Skip to content

Commit

Permalink
[NF] Add reduction tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jan 18, 2019
1 parent 84a90a3 commit 6307dbc
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -696,6 +696,10 @@ redeclare3.mo \
redeclare4.mo \
redeclare7.mo \
redeclare9.mo \
ReductionInvalidTypeSum.mo \
ReductionInvalidTypeProduct.mo \
ReductionInvalidTypeMin.mo \
ReductionInvalidTypeMax.mo \
Reinit1.mo \
Reinit2.mo \
ReinitInvalid1.mo \
Expand Down
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/ReductionInvalidTypeMax.mo
@@ -0,0 +1,21 @@
// name: ReductionInvalidTypeMax
// keywords: reduction
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin reduction operators.
//

model ReductionInvalidTypeMax
Real x = max("test" for i in 1:3);
end ReductionInvalidTypeMax;

// Result:
// Error processing file: ReductionInvalidTypeMax.mo
// [flattening/modelica/scodeinst/ReductionInvalidTypeMax.mo:10:3-10:36:writable] Error: Invalid expression ‘"test"‘ of type String in max reduction, expected scalar enumeration, Boolean, Integer or Real.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/ReductionInvalidTypeMin.mo
@@ -0,0 +1,21 @@
// name: ReductionInvalidTypeMin
// keywords: reduction
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin reduction operators.
//

model ReductionInvalidTypeMin
Real x = min({1, 2, 3} for i in 1:3);
end ReductionInvalidTypeMin;

// Result:
// Error processing file: ReductionInvalidTypeMin.mo
// [flattening/modelica/scodeinst/ReductionInvalidTypeMin.mo:10:3-10:39:writable] Error: Invalid expression ‘{1, 2, 3}‘ of type Integer[3] in min reduction, expected scalar enumeration, Boolean, Integer or Real.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/ReductionInvalidTypeProduct.mo
@@ -0,0 +1,21 @@
// name: ReductionInvalidTypeProduct
// keywords: reduction
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin reduction operators.
//

model ReductionInvalidTypeProduct
Real x = product({1, 2, 3} for i in 1:3);
end ReductionInvalidTypeProduct;

// Result:
// Error processing file: ReductionInvalidTypeProduct.mo
// [flattening/modelica/scodeinst/ReductionInvalidTypeProduct.mo:10:3-10:43:writable] Error: Invalid expression ‘{1, 2, 3}‘ of type Integer[3] in product reduction, expected scalar Integer or Real.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/ReductionInvalidTypeSum.mo
@@ -0,0 +1,21 @@
// name: ReductionInvalidTypeSum
// keywords: reduction
// status: incorrect
// cflags: -d=newInst
//
// Tests the builtin reduction operators.
//

model ReductionInvalidTypeSum
Real x = sum("test" for i in 1:3);
end ReductionInvalidTypeSum;

// Result:
// Error processing file: ReductionInvalidTypeSum.mo
// [flattening/modelica/scodeinst/ReductionInvalidTypeSum.mo:10:3-10:36:writable] Error: Invalid expression ‘"test"‘ of type String in sum reduction, expected Integer or Real.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult

0 comments on commit 6307dbc

Please sign in to comment.