From: Damir Tomic Date: Fri, 19 Jun 2015 15:51:30 +0000 (+0200) Subject: c_fileHandlingTest.h: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=407e4b65a85ce32aba1138afca1a98d8a1704f31;p=thirdparty%2Fntp.git c_fileHandlingTest.h: added new cases with strcpy(path,....) run-strtolfp.c, run-lfptostr.c: new file bk: 55843a82TcA8kiy_MeZsvwBDpKmHow --- diff --git a/sntp/tests/c_fileHandlingTest.h b/sntp/tests/c_fileHandlingTest.h index b9cb12ad6..e3f76d570 100644 --- a/sntp/tests/c_fileHandlingTest.h +++ b/sntp/tests/c_fileHandlingTest.h @@ -35,7 +35,10 @@ const char * CreatePath(const char* filename, enum DirectoryType argument) { if (getcwd(cwd, sizeof(cwd)) != NULL) printf("Current working dir: %s\n", cwd); - + if(strstr(cwd,"sub/") == NULL){ + strcpy(path,"../../../sntp/tests/data/"); + } + else if(strstr(cwd,"_build") == NULL){ //if it's run as make distcheck, it's in a different directory! strcpy(path,"../../../sntp/tests/data/"); } diff --git a/tests/libntp/run-lfptostr.c b/tests/libntp/run-lfptostr.c new file mode 100644 index 000000000..491f7c0dc --- /dev/null +++ b/tests/libntp/run-lfptostr.c @@ -0,0 +1,71 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_PositiveInteger(void); +extern void test_NegativeInteger(void); +extern void test_PositiveIntegerWithFraction(void); +extern void test_NegativeIntegerWithFraction(void); +extern void test_RoundingDownToInteger(void); +extern void test_RoundingMiddleToInteger(void); +extern void test_RoundingUpToInteger(void); +extern void test_SingleDecimal(void); +extern void test_MillisecondsRoundingUp(void); +extern void test_MillisecondsRoundingDown(void); +extern void test_UnsignedInteger(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "lfptostr.c"; + UnityBegin("lfptostr.c"); + RUN_TEST(test_PositiveInteger, 22); + RUN_TEST(test_NegativeInteger, 29); + RUN_TEST(test_PositiveIntegerWithFraction, 36); + RUN_TEST(test_NegativeIntegerWithFraction, 43); + RUN_TEST(test_RoundingDownToInteger, 50); + RUN_TEST(test_RoundingMiddleToInteger, 57); + RUN_TEST(test_RoundingUpToInteger, 64); + RUN_TEST(test_SingleDecimal, 71); + RUN_TEST(test_MillisecondsRoundingUp, 78); + RUN_TEST(test_MillisecondsRoundingDown, 87); + RUN_TEST(test_UnsignedInteger, 96); + + return (UnityEnd()); +} diff --git a/tests/libntp/run-strtolfp.c b/tests/libntp/run-strtolfp.c new file mode 100644 index 000000000..c69880026 --- /dev/null +++ b/tests/libntp/run-strtolfp.c @@ -0,0 +1,63 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +//=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST(TestFunc, TestLineNum) \ +{ \ + Unity.CurrentTestName = #TestFunc; \ + Unity.CurrentTestLineNumber = TestLineNum; \ + Unity.NumberOfTests++; \ + if (TEST_PROTECT()) \ + { \ + setUp(); \ + TestFunc(); \ + } \ + if (TEST_PROTECT() && !TEST_IS_IGNORED) \ + { \ + tearDown(); \ + } \ + UnityConcludeTest(); \ +} + +//=======Automagically Detected Files To Include===== +#include "unity.h" +#include +#include + +//=======External Functions This Runner Calls===== +extern void setUp(void); +extern void tearDown(void); +extern void test_PositiveInteger(void); +extern void test_NegativeInteger(void); +extern void test_PositiveFraction(void); +extern void test_NegativeFraction(void); +extern void test_PositiveMsFraction(void); +extern void test_NegativeMsFraction(void); +extern void test_InvalidChars(void); + + +//=======Test Reset Option===== +void resetTest() +{ + tearDown(); + setUp(); +} + +char *progname; + + +//=======MAIN===== +int main(int argc, char *argv[]) +{ + progname = argv[0]; + Unity.TestFile = "strtolfp.c"; + UnityBegin("strtolfp.c"); + RUN_TEST(test_PositiveInteger, 9); + RUN_TEST(test_NegativeInteger, 23); + RUN_TEST(test_PositiveFraction, 40); + RUN_TEST(test_NegativeFraction, 54); + RUN_TEST(test_PositiveMsFraction, 71); + RUN_TEST(test_NegativeMsFraction, 87); + RUN_TEST(test_InvalidChars, 105); + + return (UnityEnd()); +}