enum testcases = [ "a1bc3d4" : [0, 1, 0, 3, 4], "to2gr" : [0, 0, 2], "1to" : [1], "x3c2" : [0, 3, 2], "1a2b3c4" : [1, 2, 3, 4], ]; foreach (pat, prios; testcases) assert(equal(priorities(pat), prios));
See Implementation