OpenEuphoria ट्रैक पर टेस्टिंग

Exercism पर अपने OpenEuphoria अभ्यासों को टेस्ट करना सीखिए।


टेस्ट चलाना

अभ्यास की डायरेक्टरी से exercism test या eutest चलाइए। इसके बाद Euphoria आपके हल के खिलाफ t_<exercise>.e चलाएगा।

आउटपुट पढ़ना

किसी अभ्यास की शुरुआत में आपके हल की फाइल में कोई रिटर्न वैल्यू नहीं होती, और चलाने पर वह क्रैश हो जाती है।

C:\path\to\leap.ex:3
<0120>:: no value returned from function
end function
           ^

FAILURE: t_leap.e EUPHORIA error with status 1

Test results summary:
    FAIL: t_leap.e
Files (run: 1) (failed: 1) (0% success)

यह अपेक्षित है। फंक्शन लागू कीजिए, और फिर दोबारा चलाकर देखिए कि कौन-से टेस्ट पास होते हैं और कौन-से फेल।

interpreting t_leap.e:
  passed: year not divisible by 4 in common year
  failed: year divisible by 2, not divisible by 4 in common year, expected: FALSE but got: TRUE
  failed: year divisible by 4, not divisible by 100 in leap year, expected: TRUE but got: FALSE
  ...
  9 tests run, 6 passed, 3 failed, 67% success
FAILURE: t_leap.e program died with status 1

Test results summary:
    FAIL: t_leap.e
Files (run: 1) (failed: 1) (0% success)

एक-एक करके टेस्ट पूरे करना

शुरुआत करने का एक अच्छा तरीका यह है कि t_<exercise>.e में पहले टेस्ट के अलावा बाकी सारे टेस्ट कमेंट कर दीजिए।

test_false("year not divisible by 4 in common year", leap(1800))
-- test_false("year divisible by 100 but not by 3 is still not a leap year", leap(1900))
-- test_false("year divisible by 2, not divisible by 4 in common year", leap(1970))

इन्हें एक-एक करके कीजिए, और जैसे ही मौजूदा टेस्ट पास हो, अगले टेस्ट से कमेंट हटा दीजिए। जब सारे टेस्ट पास हो जाएँ, तो आपने अभ्यास पूरा कर लिया।