qse/regress/awk/lang-012.awk

123 lines
3.4 KiB
Awk
Raw Normal View History

BEGIN {
OFS="\t\t";
print "1==1 :", (1 == 1);
print "1==0 :", (1 == 0);
print "1.0==1 :", (1.0 == 1);
print "1.1==1 :", (1.1 == 1);
print "1.0!=1 :", (1.0 != 1);
print "1.1!=1 :", (1.1 != 1);
print "\"abc\" == \"abc\"", ("abc" == "abc");
print "\"abc\" != \"abc\"", ("abc" != "abc");
print "--------------------------";
print "a == \"\" :", (a == "");
print "a >= \"\" :", (a >= "");
print "a <= \"\" :", (a <= "");
print "a > \"\" :", (a > "");
print "a < \"\" :", (a < "");
print "--------------------------";
print "a == \" \" :", (a == " ");
print "a >= \" \" :", (a >= " ");
print "a <= \" \" :", (a <= " ");
print "a > \" \" :", (a > " ");
print "a < \" \" :", (a < " ");
print "--------------------------";
print "\"\" == a :", ("" == a);
print "\"\" >= a:", ("" >= a);
print "\"\" <= a:", ("" <= a);
print "\"\" > a:", ("" > a);
print "\"\" < a:", ("" < a);
print "--------------------------";
print "\" \" == a :", (" " == a);
print "\" \" >= a:", (" " >= a);
print "\" \" <= a:", (" " <= a);
print "\" \" > a:", (" " > a);
print "\" \" < a:", (" " < a);
print "--------------------------";
print "10 == \"10\"", (10 == "10");
print "10 != \"10\"", (10 != "10");
print "10 >= \"10\"", (10 >= "10");
print "10 <= \"10\"", (10 <= "10");
print "10 > \"10\"", (10 > "10");
print "10 < \"10\"", (10 < "10");
print "--------------------------";
print "10 == \"11\"", (10 == "11");
print "10 != \"11\"", (10 != "11");
print "10 >= \"11\"", (10 >= "11");
print "10 <= \"11\"", (10 <= "11");
print "10 > \"11\"", (10 > "11");
print "10 < \"11\"", (10 < "11");
print "--------------------------";
print "11 == \"10\"", (11 == "10");
print "11 != \"10\"", (11 != "10");
print "11 >= \"10\"", (11 >= "10");
print "11 <= \"10\"", (11 <= "10");
print "11 > \"10\"", (11 > "10");
print "11 < \"10\"", (11 < "10");
# octal number
print "--------------------------";
print "010 == \"8\"", (010 == "8");
print "010 != \"8\"", (010 != "8");
print "010 >= \"8\"", (010 >= "8");
print "010 <= \"8\"", (010 <= "8");
print "010 > \"8\"", (010 > "8");
print "010 < \"8\"", (010 < "8");
print "--------------------------";
print "10 == \"10.0\"", (10 == "10.0");
print "10 != \"10.0\"", (10 != "10.0");
print "10 >= \"10.0\"", (10 >= "10.0");
print "10 <= \"10.0\"", (10 <= "10.0");
print "10 > \"10.0\"", (10 > "10.0");
print "10 < \"10.0\"", (10 < "10.0");
#OFMT="abc";
print "--------------------------";
print "10.0 == \"10\"", (10.0 == "10");
print "10.0 != \"10\"", (10.0 != "10");
print "10.0 >= \"10\"", (10.0 >= "10");
print "10.0 <= \"10\"", (10.0 <= "10");
print "10.0 > \"10\"", (10.0 > "10");
print "10.0 < \"10\"", (10.0 < "10");
print "--------------------------";
print "\"10\" == 10.0", ("10" == 10.0);
print "\"10\" != 10.0", ("10" != 10.0);
print "\"10\" >= 10.0", ("10" >= 10.0);
print "\"10\" <= 10.0", ("10" <= 10.0);
print "\"10\" > 10.0", ("10" > 10.0);
print "\"10\" < 10.0", ("10" < 10.0);
print "--------------------------";
print "\"10\" == 10.1", ("10" == 10.1);
print "\"10\" != 10.1", ("10" != 10.1);
print "\"10\" >= 10.1", ("10" >= 10.1);
print "\"10\" <= 10.1", ("10" <= 10.1);
print "\"10\" > 10.1", ("10" > 10.1);
print "\"10\" < 10.1", ("10" < 10.1);
#a[10] = 2;
#print a == 1;
print (0.234 + 1.01123);
print 12345678901234567890E20;
print .123;
print +.123;
print -.123;
print .123E-;
print +.123E-;
print -.123E-;
print -.123E- + "123";
}