Skip to content

Commit

Permalink
Catch: named sections of n-way tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Oct 3, 2024
1 parent 5a2a9bb commit 9e81f57
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
3 changes: 0 additions & 3 deletions C/tests/c4Test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ C4Test::C4Test(int num) : _storage(kC4SQLiteStorageEngine) { // NOLINT(cppcoreg
memcpy(_dbConfig.encryptionKey.bytes, "this is not a random key at all.", kC4EncryptionKeySizeAES256);
}

fprintf(stderr, " --- %s %s\n", ((_dbConfig.flags & kC4DB_VersionVectors) ? "Version-vectors" : "Rev-trees"),
(_dbConfig.encryptionKey.algorithm ? ", Encrypted" : ""));

C4Error error;
if ( !c4db_deleteNamed(kDatabaseName, _dbConfig.parentDirectory, ERROR_INFO(&error)) ) REQUIRE(error.code == 0);
db = c4db_openNamed(kDatabaseName, &_dbConfig, ERROR_INFO(&error));
Expand Down
3 changes: 3 additions & 0 deletions C/tests/c4Test.hh
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,18 @@ class C4Test {
#if defined(COUCHBASE_ENTERPRISE)
# if SkipVersionVectorTest
static constexpr int numberOfOptions = 2; // rev-tree, rev-tree encrypted
static constexpr const char* nameOfOption[numberOfOptions] = { "RevTree", "EncryptedRevTree" };
# else
static constexpr int numberOfOptions = 3; // rev-tree, version vector, rev-tree encrypted
static constexpr const char* nameOfOption[numberOfOptions] = { "RevTree", "VersionVector", "EncryptedRevTree" };
# endif
#else
# if SkipVersionVectorTest
static constexpr int numberOfOptions = 1; // rev-tree
# else
static constexpr int numberOfOptions = 2; // rev-tree, version vector
# endif
static constexpr const char* nameOfOption[2] = { "RevTree", "VersionVector" };
#endif

static std::string sFixturesDir; // directory where test files live
Expand Down
1 change: 1 addition & 0 deletions LiteCore/tests/DataFileTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ using namespace std;
class KeyStoreTestFixture : public DataFileTestFixture {
public:
static constexpr int numberOfOptions = 2;
static constexpr const char* nameOfOption[numberOfOptions] = { "SQLiteKeyStore", "BothKeyStore" };

KeyStoreTestFixture(int option) {
if ( int(option) == 0 ) {
Expand Down
3 changes: 2 additions & 1 deletion LiteCore/tests/QueryTest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ using namespace fleece::impl;
class QueryTest : public DataFileTestFixture {
public:
static constexpr int numberOfOptions = 5;
static constexpr const char* nameOfOption[numberOfOptions] = { "Collection `_default`", "Collection `_`", "Collection `Secondary`",
"Collection `_default.Secondary`", "Collection `scopey.subsidiary`"};

string collectionName;
int option{0};
Expand All @@ -44,7 +46,6 @@ class QueryTest : public DataFileTestFixture {
explicit QueryTest(int opt = 0) : option(opt) {
Assert(option < numberOfOptions, "Test option out of valid range");
collectionName = kCollectionNameOptions[option];
logSection(stringprintf("Collection `%s`", collectionName.c_str()));
if ( slice keyStoreName = kKeyStoreNameOptions[option] ) store = &db->getKeyStore(keyStoreName);
}

Expand Down
1 change: 1 addition & 0 deletions LiteCore/tests/SQLiteFunctionsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SQLiteFunctionsTest
, DataFile::Delegate {
public:
static constexpr int numberOfOptions = 2;
static constexpr const char* nameOfOption[numberOfOptions] = { "No SharedKeys", "With SharedKeys" };

explicit SQLiteFunctionsTest(int which) : db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE) {
// Run test once with shared keys, once without:
Expand Down
3 changes: 1 addition & 2 deletions REST/tests/RESTClientTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ class RESTClientTest : public ReplicatorAPITest {
#else
static constexpr int numberOfOptions = 1;
#endif
static constexpr const char* nameOfOption[2] = {"No proxy", "HTTP proxy"};

explicit RESTClientTest(int option) : ReplicatorAPITest() {
if ( option == 0 ) {
_sg.proxy = nullptr;
fprintf(stderr, " --- No proxy ---\n");
} else if ( option == 1 ) {
if ( _sg.proxy ) _sg.proxy = make_unique<ProxySpec>(ProxyType::HTTP, "localhost"_sl, uint16_t(8888));
fprintf(stderr, " --- HTTP proxy ---\n");
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion vendor/fleece

0 comments on commit 9e81f57

Please sign in to comment.