• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作業部屋の使い方を試しています。


Commit MetaInfo

Revision14 (tree)
Time2014-06-10 21:46:11
Authortuna_p

Log Message

(empty log message)

Change Summary

Incremental Difference

--- JUnit-Sample/test/sample/VectorsJUnit4Test.java (revision 13)
+++ JUnit-Sample/test/sample/VectorsJUnit4Test.java (revision 14)
@@ -34,15 +34,26 @@
3434 * Test of equal method, of class Vectors.
3535 */
3636 @Test
37- public void testEqual() {
38- System.out.println("equal");
39- int[] a = null;
40- int[] b = null;
41- boolean expResult = false;
42- boolean result = Vectors.equal(a, b);
43- assertEquals(expResult, result);
44- // TODO review the generated test code and remove the default call to fail.
45- fail("The test case is a prototype.");
37+ public void equalsCheck() {
38+ System.out.println("* VectorsJUnit4Test: equalsCheck()");
39+ assertTrue(Vectors.equal(new int[] {}, new int[] {}));
40+ assertTrue(Vectors.equal(new int[] {0}, new int[] {0}));
41+ assertTrue(Vectors.equal(new int[] {0, 0}, new int[] {0, 0}));
42+ assertTrue(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0, 0}));
43+ assertTrue(Vectors.equal(new int[] {5, 6, 7}, new int[] {5, 6, 7}));
44+
45+ assertFalse(Vectors.equal(new int[] {}, new int[] {0}));
46+ assertFalse(Vectors.equal(new int[] {0}, new int[] {0, 0}));
47+ assertFalse(Vectors.equal(new int[] {0, 0}, new int[] {0, 0, 0}));
48+ assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0}));
49+ assertFalse(Vectors.equal(new int[] {0, 0}, new int[] {0}));
50+ assertFalse(Vectors.equal(new int[] {0}, new int[] {}));
51+
52+ assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 0, 1}));
53+ assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {0, 1, 0}));
54+ assertFalse(Vectors.equal(new int[] {0, 0, 0}, new int[] {1, 0, 0}));
55+ assertFalse(Vectors.equal(new int[] {0, 0, 1}, new int[] {0, 0, 3}));
56+
4657 }
4758
4859 /**
@@ -49,15 +60,13 @@
4960 * Test of scalarMultiplication method, of class Vectors.
5061 */
5162 @Test
52- public void testScalarMultiplication() {
53- System.out.println("scalarMultiplication");
54- int[] a = null;
55- int[] b = null;
56- int expResult = 0;
57- int result = Vectors.scalarMultiplication(a, b);
58- assertEquals(expResult, result);
59- // TODO review the generated test code and remove the default call to fail.
60- fail("The test case is a prototype.");
63+ public void ScalarMultiplicationCheck() {
64+ System.out.println("* VectorsJUnit4Test: ScalarMultiplicationCheck()");
65+ assertEquals( 0, Vectors.scalarMultiplication(new int[] { 0, 0}, new int[] { 0, 0}));
66+ assertEquals( 39, Vectors.scalarMultiplication(new int[] { 3, 4}, new int[] { 5, 6}));
67+ assertEquals(-39, Vectors.scalarMultiplication(new int[] {-3, 4}, new int[] { 5,-6}));
68+ assertEquals( 0, Vectors.scalarMultiplication(new int[] { 5, 9}, new int[] {-9, 5}));
69+ assertEquals(100, Vectors.scalarMultiplication(new int[] { 6, 8}, new int[] { 6, 8}));
6170 }
6271
6372 }
--- JUnit-Sample/test/sample/UtilsJUnit4Test.java (nonexistent)
+++ JUnit-Sample/test/sample/UtilsJUnit4Test.java (revision 14)
@@ -0,0 +1,116 @@
1+/*
2+ * To change this license header, choose License Headers in Project Properties.
3+ * To change this template file, choose Tools | Templates
4+ * and open the template in the editor.
5+ */
6+
7+package sample;
8+
9+import org.junit.After;
10+import org.junit.AfterClass;
11+import static org.junit.Assert.*;
12+import org.junit.Before;
13+import org.junit.BeforeClass;
14+import org.junit.Ignore;
15+import org.junit.Test;
16+
17+/**
18+ *
19+ * @author kgto
20+ */
21+public class UtilsJUnit4Test {
22+
23+ public UtilsJUnit4Test() {
24+ }
25+
26+ @BeforeClass
27+ public static void setUpClass() {
28+ System.out.println("* UtilsJUnit4Test: @BeforeClass method");
29+ }
30+
31+ @AfterClass
32+ public static void tearDownClass() {
33+ System.out.println("* UtilsJUnit4Test: @AfterClass method");
34+ }
35+
36+ @Before
37+ public void setUp() {
38+ System.out.println("* UtilsJUnit4Test: @Before method");
39+ }
40+
41+ @After
42+ public void tearDown() {
43+ System.out.println("* UtilsJUnit4Test: @After method");
44+ }
45+
46+ /**
47+ * Test of concatWords method, of class Utils.
48+ */
49+ @Test
50+ /* 削除
51+ public void testConcatWords() {
52+ System.out.println("concatWords");
53+ String[] words = null;
54+ String expResult = "";
55+ String result = Utils.concatWords(words);
56+ assertEquals(expResult, result);
57+ // TODO review the generated test code and remove the default call to fail.
58+ fail("The test case is a prototype.");
59+ }
60+ */
61+ public void helloWorldCheck() {
62+ System.out.println("* UtilsJUnit4Test: test method 1 - helloWorldCheck()");
63+ assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
64+ }
65+
66+ /**
67+ * Test of computeFactorial method, of class Utils.
68+ */
69+ /* 削除
70+ public void testComputeFactorial() {
71+ System.out.println("computeFactorial");
72+ int number = 0;
73+ String expResult = "";
74+ String result = Utils.computeFactorial(number);
75+ assertEquals(expResult, result);
76+ // TODO review the generated test code and remove the default call to fail.
77+ fail("The test case is a prototype.");
78+ }
79+ */
80+ @Test(timeout=1000)
81+ public void testWithTimeout() {
82+ System.out.println("* UtilsJUnit4Test: test method 2 - testWithTimeout()");
83+ final int factorialOf = 1 + (int) (30000 * Math.random());
84+ System.out.println("computing " + factorialOf + '!');
85+ System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
86+ }
87+
88+ @Test(expected=IllegalArgumentException.class)
89+ public void checkExpectedException() {
90+ System.out.println("* UtilsJUnit4Test: test method 3 - checkExpectedException()");
91+ final int factorialOf = -5;
92+ System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
93+ }
94+
95+ /**
96+ * Test of normalizeWord method, of class Utils.
97+ */
98+ /* 削除
99+ @Test
100+ public void testNormalizeWord() {
101+ System.out.println("normalizeWord");
102+ String word = "";
103+ String expResult = "";
104+ String result = Utils.normalizeWord(word);
105+ assertEquals(expResult, result);
106+ // TODO review the generated test code and remove the default call to fail.
107+ fail("The test case is a prototype.");
108+ }
109+ */
110+ @Ignore
111+ @Test
112+ public void temporarilyDisabledTest() throws Exception {
113+ System.out.println("* UtilsJUnit4Test: test method 4 - checkExpectedException()");
114+ assertEquals("Malm\u00f6", Utils.normalizeWord("Malmo\u0308"));
115+ }
116+}