summaryrefslogtreecommitdiffhomepage
path: root/dev/lib
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-08-15 12:09:28 +0200
committerAmlal <amlal@nekernel.org>2025-08-15 12:09:28 +0200
commit70945244a35e0e6d2a2e0f84ae83f31b9898a0ca (patch)
tree2bf642b31c914a36c36f10b20ea5189ca3c47c09 /dev/lib
parent37bc0133c137cdf7fe62e79ac8208ec46096316e (diff)
feat: new hpptest and gtest module. Other module improvements.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/lib')
-rw-r--r--dev/lib/core/includes.hpp15
-rw-r--r--dev/lib/except/hpptest.hpp9
-rw-r--r--dev/lib/fix/parser.hpp2
-rw-r--r--dev/lib/io/print.hpp19
-rw-r--r--dev/lib/net/url.hpp16
-rw-r--r--dev/lib/tests/gtest.hpp8
-rw-r--r--dev/lib/tests/hpptest.hpp22
7 files changed, 63 insertions, 28 deletions
diff --git a/dev/lib/core/includes.hpp b/dev/lib/core/includes.hpp
new file mode 100644
index 0000000..b516e5f
--- /dev/null
+++ b/dev/lib/core/includes.hpp
@@ -0,0 +1,15 @@
+/*
+ * File: core/includes.hpp
+ * Purpose: Core includes for the SOCL library.
+ * Author: Amlal El Mahrouss (founder@snu.systems)
+ * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp.
+ */
+
+#pragma once
+
+#include <boost/core/nvp.hpp>
+#include <boost/core/demangle.hpp>
+#include <boost/core/null_deleter.hpp>
+#include <memory>
+#include <utility>
+#include <filesystem>
diff --git a/dev/lib/except/hpptest.hpp b/dev/lib/except/hpptest.hpp
deleted file mode 100644
index 5277780..0000000
--- a/dev/lib/except/hpptest.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-/// @note Place your static asserts here, for hpptest.py!
-#ifdef SOCL_HPPTEST
-SOCL_HPPTEST_ASSERT(true);
-SOCL_HPPTEST_ASSERT(1 + 1 == 2);
-#endif
-
-/// @brief This header file is meant to be a tutorial on how to use mk.test and its macro framework.
diff --git a/dev/lib/fix/parser.hpp b/dev/lib/fix/parser.hpp
index 0f2287e..8181359 100644
--- a/dev/lib/fix/parser.hpp
+++ b/dev/lib/fix/parser.hpp
@@ -159,7 +159,7 @@ namespace snu::fix
if (in.empty())
return ret;
- thread_local std::basic_string<char_type> in_tmp{};
+ static thread_local std::basic_string<char_type> in_tmp{};
in_tmp.reserve(in.size());
diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp
index 36192c4..eb425c1 100644
--- a/dev/lib/io/print.hpp
+++ b/dev/lib/io/print.hpp
@@ -13,31 +13,30 @@
#include <ostream>
namespace snu::io
-{
- template <typename T>
- inline void printv(T fmt) noexcept
+{
+ template <typename T, typename... Args>
+ inline void print(T fmt, Args... other) noexcept
{
std::cout << fmt;
+ print(other...);
}
template <typename T>
- inline void printv(std::initializer_list<T> fmt) noexcept
+ inline void print(T fmt) noexcept
{
std::cout << fmt;
}
- template <typename... T>
- inline void print(T... fmt) noexcept
+ inline void print() noexcept
{
- (printv(fmt), ...);
+ std::cout << std::endl;
}
template <typename... T>
inline void println(T... fmt) noexcept
{
- print(static_cast<T>(fmt)...);
- std::cout << std::endl;
+ print(fmt...);
}
} // namespace snu::io
-#endif // ifndef _SNU_PRINT_HPP \ No newline at end of file
+#endif // ifndef _SNU_PRINT_HPP
diff --git a/dev/lib/net/url.hpp b/dev/lib/net/url.hpp
index 496889c..f6dba95 100644
--- a/dev/lib/net/url.hpp
+++ b/dev/lib/net/url.hpp
@@ -51,14 +51,14 @@ namespace snu::net
return *this;
}
- explicit operator bool()
- {
- return this->is_valid();
- }
+ explicit operator bool()
+ {
+ return this->is_valid();
+ }
- bool is_valid()
- {
- return ss_.size() > 0;
- }
+ bool is_valid()
+ {
+ return ss_.size() > 0;
+ }
};
} // namespace snu::net
diff --git a/dev/lib/tests/gtest.hpp b/dev/lib/tests/gtest.hpp
new file mode 100644
index 0000000..14474c0
--- /dev/null
+++ b/dev/lib/tests/gtest.hpp
@@ -0,0 +1,8 @@
+/*
+ * File: tests/gtest.hpp
+ * Purpose: Google Test wrapper for the SOCL library.
+ * Author: Amlal El Mahrouss (founder@snu.systems)
+ * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp.
+ */
+
+#include <gtest/gtest.h>
diff --git a/dev/lib/tests/hpptest.hpp b/dev/lib/tests/hpptest.hpp
new file mode 100644
index 0000000..4c99ce6
--- /dev/null
+++ b/dev/lib/tests/hpptest.hpp
@@ -0,0 +1,22 @@
+/*
+ * File: tests/hpptest.hpp
+ * Purpose: HPP Test wrapper for the SOCL library.
+ * Author: Amlal El Mahrouss (founder@snu.systems)
+ * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp.
+ */
+
+#pragma once
+
+
+#ifdef SOCL_HPPTEST
+namespace snu::hpptest
+{
+ typedef bool condition_type;
+
+ template <condition_type expr = true>
+ consteval inline void must_pass()
+ {
+ SOCL_HPPTEST_ASSERT(expr);
+ }
+} // namespace snu::hpptest
+#endif