mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.3.1
This commit is contained in:
@@ -33,7 +33,7 @@ public class Xop_amp_mgr_decode_tst {
|
||||
@Test public void Hex_zero_padded() {fxt.Test_decode_as_bry("Σ" , "Σ");}
|
||||
@Test public void Hex_upper_x() {fxt.Test_decode_as_bry("Σ" , "Σ");}
|
||||
@Test public void Num_fail_large_codepoint() {fxt.Test_decode_as_bry("�" , "�");}
|
||||
@Test public void Num_ignore_extra_x() {fxt.Test_decode_as_bry("&#xx26D0;" , Char_.XtoStr(Char_.XbyInt(9936)));} // 2nd x is ignored
|
||||
@Test public void Num_ignore_extra_x() {fxt.Test_decode_as_bry("&#xx26D0;" , Char_.To_str(Char_.XbyInt(9936)));} // 2nd x is ignored
|
||||
}
|
||||
class Xop_amp_mgr_fxt {
|
||||
private Xop_amp_mgr amp_mgr = Xop_amp_mgr.I;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Xop_list_tkn_chkr extends Xop_tkn_chkr_base {
|
||||
err += mgr.Tst_val(list_bgn == 0, path, "list_bgn", list_bgn, actl.List_bgn());
|
||||
err += mgr.Tst_val(list_itmTyp == Xop_list_tkn_.List_itmTyp_null, path, "list_itmTyp", list_itmTyp, actl.List_itmTyp());
|
||||
err += mgr.Tst_val(list_sub_last == Bool_.__byte, path, "list_sub_last", list_sub_last, actl.List_sub_last());
|
||||
err += mgr.Tst_val(list_path == Int_.Ary_empty, path, "list_path", Array_.XtoStr(list_path), Array_.XtoStr(actl.List_path()));
|
||||
err += mgr.Tst_val(list_path == Int_.Ary_empty, path, "list_path", Array_.To_str(list_path), Array_.To_str(actl.List_path()));
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Xop_log_mgr implements GfoInvkAble {
|
||||
public void Delete_all() {
|
||||
log_tbl.Delete();
|
||||
}
|
||||
public void Txn_bgn() {conn.Txn_bgn();}
|
||||
public void Txn_bgn() {conn.Txn_bgn("log_mgr");}
|
||||
public void Txn_end() {conn.Txn_end();}
|
||||
public void Rls() {
|
||||
if (log_tbl != null) log_tbl.Rls();
|
||||
|
||||
40
400_xowa/src/gplx/xowa/parsers/utils/Xop_util.java
Normal file
40
400_xowa/src/gplx/xowa/parsers/utils/Xop_util.java
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.core.primitives.*;
|
||||
public class Xop_util {
|
||||
public byte[] Uniq_bry_new() {
|
||||
return Bry_.Add
|
||||
( Random_bry_hdr // "\x7fUNIQ" where "\x7f" is (byte)127
|
||||
, Random_bry_new(16)); // random hexdecimal String
|
||||
}
|
||||
public void Random_int_ary_(int... v) {random_int_ary = v;} private int[] random_int_ary; // TEST:
|
||||
public byte[] Random_bry_new(int len) {
|
||||
Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
RandomAdp random_gen = RandomAdp_.new_();
|
||||
for (int i = 0; i < len; i += 7) {
|
||||
int rand = random_int_ary == null ? random_gen.Next(Int_.MaxValue) : random_int_ary[i / 7];
|
||||
String rand_str = Int_.Xto_str_hex(Bool_.N, Bool_.Y, rand & 0xfffffff); // limits value to 268435455
|
||||
tmp_bfr.Add_str_a7(rand_str);
|
||||
}
|
||||
byte[] rv = tmp_bfr.Xto_bry(0, len);
|
||||
tmp_bfr.Clear();
|
||||
return rv;
|
||||
}
|
||||
private final static byte[] Random_bry_hdr = Bry_.new_a7("\u007fUNIQ");
|
||||
}
|
||||
36
400_xowa/src/gplx/xowa/parsers/utils/Xop_util_tst.java
Normal file
36
400_xowa/src/gplx/xowa/parsers/utils/Xop_util_tst.java
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.utils; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*;
|
||||
public class Xop_util_tst {
|
||||
private final Xop_util_fxt fxt = new Xop_util_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Init_random_int_ary(Int_.Ary(240563374, 22728940, 1451248133));
|
||||
fxt.Test_uniq_bry_new("UNIQE56B4AE15AD0EC68");
|
||||
|
||||
fxt.Init_random_int_ary(Int_.Ary(1363621437, 426295411, 421041101));
|
||||
fxt.Test_uniq_bry_new("UNIQ147363D968C07391");
|
||||
}
|
||||
}
|
||||
class Xop_util_fxt {
|
||||
private final Xop_util util = new Xop_util();
|
||||
public Xop_util_fxt Init_random_int_ary(int... v) {util.Random_int_ary_(v); return this;}
|
||||
public void Test_uniq_bry_new(String expd) {
|
||||
Tfds.Eq_str(expd, String_.new_a7(util.Uniq_bry_new()), "unique_bry");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user