Skip to content

Commit

Permalink
fix build test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Svvmy committed Jan 15, 2024
1 parent 884e229 commit 979cf94
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
21 changes: 11 additions & 10 deletions utils/tst/CommonTypesTestSuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@
#include "gtest/gtest.h"
#include <gmds/utils/CommonTypes.h>
#include <unit_test_config.h>
using namespace gmds;

// Test for getCommonBut
TEST(CommonTypesTestSuite, GetCommonButTest)
{
std::vector<TCellID> set1 = {1, 2, 3, 4, 5};
std::vector<TCellID> set2 = {3, 4, 5, 6, 7};
TCellID but = 2;
std::vector<gmds::TCellID> set1 = {1, 2, 3, 4, 5};
std::vector<gmds::TCellID> set2 = {3, 4, 5, 6, 7};
gmds::TCellID but = 4;

std::vector<TCellID> result = gmds::getCommonBut(set1, set2, but);
std::vector<gmds::TCellID> result = gmds::getCommonBut(set1, set2, but);

ASSERT_EQ(result.size(), 2);
ASSERT_TRUE(std::find(result.begin(), result.end(), 2) != result.end());
ASSERT_TRUE(std::find(result.begin(), result.end(), 3) != result.end());
ASSERT_TRUE(std::find(result.begin(), result.end(), 5) != result.end());
ASSERT_TRUE(std::find(result.begin(), result.end(), 4) == result.end());
}

// Test for keepFilter
TEST(CommonTypesTestSuite, KeepFilterTest)
{
std::vector<TCellID> set = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
TInt nb = 2;
std::vector<gmds::TCellID> set = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4};
gmds::TInt nb = 2;

std::vector<TCellID> result = gmds::keepFilter(set, nb);
std::vector<gmds::TCellID> result = gmds::keepFilter(set, nb);

ASSERT_EQ(result.size(), 2);
ASSERT_TRUE(std::find(result.begin(), result.end(), 2) != result.end());
ASSERT_TRUE(std::find(result.begin(), result.end(), 3) != result.end());
ASSERT_TRUE(std::find(result.begin(), result.end(), 4) != result.end());
}

#endif // GMDS_COMMON_TYPES_TEST_SUITE_H
6 changes: 3 additions & 3 deletions utils/tst/main_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/*----------------------------------------------------------------------------*/
// Files containing the different test suites to launch
#include "ArrayTestSuite.h"
#include "AssertTestSuite.h"
// #include "AssertTestSuite.h"
#include "BitVectorTestSuite.h"
// #include "CommonTypesTestSuite.h"
#include "CommonTypesTestSuite.h"
// #include "LogTestSuite.h"
// #include "OrientedGraphTestSuite.h"
#include "ParamTestSuite.h"
#include "RandomGeneratorTestSuite.h"
// #include "RandomGeneratorTestSuite.h"
#include "UtilsTestSuite.h"
// #include "VariableManagerTestSuite.h"
/*----------------------------------------------------------------------------*/
Expand Down

0 comments on commit 979cf94

Please sign in to comment.