Started adding unit tests

This commit is contained in:
2021-11-21 22:46:19 +01:00
parent ad737f1c73
commit 5a4b9e3298
9 changed files with 83 additions and 1 deletions

View File

@@ -18,6 +18,12 @@ struct fmt_node_t {
int length = 6;
int precision = 2;
FormatType type = FormatType::s;
constexpr bool operator==(const fmt_node_t& rhs) const {
return (rhs.has_zero_padding == has_zero_padding) &&
(rhs.length == length) && (rhs.precision == precision) &&
(rhs.type == type);
}
};
@@ -26,6 +32,17 @@ public:
constexpr ast_node_t() {
}
constexpr ast_node_t(char c) : m_is_char(true), m_c(c) {
}
constexpr ast_node_t(fmt_node_t node) : m_is_char(false), m_node(node) {
}
constexpr bool operator==(const ast_node_t& rhs) const {
return ((rhs.m_is_char == m_is_char) && (rhs.m_c == m_c)) ||
((rhs.m_is_char != m_is_char) && (rhs.m_node == m_node));
}
constexpr void set_char(char c) {
m_c = c;
m_is_char = true;

View File

@@ -2,6 +2,9 @@
#define LOGGER_UTILITY_H
#include <cstdlib>
namespace detail {