16 Commits

Author SHA1 Message Date
Benedikt Heine
a6abfdf7c5 Include all local files relatively 2018-11-15 15:17:48 +01:00
Benedikt Heine
2e9d8300de Include full c source to assert static objects
To assert static objects, we either have to add a method into the
object under test itself and recompile on a test run with the activated test
method (but also recompile after tests, so that method is gone on
release builds).

Alternatively we can include the whole .c file in our test
infrastructure and save the object in the test directory. So there's no
necessity to clean it up prior to a release build and it's contained
away.

This requires, that the test folder isn't excluded in coveralls.
2018-11-15 15:17:21 +01:00
Benedikt Heine
90b04a22dd Use g_malloc instead of malloc
g_malloc won't return NULL, but abort the program. As we don't check for
NULl, this is the better solution.
2018-11-11 15:18:56 +01:00
Benedikt Heine
d8d457f500 Remove string_replace()
string_replace_at does almost the same and string_replace is only used
once, where additionally string_replace_at would be the better choice.
2018-11-11 15:18:56 +01:00
Benedikt Heine
778a6857d8 Move clean_value function to utils.c
This is a typical string manipulation function an has no necessity to
stay in option_parser.
2018-10-08 18:27:11 +02:00
Nikos Tsipinakis
e8e4af9ea3 Temporarily remove invalid value test in string_to_time
As mentioned in #368 testing for invalid values with the current
implementation would result in misleading error messages being printed
to stdout. These tests should be disabled until a solution is found.
2017-10-07 19:05:49 +03:00
Benedikt Heine
5d46cd700c Add option_get_time functions 2017-10-07 17:46:24 +02:00
Benedikt Heine
a6301ff464 Do not concatenate empty strings with separator 2017-10-06 13:13:47 +02:00
Benedikt Heine
a1781a451b Check for b value if null in string_append
This avoids "a", NULL, "sep" to come to "asep" instead of "a".
2017-09-25 03:55:19 +02:00
Benedikt Heine
8b11113be1 Implement test_string_append 2017-09-25 03:54:37 +02:00
Benedikt Heine
7eb99ea64d add tests for *_get_path functions 2017-08-15 23:51:14 +02:00
Nikos Tsipinakis
0c49b49254 Replace string_to_argv util function with g_shell_parse_argv
string_to_argv parsing was very simplistic and didn't properly handle
quotations. Since we are already using glib, g_shell_parse_argv serves
the same purpose with much better parsing and error handling.
2017-02-05 13:00:59 +02:00
Nikos Tsipinakis
f34b846041 Fix memory leaks in the unit tests
Making valgrind complain less should help finding actual memory leaks in
the long run.
2017-01-29 15:32:36 +02:00
Nikos Tsipinakis
9333d68656 Use the suite_ prefix for test suites 2016-12-03 19:19:10 +02:00
Nikos Tsipinakis
256440b25a Implement tests for most of the util functions
Also improved the implementation of the test_string_replace_char test.
2016-11-22 18:47:38 +02:00
Nikos Tsipinakis
d441e950d8 Implement test target and add the first test
make test will now compile the tests to test/test.
The first test, testing string_replace_char from utils.c, was added.
2016-11-19 12:26:00 +02:00