Skip to content

Instantly share code, notes, and snippets.

@EricWF
Created April 30, 2015 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricWF/bef9f2a3ca4c86cb0781 to your computer and use it in GitHub Desktop.
Save EricWF/bef9f2a3ca4c86cb0781 to your computer and use it in GitHub Desktop.
Test Fix for C++03
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
index 9dc2ef9..eeb4373 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
@@ -32,5 +32,5 @@ template <class PopulationIterator, class SampleIterator> void test() {
}
int main() {
- test<input_iterator<int *>, output_iterator<int *>>();
+ test<input_iterator<int *>, output_iterator<int *> >();
}
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
index c464370..3ab3687 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
@@ -22,22 +22,22 @@
#include "test_iterators.h"
struct ReservoirSampleExpectations {
- static constexpr unsigned os = 4;
- static constexpr int oa1[os] = {10, 5, 9, 4};
- static constexpr int oa2[os] = {5, 2, 10, 4};
+ enum { os = 4 };
+ static int oa1[os];
+ static int oa2[os];
};
-constexpr int ReservoirSampleExpectations::oa1[];
-constexpr int ReservoirSampleExpectations::oa2[];
+int ReservoirSampleExpectations::oa1[] = {10, 5, 9, 4};
+int ReservoirSampleExpectations::oa2[] = {5, 2, 10, 4};
struct SelectionSampleExpectations {
- static constexpr unsigned os = 4;
- static constexpr int oa1[os] = {1, 4, 6, 7};
- static constexpr int oa2[os] = {1, 2, 6, 8};
+ enum { os = 4 };
+ static int oa1[os];
+ static int oa2[os];
};
-constexpr int SelectionSampleExpectations::oa1[];
-constexpr int SelectionSampleExpectations::oa2[];
+int SelectionSampleExpectations::oa1[] = {1, 4, 6, 7};
+int SelectionSampleExpectations::oa2[] = {1, 2, 6, 8};
template <class IteratorCategory> struct TestExpectations;
template <>
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp
index 51f93b3..c805c66 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.stable.pass.cpp
@@ -29,12 +29,12 @@ void test_stability(bool expect_stable) {
int ia[kPopulationSize];
for (unsigned i = 0; i < kPopulationSize; ++i)
ia[i] = i;
- PopulationIterator first{ia};
- PopulationIterator last{ia + kPopulationSize};
+ PopulationIterator first(ia);
+ PopulationIterator last(ia + kPopulationSize);
const unsigned kSampleSize = 20;
int oa[kPopulationSize];
- SampleIterator out{oa};
+ SampleIterator out(oa);
std::minstd_rand g;
@@ -48,6 +48,6 @@ void test_stability(bool expect_stable) {
}
int main() {
- test_stability<forward_iterator<int *>, output_iterator<int *>>(true);
- test_stability<input_iterator<int *>, random_access_iterator<int *>>(false);
+ test_stability<forward_iterator<int *>, output_iterator<int *> >(true);
+ test_stability<input_iterator<int *>, random_access_iterator<int *> >(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment