--- /dev/null
+/*
+ * Copyright (C) 2012-2015 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <list.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+static char *names[] = {
+ "backwards",
+ "end to start",
+ "finish",
+ "english",
+};
+
+int main(int argc, char **argv)
+{
+ struct list *l;
+ int i;
+ int arraylen;
+
+ arraylen = sizeof(names)/sizeof(names[0]);
+
+ l = list_new();
+ list_add(&l, "GNU");
+ list_free(l, NULL);
+ printf("Single static list test pass\n");
+ fflush(stdout);
+
+ l = list_new();
+ for (i = 0; i < arraylen; i++) {
+ list_add(&l, strdup(names[i]));
+ }
+ for (i = 0; i < arraylen; i++) {
+ if (strcmp(list_get(l, i), names[i]))
+ return 1;
+ }
+ list_free(l, free);
+ printf("Multiple add ordering list test pass\n");
+ fflush(stdout);
+
+ l = list_new();
+ for (i = 0; i < arraylen; i++) {
+ list_insert(&l, 0, strdup(names[i]));
+ }
+ for (i = 0; i < arraylen; i++) {
+ if (strcmp(list_get(l, i), names[arraylen - i - 1]))
+ return 1;
+ }
+ list_free(l, free);
+ printf("Multiple insertion at start ordering list test pass\n");
+ fflush(stdout);
+
+ l = list_new();
+ for (i = 0; i < arraylen; i++) {
+ list_insert(&l, i, strdup(names[i]));
+ }
+ for (i = 0; i < arraylen; i++) {
+ if (strcmp(list_get(l, i), names[i]))
+ return 1;
+ }
+ list_free(l, free);
+ printf("Multiple insertion at end ordering list test pass\n");
+ fflush(stdout);
+
+ return 0;
+}