'use strict';

// MODULES //

var tape = require( 'tape' );
var ksa = require( './../lib/ksa.js' );


// FIXTURES //

var byte_array = require( './fixtures/ksa.json' );


// TESTS //

tape( 'main export is a function', function test( t ) {
	t.ok( true, __filename );
	t.equal( typeof ksa, 'function', 'main export is a function' );
	t.end();
});

tape( 'the function returns a permuted byte array', function test( t ) {
	var expected;
	var S;

	expected = new Uint8Array( byte_array );

	S = ksa( 'pwd12' );

	t.equal( S instanceof Uint8Array, true, 'returns a Uint8Array' );
	t.equal( S.length, 256, 'length is 256' );
	t.deepEqual( S, expected, 'returns expected byte array' );

	t.end();
});

'use strict';

// MODULES //

var tape = require( 'tape' );
var ksa = require( './../lib/ksa.js' );


// FIXTURES //

var byte_array = require( './fixtures/ksa.json' );


// TESTS //

tape( 'main export is a function', function test( t ) {
	t.ok( true, __filename );
	t.equal( typeof ksa, 'function', 'main export is a function' );
	t.end();
});

tape( 'the function returns a permuted byte array', function test( t ) {
	var expected;
	var S;
	var i;

	expected = new Uint8Array( byte_array );

	S = ksa( 'pwd12' );

	t.equal( S instanceof Uint8Array, true, 'returns a Uint8Array' );
	t.equal( S.length, 256, 'length is 256' );
	for ( i = 0; i < S.length; i++ ) {
		t.equal( S[i], expected[i], 'element '+i+' ('+S[i]+') has expected value '+expected[i] );
	}
	t.end();
});

Modify test to print expected and actual values
Modify test to print expected and actual values
