Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
9b9d7b81
Commit
9b9d7b81
authored
Jul 12, 2018
by
Christoph Richter
Browse files
Added additional test for add
parent
5ade1c2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/test/java/de/monticore/lang/monticar/generator/cpp/armadillo/BasicMathGenerationArmadilloTest.java
View file @
9b9d7b81
...
...
@@ -158,4 +158,18 @@ public class BasicMathGenerationArmadilloTest extends AbstractSymtabTest {
String
restPath
=
"armadillo/testMath/l0/"
;
testFilesAreEqual
(
files
,
restPath
);
}
@Test
public
void
matScalarAddTest
()
throws
IOException
{
TaggingResolver
symtab
=
createSymTabAndTaggingResolver
(
"src/test/resources"
);
ExpandedComponentInstanceSymbol
componentSymbol
=
symtab
.<
ExpandedComponentInstanceSymbol
>
resolve
(
"test.math.matScalarAddTest"
,
ExpandedComponentInstanceSymbol
.
KIND
).
orElse
(
null
);
assertNotNull
(
componentSymbol
);
GeneratorCPP
generatorCPP
=
new
GeneratorCPP
();
generatorCPP
.
useArmadilloBackend
();
generatorCPP
.
setGenerationTargetPath
(
"./target/generated-sources-cpp/armadillo/testMath/l0"
);
List
<
File
>
files
=
generatorCPP
.
generateFiles
(
symtab
,
componentSymbol
,
symtab
);
String
restPath
=
"armadillo/testMath/l0/"
;
testFilesAreEqual
(
files
,
restPath
);
}
}
src/test/resources/results/armadillo/testMath/l0/test_math_matScalarAddTest.h
0 → 100644
View file @
9b9d7b81
#ifndef TEST_MATH_MATSCALARADDTEST
#define TEST_MATH_MATSCALARADDTEST
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#include
"armadillo.h"
using
namespace
arma
;
class
test_math_matScalarAddTest
{
public:
void
init
()
{
}
void
execute
()
{
mat
A
=
(
ones
<
mat
>
(
2
,
2
));
double
b
=
1
;
A
=
A
+
1
;
}
};
#endif
src/test/resources/test/math/MatScalarAddTest.emam
0 → 100644
View file @
9b9d7b81
package
test
.
math
;
component
MatScalarAddTest
{
implementation
Math
{
Q
^{
2
,
2
}
A
=
ones
(
2
,
2
);
Q
b
=
1
;
A
=
A
+
1
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment