applejuzi 2007-7-24 10:49
再谈三角形问题
我也看到了论坛中有很多关于三角形问题的帖子,我看到了对于该问题有多种答案,所以不知道 哪种更好,更准确。下面我就把我看到的答案帖出来。大家相互讨论。
题:
[color=#000000][font=宋体][size=10pt]某程序规定:[/size][/font][font=Verdana][size=10pt]"[/size][/font][font=宋体][size=10pt]输入三个整数[/size][/font][font=Verdana][size=10pt] a [/size][/font][font=宋体][size=10pt]、[/size][/font][font=Verdana][size=10pt] b [/size][/font][font=宋体][size=10pt]、[/size][/font][font=Verdana][size=10pt] c [/size][/font][font=宋体][size=10pt]分别作为三边的边长构成三角形。通过程序判定所构成的三角形的类型,当此三角形为一般三角形、等腰三角形及等边三角形时,分别作计算[/size][/font][font=Verdana][size=10pt] … "[/size][/font][font=宋体][size=10pt]。用等价类划分方法为该程序进行测试用例设计。[/size][/font][/color]
答案一:
[align=left][align=left][font=宋体][size=10pt][color=#000000]分析题目中给出和隐含的对输入条件的要求:[/color][/size][/font][color=#000000]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]1[/size][/font][font=宋体][size=10pt])整数[/size][/font]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]2[/size][/font][font=宋体][size=10pt])三个数[/size][/font]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]3[/size][/font][font=宋体][size=10pt])非零数[/size][/font]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]4[/size][/font][font=宋体][size=10pt])正数[/size][/font][/color][color=#000000]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]5[/size][/font][font=宋体][size=10pt])两边之和大于第三边[/size][/font]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]6[/size][/font][font=宋体][size=10pt])等腰[/size][/font]
[font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt]7[/size][/font][font=宋体][size=10pt])等边[/size][/font][/color][color=#000000]
[font=宋体][size=10pt]如果[/size][/font][font=Verdana][size=10pt] a [/size][/font][font=宋体][size=10pt]、[/size][/font][font=Verdana][size=10pt] b [/size][/font][font=宋体][size=10pt]、[/size][/font][font=Verdana][size=10pt] c [/size][/font][font=宋体][size=10pt]满足条件([/size][/font][font=Verdana][size=10pt] 1 [/size][/font][font=宋体][size=10pt])[/size][/font][font=Verdana][size=10pt] ~ [/size][/font][font=宋体][size=10pt]([/size][/font][font=Verdana][size=10pt] 4 [/size][/font][font=宋体][size=10pt]),则输出下列四种情况之一:[/size][/font][/color][font=Verdana][size=10pt]
[color=#000000] 1)[/color][/size][/font][color=#000000][font=宋体][size=10pt]如果不满足条件([/size][/font][font=Verdana][size=10pt]5[/size][/font][font=宋体][size=10pt]),则程序输出为[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]非三角形[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]。[/size][/font][/color][font=Verdana][size=10pt]
[color=#000000] 2)[/color][/size][/font][color=#000000][font=宋体][size=10pt]如果三条边相等即满足条件([/size][/font][font=Verdana][size=10pt]7[/size][/font][font=宋体][size=10pt]),则程序输出为[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]等边三角形[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]。[/size][/font][/color][font=Verdana][size=10pt]
[color=#000000] 3)[/color][/size][/font][color=#000000][font=宋体][size=10pt]如果只有两条边相等、即满足条件([/size][/font][font=Verdana][size=10pt]6[/size][/font][font=宋体][size=10pt]),则程序输出为[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]等腰三角形[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]。[/size][/font][/color][font=Verdana][size=10pt]
[color=#000000] 4)[/color][/size][/font][color=#000000][font=宋体][size=10pt]如果三条边都不相等,则程序输出为[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]一般三角形[/size][/font][font=Verdana][size=10pt] " [/size][/font][font=宋体][size=10pt]。[/size][/font][/color][color=#000000]
[font=宋体][size=10pt]列出等价类表并编号[/size][/font][/color][/align][/align][align=left][align=left][color=#000000]
[/color][font=Verdana][size=10pt][/size][/font] [/align][/align]
applejuzi 2007-7-24 10:50
覆盖有效等价类的测试用例:
a b c 覆盖等价类号码
3 4 5 (1)--(7)
4 4 5 (1)--(7),(8)
4 5 5 (1)--(7),(9)
5 4 5 (1)--(7),(10)
4 4 4 (1)--(7),(11)
覆盖无效等价类的测试用例:
applejuzi 2007-7-24 10:53
答案二:
[font=Wingdings][size=9pt][b]n
[/b][/size][/font][font=宋体][size=9pt][b]我们可以设三角形的[/b][/size][/font][font=Tahoma][size=9pt][b]3[/b][/size][/font][font=宋体][size=9pt][b]条边分别为[/b][/size][/font][font=Tahoma][size=9pt][b]A[/b][/size][/font][font=宋体][size=9pt][b],[/b][/size][/font][font=Tahoma][size=9pt][b]B[/b][/size][/font][font=宋体][size=9pt][b],[/b][/size][/font][font=Tahoma][size=9pt][b]C[/b][/size][/font][font=宋体][size=9pt][b]。如果它们能够构成三角形的[/b][/size][/font][font=Tahoma][size=9pt][b]3[/b][/size][/font][font=宋体][size=9pt][b]条边,必须满足:[/b][/size][/font][font=Tahoma][size=9pt][b][/b][/size][/font]
[font=Wingdings][size=9pt][b]n
[/b][/size][/font][font=Tahoma][size=9pt][b]A>0[/b][/size][/font][font=宋体][size=9pt][b],[/b][/size][/font][font=Tahoma][size=9pt][b]B>0[/b][/size][/font][font=宋体][size=9pt][b],[/b][/size][/font][font=Tahoma][size=9pt][b]C>0[/b][/size][/font][font=宋体][size=9pt][b],且[/b][/size][/font][font=Tahoma][size=9pt][b]A+B>C[/b][/size][/font][font=宋体][size=9pt][b],[/b][/size][/font][font=Tahoma][size=9pt][b]B+C>A[/b][/size][/font][font=宋体][size=9pt][b],[/b][/size][/font][font=Tahoma][size=9pt][b]A+C>B[/b][/size][/font][font=宋体][size=9pt][b]。[/b][/size][/font][font=Tahoma][size=9pt][b][/b][/size][/font]
[font=Wingdings][size=9pt][b]n
[/b][/size][/font][font=宋体][size=9pt][b]如果是等腰的,还要判断[/b][/size][/font][font=Tahoma][size=9pt][b]A=B[/b][/size][/font][font=宋体][size=9pt][b],或[/b][/size][/font][font=Tahoma][size=9pt][b]B=C[/b][/size][/font][font=宋体][size=9pt][b],或[/b][/size][/font][font=Tahoma][size=9pt][b]A=C[/b][/size][/font][font=宋体][size=9pt][b]。[/b][/size][/font][font=Tahoma][size=9pt][b][/b][/size][/font]
[font=Wingdings][size=9pt][b]n
[/b][/size][/font][font=宋体][size=9pt][b]如果是等边的,则需判断是否[/b][/size][/font][font=Tahoma][size=9pt][b]A=B[/b][/size][/font][font=宋体][size=9pt][b],且[/b][/size][/font][font=Tahoma][size=9pt][b]B=C[/b][/size][/font][font=宋体][size=9pt][b],且[/b][/size][/font][font=Tahoma][size=9pt][b]A=C[/b][/size][/font][font=宋体][size=9pt][b]。[/b][/size][/font][font=Tahoma][size=9pt][b][/b][/size][/font]
[table=518][tr][td=1,1,142][size=3][color=#000000][font=宋体]输入条件[/font][/color][/size]
[/td][td=1,1,204][size=3][color=#000000][font=宋体]有效等价类[/font][/color][/size]
[/td][td=1,1,174][size=3][color=#000000][font=宋体]无效等价类[/font][/color][/size]
[/td][/tr][tr][td=1,1,142][size=3][color=#000000][font=宋体]是否三角形的三条边[/font][/color][/size]
[/td][td=1,1,204][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A>0[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]B>0[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]2[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]C>0[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]3[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A+B>C[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]4[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]B+C>A[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]5[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A+C>B[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]6[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,1,174][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A[/font][/b][font=宋体]≤[/font][b][font=Times New Roman]0[/font][/b][font=宋体]),[/font][b][font=Times New Roman]
[/font][/b][font=宋体]([/font][b][font=Times New Roman]7[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]B[/font][/b][font=宋体]≤[/font][b][font=Times New Roman]0[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]8[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]C[/font][/b][font=宋体]≤[/font][b][font=Times New Roman]0[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]9[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A+B[/font][/b][font=宋体]≤[/font][b][font=Times New Roman]C[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]10[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]B+C[/font][/b][font=宋体]≤[/font][b][font=Times New Roman]A[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]11[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A+C[/font][/b][font=宋体]≤[/font][b][font=Times New Roman]B[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]12[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,142][size=3][color=#000000][font=宋体]是否等腰三角形[/font][/color][/size]
[/td][td=1,1,204][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A=B[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]13[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]B=C[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]14[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]C=A[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]15[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,1,174][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A[/font][/b][font=宋体]≠[/font][b][font=Times New Roman]B[/font][/b][font=宋体])[/font][b][font=Times New Roman]and[/font][/b][font=宋体]([/font][b][font=Times New Roman]B[/font][/b][font=宋体]≠[/font][b][font=Times New Roman]C[/font][/b][font=宋体])[/font][b][font=Times New Roman]and[/font][/b][font=宋体]([/font][b][font=Times New Roman]C[/font][/b][font=宋体]≠[/font][b][font=Times New Roman]A[/font][/b][font=宋体])[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]16[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,142][size=3][color=#000000][font=宋体]是否等边三角形[/font][/color][/size]
[/td][td=1,1,204][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A=B[/font][/b][font=宋体])[/font][b][font=Times New Roman]and[/font][/b][font=宋体]([/font][b][font=Times New Roman]B=C[/font][/b][font=宋体])[/font][b][font=Times New Roman]and[/font][/b][font=宋体]([/font][b][font=Times New Roman]C=A[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]17[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,1,174][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]A[/font][/b][font=宋体]≠[/font][b][font=Times New Roman]B[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]18[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]B[/font][/b][font=宋体]≠[/font][b][font=Times New Roman]C[/font][/b][font=宋体]),[/font][b][font=Times New Roman]
[/font][/b][font=宋体]([/font][b][font=Times New Roman]19[/font][/b][font=宋体])[/font][b][/b][/color][/size]
[size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]C[/font][/b][font=宋体]≠[/font][b][font=Times New Roman]A[/font][/b][font=宋体]),[/font][b][font=Times New Roman] [/font][/b][font=宋体]([/font][b][font=Times New Roman]20[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][/table]
applejuzi 2007-7-24 10:57
[table=518][tr][td=1,1,36][size=3][color=#000000][font=宋体]序号[/font][/color][/size]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]A[/font][/b][font=宋体],[/font][b][font=Times New Roman]B[/font][/b][font=宋体],[/font][b][font=Times New Roman]C[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]覆盖等价类[/font][/color][/size]
[/td][td=1,1,91][size=3][color=#000000][font=宋体]输出[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]1[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体],[/font][b][font=Times New Roman]5[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,1,91][size=3][color=#000000][font=宋体]一般三角形[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]2[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]0[/font][/b][font=宋体],[/font][b][font=Times New Roman]1[/font][/b][font=宋体],[/font][b][font=Times New Roman]2[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]7[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,6,91][size=3][color=#000000][font=宋体]不能构成三角形[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]3[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]1[/font][/b][font=宋体],[/font][b][font=Times New Roman]0[/font][/b][font=宋体],[/font][b][font=Times New Roman]2[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]8[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]4[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]1[/font][/b][font=宋体],[/font][b][font=Times New Roman]2[/font][/b][font=宋体],[/font][b][font=Times New Roman]0[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]9[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]5[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]1[/font][/b][font=宋体],[/font][b][font=Times New Roman]2[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]10[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]6[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]1[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]2[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]11[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]7[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]1[/font][/b][font=宋体],[/font][b][font=Times New Roman]2[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]12[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]8[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]13[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,3,91][size=3][color=#000000][font=宋体]等腰三角形[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][font=Times New Roman][size=3][color=#000000][b]9[/b][/color][/size][/font]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]14[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][size=3][color=#000000][font=Times New Roman][b]10[/b][/font][/color][/size]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]15[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][size=3][color=#000000][font=Times New Roman][b]11[/b][/font][/color][/size]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体],[/font][b][font=Times New Roman]5[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]16[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,1,91][font=宋体][size=3][color=#000000]非等腰三角形[/color][/size][/font]
[/td][/tr][/table]
applejuzi 2007-7-24 10:58
[table=518][tr][td=1,1,36][b][font=Times New Roman][size=3][color=#000000]12[/color][/size][/font][/b]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]17[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,1,91][font=宋体][size=3][color=#000000]是等边三角形[/color][/size][/font]
[/td][/tr][tr][td=1,1,36][b][font=Times New Roman][size=3][color=#000000]13[/color][/size][/font][/b]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]14[/font][/b][font=宋体]),([/font][b][font=Times New Roman]18[/font][/b][font=宋体])[/font][/color][/size]
[/td][td=1,3,91][font=宋体][size=3][color=#000000]非等边三角形[/color][/size][/font]
[/td][/tr][tr][td=1,1,36][b][font=Times New Roman][size=3][color=#000000]14[/color][/size][/font][/b]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]15[/font][/b][font=宋体]),([/font][b][font=Times New Roman]19[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][tr][td=1,1,36][b][font=Times New Roman][size=3][color=#000000]15[/color][/size][/font][/b]
[/td][td=1,1,79][size=3][color=#000000][font=宋体]【[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]3[/font][/b][font=宋体],[/font][b][font=Times New Roman]4[/font][/b][font=宋体]】[/font][/color][/size]
[/td][td=1,1,315][size=3][color=#000000][font=宋体]([/font][b][font=Times New Roman]1[/font][/b][font=宋体]),([/font][b][font=Times New Roman]2[/font][/b][font=宋体]),([/font][b][font=Times New Roman]3[/font][/b][font=宋体]),([/font][b][font=Times New Roman]4[/font][/b][font=宋体]),([/font][b][font=Times New Roman]5[/font][/b][font=宋体]),([/font][b][font=Times New Roman]6[/font][/b][font=宋体]),([/font][b][font=Times New Roman]13[/font][/b][font=宋体]),([/font][b][font=Times New Roman]20[/font][/b][font=宋体])[/font][/color][/size]
[/td][/tr][/table]
[font=Times New Roman][size=3][color=#000000] 本人更倾向于答案一。不过,对于其中的那个无效类:非整数,为何不再具体划分为小数、字符等。请各位高手指点。[/color][/size][/font]
tianbudong 2007-7-24 16:51
好,同意
dragon2007 2007-8-3 16:03
分析的很详细!!
分析的很详细!!分析的很详细!!分析的很详细!!分析的很详细!!
hyq828 2007-8-16 16:41
我觉的其实也可以把无效等价类细分成小数和字符了。这主要看你怎么拆分等价类了
lsb5211314 2007-9-15 14:38
受教了,不错,努力学习,顶一下!
flying-clouds 2007-9-15 19:24
分析的真好
Suran2004 2007-9-17 17:00
非常感谢楼主对这道题目做了一个这么好的总结。。。不错!!
zhouzxcv 2007-9-17 23:17
一、 输入和输出条件
输入:
条件1:1<=a<=200
条件2:1<=b<=200
条件3:1<=c<=200
条件4:a<b+c
条件5:b<a+c
条件6:c<b+a
输出:
输出1:提示输入的数据有误
输出2:等边三角形
输出3:等腰三角形
输出4:不等边三角形
输出5::非三角形
二、判别表
输入
条件1 F T T T T T T T T
条件2 F T T T T T T T
条件3 T F T T T T T T
条件4 T T F T T T
条件5 T F T T T T
条件6 F T T T T T
输出
输出1 X X X
输出2 X
输出3 X
输出4 X
输出5 X X X
三、用例
输入不合法的情况有:超出[1,200]范围
浮点数
字符
空
我的思路,用例没写
[[i] 本帖最后由 zhouzxcv 于 2007-9-17 23:19 编辑 [/i]]
zqdl 2007-10-31 10:59
分析的太详细拉,学习!!!!
kenanmao1983 2007-10-31 15:43
非常感谢!
aaliujing 2007-12-24 17:12
呵呵,三角形的问题太经典了~
感觉平时我写的用例分析不全面~
主要是这种设计思想没有~
呵呵~
加油中~
ilovecinema 2008-5-4 19:33
刚学测试,布置的作业也是这个:)
1997goodluck 2008-5-4 22:14
方法一更好一些,不过我认为非整形能不能在分为小数,字母,特殊字符和汉字
I_hui 2008-5-5 01:36
写测试用例,思想最重要,我所欠缺的就是这种思想。。。
wanghaiping1111 2008-5-6 12:04
回复 5# 的帖子
我个人觉得第二种分析方法也分析的不错,只是判断非等腰三角形和非等边三角形有重复,如果是三角形的话,不是等边三角形或等腰三角形,那应该就是一般三角形。
wanghaiping1111 2008-5-6 12:05
因为后面的条件前面一般三角形都已经覆盖了:lol
wanghaiping1111 2008-5-6 12:07
[quote]原帖由 [i]hyq828[/i] 于 2007-8-16 16:41 发表 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=664278&ptid=83967][img]http://bbs.51testing.com/images/common/back.gif[/img][/url]
我觉的其实也可以把无效等价类细分成小数和字符了。这主要看你怎么拆分等价类了 [/quote]
人家已经说了三个整数,所以我觉得在无效等价类不用考虑小数和字符了
lht248382830 2008-5-28 08:59
不错,之前也做过
iisgood 2008-6-6 13:06
第二个,无效等价类划分的是不是不够细?
我觉的负数至少得考虑进去!
mrxangel1986 2008-6-9 23:42
对于其中的那个无效类:非整数,为何不再具体划分为小数、字符
要看你是否测试的更深了
mrxangel1986 2008-6-9 23:42
把握测试的度,,,,
清V闲 2008-6-10 20:07
:) 借鉴借鉴
页:
[1]