Added test cases for resizing blobs
This commit is contained in:
parent
8b7a76c38a
commit
f834f8892d
@ -1,8 +0,0 @@
|
||||
#include "testutils/BlobStoreTest.h"
|
||||
|
||||
class BlobOnBlocksTest: public BlobStoreTest {};
|
||||
|
||||
TEST_F(BlobOnBlocksTest, CreatedBlobIsEmpty) {
|
||||
auto blob = blobStore->create();
|
||||
EXPECT_EQ(0, blob->size());
|
||||
}
|
58
test/implementations/onblocks/BlobResizeTest.cpp
Normal file
58
test/implementations/onblocks/BlobResizeTest.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "testutils/BlobStoreTest.h"
|
||||
|
||||
using std::unique_ptr;
|
||||
|
||||
using namespace blobstore;
|
||||
|
||||
class BlobResizeTest: public BlobStoreTest {
|
||||
public:
|
||||
BlobResizeTest(): blob(blobStore->create()) {}
|
||||
|
||||
static constexpr uint32_t LARGE_SIZE = 10 * 1024 * 1024;
|
||||
|
||||
unique_ptr<Blob> blob;
|
||||
};
|
||||
constexpr uint32_t BlobResizeTest::LARGE_SIZE;
|
||||
|
||||
TEST_F(BlobResizeTest, CreatedBlobIsEmpty) {
|
||||
EXPECT_EQ(0, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, Growing_1Byte) {
|
||||
blob->resize(1);
|
||||
EXPECT_EQ(1, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, Growing_Large) {
|
||||
blob->resize(LARGE_SIZE);
|
||||
EXPECT_EQ(LARGE_SIZE, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, Shrinking_Empty) {
|
||||
blob->resize(LARGE_SIZE);
|
||||
blob->resize(0);
|
||||
EXPECT_EQ(0, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, Shrinking_1Byte) {
|
||||
blob->resize(LARGE_SIZE);
|
||||
blob->resize(1);
|
||||
EXPECT_EQ(1, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, ResizingToItself_Empty) {
|
||||
blob->resize(0);
|
||||
EXPECT_EQ(0, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, ResizingToItself_1Byte) {
|
||||
blob->resize(1);
|
||||
blob->resize(1);
|
||||
EXPECT_EQ(1, blob->size());
|
||||
}
|
||||
|
||||
TEST_F(BlobResizeTest, ResizingToItself_Large) {
|
||||
blob->resize(LARGE_SIZE);
|
||||
blob->resize(LARGE_SIZE);
|
||||
EXPECT_EQ(LARGE_SIZE, blob->size());
|
||||
}
|
@ -6,7 +6,7 @@ class BlobStoreTest: public ::testing::Test {
|
||||
public:
|
||||
BlobStoreTest();
|
||||
|
||||
static constexpr uint32_t BLOCKSIZE_BYTES = 256;
|
||||
static constexpr uint32_t BLOCKSIZE_BYTES = 4096;
|
||||
|
||||
std::unique_ptr<blobstore::BlobStore> blobStore;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user