From ac67b1ea1b870d225e641ae3f4095ebc4c485768 Mon Sep 17 00:00:00 2001 From: krischerven <50562493+krischerven@users.noreply.github.com> Date: Mon, 13 Apr 2020 10:44:21 -0400 Subject: [PATCH] tests: add new type alias syntax tests --- vlib/v/tests/type_alias_test.v | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/vlib/v/tests/type_alias_test.v b/vlib/v/tests/type_alias_test.v index db772eef72..14076ab3e4 100644 --- a/vlib/v/tests/type_alias_test.v +++ b/vlib/v/tests/type_alias_test.v @@ -5,6 +5,21 @@ type Myf64 f64 fn test_type_alias() { i := Myint(10) assert i + 100 == 110 - f := Myf64(10.4) - assert f + 0.5 == 10.9 + f := Myf32(7.4) + assert f + f32(0.6) == f32(8.0) + g := Myf64(10.4) + assert g + 0.5 == 10.9 +} + +type Myint_2 = int +type Myf32_2 = f32 +type Myf64_2 = f64 + +fn test_type_alias_v2() { + i := Myint_2(10) + assert i + 100 == 110 + f := Myf32_2(7.4) + assert f + f32(0.6) == f32(8.0) + g := Myf64_2(10.4) + assert g + 0.5 == 10.9 }