This commit is contained in:
David Given
2024-05-14 21:41:30 +02:00

View File

@@ -37,11 +37,39 @@ namespace
}; };
} }
static std::ostream& operator<<(std::ostream& stream, const Bytes& bytes) namespace snowhouse
{ {
stream << '\n'; template <>
hexdump(stream, bytes); struct Stringizer<std::vector<bool>>
return stream; {
static std::string ToString(const std::vector<bool>& vector)
{
std::stringstream stream;
stream << '{';
bool first = true;
for (const auto& item : vector)
{
if (!first)
stream << ", ";
stream << item;
first = false;
}
stream << '}';
return stream.str();
}
};
template <>
struct Stringizer<Bytes>
{
static std::string ToString(const Bytes& bytes)
{
std::stringstream stream;
stream << '\n';
hexdump(stream, bytes);
return stream.str();
}
};
} }
static Bytes createDirent(const std::string& filename, static Bytes createDirent(const std::string& filename,
@@ -154,6 +182,7 @@ static void testBitmap()
Equals(std::vector<bool>{ Equals(std::vector<bool>{
1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})); 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}));
} }
#if 0
static void testPutGet() static void testPutGet()
{ {
@@ -271,6 +300,7 @@ static void testPutMetadata()
createDirent("FILE2", 0, 1, {19}))); createDirent("FILE2", 0, 1, {19})));
} }
#endif
int main(void) int main(void)
{ {
try try
@@ -306,12 +336,14 @@ int main(void)
testPartialExtent(); testPartialExtent();
testLogicalExtents(); testLogicalExtents();
#if 0
testBitmap(); testBitmap();
testPutGet(); testPutGet();
testPutBigFile(); testPutBigFile();
testDelete(); testDelete();
testMove(); testMove();
testPutMetadata(); testPutMetadata();
#endif
} }
catch (const ErrorException& e) catch (const ErrorException& e)
{ {