-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_parse.cpp
More file actions
43 lines (39 loc) · 847 Bytes
/
test_parse.cpp
File metadata and controls
43 lines (39 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Created by yangning on 18-1-14.
//
// Descriprion :
//
// Copyright (c) yangning All rights reserved.
//
const char json[] = "BEGIN{ \"cmd\" : 1,\"cmd_info\" : \"hello\"}END";
#include "gtest/gtest.h"
#include "Session.h"
class TestSession : public ::testing::Test {
protected:
//第一个case执行前执行
static void SetUpTestCase()
{
}
//SetUp()方法在每个TestCase之前执行
virtual void SetUp()
{
}
// TearDown()方法在每个TestCase之后执行
virtual void TearDown()
{
}
static void TearDownTestCase()
{
// std::cout << "after test case\n";
}
net::SocketBuf buf_;
Session session_;
};
TEST_F(TestSession,parse)
{
buf_.append(json);
session_.parse(&buf_);
buf_.resetBuffer();
buf_.append("BEGINEND");
session_.parse(&buf_);
}