Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: runTests

on:
push:
branches: [ master, main ]
pull_request:
workflow_dispatch:

jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake ninja

- name: Configure (Linux / macOS)
if: runner.os != 'Windows'
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DESFA_BUILD_TESTS=ON

- name: Configure (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cmake -B build `
-DCMAKE_BUILD_TYPE=Release `
-DESFA_BUILD_TESTS=ON

- name: Build (Linux / macOS)
if: runner.os != 'Windows'
run: cmake --build build

- name: Build (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: cmake --build build --config Release

- name: Test (Linux / macOS)
if: runner.os != 'Windows'
run: ctest --test-dir build/test --output-on-failure

- name: Test (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: ctest --test-dir build/test --build-config Release --output-on-failure
12 changes: 3 additions & 9 deletions include/esfa/esfa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@ namespace esfa {

class Processor {
public:
explicit Processor(const interface::Registry& registry)
: mRegistry(registry)
{
}

const interface::Registry& GetRegistry()
{
return mRegistry;
}
explicit Processor(const interface::Registry& registry) : mRegistry(registry) {}

const interface::Registry& GetRegistry() const { return mRegistry; }

std::shared_ptr<interface::ParsedAsset> ParseAsset(
const std::string& typeKey,
Expand Down
8 changes: 2 additions & 6 deletions src/processing/binary/reader.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <cmath>
#include <stdexcept>

#include "esfa/processing/binary/reader.hpp"
Expand Down Expand Up @@ -128,7 +127,7 @@ uint64_t Reader::ReadUInt64()

float Reader::ReadSingle()
{
float result;
float result = 0.f;

stream->Read((char*)&result, sizeof(float));

Expand All @@ -146,7 +145,7 @@ float Reader::ReadSingle()

double Reader::ReadDouble()
{
double result = NAN;
double result = 0.0;

stream->Read((char*)&result, sizeof(double));

Expand All @@ -160,9 +159,6 @@ double Reader::ReadDouble()
result = tmp;
}

if (std::isnan(result))
throw std::runtime_error("Reader::ReadDouble(): Error reading stream");

return result;
}

Expand Down
11 changes: 4 additions & 7 deletions src/processing/stream/memory_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,10 @@ void MemoryStream::Read(char* dest, size_t length)
}
if (mPosition + length > mBuffer.size())
{
std::string msg =
"MemoryStream::Read: position " + std::to_string(mPosition) +
" + length " + std::to_string(length) +
" = " + std::to_string(mPosition + length) +
" > buffer size " + std::to_string(mBuffer.size());

throw std::runtime_error(msg);
throw std::runtime_error(
"MemoryStream::Read: short read (past end of buffer) pos=" +
std::to_string(mPosition) + " len=" + std::to_string(length) +
" size=" + std::to_string(mBuffer.size()));
}
std::memcpy(dest, mBuffer.data() + mPosition, length);
mPosition += length;
Expand Down
Loading