Exemple #1
0
        public void OneWord()
        {
            string[] words  = { "hola" };
            string[] output = finder.Find(words);

            Assert.AreEqual(null, output[0]);
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            Android.Content.Res.AssetManager assets = this.Assets;

            asFuck.LoadList(assets.Open("english-words.txt"), 5);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            EditText wordList            = FindViewById <EditText>(Resource.Id.wordList);
            EditText availableCharacters = FindViewById <EditText>(Resource.Id.input);
            TextView wordsFound          = FindViewById <TextView>(Resource.Id.textWordCount);
            Button   search = FindViewById <Button>(Resource.Id.searchButton);
            Button   soduku = FindViewById <Button>(Resource.Id.sodSolver);


            search.Click += (sender, e) =>
            {
                wordList.Text = string.Empty;
                var matches = asFuck.Find(availableCharacters.Text);
                wordsFound.Text = string.Format("Found {0} words.", matches.Count);
                matches.ForEach(w => wordList.Text += string.Format("{0}\n", w));
            };

            soduku.Click += (sender, e) =>
            {
                var intent = new Intent(this, typeof(SentenceSolver));
                StartActivity(intent);
            };
        }
Exemple #3
0
        public void TestFindsTwoWords()
        {
            var af = new AnagramFinder();

            af.LoadList("TestWords.txt", 4);
            var words = af.Find("evil");

            words.ForEach(a => Console.WriteLine(a));

            Assert.AreEqual(2, words.Count);
        }
Exemple #4
0
        public void ProcessingWordListFor6LettersAnagrams_FindsSome()
        {
            var readableFinder = new FixedSizeAnagramFinder(@"C:\Users\Etienne\Documents\GitHub\codekatas\wordlist.txt", 6);
            int count1         = readableFinder.Find().Count();

            Assert.NotEqual(0, count1);

            var extendableFinder = new AnagramFinder(
                new FileBasedWordListProvider(@"C:\Users\Etienne\Documents\GitHub\codekatas\wordlist.txt"),
                new FixedSizeAnagramValidator(6)
                // TODO: Inject find algo...
                );
            int count2 = extendableFinder.Find().Count();

            Assert.Equal(count1, count2);
        }