WIP: Fixed print bug, tests incomplete, read more

I was sidetracked by a strange display bug - turns out it was caused by
pointers - this commit fixes it.

The tests for if-then-else still aren't finished, but I'm knocking off
as it's past my time limit. I've marked 'TODO' and 'URGENT' using
comments, so finding the issues should be easy.
This commit is contained in:
2024-11-22 18:21:47 +11:00
parent b29a87840d
commit 7d4ea4881f
3 changed files with 20 additions and 20 deletions

View File

@@ -654,7 +654,7 @@ int test_string_equality() {
Toy_Bucket* bucket = Toy_allocateBucket(1024);
Toy_String* helloWorldOne = Toy_createNameStringLength(&bucket, "Hello world", strlen("Hello world"), TOY_VALUE_UNKNOWN, false);
Toy_String* helloWorldTwo = Toy_createNameStringLength(&bucket, "Hello world", strlen("Hello world"), TOY_VALUE_UNKNOWN, false);
Toy_String* helloEveryone = Toy_createNameStringLength(&bucket, "Hello everyone", strlen("Hello everyone"), TOY_VALUE_UNKNOWN, false); //TODO: compare types?
Toy_String* helloEveryone = Toy_createNameStringLength(&bucket, "Hello everyone", strlen("Hello everyone"), TOY_VALUE_UNKNOWN, false);
int result = 0; //for print the errors

View File

@@ -1,26 +1,26 @@
//literals
if (true) {
print "Success";
print "Success 1";
}
else {
print "Failure";
print "Failure 1";
}
//false literals
if (false) {
print "Failure";
print "Failure 2";
}
else {
print "Success";
print "Success 2";
}
//conditionals
if (1 < 2) {
print "Success";
print "Success 3";
}
if (1 > 2) {
print "Failure";
print "Failure 3";
}
@@ -28,39 +28,39 @@ if (1 > 2) {
var a = 42;
if (a) {
print "Success";
print "Success 4";
}
else {
print "Failure";
print "Failure 4";
}
if (a == 42) {
print "Success";
print "Success 5";
}
else {
print "Failure";
print "Failure 5";
}
//concatenated strings
if ("foo" .. "bar" == "foobar") {
print "Success";
print "Success 6";
}
else {
print "Failure";
print "Failure 6";
}
if ("foobar" == "foo" .. "bar") {
print "Success";
print "Success 7";
}
else {
print "Failure";
print "Failure 7";
}
if ("fizz" .. "le" == "fi" .. "zzle") {
print "Success";
print "Success 8";
}
else {
print "Failure";
}
print "Failure 8";
}