Part 2
Part 2 of singly linked list is a combination of exercises from geeksforgeek and improving my environment. You can find part 1 here.
Environment
I spent some time setting up a build and debug environment in Eclipse. Running Ceedling tests is a couple clicks and returns a nice report. My setup followed the advice from http://www.throwtheswitch.org/eclipse/. I’m currently running Eclipse 4.7.3a on Ubuntu 16.04. I did the bare minimum to get things running. The page includes improvements like clicking errors opens the source.
Debugging test failures uses the Eclipse debug perspective. This setup relies on the output executable from a Ceedling run. I can place breakpoints, trace execution, and inspect variables easily from within Eclipse. I created a new Debug Configuration as a C/C++ Application. C/C++ Application text box points to my executable .out that is created when running Ceedling. The debug configuration lets me place breakpoints and do normal C application debugging within the unit test.
Singly Linked List Exercises
I continued working the exercises at https://www.geeksforgeeks.org/data-structures/linked-list/ for the linked list data structure. Each new feature I added to the linked list has associated tests. The repo https://github.com/danaspisak/c-refresh has my progress. The setup is for Ceedling. It can be executed from the command line using ‘ceedling test:all’ as well.
Knocked the rust off my C pointer use without too much pain. Drawing out, pencil and paper, what I’m trying to do makes a difference. Boxes and arrows help figure out if you want an address of something, dereference it, or the address of the address. Writing recursive functions was an exercise. Recursive functions are avoided in embedded programming with an RTOS.
Next
Next up, either I work on variants of the linked list or move on to the stack. Doubly linked and circular are variations of the linked list. I’m eager to move on to a new data structure.