mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
v1.8.1.1
This commit is contained in:
parent
7b6e65b088
commit
fb8c06c560
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class ErrProcData_tst {
|
||||
@Test public void parse_() {
|
||||
@Test public void parse_() {
|
||||
tst_parse_("gplx._tst.Err__tst.RdrLoad(MethodData_tst.java:1)"
|
||||
, ErrProcData.new_()
|
||||
.SignatureRaw_("gplx._tst.Err__tst.RdrLoad")
|
||||
@ -27,7 +27,7 @@ public class ErrProcData_tst {
|
||||
.IdeAddress_("(MethodData_tst.java:1)")
|
||||
);
|
||||
}
|
||||
@Test public void parse_ary_() {
|
||||
@Test public void parse_ary_() {
|
||||
String stackTrace = "";
|
||||
try {ThrowException();} catch (Exception exc) {stackTrace = Err_.StackTrace_lang(exc);}
|
||||
ErrProcData[] ary = ErrProcData.parse_ary_(stackTrace);
|
||||
|
@ -66,6 +66,12 @@ public class Err_ { //_20110415
|
||||
public static String Message_lang(Exception e) {return e.getClass() + " " + e.getMessage();}
|
||||
public static String Message_gplx(Exception e) {return ErrMsgWtr._.Message_gplx(e);}
|
||||
public static String Message_gplx_brief(Exception e) {return ErrMsgWtr._.Message_gplx_brief(e);}
|
||||
public static String Message_hdr_or_message(Exception e) {
|
||||
if (e == null) return "exception is null";
|
||||
return ClassAdp_.Eq(e.getClass(), Err.class)
|
||||
? ((Err)e).Hdr()
|
||||
: Message_lang(e);
|
||||
}
|
||||
@gplx.Internal protected static String StackTrace_lang(Exception e) {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
StackTraceElement[] stackTraceAry = e.getStackTrace();
|
||||
|
@ -18,19 +18,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class Array__tst {
|
||||
@Test public void Resize_add() {
|
||||
@Test public void Resize_add() {
|
||||
tst_Resize_add(ary_(), ary_(1), ary_(1)); // 0 + 1 = 1
|
||||
tst_Resize_add(ary_(0), ary_(), ary_(0)); // 1 + 0 = 1
|
||||
tst_Resize_add(ary_(0), ary_(1), ary_(0, 1)); // 1 + 1 = 2
|
||||
} void tst_Resize_add(int[] source, int[] added, int[] expd) {Tfds.Eq_ary(expd, (int[])Array_.Resize_add(source, added));}
|
||||
@Test public void Resize() {
|
||||
@Test public void Resize() {
|
||||
tst_Resize(ary_(0), 0, ary_()); // 1 -> 0
|
||||
tst_Resize(ary_(0, 1), 1, ary_(0)); // 2 -> 1
|
||||
} void tst_Resize(int[] source, int length, int[] expd) {Tfds.Eq_ary(expd, (int[])Array_.Resize(source, length));}
|
||||
@Test public void Insert() {
|
||||
@Test public void Insert() {
|
||||
tst_Insert(ary_obj(0, 1, 4, 5), ary_obj(2, 3), 2, ary_obj(0, 1, 2, 3, 4, 5));
|
||||
} void tst_Insert(Object[] cur, Object[] add, int addPos, Object[] expd) {Tfds.Eq_ary(expd, Array_.Insert(cur, add, addPos));}
|
||||
@Test public void ReplaceInsert() {
|
||||
@Test public void ReplaceInsert() {
|
||||
tst_ReplaceInsert(ary_obj(0, 1, 4, 5) , ary_obj(1, 2, 3), 1, 1, ary_obj(0, 1, 2, 3, 4, 5));
|
||||
tst_ReplaceInsert(ary_obj(0, 1, 2, 4, 5) , ary_obj(1, 2, 3), 1, 2, ary_obj(0, 1, 2, 3, 4, 5));
|
||||
tst_ReplaceInsert(ary_obj(0, 1, 2, 3, 4, 5) , ary_obj(1, 2, 3), 1, 3, ary_obj(0, 1, 2, 3, 4, 5));
|
||||
|
@ -212,7 +212,8 @@ public class Bry_ {
|
||||
}
|
||||
public static byte[] Mid_by_len(byte[] src, int bgn, int len) {return Mid(src, bgn, bgn + len);}
|
||||
public static byte[] Mid_by_len_safe(byte[] src, int bgn, int len) {
|
||||
if (len > src.length) len = src.length;
|
||||
int src_len = src.length;
|
||||
if (len + bgn > src_len) len = (src_len - bgn);
|
||||
return Mid(src, bgn, bgn + len);
|
||||
}
|
||||
public static String MidByLenToStr(byte[] src, int bgn, int len) {
|
||||
|
@ -123,6 +123,7 @@ public class Bry_bfr {
|
||||
public Bry_bfr Add_byte_pipe() {return Add_byte(Byte_ascii.Pipe);}
|
||||
public Bry_bfr Add_byte_comma() {return Add_byte(Byte_ascii.Comma);}
|
||||
public Bry_bfr Add_byte_apos() {return Add_byte(Byte_ascii.Apos);}
|
||||
public Bry_bfr Add_byte_slash() {return Add_byte(Byte_ascii.Slash);}
|
||||
public Bry_bfr Add_byte_backslash() {return Add_byte(Byte_ascii.Backslash);}
|
||||
public Bry_bfr Add_byte_quote() {return Add_byte(Byte_ascii.Quote);}
|
||||
public Bry_bfr Add_byte_space() {return Add_byte(Byte_ascii.Space);}
|
||||
|
@ -18,14 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class Byte__tst {
|
||||
@Test public void int_() {
|
||||
@Test public void int_() {
|
||||
tst_int_( 0, 0);
|
||||
tst_int_( 127, 127);
|
||||
tst_int_( 128, 128); // NOTE: JAVA defines byte as -128 -> 127
|
||||
tst_int_( 255, 255);
|
||||
tst_int_( 256, 0); // NOTE: 256 will cast to 1; (byte)256 works same in both JAVA/.NET
|
||||
} void tst_int_(int v, int expd) {Tfds.Eq((byte)expd, Byte_.int_(v));} // WORKAROUND/JAVA: expd is of type int b/c java promotes numbers to ints
|
||||
@Test public void XtoInt() {
|
||||
@Test public void XtoInt() {
|
||||
tst_XtoInt( 0, 0);
|
||||
tst_XtoInt( 127, 127);
|
||||
tst_XtoInt( 128, 128);
|
||||
|
@ -70,8 +70,10 @@ public class Byte_ascii {
|
||||
;
|
||||
}
|
||||
public static final byte[]
|
||||
Dot_bry = new byte[] {Byte_ascii.Dot}
|
||||
Tab_bry = new byte[] {Byte_ascii.Tab}
|
||||
, NewLine_bry = new byte[] {Byte_ascii.NewLine}
|
||||
, Dot_bry = new byte[] {Byte_ascii.Dot}
|
||||
, Comma_bry = new byte[] {Byte_ascii.Comma}
|
||||
, Colon_bry = new byte[] {Byte_ascii.Colon}
|
||||
, Lt_bry = new byte[] {Byte_ascii.Lt}
|
||||
, Gt_bry = new byte[] {Byte_ascii.Gt}
|
||||
|
@ -39,7 +39,7 @@ public class Double_ {
|
||||
int v_as_int = (int)v;
|
||||
return v == v_as_int
|
||||
? Int_.XtoStr(v_as_int) // convert to int, and call print String to eliminate any trailing decimal places
|
||||
: String.format("%g", v); // call "%g" format which should eliminate most, though not all; EX:2449.6000000000004; DATE:2014-07-14
|
||||
: Float_.XtoStr((float)v); // calling ((float)v).toString is better at removing trailing 0s than String.format("%g", v). note that .net .toString() handles it better; EX:2449.600000000000d; DATE:2014-07-29
|
||||
}
|
||||
public static double cast_(Object o) {try {return (Double)o;} catch(Exception e) {throw Err_.type_mismatch_exc_(e, double.class, o);}}
|
||||
public static double parse_(String raw) {try {return Double.parseDouble(raw);} catch(Exception e) {throw Err_.parse_type_exc_(e, double.class, raw);}}
|
||||
|
@ -15,12 +15,15 @@ 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.html.modules; import gplx.*; import gplx.xowa.*; import gplx.xowa.html.*;
|
||||
import gplx.xowa.html.modules.popups.*;
|
||||
public class Xow_module_mgr {
|
||||
public Xow_module_mgr(Xow_wiki wiki) {this.popup_mgr = new Xow_popup_mgr(wiki);}
|
||||
public void Init_by_wiki(Xow_wiki wiki) {
|
||||
popup_mgr.Init_by_wiki(wiki);
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class Double__tst {
|
||||
private Double__fxt fxt = new Double__fxt();
|
||||
@Test public void Xto_str_loose() {
|
||||
fxt.Test_Xto_str_loose(2449.6000000d , "2449.6");
|
||||
fxt.Test_Xto_str_loose(623.700d , "623.7");
|
||||
}
|
||||
public Xow_popup_mgr Popup_mgr() {return popup_mgr;} private Xow_popup_mgr popup_mgr;
|
||||
}
|
||||
class Double__fxt {
|
||||
public void Test_Xto_str_loose(double v, String expd) {Tfds.Eq(expd, Double_.Xto_str_loose(v));}
|
||||
}
|
@ -27,7 +27,7 @@ public class Object__tst {
|
||||
}
|
||||
@Test public void Xto_str_loose_or_null() {
|
||||
fxt.Test_xto_str_loose_or_null(null, null);
|
||||
fxt.Test_xto_str_loose_or_null(2449.6000000000004d, "2449.60");
|
||||
fxt.Test_xto_str_loose_or_null(2449.6000000000004d, "2449.6");
|
||||
}
|
||||
}
|
||||
class Object__fxt {
|
||||
|
@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class KeyValHash_tst {
|
||||
@Test public void AryVals() {
|
||||
@Test public void AryVals() {
|
||||
tst_AryVals(ary_());
|
||||
tst_AryVals(ary_("key1", "1"), kv_("key1", "1"));
|
||||
tst_AryVals(ary_("key1", "1", "key2", "2"), kv_("key1", "1"), kv_("key2", "2"));
|
||||
}
|
||||
@Test public void Fail_lengthMustBeEven() {
|
||||
@Test public void Fail_lengthMustBeEven() {
|
||||
try {
|
||||
tst_AryVals(ary_("key1"), kv_("key1", "1"));
|
||||
Tfds.Fail_expdError();
|
||||
|
@ -18,51 +18,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class TimeSpanAdp_basic_tst {
|
||||
@Test public void seconds_() {
|
||||
@Test public void seconds_() {
|
||||
TimeSpanAdp expd = TimeSpanAdp_.fracs_(123987);
|
||||
TimeSpanAdp actl = TimeSpanAdp_.seconds_(123.987);
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
@Test public void TotalSecs() {
|
||||
@Test public void TotalSecs() {
|
||||
TimeSpanAdp val = TimeSpanAdp_.fracs_(1987);
|
||||
Tfds.Eq_decimal(DecimalAdp_.parts_(1, 987), val.TotalSecs());
|
||||
}
|
||||
@Test public void Units() {
|
||||
@Test public void Units() {
|
||||
tst_Units("01:02:03.987", 1, 2, 3, 987);
|
||||
tst_Units("01:00:03", 1, 0, 3, 0);
|
||||
tst_Units("01:00:00.987", 1, 0, 0, 987);
|
||||
tst_Units("02:00.987", 0, 2, 0, 987);
|
||||
}
|
||||
@Test public void Add() {
|
||||
@Test public void Add() {
|
||||
TimeSpanAdp val = TimeSpanAdp_.fracs_(3);
|
||||
TimeSpanAdp arg = TimeSpanAdp_.fracs_(2);
|
||||
TimeSpanAdp expd = TimeSpanAdp_.fracs_(5);
|
||||
TimeSpanAdp actl = val.Add(arg);
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
@Test public void Subtract() {
|
||||
@Test public void Subtract() {
|
||||
TimeSpanAdp val = TimeSpanAdp_.fracs_(3);
|
||||
TimeSpanAdp arg = TimeSpanAdp_.fracs_(2);
|
||||
TimeSpanAdp expd = TimeSpanAdp_.fracs_(1);
|
||||
TimeSpanAdp actl = val.Subtract(arg);
|
||||
Tfds.Eq(expd, actl);
|
||||
}
|
||||
@Test public void Add_unit_identity() {
|
||||
@Test public void Add_unit_identity() {
|
||||
tst_AddUnit("00:00:01.000", 0, 0, "00:00:01.000");
|
||||
}
|
||||
@Test public void Add_unit_basic() {
|
||||
@Test public void Add_unit_basic() {
|
||||
tst_AddUnit("01:59:58.987", 0, 1013, "02:00:00.000");
|
||||
tst_AddUnit("01:59:58.987", 1, 2, "02:00:00.987");
|
||||
tst_AddUnit("01:59:58.987", 2, 1, "02:00:58.987");
|
||||
tst_AddUnit("01:59:58.987", 3, 1, "02:59:58.987");
|
||||
}
|
||||
@Test public void Add_unit_negative() {
|
||||
@Test public void Add_unit_negative() {
|
||||
tst_AddUnit("01:00:00.00", 0, -1, "00:59:59.999");
|
||||
tst_AddUnit("01:00:00.00", 1, -1, "00:59:59.000");
|
||||
tst_AddUnit("01:00:00.00", 2, -1, "00:59:00.000");
|
||||
tst_AddUnit("01:00:00.00", 3, -1, "00:00:00.000");
|
||||
}
|
||||
@Test public void XtoStrUiAbbrv() {
|
||||
@Test public void XtoStrUiAbbrv() {
|
||||
tst_XtoStrUiAbbrv("01:02:03.004", "1h 2m 3s 4f");
|
||||
tst_XtoStrUiAbbrv("00:00:03.004", "3s 4f");
|
||||
tst_XtoStrUiAbbrv("00:00:03.000", "3s 0f");
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class UuidAdp__tst {
|
||||
@Test public void parse_() {
|
||||
@Test public void parse_() {
|
||||
tst_parse_("467ffb41-cdfe-402f-b22b-be855425784b");
|
||||
}
|
||||
void tst_parse_(String s) {
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.criterias; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class Criteria_tst {
|
||||
@Test public void Equal() {
|
||||
@Test public void Equal() {
|
||||
Criteria crt = Criteria_.eq_(true);
|
||||
fx.tst_Matches(crt, true);
|
||||
fx.tst_MatchesNot(crt, false);
|
||||
@ -28,7 +28,7 @@ public class Criteria_tst {
|
||||
fx.tst_Matches(Criteria_.eq_("equal"), "equal");
|
||||
fx.tst_Matches(Criteria_.eq_(date), date);
|
||||
}
|
||||
@Test public void Not() {
|
||||
@Test public void Not() {
|
||||
Criteria crt = Criteria_.eqn_(true);
|
||||
fx.tst_Matches(crt, false);
|
||||
fx.tst_MatchesNot(crt, true);
|
||||
@ -38,7 +38,7 @@ public class Criteria_tst {
|
||||
fx.tst_Matches(Criteria_.eqn_("equal"), "not equal");
|
||||
fx.tst_Matches(Criteria_.eqn_(date), date.Add_minute(1));
|
||||
}
|
||||
@Test public void MoreThan() {
|
||||
@Test public void MoreThan() {
|
||||
Criteria crt = Criteria_.mt_(0);
|
||||
fx.tst_Matches(crt, 1, 2);
|
||||
fx.tst_MatchesNot(crt, 0, -1);
|
||||
@ -49,21 +49,21 @@ public class Criteria_tst {
|
||||
fx.tst_Matches(Criteria_.mt_(date), date.Add_minute(1));
|
||||
fx.tst_Matches(Criteria_.mt_(false), true); // MISC: thus truth is greater than falsehood
|
||||
}
|
||||
@Test public void MoreThanEq() {
|
||||
@Test public void MoreThanEq() {
|
||||
Criteria crt = Criteria_.mte_(0);
|
||||
fx.tst_Matches(crt, 0);
|
||||
}
|
||||
@Test public void Less() {
|
||||
@Test public void Less() {
|
||||
Criteria crt = Criteria_.lt_(0);
|
||||
fx.tst_Matches(crt, -1, -2);
|
||||
fx.tst_MatchesNot(crt, 0, 1);
|
||||
fx.tst_MatchesFail(crt, "-1");
|
||||
}
|
||||
@Test public void LessEq() {
|
||||
@Test public void LessEq() {
|
||||
Criteria crt = Criteria_.lte_(0);
|
||||
fx.tst_Matches(crt, 0);
|
||||
}
|
||||
@Test public void Between() {
|
||||
@Test public void Between() {
|
||||
Criteria crt = Criteria_.between_(-1, 1);
|
||||
fx.tst_Matches(crt, 0, 1, -1);
|
||||
fx.tst_MatchesNot(crt, -2, 2);
|
||||
@ -72,7 +72,7 @@ public class Criteria_tst {
|
||||
fx.tst_Matches(Criteria_.between_(1, -1), 0); // reverse range
|
||||
fx.tst_Matches(Criteria_.between_("a", "c"), "b");
|
||||
}
|
||||
@Test public void In() {
|
||||
@Test public void In() {
|
||||
Criteria crt = Criteria_.in_(0, 1, 2);
|
||||
fx.tst_Matches(crt, 0, 1, 2);
|
||||
fx.tst_MatchesNot(crt, 3, -1);
|
||||
|
@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class ListAdp_Sorter_tst {
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
Object[] src = new Object[] {0,8,1,7,2,6,3,5,4};
|
||||
ListAdp_Sorter.new_().Sort(src, src.length);
|
||||
Tfds.Eq_ary(src, Sequential(0, 8));
|
||||
}
|
||||
@Test public void Basic2() {
|
||||
@Test public void Basic2() {
|
||||
Object[] src = new Object[] {"0","8","1","7","2","6","3","5","4"};
|
||||
ListAdp_Sorter.new_().Sort(src, src.length);
|
||||
Tfds.Eq_ary(src, new Object[] {"0","1","2","3","4","5","6","7","8"});
|
||||
|
@ -21,11 +21,11 @@ public class OrderedHash_tst {
|
||||
@Before public void setup() {
|
||||
hash = OrderedHash_.new_();
|
||||
}
|
||||
@Test public void FetchAt() {
|
||||
@Test public void FetchAt() {
|
||||
hash.Add("key1", "val1");
|
||||
Tfds.Eq("val1", hash.FetchAt(0));
|
||||
}
|
||||
@Test public void iterator() {
|
||||
@Test public void iterator() {
|
||||
hash.Add("key2", "val2");
|
||||
hash.Add("key1", "val1");
|
||||
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.lists; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class StackAdp_tst {
|
||||
@Test public void XtoList() {
|
||||
@Test public void XtoList() {
|
||||
tst_XtoList(1, 2, 3);
|
||||
}
|
||||
void tst_XtoList(int... ary) {
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.texts; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class BaseXXConverter_tst {
|
||||
@Test public void Base32() {
|
||||
@Test public void Base32() {
|
||||
tst_Base32("", "");
|
||||
tst_Base32("f", "MY");
|
||||
tst_Base32("fo", "MZXQ");
|
||||
@ -30,7 +30,7 @@ public class BaseXXConverter_tst {
|
||||
tst_Base32("a", "ME");
|
||||
tst_Base32("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", "IFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLIZDGNBVGY3Q");
|
||||
}
|
||||
@Test public void Base64() {
|
||||
@Test public void Base64() {
|
||||
tst_Base64("", "");
|
||||
tst_Base64("f", "Zg==");
|
||||
tst_Base64("fo", "Zm8=");
|
||||
|
@ -21,19 +21,19 @@ public class CharStream_tst {
|
||||
@Before public void setup() {
|
||||
stream = CharStream.pos0_("abcdefgh");
|
||||
}
|
||||
@Test public void XtoStr() {
|
||||
@Test public void XtoStr() {
|
||||
Tfds.Eq(stream.XtoStr(), "abcdefgh");
|
||||
}
|
||||
@Test public void CurrentText() {
|
||||
@Test public void CurrentText() {
|
||||
stream.MoveNextBy(1);
|
||||
Tfds.Eq(stream.XtoStrAtCur(2), "bc");
|
||||
Tfds.Eq(stream.XtoStr(), "abcdefgh");
|
||||
}
|
||||
@Test public void CurrentText_outOfBounds() {
|
||||
@Test public void CurrentText_outOfBounds() {
|
||||
stream.MoveNextBy(7);
|
||||
Tfds.Eq(stream.XtoStrAtCur(2), "h");
|
||||
}
|
||||
@Test public void Match() {
|
||||
@Test public void Match() {
|
||||
stream.MoveNextBy(6);
|
||||
tst_Match(true, "g");
|
||||
tst_Match(false, "z");
|
||||
@ -41,7 +41,7 @@ public class CharStream_tst {
|
||||
tst_Match(false, "gz");
|
||||
tst_Match(false, "ghi");
|
||||
}
|
||||
@Test public void AtBounds() {
|
||||
@Test public void AtBounds() {
|
||||
stream.MoveTo(-1);
|
||||
tst_AtBounds(true, false, false);
|
||||
|
||||
|
@ -18,35 +18,35 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.texts; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class RegxPatn_cls_ioMatch_tst {
|
||||
@Test public void SimpleMatches() {
|
||||
@Test public void SimpleMatches() {
|
||||
tst_Matches("file.cs", "file.cs", true); // basic
|
||||
tst_Matches("file.cs", "file.cs.exe", false); // fail: must match name precisely
|
||||
tst_Matches("file.cs", "tst_file.cs", false); // fail: must match name precisely
|
||||
}
|
||||
@Test public void Wildcard() {
|
||||
@Test public void Wildcard() {
|
||||
tst_Matches("*.cs", "file.cs", true); // pass: before
|
||||
tst_Matches("file*", "file_valid.cs", true); // pass: after
|
||||
tst_Matches("*.exe", "file.cs", false); // fail: before
|
||||
tst_Matches("file*", "invalid_file.cs", false); // fail: after
|
||||
}
|
||||
@Test public void DoubleWildcard() {
|
||||
@Test public void DoubleWildcard() {
|
||||
tst_Matches("*cs*", "file.cs", true); // pass: after
|
||||
tst_Matches("*cs*", "csFile.exe", true); // pass: before
|
||||
tst_Matches("*cs*", "file.cs.exe", true); // pass: middle
|
||||
tst_Matches("*cs*", "file.exe", false); // fail
|
||||
}
|
||||
@Test public void Compound() {
|
||||
@Test public void Compound() {
|
||||
tst_Matches("*.cs|*.exe", "file.cs", true); // pass: match first
|
||||
tst_Matches("*.cs|*.exe", "file.exe", true); // pass: match second
|
||||
tst_Matches("*.cs|*.exe", "file.dll", false); // fail: match neither
|
||||
tst_Matches("*.cs|*.exe", "file.cs.exe.dll", false); // fail: match neither (though both are embedded)
|
||||
}
|
||||
@Test public void Backslash() {
|
||||
@Test public void Backslash() {
|
||||
tst_Matches("*\\bin\\*", "C:\\project\\bin\\", true); // pass: dir
|
||||
tst_Matches("*\\bin\\*", "C:\\project\\bin\\file.dll", true); // pass: fil
|
||||
tst_Matches("*\\bin\\*", "C:\\project\\binFiles\\", false); // fail
|
||||
}
|
||||
@Test public void MixedCase() {
|
||||
@Test public void MixedCase() {
|
||||
tst_Matches("file.cs", "file.cs", true); // pass: same case
|
||||
tst_Matches("file.cs", "File.cS", true); // pass: diff case
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.security; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class HashAlgo_tth192_tree_tst {
|
||||
@Test public void CalcRecursiveHalves() {
|
||||
@Test public void CalcRecursiveHalves() {
|
||||
tst_CalcRecursiveHalves(129, 128);
|
||||
tst_CalcRecursiveHalves(128, 127);
|
||||
tst_CalcRecursiveHalves(100, 99);
|
||||
@ -31,7 +31,7 @@ public class HashAlgo_tth192_tree_tst {
|
||||
tst_CalcRecursiveHalves(1, 0);
|
||||
tst_CalcRecursiveHalves(0, 0);
|
||||
}
|
||||
@Test public void CalcWorkUnits() {
|
||||
@Test public void CalcWorkUnits() {
|
||||
tst_CalcWorkUnits(101, 21); // leafs; 10 full, 1 part (+11) -> reduce 11 to 5+1 (+5) -> reduce 6 to 3 (+3) -> reduce 3 to 1+1 (+1) -> reduce 2 to 1 (+1)
|
||||
tst_CalcWorkUnits(100, 19); // leafs; 10 full (+10) -> reduce 10 to 5 (+5) -> reduce 5 to 2+1 (+2) -> reduce 3 to 1+1 (+1) -> reduce 2 to 1 (+1)
|
||||
tst_CalcWorkUnits(30, 5); // leafs; 3 full (+3) -> reduce 3 to 1+1 (+1) -> reduce 2 to 1 (+1)
|
||||
|
@ -392,8 +392,10 @@ public class IoEngine_system extends IoEngine_base {
|
||||
Io_download_fmt xfer_fmt = xrg.Download_fmt();
|
||||
prog_dlg = xfer_fmt.usr_dlg;
|
||||
if (!Web_access_enabled) {
|
||||
if (session_fil == null) session_fil = prog_dlg.Log_wtr().Session_dir().GenSubFil("internet.txt");
|
||||
if (prog_dlg != null) prog_dlg.Log_wtr().Log_msg_to_url_fmt(session_fil, "download disabled: src='~{0}' trg='~{1}'", xrg.Src(), xrg.Trg().Raw());
|
||||
if (prog_dlg != null) {
|
||||
if (session_fil == null) session_fil = prog_dlg.Log_wtr().Session_dir().GenSubFil("internet.txt");
|
||||
prog_dlg.Log_wtr().Log_msg_to_url_fmt(session_fil, "download disabled: src='~{0}' trg='~{1}'", xrg.Src(), xrg.Trg().Raw());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
|
@ -21,6 +21,9 @@ public class IoEngine_xrg_downloadFil {
|
||||
public Io_url Trg() {return trg;} public IoEngine_xrg_downloadFil Trg_(Io_url v) {trg = v; return this;} Io_url trg;
|
||||
public byte Rslt() {return rslt;} public IoEngine_xrg_downloadFil Rslt_(byte v) {rslt = v; return this;} private byte rslt = Rslt_pass;
|
||||
public Exception Rslt_err() {return rslt_err;} public IoEngine_xrg_downloadFil Rslt_err_(Exception v) {rslt_err = v; return this;} Exception rslt_err;
|
||||
public String Rslt_err_str() {
|
||||
return rslt_err == null ? "none" : Err_.Message_gplx_brief(rslt_err);
|
||||
}
|
||||
public String User_agent() {return user_agent;} public IoEngine_xrg_downloadFil User_agent_(String v) {user_agent = v; return this;} private String user_agent;
|
||||
public Gfo_usr_dlg Prog_dlg() {return prog_dlg;} public IoEngine_xrg_downloadFil Prog_dlg_(Gfo_usr_dlg v) {prog_dlg = v; download_fmt.Ctor(prog_dlg); return this;} Gfo_usr_dlg prog_dlg;
|
||||
public Bry_fmtr Prog_fmtr() {return prog_fmtr;} Bry_fmtr prog_fmtr = Bry_fmtr.new_("~{download_header}: ~{download_read} of ~{download_length} kb;", "download_header", "download_url", "download_read", "download_length");
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx;
|
||||
import org.junit.*;
|
||||
public class DateAdpClassXtn_tst {
|
||||
@Test public void XtoDb() {
|
||||
@Test public void XtoDb() {
|
||||
tst_XtoDb("20091115 220102.999", "2009-11-15 22:01:02.999");
|
||||
}
|
||||
void tst_XtoDb(String val, String expdRaw) {
|
||||
|
@ -21,31 +21,31 @@ public class GfoEvMgr_tst {
|
||||
@Before public void setup() {
|
||||
pub = make_(); sub = make_();
|
||||
} MockEvObj pub, sub;
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
GfoEvMgr_.SubSame(pub, "ev1", sub);
|
||||
GfoEvMgr_.PubVal(pub, "ev1", "val1");
|
||||
sub.tst_Handled("val1");
|
||||
}
|
||||
@Test public void None() {// make sure no subscribers does not cause exception
|
||||
@Test public void None() {// make sure no subscribers does not cause exception
|
||||
GfoEvMgr_.SubSame(pub, "ev1", sub);
|
||||
GfoEvMgr_.PubVal(pub, "ev2", "val1"); //ev2 does not exist
|
||||
sub.tst_Handled();
|
||||
}
|
||||
@Test public void Lnk() {
|
||||
@Test public void Lnk() {
|
||||
MockEvObj mid = make_();
|
||||
mid.EvMgr().Lnk(pub);
|
||||
GfoEvMgr_.SubSame(mid, "ev1", sub);
|
||||
GfoEvMgr_.PubVal(pub, "ev1", "val1");
|
||||
sub.tst_Handled("val1");
|
||||
}
|
||||
@Test public void RlsSub() {
|
||||
@Test public void RlsSub() {
|
||||
this.Basic();
|
||||
|
||||
GfoEvMgr_.RlsSub(sub);
|
||||
GfoEvMgr_.PubVal(pub, "ev1", "val1");
|
||||
sub.tst_Handled();
|
||||
}
|
||||
@Test public void RlsPub() {
|
||||
@Test public void RlsPub() {
|
||||
this.Basic();
|
||||
|
||||
GfoEvMgr_.RlsSub(pub);
|
||||
|
@ -21,11 +21,11 @@ public class GfoMsg_tst {
|
||||
@Before public void setup() {
|
||||
GfsCore._.AddObj(new Mok(), "Mok");
|
||||
}
|
||||
@Test public void Write1() {
|
||||
@Test public void Write1() {
|
||||
GfoMsg m = GfoMsg_.root_leafArgs_(String_.Ary("a", "b"), KeyVal_.new_("int0", 1));
|
||||
tst_Msg(m, "a.b:int0='1';");
|
||||
}
|
||||
@Test public void Write() {
|
||||
@Test public void Write() {
|
||||
Mok mok = new Mok();
|
||||
tst_Msg(GfoInvkXtoStr.WriteMsg(mok, Mok.Invk_Cmd0, true, 1, "a"), "Mok.Cmd0:bool0='y' int0='1' str0='a';");
|
||||
mok.Int0 = 2;
|
||||
|
@ -19,12 +19,12 @@ package gplx.stores.dsvs; import gplx.*; import gplx.stores.*;
|
||||
import org.junit.*;
|
||||
public class DsvDataRdr_dsv_dat_tst {
|
||||
@Before public void setup() {fx.Clear();} DsvDataRdr_fxt fx = DsvDataRdr_fxt.new_();
|
||||
@Test public void NameOnly() {
|
||||
@Test public void NameOnly() {
|
||||
fx.run_parse_("tableName, ,\" \",#");
|
||||
fx.tst_Tbls("tableName");
|
||||
fx.tst_Dat(0);
|
||||
}
|
||||
@Test public void Rows_N() {
|
||||
@Test public void Rows_N() {
|
||||
fx.run_parse_lines_
|
||||
( "numbers, ,\" \",#"
|
||||
, "1,2,3"
|
||||
@ -36,7 +36,7 @@ public class DsvDataRdr_dsv_dat_tst {
|
||||
, fx.ary_("4", "5", "6")
|
||||
);
|
||||
}
|
||||
@Test public void Tbls_N() {
|
||||
@Test public void Tbls_N() {
|
||||
fx.run_parse_lines_
|
||||
( "letters, ,\" \",#"
|
||||
, "a,b,c"
|
||||
@ -48,7 +48,7 @@ public class DsvDataRdr_dsv_dat_tst {
|
||||
fx.tst_Dat(0, fx.ary_("a", "b", "c"));
|
||||
fx.tst_Dat(1, fx.ary_("1", "2", "3"), fx.ary_("4", "5", "6"));
|
||||
}
|
||||
@Test public void IgnoreTrailingBlankRow() {
|
||||
@Test public void IgnoreTrailingBlankRow() {
|
||||
fx.run_parse_lines_
|
||||
( "letters, ,\" \",#"
|
||||
, "a,b,c"
|
||||
@ -57,7 +57,7 @@ public class DsvDataRdr_dsv_dat_tst {
|
||||
fx.tst_Tbls("letters");
|
||||
fx.tst_Dat(0, fx.ary_("a", "b", "c"));
|
||||
}
|
||||
@Test public void AllowCommentsDuringData() {
|
||||
@Test public void AllowCommentsDuringData() {
|
||||
fx.run_parse_lines_
|
||||
( "letters, ,\" \",#"
|
||||
, "a,b,c"
|
||||
|
@ -19,7 +19,7 @@ package gplx.stores.dsvs; import gplx.*; import gplx.stores.*;
|
||||
import org.junit.*;
|
||||
public class DsvDataRdr_dsv_hdr_tst {
|
||||
@Before public void setup() {fx.Clear();} DsvDataRdr_fxt fx = DsvDataRdr_fxt.new_();
|
||||
@Test public void Names() {
|
||||
@Test public void Names() {
|
||||
fx.run_parse_lines_
|
||||
( "id,name, ,\" \",@"
|
||||
, "0,me"
|
||||
@ -32,7 +32,7 @@ public class DsvDataRdr_dsv_hdr_tst {
|
||||
, fx.ary_("1", "you")
|
||||
);
|
||||
}
|
||||
@Test public void Types() {
|
||||
@Test public void Types() {
|
||||
fx.run_parse_lines_
|
||||
( "int," + StringClassXtn.Key_const + ", ,\" \",$"
|
||||
, "0,me"
|
||||
@ -44,7 +44,7 @@ public class DsvDataRdr_dsv_hdr_tst {
|
||||
, fx.ary_(1, "you")
|
||||
);
|
||||
}
|
||||
@Test public void NamesAndTypes() {
|
||||
@Test public void NamesAndTypes() {
|
||||
fx.run_parse_lines_
|
||||
( "id,name, ,\" \",@"
|
||||
, "int," + StringClassXtn.Key_const + ", ,\" \",$"
|
||||
@ -57,7 +57,7 @@ public class DsvDataRdr_dsv_hdr_tst {
|
||||
, fx.ary_(1, "you")
|
||||
);
|
||||
}
|
||||
@Test public void MultipleTables_NoData() {
|
||||
@Test public void MultipleTables_NoData() {
|
||||
fx.run_parse_lines_
|
||||
( "persons, ,\" \",#"
|
||||
, "id,name, ,\" \",@"
|
||||
@ -70,7 +70,7 @@ public class DsvDataRdr_dsv_hdr_tst {
|
||||
fx.tst_Dat(0);
|
||||
fx.tst_Dat(1);
|
||||
}
|
||||
@Test public void Comment() {
|
||||
@Test public void Comment() {
|
||||
fx.run_parse_lines_
|
||||
( "--------------------, ,\" \",//"
|
||||
, "tbl0, ,\" \",#"
|
||||
|
@ -23,13 +23,13 @@ public class GfsCore_tst {
|
||||
core.AddObj(String_.Gfs, "String_");
|
||||
core.AddObj(Int_.Gfs, "Int_");
|
||||
} GfsCore core;
|
||||
@Test public void Basic() { // String_.Len('abc') >> 3
|
||||
@Test public void Basic() { // String_.Len('abc') >> 3
|
||||
tst_Msg
|
||||
( msg_("String_").Subs_
|
||||
( msg_("Len").Add("v", "abc"))
|
||||
, 3);
|
||||
}
|
||||
@Test public void PrimitiveConversion() { // String_.Len('abc').Add(-3) >> 0
|
||||
@Test public void PrimitiveConversion() { // String_.Len('abc').Add(-3) >> 0
|
||||
tst_Msg
|
||||
( msg_("String_").Subs_
|
||||
( msg_("Len").Add("v", "abc").Subs_
|
||||
@ -37,32 +37,32 @@ public class GfsCore_tst {
|
||||
)
|
||||
, 0);
|
||||
}
|
||||
// @Test public void Fail_notFound() { // String_.DoesNotExists
|
||||
// @Test public void Fail_notFound() { // String_.DoesNotExists
|
||||
// tst_Err
|
||||
// ( msg_("help").Add("", "String_.DoesNotExist")
|
||||
// , GfsHelp.Err_Unhandled("String_", "DoesNotExist"));
|
||||
// }
|
||||
@Test public void Cmd() { // cmd
|
||||
@Test public void Cmd() { // cmd
|
||||
core.AddCmd(new GfsTest_cmd(), "testCmd");
|
||||
tst_Msg
|
||||
( msg_("testCmd").Add("s", "pass")
|
||||
, "pass");
|
||||
}
|
||||
@Test public void EmptyMsg() {
|
||||
@Test public void EmptyMsg() {
|
||||
tst_Msg
|
||||
( msg_("")
|
||||
, GfoInvkAble_.Rv_unhandled);
|
||||
}
|
||||
// @Test public void Fail_argMissing() { // String_.Len()
|
||||
// @Test public void Fail_argMissing() { // String_.Len()
|
||||
// tst_String__Len_Err(msg_("Len"), GfsCtx.Err_KeyNotFound("v", "<<EMPTY>>"));
|
||||
// }
|
||||
// @Test public void Fail_argWrongKey() { // String_.Len(badKey='abc')
|
||||
// @Test public void Fail_argWrongKey() { // String_.Len(badKey='abc')
|
||||
// tst_String__Len_Err(msg_("Len").Add("badKey", "abc"), GfsCtx.Err_KeyNotFound("v", "badKey;"));
|
||||
// }
|
||||
// @Test public void Fail_argExtraKey() { // String_.Len(v='abc' extraKey=1)
|
||||
// @Test public void Fail_argExtraKey() { // String_.Len(v='abc' extraKey=1)
|
||||
// tst_String__Len_Err(msg_("Len").Add("v", "abc").Add("extraKey", 1), GfsCtx.Err_KeyNotFound("v", "badKey;"));
|
||||
// }
|
||||
@Test public void Add_obj_deep() { // String_.Len(badKey='abc')
|
||||
@Test public void Add_obj_deep() { // String_.Len(badKey='abc')
|
||||
GfsCore_tst_nest obj1 = GfsCore_tst_nest.new_("1", "val1");
|
||||
GfsCore_tst_nest obj1_1 = GfsCore_tst_nest.new_("1_1", "val2");
|
||||
core.AddObj(obj1, "1");
|
||||
|
@ -32,4 +32,5 @@ public interface Gfo_usr_dlg extends GfoInvkAble, Cancelable {
|
||||
String Prog_one(String grp_key, String msg_key, String fmt, Object arg);
|
||||
String Prog_direct(String msg);
|
||||
String Log_direct(String msg);
|
||||
String Plog_many(String grp_key, String msg_key, String fmt, Object... args);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ class Gfo_usr_dlg_null implements Gfo_usr_dlg {
|
||||
public String Prog_one(String grp_key, String msg_key, String fmt, Object arg) {return "";}
|
||||
public String Prog_direct(String msg) {return "";}
|
||||
public String Log_direct(String msg) {return "";}
|
||||
public String Plog_many(String grp_key, String msg_key, String fmt, Object... args) {return "";}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {return this;}
|
||||
public static final Gfo_usr_dlg_null _ = new Gfo_usr_dlg_null(); Gfo_usr_dlg_null() {}
|
||||
}
|
||||
|
@ -20,19 +20,19 @@ import org.junit.*;
|
||||
import gplx.ios.*; import gplx.texts.*;
|
||||
public class HierStrBldr_tst {
|
||||
@Before public void setup() {bldr = new HierStrBldr();} HierStrBldr bldr;
|
||||
@Test public void Hier0() {
|
||||
@Test public void Hier0() {
|
||||
bldr.Ctor("/root/", "dir_{0}/", "idx_{0}.csv", "000");
|
||||
tst_MakeName( 0, "/root/idx_000.csv");
|
||||
tst_MakeName( 1, "/root/idx_001.csv");
|
||||
tst_MakeName(10, "/root/idx_010.csv");
|
||||
}
|
||||
@Test public void Hier1() {
|
||||
@Test public void Hier1() {
|
||||
bldr.Ctor("/root/", "dir_{0}/", "idx_{0}.csv", "000", 10);
|
||||
tst_MakeName( 0, "/root/dir_000/idx_000.csv");
|
||||
tst_MakeName( 1, "/root/dir_000/idx_001.csv");
|
||||
tst_MakeName(10, "/root/dir_010/idx_010.csv");
|
||||
}
|
||||
@Test public void Hier2() {
|
||||
@Test public void Hier2() {
|
||||
bldr.Ctor("/root/", "dir_{0}/", "idx_{0}.csv", "000", 5, 10);
|
||||
tst_MakeName( 0, "/root/dir_000/dir_000/idx_000.csv");
|
||||
tst_MakeName( 1, "/root/dir_000/dir_000/idx_001.csv");
|
||||
|
@ -19,13 +19,13 @@ package gplx.xmls; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class XmlDoc_tst {
|
||||
String xml; XmlDoc xdoc; XmlNde xnde;
|
||||
@Test public void parse_() {
|
||||
@Test public void parse_() {
|
||||
xml = String_.Concat("<root/>");
|
||||
xdoc = XmlDoc_.parse_(xml);
|
||||
Tfds.Eq("root", xdoc.Root().Name());
|
||||
Tfds.Eq(true, xdoc.Root().NdeType_element());
|
||||
}
|
||||
@Test public void Xml_outer() {
|
||||
@Test public void Xml_outer() {
|
||||
xml = String_.Concat
|
||||
( "<root>"
|
||||
, "<a>"
|
||||
@ -39,7 +39,7 @@ public class XmlDoc_tst {
|
||||
Tfds.Eq("a", xnde.Name());
|
||||
Tfds.Eq("<a><b/><b/></a>", xnde.Xml_outer());
|
||||
}
|
||||
@Test public void Text_inner() {
|
||||
@Test public void Text_inner() {
|
||||
xml = String_.Concat
|
||||
( "<root>"
|
||||
, "<a>"
|
||||
@ -52,7 +52,7 @@ public class XmlDoc_tst {
|
||||
Tfds.Eq("a", xnde.Name());
|
||||
Tfds.Eq("test me", xnde.Text_inner());
|
||||
}
|
||||
@Test public void Atrs() {
|
||||
@Test public void Atrs() {
|
||||
xml = String_.Concat
|
||||
( "<root atr0=\"0\" atr1=\"1\">"
|
||||
, "</root>"
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xmls; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class Xpath__tst {
|
||||
@Test public void Select_all() {
|
||||
@Test public void Select_all() {
|
||||
String xml = String_.Concat
|
||||
( "<root>"
|
||||
, "<a>"
|
||||
|
@ -21,7 +21,7 @@ public class EnmParser_tst {
|
||||
@Before public void setup() {
|
||||
parser = EnmMgr.new_();
|
||||
}
|
||||
@Test public void Basic() { // 1,2,4,8
|
||||
@Test public void Basic() { // 1,2,4,8
|
||||
parser.BitRngEnd_(8);
|
||||
run_Reg(0, "zero");
|
||||
run_Reg(1, "one");
|
||||
@ -34,7 +34,7 @@ public class EnmParser_tst {
|
||||
tst_Convert("eight", 8);
|
||||
tst_Convert("one+eight", 9);
|
||||
}
|
||||
@Test public void Keys() {
|
||||
@Test public void Keys() {
|
||||
parser.BitRngBgn_(65536).BitRngEnd_(262144);
|
||||
run_Reg( 65, "a");
|
||||
run_Reg( 65536, "shift");
|
||||
@ -45,7 +45,7 @@ public class EnmParser_tst {
|
||||
tst_Convert("ctrl+a", 65 + 131072);
|
||||
tst_Convert("shift+ctrl+a", 65 + 65536 + 131072);
|
||||
}
|
||||
@Test public void Prefix() {
|
||||
@Test public void Prefix() {
|
||||
parser.Prefix_("key.").BitRngBgn_(128).BitRngEnd_(128);
|
||||
run_Reg(65, "a");
|
||||
tst_Convert("key.a", 65);
|
||||
|
@ -22,31 +22,31 @@ public class GfoMsg_rdr_tst {
|
||||
msg = msg_().Add("a", "1").Add("b", "2").Add("c", "3");
|
||||
ctx.Match("init", "init");
|
||||
} GfoMsg msg; GfsCtx ctx = GfsCtx.new_();
|
||||
@Test public void Key() {
|
||||
@Test public void Key() {
|
||||
tst_Msg(msg, "a", "1");
|
||||
tst_Msg(msg, "b", "2");
|
||||
tst_Msg(msg, "c", "3");
|
||||
tst_Msg(msg, "d", null);
|
||||
}
|
||||
@Test public void Pos() {
|
||||
@Test public void Pos() {
|
||||
msg = msg_().Add("", "1").Add("", "2").Add("", "3");
|
||||
tst_Msg(msg, "", "1");
|
||||
tst_Msg(msg, "", "2");
|
||||
tst_Msg(msg, "", "3");
|
||||
tst_Msg(msg, "", null);
|
||||
}
|
||||
@Test public void OutOfOrder() {
|
||||
@Test public void OutOfOrder() {
|
||||
tst_Msg(msg, "c", "3");
|
||||
tst_Msg(msg, "b", "2");
|
||||
tst_Msg(msg, "a", "1");
|
||||
}
|
||||
@Test public void Key3_Pos1_Pos2() {
|
||||
@Test public void Key3_Pos1_Pos2() {
|
||||
msg = msg_().Add("", "1").Add("", "2").Add("c", "3");
|
||||
tst_Msg(msg, "c", "3");
|
||||
tst_Msg(msg, "", "1");
|
||||
tst_Msg(msg, "", "2");
|
||||
}
|
||||
@Test public void MultipleEmpty() {
|
||||
@Test public void MultipleEmpty() {
|
||||
msg = msg_().Add("", "1").Add("", "2").Add("", "3");
|
||||
tst_Msg(msg, "", "1");
|
||||
tst_Msg(msg, "", "2");
|
||||
|
@ -22,7 +22,7 @@ public class IoEngine_dir_basic_system_tst extends IoEngine_dir_basic_base {
|
||||
root = Tfds.RscDir.GenSubDir_nest("100_core", "ioEngineTest", "_temp");
|
||||
IoEngine_xrg_deleteDir.new_(root).Recur_().ReadOnlyFails_off().Exec();
|
||||
} @Override protected IoEngine engine_() {return IoEngine_system.new_();}
|
||||
@Test @Override public void ScanDir() {
|
||||
@Test @Override public void ScanDir() {
|
||||
super.ScanDir();
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ public class IoEngine_fil_basic_system_tst extends IoEngine_fil_basic_base {
|
||||
fil = root.GenSubFil("fil.txt");
|
||||
IoEngine_xrg_deleteDir.new_(fil.OwnerDir()).Recur_().ReadOnlyFails_off().Exec();
|
||||
} @Override protected IoEngine engine_() {return IoEngine_system.new_();}
|
||||
@Test public void ExistsFil_IgnoreDifferentCasing() {
|
||||
@Test public void ExistsFil_IgnoreDifferentCasing() {
|
||||
if (root.Info().CaseSensitive()) return;
|
||||
fx.run_SaveFilText(fil, "text");
|
||||
fx.tst_ExistsPaths(true, fil);
|
||||
fx.tst_ExistsPaths(true, fil.OwnerDir().GenSubFil("FIL.txt"));
|
||||
}
|
||||
@Test @gplx.Virtual public void RecycleFil() {
|
||||
@Test @gplx.Virtual public void RecycleFil() {
|
||||
fx.run_SaveFilText(fil, "text");
|
||||
fx.tst_ExistsPaths(true, fil);
|
||||
|
||||
@ -46,13 +46,13 @@ public class IoEngine_fil_basic_system_tst extends IoEngine_fil_basic_base {
|
||||
fx.tst_ExistsPaths(true, fil);
|
||||
fx.tst_ExistsPaths(false, recycleXrg.RecycleUrl());
|
||||
}
|
||||
@Test @Override public void DeleteFil_missing_pass() {
|
||||
@Test @Override public void DeleteFil_missing_pass() {
|
||||
super.DeleteFil_missing_pass();
|
||||
}
|
||||
@Test @Override public void DeleteFil_readOnly_pass() {
|
||||
@Test @Override public void DeleteFil_readOnly_pass() {
|
||||
super.DeleteFil_readOnly_pass ();
|
||||
}
|
||||
@Test @Override public void SaveFilText_readOnlyFails() {
|
||||
@Test @Override public void SaveFilText_readOnlyFails() {
|
||||
super.SaveFilText_readOnlyFails();
|
||||
}
|
||||
}
|
||||
|
@ -18,23 +18,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.stores; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class GfoNdeRdr_read_tst {
|
||||
@Test public void ReadInt() {
|
||||
@Test public void ReadInt() {
|
||||
rdr = rdr_(IntClassXtn._, "id", 1);
|
||||
Tfds.Eq(rdr.ReadInt("id"), 1);
|
||||
}
|
||||
@Test public void ReadIntOr() {
|
||||
@Test public void ReadIntOr() {
|
||||
rdr = rdr_(IntClassXtn._, "id", 1);
|
||||
Tfds.Eq(rdr.ReadIntOr("id", -1), 1);
|
||||
}
|
||||
@Test public void ReadIntElse_minus1() {
|
||||
@Test public void ReadIntElse_minus1() {
|
||||
rdr = rdr_(IntClassXtn._, "id", null);
|
||||
Tfds.Eq(rdr.ReadIntOr("id", -1), -1);
|
||||
}
|
||||
@Test public void ReadInt_parse() {
|
||||
@Test public void ReadInt_parse() {
|
||||
rdr = rdr_(StringClassXtn._, "id", "1");
|
||||
Tfds.Eq(rdr.ReadInt("id"), 1);
|
||||
}
|
||||
@Test public void ReadIntElse_parse() {
|
||||
@Test public void ReadIntElse_parse() {
|
||||
rdr = rdr_(StringClassXtn._, "id", "2");
|
||||
Tfds.Eq(rdr.ReadIntOr("id", -1), 2);
|
||||
}
|
||||
|
@ -18,14 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.stores.xmls; import gplx.*; import gplx.stores.*;
|
||||
import org.junit.*;
|
||||
public class XmlDataRdr_tst {
|
||||
@Test public void Read() {
|
||||
@Test public void Read() {
|
||||
DataRdr rdr = fx.rdr_("<title id=\"1\" name=\"first\" profiled=\"false\" />");
|
||||
Tfds.Eq(rdr.NameOfNode(), "title");
|
||||
Tfds.Eq(rdr.ReadStr("name"), "first");
|
||||
Tfds.Eq(rdr.ReadInt("id"), 1);
|
||||
Tfds.Eq(rdr.ReadBool("profiled"), false);
|
||||
}
|
||||
@Test public void None() {
|
||||
@Test public void None() {
|
||||
DataRdr rdr = fx.rdr_
|
||||
( "<root>"
|
||||
, "<find/>"
|
||||
@ -33,7 +33,7 @@ public class XmlDataRdr_tst {
|
||||
);
|
||||
fx.tst_Subs_ByName(rdr, "no_nde", "no_atr");
|
||||
}
|
||||
@Test public void One() {
|
||||
@Test public void One() {
|
||||
DataRdr rdr = fx.rdr_
|
||||
( "<root>"
|
||||
, "<find id=\"f0\" />"
|
||||
@ -41,7 +41,7 @@ public class XmlDataRdr_tst {
|
||||
);
|
||||
fx.tst_Subs_ByName(rdr, "find", "id", "f0");
|
||||
}
|
||||
@Test public void One_IgnoreOthers() {
|
||||
@Test public void One_IgnoreOthers() {
|
||||
DataRdr rdr = fx.rdr_
|
||||
( "<root>"
|
||||
, "<find id=\"f0\" />"
|
||||
@ -50,7 +50,7 @@ public class XmlDataRdr_tst {
|
||||
);
|
||||
fx.tst_Subs_ByName(rdr, "find", "id", "f0");
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
DataRdr rdr = fx.rdr_
|
||||
( "<root>"
|
||||
, "<find id=\"f0\" />"
|
||||
@ -59,7 +59,7 @@ public class XmlDataRdr_tst {
|
||||
);
|
||||
fx.tst_Subs_ByName(rdr, "find", "id", "f0", "f1");
|
||||
}
|
||||
@Test public void Nested() {
|
||||
@Test public void Nested() {
|
||||
DataRdr rdr = fx.rdr_
|
||||
( "<root>"
|
||||
, "<sub1>"
|
||||
@ -70,7 +70,7 @@ public class XmlDataRdr_tst {
|
||||
);
|
||||
fx.tst_Subs_ByName(rdr, "sub1/find", "id", "f0", "f1");
|
||||
}
|
||||
@Test public void Nested_IgnoreOthers() {
|
||||
@Test public void Nested_IgnoreOthers() {
|
||||
DataRdr rdr = fx.rdr_
|
||||
( "<root>"
|
||||
, "<sub1>"
|
||||
|
@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfml; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class GfmlDataRdr_tst {
|
||||
@Test public void Raw() {
|
||||
@Test public void Raw() {
|
||||
raw = "root:{}";
|
||||
rdr = rdr_(raw);
|
||||
|
||||
Tfds.Eq(rdr.NameOfNode(), "root");
|
||||
}
|
||||
@Test public void Atrs() {
|
||||
@Test public void Atrs() {
|
||||
raw = "root:id=1 name=me isPresent=true dateOf='2006-12-08';";
|
||||
rdr = rdr_(raw);
|
||||
|
||||
@ -33,7 +33,7 @@ public class GfmlDataRdr_tst {
|
||||
Tfds.Eq(rdr.ReadBool("isPresent"), true);
|
||||
Tfds.Eq_date(rdr.ReadDate("dateOf"), DateAdp_.parse_gplx("2006-12-08"));
|
||||
}
|
||||
@Test public void Subs() {
|
||||
@Test public void Subs() {
|
||||
raw = String_.Concat_any(
|
||||
"root:{",
|
||||
" computers:id=1 {",
|
||||
@ -65,7 +65,7 @@ public class GfmlDataRdr_tst {
|
||||
}
|
||||
Tfds.Eq(idx, 2);
|
||||
}
|
||||
@Test public void SelectRdr() {
|
||||
@Test public void SelectRdr() {
|
||||
raw = String_.Concat_any(
|
||||
"root:{",
|
||||
" person:name=me {}",
|
||||
@ -80,7 +80,7 @@ public class GfmlDataRdr_tst {
|
||||
Tfds.Eq(computer.NameOfNode(), "computer");
|
||||
Tfds.Eq(computer.ReadStr("brand"), "noname");
|
||||
}
|
||||
// @Test public void Subs_byKey() {
|
||||
// @Test public void Subs_byKey() {
|
||||
// raw = String_.Concat_any(
|
||||
// "root:",
|
||||
// " person=(name=me)",
|
||||
@ -91,7 +91,7 @@ public class GfmlDataRdr_tst {
|
||||
// Tfds.Eq(person.NameOfNode, "person");
|
||||
// Tfds.Eq(person.ReadStr("name"), "me");
|
||||
// }
|
||||
// @Test public void Type() {
|
||||
// @Test public void Type() {
|
||||
// raw = String_.Concat_any(
|
||||
// "root:{",
|
||||
// " _type:{example{explicit_val; bool_val; int_val; string_val; long_val; date_val; float_val; decimal_val;}}",
|
||||
|
@ -21,24 +21,24 @@ public class z011_IntObjHash_tst {
|
||||
@Before public void setup() {
|
||||
hash = new IntObjHash_base();
|
||||
} IntObjHash_base hash;
|
||||
@Test public void Empty() {
|
||||
@Test public void Empty() {
|
||||
tst_Count(0);
|
||||
tst_Fetch(1, null);
|
||||
}
|
||||
@Test public void Add() {
|
||||
@Test public void Add() {
|
||||
hash.Add(1, "1");
|
||||
tst_Count(1);
|
||||
tst_Fetch(1, "1");
|
||||
tst_Fetch(2, null);
|
||||
}
|
||||
@Test public void Del() {
|
||||
@Test public void Del() {
|
||||
hash.Add(1, "1");
|
||||
|
||||
hash.Del(1);
|
||||
tst_Count(0);
|
||||
tst_Fetch(1, null);
|
||||
}
|
||||
@Test public void Clear() {
|
||||
@Test public void Clear() {
|
||||
hash.Add(1, "1");
|
||||
hash.Add(32, "32");
|
||||
tst_Fetch(1, "1");
|
||||
@ -50,7 +50,7 @@ public class z011_IntObjHash_tst {
|
||||
tst_Fetch(2, null);
|
||||
tst_Fetch(32, null);
|
||||
}
|
||||
@Test public void Add_bug() { // fails after expanding ary, and fetching at key=n*16
|
||||
@Test public void Add_bug() { // fails after expanding ary, and fetching at key=n*16
|
||||
hash.Add(1, "1");
|
||||
tst_Count(1);
|
||||
tst_Fetch(1, "1");
|
||||
|
@ -22,28 +22,28 @@ public class z012_GfmlTrie_tst {
|
||||
@Before public void setup() {
|
||||
trie = GfmlTrie.new_();
|
||||
} GfmlTrie trie;
|
||||
@Test public void Null() {
|
||||
@Test public void Null() {
|
||||
tst_FindMatch_first("", null);
|
||||
tst_FindMatch_first("{", null);
|
||||
}
|
||||
@Test public void OneChar() {
|
||||
@Test public void OneChar() {
|
||||
trie.Add("{", "val0");
|
||||
tst_FindMatch_first("{", "val0");
|
||||
tst_FindMatch_first(":", null);
|
||||
}
|
||||
@Test public void TwoChar() {
|
||||
@Test public void TwoChar() {
|
||||
trie.Add("/*", "val0");
|
||||
tst_FindMatch_first("/*", "val0");
|
||||
tst_FindMatch_first("//", null);
|
||||
}
|
||||
@Test public void ManySym() {
|
||||
@Test public void ManySym() {
|
||||
trie.Add(":", "val0");
|
||||
trie.Add("{", "val1");
|
||||
tst_FindMatch_first(":", "val0");
|
||||
tst_FindMatch_first("{", "val1");
|
||||
tst_FindMatch_first("-", null);
|
||||
}
|
||||
@Test public void Overlap_1_2() {
|
||||
@Test public void Overlap_1_2() {
|
||||
trie.Add("[", "val0");
|
||||
trie.Add("[:", "val1");
|
||||
tst_FindMatch_first("[", "val0");
|
||||
@ -51,7 +51,7 @@ public class z012_GfmlTrie_tst {
|
||||
tst_FindMatch_first("[-", "val0");
|
||||
tst_FindMatch_first(":", null);
|
||||
}
|
||||
@Test public void Overlap_2_1() {
|
||||
@Test public void Overlap_2_1() {
|
||||
trie.Add("[:", "val0");
|
||||
trie.Add("[", "val1");
|
||||
tst_FindMatch_first("[:", "val0");
|
||||
@ -59,7 +59,7 @@ public class z012_GfmlTrie_tst {
|
||||
tst_FindMatch_first("[-", "val1");
|
||||
tst_FindMatch_first(":", null);
|
||||
}
|
||||
@Test public void Overlap_1_1() {
|
||||
@Test public void Overlap_1_1() {
|
||||
trie.Add("[", "val0");
|
||||
trie.Add("[", "val1");
|
||||
tst_FindMatch_first("[", "val1"); // return last added
|
||||
|
@ -19,29 +19,29 @@ package gplx.gfml; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class z015_GfmlDocPos_tst {
|
||||
GfmlDocPos root = GfmlDocPos_.Root;
|
||||
@Test public void Root() {
|
||||
@Test public void Root() {
|
||||
tst_Path(root, "0");
|
||||
}
|
||||
@Test public void MoveDown() {
|
||||
@Test public void MoveDown() {
|
||||
tst_Path(root.NewDown(0), "0_0");
|
||||
tst_Path(root.NewDown(0).NewDown(0), "0_0_0");
|
||||
tst_Path(root.NewDown(1).NewDown(2), "0_1_2");
|
||||
}
|
||||
@Test public void MoveUp() {
|
||||
@Test public void MoveUp() {
|
||||
tst_Path(root.NewDown(1).NewDown(2).NewUp(), "0_1");
|
||||
}
|
||||
@Test public void CompareTo_same() {
|
||||
@Test public void CompareTo_same() {
|
||||
GfmlDocPos lhs = root.NewDown(0);
|
||||
GfmlDocPos rhs = root.NewDown(0);
|
||||
tst_CompareTo(lhs, rhs, CompareAble_.Same);
|
||||
}
|
||||
@Test public void CompareTo_diffIndex() {
|
||||
@Test public void CompareTo_diffIndex() {
|
||||
GfmlDocPos lhs = root.NewDown(0);
|
||||
GfmlDocPos rhs = root.NewDown(1);
|
||||
tst_CompareTo(lhs, rhs, CompareAble_.Less);
|
||||
tst_CompareTo(rhs, lhs, CompareAble_.More);
|
||||
}
|
||||
@Test public void CompareTo_diffLevel() {
|
||||
@Test public void CompareTo_diffLevel() {
|
||||
GfmlDocPos lhs = root;
|
||||
GfmlDocPos rhs = root.NewDown(0);
|
||||
tst_CompareTo(lhs, rhs, CompareAble_.Less);
|
||||
|
@ -21,14 +21,14 @@ public class z016_GfmlScopeList_tst {
|
||||
@Before public void setup() {
|
||||
list = GfmlScopeList.new_("test");
|
||||
} GfmlScopeList list;
|
||||
@Test public void None() {
|
||||
@Test public void None() {
|
||||
tst_Itm(list, GfmlDocPos_.Root, null);
|
||||
}
|
||||
@Test public void One() {
|
||||
@Test public void One() {
|
||||
run_Add(list, var_("val1"));
|
||||
tst_Itm(list, GfmlDocPos_.Root, "val1");
|
||||
}
|
||||
@Test public void ByPos() {
|
||||
@Test public void ByPos() {
|
||||
run_Add(list, var_("val1").DocPos_(docPos_(0, 0)));
|
||||
run_Add(list, var_("val2").DocPos_(docPos_(0, 0, 0)));
|
||||
tst_Itm(list, docPos_(0, 0), "val1");
|
||||
|
@ -23,26 +23,26 @@ public class z051_GfmlFldPool_keyed_tst {
|
||||
GfmlType type = makr.MakeSubType("point", "x", "y", "z");
|
||||
fldPool = GfmlFldPool.new_(type);
|
||||
} GfmlFldPool fldPool;
|
||||
@Test public void PopByKey_inOrder() {
|
||||
@Test public void PopByKey_inOrder() {
|
||||
tst_Keyed_PopByKey(fldPool, "x", "x", "y", "z");
|
||||
}
|
||||
@Test public void PopByKey_outOfOrder() {
|
||||
@Test public void PopByKey_outOfOrder() {
|
||||
tst_Keyed_PopByKey(fldPool, "y", "y", "x", "z");
|
||||
}
|
||||
@Test public void PopByKey_unknown() {
|
||||
@Test public void PopByKey_unknown() {
|
||||
tst_Keyed_PopByKey(fldPool, "a", GfmlItmKeys.NullKey, "x", "y", "z");
|
||||
}
|
||||
@Test public void PopByKey_alreadyRemoved() {
|
||||
@Test public void PopByKey_alreadyRemoved() {
|
||||
tst_Keyed_PopByKey(fldPool, "x", "x", "y", "z");
|
||||
tst_Keyed_PopByKey(fldPool, "x", GfmlItmKeys.NullKey, "y", "z");
|
||||
}
|
||||
@Test public void PopByKey_depleted() {
|
||||
@Test public void PopByKey_depleted() {
|
||||
tst_Keyed_PopByKey(fldPool, "x", "x", "y", "z");
|
||||
tst_Keyed_PopByKey(fldPool, "y", "y", "z");
|
||||
tst_Keyed_PopByKey(fldPool, "z", "z");
|
||||
tst_Keyed_PopByKey(fldPool, "x", GfmlItmKeys.NullKey);
|
||||
}
|
||||
@Test public void PopNext_inOrder() {
|
||||
@Test public void PopNext_inOrder() {
|
||||
tst_Keyed_PopNext(fldPool, "x", "y", "z");
|
||||
tst_Keyed_PopNext(fldPool, "y", "z");
|
||||
tst_Keyed_PopNext(fldPool, "z");
|
||||
@ -52,7 +52,7 @@ public class z051_GfmlFldPool_keyed_tst {
|
||||
}
|
||||
catch (Exception exc) {Err_.Noop(exc);}
|
||||
}
|
||||
@Test public void PopByKey_PopNext() {
|
||||
@Test public void PopByKey_PopNext() {
|
||||
tst_Keyed_PopByKey(fldPool, "y", "y", "x", "z");
|
||||
tst_Keyed_PopNext(fldPool, "x", "z");
|
||||
}
|
||||
|
@ -22,45 +22,45 @@ public class z081_GfmlDataWtr_tst {
|
||||
wtr = GfmlDataWtr.new_();
|
||||
wtr.WriteNodeBgn("root");
|
||||
} DataWtr wtr;
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
tst_XtoStr(wtr, "root:;");
|
||||
}
|
||||
@Test public void Atr_one() {
|
||||
@Test public void Atr_one() {
|
||||
wtr.WriteData("key", "data");;
|
||||
tst_XtoStr(wtr, "root:key='data';");
|
||||
}
|
||||
@Test public void Atr_many() {
|
||||
@Test public void Atr_many() {
|
||||
wtr.WriteData("key1", "data1");
|
||||
wtr.WriteData("key2", "data2");
|
||||
tst_XtoStr(wtr, "root:key1='data1' key2='data2';");
|
||||
}
|
||||
@Test public void Nde_one() {
|
||||
@Test public void Nde_one() {
|
||||
wtr.WriteNodeBgn("sub0");
|
||||
tst_XtoStr(wtr, "root:{sub0:;}");
|
||||
}
|
||||
@Test public void Nde_many() {
|
||||
@Test public void Nde_many() {
|
||||
wtr.WriteNodeBgn("sub0");
|
||||
wtr.WriteNodeEnd();
|
||||
wtr.WriteNodeBgn("sub1");
|
||||
tst_XtoStr(wtr, "root:{sub0:;sub1:;}");
|
||||
}
|
||||
@Test public void Nde_nested() {
|
||||
@Test public void Nde_nested() {
|
||||
wtr.WriteNodeBgn("sub0");
|
||||
wtr.WriteNodeBgn("sub1");
|
||||
tst_XtoStr(wtr, "root:{sub0:{sub1:;}}");
|
||||
}
|
||||
@Test public void OneAtrOneNde() {
|
||||
@Test public void OneAtrOneNde() {
|
||||
wtr.WriteData("key1", "data1");
|
||||
wtr.WriteNodeBgn("sub0");
|
||||
tst_XtoStr(wtr, "root:key1='data1'{sub0:;}");
|
||||
}
|
||||
@Test public void OneAtrOneNdeOneAtr() {
|
||||
@Test public void OneAtrOneNdeOneAtr() {
|
||||
wtr.WriteData("key1", "data1");
|
||||
wtr.WriteNodeBgn("sub0");
|
||||
wtr.WriteData("key2", "data2");
|
||||
tst_XtoStr(wtr, "root:key1='data1'{sub0:key2='data2';}");
|
||||
}
|
||||
@Test public void EscapeQuote() {
|
||||
@Test public void EscapeQuote() {
|
||||
wtr.WriteData("key", "data's");;
|
||||
tst_XtoStr(wtr, "root:key='data''s';");
|
||||
}
|
||||
|
@ -22,20 +22,20 @@ public class z091_GfmlLxr_basic_tst {
|
||||
@Before public void setup() {
|
||||
rootLxr = GfmlLxr_.general_("gfml.root", GfmlTkn_.cmd_("tkn:text", GfmlBldrCmd_.Null));
|
||||
} GfmlLxr rootLxr;
|
||||
@Test public void Empty() {
|
||||
@Test public void Empty() {
|
||||
tst_Fetch("");
|
||||
}
|
||||
@Test public void General() {
|
||||
@Test public void General() {
|
||||
tst_Fetch("text", "text");
|
||||
}
|
||||
@Test public void Solo() {
|
||||
@Test public void Solo() {
|
||||
ini_AddSymbol(",");
|
||||
tst_Fetch(",", ",");
|
||||
tst_Fetch(",data0", ",", "data0");
|
||||
tst_Fetch("data0,", "data0", ",");
|
||||
tst_Fetch("data0,data1", "data0", ",", "data1");
|
||||
}
|
||||
@Test public void Range() {
|
||||
@Test public void Range() {
|
||||
ini_AddRange(" ", "\t");
|
||||
tst_Fetch(" ", " ");
|
||||
tst_Fetch(" a", " ", "a");
|
||||
|
@ -22,7 +22,7 @@ public class z101_core_ndeInline_tst {
|
||||
@Before public void setup() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.NdeInline_lxr());
|
||||
}
|
||||
@Test public void One() {
|
||||
@Test public void One() {
|
||||
fx.tst_Doc("a;", fx.nde_().Atru_("a"));
|
||||
fx.tst_Tkn("a;"
|
||||
, fx.tkn_grp_
|
||||
@ -30,7 +30,7 @@ public class z101_core_ndeInline_tst {
|
||||
, fx.tkn_itm_(";")
|
||||
));
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
fx.tst_Doc("a;b;"
|
||||
, fx.nde_().Atru_("a")
|
||||
, fx.nde_().Atru_("b")
|
||||
|
@ -25,7 +25,7 @@ public class z103_core_elmKey_tst {
|
||||
, GfmlDocLxrs.ElmKey_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("a=b;", fx.nde_().Atrk_("a", "b"));
|
||||
fx.tst_Tkn("a=b;"
|
||||
, fx.tkn_grp_
|
||||
@ -34,7 +34,7 @@ public class z103_core_elmKey_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void Ws() {
|
||||
@Test public void Ws() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
fx.tst_Tkn("a = b;"
|
||||
, fx.tkn_grp_
|
||||
@ -43,10 +43,10 @@ public class z103_core_elmKey_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
// @Test public void Err_NotNamed() {
|
||||
// @Test public void Err_NotNamed() {
|
||||
// fx.tst_Err("=", GfmlOutCmds.DatTkn_notFound_Err_());
|
||||
// }
|
||||
// @Test public void Err_NotValued() {
|
||||
// @Test public void Err_NotValued() {
|
||||
// fx.tst_Err("a=;", GfmlOutCmds.elmKey_notValued_Err());
|
||||
// }
|
||||
}
|
||||
|
@ -25,13 +25,13 @@ public class z112_core_comment1_tst {
|
||||
, GfmlDocLxrs.Comment1_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("/*a*/");
|
||||
fx.tst_Tkn("/*a*/"
|
||||
, fx.tkn_grp_ary_("/*", "a", "*/")
|
||||
);
|
||||
}
|
||||
@Test public void Data() {
|
||||
@Test public void Data() {
|
||||
fx.tst_Doc("a;/*b*/", fx.nde_().Atru_("a"));
|
||||
fx.tst_Tkn("a;/*b*/"
|
||||
, fx.tkn_grp_
|
||||
@ -40,22 +40,22 @@ public class z112_core_comment1_tst {
|
||||
, fx.tkn_grp_ary_("/*", "b", "*/")
|
||||
);
|
||||
}
|
||||
@Test public void IgnoreWs() {
|
||||
@Test public void IgnoreWs() {
|
||||
fx.tst_Tkn("/* b c */"
|
||||
, fx.tkn_grp_ary_("/*", " b c ", "*/")
|
||||
);
|
||||
}
|
||||
@Test public void EscapeBgn() {
|
||||
@Test public void EscapeBgn() {
|
||||
fx.tst_Tkn("/* /*/* */"
|
||||
, fx.tkn_grp_ary_("/*", " ", "/*/*", " ", "*/")
|
||||
);
|
||||
}
|
||||
@Test public void EscapeEnd() {
|
||||
@Test public void EscapeEnd() {
|
||||
fx.tst_Tkn("/* */*/ */"
|
||||
, fx.tkn_grp_ary_("/*", " ", "*/*/", " ", "*/")
|
||||
);
|
||||
}
|
||||
@Test public void Nest() {
|
||||
@Test public void Nest() {
|
||||
fx.tst_Tkn("/* b0 /* c */ b1 */"
|
||||
, fx.tkn_grp_
|
||||
( fx.tkn_itm_("/*")
|
||||
|
@ -25,7 +25,7 @@ public class z120_quotes_eval0_tst {
|
||||
, GfmlDocLxrs.Eval0_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("<~t>;", fx.nde_().Atru_("\t"));
|
||||
fx.tst_Tkn("<~t>;"
|
||||
, fx.tkn_grp_
|
||||
@ -35,7 +35,7 @@ public class z120_quotes_eval0_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void DoublingIsNotEscaping() {
|
||||
@Test public void DoublingIsNotEscaping() {
|
||||
fx.tst_Doc("<~t>>>;", fx.nde_().Atru_("\t").Atru_(">>")); // >> does not resolve to >
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class z121_quotes_quotes0_tst {
|
||||
, GfmlDocLxrs.Quote0_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("'abc';", fx.nde_().Atru_("abc"));
|
||||
fx.tst_Tkn("'abc';"
|
||||
, fx.tkn_grp_
|
||||
@ -35,7 +35,7 @@ public class z121_quotes_quotes0_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void Escape() {
|
||||
@Test public void Escape() {
|
||||
fx.tst_Doc("'a''b';", fx.nde_().Atru_("a'b"));
|
||||
fx.tst_Tkn("'a''b';"
|
||||
, fx.tkn_grp_
|
||||
@ -45,7 +45,7 @@ public class z121_quotes_quotes0_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void ManyAtrs_LastQuoted() { // bugfix
|
||||
@Test public void ManyAtrs_LastQuoted() { // bugfix
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
fx.tst_Doc("a 'b';", fx.nde_().Atru_("a").Atru_("b"));
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class z122_quotes_quote0_eval0_tst {
|
||||
, GfmlDocLxrs.Quote0_Eval0_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("'a<~t>b';", fx.nde_().Atru_("a\tb"));
|
||||
fx.tst_Tkn("'a<~t>b';"
|
||||
, fx.tkn_grp_
|
||||
@ -41,7 +41,7 @@ public class z122_quotes_quote0_eval0_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void QuoteInside() {
|
||||
@Test public void QuoteInside() {
|
||||
fx.tst_Doc("'a<~'t'>b';", fx.nde_().Atru_("a\tb"));
|
||||
fx.tst_Tkn("'a<~'t'>b';"
|
||||
, fx.tkn_grp_
|
||||
|
@ -25,16 +25,16 @@ public class z123_quotes_quoteBlock_tst {
|
||||
, GfmlDocLxrs.QuoteBlock_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("|'abc'|;", fx.nde_().Atru_("abc"));
|
||||
}
|
||||
@Test public void Escape_bgn() {
|
||||
@Test public void Escape_bgn() {
|
||||
fx.tst_Doc("|'a|'|'b'|;", fx.nde_().Atru_("a|'b"));
|
||||
}
|
||||
@Test public void Escape_end() {
|
||||
@Test public void Escape_end() {
|
||||
fx.tst_Doc("|'a'|'|b'|;", fx.nde_().Atru_("a'|b"));
|
||||
}
|
||||
@Test public void Nest() {
|
||||
@Test public void Nest() {
|
||||
fx.tst_Doc("|'a|'-'|b'|;", fx.nde_().Atru_("a-b"));
|
||||
}
|
||||
}
|
||||
|
@ -25,29 +25,29 @@ public class z151_ndeSubs_basic_tst {
|
||||
, GfmlDocLxrs.NdeBodyEnd_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("{}", fx.nde_());
|
||||
fx.tst_Tkn("{}"
|
||||
, fx.tkn_grp_ary_("{", "}")
|
||||
);
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
fx.tst_Doc("{}{}", fx.nde_(), fx.nde_());
|
||||
}
|
||||
@Test public void Nested() {
|
||||
@Test public void Nested() {
|
||||
fx.tst_Doc("{{}}"
|
||||
, fx.nde_().Subs_
|
||||
( fx.nde_())
|
||||
);
|
||||
}
|
||||
@Test public void NestedMany() {
|
||||
@Test public void NestedMany() {
|
||||
fx.tst_Doc("{{}{}}"
|
||||
, fx.nde_().Subs_
|
||||
( fx.nde_()
|
||||
, fx.nde_()
|
||||
));
|
||||
}
|
||||
@Test public void Complex() {
|
||||
@Test public void Complex() {
|
||||
fx.tst_Doc(String_.Concat
|
||||
( "{"
|
||||
, "{"
|
||||
|
@ -27,37 +27,37 @@ public class z152_ndeSubs_data_tst {
|
||||
, GfmlDocLxrs.Whitespace_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void ToInline() {
|
||||
@Test public void ToInline() {
|
||||
fx.tst_Doc("{a;}"
|
||||
, fx.nde_().Subs_
|
||||
( fx.nde_().Atru_("a"))
|
||||
);
|
||||
}
|
||||
@Test public void ToInline_many() {
|
||||
@Test public void ToInline_many() {
|
||||
fx.tst_Doc("{a b;}"
|
||||
, fx.nde_().Subs_
|
||||
( fx.nde_().Atru_("a").Atru_("b"))
|
||||
);
|
||||
}
|
||||
@Test public void ToBody() {
|
||||
@Test public void ToBody() {
|
||||
fx.tst_Doc("{a{}}"
|
||||
, fx.nde_().Subs_
|
||||
( fx.nde_().Atru_("a"))
|
||||
);
|
||||
}
|
||||
@Test public void ToBody_many() {
|
||||
@Test public void ToBody_many() {
|
||||
fx.tst_Doc("{a b{}}"
|
||||
, fx.nde_().Subs_
|
||||
( fx.nde_().Atru_("a").Atru_("b"))
|
||||
);
|
||||
}
|
||||
@Test public void ToBody_manyNest() {
|
||||
@Test public void ToBody_manyNest() {
|
||||
fx.tst_Doc("a{b;}"
|
||||
, fx.nde_().Atru_("a").Subs_
|
||||
( fx.nde_().Atru_("b"))
|
||||
);
|
||||
}
|
||||
@Test public void ToBody_many2() {
|
||||
@Test public void ToBody_many2() {
|
||||
fx.tst_Doc("a{b{c;}}"
|
||||
, fx.nde_().Atru_("a").Subs_
|
||||
( fx.nde_().Atru_("b").Subs_
|
||||
|
@ -26,19 +26,19 @@ public class z161_ndeHdrs_inline_tst {
|
||||
, GfmlDocLxrs.Whitespace_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("a:;", fx.nde_().Hnd_("a"));
|
||||
fx.tst_Tkn("a:;"
|
||||
, fx.tkn_grp_ary_("a", ":", ";")
|
||||
);
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
fx.tst_Doc("a:;b:;"
|
||||
, fx.nde_().Hnd_("a")
|
||||
, fx.nde_().Hnd_("b")
|
||||
);
|
||||
}
|
||||
@Test public void Ws() {
|
||||
@Test public void Ws() {
|
||||
fx.tst_Tkn("a : ;"
|
||||
, fx.tkn_grp_ary_("a", " ", ":", " ", ";")
|
||||
);
|
||||
|
@ -24,10 +24,10 @@ public class z162_ndeHdrs_err_tst {
|
||||
( GfmlDocLxrs.NdeHeader_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void NotNamed() {
|
||||
@Test public void NotNamed() {
|
||||
fx.tst_Err(":", UsrMsg_mok.new_(GfmlUsrMsgs.fail_DatTkn_notFound()));
|
||||
}
|
||||
@Test public void Dangling() {
|
||||
@Test public void Dangling() {
|
||||
fx.tst_Err("a{", UsrMsg_mok.new_(GfmlUsrMsgs.fail_Frame_danglingBgn()));
|
||||
}
|
||||
}
|
||||
|
@ -26,22 +26,22 @@ public class z163_ndeHdrs_body_tst {
|
||||
, GfmlDocLxrs.NdeBodyEnd_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("a:{}", fx.nde_().Hnd_("a"));
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
fx.tst_Doc("a:{}b:{}"
|
||||
, fx.nde_().Hnd_("a")
|
||||
, fx.nde_().Hnd_("b")
|
||||
);
|
||||
}
|
||||
@Test public void Nested() {
|
||||
@Test public void Nested() {
|
||||
fx.tst_Doc("a:{b:{}}"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().Hnd_("b"))
|
||||
);
|
||||
}
|
||||
@Test public void NestedMany() {
|
||||
@Test public void NestedMany() {
|
||||
fx.tst_Doc("a:{b:{}c:{}}"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().Hnd_("b")
|
||||
|
@ -28,7 +28,7 @@ public class z164_hdeHdrs_data_tst {
|
||||
, GfmlDocLxrs.NdeBodyEnd_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Bas1() {
|
||||
@Test public void Bas1() {
|
||||
fx.tst_Tkn("a:b;"
|
||||
, fx.tkn_grp_
|
||||
( fx.tkn_itm_("a")
|
||||
@ -37,7 +37,7 @@ public class z164_hdeHdrs_data_tst {
|
||||
, fx.tkn_itm_(";")
|
||||
));
|
||||
}
|
||||
@Test public void Basic3() {
|
||||
@Test public void Basic3() {
|
||||
fx.tst_Tkn("a:b{c;}"
|
||||
, fx.tkn_grp_
|
||||
( fx.tkn_itm_("a")
|
||||
|
@ -27,7 +27,7 @@ public class z181_ndeDots_basic_tst {
|
||||
, GfmlDocLxrs.NdeBodyEnd_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void One() {
|
||||
@Test public void One() {
|
||||
fx.tst_Doc("{a.b;c;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
@ -51,7 +51,7 @@ public class z181_ndeDots_basic_tst {
|
||||
, fx.tkn_itm_("}")
|
||||
));
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
fx.tst_Doc("{a.b.c.d;e;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
|
@ -26,7 +26,7 @@ public class z182_ndeDots_subs_tst {
|
||||
, GfmlDocLxrs.NdeBodyEnd_lxr()
|
||||
);
|
||||
} GfmlParse_fxt fx = GfmlParse_fxt.new_();
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("{a.b{}z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
@ -35,7 +35,7 @@ public class z182_ndeDots_subs_tst {
|
||||
, fx.nde_().Atru_("z").ChainId_(0)
|
||||
));
|
||||
}
|
||||
@Test public void Nest() {
|
||||
@Test public void Nest() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.NdeHeader_lxr());
|
||||
fx.tst_Doc("{a.b.c{d:e;}z;}" // shorthand of {a{b{c{d:e;}}}}
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
@ -49,7 +49,7 @@ public class z182_ndeDots_subs_tst {
|
||||
, fx.nde_().ChainId_(0).Atru_("z")
|
||||
));
|
||||
}
|
||||
@Test public void Chain() {
|
||||
@Test public void Chain() {
|
||||
fx.tst_Doc("{a.b.c;z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
@ -59,7 +59,7 @@ public class z182_ndeDots_subs_tst {
|
||||
, fx.nde_().ChainId_(0).Atru_("z")
|
||||
));
|
||||
}
|
||||
@Test public void NdeHdr() {
|
||||
@Test public void NdeHdr() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.NdeHeader_lxr());
|
||||
fx.tst_Doc("{a:b.c;z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
|
@ -28,7 +28,7 @@ public class z183_ndeDots_parens_tst {
|
||||
, GfmlDocLxrs.NdeHdrEnd_lxr()
|
||||
);
|
||||
} GfmlParse_fxt fx = GfmlParse_fxt.new_();
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("{a.b(c);z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
@ -37,7 +37,7 @@ public class z183_ndeDots_parens_tst {
|
||||
, fx.nde_().ChainId_(0).Atru_("z")
|
||||
));
|
||||
}
|
||||
@Test public void Basic_tkn() {
|
||||
@Test public void Basic_tkn() {
|
||||
//A_('1');
|
||||
fx.tst_Tkn("a(c);"
|
||||
, fx.tkn_grp_
|
||||
@ -47,7 +47,7 @@ public class z183_ndeDots_parens_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void Basic2_tkn() {
|
||||
@Test public void Basic2_tkn() {
|
||||
fx.tst_Tkn("a.b(c);"
|
||||
, fx.tkn_grp_
|
||||
( fx.tkn_itm_("a"), fx.tkn_itm_(".")
|
||||
@ -57,7 +57,7 @@ public class z183_ndeDots_parens_tst {
|
||||
)
|
||||
);
|
||||
}
|
||||
@Test public void Many() {
|
||||
@Test public void Many() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
fx.tst_Doc("{a.b(c d e);z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
@ -67,7 +67,7 @@ public class z183_ndeDots_parens_tst {
|
||||
, fx.nde_().ChainId_(0).Atru_("z")
|
||||
));
|
||||
}
|
||||
// @Test public void Many2() {
|
||||
// @Test public void Many2() {
|
||||
// fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
// fx.tst_Doc("{a.b(c){d();}}"
|
||||
// , fx.nde_().ChainId_(0).Subs_
|
||||
@ -78,7 +78,7 @@ public class z183_ndeDots_parens_tst {
|
||||
// )
|
||||
// ));
|
||||
// }
|
||||
@Test public void Chain() {
|
||||
@Test public void Chain() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
fx.tst_Doc("{a.b(c).d(e);z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
@ -90,7 +90,7 @@ public class z183_ndeDots_parens_tst {
|
||||
, fx.nde_().ChainId_(0).Atru_("z")
|
||||
));
|
||||
}
|
||||
@Test public void Nest() {
|
||||
@Test public void Nest() {
|
||||
fx.tst_Doc("{a.b(c.d);z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
@ -103,7 +103,7 @@ public class z183_ndeDots_parens_tst {
|
||||
, fx.nde_().Atru_("z")
|
||||
));
|
||||
}
|
||||
@Test public void Nest_longer() {
|
||||
@Test public void Nest_longer() {
|
||||
fx.tst_Doc("{a.b.c(d.e.f);z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
@ -120,7 +120,7 @@ public class z183_ndeDots_parens_tst {
|
||||
, fx.nde_().Atru_("z")
|
||||
));
|
||||
}
|
||||
@Test public void Nest_deeper() {
|
||||
@Test public void Nest_deeper() {
|
||||
fx.tst_Doc("{a.b(c.d(e.f));z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
( fx.nde_().Hnd_("a").ChainId_(1).Subs_
|
||||
|
@ -29,7 +29,7 @@ public class z184_ndeDots_atrSpr_tst {
|
||||
, GfmlDocLxrs.AtrSpr_lxr()
|
||||
);
|
||||
} GfmlParse_fxt fx = GfmlParse_fxt.new_();
|
||||
@Test public void NestMult() {
|
||||
@Test public void NestMult() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.AtrSpr_lxr());
|
||||
fx.tst_Doc("{a.b(c.d,e.f);z;}"
|
||||
, fx.nde_().ChainId_(0).Subs_
|
||||
|
@ -29,20 +29,20 @@ public class z191_ndeProps_basic_tst {
|
||||
, GfmlDocLxrs.NdeInline_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
fx.tst_Doc("a:[b]{}"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Atru_("b"))
|
||||
);
|
||||
}
|
||||
@Test public void Basic_empty() {
|
||||
@Test public void Basic_empty() {
|
||||
fx.tst_Tkn("[];"
|
||||
, fx.tkn_grp_
|
||||
( fx.tkn_grp_ary_("[", "]")
|
||||
, fx.tkn_itm_(";")
|
||||
));
|
||||
}
|
||||
@Test public void Hdr() {
|
||||
@Test public void Hdr() {
|
||||
fx.tst_Tkn("a[];"
|
||||
, fx.tkn_grp_
|
||||
( fx.tkn_grp_ary_("a")
|
||||
@ -50,52 +50,52 @@ public class z191_ndeProps_basic_tst {
|
||||
, fx.tkn_itm_(";")
|
||||
));
|
||||
}
|
||||
@Test public void WithInnerNde() {
|
||||
@Test public void WithInnerNde() {
|
||||
fx.tst_Doc("a:[b]{c;}"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Atru_("b")
|
||||
, fx.nde_().Atru_("c")
|
||||
));
|
||||
}
|
||||
@Test public void DoesNotUsurpDatTknForName() {
|
||||
@Test public void DoesNotUsurpDatTknForName() {
|
||||
fx.tst_Doc("a:b[c]{}"
|
||||
, fx.nde_().Hnd_("a").Atru_("b").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Atru_("c")
|
||||
));
|
||||
}
|
||||
@Test public void NoHeader_body() {
|
||||
@Test public void NoHeader_body() {
|
||||
fx.tst_Doc("a[b]{}"
|
||||
, fx.nde_().Atru_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Atru_("b")
|
||||
));
|
||||
}
|
||||
@Test public void NoHeader_inline() {
|
||||
@Test public void NoHeader_inline() {
|
||||
fx.tst_Doc("a[b];"
|
||||
, fx.nde_().Atru_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Atru_("b")
|
||||
));
|
||||
}
|
||||
@Test public void Nesting() {
|
||||
@Test public void Nesting() {
|
||||
fx.tst_Doc("a:[b:;]{}"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Subs_
|
||||
( fx.nde_().Hnd_("b"))
|
||||
));
|
||||
}
|
||||
@Test public void Nesting2() {
|
||||
@Test public void Nesting2() {
|
||||
fx.tst_Doc("a:[b{}]{}"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Atru_("b")
|
||||
));
|
||||
}
|
||||
@Test public void CanBeKeyed_header() {
|
||||
@Test public void CanBeKeyed_header() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.ElmKey_lxr());
|
||||
fx.tst_Doc("a:b=[c];"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().KeyedSubObj_().Key_("b").Atru_("c")
|
||||
));
|
||||
}
|
||||
@Test public void CanBeKeyed2_inline() {
|
||||
@Test public void CanBeKeyed2_inline() {
|
||||
fx.ini_RootLxr_Add
|
||||
( GfmlDocLxrs.Whitespace_lxr()
|
||||
, GfmlDocLxrs.ElmKey_lxr()
|
||||
@ -105,12 +105,12 @@ public class z191_ndeProps_basic_tst {
|
||||
( fx.nde_().KeyedSubObj_().Key_("b").Atru_("c")
|
||||
));
|
||||
}
|
||||
@Test public void Sole() {
|
||||
@Test public void Sole() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
fx.tst_Doc("[a b]"
|
||||
, fx.nde_().KeyedSubObj_().Atru_("a").Atru_("b"));
|
||||
}
|
||||
@Test public void Nest1() {
|
||||
@Test public void Nest1() {
|
||||
fx.ini_RootLxr_Add(GfmlDocLxrs.Whitespace_lxr());
|
||||
fx.tst_Doc("[a [b]]"
|
||||
, fx.nde_().Atru_("a").Subs_
|
||||
|
@ -29,7 +29,7 @@ public class z192_ndeProps_dots_tst {
|
||||
, GfmlDocLxrs.NdePropEnd_lxr()
|
||||
);
|
||||
}
|
||||
@Test public void Stress() {
|
||||
@Test public void Stress() {
|
||||
fx.tst_Doc("a.b[c];"
|
||||
, fx.nde_().Hnd_("a").Subs_
|
||||
( fx.nde_().Hnd_("b").Subs_
|
||||
|
@ -21,7 +21,7 @@ public class z452_dflts_exec_tst {
|
||||
@Before public void setup() {
|
||||
type = make_("gfml.point", "point", "x");
|
||||
} GfmlDefaultItem item; GfmlType type; GfmlDefaultItem_fxt fx_item = GfmlDefaultItem_fxt.new_();
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
tst_SubFldDefault(type, "x", null);
|
||||
|
||||
item = fx_item.make_("gfml.point", "x", "10");
|
||||
@ -31,7 +31,7 @@ public class z452_dflts_exec_tst {
|
||||
item.Exec_end(type);
|
||||
tst_SubFldDefault(type, "x", null);
|
||||
}
|
||||
@Test public void Overwrite() {
|
||||
@Test public void Overwrite() {
|
||||
ini_SubFldDefault_add(type, "x", "0");
|
||||
tst_SubFldDefault(type, "x", "0");
|
||||
|
||||
@ -42,7 +42,7 @@ public class z452_dflts_exec_tst {
|
||||
item.Exec_end(type);
|
||||
tst_SubFldDefault(type, "x", "0");
|
||||
}
|
||||
@Test public void CreateDefault() {
|
||||
@Test public void CreateDefault() {
|
||||
tst_SubFldExists(type, "y", false);
|
||||
|
||||
item = fx_item.make_("gfml.point", "y", "10");
|
||||
@ -53,7 +53,7 @@ public class z452_dflts_exec_tst {
|
||||
item.Exec_end(type);
|
||||
tst_SubFldExists(type, "y", false);
|
||||
}
|
||||
@Test public void DefaultTkn() {
|
||||
@Test public void DefaultTkn() {
|
||||
Object[] ary = ini_eval_("0");
|
||||
GfmlTkn varTkn = (GfmlTkn)ary[0];
|
||||
GfmlVarItm varItem = (GfmlVarItm)ary[1];
|
||||
|
@ -25,7 +25,7 @@ public class z455_dflts_scope_tst {
|
||||
GfmlType type = makr.MakeRootType("point", "point", "x", "y").DocPos_(rootPos);
|
||||
regy.Add(type);
|
||||
} GfmlDocPos rootPos, currPos; GfmlTypRegy regy;
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
currPos = rootPos.NewDown(0);
|
||||
tst_FetchOrNullByPos(regy, "point", rootPos, "point", "x", "y");
|
||||
tst_FetchOrNullByPos(regy, "point", currPos, "point", "x", "y");
|
||||
|
@ -19,6 +19,6 @@ package gplx.gfml; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class z602_edit_nde_tst {
|
||||
GfmlUpdateFx fx = GfmlUpdateFx.new_();
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import org.junit.*;
|
||||
import gplx.stores.*;
|
||||
public class z801_useCase_DataRdr_tst {
|
||||
String raw;
|
||||
@Test public void Subs_byName() {
|
||||
@Test public void Subs_byName() {
|
||||
raw = String_.Concat
|
||||
( "_type:{"
|
||||
, " item {"
|
||||
|
@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfml; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class z811_useCase_GfmlIoSql_tst {
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
tst_Doc("fld1=val1", nde_("fld").Atrs_add_("word", "fld1").Atrs_add_("op", "=").Atrs_add_("word", "val1"));
|
||||
tst_Doc("fld1 = val1", nde_("fld").Atrs_add_("word", "fld1").Atrs_add_("op", "=").Atrs_add_("word", "val1"));
|
||||
tst_Doc("fld1='val1'", nde_("fld").Atrs_add_("word", "fld1").Atrs_add_("op", "=").Atrs_add_("word", "val1"));
|
||||
tst_Doc("fld1='val 1'", nde_("fld").Atrs_add_("word", "fld1").Atrs_add_("op", "=").Atrs_add_("word", "val 1"));
|
||||
}
|
||||
@Test public void Basic2() {
|
||||
@Test public void Basic2() {
|
||||
tst_Doc("1=1 OR 2=2", nde_("fld").Atrs_add_("word", "1").Atrs_add_("op", "=").Atrs_add_("word", "1")
|
||||
.Atrs_add_("word", "OR")
|
||||
.Atrs_add_("word", "2").Atrs_add_("op", "=").Atrs_add_("word", "2")
|
||||
|
@ -59,11 +59,10 @@ public class Sqlite_engine_ {
|
||||
int len = idxs.length;
|
||||
p.Txn_mgr().Txn_end_all(); // commit any pending transactions
|
||||
for (int i = 0; i < len; i++) {
|
||||
p.Txn_mgr().Txn_bgn_if_none();
|
||||
String index = idxs[i].Xto_sql();
|
||||
usr_dlg.Prog_many("", "", "creating index: ~{0} ~{1}", file_id, index);
|
||||
usr_dlg.Plog_many("", "", "creating index: ~{0} ~{1}", file_id, index);
|
||||
p.Exec_qry(Db_qry_sql.ddl_(index));
|
||||
p.Txn_mgr().Txn_end_all();
|
||||
usr_dlg.Log_many("", "", "index created: ~{0} ~{1}", file_id, index);
|
||||
}
|
||||
}
|
||||
public static Db_provider Provider_load_or_fail_(Io_url url) {
|
||||
|
@ -25,6 +25,7 @@ import java.sql.*;
|
||||
public class SqliteDbMain {
|
||||
public static void main(String[] args) throws Exception {
|
||||
SqliteDbMain main = new SqliteDbMain();
|
||||
// main.JdbcInit(args);
|
||||
// main.Read();
|
||||
// main.Mass_upload(Io_url_.new_dir_("J:\\gplx\\xowl\\file\\all#meta\\en.wikipedia.org\\"));
|
||||
// main.CreateMany(20, 0);
|
||||
@ -38,6 +39,15 @@ public class SqliteDbMain {
|
||||
'5719' '174'
|
||||
'5766' '173'
|
||||
*/
|
||||
|
||||
// private void JdbcInit(String[] args) {
|
||||
// try {
|
||||
// Class.forName("SQLite.JDBCDriver");
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// ConsoleAdp._.WriteLine(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
private void CreateMany(int number, int base_val) {
|
||||
long time_bgn = Env_.TickCount();
|
||||
Db_provider provider = Sqlite_engine_.Provider_load_or_make_(Io_url_.new_fil_("E:\\test.sqlite3"));
|
||||
|
@ -24,16 +24,16 @@ public class IptCfg_tst {
|
||||
cfg = new IptCfg_mok();
|
||||
key = IptBndsOwner_mok.Invk_Reg;
|
||||
} IptBndsOwner_mok box; IptCfg_mok cfg; String key;
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
cfg.run_GetOrDflt(box, key, IptKey_.A);
|
||||
box.tst_SendKey(IptKey_.A, 1);
|
||||
}
|
||||
@Test public void Del() {
|
||||
@Test public void Del() {
|
||||
cfg.run_GetOrDflt(box, key, IptKey_.A);
|
||||
box.IptBnds().Cfgs_delAll();
|
||||
box.tst_SendKey(IptKey_.A, 0);
|
||||
}
|
||||
@Test public void Change() {
|
||||
@Test public void Change() {
|
||||
cfg.run_GetOrDflt(box, key, IptKey_.A);
|
||||
cfg.run_Set(key, IptKey_.B);
|
||||
box.tst_SendKey(IptKey_.B, 1);
|
||||
@ -42,19 +42,19 @@ public class IptCfg_tst {
|
||||
box.tst_SendKey(IptKey_.C, 1);
|
||||
box.tst_SendKey(IptKey_.B, 0);
|
||||
}
|
||||
@Test public void SetBeforeInit() {
|
||||
@Test public void SetBeforeInit() {
|
||||
cfg.run_Set(key, IptKey_.B);
|
||||
cfg.run_GetOrDflt(box, key, IptKey_.A);
|
||||
box.tst_SendKey(IptKey_.B, 1);
|
||||
box.tst_SendKey(IptKey_.A, 0);
|
||||
}
|
||||
@Test public void SetBeforeInit_msg() {
|
||||
@Test public void SetBeforeInit_msg() {
|
||||
cfg.run_Set_msg(key, 2, IptKey_.B);
|
||||
cfg.run_GetOrDflt(box, key, IptKey_.A); // iptBnd exists; ignore Key_.A (and also msg=1)
|
||||
box.tst_SendKey(IptKey_.B, 2);
|
||||
box.tst_SendKey(IptKey_.A, 0);
|
||||
}
|
||||
@Test public void Chained() {
|
||||
@Test public void Chained() {
|
||||
cfg.run_GetOrDflt(box, key, IptKeyChain.parse_("key.ctrl+key.a,key.b"));
|
||||
cfg.run_Set(key, IptKey_.A);
|
||||
box.tst_SendKey(IptKey_.A, 1);
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class ClipboardAdp__tst {
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
ClipboardAdp_.SetText("test");
|
||||
Tfds.Eq(true, ClipboardAdp_.IsText());
|
||||
Tfds.Eq("test", ClipboardAdp_.GetText());
|
||||
|
@ -21,20 +21,20 @@ public class GfuiBorderMgr_tst {
|
||||
@Before public void setup() {
|
||||
borderMgr = GfuiBorderMgr.new_();
|
||||
}
|
||||
@Test public void NullToEdge() { // all null -> one edge
|
||||
@Test public void NullToEdge() { // all null -> one edge
|
||||
tst_Eq(borderMgr, null, null, null, null, null);
|
||||
|
||||
borderMgr.Top_(red);
|
||||
tst_Eq(borderMgr, null, red, null, null, null);
|
||||
}
|
||||
@Test public void EdgeToAll() { // one edge -> all edge
|
||||
@Test public void EdgeToAll() { // one edge -> all edge
|
||||
borderMgr.Top_(red);
|
||||
tst_Eq(borderMgr, null, red, null, null, null);
|
||||
|
||||
borderMgr.All_(black);
|
||||
tst_Eq(borderMgr, black, null, null, null, null);
|
||||
}
|
||||
@Test public void AllToEdge() { // all edge -> one new; three old
|
||||
@Test public void AllToEdge() { // all edge -> one new; three old
|
||||
borderMgr.All_(red);
|
||||
tst_Eq(borderMgr, red, null, null, null, null);
|
||||
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class GfuiClickKeyMgr_tst {
|
||||
@Test public void ExtractKeyFromText() {
|
||||
@Test public void ExtractKeyFromText() {
|
||||
tst_ExtractKey("&click", IptKey_.C);
|
||||
tst_ExtractKey("&", IptKey_.None);
|
||||
tst_ExtractKey("trailing &", IptKey_.None);
|
||||
|
@ -22,28 +22,28 @@ public class GfuiFocusOrderer_tst {
|
||||
owner = GfuiElem_.new_();
|
||||
list = ListAdp_.new_(); // list of all controls
|
||||
}
|
||||
@Test public void Horizontal() {
|
||||
@Test public void Horizontal() {
|
||||
ini_Subs(owner, list, xy_(40, 0), xy_(20, 0), xy_(0, 0));
|
||||
tst_FocusIndxs(owner, list, 0, 1, 2);
|
||||
|
||||
GfuiFocusOrderer.OrderByX(owner);
|
||||
tst_FocusIndxs(owner, list, 2, 1, 0);
|
||||
}
|
||||
@Test public void Vertical() {
|
||||
@Test public void Vertical() {
|
||||
ini_Subs(owner, list, xy_(0, 40), xy_(0, 20), xy_(0, 0));
|
||||
tst_FocusIndxs(owner, list, 0, 1, 2);
|
||||
|
||||
GfuiFocusOrderer.OrderByY(owner);
|
||||
tst_FocusIndxs(owner, list, 2, 1, 0);
|
||||
}
|
||||
@Test public void Grid() {
|
||||
@Test public void Grid() {
|
||||
ini_Subs(owner, list, xy_(20, 20), xy_(0, 20), xy_(20, 0), xy_(0, 0));
|
||||
tst_FocusIndxs(owner, list, 0, 1, 2, 3);
|
||||
|
||||
GfuiFocusOrderer.OrderByX(owner);
|
||||
tst_FocusIndxs(owner, list, 3, 2, 1, 0);
|
||||
}
|
||||
@Test public void Deep() {
|
||||
@Test public void Deep() {
|
||||
ini_Subs(owner, list, xy_(20, 0), xy_(0, 0));
|
||||
GfuiElem sub0 = sub_(owner, 0), sub1 = sub_(owner, 1);
|
||||
ini_Subs(sub0, list, xy_(20, 0), xy_(0, 0));
|
||||
@ -53,7 +53,7 @@ public class GfuiFocusOrderer_tst {
|
||||
GfuiFocusOrderer.OrderByX(owner);
|
||||
tst_FocusIndxs(owner, list, 3, 0, 5, 4, 2, 1);
|
||||
}
|
||||
@Test public void Manusl() {
|
||||
@Test public void Manusl() {
|
||||
ini_Subs(owner, list, xy_(0, 0), xy_(20, 0));
|
||||
tst_FocusIndxs(owner, list, 0, 1);
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class GfuiMoveElemBtn_tst {
|
||||
GfuiMoveElemBnd bnd = GfuiMoveElemBnd.new_(); bnd.TargetElem_set(form);
|
||||
moveBtn.IptBnds().Add(bnd);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
@Test public void Basic() {
|
||||
Tfds.Eq(form.X(), 0);
|
||||
IptEventMgr.ExecKeyDown(moveBtn, IptEvtDataKey.test_(MoveRightArg()));
|
||||
Tfds.Eq(form.X(), 10);
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class IptArg_parser_tst {
|
||||
@Test public void KeyBasic() {
|
||||
@Test public void KeyBasic() {
|
||||
tst_parse_Key_("key.a", IptKey_.A);
|
||||
tst_parse_Key_("key.d0", IptKey_.D0);
|
||||
tst_parse_Key_("key.semicolon", IptKey_.Semicolon);
|
||||
@ -27,34 +27,34 @@ public class IptArg_parser_tst {
|
||||
tst_parse_Key_("key.ctrl", IptKey_.Ctrl);
|
||||
tst_parse_Key_("key.none", IptKey_.None);
|
||||
} void tst_parse_Key_(String raw, IptKey expd) {Tfds.Eq(expd.Val(), IptKey_.parse_(raw).Val());}
|
||||
@Test public void KbdCmdModifiers() {
|
||||
@Test public void KbdCmdModifiers() {
|
||||
tst_parse_Key_("key.ctrl+key.enter", IptKey_.Ctrl.Add(IptKey_.Enter));
|
||||
tst_parse_Key_("key.alt+key.escape", IptKey_.Alt.Add(IptKey_.Escape));
|
||||
tst_parse_Key_("key.shift+key.f1", IptKey_.Shift.Add(IptKey_.F1));
|
||||
tst_parse_Key_("key.shift+key.ctrl", IptKey_.Ctrl.Add(IptKey_.Shift));
|
||||
tst_parse_Key_("key.ctrl+key.alt+key.slash", IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.Slash));
|
||||
}
|
||||
@Test public void KeyWhitespace() {
|
||||
@Test public void KeyWhitespace() {
|
||||
tst_parse_Key_("key.ctrl + key.alt + key.slash", IptKey_.Ctrl.Add(IptKey_.Alt).Add(IptKey_.Slash));
|
||||
}
|
||||
@Test public void MouseBtn() {
|
||||
@Test public void MouseBtn() {
|
||||
tst_parse_MouseBtn_("mouse.left", IptMouseBtn_.Left);
|
||||
tst_parse_MouseBtn_("mouse.right", IptMouseBtn_.Right);
|
||||
tst_parse_MouseBtn_("mouse.middle", IptMouseBtn_.Middle);
|
||||
tst_parse_MouseBtn_("mouse.x1", IptMouseBtn_.X1);
|
||||
tst_parse_MouseBtn_("mouse.x2", IptMouseBtn_.X2);
|
||||
} void tst_parse_MouseBtn_(String raw, IptMouseBtn expd) {Tfds.Eq(expd, IptMouseBtn_.parse_(raw));}
|
||||
@Test public void MouseWheel() {
|
||||
@Test public void MouseWheel() {
|
||||
tst_parse_MouseWheel_("wheel.up", IptMouseWheel_.Up);
|
||||
tst_parse_MouseWheel_("wheel.down", IptMouseWheel_.Down);
|
||||
} void tst_parse_MouseWheel_(String raw, IptMouseWheel expd) {Tfds.Eq(expd, IptMouseWheel_.parse_(raw));}
|
||||
@Test public void Mod() {
|
||||
@Test public void Mod() {
|
||||
tst_parse_("mod.c", IptKey_.Ctrl);
|
||||
tst_parse_("mod.cs", IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift));
|
||||
tst_parse_("mod.cas", IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.Shift));
|
||||
tst_parse_("mod.c+key.c", IptKey_.add_(IptKey_.Ctrl, IptKey_.C));
|
||||
}
|
||||
@Test public void All() {
|
||||
@Test public void All() {
|
||||
tst_parse_("key.c", IptKey_.C);
|
||||
tst_parse_("mouse.left", IptMouseBtn_.Left);
|
||||
tst_parse_("wheel.up", IptMouseWheel_.Up);
|
||||
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class IptEventType_tst {
|
||||
@Test public void Has() {
|
||||
@Test public void Has() {
|
||||
tst_Has(IptEventType_.KeyDown, IptEventType_.KeyDown, true);
|
||||
tst_Has(IptEventType_.KeyUp, IptEventType_.KeyDown, false);
|
||||
tst_Has(IptEventType_.None, IptEventType_.KeyDown, false);
|
||||
@ -27,7 +27,7 @@ public class IptEventType_tst {
|
||||
tst_Has(IptEventType_.MouseDown.Add(IptEventType_.MouseUp), IptEventType_.KeyDown, false);
|
||||
tst_Has(IptEventType_.KeyDown.Add(IptEventType_.KeyUp), IptEventType_.None, false);
|
||||
} void tst_Has(IptEventType val, IptEventType find, boolean expd) {Tfds.Eq(expd, IptEventType_.Has(val, find));}
|
||||
@Test public void add_() {
|
||||
@Test public void add_() {
|
||||
tst_add(IptEventType_.KeyDown, IptEventType_.KeyDown, IptEventType_.KeyDown.Val());
|
||||
tst_add(IptEventType_.KeyDown, IptEventType_.KeyUp, IptEventType_.KeyDown.Val() + IptEventType_.KeyUp.Val());
|
||||
} void tst_add(IptEventType lhs, IptEventType rhs, int expd) {Tfds.Eq(expd, IptEventType_.add_(lhs, rhs).Val());}
|
||||
|
@ -18,11 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
public class ScreenAdp_tst {
|
||||
@Test public void parse_() {
|
||||
@Test public void parse_() {
|
||||
ScreenAdp actl = ScreenAdp_.parse_("{screen{0}");
|
||||
Tfds.Eq(0, actl.Index());
|
||||
}
|
||||
@Test public void opposite_() {
|
||||
@Test public void opposite_() {
|
||||
ScreenAdp actl = ScreenAdp_.from_point_(PointAdp_.new_(2000, 2000));
|
||||
Tfds.Eq(0, actl.Index());
|
||||
}
|
||||
|
@ -21,11 +21,11 @@ public class TabBox_tst {
|
||||
// @Before public void setup() {
|
||||
// fx = TabBoxFxt.new_();
|
||||
// } TabBoxFxt fx;
|
||||
@Test public void Add() {
|
||||
@Test public void Add() {
|
||||
// fx.Make(1).tst_Selected("0").FetchBtnAt(0).tst_X(0);
|
||||
// fx.Make(3).tst_Selected("2").FetchBtnAt(2).tst_X(160);
|
||||
}
|
||||
// @Test public void DelAt() {
|
||||
// @Test public void DelAt() {
|
||||
// fx.Make(2).DelAt(1).tst_Btns("0");
|
||||
// fx.Make(2).DelAt(0).tst_Btns("1");
|
||||
// fx.Make(3).DelAt(0).tst_Btns("1", "2");
|
||||
@ -36,17 +36,17 @@ public class TabBox_tst {
|
||||
// fx.Make(3).Select(1).DelAt(0).tst_Selected("1"); // 0 deleted; 1 still remains active (but will have idx of 0
|
||||
// fx.Make(3).Select(2).DelAt(2).tst_Selected("1"); // 2 deleted; 1 selected
|
||||
// }
|
||||
// @Test public void Selected_byAdd() {
|
||||
// @Test public void Selected_byAdd() {
|
||||
// fx.Make(2).Select(0).tst_Selected("0").Select(1).tst_Selected("1");
|
||||
// }
|
||||
// @Test public void Selected_byBtn() {
|
||||
// @Test public void Selected_byBtn() {
|
||||
// fx.Make(2).tst_Selected("1");
|
||||
//
|
||||
// GfuiBtn btn = fx.TabBox().SubBtnArea().FetchAt(0);
|
||||
// btn.Click();
|
||||
// fx.tst_Selected("0");
|
||||
// }
|
||||
// @Test public void ReorderTab() {
|
||||
// @Test public void ReorderTab() {
|
||||
// fx.Make(3).Reorder(0, -1).tst_Raised(false);
|
||||
// fx.Make(3).Reorder(2, 1).tst_Raised(false);
|
||||
// fx.Make(3).Reorder(0, 1).tst_Btns("1", "0", "2").tst_Raised(true).tst_FocusOrder();
|
||||
|
@ -24,10 +24,12 @@ public abstract class Dsv_wkr_base implements GfoInvkAble {
|
||||
public void Load_by_bry(byte[] src) {
|
||||
Dsv_tbl_parser tbl_parser = new Dsv_tbl_parser(); // NOTE: this proc should only be called once, so don't bother caching tbl_parser
|
||||
tbl_parser.Init(this, this.Fld_parsers());
|
||||
Load_by_bry_bgn();
|
||||
tbl_parser.Parse(src);
|
||||
tbl_parser.Rls();
|
||||
Load_by_bry_end();
|
||||
}
|
||||
@gplx.Virtual public void Load_by_bry_bgn() {}
|
||||
@gplx.Virtual public void Load_by_bry_end() {}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_load_by_str)) Load_by_bry(m.ReadBry("v"));
|
||||
|
@ -23,7 +23,7 @@ public class Xoa_app_ {
|
||||
boot_mgr.Run(args);
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final String Version = "1.7.4.1";
|
||||
public static final String Version = "1.8.1.1";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Op_sys;
|
||||
public static String User_agent = "";
|
||||
@ -35,7 +35,7 @@ public class Xoa_app_ {
|
||||
rv.Log_wtr().Queue_enabled_(true);
|
||||
return rv;
|
||||
}
|
||||
public static final byte Mode_console = 0, Mode_gui = 1;
|
||||
public static final byte Mode_console = 0, Mode_gui = 1, Mode_http = 2;
|
||||
}
|
||||
class Xoa_app_boot_mgr {
|
||||
private Gfo_usr_dlg usr_dlg; private Gfo_log_wtr log_wtr; private String chkpoint = "null";
|
||||
@ -144,6 +144,7 @@ class Xoa_app_boot_mgr {
|
||||
app.Gui_wtr().Log_wtr_(app.Log_wtr()); // NOTE: log_wtr must be set for cmd-line (else process will fail);
|
||||
|
||||
// run gfs
|
||||
gplx.xowa.users.prefs.Prefs_rename_mgr._.Check(app.User().Fsys_mgr().App_data_cfg_user_fil());
|
||||
try {app.Gfs_mgr().Run_url(cmd_file); chkpoint = "run_url";}
|
||||
catch (Exception e) {
|
||||
usr_dlg.Warn_many("", "", "script file failed: ~{0} ~{1} ~{2}", chkpoint, cmd_file.Raw(), Err_.Message_gplx(e));
|
||||
@ -155,8 +156,10 @@ class Xoa_app_boot_mgr {
|
||||
app.Launch(); chkpoint = "launch";
|
||||
if (String_.Eq(app_mode, "server"))
|
||||
app.Tcp_server().Run();
|
||||
else if (String_.Eq(app_mode, "http_server"))
|
||||
else if (String_.Eq(app_mode, "http_server")) {
|
||||
app.Mode_(Xoa_app_.Mode_http);
|
||||
app.Http_server().Run();
|
||||
}
|
||||
else {
|
||||
if (cmd_text != null)
|
||||
ConsoleAdp._.WriteLine_utf8(Object_.Xto_str_strict_or_empty(app.Gfs_mgr().Run_str(cmd_text)));
|
||||
|
@ -25,11 +25,13 @@ public class Xoapi_html implements GfoInvkAble {
|
||||
public Xoapi_tidy Tidy() {return tidy;} private Xoapi_tidy tidy = new Xoapi_tidy();
|
||||
public Xoapi_modules Modules() {return modules;} private Xoapi_modules modules = new Xoapi_modules();
|
||||
public Xoapi_skins Skins() {return skins;} private Xoapi_skins skins = new Xoapi_skins();
|
||||
public Xoapi_page Page() {return page;} private Xoapi_page page = new Xoapi_page();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_tidy)) return tidy;
|
||||
else if (ctx.Match(k, Invk_modules)) return modules;
|
||||
else if (ctx.Match(k, Invk_skins)) return skins;
|
||||
else if (ctx.Match(k, Invk_page)) return page;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_tidy = "tidy", Invk_modules = "modules", Invk_skins = "skins";
|
||||
private static final String Invk_tidy = "tidy", Invk_modules = "modules", Invk_skins = "skins", Invk_page = "page";
|
||||
}
|
||||
|
27
400_xowa/src/gplx/xowa/apis/xowa/html/Xoapi_page.java
Normal file
27
400_xowa/src/gplx/xowa/apis/xowa/html/Xoapi_page.java
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.core.btries.*;
|
||||
public class Xoapi_page implements GfoInvkAble {
|
||||
public Xoapi_toggle_mgr Toggle_mgr() {return toggle_mgr;} private Xoapi_toggle_mgr toggle_mgr = new Xoapi_toggle_mgr();
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_toggles)) return toggle_mgr;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_toggles = "toggles";
|
||||
}
|
50
400_xowa/src/gplx/xowa/apis/xowa/html/Xoapi_toggle_itm.java
Normal file
50
400_xowa/src/gplx/xowa/apis/xowa/html/Xoapi_toggle_itm.java
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
public class Xoapi_toggle_itm implements GfoInvkAble {
|
||||
public Xoapi_toggle_itm(byte[] key_bry) {this.key_bry = key_bry;}
|
||||
public byte[] Key_bry() {return key_bry;} private byte[] key_bry;
|
||||
public byte[] Icon_src() {return icon_src;} private byte[] icon_src;
|
||||
public byte[] Icon_title() {return icon_title;} private byte[] icon_title;
|
||||
public byte[] Elem_display() {return elem_display;} private byte[] elem_display;
|
||||
public boolean Visible() {return visible;} private boolean visible;
|
||||
public Xoapi_toggle_itm Init(Xow_wiki wiki) {
|
||||
if (Img_src_y == null) {
|
||||
Io_url img_dir = wiki.App().User().Fsys_mgr().App_img_dir().GenSubDir_nest("window", "portal");
|
||||
Img_src_y = img_dir.GenSubFil("twisty_down.png").To_http_file_bry();
|
||||
Img_src_n = img_dir.GenSubFil("twisty_right.png").To_http_file_bry();
|
||||
}
|
||||
icon_src = visible ? Img_src_y : Img_src_n;
|
||||
byte[] img_title_msg = visible ? Img_title_msg_y : Img_title_msg_n;
|
||||
icon_title = wiki.Msg_mgr().Val_by_key_obj(img_title_msg);
|
||||
elem_display = visible ? Img_display_y : Img_display_n;
|
||||
return this;
|
||||
}
|
||||
private static byte[] Img_src_y, Img_src_n;
|
||||
private static final byte[]
|
||||
Img_title_msg_y = Bry_.new_ascii_("hide"), Img_title_msg_n = Bry_.new_ascii_("show")
|
||||
, Img_display_y = Bry_.new_ascii_("display:;"), Img_display_n = Bry_.new_ascii_("display:none;")
|
||||
;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_visible)) return Yn.Xto_str(visible);
|
||||
else if (ctx.Match(k, Invk_visible_)) visible = m.ReadYn("v");
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_visible = "visible", Invk_visible_ = "visible_";
|
||||
}
|
51
400_xowa/src/gplx/xowa/apis/xowa/html/Xoapi_toggle_mgr.java
Normal file
51
400_xowa/src/gplx/xowa/apis/xowa/html/Xoapi_toggle_mgr.java
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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.apis.xowa.html; import gplx.*; import gplx.xowa.*; import gplx.xowa.apis.*; import gplx.xowa.apis.xowa.*;
|
||||
import gplx.xowa.cfgs.*;
|
||||
public class Xoapi_toggle_mgr implements GfoInvkAble {
|
||||
private Hash_adp_bry itms = Hash_adp_bry.cs_();
|
||||
public Xoapi_toggle_mgr() {
|
||||
itm_wikidata_langs = itms_add(itms, Key_wikidata_langs);
|
||||
itm_offline_wikis = itms_add(itms, Key_offline_wikis);
|
||||
}
|
||||
public Xoapi_toggle_itm Itm_wikidata_langs() {return itm_wikidata_langs;} private Xoapi_toggle_itm itm_wikidata_langs;
|
||||
public Xoapi_toggle_itm Itm_offline_wikis() {return itm_offline_wikis;} private Xoapi_toggle_itm itm_offline_wikis;
|
||||
public Xoapi_toggle_itm Get(byte[] key) {return (Xoapi_toggle_itm)itms.Get_by_bry(key);}
|
||||
public void Save(Xoa_cfg_mgr cfg_mgr) {
|
||||
Save_itm(cfg_mgr, itm_wikidata_langs, itm_offline_wikis);
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_get)) return this.Get(m.ReadBry("key"));
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
}
|
||||
private static final String Invk_get = "get";
|
||||
private static final String Key_wikidata_langs = "wikidata-langs", Key_offline_wikis = "offline-wikis";
|
||||
private static Xoapi_toggle_itm itms_add(Hash_adp_bry itms, String name_str) {
|
||||
byte[] name_bry = Bry_.new_utf8_(name_str);
|
||||
Xoapi_toggle_itm rv = new Xoapi_toggle_itm(name_bry);
|
||||
itms.Add(name_bry, rv);
|
||||
return rv;
|
||||
}
|
||||
private static void Save_itm(Xoa_cfg_mgr cfg_mgr, Xoapi_toggle_itm... itms) {
|
||||
int itms_len = itms.length;
|
||||
for (int i = 0; i < itms_len; ++i) {
|
||||
Xoapi_toggle_itm itm = itms[i];
|
||||
cfg_mgr.Set_by_app("xowa.api.html.page.toggles.get('" + String_.new_utf8_(itm.Key_bry()) + "').visible", Yn.Xto_str(itm.Visible()));
|
||||
}
|
||||
}
|
||||
}
|
@ -58,6 +58,7 @@ public class Xob_cmd_mgr implements GfoInvkAble {
|
||||
else if (String_.Eq(cmd_key, Xof_wiki_orig_cmd.KEY_oimg)) return Add(new Xof_wiki_orig_cmd(bldr, wiki));
|
||||
else if (String_.Eq(cmd_key, Xob_download_wkr.KEY_oimg)) return Add(new Xob_download_wkr(bldr, wiki));
|
||||
else if (String_.Eq(cmd_key, Xob_page_regy_cmd.KEY_oimg)) return Add(new Xob_page_regy_cmd(bldr, wiki));
|
||||
else if (String_.Eq(cmd_key, Xob_cmd_exec_sql.KEY)) return Add(new Xob_cmd_exec_sql(bldr, wiki));
|
||||
|
||||
else if (String_.Eq(cmd_key, Xob_wiki_redirect_cmd.KEY_redirect)) return Add(new Xob_wiki_redirect_cmd(bldr, wiki));
|
||||
else if (String_.Eq(cmd_key, Xob_wiki_image_sql.KEY)) return Add(new Xob_wiki_image_sql(bldr, wiki));
|
||||
|
38
400_xowa/src/gplx/xowa/bldrs/imports/Db_idx_mode.java
Normal file
38
400_xowa/src/gplx/xowa/bldrs/imports/Db_idx_mode.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
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.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
public class Db_idx_mode {
|
||||
private int tid;
|
||||
Db_idx_mode(int tid) {this.tid = tid;}
|
||||
public boolean Tid_is_bgn() {return tid == Tid_bgn;}
|
||||
public boolean Tid_is_end() {return tid == Tid_end;}
|
||||
public boolean Tid_is_skip() {return tid == Tid_skip;}
|
||||
private static final int Tid_skip = 0, Tid_bgn = 1, Tid_end = 2;
|
||||
private static final String Key_skip = "skip", Key_bgn = "bgn", Key_end = "end";
|
||||
public static final Db_idx_mode
|
||||
Itm_skip = new Db_idx_mode(Tid_skip)
|
||||
, Itm_bgn = new Db_idx_mode(Tid_bgn)
|
||||
, Itm_end = new Db_idx_mode(Tid_end)
|
||||
;
|
||||
public static Db_idx_mode Xto_itm(String key) {
|
||||
if (String_.Eq(key, Key_skip)) return Itm_skip;
|
||||
else if (String_.Eq(key, Key_bgn)) return Itm_bgn;
|
||||
else if (String_.Eq(key, Key_end)) return Itm_end;
|
||||
else throw Err_.unhandled(key);
|
||||
}
|
||||
}
|
43
400_xowa/src/gplx/xowa/bldrs/imports/Xob_cmd_exec_sql.java
Normal file
43
400_xowa/src/gplx/xowa/bldrs/imports/Xob_cmd_exec_sql.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
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.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.xowa.dbs.*;
|
||||
public class Xob_cmd_exec_sql implements Xob_cmd {
|
||||
private Xow_wiki wiki; private int file_idx = -1; private String sql;
|
||||
public Xob_cmd_exec_sql(Xob_bldr bldr, Xow_wiki wiki) {this.wiki = wiki;}
|
||||
public String Cmd_key() {return KEY;} public static final String KEY = "import.sql.exec_sql";
|
||||
public void Cmd_ini(Xob_bldr bldr) {}
|
||||
public void Cmd_bgn(Xob_bldr bldr) {
|
||||
Xoa_app app = wiki.App();
|
||||
wiki.Init_assert(); // force load; needed to pick up MediaWiki ns for MediaWiki:mainpage
|
||||
Xodb_mgr_sql db_mgr = wiki.Db_mgr_as_sql();
|
||||
Xodb_fsys_mgr fsys_mgr = db_mgr.Fsys_mgr();
|
||||
Xodb_file file = fsys_mgr.Get_by_db_idx(file_idx);
|
||||
app.Usr_dlg().Plog_many("", "", "exec_sql: running sql; file_idx=~{0} sql=~{1}", file_idx, sql);
|
||||
file.Provider().Exec_sql(sql);
|
||||
}
|
||||
public void Cmd_run() {}
|
||||
public void Cmd_end() {}
|
||||
public void Cmd_print() {}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_file_idx_)) file_idx = m.ReadInt("v");
|
||||
else if (ctx.Match(k, Invk_sql_)) sql = m.ReadStr("v");
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_file_idx_ = "file_idx_", Invk_sql_ = "sql_";
|
||||
}
|
@ -35,7 +35,7 @@ public abstract class Xob_init_base implements Xob_cmd, GfoInvkAble {
|
||||
this.Cmd_run_end(wiki); // save site info
|
||||
}
|
||||
public void Cmd_end() {
|
||||
wiki.App().Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_refresh(); // dirty wiki list so that next refresh will load itm
|
||||
wiki.App().Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_reset(); // dirty wiki list so that next refresh will load itm
|
||||
if (wiki.App().Setup_mgr().Dump_mgr().Css_wiki_update()) {
|
||||
Io_url url = wiki.App().User().Fsys_mgr().Wiki_html_dir(wiki.Domain_str()).GenSubFil(Xoa_css_extractor.Css_wiki_name);
|
||||
usr_dlg.Log_many("", "", "deleting css: ~{0}", url.Raw());
|
||||
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import gplx.dbs.*; import gplx.xowa.dbs.*; import gplx.xowa.dbs.tbls.*; import gplx.ios.*;
|
||||
public class Xob_page_sql extends Xob_itm_basic_base implements Xobd_wkr, GfoInvkAble {
|
||||
private Db_idx_mode idx_mode = Db_idx_mode.Itm_end;
|
||||
private Xop_redirect_mgr redirect_mgr; private Io_stream_zip_mgr zip_mgr; private byte data_storage_format;
|
||||
private Xodb_mgr_sql db_mgr; private Xodb_fsys_mgr fsys_mgr; private Db_provider page_provider; private Db_stmt page_stmt; private Xob_text_stmts_mgr text_stmts_mgr;
|
||||
private int page_count_all, page_count_main = 0; private int txn_commit_interval = 100000; // 100 k
|
||||
@ -40,6 +41,7 @@ public class Xob_page_sql extends Xob_itm_basic_base implements Xobd_wkr, GfoInv
|
||||
page_stmt = db_mgr.Tbl_page().Insert_stmt(page_provider);
|
||||
page_provider.Txn_mgr().Txn_bgn_if_none();
|
||||
text_stmts_mgr = new Xob_text_stmts_mgr(db_mgr, fsys_mgr);
|
||||
if (idx_mode.Tid_is_bgn()) Idx_create();
|
||||
}
|
||||
public void Wkr_run(Xodb_page page) {
|
||||
int page_id = page.Id();
|
||||
@ -69,25 +71,33 @@ public class Xob_page_sql extends Xob_itm_basic_base implements Xobd_wkr, GfoInv
|
||||
if (page_count_all % txn_commit_interval == 0) text_stmt.Provider().Txn_mgr().Txn_end_all_bgn_if_none();
|
||||
}
|
||||
public void Wkr_end() {
|
||||
usr_dlg.Log_many("", "", "import.page: insert done; committing pages; pages=~{0}", page_count_all);
|
||||
page_provider.Txn_mgr().Txn_end_all();
|
||||
page_stmt.Rls();
|
||||
text_stmts_mgr.Rls();
|
||||
usr_dlg.Log_many("", "", "import.page: updating core stats");
|
||||
Xow_ns_mgr ns_mgr = wiki.Ns_mgr();
|
||||
db_mgr.Tbl_site_stats().Update(page_count_main, page_count_all, ns_mgr.Ns_file().Count()); // save page stats
|
||||
db_mgr.Tbl_xowa_ns().Insert(ns_mgr); // save ns
|
||||
db_mgr.Tbl_xowa_db().Commit_all(page_provider, db_mgr.Fsys_mgr().Ary()); // save dbs; note that dbs can be saved again later
|
||||
db_mgr.Tbl_xowa_cfg().Insert_str(Xodb_mgr_sql.Grp_wiki_init, "props.modified_latest", modified_latest.XtoStr_fmt(DateAdp_.Fmt_iso8561_date_time));
|
||||
fsys_mgr.Index_create(usr_dlg, Byte_.Ary(Xodb_file_tid_.Tid_core, Xodb_file_tid_.Tid_text), Index_page_title, Index_page_random);
|
||||
if (idx_mode.Tid_is_end()) Idx_create();
|
||||
}
|
||||
private void Idx_create() {
|
||||
fsys_mgr.Index_create(usr_dlg, Byte_.Ary(Xodb_file_tid_.Tid_core, Xodb_file_tid_.Tid_text), Idx_page_title, Idx_page_random);
|
||||
}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_txn_commit_interval_)) txn_commit_interval = m.ReadInt("v");
|
||||
return super.Invk(ctx, ikey, k, m);
|
||||
} private static final String Invk_txn_commit_interval_ = "txn_commit_interval_";
|
||||
else if (ctx.Match(k, Invk_idx_mode_)) idx_mode = Db_idx_mode.Xto_itm(m.ReadStr("v"));
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_txn_commit_interval_ = "txn_commit_interval_", Invk_idx_mode_ = "idx_mode_";
|
||||
public void Wkr_ini(Xob_bldr bldr) {}
|
||||
public void Wkr_print() {}
|
||||
private static final Db_idx_itm
|
||||
Index_page_title = Db_idx_itm.sql_("CREATE UNIQUE INDEX IF NOT EXISTS page__title ON page (page_namespace, page_title, page_id, page_len, page_is_redirect);") // PERF:page_id for general queries; PERF: page_len for search_suggest; PREF:page_is_redirect for oimg
|
||||
, Index_page_random = Db_idx_itm.sql_("CREATE UNIQUE INDEX IF NOT EXISTS page__name_random ON page (page_namespace, page_random_int);")
|
||||
Idx_page_title = Db_idx_itm.sql_("CREATE UNIQUE INDEX IF NOT EXISTS page__title ON page (page_namespace, page_title, page_id, page_len, page_is_redirect);") // PERF:page_id for general queries; PERF: page_len for search_suggest; PREF:page_is_redirect for oimg
|
||||
, Idx_page_random = Db_idx_itm.sql_("CREATE INDEX IF NOT EXISTS page__name_random ON page (page_namespace, page_random_int);")
|
||||
;
|
||||
}
|
||||
class Xob_text_stmts_mgr {
|
||||
|
@ -18,9 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.imports; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*;
|
||||
import org.junit.*; import gplx.dbs.*; import gplx.xowa.specials.search.*; import gplx.xowa.bldrs.imports.ctgs.*;
|
||||
public class Xob_page_sql_tst {
|
||||
@Before public void init() {fxt.Ctor_fsys();} Db_mgr_fxt fxt = new Db_mgr_fxt();
|
||||
@After public void term() {fxt.Rls();}
|
||||
@Before public void init() {if (Xoa_test_.Db_skip()) return; fxt.Ctor_fsys();} Db_mgr_fxt fxt = new Db_mgr_fxt();
|
||||
@After public void term() {if (Xoa_test_.Db_skip()) return; fxt.Rls();}
|
||||
@Test public void Basic() {
|
||||
if (Xoa_test_.Db_skip()) return;
|
||||
fxt.Init_db_sqlite();
|
||||
fxt.doc_ary_
|
||||
( fxt.doc_(2, "2013-06-03 01:23", "A", "text_a")
|
||||
|
@ -26,7 +26,7 @@ public abstract class Xob_term_base implements Xob_cmd, GfoInvkAble {
|
||||
public void Cmd_run() {}
|
||||
public void Cmd_end() {
|
||||
Xoa_app app = wiki.App();
|
||||
app.Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_refresh(); // NOTE: dirty wiki list so that next refresh will load itm
|
||||
app.Gui_mgr().Html_mgr().Portal_mgr().Wikis().Itms_reset(); // NOTE: dirty wiki list so that next refresh will load itm
|
||||
app.Free_mem(false); // clear cache, else import will load new page with old items from cache; DATE:2013-11-21
|
||||
wiki.Init_needed_(true);// flag init_needed prior to show; dir_info will show page_txt instead of page_gz;
|
||||
wiki.Init_assert(); // force load; needed to pick up MediaWiki ns for MediaWiki:mainpage
|
||||
|
@ -18,8 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.imports.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.imports.*;
|
||||
import org.junit.*;
|
||||
public class Xob_category_registry_sql_tst {
|
||||
@Before public void init() {fxt.Clear();} private Xob_category_registry_sql_fxt fxt = new Xob_category_registry_sql_fxt();
|
||||
@Before public void init() {if (Xoa_test_.Db_skip()) return; fxt.Clear();} private Xob_category_registry_sql_fxt fxt = new Xob_category_registry_sql_fxt();
|
||||
@Test public void Basic() {
|
||||
if (Xoa_test_.Db_skip()) return;
|
||||
fxt.Init_page_insert(String_.Ary("Ctg3", "Ctg2", "Ctg1"));
|
||||
fxt.Exec_category_registry_cmd();
|
||||
fxt.Test_ids(Int_.Ary(3, 2, 1)); // note that Ctg1 is page_id 3
|
||||
|
@ -18,9 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.imports.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.imports.*;
|
||||
import gplx.ios.*;
|
||||
public class Xob_categorylinks_sql extends Xob_categorylinks_base {
|
||||
private Db_idx_mode idx_mode = Db_idx_mode.Itm_end;
|
||||
public Xob_categorylinks_sql(Xob_bldr bldr, Xow_wiki wiki) {this.Cmd_ctor(bldr, wiki); this.make_fil_len = Io_mgr.Len_mb;}
|
||||
@Override public String Cmd_key() {return KEY;} public static final String KEY = "import.sql.categorylinks";
|
||||
@Override public Io_sort_cmd Make_sort_cmd(Sql_file_parser sql_parser) {return new Xob_categorylinks_sql_make(sql_parser, wiki);}
|
||||
@Override public Io_sort_cmd Make_sort_cmd(Sql_file_parser sql_parser) {return new Xob_categorylinks_sql_make(sql_parser, wiki, idx_mode);}
|
||||
public static final String Tbl_categorylinks = String_.Concat_lines_nl
|
||||
( "CREATE TABLE `categorylinks` ("
|
||||
, " `cl_from` int(10) unsigned NOT NULL DEFAULT '0',"
|
||||
@ -33,4 +34,10 @@ public class Xob_categorylinks_sql extends Xob_categorylinks_base {
|
||||
, " UNIQUE KEY `cl_from` (`cl_from`,`cl_to`),"
|
||||
, ");"
|
||||
);
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_idx_mode_)) idx_mode = Db_idx_mode.Xto_itm(m.ReadStr("v"));
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
}
|
||||
private static final String Invk_idx_mode_ = "idx_mode_";
|
||||
}
|
||||
|
@ -18,7 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.bldrs.imports.ctgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.bldrs.*; import gplx.xowa.bldrs.imports.*;
|
||||
import gplx.core.flds.*; import gplx.ios.*; import gplx.dbs.*; import gplx.xowa.dbs.*; import gplx.xowa.ctgs.*;
|
||||
public class Xob_categorylinks_sql_make implements Io_make_cmd {
|
||||
public Xob_categorylinks_sql_make(Sql_file_parser sql_parser, Xow_wiki wiki) {this.wiki = wiki; this.sql_parser = sql_parser;} private Xow_wiki wiki; Xodb_mgr_sql db_mgr; Sql_file_parser sql_parser;
|
||||
private Xow_wiki wiki; private Sql_file_parser sql_parser; private Db_idx_mode idx_mode;
|
||||
private Xodb_mgr_sql db_mgr;
|
||||
public Xob_categorylinks_sql_make(Sql_file_parser sql_parser, Xow_wiki wiki, Db_idx_mode idx_mode) {
|
||||
this.wiki = wiki; this.sql_parser = sql_parser; this.idx_mode = idx_mode;
|
||||
}
|
||||
public Io_sort_cmd Make_dir_(Io_url v) {return this;}
|
||||
public void Sort_bgn() {
|
||||
usr_dlg = wiki.App().Usr_dlg();
|
||||
@ -38,6 +42,7 @@ public class Xob_categorylinks_sql_make implements Io_make_cmd {
|
||||
ctg_stmt = db_mgr.Tbl_category().Insert_stmt(cat_provider);
|
||||
File_open(category_file);
|
||||
first_provider = true;
|
||||
if (idx_mode.Tid_is_bgn()) Idx_create(fsys_mgr);
|
||||
} Db_provider cl_provider, cat_provider; Gfo_fld_rdr fld_rdr = Gfo_fld_rdr.xowa_(); Db_stmt cl_stmt = Db_stmt_.Null, ctg_stmt = Db_stmt_.Null; int row_count = 0; Gfo_usr_dlg usr_dlg; boolean first_provider;
|
||||
int[] cur_cat_counts = new int[Xoa_ctg_mgr.Tid__max]; long cur_cat_file_size, cur_cat_file_max; byte[] cur_cat_ttl = Ttl_first; int cur_cat_id; int cur_cat_file_idx;
|
||||
public byte Line_dlm() {return line_dlm;} public Xob_categorylinks_sql_make Line_dlm_(byte v) {line_dlm = v; return this;} private byte line_dlm = Byte_ascii.Nil;
|
||||
@ -68,13 +73,17 @@ public class Xob_categorylinks_sql_make implements Io_make_cmd {
|
||||
db_mgr.Tbl_xowa_db().Commit_all(fsys_mgr.Core_provider(), fsys_mgr.Ary());
|
||||
if (db_mgr.Category_version() == Xoa_ctg_mgr.Version_null) // NOTE: ctg_v1 wkr will set this to v1; only set to v2 if null
|
||||
db_mgr.Category_version_update(false);
|
||||
usr_dlg.Log_many("", "", "import.category.v2: insert done; committing; rows=~{0}", row_count);
|
||||
cat_provider.Txn_mgr().Txn_end_all();
|
||||
ctg_stmt.Rls();
|
||||
fsys_mgr.Index_create(usr_dlg, Byte_.Ary(Xodb_file_tid_.Tid_core, Xodb_file_tid_.Tid_category), Index_categorylinks_from, Index_categorylinks_main);
|
||||
if (idx_mode.Tid_is_end()) Idx_create(fsys_mgr);
|
||||
name_id_rdr.Rls();
|
||||
if (String_.Eq(sql_parser.Src_fil().NameAndExt(), Xob_ctg_v1_sql_make.Url_sql)) // delete temp xowa_categorylinks.sql file created by cat_v1
|
||||
Io_mgr._.DeleteFil(sql_parser.Src_fil());
|
||||
}
|
||||
private void Idx_create(Xodb_fsys_mgr fsys_mgr) {
|
||||
fsys_mgr.Index_create(usr_dlg, Byte_.Ary(Xodb_file_tid_.Tid_core, Xodb_file_tid_.Tid_category), Idx_categorylinks_from, Idx_categorylinks_main);
|
||||
}
|
||||
int Ctg_grp_end(byte[] new_ctg_ttl) {
|
||||
if (cur_cat_ttl != Bry_.Empty && cur_cat_id != -1)
|
||||
db_mgr.Tbl_category().Insert(ctg_stmt, cur_cat_id, cur_cat_counts[Xoa_ctg_mgr.Tid_page], cur_cat_counts[Xoa_ctg_mgr.Tid_subc], cur_cat_counts[Xoa_ctg_mgr.Tid_file], Xoa_ctg_mgr.Hidden_n, cur_cat_file_idx);
|
||||
@ -131,8 +140,8 @@ public class Xob_categorylinks_sql_make implements Io_make_cmd {
|
||||
} Io_line_rdr name_id_rdr;
|
||||
private static final byte[] Ttl_last = null, Ttl_first = Bry_.Empty;
|
||||
private static final Db_idx_itm
|
||||
Index_categorylinks_main = Db_idx_itm.sql_("CREATE INDEX IF NOT EXISTS categorylinks__cl_main ON categorylinks (cl_to_id, cl_type_id, cl_sortkey, cl_from);")
|
||||
, Index_categorylinks_from = Db_idx_itm.sql_("CREATE INDEX IF NOT EXISTS categorylinks__cl_from ON categorylinks (cl_from);")
|
||||
Idx_categorylinks_main = Db_idx_itm.sql_("CREATE INDEX IF NOT EXISTS categorylinks__cl_main ON categorylinks (cl_to_id, cl_type_id, cl_sortkey, cl_from);")
|
||||
, Idx_categorylinks_from = Db_idx_itm.sql_("CREATE INDEX IF NOT EXISTS categorylinks__cl_from ON categorylinks (cl_from);")
|
||||
;
|
||||
}
|
||||
/*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user