test_alt_svc_ver.c revision a74702c6
1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ 25392f7a3SLiteSpeed Tech#include <assert.h> 35392f7a3SLiteSpeed Tech#include <string.h> 45392f7a3SLiteSpeed Tech 55392f7a3SLiteSpeed Tech#include "lsquic.h" 65392f7a3SLiteSpeed Tech 75392f7a3SLiteSpeed Tech#define B(x) (1<<(x)) 85392f7a3SLiteSpeed Tech 95392f7a3SLiteSpeed Techint 105392f7a3SLiteSpeed Techmain (void) 115392f7a3SLiteSpeed Tech{ 125392f7a3SLiteSpeed Tech assert(0 == strcmp("", lsquic_get_alt_svc_versions(0xF000))); /* Invalid bits ignored and no crash */ 13fb96f4ddSDmitri Tikhonov assert(0 == strcmp("43", lsquic_get_alt_svc_versions(B(LSQVER_043)))); 14fb96f4ddSDmitri Tikhonov assert(0 == strcmp("43,46", lsquic_get_alt_svc_versions(B(LSQVER_046)|B(LSQVER_043)))); 15fb96f4ddSDmitri Tikhonov assert(0 == strcmp("43,46", lsquic_get_alt_svc_versions(0xFF0000|B(LSQVER_046)|B(LSQVER_043)))); 16fb96f4ddSDmitri Tikhonov assert(0 == strcmp("46", lsquic_get_alt_svc_versions(B(LSQVER_046)|B(LSQVER_050)))); 175392f7a3SLiteSpeed Tech return 0; 185392f7a3SLiteSpeed Tech} 19