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

Importing test cases from /beatgammit/base64-js/ #3

Closed
prahaladbelavadi opened this issue Oct 11, 2018 · 1 comment
Closed

Importing test cases from /beatgammit/base64-js/ #3

prahaladbelavadi opened this issue Oct 11, 2018 · 1 comment

Comments

@prahaladbelavadi
Copy link
Contributor

I'm trying to import test cases from beatgammit/base64-js/

In beatgammit/base64-js:

  • big-data:
    • They generate a huge(8641028) uint8array
    • convert that array to base64
    • Convert base64 string back to bytearray and confirm if it matches
  • url-safe:
    • converts a base64 string with '+','/','_','-' to a byte array
    • converts the byte array back to base64 string and check if it matches
  • corrupt:
    • converts string to bytearray
    • checks for "=" in the bytearray that's not trailing
  • Convert:
    • converts base64 string to byte array
    • converts byte array to base 64 string and checks if they are equal
    • uses an array to test different strings

To import the tests to LinusU/fast-base64-decode

  • big data:
    • generate a big (8641028) uint8array
    • import a file containing the base64 string from the uint8array (what format, where should it be placed ?)
    • read the file
    • decode the contents using LinusU/fast-base64-decode (takes file content and byte length as params)
    • check if the generated uint8array and the decoded array matches
  • url-safe:
    • check if string containing '+','/','_','-' decodes into [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff] array
  • corrupt:
    • convert a base64 string containing padding bytes to a bytearray
    • iterate through the byte array checking for the "=" character in between and isn't trailing
  • convert:
    • already has independent tests to confirm base64 to byte array decoding;
    • does not support encoding; so no tests for encoding

Do correct me if I'm wrong somewhere or missing something out.

I did have a couple of questions with regard to the big data tests;

  • The javascript heap stack runs out while trying to operate on a big binary file
  • While writing and reading to an external file, what format do I use to store/read the file ?
  • where do I place the file ? Would it be okay if I made a folder for the tests and split them into different files ?
  • Is importing a binary file to do big data tests a normal thing ? or are there better methods to test it ?
  • [corrupt]:

Do let me know if I'm heading in the right direction or need to correct something.

Thank you @LinusU

@LinusU
Copy link
Owner

LinusU commented Oct 30, 2022

Sorry for the extremely slow response here. I've merged your PR, and I've added the "big data" test as well: 5cf93b3

Let me know if there is anything more you think we should do! Thank you so much for your contribution 🙏

@LinusU LinusU closed this as completed Oct 30, 2022
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

No branches or pull requests

2 participants