First, I am convinced it is not a very effective approach trying to test a function which was not written in a testable manner in conjunction with some "no change to the source code" policy. Often, some changes to the source code take only a small effort and have a very low risk of breaking somethinganything, but they reducewhilst reducing the effort of writing unit tests by an order of magnitude.
However, depending on the actual programming language, it may be possible to embed these functions into a testing environment where the variables system or database can be initialized by "test objects" or "mocks" from outside. That can make it possible to test the functions of your example without changing anything to thein source code of thosefile where the functions you want to test "lives".
For example, in C or C++, you might be able to utilize the preprocessor for this, or include files which are different in the test environment from the development enviroment. In Java or C#, you may be able to set up a newspecial test project, containing a "mock database"mock "database" and a "mock system"mock "system" object for this, and reference the "function under test" into this environment.
However, this is much easier if you change the code slightly in a way you can inject the "system" or the function system.day directly by the caller. Michael Feathers called this creating a seam in your code - a place where you can alter behavior without editing the code in place.