ref: remove test examples

This commit is contained in:
samsonium
2026-10-25 01:56:07 +03:00
parent c4eb148d17
commit a37b8cfe6e
11 changed files with 0 additions and 207 deletions
-7
View File
@@ -1,7 +0,0 @@
printline(2 + 2 * 2);
printline(-1 + 1);
printline(2 ^ 2);
printline(1 + 1 * 1 / 1);
printline(4 % 2);
printline(10 / 2);
-46
View File
@@ -1,46 +0,0 @@
class A
{
uint some;
}
fn doSome(A a) A
{
// NOTE: section below won't change `a.some` value
if (a.some < 1)
{
a.some = 1;
return a;
}
return a;
}
fn doSomeNew() A
{
if (1 == 1)
{
return new A;
}
}
A a = new A;
a.some = 0;
if (a.some != 0)
{
printline("Test failed (first a.some != 0)");
exit(1);
}
else printline(a);
a = doSome(a);
if (a.some != 1)
{
printline("Test failed (2nd a.some != 1)");
exit(1);
}
else printline(a);
A b = doSomeNew();
printline(b);
-36
View File
@@ -1,36 +0,0 @@
class Point
{
int x;
int y;
// Move point by [dx,dy]
fn move(int dx, int dy) {
this.x = this.x + dx;
this.y = this.y + dy;
}
}
Point obj = new Point;
obj.x = 1;
obj.y = 2;
printline("Current X,Y:");
printline(obj.x);
printline(obj.y);
// NOTE: WHY THE FUCK THIS FUCKING COMPILER REQUIRES ';' AFTER '='?!
// |
// v
obj.move(9, 8);
printline("X,Y after move:");
printline(obj.x);
printline(obj.y);
if (obj.x == 10 && obj.y == 10)
printline("Test passed");
else
{
printline("Test failed");
exit(1);
}
-3
View File
@@ -1,3 +0,0 @@
// I'm a comment
printline("Comment is skipped");;;;;
-20
View File
@@ -1,20 +0,0 @@
bool flag = true;
if (!flag)
{
printline("buhhh, flag is not true");
exit(1);
}
else if (2 + 2 >= 4)
{
printline ("two plus two is four");
}
else {
printline("gotcha");
exit(1);
}
{
printline("block after");
}
-32
View File
@@ -1,32 +0,0 @@
fn fib(int n) int
{
if (n <= 1)
return n;
return fib(n - 1) + fib(n - 2);
}
fn sum(uint a, uint b) uint
{
return a + b;
}
printline("Test #1: fibonacci");
int result = fib(7);
if (result == 13)
printline("Recurse test passed");
else
{
printline("Recurse test failed");
exit(1);
}
printline("Test #2: sum");
if (sum(2, 2) == 4)
printline("Sum test passed");
else
{
printline("Sum test failed");
exit(1);
}
-2
View File
@@ -1,2 +0,0 @@
printline('hello, world');
-1
View File
@@ -1 +0,0 @@
printline("");
-1
View File
@@ -1 +0,0 @@
printline("hello);
-46
View File
@@ -1,46 +0,0 @@
class Animal
{
str type;
str name;
int age;
fn copy() Animal
{
Animal cp = new Animal;
cp.type = this.type;
cp.name = this.name;
cp.age = this.age;
return cp;
}
}
Animal a = new Animal;
a.type = "Cow";
a.name = "Buryatka";
a.age = 5;
Animal b = a.copy();
b.name = "Gavryusha";
b.age = 10;
printline(a);
printline(b);
printline("Types are same:");
printline(a.type == b.type);
printline("Names are NOT the same");
printline(a.name != b.name);
printline("1st age less than 2nd");
printline(a.age < b.age);
if (a.type == b.type && a.name != b.name && a.age < b.age)
printline("Test passed");
else
{
printline("Test failed");
exit(1);
}
-13
View File
@@ -1,13 +0,0 @@
uint work_it = 21 * 2 ^ 2;
int make_it = 10;
u64 do_it;
do_it = 15;
printline(work_it);
printline(make_it + do_it);
char make_us;
str floyd = "hello, Pink Floyd!";
printline(floyd);