mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Html: Move get_elem_val to xo.elem
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*;
|
||||
import org.junit.*; import gplx.xowa.langs.cases.*;
|
||||
public class Srch_highlight_mgr_tst {
|
||||
private final Srch_highlight_mgr_tstr tstr = new Srch_highlight_mgr_tstr();
|
||||
@Test public void Full__one() {tstr.Test("a" , "A" , "<strong>A</strong>");}
|
||||
@Test public void Full__many() {tstr.Test("a b" , "A B" , "<strong>A</strong> <strong>B</strong>");}
|
||||
@Test public void Part__one() {tstr.Test("a" , "A1" , "<strong>A</strong>1");}
|
||||
@Test public void Part__many() {tstr.Test("a b" , "A1 B1" , "<strong>A</strong>1 <strong>B</strong>1");}
|
||||
@Test public void Unordered() {tstr.Test("b a" , "A1 B1" , "<strong>A</strong>1 <strong>B</strong>1");}
|
||||
@Test public void Repeat__part() {tstr.Test("a ab" , "Ab A" , "<strong>Ab</strong> <strong>A</strong>");}
|
||||
@Test public void Repeat__full() {tstr.Test("a" , "A A" , "<strong>A</strong> <strong>A</strong>");}
|
||||
@Test public void Close() {tstr.Test("a" , "Ba Aa" , "Ba <strong>A</strong>a");}
|
||||
@Test public void Comma() {tstr.Test("a" , "A, b" , "<strong>A</strong>, b");}
|
||||
@Test public void Dash() {tstr.Test("b" , "A-B c" , "A-<strong>B</strong> c");}
|
||||
@Test public void Parens() {tstr.Test("a" , "(A)" , "(<strong>A</strong>)");}
|
||||
@Test public void Strong() {tstr.Test("strong" , "strong strong" , "<strong>strong</strong> <strong>strong</strong>");}
|
||||
@Test public void Dash_w_mixed_cases() {tstr.Test("b" , "A-a B" , "A-a <strong>B</strong>");} // search_parser treats A-a separately from a-a
|
||||
@Test public void Acronymn() {tstr.Test("ab" , "A.B." , "A.B.");}
|
||||
// @Test public void Slash() {tstr.Test("b" , "A/B/C" , "A/<strong>B</strong>/C");}
|
||||
}
|
||||
class Srch_highlight_mgr_tstr {
|
||||
private final Srch_highlight_mgr mgr;
|
||||
private final Xol_case_mgr case_mgr = Xol_case_mgr_.A7();
|
||||
public Srch_highlight_mgr_tstr() {
|
||||
mgr = new Srch_highlight_mgr(case_mgr);
|
||||
}
|
||||
public void Test(String search, String title, String expd) {
|
||||
Tfds.Eq(expd, String_.new_u8(mgr.Search_(Bry_.new_u8(search)).Highlight(Bry_.new_u8(title))));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*;
|
||||
import org.junit.*; import gplx.xowa.langs.cases.*;
|
||||
public class Srch_text_parser_tst {
|
||||
private final Srch_text_parser_fxt fxt = new Srch_text_parser_fxt();
|
||||
@Before public void init() {fxt.Init();}
|
||||
@Test public void Word__one() {fxt.Clear().Test__split("abcd" , "abcd");}
|
||||
@Test public void Word__many() {fxt.Clear().Test__split("abc d ef" , "abc", "d", "ef");}
|
||||
@Test public void Ws__many() {fxt.Clear().Test__split("a b" , "a", "b");}
|
||||
@Test public void Ws__bgn() {fxt.Clear().Test__split(" a" , "a");}
|
||||
@Test public void Ws__end() {fxt.Clear().Test__split("a " , "a");}
|
||||
@Test public void Under() {fxt.Clear().Test__split("a_b" , "a", "b");} // NOTE: same as space
|
||||
@Test public void Lowercase() {fxt.Clear().Test__split("A B C" , "a", "b", "c");}
|
||||
@Test public void Dupe() {fxt.Clear().Test__split("a a a" , fxt.Make_word("a", 3));}
|
||||
@Test public void Dupe__lowercase() {fxt.Clear().Test__split("a A" , fxt.Make_word("a", 2));}
|
||||
@Test public void Comma__end() {fxt.Clear().Test__split("a, b" , "a", "b");} // EX: "Henry VI, Part 3"; "Bergen County, New Jersey"
|
||||
@Test public void Comma__mid() {fxt.Clear().Test__split("a,b" , "a,b");} // EX: "20,000 Leagues Under the Sea"
|
||||
@Test public void Comma__bgn() {fxt.Clear().Test__split(",a b" , "a", "b");} // EX: skip bad usages; EX: "Little Harbour,Pictou ,Nova Scotia"; "The Hindu Succession Act ,1956"
|
||||
@Test public void Colon__end() {fxt.Clear().Test__split("a: b" , "a", "b");}
|
||||
@Test public void Colon__mid() {fxt.Clear().Test__split("a:b" , "a:b");} // EX: "3:10 to Yuma (2007 film)"; "6:02 AM EST"; "24:7 Theatre Festival"; "Library of Congress Classification:Class P -- Language and Literature"
|
||||
@Test public void Colon__bgn() {fxt.Clear().Test__split(":a b" , "a", "b");}
|
||||
@Test public void Semic__end() {fxt.Clear().Test__split("a; b" , "a", "b");}
|
||||
@Test public void Semic__mid() {fxt.Clear().Test__split("a;b" , "a;b");}
|
||||
@Test public void Semic__bgn() {fxt.Clear().Test__split(";a b" , "a", "b");}
|
||||
@Test public void Bang__end() {fxt.Clear().Test__split("a! b" , "a", "b");}
|
||||
@Test public void Bang__mid() {fxt.Clear().Test__split("a!b" , "a!b");}
|
||||
@Test public void Bang__bgn() {fxt.Clear().Test__split("!a b" , "a", "b");}
|
||||
@Test public void Question__end() {fxt.Clear().Test__split("a? b" , "a", "b");}
|
||||
@Test public void Question__mid() {fxt.Clear().Test__split("a?b" , "a?b");}
|
||||
@Test public void Question__bgn() {fxt.Clear().Test__split("?a b" , "a", "b");}
|
||||
@Test public void Question__sentence() {fxt.Clear().Test__split("a?" , "a");}
|
||||
@Test public void Multiple__1() {fxt.Clear().Test__split("a?!" , "a");}
|
||||
@Test public void Multiple__2() {fxt.Clear().Test__split("a!?" , "a");}
|
||||
@Test public void Dot__word() {fxt.Clear().Test__split("a.org" , "a.org");} // EX: "en.wikipedia.org"; "Earth.png"; "IEEE_802.15"
|
||||
@Test public void Dot__abrv() {fxt.Clear().Test__split("a vs. b" , "a", "vs.", "vs", "b");} // EX: "vs.", "no.", "dr.", "st.", "inc."
|
||||
@Test public void Dot__initials() {fxt.Clear().Test__split("a. b. cde" , "a.", "a", "b.", "b", "cde");} // EX: "H. G. Wells"
|
||||
@Test public void Dot__acronym() {fxt.Clear().Test__split("abc D.E.F. ghi" , "abc", "d.e.f.", "def", "ghi");} // EX: "History of U.S.A. Science", "G.I. Bill", "Washington, D.C."; "Barcelona F.C."; "The Office (U.S.)"; "Agents of S.H.I.E.L.D."; "Gunfight at the O.K. Corral"; "H.M.S. Pinafore"; "R.E.M. discography"
|
||||
@Test public void Dot__bgn() {fxt.Clear().Test__split("a .bcd e" , "a", ".bcd", "bcd", "e");} // EX: "Colt .45", "List of organizations with .int domain names"
|
||||
@Test public void Dot__bgn__end() {fxt.Clear().Test__split("a .b. c" , "a", ".b.", "c");}
|
||||
@Test public void Dot__ellipsis_like() {fxt.Clear().Test__split("a . . . b" , "a", "b");} // EX: "Did you know . . ."
|
||||
@Test public void Ellipsis__len_3() {fxt.Clear().Test__split("a... bc d" , "a", "...", "bc", "d");} // EX: "Nights into Dreams..."
|
||||
@Test public void Ellipsis__len_3__bgn() {fxt.Clear().Test__split("a ...b" , "a", "...", "b"); ;} // NOTE: make sure "dot_bgn" code doesn't break this
|
||||
@Test public void Ellipsis__len_2() {fxt.Clear().Test__split("a.. b" , "a", "..", "b");} // EX: "3.. 6.. 9 Seconds of Light"
|
||||
@Test public void Ellipsis__bgn() {fxt.Clear().Test__split("...a" , "...", "a");}
|
||||
@Test public void Ellipsis__end() {fxt.Clear().Test__split("a..." , "a", "...");}
|
||||
@Test public void Ellipsis__no_ws() {fxt.Clear().Test__split("a...b" , "a", "...", "b");}
|
||||
@Test public void Ellipsis__term() {fxt.Clear().Test__split("a...?!" , "a", "...");} // EX: "Wetten, dass..?"
|
||||
@Test public void Apos__merge__end__eos() {fxt.Clear().Test__split("ab's" , "ab's", "abs");} // EX: "A Midsummer Night's Dream"; "Director's cut"
|
||||
@Test public void Apos__merge__end__word() {fxt.Clear().Test__split("ab's c" , "ab's", "abs", "c");} // EX: "Director's cut"; "Cap'n Crunch";
|
||||
@Test public void Apos__merge__bgn() {fxt.Clear().Test__split("a o'bc" , "a", "o'bc", "obc");} // EX: "Twelve O'Clock High"; "Shaqille O'Neal"; "Banca d'Italia"
|
||||
@Test public void Apos__merge__mid() {fxt.Clear().Test__split("i'm" , "i'm", "im");}
|
||||
@Test public void Apos__bgn__long() {fxt.Clear().Test__split("a 'tis b" , "a", "'tis", "tis", "b");} // EX: "My Country, 'Tis of Thee"; "Omaha hold 'em"; "Slash'EM"; "Expo '92"
|
||||
@Test public void Apos__end__eos() {fxt.Clear().Test__split("a'" , "a");}
|
||||
@Test public void Apos__end__short() {fxt.Clear().Test__split("a' b" , "a", "b");} // EX: "Will-o'-the-wisp"; "Portuguese man o' war";
|
||||
@Test public void Apos__end__long() {fxt.Clear().Test__split("ab' c" , "ab", "c");} // EX: "Dunkin' Donuts"; "'Allo 'Allo!"; "Catherine de' Medici"
|
||||
@Test public void Apos__both__n() {fxt.Clear().Test__split("a 'n' b" , "a", "'n'", "n", "b");} // EX: "Rock 'n' Roll"; "Town 'n' Country, Florida"; "Hill 'n Dale, Florida"; "Chip 'n Dale Rescue Rangers"
|
||||
@Test public void Apos__multiple() {fxt.Clear().Test__split("ab''cd" , "ab''cd");}
|
||||
@Test public void Apos__lone() {fxt.Clear().Test__split("' a" , "'", "a");} // EX: "' (disambiguation)"
|
||||
@Test public void Dash__one() {fxt.Clear().Test__split("a-b" , "a", "b", "a-b");} // EX: "The Amazing Spider-Man"; "On-super percentage"; "Basic Role-Playing"; "Context-sensitive"; "Cross-country skiing"; "Double-barreled shotgun"; "Dot-com bubble"; "Many-worlds interpretation"; "Faster-than-light"; "Gram-positive bacteria"; "Half-life", "Jean-Paul Sartre"; "Austria-Hungary"
|
||||
@Test public void Dash__many() {fxt.Clear().Test__split("a-b-c" , "a", "b", "c", "a-b-c");}
|
||||
@Test public void Dash__ws() {fxt.Clear().Test__split("a - b" , "a", "-", "b");}
|
||||
@Test public void Dash__eos() {fxt.Clear().Test__split("a-" , "a", "a-");}
|
||||
@Test public void Dash__bos() {fxt.Clear().Test__split("-a" , "a", "-a");}
|
||||
@Test public void Dash__mult__2() {fxt.Clear().Test__split("--" , "--");}
|
||||
@Test public void Dash__mult__3() {fxt.Clear().Test__split("---" , "---");}
|
||||
@Test public void Dash__mult__2__words() {fxt.Clear().Test__split("a--b" , "a", "b", "a--b");}
|
||||
@Test public void Dash__w_comma() {fxt.Clear().Test__split("a-, b" , "a", "a-", "b");}
|
||||
@Test public void Slash__one() {fxt.Clear().Test__split("a/b" , "a", "b");} // EX: "Good cop/bad cop"; "Snooker world rankings 2004/2005"; "Debian GNU/Hurd"; "HIV/AIDS in the United States"; "List of minor planets/1<>100"
|
||||
@Test public void Slash__many() {fxt.Clear().Test__split("a/b/c" , "a", "b", "c");} // EX: "Age/sex/location";
|
||||
@Test public void Slash__ws() {fxt.Clear().Test__split("a / b" , "a", "b");}
|
||||
@Test public void Dash__slash() {fxt.Clear().Test__split("a-b/c-d-e/f-g" , "a", "b", "a-b", "c", "d", "e", "c-d-e", "f", "g", "f-g");}
|
||||
@Test public void Paren__both__one() {fxt.Clear().Test__split("a (b) c" , "a", "b", "c");} // EX: "A (letter)"
|
||||
@Test public void Paren__both__many() {fxt.Clear().Test__split("a (b c) d" , "a", "b", "c", "d");} // EX: "A (2016 film)"
|
||||
@Test public void Paren__bgn__multiple() {fxt.Clear().Test__split("a (((b)))" , "a", "b");}
|
||||
@Test public void Paren__unmatched() {fxt.Clear().Test__split("a(b" , "a(b");}
|
||||
@Test public void Paren__unmatched__bgn() {fxt.Clear().Test__split("a (b" , "a", "b");}
|
||||
@Test public void Paren__mid() {fxt.Clear().Test__split("a(b)c" , "a(b)c");} // EX: "Chloro(pyridine)cobaloxime"; "Exi(s)t"
|
||||
@Test public void Paren__end() {fxt.Clear().Test__split("a(b)" , "a(b)", "a");} // EX: "Come What(ever) May"; "501(c) organization"; "Reindeer(s) Are Better Than People"; "(Miss)understood"; "Chromium(III) picolinate"
|
||||
@Test public void Paren__bgn() {fxt.Clear().Test__split("(a)b" , "(a)b", "b");} // EX: "International Student Congress of (bio)Medical Sciences"
|
||||
@Test public void Paren__end__dash() {fxt.Clear().Test__split("a(b-c) d" , "a(b-c)", "a", "d");} // EX: "Bis(2-ethylhexyl) phthalate"
|
||||
@Test public void Paren__end__comma() {fxt.Clear().Test__split("a(b,c) d" , "a(b,c)", "a", "d");} // EX: "Iron(II,III) oxide"
|
||||
@Test public void Paren__comma() {fxt.Clear().Test__split("a (b), c" , "a", "b", "c");} // EX: "Corning (city), New York"
|
||||
@Test public void Paren__multiple() {fxt.Clear().Test__split("(a) (b)" , "a", "b");}
|
||||
@Test public void Quote__both() {fxt.Clear().Test__split("a \"b\" c" , "a", "b", "c");}
|
||||
@Test public void Word_bgn__at() {fxt.Clear().Test__split("@a" , "@a", "a");}
|
||||
@Test public void Word_bgn__tilde() {fxt.Clear().Test__split("~a~" , "a");} // EX: "Phantom ~Requiem for the Phantom~"
|
||||
}
|
||||
class Srch_text_parser_fxt {
|
||||
private final Srch_text_parser word_parser = new Srch_text_parser();
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(32);
|
||||
private Xol_case_mgr case_mgr;
|
||||
public void Init() {
|
||||
case_mgr = Xol_case_mgr_.A7();
|
||||
word_parser.Init_for_ttl(case_mgr);
|
||||
}
|
||||
public Srch_text_parser_fxt Clear() {
|
||||
word_parser.word_hash.Clear();
|
||||
return this;
|
||||
}
|
||||
public Srch_word_itm Make_word(String raw, int count) {return new Srch_word_itm(Bry_.new_u8(raw)).Count_(count);}
|
||||
public void Test__split(String src, String... expd_words) {
|
||||
int len = expd_words.length;
|
||||
Srch_word_itm[] ary = new Srch_word_itm[len];
|
||||
for (int i = 0; i < len; ++i) {
|
||||
ary[i] = Make_word(expd_words[i], 1);
|
||||
}
|
||||
Test__split(src, ary);
|
||||
}
|
||||
public void Test__split(String src, Srch_word_itm... expd_words) {
|
||||
byte[] src_bry = Bry_.new_u8(src);
|
||||
word_parser.Parse(Bool_.Y, src_bry, 0, src_bry.length);
|
||||
Tfds.Eq_str_lines(To_str(expd_words), To_str(word_parser.word_hash));
|
||||
}
|
||||
private String To_str(Srch_word_itm[] word_ary) {
|
||||
int len = word_ary.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (i != 0) tmp_bfr.Add_byte_nl();
|
||||
Srch_word_itm word = word_ary[i];
|
||||
tmp_bfr.Add(word.Word).Add_byte_pipe();
|
||||
tmp_bfr.Add_int_variable(word.Count());
|
||||
}
|
||||
return tmp_bfr.To_str_and_clear();
|
||||
}
|
||||
private String To_str(Srch_word_hash word_mgr) {
|
||||
int len = word_mgr.Len();
|
||||
Srch_word_itm[] ary = new Srch_word_itm[len];
|
||||
for (int i = 0; i < len; ++i)
|
||||
ary[i] = word_mgr.Get_at(i);
|
||||
return To_str(ary);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.searchers; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*;
|
||||
import org.junit.*; import gplx.xowa.addons.wikis.searchs.parsers.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.*;
|
||||
public class Srch_search_phrase_tst {
|
||||
private final Srch_search_phrase_fxt fxt = new Srch_search_phrase_fxt();
|
||||
@Test public void Word() {fxt.Test__auto_wildcard("a" , "a*");}
|
||||
@Test public void Paren_end() {fxt.Test__auto_wildcard("(a)" , "(a*)");}
|
||||
@Test public void Quoted() {fxt.Test__auto_wildcard("\"a\"" , "\"a\"");}
|
||||
@Test public void Space() {fxt.Test__auto_wildcard(" " , " ");}
|
||||
@Test public void Not() {fxt.Test__auto_wildcard("-" , "-");}
|
||||
@Test public void And() {fxt.Test__auto_wildcard("+" , "+");}
|
||||
@Test public void Or() {fxt.Test__auto_wildcard("," , ",");}
|
||||
@Test public void Paren_bgn() {fxt.Test__auto_wildcard("(" , "(");}
|
||||
@Test public void Star() {fxt.Test__auto_wildcard("*" , "*");}
|
||||
@Test public void Wildcard__exists__y() {fxt.Test__auto_wildcard("a*b" , "a*b");}
|
||||
@Test public void Wildcard__exists__escaped() {fxt.Test__auto_wildcard("a\\*b" , "a\\*b*");}
|
||||
@Test public void Wildcard__exists__n() {fxt.Test__auto_wildcard("a* bc" , "a* bc*");}
|
||||
@Test public void Escape() {fxt.Test__auto_wildcard("\\*" , "\\**");}
|
||||
@Test public void Escape__incomplete() {fxt.Test__auto_wildcard("a\\" , "a\\");}
|
||||
@Test public void Escape__escaped() {fxt.Test__auto_wildcard("a\\\\" , "a\\\\*");}
|
||||
@Test public void Auto_wildcard_n() {fxt.Init__auto_wildcard_n_().Test__auto_wildcard("a", "a");}
|
||||
}
|
||||
class Srch_search_phrase_fxt {
|
||||
private final Srch_crt_scanner_syms syms = Srch_crt_scanner_syms.Dflt;
|
||||
private boolean auto_wildcard = true;
|
||||
public Srch_search_phrase_fxt Init__auto_wildcard_n_() {this.auto_wildcard = false; return this;}
|
||||
public void Test__auto_wildcard(String src_str, String expd) {
|
||||
byte[] src_raw = Bry_.new_u8(src_str);
|
||||
byte[] actl = Srch_search_phrase.Auto_wildcard(src_raw, auto_wildcard, syms);
|
||||
Tfds.Eq(expd, String_.new_u8(actl));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.searchers.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.searchers.*;
|
||||
import org.junit.*; import gplx.xowa.addons.wikis.searchs.parsers.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.visitors.*;
|
||||
public class Srch_crt_parser_tst {
|
||||
private final Srch_crt_parser_fxt fxt = new Srch_crt_parser_fxt();
|
||||
@Test public void Word__one() {fxt.Test__parse("a" , "a");}
|
||||
@Test public void And__one() {fxt.Test__parse("a + b" , "(a AND b)");}
|
||||
@Test public void And__many() {fxt.Test__parse("a + b + c" , "(a AND b AND c)");}
|
||||
@Test public void And__dangling() {fxt.Test__parse("a +" , "a");}
|
||||
@Test public void And__dupe() {fxt.Test__parse("a + + b" , "(a AND b)");}
|
||||
@Test public void Quote() {fxt.Test__parse("\"a b\"" , "\"a b\"");}
|
||||
@Test public void Auto__word() {fxt.Test__parse("a b" , "(a AND b)");}
|
||||
@Test public void Auto__quote() {fxt.Test__parse("a \"b\"" , "(a AND \"b\")");}
|
||||
@Test public void Auto__parens() {fxt.Test__parse("a (b , c)" , "(a AND (b OR c))");}
|
||||
@Test public void Or__one() {fxt.Test__parse("a , b" , "(a OR b)");}
|
||||
@Test public void Or__many() {fxt.Test__parse("a , b , c" , "(a OR b OR c)");}
|
||||
@Test public void Mixed__3() {fxt.Test__parse("a + b , c" , "((a AND b) OR c)");}
|
||||
@Test public void Mixed__5() {fxt.Test__parse("a + b , c + d , e" , "((((a AND b) OR c) AND d) OR e)");}
|
||||
@Test public void Parens__basic() {fxt.Test__parse("a + (b , c)" , "(a AND (b OR c))");}
|
||||
@Test public void Parens__nest() {fxt.Test__parse("a + (b , (c + d))" , "(a AND (b OR (c AND d)))");}
|
||||
@Test public void Parens__mid() {fxt.Test__parse("a + (b , c) + d)" , "(a AND (b OR c) AND d)");}
|
||||
@Test public void Parens__mixed() {fxt.Test__parse("a + (b , c) , d)" , "((a AND (b OR c)) OR d)");}
|
||||
@Test public void Parens__dupe() {fxt.Test__parse("((a))" , "a");}
|
||||
@Test public void Parens__dangling__lhs() {fxt.Test__parse("(a" , "a");}
|
||||
@Test public void Parens__dangling__rhs() {fxt.Test__parse("a)" , "a");}
|
||||
@Test public void Parens__empty__bos() {fxt.Test__parse("()" , "");}
|
||||
@Test public void Parens__empty__mid() {fxt.Test__parse("a () b" , "(a AND b)");}
|
||||
@Test public void Not__bos() {fxt.Test__parse("-abc" , "NOT abc");}
|
||||
@Test public void Not__mid() {fxt.Test__parse("a -b" , "(a AND NOT b)");}
|
||||
@Test public void Not__2() {fxt.Test__parse("a -b -c" , "(a AND NOT b AND NOT c)");}
|
||||
@Test public void Not__dangling__eos() {fxt.Test__parse("a -" , "a");}
|
||||
@Test public void Not__dangling__mid() {fxt.Test__parse("a -- b" , "(a AND b)");} // NOTE: scanner will remove spaces and convert to "a", "--", "b"
|
||||
@Test public void Not__dupe__2() {fxt.Test__parse("a --b" , "(a AND b)");}
|
||||
@Test public void Not__dupe__3() {fxt.Test__parse("a ---b" , "(a AND NOT b)");}
|
||||
@Test public void Not__parens() {fxt.Test__parse("a -(b + c)" , "(a AND NOT (b AND c))");}
|
||||
@Test public void Escape__eos() {fxt.Test__parse("\\" , "");}
|
||||
@Test public void Escape__escaped() {fxt.Test__parse("\\\\*" , "\\*");} // '\\' -> '\*'
|
||||
}
|
||||
class Srch_crt_parser_fxt {
|
||||
private final Srch_crt_parser crt_parser;
|
||||
private final Srch_crt_visitor__print visitor__to_str = new Srch_crt_visitor__print();
|
||||
public Srch_crt_parser_fxt() {
|
||||
crt_parser = new Srch_crt_parser(Srch_crt_scanner_syms.Dflt);
|
||||
Srch_text_parser text_parser = new Srch_text_parser();
|
||||
text_parser.Init_for_ttl(gplx.xowa.langs.cases.Xol_case_mgr_.A7());
|
||||
}
|
||||
public void Test__parse(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_a7(src_str);
|
||||
Srch_crt_mgr crt_mgr = crt_parser.Parse_or_invalid(src_bry, Bool_.N);
|
||||
Tfds.Eq(expd, String_.new_u8(visitor__to_str.Print(crt_mgr.Root)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.searchers.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.searchers.*;
|
||||
import org.junit.*; import gplx.xowa.addons.wikis.searchs.parsers.*;
|
||||
public class Srch_crt_scanner_tst {
|
||||
private final Srch_crt_scanner_fxt fxt = new Srch_crt_scanner_fxt();
|
||||
@Test public void Word() {fxt.Test__scan("abc" , "abc");}
|
||||
@Test public void Word__many() {fxt.Test__scan("abc d ef" , "abc", "d", "ef");}
|
||||
@Test public void Word__symbol() {fxt.Test__scan("a; b" , "a;", "b");}
|
||||
@Test public void And() {fxt.Test__scan("a + b" , "a", "+", "b");}
|
||||
@Test public void And__parens() {fxt.Test__scan("a +(b)" , "a", "+", "(", "b", ")");} // check that ( causes and to be treated as separate word
|
||||
@Test public void Or() {fxt.Test__scan("a , b" , "a", ",", "b");}
|
||||
@Test public void Or__no_space() {fxt.Test__scan("a, b" , "a", ",", "b");}
|
||||
@Test public void Not() {fxt.Test__scan("-abc" , "-", "abc");}
|
||||
@Test public void Not__mid__1() {fxt.Test__scan("a-b" , "a-b");} // fails if "a", "-", "b"
|
||||
@Test public void Not__mid__2() {fxt.Test__scan("a b-c" , "a", "b-c");} // ignore - if in middle of word
|
||||
@Test public void Not__and() {fxt.Test__scan("a -bc" , "a", "-", "bc");} // auto-add AND for -
|
||||
@Test public void Not__dangling() {fxt.Test__scan("a -" , "a", "-");}
|
||||
@Test public void Space() {fxt.Test__scan(" a b " , "a", "b");} // spaces should not generate tkns
|
||||
@Test public void Quote() {fxt.Test__scan("\"a b\"" , "a b");}
|
||||
@Test public void Quote__mid() {fxt.Test__scan("a\"b" , "a", "b");}
|
||||
@Test public void Quote__double() {fxt.Test__scan("\"a\"\"b\"" , "a\"b");}
|
||||
@Test public void Quote__missing__one() {fxt.Test__scan("\"abc" , "abc");}
|
||||
@Test public void Quote__missing__many() {fxt.Test__scan("\"abc a" , "abc", "a");}
|
||||
@Test public void Escape__bgn() {fxt.Test__scan("\\-a" , "-a");} // fails if "-", "a"
|
||||
@Test public void Escape__and__bgn() {fxt.Test__scan("\\+" , "+");} // fails if "a", "&", "b"
|
||||
@Test public void Escape__and__mid() {fxt.Test__scan("a\\+b" , "a+b");} // fails if "a", "&", "b"
|
||||
@Test public void Escape__eos__1() {fxt.Test__scan("\\" , String_.Ary_empty);}
|
||||
@Test public void Escape__eos__2() {fxt.Test__scan("a \\" , "a");}
|
||||
@Test public void Escape__eos__3() {fxt.Test__scan("a\\" , "a");}
|
||||
@Test public void Escape__many() {fxt.Test__scan("c\\+\\+" , "c++");}
|
||||
@Test public void Escape__end() {fxt.Test__scan("a\\\\" , "a\\");}
|
||||
@Test public void Complicated() {fxt.Test__scan("(a + \"b\") , -c", "(", "a", "+", "b", ")", ",", "-", "c");}
|
||||
}
|
||||
class Srch_crt_scanner_fxt {
|
||||
private final Srch_crt_scanner scanner;
|
||||
public Srch_crt_scanner_fxt() {
|
||||
this.scanner = new Srch_crt_scanner(Srch_crt_scanner_syms.Dflt);
|
||||
Srch_text_parser text_parser = new Srch_text_parser();
|
||||
text_parser.Init_for_ttl(gplx.xowa.langs.cases.Xol_case_mgr_.A7());
|
||||
}
|
||||
public void Test__scan(String src_str, String... expd) {
|
||||
byte[] src_bry = Bry_.new_a7(src_str);
|
||||
Srch_crt_tkn[] actl_itms = scanner.Scan(src_bry);
|
||||
Tfds.Eq_ary(expd, To_vals(src_bry, actl_itms));
|
||||
}
|
||||
public void Test__scan_tids(String src_str, byte... expd) {
|
||||
byte[] src_bry = Bry_.new_a7(src_str);
|
||||
Srch_crt_tkn[] actl_itms = scanner.Scan(src_bry);
|
||||
Tfds.Eq_ary(expd, To_tids(actl_itms));
|
||||
}
|
||||
private String[] To_vals(byte[] src, Srch_crt_tkn[] ary) {
|
||||
int len = ary.length;
|
||||
String[] rv = new String[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
Srch_crt_tkn tkn = ary[i];
|
||||
rv[i] = String_.new_a7(tkn.Val);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
private byte[] To_tids(Srch_crt_tkn[] ary) {
|
||||
int len = ary.length;
|
||||
byte[] rv = new byte[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
Srch_crt_tkn tkn = ary[i];
|
||||
rv[i] = tkn.Tid;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.searchers.crts; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.searchers.*;
|
||||
import org.junit.*;
|
||||
public class Srch_crt_sql_tst {
|
||||
private final Srch_crt_sql_fxt fxt = new Srch_crt_sql_fxt();
|
||||
@Test public void Eq() {fxt.Exec__new_or_null("a").Test__tid(Srch_crt_sql.Tid__eq).Test__eq("a");}
|
||||
@Test public void Rng() {fxt.Exec__new_or_null("a*").Test__tid(Srch_crt_sql.Tid__rng).Test__rng_bgn("a").Test__rng_end("b").Test__pattern("a*");}
|
||||
@Test public void Like() {fxt.Exec__new_or_null("a*b").Test__tid(Srch_crt_sql.Tid__like).Test__like("a%b").Test__pattern("a*b");}
|
||||
@Test public void Like__escape() {fxt.Exec__new_or_null("a|\\*b").Test__tid(Srch_crt_sql.Tid__like).Test__like("a|\\%b").Test__pattern("a\\*b");} // "a\*b"
|
||||
@Test public void Quote() {fxt.Exec__new_or_null("\"a b\"").Test__tid(Srch_crt_sql.Tid__eq).Test__eq("\"a b\"");}
|
||||
}
|
||||
class Srch_crt_sql_fxt {
|
||||
private Srch_crt_sql actl;
|
||||
public Srch_crt_sql_fxt Exec__new_or_null(String src_str) {
|
||||
this.actl = Srch_crt_sql.New_or_null(Bry_.new_u8(src_str), Srch_search_addon.Wildcard__star);
|
||||
return this;
|
||||
}
|
||||
public Srch_crt_sql_fxt Test__tid(int expd) {Tfds.Eq(expd, actl.Tid); return this;}
|
||||
public Srch_crt_sql_fxt Test__eq(String expd) {Tfds.Eq(expd, actl.Eq); return this;}
|
||||
public Srch_crt_sql_fxt Test__rng_bgn(String expd) {Tfds.Eq(expd, actl.Rng_bgn); return this;}
|
||||
public Srch_crt_sql_fxt Test__rng_end(String expd) {Tfds.Eq(expd, actl.Rng_end); return this;}
|
||||
public Srch_crt_sql_fxt Test__like(String expd) {Tfds.Eq(expd, actl.Like); return this;}
|
||||
public Srch_crt_sql_fxt Test__pattern(String expd) {Tfds.Eq(expd, String_.new_u8(actl.Pattern.Raw()), "pattern"); return this;}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.searchers.wkrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.searchers.*;
|
||||
import org.junit.*; import gplx.xowa.addons.wikis.searchs.parsers.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.visitors.*;
|
||||
public class Srch_link_wkr_sql_tst {
|
||||
private final Srch_link_wkr_sql_fxt fxt = new Srch_link_wkr_sql_fxt();
|
||||
@Test public void Rng() {
|
||||
fxt.Run__search("a").Test__eq
|
||||
( "select"
|
||||
);
|
||||
}
|
||||
}
|
||||
class Srch_link_wkr_sql_fxt {
|
||||
private final Srch_link_wkr_sql link_wkr = new Srch_link_wkr_sql();
|
||||
public Srch_link_wkr_sql_fxt Run__search(String search) {
|
||||
// attach_mgr.Init(cur_link_tbl.conn, new Db_attach_itm("page_db", ctx.Db__core.Conn()), new Db_attach_itm("word_db", ctx.Tbl__word.conn));
|
||||
// link_wkr.Init(ctx, attach_mgr);
|
||||
// this.actl_sql = link_wkr.Write(ctx, attach_mgr);
|
||||
link_wkr.Clear();
|
||||
return this;
|
||||
}
|
||||
public void Test__eq(String... v) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.searchers.wkrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.searchers.*;
|
||||
import org.junit.*; import gplx.xowa.addons.wikis.searchs.parsers.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.*; import gplx.xowa.addons.wikis.searchs.searchers.crts.visitors.*;
|
||||
public class Srch_page_tbl_wkr_tst {
|
||||
private final Srch_page_tbl_wkr_fxt fxt = new Srch_page_tbl_wkr_fxt();
|
||||
@Test public void Word__one() {fxt.Test__to_bry_or_null("a" , "a");}
|
||||
@Test public void Word__many() {fxt.Test__to_bry_or_null("a b c" , "a b c");}
|
||||
@Test public void Wild__end() {fxt.Test__to_bry_or_null("a*" , "a");}
|
||||
@Test public void Wild__both() {fxt.Test__to_bry_or_null("a*b*" , null);}
|
||||
@Test public void Quote() {fxt.Test__to_bry_or_null("\"a b\"" , "a b");}
|
||||
@Test public void Quote__mixed() {fxt.Test__to_bry_or_null("a \"b \"\" c\" d" , "a b \" c d");}
|
||||
@Test public void Escape() {fxt.Test__to_bry_or_null("a\\+" , "a+");}
|
||||
@Test public void Not() {fxt.Test__to_bry_or_null("a -b" , null);}
|
||||
@Test public void And() {fxt.Test__to_bry_or_null("a + b" , null);}
|
||||
@Test public void Or() {fxt.Test__to_bry_or_null("a , b" , null);}
|
||||
@Test public void Parens() {fxt.Test__to_bry_or_null("(a)" , null);}
|
||||
}
|
||||
class Srch_page_tbl_wkr_fxt {
|
||||
private final Srch_crt_parser crt_parser;
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
public Srch_page_tbl_wkr_fxt() {
|
||||
crt_parser = new Srch_crt_parser(Srch_crt_scanner_syms.Dflt);
|
||||
Srch_text_parser text_parser = new Srch_text_parser();
|
||||
text_parser.Init_for_ttl(gplx.xowa.langs.cases.Xol_case_mgr_.A7());
|
||||
}
|
||||
public void Test__to_bry_or_null(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_a7(src_str);
|
||||
Srch_crt_mgr crt_mgr = crt_parser.Parse_or_invalid(src_bry, Bool_.N);
|
||||
Tfds.Eq(expd, String_.new_u8(Srch_page_tbl_wkr.To_bry_or_null(tmp_bfr, Srch_search_addon.Wildcard__star, crt_mgr)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
//namespace gplx.xowa.addons.wikis.searchs.v1s {
|
||||
// import org.junit.*; using gplx.xowa.wikis.tdbs; using gplx.xowa.wikis.data.tbls;
|
||||
// public class Xosrh_core_tst {
|
||||
// @Before public void Init() {fxt.Clear();} private Xos_search_mgr_fxt fxt = new Xos_search_mgr_fxt();
|
||||
// @Test public void Basic() {
|
||||
// fxt.Init_basic();
|
||||
// fxt.Test_search_exact("b2", "B2_22", "B2_12", "B2__2");
|
||||
// fxt.Test_search_exact("a" , "A___0");
|
||||
// fxt.Test_search_exact("b1a"); // missing: mid
|
||||
// fxt.Test_search_exact("d"); // missing: end
|
||||
// fxt.Test_search_exact("$"); // missing: bgn
|
||||
// fxt.Test_search_match_bgn("b*", "B3_23", "B2_22", "B1_21", "B3_13", "B2_12", "B1_11", "B3__3", "B2__2", "B1__1");
|
||||
// }
|
||||
// @Test public void Page_size() {
|
||||
// fxt.Init_basic();
|
||||
// fxt.Search_mgr().Page_mgr().Itms_per_page_(1);
|
||||
// fxt.Test_search("b*", 0, "B3_23");
|
||||
// fxt.Test_search("b*", 1, "B2_22");
|
||||
// fxt.Test_search("b*", 2, "B1_21");
|
||||
// fxt.Test_search("b*", 3, "B3_13");
|
||||
// }
|
||||
// @Test public void Url() {
|
||||
// Xoa_url url = Xow_url_parser_old.Parse_url(fxt.App(), fxt.Wiki(), "Special:Search/Abc?fulltext=y&xowa_sort=len_desc");
|
||||
// fxt.Search_mgr().Args_mgr().Clear().Parse(url.Args());
|
||||
// Tfds.Eq(Srch_rslt_row_sorter.Tid_len_dsc, fxt.Search_mgr().Args_mgr().Sort_tid());
|
||||
// }
|
||||
// @Test public void Url_arg_title() {// http://en.wikipedia.org/wiki/Special:Search/Earth?fulltext=yes&title=Mars
|
||||
// fxt.Test_url_search_bry("Special:Search?fulltext=y&search=Abc" , "Abc"); // query arg
|
||||
//// fxt.Test_url_search_bry("Special:Search/Abc?fulltext=y" , "Abc"); // leaf
|
||||
// fxt.Test_url_search_bry("Special:Search/Abc?fulltext=y&search=Def" , "Def"); // leaf overrides query arg
|
||||
// }
|
||||
// @Test public void Url_ns() {
|
||||
// fxt.Test_url__ns("Special:Search?search=Abc&ns0=1&ns1=1", "0|1");
|
||||
// fxt.Test_url__ns("Special:Search?search=Abc&ns*=1", "*");
|
||||
// fxt.Test_url__ns("Special:Search?search=Abc", "0");
|
||||
// }
|
||||
// @Test public void Html() {
|
||||
// fxt.Init_basic();
|
||||
// fxt.Test_html_by_url("B1", "", String_.Concat_lines_nl
|
||||
// ( "Result '''1''' of '''3''' for '''B1'''<br/>"
|
||||
// , "{|"
|
||||
// , "|-"
|
||||
// , "| [[Special:Search/B1?fulltext=y&xowa_page_index=0|<]]"
|
||||
// , "| [[Special:Search/B1?fulltext=y&xowa_page_index=1|>]]"
|
||||
// , "|-"
|
||||
// , "| [[Special:Search/B1?fulltext=y&xowa_sort=len_desc|length]]"
|
||||
// , "| [[Special:Search/B1?fulltext=y&xowa_sort=title_asc|title]]"
|
||||
// , "|-"
|
||||
// , "| 42 || [[B1 21]]"
|
||||
// , "|-"
|
||||
// , "| 22 || [[B1 11]]"
|
||||
// , "|-"
|
||||
// , "| 2 || [[B1 1]]"
|
||||
// , "|-"
|
||||
// , "| [[Special:Search/B1?fulltext=y&xowa_page_index=0|<]]"
|
||||
// , "| [[Special:Search/B1?fulltext=y&xowa_page_index=1|>]]"
|
||||
// , "|}"
|
||||
// ));
|
||||
// }
|
||||
//// @Test public void Page_next() {
|
||||
//// fxt.Init_basic();
|
||||
//// fxt.Search_mgr().Page_size_(1);
|
||||
//// fxt.Test_search(Srch_special_page.Match_tid_all, "B1", 0, "B1 1");
|
||||
//// fxt.Test_search(Srch_special_page.Match_tid_all, "B1", 1, "B1 11");
|
||||
//// }
|
||||
//// @Test public void Misc_url() {
|
||||
//// fxt.Init_basic();
|
||||
//// fxt.Search_mgr().Page_size_(1);
|
||||
//// fxt.Expd_address_page_("Special:Search/B1");
|
||||
//// fxt.Test_search(Srch_special_page.Match_tid_all, "B1", 0, "B1 1");
|
||||
//// }
|
||||
// @Test public void Sort_defaults_to_len_desc() {
|
||||
// fxt.Init_basic();
|
||||
// fxt.Search_mgr().Page_mgr().Itms_per_page_(3);
|
||||
// fxt.Test_search2(Srch_special_page.Match_tid_bgn, "b" , 0, Srch_rslt_row_sorter.Tid_ttl_asc , "B1_11", "B1_21", "B1__1"); // sort by name; note that _ sorts after alphabet
|
||||
// fxt.Test_search2(Srch_special_page.Match_tid_bgn, "b" , 1, Srch_rslt_row_sorter.Tid_none , "B2_12", "B2_22", "B2__2"); // sort by name still; next page should not reset
|
||||
// fxt.Test_search2(Srch_special_page.Match_tid_bgn, "b2" , 0, Srch_rslt_row_sorter.Tid_none , "B2_22", "B2_12", "B2__2"); // sort by len desc; new search should reset
|
||||
// }
|
||||
// }
|
||||
// class Xos_search_mgr_fxt {
|
||||
// Xoae_app app; Xowe_wiki wiki; Bry_bfr bfr = Bry_bfr_.Reset(500); Srch_special_page search_mgr;
|
||||
// public Xoae_app App() {return app;}
|
||||
// public Xowe_wiki Wiki() {return wiki;}
|
||||
// public Xobl_regy_itm regy_itm_(int id, String bgn, String end, int count) {return new Xobl_regy_itm(id, Bry_.new_u8(bgn), Bry_.new_u8(end), count);}
|
||||
// public Xowd_page_itm data_ttl_(int id, String ttl) {return data_ttl_(id, 0, 0, false, 0, ttl);}
|
||||
// public Xowd_page_itm data_ttl_(int id, int fil, int row, boolean redirect, int len, String ttl) {return new Xowd_page_itm().Init(id, Bry_.new_u8(ttl), redirect, len, fil, row);}
|
||||
// public Xowd_page_itm data_id_(int id, String ttl) {return data_id_(id, Xow_ns_.Tid__main, ttl);}
|
||||
// public Xowd_page_itm data_id_(int id, int ns, String ttl) {return new Xowd_page_itm().Id_(id).Ns_id_(ns).Ttl_page_db_(Bry_.new_u8(ttl)).Text_db_id_(0).Text_len_(0);}
|
||||
// public Xobl_search_ttl data_sttl_(String word, params int[] ids) {return new Xobl_search_ttl(Bry_.new_u8(word), data_ttl_word_page_ary_(ids));}
|
||||
// public Xobl_search_ttl_page[] data_ttl_word_page_ary_(params int[] ids) {
|
||||
// int ids_len = ids.length;
|
||||
// Xobl_search_ttl_page[] rv = new Xobl_search_ttl_page[ids_len];
|
||||
// for (int i = 0; i < ids_len; i++) {
|
||||
// int id = ids[i];
|
||||
// rv[i] = new Xobl_search_ttl_page(id, id * 2);
|
||||
// }
|
||||
// return rv;
|
||||
// }
|
||||
// public void Init_regy_site(byte dir_info, params Xobl_regy_itm[] ary) {Init_regy(wiki.Tdb_fsys_mgr().Url_site_reg(dir_info), ary);}
|
||||
// public void Init_regy_ns (String ns_num, byte tid, params Xobl_regy_itm[] ary) {Init_regy(wiki.Tdb_fsys_mgr().Url_ns_reg(ns_num, tid), ary);}
|
||||
// public void Init_regy(Io_url url, Xobl_regy_itm[] ary) {
|
||||
// int ary_len = ary.length;
|
||||
// for (int i = 0; i < ary_len; i++) {
|
||||
// Xobl_regy_itm itm = ary[i];
|
||||
// itm.Srl_save(tmp_bfr);
|
||||
// }
|
||||
// Io_mgr.Instance.SaveFilBfr(url, tmp_bfr);
|
||||
// } private Bry_bfr tmp_bfr = Bry_bfr_.Reset(255);
|
||||
// public void Init_data(Io_url fil, params Xobl_data_itm[] ary) {
|
||||
// Xob_xdat_file xdat_file = new Xob_xdat_file();
|
||||
// int ary_len = ary.length;
|
||||
// for (int i = 0; i < ary_len; i++) {
|
||||
// Xobl_data_itm itm = ary[i];
|
||||
// itm.Srl_save(tmp_bfr);
|
||||
// xdat_file.Insert(bfr, tmp_bfr.To_bry_and_clear());
|
||||
// }
|
||||
// xdat_file.Save(fil);
|
||||
// }
|
||||
// public void Init_basic() {
|
||||
// this.Init_regy_ns(wiki.Ns_mgr().Ns_main().Num_str(), Xotdb_dir_info_.Tid_search_ttl, this.regy_itm_(0, "A", "C", 5));
|
||||
// this.Init_data(wiki.Tdb_fsys_mgr().Url_ns_fil(Xotdb_dir_info_.Tid_search_ttl, Xow_ns_.Tid__main, 0)
|
||||
// , this.data_sttl_("a" , 0)
|
||||
// , this.data_sttl_("b1" , 1, 11, 21)
|
||||
// , this.data_sttl_("b2" , 2, 12, 22)
|
||||
// , this.data_sttl_("b3" , 3, 13, 23)
|
||||
// , this.data_sttl_("c" , 4)
|
||||
// );
|
||||
// this.Init_regy_site(Xotdb_dir_info_.Tid_id, this.regy_itm_(0, "A", "C", 11));
|
||||
// this.Init_data(wiki.Tdb_fsys_mgr().Url_site_fil(Xotdb_dir_info_.Tid_id, 0)
|
||||
// , this.data_id_( 0, "A___0")
|
||||
// , this.data_id_( 1, "B1__1")
|
||||
// , this.data_id_( 2, "B2__2")
|
||||
// , this.data_id_( 3, "B3__3")
|
||||
// , this.data_id_( 4, "C___4")
|
||||
// , this.data_id_(11, "B1_11")
|
||||
// , this.data_id_(12, "B2_12")
|
||||
// , this.data_id_(13, "B3_13")
|
||||
// , this.data_id_(21, "B1_21")
|
||||
// , this.data_id_(22, "B2_22")
|
||||
// , this.data_id_(23, "B3_23")
|
||||
// );
|
||||
// search_mgr.Page_mgr().Ns_mgr().Add_all(); // WORKAROUND: xdat fmt does not store ns with search data; pages will be retrieved with ns_id = null; force ns_all (instead of allowing ns_main default);
|
||||
// }
|
||||
// public void Clear() {
|
||||
// Io_mgr.Instance.InitEngine_mem();
|
||||
// app = Xoa_app_fxt.Make__app__edit();
|
||||
// wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
// search_mgr = wiki.Special_mgr().Page_search();
|
||||
// wiki.Appe().Gui_mgr().Search_suggest_mgr().Args_default_str_("ns*=1"); // WORKAROUND: xdat fmt does not store ns with search data; pages will be retrieved with ns_id = null; force ns_all (instead of allowing ns_main default);
|
||||
// }
|
||||
// public Srch_special_page Search_mgr() {return search_mgr;}
|
||||
// public void Test_url_search_bry(String url_str, String expd) {
|
||||
// Xoa_url url = Xow_url_parser_old.Parse_url(app, wiki, url_str);
|
||||
// search_mgr.Args_mgr().Clear().Parse(url.Args());
|
||||
// Tfds.Eq(expd, String_.new_u8(search_mgr.Args_mgr().Search_bry()));
|
||||
// }
|
||||
// public void Test_url__ns(String url_str, String expd) {
|
||||
// Xoa_url url = Xow_url_parser_old.Parse_url(app, wiki, url_str);
|
||||
// search_mgr.Args_mgr().Clear().Parse(url.Args());
|
||||
// Tfds.Eq(expd, String_.new_a7(search_mgr.Args_mgr().Ns_mgr().Xto_hash_key()));
|
||||
// }
|
||||
// public void Test_search_exact(String ttl_str, params String[] expd_ary) {Test_search(ttl_str, 0, expd_ary);}
|
||||
// public void Test_search_match_bgn(String ttl_str, params String[] expd_ary) {Test_search(ttl_str, 0, expd_ary);}
|
||||
// public void Test_search(String ttl_str, int page_idx, params String[] expd_ary) {
|
||||
// byte[] ttl_bry = Bry_.new_a7(ttl_str);
|
||||
// Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b128();
|
||||
// Xosrh_rslt_grp page = search_mgr.Page_mgr().Search(bfr, wiki, ttl_bry, page_idx, search_mgr.Page_mgr());
|
||||
// bfr.Mkr_rls();
|
||||
// Tfds.Eq_ary(expd_ary, Search_itms_to_int_ary(page));
|
||||
// }
|
||||
// public void Test_html_by_url(String ttl_str, String args_str, String expd_html) {
|
||||
// wiki.Init_needed_(false);
|
||||
// byte[] ttl_bry = Bry_.new_a7(ttl_str);
|
||||
// Xoa_ttl ttl = Xoa_ttl.Parse(wiki, ttl_bry);
|
||||
// Xoae_page page = Xoae_page.New_test(wiki, ttl);
|
||||
// byte[] url_bry = Bry_.new_a7("http://en.wikipedia.org/wiki/Special:Search/" + ttl_str + args_str);
|
||||
// Xoa_url url = wiki.Appe().Url_parser().Parse(url_bry);
|
||||
// search_mgr.Special__gen(url, page, wiki, ttl);
|
||||
// Tfds.Eq_str_lines(expd_html, String_.new_u8(page.Root().Data_htm()));
|
||||
// }
|
||||
// public void Test_search2(byte match_tid, String ttl_str, int page_idx, byte sort_tid, params String[] expd_ary) {
|
||||
// Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_b128();
|
||||
// Xow_url_parser_old url_parser = new Xow_url_parser_old();
|
||||
// byte[] url_raw = Bry_.new_a7("Special:Search/" + ttl_str + ((match_tid == Srch_special_page.Match_tid_all) ? "" : "*") + "?fulltext=y" + Srch_rslt_row_sorter.Xto_url_arg(sort_tid) + "&xowa_page_size=1&xowa_page_index=" + page_idx);
|
||||
// Xoa_url url = url_parser.Parse(url_raw);
|
||||
// Xoa_ttl ttl = Xoa_ttl.Parse(wiki, url_raw);
|
||||
// Xoae_page page = wiki.Ctx().Page();
|
||||
// search_mgr.Special__gen(url, page, wiki, ttl);
|
||||
// Xosrh_rslt_grp cur_grp = search_mgr.Cur_grp();
|
||||
// bfr.Mkr_rls();
|
||||
// Tfds.Eq_ary(expd_ary, Search_itms_to_int_ary(cur_grp));
|
||||
// }
|
||||
// String[] Search_itms_to_int_ary(Xosrh_rslt_grp page) {
|
||||
// int itms_len = page.Itms_len();
|
||||
// String[] rv = new String[itms_len];
|
||||
// for (int i = 0; i < itms_len; i++) {
|
||||
// Xowd_page_itm itm = page.Itms_get_at(i);
|
||||
// rv[i] = String_.new_u8(itm.Ttl_page_db());
|
||||
// }
|
||||
// return rv;
|
||||
// }
|
||||
// }
|
||||
// interface Xobl_data_itm {
|
||||
// void Srl_save(Bry_bfr bfr);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.specials.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.specials.*;
|
||||
import org.junit.*; import gplx.xowa.htmls.core.htmls.utls.*; import gplx.xowa.wikis.tdbs.*;
|
||||
import gplx.xowa.wikis.domains.*;
|
||||
import gplx.xowa.wikis.data.tbls.*;
|
||||
import gplx.xowa.addons.wikis.searchs.searchers.*; import gplx.xowa.addons.wikis.searchs.searchers.rslts.*;
|
||||
public class Srch_html_page_bldr_tst {
|
||||
@Before public void init() {fxt.Clear();} private Srch_html_page_bldr_fxt fxt = new Srch_html_page_bldr_fxt();
|
||||
@Test public void Paging() {
|
||||
fxt.Test_paging(Bool_.Y, 1, "<a href='/site/en.wikipedia.org/wiki/Special:Search/A?fulltext=y&xowa_page_index=2' title='Next'>Next<img src='file:///mem/xowa/bin/any/xowa/file/app.general/go_fwd.png' width='16' height='16'/></a>");
|
||||
fxt.Test_paging(Bool_.N, 1, "<a href='/site/en.wikipedia.org/wiki/Special:Search/A?fulltext=y&xowa_page_index=0' title='Previous'><img src='file:///mem/xowa/bin/any/xowa/file/app.general/go_bwd.png' width='16' height='16'/>Previous</a>");
|
||||
fxt.Test_paging(Bool_.Y, 2, "<a href='/site/en.wikipedia.org/wiki/Special:Search/A?fulltext=y&xowa_page_index=3' title='Next'>Next<img src='file:///mem/xowa/bin/any/xowa/file/app.general/go_fwd.png' width='16' height='16'/></a>");
|
||||
fxt.Test_paging(Bool_.N, 0, " ");
|
||||
}
|
||||
@Test public void Rows() {
|
||||
fxt.Test_rows(new Srch_rslt_row[] {fxt.Make_row(10, "A"), fxt.Make_row(20, "B")}, String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <tr id='w.7C1'>"
|
||||
, " <td style='padding-right:5px; vertical-align:top; text-align:right;'>10"
|
||||
, " </td>"
|
||||
, " <td style='padding-left:5px; vertical-align:top;'><a href='/site/w/wiki/A' title='A'>A</a>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr id='w.7C2'>"
|
||||
, " <td style='padding-right:5px; vertical-align:top; text-align:right;'>20"
|
||||
, " </td>"
|
||||
, " <td style='padding-left:5px; vertical-align:top;'><a href='/site/w/wiki/B' title='B'>B</a>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
));
|
||||
}
|
||||
}
|
||||
class Srch_html_page_bldr_fxt {
|
||||
private Xoae_app app; private Xowe_wiki wiki; private Srch_html_page_bldr html_mgr; private final Bry_bfr tmp_bfr = Bry_bfr_.New_w_size(255);
|
||||
private int page_id;
|
||||
public Srch_html_page_bldr_fxt Clear() {
|
||||
if (app == null) {
|
||||
app = Xoa_app_fxt.Make__app__edit();
|
||||
wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
html_mgr = new Srch_html_page_bldr();
|
||||
}
|
||||
page_id = 0;
|
||||
return this;
|
||||
}
|
||||
public void Test_paging(boolean fwd, int slab_idx, String expd) {
|
||||
byte[] search_orig = Bry_.new_a7("A");
|
||||
Srch_search_qry qry = Srch_search_qry.New__search_page(Xow_domain_itm_.Ary_empty, wiki, app.Addon_mgr().Itms__search__special().Ns_mgr(), Bool_.N, search_orig, slab_idx, 100);
|
||||
html_mgr.Init_by_wiki(wiki, wiki.Lang().Num_mgr(), qry);
|
||||
byte[] paging_link = html_mgr.Bld_paging_link(fwd);
|
||||
Tfds.Eq(expd, String_.new_a7(paging_link));
|
||||
}
|
||||
public void Test_rows(Srch_rslt_row[] rows, String expd) {
|
||||
Srch_rslt_list rslts = new Srch_rslt_list();
|
||||
Srch_html_row_bldr row_bldr = new Srch_html_row_bldr(wiki.Html__lnki_bldr());
|
||||
row_bldr.Init(rslts, 0, rows.length);
|
||||
for (int i = 0; i < rows.length; ++i)
|
||||
rslts.Add(rows[i]);
|
||||
row_bldr.Bfr_arg__add(tmp_bfr);
|
||||
Tfds.Eq_str_lines(expd, tmp_bfr.To_str_and_clear());
|
||||
}
|
||||
public Srch_rslt_row Make_row(int len, String ttl_str) {
|
||||
byte[] wiki_bry = Bry_.new_a7("w");
|
||||
byte[] ttl_bry = Bry_.new_u8(ttl_str);
|
||||
++page_id;
|
||||
Srch_rslt_row rv = new Srch_rslt_row(Srch_rslt_row.Bld_key(wiki_bry, page_id), wiki_bry, wiki.Ttl_parse(ttl_bry), gplx.xowa.wikis.nss.Xow_ns_.Tid__main, ttl_bry, page_id, len, len, Srch_rslt_row.Page_redirect_id_null);
|
||||
rv.Page_ttl_highlight = rv.Page_ttl.Full_txt_w_ttl_case();
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.wikis.searchs.specials.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.wikis.*; import gplx.xowa.addons.wikis.searchs.*; import gplx.xowa.addons.wikis.searchs.specials.*;
|
||||
import org.junit.*; import gplx.xowa.htmls.core.htmls.utls.*; import gplx.xowa.guis.cbks.js.*; import gplx.xowa.addons.wikis.searchs.searchers.rslts.*;
|
||||
public class Srch_rslt_cbk_tst {
|
||||
@Before public void init() {fxt.Clear();} private Srch_rslt_cbk_fxt fxt = new Srch_rslt_cbk_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Test_add(fxt.Make_rslt(50, "L"), fxt.Make_args_append("xowa_insert_w" , "w.7CL")); // insert new
|
||||
fxt.Test_add(fxt.Make_rslt(30, "N"), fxt.Make_args_append("xowa_insert_w" , "w.7CN")); // insert below last
|
||||
fxt.Test_add(fxt.Make_rslt(70, "J"), fxt.Make_args_append("w.7CL" , "w.7CJ")); // insert above first
|
||||
fxt.Test_add(fxt.Make_rslt(60, "K"), fxt.Make_args_append("w.7CL" , "w.7CK")); // insert above mid
|
||||
fxt.Test_add(fxt.Make_rslt(40, "M"), fxt.Make_args_append("w.7CN" , "w.7CM")); // insert below mid
|
||||
fxt.Test_add(fxt.Make_rslt(10, "P")); // insert noop
|
||||
fxt.Test_add(fxt.Make_rslt(80, "I"), fxt.Make_args_append("w.7CJ" , "w.7CI") , fxt.Make_args_replace("w.7CN")); // insert displace all
|
||||
fxt.Test_add(fxt.Make_rslt(61, "K1"), fxt.Make_args_append("w.7CK" , "w.7CK1"), fxt.Make_args_replace("w.7CM")); // insert displace mid
|
||||
}
|
||||
}
|
||||
class Srch_rslt_cbk_fxt {
|
||||
private Srch_html_row_bldr html_row; private static final byte[] Bry_enwiki = Bry_.new_a7("w");
|
||||
private Srch_html_row_wkr async;
|
||||
private Xog_js_wkr__log js_wkr = new Xog_js_wkr__log();
|
||||
private Xowe_wiki wiki;
|
||||
private int page_id;
|
||||
public void Clear() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
this.wiki = Xoa_app_fxt.Make__wiki__edit(app, "w");
|
||||
html_row = new Srch_html_row_bldr(wiki.Html__lnki_bldr());
|
||||
html_row.Fmtr().Fmt_("~{page_key}");
|
||||
async = new Srch_html_row_wkr(html_row, js_wkr, 5, Bry_enwiki);
|
||||
page_id = 0;
|
||||
}
|
||||
public Srch_rslt_row Make_rslt(int len, String ttl) {
|
||||
byte[] ttl_bry = Bry_.new_a7(ttl);
|
||||
++page_id;
|
||||
byte[] key = Bry_.Add(Bry_enwiki, Byte_ascii.Pipe_bry, ttl_bry); // NOTE: deliberately changing key to use ttl instead of id to make tests more readable
|
||||
return new Srch_rslt_row(key, Bry_enwiki, wiki.Ttl_parse(ttl_bry), gplx.xowa.wikis.nss.Xow_ns_.Tid__main, ttl_bry, page_id, len, len, Srch_rslt_row.Page_redirect_id_null);
|
||||
}
|
||||
public Object[] Make_args_append(String uid, String html) {return Object_.Ary(Xog_js_wkr__log.Proc_append_above, uid, html);}
|
||||
public Object[] Make_args_replace(String uid) {return Object_.Ary(Xog_js_wkr__log.Proc_replace_html, uid, "");}
|
||||
public void Test_add(Srch_rslt_row row, Object[]... expd) {
|
||||
async.On_rslt_found(row);
|
||||
int expd_len = expd.length;
|
||||
Tfds.Eq(expd_len, js_wkr.Log__len());
|
||||
for (int i = 0; i < expd_len; ++i) {
|
||||
String expd_str = String_.Concat_with_obj("\n", expd[i]);
|
||||
String actl_str = String_.Concat_with_obj("\n", js_wkr.Log__get_at(i));
|
||||
Tfds.Eq_str_lines(expd_str, actl_str);
|
||||
}
|
||||
js_wkr.Log__clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user