Remove new line in console.log, Add console.write and console.writeline (console.write is an alias of console.log), update some lua scripts that depended on newline in console.log, add a console library lua unit test

This commit is contained in:
adelikat 2014-04-29 21:03:54 +00:00
parent 8f35b29a5c
commit bac7ba9a5d
5 changed files with 40 additions and 30 deletions

View File

@ -0,0 +1,9 @@
--console.clear()
--console.writeline("--cleared previous output")
--console.log("--Logging ", "multiple ", "values ", "in one ", "call", "\n")
--console.write("--console.write does not include a new line")
--console.writeline("--but console.writeline does")
--console.writeline("--next line")
--print("--Print Single value\n")
--console.writeline("--Log a lua table:")
console.log(joypad.get())

View File

@ -1,10 +1,10 @@
console.log("Game Info library test")
console.log("Rom Name: " .. gameinfo.getromname());
console.log("Rom Hash: " .. gameinfo.getromhash());
console.log("Display Type: " .. emu.getdisplaytype());
console.log("In Database?: " .. tostring(gameinfo.indatabase()));
console.log("Rom Status: " .. gameinfo.getstatus());
console.log("Is Status Bad?: " .. tostring(gameinfo.isstatusbad()));
console.log("Board Type: " .. gameinfo.getboardtype());
console.log("Game Options: ")
console.log(gameinfo.getoptions());
console.writeline("Game Info library test")
console.writeline("Rom Name: " .. gameinfo.getromname());
console.writeline("Rom Hash: " .. gameinfo.getromhash());
console.writeline("Display Type: " .. emu.getdisplaytype());
console.writeline("In Database?: " .. tostring(gameinfo.indatabase()));
console.writeline("Rom Status: " .. gameinfo.getstatus());
console.writeline("Is Status Bad?: " .. tostring(gameinfo.isstatusbad()));
console.writeline("Board Type: " .. gameinfo.getboardtype());
console.writeline("Game Options: ")
console.writeline(gameinfo.getoptions());

View File

@ -1,12 +1,12 @@
console.log("Unit test for joypad.set")
console.log("Core Required: NES (or any multi-player core with U,D,L,R,select,start,A,B as buttons)")
console.log("Correct behavior:")
console.log("No Directional button shoudl be imparied in any way, should operate as if nothing was ever pressed")
console.log("A should be off and user can not push buttons to change that")
console.log("B should be on and the user can not push buttons to change that")
console.log("Select should be on, but pressing it turns it off")
console.log("Start should be unaffected")
console.log("After frame 600, the console will say 'cleared', and now all buttons should be off and unaffected, as if the script was never run");
console.writeline("Unit test for joypad.set")
console.writeline("Core Required: NES (or any multi-player core with U,D,L,R,select,start,A,B as buttons)")
console.writeline("Correct behavior:")
console.writeline("No Directional button shoudl be imparied in any way, should operate as if nothing was ever pressed")
console.writeline("A should be off and user can not push buttons to change that")
console.writeline("B should be on and the user can not push buttons to change that")
console.writeline("Select should be on, but pressing it turns it off")
console.writeline("Start should be unaffected")
console.writeline("After frame 600, the console will say 'cleared', and now all buttons should be off and unaffected, as if the script was never run");
buttons = { };
@ -37,7 +37,7 @@ while true do
turnoff["Start"] = null;
joypad.set(turnoff, 1);
console.log("cleared")
console.writeline("cleared")
end
emu.frameadvance();

View File

@ -1,12 +1,12 @@
console.log("Unit test for joypad.set using the controller parameter")
console.log("Core Required: NES (or any multi-player core with U,D,L,R,select,start,A,B as buttons)")
console.log("Correct behavior:")
console.log("No Directional button shoudl be imparied in any way, should operate as if nothing was ever pressed")
console.log("A should be off and user can not push buttons to change that")
console.log("B should be on and the user can not push buttons to change that")
console.log("Select should be on, but pressing it turns it off")
console.log("Start should be unaffected")
console.log("After frame 600, the console will say 'cleared', and now all buttons should be off and unaffected, as if the script was never run");
console.writeline("Unit test for joypad.set using the controller parameter")
console.writeline("Core Required: NES (or any multi-player core with U,D,L,R,select,start,A,B as buttons)")
console.writeline("Correct behavior:")
console.writeline("No Directional button shoudl be imparied in any way, should operate as if nothing was ever pressed")
console.writeline("A should be off and user can not push buttons to change that")
console.writeline("B should be on and the user can not push buttons to change that")
console.writeline("Select should be on, but pressing it turns it off")
console.writeline("Start should be unaffected")
console.writeline("After frame 600, the console will say 'cleared', and now all buttons should be off and unaffected, as if the script was never run");
buttons = { };
@ -37,7 +37,7 @@ while true do
turnoff["Start"] = null;
joypad.set(turnoff, 1);
console.log("cleared")
console.writeline("cleared")
end
emu.frameadvance();

View File

@ -1,3 +1,4 @@
0 .\Lua\UnitTests\Joypad_Set.lua
0 .\Lua\UnitTests\Joypad_WithControllerNumbers.lua
0 .\Lua\UnitTests\GameInfo.lua
0 .\Lua\UnitTests\Console.lua