Skip to content

Commit

Permalink
Update tests for -d=nogen being the default
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Dec 16, 2016
1 parent ee053f0 commit 4a890b8
Show file tree
Hide file tree
Showing 100 changed files with 133 additions and 148 deletions.
Expand Up @@ -25,7 +25,7 @@ getErrorString();
// end StackOverflowTest.f;
//
// class StackOverflowTest
// constant Real r = fail();
// constant Real r = StackOverflowTest.f();
// end StackOverflowTest;
// "
// "[Script/CevalScript.mo:0:0-0:0:writable] Error: Internal error Stack overflow when evaluating function call: StackOverflowTest.f()...
Expand Down
@@ -1,4 +1,5 @@
// name: TestGravityAcceleration
// cflags: -d=gen
// keywords: instance function
// status: correct
//
Expand Down Expand Up @@ -148,6 +149,6 @@ end TestGravityAcceleration;
// gravity[2] = -9.81;
// gravity[3] = 0.0;
// end TestGravityAcceleration;
// [flattening/modelica/algorithms-functions/TestGravityAcceleration.mo:58:7-61:19:writable] Error: Cyclically dependent constants or parameters found in scope : {gravityType}, {g}, {mue}.
// [flattening/modelica/algorithms-functions/TestGravityAcceleration.mo:59:7-62:19:writable] Error: Cyclically dependent constants or parameters found in scope : {gravityType}, {g}, {mue}.
//
// endResult
Expand Up @@ -112,6 +112,6 @@ end M;
// end f;
//
// class M
// constant Real r = 0.2575342903011664;
// constant Real r = f({1, 2});
// end M;
// endResult
@@ -1,4 +1,5 @@
// name: ExternalFunction1
// cflags: -d=gen
// keywords: external function,code generation,constant propagation
// status: correct
// setup_command: gcc `if test "x86_64" = \`uname -m\`; then echo -fPIC; fi` -c -o ExternalFunction1_f.o ExternalFunction1_f.c
Expand Down
@@ -1,6 +1,7 @@
// name: ExternalFunction2
// keywords: external function,code generation,constant propagation
// status: correct
// cflags: -d=gen
// setup_command: gcc `if test "x86_64" = \`uname -m\`; then echo -fPIC; fi` -c -o ExternalFunction2_f.o ExternalFunction2_f.c
// teardown_command: rm -f ExternalFunction2_f.o ext__f*
//
Expand Down
3 changes: 2 additions & 1 deletion flattening/modelica/external-functions/ExternalFunction3.mo
@@ -1,6 +1,7 @@
// name: ExternalFunction3
// keywords: external function,code generation,constant propagation
// status: correct
// cflags: -d=gen
// setup_command: gcc `if test "x86_64" = \`uname -m\`; then echo -fPIC; fi` -c -o ExternalFunction3-addmatrices.o ExternalFunction3-addmatrices.c
// teardown_command: rm -f ExternalFunction3-addmatrices.o ExternalFunction3_*
//
Expand Down Expand Up @@ -52,6 +53,6 @@ end ExternalFunction3;
// c[2,1] = 10.0;
// c[2,2] = 12.0;
// end ExternalFunction3;
// [flattening/modelica/external-functions/ExternalFunction3.mo:13:1-18:16:writable] Warning: An external declaration with a single output without explicit mapping is defined as having the output as the lhs, but language C does not support this for array variables. OpenModelica will put the output as an input (as is done when there is more than 1 output), but this is not according to the Modelica Specification. Use an explicit mapping instead of the implicit one to suppress this warning.
// [flattening/modelica/external-functions/ExternalFunction3.mo:14:1-19:16:writable] Warning: An external declaration with a single output without explicit mapping is defined as having the output as the lhs, but language C does not support this for array variables. OpenModelica will put the output as an input (as is done when there is more than 1 output), but this is not according to the Modelica Specification. Use an explicit mapping instead of the implicit one to suppress this warning.
//
// endResult
@@ -1,6 +1,7 @@
// name: ExternalFunction6
// status: correct
// teardown_command: rm -f ExternalFunction6_*
// cflags: -d=gen

class ExternalFunction6
function fn
Expand Down
@@ -1,5 +1,5 @@
// name: ExternalFunctionArray
// cflags: +d=noevalfunc
// cflags: -d=noevalfunc,gen
// status: correct
// teardown_command: rm -f ExternalFunctionArray_*
//
Expand Down
2 changes: 2 additions & 0 deletions flattening/modelica/mosfiles/ExternalFunctionResultOrder.mos
Expand Up @@ -8,6 +8,7 @@
// and not only when the outputs are in the same order as the default mapping.
//

setCommandLineOptions("-d=gen,noevalfunc");
loadFile("ExternalFunctionResultOrder.mo");
ExternalFunctionResultOrder.c1234();getErrorString();
ExternalFunctionResultOrder.c2341();getErrorString();
Expand All @@ -21,6 +22,7 @@ ExternalFunctionResultOrder.f4321();getErrorString();

// Result:
// true
// true
// (1,2,3,4)
// ""
// (2,3,4,1)
Expand Down
2 changes: 2 additions & 0 deletions flattening/modelica/mosfiles/ExternalLibraryFunction.mos
Expand Up @@ -12,6 +12,7 @@ echo(true);
libs[1,1];
testsuiteFriendlyName(libs[1,2]);
testsuiteFriendlyName(OpenModelica.Scripting.uriToFilename("modelica://Test")); // Don't print the full path
setCommandLineOptions("-d=gen,noevalfunc");
Test.ext1();getErrorString();
Test.ext2();getErrorString();
Test.ext3();getErrorString();
Expand All @@ -25,6 +26,7 @@ Test.ext4();getErrorString();
// "Test"
// "flattening/modelica/mosfiles/TestLibrary"
// "flattening/modelica/mosfiles/TestLibrary"
// true
// 42.1
// ""
// 42.2
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/mosfiles/LeastSquares.mos
@@ -1,5 +1,5 @@
// status: correct
// cflags: +d=noevalfunc
// cflags: -d=noevalfunc,gen

loadModel(Modelica,{"3.2"});getErrorString();
Modelica.Math.Matrices.leastSquares([1,2; 3,4], {1,2});getErrorString();
Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/mosfiles/QuotedFunction.mos
@@ -1,6 +1,6 @@
// name: QuotedFunction
// status: correct
// cflags: +d=noevalfunc
// cflags: -d=noevalfunc,gen
// env: MODELICAUSERCFLAGS=-g
// teardown_command: rm -f _omcQuot_*

Expand Down
2 changes: 1 addition & 1 deletion flattening/modelica/mosfiles/StringArrayReturn.mos
Expand Up @@ -2,7 +2,7 @@
// status: correct
// teardown_command: rm -f StringArrayReturn_*

setCommandLineOptions("+d=noevalfunc");
setCommandLineOptions("-d=noevalfunc,gen");
loadString("
package StringArrayReturn
function f
Expand Down
6 changes: 2 additions & 4 deletions flattening/modelica/mosfiles/ZeroRange.mos
Expand Up @@ -12,9 +12,9 @@ ZeroRange.testRangeLoop(0,-1,-1);
ZeroRange.testRangeLoop(0,-1,0);
ZeroRange.testRangeLoop(0,-1,1);

ZeroRange.testRangeLoop(0,0,1);
// ZeroRange.testRangeLoop(0,0,1);

setCommandLineOptions("+d=noevalfunc");
setCommandLineOptions("-d=noevalfunc,gen");
ZeroRange.testRangeLoop(0,1,-1);
ZeroRange.testRangeLoop(0,1,0);
ZeroRange.testRangeLoop(0,1,1);
Expand All @@ -32,8 +32,6 @@ ZeroRange.testRangeLoop(0,0,1);
// 2
// 1
// 0
// [:-1:-1--1:-1:readonly]Modelica Assert: assertion range step != 0 failed!
// fail()
// true
// 0
// 1
Expand Down
8 changes: 4 additions & 4 deletions flattening/modelica/others/EndUnknown.mo
@@ -1,6 +1,6 @@
// name: EndUnknown
// status: correct
// cflags: +d=noevalfunc
// cflags: -d=noevalfunc,gen
// teardown_command: rm -f EndUnknown_*

model EndUnknown
Expand All @@ -20,7 +20,7 @@ model EndUnknown
end if;
end simpson;

parameter Real a = simpson({0.4, 0.3, 0.1, 0.2, 0.3},0,1);
constant Real a = simpson({0.4, 0.3, 0.1, 0.2, 0.3},0,1);
Real x(start=1);
equation
der(x) = -a * x;
Expand All @@ -41,9 +41,9 @@ end EndUnknown;
// end EndUnknown.simpson;
//
// class EndUnknown
// parameter Real a = 0.2416666666666666;
// constant Real a = 0.2416666666666666;
// Real x(start = 1.0);
// equation
// der(x) = (-a) * x;
// der(x) = -0.2416666666666666 * x;
// end EndUnknown;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/others/StringPool.mo
@@ -1,5 +1,5 @@
// name: StringPool
// cflags: +d=noevalfunc
// cflags: -d=noevalfunc,gen
// status: correct
// teardown_command: rm -f StringPool_*
//
Expand Down
4 changes: 3 additions & 1 deletion flattening/modelica/records/EmptyRecordTestConstructor.mos
Expand Up @@ -8,8 +8,9 @@ loadFile("RecordTest.mo");

a:=RecordTest.mk_empty1();
a:=RecordTest.mk_empty2();
a:=RecordTest.mk_empty_ext();
a:=RecordTest.EMPTY();
setCommandLineOptions("-d=gen");
a:=RecordTest.mk_empty_ext();

// Result:
// true
Expand All @@ -19,6 +20,7 @@ a:=RecordTest.EMPTY();
// end RecordTest.EMPTY;
// record RecordTest.EMPTY
// end RecordTest.EMPTY;
// true
// record RecordTest.EMPTY
// end RecordTest.EMPTY;
// endResult
24 changes: 13 additions & 11 deletions flattening/modelica/records/NestedRecordTestConstructor.mos
Expand Up @@ -13,8 +13,9 @@ plus1:=RecordTest.mk_plus1(left,right);
plus2:=RecordTest.mk_plus2(right,right);
plus3:=RecordTest.mk_plus3(right,left);
res:=RecordTest.mk_plus4(1.0,2.0,3.0,4.0);
res:=RecordTest.mk_plus_ext(RecordTest.ADD(1.0,2.0),RecordTest.ADD(3.0,4.0));
res:=RecordTest.MULT_PLUS(plus1,plus2,plus3);
setCommandLineOptions("-d=gen");
res:=RecordTest.mk_plus_ext(RecordTest.ADD(1.0,2.0),RecordTest.ADD(3.0,4.0));

// Result:
// true
Expand Down Expand Up @@ -66,16 +67,6 @@ res:=RecordTest.MULT_PLUS(plus1,plus2,plus3);
// a2 = 4.0
// end RecordTest.ADD;
// end RecordTest.PLUS;
// record RecordTest.PLUS
// left = record RecordTest.ADD
// a1 = 1.0,
// a2 = 2.0
// end RecordTest.ADD;,
// right = record RecordTest.ADD
// a1 = 3.0,
// a2 = 4.0
// end RecordTest.ADD;
// end RecordTest.PLUS;
// record RecordTest.MULT_PLUS
// plus1 = record RecordTest.PLUS
// left = record RecordTest.ADD
Expand Down Expand Up @@ -108,4 +99,15 @@ res:=RecordTest.MULT_PLUS(plus1,plus2,plus3);
// end RecordTest.ADD;
// end RecordTest.PLUS;
// end RecordTest.MULT_PLUS;
// true
// record RecordTest.PLUS
// left = record RecordTest.ADD
// a1 = 1.0,
// a2 = 2.0
// end RecordTest.ADD;,
// right = record RecordTest.ADD
// a1 = 3.0,
// a2 = 4.0
// end RecordTest.ADD;
// end RecordTest.PLUS;
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/records/RecordSliceAssign.mo
@@ -1,6 +1,7 @@
// name: RecordSliceAssign
// keywords: record slice #3245
// status: correct
// cflags: -d=gen
//
// Checks that assigning to a slice of an array of records works.
//
Expand Down
4 changes: 3 additions & 1 deletion flattening/modelica/records/SimpleRecordTestConstructor.mos
Expand Up @@ -9,8 +9,9 @@ loadFile("RecordTest.mo");
a:=RecordTest.mk_add1(1.0,2.0);
a:=RecordTest.mk_add2(1.0,2.0);
a:=RecordTest.mk_add3();
a:=RecordTest.mk_add_ext(1.0,2.0);
a:=RecordTest.ADD(1.0,2.0);
setCommandLineOptions("-d=gen");
a:=RecordTest.mk_add_ext(1.0,2.0);

// Result:
// true
Expand All @@ -30,6 +31,7 @@ a:=RecordTest.ADD(1.0,2.0);
// a1 = 1.0,
// a2 = 2.0
// end RecordTest.ADD;
// true
// record RecordTest.ADD
// a1 = 1.0,
// a2 = 2.0
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/AlgPatternm.mos
@@ -1,7 +1,7 @@
// name: AlgPatternm
// status: correct

setCommandLineOptions("+g=MetaModelica");
setCommandLineOptions("-g=MetaModelica -d=gen");
loadFile("AlgPatternm.mo");
getErrorString();
AlgPatternm.f1(1);
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/AllWild.mos
@@ -1,5 +1,5 @@
// name: AllWild
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
// status: correct
// teardown_command: rm -rf AllWild_*

Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/ArraySubscripting.mos
@@ -1,7 +1,7 @@
// name: ArraySubscripting
// keywords: builtin, array, subscript
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Checks that subscripting of arrays works correctly.
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/AssignMatchVar.mos
@@ -1,5 +1,5 @@
// name: AssignMatchVar
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
// status: correct
//
// Checks that it's allowed to assign to a non-input variable that's used in a
Expand Down
4 changes: 3 additions & 1 deletion metamodelica/meta/AssignMetaRecordField.mos
@@ -1,6 +1,7 @@
// status: correct

setCommandLineOptions("--grammar=MetaModelica");loadString("
setCommandLineOptions("--grammar=MetaModelica -d=gen");
loadString("
function assignMetaRecordField
uniontype union
record METARECORD
Expand All @@ -18,6 +19,7 @@ algorithm
end match;
end assignMetaRecordField;");getErrorString();
assignMetaRecordField();getErrorString();

// Result:
// true
// true
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/BuiltinArray.mos
@@ -1,7 +1,7 @@
// name: BuiltinArray
// keywords: Builtin
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Builtin function testing
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/BuiltinList.mos
@@ -1,7 +1,7 @@
// name: BuiltinList
// keywords: Builtin
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Builtin function testing
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/BuiltinMisc.mos
@@ -1,7 +1,7 @@
// name: BuiltinMisc
// keywords: Builtin
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Builtin function testing
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/BuiltinReal.mos
@@ -1,7 +1,7 @@
// name: BuiltinReal
// keywords: Builtin
// status: correct
// cflags: +g=MetaModelica +d=noevalfunc
// cflags: -g=MetaModelica -d=noevalfunc,gen
//
// Builtin function testing
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/BuiltinString.mos
@@ -1,7 +1,7 @@
// name: BuiltinString
// keywords: Builtin
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Builtin function testing
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/Continue.mo
@@ -1,5 +1,5 @@
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen

model TestContinue
function f
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/EqPatternm.mos
@@ -1,7 +1,7 @@
// name: EqPatternm
// keywords: EqPatternm
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Pattern matching in equations
//
Expand Down
2 changes: 1 addition & 1 deletion metamodelica/meta/Equality.mos
@@ -1,7 +1,7 @@
// name: Equality
// keywords: Equality
// status: correct
// cflags: +g=MetaModelica
// cflags: -g=MetaModelica -d=gen
//
// Equality Testing
//
Expand Down

0 comments on commit 4a890b8

Please sign in to comment.