summaryrefslogtreecommitdiffhomepage
path: root/setupapi/setupapi_windows_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'setupapi/setupapi_windows_test.go')
-rw-r--r--setupapi/setupapi_windows_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/setupapi/setupapi_windows_test.go b/setupapi/setupapi_windows_test.go
index 3d9abd6..9f45a6f 100644
--- a/setupapi/setupapi_windows_test.go
+++ b/setupapi/setupapi_windows_test.go
@@ -177,6 +177,28 @@ func TestDevInfo_BuildDriverInfoList(t *testing.T) {
continue
}
+ if !driverData.IsNewer(windows.Filetime{}, 0) {
+ t.Error("Driver should have non-zero date and version")
+ }
+ if !driverData.IsNewer(windows.Filetime{HighDateTime: driverData.DriverDate.HighDateTime}, 0) {
+ t.Error("Driver should have non-zero date and version")
+ }
+ if driverData.IsNewer(windows.Filetime{HighDateTime: driverData.DriverDate.HighDateTime + 1}, 0) {
+ t.Error("Driver should report newer version on high-date-time")
+ }
+ if !driverData.IsNewer(windows.Filetime{HighDateTime: driverData.DriverDate.HighDateTime, LowDateTime: driverData.DriverDate.LowDateTime}, 0) {
+ t.Error("Driver should have non-zero version")
+ }
+ if driverData.IsNewer(windows.Filetime{HighDateTime: driverData.DriverDate.HighDateTime, LowDateTime: driverData.DriverDate.LowDateTime + 1}, 0) {
+ t.Error("Driver should report newer version on low-date-time")
+ }
+ if driverData.IsNewer(windows.Filetime{HighDateTime: driverData.DriverDate.HighDateTime, LowDateTime: driverData.DriverDate.LowDateTime}, driverData.DriverVersion) {
+ t.Error("Driver should not be newer than itself")
+ }
+ if driverData.IsNewer(windows.Filetime{HighDateTime: driverData.DriverDate.HighDateTime, LowDateTime: driverData.DriverDate.LowDateTime}, driverData.DriverVersion+1) {
+ t.Error("Driver should report newer version on version")
+ }
+
err = devInfoList.SetSelectedDriver(deviceData, driverData)
if err != nil {
t.Errorf("Error calling SetupDiSetSelectedDriver: %s", err.Error())