diff --git a/CMakeLists.txt b/CMakeLists.txt index 65ed0a9..057169b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ project(BetterSTL VERSION 0.1.0 LANGUAGES C CXX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # 定义源文件 -set(BETTERSTL_SOURCES - src/BigInteger.cpp - src/BigDecimal.cpp) +set(BETTERSTL_SOURCES + src/big_integer.cpp + src/big_decimal.cpp) # 生成静态库 (.a 文件) add_library(BetterSTL_static STATIC ${BETTERSTL_SOURCES}) @@ -26,12 +26,12 @@ add_library(BetterSTL ALIAS BetterSTL_static) enable_testing() -add_executable(BigIntegerTests tests/BigIntegerTest.cpp) +add_executable(BigIntegerTests tests/big_integer_test.cpp) target_include_directories(BigIntegerTests PRIVATE include) target_link_libraries(BigIntegerTests PRIVATE BetterSTL_static) add_test(NAME BigIntegerTests COMMAND BigIntegerTests) -add_executable(BigDecimalTests tests/BigDecimalTest.cpp) +add_executable(BigDecimalTests tests/big_decimal_test.cpp) target_include_directories(BigDecimalTests PRIVATE include) target_link_libraries(BigDecimalTests PRIVATE BetterSTL_static) add_test(NAME BigDecimalTests COMMAND BigDecimalTests) diff --git a/include/BigDecimal.hpp b/include/bstl/big_decimal.hpp similarity index 93% rename from include/BigDecimal.hpp rename to include/bstl/big_decimal.hpp index 322cc73..59b8639 100644 --- a/include/BigDecimal.hpp +++ b/include/bstl/big_decimal.hpp @@ -1,11 +1,11 @@ -#pragma once +#ifndef BETTERSTL_BIG_DECIMAL_H +#define BETTERSTL_BIG_DECIMAL_H #include -#include "BigInteger.hpp" +#include namespace bstl { - -class BigDecimal { + class BigDecimal { public: BigDecimal(); BigDecimal(int value); @@ -70,3 +70,5 @@ private: }; } // namespace bstl + +#endif //BETTERSTL_BIG_DECIMAL_H diff --git a/include/BigInteger.hpp b/include/bstl/big_integer.hpp similarity index 95% rename from include/BigInteger.hpp rename to include/bstl/big_integer.hpp index ed6a4a9..c4f12d9 100644 --- a/include/BigInteger.hpp +++ b/include/bstl/big_integer.hpp @@ -1,4 +1,5 @@ -#pragma once +#ifndef BETTERSTL_BIG_INTEGER_HPP +#define BETTERSTL_BIG_INTEGER_HPP #include @@ -64,6 +65,6 @@ private: static std::string divAbs(const std::string& a, const std::string& b); }; -using BitInteger = BigInteger; - } // namespace bstl + +#endif //BETTERSTL_BIG_INTEGER_HPP diff --git a/include/bstl/big_number.hpp b/include/bstl/big_number.hpp new file mode 100644 index 0000000..ddd2e3a --- /dev/null +++ b/include/bstl/big_number.hpp @@ -0,0 +1,7 @@ +#ifndef BETTERSTL_BIG_NUMBERS_HPP +#define BETTERSTL_BIG_NUMBERS_HPP + +#include +#include + +#endif // BETTERSTL_BIG_NUMBERS_HPP diff --git a/include/bstl/bigdecimal.hpp b/include/bstl/bigdecimal.hpp deleted file mode 100644 index b535876..0000000 --- a/include/bstl/bigdecimal.hpp +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef BETTERSTL_BIGDECIMAL_H -#define BETTERSTL_BIGDECIMAL_H - -#endif //BETTERSTL_BIGDECIMAL_H diff --git a/include/bstl/biginteger.hpp b/include/bstl/biginteger.hpp deleted file mode 100644 index d40c5cf..0000000 --- a/include/bstl/biginteger.hpp +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef BETTERSTL_BIGINTEGER_HPP -#define BETTERSTL_BIGINTEGER_HPP - -#endif //BETTERSTL_BIGINTEGER_HPP diff --git a/include/bstl/bignums.hpp b/include/bstl/bignums.hpp deleted file mode 100644 index bda4dbf..0000000 --- a/include/bstl/bignums.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef BETTERSTL_BIGNUMS_HPP -#define BETTERSTL_BIGNUMS_HPP - -#include -#include - -#endif //BETTERSTL_BIGNUMS_HPP diff --git a/include/bstl/bstl.hpp b/include/bstl/bstl.hpp index 91fc56c..8ca613f 100644 --- a/include/bstl/bstl.hpp +++ b/include/bstl/bstl.hpp @@ -1,7 +1,8 @@ - #ifndef BETTERSTL_BSTL_HPP -#include -#include + +#include +#include #include + #define BETTERSTL_BSTL_HPP #endif //BETTERSTL_BSTL_HPP diff --git a/src/BigDecimal.cpp b/src/big_decimal.cpp similarity index 99% rename from src/BigDecimal.cpp rename to src/big_decimal.cpp index a09b0e5..52291ee 100644 --- a/src/BigDecimal.cpp +++ b/src/big_decimal.cpp @@ -1,4 +1,4 @@ -#include "BigDecimal.hpp" +#include #include #include diff --git a/src/BigInteger.cpp b/src/big_integer.cpp similarity index 99% rename from src/BigInteger.cpp rename to src/big_integer.cpp index 06ebca9..3ed86c3 100644 --- a/src/BigInteger.cpp +++ b/src/big_integer.cpp @@ -1,4 +1,4 @@ -#include "BigInteger.hpp" +#include #include #include diff --git a/tests/BigDecimalTest.cpp b/tests/big_decimal_test.cpp similarity index 95% rename from tests/BigDecimalTest.cpp rename to tests/big_decimal_test.cpp index 8a14df4..d168e21 100644 --- a/tests/BigDecimalTest.cpp +++ b/tests/big_decimal_test.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/BigIntegerTest.cpp b/tests/big_integer_test.cpp similarity index 96% rename from tests/BigIntegerTest.cpp rename to tests/big_integer_test.cpp index 475478b..701a353 100644 --- a/tests/BigIntegerTest.cpp +++ b/tests/big_integer_test.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include