From 2f64d4a8ca2babeaaaa162ca5abfc82723ff601c Mon Sep 17 00:00:00 2001 From: Xie Yuheng Date: Wed, 13 Sep 2023 09:53:00 +0800 Subject: [PATCH] test for spread --- TODO.md | 2 -- tests/builtin/spread.i | 15 +++++++++++++++ tests/builtin/spread.i.out | 3 +++ tests/datatype/DiffList.test.i | 4 ++-- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 tests/builtin/spread.i create mode 100644 tests/builtin/spread.i.out diff --git a/TODO.md b/TODO.md index 2bafb52b..0f1e7250 100644 --- a/TODO.md +++ b/TODO.md @@ -2,8 +2,6 @@ remove syntax of rearrange update docs about using `@spread` to do rearrange - - `(cons)` -- unconnected node as value -- redesign syntax of rearrange ``` diff --git a/tests/builtin/spread.i b/tests/builtin/spread.i new file mode 100644 index 00000000..a0bc804e --- /dev/null +++ b/tests/builtin/spread.i @@ -0,0 +1,15 @@ +type Nat -- @Type end +node zero -- Nat :value! end +node add1 Nat :prev -- Nat :value! end + +node add + Nat :target! + Nat :addend + -------- + Nat :return +end + +(add) @spread $target $addend $return +target @inspect +addend @inspect +return @inspect diff --git a/tests/builtin/spread.i.out b/tests/builtin/spread.i.out new file mode 100644 index 00000000..d506d143 --- /dev/null +++ b/tests/builtin/spread.i.out @@ -0,0 +1,3 @@ +net_from_port (add₀)-target! end +net_from_port (add₀)-addend end +net_from_port (add₀)-return end diff --git a/tests/datatype/DiffList.test.i b/tests/datatype/DiffList.test.i index f2f46b1c..800f462b 100644 --- a/tests/datatype/DiffList.test.i +++ b/tests/datatype/DiffList.test.i @@ -4,8 +4,8 @@ require "Trivial.i" claim one_two_soles -- Trivial DiffList end define one_two_soles - sole (cons :tail) diff @rot @rot @connect - sole (cons :tail) sole cons diff @rot @rot @connect + (diff) @spread $front sole cons front @connect + (diff) @spread $front sole cons sole cons front @connect diff_append end