-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'externals/nitro/' changes from c899f14ad..b5612a7df
b5612a7df enable "WarningsAsErrors" for DEBUG builds 2f47cc122 Merge commit 'f067a751ac940fc485c06f003e2e2c23071a8766' into cpp17 f067a751a Squashed 'externals/coda-oss/' changes from 5015192abb..1ec9a072c4 50a3500ec Merge branch 'main' into cpp17 de4686af0 improve TRE unitesting (#599) a4d0a5130 remove /Wall from MSVC (#598) b97c4a867 disable pre-loaded TREs (#597) 1075b4ecd be sure the string is properly padded for the field type git-subtree-dir: externals/nitro git-subtree-split: b5612a7dffc1a7340da81f6390fda40e8a59e679
- Loading branch information
Dan Smith
committed
Nov 15, 2023
1 parent
b60fb0a
commit 9188104
Showing
45 changed files
with
483 additions
and
1,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
#include "pch.h" | ||
#include "CppUnitTest.h" | ||
|
||
#include <nitf/PluginRegistry.h> | ||
#include <nitf/UnitTests.hpp> | ||
|
||
// https://learn.microsoft.com/en-us/visualstudio/test/microsoft-visualstudio-testtools-cppunittestframework-api-reference?view=vs-2022 | ||
TEST_MODULE_INITIALIZE(methodName) | ||
{ | ||
// module initialization code | ||
nitf::Test::setNitfPluginPath(); | ||
nitf_PluginRegistry_PreloadedTREHandlersEnable(NRT_TRUE); | ||
nitf::Test::j2kSetNitfPluginPath(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* ========================================================================= | ||
* This file is part of NITRO | ||
* ========================================================================= | ||
* | ||
* (C) Copyright 2004 - 2014, MDA Information Systems LLC | ||
* © Copyright 2023, Maxar Technologies, Inc. | ||
* | ||
* NITRO is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this program; if not, If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "TREField.hpp" | ||
|
||
// A sample (and simple) "strongly-typed" TRE; see ENGRDA in the | ||
// unittests for something a bit more elaborate (not included because it's incomplete). | ||
namespace nitf | ||
{ | ||
namespace TREs | ||
{ | ||
class TEST_DES final | ||
{ | ||
nitf::TRE tre_; | ||
static constexpr const char* tag = "TEST_DES"; | ||
|
||
public: | ||
// from TRE::getID() | ||
/** | ||
* Get the TRE identifier. This is NOT the tag, however it may be the | ||
* same value as the tag. The ID is used to identify a specific | ||
* version/incarnation of the TRE, if multiple are possible. For most TREs, | ||
* this value will be the same as the tag. | ||
*/ | ||
TEST_DES(const std::string& id = "") noexcept(false) | ||
: tre_(tag, id.empty() ? tag : id.c_str()), | ||
TEST_DES_COUNT(tre_, "TEST_DES_COUNT"), | ||
TEST_DES_START(tre_, "TEST_DES_START"), | ||
TEST_DES_INCREMENT(tre_, "TEST_DES_INCREMENT") | ||
{ | ||
} | ||
~TEST_DES() = default; | ||
TEST_DES(const TEST_DES&) = delete; | ||
TEST_DES& operator=(const TEST_DES&) = delete; | ||
TEST_DES(TEST_DES&&) = default; | ||
TEST_DES& operator=(TEST_DES&&) = delete; | ||
|
||
// From TEST_DES.c | ||
/* | ||
static nitf_TREDescription TEST_DES_description[] = { | ||
{NITF_BCS_N, 2, "Number of data values", "TEST_DES_COUNT" }, | ||
{NITF_BCS_N, 3, "Start value in ramp", "TEST_DES_START" }, | ||
{NITF_BCS_N, 2, "Increment between values in ramp", "TEST_DES_INCREMENT" }, | ||
{NITF_END, 0, NULL, NULL} | ||
}; | ||
*/ | ||
nitf::TREField_BCS_N<2> TEST_DES_COUNT; | ||
nitf::TREField_BCS_N<3> TEST_DES_START; | ||
nitf::TREField_BCS_N<2> TEST_DES_INCREMENT; | ||
|
||
void updateFields() | ||
{ | ||
tre_.updateFields(); | ||
} | ||
}; | ||
|
||
class TEST_PRELOADED_DES final | ||
{ | ||
nitf::TRE tre_; | ||
static constexpr const char* tag = "TEST_PRELOADED_DES"; | ||
|
||
public: | ||
// from TRE::getID() | ||
/** | ||
* Get the TRE identifier. This is NOT the tag, however it may be the | ||
* same value as the tag. The ID is used to identify a specific | ||
* version/incarnation of the TRE, if multiple are possible. For most TREs, | ||
* this value will be the same as the tag. | ||
*/ | ||
TEST_PRELOADED_DES(const std::string& id = "") noexcept(false) : tre_(tag, id.empty() ? tag : id.c_str()), | ||
COUNT(tre_, "COUNT"), START(tre_, "START"), INCREMENT(tre_, "INCREMENT") { } | ||
~TEST_PRELOADED_DES() = default; | ||
TEST_PRELOADED_DES(const TEST_PRELOADED_DES&) = delete; | ||
TEST_PRELOADED_DES& operator=(const TEST_PRELOADED_DES&) = delete; | ||
TEST_PRELOADED_DES(TEST_PRELOADED_DES&&) = default; | ||
TEST_PRELOADED_DES& operator=(TEST_PRELOADED_DES&&) = delete; | ||
|
||
// From TREs.c | ||
/* | ||
static nitf_TREDescription TEST_PRELOADED_DES_description[] = { | ||
{NITF_BCS_N, 2, "Number of data values", "COUNT" }, | ||
{NITF_BCS_N, 3, "Start value in ramp", "START" }, | ||
{NITF_BCS_N, 2, "Increment between values in ramp", "INCREMENT" }, | ||
{NITF_END, 0, NULL, NULL} | ||
}; | ||
*/ | ||
nitf::TREField_BCS_N<2> COUNT; | ||
nitf::TREField_BCS_N<3> START; | ||
nitf::TREField_BCS_N<2> INCREMENT; | ||
|
||
void updateFields() | ||
{ | ||
tre_.updateFields(); | ||
} | ||
}; | ||
|
||
} // namespace TREs | ||
} // namespace nitf |
Oops, something went wrong.