1*544c191cSchristos /* Id: test-stringlist.c,v 1.3 2018/08/15 02:48:51 schwarze Exp */
29ff1f2acSchristos /*
39ff1f2acSchristos * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
49ff1f2acSchristos *
59ff1f2acSchristos * Permission to use, copy, modify, and distribute this software for any
69ff1f2acSchristos * purpose with or without fee is hereby granted, provided that the above
79ff1f2acSchristos * copyright notice and this permission notice appear in all copies.
89ff1f2acSchristos *
99ff1f2acSchristos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
109ff1f2acSchristos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
119ff1f2acSchristos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
129ff1f2acSchristos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
139ff1f2acSchristos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
149ff1f2acSchristos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
159ff1f2acSchristos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
169ff1f2acSchristos */
179ff1f2acSchristos
18*544c191cSchristos #include <stddef.h>
199ff1f2acSchristos #include <stringlist.h>
209ff1f2acSchristos
219ff1f2acSchristos int
main(void)229ff1f2acSchristos main(void)
239ff1f2acSchristos {
249ff1f2acSchristos StringList *sl;
259ff1f2acSchristos char teststr[] = "test";
269ff1f2acSchristos
279ff1f2acSchristos if ((sl = sl_init()) == NULL)
289ff1f2acSchristos return 1;
299ff1f2acSchristos if (sl_add(sl, teststr))
309ff1f2acSchristos return 2;
319ff1f2acSchristos if (sl->sl_cur != 1)
329ff1f2acSchristos return 3;
339ff1f2acSchristos if (sl->sl_str[0] != teststr)
349ff1f2acSchristos return 4;
359ff1f2acSchristos
369ff1f2acSchristos sl_free(sl, 0);
379ff1f2acSchristos return 0;
389ff1f2acSchristos }
39