From 6b70c759d6e4d9f2a810307b10928278508d18c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Sun, 8 Oct 2017 15:35:30 +0200 Subject: [PATCH] Add test for ticket:4550 reduction type Belonging to [master]: - OpenModelica/OMCompiler#1870 - OpenModelica/OpenModelica-testsuite#727 --- simulation/modelica/functions_eval/Makefile | 1 + .../NumberOfSymmetricBaseSystems.mos | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 simulation/modelica/functions_eval/NumberOfSymmetricBaseSystems.mos diff --git a/simulation/modelica/functions_eval/Makefile b/simulation/modelica/functions_eval/Makefile index 598ba8cc56b..1363577a951 100644 --- a/simulation/modelica/functions_eval/Makefile +++ b/simulation/modelica/functions_eval/Makefile @@ -11,6 +11,7 @@ functionTest5.mos \ functionTest7.mos \ functionTest8.mos \ functionTest9.mos \ +NumberOfSymmetricBaseSystems.mos \ simplifyIf1.mos \ simplifyIf2.mos \ ticket2535.mos \ diff --git a/simulation/modelica/functions_eval/NumberOfSymmetricBaseSystems.mos b/simulation/modelica/functions_eval/NumberOfSymmetricBaseSystems.mos new file mode 100644 index 00000000000..c2429961171 --- /dev/null +++ b/simulation/modelica/functions_eval/NumberOfSymmetricBaseSystems.mos @@ -0,0 +1,38 @@ +// status: correct +// Based on ticket:4550 + +loadString("function numberOfSymmetricBaseSystems + input Integer m=3; + output Integer n; + algorithm + n := if mod(m, 2) == 0 then product(if mod(m, i) == 0 then 2 else 1 for i in {2^j for j in 1:integer(log(m/2)/log(2))}) else 1; + end numberOfSymmetricBaseSystems;");getErrorString(); +numberOfSymmetricBaseSystems(1);getErrorString(); +numberOfSymmetricBaseSystems(2);getErrorString(); +numberOfSymmetricBaseSystems(3);getErrorString(); +numberOfSymmetricBaseSystems(4);getErrorString(); +numberOfSymmetricBaseSystems(5);getErrorString(); +numberOfSymmetricBaseSystems(6);getErrorString(); +numberOfSymmetricBaseSystems(7);getErrorString(); +numberOfSymmetricBaseSystems(8);getErrorString(); + +// Result: +// true +// "" +// 1 +// "" +// 1 +// "" +// 1 +// "" +// 2 +// "" +// 1 +// "" +// 2 +// "" +// 1 +// "" +// 4 +// "" +// endResult