The xml parse works for <yes/>. Adding tests

This commit is contained in:
Tristan Roux
2019-12-05 20:34:59 +01:00
parent 76b81478e5
commit 6291a21f71
9 changed files with 85 additions and 9 deletions

21
tests/test_basics.c Normal file
View File

@@ -0,0 +1,21 @@
/*
** EPITECH PROJECT, 2019
** xmlparser
** File description:
** test_basics
*/
#include "xml.h"
#include <criterion/criterion.h>
#include <string.h>
Test(xml, simple)
{
char *xml = strdup("<yes/>");
node *n = xml_parsenode(&xml);
cr_assert_str_eq(n->name, "yes");
cr_assert_eq(n->child, NULL);
cr_assert_eq(n->next, NULL);
cr_assert_eq(n->properties, NULL);
}

18
tests/test_main.c Normal file
View File

@@ -0,0 +1,18 @@
/*
** EPITECH PROJECT, 2019
** xmlparser
** File description:
** test_main
*/
#include "xml.h"
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc != 2)
return (printf("Usage: %s xml_path\n", argv[0]), 0);
node *n = xmlparse(argv[1]);
(void)n;
return (0);
}

1
tests/xmltest.txt Normal file
View File

@@ -0,0 +1 @@
<yes/>