summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-18 21:43:44 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-18 21:43:44 -0500
commite94db4695e236b42ae1be44b2605075161d5144f (patch)
treeada1a0442abdd08375df7f9a8f9cd50924e0840a /test
parent8249b28bea29e8ce17eac12776a60ec3f9e47176 (diff)
Add temporary work for formatting.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/test_format.cpp35
2 files changed, 36 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a2fcf7b..0860c0d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -60,6 +60,7 @@ fud_add_test(test_fud SOURCES test_fud.cpp)
fud_add_test(test_allocator SOURCES test_allocator.cpp)
fud_add_test(test_assert SOURCES test_assert.cpp)
fud_add_test(test_directory SOURCES test_directory.cpp)
+fud_add_test(test_format SOURCES test_format.cpp)
fud_add_test(test_result SOURCES test_result.cpp)
fud_add_test(test_span SOURCES test_span.cpp)
fud_add_test(test_sqlite SOURCES test_sqlite.cpp)
diff --git a/test/test_format.cpp b/test/test_format.cpp
new file mode 100644
index 0000000..a373fec
--- /dev/null
+++ b/test/test_format.cpp
@@ -0,0 +1,35 @@
+/*
+ * libfud
+ * Copyright 2024 Dominick Allen
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fud_array.hpp"
+#include "fud_format.hpp"
+#include "fud_span.hpp"
+
+#include "gtest/gtest.h"
+
+namespace fud {
+
+TEST(FormatTest, BasicTest)
+{
+ auto buffer{Array<char, 64>::constFill('\0')};
+ auto span = Span<char, buffer.size() - 1U>::makeCStringBuffer(buffer);
+
+ auto formatResult = format(span, "Hello, {}! {}", "world", 42);
+ printf("%s\n", buffer.data());
+}
+
+} // namespace fud