From b2f0e4f959417df26caf2249d25a4d03f67e2bed Mon Sep 17 00:00:00 2001 From: j8takagi Date: Fri, 10 Dec 2010 08:28:10 +0900 Subject: [PATCH] =?utf8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=81=AB?= =?utf8?q?=E3=80=81=E4=B8=89=E8=A7=92=E5=BD=A2=E5=88=A4=E5=AE=9A=E3=83=97?= =?utf8?q?=E3=83=AD=E3=82=B0=E3=83=A9=E3=83=A0=E3=81=A8=E3=81=9D=E3=81=AE?= =?utf8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sample/triangle/Makefile | 9 +++ sample/triangle/test/.gitignore | 6 ++ sample/triangle/test/01_scalene/0.txt | 1 + sample/triangle/test/01_scalene/Makefile | 3 + sample/triangle/test/01_scalene/cmd | 1 + sample/triangle/test/01_scalene/desc.txt | 1 + sample/triangle/test/02_equilateral/0.txt | 1 + .../test/02_equilateral/02_equilateral | 1 + sample/triangle/test/02_equilateral/Makefile | 3 + sample/triangle/test/02_equilateral/cmd | 1 + sample/triangle/test/02_equilateral/desc.txt | 1 + sample/triangle/test/03_isosceles/0.txt | 1 + .../triangle/test/03_isosceles/03_isosceles | 1 + sample/triangle/test/03_isosceles/Makefile | 3 + sample/triangle/test/03_isosceles/cmd | 1 + sample/triangle/test/03_isosceles/desc.txt | 1 + sample/triangle/test/04_isosceles_c/0.txt | 3 + .../test/04_isosceles_c/04_isosceles_c | 1 + sample/triangle/test/04_isosceles_c/Makefile | 3 + sample/triangle/test/04_isosceles_c/cmd | 3 + sample/triangle/test/04_isosceles_c/desc.txt | 1 + sample/triangle/test/05_zero/0.txt | 1 + sample/triangle/test/05_zero/05_zero | 1 + sample/triangle/test/05_zero/Makefile | 3 + sample/triangle/test/05_zero/cmd | 1 + sample/triangle/test/05_zero/desc.txt | 1 + sample/triangle/test/06_minus/0.txt | 1 + sample/triangle/test/06_minus/06_minus | 1 + sample/triangle/test/06_minus/Makefile | 3 + sample/triangle/test/06_minus/cmd | 1 + sample/triangle/test/06_minus/desc.txt | 1 + sample/triangle/test/07_line/0.txt | 1 + sample/triangle/test/07_line/07_line | 1 + sample/triangle/test/07_line/Makefile | 3 + sample/triangle/test/07_line/cmd | 1 + sample/triangle/test/07_line/desc.txt | 1 + sample/triangle/test/08_lines/0.txt | 3 + sample/triangle/test/08_lines/08_lines | 1 + sample/triangle/test/08_lines/Makefile | 3 + sample/triangle/test/08_lines/cmd | 3 + sample/triangle/test/08_lines/desc.txt | 1 + sample/triangle/test/09_less/0.txt | 2 + sample/triangle/test/09_less/09_less | 1 + sample/triangle/test/09_less/Makefile | 3 + sample/triangle/test/09_less/cmd | 2 + sample/triangle/test/09_less/desc.txt | 1 + sample/triangle/test/10_lesses/0.txt | 3 + sample/triangle/test/10_lesses/Makefile | 3 + sample/triangle/test/10_lesses/cmd | 3 + sample/triangle/test/10_lesses/desc.txt | 1 + sample/triangle/test/11_zeroall/0.txt | 1 + sample/triangle/test/11_zeroall/11_zeroall | 1 + sample/triangle/test/11_zeroall/Makefile | 3 + sample/triangle/test/11_zeroall/cmd | 1 + sample/triangle/test/11_zeroall/desc.txt | 1 + sample/triangle/test/12_notint/0.txt | 1 + sample/triangle/test/12_notint/12_notint | 1 + sample/triangle/test/12_notint/Makefile | 3 + sample/triangle/test/12_notint/cmd | 1 + sample/triangle/test/12_notint/desc.txt | 1 + sample/triangle/test/13_argcnt/0.txt | 2 + sample/triangle/test/13_argcnt/Makefile | 3 + sample/triangle/test/13_argcnt/cmd | 3 + sample/triangle/test/13_argcnt/desc.txt | 1 + sample/triangle/test/Define.mk | 1 + sample/triangle/test/Define_group.mk | 1 + sample/triangle/test/Define_test.mk | 1 + sample/triangle/test/Makefile | 1 + sample/triangle/test/Test.mk | 1 + sample/triangle/triangle.c | 68 +++++++++++++++++++ 70 files changed, 193 insertions(+) create mode 100644 sample/triangle/Makefile create mode 100644 sample/triangle/test/.gitignore create mode 100644 sample/triangle/test/01_scalene/0.txt create mode 100644 sample/triangle/test/01_scalene/Makefile create mode 100755 sample/triangle/test/01_scalene/cmd create mode 100644 sample/triangle/test/01_scalene/desc.txt create mode 100644 sample/triangle/test/02_equilateral/0.txt create mode 100644 sample/triangle/test/02_equilateral/02_equilateral create mode 100644 sample/triangle/test/02_equilateral/Makefile create mode 100755 sample/triangle/test/02_equilateral/cmd create mode 100644 sample/triangle/test/02_equilateral/desc.txt create mode 100644 sample/triangle/test/03_isosceles/0.txt create mode 100644 sample/triangle/test/03_isosceles/03_isosceles create mode 100644 sample/triangle/test/03_isosceles/Makefile create mode 100755 sample/triangle/test/03_isosceles/cmd create mode 100644 sample/triangle/test/03_isosceles/desc.txt create mode 100644 sample/triangle/test/04_isosceles_c/0.txt create mode 100644 sample/triangle/test/04_isosceles_c/04_isosceles_c create mode 100644 sample/triangle/test/04_isosceles_c/Makefile create mode 100755 sample/triangle/test/04_isosceles_c/cmd create mode 100644 sample/triangle/test/04_isosceles_c/desc.txt create mode 100644 sample/triangle/test/05_zero/0.txt create mode 100644 sample/triangle/test/05_zero/05_zero create mode 100644 sample/triangle/test/05_zero/Makefile create mode 100755 sample/triangle/test/05_zero/cmd create mode 100644 sample/triangle/test/05_zero/desc.txt create mode 100644 sample/triangle/test/06_minus/0.txt create mode 100644 sample/triangle/test/06_minus/06_minus create mode 100644 sample/triangle/test/06_minus/Makefile create mode 100755 sample/triangle/test/06_minus/cmd create mode 100644 sample/triangle/test/06_minus/desc.txt create mode 100644 sample/triangle/test/07_line/0.txt create mode 100644 sample/triangle/test/07_line/07_line create mode 100644 sample/triangle/test/07_line/Makefile create mode 100755 sample/triangle/test/07_line/cmd create mode 100644 sample/triangle/test/07_line/desc.txt create mode 100644 sample/triangle/test/08_lines/0.txt create mode 100644 sample/triangle/test/08_lines/08_lines create mode 100644 sample/triangle/test/08_lines/Makefile create mode 100755 sample/triangle/test/08_lines/cmd create mode 100644 sample/triangle/test/08_lines/desc.txt create mode 100644 sample/triangle/test/09_less/0.txt create mode 100644 sample/triangle/test/09_less/09_less create mode 100644 sample/triangle/test/09_less/Makefile create mode 100755 sample/triangle/test/09_less/cmd create mode 100644 sample/triangle/test/09_less/desc.txt create mode 100644 sample/triangle/test/10_lesses/0.txt create mode 100644 sample/triangle/test/10_lesses/Makefile create mode 100755 sample/triangle/test/10_lesses/cmd create mode 100644 sample/triangle/test/10_lesses/desc.txt create mode 100644 sample/triangle/test/11_zeroall/0.txt create mode 100644 sample/triangle/test/11_zeroall/11_zeroall create mode 100644 sample/triangle/test/11_zeroall/Makefile create mode 100755 sample/triangle/test/11_zeroall/cmd create mode 100644 sample/triangle/test/11_zeroall/desc.txt create mode 100644 sample/triangle/test/12_notint/0.txt create mode 100644 sample/triangle/test/12_notint/12_notint create mode 100644 sample/triangle/test/12_notint/Makefile create mode 100755 sample/triangle/test/12_notint/cmd create mode 100644 sample/triangle/test/12_notint/desc.txt create mode 100644 sample/triangle/test/13_argcnt/0.txt create mode 100644 sample/triangle/test/13_argcnt/Makefile create mode 100755 sample/triangle/test/13_argcnt/cmd create mode 100644 sample/triangle/test/13_argcnt/desc.txt create mode 120000 sample/triangle/test/Define.mk create mode 120000 sample/triangle/test/Define_group.mk create mode 120000 sample/triangle/test/Define_test.mk create mode 120000 sample/triangle/test/Makefile create mode 120000 sample/triangle/test/Test.mk create mode 100644 sample/triangle/triangle.c diff --git a/sample/triangle/Makefile b/sample/triangle/Makefile new file mode 100644 index 0000000..f4889bd --- /dev/null +++ b/sample/triangle/Makefile @@ -0,0 +1,9 @@ +.PHONY: all clean + +all: triangle + +triangle: triangle.c + $(CC) -o triangle triangle.c + +clean: + rm -f triangle diff --git a/sample/triangle/test/.gitignore b/sample/triangle/test/.gitignore new file mode 100644 index 0000000..c4affcf --- /dev/null +++ b/sample/triangle/test/.gitignore @@ -0,0 +1,6 @@ +*/1.txt +*/diff.txt +*/err.txt +*/test.log +*/detail.log +*/time.log diff --git a/sample/triangle/test/01_scalene/0.txt b/sample/triangle/test/01_scalene/0.txt new file mode 100644 index 0000000..2172c8f --- /dev/null +++ b/sample/triangle/test/01_scalene/0.txt @@ -0,0 +1 @@ +scalene triangle diff --git a/sample/triangle/test/01_scalene/Makefile b/sample/triangle/test/01_scalene/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/01_scalene/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/01_scalene/cmd b/sample/triangle/test/01_scalene/cmd new file mode 100755 index 0000000..7362956 --- /dev/null +++ b/sample/triangle/test/01_scalene/cmd @@ -0,0 +1 @@ +../../triangle 3 4 5 diff --git a/sample/triangle/test/01_scalene/desc.txt b/sample/triangle/test/01_scalene/desc.txt new file mode 100644 index 0000000..029a05f --- /dev/null +++ b/sample/triangle/test/01_scalene/desc.txt @@ -0,0 +1 @@ +有効な不等辺三角形をあらわすテスト・ケース diff --git a/sample/triangle/test/02_equilateral/0.txt b/sample/triangle/test/02_equilateral/0.txt new file mode 100644 index 0000000..6704fca --- /dev/null +++ b/sample/triangle/test/02_equilateral/0.txt @@ -0,0 +1 @@ +equilateral triangle diff --git a/sample/triangle/test/02_equilateral/02_equilateral b/sample/triangle/test/02_equilateral/02_equilateral new file mode 100644 index 0000000..91ad4aa --- /dev/null +++ b/sample/triangle/test/02_equilateral/02_equilateral @@ -0,0 +1 @@ +real 0m0.006s diff --git a/sample/triangle/test/02_equilateral/Makefile b/sample/triangle/test/02_equilateral/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/02_equilateral/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/02_equilateral/cmd b/sample/triangle/test/02_equilateral/cmd new file mode 100755 index 0000000..2ebe2a3 --- /dev/null +++ b/sample/triangle/test/02_equilateral/cmd @@ -0,0 +1 @@ +../../triangle 4 4 4 diff --git a/sample/triangle/test/02_equilateral/desc.txt b/sample/triangle/test/02_equilateral/desc.txt new file mode 100644 index 0000000..48a23ac --- /dev/null +++ b/sample/triangle/test/02_equilateral/desc.txt @@ -0,0 +1 @@ +有効な正三角形をあらわすテスト・ケース diff --git a/sample/triangle/test/03_isosceles/0.txt b/sample/triangle/test/03_isosceles/0.txt new file mode 100644 index 0000000..4e9e0ff --- /dev/null +++ b/sample/triangle/test/03_isosceles/0.txt @@ -0,0 +1 @@ +isosceles triangle diff --git a/sample/triangle/test/03_isosceles/03_isosceles b/sample/triangle/test/03_isosceles/03_isosceles new file mode 100644 index 0000000..d6a2a2e --- /dev/null +++ b/sample/triangle/test/03_isosceles/03_isosceles @@ -0,0 +1 @@ +real 0m0.004s diff --git a/sample/triangle/test/03_isosceles/Makefile b/sample/triangle/test/03_isosceles/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/03_isosceles/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/03_isosceles/cmd b/sample/triangle/test/03_isosceles/cmd new file mode 100755 index 0000000..d497a25 --- /dev/null +++ b/sample/triangle/test/03_isosceles/cmd @@ -0,0 +1 @@ +../../triangle 2 4 4 diff --git a/sample/triangle/test/03_isosceles/desc.txt b/sample/triangle/test/03_isosceles/desc.txt new file mode 100644 index 0000000..fe911dc --- /dev/null +++ b/sample/triangle/test/03_isosceles/desc.txt @@ -0,0 +1 @@ +有効な二等辺三角形をあらわすテスト・ケース diff --git a/sample/triangle/test/04_isosceles_c/0.txt b/sample/triangle/test/04_isosceles_c/0.txt new file mode 100644 index 0000000..b7333a3 --- /dev/null +++ b/sample/triangle/test/04_isosceles_c/0.txt @@ -0,0 +1,3 @@ +isosceles triangle +isosceles triangle +isosceles triangle diff --git a/sample/triangle/test/04_isosceles_c/04_isosceles_c b/sample/triangle/test/04_isosceles_c/04_isosceles_c new file mode 100644 index 0000000..a1f9611 --- /dev/null +++ b/sample/triangle/test/04_isosceles_c/04_isosceles_c @@ -0,0 +1 @@ +real 0m0.009s diff --git a/sample/triangle/test/04_isosceles_c/Makefile b/sample/triangle/test/04_isosceles_c/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/04_isosceles_c/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/04_isosceles_c/cmd b/sample/triangle/test/04_isosceles_c/cmd new file mode 100755 index 0000000..3cfb153 --- /dev/null +++ b/sample/triangle/test/04_isosceles_c/cmd @@ -0,0 +1,3 @@ +../../triangle 3 3 4 +../../triangle 3 4 3 +../../triangle 4 3 3 diff --git a/sample/triangle/test/04_isosceles_c/desc.txt b/sample/triangle/test/04_isosceles_c/desc.txt new file mode 100644 index 0000000..34053d0 --- /dev/null +++ b/sample/triangle/test/04_isosceles_c/desc.txt @@ -0,0 +1 @@ +有効な二等辺三角形で2つの等辺を含む3種類の組合せすべてをためすことができる3つのテストケース diff --git a/sample/triangle/test/05_zero/0.txt b/sample/triangle/test/05_zero/0.txt new file mode 100644 index 0000000..e371bce --- /dev/null +++ b/sample/triangle/test/05_zero/0.txt @@ -0,0 +1 @@ +0: invalid argument. diff --git a/sample/triangle/test/05_zero/05_zero b/sample/triangle/test/05_zero/05_zero new file mode 100644 index 0000000..288f919 --- /dev/null +++ b/sample/triangle/test/05_zero/05_zero @@ -0,0 +1 @@ +real 0m0.005s diff --git a/sample/triangle/test/05_zero/Makefile b/sample/triangle/test/05_zero/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/05_zero/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/05_zero/cmd b/sample/triangle/test/05_zero/cmd new file mode 100755 index 0000000..c9ab8c0 --- /dev/null +++ b/sample/triangle/test/05_zero/cmd @@ -0,0 +1 @@ +../../triangle 3 4 0 diff --git a/sample/triangle/test/05_zero/desc.txt b/sample/triangle/test/05_zero/desc.txt new file mode 100644 index 0000000..4ab99f3 --- /dev/null +++ b/sample/triangle/test/05_zero/desc.txt @@ -0,0 +1 @@ +1つの辺がゼロの値をもつテスト・ケース diff --git a/sample/triangle/test/06_minus/0.txt b/sample/triangle/test/06_minus/0.txt new file mode 100644 index 0000000..a275577 --- /dev/null +++ b/sample/triangle/test/06_minus/0.txt @@ -0,0 +1 @@ +-1: invalid argument. diff --git a/sample/triangle/test/06_minus/06_minus b/sample/triangle/test/06_minus/06_minus new file mode 100644 index 0000000..a072ab3 --- /dev/null +++ b/sample/triangle/test/06_minus/06_minus @@ -0,0 +1 @@ +real 0m0.010s diff --git a/sample/triangle/test/06_minus/Makefile b/sample/triangle/test/06_minus/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/06_minus/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/06_minus/cmd b/sample/triangle/test/06_minus/cmd new file mode 100755 index 0000000..665928f --- /dev/null +++ b/sample/triangle/test/06_minus/cmd @@ -0,0 +1 @@ +../../triangle -1 3 4 diff --git a/sample/triangle/test/06_minus/desc.txt b/sample/triangle/test/06_minus/desc.txt new file mode 100644 index 0000000..08d1e83 --- /dev/null +++ b/sample/triangle/test/06_minus/desc.txt @@ -0,0 +1 @@ +1つの辺が負の値をしめすテスト・ケース diff --git a/sample/triangle/test/07_line/0.txt b/sample/triangle/test/07_line/0.txt new file mode 100644 index 0000000..0456fff --- /dev/null +++ b/sample/triangle/test/07_line/0.txt @@ -0,0 +1 @@ +not triangle diff --git a/sample/triangle/test/07_line/07_line b/sample/triangle/test/07_line/07_line new file mode 100644 index 0000000..385d704 --- /dev/null +++ b/sample/triangle/test/07_line/07_line @@ -0,0 +1 @@ +real 0m0.011s diff --git a/sample/triangle/test/07_line/Makefile b/sample/triangle/test/07_line/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/07_line/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/07_line/cmd b/sample/triangle/test/07_line/cmd new file mode 100755 index 0000000..24eec4b --- /dev/null +++ b/sample/triangle/test/07_line/cmd @@ -0,0 +1 @@ +../../triangle 1 2 3 diff --git a/sample/triangle/test/07_line/desc.txt b/sample/triangle/test/07_line/desc.txt new file mode 100644 index 0000000..d9c6d52 --- /dev/null +++ b/sample/triangle/test/07_line/desc.txt @@ -0,0 +1 @@ +ゼロより大きい3つの整数をもち、そのうち2つの和がそれ以外の1つと等しいようなテスト・ケース diff --git a/sample/triangle/test/08_lines/0.txt b/sample/triangle/test/08_lines/0.txt new file mode 100644 index 0000000..a562ff8 --- /dev/null +++ b/sample/triangle/test/08_lines/0.txt @@ -0,0 +1,3 @@ +not triangle +not triangle +not triangle diff --git a/sample/triangle/test/08_lines/08_lines b/sample/triangle/test/08_lines/08_lines new file mode 100644 index 0000000..a072ab3 --- /dev/null +++ b/sample/triangle/test/08_lines/08_lines @@ -0,0 +1 @@ +real 0m0.010s diff --git a/sample/triangle/test/08_lines/Makefile b/sample/triangle/test/08_lines/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/08_lines/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/08_lines/cmd b/sample/triangle/test/08_lines/cmd new file mode 100755 index 0000000..aea1c3d --- /dev/null +++ b/sample/triangle/test/08_lines/cmd @@ -0,0 +1,3 @@ +../../triangle 1 2 3 +../../triangle 1 3 2 +../../triangle 3 1 2 diff --git a/sample/triangle/test/08_lines/desc.txt b/sample/triangle/test/08_lines/desc.txt new file mode 100644 index 0000000..797413c --- /dev/null +++ b/sample/triangle/test/08_lines/desc.txt @@ -0,0 +1 @@ +1辺の長さが他の2辺の長さの和に等しいことを3種類の順列のすべてに対してためすことのできるテスト・ケース diff --git a/sample/triangle/test/09_less/0.txt b/sample/triangle/test/09_less/0.txt new file mode 100644 index 0000000..4552d92 --- /dev/null +++ b/sample/triangle/test/09_less/0.txt @@ -0,0 +1,2 @@ +not triangle +not triangle diff --git a/sample/triangle/test/09_less/09_less b/sample/triangle/test/09_less/09_less new file mode 100644 index 0000000..326d4ac --- /dev/null +++ b/sample/triangle/test/09_less/09_less @@ -0,0 +1 @@ +real 0m0.007s diff --git a/sample/triangle/test/09_less/Makefile b/sample/triangle/test/09_less/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/09_less/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/09_less/cmd b/sample/triangle/test/09_less/cmd new file mode 100755 index 0000000..acad848 --- /dev/null +++ b/sample/triangle/test/09_less/cmd @@ -0,0 +1,2 @@ +../../triangle 1 2 4 +../../triangle 12 15 30 diff --git a/sample/triangle/test/09_less/desc.txt b/sample/triangle/test/09_less/desc.txt new file mode 100644 index 0000000..c02c0a9 --- /dev/null +++ b/sample/triangle/test/09_less/desc.txt @@ -0,0 +1 @@ +ゼロより大きな3つの整数のうち、2つの数の和がそれ以外の1つの数より小さくなるテストケース diff --git a/sample/triangle/test/10_lesses/0.txt b/sample/triangle/test/10_lesses/0.txt new file mode 100644 index 0000000..a562ff8 --- /dev/null +++ b/sample/triangle/test/10_lesses/0.txt @@ -0,0 +1,3 @@ +not triangle +not triangle +not triangle diff --git a/sample/triangle/test/10_lesses/Makefile b/sample/triangle/test/10_lesses/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/10_lesses/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/10_lesses/cmd b/sample/triangle/test/10_lesses/cmd new file mode 100755 index 0000000..8056645 --- /dev/null +++ b/sample/triangle/test/10_lesses/cmd @@ -0,0 +1,3 @@ +../../triangle 1 2 4 +../../triangle 1 4 2 +../../triangle 4 2 1 diff --git a/sample/triangle/test/10_lesses/desc.txt b/sample/triangle/test/10_lesses/desc.txt new file mode 100644 index 0000000..3940632 --- /dev/null +++ b/sample/triangle/test/10_lesses/desc.txt @@ -0,0 +1 @@ +ゼロより大きな3つの整数のうち、2つの数の和がそれ以外の1つの数より小さくなることにおいて、3種類の順列すべてを考慮することのできるテストケース diff --git a/sample/triangle/test/11_zeroall/0.txt b/sample/triangle/test/11_zeroall/0.txt new file mode 100644 index 0000000..e371bce --- /dev/null +++ b/sample/triangle/test/11_zeroall/0.txt @@ -0,0 +1 @@ +0: invalid argument. diff --git a/sample/triangle/test/11_zeroall/11_zeroall b/sample/triangle/test/11_zeroall/11_zeroall new file mode 100644 index 0000000..288f919 --- /dev/null +++ b/sample/triangle/test/11_zeroall/11_zeroall @@ -0,0 +1 @@ +real 0m0.005s diff --git a/sample/triangle/test/11_zeroall/Makefile b/sample/triangle/test/11_zeroall/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/11_zeroall/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/11_zeroall/cmd b/sample/triangle/test/11_zeroall/cmd new file mode 100755 index 0000000..6357f33 --- /dev/null +++ b/sample/triangle/test/11_zeroall/cmd @@ -0,0 +1 @@ +../../triangle 0 0 0 diff --git a/sample/triangle/test/11_zeroall/desc.txt b/sample/triangle/test/11_zeroall/desc.txt new file mode 100644 index 0000000..d4144c8 --- /dev/null +++ b/sample/triangle/test/11_zeroall/desc.txt @@ -0,0 +1 @@ +すべての辺がゼロであるテスト・ケース diff --git a/sample/triangle/test/12_notint/0.txt b/sample/triangle/test/12_notint/0.txt new file mode 100644 index 0000000..a891c01 --- /dev/null +++ b/sample/triangle/test/12_notint/0.txt @@ -0,0 +1 @@ +3.1: invalid argument. diff --git a/sample/triangle/test/12_notint/12_notint b/sample/triangle/test/12_notint/12_notint new file mode 100644 index 0000000..288f919 --- /dev/null +++ b/sample/triangle/test/12_notint/12_notint @@ -0,0 +1 @@ +real 0m0.005s diff --git a/sample/triangle/test/12_notint/Makefile b/sample/triangle/test/12_notint/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/12_notint/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/12_notint/cmd b/sample/triangle/test/12_notint/cmd new file mode 100755 index 0000000..81a9de3 --- /dev/null +++ b/sample/triangle/test/12_notint/cmd @@ -0,0 +1 @@ +../../triangle 3.1 4.5 6.2 diff --git a/sample/triangle/test/12_notint/desc.txt b/sample/triangle/test/12_notint/desc.txt new file mode 100644 index 0000000..1a871ee --- /dev/null +++ b/sample/triangle/test/12_notint/desc.txt @@ -0,0 +1 @@ +整数でない値をもつテスト・ケース diff --git a/sample/triangle/test/13_argcnt/0.txt b/sample/triangle/test/13_argcnt/0.txt new file mode 100644 index 0000000..67d691b --- /dev/null +++ b/sample/triangle/test/13_argcnt/0.txt @@ -0,0 +1,2 @@ +too few argument. +too many argument. diff --git a/sample/triangle/test/13_argcnt/Makefile b/sample/triangle/test/13_argcnt/Makefile new file mode 100644 index 0000000..e38b63c --- /dev/null +++ b/sample/triangle/test/13_argcnt/Makefile @@ -0,0 +1,3 @@ +include ../Define.mk +include ../Define_test.mk +include ../Test.mk diff --git a/sample/triangle/test/13_argcnt/cmd b/sample/triangle/test/13_argcnt/cmd new file mode 100755 index 0000000..cb98719 --- /dev/null +++ b/sample/triangle/test/13_argcnt/cmd @@ -0,0 +1,3 @@ +../../triangle 3 4 +../../triangle 3 4 5 6 + diff --git a/sample/triangle/test/13_argcnt/desc.txt b/sample/triangle/test/13_argcnt/desc.txt new file mode 100644 index 0000000..7c9b72e --- /dev/null +++ b/sample/triangle/test/13_argcnt/desc.txt @@ -0,0 +1 @@ +数値の個数が間違っていることをためすテスト・ケース diff --git a/sample/triangle/test/Define.mk b/sample/triangle/test/Define.mk new file mode 120000 index 0000000..30e79a4 --- /dev/null +++ b/sample/triangle/test/Define.mk @@ -0,0 +1 @@ +/Users/kazubito/2010_12/autotest.mk/template/Define.mk \ No newline at end of file diff --git a/sample/triangle/test/Define_group.mk b/sample/triangle/test/Define_group.mk new file mode 120000 index 0000000..5efc14d --- /dev/null +++ b/sample/triangle/test/Define_group.mk @@ -0,0 +1 @@ +/Users/kazubito/2010_12/autotest.mk/template/Define_group.mk \ No newline at end of file diff --git a/sample/triangle/test/Define_test.mk b/sample/triangle/test/Define_test.mk new file mode 120000 index 0000000..152bd34 --- /dev/null +++ b/sample/triangle/test/Define_test.mk @@ -0,0 +1 @@ +/Users/kazubito/2010_12/autotest.mk/template/Define_test.mk \ No newline at end of file diff --git a/sample/triangle/test/Makefile b/sample/triangle/test/Makefile new file mode 120000 index 0000000..b78314e --- /dev/null +++ b/sample/triangle/test/Makefile @@ -0,0 +1 @@ +/Users/kazubito/2010_12/autotest.mk/template/Group.mk \ No newline at end of file diff --git a/sample/triangle/test/Test.mk b/sample/triangle/test/Test.mk new file mode 120000 index 0000000..bb188bd --- /dev/null +++ b/sample/triangle/test/Test.mk @@ -0,0 +1 @@ +/Users/kazubito/2010_12/autotest.mk/template/Test.mk \ No newline at end of file diff --git a/sample/triangle/triangle.c b/sample/triangle/triangle.c new file mode 100644 index 0000000..c38f9a0 --- /dev/null +++ b/sample/triangle/triangle.c @@ -0,0 +1,68 @@ +/********************************************************************** +triangle.c +引数として指定された3つの整数が三角形の3辺を表すものとし、 +次のうちどれであるかをきめるメッセージを印字する。 + 不等辺三角形(scalene triangle) + 二等辺三角形(isosceles triangle) + 正三角形(equilateral triangle) + +Glenford J Myers『ソフトウェア・テストの技法』(近代科学社、1980) +http://www.amazon.co.jp/dp/4764900599 +第1章「自己診断テスト」に記載された「自己診断テスト」の仕様を実装 +**********************************************************************/ + +#include +#include +/* #define DEBUG */ + +int main(int argc, char *argv[]) +{ + int l[3], i; + char *check; + + /* 引数が3以外の場合は、エラー終了 */ + if(argc != 4) { + if(argc < 4) { + fprintf(stderr, "too few argument.\n"); + } + else if(argc > 4) { + fprintf(stderr, "too many argument.\n"); + } + return -1; + } + /* 引数が整数かチェック。整数以外の場合はエラー終了 */ + for(i = 0; i < 3; i++) { + l[i] = strtol(argv[i+1], &check, 10); + if(*check != '\0' || l[i] <= 0) { + fprintf(stderr, "%s: invalid argument.\n", argv[i+1]); + #ifdef DEBUG + printf("i:%d argv[i+1]:%s check:%s l[%d]:%d\n", i, argv[i+1], check, i, l[i]); + #endif + return -1; + } + } + #ifdef DEBUG + printf("l[0]:%d l[1]:%d l[2]:%d\n", l[0], l[1], l[2]); + #endif + /* 三角不等式により、三角形になるかを判定 */ + if(l[0] + l[1] <= l[2] || l[1] + l[2] <= l[0] || l[2] + l[0] <= l[1]) { + puts("not triangle"); + } else { + /* 3辺の長さが等しい場合は、正三角形 */ + if(l[0] == l[1] && l[1] == l[2] && l[2] == l[0]) { + puts("equilateral triangle"); + } + /* 2辺の長さが等しい場合は、二等辺三角形 */ + else if (l[0] == l[1] || l[1] == l[2] || l[2] == l[0]) { + puts("isosceles triangle"); + } + /* それ以外の場合は、不等辺三角形 */ + else { + puts("scalene triangle"); + } + } + #ifdef DEBUG + printf("l[0]:%d l[1]:%d l[2]:%d cosa:%f\n", l[0], l[1], l[2], cosa); + #endif + return 0; +} -- 2.18.0