-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from audrey-jardin/main
New set of unit tests for built-in and ETL operators
- Loading branch information
Showing
32 changed files
with
128 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/libraries/ETL_test/CountInside.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/libraries/ETL_test/Inside_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/BooleanAtEvent_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
model BooleanAtEvent_no_ext is { | ||
Boolean b1 is if 2.5 < time and time < 5 then true else false; | ||
Boolean b is if 2.0 < time and time < 3.5 then true else false; | ||
Boolean b is if (2.0 <= time and time < 3.5) or (4.0 <= time and time < 5.5) then true else false; | ||
Clock c is new Clock b; | ||
Boolean b_at_event is b1 at c; | ||
Boolean b_at_event is b1 at c; // Should start at false and becomes true at t=4s | ||
}; |
15 changes: 12 additions & 3 deletions
15
src/test/resources/testModels/spec-doc-examples/BooleanIntegration_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
model BooleanIntegration is { | ||
Boolean a is if 2.0 < time and time < 3.5 then true else false; | ||
Boolean b is if 2.5 < time and time < 5 then true else false; | ||
Period P is [ new Event b, new Event not b ]; | ||
Boolean b_integration is integrate a on P; | ||
Period P is [ new Event a new Event not a ]; | ||
|
||
Boolean b_true is if 2.5 < time and time < 5 then undefined else true; | ||
Boolean b_false is if 2.5 < time and time < 5 then undefined else false; | ||
Boolean b_undecided is if 2.5 < time and time < 5 then undecided else true; | ||
Boolean b_undefined is undefined; | ||
|
||
Boolean b_integration_true is integrate b_true on P; //Value is undefined and becomes true at 2.5s | ||
Boolean b_integration_false is integrate b_false on P; //Value is undefined and becomes false at 2.5s | ||
Boolean b_integration_undecided is integrate b_undecided on P; //Value is undefined and becomes undecided at 2.5s | ||
Boolean b_integration_undefined is integrate b_undefined on P; //Value is and remains undefined | ||
|
||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/ClockConstructors_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
model ClockConstructors_no_ext is { | ||
// Constructors | ||
Boolean b is if 2.0 < time and time < 3.5 then true else false;; | ||
Clock c is new Clock b; // one event should be generated at instant t=2.0 | ||
Boolean b is if 2.0 <= time and time < 3.5 then true else false;; | ||
Clock c is new Clock b; // One event should be generated at instant t=2.0 | ||
}; |
7 changes: 5 additions & 2 deletions
7
src/test/resources/testModels/spec-doc-examples/ClockCurrentTick_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
model ClockCurrentTick_no_ext is { | ||
Boolean b is if 2.0 < time and time < 3.5 then true else false; | ||
Boolean b is if (2.0 <= time and time < 3.5) and (4.0 <= time and time < 5.5) then true else false; | ||
Clock c is new Clock b; | ||
Event e_current_tick is tick c; | ||
Event e_current_tick is tick c; | ||
// Should start with an empty set, | ||
// then at t=2.0s becomes a set with one event at t=2.0s | ||
// and turns at t=4.0s to a set with two events at t=2.0s and t=4.0s | ||
}; |
6 changes: 3 additions & 3 deletions
6
src/test/resources/testModels/spec-doc-examples/ClockFilter.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
model ClockFilter is { | ||
Clock c1 is external; | ||
Clock c2 is external; | ||
Clock c_filter is c1 filter tick c2; | ||
Event e is external; | ||
Clock c is external; | ||
Clock c_filter is c filter (tick c >= e); // Should only keep c ticks which happen after or at the same time than event e. | ||
}; |
8 changes: 8 additions & 0 deletions
8
src/test/resources/testModels/spec-doc-examples/ClockFilter_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
model ClockFilter_no_ext is { | ||
Boolean b1 is if 2.5 < time and time < 5 then true else false; | ||
Boolean b is if (2.0 <= time and time < 3.5) or (4.0 <= time and time < 5.5) then true else false; | ||
|
||
Event e is new Event b1; // One event at t=2.5s | ||
Clock c is new Clock b; // Two ticks at t=2.0s and t=4.0s | ||
Clock c_filter is c filter (tick c >= e); // Should only keep tick at t=4.0s. | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/test/resources/testModels/spec-doc-examples/ClockNumberOfTicks_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
model ClockNumberOfTicks_no_ext is { | ||
Boolean b is if (2.0 <= time and time < 3.5) or (4.0 <= time and time < 5.5) then true else false; | ||
|
||
Clock c is new Clock b; // Two ticks at t=2.0s and t=4.0s | ||
Integer n_number_of_ticks is card c; // Should be 0 at start, then 1 at t=2.0s and becomes 2 at t=4.0s | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/IntegerBinaryAddition.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
model IntegerBinaryAddition is { | ||
Integer n1 is 25; | ||
Integer n2 is -3; | ||
Integer n1 is external; | ||
Integer n2 is external; | ||
Integer n_binary_addition is n1 + n2; | ||
}; |
5 changes: 5 additions & 0 deletions
5
src/test/resources/testModels/spec-doc-examples/IntegerBinaryAddition_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model IntegerBinaryAddition_no_ext is { | ||
Integer n1 is 25; | ||
Integer n2 is -3; | ||
Integer n_binary_addition is n1 + n2; //Value is 22 | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/IntegerUnaryAddition.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
model IntegerUnaryAddition is { | ||
Integer n1 is 25; | ||
Integer n2 is -3; | ||
Integer n1 is external; | ||
Integer n2 is external; | ||
Integer n_unary_addition_1 is +n1; | ||
Integer n_unary_addition_2 is +n2; | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/test/resources/testModels/spec-doc-examples/IntegerUnaryAddition_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
model IntegerUnaryAddition is { | ||
Integer n1 is 25; | ||
Integer n2 is -3; | ||
Integer n_unary_addition_1 is +n1; //Value is 26 | ||
Integer n_unary_addition_2 is +n2; //Value is -2 | ||
}; |
9 changes: 9 additions & 0 deletions
9
src/test/resources/testModels/spec-doc-examples/PeriodClosingEvent_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
model PeriodClosingEvent_no_ext is { | ||
Boolean b1 is if (2.0 <= time and time < 3.5) then true else false; | ||
Boolean b2 is if (3.0 <= time and time < 5.5) then true else false; | ||
Clock c1 is new Clock b1; | ||
Clock c2 is new Clock b2; | ||
Period P is [c1, c2]; | ||
Event e is P end; // Should return an event at t=3.0s | ||
|
||
}; |
6 changes: 6 additions & 0 deletions
6
src/test/resources/testModels/spec-doc-examples/PeriodOpeningEvent_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
model PeriodOpeningEvent_no_ext is { | ||
Boolean b is if (2.0 <= time and time < 3.5) then true else false; | ||
Clock c is new Clock b; | ||
Period P is [c, new Clock false]; | ||
Event e is P start; // Should return an event at t=2.0s | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/RealBinaryAddition.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
model RealBinaryAddition is { | ||
Real x1 is -28.775E+3; | ||
Real x2 is 0.28e-7; | ||
Real x1 is external; | ||
Real x2 is external; | ||
Real x_binary_addition is x1 + x2; | ||
}; |
5 changes: 5 additions & 0 deletions
5
src/test/resources/testModels/spec-doc-examples/RealBinaryAddition_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model RealBinaryAddition_no_ext is { | ||
Real x1 is 2.5; | ||
Real x2 is 3.0; | ||
Real x_binary_addition is x1 + x2; //Value is 5.5 | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/RealMultiplication.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
model RealMultiplication is { | ||
Real x1 is -28.775E+3; | ||
Real x2 is 0.28e-7; | ||
Real x1 is external; | ||
Real x2 is external; | ||
Real x_multiplication is x1 * x2; | ||
}; |
5 changes: 5 additions & 0 deletions
5
src/test/resources/testModels/spec-doc-examples/RealMultiplication_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model RealMultiplication is { | ||
Real x1 is 2.5; | ||
Real x2 is 3.0; | ||
Real x_multiplication is x1 * x2; //Value is 7.5 | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/RealUnaryAddition.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
model RealUnaryAddition is { | ||
Real x1 is -28.775E+3; | ||
Real x2 is 0.28e-7; | ||
Real x1 is external; | ||
Real x2 is external; | ||
Real x_unary_addition_1 is +x1; | ||
Real x_unary_addition_2 is +x2; | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/test/resources/testModels/spec-doc-examples/RealUnaryAddition_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
model RealUnaryAddition_no_ext is { | ||
Real x1 is 2.5; | ||
Real x2 is 3.0; | ||
Real x_unary_addition_1 is +x1; //Value is 3.5 | ||
Real x_unary_addition_2 is +x2; //Value is 4.0 | ||
}; |
5 changes: 5 additions & 0 deletions
5
src/test/resources/testModels/spec-doc-examples/SetCard_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model SetCard_no_ext is { | ||
// Example with set of Real variables | ||
Real {} S is {3.0, 1.5, 237}; | ||
Integer n is card S; // Should be equal to 3. | ||
}; |
4 changes: 2 additions & 2 deletions
4
src/test/resources/testModels/spec-doc-examples/StringConcatenation.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
model StringConcatenation is { | ||
String s1 is "conca"; | ||
String s2 is "tenation"; | ||
String s1 is external; | ||
String s2 is external; | ||
String s_s1_is_concatenated_with_s2 is s1 + s2; //value should be "s1s2" | ||
}; |
10 changes: 5 additions & 5 deletions
10
...doc-examples/StringOperatorsExample1.crml → ...examples/StringConcatenationExample1.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
model StringOperatorsExample1 is { | ||
Integer n is 3; | ||
Real x is 2.5; | ||
String s is "The " + new String n + " ships follow each other from a distance of " + new String x + " kilometers."; | ||
// The value of s is "The 3 ships follow each other from a distance of 2.5 kilometers." | ||
model StringOperatorsExample1 is { | ||
Integer n is 3; | ||
Real x is 2.5; | ||
String s is "The " + new String n + " ships follow each other from a distance of " + new String x + " kilometers."; | ||
// The value of s is "The 3 ships follow each other from a distance of 2.5 kilometers." | ||
}; |
6 changes: 3 additions & 3 deletions
6
...doc-examples/StringOperatorsExample2.crml → ...examples/StringConcatenationExample2.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
model StringOperatorsExample2 is { | ||
String s is "The set of 4-valued Booleans is { " + new String undecided + ", " + new String undefined + ", " + new String false + ", " + new String true + " }. "; | ||
// The value of s is "The set of 4-valued Booleans is { undecided, undefined, false, true }." | ||
model StringOperatorsExample2 is { | ||
String s is "The set of 4-valued Booleans is { " + new String undecided + ", " + new String undefined + ", " + new String false + ", " + new String true + " }. "; | ||
// The value of s is "The set of 4-valued Booleans is { undecided, undefined, false, true }." | ||
}; |
5 changes: 5 additions & 0 deletions
5
src/test/resources/testModels/spec-doc-examples/StringConcatenation_no_ext.crml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model StringConcatenation_no_ext is { | ||
String s1 is "conca"; | ||
String s2 is "tenation"; | ||
String s_s1_is_concatenated_with_s2 is s1 + s2; //value should be "concatenation" | ||
}; |