Is there a way to add custom launch arguments for lime? (For example, different game types compiled with "lime test windows -example") - haxeflixel

I have an idea for a game with multiple types with differences, sharing all the same base code (think Pokemon, but with more difference) is there a way to do that? For example, using #if example --code-- #end, like html5/windows specific content? And if so, how would you build it (lime test windows -example)?

Based on lime help:
-Dvalue -- Specify a define to use when processing other commands
So by executing lime test windows -Dmydefine you should then be able to use the compiler define to do conditional compilation in your code :
#if mydefine
// your specific code
#end
Is it what you are looking for ?

Related

Stepping through code in Google Apps Script (equivalent VBA-GAS )

When writing my VBA macros I often used "F8" so as to debug the macro line by line. Is there a similar feature in Google Apps Script?
Similar, but not the same.
Google Apps Script is developed in a dedicated IDE1 called the Script Editor, which provides support for single-step execution and breakpoints, among other things.
For a quick introduction to debugging using the IDE, see this video. The Troubleshooting section of the online documentation includes a quick overview of the basics.
Debugging Functions with parameters
In the IDE you can select any function in your script for execution, and then select the "run" or "Debug" icons to start. Unfortunately, there is no way to pass parameters to a function this way, so here are a few ways you can deal with that.
Set defaults. There are numerous ways to define defaults in javascript, here is a picture of the debugger operating on a function using the simplest of them. The function toText() from this answer accepts a number as a parameter, so for this example we are forcing the default value to 21. The picture shows the debugger paused at line 40; if we continue stepping through the function we expect to end up with a result s == 'Twenty-one'.
Write a test function. This is a better approach than setting defaults, because it allows you to write multiple test cases, and it avoids polluting your target function with debug code. As an example, the target function flipFlopAndFly() and its test function test_flipFlopAndFly() were provided in this answer. The test function accesses the spreadsheet to provide appropriate data for testing the target, so we can easily modify the data for different tests. Note also, this function includes error checking, so it would not be appropriate to test by forcing default values.
There are many variations on these basic patterns, so feel free to adapt them to your own situation. It will help your debugging capability to think while you are writing about how you would step through your code:
Is each important object and value stored in a var, so you can see it?
Is your function result (return value) in a var?
Custom Functions
When developing or debugging custom functions that will be called from a spreadsheet, remember that you cannot "jump" into the IDE. If you need to step through the script, you will need to work entirely within the IDE to observe execution of your code. You can use the techniques described above to debug custom functions.
1 Integrated Development Environment

Replicate class with main method as in Java IDE within Objective-C and Xcode 4

I have a simple question. Coming from a java background and having worked extensively with eclipse, netbeans or any other java IDE, is quite nice to have the possibility to add a main method to a class and execute it within the IDE, with just a click, and see the output.
I was looking for the same possibility within xcode4/objective-c but I couldn't find a way. From time to time, I like testing small piece of software, without compiling and running the whole project.
As I am still "thinking" in Java, could you suggest the proper way to achieve this with xcode4 from an "objective-c developer point of view" ?
thanks
There's not really a lightweight way to do this, but you have two options that I can think of depending on whether you want to keep the harness code you've written.
If you do, then you'd need to make a new target in your project for each class you drive with a harness, and have that target build just the class you are driving and a simple file with just the main code to drive that class.
If you don't, then you could make a target with a main, and each time you want to drive a different class, change which files are built, change the code in main, and rebuild.
This is assuming that you want to avoid both running and compiling the rest of your code. If you don't mind compiling everything, you could have one test-harness target that builds all of your classes, and either change main on the fly, or use #ifdefs or a runtime argument to decide which helper code to run.

Does there exist an established standard for testing command line arguments?

I am developing a command line utility that has a LOT of flags. A typical command looks like this:
mycommand --foo=A --bar=B --jar=C --gnar=D --binks=E
In most cases, a 'success' message is printed but I still want to verify against other sources like an external database to ensure actual success.
I'm starting to create integration tests and I am unsure of the best way to do this. My main concerns are:
There are many many flag combinations, how do I know which combinations to test? If you do the math for the 10+ flags that can be used together...
Is it necessary to test permutations of flags?
How to build a framework capable of automating the tests and then verifying results.
How to keep track of a large number of flags and providing an order so it is easy to tell what combinations have been implemented and what has not.
The thought of manually writing out individual cases and verifying results in a unit-test like format is daunting.
Does anyone know of a pattern that can be used to automate this type of test? Perhaps even software that attempts to solve this problem? How did people working on GNU commandline tools test their software?
I think this is very specific to your application.
First, how do you determine the success of the execution of you application? Is it a result code? Is it something printed to the console?
For question 2, it depends how you parse those flags in your application. Most of the time, order of flags isn't important, but there are cases where it is. I hope you don't need to test for permutations of flags, because it would add a lot of cases to test.
In a general case, you should analyse what is the impact of each flag. It is possible that a flag doesn't interfere with the others, and then it just need to be tested once. This is also the case for flags that are meant to be used alone (--help or --version, for example). You also need to analyse what values you should test for each flag. Usually, you want to try each kind of possible valid value, and each kind of possible invalid values.
I think a simple bash script could be written to perform the tests, or any scripting language, like Python. Using nested loops, you could try, for each flag, possibles values, including tests for invalid values and the case where the flag isn't set. I will produce a multidimensional matrix of results, that should be analysed to see if results are conform to what expected.
When I write apps (in scripting languages), I have a function that parses a command line string. I source the file that I'm developing and unit test that function directly rather than involving the shell.

Change build behavior in XCode?

Is there any way to change how XCode compiles my code without completely reprogramming the compiler? Specifically, I want to add a keyword that when used, will invoke a certain behavior for the program. Does anybody know if this is possible?
compiler directives/macros like #define are one way you can go about this. For example objective-c originally started out as compiler directives and unix commands.
Likely what you want to do can be accomplished in a different way. You might want to look into the template system that apple has for interface builder to allow you to add your own objects to IB. Have a look at this question for more.

Supply parameters to NUnit tests at run time

NUnit 2.5 adds support for parameterized tests with attributes like ValuesAttribute and ValueSourceAttribute so that one can write something like:
[Test]
public void MoneyTransfer(
[Values("USD", "EUR")]string currency,
[Values(0, 100)]long amount)
{
}
and get all permutations for parameters specified. Priceless. However, it would be cool to specify (override) those parameters directly in NUnit GUI before pressing 'Run'. Unfortunately there is no such functionality in NUnit (yet?). Is there an alternative tool or testing framework allowing me to specify parameters before running a test (something like i can provide parameters in WcfTestClient.exe)?
One option could be to try out the TestCaseSource attribute that's supported - basically, you can define an IEnumerable method as source of data for a test - and within that, you can look anywhere you like for test data - could be to pull from a database/flat file/iterater round files in a given directory etc.
Have a look at that, it's a handy thing to know about.
Unit test are supposed to run automatically and be reproducible. By changing test at runtime you break this behavior.
So I don't think this is something you want to do...