diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-09-02 23:38:48 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-09-02 23:51:15 +0200 |
commit | 4763814c683c50f8a3697b74e764f19c3dacccd5 (patch) | |
tree | 386ff43f024705a32310b882f2161b5f86d8820a /tests/common/check_stdin.c | |
parent | c12bdb94ecdc44f200a8030dfde4a5ec46053ea6 (diff) | |
download | blogc-4763814c683c50f8a3697b74e764f19c3dacccd5.tar.gz blogc-4763814c683c50f8a3697b74e764f19c3dacccd5.tar.bz2 blogc-4763814c683c50f8a3697b74e764f19c3dacccd5.zip |
migrate codebase to use squareball. again :)feature/squareball
Diffstat (limited to 'tests/common/check_stdin.c')
-rw-r--r-- | tests/common/check_stdin.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/tests/common/check_stdin.c b/tests/common/check_stdin.c deleted file mode 100644 index 716916d..0000000 --- a/tests/common/check_stdin.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * blogc: A blog compiler. - * Copyright (C) 2014-2019 Rafael G. Martins <rafael@rafaelmartins.eng.br> - * - * This program can be distributed under the terms of the BSD License. - * See the file LICENSE. - */ - -#include <stdarg.h> -#include <stddef.h> -#include <setjmp.h> -#include <cmocka.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include "../../src/common/stdin.h" - - -int -__wrap_fgetc(FILE *stream) -{ - assert_int_equal(fileno(stream), fileno(stdin)); - return mock_type(int); -} - - -static void -test_read(void **state) -{ - will_return(__wrap_fgetc, EOF); - char *t = bc_stdin_read(); - assert_non_null(t); - assert_string_equal(t, ""); - free(t); - will_return(__wrap_fgetc, 'b'); - will_return(__wrap_fgetc, 'o'); - will_return(__wrap_fgetc, 'l'); - will_return(__wrap_fgetc, 'a'); - will_return(__wrap_fgetc, EOF); - t = bc_stdin_read(); - assert_non_null(t); - assert_string_equal(t, "bola"); - free(t); -} - - -int -main(void) -{ - const UnitTest tests[] = { - unit_test(test_read), - }; - return run_tests(tests); -} |