comparison test/Grids/grid_test.jl @ 1270:dcbac783e4c1 refactor/grids

Factor out functions for getting the type and number of components in a type
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 25 Feb 2023 22:42:16 +0100
parents 20f42cf0800c
children 3637daad71e8
comparison
equal deleted inserted replaced
1269:20f42cf0800c 1270:dcbac783e4c1
43 end 43 end
44 44
45 @testset "getcomponent" begin 45 @testset "getcomponent" begin
46 @test_broken false 46 @test_broken false
47 end 47 end
48
49 @testset "_ncomponents" begin
50 @test Grids._ncomponents(Int) == 1
51 @test Grids._ncomponents(Float64) == 1
52 @test Grids._ncomponents(Rational) == 1
53
54 @test Grids._ncomponents(SVector{3,Int}) == 3
55 @test Grids._ncomponents(SVector{2,Float64}) == 2
56 @test Grids._ncomponents(SVector{4,Rational}) == 4
57 end
58
59 @testset "_component_type" begin
60 @test Grids._component_type(Int) == Int
61 @test Grids._component_type(Float64) == Float64
62 @test Grids._component_type(Rational) == Rational
63
64 @test Grids._component_type(SVector{3,Int}) == Int
65 @test Grids._component_type(SVector{2,Float64}) == Float64
66 @test Grids._component_type(SVector{4,Rational}) == Rational
67 end