Skip to content

Commit

Permalink
Ensure rand() is available, create consistent seed.
Browse files Browse the repository at this point in the history
  • Loading branch information
lordofhyphens committed May 28, 2019
1 parent 6df833d commit bd575f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/libslic3r/test_extrusion_entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "ExtrusionEntityCollection.hpp"
#include "ExtrusionEntity.hpp"
#include "Point.hpp"
#include <cstdlib>

Point random_point(float LO=-50, float HI=50) {
float x = LO + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(HI-LO)));
Expand All @@ -28,6 +29,9 @@ ExtrusionPaths random_paths(size_t count=10, size_t length=20, float LO=-50, flo
using namespace Slic3r;

SCENARIO("ExtrusionEntityCollection: Polygon flattening") {
srand(0xDEADBEEF); // consistent seed for test reproducibility.

// Generate one specific random path set and save it for later comparison
ExtrusionPaths nosort_path_set {random_paths()};

ExtrusionEntityCollection sub_nosort;
Expand Down

0 comments on commit bd575f1

Please sign in to comment.