Minor formatting changes.

This commit is contained in:
Peter Goodman
2018-02-06 12:18:06 +08:00
parent d227cc7f34
commit 1aa468dabc
2 changed files with 22 additions and 23 deletions

View File

@@ -2,42 +2,41 @@
#include <stdlib.h>
int square(int x) {
return x*x;
return x*x;
}
#ifdef DEEPSTATE_TEST
#include <deepstate/DeepState.h>
DeepState_EntryPoint(test_main) {
const char *new_args[2];
new_args[0] = "deepstate";
new_args[1] = DeepState_CStr(8);
const char *new_args[2];
new_args[0] = "deepstate";
new_args[1] = DeepState_CStr(8);
DeepState_Assert(0 == old_main(2, new_args));
DeepState_Assert(0 == old_main(2, new_args));
}
int main(int argc, const char *argv[]) {
return 0 == DeepState_Run();
DeepState_InitOptions(argc, argv);
return 0 == DeepState_Run();
}
// yes this is awful but avoids another ifdef
// TODO(artem): yes this is awful but avoids another `ifdef`.
#define main old_main
#endif
int main(int argc, char *argv[]) {
DeepState_InitOptions(argc, argv);
if (argc != 2) {
printf("Usage: %s <integer>\n", argv[0]);
return -1;
}
int x = atoi(argv[1]);
int y = square(x);
if(argc != 2) {
printf("Usage: %s <integer>\n", argv[0]);
return -1;
}
int x = atoi(argv[1]);
int y = square(x);
if(y + 4 == 29) {
printf("You found the secret number\n");
return 0;
} else {
printf("Secret NOT found\n");
return -1;
}
if (y + 4 == 29) {
printf("You found the secret number\n");
return 0;
} else {
printf("Secret NOT found\n");
return -1;
}
}

View File

@@ -30,7 +30,7 @@ enum {
static struct DeepState_Option *DeepState_Options = NULL;
int DeepState_OptionsAreInitialized = 0;
static const char DeepState_FakeSpace = ' ' | 0x80;
static const char DeepState_FakeSpace = ' ' | ((char) 0x80);
/* Copy of the option string. */
static int DeepState_OptionStringLength = 0;