Beispiel #1
0
        public void Load()
        {
            string filename = Path.GetTempFileName();
            LatvianTokenizer tokenizer = new LatvianTokenizer();
            tokenizer.Save(filename);

            int count = 100;

            Stopwatch timer = new Stopwatch();
            timer.Start();
            for (int i = 0; i < count; i++)
            {
                LatvianTokenizer tokenizer2 = new LatvianTokenizer(filename);
            }
            timer.Stop();

            Debug.WriteLine("Load: {0:0.000} ms", timer.ElapsedMilliseconds / count);
            Debug.WriteLine("Load x{1}: {0:0.000} ms", timer.ElapsedMilliseconds, count);

            File.Delete(filename);
        }
Beispiel #2
0
        public void LoadSave()
        {
            string filename = Path.GetTempFileName();

            LatvianTokenizer tokenizer = new LatvianTokenizer();
            tokenizer.Save(filename);

            tokenizer = new LatvianTokenizer(filename);

            Token[] tokens = tokenizer.Tokenize("123 456").ToArray();
            Assert.AreEqual("123", tokens[0].Text);
            Assert.AreEqual("456", tokens[1].Text);
        }