mirror of
https://github.com/Smaug123/hvm
synced 2025-10-07 05:28:41 +00:00
Another test, and fix bugs
This commit is contained in:
3
Makefile
3
Makefile
@@ -5,6 +5,9 @@ HVM_SUBFOLDER=hvm
|
||||
hvm: $(HVM_SUBFOLDER)/hvm.o
|
||||
$(CC) -o hvm_execute $(HVM_SUBFOLDER)/main.c $(HVM_SUBFOLDER)/hvm.c $(CFLAGS)
|
||||
|
||||
debug: $(HVM_SUBFOLDER)/hvm.o
|
||||
$(CC) -o hvm_execute $(HVM_SUBFOLDER)/main.c $(HVM_SUBFOLDER)/hvm.c $(CFLAGS) -ggdb
|
||||
|
||||
clean:
|
||||
rm -f $(HVM_SUBFOLDER)/*.o
|
||||
|
||||
|
@@ -159,7 +159,7 @@ push (int val,
|
||||
/*
|
||||
* More storage required for the stack, since it's full at the moment
|
||||
*/
|
||||
*stack = realloc(*stack, 2*curr_allocated);
|
||||
*stack = realloc(*stack, 2*curr_allocated*sizeof(int));
|
||||
if (*stack == NULL) {
|
||||
rc = ERR_OTHER;
|
||||
}
|
||||
@@ -172,7 +172,6 @@ push (int val,
|
||||
if (rc == ERR_IS_OK) {
|
||||
(*stack)[stack_depth] = val;
|
||||
stack_depth++;
|
||||
|
||||
}
|
||||
|
||||
return (rc);
|
||||
@@ -209,6 +208,11 @@ int_geq_sizet (int a,
|
||||
result = false;
|
||||
} else if ((size_t)(a) >= b) {
|
||||
result = true;
|
||||
} else {
|
||||
/*
|
||||
* a and b are nonnegative and a < b
|
||||
*/
|
||||
result = false;
|
||||
}
|
||||
|
||||
return (result);
|
||||
|
4
test.sh
4
test.sh
@@ -2,4 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
[ $(./hvm_execute "123451^2v5:4?9p2g8pppppp" "") == "945321" ]
|
||||
[ "$(./hvm_execute "123451^2v5:4?9p2g8pppppp" "")" = "945321" ]
|
||||
[ "$(./hvm_execute "123451v2vppppp" "")" = "34521" ]
|
||||
[ "$(./hvm_execute '0924809693937820909181938+68283390909580634**+P01^:87+*g' '')" = 'Hello, Small World!' ]
|
Reference in New Issue
Block a user