From bac707bc6ccfe2a86384ee6a264ea281d558adc7 Mon Sep 17 00:00:00 2001
From: David Rafferty <drafferty@hs.uni-hamburg.de>
Date: Mon, 7 Dec 2020 17:06:48 +0100
Subject: [PATCH] Clean up and consolidate tests

---
 CMakeLists.txt                                | 22 -------------------
 test.py                                       | 18 ---------------
 testlsm.py                                    |  6 -----
 tests/{test_apparent_sky.txt => apparent.sky} |  0
 tests/test_group.py                           | 12 ----------
 tests/test_lsmtool.py                         |  6 +++++
 6 files changed, 6 insertions(+), 58 deletions(-)
 delete mode 100644 CMakeLists.txt
 delete mode 100644 test.py
 delete mode 100644 testlsm.py
 rename tests/{test_apparent_sky.txt => apparent.sky} (100%)
 delete mode 100644 tests/test_group.py

diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 5d4c0b7..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-cmake_minimum_required(VERSION 3.16)
-project(grouper)      
-
-set(CMAKE_CXX_STANDARD 14)
-
-find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED)
-find_package(OpenMP)
-
-if(Python_FOUND)
-    message(STATUS "Python Found: ${Python_EXECUTABLE}")
-    message(STATUS "Python Found: ${Python_INCLUDE_DIRS}")
-    message(STATUS "Python Found: ${Python_LIBRARIES}")
-    message(STATUS "Python Found: ${Python_LIBRARY_DIRS}")
-    include_directories(${Python_INCLUDE_DIRS})
-endif()
-
-add_library(grouper   SHARED meanshift.cpp)  
-SET_TARGET_PROPERTIES(grouper   PROPERTIES PREFIX "")
-if(Python_FOUND)
-    target_link_libraries(grouper ${Python_LIBRARIES} OpenMP::OpenMP_CXX)                     
-endif()
-
diff --git a/test.py b/test.py
deleted file mode 100644
index dd5366e..0000000
--- a/test.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import grouper
-import numpy as np
-
-a = np.array([[1.0, 2.0],[3.0,4.0],[5.0,6.0]])
-f = np.array([1.0,2.0,3.0])
-
-g = grouper.Grouper()
-
-g.readCoordinates(a,f)
-
-g.setLookDistance(5.0)
-g.setGroupingDistance(5.0)
-
-g.run()
-b = []
-g.group(b)
-
-print(b)
diff --git a/testlsm.py b/testlsm.py
deleted file mode 100644
index dfd4b4a..0000000
--- a/testlsm.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import lsmtool
-
-s = lsmtool.load('test_large.sky')
-
-s.group('meanshift', byPatch=True,lookDistance=0.075,groupingDistance=0.01)
-
diff --git a/tests/test_apparent_sky.txt b/tests/apparent.sky
similarity index 100%
rename from tests/test_apparent_sky.txt
rename to tests/apparent.sky
diff --git a/tests/test_group.py b/tests/test_group.py
deleted file mode 100644
index 7a08f86..0000000
--- a/tests/test_group.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import lsmtool
-
-s = lsmtool.load('test_apparent_sky.txt')
-
-s.group('meanshift', byPatch=True,lookDistance=0.075,groupingDistance=0.01)
-
-if (len(s.getPatchPositions()) == 67):
-    print("Test successful.")
-else:
-    print("Test failed. (Did you build with c++ extensions? This test may fail for the pure python code.)")
-
-
diff --git a/tests/test_lsmtool.py b/tests/test_lsmtool.py
index 1fbbe5f..7776719 100644
--- a/tests/test_lsmtool.py
+++ b/tests/test_lsmtool.py
@@ -5,6 +5,7 @@ import os
 
 
 s = lsmtool.load('tests/no_patches.sky')
+s2 = lsmtool.load('tests/apparent.sky')
 
 
 def test_select():
@@ -94,3 +95,8 @@ def test_plot():
     s.plot('tests/plot.pdf')
     assert os.path.exists('tests/plot.pdf')
 
+
+def test_meanshift():
+    print('Group the model with the meanshift algorithm')
+    s2.group('meanshift', byPatch=True, lookDistance=0.075, groupingDistance=0.01)
+    assert len(s2.getPatchPositions()) == 67
-- 
GitLab