diff options
| author | jakob <jakob@memeware.net> | 2017-02-19 10:57:47 -0500 |
|---|---|---|
| committer | jakob <jakob@memeware.net> | 2017-02-19 10:57:47 -0500 |
| commit | 32fb7b11d83138cc288d62c1f1674d95cc94e8de (patch) | |
| tree | 290c5a27b58e24bb82bd46decba0aa5e1282e003 /test/test_io.c | |
| parent | 1fc6cc323dbaa5387d84630615c0d4cab0c1c5ba (diff) | |
Implemented table linked list, decompression and encryption. Tests have been improved.
Diffstat (limited to 'test/test_io.c')
| -rw-r--r-- | test/test_io.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test_io.c b/test/test_io.c index fd1e483..86dde8e 100644 --- a/test/test_io.c +++ b/test/test_io.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with Nekopack. If not, see <http://www.gnu.org/licenses/>. */ +#include <stdint.h> #include <string.h> #include "minunit.h" @@ -54,3 +55,35 @@ char *test_stream_rw(void) { stream_free(s); return NULL; } + + +char *test_stream_realloc(void) { + struct stream *s = stream_new(0x2); + stream_write(s, "\x00\x01\x02\x03", 4); + mu_assert("`len` not modified", s->len > 0x2); + return NULL; +} + + +char *test_stream_xor(void) { + struct stream *s = stream_new(2); + stream_write(s, "\x01\x01", 2); + stream_xor(s, 1, 0); + mu_assert("Initial key failure", !memcmp(s->_start, "\x00\x01", 2)); + stream_xor(s, 0, 1); + mu_assert("Primary key failure", !memcmp(s->_start, "\x01\x00", 2)); + stream_free(s); + return NULL; +} + + +char *test_stream_nav(void) { + struct stream *s = stream_new(2); + mu_assert("Cursor not at beginning", stream_tell(s) == 0); + stream_seek(s, 2); + mu_assert("Cursor not advanced", stream_tell(s) == 2); + stream_rewind(s); + mu_assert("Cursor not rewinded", stream_tell(s) == 0); + stream_free(s); + return NULL; +} |