Skip to content

Commit

Permalink
unit_test: Fix unit tests after saicanon changes
Browse files Browse the repository at this point in the history
The "mock" file just had a few globals that would be clearer to just
store in the main test file.
  • Loading branch information
robEllenberg committed Jun 28, 2019
1 parent 8794b78 commit fbf9cf8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
12 changes: 5 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,9 @@ libsaicanon = shared_module('saicanon',
dependencies : [boost_dep, python2_dep, dl_dep, liblinuxcncini_dep, librs274ngc_dep]
)

mock_sai = static_library('mock_sai',
'unit_tests/mock/mock_sai.cc',
include_directories : [rs274ngc_inc, rs274ngc_external_inc ],
)
libsaicanon_dep = declare_dependency(include_directories : sai_inc,
link_with : libsaicanon)


test_interp_ex = executable('test_interp',
test_interp_srcs,
include_directories : [test_interp_inc, rs274ngc_external_inc, unit_test_inc],
Expand All @@ -249,8 +246,9 @@ test_interp_ex = executable('test_interp',
python2_dep,
librs274ngc_dep,
libpyplugin_dep,
],
link_with : [librs274ngc, libsaicanon, mock_sai, liblinuxcnchal]
liblinuxcnchal_dep,
libsaicanon_dep,
]
)

test('test_interp', test_interp_ex)
Expand Down
3 changes: 3 additions & 0 deletions unit_tests/interp/test_interp_basics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <rs274ngc_interp.hh>
#include <interp_inspection.hh>
#include <interp_return.hh>
#include <saicanon.hh>
#include <interp_parameter_def.hh>
using namespace interp_param_global;

Expand Down Expand Up @@ -79,6 +80,7 @@ TEST_CASE("Interp Basics")

SECTION("G55 without rotation")
{
REQUIRE_INTERP_OK(test_interp.execute("G20"));
REQUIRE_FUZZ(currentX(settings), 0.0);
REQUIRE_FUZZ(currentY(settings), 0.0);
REQUIRE_FUZZ(currentZ(settings), 0.0);
Expand All @@ -98,6 +100,7 @@ TEST_CASE("Interp Basics")

SECTION("G55 with rotation")
{
REQUIRE_INTERP_OK(test_interp.execute("G20"));
currentX(settings) = 0.0;
// KLUDGE hack in parameters directly to avoid depending on other functions
test_interp._setup.parameters[G55_X] = 2;
Expand Down
8 changes: 4 additions & 4 deletions unit_tests/interp/tests_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

#include <python_plugin.hh>
#include <rs274ngc_interp.hh>
extern Interp *pinterp;
Interp dummy_interp;
#include <stdio.h>
#include <saicanon.hh>

int _task = 1; // Dummy this out, not used in unit test
InterpBase *pinterp;

// KLUDGE fix missing symbol the ugly way
struct _inittab builtin_modules[] = {
Expand All @@ -14,8 +16,6 @@ struct _inittab builtin_modules[] = {

int main (int argc, char * argv[]) {
// KLUDGE just to satisfy saicanon dependencies, not used in tests
dummy_interp = Interp();
pinterp = &dummy_interp;
_outfile = fopen("test_interp_canon.log", "w");
PythonPlugin::instantiate(builtin_modules);
return Catch::Session().run( argc, argv );
Expand Down
3 changes: 0 additions & 3 deletions unit_tests/mock/mock_sai.cc

This file was deleted.

0 comments on commit fbf9cf8

Please sign in to comment.