This is something I wanted to clean-up since a very long time indeed, but always postponed it, since it requires a lot of nasty clean-up and disentangling.... Several parts had been stashed away into `src/lib/test`, which are not really related: * the testrunner and testsuite builder * generic helper utilities * specialised test-support facilities, e.g. the EventLog This changeset introduces a new top-level test folder and a namespace `::test` Code from this folder is linked into a shared library `libtestsupport.so`, which resides in the linkage hierarchy between »Vessel« and »Vault«, yet is no longer part of the Lumiera application and only linked into the test-suite.
53 lines
1.8 KiB
C++
53 lines
1.8 KiB
C++
/*
|
||
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
|
||
|