Clean up tests
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
char * ptr = (char *)malloc(256);
|
||||
printf("malloc %p\n", ptr);
|
||||
int i;
|
||||
for(i = 0; i < 256; i++) {
|
||||
ptr[i] = (char)i;
|
||||
}
|
||||
free(ptr);
|
||||
|
||||
char * ptrc = (char *)calloc(256, 1);
|
||||
printf("calloc %p\n", ptrc);
|
||||
for(i = 0; i < 256; i++) {
|
||||
ptrc[i] = (char)i;
|
||||
}
|
||||
free(ptrc);
|
||||
|
||||
char * ptra = (char *)memalign(256, 256);
|
||||
printf("memalign %p\n", ptra);
|
||||
for(i = 0; i < 256; i++) {
|
||||
ptra[i] = (char)i;
|
||||
}
|
||||
free(ptra);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
double d = atof("-3.14");
|
||||
printf("%f\n", d);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("%d\n", atoi(" -42"));
|
||||
printf("%d\n", atoi(" +555"));
|
||||
printf("%d\n", atoi(" 1234567890 "));
|
||||
printf("%ld\n", atol(" -42"));
|
||||
printf("%ld\n", atol(" +555"));
|
||||
printf("%ld\n", atol(" 1234567890 "));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
//puts(getenv("SHELL"));
|
||||
//puts(getenv("CC"));
|
||||
|
||||
putenv("TEST=It's working!!");
|
||||
|
||||
puts(getenv("TEST"));
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* file_name = (char*) calloc(18, sizeof(char));
|
||||
strcpy(file_name, "tempXXXXXX.suffix");
|
||||
int fd = mkostemps(file_name, 7, 0);
|
||||
FILE* fp = fdopen(fd, "w+");
|
||||
printf("Start unchanged: %d\n", strncmp(file_name, "temp", 4));
|
||||
printf("End unchanged: %d\n", strcmp(file_name + 4 + 6, ".suffix"));
|
||||
|
||||
char* write = "Writing to file";
|
||||
fputs(write, fp);
|
||||
|
||||
char buffer[sizeof write];
|
||||
memset(buffer, 0, sizeof buffer);
|
||||
fgets(buffer, strlen(buffer), fp);
|
||||
if (strcmp(write, buffer)) {
|
||||
printf("Read & Write Successful\n");
|
||||
} else {
|
||||
printf("Read & Write Failed\n");
|
||||
}
|
||||
fclose(fp);
|
||||
remove(file_name);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
system("echo test of system");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user