Skip to content

Commit fedca50

Browse files
centralize all the byte_vec type definitions (#37)
1 parent 27ee4d6 commit fedca50

7 files changed

+13
-20
lines changed

tests/byte_vec.h

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
#include <vector>
4+
5+
using byte_t = unsigned char;
6+
using byte_vec_t = std::vector<byte_t>;
7+

tests/test_cobs_decode_inplace.cc

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#include "../cobs.h"
2+
#include "byte_vec.h"
23
#include "doctest.h"
34

45
#include <algorithm>
56
#include <cstring>
67
#include <numeric>
7-
#include <vector>
88

9-
10-
using byte_t = unsigned char;
11-
using byte_vec_t = std::vector< byte_t >;
129
static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE;
1310

1411
namespace {

tests/test_cobs_encode.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#include "../cobs.h"
2+
#include "byte_vec.h"
23
#include "doctest.h"
34

4-
#include <vector>
55
#include <cstring>
66

7-
using byte_vec_t = std::vector< unsigned char >;
8-
97
TEST_CASE("Encoding validation") {
108
unsigned char enc[32], dec[32];
119
unsigned const enc_n = sizeof(enc);

tests/test_cobs_encode_inc.cc

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#include "../cobs.h"
2+
#include "byte_vec.h"
23
#include "doctest.h"
34

45
#include <algorithm>
56
#include <iomanip>
67
#include <numeric>
78
#include <sstream>
8-
#include <vector>
99

1010

11-
using byte_t = unsigned char;
12-
using byte_vec_t = std::vector<byte_t>;
13-
1411
TEST_CASE("cobs_encode_inc_begin") {
1512
cobs_enc_ctx_t ctx;
1613
std::vector<unsigned char> buf(1024);

tests/test_cobs_encode_inplace.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#include "../cobs.h"
2+
#include "byte_vec.h"
23
#include "doctest.h"
34

45
#include <cstring>
56
#include <numeric>
6-
#include <vector>
77

8-
using byte_t = unsigned char;
9-
using byte_vec_t = std::vector< byte_t >;
108
static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE;
119

1210
namespace {

tests/test_paper_figures.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "../cobs.h"
2+
#include "byte_vec.h"
23
#include "doctest.h"
34

4-
#include <vector>
5-
6-
using byte_vec_t = std::vector< unsigned char >;
75

86
// http://www.stuartcheshire.org/papers/COBSforToN.pdf
97
TEST_CASE("COBS paper examples") {

tests/test_wikipedia.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#include "../cobs.h"
2+
#include "byte_vec.h"
23
#include "doctest.h"
34

45
#include <numeric>
5-
#include <vector>
66

7-
using byte_t = unsigned char;
8-
using byte_vec_t = std::vector< byte_t >;
97
static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE;
108

119
namespace {

0 commit comments

Comments
 (0)