mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-14 19:55:07 +01:00
fopen and tests
This commit is contained in:
parent
862ef8dc22
commit
b795ee80c9
14 changed files with 97 additions and 45 deletions
16
tests/c/fopen.c
Normal file
16
tests/c/fopen.c
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *file1 = fopen("./c/fopen.c", "r");
|
||||
assert(file1 && "failed to open file");
|
||||
|
||||
FILE *file2 = fopen("./c/fopen.c", "meow");
|
||||
assert(!file2 && "succeeded opening file despite invalid argument");
|
||||
assert((errno == EINVAL) && "wrong errno");
|
||||
|
||||
FILE *file3 = fopen("/this-does-absolutely-not-exist-at-all-edhjkefhew98", "r");
|
||||
assert(!file3 && "succeeded despite file not existing");
|
||||
assert((errno == ENOENT) && "wrong errno");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue