User:RobLa/ABIF/Tests2023September

This is a set of examples for testing Module:ABIF

get_data tests

Test 01get_data

see User:RobLa/ABIF/Tests2023September/01get_data


ABIF embedded in wikitext (in "User:RobLa/ABIF/Tests2023September"):

<abif set_id="01get_data">
24:  "蘇業"/5 > DGM/2 =  AM/2 > SBJ/1
</abif>

Template invocation (from another page):

{{#invoke:ABIF|get_data|page=User:RobLa/ABIF/page=Tests2023September/01get_data}}

Result 01get_data

24: "蘇業"/5 > DGM/2 = AM/2 > SBJ/1

Test 02get_data

see User:RobLa/ABIF/Tests2023September/02get_data

ABIF embedded in wikitext (in "User:RobLa/ABIF/Tests2023September"):

<abif set_id="02get_data">
25:DGM/5>SBJ/3>[蘇業]/2>AM/1
</abif>

Template invocation (from another page):

{{#invoke:ABIF|get_data|page=User:RobLa/ABIF/Tests2023September/02get_data|set_id=02get_data}}

Result 02get_data

25:DGM/5>SBJ/3>[蘇業]/2>AM/1

parse_prefs_line tests

Test 03parse_prefs_line

see User:RobLa/ABIF/Tests2023September/03parse_prefs_line


Testing basic parsing of a prefs line in an .abif file

{{#invoke:ABIF|parse_prefs_line|line=24: "蘇業"/5 > DGM/2 = AM/2 > SBJ/1}}

Result 03parse_prefs_line

table

prefs_line_json tests

Test 04prefs_line_json

see User:RobLa/ABIF/Tests2023September/04prefs_line_json


Invocation 04prefs_line_json

{{#invoke:ABIF|prefs_line_json|line=DGM}}

Result 04prefs_line_json

[]

Test 05prefs_line_json

see User:RobLa/ABIF/Tests2023September/05prefs line json

This test passes a valid prefline from an ABIF file, which should result in some pretty JSON (strcutured according the ".jabmod" schema)

Invocation 05prefs_line_json

{{#invoke:ABIF|prefs_line_json|line=24: "蘇業"/5 > DGM/2 = AM/2 > SBJ/1}}

Result 05prefs_line_json

{"prefs":[{"name":"\"蘇業\"","rating":5},{"name":" > DGM","rating":2},{"name":" = AM","rating":2},{"name":" > SBJ","rating":1}],"qty":24,"orderedlist":true}