Skip to content

Commit 6ec4750

Browse files
committed
port coverage / abs->fabs changes from NFM
1 parent d1f539f commit 6ec4750

File tree

7 files changed

+11
-22
lines changed

7 files changed

+11
-22
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ services:
66
addons:
77
apt:
88
packages:
9-
- cmake
109
- valgrind
11-
- python-pip
1210

1311
homebrew:
1412
packages:
15-
- cmake
1613
- valgrind
1714

1815
matrix:

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
mkdir -p build
44
cd build
55
cmake -DCMAKE_CXX_COMPILER="${CXX_COMPILER}" -DUSER_CXX_FLAGS="${CXX_FLAGS}" -DUSE_COVERAGE="${USE_COVERAGE}" ..
6-
make
6+
make -j$(nproc)

src/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,3 @@ if (MPI_FOUND)
66
target_link_libraries(mci ${MPI_CXX_LIBRARIES})
77
target_link_libraries(mci_static ${MPI_CXX_LIBRARIES})
88
endif()
9-
10-
if (USE_COVERAGE)
11-
target_link_libraries(mci --coverage)
12-
target_link_libraries(mci_static --coverage)
13-
endif()

test/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
include_directories(common/)
22
link_libraries(mci)
3-
if (USE_COVERAGE)
4-
link_libraries(--coverage)
5-
endif()
63

74
add_executable(check main.cpp)
85
add_executable(ut1.exe ut1/main.cpp)

test/ut1/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ int main(){
3434
// this integral will give a wrong answer! This is because the starting point is very bad and initialDecorrelation is skipped (as well as the MRT2step automatic setting)
3535
mci->setX(x);
3636
mci->integrate(NMC, average, error, false, false);
37-
assert( abs(average[0]-CORRECT_RESULT) > 2.*error[0] );
37+
assert( fabs(average[0]-CORRECT_RESULT) > 2.*error[0] );
3838

3939
// this integral, instead, will provide the right answer
4040
mci->setX(x);
4141
mci->integrate(NMC, average, error);
42-
assert( abs(average[0]-CORRECT_RESULT) < 2.*error[0] );
42+
assert( fabs(average[0]-CORRECT_RESULT) < 2.*error[0] );
4343

4444
// now, doing an integral without finding again the MRT2step and doing the initialDecorrelation will also result in a correct result
4545
mci->integrate(NMC, average, error, false, false);
46-
assert( abs(average[0]-CORRECT_RESULT) < 2.*error[0] );
46+
assert( fabs(average[0]-CORRECT_RESULT) < 2.*error[0] );
4747

4848

4949

test/ut2/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ int main(){
3737
mci->setX(x);
3838
mci->integrate(NMC, average, error, false, false);
3939
for (int i=0; i<mci->getNObsDim(); ++i) {
40-
assert( abs(average[i]-CORRECT_RESULT) > 2.*error[i] );
40+
assert( fabs(average[i]-CORRECT_RESULT) > 2.*error[i] );
4141
}
4242

4343
// this integral, instead, will provide the right answer
4444
mci->setX(x);
4545
mci->integrate(NMC, average, error);
4646
for (int i=0; i<mci->getNObsDim(); ++i) {
47-
assert( abs(average[i]-CORRECT_RESULT) < 2.*error[i] );
47+
assert( fabs(average[i]-CORRECT_RESULT) < 2.*error[i] );
4848
}
4949

5050
// now, doing an integral without finding again the MRT2step and doing the initialDecorrelation will also result in a correct result
5151
mci->integrate(NMC, average, error, false, false);
5252
for (int i=0; i<mci->getNObsDim(); ++i) {
53-
assert( abs(average[i]-CORRECT_RESULT) < 2.*error[i] );
53+
assert( fabs(average[i]-CORRECT_RESULT) < 2.*error[i] );
5454
}
5555

5656

test/ut3/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ int main(){
3838
// this integral will give a wrong answer! This is because the starting point is very bad and initialDecorrelation is skipped (as well as the MRT2step automatic setting)
3939
mci->setX(x);
4040
mci->integrate(NMC, average, error, false, false);
41-
assert( abs(average[0]-CORRECT_RESULT) > 2.*error[0] );
41+
assert( fabs(average[0]-CORRECT_RESULT) > 2.*error[0] );
4242

4343
// this integral, instead, will provide the right answer
4444
mci->setX(x);
4545
mci->integrate(NMC, average, error, true, true);
46-
assert( abs(average[0]-CORRECT_RESULT) < 2.*error[0] );
46+
assert( fabs(average[0]-CORRECT_RESULT) < 2.*error[0] );
4747

4848
// now, doing an integral without finding again the MRT2step and doing the initialDecorrelation will also result in a correct result
4949
mci->integrate(NMC, average, error, false, false);
50-
assert( abs(average[0]-CORRECT_RESULT) < 2.*error[0] );
50+
assert( fabs(average[0]-CORRECT_RESULT) < 2.*error[0] );
5151

5252
// and using fixed blocking also gives the same result
5353
mci->setNBlocks(15);
5454
mci->integrate(NMC, average, error, false, false);
55-
assert( abs(average[0]-CORRECT_RESULT) < 2.*error[0] );
55+
assert( fabs(average[0]-CORRECT_RESULT) < 2.*error[0] );
5656

5757

5858
delete pdf;

0 commit comments

Comments
 (0)