New upstream version 8.1.0

This commit is contained in:
geos_one
2025-08-10 01:34:16 +02:00
commit c891bb7105
4398 changed files with 838833 additions and 0 deletions

33
common/tests/TestUiTk.cpp Normal file
View File

@@ -0,0 +1,33 @@
#include <common/toolkit/UiTk.h>
#include <sstream>
#include <gtest/gtest.h>
bool testQuestion(const std::string& answer, boost::optional<bool> defaultAnswer=boost::none)
{
std::stringstream input(answer);
return uitk::userYNQuestion("Test", defaultAnswer, input);
}
TEST(UiTk, userYNQuestion)
{
// basic input
ASSERT_TRUE( testQuestion("Y"));
ASSERT_FALSE(testQuestion("N"));
ASSERT_TRUE( testQuestion("y"));
ASSERT_FALSE(testQuestion("n"));
ASSERT_TRUE( testQuestion("Yes"));
ASSERT_FALSE(testQuestion("No"));
// default answers
ASSERT_TRUE( testQuestion("", true));
ASSERT_FALSE(testQuestion("", false));
ASSERT_TRUE( testQuestion("Y", false));
ASSERT_TRUE( testQuestion("Y", false));
ASSERT_FALSE(testQuestion("N", true));
ASSERT_FALSE(testQuestion("N", true));
}