Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAN-13 barcode doesn't automatically calculate checksum when not provided #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mjamro
Copy link

@mjamro mjamro commented Mar 15, 2024

JAN-13 barcode doesn't automatically calculate checksum when not provided. This differs from the EAN-13 behaviour which calculates it correctly.

The provided unit tests reproduces that case.

@@ -6,12 +6,16 @@ namespace BarcodeLib.Symbologies
/// JAN-13 encoding
/// Written by: Brad Barnhill
/// </summary>
class JAN13 : BarcodeCommon, IBarcode
internal class JAN13 : BarcodeCommon, IBarcode
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we mark this symbology as internal shouldnt we mark the others as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we mark this symbology as internal shouldnt we mark the others as well?

There’s no reason to mark a class in the global scope internal. That is the default visibility. I’d argue to remove internal here instead of adding it.

public JAN13(string input)
{
RawData = input;
_ean13 = new EAN13(input);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of initing an EAN13 here wouldnt it be better to expose the check digit method there and call the check digit here in the constructor OR make a copy of the CheckDigit() method in JAN so we get proper error codes here and just calculate it here. This way the init doesnt have to happen which runs the encoding and such till after the data validation is done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants