Tests for a generic string buffer structure for string printing and parsing.
More...
#include "acutest.h"
#include "acutest_helpers.h"
#include <freeradius-devel/util/time.h>
Go to the source code of this file.
Tests for a generic string buffer structure for string printing and parsing.
- Copyright
- 2022 Arran Cudbard-Bell a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg
Definition in file time_tests.c.
◆ ROUNDS
◆ check_delta_from_str()
| static void check_delta_from_str |
( |
char const * |
in, |
|
|
fr_time_res_t |
hint, |
|
|
int64_t |
expected |
|
) |
| |
|
static |
◆ check_delta_from_str_fail()
| static void check_delta_from_str_fail |
( |
char const * |
in, |
|
|
fr_time_res_t |
hint |
|
) |
| |
|
static |
◆ time_benchmark()
| static void time_benchmark |
( |
void |
| ) |
|
|
static |
◆ time_delta_from_str()
| static void time_delta_from_str |
( |
void |
| ) |
|
|
static |
Parse time deltas from strings: integers, floats, scale suffixes, timestamps and errors.
Definition at line 111 of file time_tests.c.
◆ time_delta_to_str()
| static void time_delta_to_str |
( |
void |
| ) |
|
|
static |
Format time deltas to strings across sign, fraction and the unsigned flag.
Definition at line 184 of file time_tests.c.
◆ time_delta_to_str_int64_min()
| static void time_delta_to_str_int64_min |
( |
void |
| ) |
|
|
static |
Format the most negative delta possible.
fr_time_delta_to_str() takes the magnitude of the delta with a MOD()
macro. INT64_MIN is the awkward case: negating it in a signed type is
undefined (its positive counterpart, 2^63, isn't representable in
int64_t), so the magnitude has to be taken in the unsigned domain.
This checks the boundary formats correctly rather than tripping UBSan.
Definition at line 60 of file time_tests.c.
◆ time_elapsed_update()
| static void time_elapsed_update |
( |
void |
| ) |
|
|
static |
Test fr_time_elapsed_update sorts delays into the correct histogram bins.
Definition at line 310 of file time_tests.c.
◆ time_scale()
| static void time_scale |
( |
void |
| ) |
|
|
static |
Test fr_time_scale: per-resolution multipliers, clamping and invalid hints.
Definition at line 215 of file time_tests.c.
◆ unix_time_from_tm()
| static void unix_time_from_tm |
( |
void |
| ) |
|
|
static |
Test fr_unix_time_from_tm against well-known UTC epochs.
Definition at line 234 of file time_tests.c.
◆ unix_time_str()
| static void unix_time_str |
( |
void |
| ) |
|
|
static |
◆ TEST_LIST
Initial value:= {
{ 0 }
}
static void unix_time_str(void)
Round-trip fr_unix_time_from_str() and fr_unix_time_to_str() in UTC.
static void time_delta_from_str(void)
Parse time deltas from strings: integers, floats, scale suffixes, timestamps and errors.
static void time_delta_to_str_int64_min(void)
Format the most negative delta possible.
static void time_delta_to_str(void)
Format time deltas to strings across sign, fraction and the unsigned flag.
static void unix_time_from_tm(void)
Test fr_unix_time_from_tm against well-known UTC epochs.
static void time_elapsed_update(void)
Test fr_time_elapsed_update sorts delays into the correct histogram bins.
static void time_benchmark(void)
static void time_scale(void)
Test fr_time_scale: per-resolution multipliers, clamping and invalid hints.
Definition at line 341 of file time_tests.c.