Skip to content

Commit

Permalink
add Precision() test
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulKa committed Jan 16, 2024
1 parent 9f1bd14 commit 8503564
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions aht20/aht20_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,17 @@ func TestDev_SoftReset(t *testing.T) {
t.Fatal(err)
}
}

func TestDev_Precision(t *testing.T) {
dev := Dev{d: &i2c.Dev{Bus: &i2ctest.Playback{}, Addr: deviceAddress}, opts: DefaultOpts}
var env physic.Env
dev.Precision(&env)

if env.Temperature == 0 {
t.Fatal("expected temperature precision")
} else if env.Pressure != 0 {
t.Fatal("expected no pressure precision")
} else if env.Humidity == 0 {
t.Fatal("expected humidity precision")
}
}

0 comments on commit 8503564

Please sign in to comment.