Skip to content

Commit

Permalink
Add some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gladk committed Jun 11, 2021
1 parent d563c37 commit 7073dad
Show file tree
Hide file tree
Showing 59 changed files with 185,177 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_FLAGS="${{ matrix.cflags }}" -DCMAKE_LINKER_FLAGS="${{ matrix.linker_flage }}" -DCMAKE_SYSTEM_NAME=${{ matrix.systemname }}
run: cmake $GITHUB_WORKSPACE -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_FLAGS="${{ matrix.cflags }}" -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.linker_flage }}" -DCMAKE_SYSTEM_NAME=${{ matrix.systemname }}

- name: Build
working-directory: ${{github.workspace}}/build
Expand Down
140 changes: 74 additions & 66 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,90 +52,98 @@ install(EXPORT admesh DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/admesh)
target_compile_definitions(libadmesh PUBLIC -DVERSION="${VERSION}")

enable_testing()
# basic
add_test(basic ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl -a ${CMAKE_BINARY_DIR}/basic.stl )
add_test(basic-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/basic.stl ${CMAKE_BINARY_DIR}/basic.stl)

# x-rotate-30
add_test(x-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --x-rotate=30 -a ${CMAKE_BINARY_DIR}/x-rotate-30.stl )
add_test(x-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/x-rotate-30.stl ${CMAKE_BINARY_DIR}/x-rotate-30.stl)

# y-rotate-30
add_test(y-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --y-rotate=30 -a ${CMAKE_BINARY_DIR}/y-rotate-30.stl )
add_test(y-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/y-rotate-30.stl ${CMAKE_BINARY_DIR}/y-rotate-30.stl)
#foreach(testfile "block" "conveyor" "hourglass")
foreach(testfile "block" "conveyor")
MESSAGE("Test ${testfile}")

# z-rotate-30
add_test(z-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --z-rotate=30 -a ${CMAKE_BINARY_DIR}/z-rotate-30.stl )
add_test(z-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/z-rotate-30.stl ${CMAKE_BINARY_DIR}/z-rotate-30.stl)
# basic
add_test(${testfile}-basic ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl -a ${CMAKE_BINARY_DIR}/basic.stl )
add_test(${testfile}-basic-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/basic.stl ${CMAKE_BINARY_DIR}/basic.stl)

# x-y-z-rotate-30
add_test(x-y-z-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --x-rotate=30 --y-rotate=30 --z-rotate=30 -a ${CMAKE_BINARY_DIR}/x-y-z-rotate-30.stl )
add_test(x-y-z-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/x-y-z-rotate-30.stl ${CMAKE_BINARY_DIR}/x-y-z-rotate-30.stl)
# x-rotate-30
add_test(${testfile}-x-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --x-rotate=30 -a ${CMAKE_BINARY_DIR}/x-rotate-30.stl )
add_test(${testfile}-x-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/x-rotate-30.stl ${CMAKE_BINARY_DIR}/x-rotate-30.stl)

# xy-mirror
add_test(xy-mirror ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --xy-mirror -a ${CMAKE_BINARY_DIR}/xy-mirror.stl)
add_test(xy-mirror-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/xy-mirror.stl ${CMAKE_BINARY_DIR}/xy-mirror.stl)
# y-rotate-30
add_test(${testfile}-y-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --y-rotate=30 -a ${CMAKE_BINARY_DIR}/y-rotate-30.stl )
add_test(${testfile}-y-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/y-rotate-30.stl ${CMAKE_BINARY_DIR}/y-rotate-30.stl)

# yz-mirror
add_test(yz-mirror ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --yz-mirror -a ${CMAKE_BINARY_DIR}/yz-mirror.stl)
add_test(yz-mirror-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/yz-mirror.stl ${CMAKE_BINARY_DIR}/yz-mirror.stl)
# z-rotate-30
add_test(${testfile}-z-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --z-rotate=30 -a ${CMAKE_BINARY_DIR}/z-rotate-30.stl )
add_test(${testfile}-z-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/z-rotate-30.stl ${CMAKE_BINARY_DIR}/z-rotate-30.stl)

# xz-mirror
add_test(xz-mirror ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --xz-mirror -a ${CMAKE_BINARY_DIR}/xz-mirror.stl)
add_test(xz-mirror-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/xz-mirror.stl ${CMAKE_BINARY_DIR}/xz-mirror.stl)
# x-y-z-rotate-30
add_test(${testfile}-x-y-z-rotate-30 ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --x-rotate=30 --y-rotate=30 --z-rotate=30 -a ${CMAKE_BINARY_DIR}/x-y-z-rotate-30.stl )
add_test(${testfile}-x-y-z-rotate-30-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/x-y-z-rotate-30.stl ${CMAKE_BINARY_DIR}/x-y-z-rotate-30.stl)

# scale
add_test(scale ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --scale 3 -a ${CMAKE_BINARY_DIR}/scale.stl)
add_test(scale-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/scale.stl ${CMAKE_BINARY_DIR}/scale.stl)
# xy-mirror
add_test(${testfile}-xy-mirror ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --xy-mirror -a ${CMAKE_BINARY_DIR}/xy-mirror.stl)
add_test(${testfile}-xy-mirror-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/xy-mirror.stl ${CMAKE_BINARY_DIR}/xy-mirror.stl)

# scale-xyz
add_test(scale-xyz ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --scale-xyz=2,3,4 -a ${CMAKE_BINARY_DIR}/scale-xyz.stl)
add_test(scale-xyz-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/scale-xyz.stl ${CMAKE_BINARY_DIR}/scale-xyz.stl)
# yz-mirror
add_test(${testfile}-yz-mirror ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --yz-mirror -a ${CMAKE_BINARY_DIR}/yz-mirror.stl)
add_test(${testfile}-yz-mirror-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/yz-mirror.stl ${CMAKE_BINARY_DIR}/yz-mirror.stl)

# translate
add_test(translate ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --translate=2,3,4 -a ${CMAKE_BINARY_DIR}/translate.stl)
add_test(translate-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/translate.stl ${CMAKE_BINARY_DIR}/translate.stl)
# xz-mirror
add_test(${testfile}-xz-mirror ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --xz-mirror -a ${CMAKE_BINARY_DIR}/xz-mirror.stl)
add_test(${testfile}-xz-mirror-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/xz-mirror.stl ${CMAKE_BINARY_DIR}/xz-mirror.stl)

# translate-rel
add_test(translate-rel ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --translate-rel=2,3,4 -a ${CMAKE_BINARY_DIR}/translate-rel.stl)
add_test(translate-rel-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/translate-rel.stl ${CMAKE_BINARY_DIR}/translate-rel.stl)
# scale
add_test(${testfile}-scale ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --scale 3 -a ${CMAKE_BINARY_DIR}/scale.stl)
add_test(${testfile}-scale-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/scale.stl ${CMAKE_BINARY_DIR}/scale.stl)

# stretch
add_test(stretch ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --stretch=::22,::3,::5 -a ${CMAKE_BINARY_DIR}/stretch.stl)
add_test(stretch-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/stretch.stl ${CMAKE_BINARY_DIR}/stretch.stl)
# scale-xyz
add_test(${testfile}-scale-xyz ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --scale-xyz=2,3,4 -a ${CMAKE_BINARY_DIR}/scale-xyz.stl)
add_test(${testfile}-scale-xyz-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/scale-xyz.stl ${CMAKE_BINARY_DIR}/scale-xyz.stl)

# merge
add_test(merge ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --merge=${CMAKE_SOURCE_DIR}/test/stretch.stl -a ${CMAKE_BINARY_DIR}/merge.stl)
add_test(merge-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/merge.stl ${CMAKE_BINARY_DIR}/merge.stl)
# translate
add_test(${testfile}-translate ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --translate=2,3,4 -a ${CMAKE_BINARY_DIR}/translate.stl)
add_test(${testfile}-translate-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/translate.stl ${CMAKE_BINARY_DIR}/translate.stl)

# nearby
add_test(nearby ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/nearby-bad.stl -n -t 0.1 -a ${CMAKE_BINARY_DIR}/nearby.stl)
add_test(nearby-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/nearby-good.stl ${CMAKE_BINARY_DIR}/nearby.stl)
# translate-rel
add_test(${testfile}-translate-rel ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --translate-rel=2,3,4 -a ${CMAKE_BINARY_DIR}/translate-rel.stl)
add_test(${testfile}-translate-rel-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/translate-rel.stl ${CMAKE_BINARY_DIR}/translate-rel.stl)

# remove-unconnected
add_test(remove-unconnected ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/remove-unconnected-bad.stl --remove-unconnected -a ${CMAKE_BINARY_DIR}/remove-unconnected.stl)
add_test(remove-unconnected-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/remove-unconnected-good.stl ${CMAKE_BINARY_DIR}/remove-unconnected.stl)
# stretch
add_test(${testfile}-stretch ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --stretch=::22,::3,::5 -a ${CMAKE_BINARY_DIR}/stretch.stl)
add_test(${testfile}-stretch-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/stretch.stl ${CMAKE_BINARY_DIR}/stretch.stl)

# fill-holes
add_test(fill-holes ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/fill-holes-bad.stl --fill-holes -a ${CMAKE_BINARY_DIR}/fill-holes.stl)
add_test(fill-holes-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/fill-holes-good.stl ${CMAKE_BINARY_DIR}/fill-holes.stl)
# merge
add_test(${testfile}-merge ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --merge=${CMAKE_SOURCE_DIR}/test/${testfile}/stretch.stl -a ${CMAKE_BINARY_DIR}/merge.stl)
add_test(${testfile}-merge-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/merge.stl ${CMAKE_BINARY_DIR}/merge.stl)

# normal-directions
add_test(normal-directions ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/normal-directions-bad.stl --normal-directions -a ${CMAKE_BINARY_DIR}/normal-directions.stl)
add_test(normal-directions-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/normal-directions-good.stl ${CMAKE_BINARY_DIR}/normal-directions.stl)
# nearby
add_test(${testfile}-nearby ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/${testfile}/nearby-bad.stl -n -t 0.1 -a ${CMAKE_BINARY_DIR}/nearby.stl)
add_test(${testfile}-nearby-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/nearby-good.stl ${CMAKE_BINARY_DIR}/nearby.stl)

# binary-stl test
add_test(binary-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl -b ${CMAKE_BINARY_DIR}/binary.stl )
add_test(binary-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/binary.stl ${CMAKE_BINARY_DIR}/binary.stl)
# remove-unconnected
add_test(${testfile}-remove-unconnected ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/${testfile}/remove-unconnected-bad.stl --remove-unconnected -a ${CMAKE_BINARY_DIR}/remove-unconnected.stl)
add_test(${testfile}-remove-unconnected-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/remove-unconnected-good.stl ${CMAKE_BINARY_DIR}/remove-unconnected.stl)

# off-stl test
add_test(off-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --write-off ${CMAKE_BINARY_DIR}/basic.off )
add_test(off-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/basic.off ${CMAKE_BINARY_DIR}/basic.off)
# fill-holes
add_test(${testfile}-fill-holes ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/${testfile}/fill-holes-bad.stl --fill-holes -a ${CMAKE_BINARY_DIR}/fill-holes.stl)
add_test(${testfile}-fill-holes-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/fill-holes-good.stl ${CMAKE_BINARY_DIR}/fill-holes.stl)

# dxf-stl test
add_test(dxf-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --write-dxf ${CMAKE_BINARY_DIR}/basic.dxf )
add_test(dxf-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/basic.dxf ${CMAKE_BINARY_DIR}/basic.dxf)
# normal-directions
add_test(${testfile}-normal-directions ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/test/${testfile}/normal-directions-bad.stl --normal-directions -a ${CMAKE_BINARY_DIR}/normal-directions.stl)
add_test(${testfile}-normal-directions-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/normal-directions-good.stl ${CMAKE_BINARY_DIR}/normal-directions.stl)

# vrml-stl test
add_test(vrml-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/block.stl --write-vrml ${CMAKE_BINARY_DIR}/basic.vrml )
add_test(vrml-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/basic.vrml ${CMAKE_BINARY_DIR}/basic.vrml)
# binary-stl test
#add_test(${testfile}-binary-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl -b ${CMAKE_BINARY_DIR}/binary.stl )
#add_test(${testfile}-binary-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/binary.stl ${CMAKE_BINARY_DIR}/binary.stl)

# off-stl test
add_test(${testfile}-off-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --write-off ${CMAKE_BINARY_DIR}/basic.off )
add_test(${testfile}-off-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/basic.off ${CMAKE_BINARY_DIR}/basic.off)

# dxf-stl test
add_test(${testfile}-dxf-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --write-dxf ${CMAKE_BINARY_DIR}/basic.dxf )
add_test(${testfile}-dxf-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/basic.dxf ${CMAKE_BINARY_DIR}/basic.dxf)

# vrml-stl test
add_test(${testfile}-vrml-stl ${CMAKE_BINARY_DIR}/admesh ${CMAKE_SOURCE_DIR}/examples/${testfile}.stl --write-vrml ${CMAKE_BINARY_DIR}/basic.vrml )
add_test(${testfile}-vrml-stl-compare ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/test/${testfile}/basic.vrml ${CMAKE_BINARY_DIR}/basic.vrml)

endforeach()
Loading

0 comments on commit 7073dad

Please sign in to comment.