(load "../common") (mtest (fmt "~x" #b'') "" (fmt "~4x" #b'') " " (fmt "~4,02x" #b'') " 00" (fmt "~x" #b'AF') "af" (fmt "~4x" #b'AF') " af" (fmt "~-4x" #b'AF') "af " (fmt "~4,03x" #b'AF') " 0af" (fmt "~-4,03X" #b'AF') "0AF ") (mtest (fmt "~x" #\xaf) "af" (fmt "~4x" #\xaf) " af" (fmt "~-4x" #\xaf) "af " (fmt "~4,03x" #\xaf) " 0af" (fmt "~-4,03X" #\xaf) "0AF ") (mtest (fmt "~x" #xaf) "af" (fmt "~4x" #xaf) " af" (fmt "~-4x" #xaf) "af " (fmt "~4,03x" #xaf) " 0af" (fmt "~-4,03X" #xaf) "0AF ") (test (fmt "~x" (sha256 "abc")) "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad") (mtest (fmt "~8,02f" 12) " 0012.00" (fmt "~8,+02f" 12) "+0012.00" (fmt "~8,-02f" 12) "00012.00" (fmt "~8, 02f" 12) " 0012.00" (fmt "~8,-02f" -12) "-0012.00" (fmt "~6,02f" 12) " 12.00" (fmt "~6,+02f" 12) "+12.00" (fmt "~6,-02f" 12) "012.00" (fmt "~6,- 2f" 12) " 12.00" (fmt "~6,-02f" -12) "-12.00" (fmt "~5,02f" 12) "12.00" (fmt "~5,+02f" 12) "+12.00" (fmt "~5,-02f" 12) "12.00" (fmt "~5,- 2f" 12) "12.00" (fmt "~5,-02f" -12) "-12.00") (mtest (fmt "~<8,02f" 12) "0012.00 " (fmt "~<8,+02f" 12) "+0012.00" (fmt "~<8,-02f" 12) "00012.00" (fmt "~<8, 02f" 12) " 0012.00" (fmt "~<8,-02f" -12) "-0012.00" (fmt "~<6,02f" 12) "12.00 " (fmt "~<6,+02f" 12) "+12.00" (fmt "~<6,-02f" 12) "012.00" (fmt "~<6,- 2f" 12) " 12.00" (fmt "~<6,-02f" -12) "-12.00" (fmt "~<5,02f" 12) "12.00" (fmt "~<5,+02f" 12) "+12.00" (fmt "~<5,-02f" 12) "12.00" (fmt "~<5,- 2f" 12) "12.00" (fmt "~<5,-02f" -12) "-12.00") (mtest (fmt "~<8,2a" 12) "12 " (fmt "~<8,02a" 12) "12 " (fmt "~<8,+02a" 12) "+12 " (fmt "~<8,-02a" 12) "012 " (fmt "~<8, 02a" 12) " 12 " (fmt "~<8,2a" 12.0) "12 " (fmt "~<8,02a" 12.0) "12 " (fmt "~<8,+02a" 12.0) "+12 " (fmt "~<8,-02a" 12.0) "012 " (fmt "~<8, 02a" 12.0) " 12 " (fmt "~<8,4a" 12.0) " 12 " (fmt "~<8,04a" 12.0) "0012 " (fmt "~<8,+04a" 12.0) "+0012 " (fmt "~<8,-04a" 12.0) "00012 " (fmt "~<8, 04a" 12.0) " 0012 " (fmt "~<8,8a" 12.0) " 12 " (fmt "~<8,08a" 12.0) "0000012 " (fmt "~<8,+08a" 12.0) "+0000012" (fmt "~<8,-08a" 12.0) "00000012" (fmt "~<8, 08a" 12.0) " 0000012") (mtest (fmt "~,04a" 1) "0001" (fmt "~,4a" 1) " 1" (fmt "~4,a" 1) " 1" (fmt "~<8,a" 1) "1 " (fmt "~<8,0a" 1) "1 " (fmt "~<8,4a" 1) " 1 " (fmt "~<8,04a" 1) "0001 " (fmt "~<8,+04a" 1) "+0001 " (fmt "~<,4a" 1) " 1") (mtest (fmt "~,04a" 1) "0001" (fmt "~,4a" 1) " 1" (fmt "~4,a" 1) " 1" (fmt "~<8,a" 1) "1 " (fmt "~<8,0a" 1) "1 " (fmt "~<8,4a" 1) " 1 " (fmt "~<8,04a" 1) "0001 " (fmt "~<8,+04a" 1) "+0001 " (fmt "~<,4a" 1) " 1") (mtest (fmt "~e" 1.2e13) "1.200e13" (fmt "~,2e" 1.2e13) "1.20e13" (fmt "~,0e" 1.2e13) "1e13" (fmt "~8,0e" 1.2e13) " 1e13" (fmt "~8,00e" 1.2e13) " 0001e13" (fmt "~8,-0e" 1.2e13) " 01e13" (fmt "~8,-00e" 1.2e13) "00001e13" (fmt "~8, 00e" 1.2e13) " 0001e13" (fmt "~8,+00e" 1.2e13) "+0001e13" (fmt "~8,+00e" -1.2e13) "-0001e13" (fmt "~8,00e" -1.2e13) "-0001e13" (fmt "~<8,0e" 1.2e13) " 1e13 " (fmt "~<8,00e" 1.2e13) "0001e13 " (fmt "~<8,-0e" 1.2e13) " 01e13" (fmt "~<8,-00e" 1.2e13) "00001e13" (fmt "~<8,+00e" 1.2e13) "+0001e13") (mtest (pic "") "" (pic "~") :error (pic "~z") :error (pic "#") :error (pic "# #" 1) :error (pic "# # #" 1 2) :error (pic "# # #" 1 2 3 4) :warning (pic "~<") "<" (pic "~>") ">" (pic "~|") "|" (pic "~#") "#" (pic "~0") "0" (pic "~+") "+" (pic "~-") "-" (pic "~.") "." (pic "~!") "!" (pic "~~") "~" (pic "x~~y") "x~y" (pic "~~x~~~~y~~") "~x~~y~") (mtest (pic "<" "a") "a" (pic "<<" "a") "a " (pic "<<<" "a") "a " (pic "~<<~>" "a") "" (pic "~<<<~>" "a") "" (pic "~<<<<~>" "a") "") (mtest (pic ">" "a") "a" (pic ">>" "a") " a" (pic ">>>" "a") " a" (pic "~>>~<" "a") ">a<" (pic "~>>>~<" "a") "> a<" (pic "~>>>>~<" "a") "> a<") (mtest (pic "|" "a") "a" (pic "||" "a") "a " (pic "|||" "a") " a " (pic "||||" "a") " a " (pic "|||||" "a") " a " (pic "|||||" "aaa") " aaa " (pic "|||||" "aaaaa") "aaaaa" (pic "|||||" "aaaaaa") "aaaaaa" (pic "~||~|" "a") "|a|" (pic "~|||~|" "a") "|a |" (pic "~||||~|" "a") "| a |") (mtest (pic "#" 0) "0" (pic "#" 0.0) "0" (pic "#" 0.1) "0" (pic "#" 0.7) "1" (pic "+#" 0.7) "+1" (pic "-#" -0.7) "-1" (pic "+#" -0.7) "-1" (pic "-#" 0.7) " 1") (mtest (pic "####" 1234) "1234" (pic "####" 1234.1) "1234" (pic "#" 1) "1" (pic "#.#" 1) "1.0" (pic "######" 1234.1) " 1234" (pic "######.#" 1234.1) " 1234.1" (pic "#######.##" 1234.1) " 1234.10" (pic "#######.##" -1234.1) " -1234.10" (pic "0######.##" 1234.1) "0001234.10" (pic "+######.##" 1234.1) " +1234.10" (pic "-######.##" 1234.1) " 1234.10" (pic "+0#####.##" 1234.1) "+001234.10" (pic "-0#####.##" 1234.1) " 001234.10") (mtest (pic "#!#" 1234) "#.#" (pic "#!#" 123) "#.#" (pic "#.#" 123) "123.0") (mtest (pic "-##!#" 12) " 12.0" (pic "+##!#" 12) "+12.0" (pic "-##!#" -123) "###.#" (pic "+##!#" 123) "###.#") (mtest (pic "###!" 123) "123" (pic "###." 123) "123." (pic "###!" 1234) "###") (mtest (pic "X##.#Y<<>>W" 1 2 3) "X 1.0Y2 Z 3W" (pic "~###.#~#<<<~#>>>~#" 1 2 3) "# 1.0#2 # 3#") (mtest (pic "#,#,#,#" 1234) "1,2,3,4" (pic "#,##,#" 1234) "1,23,4" (pic "##,##" 1234) "12,34" (pic "###," 1234) "1234," (pic ",###" 1234) ",1234" (pic "##,##" 1234.1) "12,34" (pic "#,###,###.###,###" 1234.1) " 1,234.100,000" (pic "#,###,###.##" -1234.1) " -1,234.10" (pic "0,###,###.##" 1234.1) "0,001,234.10" (pic "+#,##,###.##" 234.1) " +234.10" (pic "+#,##,###.##" 123456.7) "+1,23,456.70" (pic "+#,##,###.##" 1234.1) " +1,234.10" (pic "-#,##,###.##" 1234.1) " 1,234.10" (pic "+0,#####.##" 1234.1) "+0,01234.10" (pic "-0,#####.##" 1234.1) " 0,01234.10") (mtest (pic "$###,###!##" 234567.89) "$234,567.89" (pic "$###,###!##" 1234567.89) "$###,###.##" (pic "#,#,#!" 123) "1,2,3" (pic "#,#,#!" 1234) "#,#,#") (mtest (pic "(#,###,###.##)" 123456.56) " 123,456.56 " (pic "(#,###,###.##)" 1234566.56) " 1,234,566.56 " (pic "(#,###,###.##)" 12345667.56) "12,345,667.56 " (pic "(#,###,###.##)" 123456678.56) "123,456,678.56" (pic "(#,###,###.##)" -123456.56) "( 123,456.56)" (pic "(#,###,###.##)" -1234566.56) "(1,234,566.56)" (pic "(#,###,###.##)" -12345667.56) "(12,345,667.56)" (pic "(#,###,###.##)" -123456678.56) "(123,456,678.56)") (mtest (pic "(0,###,###.##)" 123456.56) " 0,123,456.56 " (pic "(0,###,###.##)" 1234566.56) " 1,234,566.56 " (pic "(0,###,###.##)" 12345667.56) "12,345,667.56 " (pic "(0,###,###.##)" 123456678.56) "123,456,678.56" (pic "(0,###,###.##)" -123456.56) "(0,123,456.56)" (pic "(0,###,###.##)" -1234566.56) "(1,234,566.56)" (pic "(0,###,###.##)" -12345667.56) "(12,345,667.56)" (pic "(0,###,###.##)" -123456678.56) "(123,456,678.56)") (test (let ((a 2) (b "###") (c 13.5)) (pic `abc@(+ a a)###.##@b>>>>` c "x")) "abc4 13.50### x") (test (pic "+0####.## <<<<<" 123 1) "+00123.00 1 ")