Commit 2775f5cd authored by MRodz's avatar MRodz Committed by mrodzis
Browse files

Add more tests and improve code

parent 896fb7bb
......@@ -33,7 +33,7 @@ declare variable $index-info:org-map :=
return
map:entry(string($entry/@xml:id),
map {
"regular-name" : string-join($entry/tei:orgName, ", "),
"regular-name" : string-join($entry/tei:orgName[not(@type)], ", "),
"occs-in-nbs" : ""
}
));
......@@ -67,8 +67,7 @@ declare variable $index-info:wrk-map :=
return
map:entry(string($entry/@xml:id),
map {
"regular-name" : string-join($entry/tei:name, ", "),
"subref-of" : string-join($entry/parent::tei:item/tei:name, ", "),
"regular-name" : string-join($entry/tei:name[not(@type)], ", "),
"occs-in-nbs" : ""
}
));
......
......@@ -27,13 +27,14 @@ declare
function index-info-test:places-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: EVENTS :)
declare
%test:name("Events: Full references - transformation result")
%test:args("<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""eve:Thesenanschlag""/>")
%test:assertEquals("<rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""eve:Thesenanschlag"" regular-name-1=""Thesenanschlag"" place-1=""plc:Kirche_Wittenberg"" occs-1=""""/>")
function index-info-test:places-full-reference-xml($node as element(*)) {
function index-info-test:events-full-reference-xml($node as element(*)) {
fontaneSimple:transform($node)
};
......@@ -42,10 +43,12 @@ declare
%test:args("eve:Thesenanschlag", "eve", "place")
%test:assertEquals("plc:Kirche_Wittenberg")
function index-info-test:places-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
function index-info-test:events-places($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: PLACES :)
declare
%test:name("Places: Full references")
%test:args("plc:Thueringen", "plc", "regular-name")
......@@ -69,4 +72,63 @@ declare
function index-info-test:places-sub-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
\ No newline at end of file
};
(: ORGANIZATIONS :)
declare
%test:name("Organizations: Regular names")
%test:args("org:Garde_Grenadier_Regiment_IV", "org", "regular-name")
%test:assertEquals("Garde-Grenadier-Regiment Nr. 4")
function index-info-test:org-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: PERSONS :)
declare
%test:name("Persons: Regular names")
%test:args("psn:Papke", "psn", "regular-name")
%test:assertEquals("Papke, Herr")
function index-info-test:persons-full-reference($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Birth date")
%test:args("psn:Pape", "psn", "birth")
%test:assertEquals("1813")
function index-info-test:persons-birth($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Death date")
%test:args("psn:Pape", "psn", "death")
%test:assertEquals("1895")
function index-info-test:persons-death($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
declare
%test:name("Persons: Occupation")
%test:args("psn:Pape", "psn", "occupation")
%test:assertEquals("preuß. General")
function index-info-test:persons-occupation($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
(: WORKS :)
declare
%test:name("Works: Regular names")
%test:args("wrk:Blechen_Gitarre", "wrk", "regular-name")
%test:assertEquals("Guitarrespielender Italiener")
function index-info-test:wrk-regular($term as xs:string, $index-type as xs:string, $info as xs:string) {
index-info:get-info-about($index-type, $term, $info)
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment