From f41811c18efb5a4ea6d64c32f02017a701c314c1 Mon Sep 17 00:00:00 2001
From: Tomas Pecka <tomas.pecka@fit.cvut.cz>
Date: Sat, 11 Apr 2020 13:32:59 +0200
Subject: [PATCH] tests: Move sanitizer test algos from alib2aux to tests
 (closes #190)

---
 .../test-src/algorithms}/Segfault.cpp                     | 8 --------
 .../test-src/algorithms}/Segfault.h                       | 4 ----
 .../test-src/algorithms}/UndefinedBehaviour.cpp           | 4 ----
 .../test-src/algorithms}/UndefinedBehaviour.h             | 4 ----
 alib2integrationtest/test-src/tests/dummyTest.cpp         | 6 ++----
 5 files changed, 2 insertions(+), 24 deletions(-)
 rename {alib2aux/src/debug => alib2integrationtest/test-src/algorithms}/Segfault.cpp (86%)
 rename {alib2aux/src/debug => alib2integrationtest/test-src/algorithms}/Segfault.h (88%)
 rename {alib2aux/src/debug => alib2integrationtest/test-src/algorithms}/UndefinedBehaviour.cpp (93%)
 rename {alib2aux/src/debug => alib2integrationtest/test-src/algorithms}/UndefinedBehaviour.h (90%)

diff --git a/alib2aux/src/debug/Segfault.cpp b/alib2integrationtest/test-src/algorithms/Segfault.cpp
similarity index 86%
rename from alib2aux/src/debug/Segfault.cpp
rename to alib2integrationtest/test-src/algorithms/Segfault.cpp
index 5bd63b1a8b..8fc29efef8 100644
--- a/alib2aux/src/debug/Segfault.cpp
+++ b/alib2integrationtest/test-src/algorithms/Segfault.cpp
@@ -10,24 +10,16 @@
 
 namespace debug {
 
-#ifdef DEBUG
-
 int debug::Segfault::segfault ( ) {
 	return * NULL_VALUE;
 }
 
 int * debug::Segfault::NULL_VALUE;
 
-#endif /* DEBUG */
-
 } /* namespace debug */
 
 namespace {
 
-#ifdef DEBUG
-
 auto SegfaultInt = registration::AbstractRegister < debug::Segfault, int > ( debug::Segfault::segfault );
 
-#endif /* DEBUG */
-
 } /* namespace */
diff --git a/alib2aux/src/debug/Segfault.h b/alib2integrationtest/test-src/algorithms/Segfault.h
similarity index 88%
rename from alib2aux/src/debug/Segfault.h
rename to alib2integrationtest/test-src/algorithms/Segfault.h
index 47520b63b6..494f19adc7 100644
--- a/alib2aux/src/debug/Segfault.h
+++ b/alib2integrationtest/test-src/algorithms/Segfault.h
@@ -10,8 +10,6 @@
 
 namespace debug {
 
-#ifdef DEBUG
-
 class Segfault {
 	static int * NULL_VALUE;
 
@@ -19,8 +17,6 @@ public:
 	static int segfault ( );
 };
 
-#endif /* DEBUG */
-
 } /* namespace debug */
 
 #endif /* SEGFAULT_H_ */
diff --git a/alib2aux/src/debug/UndefinedBehaviour.cpp b/alib2integrationtest/test-src/algorithms/UndefinedBehaviour.cpp
similarity index 93%
rename from alib2aux/src/debug/UndefinedBehaviour.cpp
rename to alib2integrationtest/test-src/algorithms/UndefinedBehaviour.cpp
index 370958c005..90ce3660fc 100644
--- a/alib2aux/src/debug/UndefinedBehaviour.cpp
+++ b/alib2integrationtest/test-src/algorithms/UndefinedBehaviour.cpp
@@ -8,8 +8,6 @@
 #include "UndefinedBehaviour.h"
 #include <registration/AlgoRegistration.hpp>
 
-#ifdef DEBUG
-
 namespace debug {
 
 int UndefinedBehaviour::undefined_behaviour ( ) {
@@ -26,5 +24,3 @@ namespace {
 auto UndefinedBehaviourInt = registration::AbstractRegister < debug::UndefinedBehaviour, int > ( debug::UndefinedBehaviour::undefined_behaviour );
 
 } /* namespace */
-
-#endif /* DEBUG */
diff --git a/alib2aux/src/debug/UndefinedBehaviour.h b/alib2integrationtest/test-src/algorithms/UndefinedBehaviour.h
similarity index 90%
rename from alib2aux/src/debug/UndefinedBehaviour.h
rename to alib2integrationtest/test-src/algorithms/UndefinedBehaviour.h
index e690b7773c..dbcdd53ef5 100644
--- a/alib2aux/src/debug/UndefinedBehaviour.h
+++ b/alib2integrationtest/test-src/algorithms/UndefinedBehaviour.h
@@ -8,8 +8,6 @@
 #ifndef UNDEFINED_BEHAVIOUR_H_
 #define UNDEFINED_BEHAVIOUR_H_
 
-#ifdef DEBUG
-
 namespace debug {
 
 class UndefinedBehaviour {
@@ -20,6 +18,4 @@ public:
 
 } /* namespace debug */
 
-#endif /* DEBUG */
-
 #endif /* UNDEFINED_BEHAVIOUR_H_ */
diff --git a/alib2integrationtest/test-src/tests/dummyTest.cpp b/alib2integrationtest/test-src/tests/dummyTest.cpp
index 0df5ef9590..633f2c4011 100644
--- a/alib2integrationtest/test-src/tests/dummyTest.cpp
+++ b/alib2integrationtest/test-src/tests/dummyTest.cpp
@@ -13,8 +13,7 @@ TEST_CASE ( "AQL Test", "[integration][dummy][!shouldfail][!hide]" ) {
 	TimeoutAqlTest ( 1s, qs );
 }
 
-#if DEBUG
-TEST_CASE ( "Segfault Test", "[integration][dummy][!shouldfail][!hide]" ) {
+TEST_CASE ( "Segfault Test", "[integration][dummy][!hide][!shouldfail]" ) {
 	ext::vector < std::string > qs = {
 		"execute debug::Random @ int",
 		"execute debug::Segfault"
@@ -23,7 +22,7 @@ TEST_CASE ( "Segfault Test", "[integration][dummy][!shouldfail][!hide]" ) {
 	TimeoutAqlTest ( 1s, qs );
 }
 
-TEST_CASE ( "Sanitizer Test", "[integration][dummy][!shouldfail]" ) {
+TEST_CASE ( "Sanitizer Test", "[integration][dummy][!hide][!shouldfail]" ) {
 	ext::vector < std::string > qs;
 	SECTION ( "asan" ) {
 		qs = {
@@ -48,7 +47,6 @@ TEST_CASE ( "Sanitizer Test", "[integration][dummy][!shouldfail]" ) {
 
 	TimeoutAqlTest ( 1s, qs );
 }
-#endif
 
 TEST_CASE ( "Failed Test", "[integration][dummy][!hide][!shouldfail]" ) {
 	ext::vector < std::string > qs = {
-- 
GitLab