forked from theheraldproject/herald-for-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of theheraldproject#113. Protobuf assessment.
Signed off by: Adam Fowler <[email protected]>
- Loading branch information
1 parent
98592fb
commit f9e05e3
Showing
38 changed files
with
7,957 additions
and
262 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
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,37 @@ | ||
// Copyright 2022 Herald Project Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "catch.hpp" | ||
#include "herald/herald.h" | ||
|
||
#include <google/protobuf/arena.h> | ||
|
||
using namespace herald::mesh; | ||
using namespace herald::mesh::messages; | ||
using namespace herald::datatype; | ||
|
||
// [Who] As a system administrator | ||
// [What] I need to issue commands to MESH devices from a central location | ||
// [Value] In order to easily administer a large mesh device network | ||
|
||
TEST_CASE("mesh-hello-command", "[mesh][command][hello]") { | ||
SECTION("mesh-hello-command") { | ||
// Test default hello command execution | ||
google::protobuf::Arena arena; | ||
// Create hello message | ||
Hello* hello = google::protobuf::Arena::CreateMessage<Hello>(&arena); | ||
hello->set_commandid(1234); | ||
// Serialise to binary | ||
std::string output; | ||
bool outOk = hello->SerializeToString(&output); | ||
REQUIRE(true == outOk); | ||
// Deserialise from binary | ||
Hello* helloIn = google::protobuf::Arena::CreateMessage<Hello>(&arena); | ||
bool inOk = helloIn->ParseFromString(output); | ||
REQUIRE(true == inOk); | ||
// Ensure new message is the same | ||
REQUIRE(1234 == hello->commandid()); | ||
REQUIRE(1234 == helloIn->commandid()); | ||
} | ||
} |
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
Oops, something went wrong.