+ Add tests for bidi rule W3

This commit is contained in:
Nils Dagsson Moskopp 2023-03-26 20:42:55 +02:00
parent 58bc44bc7c
commit fb971deccf
1 changed files with 15 additions and 2 deletions

View File

@ -207,7 +207,7 @@ assert(
"EN" == test_output[3].bidi_class
)
bidi.W3 = function(run)
local W3 = function(run)
-- Change al ALs to R.
for i = 1, #run do
if "AL" == run[i].bidi_class then
@ -217,6 +217,19 @@ bidi.W3 = function(run)
return run
end
-- Test W3: AL AL AL → R R R
local test_input = {
{ ["bidi_class"] = "AL" },
{ ["bidi_class"] = "AL" },
{ ["bidi_class"] = "AL" },
}
local test_output = W3(test_input)
assert(
"R" == test_output[1].bidi_class and
"R" == test_output[2].bidi_class and
"R" == test_output[3].bidi_class
)
bidi.W4 = function(run)
for i = 1, #run do
if "ES" == run[i].bidi_class then
@ -323,7 +336,7 @@ end
bidi.resolve_weak_types = function(run, sos)
run = bidi.W1(run, sos)
run = W2(run, sos)
run = bidi.W3(run)
run = W3(run)
run = bidi.W4(run)
run = bidi.W5(run)
run = bidi.W6(run)