예제 #1
0
        //[Test, TestCaseSource("split_token_tests")]
        public void TestSplitContent(StringTest test)
        {
            Func <string[], FSStringList> of_array = (array) => ListModule.OfArray <string>(array);

            Func <FSStringList, string[]> to_string_array = (string_list) =>
            {
                var tl  = string_list;
                var res = new StringList();
                while (ListModule.Length <string>(tl) > 0)
                {
                    res.Add(ListModule.Head <string>(tl));
                    tl = ListModule.Tail <string>(tl);
                }

                return(res.ToArray());
            };

            //Assert.AreEqual(to_string_array(of_array(test.expected)), to_string_array(OutputHandling.split_token_contents(test.provided)));
        }
예제 #2
0
        /// <summary>
        /// <see cref=""/>
        /// </summary>
        /// <param name="test"></param>
        //[Test, TestCaseSource("smart_split_tests")]
        public void TestSmartSplit(StringTest test)
        {
            Regex           r = new Regex(@"(""(?:[^""\\]*(?:\\.[^""\\]*)*)""|'(?:[^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+)", RegexOptions.Compiled);
            MatchCollection m = r.Matches(@"'\'funky\' style'");

            Func <string[], FSStringList> of_array = (array) => ListModule.OfArray <string>(array);

            Func <FSStringList, string[]> to_string_array = (string_list) =>
            {
                var tl  = string_list;
                var res = new StringList();
                while (ListModule.Length <string>(tl) > 0)
                {
                    res.Add(ListModule.Head <string>(tl));
                    tl = ListModule.Tail <string>(tl);
                }

                return(res.ToArray());
            };

            //         Assert.AreEqual(to_string_array(of_array(test.expected)), to_string_array(OutputHandling.smart_split(test.provided)));
        }
예제 #3
0
 int ICollection <KeyValuePair <K, V> > .get_Count()
 {
     return(ListModule.Length <K>((FSharpList <M0>) this.keys));
 }