-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathtestParallelTestUtilities.cpp
More file actions
73 lines (64 loc) · 1.76 KB
/
testParallelTestUtilities.cpp
File metadata and controls
73 lines (64 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2024 TotalEnergies
* Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2023-2024 Chevron
* Copyright (c) 2019- GEOS/GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/
#include "mainInterface/initialization.hpp"
#include "codingUtilities/UnitTestUtilities.hpp"
#include <gtest/gtest.h>
TEST( UnitTestUtilities, skipInSerial )
{
SKIP_TEST_IN_SERIAL( "This test should not be run in serial." );
if( geos::MpiWrapper::commSize() == 1 )
{
GTEST_FAIL();
}
else
{
GTEST_SUCCEED();
}
}
TEST( UnitTestUtilities, skipInParallel )
{
SKIP_TEST_IN_PARALLEL( "This test should not be run in parallel." );
if( geos::MpiWrapper::commSize() != 1 )
{
GTEST_FAIL();
}
else
{
GTEST_SUCCEED();
}
}
TEST( UnitTestUtilities, expected )
{
using namespace geos;
using namespace geos::testing;
if( MpiWrapper::commSize() == 1 )
{
ASSERT_EQ( 1, expected( 1, {} ) );
ASSERT_EQ( 1, expected( 1, { 2 } ) );
ASSERT_EQ( 1, expected( 1, { 2, 3 } ) );
}
else
{
ASSERT_EQ( MpiWrapper::commRank() == 0 ? 2 : 3, expected( 1, { 2, 3 } ) );
}
}
int main( int ac, char * av[] )
{
::testing::InitGoogleTest( &ac, av );
geos::basicSetup( ac, av );
int const result = RUN_ALL_TESTS();
geos::basicCleanup( false );
return result;
}