static void InitCases()
 {
     AddCase("async", "some async features", () => AsyncTest());
     AddCase("carrying", "one functional feature", () => Carrying.Test());
     AddCase("lazy", "lazy init", () => LazyTest.Process());
     AddCase("format", "string formatting", () => StringFormat.Test());
     AddCase("prop notify", "INotifyPropertyChanged example", () => INotifyPropertyChangedExample.Test());
     AddCase("linked list", "linked list example", () => LinkedListTest.Test());
     AddCase("rx", "reactive extensions example", () => ReactiveExtensions.Test());
     AddCase("immutable", "immutable list example", () => Immutable.Test());
     AddCase("fs watcher", "filesystem watcher example", () => FSWatcher.Test());
     AddCase("ext methods", "extension method example", () => ExtMethods.Test());
     AddCase("log wrapper", "reflection example", () => LogWrapper.Test());
 }
Exemple #2
0
        private static void LinkedList()
        {
            var linkedList = new LinkedListNode();

            linkedList.head = new LinkedListNode.Node(1);
            LinkedListNode.Node second = new LinkedListNode.Node(2);
            LinkedListNode.Node third  = new LinkedListNode.Node(3);

            linkedList.head.next = second;
            second.next          = third;

            PrintList(linkedList.head);
            Push(4, linkedList.head);

            LinkedListTest.PrintActions();
        }
Exemple #3
0
    private void Awake()
    {
        desiredDirection = Vector2.left * moveSpace;

        isAlive = true;

        gridPosition  = new Vector2(10, 10);
        gridMoveTimer = gridMoveTimerMax;

        linkedList  = new LinkedListTest();
        objMainHead = Instantiate(snakeBody, gridPosition, Quaternion.identity);
        objMainHead.gameObject.tag = "Player";

        objMainHead.transform.parent = gameObject.transform;

        linkedList.PushBack(objMainHead);
        maxBodyCount--;

        timer = Time.time + timerOffset;
    }
Exemple #4
0
        protected void TestLinkList()
        {
            ITestUnit unit = new LinkedListTest();

            unit.StartTest();
        }
 static void Main()
 {
     StackTest.Test();
     QueueTest.Test();
     LinkedListTest.Test();
 }
 static void Main(string[] args)
 {
     // ArrayTest.Show();
     LinkedListTest.Show();
 }
Exemple #7
0
    public static void Main(string[] args)
    {
        LinkedListTest llist = new LinkedListTest();


        String line;

        string resultString;
        string fullPath;

        try
        {
            //allows filepath to be entered into command line
            string filePath;
            //it will also work if you just put the 'name'.txt but better safe than sorry with the entire filepath
            Console.WriteLine("Enter Path to desired text file: ");
            filePath = @"" + Console.ReadLine();

            //the below also works if you would rather put the filepath in here and comment out line 96
            //filePath = @"inputNodes.txt";

            //checks filepath, if incomplete, will throw exception
            fullPath = Path.GetFullPath(filePath);
            Console.WriteLine("GetFullPath('{0}') returns '{1}'",
                              filePath, fullPath);

            FileInfo file = new FileInfo(filePath);
            //reads file
            StreamReader sr = new StreamReader(filePath);
            line = sr.ReadLine();

            //will read file until it reaches the end
            while (line != null)
            {
                if (line.StartsWith("i"))
                {   //performing append on the list if it starts with the i command and taking the number out by regular expression
                    resultString = Regex.Match(line, @"\d+").Value;
                    //putting the number into the linked list
                    llist.AppendNode(Int32.Parse(resultString));

                    line = sr.ReadLine();
                }
                else if (line.StartsWith("d"))
                {   //performing delete on the list if it starts with the d command and removing num by regex
                    resultString = Regex.Match(line, @"\d+").Value;
                    llist.DeleteNode(Int32.Parse(resultString));

                    line = sr.ReadLine();
                }
            }

            //printing the linkedlist
            llist.PrintList();

            //closed the file
            sr.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception: " + e.Message);
        }
    }
        public static void Main(string[] args)
        {
            CreateHeader();
            while (true)
            {
                Console.WriteLine("Input problem #:");
                string userInput     = "lis";
                int    problemNumber = 0;

                if (userInput == "sort")
                {
                    SortingAlgorithms SortingAlgorithms = new SortingAlgorithms();
                    SortingAlgorithms.Main();
                }
                else if (userInput == "LinkedList")
                {
                    LinkedListTest linkedList = new LinkedListTest();
                    linkedList.Main();
                }
                else if (userInput == "Fib")
                {
                    Fib fib = new Fib();
                    fib.Main();
                }
                else if (userInput == "lis")
                {
                    LISS lis = new LISS();
                    lis.Main();
                }
                else if (userInput == "search")
                {
                    SearchingAlgorithms search = new SearchingAlgorithms();
                    search.Main();
                }
                else
                {
                    bool validInput = Int32.TryParse(userInput, out problemNumber);
                    if (validInput)
                    {
                        switch (problemNumber)
                        {
                        case 1:
                            Problem1 problem1 = new Problem1();
                            problem1.Main();
                            break;

                        case 21:
                            Problem21 problem21 = new Problem21();
                            problem21.Main();
                            break;

                        case 29:
                            Problem29 problem29 = new Problem29();
                            problem29.Main();
                            break;

                        case 37:
                            Problem37 problem37 = new Problem37();
                            problem37.Main();
                            break;

                        case 44:
                            Problem44 problem44 = new Problem44();
                            problem44.Main();
                            break;

                        case 57:
                            Problem57 problem57 = new Problem57();
                            problem57.Main();
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }