Repository: adhocore/gronx (go)

Issue:
Range-with-step showing time outside the range as due
First of all, thanks for the awesome library.

For the following example, IsDue() is returning `true` incorrectly.
```
expr = 0-10/2 * * * *
ref  = 2011-06-20 12:12:00
```

I think it is because of this function:
```
func inStepRange(val, start, end, step int) bool {
	for {
		if start == val {
			return true
		}
		if start > end {
			return false
		}

		start += step
	}
}
```

After `start += step`, the next time around the loop, the code fails to check whether `start > end`. 

I think the problem can be solved by interchanging the order of the two `if` conditions within the `for` loop. I'll be happy to submit a PR if you are accepting.

Pull request:
Fix range-with-step check for boundary condition (#6)
Fixes #6 

Patch:
diff --git a/validator.go b/validator.go
index 3437f42..074415b 100644
--- a/validator.go
+++ b/validator.go
@@ -53,16 +53,12 @@ func inRange(val int, s string) (bool, error) {
 }
 
 func inStepRange(val, start, end, step int) bool {
-	for {
-		if start == val {
+	for i := start; i <= end && i <= val; i += step {
+		if i == val {
 			return true
 		}
-		if start > end {
-			return false
-		}
-
-		start += step
 	}
+	return false
 }
 
 func isValidMonthDay(val string, last int, ref time.Time) (bool, error) {


Test patch:
diff --git a/gronx_test.go b/gronx_test.go
index 8948172..c6a55c3 100644
--- a/gronx_test.go
+++ b/gronx_test.go
@@ -129,6 +129,7 @@ func testcases() []Case {
 		{"0 0 * * 2-7", "2011-06-18 23:09:00", false},
 		{"0 0 * * 4-7", "2011-07-19 00:00:00", false},
 		{"0-12/4 * * * *", "2011-06-20 12:04:00", true},
+		{"0-10/2 * * * *", "2011-06-20 12:12:00", false},
 		{"4-59/2 * * * *", "2011-06-20 12:04:00", true},
 		{"4-59/2 * * * *", "2011-06-20 12:06:00", true},
 		{"4-59/3 * * * *", "2011-06-20 12:06:00", false},