This commit is contained in:
parent
fbcafef67c
commit
cad01edab8
3 changed files with 38 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ pub fn main() -> Nil {
|
|||
gleeunit.main()
|
||||
}
|
||||
|
||||
pub fn file_read_test() {
|
||||
pub fn sensor_name_and_unit_test() {
|
||||
let reading =
|
||||
sensors.sensor_name(sensors.Temperature)
|
||||
<> " "
|
||||
|
|
@ -28,3 +28,17 @@ pub fn parse_topic_1_test() {
|
|||
sensors.SensorReading(sensor: sensors.Pressure, value: 944.67),
|
||||
])
|
||||
}
|
||||
|
||||
pub fn parse_topic_2_test() {
|
||||
let json_string = "{\"pm1\":16.83,\"pm2_5\":10.68,\"pm10\":16.619719}"
|
||||
let readings = sensors.parse_topic_2(json_string)
|
||||
readings
|
||||
|> should.equal([
|
||||
sensors.SensorReading(sensor: sensors.ParticalMatterOne, value: 16.83),
|
||||
sensors.SensorReading(
|
||||
sensor: sensors.ParticalMatterTwoPointFive,
|
||||
value: 10.68,
|
||||
),
|
||||
sensors.SensorReading(sensor: sensors.ParticalMatterTen, value: 16.619719),
|
||||
])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue