test_senhist.c revision 06b2a236
1/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc.  See LICENSE. */
2#include <assert.h>
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6#include <inttypes.h>
7
8#include "lsquic_int_types.h"
9#include "lsquic_senhist.h"
10#include "lsquic_types.h"
11#include "lsquic_logger.h"
12
13
14int
15main (void)
16{
17    struct lsquic_senhist hist = { 0, 0
18#if !LSQUIC_SENHIST_FATAL
19        , 0
20#endif
21    };
22    lsquic_packno_t packno;
23
24    lsquic_senhist_init(&hist, 0);
25
26    assert(0 == lsquic_senhist_largest(&hist));
27
28    for (packno = 1; packno < 100; ++packno)
29        lsquic_senhist_add(&hist, packno);
30
31    assert(99 == lsquic_senhist_largest(&hist));
32
33    lsquic_senhist_cleanup(&hist);
34
35    return 0;
36}
37