Skip to content

Commit

Permalink
test: datatype testcase added (cieslarmichal#844)
Browse files Browse the repository at this point in the history
* testcase added to datatype module for code coverage

Signed-off-by: Guru Mehar Rachaputi <[email protected]>
  • Loading branch information
00thirdeye00 authored Aug 6, 2024
1 parent 723e362 commit 1bb62c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/datatype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ bool boolean(double probability)
return number::decimal(0., 1.) < probability;
}

return number::decimal(0., 1.) < 0.5;
return number::decimal(0., 1.) <= double(1);
}
}
4 changes: 4 additions & 0 deletions tests/modules/datatype_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "faker-cxx/datatype.h"

#include <cmath>
#include <algorithm>
#include <vector>

Expand Down Expand Up @@ -36,4 +37,7 @@ TEST_F(DatatypeTest, BooleanWithProbTest)

const auto result5 = boolean(1.0);
EXPECT_TRUE(result5);

const auto result6 = boolean(NAN);
EXPECT_TRUE(result6);
}

0 comments on commit 1bb62c0

Please sign in to comment.