Skip to content

Commit

Permalink
🚨 Test the C macros related to the SPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ronisbr committed Jun 24, 2020
1 parent 24a66d3 commit 3939448
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
using Test
using BaremetalPi

@test 1 == 1
################################################################################
# C Macros
################################################################################

# Test if the C Macros for the SPI protocol are being computed correctly.
@testset "C Macros - SPI" begin
@test BaremetalPi.SPI_IOC_RD_MODE == 0x80016b01
@test BaremetalPi.SPI_IOC_WR_MODE == 0x40016b01
@test BaremetalPi.SPI_IOC_RD_LSB_FIRST == 0x80016b02
@test BaremetalPi.SPI_IOC_WR_LSB_FIRST == 0x40016b02
@test BaremetalPi.SPI_IOC_RD_BITS_PER_WORD == 0x80016b03
@test BaremetalPi.SPI_IOC_WR_BITS_PER_WORD == 0x40016b03
@test BaremetalPi.SPI_IOC_RD_MAX_SPEED_HZ == 0x80046b04
@test BaremetalPi.SPI_IOC_WR_MAX_SPEED_HZ == 0x40046b04
@test BaremetalPi.SPI_IOC_MESSAGE(1) == 0x40206b00
@test BaremetalPi.SPI_IOC_MESSAGE(2) == 0x40406b00
@test BaremetalPi.SPI_IOC_MESSAGE(3) == 0x40606b00
@test BaremetalPi.SPI_IOC_MESSAGE(4) == 0x40806b00
@test BaremetalPi.SPI_IOC_MESSAGE(5) == 0x40a06b00
@test BaremetalPi.SPI_IOC_MESSAGE(6) == 0x40c06b00
@test BaremetalPi.SPI_IOC_MESSAGE(7) == 0x40e06b00
@test BaremetalPi.SPI_IOC_MESSAGE(8) == 0x41006b00
@test BaremetalPi.SPI_IOC_MESSAGE(9) == 0x41206b00
@test BaremetalPi.SPI_IOC_MESSAGE(10) == 0x41406b00
end

0 comments on commit 3939448

Please sign in to comment.