mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Fix tests
This commit is contained in:
parent
17beae299d
commit
e21aee58f6
1 changed files with 8 additions and 18 deletions
|
@ -320,20 +320,15 @@ namespace nix {
|
|||
* --------------------------------------------------------------------------*/
|
||||
|
||||
TEST(string2Float, emptyString) {
|
||||
double n;
|
||||
ASSERT_EQ(string2Float("", n), false);
|
||||
ASSERT_EQ(string2Float<double>(""), std::nullopt);
|
||||
}
|
||||
|
||||
TEST(string2Float, trivialConversions) {
|
||||
double n;
|
||||
ASSERT_EQ(string2Float("1.0", n), true);
|
||||
ASSERT_EQ(n, 1.0);
|
||||
ASSERT_EQ(string2Float<double>("1.0"), 1.0);
|
||||
|
||||
ASSERT_EQ(string2Float("0.0", n), true);
|
||||
ASSERT_EQ(n, 0.0);
|
||||
ASSERT_EQ(string2Float<double>("0.0"), 0.0);
|
||||
|
||||
ASSERT_EQ(string2Float("-100.25", n), true);
|
||||
ASSERT_EQ(n, (-100.25));
|
||||
ASSERT_EQ(string2Float<double>("-100.25"), -100.25);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
|
@ -341,20 +336,15 @@ namespace nix {
|
|||
* --------------------------------------------------------------------------*/
|
||||
|
||||
TEST(string2Int, emptyString) {
|
||||
double n;
|
||||
ASSERT_EQ(string2Int("", n), false);
|
||||
ASSERT_EQ(string2Int<int>(""), std::nullopt);
|
||||
}
|
||||
|
||||
TEST(string2Int, trivialConversions) {
|
||||
double n;
|
||||
ASSERT_EQ(string2Int("1", n), true);
|
||||
ASSERT_EQ(n, 1);
|
||||
ASSERT_EQ(string2Int<int>("1"), 1);
|
||||
|
||||
ASSERT_EQ(string2Int("0", n), true);
|
||||
ASSERT_EQ(n, 0);
|
||||
ASSERT_EQ(string2Int<int>("0"), 0);
|
||||
|
||||
ASSERT_EQ(string2Int("-100", n), true);
|
||||
ASSERT_EQ(n, (-100));
|
||||
ASSERT_EQ(string2Int<int>("-100"), -100);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue