Skip to content

Commit

Permalink
Merge pull request #9 from xtuml/master
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
travislondon authored Apr 25, 2017
2 parents 49f7846 + dbdb149 commit e08dbee
Show file tree
Hide file tree
Showing 29 changed files with 304 additions and 4 deletions.
10 changes: 10 additions & 0 deletions masl/test/9432_enumerator/EnumDefaultValue.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
domain EnumDefaultValue is

public type Colour is enum ( black, white );

public type properties is structure
foreground : Colour := black;
background : Colour := Colour.white;
end structure;

end domain;
17 changes: 17 additions & 0 deletions masl/test/9432_enumerator/EnumDefaultValue.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
domain EnumDefaultValue is
object Screen;

public type Colour is enum ( black, white );

public type properties is structure
foreground : Colour := black;
background : Colour := Colour.white;
end structure;

object Screen is
id : preferred integer;
foreground : Colour := black;
background : Colour := Colour.white;
end object;

end domain;
6 changes: 6 additions & 0 deletions masl/test/9432_enummore/Colouring.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
domain Colouring is
public type PrimaryColour is enum (red, green, blue);
public type RainbowColour is enum (red, orange, yellow, green, blue, indigo, violet);

public service test();
end domain;
6 changes: 6 additions & 0 deletions masl/test/9432_enummore/Colouring.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
domain Colouring is
public type PrimaryColour is enum (red, green, blue);
public type RainbowColour is enum (red, orange, yellow, green, blue, indigo, violet);

public service test();
end domain;
29 changes: 29 additions & 0 deletions masl/test/9432_enummore/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
public service Colouring::test() is
rainbow : RainbowColour;
primary : PrimaryColour;
name : string;
begin

rainbow := Colouring::RainbowColour.indigo; // Explicit domain and type scope. No ambiguity.
rainbow := RainbowColour.indigo; // Explicit Type scope. No ambiguity.
rainbow := Colouring::indigo; // Explicit domain scope. No ambiguity.
rainbow := indigo; // No scope, No ambiguity.

primary := Colouring::PrimaryColour.red; // Explicit domain and type scope. No ambiguity.
primary := PrimaryColour.red; // Explicit Type scope. No ambiguity.
primary := Colouring::red; // Explicit domain scope. Ambiguity resolved by examining the assigned to type.
primary := red; // No scope. Ambiguity resolved by examining the assigned to type.

name := Colouring::RainbowColour.indigo'image; // Explicit domain and type scope. No ambiguity.
name := RainbowColour.indigo'image; // Explicit Type scope. No ambiguity.
name := Colouring::indigo'image; // Explicit domain scope. No ambiguity.
name := indigo'image; // No scope, No ambiguity.

name := Colouring::PrimaryColour.red'image; // Explicit domain and type scope. No ambiguity.
name := PrimaryColour.red'image; // Explicit Type scope. No ambiguity.

// The lines commented out below would raise a semantic error, as the ambiguity cannot be resolved.
// name := Colouring::red'image; // Explicit domain scope. ERROR - Ambiguous enumerator name.
// name := red'image; // No scope. ERROR - Ambiguous enumerator name.

end service;
7 changes: 7 additions & 0 deletions masl/test/9433_servicelinking/SvcFnOverload.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
domain SvcFnOverload is
public service foo() return boolean;
public service foo();

public service test();
end domain;

7 changes: 7 additions & 0 deletions masl/test/9433_servicelinking/SvcFnOverload.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
domain SvcFnOverload is
public service foo() return boolean;
public service foo();

public service test();
end domain;

6 changes: 6 additions & 0 deletions masl/test/9433_servicelinking/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service SvcFnOverload::test() is
result : boolean;
begin
foo(); // This is a 'domain service call'
result := foo(); // This is a 'domain fn call'
end;
5 changes: 5 additions & 0 deletions masl/test/9435_findExpression/FindExpression.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
domain FindExpression is

public service test();

end domain;
20 changes: 20 additions & 0 deletions masl/test/9435_findExpression/FindExpression.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
domain FindExpression is
object Dog;
object Person;

public service test();

relationship R1 is
Person conditionally owns many Dog,
Dog conditionally is_owned_by one Person;

object Person is
name : preferred string;
end object;

object Dog is
name : preferred string;
owner : referential (R1.is_owned_by.Person.name) string;
breed : string;
end object;
end domain;
7 changes: 7 additions & 0 deletions masl/test/9435_findExpression/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public service FindExpression::test() is
d : set of instance of Dog;
p : instance of Person;
begin
// p := find_one Person (name = "Fred");
d := p->R1(breed = "poodle");
end;
3 changes: 3 additions & 0 deletions masl/test/9436_wrong_type/IntegerAssignment.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
domain IntegerAssignment is
public service test();
end domain;
3 changes: 3 additions & 0 deletions masl/test/9436_wrong_type/IntegerAssignment.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
domain IntegerAssignment is
public service test();
end domain;
7 changes: 7 additions & 0 deletions masl/test/9436_wrong_type/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public service IntegerAssignment::test() is
l : long_integer;
i : integer;
begin
l := 0;
i := 0;
end;
5 changes: 5 additions & 0 deletions masl/test/9441_subsupernavigation/SuperSubNavigate.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
domain SuperSubNavigate is

public service test();

end domain;
18 changes: 18 additions & 0 deletions masl/test/9441_subsupernavigation/SuperSubNavigate.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
domain SuperSubNavigate is

object Animal;
object Dog;

public service test();

relationship R1 is Animal is_a ( Dog );

object Animal is
name : preferred string;
end object;

object Dog is
name : preferred referential (R1.name) string;
end object;

end domain;
11 changes: 11 additions & 0 deletions masl/test/9441_subsupernavigation/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public service SuperSubNavigate::test() is
animal : instance of Animal;
dog : instance of Dog;
animals : set of instance of Animal;
dogs : set of instance of Dog;
begin
animal := dog->R1;
dog := animal->R1;
animals := dogs->R1;
dogs := animals->R1;
end;
16 changes: 16 additions & 0 deletions masl/test/9443_recursiveStructures/RecursiveStructure.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
domain RecursiveStructure is
public type Component;
public type Device;

public type Device is structure
components: sequence of Component;
end structure;

public type Component is structure
subDevices : sequence of Device;
subComponents : sequence of Component;
end structure;

public service test();

end domain;
16 changes: 16 additions & 0 deletions masl/test/9443_recursiveStructures/RecursiveStructure.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
domain RecursiveStructure is
public type Component;
public type Device;

public type Device is structure
components: sequence of Component;
end structure;

public type Component is structure
subDevices : sequence of Device;
subComponents : sequence of Component;
end structure;

public service test();

end domain;
17 changes: 17 additions & 0 deletions masl/test/9443_recursiveStructures/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public service RecursiveStructure::test() is
component : Component;
device : Device;
components : sequence of Component;
devices : sequence of Device;
begin
components := component.subComponents;
devices := component.subDevices;
components := device.components;

components := component.subComponents[0].subComponents;
devices := device.components[0].subDevices;
components := device.components[0].subComponents;

component.subDevices := 1;
end service;

3 changes: 3 additions & 0 deletions masl/test/9450_basedliterals/foo.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
domain foo is

end;
3 changes: 3 additions & 0 deletions masl/test/9450_basedliterals/foo.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
domain foo is
service foo();
end;
19 changes: 19 additions & 0 deletions masl/test/9450_basedliterals/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
service foo::foo() is
i : integer;
r : real;
begin
i := 255;
i := 2#11111111;
i := 8#377;
i := 16#FF;
i := 36#73;

r := 10.25;
r := 2#1010.01;
r := 2#1.01001#+3;
r := 16#a.4;
r := 16#A4#-1;
r := 36#A.9;
r := 36#0.0A9#2;
end;

5 changes: 5 additions & 0 deletions masl/test/9452_duration_at_at/ScheduledEvents.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
domain ScheduledEvents is

public service test();

end domain;
18 changes: 18 additions & 0 deletions masl/test/9452_duration_at_at/ScheduledEvents.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
domain ScheduledEvents is
object Test;

public service test();

object Test is
id : preferred unique integer;
timerId : timer;

state Exists();
event SomethingHappened();

transition is
Non_Existent ( SomethingHappened => Cannot_Happen );
Exists ( SomethingHappened => Exists );
end transition;
end object;
end domain;
18 changes: 18 additions & 0 deletions masl/test/9452_duration_at_at/test.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

public service ScheduledEvents::test() is
obj : instance of Test;
begin
obj := create Test( Current_State => Exists );

// Christmas
schedule obj.timerId generate Test.SomethingHappened() to obj at @2017-12-25@;

// Noon every Wednesday
schedule obj.timerId generate Test.SomethingHappened() to obj at @2017-04-19T12:00:00Z@ delta @PT24H@;

// Same time tomorrow
schedule obj.timerId generate Test.SomethingHappened() to obj delay @P1D@;

// Every hour
schedule obj.timerId generate Test.SomethingHappened() to obj delay @PT0S@ delta @PT1H@;
end service;
4 changes: 4 additions & 0 deletions masl/test/9454_mpragma/MultiValuedPragma.int
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
domain MultiValuedPragma is
public service foo(); pragma ids ("one", "two", "three");
public service bar(); pragma id ("one"); pragma id ("two"); pragma id ("three");
end domain;
4 changes: 4 additions & 0 deletions masl/test/9454_mpragma/MultiValuedPragma.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
domain MultiValuedPragma is
public service foo(); pragma ids ("one", "two", "three");
public service bar(); pragma id ("one"); pragma id ("two"); pragma id ("three");
end domain;
18 changes: 14 additions & 4 deletions masl/test/all_tests
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ poly
9272_event_parms
9275_incomplete
9276_incomplete
9279_udt_comments
9280_miss_rows
9251_default
9267_assigner
Expand All @@ -38,7 +37,6 @@ poly
9257_pragma_overload
9273_same_evt
9302_state_action
9321_name_clash/System 9321_name_clash/User 9321_name_clash/TerminatorNameClash_PROC
9365_uniqueid
9370_2nd_id_1
9370_2nd_id_2
Expand All @@ -48,8 +46,20 @@ poly
9379_dupcomment
9379_dupmore
9308_pragma_lost
#../SAC/SAC_OOA ../SAC/SAC_PROC
9454_mpragma
9432_enumerator
9432_enummore
9435_findExpression
9436_wrong_type
9441_subsupernavigation
9452_duration_at_at
9404_nameclash/User 9404_nameclash/NameClash
9321_name_clash/System 9321_name_clash/User 9321_name_clash/TerminatorNameClash_PROC
#9279_udt_comments
#9433_servicelinking
#9443_recursiveStructures
#9450_basedliterals
#IPv6Nodes
#pragmas/PragmaTest
#pragmas/PragmaTest pragmas/PragmaTestProj
#9404_nameclash/User 9404_nameclash/NameClash
#../SAC/SAC_OOA ../SAC/SAC_PROC

0 comments on commit e08dbee

Please sign in to comment.