diff --git a/tests/dobj_sandbox/meson.build b/tests/dobj_sandbox/meson.build new file mode 100644 index 0000000..ef5cdd7 --- /dev/null +++ b/tests/dobj_sandbox/meson.build @@ -0,0 +1,10 @@ +test_file = 'testDObject.cpp' +exe_name = test_file.split('.')[0] +executable( + exe_name, + test_file, + dependencies: gtest_dep, + include_directories: include_directories('../../src/dobj/public'), + link_with: libdobj, # Link the dobj library + install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly +) \ No newline at end of file diff --git a/tests/dobj_sandbox/testDObject.cpp b/tests/dobj_sandbox/testDObject.cpp new file mode 100644 index 0000000..6384682 --- /dev/null +++ b/tests/dobj_sandbox/testDObject.cpp @@ -0,0 +1,31 @@ +#include + +#include "DObject.h" + +DObject testFunction(DObject &obj); + +int main(){ + float data = 55.86868; + DObject obj; + obj.setData(data); + float newData; + newData = std::get(obj.getData()); + std::cout << "Data: " << newData << std::endl; + std::cout << "Calling test function" << std::endl; + DObject newObj = testFunction(obj); + std::cout << newObj << std::endl; + return 0; +} + +// Test function which takes a DObject as an argument and +// returns new DObject with an vector of 10 elements identical to the input DObject +// This should use std::varient and auto to do some degree of type inference +DObject testFunction(DObject &obj){ + float data = obj.getDataAs(); + std::cout << "Data: " << data << std::endl; + std::vector> newData(3, std::vector(3, data)); + DObject newObj(newData); + std::cout << obj << std::endl; + + return newObj; +} diff --git a/tests/meson.build b/tests/meson.build index 5608016..5865cb7 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,5 +1,8 @@ # Google Test dependency gtest_dep = dependency('gtest', main: true, required : true) -# Subdirectory for dobj tests +# Subdirectories for unit and integration tests subdir('dobj') + +# Subdirectories for sandbox tests +subdir('dobj_sandbox')