Skip to content

Commit

Permalink
add tests for all 40 pins
Browse files Browse the repository at this point in the history
  • Loading branch information
mnr committed Nov 28, 2023
1 parent f184a0f commit 048a417
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion tests/testthat/test-rpi_pinToBCM.R
Original file line number Diff line number Diff line change
@@ -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))
})

0 comments on commit 048a417

Please sign in to comment.