Commit Graph

16 Commits

Author SHA1 Message Date
Campbell Barton
7a977df6d4 Refactor array_utils out of BLI_array
BLI_array.h is for resizing array macros, where as array_utils can operate on any arrays.
2015-02-14 08:00:41 +11:00
Bastien Montagne
16ed20ff3c Add some BLI helpers needed by asset branch.
`BLI_strncpy_ensure_pad()` is also useful with current master code.

The two others (`BLI_strcmp_ignore_pad()` and `BLI_filelist_duplicate()`)
are only used in asset branch currently, but think they could be useful
in other places too, and simplifies handling of asset branch & future patch review.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D965
2015-01-03 10:13:44 +01:00
Campbell Barton
6b8b3badf5 GTest: test beautify with polyfill 2015-01-03 18:05:18 +11:00
Bastien Montagne
64c0c13e6e Add Murmur2A hashing feature to BLI
Murmur2a is a very fast hashing function generation int32 hashes.
It also features a very good distribution of generated hashes.

However, it is not endianness-agnostic, meaning it will usually generate
different hashes for a same key on big- and little-endian architectures.
Consequently, **it shall not be used to generate persistent hashes**
(never store them in .blend file e.g.).

This implementation supports incremental hashing, and is a direct
adaptation of reference implementation (in c++):
https://smhasher.googlecode.com/svn-history/r130/trunk/MurmurHash2.cpp

That cpp code was also used to generate reference values in gtests file.

Reviewers: sergey, campbellbarton

Reviewed By: campbellbarton

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D892
2014-11-14 11:00:26 +01:00
Campbell Barton
503484c978 GTest: polyfill2d
Collection of test cases from libGDX and our own tracker

Tests:

- combine triangle area matches polygon area.
- tris have same winding.
- tris don't have duplicates.
- correct number of internal & boundary edges.
- degenerate polys still give topologically correct output.

also checks all possible start-vert offsets, forwards and backwards.

optional OBJ output, for debugging.
2014-09-28 21:43:15 +10:00
Campbell Barton
a4c3b92294 BLI_Stack add BLI_stack_peek, BLI_stack_discard
also remove own incorrect assert
2014-09-28 15:08:54 +10:00
Nicholas Bishop
1c8ac33970 Fix incorrect comments in listbase, add unit test to verify change
Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D708
2014-08-05 10:33:24 -04:00
Campbell Barton
f7d6749e2f Cleanup: test naming 2014-07-19 20:02:14 +10:00
Campbell Barton
4cc93123c8 Add thousands separators to scene stats (D646)
by januz with own modifications
2014-07-17 14:54:12 +10:00
Campbell Barton
5c4180d898 BLI_stack: various small additions
- add BLI_stack_count
- add BLI_stack_pop_n to pop into an array
- add BLI_stack_push_r, which returns a pointer that can be filled in

Also remove sanity check in BLI_stack_pop, assert if the stack is empty.
2014-07-15 21:09:03 +10:00
Campbell Barton
ea1f1fe0c2 BLI_string, dont pass unicode to ascii BLI_str_partition functions 2014-07-08 06:06:34 +10:00
Bastien Montagne
e3c8cf0a9e Add (r)partition funcs to BLI_string, to get left-most/right-most first occurence of delimiters.
Inspired by Python (r)partition str functions. Also added some Gtest cases for those new funcs.

Reviewed by Campbell Barton, many thanks!
2014-07-04 14:14:06 +02:00
Campbell Barton
228361973d Add BLI_stack test 2014-06-30 11:55:01 +10:00
Campbell Barton
8df6769040 CMake: update source files 2014-06-28 23:17:11 +10:00
Campbell Barton
7ecc3f4734 Add brief license headers to tests
These are effectively public-domain, but use apache2.0 to avoid adding new licenses
2014-06-19 18:48:41 +10:00
Sergey Sharybin
306cbb82ec GTest unit testing framework
Currently covers only small set of functionality.
2014-06-19 02:09:16 +10:00