Skip to content

Commit

Permalink
test_not_support_future_rdb_version
Browse files Browse the repository at this point in the history
  • Loading branch information
moticless committed Apr 15, 2024
1 parent f141073 commit 0ec26ca
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ static void test_empty_rdb(void **state) {
RDB_deleteParser(parser);
}

static void test_not_support_future_rdb_version(void **state) {
UNUSED(state);

const char *rdbfile = DUMP_FOLDER("future_v19.rdb");
const char *jsonfile = TMP_FOLDER("future_v19.json");

RdbStatus status;
RdbParser *parser = RDB_createParserRdb(NULL);
RDB_setLogLevel(parser, RDB_LOG_ERR);
assert_non_null(RDBX_createReaderFile(parser, rdbfile));
RdbxToJsonConf r2jConf = { .level = RDB_LEVEL_DATA };

assert_non_null(RDBX_createHandlersToJson(parser,
jsonfile,
&r2jConf));

while ((status = RDB_parse(parser)) == RDB_STATUS_WAIT_MORE_DATA);
assert_int_equal( status, RDB_STATUS_ERROR);

/* verify returned error code */
RdbRes err = RDB_getErrorCode(parser);
assert_int_equal(err, RDB_ERR_UNSUPPORTED_RDB_VERSION);

RDB_deleteParser(parser);
}

static void test_mixed_levels_registration(void **state) {
UNUSED(state);
const char *rdbfile = DUMP_FOLDER("multiple_lists_strings.rdb");
Expand Down Expand Up @@ -153,6 +179,7 @@ int group_misc(void) {
cmocka_unit_test(test_empty_rdb),
cmocka_unit_test(test_mixed_levels_registration),
cmocka_unit_test(test_checksum),
cmocka_unit_test(test_not_support_future_rdb_version),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}
Expand Down

0 comments on commit 0ec26ca

Please sign in to comment.