PageRenderTime 48ms CodeModel.GetById 5ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TestCase.as

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
ActionScript | 42 lines | 29 code | 4 blank | 9 comment | 1 complexity | fef1e46d9e0afd35910ab8d2c0174688 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /**
  2. * TestCase
  3. *
  4. * Embryonic unit test support class.
  5. * Copyright (c) 2007 Henri Torgemane
  6. *
  7. * See LICENSE.txt for full license information.
  8. */
  9. package com.hurlant.crypto.tests
  10. {
  11. public class TestCase
  12. {
  13. public var harness:ITestHarness;
  14. public function TestCase(h:ITestHarness, title:String) {
  15. harness = h;
  16. harness.beginTestCase(title);
  17. }
  18. public function assert(msg:String, value:Boolean):void {
  19. if (value) {
  20. // TestHarness.print("+ ",msg);
  21. return;
  22. }
  23. throw new Error("Test Failure:"+msg);
  24. }
  25. public function runTest(f:Function, title:String):void {
  26. harness.beginTest(title);
  27. try {
  28. f();
  29. } catch (e:Error) {
  30. trace("EXCEPTION THROWN: "+e);
  31. trace(e.getStackTrace());
  32. harness.failTest(e.toString());
  33. return;
  34. }
  35. harness.passTest();
  36. }
  37. }
  38. }