Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/uml/alf/org.eclipse.papyrus.uml.alf.tests/tests/Expressions_Sequence_Operation.alf')
-rw-r--r--tests/junit/plugins/uml/alf/org.eclipse.papyrus.uml.alf.tests/tests/Expressions_Sequence_Operation.alf55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/alf/org.eclipse.papyrus.uml.alf.tests/tests/Expressions_Sequence_Operation.alf b/tests/junit/plugins/uml/alf/org.eclipse.papyrus.uml.alf.tests/tests/Expressions_Sequence_Operation.alf
new file mode 100644
index 00000000000..03627ae4b3f
--- /dev/null
+++ b/tests/junit/plugins/uml/alf/org.eclipse.papyrus.uml.alf.tests/tests/Expressions_Sequence_Operation.alf
@@ -0,0 +1,55 @@
+/**
+ * Test sequence operation expressions.
+ **/
+active class Expressions_Sequence_Operation {
+
+ // Supporting declarations *************************************************
+
+ class Customer {
+ public name: String;
+ @Create Customer(in name: String) { this.name = name; }
+ }
+
+ //**************************************************************************
+
+ test(
+ out notEmpty: Boolean, out includes: Boolean, out m: Integer, out n: Integer,
+ out customers: Customer[*], out list: any[*]) {
+
+ customer = new Customer("A");
+ customers = Customer[]{};
+
+ notEmpty = customers->notEmpty();
+ customers->notEmpty(); // Check that notEmpty is still resolvable as a behavior.
+ includes = customers->includes(customer);
+ customers = customers->including(customer);
+ customers->add(new Customer("B"));
+ customers->add(new Customer("C"));
+ customers->add(customer);
+ customers->removeAt(2);
+ customers->remove(customer);
+
+ m = Customer->size();
+ n = Customer.allInstances()->size();
+
+ list = null; // Type is "any".
+ list = list->including(customer);
+ list->add(customer);
+ list->add("Blah");
+ list->add(1);
+ list->removeAll(customer);
+ }
+
+} do {
+ this.test(notEmpty, includes, n, m, customers, list);
+
+// AssertFalse("notEmpty", notEmpty);
+// AssertFalse("includes", includes);
+// AssertEqual("n", n, 3);
+// AssertEqual("m", m, 3);
+//
+// AssertList("customers.name", customers.name, "C");
+// AssertList("list", list, any[]{"Blah", 1});
+
+ WriteLine("Done");
+} \ No newline at end of file

Back to the top