fix(fourdst-namespace): moved into fourdst::constants namespace
This commit is contained in:
@@ -4,11 +4,11 @@
|
|||||||
// File Author: Emily Boudreaux
|
// File Author: Emily Boudreaux
|
||||||
// Last Modified: March 17, 2025
|
// Last Modified: March 17, 2025
|
||||||
//
|
//
|
||||||
// 4DSSE is free software; you can use it and/or modify
|
// libconstants is free software; you can use it and/or modify
|
||||||
// it under the terms and restrictions the GNU General Library Public
|
// it under the terms and restrictions the GNU General Library Public
|
||||||
// License version 3 (GPLv3) as published by the Free Software Foundation.
|
// License version 3 (GPLv3) as published by the Free Software Foundation.
|
||||||
//
|
//
|
||||||
// 4DSSE is distributed in the hope that it will be useful,
|
// libconstants is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
// See the GNU Library General Public License for more details.
|
// See the GNU Library General Public License for more details.
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "embedded_constants.h" // Generated at build time by meson
|
#include "embedded_constants.h" // Generated at build time by meson
|
||||||
|
|
||||||
namespace serif::constant {
|
namespace fourdst::constant {
|
||||||
Constants::Constants() {
|
Constants::Constants() {
|
||||||
loaded_ = initialize();
|
loaded_ = initialize();
|
||||||
}
|
}
|
||||||
@@ -123,4 +123,4 @@ namespace serif::constant {
|
|||||||
loaded_ = true;
|
loaded_ = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
// File Author: Emily Boudreaux
|
// File Author: Emily Boudreaux
|
||||||
// Last Modified: March 17, 2025
|
// Last Modified: March 17, 2025
|
||||||
//
|
//
|
||||||
// 4DSSE is free software; you can use it and/or modify
|
// libconstants is free software; you can use it and/or modify
|
||||||
// it under the terms and restrictions the GNU General Library Public
|
// it under the terms and restrictions the GNU General Library Public
|
||||||
// License version 3 (GPLv3) as published by the Free Software Foundation.
|
// License version 3 (GPLv3) as published by the Free Software Foundation.
|
||||||
//
|
//
|
||||||
// 4DSSE is distributed in the hope that it will be useful,
|
// libconstants is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
// See the GNU Library General Public License for more details.
|
// See the GNU Library General Public License for more details.
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace serif::constant {
|
namespace fourdst::constant {
|
||||||
/**
|
/**
|
||||||
* @brief Structure to hold a constant's details.
|
* @brief Structure to hold a constant's details.
|
||||||
*/
|
*/
|
||||||
@@ -137,5 +137,5 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace serif::const
|
} // namespace fourdst::const
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
class constTest : public ::testing::Test {
|
class constTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
serif::constant::Constants::getInstance();
|
fourdst::constant::Constants::getInstance();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ protected:
|
|||||||
* @test Verify default constructor initializes correctly.
|
* @test Verify default constructor initializes correctly.
|
||||||
*/
|
*/
|
||||||
TEST_F(constTest, DefaultConstructor) {
|
TEST_F(constTest, DefaultConstructor) {
|
||||||
EXPECT_NO_THROW(serif::constant::Constants::getInstance());
|
EXPECT_NO_THROW(fourdst::constant::Constants::getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,14 +33,14 @@ TEST_F(constTest, DefaultConstructor) {
|
|||||||
*/
|
*/
|
||||||
TEST_F(constTest, isLoaded) {
|
TEST_F(constTest, isLoaded) {
|
||||||
|
|
||||||
EXPECT_NO_THROW(serif::constant::Constants::getInstance().isLoaded());
|
EXPECT_NO_THROW(fourdst::constant::Constants::getInstance().isLoaded());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test Verify get method returns the correct constant.
|
* @test Verify get method returns the correct constant.
|
||||||
*/
|
*/
|
||||||
TEST_F(constTest, GetMethod) {
|
TEST_F(constTest, GetMethod) {
|
||||||
serif::constant::Constants& obj = serif::constant::Constants::getInstance();
|
fourdst::constant::Constants& obj = fourdst::constant::Constants::getInstance();
|
||||||
EXPECT_DOUBLE_EQ(obj.get("c").value, 2.99792458e10);
|
EXPECT_DOUBLE_EQ(obj.get("c").value, 2.99792458e10);
|
||||||
EXPECT_EQ(obj.get("c").unit, "cm / s");
|
EXPECT_EQ(obj.get("c").unit, "cm / s");
|
||||||
EXPECT_DOUBLE_EQ(obj.get("c").uncertainty, 0.0);
|
EXPECT_DOUBLE_EQ(obj.get("c").uncertainty, 0.0);
|
||||||
@@ -51,7 +51,7 @@ TEST_F(constTest, GetMethod) {
|
|||||||
* @test Verify [] opperators returns the correct constant.
|
* @test Verify [] opperators returns the correct constant.
|
||||||
*/
|
*/
|
||||||
TEST_F(constTest, SubscriptOperator) {
|
TEST_F(constTest, SubscriptOperator) {
|
||||||
serif::constant::Constants& obj = serif::constant::Constants::getInstance();
|
fourdst::constant::Constants& obj = fourdst::constant::Constants::getInstance();
|
||||||
EXPECT_DOUBLE_EQ(obj["c"].value, 2.99792458e10);
|
EXPECT_DOUBLE_EQ(obj["c"].value, 2.99792458e10);
|
||||||
EXPECT_EQ(obj["c"].unit, "cm / s");
|
EXPECT_EQ(obj["c"].unit, "cm / s");
|
||||||
EXPECT_DOUBLE_EQ(obj["c"].uncertainty, 0.0);
|
EXPECT_DOUBLE_EQ(obj["c"].uncertainty, 0.0);
|
||||||
@@ -62,7 +62,7 @@ TEST_F(constTest, SubscriptOperator) {
|
|||||||
* @test Verify that the has method returns the correct values
|
* @test Verify that the has method returns the correct values
|
||||||
*/
|
*/
|
||||||
TEST_F(constTest, HasMethod) {
|
TEST_F(constTest, HasMethod) {
|
||||||
serif::constant::Constants& obj = serif::constant::Constants::getInstance();
|
fourdst::constant::Constants& obj = fourdst::constant::Constants::getInstance();
|
||||||
|
|
||||||
EXPECT_TRUE(obj.has("c"));
|
EXPECT_TRUE(obj.has("c"));
|
||||||
EXPECT_FALSE(obj.has("c4"));
|
EXPECT_FALSE(obj.has("c4"));
|
||||||
@@ -70,7 +70,7 @@ TEST_F(constTest, HasMethod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(constTest, KeysMethod) {
|
TEST_F(constTest, KeysMethod) {
|
||||||
serif::constant::Constants& obj = serif::constant::Constants::getInstance();
|
fourdst::constant::Constants& obj = fourdst::constant::Constants::getInstance();
|
||||||
std::set<std::string> checkKeys;
|
std::set<std::string> checkKeys;
|
||||||
checkKeys.insert("c");
|
checkKeys.insert("c");
|
||||||
checkKeys.insert("wienK");
|
checkKeys.insert("wienK");
|
||||||
@@ -99,11 +99,11 @@ TEST_F(constTest, KeysMethod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(constTest, StreamOperator) {
|
TEST_F(constTest, StreamOperator) {
|
||||||
serif::constant::Constants& obj = serif::constant::Constants::getInstance();
|
fourdst::constant::Constants& obj = fourdst::constant::Constants::getInstance();
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
||||||
os << obj.get("c");
|
os << obj.get("c");
|
||||||
std::string expected = "<speed of light in vacuum: 2.99792e+10±0 cm / s (CODATA2022)>\n";
|
std::string expected = "<speed of light in vacuum: 2.99792e+10±0 cm / s (CODATA2022)>\n";
|
||||||
|
|
||||||
EXPECT_EQ(os.str(), expected);
|
EXPECT_EQ(os.str(), expected);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user