Skip to content

Commit

Permalink
Add testcase for #3395
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed Aug 3, 2015
1 parent 722fdf9 commit 7d07b6b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
27 changes: 27 additions & 0 deletions simulation/modelica/algorithms_functions/FunctionTupleRecord.mo
@@ -0,0 +1,27 @@
model FunctionTupleRecord
record R
Real r1;
Integer r2;
end R;

function f4
input Real x1;
input Real x2;
input R r;
output R y1;
output Real y2;
algorithm
y1.r1 := if x1>x2 then sin(r.r1) else cos(r.r2);
y1.r2 := integer(ceil(y1.r1));
for i in 1:y1.r2 loop
y1.r1 := y1.r1+x1*x2+r.r1*r.r2;
end for;
y2 := r.r1*r.r2;
end f4;

R cse4, y;
Real cse5;
equation
y = cse4;
(cse4, cse5) = f4(time, 0, R(time, 2));
end FunctionTupleRecord;
11 changes: 11 additions & 0 deletions simulation/modelica/algorithms_functions/FunctionTupleRecord.mos
@@ -0,0 +1,11 @@
// status: correct

loadFile("FunctionTupleRecord.mo");getErrorString();
buildModel(FunctionTupleRecord);getErrorString();

// Result:
// true
// ""
// {"FunctionTupleRecord","FunctionTupleRecord_init.xml"}
// ""
// endResult
15 changes: 8 additions & 7 deletions simulation/modelica/algorithms_functions/Makefile
Expand Up @@ -21,6 +21,7 @@ FuncDer.mos \
FunctionIndirectRecursion.mos \
FunctionIndirectRecursion2.mos \
FunctionInReinit.mos \
FunctionTupleRecord.mos \
Interpolation.mos \
InverseAlgorithm1.mos \
InverseAlgorithm2.mos \
Expand All @@ -39,7 +40,7 @@ WhenStatement3.mos \
whenstatements.mos \
ZeroCross.mos \

# test that currently fail. Move up when fixed.
# test that currently fail. Move up when fixed.
# Run make testfailing
FAILINGTESTFILES = \
StatementCall.mos \
Expand All @@ -62,8 +63,8 @@ test:
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)
# Cleans all files that are not listed as dependencies

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)
Expand All @@ -72,11 +73,11 @@ clean :
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

Expand Down

0 comments on commit 7d07b6b

Please sign in to comment.