multihash icon indicating copy to clipboard operation
multihash copied to clipboard

Standard Implementation Test Suite

Open jbenet opened this issue 8 years ago • 12 comments

we should have a standard test suite in this repo, to be used across implementations.

Perhaps:

  • require an implementation can produce an executable we can call to exercise an implementation like the go-multihash bin. (options below)
  • setup a sharness test suite with clear examples that can test any bin
  • make it easy for this suite to be included in an implementation to test it.
  • setup a sharness suite to test all known implementations in this repo.

@chriscool maybe this is something you could help with? o/


Proposed options of the bin:

> multihash --help
usage: multihash [options] [FILE]
Print or check multihash checksums.
With no FILE, or when FILE is -, read standard input.

Options:
  -a, --algorithm string  one of: sha1, sha2-256, sha2-512, sha3 (default: sha2-256)
  -c, --check string      check checksum matches
  -e, --encoding string   one of: raw, hex, base58, base64 (default: base58)
  -l, --length int        checksum length in bits (truncate). -1 is default (default: -1)
  -q, --quiet             quiet output (no newline on checksum, no error text)

jbenet avatar Jun 21 '16 08:06 jbenet

Ok I will take a look at this soon.

chriscool avatar Jun 21 '16 09:06 chriscool

We need:

  • [ ] flesh out the sharness test suite to test all the algorithms, lengths, etc
    • we can define the sharness test suite as the bin's "api spec"
  • [ ] make it easy to swap other binaries in the sharness test suite.

@chriscool possible to take a look at this sooner? @Kubuxu wants to be able to test his c-multihash impl with it.

jbenet avatar Aug 06 '16 16:08 jbenet

In js-land, we also need:

  • [ ] making the js-multihash bin to conform to this test suite
  • [ ] adding the test suite to js-multihash/js-multihashing

@RichardLitt possible for you to handle this one? or @dignifiedquire @diasdavid

jbenet avatar Aug 06 '16 16:08 jbenet

I can help making the js cli compliant but I don't have time writing the tests.

dignifiedquire avatar Aug 06 '16 16:08 dignifiedquire

nvm just saw the base setup will take a look at integrating Monday/Tuesday

dignifiedquire avatar Aug 06 '16 17:08 dignifiedquire

PR #39 starts to implement some tests.

@jbenet: to make it easy to swap other binaries, do you want the test suite to check if for example the MULTIHASH env variable is defined and, in this case test $MULTIHASH instead of 'multihash'?

chriscool avatar Aug 06 '16 20:08 chriscool

Also something we have discussed is separating multihash from multihashing. Meaning we should have two sets of tests, one for encoding and decoding and second for hashing.

Kubuxu avatar Aug 06 '16 20:08 Kubuxu

@chriscool: yeah, maybe MULTIHASH_BIN ?

@Kubuxu: maybe. Let's start with just different test files in the sharness tests and break it out only once needed. On Sat, Aug 6, 2016 at 16:09 Jakub Sztandera [email protected] wrote:

Also something we have discussed is separating multihash from multihashing. Meaning we should have two sets of tests, one for encoding and decoding and second for hashing.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/multiformats/multihash/issues/32#issuecomment-238046401, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIcoW0hGl_xEOT4T0ZiUbcKzt9cUwEAks5qdOoBgaJpZM4I6eEy .

jbenet avatar Aug 07 '16 07:08 jbenet

@dignifiedquire What is the status of the test suite?

RichardLitt avatar Dec 02 '16 16:12 RichardLitt

@RichardLitt same as before, I completely forgot about this :/

dignifiedquire avatar Dec 02 '16 17:12 dignifiedquire

@dignifiedquire Will you be able to get to it? Alternatively, I can take a look.

RichardLitt avatar Dec 02 '16 17:12 RichardLitt

@RichardLitt please do so, but keep im mind js-multihasing-async is the main used module now

dignifiedquire avatar Dec 02 '16 19:12 dignifiedquire