You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gnosygnu_xowa/400_xowa/src/gplx/xowa/xtns/wbases/hwtrs/Wdata_visitor__html_wtr_tst...

106 lines
3.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2020 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
You may use XOWA according to either of these licenses as is most appropriate
for your project on a case-by-case basis.
The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.xtns.wbases.hwtrs;
import gplx.Bry_;
import gplx.xowa.xtns.wbases.claims.itms.times.Wbase_date;
import org.junit.Before;
import org.junit.Test;
public class Wdata_visitor__html_wtr_tst {
@Before public void init() {fxt.init();} private Wdata_hwtr_mgr_fxt fxt = new Wdata_hwtr_mgr_fxt();
@Test public void Monolingualtext() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_monolingual(1, "en", "Motto")
, "Motto [en]"
);
}
@Test public void Time() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_time(1, "2001-02-03 04:05:06", Wbase_date.Fmt_ymdhns)
, "4:05:06 3 Feb 2001"
);
}
@Test public void Time__julian() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_time(1, "2001-02-03 04:05:06", Bry_.Empty, Bry_.new_a7("http://www.wikidata.org/entity/Q1985786"))
, "4:05:06 3 Feb 2001"
);
}
@Test public void Quantity_ubound_lbound() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_quantity(1, "50", "", "60", "30")
, "30-60"
);
}
@Test public void Quantity_same() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_quantity(1, "50", "1", "60", "40")
, "50±10"
);
}
@Test public void Quantity_frac() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_quantity(1, "+0.1234", "1", "+0.1235", "+0.1233")
, "0.1234±0.0001"
);
}
@Test public void Entity_qid() {
fxt
.Init_resolved_qid(1, "item_1")
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_entity_qid(1, 1)
, "<a href='/wiki/Q1'>item_1</a>"
);
}
@Test public void Entity_pid() {
fxt
.Init_resolved_pid(1, "item_1")
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_entity_pid(1, 1)
, "<a href='/wiki/Property:P1'>item_1</a>"
);
}
@Test public void Globecoordinate() {
fxt
.Init_resolved_qid(2, "Earth")
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_geo(1, "51.5072222", "-0.1275", ".000027777", "123", "http://www.wikidata.org/entity/Q2")
, "0°7&#39;38.99&#34;S, 51°30&#39;26.01&#34;E (<a href='/wiki/Q2'>Earth</a>)"
);
}
@Test public void Globecoordinate__globe__null() {
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_geo(1, "51.5072222", "-0.1275", ".000027777", "null", "")
, "0°7&#39;38.99&#34;S, 51°30&#39;26.01&#34;E"
);
}
@Test public void Globecoordinate__precision__0() { // PURPOSE: 0 precision was causing divide by 0 error; PAGE:ru.w:Лысково_(Калужская_область) DATE:2016-11-24
fxt
.Test_claim_val
( fxt.Wdata_fxt().Make_claim_geo(1, "51.5072222", "-0.1275", "0", "null", "")
, "0°7&#39;39&#34;S, 51°30&#39;26&#34;E"
);
}
}