Skip to content

Commit

Permalink
Merge pull request #4 from hassansalehe/critical-signature-uts
Browse files Browse the repository at this point in the history
Add unittests for CriticalSignatures.h
  • Loading branch information
hassansalehe authored Jun 12, 2021
2 parents 5e0b050 + 7b4506c commit f62483a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/CriticalSignatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef _COMMON_CRITICALSIGNATURES_H_
#define _COMMON_CRITICALSIGNATURES_H_

#include <string>

namespace tasksan {

/**
Expand Down
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ link_libraries(${GTEST_LIBRARIES} pthread gtest_main gcov --coverage)
# Link commonTests with what we want to test and
# the GTest and pthread library
add_executable(commonTests Common_Defs_gtest.cc)
add_executable(critalSigTests CriticalSignatures_gtest.cc)

# Add tests for Ctest
add_test(common_tests, commonTests)
add_test(critica_signatures_tests, critalSigTests)
11 changes: 11 additions & 0 deletions test/CriticalSignatures_gtest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "common/CriticalSignatures.h"
#include <gtest/gtest.h>

//! \brief Unit tests for TaskSanitizer helper functions
TEST(CriticalSignature, CheckReturnOfGetStartCriticalSignature) {
EXPECT_EQ("TASKSAN:BeginCriticalSection", tasksan::getStartCriticalSignature());
}

TEST(CriticalSignature, CheckReturnOfGetEndCriticalSignature) {
EXPECT_EQ("TASKSAN:EndCriticalSection", tasksan::getEndCriticalSignature());
}

0 comments on commit f62483a

Please sign in to comment.