Zacznij terazZacznij za darmo

Fix expectation errors

Sometimes it becomes necessary to fix tests that may have been entered incorrectly to their correct forms. As you've looked over function definitions like that of temp_converter(), unit testing is also a handy technique to familiarize yourself with the inner workings of package functionality. In this exercise, you'll explore fixing tests, grouping them together, and also testing groups all at once.

You'll begin by reviewing errors in the first step, and then fix the errors in the second step.

The testthat package and the unitConverter package at this point in development have been loaded for you.

To ćwiczenie jest częścią kursu

Developing R Packages

Zobacz kurs

Interaktywne ćwiczenie praktyczne

Spróbuj tego ćwiczenia, uzupełniając ten przykładowy kod.

# Change each of the expectations below to have correct outputs
expect_equal(
  dist_converter(200, unit_from = "meters", unit_to = "feet"),
  60.96
)
expect_equal(
  dist_converter(656, unit_from = "feet", unit_to = "meters"),
  14
)
Edytuj i uruchom kod