-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2399ef0
commit 4a8a27c
Showing
5 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "util/tc_common.h" | ||
#include "util/tc_mysql.h" | ||
#include "gtest/gtest.h" | ||
|
||
#include <iostream> | ||
#include <vector> | ||
|
||
using namespace std; | ||
using namespace tars; | ||
|
||
class UtilMysqlTest : public testing::Test | ||
{ | ||
public: | ||
//添加日志 | ||
static void SetUpTestCase() | ||
{ | ||
} | ||
static void TearDownTestCase() | ||
{ | ||
} | ||
virtual void SetUp() //TEST跑之前会执行SetUp | ||
{ | ||
} | ||
virtual void TearDown() //TEST跑完之后会执行TearDown | ||
{ | ||
} | ||
}; | ||
|
||
#ifdef TARS_MYSQL | ||
|
||
TEST_F(UtilMysqlTest, test80) | ||
{ | ||
try | ||
{ | ||
TC_Mysql mysql; | ||
|
||
mysql.init("127.0.0.1", "root", "123456", "", "utf8", 3307, 0); | ||
|
||
mysql.queryRecord("select 1"); | ||
} | ||
catch(exception &ex) | ||
{ | ||
cerr << ex.what() << endl; | ||
} | ||
|
||
try | ||
{ | ||
TC_Mysql mysql; | ||
|
||
mysql.init("127.0.0.1", "root", "tars@12345", "", "utf8", 3306, 0); | ||
|
||
mysql.queryRecord("select 1"); | ||
|
||
cout << "success" << endl; | ||
} | ||
catch(exception &ex) | ||
{ | ||
cerr << ex.what() << endl; | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters