Adding upstream version 0.1.10+dfsg.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
157f539082
commit
4d3e0bf859
42 changed files with 10556 additions and 0 deletions
45
tests/text.js
Executable file
45
tests/text.js
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
"use strict";
|
||||
|
||||
var tape = require('blue-tape');
|
||||
|
||||
var Zmodem = require('../src/zmodem');
|
||||
|
||||
var ZText = Zmodem.Text;
|
||||
|
||||
const TEXTS = [
|
||||
[ "-./", [45, 46, 47] ],
|
||||
[ "épée", [195, 169, 112, 195, 169, 101] ],
|
||||
[ "“words”", [226, 128, 156, 119, 111, 114, 100, 115, 226, 128, 157] ],
|
||||
[ "🍊", [240, 159, 141, 138] ],
|
||||
[ "🍊🍊", [240, 159, 141, 138, 240, 159, 141, 138] ],
|
||||
];
|
||||
|
||||
tape('decoder', function(t) {
|
||||
var decoder = new ZText.Decoder();
|
||||
|
||||
TEXTS.forEach( (tt) => {
|
||||
t.is(
|
||||
decoder.decode( new Uint8Array(tt[1]) ),
|
||||
tt[0],
|
||||
`decode: ${tt[1]} -> ${tt[0]}`
|
||||
);
|
||||
} );
|
||||
|
||||
t.end();
|
||||
} );
|
||||
|
||||
tape('encoder', function(t) {
|
||||
var encoder = new ZText.Encoder();
|
||||
|
||||
TEXTS.forEach( (tt) => {
|
||||
t.deepEquals(
|
||||
encoder.encode(tt[0]),
|
||||
new Uint8Array( tt[1] ),
|
||||
`encode: ${tt[0]} -> ${tt[1]}`
|
||||
);
|
||||
} );
|
||||
|
||||
t.end();
|
||||
} );
|
Loading…
Add table
Add a link
Reference in a new issue