sandbox-c/struct-location/location-test.c

29 lines
637 B
C

#include "location.h"
/*use assert()*/
#include <assert.h>
/*use strcmp*/
#include <string.h>
static void test_lct_lat(){
struct location lctn;
strcpy(lctn.lat, "+052.26594");
strcpy(lctn.lon, "+10.52673");
struct location lctnGet=getLocation(lctn.lat, lctn.lon);
assert(strcmp(lctn.lat, lctnGet.lat)==0 && "test_lct_lat()");
}
static void test_lct_lon(){
struct location lctn;
strcpy(lctn.lat, "+052.26594");
strcpy(lctn.lon, "+10.52673");
struct location lctnGet=getLocation(lctn.lat, lctn.lon);
assert(strcmp(lctn.lat, lctnGet.lat)==0 && "test_lct_lon()");
}
int main(){
test_lct_lat();
test_lct_lon();
}