CCTDemoConsole Tests Listing Guide

 

Brooks Harris

Version 5, 2024-04-27

 

The batch file RunDemoConsoleTests.bat found at:

CCT\CCTDemoConsole\CCTRunDemoConsoleTests_bat\RunDemoConsoleTests.bat

will run CCTDemoConsole several times with various commands to run selected tests.

The listing files will output to CCT\OutputFiles.

 

Links to Listings:

CCTOut_A_TESTSETTINGCBFANDCCFPARSING

CCTOut_BA_TESTSELECTEDTIMEPOINTSANDINTERVALS

CCTOut_B_TESTSELECTEDVALUES

CCTOut_BB_TESTSELECTEDCONFIGURATIONSANDSHOWCBFVALUES

CCTOut_C_TESTADDVALUE

CCTOut_D_TESTYMDHMSTOSECONDSSECONDSTOYMDHMS

CCTOut_E_TESTCTAIUTCTABLEPRINTF

CCTOut_F_TESTCONVERTTOZONE

CCTOut_G_TESTSELECTEDDIFFERENCES

CCTOut_H_TEST1972UTCLEAPSECONDSHOWCBFVALUES

CCTOut_I_TESTGETWINDOWSTIME

CCTOut_J_TESTGETPOSIXTIME

CCTOut_L_TESTINTERESTINGPOINTSOFYEAR

CCTOut_N_TESTCCCTCRIFF_CCBF

CCTOut_N_TESTBINARYCBFANDRIFFLIST

CCTOut_N_TESTGETPOSIXTIMEANDCCTCALENDAR

CCTOut_N_TESTTZDATAPARSEMULTI_Moscow

CCTOut_X_TESTUNUSUAL

CCTOut_N_TESTTZDATAPARSEMULTI.zip

CCTOut_HA_TEST_TOD_LEAPSECOND_UTC_UTC.zip

CCTOut_HB_TEST_TOD_LEAPSECOND_MIDNIGHT.zip

 

Guide to listings

 

N_TESTTZDATAPARSEMULTI

This listing is a most important reference. I is a large complex test that finds every transition in Tz Database using Posix-time and TzDb code, generating CBF and CCF, with extensive regressive error checking.

This is a large file, hence a zip.

TestTzDataParseMulti(&Test_stX);

CCTOut_N_TESTTZDATAPARSEMULTI.zip

 

Common Calendar supports two time-of-day "count modes" that effect the sequence of the YMDhms representation near Leap Seconds.

See Common Calendar Local Timescales Section 4.2 Time-of-day (TOD) Count Mode and Leap Second Introduction

The TOD_LEAPSECOND_UTC_UTC, TOD_LEAPSECOND_UTC_NTP, and TOD_LEAPSECOND_UTC_POSIX modes introduce the Leap Second in the local YMDhms representation simultaneous with UTC. This creates a discontinuity in midday (between local midnights).

This is a large file, hence a zip.

HA_TEST_TOD_LEAPSECOND_UTC_UTC

TestTOD_LEAPSECOND_UTC_UTC(&Test_stX);

CCTOut_HA_TEST_TOD_LEAPSECOND_UTC_UTC.zip

 

The TOD_LEAPSECOND_MIDNIGHT avoids this discontinuity by introducing the Leap Second at YYYY-MM-DD 23:59:60 on all timescales. This is relatively simple to implement and provides a symmetrical matrix of local YMShms representations and offsets amongst them. This is known as “rolling leap-seconds”.

This is a large file, hence a zip.

HB_TEST_TOD_LEAPSECOND_MIDNIGHT

TestTOD_LEAPSECOND_MIDNIGHT(&Test_stX);

CCTOut_HB_TEST_TOD_LEAPSECOND_MIDNIGHT.zip

 

A_TESTSETTINGCBFANDCCFPARSING

Shows basic calling of test routines. Most calls use struct Test_st to pass parameters for the tests. See CCTDemoTests.h.

The calls to CCT::SetYMDhms() are particularly useful for general use and development, allowing date and time entry in YMDhms form with range and error checking. See CCct.cpp CCct::SetYMDhmsd().

TestOneValue() generates the CCcf character string from the underlying CCbf binary values, which are decaled in CBF.h.

TestOneValueAndParse() reads and parses a CCF character string, sets the CCbf binary, and generates the CCcf character string from new CCbf.

TestOneValueAndParseTwice() cycles TestOneValueAndParse() twice for overkill round-trip testing.

TestSettingCbfAndCcfParsing(&Test_stX);

CCTOut_A_TESTSETTINGCBFANDCCFPARSING

BA_TESTSELECTEDTIMEPOINTSANDINTERVALS

Populate CBF as selected time points without date and intervals and output CCF

TestSelectedTimePointsAndIntervals(&Test_stX);

CCTOut_BA_TESTSELECTEDTIMEPOINTSANDINTERVALS

B_TESTSELECTEDVALUES

Make various calls with various example values. They are briefly explained in the listing itself.

TestSelectedValues(&Test_stX);

CCTOut_B_TESTSELECTEDVALUES

BB_TESTSELECTEDCONFIGURATIONSANDSHOWCBFVALUES

Populate CBF selected time points without date, intervals, and date and time-of-day, output CCF, show CBF components and member values and CBF image as hexadecimal

TestSelectedConfigurationsAndShowCbfValues(&Test_stX);

CCTOut_BB_TESTSELECTEDCONFIGURATIONSANDSHOWCBFVALUES

C_TESTADDVALUE

Demonstrates adding units to a CCT representation. CCT currently supports "rates" from 1 second (1Hz) to picoseconds (1THz (terahertz)). See CCTLib, CCct.cpp, CCct::AddUnitUTIL()

TestAddValue(&Test_stX);

CCTOut_C_TESTADDVALUE

D_TESTYMDHMSTOSECONDSSECONDSTOYMDHMS

The YMDhms Api is crucial component of Common Calendar, providing the core ability to manipulate YMDhms values with native Leap Second accuracy.  Of course, this requires the Leap Second metadata as provided by the TAI-UTC API.

This demonstrates using the CYMDhmsApi class implementation independent from the full CCT suite.

CYMDhms::YMDhmsToSeconds() and CYMDhms::SecondsToYMDhms() are analogous to POSIX mktime() and gmtime() except using a UTC1972 epoch and native Leap Second compensation (requires TAI-UTC API interface).

See CCTYMDhmsApiLib,  CYMDhmsApi.cpp, class CYMDhmsApi

TestYMDhmsToSecondsSecondsToYMDhms(Test_stX.m_pCTaiUtcClient);

CCTOut_D_TESTYMDHMSTOSECONDSSECONDSTOYMDHMS

E_TESTCTAIUTCTABLEPRINTF

The TAI-UTC API provides a standardized form of the IERS Leap Seconds table. CCTTaiUtcApiLib provides server and client of Leap Seconds metadata together with lookup algorithms.

This prints the Leap Second table as implemented and populated.

See CCTTaiUtcApiLib, CTaiUtcTable.cpp, IERSLeapSecondHistoryDat.cpp and related

TestCTaiUtcTablePrintf(&Test_stX);

CCTOut_E_TESTCTAIUTCTABLEPRINTF

F_TESTCONVERTTOZONE

This demonstrates converting one time zone to another using CCct::ConvertToZoneUTIL().

TestConvertToZone(&Test_stX);

CCTOut_F_TESTCONVERTTOZONE

G_TESTSELECTEDDIFFERENCES

A "difference" may be duration between two time points along a given local timescale, or the offset value amongst time zones.

CCT can be used to represent a duration, rather than a time point.

This demonstrates measuring differences between time points, time zones, and using CCT to represent the resulting durations.

TestSelectedDifferences(&Test_stX);

CCTOut_G_TESTSELECTEDDIFFERENCES

H_TEST1972UTCLEAPSECONDSHOWCBFVALUES

The Common Calendar Binary Format (CBF) is the underlying binary data representation.

This sets various values and shows the date and time as CCF character format and the values of the CCbf binary data members.

Test1972UTCLeapSecondShowCbfValues(&Test_stX);

CCTOut_H_TEST1972UTCLEAPSECONDSHOWCBFVALUES

I_TESTGETWINDOWSTIME

Populate Common Calendar (CCT) from current Windows date and time.

TestGetWindowsTime(&Test_stX);

CCTOut_I_TESTGETWINDOWSTIME

 

J_TESTGETPOSIXTIME

Populate Common Calendar (CCT) from current POSIX date and time

TestGetPosixTime(&Test_stX);

CCTOut_J_TESTGETPOSIXTIME

L_TESTINTERESTINGPOINTSOFYEAR

The CCT implementation includes both Leap Second and local time metadata (through the Tz Database API) making it possible to discover both leap-seconds and DST changes for a given year.

This loops through years 2015 and 2016 and several time zones for both TOD_LEAPSECOND_UTC_UTC and TOD_LEAPSECOND_MIDNIGHT count modes and lists:

1st of each month of year

Leap Seconds as found in leap-second Table

TestInterestingPointsOfYear(&Test_stX);

CCTOut_L_TESTINTERESTINGPOINTSOFYEAR

N_TESTCCCTCRIFF_CCBF

TestCCctCRiff_Ccbf(&Test_stX)

CCTOut_N_TESTCCCTCRIFF_CCBF

N_TESTBINARYCBFANDRIFFLIST

TestBinaryCbfAndRiffLIST(&Test_stX)

CCTOut_N_TESTBINARYCBFANDRIFFLIST

 

N_TESTGETPOSIXTIMEANDCCTCALENDAR:

Gets current system time via calls to POSIX time, constructs a class CCctMonth and outputs the calendar month and the contents of its 42 element array of CCbf objects as CCF character strings.

TestGetPosixTimeAndCCTCalendar(&Test_stX);

CCTOut_N_TESTGETPOSIXTIMEANDCCTCALENDAR

 

N_TESTTZDATAPARSEMULTI (Moscow)

 

N_TESTTZDATAPARSEMULTI called with -Z "Europe/Moscow" option

 

TestTzDataParseMulti(&Test_stX)with -Z "Europe/Moscow" option

CCTOut_N_TESTTZDATAPARSEMULTI_Moscow

 

X_TESTUNUSUAL

 

TestUnusual(&Test_stX)

CCTOut_X_TESTUNUSUAL