[opengtl-commits] [170] this test show that my fear of a hidden problem is unfounded : add a test for coumpound default argument of functions |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 170
Author: cyrille
Date: 2008-05-19 10:41:33 +0200 (Mon, 19 May 2008)
Log Message:
-----------
this test show that my fear of a hidden problem is unfounded : add a test for coumpound default argument of functions
Modified Paths:
--------------
trunk/OpenGTL/OpenCTL/tests/statements/defaultparameter.ctl
Modified: trunk/OpenGTL/OpenCTL/tests/statements/defaultparameter.ctl
===================================================================
--- trunk/OpenGTL/OpenCTL/tests/statements/defaultparameter.ctl 2008-05-19 08:37:52 UTC (rev 169)
+++ trunk/OpenGTL/OpenCTL/tests/statements/defaultparameter.ctl 2008-05-19 08:41:33 UTC (rev 170)
@@ -1,3 +1,27 @@
+
+struct MyStruct {
+ int r;
+ float g;
+ half b;
+ bool t[2];
+};
+
+void testFunction2( MyStruct myStruct = { 1, 2.03, 4.05, {true, false} } )
+{
+ assert( myStruct.r == 1 );
+ assert( myStruct.g == 2.03 );
+ assert( myStruct.b == 4.05 );
+ assert( myStruct.t[0] );
+ assert( !myStruct.t[1] );
+}
+
+void testFunction1( bool t[2] = {true, false})
+{
+ assert( t[0] );
+ assert( !t[1] );
+}
+
+
int func(int a = 10)
{
assert(a == 10);
@@ -7,5 +31,7 @@
int main()
{
func(10);
+ testFunction1();
+ testFunction2();
return 0;
}