Import Amiga applications and desktop tools
This commit is contained in:
commit
1c144c9a3c
347 files changed
+423483
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#include "terminal.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
static struct Terminal t;static int failures,checks;static FILE *logfile;
|
||||
#define CHECK(x) do{checks++;if(!(x)){failures++;fprintf(logfile,"FAIL line %d: %s\n",__LINE__,#x);}}while(0)
|
||||
static void feed(char*s){while(*s)term_feed(&t,(unsigned char)*s++);}
|
||||
int main(void){int i,m;unsigned long seed=0x37b5;
|
||||
logfile=fopen("PROGDIR:core-tests.log","w");if(!logfile)return 20;
|
||||
term_init(&t,0);term_feed(&t,7);CHECK(t.bell==1&&t.x==0&&t.y==0);
|
||||
term_init(&t,0);feed("\033]0;title\007");CHECK(t.bell==0);
|
||||
term_init(&t,1);term_feed(&t,7);CHECK(t.bell==1&&t.x==0&&t.y==0);
|
||||
term_init(&t,1);term_feed(&t,147);term_feed(&t,28);term_feed(&t,18);term_feed(&t,'A');
|
||||
CHECK(t.cell[0].glyph==1);CHECK(t.cell[0].fg==0&&t.cell[0].bg==2);CHECK(t.x==1&&t.y==0);
|
||||
term_feed(&t,13);CHECK(t.x==0&&t.y==1&&t.reverse==0);term_feed(&t,14);CHECK(t.charset==1);
|
||||
term_feed(&t,0xc1);CHECK(t.cell[40].glyph==65);term_feed(&t,0xff);CHECK(t.cell[41].glyph==94);
|
||||
term_feed(&t,19);term_feed(&t,148);CHECK(t.cell[0].glyph==32);term_feed(&t,20);CHECK(t.x==0&&t.y==0);
|
||||
term_init(&t,0);feed("\033[2;5HABC");CHECK(t.x==7&&t.y==1);CHECK(t.cell[84].glyph=='A');
|
||||
feed("\033[31;7mX");CHECK(t.cell[87].fg==0&&t.cell[87].bg==1);
|
||||
feed("\033[2J");CHECK(t.x==8&&t.y==1);CHECK(t.cell[87].glyph==32);
|
||||
feed("\033[H\033[0m");term_feed(&t,0xc3);term_feed(&t,0xa9);CHECK(t.cell[0].glyph==130&&t.x==1);
|
||||
term_feed(&t,0xe2);term_feed(&t,0x96);term_feed(&t,0x88);CHECK(t.cell[1].glyph==8&&t.x==2);
|
||||
term_feed(&t,0xc4);term_feed(&t,'A');CHECK(t.cell[2].glyph==0xc4&&t.cell[3].glyph=='A');
|
||||
term_init(&t,0);for(i=0;i<80;i++)term_feed(&t,'A');CHECK(t.y==0&&t.x==79&&t.pendingwrap);term_feed(&t,'B');CHECK(t.y==1&&t.x==1&&t.cell[80].glyph=='B');
|
||||
for(m=0;m<2;m++){
|
||||
term_init(&t,m);
|
||||
for(i=0;i<30000;i++){
|
||||
seed^=seed<<13;seed^=seed>>17;seed^=seed<<5;term_feed(&t,seed&255);
|
||||
if(t.x<0||t.x>=t.cols||t.y<0||t.y>=25||t.argc>16){CHECK(0);break;}
|
||||
}
|
||||
CHECK(i==30000);
|
||||
}
|
||||
fprintf(logfile,"%d checks, %d failures; 60000 fuzz bytes processed.\n",checks,failures);fclose(logfile);return failures?20:0;
|
||||
}
|
||||
Reference in new issue
Block a user