Skip to content

Commit

Permalink
Split unit tests.
Browse files Browse the repository at this point in the history
Remove expr.c and add string.c and command.c.
  • Loading branch information
BYVoid committed Oct 20, 2013
1 parent e6e44fc commit 370767b
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 36 deletions.
6 changes: 4 additions & 2 deletions src/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,22 @@ let test_cases = "Batsh Unit Tests" >::: [
"[Bash]Arith" >:: test "arith" test_bash;
"[Bash]Assignment" >:: test "assignment" test_bash;
"[Bash]Array" >:: test "array" test_bash;
"[Bash]Expressions" >:: test "expr" test_bash;
"[Bash]String" >:: test "string" test_bash;
"[Bash]If" >:: test "if" test_bash;
"[Bash]While" >:: test "while" test_bash;
"[Bash]Function" >:: test "function" test_bash;
"[Bash]Recursion" >:: test "recursion" test_bash;
"[Bash]Command" >:: test "command" test_bash;
"[Winbat]Block" >:: test "block" test_winbat;
"[Winbat]Arith" >:: test "arith" test_winbat;
"[Winbat]Assignment" >:: test "assignment" test_winbat;
(* "[Winbat]Array" >:: test "array" test_winbat; *)
(* "[Winbat]Expressions" >:: test "expr" test_winbat; *)
"[Winbat]String" >:: test "string" test_winbat;
"[Winbat]If" >:: test "if" test_winbat;
"[Winbat]While" >:: test "while" test_winbat;
"[Winbat]Function" >:: test "function" test_winbat;
"[Winbat]Recursion" >:: test "recursion" test_winbat;
(* "[Winbat]Command" >:: test "command" test_winbat; *)
]

let _ =
Expand Down
6 changes: 6 additions & 0 deletions tests/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ a[0] = 2 * 9;
a[2] = "abx";
a[5] = "5" ++ a[0];
println(a[0], a[1], a[2], a[3], a[4], a[5]);
a = [1, 2, 3];
println(a[0], a[1], a[2]);
println(("10" ++ a[0]) * 2);
println(len(a));
println(len(a) * 8);
//println([1, 2, 3]);
4 changes: 4 additions & 0 deletions tests/command.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
call("println", "Println Called");
cmd = "ec" ++ "ho";
call(cmd, "Echo Called");
println(expr(36, "+", 6));
18 changes: 0 additions & 18 deletions tests/expr.c

This file was deleted.

4 changes: 4 additions & 0 deletions tests/output/array.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
18 y abx 1 518
1 2 3
202
3
24
3 changes: 3 additions & 0 deletions tests/output/command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Println Called
Echo Called
42
16 changes: 0 additions & 16 deletions tests/output/expr.txt

This file was deleted.

11 changes: 11 additions & 0 deletions tests/output/string.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BYVoid
Slash/
Backslash\
Quote"'
Tab Tab
http://www.byvoid.com
3BYVoid8
6
62
35
1
13 changes: 13 additions & 0 deletions tests/string.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
println("BYVoid");
println("Slash/");
println("Backslash\\");
println("Quote\"'");
println("Tab\tTab");
//println("Newline\nLine2");
//println("!");
println("http://" ++ "www." ++ ("byvoid" ++ ".com"));
println(6 / 2 ++ "BYVoid" ++ 3 + 5);
println(3 + "3");
println(3 + "3" ++ "2");
println(3 + ("3" ++ "2"));
println("BYVoid" == "BYVoid");

0 comments on commit 370767b

Please sign in to comment.