tests: More refactoring, add helper header to every test, override exit for better error reporting
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
puts("# mem #");
|
||||
char arr[100];
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char dest1[12] = "hello";
|
||||
printf("%s\n", strcat(dest1, " world")); // should be hello world
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
printf("%s\n", strchr("hello", 'e')); // should be ello
|
||||
printf("%s\n", strchr("world", 'l')); // should be ld
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char dst[20];
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char *world = "world";
|
||||
printf("%ld\n", strcspn("hello", world)); // should be 2
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
printf("%d\n", strncmp("a", "aa", 2));
|
||||
printf("%d\n", strncmp("a", "aä", 2));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char* source = "The quick drawn fix jumps over the lazy bug";
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char s0[] = "hello, world";
|
||||
char* ptr = strrchr(s0, 'l');
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char *hello = "hello";
|
||||
char *world = "world";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
printf("%s\n", strstr("In relibc we trust", "rust"));
|
||||
printf("%s\n", strstr("In relibc we trust", "libc"));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char source[] = "I'd just like to interject for a moment. What you're referring to as Linux, "
|
||||
"is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test_helpers.h"
|
||||
|
||||
int main(void) {
|
||||
char source[] = "I'd just like to interject for a moment. What you're referring to as Linux, "
|
||||
"is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
|
||||
|
||||
Reference in New Issue
Block a user