File: numeric.nice

package info (click to toggle)
nice 0.9.12-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,220 kB
  • ctags: 6,894
  • sloc: java: 42,767; xml: 3,508; lisp: 1,079; sh: 736; makefile: 673; cpp: 21; awk: 3
file content (53 lines) | stat: -rw-r--r-- 1,051 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

package regtest.basic;

/**
   Test of primitive numbers.
   Especially tests that cannot be done in coreJava 
   for comparison with Java.
   */

void test_numeric();
test_numeric()
{
  println("### Testing native numbers ###\n");

  // setting to default values
  boolean bo = false;
  byte by = 0;
  short s = 0;
  int i = 0;
  long l = 0;
  char c = '0';
  float f = 0;
  double d = 0;

  println("" + (bo==false) + (by==0) + (s==0) + (i==0) + (l==0) + (c=='0'));

  println("" + 14 + " " +
	  (14 > 17) + (14 > 14) + (17 > 14) + 
	  (14 < 17) + (14 < 14) + (17 < 14) +
	  (14 == 17) + (14 == 14) + (14 != 17) + (14 != 14));

  println("" + 14.1 + " " +
	  (14.1 > 17) + (14.1 > 14.1) + (17 > 14.1) + 
	  (14.1 < 17) + (14.1 < 14.1) + (17 < 14.1) +
	  (14.1 == 17) + (14.1 == 14.1) + (14.1 != 17) + (14.1 != 14.1));

  // testing correct wrapping/unwrapping
  bo = id(bo);
  by = id(by);
  s  = id(s);
  i  = id(i);
  l  = id(l);
  c  = id(c);
  f  = id(f);
  d  = id(d);

  // unary negation
  i = -by;
  i = -s;
  i = -i;
  l = -i;
  l = -l;
}