summaryrefslogtreecommitdiff
path: root/src/test/test-hashmap.c
Commit message (Collapse)AuthorAge
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-08-24
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* test: use _cleanup_hashmap_free_ instread of _cleanup_(hashmap_freep)Yu Watanabe2018-08-24
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* hash-func: add generic hash_ops implementation for hashing pathsLennart Poettering2018-05-30
| | | | | | | | | | | | | | | This is similar to string_hash_ops but operates one file system paths specifically. It will ensure that "/foo//bar" and "///foo/bar" are considered to be the same path for hashmap purposes. This makes use of the existing path_compare() API, and adds a matching hashing function for it. Note that relative and absolute paths will hash to different values, however whether the path is suffixed with a slash or not is not detected. This matches the existing path_compare() behaviour, and follows the logic that on Linux there can't be two different objects at path /foo/bar and /foo/bar/ either.
* test-hashmap: test IteratedCacheVito Caputo2018-05-30
| | | | Add some rudimentary testing of the new IteratedCache
* hash-func: add generic hash_ops implementation for hashing pathsLennart Poettering2018-05-30
| | | | | | | | | | | | | | | | | This is similar to string_hash_ops but operates one file system paths specifically. It will ensure that "/foo//bar" and "///foo/bar" are considered to be the same path for hashmap purposes. This makes use of the existing path_compare() API, and adds a matching hashing function for it. Note that relative and absolute paths will hash to different values, however whether the path is suffixed with a slash or not is not detected. This matches the existing path_compare() behaviour, and follows the logic that on Linux there can't be two different objects at path /foo/bar and /foo/bar/ either. (cherry picked from commit 46e16b347f83d809ed3d34f26286f580dfd086ce)
* Prep v236 : Add missing SPDX-License-Identifier (8/9) src/testSven Eden2018-03-26
|
* Add set/hashmap helpers for non-trivial freeing and use where straighforwardZbigniew Jędrzejewski-Szmek2017-11-28
| | | | | | A macro is needed because otherwise we couldn't ensure type safety. Some simple tests are included. No functional change intended.
* Prep v233.3: Add all possible coverage tests for elogindSven Eden2017-07-20
|
* Remove src/testAndy Wingo2015-04-19
|
* test-hashmap: fix gcc5 warningDaniel Mack2015-02-24
| | | | | | | | gcc5 spits out a warning about test-hashmap.c: CC src/test/test-hashmap.o src/test/test-hashmap.c: In function ‘test_string_compare_func’: src/test/test-hashmap.c:76:79: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* test: generate tests for OrderedHashmap from Hashmap testsMichal Schmidt2014-10-23
| | | | | | | | | test-hashmap-ordered.c is generated from test-hashmap-plain.c simply by substituting "ordered_hashmap" for "hashmap" etc. In the cases where tests rely on the order of entries, a distinction between plain and ordered hashmaps is made using the ORDERED macro, which is defined only for test-hashmap-ordered.c.
* test: only use assert_seThomas Hindoe Paaboel Andersen2014-10-04
| | | | | The asserts used in the tests should never be allowed to be optimized away
* tests: add tests for {hashmap,set}_steal_firstZbigniew Jędrzejewski-Szmek2014-10-01
| | | | Just to make sure that coverity is wrong.
* hashmap, set: remove unused functionsMichal Schmidt2014-09-15
| | | | | | | | | | | | The following hashmap_* and set_* functions/macros have never had any users in systemd's history: *_iterate_backwards *_iterate_skip *_last *_FOREACH_BACKWARDS Remove this dead code.
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* tests: add tests to test-hashmapRonny Chevalier2014-06-16
| | | | | | | | | add tests for: - hashmap_remove_and_put - hashmap_first_key - hashmap_last - hashmap_steal_first_key - hashmap_clear_free_free
* hashmap: size hashmap bucket array dynamicallyLennart Poettering2013-10-01
| | | | | | | | | | Instead of fixing the hashmap bucket array to 127 entries dynamically size it, starting with a smaller one of 31. As soon as a fill level of 75% is reached, quadruple the size, and so on. This should siginficantly optimize the lookup time in large tables (from O(n) back to O(1)), and save memory on smaller tables (which most are).
* test-hashmap: fix access to uninitialized memoryZbigniew Jędrzejewski-Szmek2013-09-26
|
* test-hashmap.c: add unit-test for hashmapDaniel Buch2013-05-03