From 5b9de776ba7de654fa92bee7c38fb30d7929405d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edvard=20Th=C3=B6rnros?= Date: Mon, 1 Feb 2021 21:57:54 +0100 Subject: .tdy -> .sy and tests -> progs/tests --- progs/tests/faulty.sy | 3 +++ progs/tests/fib.sy | 9 +++++++++ progs/tests/for.sy | 19 +++++++++++++++++++ progs/tests/scoping.sy | 13 +++++++++++++ progs/tests/simple.sy | 2 ++ progs/tests/unreachable.sy | 1 + src/lib.rs | 4 ++-- src/main.rs | 2 +- tests/faulty.tdy | 3 --- tests/fib.tdy | 9 --------- tests/for.tdy | 19 ------------------- tests/scoping.tdy | 13 ------------- tests/simple.tdy | 2 -- tests/unreachable.tdy | 1 - 14 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 progs/tests/faulty.sy create mode 100644 progs/tests/fib.sy create mode 100644 progs/tests/for.sy create mode 100644 progs/tests/scoping.sy create mode 100644 progs/tests/simple.sy create mode 100644 progs/tests/unreachable.sy delete mode 100644 tests/faulty.tdy delete mode 100644 tests/fib.tdy delete mode 100644 tests/for.tdy delete mode 100644 tests/scoping.tdy delete mode 100644 tests/simple.tdy delete mode 100644 tests/unreachable.tdy diff --git a/progs/tests/faulty.sy b/progs/tests/faulty.sy new file mode 100644 index 0000000..369b8ff --- /dev/null +++ b/progs/tests/faulty.sy @@ -0,0 +1,3 @@ +asdflökja;;;; +123 +asd diff --git a/progs/tests/fib.sy b/progs/tests/fib.sy new file mode 100644 index 0000000..1dde6a8 --- /dev/null +++ b/progs/tests/fib.sy @@ -0,0 +1,9 @@ +a := 0 +b := 1 + +for i := 0, i < 90, i = i + 1 { + c := a + a = b + b = c + b +} +a <=> 2880067194370816120 diff --git a/progs/tests/for.sy b/progs/tests/for.sy new file mode 100644 index 0000000..a9f8cd2 --- /dev/null +++ b/progs/tests/for.sy @@ -0,0 +1,19 @@ +a := 0 +for i := 0, i < 3, i = i + 1 { + a = a + i +} +a <=> 3 + +a = 0 +for i := 0, i <= 3, i = i + 1 { + a = a + i +} +a <=> 6 + +a = 0 +for i := 0, i < 3, i = i + 1 { + for j := 0, j < 3, j = j + 1 { + a = a + i * j + } +} +a <=> 9 diff --git a/progs/tests/scoping.sy b/progs/tests/scoping.sy new file mode 100644 index 0000000..7679948 --- /dev/null +++ b/progs/tests/scoping.sy @@ -0,0 +1,13 @@ +a : int = 1 +{ + a <=> 1 + a : int = a + a + a <=> 2 +} +a <=> 1 + +{ + a = 2 + a : int = 1 +} +a <=> 2 diff --git a/progs/tests/simple.sy b/progs/tests/simple.sy new file mode 100644 index 0000000..12a43c0 --- /dev/null +++ b/progs/tests/simple.sy @@ -0,0 +1,2 @@ +print extern_test(3.0) +print extern_test(3.0, 4.0, 5.0) diff --git a/progs/tests/unreachable.sy b/progs/tests/unreachable.sy new file mode 100644 index 0000000..f016a14 --- /dev/null +++ b/progs/tests/unreachable.sy @@ -0,0 +1 @@ + diff --git a/src/lib.rs b/src/lib.rs index 336a7e2..62a2a81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -331,8 +331,8 @@ a() <=> 4 more_types: "a: (str, bool, int) = (\"abc\", true, 1)", ); - test_file!(scoping, "tests/scoping.tdy"); - test_file!(for_, "tests/for.tdy"); + test_file!(scoping, "progs/tests/scoping.sy"); + test_file!(for_, "progs/tests/for.sy"); test_multiple!( op_assign, diff --git a/src/main.rs b/src/main.rs index 37ae256..bc68d40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ struct Args { fn main() { let args = parse_args(); - let file = args.file.unwrap_or_else(|| Path::new("tests/simple.tdy").to_owned()); + let file = args.file.unwrap_or_else(|| Path::new("progs/tests/simple.sy").to_owned()); let errs = match run_file(&file, args.print, vec![(String::from("extern_test"), extern_test)]) { Err(it) => it, _ => return, diff --git a/tests/faulty.tdy b/tests/faulty.tdy deleted file mode 100644 index 369b8ff..0000000 --- a/tests/faulty.tdy +++ /dev/null @@ -1,3 +0,0 @@ -asdflökja;;;; -123 -asd diff --git a/tests/fib.tdy b/tests/fib.tdy deleted file mode 100644 index 1dde6a8..0000000 --- a/tests/fib.tdy +++ /dev/null @@ -1,9 +0,0 @@ -a := 0 -b := 1 - -for i := 0, i < 90, i = i + 1 { - c := a - a = b - b = c + b -} -a <=> 2880067194370816120 diff --git a/tests/for.tdy b/tests/for.tdy deleted file mode 100644 index a9f8cd2..0000000 --- a/tests/for.tdy +++ /dev/null @@ -1,19 +0,0 @@ -a := 0 -for i := 0, i < 3, i = i + 1 { - a = a + i -} -a <=> 3 - -a = 0 -for i := 0, i <= 3, i = i + 1 { - a = a + i -} -a <=> 6 - -a = 0 -for i := 0, i < 3, i = i + 1 { - for j := 0, j < 3, j = j + 1 { - a = a + i * j - } -} -a <=> 9 diff --git a/tests/scoping.tdy b/tests/scoping.tdy deleted file mode 100644 index 7679948..0000000 --- a/tests/scoping.tdy +++ /dev/null @@ -1,13 +0,0 @@ -a : int = 1 -{ - a <=> 1 - a : int = a + a - a <=> 2 -} -a <=> 1 - -{ - a = 2 - a : int = 1 -} -a <=> 2 diff --git a/tests/simple.tdy b/tests/simple.tdy deleted file mode 100644 index 12a43c0..0000000 --- a/tests/simple.tdy +++ /dev/null @@ -1,2 +0,0 @@ -print extern_test(3.0) -print extern_test(3.0, 4.0, 5.0) diff --git a/tests/unreachable.tdy b/tests/unreachable.tdy deleted file mode 100644 index f016a14..0000000 --- a/tests/unreachable.tdy +++ /dev/null @@ -1 +0,0 @@ - -- cgit v1.2.1