test-stringlist.c revision 302408
1248613Sdes/* $Id: test-stringlist.c,v 1.2 2015/10/06 18:32:20 schwarze Exp $ */ 2137015Sdes/* 3137015Sdes * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> 4147001Sdes * 5137015Sdes * Permission to use, copy, modify, and distribute this software for any 6137015Sdes * purpose with or without fee is hereby granted, provided that the above 7137015Sdes * copyright notice and this permission notice appear in all copies. 8218767Sdes * 9146998Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10146998Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11146998Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12146998Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13137015Sdes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14137015Sdes * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15137015Sdes * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16248613Sdes */ 17248613Sdes 18248613Sdes#include <stringlist.h> 19248613Sdes 20248613Sdesint 21248613Sdesmain(void) 22248613Sdes{ 23248613Sdes StringList *sl; 24248613Sdes char teststr[] = "test"; 25248613Sdes 26137015Sdes if ((sl = sl_init()) == NULL) 27137015Sdes return 1; 28137015Sdes if (sl_add(sl, teststr)) 29146998Sdes return 2; 30146998Sdes if (sl->sl_cur != 1) 31248613Sdes return 3; 32137015Sdes if (sl->sl_str[0] != teststr) 33137015Sdes return 4; 34137015Sdes 35204861Sdes sl_free(sl, 0); 36137015Sdes return 0; 37137015Sdes} 38137015Sdes