#!/usr/local/bin/konoha

import "utest.k";

int r;
int a=1;
b=0b00010;
c=-3;

utest("int+int",a+b+c==0);

utest("int-int",a-b-c==2);

utest("int*int",a*b*c==-6);

utest("int/int",b/-2==-1);

utest("int/int(2)",c/2==-1);

utest("int%int",c % b==-1);

utest("int mod int",c mod b==-1);

utest("int+int*int",a+b*c==-5);

r=c/a*b;
utest("int/int*int",r==-6);

r=18/c/b;
utest("int/int/int",r==-3);

r=c&5;
utest("int&int",r==5);

r=c^b;
utest("int^int",r==-1);

r=c<<1;
utest("int<<int",r==-6);

r=7 >> 1;
utest("int>>int",r==3);

r=b|c;
utest("int|int",r==-1);

r=~b;
utest("~int",r==-3);

utest("int<int",c<b);

utest("int>int",b>c);

utest("int>=int",b>=-1 && b>=2);

utest("int<=int",c<=1 && c<=-3);

utest("int!=int",b!=c);

utest("int==string", a != "1");

utest("int++",(a++)==2);

utest("int--",(b--)==1);

/*
print "random(5)";
for(i=0;i<5;i++){
print Int.random(5);
}
*/

