-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathhead_content.rosetta
More file actions
101 lines (85 loc) · 2.05 KB
/
head_content.rosetta
File metadata and controls
101 lines (85 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
namespace rosetta_dsl.test.semantic.collections : <"generate Python unit tests from Rosetta.">
type CountItem:
name string (0..1)
value int (0..1)
type CountContainer:
field1 int (0..*)
field2 CountItem (0..*)
type CountTest:
bValue CountContainer (1..*)
condition TestCond:
if bValue -> field2 count > 0
then True
else False
type SumTest:
aValue int (1..1)
bValue int (1..1)
target int (1..1)
condition TestCond:
if [aValue, bValue] sum = target
then True
else False
type MinTest:
a int (1..1)
condition Test:
if [a, 1] min = 1
then True
else False
type MaxTest:
a int (1..1)
condition Test:
if [a, 1, 20] max = 20
then True
else False
type LastTest:
aValue int (1..1)
bValue int (1..1)
cValue int (1..1)
target int (1..1)
condition TestCond:
if [aValue, bValue, cValue] last = target
then True
else False
type SortTest:
condition Test:
if [3, 2, 1] sort first = 1
then True
else False
type JoinTest:
field1 string (1..1)
field2 string (1..1)
condition TestCond:
if [field1, field2] join "" = "ab"
then True
else False
type FilterItem:
fi int (1..1)
type FilterTest:
fis FilterItem (1..*)
target int (1..1)
condition TestCondFilter:
if [fis filter i [i->fi = target]] count = 1
then True
else False
type FlattenItem:
field1 int (1..*)
type FlattenContainer:
fieldList FlattenItem (1..*)
type FlattenBar:
numbers int (0..*)
type FlattenFoo:
bars FlattenBar (0..*)
condition TestCondFoo:
[1, 2, 3] = (bars
extract numbers
then flatten)
func FlattenTest: <"Test flatten operation in a condition">
inputs:
bValue FlattenContainer (1..*) <"Test value">
output:
result int (1..*)
set result:
bValue
extract fieldList
then extract field1
then flatten