Skip to content

Commit 77ca0a7

Browse files
committed
[example] assert on output tested against cpp code
1 parent c508998 commit 77ca0a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

example/cppadcg_c_codegen.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@
4242
langC = LanguageC("double", 3)
4343
nameGen = LangCDefaultVariableNameGenerator("y","x","v","array","sarray")
4444
code = handler.generateCode(langC, jac, nameGen, "source")
45+
output = code.splitlines()
46+
assert(output[0]==' y[1] = 0.5 * x[1] + 0.5 * x[1];')
47+
assert(output[1]==' // dependent variables without operations')
48+
assert(output[2]==' y[0] = 0.5;')
4549
print(code)

0 commit comments

Comments
 (0)