软件测试(七)

Assignment 7.

Problem

构造下述三角形问题的弱健壮的等价类测试用例。
三角形问题:输入三个不超过100的正整数作为三角形的三条边,判断三角形是等边三角形、等腰不等边三角形、完全不等边三角形还是不能构成三角形。

划分等价类

三角形的三条边记位 S = { a , b , c } S=\{a,b,c\} S={a,b,c},则划分弱健壮性的等价类如下所示

(1) S ⊆ N ∗ S \subseteq \N^{*} SN

(2) S ⊆ Z − N ∗ S \subseteq \Z - \N^{*} SZN

(3) ∀ s ∈ S , s ∈ [ 1 , 100 ] \forall s \in S,s\in[1,100] sS,s[1,100]

(4) ∃ s ∈ S , s ∈ ( − ∞ , 1 ) ∪ ( 100 , + ∞ ) \exist s \in S, s \in (-\infty,1) \cup (100, +\infty) sS,s(,1)(100,+)

(5) a = b = c a=b=c a=b=c

(6) ∃   x 1 ∈ S ,   ∃ x 2 ∈ S − { x 1 } , x 3 ∈ S − { x 1 , x 2 } , ( x 1 ≠ x 3 ) ∧ ( x 1 = x 2 ) \exist \ x_1 \in S, \ \exist x_2 \in S-\{x_1\}, x_3 \in S-\{x_1, x_2\},(x_1 \neq x_3) \wedge (x_1=x_2)  x1S, x2S{x1},x3S{x1,x2},(x1̸=x3)(x1=x2)

(7) a ≠ b ≠ c a \neq b \neq c a̸=b̸=c

(8) ( a + b &lt; = c ) ∨ ( a + c &lt; = b ) ∨ ( b + c &lt; = a ) (a+b&lt;=c) \vee (a+c&lt;=b) \vee (b+c&lt;=a) (a+b<=c)(a+c<=b)(b+c<=a)

输入条件有效等价类无效等价类
输入为正整数(1)(2)
输入的值不超过100(3)(1)
等边三角形(5)(6),(7),(8)
等腰不等边三角形(6)(5),(7),(8)
完全不等边三角形(7)(5),(6),(8)
不能构成三角形(8)(5),(6),(7)

确立测试用例

Test CaseabcExpected Output
WN1555Equilateral
WN2554Isosceles
WN3345Scalene
WN4112Not a triangle
WR5-155Value of a is out of range
WR65-15Value of b is out of range
WR755-1Value of c is out of range
WR810155Value of a is out of range
WR951015Value of b is out of range
WR1055101Value of c is out of range
WR115.155Value of a is not int
WR1255.15Value of b is not int
WR13555.1Value of c is not int
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值