mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
native-test: the GoogleTest tests' functions documented (doc_check)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSgB6M9Vp9dEP1haEE
This commit is contained in:
2 files changed
+10
No files matched your search
@@ -105,6 +105,7 @@ int wait_line()
|
||||
return fd;
|
||||
}
|
||||
|
||||
/* dmodem_config_init(): SIP on 5060, T.38 on, a peer line's lead 100 ms */
|
||||
TEST(CApi, Defaults)
|
||||
{
|
||||
dmodem_config c;
|
||||
@@ -114,6 +115,7 @@ TEST(CApi, Defaults)
|
||||
EXPECT_EQ(c.peer_lead_ms, 100);
|
||||
}
|
||||
|
||||
/* the header's types and calls from C (c_api_header.c) */
|
||||
TEST(CApi, HeaderAsC)
|
||||
{
|
||||
EXPECT_EQ(c_api_header_from_c(), 0);
|
||||
@@ -126,6 +128,7 @@ protected:
|
||||
dmodem_config c;
|
||||
int dte = -1;
|
||||
|
||||
/* the callbacks, once for the suite */
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
dmodem_callbacks cb = {};
|
||||
@@ -137,6 +140,7 @@ protected:
|
||||
dmodem_set_callbacks(&cb);
|
||||
}
|
||||
|
||||
/* what was reported cleared; the engine started on a peer line */
|
||||
void SetUp() override
|
||||
{
|
||||
pthread_mutex_lock(&mu);
|
||||
@@ -155,6 +159,7 @@ protected:
|
||||
ASSERT_TRUE(dmodem_running());
|
||||
}
|
||||
|
||||
/* the DTE closed, the modem ended and stopped */
|
||||
void TearDown() override
|
||||
{
|
||||
if (dte >= 0)
|
||||
@@ -165,11 +170,13 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
/* a second start refused while it runs */
|
||||
TEST_F(CApiTest, SecondStartRefused)
|
||||
{
|
||||
EXPECT_LT(dmodem_start(&c), 0);
|
||||
}
|
||||
|
||||
/* ATE0: OK; ATI3: the peer line's driver */
|
||||
TEST_F(CApiTest, AnswersAtCommands)
|
||||
{
|
||||
put(dte, "ATE0\r");
|
||||
@@ -223,6 +230,7 @@ TEST_F(CApiTest, EndsWhenTheDteCloses)
|
||||
|
||||
} // namespace
|
||||
|
||||
/* the tests (SIGPIPE ignored: the line's fd closed under the modem) */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
@@ -221,6 +221,7 @@ protected:
|
||||
int pty = -1, app = -1;
|
||||
pid_t dm = -1;
|
||||
|
||||
/* what was reported cleared; a dmodemd of its own, answering (ATS0=1) */
|
||||
void SetUp() override
|
||||
{
|
||||
{
|
||||
@@ -242,6 +243,7 @@ protected:
|
||||
ASSERT_TRUE(expect(pty, "OK", 5)) << "dmodemd: ATS0=1";
|
||||
}
|
||||
|
||||
/* the engine stopped, the app's end closed, dmodemd gone; the log if it failed */
|
||||
void TearDown() override
|
||||
{
|
||||
e.stop();
|
||||
|
||||
Reference in new issue
Block a user