From 6be608ee223b3dd515883679da53c1e3c03c7215 Mon Sep 17 00:00:00 2001 From: Adriano Meligrana <68152031+Tortar@users.noreply.github.com> Date: Sat, 28 Sep 2024 23:35:38 +0200 Subject: [PATCH] Stronger tests (#4) --- test/runtests.jl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 28b18fa..c4cc709 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,20 +3,20 @@ using Test using HybridStructs @hybrid struct A - x::Int + x::Int end abstract type AbstractB{X} end -@hybrid struct B{X} <: AbstractB{X} - x::X - y::Int - const z - B{X}(x, y) where X = new{X}(x, y, 1) - B{X}(x, y, z) where X = new{X}(x, y, z) - function B(x::X, y, z) where X - return new{X}(x, y, z) - end +@hybrid struct B{X,Y} <: AbstractB{X} + x::X + y::Y + const z + B{X,Y}(x, y) where {X,Y} = new{X,Y}(x, y, 1) + B{X,Y}(x, y, z) where {X,Y} = new{X,Y}(x, y, z) + function B(x::X, y::Y, z) where {X,Y} + return new{X,Y}(x, y, z) + end end @testset "HybridStructs.jl Tests" begin @@ -37,8 +37,8 @@ end @test AbstractB_Mut <: AbstractB b1 = B_Immut(1, 2, :im) - b2 = B_Immut{Float64}(3, 2, 4.0) - b3 = B_Mut{Int}(3, 2, 4.0) + b2 = B_Immut{Float64, Int}(3, 2, 4.0) + b3 = B_Mut{Int, Int}(3, 2, 4.0) @test b1.x === 1 @test b1 isa B_Immut{Int}