search the lab

Embedded Testing with Unity & CMock (by Mark)

Embedded Testing with Unity & CMock

James Grenning's book (features Unity)

Test Driven Development for Embedded C

Topics

« CException Intro | Main | Should I Download Unity, CMock, or Ceedling? »
Wednesday
Feb162011

Unity Intro

What is Unity?

Unity is a unit test framework written entirely in the C language. It is lightweight and possesses special features for embedded systems. Unity has scaled well from small to large embedded projects but can be used for any C project. At only one source file and a couple of header files, it doesn’t get much smaller.

  void test_ShowSomeSillyExamples(void)
  {
    TEST_ASSERT_NOT_EQUAL(0, -1);
    TEST_ASSERT_EQUAL_INT(1, 1);
    TEST_ASSERT_EQUAL_HEX16(0x1234, 0x1234);
    TEST_ASSERT_EQUAL_STRING("These Are The Same", "These Are The Same");
    TEST_ASSERT_BITS(0x1111, 0x5555, 0x7175);
    TEST_ASSERT_INT_WITHIN(5, 100, 102);
  }

Links

This page is meant to be a starting point... the launch page for learning more about Unity. If you have any problems, refer to the Science Forums which are for helping with any issues you might run into and requesting new features.