diff --git a/examples/acceptance_tests/105/aiken.lock b/examples/acceptance_tests/105/aiken.lock new file mode 100644 index 00000000..6e350cda --- /dev/null +++ b/examples/acceptance_tests/105/aiken.lock @@ -0,0 +1,7 @@ +# This file was generated by Aiken +# You typically do not need to edit this file + +requirements = [] +packages = [] + +[etags] diff --git a/examples/acceptance_tests/105/aiken.toml b/examples/acceptance_tests/105/aiken.toml new file mode 100644 index 00000000..c7fec73f --- /dev/null +++ b/examples/acceptance_tests/105/aiken.toml @@ -0,0 +1,9 @@ +name = "aiken-lang/105" +version = "0.0.0" +license = "Apache-2.0" +description = "Aiken contracts for project 'aiken-lang/102'" + +[repository] +user = "aiken-lang" +project = "105" +platform = "github" diff --git a/examples/acceptance_tests/105/lib/tests.ak b/examples/acceptance_tests/105/lib/tests.ak new file mode 100644 index 00000000..7e6f26ee --- /dev/null +++ b/examples/acceptance_tests/105/lib/tests.ak @@ -0,0 +1,45 @@ +pub type Foo { + a: Int, +} + +pub type Bar { + Bazz(Int) + Buzz(Int) +} + +test if_soft_cast() { + let d: Data = Foo { a: 1 } + + if d is Foo { + d.a == 1 + } else { + False + } +} + +test if_soft_cast_2() { + let d: Data = Bazz(1) + + if d is Foo { + d.a == 1 + } else if d is Bazz(y): Bar { + y == 1 + } else { + False + } +} + +test if_soft_cast_3() { + let d: Data = Bazz(1) + let x: Data = Buzz(2) + + if d is Foo { + d.a == 1 + } else if d is Bazz(y): Bar { + y == 1 + } else if x is Buzz(y): Bar { + y == 2 + } else { + False + } +}