view test/LazyTensors/lazy_tensor_test.jl @ 2015:5c2448d6a201 feature/grids/geometry_functions tip

Structure tests a bit more
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 09 May 2025 15:57:38 +0200
parents 471a948cd2b2
children
line wrap: on
line source

using Test
using Diffinitive.LazyTensors

@testset "Generic Mapping methods" begin
    struct DummyMapping{T,R,D} <: LazyTensor{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