Comments (2)
Looking at the current function to extract and process the current digit, it looks like this will likely be a problem with strings more than a couple of digits long due to the difference between the length function and the zero-indexing of strings (i.e. calculating the character index from the string length):
int currentDigit = int.Parse(input.Substring(input.Length - i - 1, 1));
(where i
starts at 0).
This needs to be tested to confirm that it is processing every digit for strings of any length.
from luhncheck.
Tested by decomposing the digit selection function in commit - can be seen to be working normally. Failing issue seems to be more related to the Luhn algorithm itself not being implemented correctly.
from luhncheck.
Related Issues (19)
- TestTheData does not use strings from InputString HOT 1
- Remove duplication in unit tests HOT 1
- CalculateLuhnDigit does not reduce doubled digits that exceed 9
- Action fails on dotnet build and dotnet test due to missing reference assemblies HOT 4
- Luhn algorithm is not implemented correctly
- Add unit tests for ConsoleApp.cs
- Extract instantiation to new class
- Luhn calculation method does not return correct check digit HOT 1
- Add code coverage metrics using Coverlet and Codecov HOT 6
- Migrate LuhnCheck and LuhnLibrary to .NET Core
- Complete coverage for CheckLuhnSuffixReturnString HOT 1
- luhnDigit is not reduced to a single digit at the end of the calculation HOT 3
- Add unit test coverage to project HOT 2
- Move method CalculateLuhnDigit into class library HOT 1
- Abstract current use case to AddSuffix method HOT 1
- Add method to validate existing suffix as ValidateSuffix HOT 1
- Make command line interface more explicit HOT 1
- AddLuhnSuffix() and CheckLuhnSuffix() are not consistent HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luhncheck.