test_alt_svc_ver.c revision 9a690580
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc.  See LICENSE. */
2#include <assert.h>
3#include <string.h>
4
5#include "lsquic.h"
6
7#define B(x) (1<<(x))
8
9int
10main (void)
11{
12    assert(0 == strcmp("", lsquic_get_alt_svc_versions(0xF000)));   /* Invalid bits ignored and no crash */
13    assert(0 == strcmp("43", lsquic_get_alt_svc_versions(B(LSQVER_043))));
14    assert(0 == strcmp("43,46", lsquic_get_alt_svc_versions(B(LSQVER_046)|B(LSQVER_043))));
15    assert(0 == strcmp("43,46", lsquic_get_alt_svc_versions(0xFF0000|B(LSQVER_046)|B(LSQVER_043))));
16    assert(0 == strcmp("46", lsquic_get_alt_svc_versions(B(LSQVER_046)|B(LSQVER_050))));
17    return 0;
18}
19