test_senhist.c revision f07b3eae
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#ifdef _MSC_VER 8#include "vc_compat.h" 9#endif 10#include "lsquic_int_types.h" 11#include "lsquic_senhist.h" 12#include "lsquic_types.h" 13#include "lsquic_logger.h" 14 15 16int 17main (void) 18{ 19 struct lsquic_senhist hist = { 0, 0 20#if !LSQUIC_SENHIST_FATAL 21 , 0 22#endif 23 }; 24 lsquic_packno_t packno; 25 26 lsquic_senhist_init(&hist, 0); 27 28 assert(0 == lsquic_senhist_largest(&hist)); 29 30 for (packno = 1; packno < 100; ++packno) 31 lsquic_senhist_add(&hist, packno); 32 33 assert(99 == lsquic_senhist_largest(&hist)); 34 35 lsquic_senhist_cleanup(&hist); 36 37 return 0; 38} 39