mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-24 05:18:59 -05:00
Fixes for unit tests.
- Fix issue where a propertyowner would not report its uri correctly - Fix inconsistency with number->string conversions - Adapt SPICE tests to now baked-in leap seconds kernel - Disable CreateSingleColorImage test as it requires an OpenGL context
This commit is contained in:
@@ -71,22 +71,16 @@ std::string formatJson(T value) {
|
||||
return ghoul::formatJson(value);
|
||||
}
|
||||
else if constexpr (internal::isGlmVector<T>()) {
|
||||
std::string values;
|
||||
for (glm::length_t i = 0; i < ghoul::glm_components<T>::value; i++) {
|
||||
values += std::to_string(value[i]) + ',';
|
||||
}
|
||||
values.pop_back();
|
||||
return std::format("[{}]", values);
|
||||
std::string v = std::format("{}", value);
|
||||
v.front() = '[';
|
||||
v.back() = ']';
|
||||
return v;
|
||||
}
|
||||
else if constexpr (internal::isGlmMatrix<T>()) {
|
||||
std::string values;
|
||||
for (glm::length_t i = 0; i < T::type::row_type::length(); i++) {
|
||||
for (glm::length_t j = 0; j < T::type::col_type::length(); j++) {
|
||||
values += std::to_string(value[i][j]) + ',';
|
||||
}
|
||||
}
|
||||
values.pop_back();
|
||||
return std::format("[{}]", values);
|
||||
std::string v = std::format("{}", value);
|
||||
v.front() = '[';
|
||||
v.back() = ']';
|
||||
return v;
|
||||
}
|
||||
else {
|
||||
static_assert(sizeof(T) == 0, "JSON formatting of type T not implemented");
|
||||
|
||||
@@ -77,12 +77,8 @@ const std::string& Property::identifier() const {
|
||||
}
|
||||
|
||||
std::string Property::uri() const {
|
||||
std::string identifier = "";
|
||||
const std::string& ownerUri = owner()->uri();
|
||||
if (!ownerUri.empty()) {
|
||||
identifier = std::format("{}.{}", ownerUri, _identifier);
|
||||
}
|
||||
return identifier;
|
||||
return !ownerUri.empty() ? std::format("{}.{}", ownerUri, _identifier) : _identifier;
|
||||
}
|
||||
|
||||
std::any Property::get() const {
|
||||
|
||||
@@ -167,7 +167,7 @@ std::string PropertyOwner::uri() const {
|
||||
currentOwner = currentOwner->owner();
|
||||
}
|
||||
// If the uri hasn't been sent at this point it is not valid, so send an empty string
|
||||
return "";
|
||||
return identifier;
|
||||
}
|
||||
|
||||
bool PropertyOwner::hasProperty(const std::string& uri) const {
|
||||
|
||||
@@ -83,7 +83,7 @@ std::string formatJsonNumber(double d) {
|
||||
if (!std::isfinite(d)) {
|
||||
return "null";
|
||||
}
|
||||
return std::to_string(d);
|
||||
return std::format("{}", d);
|
||||
}
|
||||
|
||||
void sortJson(nlohmann::json& json, const std::string& key) {
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
KPL/LSK
|
||||
|
||||
|
||||
LEAPSECONDS KERNEL FILE
|
||||
===========================================================================
|
||||
|
||||
Modifications:
|
||||
--------------
|
||||
|
||||
2005, Aug. 3 NJB Modified file to account for the leapsecond that
|
||||
will occur on December 31, 2005.
|
||||
|
||||
1998, Jul 17 WLT Modified file to account for the leapsecond that
|
||||
will occur on December 31, 1998.
|
||||
|
||||
1997, Feb 22 WLT Modified file to account for the leapsecond that
|
||||
will occur on June 30, 1997.
|
||||
|
||||
1995, Dec 14 KSZ Corrected date of last leapsecond from 1-1-95
|
||||
to 1-1-96.
|
||||
|
||||
1995, Oct 25 WLT Modified file to account for the leapsecond that
|
||||
will occur on Dec 31, 1995.
|
||||
|
||||
1994, Jun 16 WLT Modified file to account for the leapsecond on
|
||||
June 30, 1994.
|
||||
|
||||
1993, Feb. 22 CHA Modified file to account for the leapsecond on
|
||||
June 30, 1993.
|
||||
|
||||
1992, Mar. 6 HAN Modified file to account for the leapsecond on
|
||||
June 30, 1992.
|
||||
|
||||
1990, Oct. 8 HAN Modified file to account for the leapsecond on
|
||||
Dec. 31, 1990.
|
||||
|
||||
|
||||
Explanation:
|
||||
------------
|
||||
|
||||
The contents of this file are used by the routine DELTET to compute the
|
||||
time difference
|
||||
|
||||
[1] DELTA_ET = ET - UTC
|
||||
|
||||
the increment to be applied to UTC to give ET.
|
||||
|
||||
The difference between UTC and TAI,
|
||||
|
||||
[2] DELTA_AT = TAI - UTC
|
||||
|
||||
is always an integral number of seconds. The value of DELTA_AT was 10
|
||||
seconds in January 1972, and increases by one each time a leap second
|
||||
is declared. Combining [1] and [2] gives
|
||||
|
||||
[3] DELTA_ET = ET - (TAI - DELTA_AT)
|
||||
|
||||
= (ET - TAI) + DELTA_AT
|
||||
|
||||
The difference (ET - TAI) is periodic, and is given by
|
||||
|
||||
[4] ET - TAI = DELTA_T_A + K sin E
|
||||
|
||||
where DELTA_T_A and K are constant, and E is the eccentric anomaly of the
|
||||
heliocentric orbit of the Earth-Moon barycenter. Equation [4], which ignores
|
||||
small-period fluctuations, is accurate to about 0.000030 seconds.
|
||||
|
||||
The eccentric anomaly E is given by
|
||||
|
||||
[5] E = M + EB sin M
|
||||
|
||||
where M is the mean anomaly, which in turn is given by
|
||||
|
||||
[6] M = M + M t
|
||||
0 1
|
||||
|
||||
where t is the number of ephemeris seconds past J2000.
|
||||
|
||||
Thus, in order to compute DELTA_ET, the following items are necessary.
|
||||
|
||||
DELTA_TA
|
||||
K
|
||||
EB
|
||||
M0
|
||||
M1
|
||||
DELTA_AT after each leap second.
|
||||
|
||||
The numbers, and the formulation, are taken from the following sources.
|
||||
|
||||
1) Moyer, T.D., Transformation from Proper Time on Earth to
|
||||
Coordinate Time in Solar System Barycentric Space-Time Frame
|
||||
of Reference, Parts 1 and 2, Celestial Mechanics 23 (1981),
|
||||
33-56 and 57-68.
|
||||
|
||||
2) Moyer, T.D., Effects of Conversion to the J2000 Astronomical
|
||||
Reference System on Algorithms for Computing Time Differences
|
||||
and Clock Rates, JPL IOM 314.5--942, 1 October 1985.
|
||||
|
||||
The variable names used above are consistent with those used in the
|
||||
Astronomical Almanac.
|
||||
|
||||
\begindata
|
||||
|
||||
DELTET/DELTA_T_A = 32.184
|
||||
DELTET/K = 1.657D-3
|
||||
DELTET/EB = 1.671D-2
|
||||
DELTET/M = ( 6.239996D0 1.99096871D-7 )
|
||||
|
||||
DELTET/DELTA_AT = ( 10, @1972-JAN-1
|
||||
11, @1972-JUL-1
|
||||
12, @1973-JAN-1
|
||||
13, @1974-JAN-1
|
||||
14, @1975-JAN-1
|
||||
15, @1976-JAN-1
|
||||
16, @1977-JAN-1
|
||||
17, @1978-JAN-1
|
||||
18, @1979-JAN-1
|
||||
19, @1980-JAN-1
|
||||
20, @1981-JUL-1
|
||||
21, @1982-JUL-1
|
||||
22, @1983-JUL-1
|
||||
23, @1985-JUL-1
|
||||
24, @1988-JAN-1
|
||||
25, @1990-JAN-1
|
||||
26, @1991-JAN-1
|
||||
27, @1992-JUL-1
|
||||
28, @1993-JUL-1
|
||||
29, @1994-JUL-1
|
||||
30, @1996-JAN-1
|
||||
31, @1997-JUL-1
|
||||
32, @1999-JAN-1
|
||||
33, @2006-JAN-1 )
|
||||
|
||||
|
||||
\begintext
|
||||
|
||||
@@ -47,9 +47,8 @@ TEMPLATE_TEST_CASE("FormatJson", "[formatjson]", glm::vec2, glm::vec3,
|
||||
// Compare with Ghoul's Lua conversions. Note that Lua uses '{' for arrays,
|
||||
// while we here expect '[' for all glm types
|
||||
std::string luaValue = ghoul::to_string(val);
|
||||
luaValue.replace(0, 1, "[");
|
||||
luaValue.replace(luaValue.size() - 1, 1, "]");
|
||||
|
||||
luaValue.front() = '[';
|
||||
luaValue.back() = ']';
|
||||
CHECK(json == luaValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
#include <filesystem>
|
||||
|
||||
#if 0
|
||||
|
||||
TEST_CASE("CreateSingleColorImage: Create image and check return value",
|
||||
"[createsinglecolorimage]")
|
||||
{
|
||||
@@ -86,3 +88,5 @@ TEST_CASE("CreateSingleColorImage: Load created image", "[createsinglecolorimage
|
||||
CHECK(width == 1);
|
||||
CHECK(height == 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -942,7 +942,7 @@ TEST_CASE("Save settings to profile", "[profile]") {
|
||||
Profile::Property::SetType::SetPropertyValueSingle
|
||||
);
|
||||
CHECK(profile.properties[0].name == "base.p1");
|
||||
CHECK(profile.properties[0].value == "2.000000");
|
||||
CHECK(profile.properties[0].value == "2");
|
||||
CHECK(
|
||||
profile.properties[1].setType ==
|
||||
Profile::Property::SetType::SetPropertyValueSingle
|
||||
|
||||
@@ -36,10 +36,6 @@ TEST_CASE("ScriptScheduler: Simple Forward", "[scriptscheduler]") {
|
||||
using namespace openspace::scripting;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
|
||||
ScriptScheduler scheduler;
|
||||
|
||||
@@ -70,9 +66,6 @@ TEST_CASE("ScriptScheduler: Multiple Forward Single Jump", "[scriptscheduler]")
|
||||
using namespace openspace::scripting;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -113,10 +106,6 @@ TEST_CASE("ScriptScheduler: Multiple Forward Ordering", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -154,9 +143,6 @@ TEST_CASE("ScriptScheduler: Simple Backward", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -187,10 +173,6 @@ TEST_CASE("ScriptScheduler: Multiple Backward Single Jump", "[scriptscheduler]")
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -231,9 +213,6 @@ TEST_CASE("ScriptScheduler: Multiple Backward Ordering", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -270,9 +249,6 @@ TEST_CASE("ScriptScheduler: Empty", "[scriptscheduler]") {
|
||||
using namespace openspace::scripting;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
static const std::vector<double> TestTimes = {
|
||||
0.0, 1.0, -1.0, std::numeric_limits<double>::min(),
|
||||
@@ -302,9 +278,6 @@ TEST_CASE("ScriptScheduler: Forward Backwards", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -349,9 +322,6 @@ TEST_CASE("ScriptScheduler: Rewind", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -389,9 +359,6 @@ TEST_CASE("ScriptScheduler: CurrentTime", "[scriptscheduler]") {
|
||||
using namespace openspace::scripting;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
static const std::vector<double> TestValues = {
|
||||
0.0, 1.0, 42.0, std::numeric_limits<double>::min(),
|
||||
@@ -413,9 +380,6 @@ TEST_CASE("ScriptScheduler: All Scripts", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -456,9 +420,6 @@ TEST_CASE("ScriptScheduler: Jump Equal", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -496,9 +457,6 @@ TEST_CASE("ScriptScheduler: Same Time", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -529,9 +487,6 @@ TEST_CASE("ScriptScheduler: Multi Inner Jump", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
std::vector<ScriptScheduler::ScheduledScript> scripts;
|
||||
{
|
||||
@@ -571,9 +526,6 @@ TEST_CASE(
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
@@ -612,9 +564,6 @@ TEST_CASE("ScriptScheduler: Multiple Forward Ordering Multiple Load" "[scriptsch
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
@@ -651,9 +600,6 @@ TEST_CASE(
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
@@ -693,9 +639,6 @@ TEST_CASE(
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler scheduler;
|
||||
|
||||
@@ -730,9 +673,6 @@ TEST_CASE("ScriptScheduler: Forward Backwards Multiple Load", "[scriptscheduler]
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
@@ -773,9 +713,6 @@ TEST_CASE("ScriptScheduler: Rewind Multiple Load", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
@@ -810,9 +747,6 @@ TEST_CASE("ScriptScheduler: All Scripts Multiple Load", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
@@ -849,9 +783,6 @@ TEST_CASE("ScriptScheduler: All Scripts Mixed Load", "[scriptscheduler]") {
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpiceManager::initialize();
|
||||
SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
ScriptScheduler::ScheduledScript script1;
|
||||
script1.time = Time::convertTime("2000 JAN 03");
|
||||
|
||||
+16
-162
@@ -37,199 +37,55 @@ namespace {
|
||||
// The remaining methods rely on multiple kernels, loaded as a SPICE 'meta-kernel'
|
||||
void loadMetaKernel() {
|
||||
const int k1 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
CHECK(k1 == 1);
|
||||
|
||||
const int k2 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/cas00084.tsc")
|
||||
);
|
||||
CHECK(k2 == 2);
|
||||
CHECK(k1 == 3);
|
||||
|
||||
const int k3 = SpiceManager::ref().loadKernel(
|
||||
const int k2 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/981005_PLTEPH-DE405S.bsp")
|
||||
);
|
||||
CHECK(k3 == 3);
|
||||
CHECK(k2 == 4);
|
||||
|
||||
const int k4 = SpiceManager::ref().loadKernel(
|
||||
const int k3 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/020514_SE_SAT105.bsp")
|
||||
);
|
||||
CHECK(k4 == 4);
|
||||
CHECK(k3 == 5);
|
||||
|
||||
const int k5 = SpiceManager::ref().loadKernel(
|
||||
const int k4 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/030201AP_SK_SM546_T45.bsp")
|
||||
);
|
||||
CHECK(k5 == 5);
|
||||
CHECK(k4 == 6);
|
||||
|
||||
const int k6 = SpiceManager::ref().loadKernel(
|
||||
const int k5 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/cas_v37.tf")
|
||||
);
|
||||
CHECK(k6 == 6);
|
||||
CHECK(k5 == 7);
|
||||
|
||||
const int k7 = SpiceManager::ref().loadKernel(
|
||||
const int k6 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/04135_04171pc_psiv2.bc")
|
||||
);
|
||||
CHECK(k7 == 7);
|
||||
CHECK(k6 == 8);
|
||||
|
||||
const int k8 = SpiceManager::ref().loadKernel(
|
||||
const int k7 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/cpck05Mar2004.tpc")
|
||||
);
|
||||
CHECK(k8 == 8);
|
||||
CHECK(k7 == 9);
|
||||
|
||||
const int k9 = SpiceManager::ref().loadKernel(
|
||||
const int k8 = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/cas_iss_v09.ti")
|
||||
);
|
||||
CHECK(k9 == 9);
|
||||
}
|
||||
|
||||
int loadLSKKernel() {
|
||||
const int kernelID = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
CHECK(kernelID == 1);
|
||||
return kernelID;
|
||||
CHECK(k8 == 10);
|
||||
}
|
||||
|
||||
int loadPCKKernel() {
|
||||
const int kernelID = SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/cpck05Mar2004.tpc")
|
||||
);
|
||||
CHECK(kernelID == 1);
|
||||
CHECK(kernelID == 3);
|
||||
return kernelID;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("SpiceManager: Load Single Kernel", "[spicemanager]") {
|
||||
constexpr int FileLength = 128;
|
||||
constexpr int TypeLength = 32;
|
||||
constexpr int SourceLength = 128;
|
||||
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
|
||||
SpiceInt handle = 0;
|
||||
std::array<char, FileLength> file;
|
||||
std::array<char, TypeLength> filtyp;
|
||||
std::array<char, SourceLength> source;
|
||||
SpiceBoolean found = SPICEFALSE;
|
||||
kdata_c(
|
||||
0,
|
||||
"text",
|
||||
FileLength,
|
||||
TypeLength,
|
||||
SourceLength,
|
||||
file.data(),
|
||||
filtyp.data(),
|
||||
source.data(),
|
||||
&handle,
|
||||
&found
|
||||
);
|
||||
CHECK(found == SPICETRUE);
|
||||
|
||||
SpiceManager::deinitialize();
|
||||
}
|
||||
|
||||
TEST_CASE("SpiceManager: Unload Kernel String", "[spicemanager]") {
|
||||
constexpr int FileLength = 128;
|
||||
constexpr int TypeLength = 32;
|
||||
constexpr int SourceLength = 128;
|
||||
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
|
||||
SpiceInt handle = 0;
|
||||
std::array<char, FileLength> file;
|
||||
std::array<char, TypeLength> filtyp;
|
||||
std::array<char, SourceLength> source;
|
||||
SpiceBoolean found = SPICEFALSE;
|
||||
kdata_c(
|
||||
0,
|
||||
"text",
|
||||
FileLength,
|
||||
TypeLength,
|
||||
SourceLength,
|
||||
file.data(),
|
||||
filtyp.data(),
|
||||
source.data(),
|
||||
&handle,
|
||||
&found
|
||||
);
|
||||
CHECK(found == SPICETRUE);
|
||||
|
||||
// unload using string keyword
|
||||
SpiceManager::ref().unloadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
|
||||
found = SPICEFALSE;
|
||||
kdata_c(
|
||||
0,
|
||||
"text",
|
||||
FileLength,
|
||||
TypeLength,
|
||||
SourceLength,
|
||||
file.data(),
|
||||
filtyp.data(),
|
||||
source.data(),
|
||||
&handle,
|
||||
&found
|
||||
);
|
||||
CHECK(found != SPICETRUE);
|
||||
|
||||
SpiceManager::deinitialize();
|
||||
}
|
||||
|
||||
TEST_CASE("SpiceManager: Unload Kernel Integer", "[spicemanager]") {
|
||||
constexpr int FileLength = 128;
|
||||
constexpr int TypeLength = 32;
|
||||
constexpr int SourceLength = 128;
|
||||
|
||||
SpiceManager::initialize();
|
||||
|
||||
const int kernelID = loadLSKKernel();
|
||||
|
||||
SpiceInt handle = 0;
|
||||
std::array<char, FileLength> file;
|
||||
std::array<char, TypeLength> filtyp;
|
||||
std::array<char, SourceLength> source;
|
||||
SpiceBoolean found = SPICEFALSE;
|
||||
kdata_c(
|
||||
0,
|
||||
"text",
|
||||
FileLength,
|
||||
TypeLength,
|
||||
SourceLength,
|
||||
file.data(),
|
||||
filtyp.data(),
|
||||
source.data(),
|
||||
&handle,
|
||||
&found
|
||||
);
|
||||
CHECK(found == SPICETRUE);
|
||||
|
||||
// unload using unique int ID
|
||||
SpiceManager::ref().unloadKernel(kernelID);
|
||||
|
||||
found = SPICEFALSE;
|
||||
kdata_c(
|
||||
0,
|
||||
"text",
|
||||
FileLength,
|
||||
TypeLength,
|
||||
SourceLength,
|
||||
file.data(),
|
||||
filtyp.data(),
|
||||
source.data(),
|
||||
&handle,
|
||||
&found
|
||||
);
|
||||
CHECK(found != SPICETRUE);
|
||||
|
||||
SpiceManager::deinitialize();
|
||||
}
|
||||
|
||||
TEST_CASE("SpiceManager: Has Value", "[spicemanager]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
@@ -299,8 +155,6 @@ TEST_CASE("SpiceManager: Get Value From ID ND", "[spicemanager]") {
|
||||
TEST_CASE("SpiceManager: String To Ephemeris Time", "[spicemanager]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
|
||||
double control_ephemerisTime = 0.0;
|
||||
const std::string date = "Thu Mar 20 12:53:29 PST 1997";
|
||||
str2et_c(date.c_str(), &control_ephemerisTime);
|
||||
|
||||
@@ -34,14 +34,6 @@
|
||||
using namespace openspace;
|
||||
|
||||
namespace {
|
||||
int loadLSKKernel() {
|
||||
const int kernelID = openspace::SpiceManager::ref().loadKernel(
|
||||
absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls")
|
||||
);
|
||||
CHECK(kernelID == 1);
|
||||
return kernelID;
|
||||
}
|
||||
|
||||
void singleTimeTest(Time& t, globebrowsing::TimeQuantizer& tq, bool clamp,
|
||||
const std::string& input, const std::string& expected)
|
||||
{
|
||||
@@ -113,7 +105,6 @@ namespace {
|
||||
TEST_CASE("TimeQuantizer: Test years resolution", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
Time testT;
|
||||
|
||||
@@ -154,7 +145,6 @@ TEST_CASE("TimeQuantizer: Test years resolution", "[timequantizer]") {
|
||||
TEST_CASE("TimeQuantizer: Test days resolution", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
Time testT;
|
||||
|
||||
@@ -202,7 +192,6 @@ TEST_CASE("TimeQuantizer: Test days resolution", "[timequantizer]") {
|
||||
TEST_CASE("TimeQuantizer: Test months resolution", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
Time testT;
|
||||
|
||||
@@ -249,7 +238,6 @@ TEST_CASE("TimeQuantizer: Test months resolution", "[timequantizer]") {
|
||||
TEST_CASE("TimeQuantizer: Test hours & minutes resolution", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
Time testT;
|
||||
|
||||
@@ -288,7 +276,6 @@ TEST_CASE("TimeQuantizer: Test hours & minutes resolution", "[timequantizer]") {
|
||||
TEST_CASE("TimeQuantizer: Test pre-2000 dates", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
Time testT;
|
||||
|
||||
@@ -319,7 +306,6 @@ TEST_CASE("TimeQuantizer: Test pre-2000 dates", "[timequantizer]") {
|
||||
TEST_CASE("TimeQuantizer: Test valid resolutions", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
|
||||
singleResolutionTest(t1, "29d", "(d)ay option.", true);
|
||||
@@ -342,7 +328,6 @@ TEST_CASE("TimeQuantizer: Test valid resolutions", "[timequantizer]") {
|
||||
TEST_CASE("TimeQuantizer: Test start time pre-existing object", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
globebrowsing::TimeQuantizer t1;
|
||||
|
||||
singleStartTimeTest(t1, "2017-01-20T00:00:00", "Invalid start", false);
|
||||
@@ -357,8 +342,6 @@ TEST_CASE("TimeQuantizer: Test start time pre-existing object", "[timequantizer]
|
||||
TEST_CASE("TimeQuantizer: Test start time using constructor", "[timequantizer]") {
|
||||
SpiceManager::initialize();
|
||||
|
||||
loadLSKKernel();
|
||||
|
||||
singleStartTimeTest("2017-01-20T00:00:00", "Invalid start", false);
|
||||
singleStartTimeTest("2017-01-32T00:00:00", "For January the day must be at least 1.0D0 and less than 3.2E+01", true);
|
||||
singleStartTimeTest("2017-01-28T12:00:00", "Invalid start time value", true);
|
||||
|
||||
Reference in New Issue
Block a user