-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
122 additions
and
34 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
build | ||
!*.zst |
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,7 +1,7 @@ | ||
# Maintainer: Databento <[email protected]> | ||
_pkgname=databento-cpp | ||
pkgname=databento-cpp-git | ||
pkgver=0.6.0 | ||
pkgver=0.6.1 | ||
pkgrel=1 | ||
pkgdesc="Official C++ client for Databento" | ||
arch=('any') | ||
|
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
Binary file not shown.
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,33 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "databento/detail/file_stream.hpp" | ||
#include "databento/exceptions.hpp" | ||
|
||
namespace databento { | ||
namespace detail { | ||
namespace test { | ||
TEST(FileStreamTests, TestReadExactInsufficient) { | ||
const std::string file_path = TEST_BUILD_DIR "/data/test_data.ohlcv-1d.dbn"; | ||
databento::detail::FileStream target{file_path}; | ||
std::vector<std::uint8_t> buffer(1024); // File is less than 1KiB | ||
try { | ||
target.ReadExact(buffer.data(), buffer.size()); | ||
FAIL() << "Expected throw"; | ||
} catch (const databento::Exception& exc) { | ||
ASSERT_STREQ(exc.what(), | ||
"Unexpected end of file, expected 1024 bytes, got 206"); | ||
} | ||
} | ||
|
||
TEST(FileStreamTests, TestReadSomeLessThanMax) { | ||
const std::string file_path = TEST_BUILD_DIR "/data/test_data.ohlcv-1d.dbn"; | ||
databento::detail::FileStream target{file_path}; | ||
std::vector<std::uint8_t> buffer(1024); // File is less than 1KiB | ||
const auto read_size = target.ReadSome(buffer.data(), buffer.size()); | ||
ASSERT_GT(read_size, 0); | ||
ASSERT_TRUE(std::any_of(buffer.cbegin(), buffer.cend(), | ||
[](std::uint8_t byte) { return byte != 0; })); | ||
} | ||
} // namespace test | ||
} // namespace detail | ||
} // namespace databento |
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,32 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include <cstddef> | ||
#include <cstdint> | ||
#include <memory> | ||
|
||
#include "databento/detail/file_stream.hpp" | ||
#include "databento/detail/zstd_stream.hpp" | ||
#include "databento/enums.hpp" | ||
#include "databento/ireadable.hpp" | ||
#include "databento/record.hpp" | ||
|
||
namespace databento { | ||
namespace detail { | ||
namespace test { | ||
TEST(ZstdStreamTests, TestMultiFrameFiles) { | ||
constexpr auto kRecordCount = 8; | ||
const std::string file_path = | ||
TEST_BUILD_DIR "/data/multi-frame.definition.zst"; | ||
|
||
databento::detail::ZstdStream target{std::unique_ptr<databento::IReadable>{ | ||
new databento::detail::FileStream{file_path}}}; | ||
for (std::size_t i = 0; i < kRecordCount; ++i) { | ||
databento::InstrumentDefMsg def_msg; | ||
target.ReadExact(reinterpret_cast<std::uint8_t*>(&def_msg), | ||
sizeof(def_msg)); | ||
EXPECT_EQ(def_msg.hd.rtype, databento::rtype::InstrumentDef); | ||
} | ||
} | ||
} // namespace test | ||
} // namespace detail | ||
} // namespace databento |