Commit Graph

72 Commits

Author SHA1 Message Date
Sybren A. Stüvel
1fb3075803 Fixed build error on Windows / VS2015 2017-07-03 16:09:19 +02:00
Bastien Montagne
eeb9e5316a Make whole ID copying code use const source pointer.
Noisy change, but safe, and better do it sooner than later if we are to
rework copying code. Also, previous commit shows this *is* useful to
catch some mistakes.
2017-06-14 22:38:11 +02:00
Campbell Barton
1bd6ed7128 Correct gtest EXPECT use 2017-06-12 10:25:18 +10:00
Campbell Barton
eb1cde5a81 GTest: initial kdopbvh test
Currently only find-nearest, ray-casting needs to be added.
2017-06-11 19:10:33 +10:00
Sybren A. Stüvel
35f4abcf53 Alembic: simplified sub-frame sampling
It's now less confusing (for example, using nr_of_samples directly,
instead of using 1 / 1 / nr_of_samples). Might also have fixed a bug.

Also added unittests.
2017-05-30 13:47:51 +02:00
Sergey Sharybin
e4ab70da86 CMake: Add option to build against system-wide Glog
Similar to previous commit for Gflags.
2017-04-21 14:36:34 +02:00
Sergey Sharybin
c7a5c48cba CMake: Add option to link against system-wide Gflags library
It is disabled by default, so should not affect existing configurations.

Main benefits of this goes as:

- Linux distros can use that to avoid libraries duplication and link
  blender package against gflags package from the system.

- It it easier to test whether Blender works with updated version of
  Gflags prior to re-bundling the library.
2017-04-21 12:01:27 +02:00
Bastien Montagne
102966b12e Fix building alembic gtest with buildinfo... 2017-04-07 10:44:13 +02:00
Sybren A. Stüvel
fa827374a7 Alembic: rotation mode issue in copy_m44_axis_swap, and added unit tests. 2017-04-06 16:47:01 +02:00
Sybren A. Stüvel
b6775cd684 Added float[][] comparison macros to testing.h
I've moved EXPECT_M3_NEAR from abc_matrix_test.cc to testing.h, as that's
a more suitable location.
2017-04-06 16:47:01 +02:00
Sybren A. Stüvel
c2fec0f1b0 Alembic: Renamed create_rotation_matrix to create_swapped_rotation_matrix and more:
Also replaced the bool param "to_yup" with "AbcAxisSwapMode mode", so that
it's more explicit that axes are swapped.

Also added unittests for create_swapped_rotation_matrix.
2017-04-06 16:47:01 +02:00
Campbell Barton
bc0b5d611c Cleanup: minor edits to path test
No need for redundant ID's and correct arg order
2017-03-24 17:48:22 +11:00
Campbell Barton
50f9fc7a53 BLI_path_util: Add BLI_path_join
There weren't any convenient ways to join multiple paths in C
that accounted for corner cases.
2017-03-24 17:40:35 +11:00
Campbell Barton
d0253b2ea4 BLI_path_util: add BLI_path_name_at_index
Utility to get a file/dir in the path by index,
supporting negative indices to start from the end of the path.

Without this it wasn't straightforward to get
the a files parent directory name from a filepath.
2017-03-22 19:34:43 +11:00
Campbell Barton
f7d67835e9 Cleanup: typo in struct name 2017-02-28 00:38:33 +11:00
Sergey Sharybin
030e99588d Tests: Use proper order for EXPECT_EQ() 2017-02-03 12:03:59 +01:00
Sergey Sharybin
aea17a612d Tests: Use EXPECT_FALSE() instead of EXPECT_EQ(foo, false) 2017-02-03 11:52:47 +01:00
Sergey Sharybin
dc1b45ff1a Tests: Use EXPECT_TRUE() instead of EXPECT_EQ(foo, true) 2017-02-03 11:52:29 +01:00
lazydodo
64f5afdb89 [Cycles/MSVC/Testing] Fix broken test code.
Currently the tests don't run on windows for the following reasons

1) render_graph_finalize has an linking issue due missing a bunch of libraries (not sure why this is not an issue for linux)
2) This one is more interesting, in test/python/cmakelists.txt ${TEST_BLENDER_EXE_BARE} and ${TEST_BLENDER_EXE} are flat out wrong, but for some reason this doesn't matter for most tests, cause ctest will actually go out and look for the executable and fix the path for you *BUT* only for the command, if you use them in any of the parameters it'll happily pass on the wrong path.
3) on linux you can just run a .py file, windows is not as awesome and needs to be told to run it with pyton.
4) had to use the NAME/COMMAND long form of add_test otherwise $<TARGET_FILE:blender> doesn't get expanded, why? beats me.
5) missing idiff.exe for msvc2015/x64 in the libs folder.

This patch addresses 1-4 , but given I have no working Linux build environment, I'm unsure if it'll break anything there

5 has been fixed in rBL61751

Reviewers: juicyfruit, brecht, sergey

Reviewed By: sergey

Subscribers: Blendify

Tags: #cycles, #automated_testing

Differential Revision: https://developer.blender.org/D2367
2017-01-25 09:37:19 -07:00
Bastien Montagne
acbb84b021 Add BLI_string_utf8 specific test.
This test should ensure we correctly detect all invalid utf-8 sequences in a given string.

DISCLAIMER:
Do not run this with current code - you'll either laugh or cry, nearly *all* checks fail!

Based on utf-8 decoder stress-test (https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt)
by Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
2016-12-31 16:10:20 +01:00
Sergey Sharybin
ac655be0e3 Add GMock library which is responsive for dealing with mock objects 2016-07-29 22:19:30 +02:00
Bastien Montagne
d3b27bd19c Fix bmesh test after recent refactor. 2016-07-04 11:48:48 +02:00
Campbell Barton
475b7f5a2c BLI_array_utils: add BLI_array_rfindindex
Array search from back to front.
2016-06-23 11:36:49 +10:00
Campbell Barton
dccf5afbef BLI_rand: add BLI_rng_get_char_n
Use to fill an array of bytes to random values.
2016-06-12 00:41:02 +10:00
Bastien Montagne
1482826075 Add 'multi small' testcase to performance Ghash tests.
This new test simply inserts and lookup a lot of time on very small ghashes
(most are < 17 items).
2016-05-30 20:04:43 +02:00
Campbell Barton
8a7d1f3b3c BLI_array_store tests
Ensure the data is valid once expanded,
and that de-duplication is working as expected.
2016-05-30 16:27:12 +10:00
Campbell Barton
70fcecc1f7 Fix BLI_strncasestr use with a single character 2016-03-24 23:30:51 +11:00
Campbell Barton
80a7efdc1d UI: multi word filtering in search menu
D1080 by @rockets, with own improvements to tests
2016-03-23 18:51:29 +11:00
Bastien Montagne
fe9b21a44a Add GHash/GSet pop() feature.
Behavior is similar to python's set.pop(), it removes and returns a 'random' entry from the hash.

Notes:
* Popping will return items in same order as ghash/gset iterators (i.e. increasing
  order in internal buckets-based storage), unless ghash/gset is modified in between.
* We are keeping a track of the latest bucket we popped out (through a 'state' parameter),
  this allows for similar performances to iterators when iteratively popping a whole hash
  (without it, we are roughly O(n!), with it we are roughly O(n)...).

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1808
2016-02-20 15:28:25 +01:00
Bastien Montagne
2f7237ac78 Fix broken ghash performance gtest.
Regression from rB2dba2b3d71d9781bce45. Do not understand why MSVC needs this convoluted
allocation (looks like broken compiler crap?), but at least let's do it correctly!
2016-02-16 22:22:41 +01:00
Sergey Sharybin
2dba2b3d71 Fix gtests on Windows/MSVC
There were some missing stubs and some tests were specifically
written for Linux. Also, apparently MSVC has a limit of 64K for
the insource strings..
2016-02-06 21:21:55 +05:00
Sergey Sharybin
5508cc2d63 Fix typo in 32bytes aligned malloc test 2016-02-06 16:42:19 +01:00
Sergey Sharybin
e1f5b2b4c1 Fix GTests compilations on Windows
Unfortunately this doesn't make all tests compilable due
to all sort of weird and wonderful bad levels includes
on Windows (G referenced from bf_blenlib) but at least
allows to selectively build tests for now.
2016-02-06 15:12:28 +01:00
Campbell Barton
dea38d78c4 GTests: were using C++11 feature 2016-01-19 20:44:57 +11:00
Campbell Barton
9b8eb41567 GTests: split array_utils tests 2016-01-19 19:55:25 +11:00
Campbell Barton
4e6ad37fc1 GTests: array_utils 2016-01-19 08:23:08 +11:00
Sergey Sharybin
0e5e407007 Correct include directories for GTests 2016-01-04 22:16:14 +05:00
Bastien Montagne
6ca6d29e6b Fix memleaks in our gtests. 2015-12-28 23:19:24 +01:00
858b680a50 Eigen: move C API into intern/eigen. 2015-12-10 01:58:06 +01:00
Bastien Montagne
be72df4f06 BLI_math: add mat3_polar_decompose, interp_m3_m3m3 and interp_m4_m4m4.
mat3_polar_decompose gives the right polar decomposition of given matrix,
as a pair (U, P) of matrices.

interp_m3_m3m3 uses that polar decomposition to perform a correct matrix interpolation,
even with non-uniformly scaled ones (where blend_m3_m3m3 would fail).

interp_m4_m4m4 just adds translation interpolation to the _m3 variant.
2015-10-09 21:26:33 +02:00
Bastien Montagne
7837f0e833 BLI_math 'compare' cleanup & enhancements.
This commit:
* Adds a 'compare_ff' function for absolute 'almost equal' comparison of floats.
* Makes 'compare_vxvx' functions use that new 'compare_ff' one.
* Adds a 'compare_ff_relative' function for secured ulp-based relative comparison of floats.
* Adds matching 'compare_vxvx_relative' functions.
* Adds some basic tests for compare_ff_relative.

See https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Note that we could replace our python/mathutils' EXPP_FloatsAreEqual() by BLI's compare_ff_relative
(using a very small absolute max_diff), but these do not have exact same behavior...
Left a comment there for now, we can do it later if/when we are sure it won't break anything!
2015-07-10 15:02:43 +02:00
Bastien Montagne
079b41dd37 Remove WITH_TESTS_PERFORMANCE option.
Performance tests now have their own CMake macro, which ensures they do not get
added to ctest list, so we do not have to bother about them anymore, and can always
build them (when GTests are enabled, of course).
2015-06-29 20:26:58 +02:00
Bastien Montagne
117bcfe039 GTests: do not add 'performance' tests to auto-ran tests (with ctest or 'make test')... 2015-06-29 18:15:02 +02:00
Bastien Montagne
c68322c7e5 Cleanup: int/uint mismatch in printf... 2015-06-27 11:02:58 +02:00
Bastien Montagne
e170d6be7f Cleanup: all params of BLI_str partition funcs can be const... 2015-06-27 11:00:47 +02:00
Bastien Montagne
ff7a46cfad GTests for new 'end' option of BLI_str_partition_ex(). 2015-06-27 10:24:54 +02:00
Campbell Barton
6e844da9da GTest: add test for listbase sorting
Check for correct sort and stable order for matching values.
2015-06-10 20:26:56 +10:00
Campbell Barton
6fbb580e51 BLI_stack: gtest for clear 2015-06-03 18:09:12 +10:00
Sergey Sharybin
42e427905c CMake: Move performance tests under the cmake option
This way running full sweep of regression tests does not require
waiting for the performance test to finish.
2015-04-20 18:30:26 +05:00
Bastien Montagne
2941b4ad9b BLI GHash: add some basic gtests.
We could likely add much more, but those already covers basic behavior and should be able
to catch most errors when editing this code.

Also added some performances tests as well (timing ghash insert/lookup under heavy loads,
for different kinds of keys).
2015-03-19 19:50:51 +01:00