Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaojing.zhang
fmp_vip
Commits
605cfcf6
Commit
605cfcf6
authored
Mar 02, 2018
by
xiaoqing.gu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、TestSession测试用例 2、TestCoupon测试用例
parent
5b8f71e5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
3 deletions
+72
-3
fmp_vip/fmp_vip_i.h
+4
-0
fmvip/task/coupon.h
+10
-0
tests/autotest/autotest.pro
+2
-1
tests/autotest/main.cpp
+1
-0
tests/autotest/tst_coupon.h
+34
-0
tests/autotest/tst_db_query.h
+0
-2
tests/autotest/tst_session.h
+21
-0
No files found.
fmp_vip/fmp_vip_i.h
View file @
605cfcf6
...
...
@@ -19,6 +19,10 @@ public:
connect
(
this
,
&
FMPVipInterface
::
TriggerUninit
,
this
,
&
FMPVipInterface
::
OnTriggerUninit
);
}
bool
isBusy
()
{
return
true
;}
void
pay
()
{}
void
list
()
{}
signals
:
void
TriggerInit
();
void
TriggerUninit
();
...
...
fmvip/task/coupon.h
View file @
605cfcf6
...
...
@@ -12,6 +12,16 @@ class Coupon
public
:
explicit
Coupon
(
QString
name
=
""
,
QString
code
=
""
,
QString
type
=
""
,
double
disAmount
=
0
,
double
limitAmount
=
0
,
QString
limitTime
=
""
,
bool
isCompatible
=
true
);
bool
operator
==
(
const
Coupon
&
rhs
)
{
return
(
this
->
code
().
compare
(
rhs
.
code
())
==
0
);
}
const
bool
operator
==
(
const
Coupon
&
rhs
)
const
{
return
(
this
->
code
().
compare
(
rhs
.
code
())
==
0
);
}
void
paint
(
QPainter
*
painter
,
const
QRect
&
rect
,
const
QPalette
&
palette
)
const
;
QSize
sizeHint
()
const
;
...
...
tests/autotest/autotest.pro
View file @
605cfcf6
...
...
@@ -9,7 +9,8 @@ CONFIG += qt console warn_on depend_includepath testcase
HEADERS
+=
\
tst_db_query
.
h
\
tst_db_create
.
h
\
tst_session
.
h
tst_session
.
h
\
tst_coupon
.
h
SOURCES
+=
main
.
cpp
...
...
tests/autotest/main.cpp
View file @
605cfcf6
#include "tst_db_create.h"
#include "tst_db_query.h"
#include "tst_session.h"
#include "tst_coupon.h"
#include <gtest/gtest.h>
...
...
tests/autotest/tst_coupon.h
0 → 100644
View file @
605cfcf6
#ifndef TST_COUPON_H
#define TST_COUPON_H
#include "coupon.h"
#include <gtest/gtest.h>
using
namespace
testing
;
class
TestCoupon
:
public
::
testing
::
Test
{
};
TEST_F
(
TestCoupon
,
CouponData
)
{
Coupon
c
(
"coupon"
,
"123456789"
,
"vip"
,
10
.
00
,
11
.
00
);
EXPECT_EQ
(
c
.
name
(),
"coupon"
);
EXPECT_EQ
(
c
.
code
(),
"123456789"
);
EXPECT_EQ
(
c
.
typeModeFlag
(),
"vip"
);
EXPECT_EQ
(
c
.
disAmount
(),
10
.
00
);
EXPECT_EQ
(
c
.
limitAmount
(),
11
.
00
);
EXPECT_EQ
(
c
.
isCompatible
(),
true
);
}
TEST_F
(
TestCoupon
,
Operator
)
{
Coupon
c1
(
"coupon"
,
"123456"
,
"vip"
);
Coupon
c2
(
"coupon"
,
"456789"
,
"vip"
);
Coupon
c3
(
"couponCode"
,
"123456"
,
"user"
);
EXPECT_EQ
((
c1
==
c2
),
false
);
EXPECT_EQ
((
c1
==
c3
),
true
);
}
#endif // TST_COUPON_H
tests/autotest/tst_db_query.h
View file @
605cfcf6
...
...
@@ -161,8 +161,6 @@ TEST_F(TestDBQuery, GetCanRefund)
PayList
pays
=
order
->
getCanRefundPatList
();
ASSERT_EQ
(
pays
.
size
(),
4
);
EXPECT_EQ
(
pays
.
first
()
->
refundAmount
(),
50
);
t
.
commit
();
}
catch
(
const
odb
::
exception
&
e
)
{
FAIL
()
<<
"Exception: "
<<
e
.
what
()
<<
std
::
endl
;
}
...
...
tests/autotest/tst_session.h
View file @
605cfcf6
...
...
@@ -33,4 +33,25 @@ TEST_F(TestSession, Clear)
EXPECT_EQ
(
s
.
data
(
"string"
).
toString
(),
""
);
}
TEST_F
(
TestSession
,
GetCouponMap
)
{
Session
s
;
Coupon
c
(
"name"
,
"123456"
,
"1"
);
QMap
<
QString
,
Coupon
>
couponMap
;
couponMap
.
insert
(
"123456"
,
c
);
s
.
addData
(
"map"
,
couponMap
);
EXPECT_EQ
(
s
.
getCouponMap
(
"map"
),
couponMap
);
}
TEST_F
(
TestSession
,
Reset
)
{
Session
s
;
s
.
addData
(
"string"
,
"s"
);
EXPECT_EQ
(
s
.
data
(
"string"
).
toString
(),
"s"
);
s
.
reset
();
EXPECT_EQ
(
s
.
data
(
"string"
).
toString
(),
""
);
EXPECT_EQ
(
s
.
createdTime
(),
QDateTime
::
currentDateTime
());
}
#endif // TST_SESSION_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment