Skip to content

Commit

Permalink
Done!
Browse files Browse the repository at this point in the history
  • Loading branch information
ndanevski1 committed Feb 10, 2020
1 parent 0199289 commit 7848cbf
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 5 deletions.
1 change: 0 additions & 1 deletion tests/inputs/input_rec_c.txt

This file was deleted.

12 changes: 12 additions & 0 deletions tests/inputs/input_rec_c_factorial.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
recC("S",
"num",
numT,
numT,
ifC(eqC(idC("num"),numC(1)),
numC(1),
multC(idC("num"),
appC(idC("S"), plusC(idC("num"), numC(-1)))
)
),
appC(idC("S"), numC(5))
)
12 changes: 12 additions & 0 deletions tests/inputs/input_rec_c_fail.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
recC("S",
"num",
numT,
numT,
ifC(eqC(idC("num"),numC(0)),
numC(0),
plusC(idC("num"),
appC(idC("S"), plusC(idC("num"), numC(-1)))
)
),
appC(idC("S"), trueC)
)
12 changes: 12 additions & 0 deletions tests/inputs/input_rec_c_sumation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
recC("S",
"num",
numT,
numT,
ifC(eqC(idC("num"),numC(0)),
numC(0),
plusC(idC("num"),
appC(idC("S"), plusC(idC("num"), numC(-1)))
)
),
appC(idC("S"), numC(10))
)
25 changes: 21 additions & 4 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,26 @@ fn type_check_input_super() {
}

#[test]
fn type_check_input_rec_c() {
fn type_check_input_rec_c_sumation() {
assert_eq!(
tc200::type_check("tests/inputs/input_rec_c.txt"),
Type::BoolT
tc200::type_check("tests/inputs/input_rec_c_sumation.txt"),
Type::NumT
);
}

#[test]
#[should_panic]
fn type_check_input_rec_c_fail() {
tc200::type_check("tests/inputs/input_rec_c_fail.txt");
}

#[test]
fn type_check_input_rec_c_factorial() {
assert_eq!(
tc200::type_check("tests/inputs/input_rec_c_factorial.txt"),
Type::NumT
);
}
}



0 comments on commit 7848cbf

Please sign in to comment.