Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
NeilBaner committed Apr 11, 2023
1 parent fabb706 commit 8ab9524
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/interpreter/new_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl Heap {

#[test]
fn check_heap_integer() {
let mut heap = Heap::new();
let mut heap = Heap::new(false);
heap.clear_heap();
let ptr = heap.push_integer(35);
let value = heap.get_integer(ptr);
Expand All @@ -279,7 +279,7 @@ fn check_heap_integer() {

#[test]
fn check_heap_bool() {
let mut heap = Heap::new();
let mut heap = Heap::new(false);
heap.clear_heap();
let ptr = heap.push_boolean(true);
let value = heap.get_boolean(ptr);
Expand All @@ -288,7 +288,7 @@ fn check_heap_bool() {

#[test]
fn check_push() {
let mut heap = Heap::new();
let mut heap = Heap::new(false);
heap.clear_heap();
let int_ptr_1 = heap.heap_push(Literal::IntLiteral(69));
let bool_ptr_1 = heap.heap_push(Literal::BoolLiteral(false));
Expand Down Expand Up @@ -324,7 +324,7 @@ fn check_push() {

#[test]
fn check_heap_resize() {
let mut heap = Heap::new();
let mut heap = Heap::new(false);
heap.clear_heap();
for i in 1..HEAP_INIT_SIZE * 4 {
let ptr = heap.push_integer(i as u64);
Expand All @@ -337,7 +337,7 @@ fn check_heap_resize() {

#[test]
fn check_concat() {
let mut heap = Heap::new();
let mut heap = Heap::new(false);
heap.clear_heap();
let string_a_ptr = heap.push_string(String::from("cyka"));
let string_b_ptr = heap.push_string(String::from(" blyat"));
Expand All @@ -355,7 +355,7 @@ fn check_concat() {

#[test]
fn check_free() {
let mut heap = Heap::new();
let mut heap = Heap::new(false);
heap.clear_heap();
let ptr1 = heap.push_integer(10);
let ptr2 = heap.push_integer(20);
Expand Down
8 changes: 4 additions & 4 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn test_primitive_values() {
let source = fs::read_to_string("examples/primitive_value_example.rs").expect("Unable to read file");
println!("Parsing...\n");
let mut ast = parser::parse(&source).expect("Failed to parse given program");
interpreter::run(&mut ast);
interpreter::run(&mut ast, DEBUG_MODE);
}


Expand Down Expand Up @@ -91,7 +91,7 @@ fn test_block_expression_with_primitive_op() {
let source = fs::read_to_string("examples/block_expression_primitive_op.rs").expect("Unable to read file");
println!("Parsing...\n");
let mut ast = parser::parse(&source).expect("Failed to parse given program");
interpreter::run(&mut ast);
interpreter::run(&mut ast, DEBUG_MODE);
}

#[test]
Expand Down Expand Up @@ -123,7 +123,7 @@ fn test_function_return_nested_vs_normal() {
let source = fs::read_to_string("examples/function_application_nested_vs_normal.rs").expect("Unable to read file");
println!("Parsing...\n");
let mut ast = parser::parse(&source).expect("Failed to parse given program");
interpreter::run(&mut ast);
interpreter::run(&mut ast, DEBUG_MODE);
}

#[test]
Expand Down Expand Up @@ -166,7 +166,7 @@ fn test_control_flow_fizzbuzz() {
let source = fs::read_to_string("examples/control_flow_fizzbuzz.rs").expect("Unable to read file");
println!("Parsing...\n");
let mut ast = parser::parse(&source).expect("Failed to parse given program");
interpreter::run(&mut ast);
interpreter::run(&mut ast, DEBUG_MODE);
}

#[test]
Expand Down

0 comments on commit 8ab9524

Please sign in to comment.