vala r2015 - in trunk: . tests tests/basic-types



Author: juergbi
Date: Fri Nov 14 09:09:04 2008
New Revision: 2015
URL: http://svn.gnome.org/viewvc/vala?rev=2015&view=rev

Log:
2008-11-14  JÃrg Billeter  <j bitron ch>

	* tests/Makefile.am:
	* tests/basic-types/:

	Rearrange test cases


Added:
   trunk/tests/basic-types/floats.exp
      - copied unchanged from r2014, /trunk/tests/basic-types/test-031.exp
   trunk/tests/basic-types/floats.vala
      - copied unchanged from r2014, /trunk/tests/basic-types/test-031.vala
   trunk/tests/basic-types/integers.exp
      - copied, changed from r2014, /trunk/tests/basic-types/expressions-relational.exp
   trunk/tests/basic-types/integers.vala
      - copied, changed from r2014, /trunk/tests/basic-types/expressions-relational.vala
Removed:
   trunk/tests/basic-types/expressions-assignments.exp
   trunk/tests/basic-types/expressions-assignments.vala
   trunk/tests/basic-types/expressions-relational.exp
   trunk/tests/basic-types/expressions-relational.vala
   trunk/tests/basic-types/test-030.exp
   trunk/tests/basic-types/test-030.vala
   trunk/tests/basic-types/test-031.exp
   trunk/tests/basic-types/test-031.vala
Modified:
   trunk/ChangeLog
   trunk/tests/Makefile.am

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Fri Nov 14 09:09:04 2008
@@ -16,12 +16,10 @@
 
 TESTS = \
 	hello.vala \
-	basic-types/expressions-assignments.vala \
-	basic-types/expressions-relational.vala \
+	basic-types/floats.vala \
+	basic-types/integers.vala \
 	basic-types/strings.vala \
 	basic-types/test-027.vala \
-	basic-types/test-030.vala \
-	basic-types/test-031.vala \
 	namespaces.vala \
 	methods/lambda.vala \
 	control-flow/break.vala \
@@ -52,12 +50,10 @@
 	$(TESTS) \
 	\
 	hello.exp \
-	basic-types/expressions-assignments.exp \
-	basic-types/expressions-relational.exp \
+	basic-types/floats.exp \
+	basic-types/integers.exp \
 	basic-types/strings.exp \
 	basic-types/test-027.exp \
-	basic-types/test-030.exp \
-	basic-types/test-031.exp \
 	namespaces.exp \
 	methods/lambda.exp \
 	control-flow/break.exp \

Copied: trunk/tests/basic-types/integers.exp (from r2014, /trunk/tests/basic-types/expressions-relational.exp)
==============================================================================
--- /trunk/tests/basic-types/expressions-relational.exp	(original)
+++ trunk/tests/basic-types/integers.exp	Fri Nov 14 09:09:04 2008
@@ -1 +1,10 @@
 Binary Expression Test: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+Assignment Test: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+int8: -128...127
+int16: -32768...32767
+int32: -2147483648...2147483647
+int64: -9223372036854775808...9223372036854775807
+uint8: 0...255
+uint16: 0...65535
+uint32: 0...4294967295
+uint64: 0...18446744073709551615

Copied: trunk/tests/basic-types/integers.vala (from r2014, /trunk/tests/basic-types/expressions-relational.vala)
==============================================================================
--- /trunk/tests/basic-types/expressions-relational.vala	(original)
+++ trunk/tests/basic-types/integers.vala	Fri Nov 14 09:09:04 2008
@@ -1,7 +1,7 @@
 using GLib;
 
 class Maman.Bar : Object {
-	static int main (string[] args) {
+	static void test_binary_expressions () {
 		stdout.printf ("Binary Expression Test: 1");
 		
 		stdout.printf (" %d", 1 + 1);
@@ -73,7 +73,102 @@
 		}
 		
 		stdout.printf (" 20\n");
+	}
+
+	static void test_assignments () {
+		stdout.printf ("Assignment Test: 1");
+		
+		int i;
+		
+		i = 2;
+		stdout.printf (" %d", i);
+		
+		i |= 1;
+		stdout.printf (" %d", i);
+		
+		i = 5;
+		i &= 6;
+		stdout.printf (" %d", i);
+		
+		i ^= 1;
+		stdout.printf (" %d", i);
+		
+		i += 1;
+		stdout.printf (" %d", i);
+		
+		i -= -1;
+		stdout.printf (" %d", i);
+		
+		i = 2;
+		i *= 4;
+		stdout.printf (" %d", i);
+		
+		i = 18;
+		i /= 2;
+		stdout.printf (" %d", i);
+		
+		i = 21;
+		i %= 11;
+		stdout.printf (" %d", i);
 		
+		i = 6;
+		i <<= 1;
+		stdout.printf (" %d", i - 1);
+		
+		i = 25;
+		i >>= 1;
+		stdout.printf (" %d", i);
+		
+		i = 12;
+		i -= 1 - 2;
+		stdout.printf (" %d", i);
+
+		stdout.printf (" 14\n");
+	}
+
+	static void test_ranges () {
+		stdout.printf (
+			"int8: %s...%s\n",
+			int8.MIN.to_string (), 
+			int8.MAX.to_string ());
+		stdout.printf (
+			"int16: %s...%s\n",
+			int16.MIN.to_string (),
+			int16.MAX.to_string ());
+		stdout.printf (
+			"int32: %s...%s\n",
+			int32.MIN.to_string (),
+			int32.MAX.to_string ());
+		stdout.printf (
+			"int64: %s...%s\n",
+			int64.MIN.to_string (),
+			int64.MAX.to_string ());
+
+		stdout.printf (
+			"uint8: %s...%s\n",
+			uint8.MIN.to_string (),
+			uint8.MAX.to_string ());
+		stdout.printf (
+			"uint16: %s...%s\n",
+			uint16.MIN.to_string (),
+			uint16.MAX.to_string ());
+		stdout.printf (
+			"uint32: %s...%s\n",
+			uint32.MIN.to_string (),
+			uint32.MAX.to_string ());
+		stdout.printf (
+			"uint64: %s...%s\n",
+			uint64.MIN.to_string (),
+			uint64.MAX.to_string ());
+	}
+
+	static int main (string[] args) {
+		test_binary_expressions ();
+
+		test_assignments ();
+
+		test_ranges ();
+
 		return 0;
 	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]