소스 검색

Unit test arbitrarily long ungetc()

oddcoder 4 년 전
부모
커밋
49dec86a5d
4개의 변경된 파일29개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      tests/Makefile
  2. 0 0
      tests/expected/stdio/ungetc_multiple.stderr
  3. 1 0
      tests/expected/stdio/ungetc_multiple.stdout
  4. 27 0
      tests/stdio/ungetc_multiple.c

+ 1 - 0
tests/Makefile

@@ -42,6 +42,7 @@ EXPECT_NAMES=\
 	stdio/setvbuf \
 	stdio/sprintf \
 	stdio/printf_space_pad \
+	stdio/ungetc_multiple \
 	stdlib/a64l \
 	stdlib/alloc \
 	stdlib/atof \

+ 0 - 0
tests/expected/stdio/ungetc_multiple.stderr


+ 1 - 0
tests/expected/stdio/ungetc_multiple.stdout

@@ -0,0 +1 @@
+hello world

+ 27 - 0
tests/stdio/ungetc_multiple.c

@@ -0,0 +1,27 @@
+#include <stdio.h>
+int main() {
+  ungetc('\n', stdin);
+  ungetc('d', stdin);
+  ungetc('l', stdin);
+  ungetc('r', stdin);
+  ungetc('o', stdin);
+  ungetc('w', stdin);
+  ungetc(' ', stdin);
+  ungetc('o', stdin);
+  ungetc('l', stdin);
+  ungetc('l', stdin);
+  ungetc('e', stdin);
+  ungetc('h', stdin);
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+  putchar(getchar());
+}