anchor.diff:  -module(imem_index).
   
   %% @doc == imem INDEX operations ==
  +
  +-define(TEST,t).
   
   -include("imem_meta.hrl").
   
  
positive.code:         b_convert(R,<<A/binary,$E>>);   
      b_convert(<<195,C,R/binary>>,A) when C >= 140, C =<  143 -> % Ì Í Î Ï 
          b_convert(R,<<A/binary,$I>>);   
      b_convert(<<195,C,R/binary>>,A) when C >= 146, C =<  148; C =:= 152 -> % Ò Ó Ô Õ Ö Ø
          b_convert(R,<<A/binary,$O>>);   
      b_convert(<<195,C,R/binary>>,A) when C >= 153, C =<  156 -> % Ù Ú Û Ü
          b_convert(R,<<A/binary,$U>>);   
  
negative.code: -include_lib("eunit/include/eunit.hrl").
  
  binstr_accentfold_test_() ->
      %UpperCaseAcc = <<"À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ Ÿ Œ Š Ž"/utf8>>,
      UpperCaseRaw = <<195,128,32,195,129,32,195,130,32,195,131,32,195,132,32,195,133,32,195,134,32,
                       195,135,32,195,136,32,195,137,32,195,138,32,195,139,32,195,140,32,195,141,32,
                       195,142,32,195,143,32,195,144,32,195,145,32,195,146,32,195,147,32,195,148,32,
                       195,149,32,195,150,32,195,152,32,195,153,32,195,154,32,195,155,32,195,156,32,
                       195,157,32,195,158,32,197,184,32,197,146,32,197,160,32,197,189>>,
  
      UpperCaseUnn = <<"A A A A A A AE C E E E E I I I I D N O O O O O O U U U U Y TH Y OE S Z">>,
  
      %LowerCaseAcc = <<"à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ œ š ß ž"/utf8>>,
      LowerCaseRaw = <<195,160,32,195,161,32,195,162,32,195,163,32,195,164,32,195,165,32,195,166,32,
                       195,167,32,195,168,32,195,169,32,195,170,32,195,171,32,195,172,32,195,173,32,
                       195,174,32,195,175,32,195,176,32,195,177,32,195,178,32,195,179,32,195,180,32,
                       195,181,32,195,182,32,195,184,32,195,185,32,195,186,32,195,187,32,195,188,32,
                       195,189,32,195,190,32,195,191,32,197,147,32,197,161,32,195,159,32,197,190>>,
      LowerCaseUnn = <<"a a a a a a ae c e e e e i i i i d n o o o o o o u u u u y th y oe s ss z">>,
  
      [?_assertEqual(UpperCaseUnn,binstr_accentfold(UpperCaseRaw)),
       ?_assertEqual(LowerCaseUnn,binstr_accentfold(LowerCaseRaw))
      ].
  
  binstr_casemod_test_()->
      %UpperCaseAcc = <<"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789[]{}À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ Ÿ"/utf8>>,
      %LowerCaseAcc = <<"abcdefghijklmnopqrstuvwxyz0123456789[]{}à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ"/utf8>>,
      UpperCaseRaw = <<65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,48,49,50,51,52,53,54,55,56,57,91,93,123,125,195,128,32,195,129,32,195,130,32,195,131,32,195,132,32,195,133,32,195,134,32,195,135,32,195,136,32,195,137,32,195,138,32,195,139,32,195,140,32,195,141,32,195,142,32,195,143,32,195,144,32,195,145,32,195,146,32,195,147,32,195,148,32,195,149,32,195,150,32,195,152,32,195,153,32,195,154,32,195,155,32,195,156,32,195,157,32,195,158,32,197,184>>,
      LowerCaseRaw = <<97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,91,93,123,125,195,160,32,195,161,32,195,162,32,195,163,32,195,164,32,195,165,32,195,166,32,195,167,32,195,168,32,195,169,32,195,170,32,195,171,32,195,172,32,195,173,32,195,174,32,195,175,32,195,176,32,195,177,32,195,178,32,195,179,32,195,180,32,195,181,32,195,182,32,195,184,32,195,185,32,195,186,32,195,187,32,195,188,32,195,189,32,195,190,32,195,191>>,
      [?_assertEqual(UpperCaseRaw,binstr_to_upper(LowerCaseRaw)),
       ?_assertEqual(LowerCaseRaw,binstr_to_lower(UpperCaseRaw))].
  
  binstr_to_lcase_ascii_test_() ->
      [{"empty",?_assertEqual(<<>>,binstr_to_lcase_ascii(<<"">>))},
       {"from binary",?_assertEqual(<<"aaaeee">>,binstr_to_lcase_ascii(<<"AÀäëéÈ"/utf8>>))},
       {"from list",?_assertEqual(<<"aaaeee">>,binstr_to_lcase_ascii("AÀäëéÈ"))},
       {"from atom",?_assertEqual(<<"atom">>,binstr_to_lcase_ascii(aTom))},
       {"from tuple",?_assertEqual(<<"{\"aaaeee\"}">>,binstr_to_lcase_ascii({"AÀäëéÈ"}))},
       {"from integer",?_assertEqual(<<"12798">>,binstr_to_lcase_ascii(12798))},
       {"from random",?_assertEqual(<<"12798">>,binstr_to_lcase_ascii(<<71,191,58,192,88,82,194,42,223,65,187,19,92,145,228,248,
    26,54,196,114>>))}
       ].
  
  -endif.
  