Added testing! call kraken like so ./kraken --test ../path/to/test/name_of_test_without_extention This will make kraken compile and run name_of_test_without_extention.krak and compare the output it generates on stdout to name_of_test_without_extention.expected_results. If they pass, then it records the pass, if not, it records the failure and saves the intermediate files generated. It has revealed some bugs which I will fix in upcoming commits.
This commit is contained in:
27
tests/memTest.krak
Normal file
27
tests/memTest.krak
Normal file
@@ -0,0 +1,27 @@
|
||||
import mem;
|
||||
import io;
|
||||
|
||||
typedef AnObject {
|
||||
int a;
|
||||
int b;
|
||||
char* c;
|
||||
|
||||
void print() {
|
||||
print(a+b);
|
||||
print("\n");
|
||||
print(c);
|
||||
print("\n");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main() {
|
||||
AnObject* ptr = new<AnObject>();
|
||||
ptr->a = 4;
|
||||
ptr->b = 7;
|
||||
ptr->c = "Hello decent memory! Quite a nice feeling\n";
|
||||
ptr->print();
|
||||
delete<AnObject>(ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user