lumiera_documentation/tests/lib/util-sanitised-identifier-test.cpp
Ichthyostega 3caa5cfb03 Tests: reorganise test folders
This resolves a long-standing issue:
we could not use proper include paths for test-helper code that was defined alongside the tests.

Since some test-helper code must now be relocated into the »Vault«-Layer,
I took the opportunity to finally resolve this annoyance. The solution is two-fold
 * introduce a dedicated test-support library
 * remove the quirks that were necessary to support some plain-C tests
Together, this allows to raise the include-directory by one level,
and then to adjust all folder names so that they match the namespace
2026-03-07 00:56:19 +01:00

53 lines
1.8 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
UtilSanitizedIdentifier(Test) - remove non-standard-chars and punctuation
Copyright (C)
2008, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version. See the file COPYING for further details.
* *****************************************************************/
/** @file util-sanitised-identifier-test.cpp
** unit test \ref UtilSanitizedIdentifier_test
*/
#include "test/run.hpp"
#include "test/test-helper.hpp"
#include "lib/util.hpp"
#include <iostream>
using std::cout;
namespace util {
namespace test {
class UtilSanitizedIdentifier_test : public Test
{
virtual void run (Arg)
{
CHECK (sanitise ( "Word") == "Word"_expect);
CHECK (sanitise ( "a Sentence") == "a_Sentence"_expect);
CHECK (sanitise ( "trailing Withespace\n \t") == "trailing_Withespace"_expect);
CHECK (sanitise ("with a \t lot\n of Whitespace") == "with_a_lot_of_Whitespace"_expect);
CHECK (sanitise ( "@with\".\'much ($punctuation)[]!") == "@with.much_($punctuation)"_expect);
CHECK (sanitise ( "§&Ω%€ leading garbage") == "leading_garbage"_expect);
CHECK (sanitise ( "mixed Ω garbage") == "mixed_garbage"_expect);
CHECK (sanitise ( "Bääääh!!") == "Bh"_expect);
CHECK (sanitise ( "§&Ω%€") == ""_expect);
}
};
LAUNCHER (UtilSanitizedIdentifier_test, "unit common");
}} // namespace util::test