summaryrefslogtreecommitdiffstats
path: root/tests/test-bitmap.c
Commit message (Collapse)AuthorAgeFilesLines
* mingw: fix error __USE_MINGW_ANSI_STDIO redefinedMarc-André Lureau2020-10-131-1/+0Star
| | | | | | | | | | | Always put osdep.h first, and remove redundant stdlib.h include. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201008165953.884599-1-marcandre.lureau@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* tests: use g_test_rand_intPaolo Bonzini2019-12-171-4/+4
| | | | | | | | | | | | | g_test_rand_int provides a reproducible random integer number, using a different number seed every time but allowing reproduction using the --seed command line option. It is thus better suited to tests than g_random_int or random. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1576113478-42926-1-git-send-email-pbonzini@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
* test-bitmap: test set 1 bit case for bitmap_setWei Yang2019-08-201-0/+12
| | | | | | | | | | All current bitmap_set test cases set range across word, while the handle of a range within one word is different from that. Add case to set 1 bit as a represent for set range within one word. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* test-bitmap: add test for bitmap_setWei Yang2019-07-191-0/+55
| | | | | | | | | | | | | Add a test for bitmap_set. There are three cases: * Both start and end is BITS_PER_LONG aligned * Only start is BITS_PER_LONG aligned * Only end is BITS_PER_LONG aligned Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Message-Id: <20190718010456.4234-3-richardw.yang@linux.intel.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* bitmap: Add bitmap_copy_with_{src|dst}_offset()Peter Xu2019-07-151-0/+72
These helpers copy the source bitmap to destination bitmap with a shift either on the src or dst bitmap. Meanwhile, we never have bitmap tests but we should. This patch also introduces the initial test cases for utils/bitmap.c but it only tests the newly introduced functions. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20190603065056.25211-5-peterx@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> --- Bitmap test used sizeof(unsigned long) instead of BITS_PER_LONG.