nskinkel / libredsalt

2 stars 1 forks source link

Fix issue 11 #22

Closed nskinkel closed 9 years ago

nskinkel commented 9 years ago

Warning: this PR assumes #21 has been merged and is branched off that.

This pull request fixes issues stopping doctest from running, makes all documentation examples run properly, reorganizes project structure to get nicer namespacing, and adds integration tests ported from nacl-201102211.

doctest issues

doctest was not running because we were building a staticlib. This PR changes the crate type to rlib, which lets doctest run properly and allows us to use standard cargo integration testing (e.g. in a tests directory).

Documentation example bugs

This PR fixes all problems in documentation examples so they all build nicely.

Project structure

This PR also reorganizes the project structure in two ways:

Now, lib syntax will be crypto::sign::open() with proper namespacing instead of crypto_sign_open(). This also lets constants be used more nicely like crypto::hash::BYTES.

Integration tests

A tests directory was added with integration tests from nacl-20110221. Some of the tests didn't apply (a lot of them are repeated twice, once for the C core and once for the C++ wrappers; we only need one copy). And a few others couldn't be run (relied on SHA256 being an option, which tweetnacl doesn't have).

But I ported over as many as were applicable.

Issues

This PR fixes issues #11 and #15