Expose private functions in grid_raytrace for unit testing.
This commit is contained in:
parent
47aa9f2948
commit
413ff4e558
4 changed files with 11 additions and 0 deletions
|
@ -30,7 +30,9 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace curry {
|
namespace curry {
|
||||||
|
#if !defined(BUILD_TESTING)
|
||||||
namespace {
|
namespace {
|
||||||
|
#endif
|
||||||
float inv_length (const vec2f& parVec) {
|
float inv_length (const vec2f& parVec) {
|
||||||
return 1.0f / std::sqrt(parVec.x() * parVec.x() + parVec.y() * parVec.y());
|
return 1.0f / std::sqrt(parVec.x() * parVec.x() + parVec.y() * parVec.y());
|
||||||
}
|
}
|
||||||
|
@ -77,7 +79,9 @@ namespace curry {
|
||||||
//else
|
//else
|
||||||
//return INFINITY;
|
//return INFINITY;
|
||||||
}
|
}
|
||||||
|
#if !defined(BUILD_TESTING)
|
||||||
} //unnamed namespace
|
} //unnamed namespace
|
||||||
|
#endif
|
||||||
|
|
||||||
//see:
|
//see:
|
||||||
//http://stackoverflow.com/questions/24679963/precise-subpixel-line-drawing-algorithm-rasterization-algorithm
|
//http://stackoverflow.com/questions/24679963/precise-subpixel-line-drawing-algorithm-rasterization-algorithm
|
||||||
|
|
|
@ -20,12 +20,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "vector.hpp"
|
#include "vector.hpp"
|
||||||
|
#include "mycurry_toplevelConfig.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace curry {
|
namespace curry {
|
||||||
class WorldGrid;
|
class WorldGrid;
|
||||||
class TileProperty;
|
class TileProperty;
|
||||||
|
|
||||||
|
#if defined(BUILD_TESTING)
|
||||||
|
float segment_intersection (const vec2f& parA, const vec2f& parDirA, const vec2f& parB, const vec2f& parDirB);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct WorldTileProperty {
|
struct WorldTileProperty {
|
||||||
vec2us index;
|
vec2us index;
|
||||||
const TileProperty* property;
|
const TileProperty* property;
|
||||||
|
|
|
@ -20,3 +20,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define RESOURCES_PATH "@MYCURRY_RESOURCES_PATH@/"
|
#define RESOURCES_PATH "@MYCURRY_RESOURCES_PATH@/"
|
||||||
|
#cmakedefine BUILD_TESTING
|
||||||
|
|
|
@ -17,6 +17,7 @@ target_include_directories(${PROJECT_NAME}
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/src/gamelib
|
PRIVATE ${CMAKE_SOURCE_DIR}/src/gamelib
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/lib/vectorwrapper/include
|
PRIVATE ${CMAKE_SOURCE_DIR}/lib/vectorwrapper/include
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/lib/tree-2.81/src
|
PRIVATE ${CMAKE_SOURCE_DIR}/lib/tree-2.81/src
|
||||||
|
PRIVATE ${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test(
|
add_test(
|
||||||
|
|
Loading…
Reference in a new issue