diff --git a/qpong_core/CMakeLists.txt b/qpong_core/CMakeLists.txt index 72fb06b4ec9f7868c98f2d452169de5597d423ab..4c14ed29b211502df984471460d6b13c18a10c2b 100644 --- a/qpong_core/CMakeLists.txt +++ b/qpong_core/CMakeLists.txt @@ -4,9 +4,9 @@ endif() ## library for the app should be GTK independent ## -add_library( qpong_core +add_library( + qpong_core Particle.cpp ImageBuffer.cpp Player.cpp - # Profiler.cpp ) diff --git a/qpong_core/Profiler.cpp b/qpong_core/Profiler.cpp deleted file mode 100644 index e3346012892de08bee0593dc5397ebdac6162e52..0000000000000000000000000000000000000000 --- a/qpong_core/Profiler.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/// -/// @file Profiler.cpp -/// @author Armin Co -/// -/// @brief - -#include "Profiler.hpp" - -Profiler::Profiler(const char* name) - : m_name {name} - , m_stopped {false} - , m_verbose {Verbose::False} -{ - m_startTimepoint = std::chrono::high_resolution_clock::now(); -} - -Profiler::~Profiler() -{ - if (!m_stopped) - { - stop(); - } -} - -long Profiler::stop() -{ - auto endTimepoint = std::chrono::high_resolution_clock::now(); - m_stopped = true; - long mus = std::chrono::duration_cast<std::chrono::nanoseconds>(endTimepoint - m_startTimepoint).count(); - - if (m_verbose == Verbose::True) - { - std::cout << m_name << ": " << mus / 1000.0 / 1000.0<< "ms" << std::endl; - } - - return mus; -} \ No newline at end of file diff --git a/qpong_core/Profiler.hpp b/qpong_core/Profiler.hpp deleted file mode 100644 index 602d8c4ebc5ddb71b2d31d904803555b4f1ccd35..0000000000000000000000000000000000000000 --- a/qpong_core/Profiler.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/// -/// @file Profiler.hpp -/// @author Armin Co -/// -/// @brief Class to do some basic timing and profiling. -/// - -#ifndef QPONG_PROFILER_HPP -#define QPONG_PROFILER_HPP - -#include <chrono> -#include <iostream> - - -enum class Verbose -{ - True, - False -}; - - -/// @brief Profiler class to do some basic timings. -/// -class Profiler -{ -public: - Profiler(const char* name); - ~Profiler(); - - /// @brief Stops the timing and returns the time measured in nanoseconds. - /// - long stop(); - - -private: - const char* m_name; - Verbose m_verbose; - std::chrono::time_point<std::chrono::system_clock> m_startTimepoint; - bool m_stopped; -}; - -#endif \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 96d720ab04f3f49a2e341775d0c736d24cd82b4a..0f98b3350c88a659ba0c241e28dc1b5d184275bd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,9 +1,23 @@ enable_testing() -include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) -add_executable(runUnitTests test_qpong.cpp) +include_directories( + ${gtest_SOURCE_DIR}/include + ${gtest_SOURCE_DIR} +) -target_link_libraries(runUnitTests gtest gtest_main) -target_link_libraries(runUnitTests qpong_core) -add_test(NAME a-test COMMAND ./tests/runUnitTests) +add_executable( + runUnitTests + test_qpong.cpp +) + +target_link_libraries( + runUnitTests + gtest + gtest_main +) + +target_link_libraries( + runUnitTests + qpong_core +) diff --git a/tests/test_qpong.cpp b/tests/test_qpong.cpp index e3b198245e2ec5b7776831ea8c27f56c06356cfc..203e84f6c4600c2f707e4ae16ec91816512cccc8 100644 --- a/tests/test_qpong.cpp +++ b/tests/test_qpong.cpp @@ -59,4 +59,7 @@ TEST(addInts, shouldBreak) TEST(addInts, negativeValues) { ASSERT_EQ(-3 + -5, -8); -} \ No newline at end of file +} + +/// @todo Example for mocks and an explanation what they are. +/// \ No newline at end of file