Create more unit tests for USB Devices and Printer Driver #21
11
.clangd
Normal file
11
.clangd
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
If:
|
||||||
|
PathMatch: tests/.*
|
||||||
|
CompileFlags:
|
||||||
|
CompilationDatabase: builddir-debug/
|
||||||
|
|
||||||
|
---
|
||||||
|
If:
|
||||||
|
PathMatch: src/.*
|
||||||
|
CompileFlags:
|
||||||
|
CompilationDatabase: builddir/
|
||||||
7
.vscode/c_cpp_properties.json
vendored
7
.vscode/c_cpp_properties.json
vendored
@@ -5,11 +5,12 @@
|
|||||||
"compilerPath": "/usr/bin/clang",
|
"compilerPath": "/usr/bin/clang",
|
||||||
"cStandard": "c11",
|
"cStandard": "c11",
|
||||||
"cppStandard": "c++20",
|
"cppStandard": "c++20",
|
||||||
"compileCommands": "${workspaceFolder}/builddir/compile_commands.json",
|
|
||||||
"browse": {
|
"browse": {
|
||||||
"path": ["${workspaceFolder}"]
|
"path": [
|
||||||
|
"${workspaceFolder}"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 4
|
"version": 4
|
||||||
}
|
}
|
||||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"clangd.arguments": [
|
"clangd.arguments": [
|
||||||
"-background-index",
|
"-background-index",
|
||||||
"-compile-commands-dir=builddir/"
|
|
||||||
],
|
],
|
||||||
"editor.formatOnType": false,
|
"editor.formatOnType": false,
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../../tests/mocks/MockCairoWrapper.hpp"
|
|
||||||
#include "graphics/interface/ILabel.hpp"
|
#include "graphics/interface/ILabel.hpp"
|
||||||
|
#include "mocks/MockCairoWrapper.hpp"
|
||||||
|
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
using ::testing::DoAll;
|
using ::testing::DoAll;
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ TEST(basic_test, Monochrome_convertWithCustomThreshhold_yieldsMonochromeRespecti
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(basic_test, Monochrome_convertNonAlignedPixels_spillsOverIntoNewByte) {
|
TEST(basic_test, Monochrome_convertNonAlignedPixels_spillsOverIntoNewByte) {
|
||||||
// TODO: We need to find to access the vector without the possiblity of out-of-bounds access
|
|
||||||
// Ideas: constexpr? compile time check?
|
|
||||||
GTEST_SKIP() << "Skipping this test, as ASAN will halt as this is an out-of-bounds access";
|
|
||||||
const std::vector<uint8_t> pixels(
|
const std::vector<uint8_t> pixels(
|
||||||
{0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF});
|
{0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF});
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "../../tests/mocks/MockUsbDevice.hpp"
|
|
||||||
#include "graphics/Bitmap.hpp"
|
#include "graphics/Bitmap.hpp"
|
||||||
#include "graphics/Monochrome.hpp"
|
#include "graphics/Monochrome.hpp"
|
||||||
|
#include "mocks/MockUsbDevice.hpp"
|
||||||
#include "printers/P700Printer.hpp"
|
#include "printers/P700Printer.hpp"
|
||||||
|
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
@@ -39,8 +39,8 @@ namespace ptprnt::printer {
|
|||||||
class P700PrinterTest : public ::testing::Test {
|
class P700PrinterTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
printer = std::make_unique<P700Printer>();
|
printer = std::make_unique<P700Printer>();
|
||||||
mockUsbDev = std::make_shared<NiceMock<libusbwrap::MockUsbDevice>>();
|
mockUsbDev = std::make_shared<NiceMock<libusbwrap::MockUsbDevice>>();
|
||||||
|
|
||||||
// Default mock behaviors
|
// Default mock behaviors
|
||||||
ON_CALL(*mockUsbDev, open()).WillByDefault(Return(true));
|
ON_CALL(*mockUsbDev, open()).WillByDefault(Return(true));
|
||||||
|
|||||||
@@ -23,8 +23,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../../tests/mocks/MockPrinterDriver.hpp"
|
|
||||||
#include "../../tests/mocks/MockUsbDevice.hpp"
|
|
||||||
#include "core/PrinterDriverFactory.hpp"
|
#include "core/PrinterDriverFactory.hpp"
|
||||||
#include "core/PrinterService.hpp"
|
#include "core/PrinterService.hpp"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user