/**
 繝�せ繝医ラ繝ゥ繧、繝�
*/
class testapp
  operations
    public executeAll : () ==> ()
    executeAll() ==
    (
      executeVerification();
      executeValidation();
    );
    
    public executeVerification : () ==> ()
    executeVerification() ==
    (
      dcl ts : TestSuite := new TestSuite("Mindstorms NXT繝ゥ繧、繝ウ繝医Ξ繝シ繧ケ莉墓ァ俶ュ」蠖捺€ァ遒コ隱阪ユ繧ケ繝�"),
          tr : TestResult := new TestResult();
      
      -- 繝ェ繧ケ繝翫�逋サ骭イ
      tr.addListener(new printTestListener());
      
      -- 繝�せ繝医こ繝シ繧ケ霑ス蜉�
      ts.addTest(new testVerification01("Case 1 - 繝ゥ繧、繝ウ迥カ諷句愛螳壹ユ繧ケ繝�"));
      
      -- 繝�せ繝亥ョ溯。�
      ts.run(tr);
      
      -- 譛€邨らオ先棡陦ィ遉コ
      if tr.wasSuccessful() = true then
        def - = new IO().echo("*** All verification tests Passed. ***") in skip
      else
        def - = new IO().echo("*** ERROR! ***") in skip
    );
    
    public executeValidation : () ==> ()
    executeValidation() ==
    (
      dcl ts : TestSuite := new TestSuite("Mindstorms NXT繝ゥ繧、繝ウ繝医Ξ繝シ繧ケ莉墓ァ伜ヲ・蠖捺€ァ遒コ隱阪ユ繧ケ繝�"),
          tr : TestResult := new TestResult();
      
      -- 繝ェ繧ケ繝翫�逋サ骭イ
      tr.addListener(new printTestListener());
      
      -- 繝�せ繝医こ繝シ繧ケ霑ス蜉�
      ts.addTest(new testValidation01("Case 1 - 蜿ウ謚�"));
      --ts.addTest(new testValidation02("Case 2 - 蟾ヲ謚�"));
      
      -- 繝�せ繝亥ョ溯。�
      ts.run(tr);
      
      -- 譛€邨らオ先棡陦ィ遉コ
      if tr.wasSuccessful() = true then
        def - = new IO().echo("*** All validation tests Passed. ***") in skip
      else
        def - = new IO().echo("*** ERROR! ***") in skip
    );
end testapp

/**
 printTestListener �� 繝�せ繝医�邨碁℃縺ィ邨先棡繧偵�繝ェ繝ウ繝医☆繧九Μ繧ケ繝翫�繧ッ繝ゥ繧ケ
*/
class printTestListener is subclass of TestListener
operations
  public initListener: () ==> ()
  initListener () == skip;
  
  public exitListener: () ==> ()
  exitListener () == skip;
  
  public addFailure: Test * AssertionFailedError ==> ()
  addFailure (test, failError) ==
    if failError.hasMessage() then
      print(test.getName() ^ failError.getMessage())
    else
      skip;

  public addError: Test * Throwable ==> ()
  addError (-, -) == skip;
  
  public startTest: Test ==> ()
  startTest (test) ==
    print("Start test - " ^ test.getName());
  
  public endTest: Test ==> ()
  endTest (test) ==
    print("End test   - " ^ test.getName());
  
  public print : seq of char ==> ()
  print(str) == def - = new IO().echo(str ^ "\n") in skip;

end printTestListener