diff test/LazyTensors/tensor_mapping_test.jl @ 712:de2df1214394 feature/selectable_tests

Split testfile for LazyTensors
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 20 Feb 2021 20:59:32 +0100
parents
children 1ba8a398af9c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/LazyTensors/tensor_mapping_test.jl	Sat Feb 20 20:59:32 2021 +0100
@@ -0,0 +1,12 @@
+using Test
+using Sbplib.LazyTensors
+
+@testset "Generic Mapping methods" begin
+    struct DummyMapping{T,R,D} <: TensorMapping{T,R,D} end
+    LazyTensors.apply(m::DummyMapping{T,R,D}, v, I::Vararg{Any,R}) where {T,R,D} = :apply
+    @test range_dim(DummyMapping{Int,2,3}()) == 2
+    @test domain_dim(DummyMapping{Int,2,3}()) == 3
+    @test apply(DummyMapping{Int,2,3}(), zeros(Int, (0,0,0)),0,0) == :apply
+    @test eltype(DummyMapping{Int,2,3}()) == Int
+    @test eltype(DummyMapping{Float64,2,3}()) == Float64
+end