added a bunch of tests

This commit is contained in:
zombie maniac 2022-04-09 15:05:23 -04:00
parent 2486e1dd42
commit bc83b32ed4
Signed by: nbrooks211
GPG key ID: F43C85C0DF0C334E
9 changed files with 118 additions and 0 deletions

BIN
a.out

Binary file not shown.

11
asmtest.c Normal file
View file

@ -0,0 +1,11 @@
#include <stdio.h> //printf and shit
int main(){
printf("asd");
asm volatile (
"mov $60, %rax\n"
"mov $1, %edi\n"
"syscall"
);
return 0;
}

7
escapetest.c Normal file
View file

@ -0,0 +1,7 @@
#include <stdio.h> //printf and shit
int main(){
printf("\e[10;2Hcum");
return 0;
}

12
functionordertest.c Normal file
View file

@ -0,0 +1,12 @@
#include <stdio.h> //printf and shit
#include <math.h>
int fuck(int asd) {
return asd;
}
int main(){
int n = 0;
printf("%d %d\n", ++n, fuck(n)); //this is bad and shouldnt compile
return 0;
}

7
inputtest.c Normal file
View file

@ -0,0 +1,7 @@
#include <stdio.h> //printf and shit
int main(){
putchar(getchar());
printf("cum");
return 0;
}

8
modfloat.c Normal file
View file

@ -0,0 +1,8 @@
#include <stdio.h> //printf and shit
float x = 2.0;
float modded;
int main(){
printf("asd %f", x);
modded = x % 2.0;
return 0;
}

32
nostdlib.c Normal file
View file

@ -0,0 +1,32 @@
char *dicks = "good bye world\n";
//totally not stolen
long unsigned int strlen(const char *str) {
long unsigned int len = 0;
while(str[len]) len++;
return len;
}
int puts(const char *aids) {
long unsigned int stringlength = strlen(dicks);
asm volatile (
"mov $1, %%rdi\n"
"mov $1, %%rax\n"
"syscall" :: "S"(aids), "d"(stringlength)
);
return 1;
}
void _start(){
puts(dicks);
asm volatile (
"mov $60, %rax\n"
"mov $1, %rdi\n"
"syscall"
);
}

8
tcctest.c Executable file
View file

@ -0,0 +1,8 @@
#!/bin/tcc -run
#include <stdio.h> //printf and shit
int main(){
printf("asd");
return 0;
}

33
timingtest.c Normal file
View file

@ -0,0 +1,33 @@
#include <stdio.h> //printf and shit
#include <time.h>
int main( int argc, char *argv[] ) { //yoinked from the internet argc is number of args and argv is a "array of arguments"
clock_t prevtime, currenttime;
prevtime = clock();
int delay = 20000;
int gamerun = 1;
while(gamerun) {
currenttime = clock();
if ((currenttime - prevtime) > delay) {
puts("this should only print every second");
if ((currenttime - prevtime) > 100000) {
puts("this should happen every 2 seconds");
}
prevtime = currenttime;
}
}
printf("Args %d",argc); //anti Wall Werror Wextra
puts(argv[0]);//anti Wall Werror Wextra
return 0;
}