Testing cocoa touch static library code.

Discussion in 'iOS Programming' started by techwoman, Nov 3, 2015.

  1. techwoman macrumors newbie

    Joined:
    Nov 22, 2014
    Location:
    USA
    #1
    I am preparing for iOS interviews and since most of companies concentrate on data structures and algorithms, I thought of working on creating basic data structure and algorithms (DSA). I have always worked on adding/amending code in the existing app at work, but this is the first time I am creating something of my own from scratch.

    So I created a cocoa touch static library for my DSA project and I added linked list code to insert/delete nodes. I wish to test these methods, so I added another class with main() in it. The project builds fine, but when I run it nothing happens. It doesn't execute main method at all.

    Is adding the library to an app or testing the code through unit test are only methods to test it? What would be the best way to test my DSA code?
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Class with main in it? This is not Java.

    A static library doesn't do anything by itself. It has to be part of an app to be executed. I think you should be able to test it using unit tests.
     
  3. techwoman thread starter macrumors newbie

    Joined:
    Nov 22, 2014
    Location:
    USA
    #3
    Thanks PhoneyDeveloper!

    I changed the project type to be command line tool so I can execute the code through main() in command line.
     

Share This Page