]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani-tests.mdc
oceani: implement struct field initialisation properly.
[ocean] / csrc / oceani-tests.mdc
index 46c1a09530a8c640057529e0668fa8422a3fa01d..d5541e9c3e21ea27ddb418d666789d8062c60beb 100644 (file)
@@ -551,10 +551,11 @@ Time to test if structure declarations and accesses work correctly.
 
 ###### test: structs
 
+       const three ::= 3
        struct foo
-               size:[3]number
+               size:[three]number
                name:string
-               active:Boolean
+               active:Boolean = True
 
        struct baz { a:number; b:Boolean; }
 
@@ -570,7 +571,8 @@ Time to test if structure declarations and accesses work correctly.
 
                        info[i].name = nm
                        info[i].size[0] = i*i
-                       info[i].active = nm == "jane"
+                       if nm != "jane":
+                               info[i].active = False
 
                for i:=0; then i=i+1; while i < 4:
                        print info[i].name, info[i].active, info[i].size[0]