تعلّم كيف تختبر تمارين OpenEuphoria على Exercism
من مجلد التمرين، شغّل 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))
تعامل معها واحدة تلو الأخرى، وأزل التعليق عن الاختبار التالي بمجرد أن ينجح الاختبار الحالي. وعندما تنجح كل الاختبارات، تكون قد أكملت التمرين.