-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional tests to cover untested functionality
- Loading branch information
Showing
19 changed files
with
259 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
|
||
classes: | ||
Buffers: | ||
methods: | ||
set_buffer: | ||
buffers: | ||
- { type: in, src: data, len: len } | ||
get_buffer2: | ||
buffers: | ||
- { type: out, src: data, len: len } | ||
get_buffer1: | ||
buffers: | ||
- { type: out, src: data, len: len } | ||
|
||
v_set_buffer: | ||
buffers: | ||
- { type: in, src: data, len: len } | ||
v_get_buffer2: | ||
buffers: | ||
- { type: out, src: data, len: len } | ||
v_get_buffer1: | ||
buffers: | ||
- { type: out, src: data, len: len } |
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,54 @@ | ||
#pragma once | ||
|
||
#include <cstring> | ||
#include <vector> | ||
|
||
class Buffers { | ||
public: | ||
|
||
// in | ||
void set_buffer(const uint8_t *data, size_t len) { | ||
m_buf.resize(len); | ||
memcpy(m_buf.data(), data, len); | ||
} | ||
|
||
// out | ||
// - data is bytes | ||
// - len is input_size and output size | ||
void get_buffer2(uint8_t *data, size_t *len) { | ||
*len = get_buffer1(data, *len); | ||
} | ||
|
||
// out | ||
// - data is bytes | ||
// - len is input size | ||
// - return value is output size | ||
size_t get_buffer1(uint8_t *data, size_t len) { | ||
size_t rlen = len < m_buf.size() ? len : m_buf.size(); | ||
if (rlen) { | ||
memcpy(data, m_buf.data(), rlen); | ||
} | ||
return rlen; | ||
} | ||
|
||
// | ||
// virtual functions -- trampolines are disabled but normal function | ||
// calls work | ||
// | ||
|
||
virtual void v_set_buffer(const uint8_t *data, size_t len) { | ||
set_buffer(data, len); | ||
} | ||
|
||
virtual void v_get_buffer2(uint8_t *data, size_t *len) { | ||
get_buffer2(data, len); | ||
} | ||
|
||
virtual size_t v_get_buffer1(uint8_t *data, size_t len) { | ||
return get_buffer1(data, len); | ||
} | ||
|
||
private: | ||
|
||
std::vector<uint8_t> m_buf; | ||
}; |
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 |
---|---|---|
@@ -1,11 +1,17 @@ | ||
|
||
#pragma once | ||
|
||
namespace NS::inner { | ||
static constexpr auto KONSTANT = 4; | ||
} | ||
|
||
class InlineCode { | ||
public: | ||
enum MyE { | ||
Value1 = 1 | ||
}; | ||
|
||
int get2() const { return 2; } | ||
|
||
int cpp_code_with_constant() { return 3; } | ||
}; |
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,14 @@ | ||
#pragma once | ||
|
||
class HasOperator { | ||
public: | ||
HasOperator() : m_i(0) {} | ||
HasOperator(int i) : m_i(i) {} | ||
|
||
bool operator==(const HasOperator &o) const { | ||
return m_i == o.m_i; | ||
} | ||
|
||
private: | ||
int m_i; | ||
}; |
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.