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:
Nathan Braswell
2014-05-20 22:21:07 -04:00
parent 39f945940d
commit 2566cbb67c
26 changed files with 430 additions and 2 deletions

52
tests/templateTest.krak Normal file
View File

@@ -0,0 +1,52 @@
import io;
import trivial_container;
typedef template <T> TemplateTest {
int a;
T b;
trivialContainer<T> c;
void print() {
print("a: ");
print(a);
print("\n");
print("b: ");
print(b);
print("\n");
c.print();
print("\n");
}
};
typedef MyInt int;
MyInt c;
template <T> T addAndPrint(T a, T b) {
print(a+b);
return a+b;
}
int main() {
TemplateTest<int> test;
TemplateTest<char*> test2;
test.a = 5;
test.b = 7;
test.c.data = 1337;
test2.a = 9;
test2.b = "Hello Templates!";
test2.c.data = "Woooo nesting!";
test.print();
test2.print();
trivialContainer<char*> testImport;
testImport.data = "From another file! Whoh!";
testImport.print();
print("\n");
print(addAndPrint<int>(7,12));
print("\n");
return 0;
}