From fedca5054c0ae4ee9897fcd7fe5a8510959bc789 Mon Sep 17 00:00:00 2001 From: Charles Nicholson Date: Tue, 31 Aug 2021 12:18:18 -0400 Subject: [PATCH] centralize all the byte_vec type definitions (#37) --- tests/byte_vec.h | 7 +++++++ tests/test_cobs_decode_inplace.cc | 5 +---- tests/test_cobs_encode.cc | 4 +--- tests/test_cobs_encode_inc.cc | 5 +---- tests/test_cobs_encode_inplace.cc | 4 +--- tests/test_paper_figures.cc | 4 +--- tests/test_wikipedia.cc | 4 +--- 7 files changed, 13 insertions(+), 20 deletions(-) create mode 100644 tests/byte_vec.h diff --git a/tests/byte_vec.h b/tests/byte_vec.h new file mode 100644 index 0000000..056c1fd --- /dev/null +++ b/tests/byte_vec.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +using byte_t = unsigned char; +using byte_vec_t = std::vector; + diff --git a/tests/test_cobs_decode_inplace.cc b/tests/test_cobs_decode_inplace.cc index 200c1ab..c7aa9ed 100644 --- a/tests/test_cobs_decode_inplace.cc +++ b/tests/test_cobs_decode_inplace.cc @@ -1,14 +1,11 @@ #include "../cobs.h" +#include "byte_vec.h" #include "doctest.h" #include #include #include -#include - -using byte_t = unsigned char; -using byte_vec_t = std::vector< byte_t >; static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE; namespace { diff --git a/tests/test_cobs_encode.cc b/tests/test_cobs_encode.cc index 316d79d..36bee46 100644 --- a/tests/test_cobs_encode.cc +++ b/tests/test_cobs_encode.cc @@ -1,11 +1,9 @@ #include "../cobs.h" +#include "byte_vec.h" #include "doctest.h" -#include #include -using byte_vec_t = std::vector< unsigned char >; - TEST_CASE("Encoding validation") { unsigned char enc[32], dec[32]; unsigned const enc_n = sizeof(enc); diff --git a/tests/test_cobs_encode_inc.cc b/tests/test_cobs_encode_inc.cc index 73091e5..1fc949c 100644 --- a/tests/test_cobs_encode_inc.cc +++ b/tests/test_cobs_encode_inc.cc @@ -1,16 +1,13 @@ #include "../cobs.h" +#include "byte_vec.h" #include "doctest.h" #include #include #include #include -#include -using byte_t = unsigned char; -using byte_vec_t = std::vector; - TEST_CASE("cobs_encode_inc_begin") { cobs_enc_ctx_t ctx; std::vector buf(1024); diff --git a/tests/test_cobs_encode_inplace.cc b/tests/test_cobs_encode_inplace.cc index 63f8e62..eb6ae87 100644 --- a/tests/test_cobs_encode_inplace.cc +++ b/tests/test_cobs_encode_inplace.cc @@ -1,12 +1,10 @@ #include "../cobs.h" +#include "byte_vec.h" #include "doctest.h" #include #include -#include -using byte_t = unsigned char; -using byte_vec_t = std::vector< byte_t >; static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE; namespace { diff --git a/tests/test_paper_figures.cc b/tests/test_paper_figures.cc index 2106add..60f41a7 100644 --- a/tests/test_paper_figures.cc +++ b/tests/test_paper_figures.cc @@ -1,9 +1,7 @@ #include "../cobs.h" +#include "byte_vec.h" #include "doctest.h" -#include - -using byte_vec_t = std::vector< unsigned char >; // http://www.stuartcheshire.org/papers/COBSforToN.pdf TEST_CASE("COBS paper examples") { diff --git a/tests/test_wikipedia.cc b/tests/test_wikipedia.cc index 973b166..d431c0a 100644 --- a/tests/test_wikipedia.cc +++ b/tests/test_wikipedia.cc @@ -1,11 +1,9 @@ #include "../cobs.h" +#include "byte_vec.h" #include "doctest.h" #include -#include -using byte_t = unsigned char; -using byte_vec_t = std::vector< byte_t >; static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE; namespace {