Remove ignores and add test

This commit is contained in:
Alex D. 2021-03-31 11:30:16 +00:00
parent 4abc4f35f7
commit 282d643347
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
4 changed files with 39 additions and 3 deletions

3
.gitignore vendored
View File

@ -1,3 +0,0 @@
build/
.clangd/
compile_commands.json

View File

@ -99,6 +99,7 @@ if (BUILD_TESTS)
add_test(NAME "OptCRLF" COMMAND "optcrlf")
add_test(NAME "Allocators" COMMAND "allocs")
add_test(NAME "ManualAssemblers" COMMAND "manassm")
add_test(NAME "ErrorNumbers" COMMAND "errno")
endif()
add_library(uirc ${UIRC_SOURCE})

View File

@ -16,3 +16,6 @@ target_link_libraries(manassm uirc)
add_executable(allocs allocs.c common.c)
target_link_libraries(allocs uirc)
add_executable(errno errno.c common.c)
target_link_libraries(errno uirc)

35
tests/errno.c Normal file
View File

@ -0,0 +1,35 @@
/*
* This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC)
* Copyright (c) 2019-2021 Alex-David Denes
*
* uIRC 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
* any later version.
*
* uIRC 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 uIRC. If not, see <https://www.gnu.org/licenses/>.
*/
#include "common.h" // expect() print_irc_message()
#include "uirc.h" // uirc_* IRC_*
#include <stdbool.h> // true
#include <stdio.h> // fprintf()
#include <stdlib.h> // EXIT_*
#include <string.h> // strcmp()
int
main(void)
{
if (uirc_errno != UIRC_ERR_NERROR) return EXIT_FAILURE;
const char* const str = "???? THIS IS INVALID";
IRC_Message* m = uirc_tokenizer_message(str);
if (m != NULL || uirc_errno != UIRC_ERR_INVFMT) return EXIT_FAILURE;
return EXIT_SUCCESS;
}