2018-07-16 07:19:50 +03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var utils = require('./utils');
|
2018-07-23 10:02:39 +03:00
|
|
|
var ethers = utils.getEthers(__filename);
|
2018-07-16 07:19:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
function checkWordlist(filename, wordlist) {
|
|
|
|
var words = utils.loadText(filename).split('\n');
|
|
|
|
it('matches wordlists for ' + wordlist.locale, function() {
|
|
|
|
for (var i = 0; i < 2048; i++) {
|
|
|
|
var actual = wordlist.getWord(i);
|
|
|
|
var expected = words[i];
|
|
|
|
assert.equal(actual, expected, 'failed to match word ' + i + ': ' + words[i] + ' !=' + wordlist.getWord(i));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
describe('Check Wordlists', function() {
|
|
|
|
checkWordlist('./wordlist-generation/lang-en.txt', ethers.wordlists.en);
|
|
|
|
checkWordlist('./wordlist-generation/lang-it.txt', ethers.wordlists.it);
|
|
|
|
checkWordlist('./wordlist-generation/lang-ja.txt', ethers.wordlists.ja);
|
|
|
|
checkWordlist('./wordlist-generation/lang-ko.txt', ethers.wordlists.ko);
|
|
|
|
checkWordlist('./wordlist-generation/lang-zh_cn.txt', ethers.wordlists.zh);
|
|
|
|
checkWordlist('./wordlist-generation/lang-zh_cn.txt', ethers.wordlists.zh_cn);
|
|
|
|
checkWordlist('./wordlist-generation/lang-zh_tw.txt', ethers.wordlists.zh_tw);
|
|
|
|
});
|