-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose
FullNameAndVersion()
from a DSDL type. (#352)
1. Exposed full name of a DSDL type as... ``` struct _traits_ { ... constexpr const char* FullNameAndVersion() { return "{{ composite_type }}"; } }; ``` Needed for libcyphal's subscriber implementation (see [issue # 380](OpenCyphal-Garage/libcyphal#380)) 2. Fix for issue #348 - added `#include <cassert>` for `nunavut/support/serialization.hpp` file generation
- Loading branch information
Showing
9 changed files
with
131 additions
and
9 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
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
Submodule CETL
updated
70 files
Submodule googletest
updated
158 files
Submodule o1heap
updated
17 files
+118 −0 | .github/workflows/main.yml | |
+3 −1 | .gitignore | |
+0 −79 | .travis.yml | |
+125 −65 | README.md | |
+5 −0 | o1heap/.clang-tidy | |
+76 −87 | o1heap/o1heap.c | |
+11 −32 | o1heap/o1heap.h | |
+0 −9 | sonar-project.properties | |
+4 −0 | tests/.clang-tidy | |
+22 −0 | tests/.idea/dictionaries/pavel.xml | |
+31 −23 | tests/CMakeLists.txt | |
+832 −471 | tests/catch/catch.hpp | |
+7 −0 | tests/cfg_test_internal.h | |
+15 −19 | tests/internal.hpp | |
+0 −0 | tests/main.cpp | |
+21 −95 | tests/test_general.cpp | |
+31 −40 | tests/test_private.cpp |
Submodule public_regulated_data_types
updated
24 files
Submodule unity
updated
12 files
+1 −1 | auto/generate_module.rb | |
+8 −6 | auto/generate_test_runner.rb | |
+1 −6 | auto/stylize_as_junit.rb | |
+1 −0 | docs/UnityChangeLog.md | |
+1 −1 | docs/UnityHelperScriptsGuide.md | |
+1 −1 | examples/unity_config.h | |
+28 −15 | src/unity.c | |
+42 −29 | src/unity_internals.h | |
+1 −0 | test/Makefile | |
+5 −5 | test/tests/self_assessment_utils.h | |
+63 −21 | test/tests/test_generate_test_runner.rb | |
+4 −3 | test/tests/test_unity_core.c |
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,117 @@ | ||
/* | ||
* Copyright (c) 2024 OpenCyphal Development Team. | ||
* Authors: Sergei Shirokov <[email protected]> | ||
* This software is distributed under the terms of the MIT License. | ||
* | ||
* Tests of constant | ||
*/ | ||
|
||
#include "gmock/gmock.h" | ||
#include "regulated/basics/Struct__0_1.hpp" | ||
#include "regulated/basics/Union_0_1.hpp" | ||
#include "regulated/basics/Service_0_1.hpp" | ||
|
||
using testing::Le; | ||
using testing::StrEq; | ||
using testing::FloatNear; | ||
using testing::DoubleNear; | ||
|
||
TEST(ConstantTests, Struct) | ||
{ | ||
// Type parameters. | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::HasFixedPortID); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::FixedPortId, 7000); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::FullNameAndVersion(), StrEq("regulated.basics.Struct_.0.1")); | ||
|
||
// Application constants. | ||
EXPECT_THAT(regulated::basics::Struct__0_1::CONSTANT_MINUS_THREE, DoubleNear(-3.0, 1e-9)); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::CONSTANT_ZEE, 'Z'); | ||
EXPECT_THAT(-regulated::basics::Struct__0_1::CONSTANT_MINUS_MAX_OFFSET, | ||
Le(regulated::basics::Struct__0_1::_traits_::SerializationBufferSizeBytes * 8U)); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::CONSTANT_TRUTH); | ||
|
||
// TODO: Uncomment when some form of "ARRAY_CAPACITY" is generated. | ||
/* | ||
// Field metadata. Expected values encoded in the field names. | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::i10_4_ARRAY_CAPACITY_, 4); | ||
EXPECT_FALSE(regulated::basics::Struct__0_1::_traits_::i10_4_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::f16_le2_ARRAY_CAPACITY_, 2); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::f16_le2_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::unaligned_bitpacked_3_ARRAY_CAPACITY_, 3); | ||
EXPECT_FALSE(regulated::basics::Struct__0_1::_traits_::unaligned_bitpacked_3_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::bytes_lt3_ARRAY_CAPACITY_, 2); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::bytes_lt3_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::bytes_3_ARRAY_CAPACITY_, 3); | ||
EXPECT_FALSE(regulated::basics::Struct__0_1::_traits_::bytes_3_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::u2_le4_ARRAY_CAPACITY_, 4); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::u2_le4_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::delimited_fix_le2_ARRAY_CAPACITY_, 2); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::delimited_fix_le2_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::u16_2_ARRAY_CAPACITY_, 2); | ||
EXPECT_FALSE(regulated::basics::Struct__0_1::_traits_::u16_2_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::aligned_bitpacked_3_ARRAY_CAPACITY_, 3); | ||
EXPECT_FALSE(regulated::basics::Struct__0_1::_traits_::aligned_bitpacked_3_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::unaligned_bitpacked_lt3_ARRAY_CAPACITY_, 2); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::unaligned_bitpacked_lt3_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::delimited_var_2_ARRAY_CAPACITY_, 2); | ||
EXPECT_FALSE(regulated::basics::Struct__0_1::_traits_::delimited_var_2_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Struct__0_1::_traits_::aligned_bitpacked_le3_ARRAY_CAPACITY_, 3); | ||
EXPECT_TRUE(regulated::basics::Struct__0_1::_traits_::aligned_bitpacked_le3_ARRAY_IS_VARIABLE_LENGTH_); | ||
*/ | ||
} | ||
|
||
TEST(ConstantTests, Union) | ||
{ | ||
// Type parameters. | ||
EXPECT_FALSE(regulated::basics::Union_0_1::_traits_::HasFixedPortID); | ||
EXPECT_THAT(regulated::basics::Union_0_1::_traits_::FullNameAndVersion(), StrEq("regulated.basics.Union.0.1")); | ||
EXPECT_THAT(regulated::basics::Union_0_1::_traits_::ExtentBytes, | ||
1U + regulated::basics::Struct__0_1::_traits_::ExtentBytes); // Largest option + union tag field | ||
EXPECT_THAT(regulated::basics::Union_0_1::VariantType::MAX_INDEX, 3); | ||
|
||
// TODO: Uncomment when some form of "ARRAY_CAPACITY" is generated. | ||
/* | ||
// Field metadata. Expected values encoded in the field names. | ||
EXPECT_THAT(regulated::basics::Union_0_1::_traits__delimited_fix_le2_ARRAY_CAPACITY_, 2); | ||
EXPECT_FALSE(regulated::basics::Union_0_1::_traits__delimited_fix_le2_ARRAY_IS_VARIABLE_LENGTH_); | ||
EXPECT_THAT(regulated::basics::Union_0_1::_traits__delimited_var_le2_ARRAY_CAPACITY_, 2); | ||
EXPECT_TRUE(regulated::basics::Union_0_1::_traits__delimited_var_le2_ARRAY_IS_VARIABLE_LENGTH_); | ||
*/ | ||
} | ||
|
||
TEST(ConstantTests, Service) | ||
{ | ||
// Type parameters. | ||
EXPECT_TRUE(regulated::basics::Service_0_1::_traits_::IsService); | ||
EXPECT_TRUE(regulated::basics::Service_0_1::_traits_::IsServiceType); | ||
|
||
EXPECT_FALSE(regulated::basics::Service::Request_0_1::_traits_::IsService); | ||
EXPECT_TRUE(regulated::basics::Service::Request_0_1::_traits_::IsServiceType); | ||
EXPECT_TRUE(regulated::basics::Service::Request_0_1::_traits_::IsRequest); | ||
EXPECT_FALSE(regulated::basics::Service::Request_0_1::_traits_::IsResponse); | ||
EXPECT_THAT(regulated::basics::Service::Request_0_1::_traits_::FullNameAndVersion(), | ||
StrEq("regulated.basics.Service.Request.0.1")); | ||
|
||
EXPECT_FALSE(regulated::basics::Service::Response_0_1::_traits_::IsService); | ||
EXPECT_TRUE(regulated::basics::Service::Response_0_1::_traits_::IsServiceType); | ||
EXPECT_TRUE(regulated::basics::Service::Response_0_1::_traits_::IsResponse); | ||
EXPECT_FALSE(regulated::basics::Service::Response_0_1::_traits_::IsRequest); | ||
EXPECT_THAT(regulated::basics::Service::Response_0_1::_traits_::FullNameAndVersion(), | ||
StrEq("regulated.basics.Service.Response.0.1")); | ||
|
||
// Application constants. | ||
EXPECT_THAT(regulated::basics::Service::Request_0_1::HALF, DoubleNear(0.5, 1e-9)); | ||
EXPECT_THAT(regulated::basics::Service::Response_0_1::ONE_TENTH, FloatNear(0.1f, 1e-9f)); | ||
} |