OSDN Git Service

hbitmap: truncate tests
authorJohn Snow <jsnow@redhat.com>
Fri, 17 Apr 2015 23:50:04 +0000 (19:50 -0400)
committerKevin Wolf <kwolf@redhat.com>
Tue, 28 Apr 2015 13:36:11 +0000 (15:36 +0200)
commita94e87c08cfff73ac4b179adc3d0d9c3b8d2ddef
tree6356d593dbe44062cf52924dd1a978acc406683c
parentce1ffea8cdcea41533bde87759b8390f0e3a9ad3
hbitmap: truncate tests

The general approach is to set bits close to the boundaries of
where we are truncating and ensure that everything appears to
have gone OK.

We test growing and shrinking by different amounts:
- Less than the granularity
- Less than the granularity, but across a boundary
- Less than sizeof(unsigned long)
- Less than sizeof(unsigned long), but across a ulong boundary
- More than sizeof(unsigned long)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1429314609-29776-17-git-send-email-jsnow@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/test-hbitmap.c