1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Refactor: Pull more classes into baselib

This commit is contained in:
gnosygnu
2021-12-19 16:19:19 -05:00
parent 48559edffe
commit 0e80d7ef6d
7999 changed files with 1375876 additions and 1365947 deletions

View File

@@ -13,26 +13,29 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.utls.StringUtl;
import gplx.types.commons.GfoDateUtl;
import org.junit.*; import gplx.core.stores.*;
public class GfmlDataRdr_tst {
@Test public void Raw() {
raw = "root:{}";
rdr = rdr_(raw);
Tfds.Eq(rdr.NameOfNode(), "root");
GfoTstr.EqObj(rdr.NameOfNode(), "root");
}
@Test public void Atrs() {
raw = "root:id=1 name=me isPresent=true dateOf='2006-12-08';";
rdr = rdr_(raw);
Tfds.Eq(rdr.ReadInt("id"), 1);
Tfds.Eq(rdr.ReadStr("name"), "me");
Tfds.Eq(rdr.ReadBool("isPresent"), true);
Tfds.Eq_date(rdr.ReadDate("dateOf"), DateAdp_.parse_gplx("2006-12-08"));
GfoTstr.EqObj(rdr.ReadInt("id"), 1);
GfoTstr.EqObj(rdr.ReadStr("name"), "me");
GfoTstr.EqObj(rdr.ReadBool("isPresent"), true);
GfoTstr.Eq(rdr.ReadDate("dateOf"), GfoDateUtl.ParseGplx("2006-12-08"));
}
@Test public void Subs() {
raw = String_.Concat_any(
raw = StringUtl.ConcatObjs(
"root:{",
" computers:id=1 {",
" item:name=cpu;",
@@ -49,22 +52,22 @@ public class GfmlDataRdr_tst {
int idx = 0;
while (computers.MoveNextPeer()) {
int expd = idx == 0 ? 1 : 2;
Tfds.Eq(computers.ReadInt("id"), expd);
GfoTstr.EqObj(computers.ReadInt("id"), expd);
idx++;
}
Tfds.Eq(idx, 2);
GfoTstr.EqObj(idx, 2);
DataRdr items = computers.Subs();
idx = 0;
while (items.MoveNextPeer()) {
String expdStr = idx == 0 ? "hardDrive" : "networkCard";
Tfds.Eq(items.ReadStr("name"), expdStr);
GfoTstr.EqObj(items.ReadStr("name"), expdStr);
idx++;
}
Tfds.Eq(idx, 2);
GfoTstr.EqObj(idx, 2);
}
@Test public void SelectRdr() {
raw = String_.Concat_any(
raw = StringUtl.ConcatObjs(
"root:{",
" person:name=me {}",
" computer:brand=noname {}",
@@ -72,11 +75,11 @@ public class GfmlDataRdr_tst {
rdr = rdr_(raw);
DataRdr person = rdr.Subs_byName_moveFirst("person");
Tfds.Eq(person.NameOfNode(), "person");
Tfds.Eq(person.ReadStr("name"), "me");
GfoTstr.EqObj(person.NameOfNode(), "person");
GfoTstr.EqObj(person.ReadStr("name"), "me");
DataRdr computer = rdr.Subs_byName_moveFirst("computer");
Tfds.Eq(computer.NameOfNode(), "computer");
Tfds.Eq(computer.ReadStr("brand"), "noname");
GfoTstr.EqObj(computer.NameOfNode(), "computer");
GfoTstr.EqObj(computer.ReadStr("brand"), "noname");
}
// @Test public void Subs_byKey() {
// raw = String_.Concat_any(

View File

@@ -13,7 +13,13 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.libs.dlgs.UsrMsg;
import gplx.frameworks.tests.TfdsTstr_fxt;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import gplx.types.basics.utls.StringUtl;
import gplx.types.commons.KeyVal;
class GfmlParse_fxt {
public GfmlNde_mok nde_() {return GfmlNde_mok.new_();}
public GfmlTkn_mok tkn_grp_ary_(String... ary) {return GfmlTkn_mok.new_().Subs_(GfmlTkn_mok.Xto_bry(ary));}
@@ -58,15 +64,15 @@ class GfmlParse_fxt {
UsrMsg_mok actlUmm = UsrMsg_mok.new_(actlUm);
tstr.Eq_str(expdUm.Main(), actlUmm.Main(), "main");
for (int j = 0; j < expdUm.Args().Len(); j++) {
Keyval expdKv = (Keyval)expdUm.Args().Get_at(j);
Keyval actlKv = (Keyval)actlUmm.Args().GetByOrNull(expdKv.Key());
Object actlVal = actlKv == null ? String_.Null_mark : actlKv.Val();
tstr.Eq_str(expdKv.Val(), actlVal, expdKv.Key());
KeyVal expdKv = (KeyVal)expdUm.Args().GetAt(j);
KeyVal actlKv = (KeyVal)actlUmm.Args().GetByOrNull(expdKv.KeyToStr());
Object actlVal = actlKv == null ? StringUtl.NullMark : actlKv.Val();
tstr.Eq_str(expdKv.Val(), actlVal, expdKv.KeyToStr());
}
for (int j = 0; j < expdUm.Required().Len(); j++) {
String expdKv = (String)expdUm.Required().Get_at(j);
Keyval actlKv = (Keyval)actlUmm.Args().GetByOrNull(expdKv);
Object actlVal = actlKv == null ? String_.Null_mark : actlKv.Val();
String expdKv = (String)expdUm.Required().GetAt(j);
KeyVal actlKv = (KeyVal)actlUmm.Args().GetByOrNull(expdKv);
Object actlVal = actlKv == null ? StringUtl.NullMark : actlKv.Val();
Object actlValV = actlKv == null ? "<<REQD>>" : actlKv.Val();
tstr.Eq_str(actlValV, actlVal, expdKv);
}

View File

@@ -1,26 +1,32 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml;
import gplx.frameworks.tests.TfdsTstr_fxt;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.Ordered_hash;
import gplx.types.basics.lists.Ordered_hash_;
import gplx.types.basics.utls.IntUtl;
import gplx.types.basics.utls.StringUtl;
class GfmlTypeCompiler_fxt {
public GfmlTyp_mok typ_() {return GfmlTyp_mok.new_();}
public GfmlNde_mok nde_() {return GfmlNde_mok.new_();}
public GfmlFld_mok fld_() {return GfmlFld_mok.new_();}
public GfmlTypRegy Regy() {return typBldr.TypeRegy();}
public void ini_Typ(List_adp typs, GfmlTyp_mok typ) {typs.Add(typ);}
@gplx.Internal protected void run_InitPragma(GfmlTypRegy regy, GfmlPragma pragma) {
public void run_InitPragma(GfmlTypRegy regy, GfmlPragma pragma) {
GfmlTypeMakr makr = GfmlTypeMakr.new_();
GfmlType[] typeAry = pragma.MakePragmaTypes(makr);
regy.Add_ary(typeAry);
@@ -55,7 +61,7 @@ class GfmlTypeCompiler_fxt {
for (int i = 0; i < max; i++) {
GfmlFld_mok expdFld = (GfmlFld_mok)tstr.List_FetchAtOrNull(expd.Subs(), i);
GfmlFld_mok actlFld = (GfmlFld_mok)tstr.List_FetchAtOrNull(actl.Subs(), i);
tstr.SubName_push(Int_.To_str(i) + " fld");
tstr.SubName_push(IntUtl.ToStr(i) + " fld");
tst(tstr, expdFld, actlFld);
tstr.SubName_pop();
}
@@ -66,7 +72,7 @@ class GfmlTypeCompiler_fxt {
if (expd.TypeKey() != null) tstr.Eq_str(expd.TypeKey(), actl.TypeKey(), "typekey");
if (expd.DefaultTkn() != null) tstr.Eq_str(expd.DefaultTknRaw(), actl.DefaultTknRaw(), "default");
}
static GfmlFld_mok NullObj(GfmlFld_mok v) {return (v == null) ? GfmlFld_mok.new_().ini_ndk_(String_.Null_mark, "") : v;}
static GfmlFld_mok NullObj(GfmlFld_mok v) {return (v == null) ? GfmlFld_mok.new_().ini_ndk_(StringUtl.NullMark, "") : v;}
public void tst_Resolve(GfmlTyp_mok typ, GfmlNde_mok nde, GfmlNde_mok expd) {
typBldr.TypeRegy().Add(typ.XtoGfmlType());
tst_Resolve(nde, expd);

View File

@@ -13,8 +13,14 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.core.strings.*;
package gplx.gfml;
import gplx.frameworks.tests.TfdsTstr_fxt;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import gplx.types.basics.utls.IntUtl;
import gplx.types.basics.utls.StringUtl;
import gplx.types.commons.String_bldr;
import gplx.types.commons.String_bldr_;
interface GfmlItm_mok {
int ObjType();
}
@@ -28,10 +34,10 @@ class GfmlAtr_mok implements GfmlItm_mok {
}
public String XtoStrStub() {
String_bldr sb = String_bldr_.new_();
sb.Add_kv("key=", key).Add_kv("val=", val);
return sb.To_str();
sb.AddKv("key=", key).AddKv("val=", val);
return sb.ToStr();
}
public static final GfmlAtr_mok Null = new GfmlAtr_mok().Key_(String_.Null_mark).Val_(String_.Null_mark);
public static final GfmlAtr_mok Null = new GfmlAtr_mok().Key_(StringUtl.NullMark).Val_(StringUtl.NullMark);
public static GfmlAtr_mok as_(Object obj) {return obj instanceof GfmlAtr_mok ? (GfmlAtr_mok)obj : null;}
public static GfmlAtr_mok new_(String key, String val) {
GfmlAtr_mok rv = new GfmlAtr_mok();
@@ -51,8 +57,8 @@ class GfmlNde_mok implements GfmlItm_mok {
public List_adp Subs() {return subs;}
public String XtoStrStub() {
String_bldr sb = String_bldr_.new_();
sb.Add_kv("key=", key).Add_kv("hnd=", hnd).Add_kv("typ=", typ).Add_kv("subs=", Int_.To_str(subs.Len()));
return sb.To_str();
sb.AddKv("key=", key).AddKv("hnd=", hnd).AddKv("typ=", typ).AddKv("subs=", IntUtl.ToStr(subs.Len()));
return sb.ToStr();
}
public GfmlNde_mok Subs_(GfmlItm_mok... ary) {
for (GfmlItm_mok itm : ary)
@@ -76,7 +82,7 @@ class GfmlNde_mok implements GfmlItm_mok {
if (ownerMok.keyed) rv.KeyedSubObj_(ownerMok.keyed);
if (ownerMok.key != null) rv.KeyTkn_set(GfmlTkn_.val_(ownerMok.key));
for (int i = 0; i < ownerMok.subs.Len(); i++) {
GfmlItm_mok itm = (GfmlItm_mok)ownerMok.subs.Get_at(i);
GfmlItm_mok itm = (GfmlItm_mok)ownerMok.subs.GetAt(i);
if (itm.ObjType() == GfmlObj_.Type_nde) {
GfmlNde_mok itmMok = (GfmlNde_mok)itm;
rv.SubObjs_Add(itmMok.XtoGfmlItm(regy));
@@ -89,7 +95,7 @@ class GfmlNde_mok implements GfmlItm_mok {
return rv;
}
public static GfmlNde_mok as_(Object obj) {return obj instanceof GfmlNde_mok ? (GfmlNde_mok)obj : null;}
public static final GfmlNde_mok Null = new GfmlNde_mok().Hnd_(String_.Null_mark).Typ_(String_.Null_mark);
public static final GfmlNde_mok Null = new GfmlNde_mok().Hnd_(StringUtl.NullMark).Typ_(StringUtl.NullMark);
public static final GfmlNde_mok ErrAtr = new GfmlNde_mok().Hnd_("<<ErrAtr>>").Typ_("<<ErrAtr>>");
public static GfmlNde_mok new_() {return new GfmlNde_mok();} GfmlNde_mok() {}
public static GfmlNde_mok gfmlNde_(GfmlNde nde) {return InitNde(nde);}
@@ -105,7 +111,7 @@ class GfmlNde_mok implements GfmlItm_mok {
if (subItm.ObjType() == GfmlObj_.Type_atr) {
GfmlAtr subAtr = (GfmlAtr)subItm;
GfmlAtr_mok mokAtr = GfmlAtr_mok.new_(subAtr.Key(), subAtr.DatTkn().Val());
if (!String_.Len_eq_0(subAtr.Key())) mokAtr.Key_(subAtr.Key());
if (!StringUtl.IsNullOrEmpty(subAtr.Key())) mokAtr.Key_(subAtr.Key());
rv.subs.Add(mokAtr);
}
else {
@@ -140,7 +146,7 @@ class GfmlTypeResolver_fxt {
for (int i = 0; i < max; i++) {
GfmlItm_mok expdSub = (GfmlItm_mok)tstr.List_FetchAtOrNull(expd.Subs(), i);
GfmlItm_mok actlSub = (GfmlItm_mok)tstr.List_FetchAtOrNull(actl.Subs(), i);
tstr.SubName_push(Int_.To_str(i));
tstr.SubName_push(IntUtl.ToStr(i));
if (expdSub == null) {
GfmlNde_mok mm = GfmlNde_mok.as_(actlSub);
String actlSubStr = mm == null ? "sub:null" : mm.XtoStrStub();

View File

@@ -1,19 +1,24 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml;
import gplx.frameworks.tests.TfdsTstr_fxt;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import gplx.types.basics.utls.IntUtl;
import gplx.types.basics.utls.StringUtl;
class GfmlTkn_mok {
public String Raw() {return raw;} public GfmlTkn_mok Raw_(String v) {raw = v; return this;} private String raw;
public List_adp Subs() {return list;} List_adp list = List_adp_.New();
@@ -66,10 +71,10 @@ class GfmlTkn_mok {
for (int i = 0; i < max; i++) {
GfmlTkn_mok expdSub = (GfmlTkn_mok)tstr.List_FetchAtOrNull(expd.Subs(), i);
GfmlTkn_mok actlSub = (GfmlTkn_mok)tstr.List_FetchAtOrNull(actl.Subs(), i);
tstr.SubName_push(Int_.To_str(i));
tstr.SubName_push(IntUtl.ToStr(i));
tst(tstr, expdSub, actlSub);
tstr.SubName_pop();
}
}
static GfmlTkn_mok NullObj(GfmlTkn_mok v) {return v == null ? GfmlTkn_mok.new_().Raw_(String_.Null_mark) : v;}
static GfmlTkn_mok NullObj(GfmlTkn_mok v) {return v == null ? GfmlTkn_mok.new_().Raw_(StringUtl.NullMark) : v;}
}

View File

@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import gplx.types.basics.utls.StringUtl;
class GfmlFld_mok {
public String Name() {return name;} public GfmlFld_mok Name_(String v) {name = v; return this;} private String name;
public String TypeKey() {return typeKey;} public GfmlFld_mok TypeKey_(String v) {typeKey = v; return this;} private String typeKey;
@@ -31,11 +34,11 @@ class GfmlFld_mok {
public GfmlFld_mok ini_ndk_(String name, String typKey) {this.name = name; this.typeKey = typKey; this.keyed = true; return this;}
public static GfmlFld_mok new_() {return new GfmlFld_mok();} GfmlFld_mok() {}
public static String XtoRaw(GfmlObj gobj) {
if (gobj == null) return String_.Null_mark;
if (gobj == null) return StringUtl.NullMark;
GfmlTkn tkn = GfmlTkn_.as_(gobj);
if (tkn != null) return tkn.Raw();
GfmlNde nde = GfmlNde.as_(gobj);
return nde.To_str();
return nde.ToStr();
}
}
class GfmlTyp_mok {
@@ -55,7 +58,7 @@ class GfmlTyp_mok {
public GfmlType XtoGfmlType() {
GfmlType rv = GfmlType_.new_(key, name); // all types in tests are top-level
for (int i = 0; i < subFlds.Len(); i++) {
GfmlFld_mok fld = (GfmlFld_mok)subFlds.Get_at(i);
GfmlFld_mok fld = (GfmlFld_mok)subFlds.GetAt(i);
rv.SubFlds().Add(fld.XtoGfmlFld());
}
return rv;

View File

@@ -13,10 +13,14 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.libs.dlgs.UsrMsg;
import gplx.types.commons.KeyVal;
import gplx.types.basics.lists.Ordered_hash;
import gplx.types.basics.lists.Ordered_hash_;
class UsrMsg_mok {
public String Main() {return main;} public UsrMsg_mok Main_(String v) {main = v; return this;} private String main;
public UsrMsg_mok Add_(String k, Object o) {hash.Add(k, Keyval_.new_(k, o)); return this;}
public UsrMsg_mok Add_(String k, Object o) {hash.Add(k, KeyVal.NewStr(k, o)); return this;}
public UsrMsg_mok Require_(String k) {required.Add(k, k); return this;}
public Ordered_hash Args() {return hash;} Ordered_hash hash = Ordered_hash_.New();
public Ordered_hash Required() {return required;} Ordered_hash required = Ordered_hash_.New();
@@ -25,8 +29,8 @@ class UsrMsg_mok {
if (um != null) {
rv.main = um.Hdr();
for (int i = 0; i < um.Args().Len(); i++) {
Keyval kv = (Keyval)um.Args().Get_at(i);
rv.Add_(kv.Key(), kv.Val());
KeyVal kv = (KeyVal)um.Args().GetAt(i);
rv.Add_(kv.KeyToStr(), kv.Val());
}
}
return rv;

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
public class z011_IntObjHash_tst {
@Before public void setup() {
@@ -56,6 +57,6 @@ public class z011_IntObjHash_tst {
tst_Fetch(17, null); // works
tst_Fetch(16, null); // used to fail
}
void tst_Fetch(int key, Object expd) {Tfds.Eq(expd, hash.Get_by(key));}
void tst_Count(int expd) {Tfds.Eq(expd, hash.Count());}
void tst_Fetch(int key, Object expd) {GfoTstr.EqObj(expd, hash.Get_by(key));}
void tst_Count(int expd) {GfoTstr.EqObj(expd, hash.Count());}
}

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
import gplx.core.texts.*; /*CharStream*/
public class z012_GfmlTrie_tst {
@@ -66,6 +67,6 @@ public class z012_GfmlTrie_tst {
void tst_FindMatch_first(String text, String expd) {
CharStream stream = CharStream.pos0_(text);
String actl = (String)trie.FindMatch(stream);
Tfds.Eq(expd, actl);
GfoTstr.EqObj(expd, actl);
}
}

View File

@@ -13,8 +13,9 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.objects.lists.CompareAbleUtl;
package gplx.gfml;
import gplx.types.commons.lists.CompareAbleUtl;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
public class z015_GfmlDocPos_tst {
GfmlDocPos root = GfmlDocPos_.Root;
@@ -46,6 +47,6 @@ public class z015_GfmlDocPos_tst {
tst_CompareTo(lhs, rhs, CompareAbleUtl.Less);
tst_CompareTo(rhs, lhs, CompareAbleUtl.More);
}
void tst_Path(GfmlDocPos pos, String expdPath) {Tfds.Eq(expdPath, pos.Path());}
void tst_CompareTo(GfmlDocPos lhs, GfmlDocPos rhs, int expd) {Tfds.Eq(expd, lhs.compareTo(rhs));}
void tst_Path(GfmlDocPos pos, String expdPath) {GfoTstr.EqObj(expdPath, pos.Path());}
void tst_CompareTo(GfmlDocPos lhs, GfmlDocPos rhs, int expd) {GfoTstr.EqObj(expd, lhs.compareTo(rhs));}
}

View File

@@ -13,8 +13,9 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import gplx.objects.arrays.ArrayUtl;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.utls.ArrayUtl;
import org.junit.*;
public class z016_GfmlScopeList_tst {
@Before public void setup() {
@@ -49,6 +50,6 @@ public class z016_GfmlScopeList_tst {
void tst_Itm(GfmlScopeList list, GfmlDocPos pos, String expd) {
GfmlVarItm itm = (GfmlVarItm)list.Get_by(pos);
String actl = itm == null ? null : itm.TknVal();
Tfds.Eq(expd, actl);
GfoTstr.EqObj(expd, actl);
}
}

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
public class z017_GfmlStringHighlighter_tst {
@Test public void Short() {
@@ -46,6 +47,6 @@ public class z017_GfmlStringHighlighter_tst {
GfmlStringHighlighter sh_() {return GfmlStringHighlighter.new_();}
void tst_Err(GfmlStringHighlighter sh, String... expdLines) {
String[] actlLines = sh.Gen();
Tfds.Eq_ary_str(expdLines, actlLines);
GfoTstr.EqLines(expdLines, actlLines);
}
}

View File

@@ -13,8 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import org.junit.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.Before;
import org.junit.Test;
public class z051_GfmlFldPool_keyed_tst {
@Before public void setup() {
GfmlTypeMakr makr = GfmlTypeMakr.new_();
@@ -46,9 +48,9 @@ public class z051_GfmlFldPool_keyed_tst {
tst_Keyed_PopNext(fldPool, "z");
try {
tst_Keyed_PopNext(fldPool, GfmlItmKeys.NullKey);
Tfds.Fail("should have failed");
GfoTstr.Fail("should have failed");
}
catch (Exception exc) {Err_.Noop(exc);}
catch (Exception exc) {}
}
@Test public void PopByKey_PopNext() {
tst_Keyed_PopByKey(fldPool, "y", "y", "x", "z");
@@ -56,20 +58,20 @@ public class z051_GfmlFldPool_keyed_tst {
}
void tst_Keyed_PopByKey(GfmlFldPool fldPool, String key, String expdFldId, String... expdSubs) {
GfmlFld actlFld = fldPool.Keyed_PopByKey(key);
Tfds.Eq(expdFldId, actlFld.Name());
GfoTstr.EqObj(expdFldId, actlFld.Name());
String[] actlSubs = new String[fldPool.Keyd_Count()];
for (int i = 0; i < actlSubs.length; i++) {
actlSubs[i] = fldPool.Keyd_FetchAt(i).Name();
}
Tfds.Eq_ary(expdSubs, actlSubs);
GfoTstr.EqLines(expdSubs, actlSubs);
}
void tst_Keyed_PopNext(GfmlFldPool fldPool, String expdFldId, String... expdSubs) {
GfmlFld actlFld = fldPool.Keyed_PopNext();
Tfds.Eq(expdFldId, actlFld.Name());
GfoTstr.EqObj(expdFldId, actlFld.Name());
String[] actlSubs = new String[fldPool.Keyd_Count()];
for (int i = 0; i < actlSubs.length; i++) {
actlSubs[i] = fldPool.Keyd_FetchAt(i).Name();
}
Tfds.Eq_ary(expdSubs, actlSubs);
GfoTstr.EqLines(expdSubs, actlSubs);
}
}

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*; import gplx.core.stores.*;
public class z081_GfmlDataWtr_tst {
@Before public void setup() {
@@ -64,6 +65,6 @@ public class z081_GfmlDataWtr_tst {
}
void tst_XtoStr(DataWtr wtr, String expd) {
String actl = wtr.To_str();
Tfds.Eq(expd, actl);
GfoTstr.EqObj(expd, actl);
}
}

View File

@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.utls.StringUtl;
import org.junit.*; import gplx.core.stores.*;
public class z082_GfmlDataWtrOpts_tst {
@Before public void setup() {
@@ -31,7 +33,7 @@ public class z082_GfmlDataWtrOpts_tst {
wtr.WriteNodeBgn("nde1");
wtr.WriteNodeBgn("nde2");
wtr.WriteNodeEnd();
tst_XtoStr(wtr, String_.Concat_lines_crlf
tst_XtoStr(wtr, StringUtl.ConcatLinesCrlf
( "root:{"
, " nde1:{"
, " nde2:;"
@@ -43,10 +45,10 @@ public class z082_GfmlDataWtrOpts_tst {
wtr.InitWtr(GfmlDataWtrOpts.Key_const, GfmlDataWtrOpts.new_().IgnoreNullNamesOn_());
wtr.WriteNodeBgn("");
wtr.WriteData("key1", "data1");
tst_XtoStr(wtr, String_.Concat("root:{key1='data1';}"));
tst_XtoStr(wtr, StringUtl.Concat("root:{key1='data1';}"));
}
void tst_XtoStr(DataWtr wtr, String expd) {
String actl = wtr.To_str();
Tfds.Eq(expd, actl);
GfoTstr.EqObj(expd, actl);
}
}

View File

@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import org.junit.*;
import gplx.core.texts.*; /*CharStream*/
public class z091_GfmlLxr_basic_tst {
@@ -60,7 +63,7 @@ public class z091_GfmlLxr_basic_tst {
list.Add(tkn.Raw());
}
String[] actl = (String[])list.ToAry(String.class);
Tfds.Eq_ary(expd, actl);
GfoTstr.EqLines(expd, actl);
return tkn;
}
}

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z102_core_whitespace_tst {
GfmlParse_fxt fx = GfmlParse_fxt.new_();
@@ -38,7 +39,7 @@ public class z102_core_whitespace_tst {
fx.tst_Doc("a\tb;", fx.nde_().Atru_("a").Atru_("b"));
}
@Test public void NewLine() {
fx.tst_Doc(String_.Format("a{0}b;", String_.CrLf), fx.nde_().Atru_("a").Atru_("b"));
fx.tst_Doc(StringUtl.Format("a{0}b;", StringUtl.CrLf), fx.nde_().Atru_("a").Atru_("b"));
}
@Test public void MergeSameWs() {
fx.tst_Doc("a b;", fx.nde_().Atru_("a").Atru_("b"));

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z111_core_comment0_tst {
GfmlParse_fxt fx = GfmlParse_fxt.new_();
@@ -25,18 +26,18 @@ public class z111_core_comment0_tst {
);
}
@Test public void Basic() {
fx.tst_Doc("//a" + String_.Lf);
fx.tst_Tkn("//a" + String_.Lf
, fx.tkn_grp_ary_("//", "a", String_.Lf)
fx.tst_Doc("//a" + StringUtl.Nl);
fx.tst_Tkn("//a" + StringUtl.Nl
, fx.tkn_grp_ary_("//", "a", StringUtl.Nl)
);
}
@Test public void Data() {
fx.tst_Doc("a;//b" + String_.Lf, fx.nde_().Atru_("a"));
fx.tst_Tkn("a;//b" + String_.Lf
fx.tst_Doc("a;//b" + StringUtl.Nl, fx.nde_().Atru_("a"));
fx.tst_Tkn("a;//b" + StringUtl.Nl
, fx.tkn_grp_
( fx.tkn_grp_ary_("a")
, fx.tkn_itm_(";"))
, fx.tkn_grp_ary_("//", "b", String_.Lf)
, fx.tkn_grp_ary_("//", "b", StringUtl.Nl)
);
}
// @Test public void DanglingBgn() {

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z124_quotes_quoteFold_tst {
GfmlParse_fxt fx = GfmlParse_fxt.new_();
@@ -36,7 +37,7 @@ public class z124_quotes_quoteFold_tst {
);
}
@Test public void NewLine() {
fx.tst_Doc(String_.Concat("^'a", String_.CrLf, "b'^;"), fx.nde_().Atru_("ab"));
fx.tst_Doc(StringUtl.Concat("^'a", StringUtl.CrLf, "b'^;"), fx.nde_().Atru_("ab"));
}
@Test public void Eval() {
fx.tst_Doc("^'a<~t>b'^;", fx.nde_().Atru_("a\tb"));
@@ -51,7 +52,7 @@ public class z124_quotes_quoteFold_tst {
fx.tst_Doc("^'a'^'^b'^;", fx.nde_().Atru_("a'^b"));
}
@Test public void Comment0() {
fx.tst_Doc(String_.Concat("^'a//comment", String_.CrLf, "b'^;"), fx.nde_().Atru_("ab"));
fx.tst_Doc(StringUtl.Concat("^'a//comment", StringUtl.CrLf, "b'^;"), fx.nde_().Atru_("ab"));
}
@Test public void Comment1() {
fx.tst_Doc("^'a/*comment*/b'^;", fx.nde_().Atru_("ab"));

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z151_ndeSubs_basic_tst {
GfmlParse_fxt fx = GfmlParse_fxt.new_();
@@ -46,7 +47,7 @@ public class z151_ndeSubs_basic_tst {
));
}
@Test public void Complex() {
fx.tst_Doc(String_.Concat
fx.tst_Doc(StringUtl.Concat
( "{"
, "{"
, "{}"

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
public class z400_GfmlTypeMakr_tst {
@Before public void setup() {
@@ -51,7 +52,7 @@ public class z400_GfmlTypeMakr_tst {
tst_XtoAry(makr, "item", "item/pos");
}
void tst_Owner(GfmlTypeMakr typeMakr, String expdKey) {
Tfds.Eq(expdKey, typeMakr.Owner().Key());
GfoTstr.EqObj(expdKey, typeMakr.Owner().Key());
}
void tst_XtoAry(GfmlTypeMakr typeMakr, String... expdAry) {
GfmlType[] actlTypeAry = typeMakr.Xto_bry();
@@ -59,6 +60,6 @@ public class z400_GfmlTypeMakr_tst {
for (int i = 0; i < actlAry.length; i++) {
actlAry[i] = actlTypeAry[i].Key();
}
Tfds.Eq_ary(expdAry, actlAry);
GfoTstr.EqLines(expdAry, actlAry);
}
}

View File

@@ -13,19 +13,20 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z441_types_parse_basic_tst {
GfmlTypeCompiler_fxt fx = GfmlTypeCompiler_fxt.new_();
@Test public void Null() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "point:1;"
)
, fx.nde_().Hnd_("point").Typ_(GfmlType_.AnyKey).Atru_("1")
);
}
@Test public void Basic() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "point {"
, "x;"
@@ -37,7 +38,7 @@ public class z441_types_parse_basic_tst {
);
}
@Test public void MultipleAtrs() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "point {"
, "x; y;"

View File

@@ -13,11 +13,12 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z442_types_parse_default_tst {
@Test public void Basic() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "point {x;}"
, "}"
@@ -27,7 +28,7 @@ public class z442_types_parse_default_tst {
);
}
@Test public void Pinned() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "point {x;}"
, "}"
@@ -39,7 +40,7 @@ public class z442_types_parse_default_tst {
);
}
@Test public void Many() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "point {x;}" // point is always pinned
, "size {w;}" // size is defined, but can only be invoked by hnd
@@ -52,7 +53,7 @@ public class z442_types_parse_default_tst {
);
}
@Test public void Nested() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "item {"
, "point {x; y;}"
@@ -66,7 +67,7 @@ public class z442_types_parse_default_tst {
);
}
@Test public void NestedWithAtr() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "item {"
, "name;"
@@ -83,7 +84,7 @@ public class z442_types_parse_default_tst {
}
//@Test
public void WithDefault() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "point {"
, "x 1;"

View File

@@ -13,11 +13,12 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z443_types_parse_keyd_tst {
@Test public void Basic() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "[10 12];"
)
, fx.nde_().Subs_
@@ -27,7 +28,7 @@ public class z443_types_parse_keyd_tst {
}
// @Test // FIX: IGNORE
public void KeydDefault() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, " rect {"
, " point [1 2];"

View File

@@ -13,23 +13,25 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.lists.List_adp;
class GfmlDefaultItem_fxt {
@gplx.Internal protected GfmlDefaultItem make_(String typeKey, String key, GfmlTkn val) {return GfmlDefaultItem.new_(typeKey, key, val);}
@gplx.Internal protected GfmlDefaultItem make_(String typeKey, String key, String val) {return GfmlDefaultItem.new_(typeKey, key, GfmlTkn_.raw_(val));}
@gplx.Internal protected void tst_Item(GfmlDefaultItem actl, GfmlDefaultItem expd) {
Tfds.Eq(expd.TypeKey(), actl.TypeKey());
Tfds.Eq(expd.Key(), actl.Key());
Tfds.Eq(GfmlFld_mok.XtoRaw(expd.Val()), GfmlFld_mok.XtoRaw(actl.Val()));
Tfds.Eq(Val_to_str_or_null(expd.ValPrev()), Val_to_str_or_null(actl.ValPrev()));
public GfmlDefaultItem make_(String typeKey, String key, GfmlTkn val) {return GfmlDefaultItem.new_(typeKey, key, val);}
public GfmlDefaultItem make_(String typeKey, String key, String val) {return GfmlDefaultItem.new_(typeKey, key, GfmlTkn_.raw_(val));}
public void tst_Item(GfmlDefaultItem actl, GfmlDefaultItem expd) {
GfoTstr.EqObj(expd.TypeKey(), actl.TypeKey());
GfoTstr.EqObj(expd.Key(), actl.Key());
GfoTstr.EqObj(GfmlFld_mok.XtoRaw(expd.Val()), GfmlFld_mok.XtoRaw(actl.Val()));
GfoTstr.EqObj(Val_to_str_or_null(expd.ValPrev()), Val_to_str_or_null(actl.ValPrev()));
}
@gplx.Internal protected void tst_List(List_adp list, GfmlDefaultItem... expdAry) {
public void tst_List(List_adp list, GfmlDefaultItem... expdAry) {
for (int i = 0; i < expdAry.length; i++) {
GfmlDefaultItem actl = (GfmlDefaultItem)list.Get_at(i);
GfmlDefaultItem actl = (GfmlDefaultItem)list.GetAt(i);
GfmlDefaultItem expd = expdAry[i];
tst_Item(actl, expd);
}
Tfds.Eq(expdAry.length, list.Len());
GfoTstr.EqObj(expdAry.length, list.Len());
}
String Val_to_str_or_null(GfmlObj gobj) {
GfmlTkn tkn = GfmlTkn_.as_(gobj);

View File

@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import org.junit.*;
public class z451_dflts_compile_tst {
@Before public void setup() {

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
public class z452_dflts_exec_tst {
@Before public void setup() {
@@ -78,11 +79,11 @@ public class z452_dflts_exec_tst {
GfmlFld subFld = type.SubFlds().Get_by(subFldKey);
GfmlTkn defaultTkn = GfmlTkn_.as_(subFld.DefaultTkn());
String actlDefaultVal = defaultTkn == null || defaultTkn == GfmlTkn_.Null ? null : defaultTkn.Val();
Tfds.Eq(expdDefaultVal, actlDefaultVal);
GfoTstr.EqObj(expdDefaultVal, actlDefaultVal);
}
void tst_SubFldExists(GfmlType type, String subFldKey, boolean expd) {
GfmlFld subFld = type.SubFlds().Get_by(subFldKey);
Tfds.Eq(expd, subFld != null);
GfoTstr.EqObj(expd, subFld != null);
}
GfmlType make_(String key, String name, String... atrs) {
GfmlTypeMakr typeMakr = GfmlTypeMakr.new_();

View File

@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import org.junit.*;
public class z455_dflts_scope_tst {
@Before public void setup() {
@@ -37,11 +40,11 @@ public class z455_dflts_scope_tst {
}
GfmlType tst_FetchOrNullByPos(GfmlTypRegy regy, String key, GfmlDocPos docPos, String expdTypeKey, String... expdSubs) {
GfmlType actl = regy.FetchOrNull(key, docPos);
Tfds.Eq(expdTypeKey, actl.Key());
GfoTstr.EqObj(expdTypeKey, actl.Key());
String[] actlSubs = new String[actl.SubFlds().Count()];
for (int i = 0; i < actlSubs.length; i++)
actlSubs[i] = actl.SubFlds().Get_at(i).Name();
Tfds.Eq_ary(expdSubs, actlSubs);
GfoTstr.EqLines(expdSubs, actlSubs);
return actl;
}
}

View File

@@ -13,11 +13,12 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z456_dflts_parse_tst {
@Test public void Fix_DefaultChangesPinnedType() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_type:{"
, "item {"
, "name;"

View File

@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import org.junit.*;
public class z481_vars_compile_tst {
@Before public void setup() {
@@ -26,8 +27,8 @@ public class z481_vars_compile_tst {
, fx.nde_().Atru_("key_test").Atru_("val_test").Atru_("context_test"));
GfmlVarItm itm = pragma.CompileItmNde(gnde);
Tfds.Eq_rev(itm.Key(), "key_test");
Tfds.Eq_rev(itm.TknVal(), "val_test");
Tfds.Eq_rev(itm.CtxKey(), "context_test");
GfoTstr.EqObj("key_test", itm.Key());
GfoTstr.EqObj("val_test", itm.TknVal());
GfoTstr.EqObj("context_test", itm.CtxKey());
}
}

View File

@@ -13,12 +13,13 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z482_vars_parse_tst {
GfmlTypeCompiler_fxt fx = GfmlTypeCompiler_fxt.new_();
@Test public void Basic() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_var:{"
, " size '20,20';"
, "}"
@@ -28,7 +29,7 @@ public class z482_vars_parse_tst {
);
}
@Test public void Many() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_var:{"
, " size '20,20';"
, " pos '30,30';"
@@ -39,7 +40,7 @@ public class z482_vars_parse_tst {
);
}
@Test public void Deferred() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_var:{"
, " key0 '<~key1>';"
, "}"
@@ -52,7 +53,7 @@ public class z482_vars_parse_tst {
);
}
@Test public void Swap() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "{"
, " _var:{"
, " size '20,20';"
@@ -71,7 +72,7 @@ public class z482_vars_parse_tst {
);
}
@Test public void Context() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_var:{"
, " size '20,20' gui;"
, "}"

View File

@@ -13,12 +13,13 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.types.basics.utls.StringUtl;
import org.junit.*;
public class z501_lxr_parse_tst {
GfmlTypeCompiler_fxt fx = GfmlTypeCompiler_fxt.new_();
@Test public void SymCreate() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_lxr_sym:key='gfml.elm_key_1' raw='<-' cmd='gfml.elm_key';"
, "a<-1;"
)
@@ -26,7 +27,7 @@ public class z501_lxr_parse_tst {
);
}
@Test public void SymUpdate() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_lxr_sym:key='gfml.elm_key_0' raw='<-';"
, "a<-1 b=1;"
)
@@ -34,7 +35,7 @@ public class z501_lxr_parse_tst {
);
}
@Test public void SwapCreate() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_lxr_sym:key='gfml.swap_0' raw='/?/?' val='/?';"
, "/?/?;"
)
@@ -42,7 +43,7 @@ public class z501_lxr_parse_tst {
);
}
@Test public void FrameCreate() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_lxr_frame:key='gfml.comment_2' type='comment' bgn='/-' end='-/';"
, "a=/-ignore-/b;"
)
@@ -50,7 +51,7 @@ public class z501_lxr_parse_tst {
);
}
@Test public void FrameUpdate() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_lxr_frame:key='gfml.comment_0' bgn='--' end='!';"
, "a=--ignore!"
, "b;"
@@ -60,7 +61,7 @@ public class z501_lxr_parse_tst {
}
//@Test
public void FrameCreateNest() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "_lxr_frame:key='gfml.comment_2' type='comment' bgn='/-' end='-/' {"
, "sym:key='gfml.comment_2_escape_bgn' raw='/-/-' val='/-' cmd='gfml.elm_data';"
, "sym:key='gfml.comment_2_escape_end' raw='-/-/' val='-/' cmd='gfml.elm_data';"

View File

@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import org.junit.*;
public class z601_edit_atr_tst {
GfmlUpdateFx fx = GfmlUpdateFx.new_();
@@ -116,11 +119,11 @@ class GfmlUpdateFx {
public GfmlUpdateFx tst_(String expd) {
GfmlDoc actlDoc = GfmlDataNde.new_any_eol_(raw).Doc();
for (int i = 0; i < cmds.Len(); i++) {
GfmlUpdateCmd cmd = (GfmlUpdateCmd)cmds.Get_at(i);
GfmlUpdateCmd cmd = (GfmlUpdateCmd)cmds.GetAt(i);
cmd.Exec(actlDoc);
}
String actl = actlDoc.RootNde().To_str();
Tfds.Eq(expd, actl);
String actl = actlDoc.RootNde().ToStr();
GfoTstr.EqObj(expd, actl);
cmds.Clear();
return this;
}

View File

@@ -13,13 +13,16 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import org.junit.*;
import gplx.core.stores.*;
package gplx.gfml;
import gplx.core.stores.DataRdr;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.utls.StringUtl;
import gplx.types.commons.KeyVal;
import org.junit.Test;
public class z801_useCase_DataRdr_tst {
String raw;
@Test public void Subs_byName() {
raw = String_.Concat
raw = StringUtl.Concat
( "_type:{"
, " item {"
, " point {"
@@ -39,7 +42,7 @@ public class z801_useCase_DataRdr_tst {
}
// @Test
public void Subs_byName3() {
raw = String_.Concat
raw = StringUtl.Concat
( "_type:{"
, " item {"
, " key"
@@ -56,12 +59,12 @@ public class z801_useCase_DataRdr_tst {
subRdr = rdr.Subs_byName_moveFirst("point");
fx_rdr.tst_Atrs(subRdr, kv_("x", "1"), kv_("y", "2"));
}
Keyval kv_(String key, Object val) {return Keyval_.new_(key, val);}
KeyVal kv_(String key, Object val) {return KeyVal.NewStr(key, val);}
DataRdr_Fxt fx_rdr = DataRdr_Fxt.Instance;
DataRdr rdr, subRdr;
}
class DataRdr_Fxt {
@gplx.Internal protected DataRdr run_Subs_at(DataRdr rdr, int i) {
public DataRdr run_Subs_at(DataRdr rdr, int i) {
DataRdr rv = rdr.Subs();
int count = -1;
while (count++ < i) {
@@ -69,11 +72,11 @@ class DataRdr_Fxt {
}
return rv;
}
@gplx.Internal protected void tst_Atrs(DataRdr rdr, Keyval... expdAry) {
Keyval[] actlAry = new Keyval[rdr.FieldCount()];
public void tst_Atrs(DataRdr rdr, KeyVal... expdAry) {
KeyVal[] actlAry = new KeyVal[rdr.FieldCount()];
for (int i = 0; i < actlAry.length; i++)
actlAry[i] = rdr.KeyValAt(i);
Tfds.Eq_ary_str(expdAry, actlAry);
GfoTstr.EqAryObjAry(expdAry, actlAry);
}
public static final DataRdr_Fxt Instance = new DataRdr_Fxt(); DataRdr_Fxt() {}
}

View File

@@ -13,12 +13,16 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.libs.files.Io_mgr;
import gplx.frameworks.tests.GfoIoTstr;
import gplx.types.basics.utls.StringUtl;
import gplx.libs.files.Io_url;
import org.junit.*;
public class z803_useCase_KbdKeyboard_tst {
String raw; GfmlDoc gdoc;
@Test public void Quote() { // smokeTest; make sure DefaultLxr supports both quoting mechanisms
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( "gfui-keyboard-ui:{"
, " keyQuote {"
, " \"'\" 'key.quote';"
@@ -35,7 +39,7 @@ public class z803_useCase_KbdKeyboard_tst {
);
}
@Test public void Key_LtrA() {
fx.tst_Parse(String_.Concat
fx.tst_Parse(StringUtl.Concat
( TypeHeader
, "keys:{"
, " keyA {"
@@ -53,12 +57,12 @@ public class z803_useCase_KbdKeyboard_tst {
);
}
@Test public void Load_Smoke() {
Io_url url = Tfds.RscDir.GenSubFil_nest("110_gfml", "cfgs_archive", "gfui-keyboard-ui.cfg.gfml");
Io_url url = GfoIoTstr.RscDir.GenSubFil_nest("110_gfml", "cfgs_archive", "gfui-keyboard-ui.cfg.gfml");
raw = Io_mgr.Instance.LoadFilStr(url);
gdoc = GfmlDoc_.parse_any_eol_(raw);
// Tfds.Write(gdoc.RootNde().To_str());
}
String TypeHeader = String_.Concat
String TypeHeader = StringUtl.Concat
( "_type:{"
, " keys {"
, " key {"

View File

@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
package gplx.gfml;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.lists.List_adp;
import gplx.types.basics.lists.List_adp_;
import org.junit.*;
public class z811_useCase_GfmlIoSql_tst {
@Test public void Basic() {
@@ -34,7 +37,7 @@ public class z811_useCase_GfmlIoSql_tst {
void tst_Doc(String raw, GfmlNdeWrapper expd) {
GfmlDoc doc = SqlDoc.XtoDoc(raw);
GfmlNde actl = (GfmlNde)doc.RootNde();
Tfds.Eq_ary_str(To_str(expd.Nde()), To_str(actl));
GfoTstr.EqLines(To_str(expd.Nde()), To_str(actl));
}
String[] To_str(GfmlNde nde) {
List_adp list = List_adp_.New();

View File

@@ -13,8 +13,15 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.gfml; import gplx.*;
import org.junit.*; import gplx.core.strings.*; import gplx.core.envs.*;
package gplx.gfml;
import gplx.libs.files.Io_mgr;
import gplx.frameworks.tests.GfoTstr;
import gplx.types.basics.utls.LongUtl;
import gplx.libs.files.Io_url_;
import gplx.types.commons.String_bldr;
import gplx.types.commons.String_bldr_;
import org.junit.*;
import gplx.core.envs.*;
public class z901_perf_tst {
TimerWatch tmr = TimerWatch.new_();
@Test public void EmptyTestSoJunitWillNotFail() {}
@@ -42,7 +49,7 @@ public class z901_perf_tst {
// tmr.End_and_print("char"); // 1700
tmr.Bgn();
GfmlDoc_.parse_any_eol_(sbGfml.To_str());
GfmlDoc_.parse_any_eol_(sbGfml.ToStr());
tmr.End_and_print("gfml"); // 1700
}
//@Test
@@ -62,7 +69,7 @@ public class z901_perf_tst {
for (int i = 0; i < max; i++)
v = c.Val_proc();
tmr.End_and_print("proc");
Tfds.Write(v);
GfoTstr.Write(v);
}
// @Test
// public void ClassComp() {
@@ -100,13 +107,13 @@ class PerfFieldVsProc {
public int Val_proc() {return 1;}
}
class TimerWatch {
public void Bgn() {bgnTime = System_.Ticks();} long bgnTime;
public void End() {duration = System_.Ticks() - bgnTime;} long duration;
public void Bgn() {bgnTime = SystemUtl.Ticks();} long bgnTime;
public void End() {duration = SystemUtl.Ticks() - bgnTime;} long duration;
public void End_and_print(String text) {
this.End();
Tfds.Write(XtoStr_ms() + " " + text);
GfoTstr.Write(XtoStr_ms() + " " + text);
}
public String XtoStr_ms() {return Long_.To_str(duration);}
public String XtoStr_ms() {return LongUtl.ToStr(duration);}
public static TimerWatch new_() {
TimerWatch rv = new TimerWatch();
rv.Bgn();