Skip to content

Commit

Permalink
centralize all the byte_vec type definitions (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesnicholson authored Aug 31, 2021
1 parent 27ee4d6 commit fedca50
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
7 changes: 7 additions & 0 deletions tests/byte_vec.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <vector>

using byte_t = unsigned char;
using byte_vec_t = std::vector<byte_t>;

5 changes: 1 addition & 4 deletions tests/test_cobs_decode_inplace.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#include "../cobs.h"
#include "byte_vec.h"
#include "doctest.h"

#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>


using byte_t = unsigned char;
using byte_vec_t = std::vector< byte_t >;
static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE;

namespace {
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cobs_encode.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "../cobs.h"
#include "byte_vec.h"
#include "doctest.h"

#include <vector>
#include <cstring>

using byte_vec_t = std::vector< unsigned char >;

TEST_CASE("Encoding validation") {
unsigned char enc[32], dec[32];
unsigned const enc_n = sizeof(enc);
Expand Down
5 changes: 1 addition & 4 deletions tests/test_cobs_encode_inc.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#include "../cobs.h"
#include "byte_vec.h"
#include "doctest.h"

#include <algorithm>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <vector>


using byte_t = unsigned char;
using byte_vec_t = std::vector<byte_t>;

TEST_CASE("cobs_encode_inc_begin") {
cobs_enc_ctx_t ctx;
std::vector<unsigned char> buf(1024);
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cobs_encode_inplace.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include "../cobs.h"
#include "byte_vec.h"
#include "doctest.h"

#include <cstring>
#include <numeric>
#include <vector>

using byte_t = unsigned char;
using byte_vec_t = std::vector< byte_t >;
static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE;

namespace {
Expand Down
4 changes: 1 addition & 3 deletions tests/test_paper_figures.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "../cobs.h"
#include "byte_vec.h"
#include "doctest.h"

#include <vector>

using byte_vec_t = std::vector< unsigned char >;

// http://www.stuartcheshire.org/papers/COBSforToN.pdf
TEST_CASE("COBS paper examples") {
Expand Down
4 changes: 1 addition & 3 deletions tests/test_wikipedia.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "../cobs.h"
#include "byte_vec.h"
#include "doctest.h"

#include <numeric>
#include <vector>

using byte_t = unsigned char;
using byte_vec_t = std::vector< byte_t >;
static constexpr byte_t CSV = COBS_INPLACE_SENTINEL_VALUE;

namespace {
Expand Down

0 comments on commit fedca50

Please sign in to comment.