Usually, when I write software, I use unit tests for each function to test if it is working without any problems. However, recently I have found myself writing some software that are not really amenable to unit testing. For example, writing code for an operating system, where standard libraries are not available. Another example is writing the constraints of an Integer Linear Programming problem, where no solution can be seen until all the constraints have been added. In these cases, I have struggled to debug my code, since identifying which part of the code is causing problems has been very difficult. Any suggestions how to deal with these cases?
Update: I wanted to write the page-mapping functionality of an operating system. The system used 4-level paging. My code used one function each to go from one level of page table to the next. Although I knew the algorithm was right, the system was not working as expected. However, I was not able to find out which function was creating the problem, since it was impossible to know the exact correct output of each function. Instead, I had to do an endless series of trials and errors (something that took me over a week) to find out the problem.