tests/testthat/test-conditions.R

test_that("Checking conditions work fine, with Spanish functions", {
  generar_mundo("mundo001")
  expect_true(frente_abierto())
  expect_false(frente_cerrado())
  expect_true(izquierda_abierto())
  expect_false(izquierda_cerrado())
  expect_false(derecha_abierto())
  expect_true(derecha_cerrado())
  expect_false(hay_cosos())
  expect_true(no_hay_cosos())
  expect_true(karel_tiene_cosos())
  expect_false(karel_no_tiene_cosos())
  expect_true(mira_al_este())
  expect_false(mira_al_oeste())
  expect_false(mira_al_norte())
  expect_false(mira_al_sur())
})

test_that("Checking conditions work fine, with English functions", {
  generar_mundo("mundo001")
  expect_true(front_is_clear())
  expect_false(front_is_blocked())
  expect_true(left_is_clear())
  expect_false(left_is_blocked())
  expect_false(right_is_clear())
  expect_true(right_is_blocked())
  expect_false(beepers_present())
  expect_true(no_beepers_present())
  expect_true(karel_has_beepers())
  expect_false(karel_has_no_beepers())
  expect_true(facing_east())
  expect_false(facing_west())
  expect_false(facing_north())
  expect_false(facing_south())
})
mpru/karel documentation built on July 27, 2024, 5:25 p.m.