mirror of
https://github.com/Noratrieb/libuwuc.git
synced 2026-01-14 11:45:05 +01:00
16 lines
No EOL
553 B
C
16 lines
No EOL
553 B
C
#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");
|
|
} |