Skip to content

Commit

Permalink
Update nfinst tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Nov 9, 2017
1 parent 3852898 commit 1514b59
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 41 deletions.
29 changes: 29 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute1.mo
@@ -0,0 +1,29 @@
// name: BuiltinAttribute1
// keywords:
// status: correct
// cflags: -d=newInst
//

model BuiltinAttribute1
Real r(quantity = "m", unit = "kg", displayUnit = "kg",
min = -100, max = 100, start = 10, fixed = true, nominal = 1,
unbounded = true, stateSelect = StateSelect.never);

Integer i(quantity = "m", min = -100, max = 100, start = 10, fixed = true);
Boolean b(quantity = "m", start = false, fixed = true);
String s(quantity = "m", start = "hello", fixed = true);

type E = enumeration(one, two, three);
E e(quantity = "m", min = E.two, max = E.three, start = E.two, fixed = false);
end BuiltinAttribute1;


// Result:
// class BuiltinAttribute1
// Real r(quantity = "m", unit = "kg", displayUnit = "kg", min = -100.0, max = 100.0, start = 10.0, fixed = true, nominal = 1.0, stateSelect = StateSelect.never);
// Integer i(quantity = "m", min = -100, max = 100, start = 10, fixed = true);
// Boolean b(quantity = "m", start = false, fixed = true);
// String s(quantity = "m", start = "hello");
// enumeration(one, two, three) e(quantity = "m", min = E.two, max = E.three, start = E.two, fixed = false);
// end BuiltinAttribute1;
// endResult
@@ -1,11 +1,8 @@
// name: builtinmod.mo
// name: BuiltinAttribute2
// keywords:
// status: correct
// cflags: -d=newInst
// cflags: -d=newInst
//
// FAILREASON: Enumeration instance m is missing it's start value.
//


type MyReal
extends Real;
Expand All @@ -27,23 +24,22 @@ type MyStateSelect
extends StateSelect;
end MyStateSelect;

model A
model BuiltinAttribute2
MyReal r(quantity = "m", unit = "kg", displayUnit = "kg",
min = -100, max = 100, start = 10, fixed = true, nominal = 1.0,
stateSelect = StateSelect.never);
unbounded = true, stateSelect = StateSelect.never);

MyInteger i(quantity = "m", min = -100, max = 100, start = 10, fixed = true);
MyBoolean b(quantity = "m", start = false, fixed = true);
MyString s(quantity = "m", start = "hello");
MyStateSelect m(start = MyStateSelect.avoid);
end A;
MyString s(quantity = "m", start = "hello", fixed = true);
end BuiltinAttribute2;


// Result:
// class A
// class BuiltinAttribute2
// Real r(quantity = "m", unit = "kg", displayUnit = "kg", min = -100, max = 100, start = 10, fixed = true, nominal = 1.0, stateSelect = StateSelect.never);
// Integer i(quantity = "m", min = -100, max = 100, start = 10, fixed = true);
// Boolean b(quantity = "m", start = false, fixed = true);
// String s(quantity = "m", start = "hello");
// enumeration(never, avoid, default, prefer, always) m(start = StateSelect.avoid);
// end A;
// end BuiltinAttribute2;
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute3.mo
@@ -0,0 +1,19 @@
// name: BuiltinAttribute3
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model BuiltinAttribute3
Real x(start(y = 1));
end BuiltinAttribute3;

// Result:
// Error processing file: BuiltinAttribute3.mo
// [flattening/modelica/scodeinst/BuiltinAttribute3.mo:8:10-8:22:writable] Error: Modified element start.y not found in class Real.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute4.mo
@@ -0,0 +1,19 @@
// name: BuiltinAttribute4
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model BuiltinAttribute4
Real x(x = 1);
end BuiltinAttribute4;

// Result:
// Error processing file: BuiltinAttribute4.mo
// [flattening/modelica/scodeinst/BuiltinAttribute4.mo:8:10-8:15:writable] Error: Modified element x not found in class Real.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute5.mo
@@ -0,0 +1,19 @@
// name: BuiltinAttribute5
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model BuiltinAttribute5
Real x(start = "fish");
end BuiltinAttribute5;

// Result:
// Error processing file: BuiltinAttribute5.mo
// [flattening/modelica/scodeinst/BuiltinAttribute5.mo:8:10-8:24:writable] Error: Type mismatch in binding start = "fish", expected subtype of Real, got type String.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute6.mo
@@ -0,0 +1,19 @@
// name: BuiltinAttribute6
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model BuiltinAttribute6
Real x(quantity = 1);
end BuiltinAttribute6;

// Result:
// Error processing file: BuiltinAttribute6.mo
// [flattening/modelica/scodeinst/BuiltinAttribute6.mo:8:10-8:22:writable] Error: Type mismatch in binding quantity = 1, expected subtype of String, got type Integer.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute7.mo
@@ -0,0 +1,19 @@
// name: BuiltinAttribute7
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model BuiltinAttribute7
Real x(redeclare Real start = 1.0);
end BuiltinAttribute7;

// Result:
// Error processing file: BuiltinAttribute7.mo
// [flattening/modelica/scodeinst/BuiltinAttribute7.mo:8:10-8:36:writable] Error: Invalid redeclaration of start, attributes of basic types may not be redeclared.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute8.mo
@@ -0,0 +1,25 @@
// name: BuiltinAttribute8
// keywords:
// status: incorrect
// cflags: -d=newInst
//


model A
Real x(final start = 1.0);
end A;

model BuiltinAttribute8
extends A(x(start = 2.0));
end BuiltinAttribute8;

// Result:
// Error processing file: BuiltinAttribute8.mo
// [flattening/modelica/scodeinst/BuiltinAttribute8.mo:13:15-13:26:writable] Notification: From here:
// [flattening/modelica/scodeinst/BuiltinAttribute8.mo:9:16-9:27:writable] Error: Trying to override final element start with modifier '2.0'.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/BuiltinAttribute9.mo
@@ -0,0 +1,21 @@
// name: BuiltinAttribute9
// keywords:
// status: incorrect
// cflags: -d=newInst
//


model BuiltinAttribute9
Real x;
Real y(start = x);
end BuiltinAttribute9;

// Result:
// Error processing file: BuiltinAttribute9.mo
// [flattening/modelica/scodeinst/BuiltinAttribute9.mo:10:10-10:19:writable] Error: Component start of variability parameter has binding 'x' of higher variability continuous.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
13 changes: 10 additions & 3 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -16,16 +16,22 @@ BindingArray1.mo \
BindingArray2.mo \
BindingArray3.mo \
BindingArray4.mo \
BindingArray5.mo \
BindingArray6.mo \
bindings1.mo \
bindings4.mo \
bindings5.mo \
bindings7.mo \
BooleanDim.mo \
BuiltinAttribute1.mo \
BuiltinAttribute2.mo \
BuiltinAttribute3.mo \
BuiltinAttribute4.mo \
BuiltinAttribute5.mo \
BuiltinAttribute6.mo \
BuiltinAttribute7.mo \
BuiltinAttribute8.mo \
BuiltinAttribute9.mo \
BuiltinLookup1.mo \
builtinmod.mo \
builtinmod2.mo \
BuiltinTime.mo \
ceval1.mo \
ceval2.mo \
Expand Down Expand Up @@ -390,6 +396,7 @@ WhenNested1.mo \
# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES=\
BindingArray5.mo \
ActualStream.mo \
ActualStreamMinMax.mo \
InStreamInvalidArgument1.mo \
Expand Down
25 changes: 0 additions & 25 deletions flattening/modelica/scodeinst/builtinmod2.mo

This file was deleted.

0 comments on commit 1514b59

Please sign in to comment.