mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Moved tests from scripts/ to test/scripts/
This commit is contained in:
@@ -97,7 +97,7 @@ void error(char* msg) {
|
|||||||
int main() {
|
int main() {
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
char* source = readFile("../scripts//test/call-from-host.toy", &size);
|
char* source = readFile("scripts/call-from-host.toy", &size);
|
||||||
unsigned char* tb = compileString(source, &size);
|
unsigned char* tb = compileString(source, &size);
|
||||||
free((void*)source);
|
free((void*)source);
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ int main() {
|
|||||||
{
|
{
|
||||||
//source
|
//source
|
||||||
size_t sourceLength = 0;
|
size_t sourceLength = 0;
|
||||||
char* source = readFile("../scripts/test/sample_code.toy", &sourceLength);
|
char* source = readFile("scripts/sample_code.toy", &sourceLength);
|
||||||
|
|
||||||
//test basic compilation & collation
|
//test basic compilation & collation
|
||||||
Lexer lexer;
|
Lexer lexer;
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
//run each file in ../scripts/test/
|
//run each file in tests/scripts/
|
||||||
char* filenames[] = {
|
char* filenames[] = {
|
||||||
"arithmetic.toy",
|
"arithmetic.toy",
|
||||||
"casting.toy",
|
"casting.toy",
|
||||||
@@ -206,7 +206,7 @@ int main() {
|
|||||||
printf("Running %s\n", filenames[i]);
|
printf("Running %s\n", filenames[i]);
|
||||||
|
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
snprintf(buffer, 128, "../scripts/test/%s", filenames[i]);
|
snprintf(buffer, 128, "scripts/%s", filenames[i]);
|
||||||
|
|
||||||
runSourceFile(buffer);
|
runSourceFile(buffer);
|
||||||
}
|
}
|
||||||
@@ -216,8 +216,8 @@ int main() {
|
|||||||
//read source
|
//read source
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
size_t exportSize, importSize;
|
size_t exportSize, importSize;
|
||||||
char* exportSource = readFile("../scripts/test/separate-exports.toy", &dummy);
|
char* exportSource = readFile("scripts/separate-exports.toy", &dummy);
|
||||||
char* importSource = readFile("../scripts/test/separate-imports.toy", &dummy);
|
char* importSource = readFile("scripts/separate-imports.toy", &dummy);
|
||||||
|
|
||||||
//compile
|
//compile
|
||||||
unsigned char* exportBinary = compileString(exportSource, &exportSize);
|
unsigned char* exportBinary = compileString(exportSource, &exportSize);
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ typedef struct Payload {
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
{
|
{
|
||||||
//run each file in ../scripts/test/
|
//run each file in test/scripts
|
||||||
Payload payloads[] = {
|
Payload payloads[] = {
|
||||||
{"interactions.toy", "standard", hookStandard}, //interactions needs standard
|
{"interactions.toy", "standard", hookStandard}, //interactions needs standard
|
||||||
{"standard.toy", "standard", hookStandard},
|
{"standard.toy", "standard", hookStandard},
|
||||||
@@ -140,7 +140,7 @@ int main() {
|
|||||||
printf("Running %s\n", payloads[i].fname);
|
printf("Running %s\n", payloads[i].fname);
|
||||||
|
|
||||||
char fname[128];
|
char fname[128];
|
||||||
snprintf(fname, 128, "../scripts/test/lib/%s", payloads[i].fname);
|
snprintf(fname, 128, "scripts/lib/%s", payloads[i].fname);
|
||||||
|
|
||||||
//compile the source
|
//compile the source
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ static int consume(Interpreter* interpreter, LiteralArray* arguments) {
|
|||||||
int main() {
|
int main() {
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
char* source = readFile("../scripts/test/opaque-data-type.toy", &size);
|
char* source = readFile("scripts/opaque-data-type.toy", &size);
|
||||||
unsigned char* tb = compileString(source, &size);
|
unsigned char* tb = compileString(source, &size);
|
||||||
free((void*)source);
|
free((void*)source);
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ int main() {
|
|||||||
{
|
{
|
||||||
//get the source file
|
//get the source file
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
char* source = readFile("../scripts/test/sample_code.toy", &size);
|
char* source = readFile("scripts/sample_code.toy", &size);
|
||||||
|
|
||||||
//test parsing a chunk of junk (valgrind will find leaks)
|
//test parsing a chunk of junk (valgrind will find leaks)
|
||||||
Lexer lexer;
|
Lexer lexer;
|
||||||
|
|||||||
Reference in New Issue
Block a user