| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Search::Fzf::AlgoCpp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Test::More tests => 4; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | open my $fileH, "<t/testfile"; | |||||||||
| 8 | |||||||||||
| 9 | 1 | my $tac = 0; | |||||||||
| 10 | 1 | my $caseInsensitive = 1; | |||||||||
| 11 | 1 | my $headerLines = 0; | |||||||||
| 12 | 1 | my $algo = Search::Fzf::AlgoCpp->new($tac, $caseInsensitive, $headerLines); | |||||||||
| 13 | 1 | $algo->asynRead($fileH); | |||||||||
| 14 | 1 | while(1) { | |||||||||
| 15 | 546 | ▶ | last if $algo->getReaderStatus() == 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | } | ||||||||||
| 17 | 1 | close $fileH; | |||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | ok($algo->getCatArraySize == 13, "simple read from array.") || print "Bail out!\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 1 | my $iPattern = "9"; | |||||||||
| 22 | 1 | my $isSort = 0; | |||||||||
| 23 | 1 | my $threadNum = 0; | |||||||||
| 24 | 1 | my $algoType = 2; # 0---Exact 1---V1 2---V2 | |||||||||
| 25 | #first match | ||||||||||
| 26 | 1 | my $ret = $algo->matchList($iPattern, $isSort, $caseInsensitive, $algoType, $threadNum); | |||||||||
| 27 | 1 | my $matchNum = scalar @{$ret}; | |||||||||
| 28 | |||||||||||
| 29 | 1 | ▶ | ok($matchNum == 4, "test of algo V2.") || print "Bail out!\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | 1 | $iPattern = "99"; | |||||||||
| 32 | 1 | $isSort = 0; | |||||||||
| 33 | 1 | $threadNum = 4; | |||||||||
| 34 | 1 | $ret = $algo->matchList($iPattern, $isSort, $caseInsensitive, $algoType, $threadNum); | |||||||||
| 35 | |||||||||||
| 36 | 1 | $matchNum = scalar @{$ret}; | |||||||||
| 37 | 1 | ▶ | ok($matchNum == 2, "continue test of algo V2.") || print "Bail out!\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | |||||||||||
| 39 | 1 | my $nullArr = $algo->getNullMatchList(); | |||||||||
| 40 | 1 | my $size = scalar @{$nullArr}; | |||||||||
| 41 | 1 | ok($size == 13, "test getNullMatchList."); | |||||||||
| 42 | |||||||||||