From e94db4695e236b42ae1be44b2605075161d5144f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Fri, 18 Oct 2024 21:43:44 -0500 Subject: Add temporary work for formatting. --- test/CMakeLists.txt | 1 + test/test_format.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 test/test_format.cpp (limited to 'test') 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::constFill('\0')}; + auto span = Span::makeCStringBuffer(buffer); + + auto formatResult = format(span, "Hello, {}! {}", "world", 42); + printf("%s\n", buffer.data()); +} + +} // namespace fud -- cgit v1.2.3