             return
         }
         XCTFail("passwordAtTime(\(badTime)) should throw an error)")
+    }
+
+    func testPasswordWithInvalidPeriod() {
+        let generator = Generator(unvalidatedFactor: .Timer(period: 0))
+        let time: NSTimeInterval = 100
+
+        do {
+            _ = try generator.passwordAtTime(time)
+        } catch Generator.Error.InvalidPeriod {
+            // This is the expected type of error
+            return
+        } catch {
+            XCTFail("passwordAtTime(\(time)) threw an unexpected type of error: \(error))")
+            return
+        }
+        XCTFail("passwordAtTime(\(time)) should throw an error)")
     }
 
     // The values in this test are found in Appendix D of the HOTP RFC

        }
    }
}

//  GeneratorTests.swift
//  OneTimePassword
//
//  Copyright (c) 2014-2016 Matt Rubin and the OneTimePassword authors
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
