Skip to content

Commit

Permalink
Cover AMF0 codec. 3.0.61
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Oct 22, 2019
1 parent 0a9659b commit aee704f
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions trunk/src/utest/srs_utest_amf0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,14 @@ VOID TEST(ProtocolAMF0Test, InterfacesString)
srs_freep(o);
}

if (true) {
uint8_t data[] = {0x00, 0x00, 0x00};
SrsBuffer b((char*)data, sizeof(data));
SrsAmf0Any* o = SrsAmf0Any::str();
HELPER_EXPECT_SUCCESS(o->write(&b));
srs_freep(o);
}

if (true) {
SrsBuffer b;
SrsAmf0Any* o = SrsAmf0Any::str();
Expand Down Expand Up @@ -1372,6 +1380,14 @@ VOID TEST(ProtocolAMF0Test, InterfacesString)
srs_freep(o);
}

if (true) {
uint8_t data[] = {0x02, 0x00, 0x00};
SrsBuffer b((char*)data, sizeof(data));
SrsAmf0Any* o = SrsAmf0Any::str();
HELPER_EXPECT_SUCCESS(o->read(&b));
srs_freep(o);
}

if (true) {
uint8_t data[] = {0x02, 0x00, 0x01};
SrsBuffer b((char*)data, sizeof(data));
Expand Down Expand Up @@ -1460,6 +1476,14 @@ VOID TEST(ProtocolAMF0Test, InterfacesBoolean)
HELPER_EXPECT_FAILED(o->read(&b));
srs_freep(o);
}

if (true) {
uint8_t data[] = {0x00};
SrsBuffer b((char*)data, sizeof(data));
SrsAmf0Any* o = SrsAmf0Any::boolean();
HELPER_EXPECT_FAILED(o->read(&b));
srs_freep(o);
}
}

VOID TEST(ProtocolAMF0Test, InterfacesNumber)
Expand Down Expand Up @@ -1549,6 +1573,14 @@ VOID TEST(ProtocolAMF0Test, InterfacesNumber)
HELPER_EXPECT_FAILED(o->read(&b));
srs_freep(o);
}

if (true) {
uint8_t data[] = {0x01};
SrsBuffer b((char*)data, sizeof(data));
SrsAmf0Any* o = SrsAmf0Any::number();
HELPER_EXPECT_FAILED(o->read(&b));
srs_freep(o);
}
}

VOID TEST(ProtocolAMF0Test, InterfacesDate)
Expand Down Expand Up @@ -2385,6 +2417,8 @@ VOID TEST(ProtocolAMF0Test, InterfacesError)

VOID TEST(ProtocolAMF0Test, Amf0Object2)
{
srs_error_t err;

if (true) {
SrsAmf0Object* o = SrsAmf0Any::object();
o->set("id", SrsAmf0Any::number(3.0));
Expand Down Expand Up @@ -2434,5 +2468,28 @@ VOID TEST(ProtocolAMF0Test, Amf0Object2)
srs_freep(j);
srs_freep(o);
}

if (true) {
SrsAmf0Any* p = SrsAmf0Any::null();
SrsAmf0Any* cp = p->copy();
EXPECT_TRUE(cp->is_null());
srs_freep(cp);
srs_freep(p);
}

if (true) {
SrsAmf0Any* p = SrsAmf0Any::undefined();
SrsAmf0Any* cp = p->copy();
EXPECT_TRUE(cp->is_undefined());
srs_freep(cp);
srs_freep(p);
}

if (true) {
SrsBuffer b;
SrsAmf0Any* eof = SrsAmf0Any::object_eof();
HELPER_EXPECT_FAILED(srs_amf0_write_object_eof(&b, (SrsAmf0ObjectEOF*)eof));
srs_freep(eof);
}
}

0 comments on commit aee704f

Please sign in to comment.