Skip to content

Commit

Permalink
Format all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davschneller committed Jul 3, 2024
1 parent 7ce27fa commit 9538f19
Show file tree
Hide file tree
Showing 10 changed files with 1,403 additions and 1,548 deletions.
1 change: 1 addition & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
# cf. https://stackoverflow.com/a/36046965
find async/ -iname '*.h' | xargs clang-format -i
find tests/ -iname '*.h' | xargs clang-format -i
git diff > formatting.patch
cat formatting.patch
Expand Down
86 changes: 40 additions & 46 deletions tests/Config.t.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,44 @@
/**
* @todo Reset the config after each test
*/
class TestConfig : public CxxTest::TestSuite
{
public:
void testMode()
{
TS_ASSERT_EQUALS(async::Config::mode(), async::SYNC);

async::Config::setMode(async::THREAD);
TS_ASSERT_EQUALS(async::Config::mode(), async::THREAD);
}

void testGetPinCore()
{
TS_ASSERT_EQUALS(async::Config::getPinCore(), -1);

async::Config::setPinCore(0);
TS_ASSERT_EQUALS(async::Config::getPinCore(), 0);
}

void testGroupSize()
{
TS_ASSERT_EQUALS(async::Config::groupSize(), 1);

async::Config::setGroupSize(4);
TS_ASSERT_EQUALS(async::Config::groupSize(), 1);

async::Config::setMode(async::MPI);
async::Config::setGroupSize(4);
TS_ASSERT_EQUALS(async::Config::groupSize(), 4);
}

void testUseAsyncCopy()
{
TS_ASSERT_EQUALS(async::Config::useAsyncCopy(), false);

async::Config::setUseAsyncCopy(true);
TS_ASSERT_EQUALS(async::Config::useAsyncCopy(), true);
}

void testAlignment()
{
TS_ASSERT_EQUALS(async::Config::alignment(), 0);

async::Config::setAlignment(2048);
TS_ASSERT_EQUALS(async::Config::alignment(), 2048);
}
class TestConfig : public CxxTest::TestSuite {
public:
void testMode() {
TS_ASSERT_EQUALS(async::Config::mode(), async::SYNC);

async::Config::setMode(async::THREAD);
TS_ASSERT_EQUALS(async::Config::mode(), async::THREAD);
}

void testGetPinCore() {
TS_ASSERT_EQUALS(async::Config::getPinCore(), -1);

async::Config::setPinCore(0);
TS_ASSERT_EQUALS(async::Config::getPinCore(), 0);
}

void testGroupSize() {
TS_ASSERT_EQUALS(async::Config::groupSize(), 1);

async::Config::setGroupSize(4);
TS_ASSERT_EQUALS(async::Config::groupSize(), 1);

async::Config::setMode(async::MPI);
async::Config::setGroupSize(4);
TS_ASSERT_EQUALS(async::Config::groupSize(), 4);
}

void testUseAsyncCopy() {
TS_ASSERT_EQUALS(async::Config::useAsyncCopy(), false);

async::Config::setUseAsyncCopy(true);
TS_ASSERT_EQUALS(async::Config::useAsyncCopy(), true);
}

void testAlignment() {
TS_ASSERT_EQUALS(async::Config::alignment(), 0);

async::Config::setAlignment(2048);
TS_ASSERT_EQUALS(async::Config::alignment(), 2048);
}
};
32 changes: 14 additions & 18 deletions tests/Dispatcher.t.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,24 @@
/**
* Test the dispatcher for non MPI mode
*/
class TestDispatcher : public CxxTest::TestSuite
{
public:
void testGroupSize()
{
async::Dispatcher dispatcher;
TS_ASSERT_EQUALS(dispatcher.groupSize(), 1);
}
class TestDispatcher : public CxxTest::TestSuite {
public:
void testGroupSize() {
async::Dispatcher dispatcher;
TS_ASSERT_EQUALS(dispatcher.groupSize(), 1);
}

void testGroupComm()
{
async::Dispatcher dispatcher;
void testGroupComm() {
async::Dispatcher dispatcher;
#ifdef USE_MPI
TS_ASSERT_EQUALS(dispatcher.groupComm(), MPI_COMM_SELF);
TS_ASSERT_EQUALS(dispatcher.groupComm(), MPI_COMM_SELF);
#endif // USE_MPI
}
}

void testCommWorld()
{
async::Dispatcher dispatcher;
void testCommWorld() {
async::Dispatcher dispatcher;
#ifdef USE_MPI
TS_ASSERT_EQUALS(dispatcher.commWorld(), MPI_COMM_WORLD);
TS_ASSERT_EQUALS(dispatcher.commWorld(), MPI_COMM_WORLD);
#endif // USE_MPI
}
}
};
Loading

0 comments on commit 9538f19

Please sign in to comment.