FreeCAD WebAssembly development snapshot
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled
This commit is contained in:
12
tests/src/Misc/CMakeLists.txt
Normal file
12
tests/src/Misc/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
add_executable(Misc_tests_run
|
||||
fmt.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Misc_tests_run PRIVATE
|
||||
GTest::gtest_main
|
||||
GTest::gmock_main
|
||||
${Google_Tests_LIBS}
|
||||
fmt::fmt
|
||||
)
|
||||
34
tests/src/Misc/fmt.cpp
Normal file
34
tests/src/Misc/fmt.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdexcept>
|
||||
|
||||
// NOLINTBEGIN
|
||||
TEST(fmt, fail)
|
||||
{
|
||||
EXPECT_NE("abc", fmt::format("{}{}", "a", "b"));
|
||||
}
|
||||
|
||||
TEST(fmt, pass)
|
||||
{
|
||||
EXPECT_EQ("ab", fmt::format("{}{}", "a", "b"));
|
||||
}
|
||||
|
||||
TEST(fmt, print_pass)
|
||||
{
|
||||
EXPECT_EQ("12", fmt::sprintf("%s%d", "1", 2));
|
||||
EXPECT_EQ("x", fmt::sprintf("%c", 'x'));
|
||||
EXPECT_EQ("1.23 2", fmt::sprintf("%.2f %d", 1.23456, 2));
|
||||
EXPECT_EQ("0.123456789012", fmt::sprintf("%.12f", 0.123456789012));
|
||||
EXPECT_EQ("-1234", fmt::sprintf("%li", -1234L));
|
||||
EXPECT_EQ("-1234567890", fmt::sprintf("%li", -1234567890L));
|
||||
EXPECT_EQ("1234567890", fmt::sprintf("%li", 1234567890UL));
|
||||
}
|
||||
|
||||
TEST(fmt, print_fail)
|
||||
{
|
||||
EXPECT_THROW(fmt::printf("%s%d", 1, 2), std::exception);
|
||||
}
|
||||
// NOLINTEND
|
||||
Reference in New Issue
Block a user