I've been asked to write test programs on 4 functions in the card game dominion. I've written one (extremely simple) just to make sure I can get it to pass as I'm pretty new to testing. However, I continually get a syntax error at runtime that I cannot figure out.
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
int main() {
int r = 0, j = 0;
int adventurer = 8;
int greathall = 17;
r = getCost(adventurer);
assert(r == 6);
j = getCost(greathall);
assert(j == 3);
return 0;
}
When I compile it, I do get some warnings:
Undefined symbols for architecture x86_64:
"_getCost", referenced from:
_main in unittest1-7d7bf2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Which I'm not sure about either, but the base code that we are given from our instructor, as well as all of the other code from my classmates, has these warnings as well.
However, when running I get the following error:
./unittest1.c: line 8: syntax error near unexpected token `('
./unittest1.c: line 8: `int main() {'
I've tried rewriting it in a blank file thinking there was some invisible characters or something but I still get this error. Does anyone see something wrong in my code? Any help is appreciated.
**getCost is called in dominion_helpers
Aucun commentaire:
Enregistrer un commentaire