Permalink
Browse files

Modified test scripts to use __initHeap

  • Loading branch information...
1 parent 3973a79 commit db58dfea6f2ff688e93e7695dcbe110d3b7ec500 @Gabriano Gabriano committed May 1, 2012
Showing with 26 additions and 24 deletions.
  1. +24 −23 src/backend/test_gc.c
  2. +2 −1 src/backend/test_primitives.c
View
47 src/backend/test_gc.c
@@ -13,39 +13,40 @@ char *line = "==================================================================
int main(void)
{
- allocByteField(getHeap(), __PAIRSIZE__);
+ __initHeap(_A_(0));
+ /* allocByteField(getHeap(), __PAIRSIZE__); */
/* dumpWord(getHeap(), (__WORD__)__TRUE__); printf("\n"); */
/* dumpWord(getHeap(), (__WORD__)__FALSE__); printf("\n"); */
/* dumpWord(getHeap(), (__WORD__)__NULL__); printf("\n"); */
- dumpWord(getHeap(), __add(_A2_, __boxint(_A1_, 3), __boxint(_A1_, 4))); printf("\n");
+ dumpWord(getHeap(), __add(_A_(2), __boxint(_A_(1), 3), __boxint(_A_(1), 4))); printf("\n");
__VAR__ p1;
p1 = allocVar();
printf(line);
printf("Only 1 boxint var. Heap should be empty before and after gc:\n");
- setVar(p1, __boxint(_A1_, 42));
+ setVar(p1, __boxint(_A_(1), 42));
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
printf(line);
printf("Only 1 boxpair var. Heap should contain the pair before and after gc:\n");
- setVar(p1, __cons(_A2_, __boxint(_A1_, 3), __boxint(_A1_, 4)));
+ setVar(p1, __cons(_A_(2), __boxint(_A_(1), 3), __boxint(_A_(1), 4)));
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
printf(line);
printf("Only 1 boxpair var but 2 more pairs created. Heap should contain 3 pairs before and 1 after gc:\n");
- setVar(p1, __cons(_A2_, __boxint(_A1_, 5), __boxint(_A1_, 6)));
- setVar(p1, __cons(_A2_, __boxint(_A1_, 7), __boxint(_A1_, 8)));
+ setVar(p1, __cons(_A_(2), __boxint(_A_(1), 5), __boxint(_A_(1), 6)));
+ setVar(p1, __cons(_A_(2), __boxint(_A_(1), 7), __boxint(_A_(1), 8)));
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
@@ -55,22 +56,22 @@ int main(void)
p2 = allocVar();
p3 = allocVar();
- setVar(p1, __cons(_A2_, __boxint(_A1_, 3), __boxint(_A1_, 4)));
- setVar(p2, __cons(_A2_, __boxint(_A1_, 5), __boxint(_A1_, 6)));
- setVar(p3, __cons(_A2_, __boxint(_A1_, 7), __boxint(_A1_, 8)));
+ setVar(p1, __cons(_A_(2), __boxint(_A_(1), 3), __boxint(_A_(1), 4)));
+ setVar(p2, __cons(_A_(2), __boxint(_A_(1), 5), __boxint(_A_(1), 6)));
+ setVar(p3, __cons(_A_(2), __boxint(_A_(1), 7), __boxint(_A_(1), 8)));
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
printf(line);
printf("3 vars. p1 == pair; p2 == vector; p3 == string. Heap should contain 5 pairs before and 3 after gc:\n");
setVar(p3, __string("**Variable p3**"));
- setVar(p2, __vector(_A1_, __boxint(_A1_, 12)));
+ setVar(p2, __vector(_A_(1), __boxint(_A_(1), 12)));
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
@@ -81,7 +82,7 @@ int main(void)
setVar(p3, __NULL__);
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
@@ -92,15 +93,15 @@ int main(void)
printf("p1[1] <= p2\n");
printf("p2 <= cons(5, 6)\n");
printf("p3 <= vector(5)\n");
- setVar(p1, __vector(_A1_, __boxint(_A1_, 3)));
- __vectorSet(_A2_, getVar(p1), __boxint(_A1_, 0), __string("Allo"));
- setVar(p2, __cons(_A2_, __boxint(_A1_, 10), __boxint(_A1_, 11)));
- __vectorSet(_A2_, getVar(p1), __boxint(_A1_, 1), getVar(p2));
- setVar(p2, __cons(_A2_, __boxint(_A1_, 5), __boxint(_A1_, 6)));
- setVar(p3, __vector(_A1_, __boxint(_A1_, 5)));
+ setVar(p1, __vector(_A_(1), __boxint(_A_(1), 3)));
+ __vectorSet(_A_(2), getVar(p1), __boxint(_A_(1), 0), __string("Allo"));
+ setVar(p2, __cons(_A_(2), __boxint(_A_(1), 10), __boxint(_A_(1), 11)));
+ __vectorSet(_A_(2), getVar(p1), __boxint(_A_(1), 1), getVar(p2));
+ setVar(p2, __cons(_A_(2), __boxint(_A_(1), 5), __boxint(_A_(1), 6)));
+ setVar(p3, __vector(_A_(1), __boxint(_A_(1), 5)));
dumpByteField(getHeap());
- __gc(getHeap(), getNewHeap());
+ gc_run(getHeap(), getNewHeap());
dumpByteField(getHeap());
printf(line);
View
3 src/backend/test_primitives.c
@@ -10,7 +10,8 @@
int main(void)
{
- allocByteField(getHeap(), __PAIRSIZE__);
+ __initHeap(_A_(0));
+ /* allocByteField(getHeap(), __PAIRSIZE__); */
__newline(_A_(0)); __display(_A_(1), __string("** Pair **")); __newline(_A_(0));

0 comments on commit db58dfe

Please sign in to comment.