Commit Graph

139 Commits

Author SHA1 Message Date
Martchus d7dd33d95a WIP: Use consistent prefix for #defines 2018-07-02 21:33:41 +02:00
Martchus 27d5041e06 Add Traits::IsSpecializingAnyOf 2018-06-24 20:13:41 +02:00
Martchus 0fb92e3685 Add Traits::None 2018-06-23 14:33:00 +02:00
Martchus e0fee70d58 Print vector<char> and similar in hex notation on assert fail 2018-06-21 23:27:05 +02:00
Martchus e4bf7142f5 Add Traits::Is{Any,None}Of 2018-06-20 23:07:08 +02:00
Martchus 5e8d8cb7d1 Show dashes in suggestions 2018-05-11 16:15:02 +02:00
Martchus 24720bbbc1 Fix passing cursor position to findSuggestions() 2018-05-11 15:51:30 +02:00
Martchus 1aa8b387e1 Apply clang-format 2018-05-08 00:35:51 +02:00
Martchus f0b777207e Fix dependency version under GCC 8 2018-05-08 00:35:41 +02:00
Martchus a4435bbcf3 Fix usage of enable_if with GCC 8
Seems like the trick with the three dots isn't working
with GCC 8 anymore. So let's make it a default template
parameter then.

Not sure whether GCC 8 is here correct and whether this
workaround causes further trouble.
2018-05-07 23:22:43 +02:00
Martchus 8ef92cbf47 Use Levenshtein algo to provide suggestions if arg not found 2018-05-07 21:59:23 +02:00
Martchus 44f0206a13 Refactor ArgumentReader::read()
* Use return-code for error handling
* Improve documentation/comments
* Improve const correctness
2018-05-07 20:04:30 +02:00
Martchus 429de98836 Add algorithm for computing Damerau–Levenshtein distance 2018-05-05 23:26:53 +02:00
Martchus 034b8a75d1 Add min(), max() for any number of arguments 2018-05-05 23:06:51 +02:00
Martchus 52bf075317 Move creation of srcdirref and testfiles dir to BasicConfig
Those make testing more convenient and are also useful when
there's no test target, eg. when testing syncthingtray with
mocked configuration.
2018-05-01 23:59:28 +02:00
Martchus df7a3ee93c Apply clang-format from LLVM 6 2018-03-24 17:00:30 +01:00
Martchus 007235973a Use DateTime::exactGmtNow in stringbuilder benchmark 2018-03-07 18:52:03 +01:00
Martchus da5a027ea3 Add simplified, string_view-compatible version of splitString() 2018-02-28 18:03:07 +01:00
Martchus 3a768508fd Use src dir as fallback unless arg *and* env var specified 2018-02-03 17:16:30 +01:00
Martchus e3310792d3 Improve tests for IO utilities 2018-01-29 16:26:02 +01:00
Martchus bc61461b7a Improve tests of conversion utilities 2018-01-29 16:25:31 +01:00
Martchus 9ed143e7d5 Improve chrono tests 2018-01-29 16:24:17 +01:00
Martchus 368fc46e47 Improve tests of argument parser 2018-01-29 16:23:10 +01:00
Martchus ff5eb6c7c9 Do not show help for --help 2018-01-28 00:43:03 +01:00
Martchus 09f9181281 Split operations from other top-level args in --help 2018-01-28 00:38:05 +01:00
Martchus 37c98b2f91 Allow ~OutputCheck() to throw so assert behaves as expected
* Required because assertion might throw
* No ABI break because not part of ABI anyways
2017-12-11 14:01:40 +01:00
Martchus 26cd303422 Improve period compution 2017-12-03 01:45:54 +01:00
Martchus 602993aa05 Add tests for TimeSpanOutputFormat::TotalSeconds 2017-12-02 22:26:26 +01:00
Martchus a3192a1113 Fix parsing top-level argument after abbreviation 2017-11-29 22:52:50 +01:00
Martchus 4e4e13e4c8 Improve argument parser tests 2017-11-29 20:29:51 +01:00
Martchus 2264ea5cf2 Add trait to check whether type is complete 2017-11-16 02:00:03 +01:00
Martchus cf4789e94d testutils: Allow asserting maps/hashes 2017-11-13 20:06:09 +01:00
Martchus ab42e9d96c Improve documentation of testutils 2017-11-12 16:58:53 +01:00
Martchus cc5d6052f5 test application: Allow to skip argument parsing 2017-11-12 16:17:08 +01:00
Martchus 924481b033 Fix platform check for readFallback...() functions 2017-11-01 19:30:55 +01:00
Martchus 6fd2603cff teat application: Prevent copying dir entries 2017-11-01 19:17:57 +01:00
Martchus 34f3ebb45d Let tests find the application path without extra args
Currently the path of the application to be tested always had to
be specified either manually using the -a argument or by running
the tests via the build system targets. The first option is annoying
and the second option not so nice when using Qt Creator and the
debugger.

This commit makes tests assume the application to be tested is
called like the test executable itself, just without "_tests"-suffix.
2017-10-30 23:03:43 +01:00
Martchus 2bb4aa36a4 Let tests find the testfiles from sources without extra args
Currently the path of the testfiles always had to be specified
either manually using the -p argument or by running the tests
via the build system targets. The first option is annoying and
the second option not so nice when using Qt Creator and the
debugger.

This commit allows tests to find the testfiles from the source
directory automatically (as fallback). This is achieved by
creating a file containing the path of the source directory
with CMake. Note that this file can only be found if the working
directory is set to the binary directory (default in Qt Creator).
2017-10-30 23:01:07 +01:00
Martchus fa39e2a1aa Add traits to check for reserve() and size() 2017-10-27 18:25:32 +02:00
Martchus dab05bdade Improve coding style in test utilities 2017-10-24 01:02:07 +02:00
Martchus e393af5dbb testutils: Print indices of iteratables (on assert equal fail) 2017-10-23 01:11:11 +02:00
Martchus 2ec3df889f Allow accessing application path from TestApplication
Make it static because when this function becomes useful,
the (singleton) instance is likely not available.
2017-10-21 21:25:26 +02:00
Martchus 46f652ad00 Improve readability of ArgumentReader::read and use Phrases 2017-10-19 00:51:47 +02:00
Martchus b4556c0481 Move OutputCheck to its own header file
* So it can be used in tests for tageditor and
  other applications
* Make it a header-only class so c++utilities
  does not depend on cppunit
2017-09-20 17:09:34 +02:00
Martchus 5f14d55f25 Use Argument::varValueCount to fix warnings 2017-09-20 17:07:06 +02:00
Martchus 868162742b Adjust argument parser tests 2017-09-19 16:02:42 +02:00
Martchus e52fd5a4af Apply tidy after updating to clang-format 5.0.0
The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2017-09-17 21:45:23 +02:00
Martchus 840700d7af Fix compiling math tests under 32-bit architectures
Same problem as with size_t. The types must match exactly
when using CPPUNIT_ASSERT_EQUAL and using 'l' or 'ul' suffix
is not sufficient under 32-bit.
2017-09-03 20:13:27 +02:00
Martchus 357ede4ee7 chrono utils: Improve handling micro- and nanoseconds
DateTime and TimeSpan have an accuracy of 100 nanoseconds.

This commit ensures this is also handled in toString() and
fromString() methods and adds relevant convenience methods.
2017-08-31 02:17:05 +02:00
Martchus c88fd9f9a8 Fix calculation of overall test coverage 2017-08-17 17:59:29 +02:00