Add basic unit tests
This commit is contained in:
parent
b7f6705d62
commit
74770a7a31
1 changed files with 17 additions and 0 deletions
17
tests/integration_test.rs
Normal file
17
tests/integration_test.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use crftng_intrprtrs::run;
|
||||
use crftng_intrprtrs::interpreter::types;
|
||||
|
||||
#[test]
|
||||
fn test_one_equality() {
|
||||
run_check_result_eq_bool("1 == 1", true);
|
||||
run_check_result_eq_bool("1 >= 1", true);
|
||||
run_check_result_eq_bool("1 <= 1", true);
|
||||
run_check_result_eq_bool("1 != 1", false);
|
||||
run_check_result_eq_bool("1 > 1", false);
|
||||
run_check_result_eq_bool("1 < 1", false);
|
||||
}
|
||||
|
||||
fn run_check_result_eq_bool(code: &str, value: bool) {
|
||||
assert_eq!(run(code).unwrap(), types::Value::Primitive(types::Primitive::Bool(value)))
|
||||
|
||||
}
|
Loading…
Reference in a new issue