//#include "ntpdtest.h"
#include "config.h"
-//maybe ntp_stdlib and the other one? types?
#include "ntp.h"
#include "ntp_calendar.h"
#include "unity.h"
#include <string.h>
-//#include <sstream>
#include "test-libntp.h"
}
static int/*BOOL*/
-setup_clear_table()
+setup_clear_table(void)
{
int rc;
leap_table_t * pt = leapsec_get_table(0);
//-------------------------
-void setUp()
+void setUp(void)
{
- //init_lib();
- //init_auth();
-//extern time_t timefunc;
ntpcal_set_timefunc(timefunc);
settime(1970, 1, 1, 0, 0, 0);
leapsec_ut_pristine();
}
-void tearDown()
+void tearDown(void)
{
ntpcal_set_timefunc(NULL);
}
// =====================================================================
// ----------------------------------------------------------------------
-void test_ValidateGood() {
+void test_ValidateGood(void) {
const char *cp = leap_ghash;
int rc = leapsec_validate(stringreader, &cp);
TEST_ASSERT_EQUAL(LSVALID_GOODHASH, rc);
}
// ----------------------------------------------------------------------
-void test_ValidateNoHash() {
+void test_ValidateNoHash(void) {
const char *cp = leap2;
int rc = leapsec_validate(stringreader, &cp);
TEST_ASSERT_EQUAL(LSVALID_NOHASH, rc);
}
// ----------------------------------------------------------------------
-void test_ValidateBad() {
+void test_ValidateBad(void) {
const char *cp = leap_bhash;
int rc = leapsec_validate(stringreader, &cp);
TEST_ASSERT_EQUAL(LSVALID_BADHASH, rc);
}
// ----------------------------------------------------------------------
-void test_ValidateMalformed() {
+void test_ValidateMalformed(void) {
const char *cp = leap_mhash;
int rc = leapsec_validate(stringreader, &cp);
TEST_ASSERT_EQUAL(LSVALID_BADFORMAT, rc);
}
// ----------------------------------------------------------------------
-void test_ValidateMalformedShort() {
+void test_ValidateMalformedShort(void) {
const char *cp = leap_shash;
int rc = leapsec_validate(stringreader, &cp);
TEST_ASSERT_EQUAL(LSVALID_BADFORMAT, rc);
}
// ----------------------------------------------------------------------
-void test_ValidateNoLeadZero() {
+void test_ValidateNoLeadZero(void) {
const char *cp = leap_gthash;
int rc = leapsec_validate(stringreader, &cp);
TEST_ASSERT_EQUAL(LSVALID_GOODHASH, rc);
// ----------------------------------------------------------------------
// test table selection
-void test_tableSelect() {
+void test_tableSelect(void) {
leap_table_t *pt1, *pt2, *pt3, *pt4;
pt1 = leapsec_get_table(0);
// ----------------------------------------------------------------------
// load file & check expiration
-void test_loadFileExpire() {
+void test_loadFileExpire(void) {
const char *cp = leap1;
int rc;
leap_table_t * pt = leapsec_get_table(0);
// ----------------------------------------------------------------------
// load file & check time-to-live
-void test_loadFileTTL() {
+void test_loadFileTTL(void) {
const char *cp = leap1;
int rc;
leap_table_t * pt = leapsec_get_table(0);
// ----------------------------------------------------------------------
// test query in pristine state (bug#2745 misbehaviour)
-void test_lsQueryPristineState() {
+void test_lsQueryPristineState(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -60days
-void test_ls2009faraway() {
+void test_ls2009faraway(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -1week
-void test_ls2009weekaway() {
+void test_ls2009weekaway(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -1hr
-void test_ls2009houraway() {
+void test_ls2009houraway(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -1sec
-void test_ls2009secaway() {
+void test_ls2009secaway(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// ad-hoc jump to leap second at 2009.01.01
-void test_ls2009onspot() {
+void test_ls2009onspot(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// test handling of the leap second at 2009.01.01 without table
-void test_ls2009nodata() {
+void test_ls2009nodata(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// test handling of the leap second at 2009.01.01 with culled data
-void test_ls2009limdata() {
+void test_ls2009limdata(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// Far-distance forward jump into a transiton window.
-void test_qryJumpFarAhead() {
+void test_qryJumpFarAhead(void) {
int rc;
leap_result_t qr;
int last, idx;
// ----------------------------------------------------------------------
// Forward jump into the next transition window
-void test_qryJumpAheadToTransition() {
+void test_qryJumpAheadToTransition(void) {
int rc;
leap_result_t qr;
int last, idx;
// ----------------------------------------------------------------------
// Forward jump over the next transition window
-void test_qryJumpAheadOverTransition() {
+void test_qryJumpAheadOverTransition(void) {
int rc;
leap_result_t qr;
int last, idx;
// ----------------------------------------------------------------------
// add dynamic leap second (like from peer/clock)
-void test_addDynamic() {
+void test_addDynamic(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// add fixed leap seconds (like from network packet)
#if 0 /* currently unused -- possibly revived later */
-void FAILtest_addFixed() {
+void FAILtest_addFixed(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// add fixed leap seconds (like from network packet)
#if 0 /* currently unused -- possibly revived later */
-void FAILtest_addFixedExtend() {
+void FAILtest_addFixedExtend(void) {
int rc;
leap_result_t qr;
int last, idx;
// empty table and test queries before / between /after the tabulated
// values.
#if 0 /* currently unused -- possibly revived later */
-void FAILtest_setFixedExtend() {
+void FAILtest_setFixedExtend(void) {
int rc;
leap_result_t qr;
int last, idx;
// ----------------------------------------------------------------------
// Check if the offset can be applied to an empty table ONCE
-void test_taiEmptyTable() {
+void test_taiEmptyTable(void) {
int rc;
rc = leapsec_autokey_tai(35, lsec2015-30*86400, NULL);
// ----------------------------------------------------------------------
// Check that with fixed entries the operation fails
-void test_taiTableFixed() {
+void test_taiTableFixed(void) {
int rc;
rc = setup_load_table(leap1, FALSE);
// ----------------------------------------------------------------------
// test adjustment with a dynamic entry already there
-void test_taiTableDynamic() {
+void test_taiTableDynamic(void) {
int rc;
leap_era_t era;
// ----------------------------------------------------------------------
// test adjustment with a dynamic entry already there in dead zone
-void test_taiTableDynamicDeadZone() {
+void test_taiTableDynamicDeadZone(void) {
int rc;
rc = leapsec_add_dyn(TRUE, lsec2015-20*SECSPERDAY, NULL);
// ----------------------------------------------------------------------
// leap second insert at 2009.01.01, electric mode
-void test_ls2009seqInsElectric() {
+void test_ls2009seqInsElectric(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// leap second insert at 2009.01.01, dumb mode
-void test_ls2009seqInsDumb() {
+void test_ls2009seqInsDumb(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// fake leap second remove at 2009.01.01, electric mode
-void test_ls2009seqDelElectric() {
+void test_ls2009seqDelElectric(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// fake leap second remove at 2009.01.01. dumb mode
-void test_ls2009seqDelDumb() {
+void test_ls2009seqDelDumb(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// leap second insert at 2012.07.01, electric mode
-void test_ls2012seqInsElectric() {
+void test_ls2012seqInsElectric(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// leap second insert at 2012.07.01, dumb mode
-void test_ls2012seqInsDumb() {
+void test_ls2012seqInsDumb(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// test repeated query on empty table in dumb mode
-void test_lsEmptyTableDumb() {
+void test_lsEmptyTableDumb(void) {
int rc;
leap_result_t qr;
// ----------------------------------------------------------------------
// test repeated query on empty table in electric mode
-void test_lsEmptyTableElectric() {
+void test_lsEmptyTableElectric(void) {
int rc;
leap_result_t qr;
extern void setUp(void);
extern void tearDown(void);
void resetTest(void);
-extern void test_ValidateGood();
-extern void test_ValidateNoHash();
-extern void test_ValidateBad();
-extern void test_ValidateMalformed();
-extern void test_ValidateMalformedShort();
-extern void test_ValidateNoLeadZero();
-extern void test_tableSelect();
-extern void test_loadFileExpire();
-extern void test_loadFileTTL();
-extern void test_lsQueryPristineState();
-extern void test_ls2009faraway();
-extern void test_ls2009weekaway();
-extern void test_ls2009houraway();
-extern void test_ls2009secaway();
-extern void test_ls2009onspot();
-extern void test_ls2009nodata();
-extern void test_ls2009limdata();
-extern void test_qryJumpFarAhead();
-extern void test_qryJumpAheadToTransition();
-extern void test_qryJumpAheadOverTransition();
-extern void test_addDynamic();
-extern void test_taiEmptyTable();
-extern void test_taiTableFixed();
-extern void test_taiTableDynamic();
-extern void test_taiTableDynamicDeadZone();
-extern void test_ls2009seqInsElectric();
-extern void test_ls2009seqInsDumb();
-extern void test_ls2009seqDelElectric();
-extern void test_ls2009seqDelDumb();
-extern void test_ls2012seqInsElectric();
-extern void test_ls2012seqInsDumb();
-extern void test_lsEmptyTableDumb();
-extern void test_lsEmptyTableElectric();
+extern void test_ValidateGood(void);
+extern void test_ValidateNoHash(void);
+extern void test_ValidateBad(void);
+extern void test_ValidateMalformed(void);
+extern void test_ValidateMalformedShort(void);
+extern void test_ValidateNoLeadZero(void);
+extern void test_tableSelect(void);
+extern void test_loadFileExpire(void);
+extern void test_loadFileTTL(void);
+extern void test_lsQueryPristineState(void);
+extern void test_ls2009faraway(void);
+extern void test_ls2009weekaway(void);
+extern void test_ls2009houraway(void);
+extern void test_ls2009secaway(void);
+extern void test_ls2009onspot(void);
+extern void test_ls2009nodata(void);
+extern void test_ls2009limdata(void);
+extern void test_qryJumpFarAhead(void);
+extern void test_qryJumpAheadToTransition(void);
+extern void test_qryJumpAheadOverTransition(void);
+extern void test_addDynamic(void);
+extern void test_taiEmptyTable(void);
+extern void test_taiTableFixed(void);
+extern void test_taiTableDynamic(void);
+extern void test_taiTableDynamicDeadZone(void);
+extern void test_ls2009seqInsElectric(void);
+extern void test_ls2009seqInsDumb(void);
+extern void test_ls2009seqDelElectric(void);
+extern void test_ls2009seqDelDumb(void);
+extern void test_ls2012seqInsElectric(void);
+extern void test_ls2012seqInsDumb(void);
+extern void test_lsEmptyTableDumb(void);
+extern void test_lsEmptyTableElectric(void);
//=======Test Reset Option=====
progname = argv[0];
Unity.TestFile = "leapsec.c";
UnityBegin("leapsec.c");
- RUN_TEST(test_ValidateGood, 336);
- RUN_TEST(test_ValidateNoHash, 343);
- RUN_TEST(test_ValidateBad, 350);
- RUN_TEST(test_ValidateMalformed, 357);
- RUN_TEST(test_ValidateMalformedShort, 364);
- RUN_TEST(test_ValidateNoLeadZero, 371);
- RUN_TEST(test_tableSelect, 383);
- RUN_TEST(test_loadFileExpire, 419);
- RUN_TEST(test_loadFileTTL, 436);
- RUN_TEST(test_lsQueryPristineState, 468);
- RUN_TEST(test_ls2009faraway, 480);
- RUN_TEST(test_ls2009weekaway, 497);
- RUN_TEST(test_ls2009houraway, 514);
- RUN_TEST(test_ls2009secaway, 531);
- RUN_TEST(test_ls2009onspot, 548);
- RUN_TEST(test_ls2009nodata, 565);
- RUN_TEST(test_ls2009limdata, 582);
- RUN_TEST(test_qryJumpFarAhead, 603);
- RUN_TEST(test_qryJumpAheadToTransition, 625);
- RUN_TEST(test_qryJumpAheadOverTransition, 647);
- RUN_TEST(test_addDynamic, 673);
- RUN_TEST(test_taiEmptyTable, 851);
- RUN_TEST(test_taiTableFixed, 863);
- RUN_TEST(test_taiTableDynamic, 875);
- RUN_TEST(test_taiTableDynamicDeadZone, 901);
- RUN_TEST(test_ls2009seqInsElectric, 921);
- RUN_TEST(test_ls2009seqInsDumb, 964);
- RUN_TEST(test_ls2009seqDelElectric, 1012);
- RUN_TEST(test_ls2009seqDelDumb, 1055);
- RUN_TEST(test_ls2012seqInsElectric, 1097);
- RUN_TEST(test_ls2012seqInsDumb, 1140);
- RUN_TEST(test_lsEmptyTableDumb, 1189);
- RUN_TEST(test_lsEmptyTableElectric, 1214);
+ RUN_TEST(test_ValidateGood, 331);
+ RUN_TEST(test_ValidateNoHash, 338);
+ RUN_TEST(test_ValidateBad, 345);
+ RUN_TEST(test_ValidateMalformed, 352);
+ RUN_TEST(test_ValidateMalformedShort, 359);
+ RUN_TEST(test_ValidateNoLeadZero, 366);
+ RUN_TEST(test_tableSelect, 378);
+ RUN_TEST(test_loadFileExpire, 414);
+ RUN_TEST(test_loadFileTTL, 431);
+ RUN_TEST(test_lsQueryPristineState, 463);
+ RUN_TEST(test_ls2009faraway, 475);
+ RUN_TEST(test_ls2009weekaway, 492);
+ RUN_TEST(test_ls2009houraway, 509);
+ RUN_TEST(test_ls2009secaway, 526);
+ RUN_TEST(test_ls2009onspot, 543);
+ RUN_TEST(test_ls2009nodata, 560);
+ RUN_TEST(test_ls2009limdata, 577);
+ RUN_TEST(test_qryJumpFarAhead, 598);
+ RUN_TEST(test_qryJumpAheadToTransition, 620);
+ RUN_TEST(test_qryJumpAheadOverTransition, 642);
+ RUN_TEST(test_addDynamic, 668);
+ RUN_TEST(test_taiEmptyTable, 846);
+ RUN_TEST(test_taiTableFixed, 858);
+ RUN_TEST(test_taiTableDynamic, 870);
+ RUN_TEST(test_taiTableDynamicDeadZone, 896);
+ RUN_TEST(test_ls2009seqInsElectric, 916);
+ RUN_TEST(test_ls2009seqInsDumb, 959);
+ RUN_TEST(test_ls2009seqDelElectric, 1007);
+ RUN_TEST(test_ls2009seqDelDumb, 1050);
+ RUN_TEST(test_ls2012seqInsElectric, 1092);
+ RUN_TEST(test_ls2012seqInsDumb, 1135);
+ RUN_TEST(test_lsEmptyTableDumb, 1184);
+ RUN_TEST(test_lsEmptyTableElectric, 1209);
return (UnityEnd());
}