[vala] tests: Add test for fixed size arrays



commit 7327e9d2fba1299b09a430553a1cff71f0ac0e5e
Author: Michal Hruby <michal mhr gmail com>
Date:   Thu Mar 10 17:45:57 2011 +0100

    tests: Add test for fixed size arrays

 tests/basic-types/arrays.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/tests/basic-types/arrays.vala b/tests/basic-types/arrays.vala
index ff32f2d..0b80cf6 100644
--- a/tests/basic-types/arrays.vala
+++ b/tests/basic-types/arrays.vala
@@ -71,9 +71,19 @@ void test_array_pass () {
 	assert (b[0] == 42);
 }
 
+void test_static_array () {
+	int a[2];
+	assert (a.length == 2);
+	a[1] = 23;
+	assert (a[1] == 23);
+	a = { 23, 34 };
+	assert (a[0] == 23 && a[1] == 34);
+}
+
 void main () {
 	test_integer_array ();
 	test_string_array ();
 	test_array_pass ();
+	test_static_array ();
 }
 



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