Skip to content

Commit

Permalink
Add more serialization tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
PengZheng committed Jan 19, 2024
1 parent 782325e commit 7f1391d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions libs/dfi/gtest/src/json_serializer_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,41 @@ TEST_F(JsonSerializerTests, WriteSequenceFailed) {
writeSequenceFailed();
}

TEST_F(JsonSerializerTests, WriteSequenceFailed2) {
dyn_type* type = nullptr;
char* result = nullptr;
int rc = dynType_parseWithStr(R"([**D)", nullptr, nullptr, &type);
ASSERT_EQ(0, rc);
double** input[] = {nullptr};
struct {
uint32_t cap;
uint32_t len;
double*** buf;
}seq{1,1,input};
rc = jsonSerializer_serialize(type, &seq, &result);
ASSERT_EQ(1, rc);
celix_err_printErrors(stderr, nullptr, nullptr);
dynType_destroy(type);
}

TEST_F(JsonSerializerTests, WriteComplexFailed) {
writeComplexFailed();
}

TEST_F(JsonSerializerTests, WriteComplexFailed2) {
dyn_type *type = nullptr;
char *result = nullptr;
int rc = dynType_parseWithStr(R"({**D a})", nullptr, nullptr, &type);
ASSERT_EQ(0, rc);
struct {
double** a;
}input{nullptr};
rc = jsonSerializer_serialize(type, &input, &result);
ASSERT_EQ(1, rc);
celix_err_printErrors(stderr, nullptr, nullptr);
dynType_destroy(type);
}

TEST_F(JsonSerializerTests, WriteEnumFailed) {
writeEnumFailed();
}
Expand Down

0 comments on commit 7f1391d

Please sign in to comment.