I have an interesting situation where I am refactoring a bunch of ObjC iPhone code to create a C++ API. I'm a novice to C++ and looking into C++ mocking frameworks to augment the work I'd done using OCUnit and poor man's mocks. I ran across googlemock and wanted to know if anyone has ever used it for iPhone development? Also, how can I share this (or mockpp) with other devs as it is an installable package and doesn't seem to lend itself to checking into a repository?
I've never used Googlemock for iPhone development, but have used it plenty on Windows and various UNIXes.
It uses standard modern C++ with TC1 (Technical Corrigenda 1) so can compile on any up to date, compliant compiler.
If your development environment doesn't implement TC1, then Google also include a subset of the Boost library that implements Tuples, which is the part of TC1 that Googlemock depends on.
Basically, if your compiler can handle templates, it should be able to handle Googlemock.
You can download the full source from Googlecode and this is what you might want to check into your repository.
For the Objective-C code you might consider Kiwi (http://www.kiwi-lib.info/mocks_and_stubs.html). It is a great bdd framework with nice mock/stub support.
Related
I have a small library that is ported to different platforms (win, os x, ios, android) that I am using in some small personal utilities and I am starting to look into testing more thoroughly.
Right now, I am using NUnit to test the windows version, with test cases written in c#. The setup just basically loads the dll and the test cases make various calls to the library. I want to duplicate this testing on the other platforms. I know there are other xUnit type frameworks to accomplish this on the other platforms, JUnit etc., but I would rather not have to rewrite the test cases for each platform.
Is there a recommended way to have one set of test cases and just point them to one of the libraries to run against that platform?
I still consider myself a novice programmer, so apologies if it's not possible and the question is naive.
Thanks
Due to the nature of unit testing(testing individual procedures or functions rather than overall program functionality as in blackbox testing ), and different languages supports different language specific features, there cannot exist a universal unit testing framework that supports all programming languages (in your case, Java, C#, Objective-C ). That's why we have xUnit framework for different languages.
Even if someone creates such framework, it would not be possible to properly test functions that uses language specific features.
I want to develop a new powerful GUI for an existing C++ application. I planned to do it as a standalone project in C++/QT, and it would communicate client-server with the existing application.
Recently I've been told that there is another possibility, to create such GUI using Eclipse. I mean that Eclipse can serve not only as an IDE, but also as some kind of framework for new applications.
Is it so?
Is it a good idea to use Eclipse in this way? What to consider?
Can such development be C++ based, or only Java based?
Yes, absolutely, the Eclipse "Rich Client Platform" is an application framework comparable to Qt, in some ways, and superior in other ways. RCP's frameworks are generally more sophisticated and more powerful than anything in Qt. Yes, I realize I'm inviting flames, because people do have religious wars over this. I don't care, I'm entitled to my opinion.
You could include C++ code in your application using the JNI API, but in general, the bulk of the development would be in Java. Ultimately, the deciding factor may just be the resources and skills you have available -- does your team know Java, or not.
As others have said, Eclipse is a platform, not just an IDE, but development using it is definitely in Java. Here's some reference material in case you decide to pursue this approach:
http://wiki.eclipse.org/index.php/Rich_Client_Platform
http://www.vogella.de/articles/EclipseRCP/article.html
Eclipse is built with its own GUI framework - SWT. It is Java-based but apparently there is a way to use it from native C++.
Eclipse is indeed a platform, with the cross-platform UI toolkit SWT and the OSGi plug-in system at its heart. Look at Android: a lot of the operating system is coded in C++, with hooks for normal UI development with Java. This is kind of what you need to do. Be aware that JNI is a pain and is certainly not easy to use, but I'd advise Java for everything except for code that needs to be accelerated, which you would do in C++. Java is fast enough for most tasks.
You can certainly do that. You might also consider Netbeans or Qt's own IDE as well.
I want to know if anyone of you guys use TDD in your c++ projects and how it performs compared to managed languages like C# and Java.
And what frameworks you guys are using to automate tests on c++ projects?
Two useful C++ test frameworks that don't seem to have been mentioned yet are Boost test and Google Test.
Test Driven Development is possible in any language. You need the right testing tools and methodologies for the language, and may possibly need a custom testing infrastructure for your project.
I have found CppUnit (at least 1.x) to be a very poor framework -- it seems to use Java/C# idioms in a C++ language and does not have support for STL constructs.
If you want a good example of Test Driven Development (in C), look at the Wine project -- http://test.winehq.org/data/ shows their test results across the different versions of Windows, Wine and the different commits into the Wine repository. They have their own custom test infrastructure.
I recently moved from a C# project that was developed using TDD to a project that is using C++. I was dreading it quite a bit, but I find that doing C++ with TDD is a lot more enjoyable and the code is more robust than I remember from past (non-TDD) experiences with C++.
We are using Google Test. It is not as easy to use as NUnit/MbUnit, but it seems to work pretty well. There is also a Google mocking framework http://code.google.com/p/googlemock , but I have not been using that yet.
Does anyone know of a C++ unit-testing framework (e.g. CppUnit, Google Test, etc.) that can be used to write tests on z/OS?
I do most of my development on Windows using the Dignus C++ compiler, which you can use as a cross-compiler and generate object code to run on z/OS. I tried writing a sample test using Google Test, but the compiler could not compile/link the Google Test code. Google Test does not claim to support z/OS, so this was expected. But, it was worth a try!
Thanks so much for any responses this!
Try CPP Unit Lite (by CppUnit's author). It uses fairly straightforward C++ code, there's a good chance it'll work on z/OS's compiler.
I know I'm late to the party here but for anybody interested in C++ testing frameworks on z/OS I highly recommend the Catch framework which IMO easily surpasses all other C++ testing frameworks I've used. I've been using it on z/OS for about 6 months and it's a breath of fresh air. It's very easy and intuitive to use and has support for Behavior Driven Development (BDD) style tests which is a contemporary way of writing test cases.
It's header only and doesn't rely on any C++11 features which is common pitfall when trying to build modern libraries/frameworks on z/OS as the C++ compiler has limited C++11 support.
The only nit I can think of is compiles take a while because it's a header only library. But nowhere near as long as boost.
Perhaps you could open a bug report for Google Test and see if they fix it? There is probably an ASCII dependency in the code somewhere that caused the test code compile to fail. Could you dig into the error message that the IBM compiler produced?
Are their any libraries which provide functionality similar to mono but for the c++ language? I know boost exists, but I like mono much more than boost.
I'm looking to do more than what's available in the base library set, like play sound more easily (crossplatform), GUI, load images, time, etc. I guess I am looking for what people might consider an engine or a large library.
Mono is a .NET implementation. Mono is NOT a library.
There is NO Mono for C++. At least, not yet.
I think you want a multi-platform framework, such as Qt
If you're wanting to work with Managed C++ a la .Net, then you would just use Mono. They have a page describing how to go about it. The only catch is that you have to compile on Windows, as there is not yet any flavor of GCC that outputs .Net CLI for C++.
To be honest, though, if you're going to use Mono, you might as well move into C#. It's a much cleaner language, IMO.
CLI is only able to host C++ compiled code on all supported platforms as long as the compiled code only contains CIL not native code.
for more detail visit
http://www.mono-project.com/CPlusPlus
I'm not sure about your precise requirements, but in terms of large multi-purpose packages: Qt has been mentioned by a few folks. wxWidgets (formerly wxWindows) is another option. GTK is multiplatform.
As you use the word "engine" (often a game-related term), you might be interested in SDL, which has been used by numerous games, professional and amateur alike. SFML is an option. ClanLib is another long-lived library I've heard of, though I'll admit to knowing little about it.
Try the STL collections...Has nothing to do with .NET, but they are a nice collection of collections (lol) and make C++ life easier.
It sounds like what you are really looking for is a C++ framework that offers the kinds of functionality found in the .NET/Mono framework. Qt is a popular choice.
On the topic of C++ interoperability, Mono has recently made some pretty big strides with CXXI.
(From this posting): The short story is that the new CXXI technology allows C#/.NET developers to:
Easily consume existing C++ classes from C# or any other .NET
language
Instantiate C++ objects from C#
Invoke C++ methods in C++ classes from C# code
Invoke C++ inline methods from C# code (provided your library is compiled with -fkeep-inline-functions or that you provide a surrogate
library)
Subclass C++ classes from C#
Override C++ methods with C# methods
Expose instances of C++ classes or mixed C++/C# classes to both C# code and C++ as if they were native code.
CXXI is the result of two summers of work from Google's Summer of Code towards improving the interoperability of Mono with the C++ language.