Testare sul track OpenEuphoria

Scopri come testare i tuoi esercizi di OpenEuphoria su Exercism


Eseguire i test

Dalla directory dell'esercizio, esegui exercism test oppure eutest. Euphoria eseguirà poi t_<exercise>.e sulla soluzione.

Leggere l'output

All'inizio di un esercizio, il file della soluzione non ha un valore restituito e va in errore quando viene eseguito.

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)

È normale. Implementa la funzione, poi esegui di nuovo per vedere quali test passano e quali falliscono.

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)

Procedere con i test in modo incrementale

Un buon modo per iniziare è trasformare in commento tutti i test tranne il primo in 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))

Affrontali uno alla volta, rimuovendo il commento dal test successivo non appena quello corrente passa. Quando tutti i test passano, hai completato l'esercizio.