Skip to content

Instantly share code, notes, and snippets.

@timothyandrew
Created April 19, 2012 20:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothyandrew/8139eefcd58abe9ff6d5 to your computer and use it in GitHub Desktop.
Save timothyandrew/8139eefcd58abe9ff6d5 to your computer and use it in GitHub Desktop.
Generate test cases for unicode normalizer
import java.text.Normalizer;
import java.util.Random;
import org.apache.lucene.util._TestUtil;
public class NormalizeTestGen {
public static void main(String[] args){
String random = org.apache.lucene.util._TestUtil.randomRealisticUnicodeString(new Random());
System.out.print("NFD.normalize(\"");
System.out.print(random);
System.out.print("\").should == \"");
System.out.print(Normalizer.normalize(random, Normalizer.Form.NFD));
System.out.println("\"");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment