Is there a more efficient way to use assert with arrays in C? -
in 1 part of program need use assert test multiple arrays (5 sets total), , wondering if there's more efficient way besides doing right now, creating new array every time. fyi have assert.h @ beginning of program.
void unittest3d(void){ double test1[3] = {0,0,0}; double test2[3] = {5,0,0}; assert(find3ddistance(test1,test2) - 5) < 0.001); double test3[3] = {-2, -3, 3.4}; double test4[3] = {-2, -3, -1.6}; assert(find3ddistance(test3,test4) - 5) < 0.001); double test5[3] = {-2, -3.2, -5}; double test6[3] = {3, 1.8, 0}; assert(find3ddistance(test5,test6) - sqrt(75)) < 0.001); return; }
Comments
Post a Comment