Skip to content

Commit

Permalink
Added unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanemagnenat committed Sep 22, 2010
1 parent 4e9b422 commit 8ff9b4e
Show file tree
Hide file tree
Showing 10 changed files with 84,380 additions and 137 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -20,6 +20,6 @@ add_library(nabo
install(TARGETS nabo ARCHIVE DESTINATION lib)
install(FILES nabo/nabo.h DESTINATION include/nabo)

add_subdirectory(benchmarks)
enable_testing()
add_subdirectory(tests)

Empty file removed benchmarks/CMakeLists.txt
Empty file.
4 changes: 2 additions & 2 deletions nabo/kdtree_cpu.cpp
Expand Up @@ -203,7 +203,7 @@ namespace Nabo
{
// enqueue offside ?
if (offset2 < bestDist && nodes[childLeft(n)].dim != -2)
queue.push(SearchElement(childLeft(n), dist));
queue.push(SearchElement(childLeft(n), offset2));
// continue onside
if (nodes[childRight(n)].dim != -2)
n = childRight(n);
Expand All @@ -214,7 +214,7 @@ namespace Nabo
{
// enqueue offside ?
if (offset2 < bestDist && nodes[childRight(n)].dim != -2)
queue.push(SearchElement(childRight(n), dist));
queue.push(SearchElement(childRight(n), offset2));
// continue onside
if (nodes[childLeft(n)].dim != -2)
n = childLeft(n);
Expand Down
39 changes: 37 additions & 2 deletions tests/CMakeLists.txt
@@ -1,3 +1,38 @@
include_directories(..)
add_executable(knn knn.cpp)
target_link_libraries(knn nabo)

add_executable(knnvalidate knnvalidate.cpp)
target_link_libraries(knnvalidate nabo)

add_test(validation-2D ${EXECUTABLE_OUTPUT_PATH}/knnvalidate ${CMAKE_CURRENT_SOURCE_DIR}/data/scan.2d.txt 10 1000)
add_test(validation-3D ${EXECUTABLE_OUTPUT_PATH}/knnvalidate ${CMAKE_CURRENT_SOURCE_DIR}/data/scan.3d.txt 10 1000)

# find_package(Boost)
# if (Boost_FOUND)
# find_path(ANN_INCLUDE_DIR ANN.h
# /usr/local/include/ANN
# /usr/include/ANN
# )
#
# include_directories(.. ${Boost_INCLUDE_DIRS} ${ANN_INCLUDE_DIR})
#
# add_executable(knnbench knnbench.cpp
# # hiiiikkk^2 this is even uglier, let's talk about this irl ok?
# ~/test/ann_1.1.2/src/ANN.cpp
# ~/test/ann_1.1.2/src/bd_fix_rad_search.cpp
# ~/test/ann_1.1.2/src/bd_pr_search.cpp
# ~/test/ann_1.1.2/src/bd_search.cpp
# ~/test/ann_1.1.2/src/bd_tree.cpp
# ~/test/ann_1.1.2/src/brute.cpp
# ~/test/ann_1.1.2/src/kd_dump.cpp
# ~/test/ann_1.1.2/src/kd_fix_rad_search.cpp
# ~/test/ann_1.1.2/src/kd_pr_search.cpp
# ~/test/ann_1.1.2/src/kd_search.cpp
# ~/test/ann_1.1.2/src/kd_split.cpp
# ~/test/ann_1.1.2/src/kd_tree.cpp
# ~/test/ann_1.1.2/src/kd_util.cpp
# ~/test/ann_1.1.2/src/perf.cpp)
#
# target_link_libraries(knnbench nabo)
# else (Boost_FOUND)
# message("Disabling benchmark because boost has not been found")
# endif (Boost_FOUND)

0 comments on commit 8ff9b4e

Please sign in to comment.