Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unittests for CriticalSignatures.h #4

Merged
merged 1 commit into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}