duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

cc.fs (2977B) - raw


      1 ?f<< tests/harness.fs
      2 ?f<< comp/c/cc.fs
      3 1 to _ccdebug
      4 testbegin
      5 \ Tests for the C compiler
      6 cc<< tests/comp/c/test.c
      7 retconst 42 #eq
      8 variables 82 #eq
      9 negate -42 #eq
     10 bwnot $ffffffd5 #eq
     11 exprbinops 7 #eq
     12 binopand 42 #eq
     13 binopor 42 #eq
     14 binopxor 42 #eq
     15 binopshl 336 #eq
     16 binopshr 10 #eq
     17 binopdiv 14 #eq
     18 binopmod 1 #eq
     19 1 binopcondeval 42 #eq
     20 0 binopcondeval 12 #eq
     21 assignops 83 #eq
     22 boolops 0 #eq
     23 funcall 42 #eq
     24 42 pushpop 42 #eq
     25 42 plusone 43 #eq
     26 3 2 subber 1 #eq
     27 ptrget 42 #eq
     28 ptrset 54 #eq
     29 12 condif 13 #eq
     30 42 condif 142 #eq
     31 42 incdec 43 #eq
     32 54 incdecp 54 #eq
     33 exprparens 9 #eq
     34 cnoop ( no result! ) scnt 0 #eq
     35 42 ptrari 50 #eq
     36 42 50 ptrari2 2 #eq
     37 array 52 #eq
     38 global 1234 #eq
     39 globalinc 1236 #eq
     40 globalinc 1238 #eq
     41 1 globalshort 2 #eq
     42 42 142 funcsig 184 #eq
     43 capture helloworld S" Hello World!" #s=
     44 create expected ," Null terminated\0"
     45 nullstr expected 16 []= #
     46 5 forsum 10 #eq
     47 1 multret 1 #eq
     48 42 multret 32 #eq
     49 1234 \ test that void funcs with args don't mess with the PS underneath it.
     50 55 capture multretvoid S" Nope" #s=
     51 42 capture multretvoid S" Answer to the universe" #s=
     52 1234 #eq
     53 forbreak 10 #eq
     54 forcontinue 9 #eq
     55 forempty \ no crash
     56 -1 0 lts #
     57 -1 0 ltu not #
     58 0 boolnot 1 #eq
     59 42 boolnot 0 #eq
     60 S" foobar" 2 get8b 'o' #eq
     61 S" foobar" 4 get8b 'b' #eq
     62 S" foobar" dup 2 'X' set8b S" fXobar" #s=
     63 S" foobar" dup 6 'X' set8b S" foobaX" #s=
     64 typecast 1 #eq
     65 5 whilesum 15 #eq
     66 5 dowhilesum 15 #eq
     67 create mydata 42 , $12345678 , $23456789 ,
     68 mydata structget $35 #eq
     69 mydata $42 structset mydata 4 + @ $42345678 #eq
     70 42 globstructset globstructget 42 #eq
     71 globdata 4 + 16b @ 42 #eq
     72 0 callfuncidx 42 #eq
     73 2 callfuncidx 82 #eq
     74 33 switchstmt 0 #eq
     75 42 switchstmt 12 #eq
     76 1234 switchstmt 3 #eq
     77 'A' switchstmt 2 #eq
     78 5678 switchstmt 2 #eq
     79 
     80 2 3 binop1 1 #eq
     81 '2' binop2 44 #eq
     82 binop3 $605 #eq
     83 binop5 1 #eq
     84 binop6 $1fe #eq
     85 binop7 0 #eq
     86 binop8 $ffffffab #eq
     87 binop9 $1234 #eq
     88 123 12 binop10 1 #eq
     89 $72 2 binop11 $1c #eq
     90 12 5 binop12 17 #eq scnt not #
     91 54 5 binop12 -1 #eq scnt not #
     92 1 42 binop13 1 #eq
     93 -1 42 binop13 0 #eq
     94 binop14 $100 #eq
     95 S" abc" S" aac" 1 binop15 #
     96 S" abc" S" aac" 2 binop15 not #
     97 5 2 binop16 1 #eq
     98 structop1 44 #eq
     99 structop2 44 #eq
    100 structop2 45 #eq
    101 structop3 42 #eq
    102 structop4 globdata 12 + #eq
    103 structop5 42 #eq
    104 structop6 54 #eq
    105 structop7 42 #eq
    106 12 42 structop8 54 #eq
    107 structop9 123 #eq
    108 structop10 30 #eq
    109 cond2 scnt not # \ don't crash or leak
    110 opwidth1 42 #eq
    111 opwidth2 42 #eq
    112 opwidth3 $129 #eq
    113 opwidth4 14 #eq
    114 opwidth5 42 #eq
    115 opwidth6 1 #eq
    116 $ff 1 opwidth7 $1fe #eq
    117 opwidth8 0 #eq
    118 42 50 ptrari3 46 #eq
    119 41 value myval
    120 to' myval ptrari4 not #
    121 1 to+ myval
    122 to' myval ptrari4 #
    123 42 unaryop1 42 #eq
    124 to' myval unaryop2 to' myval #eq
    125 myval 42 #eq
    126 ptrari5 8 + @ 42 #eq
    127 123 456 ptrari6 123 456 + #eq
    128 $1234 2 ptrari7 $1238 #eq
    129 ptrari8 @ 42 #eq \ struct that was changed in ptrari5()
    130 funcall1 138 #eq
    131 42 funcall2 85 #eq
    132 funcall3 scnt not # \ no PS leak/underflow
    133 41 switch1 41 #eq
    134 42 switch1 43 #eq
    135 switch2 42 #eq
    136 
    137 \ and what about inline functions?
    138 :c int myinline() { return 42; }
    139 myinline 42 #eq
    140 testend