[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-630-g05ef490
Mildred Ki'Lya
silkensedai at online.fr
Thu Jun 17 12:56:04 UTC 2010
The following commit has been merged in the master branch:
commit 05ef490d18844b82b46b4cfdafd7fbabbad0acd6
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Thu Jun 17 14:55:31 2010 +0200
More tests
diff --git a/features/expanded.feature b/features/expanded.feature
new file mode 100644
index 0000000..3977a38
--- /dev/null
+++ b/features/expanded.feature
@@ -0,0 +1,105 @@
+Feature: Expanded Objects
+
+ Expanded objects are used as values and not reference. Objects can be defined
+ as Expanded when the prototype is declared, or when a variable is declared.
+
+ It is possible to convert from Expanded to Reference objects and vice-versa:
+
+ | Expanded -> Expanded | Copy value |
+ | Expanded -> Reference | Copy value (reference not null) |
+ | Reference -> Expanded | Copy value (reference not null) |
+ | Reference -> Reference | Copy reference |
+
+ Background:
+ Given lisaac/bin is in the PATH
+ And make.lip is installed
+ And I am in an empty directory
+
+ Scenario:
+ Given a file "aa.li"
+ """
+ Section Header
+ + name := AA;
+ Section Insert
+ - parent_object :Expanded OBJECT;
+ Section Public
+ + num :INTEGER := 0;
+ - set_num i:INTEGER <- (num := i;);
+ """
+ Given a file "bb.li"
+ """
+ Section Header
+ + name := Expanded BB;
+ Section Public
+ + num :INTEGER := 0;
+ - set_num i:INTEGER <- (num := i;);
+ """
+ Given a file "main.li"
+ """
+ Section Header
+ + name := MAIN;
+ Section Public
+ - main <-
+ ( + ae : Expanded AA;
+ + ar1 : AA;
+ + ar2 : AA;
+ + b1 : BB;
+ + b2 : BB;
+
+ ae.set_num 1;
+ ar1 := AA.clone;
+ ar2 := AA.clone;
+ ar1.set_num 2;
+ ar2.set_num 3;
+ b1.set_num 4;
+ b2.set_num 5;
+
+ ? { ar1.num = 2 };
+ ? { ar2.num = 3 };
+ ar1 := ar2;
+ ? { ar1.num = 3 };
+ ? { ar2.num = 3 };
+ ar1.set_num 6;
+ ? { ar1.num = 6 };
+ ? { ar2.num = 6 };
+ ar2.set_num 7;
+ ? { ar1.num = 7 };
+ ? { ar2.num = 7 };
+
+ ? { ae.num = 1 };
+ ar1 := ae;
+ ? { ae.num = 1 };
+ ? { ar1.num = 1 };
+ ? { ar2.num = 1 };
+ ae.set_num 8;
+ ? { ae.num = 8 };
+ ? { ar1.num = 1 };
+ ? { ar2.num = 1 };
+
+ ae := ar1;
+ ? { ae.num = 1 };
+ ? { ar1.num = 1 };
+ ae.set_num 9;
+ ? { ae.num = 9 };
+ ? { ar1.num = 1 };
+
+ ? { b1.num = 4 };
+ ? { b2.num = 5 };
+ b2 := b1;
+ ? { b1.num = 4 };
+ ? { b2.num = 4 };
+
+ "OK".println;
+ );
+ """
+
+ When I run lisaac main
+ Then it should pass
+
+ When I run ./main
+ Then it should pass with
+ """
+ OK
+
+ """
+
diff --git a/features/section-header.feature b/features/section-header.feature
new file mode 100644
index 0000000..c9c0b09
--- /dev/null
+++ b/features/section-header.feature
@@ -0,0 +1,112 @@
+Feature: Section Header
+ The Section Header of a prototype contains important metadata. The following
+ slots are recognized:
+ - name: name of the prototype (if the prototype is COP)
+ + name: name of the prototype (non COP)
+ - import: list of types to auto-import from
+ - export: list of types to auto-export to
+ - external: external code enclosed in `\`` to be included in the compiled
+ code
+ - default: expression, default value of the variables of this type
+ - type: external code coding the native type
+ - version: integer representing the version number (TODO: float at least)
+ - lip: LIP code to be executed when the prototype comes alive
+ - date, comment, author, bibliography, language, copyright, bug_report:
+ metadata strings
+
+ The `name` slot is mandatory and must be the first.
+
+ TODO: test the effect of:
+ - wrong name
+ - Expanded, Strict
+ - lip prototype
+ - auto import/export
+ - external code, external type
+ - default value
+
+ Background:
+ Given lisaac/bin is in the PATH
+ And make.lip is installed
+ And I am in an empty directory
+
+ Scenario: Missing Section Header
+ Given a file "main.li"
+ """
+ Section Public
+
+ - main <-
+ (
+ "Hello".println;
+ );
+
+ """
+
+ When I run lisaac main
+ Then it should fail
+ And the output should contain
+ """
+ Section `Header' is needed
+ """
+ Scenario: Missing slot name
+ Given a file "main.li"
+ """
+ Section Header
+
+ Section Public
+
+ - main <-
+ (
+ "Hello".println;
+ );
+
+ """
+
+ When I run lisaac main
+ Then it should fail
+ And the output should contain
+ """
+ Slot `name' not found
+ """
+
+ Scenario: Header Slots
+ Given a file "main.li"
+ """
+ Section Header
+
+ + name := MAIN;
+ - import := INTEGER, REAL;
+ - export := INTEGER, REAL;
+ - external := `/* nothing */`;
+ - default := NULL;
+ - type := `void*`;
+ - version := 1_01; // FLOAT would be better than INTEGER !!!
+ - lip <- ( "Hello LIP\n".print );
+ - date := "20051987";
+ - comment := "toto";
+ - author := "Mildred";
+ - bibliography := "This is a test";
+ - language := "FR";
+ - copyright := "2010";
+ - bug_report := "nowhere";
+
+ Section Public
+
+ - main <-
+ (
+ "Hello LISAAC".println;
+ );
+
+ """
+
+ When I run lisaac main
+ Then it should pass
+ And the output should contain
+ """
+ Hello LIP
+ """
+ When I run ./main
+ Then it should pass with
+ """
+ Hello LISAAC
+
+ """
--
Lisaac compiler
More information about the Lisaac-commits
mailing list