-
Notifications
You must be signed in to change notification settings - Fork 298
/
FuncBuiltinMin.mo
44 lines (38 loc) · 1006 Bytes
/
FuncBuiltinMin.mo
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
// name: FuncBuiltinMin
// keywords: min
// status: correct
// cflags: -d=newInst
//
// Tests the builtin min operator.
//
model FuncBuiltinMin
type E = enumeration(one, two, three);
Real r1 = min(4.0, 2.0);
Real r2 = min({3.0, 1.0, 2.0});
Real r3 = min(r1, r2);
Integer i1 = min(5, 6);
Integer i2 = min({4, 2, 1});
Integer i3 = min(i2, i1);
Boolean b1 = min(true, false);
Boolean b2 = min({false, true});
Boolean b3 = min(b1, b2);
E e1 = min(E.one, E.three);
E e2 = min({E.one, E.two, E.three});
E e3 = min(e1, e2);
end FuncBuiltinMin;
// Result:
// class FuncBuiltinMin
// Real r1 = 2.0;
// Real r2 = 1.0;
// Real r3 = min(r1, r2);
// Integer i1 = 5;
// Integer i2 = 1;
// Integer i3 = min(i2, i1);
// Boolean b1 = false;
// Boolean b2 = false;
// Boolean b3 = min(b1, b2);
// enumeration(one, two, three) e1 = E.one;
// enumeration(one, two, three) e2 = E.one;
// enumeration(one, two, three) e3 = min(e1, e2);
// end FuncBuiltinMin;
// endResult