@@ -3,13 +3,12 @@ import assert from 'node:assert';
33import { suite } from 'perf-insight' ;
44
55import type { Trie } from '../src/lib/index.ts' ;
6- import type { FastTrieBlob } from '../src/lib/TrieBlob/FastTrieBlob.ts' ;
7- import { FastTrieBlobBuilder } from '../src/lib/TrieBlob/FastTrieBlobBuilder.ts' ;
86import { TrieBlob } from '../src/lib/TrieBlob/TrieBlob.ts' ;
7+ import { TrieBlobBuilder } from '../src/lib/TrieBlob/TrieBlobBuilder.ts' ;
98import type { TrieData } from '../src/lib/TrieData.ts' ;
109import { TrieNodeTrie } from '../src/lib/TrieNode/TrieNodeTrie.ts' ;
1110import { walkerWordsITrie } from '../src/lib/walker/walker.ts' ;
12- import { readFastTrieBlobFromConfig , readTrieFromConfig } from '../src/test/dictionaries.test.helper.ts' ;
11+ import { readTrieBlobFromConfig , readTrieFromConfig } from '../src/test/dictionaries.test.helper.ts' ;
1312
1413// const weightMapEn = getEnglishWeightMap();
1514
@@ -29,16 +28,16 @@ class DI {
2928 }
3029
3130 private _trieFast = lazy ( ( ) => {
32- return getFastTrieBlob ( ) ;
31+ return getTrieBlob ( ) ;
3332 } ) ;
3433
35- get trieFastNL ( ) {
34+ get trieBlobNL ( ) {
3635 return this . _trieFastNL ( ) ;
3736 }
3837
39- private _trieFastNL = lazy ( ( ) => getFastTrieBlobNL ( ) ) ;
38+ private _trieFastNL = lazy ( ( ) => getTrieBlobNL ( ) ) ;
4039
41- get trieFast ( ) {
40+ get trieBlob ( ) {
4241 return this . _trieFast ( ) ;
4342 }
4443
@@ -56,8 +55,8 @@ class DI {
5655interface TestDependencies {
5756 trie : Trie ;
5857 words : string [ ] ;
59- trieFast : FastTrieBlob ;
60- trieFastNL : FastTrieBlob ;
58+ trieBlob : TrieBlob ;
59+ trieBlobNL : TrieBlob ;
6160}
6261
6362type DependenciesKeys = keyof TestDependencies ;
@@ -67,22 +66,12 @@ const di = new DI();
6766// const measureTimeout = 100;
6867
6968suite ( 'blob.FastTrieBlobBuilder' , async ( test ) => {
70- const { trie, words, trieFast } = await prepareDI ( [ 'trie' , 'words' , 'trieFast' ] ) ;
71- const trieBlob = FastTrieBlobBuilder . fromTrieRoot ( trie . root ) . toTrieBlob ( ) ;
72- const trieBlobFromFast = trieFast . toTrieBlob ( ) ;
73- assert ( ! words . some ( ( w ) => ! trieFast . has ( w ) ) , 'Expect all words to be found in trieFast.' ) ;
74- assert ( ! words . some ( ( w ) => ! trieBlobFromFast . has ( w ) ) , 'Expect all words to be found in trieBlobFromFast.' ) ;
69+ const { trie, words, trieBlob } = await prepareDI ( [ 'trie' , 'words' , 'trieBlob' ] ) ;
70+ assert ( ! words . some ( ( w ) => ! trieBlob . has ( w ) ) , 'Expect all words to be found in trieFast.' ) ;
7571 assert ( ! words . some ( ( w ) => ! trie . has ( w ) ) , 'Expect all words to be found in trie.' ) ;
7672 assert ( ! words . some ( ( w ) => ! trieBlob . has ( w ) ) , 'Expect all words to be found in trieBlob. p1' ) ;
7773
78- test ( 'FastTrieBlobBuilder.fromTrieRoot' , ( ) => FastTrieBlobBuilder . fromTrieRoot ( trie . root ) ) ;
79-
80- test . prepare ( ( ) => FastTrieBlobBuilder . fromTrieRoot ( trie . root ) ) . test (
81- 'blob.FastTrieBlobBuilder.fromTrieRoot' ,
82- ( ft ) => ft . toTrieBlob ( ) ,
83- ) ;
84-
85- test ( 'blob.createTrieBlobFromITrieNodeRoot' , ( ) => FastTrieBlobBuilder . fromTrieRoot ( trie . root ) . toTrieBlob ( ) ) ;
74+ test ( 'TrieBlobBuilder.fromTrieRoot' , ( ) => TrieBlobBuilder . fromTrieRoot ( trie . root ) ) ;
8675
8776 test ( 'blob.TrieBlob.has' , ( ) => trieHasWords ( trieBlob , words ) ) ;
8877 test ( 'blob.words' , ( ) => [ ...trieBlob . words ( ) ] ) ;
@@ -118,12 +107,12 @@ function getTrie() {
118107 return readTrieFromConfig ( '@cspell/dict-en_us/cspell-ext.json' ) ;
119108}
120109
121- function getFastTrieBlob ( ) {
122- return readFastTrieBlobFromConfig ( '@cspell/dict-en_us/cspell-ext.json' ) ;
110+ function getTrieBlob ( ) {
111+ return readTrieBlobFromConfig ( '@cspell/dict-en_us/cspell-ext.json' ) ;
123112}
124113
125- function getFastTrieBlobNL ( ) {
126- return readFastTrieBlobFromConfig ( '@cspell/dict-nl-nl/cspell-ext.json' ) ;
114+ function getTrieBlobNL ( ) {
115+ return readTrieBlobFromConfig ( '@cspell/dict-nl-nl/cspell-ext.json' ) ;
127116}
128117
129118function trieHasWords ( trie : TrieData , words : string [ ] ) : boolean {
0 commit comments