ci und test updated

This commit is contained in:
Nicolas Kruse 2025-10-14 23:21:23 +02:00
parent 46dcaf3e66
commit 04a6c7d525
4 changed files with 14 additions and 11 deletions

View File

@ -60,11 +60,11 @@ jobs:
python tools/extract_code.py "bin/test.copapy" "bin/test.copapy.bin" python tools/extract_code.py "bin/test.copapy" "bin/test.copapy.bin"
objdump --disassembler-color=on -D -b binary -m i386:x86-64 --adjust-vma=0x1000 bin/test.copapy.bin > bin/test.copapy.asm objdump --disassembler-color=on -D -b binary -m i386:x86-64 --adjust-vma=0x1000 bin/test.copapy.bin > bin/test.copapy.asm
echo '<p>test.copapy.asm</p><code>' >> $GITHUB_STEP_SUMMARY echo '<p>test.copapy.asm</p><code>' >> $GITHUB_STEP_SUMMARY
cat bin/test.copapy.asm | ansi2html >> $GITHUB_STEP_SUMMARY cat bin/test.copapy.asm | ansi2html -i >> $GITHUB_STEP_SUMMARY
echo '</code>' >> $GITHUB_STEP_SUMMARY echo '</code>' >> $GITHUB_STEP_SUMMARY
objdump --disassembler-color=on -d -j .text src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm objdump --disassembler-color=on -d -j .text src/copapy/obj/stencils_x86_64_O3.o > bin/stencils_x86_64_O3.asm
echo '<p>stencils_x86_64_O3.asm</p><code>' >> $GITHUB_STEP_SUMMARY echo '<p>stencils_x86_64_O3.asm</p><code>' >> $GITHUB_STEP_SUMMARY
cat bin/stencils_x86_64_O3.asm | ansi2html >> $GITHUB_STEP_SUMMARY cat bin/stencils_x86_64_O3.asm | ansi2html -i >> $GITHUB_STEP_SUMMARY
echo '</code>' >> $GITHUB_STEP_SUMMARY echo '</code>' >> $GITHUB_STEP_SUMMARY
- name: Run tests with pytest - name: Run tests with pytest

View File

@ -36,7 +36,6 @@ def test_example():
def function(c1, c2): def function(c1, c2):
i1 = c1 // 3.3 + 5 i1 = c1 // 3.3 + 5
i2 = c2 * 5 + c1 i2 = c2 * 5 + c1
#r1 = i1 + i2 * 55 / 4
r1 = i1 + i2 * 55 / 4 r1 = i1 + i2 * 55 / 4
r2 = 4 * i2 + 5 r2 = 4 * i2 + 5
@ -48,8 +47,8 @@ def test_compile():
c1 = CPVariable(4) c1 = CPVariable(4)
c2 = CPVariable(2) c2 = CPVariable(2)
#ret = function(c1, c2) ret = function(c1, c2)
ret = [c1 // 3.3 + 5] #ret = [c1 // 3.3 + 5]
out = [Write(r) for r in ret] out = [Write(r) for r in ret]
@ -58,8 +57,8 @@ def test_compile():
# run program command # run program command
il.write_com(binwrite.Command.RUN_PROG) il.write_com(binwrite.Command.RUN_PROG)
#for net in ret: for net in ret:
# copapy.add_read_command(il, variables, net) copapy.add_read_command(il, variables, net)
il.write_com(binwrite.Command.END_COM) il.write_com(binwrite.Command.END_COM)

View File

@ -3,9 +3,13 @@ from pytest import approx
def function(c1): def function(c1):
r1 = c1 / 2 i1 = c1 / 4 + c1 / -4 - c1 // 4 * c1 // -4 + (c1 * -1) // 4
return [r1] r1 = i1 / 32.4 + 54 * c1
r2 = 65 * c1 + 8
r3 = c1 > r2
return [r1, r2, r3]
def test_compile(): def test_compile():

View File

@ -29,8 +29,8 @@ def test_compile():
c_f = CPVariable(1.111) c_f = CPVariable(1.111)
c_b = CPVariable(True) c_b = CPVariable(True)
ret_test = function1(c_i) + function1(c_f) #+ function2(c_i) + function2(c_f) + function3(c_i) + function4(c_i) + function5(c_b) + [CPVariable(9) % 2] ret_test = function1(c_i) + function1(c_f) + function2(c_i) + function2(c_f) + function3(c_i) + function4(c_i) + function5(c_b) + [CPVariable(9) % 2]
ret_ref = function1(9) + function1(1.111) #+ function2(9) + function2(1.111) + function3(9) + function4(9) + function5(True) + [9 % 2] ret_ref = function1(9) + function1(1.111) + function2(9) + function2(1.111) + function3(9) + function4(9) + function5(True) + [9 % 2]
print(ret_test) print(ret_test)