dte test coverage


Directory: ./
File: src/util/intern.c
Date: 2025-11-12 12:04:10
Coverage Exec Excl Total
Lines: 100.0% 8 0 8
Functions: 100.0% 2 0 2
Branches: 100.0% 2 0 2

Line Branch Exec Source
1 #include "intern.h"
2 #include "hashset.h"
3
4 // NOLINTNEXTLINE(*-avoid-non-const-global-variables)
5 static HashSet interned_strings;
6
7 2984 const void *mem_intern(const void *data, size_t len)
8 {
9
2/2
✓ Branch 2 → 3 taken 11 times.
✓ Branch 2 → 4 taken 2973 times.
2984 if (unlikely(interned_strings.table_size == 0)) {
10 11 hashset_init(&interned_strings, 32, false);
11 }
12
13 2984 HashSetEntry *e = hashset_insert(&interned_strings, data, len);
14 2984 return e->str;
15 }
16
17 11 void free_interned_strings(void)
18 {
19 11 hashset_free(&interned_strings);
20 11 }
21