Skip to content

Commit 73091d0

Browse files
committed
Update notes
1 parent f5f2a31 commit 73091d0

4 files changed

Lines changed: 71 additions & 61 deletions

File tree

index.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Introduction to testing R code"
33
author: "Brad Duthie"
4-
date: "15 APR 2025"
4+
date: "15 APR 2026"
55
output:
66
html_document:
77
code_folding: show

index.html

Lines changed: 52 additions & 58 deletions
Large diffs are not rendered by default.

temperature/test-temp_conversion.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ library(testthat);
22
context("Temperature function testing");
33
source("temp_conversion.R");
44

5-
test_that("Fahrenheit to Celsius", {
5+
test_that("Fahrenheit to Celsius function", {
66

77
temp_C <- F_to_C(50);
88

@@ -13,7 +13,7 @@ test_that("Fahrenheit to Celsius", {
1313
expect_that( object = temp_C, condition = equals(10) );
1414
})
1515

16-
test_that("Celsius to Fahrenheit", {
16+
test_that("Celsius to Fahrenheit function", {
1717

1818
temp_F <- C_to_F(10);
1919

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
library(testthat);
2+
context("Temperature function testing new");
3+
source("temp_conversion.R");
4+
5+
test_that("Fahrenheit to Celsius fail", {
6+
7+
temp_C <- F_to_C(32);
8+
9+
# Test that the result is numeric
10+
expect_that( object = is.numeric(temp_C), condition = equals(TRUE) );
11+
12+
# Test that the result is the correct value
13+
expect_that( object = temp_C, condition = equals(0) );
14+
})
15+
16+

0 commit comments

Comments
 (0)