Skip to content

Instantly share code, notes, and snippets.

@adrianulbona
Created March 11, 2017 11:18
Show Gist options
  • Save adrianulbona/173cfeeceb12e866454f4cb3f468c408 to your computer and use it in GitHub Desktop.
Save adrianulbona/173cfeeceb12e866454f4cb3f468c408 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define NDEBUG
typedef enum {
false, true
} bool;
bool prime(int n) {
return false;
}
int main() {
int numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
bool expected[] = {false, true, true, false, true, false, true, false, false};
int n = (int) (sizeof(numbers) / sizeof(int));
for (int i = 0; i < n; i++) {
assert(prime(numbers[i]) == expected[i]);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment