• 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

Revision13 (tree)
Time2014-06-10 15:01:04
Authortuna_p

Log Message

(empty log message)

Change Summary

Incremental Difference

--- JUnit-Sample/test/sample/VectorsJUnit3Test.java (revision 12)
+++ JUnit-Sample/test/sample/VectorsJUnit3Test.java (revision 13)
@@ -4,6 +4,8 @@
44 * and open the template in the editor.
55 */
66
7+package sample;
8+
79 import junit.framework.TestCase;
810 import sample.Vectors;
911
@@ -46,11 +48,13 @@
4648 */
4749 public void testScalarMultiplication() {
4850 System.out.println("* VectorsJUnit3Test: testScalarMultiplication()");
51+ /*
4952 int[] a = null;
5053 int[] b = null;
5154 int expResult = 0;
5255 int result = Vectors.scalarMultiplication(a, b);
5356 assertEquals(expResult, result);
57+ */
5458 assertEquals( 0, Vectors.scalarMultiplication(new int[] { 0, 0}, new int[] { 0, 0}));
5559 assertEquals( 39, Vectors.scalarMultiplication(new int[] { 3, 4}, new int[] { 5, 6}));
5660 assertEquals(-39, Vectors.scalarMultiplication(new int[] {-3, 4}, new int[] { 5,-6}));
@@ -58,7 +62,7 @@
5862 assertEquals(100, Vectors.scalarMultiplication(new int[] { 6, 8}, new int[] { 6, 8}));
5963
6064 // TODO review the generated test code and remove the default call to fail.
61- fail("The test case is a prototype.");
65+ // fail("The test case is a prototype.");
6266 }
6367
6468 }
--- JUnit-Sample/test/sample/VectorsJUnit4Test.java (nonexistent)
+++ JUnit-Sample/test/sample/VectorsJUnit4Test.java (revision 13)
@@ -0,0 +1,63 @@
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.AfterClass;
10+import org.junit.BeforeClass;
11+import org.junit.Test;
12+import static org.junit.Assert.*;
13+
14+/**
15+ *
16+ * @author kgto
17+ */
18+public class VectorsJUnit4Test {
19+
20+ public VectorsJUnit4Test() {
21+ }
22+
23+ /* 削除
24+ @BeforeClass
25+ public static void setUpClass() {
26+ }
27+
28+ @AfterClass
29+ public static void tearDownClass() {
30+ }
31+ */
32+
33+ /**
34+ * Test of equal method, of class Vectors.
35+ */
36+ @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.");
46+ }
47+
48+ /**
49+ * Test of scalarMultiplication method, of class Vectors.
50+ */
51+ @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.");
61+ }
62+
63+}
--- JUnit-Sample/test/sample/UtilsJUnit3Test.java (revision 12)
+++ JUnit-Sample/test/sample/UtilsJUnit3Test.java (revision 13)
@@ -6,6 +6,7 @@
66
77 package sample;
88
9+import java.util.concurrent.TimeoutException;
910 import junit.framework.TestCase;
1011
1112 /**
@@ -33,6 +34,7 @@
3334 /**
3435 * Test of concatWords method, of class Utils.
3536 */
37+ /* 削除
3638 public void testConcatWords() {
3739 System.out.println("concatWords");
3840 String[] words = null;
@@ -42,10 +44,16 @@
4244 // TODO review the generated test code and remove the default call to fail.
4345 fail("The test case is a prototype.");
4446 }
47+ */
48+ public void testHelloWorld() {
49+ System.out.println("* UtilsJUnit3Test: test method 1 - testHelloWorld()");
50+ assertEquals("Hello, world!", Utils.concatWords("Hello", ", ", "world", "!"));
51+ }
4552
4653 /**
4754 * Test of computeFactorial method, of class Utils.
4855 */
56+ /* 削除
4957 public void testComputeFactorial() {
5058 System.out.println("computeFactorial");
5159 int number = 0;
@@ -55,10 +63,41 @@
5563 // TODO review the generated test code and remove the default call to fail.
5664 fail("The test case is a prototype.");
5765 }
66+ */
67+ public void testWithTimeout() throws InterruptedException, TimeoutException {
68+ System.out.println("* UtilsJUnit3Test: test method 2 - testWithTimeout()");
69+ final int factorialOf = 1 + (int) (30000 * Math.random());
70+ System.out.println("computing " + factorialOf + '!');
5871
72+ Thread testThread = new Thread() {
73+ public void run() {
74+ System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
75+ }
76+ };
77+
78+ testThread.start();
79+ Thread.sleep(1000);
80+ testThread.interrupt();
81+
82+ if (testThread.isInterrupted()) {
83+ throw new TimeoutException("the test took too long to complete");
84+ }
85+ }
86+
87+ public void testExpectedException() {
88+ System.out.println("* UtilsJUnit3Test: test method 3 - testExpectedException()");
89+ try {
90+ final int factorialOf = -5;
91+ System.out.println(factorialOf + "! = " + Utils.computeFactorial(factorialOf));
92+ fail("IllegalArgumentException was expected");
93+ } catch (IllegalArgumentException ex) {
94+ }
95+ }
96+
5997 /**
6098 * Test of normalizeWord method, of class Utils.
6199 */
100+ /* 削除
62101 public void testNormalizeWord() {
63102 System.out.println("normalizeWord");
64103 String word = "";
@@ -68,5 +107,11 @@
68107 // TODO review the generated test code and remove the default call to fail.
69108 fail("The test case is a prototype.");
70109 }
110+ */
71111
112+ public void DISABLED_testTemporarilyDisabled() throws Exception {
113+ System.out.println("* UtilsJUnit3Test: test method 4 - checkExpectedException()");
114+ assertEquals("Malm\u00f6", Utils.normalizeWord("Malmo\u0308"));
115+ }
116+
72117 }