[edit]

目次

[edit]

Jsunit

カテゴリーJsunit
優先順位至急
イテレーションイテレーション1
状態完了
完了予定日2007/10/5
工数
対応者清原

[edit]

使い方

テストケースの作成
jsUnitCore?.jsをロードする

TestSuite?を作成
suite()メソッドを作成し、メソッド内でjsUnitTestSuite?クラスを生成し、各テストケースファイルを追加する

[edit]

作成したテストケース

今回はtest-div.htmlとtest-pytha.htmlの2つのテストケースを用意した
以下はtest-pytha.html

<html>
<head>
<script language="javascript"  src="../../jsunit/jsunit/app/jsUnitCore.js"></script>
<script language="javascript" src="CalcClass.js"></script>
</head>
<body>
<script language="javascript">
  function testAbnormalpytha(){
      var max =999999999999999999......(ものスゴく巨大な数字)
      assertEquals('10:x = positiveInfinity y = 5','InfinityError',pythagoras(max,5));
      assertEquals('11:x = 49 y =  negativeInfinity','InfinityError',pythagoras(49,-(max)))
      assertEquals('12:NotNumber','NotNumber',pythagoras('r',9));
      assertEquals('13:Empty','ArgumentEmptyError',pythagoras('',5));
      assertEquals('14:NotNumber','NotNumber',pythagoras('0.00.3',5));
  }
  function testNormalpytha(){
      assertEquals("17:x = -2.2 y = 3",Math.sqrt(13.84),pythagoras(-2.2,3)); 
      assertEquals('18:x = 4 y = 2',Math.sqrt(20),pythagoras(4,2));
      assertEquals('19:x = 3 y = 5',Math.sqrt(34),pythagoras(3,5));
      assertEquals('20:x = 10 y = 9',Math.sqrt(181),pythagoras(10,9));
      assertEquals('21:x = 2 y = -6',Math.sqrt(40),pythagoras(2,-6));
  }
</script>
</body>
</html>

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS

アークウェブのサービスやソリューションはこちら