I am writing a number of static libraries for the iPhone and wish also to have suites of unit tests. XCode 3 provides templates for both static libraries and unit tests but I am wondering how they should fit together in a static library project?
In my static library project I have created a target for unit testing but expect to also create an executable to kick off the unit tests than run against the classes in the static library.
What is the procedure for doing this?
Note that some classes of tests (like anything that would rely on the system calls such as [UIApplication sharedApplication] working require a separate target, while pure logic tests do not.
Create a new project with Unit Test and see what is added - basically you can do the same thing easily, create a new target and select "Unit Test Bundle" as the target type.
you have to add all your .m related files in the unit test target. (Just drag and drop!)
In case people still have problems with using static libraries:
I've created an article that explains how to create static libraries and how to use them within projects:
Xcode: The complete explanation on how to use static libraries:
http://www.sodeso.nl/?p=822
And for the unit testing part of static libraries, i don't have an explanation on how to set it up but i do have created a static library template that uses Google Toolkit for Map unit testing framework which you can download and add to your Xcode installation:
Xcode: Static library template with Google Toolkit for Mac Testing framework:
http://www.sodeso.nl/?p=982
Related
In kotlin standard library documentation i can see the following filters:
As far as i can gather, JVM means that internals of a package can be compiled into byte code, JS into javaScript and Native into binaries. But what does "Common" mean ?
Common means available for all platforms. It is an API that you can use directly in platform independent code in Kotlin Multiplatform projects.
Kotlin Multiplatform allows you to write common Kotlin code for multiple different platforms. For example, you could have a project with an Android app (using Kotlin/JVM for native Android applications) and a web interface (using Kotlin/JS). Then, you could share code between both subprojects.
As you have guessed correctly, JVM means it is available using Kotlin/JVM (compiling to Java bytecode).
If it is marked with JS, it is available for Kotlin/JS which transpiles the Kotlin code to JavaScript.
Finally, Native means it is available when using Kotlin/Native. This is different from compiling with native-image, which compiles JVM bytecode to native executables. For that, you would still use Kotlin/JVM.
If you write code in "common", then it can be compiled into any of the other targets, so you can share Kotlin code amongst the different platforms you are targeting. You can read more in the documentation.
As far as I know, kotlin native allows you to compile kotlin source code to platform specific nativ code, that runs without any virtual machine.
But I don't seem to find any example on how to build a windows executable (.exe) from kotlin source code.
Why is that?
Can you do it or not?
https://kotlinlang.org/docs/native-get-started.html shows you how to set up a basic Kotlin Native project, and compile it. The only note is that kotlin native will generate a .kexe, which is just a renamed .exe.
Is there any way relative simple to load Kotlin/Native dynamic library into Kotlin/JVM. Some details of my case: I have some Kotlin/JVM interface for example IGenerator:
interface IGenerator {
fun generate(): ByteArray
}
and I want to implement this interface using native code due to performance purpose. Without Kotlin/Native I would wrote a C/C++ code then compile it into shared library and build a JVM wrapper using for example SWIG (http://www.swig.org/). This tool generate JNI wrapper for my shared library and it'll be good to load into my Kotlin/JVM app.
So the question: is there a convenient way to load Kotlin/Native shared library into Kotlin/JVM application? I'd like to use any sort of Kotlin tooling without creation of separated wrappers or any other voodoo magic.
If you're using gradle, it's simple enough (:shared is Kotlin/Native Multiplatform project):
implementation project(':shared')
You can then use any K/N method written in :shared in your Kotlin/JVM project.
I have an application that uses the Vuforia SDK (https://www.vuforia.com/) and a feature that does not work in the simulator. I started writing unit tests for this application and I'm not sure why but when I run the tests, it also tries to build the main application and fails because there is no valid architecture for i386.
Is is possible NOT to build the main application? I'm only testing a couple of model classes and a XML parser, no need to build the whole application...
Thanks !
You could put the classes that need testing into a library or framework and make the tests depend on the library. These tests and library will not require the Vuforia SDK.
The executable is a separate target (or even project) depending on the library but is built after the tests.
The unit test target that is created for new projects is an Application Unit Test. It injects your test code into the app by setting BUNDLE_LOADER and TEST_HOST in the build settings. You can create a new unit test target and by default this will be a Logic Unit Test (BUNDLE_LOADER and TEST_HOST are not set). Then add the code you want to test to the new target as well as your app target. Change your scheme to the new target and run your unit tests.
New Target Dialog
Target Membership
Select Scheme
i just wanted to use eclipse tptp, a framework for static code analysis but the support for code analysis ended with tptp 4.5.0.
1. it seems that this version can not be integrated into the current eclipse galileo. am i right?
2. which language independant framework for eclipse would you use as an alternative for tptp static analysis which works with eclipse galileo?
I confirm the "Static Analysis" module of TPTP has been moved to the "as Is" (dormant) projects list, with a special set of instructions.
See this thread:
The owner of the static analysis component no longer work and contriube
resource in the project and due to the lack of additional resources to
support the component, PMC has decided to move it to as-is and there will be
no maintenance on the component supported by the project.
I do not know about another language independent framework for a static analysis tool on Eclipse.
Tools for Java are many, Findbugs being a good example (or Checkstyle, or PMD).
But for any language... I don't find any.