mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-19 03:13:14 +00:00
Fixes and cleanup
This commit is contained in:
parent
be06daa46d
commit
44c6f565ac
@ -4,6 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct Device;
|
||||
struct DeviceType;
|
||||
|
||||
|
||||
@ -5,8 +5,6 @@
|
||||
|
||||
#include <Tactility/Device.h>
|
||||
|
||||
#include "Tactility/Log.h"
|
||||
|
||||
TEST_CASE("device_construct and device_destruct should set and unset the correct fields") {
|
||||
Device device = { 0 };
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#include "doctest.h"
|
||||
#include <cstring>
|
||||
#include <Tactility/Driver.h>
|
||||
|
||||
TEST_CASE("driver_construct and driver_destruct should set and unset the correct fields") {
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "doctest.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include <Tactility/file/File.h>
|
||||
|
||||
/**
|
||||
* A class for creating test files that can automatically clean themselves up.
|
||||
*/
|
||||
class TestFile {
|
||||
const char* path;
|
||||
bool autoClean;
|
||||
|
||||
public:
|
||||
|
||||
TestFile(const char* path, bool autoClean = true) : path(path), autoClean(autoClean) {
|
||||
if (autoClean && exists()) {
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
~TestFile() {
|
||||
if (autoClean && exists()) {
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
const char* getPath() const { return path; }
|
||||
|
||||
void writeData(const char* data) const {
|
||||
CHECK_EQ(tt::file::writeString(path, data), true);
|
||||
}
|
||||
|
||||
bool exists() const {
|
||||
return access(path, F_OK) == 0;
|
||||
}
|
||||
|
||||
void remove() const {
|
||||
::remove(path);
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user