From f4efd8eb3373cd22ca1442bb215b8ebd240f8fb1 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 16 Apr 2015 16:36:44 +0100 Subject: Test our enum-like type works as expected. Specifically that we can get the value back as a string, and work with the ordinal too. --- t/test-testresult.t | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 t/test-testresult.t (limited to 't') diff --git a/t/test-testresult.t b/t/test-testresult.t new file mode 100755 index 0000000..6e8be4b --- /dev/null +++ b/t/test-testresult.t @@ -0,0 +1,52 @@ +#!/usr/bin/ruby -Ilib/ -I../lib/ + + +require 'test/unit' + +require 'custodian/testfactory' + + +class TestTestResult < Test::Unit::TestCase + + # + # Create the test suite environment: NOP. + # + def setup + end + + # + # Destroy the test suite environment: NOP. + # + def teardown + end + + + # + # Test the passed-symbol + # + def test_test_passed + f = Custodian::TestResult::TEST_PASSED + assert_equal(Custodian::TestResult.to_str(f), 'TEST_PASSED') + assert_equal(f, 2) + end + + + # + # Test the failed-symbol + # + def test_test_failed + f = Custodian::TestResult::TEST_FAILED + assert_equal(Custodian::TestResult.to_str(f), 'TEST_FAILED') + assert_equal(f, 4) + end + + # + # Test the skipped symbol + # + def test_test_skipped + f = Custodian::TestResult::TEST_SKIPPED + assert_equal(Custodian::TestResult.to_str(f), 'TEST_SKIPPED') + assert_equal(f, 8) + end + +end -- cgit v1.2.1