Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional: vinUS validation fails on valid vin numbers (#2460)
* Removed === compare, changed to == Compare by value and type (===) does not work for this algorithm, as both cd and cdv can be either types at the same time. By comparing by value only (==) cd and cdv can be either integer or string, as a string number will be converted to a number reqardless of type. * Rewrote forloop, removed nested forloop * Additional: fixed spacing issues * Additional: Add vinUS.js validation test cases Test cases include default test with 17 one's, and additional US and Canada VIN * Additional: add two more test casses for vinUS * Additional: removed text license number, should be VIN
- Loading branch information
Showing
3 changed files
with
43 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
QUnit.test( "vinUS", function( assert ) { | ||
var method = methodTest( "vinUS" ); | ||
assert.ok( method( "11111111111111111" ), "Valid test VIN number" ); | ||
assert.ok( method( "1FTFX1CT9CFD06231" ), "Valid US VIN number" ); | ||
assert.ok( method( "2FTHF26F8SCA68695" ), "Valid CAN VIN number" ); | ||
assert.ok( method( "LJCPCBLCX11000237" ), "Valid VIN with X check digit" ); | ||
assert.ok( !method( "LJCPCBLC011000237" ), "Invalid VIN with 0 check digit" ); | ||
assert.ok( !method( "2FTHF26F8" ), "InValid VIN number" ); | ||
assert.ok( !method( "11111111X1111111" ), "Invalid test VIN" ); | ||
assert.ok( !method( "1111111101111111" ), "Invalid test VIN" ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters