From 048a417f799a2d7a47975926ee968f4f5f5d3525 Mon Sep 17 00:00:00 2001 From: Mark Niemann-Ross Date: Tue, 28 Nov 2023 04:31:28 -0800 Subject: [PATCH] add tests for all 40 pins --- tests/testthat/test-rpi_pinToBCM.R | 40 +++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-rpi_pinToBCM.R b/tests/testthat/test-rpi_pinToBCM.R index 87a41b4..4de0984 100644 --- a/tests/testthat/test-rpi_pinToBCM.R +++ b/tests/testthat/test-rpi_pinToBCM.R @@ -1,7 +1,45 @@ test_that("is pin correctly converted to BCM", { + expect_error(rpi_pinToBCM(1)) + expect_error(rpi_pinToBCM(2)) + expect_named(rpi_pinToBCM(3), "GPIO02") + expect_error(rpi_pinToBCM(4)) + expect_named(rpi_pinToBCM(5), "GPIO03") + expect_error(rpi_pinToBCM(6)) + expect_named(rpi_pinToBCM(7), "GPIO04") + expect_named(rpi_pinToBCM(8), "GPIO14") + expect_error(rpi_pinToBCM(9)) + expect_named(rpi_pinToBCM(10), "GPIO15") + expect_named(rpi_pinToBCM(11), "GPIO17") + expect_named(rpi_pinToBCM(12), "GPIO18") + expect_named(rpi_pinToBCM(13), "GPIO27") + expect_error(rpi_pinToBCM(14)) + expect_named(rpi_pinToBCM(15), "GPIO22") + expect_named(rpi_pinToBCM(16), "GPIO23") + expect_error(rpi_pinToBCM(17)) + expect_named(rpi_pinToBCM(18), "GPIO24") + expect_named(rpi_pinToBCM(19), "GPIO10") + expect_error(rpi_pinToBCM(20)) + expect_named(rpi_pinToBCM(21), "GPIO09") + expect_named(rpi_pinToBCM(22), "GPIO25") + expect_named(rpi_pinToBCM(23), "GPIO11") + expect_named(rpi_pinToBCM(24), "GPIO08") + expect_error(rpi_pinToBCM(25)) + expect_named(rpi_pinToBCM(26), "GPIO07") + expect_named(rpi_pinToBCM(27), "GPIO00") + expect_named(rpi_pinToBCM(28), "GPIO01") + expect_named(rpi_pinToBCM(29), "GPIO05") + expect_error(rpi_pinToBCM(30)) + expect_named(rpi_pinToBCM(31), "GPIO06") + expect_named(rpi_pinToBCM(32), "GPIO12") + expect_named(rpi_pinToBCM(33), "GPIO13") + expect_error(rpi_pinToBCM(34)) + expect_named(rpi_pinToBCM(35), "GPIO19") + expect_named(rpi_pinToBCM(36), "GPIO16") + expect_named(rpi_pinToBCM(37), "GPIO26") + expect_named(rpi_pinToBCM(38), "GPIO20") + expect_error(rpi_pinToBCM(39)) expect_named(rpi_pinToBCM(40), "GPIO21") }) test_that("is pin correctly converted to BCM", { - expect_error(rpi_pinToBCM(1)) })