Changeset e2776ff in mainline


Ignore:
Timestamp:
2020-08-27T14:41:26Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a57c70c
Parents:
32066f2
git-author:
Jiri Svoboda <jiri@…> (2020-08-26 18:41:05)
git-committer:
Jiri Svoboda <jiri@…> (2020-08-27 14:41:26)
Message:

Unit test for gfx_coord_div_rneg()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfx/test/coord.c

    r32066f2 re2776ff  
    3434PCUT_TEST_SUITE(coord);
    3535
     36/** gfx_coord_div_rneg rounds towards negative numbers */
     37PCUT_TEST(coord_div_rneg)
     38{
     39        PCUT_ASSERT_INT_EQUALS(-3, gfx_coord_div_rneg(-7, 3));
     40        PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-6, 3));
     41        PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-5, 3));
     42        PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-4, 3));
     43        PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-3, 3));
     44        PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-2, 3));
     45        PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-1, 3));
     46        PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(0, 3));
     47        PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(1, 3));
     48        PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(2, 3));
     49        PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(3, 3));
     50        PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(4, 3));
     51        PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(5, 3));
     52        PCUT_ASSERT_INT_EQUALS(2, gfx_coord_div_rneg(6, 3));
     53}
     54
    3655/** gfx_coord2_add should add two coordinate vectors */
    3756PCUT_TEST(coord2_add)
Note: See TracChangeset for help on using the changeset viewer.