Home | History | Annotate | Line # | Download | only in dist
      1  1.1.1.2  christos /*	Id: test-stringlist.c,v 1.3 2018/08/15 02:48:51 schwarze Exp 	*/
      2      1.1  christos /*
      3      1.1  christos  * Copyright (c) 2015 Ingo Schwarze <schwarze (at) openbsd.org>
      4      1.1  christos  *
      5      1.1  christos  * Permission to use, copy, modify, and distribute this software for any
      6      1.1  christos  * purpose with or without fee is hereby granted, provided that the above
      7      1.1  christos  * copyright notice and this permission notice appear in all copies.
      8      1.1  christos  *
      9      1.1  christos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10      1.1  christos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11      1.1  christos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12      1.1  christos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13      1.1  christos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14      1.1  christos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15      1.1  christos  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16      1.1  christos  */
     17      1.1  christos 
     18  1.1.1.2  christos #include <stddef.h>
     19      1.1  christos #include <stringlist.h>
     20      1.1  christos 
     21      1.1  christos int
     22      1.1  christos main(void)
     23      1.1  christos {
     24      1.1  christos 	StringList	*sl;
     25      1.1  christos 	char		 teststr[] = "test";
     26      1.1  christos 
     27      1.1  christos 	if ((sl = sl_init()) == NULL)
     28      1.1  christos 		return 1;
     29      1.1  christos 	if (sl_add(sl, teststr))
     30      1.1  christos 		return 2;
     31      1.1  christos 	if (sl->sl_cur != 1)
     32      1.1  christos 		return 3;
     33      1.1  christos 	if (sl->sl_str[0] != teststr)
     34      1.1  christos 		return 4;
     35      1.1  christos 
     36      1.1  christos 	sl_free(sl, 0);
     37      1.1  christos 	return 0;
     38      1.1  christos }
     39