[libcxx] r258281 - Got the test backwards in r258279. Fixed that and de-tabbed
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 19 19:37:47 PST 2016
Author: marshall
Date: Tue Jan 19 21:37:46 2016
New Revision: 258281
URL: http://llvm.org/viewvc/llvm-project?rev=258281&view=rev
Log:
Got the test backwards in r258279. Fixed that and de-tabbed
Modified:
libcxx/trunk/test/support/test_iterators.h
Modified: libcxx/trunk/test/support/test_iterators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_iterators.h?rev=258281&r1=258280&r2=258281&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_iterators.h (original)
+++ libcxx/trunk/test/support/test_iterators.h Tue Jan 19 21:37:46 2016
@@ -335,137 +335,137 @@ struct ThrowingIterator {
typedef const T * pointer;
typedef const T & reference;
- enum ThrowingAction { TAIncrement, TADecrement, TADereference, TAAssignment, TAComparison };
+ enum ThrowingAction { TAIncrement, TADecrement, TADereference, TAAssignment, TAComparison };
-// Constructors
- ThrowingIterator ()
- : begin_(nullptr), end_(nullptr), current_(nullptr), action_(TADereference), index_(0) {}
- ThrowingIterator (const T *first, const T *last, size_t index = 0, ThrowingAction action = TADereference)
- : begin_(first), end_(last), current_(first), action_(action), index_(index) {}
- ThrowingIterator (const ThrowingIterator &rhs)
- : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_), action_(rhs.action_), index_(rhs.index_) {}
- ThrowingIterator & operator= (const ThrowingIterator &rhs)
- {
- if (action_ == TAAssignment)
- {
- if (index_ == 0)
+// Constructors
+ ThrowingIterator ()
+ : begin_(nullptr), end_(nullptr), current_(nullptr), action_(TADereference), index_(0) {}
+ ThrowingIterator (const T *first, const T *last, size_t index = 0, ThrowingAction action = TADereference)
+ : begin_(first), end_(last), current_(first), action_(action), index_(index) {}
+ ThrowingIterator (const ThrowingIterator &rhs)
+ : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_), action_(rhs.action_), index_(rhs.index_) {}
+ ThrowingIterator & operator= (const ThrowingIterator &rhs)
+ {
+ if (action_ == TAAssignment)
+ {
+ if (index_ == 0)
#ifndef TEST_HAS_NO_EXCEPTIONS
- assert(false);
+ throw std::runtime_error ("throw from iterator assignment");
#else
- throw std::runtime_error ("throw from iterator assignment");
+ assert(false);
#endif
- else
- --index_;
- }
- begin_ = rhs.begin_;
- end_ = rhs.end_;
- current_ = rhs.current_;
- action_ = rhs.action_;
- index_ = rhs.index_;
- return *this;
- }
-
-// iterator operations
- reference operator*() const
- {
- if (action_ == TADereference)
- {
- if (index_ == 0)
+ else
+ --index_;
+ }
+ begin_ = rhs.begin_;
+ end_ = rhs.end_;
+ current_ = rhs.current_;
+ action_ = rhs.action_;
+ index_ = rhs.index_;
+ return *this;
+ }
+
+// iterator operations
+ reference operator*() const
+ {
+ if (action_ == TADereference)
+ {
+ if (index_ == 0)
#ifndef TEST_HAS_NO_EXCEPTIONS
- assert(false);
+ throw std::runtime_error ("throw from iterator dereference");
#else
- throw std::runtime_error ("throw from iterator dereference");
+ assert(false);
#endif
- else
- --index_;
- }
- return *current_;
- }
-
- ThrowingIterator & operator++()
- {
- if (action_ == TAIncrement)
- {
- if (index_ == 0)
+ else
+ --index_;
+ }
+ return *current_;
+ }
+
+ ThrowingIterator & operator++()
+ {
+ if (action_ == TAIncrement)
+ {
+ if (index_ == 0)
#ifndef TEST_HAS_NO_EXCEPTIONS
- assert(false);
+ throw std::runtime_error ("throw from iterator increment");
#else
- throw std::runtime_error ("throw from iterator increment");
+ assert(false);
#endif
- else
- --index_;
- }
- ++current_;
- return *this;
- }
-
- ThrowingIterator operator++(int)
- {
- ThrowingIterator temp = *this;
- ++(*this);
- return temp;
- }
-
- ThrowingIterator & operator--()
- {
- if (action_ == TADecrement)
- {
- if (index_ == 0)
+ else
+ --index_;
+ }
+ ++current_;
+ return *this;
+ }
+
+ ThrowingIterator operator++(int)
+ {
+ ThrowingIterator temp = *this;
+ ++(*this);
+ return temp;
+ }
+
+ ThrowingIterator & operator--()
+ {
+ if (action_ == TADecrement)
+ {
+ if (index_ == 0)
#ifndef TEST_HAS_NO_EXCEPTIONS
- assert(false);
+ throw std::runtime_error ("throw from iterator decrement");
#else
- throw std::runtime_error ("throw from iterator decrement");
+ assert(false);
#endif
- else
- --index_;
- }
- --current_;
- return *this;
- }
-
- ThrowingIterator operator--(int) {
- ThrowingIterator temp = *this;
- --(*this);
- return temp;
- }
-
- bool operator== (const ThrowingIterator &rhs) const
- {
- if (action_ == TAComparison)
- {
- if (index_ == 0)
+ else
+ --index_;
+ }
+ --current_;
+ return *this;
+ }
+
+ ThrowingIterator operator--(int) {
+ ThrowingIterator temp = *this;
+ --(*this);
+ return temp;
+ }
+
+ bool operator== (const ThrowingIterator &rhs) const
+ {
+ if (action_ == TAComparison)
+ {
+ if (index_ == 0)
#ifndef TEST_HAS_NO_EXCEPTIONS
- assert(false);
+ throw std::runtime_error ("throw from iterator comparison");
#else
- throw std::runtime_error ("throw from iterator comparison");
+ assert(false);
#endif
- else
- --index_;
- }
- bool atEndL = current_ == end_;
- bool atEndR = rhs.current_ == rhs.end_;
- if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
- if (atEndL) return true; // both are at the end (or empty)
- return current_ == rhs.current_;
- }
+ else
+ --index_;
+ }
+ bool atEndL = current_ == end_;
+ bool atEndR = rhs.current_ == rhs.end_;
+ if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
+ if (atEndL) return true; // both are at the end (or empty)
+ return current_ == rhs.current_;
+ }
private:
- const T* begin_;
- const T* end_;
- const T* current_;
- ThrowingAction action_;
- mutable size_t index_;
+ const T* begin_;
+ const T* end_;
+ const T* current_;
+ ThrowingAction action_;
+ mutable size_t index_;
};
template <typename T>
bool operator== (const ThrowingIterator<T>& a, const ThrowingIterator<T>& b)
-{ return a.operator==(b); }
+{ return a.operator==(b); }
template <typename T>
bool operator!= (const ThrowingIterator<T>& a, const ThrowingIterator<T>& b)
-{ return !a.operator==(b); }
-
+{ return !a.operator==(b); }
+
template <typename T>
struct NonThrowingIterator {
typedef std::bidirectional_iterator_tag iterator_category;
@@ -474,75 +474,75 @@ struct NonThrowingIterator {
typedef const T * pointer;
typedef const T & reference;
-// Constructors
- NonThrowingIterator ()
- : begin_(nullptr), end_(nullptr), current_(nullptr) {}
- NonThrowingIterator (const T *first, const T* last)
- : begin_(first), end_(last), current_(first) {}
- NonThrowingIterator (const NonThrowingIterator &rhs)
- : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_) {}
- NonThrowingIterator & operator= (const NonThrowingIterator &rhs) TEST_NOEXCEPT
- {
- begin_ = rhs.begin_;
- end_ = rhs.end_;
- current_ = rhs.current_;
- return *this;
- }
-
-// iterator operations
- reference operator*() const TEST_NOEXCEPT
- {
- return *current_;
- }
-
- NonThrowingIterator & operator++() TEST_NOEXCEPT
- {
- ++current_;
- return *this;
- }
-
- NonThrowingIterator operator++(int) TEST_NOEXCEPT
- {
- NonThrowingIterator temp = *this;
- ++(*this);
- return temp;
- }
-
- NonThrowingIterator & operator--() TEST_NOEXCEPT
- {
- --current_;
- return *this;
- }
-
- NonThrowingIterator operator--(int) TEST_NOEXCEPT
- {
- NonThrowingIterator temp = *this;
- --(*this);
- return temp;
- }
-
- bool operator== (const NonThrowingIterator &rhs) const TEST_NOEXCEPT
- {
- bool atEndL = current_ == end_;
- bool atEndR = rhs.current_ == rhs.end_;
- if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
- if (atEndL) return true; // both are at the end (or empty)
- return current_ == rhs.current_;
- }
+// Constructors
+ NonThrowingIterator ()
+ : begin_(nullptr), end_(nullptr), current_(nullptr) {}
+ NonThrowingIterator (const T *first, const T* last)
+ : begin_(first), end_(last), current_(first) {}
+ NonThrowingIterator (const NonThrowingIterator &rhs)
+ : begin_(rhs.begin_), end_(rhs.end_), current_(rhs.current_) {}
+ NonThrowingIterator & operator= (const NonThrowingIterator &rhs) TEST_NOEXCEPT
+ {
+ begin_ = rhs.begin_;
+ end_ = rhs.end_;
+ current_ = rhs.current_;
+ return *this;
+ }
+
+// iterator operations
+ reference operator*() const TEST_NOEXCEPT
+ {
+ return *current_;
+ }
+
+ NonThrowingIterator & operator++() TEST_NOEXCEPT
+ {
+ ++current_;
+ return *this;
+ }
+
+ NonThrowingIterator operator++(int) TEST_NOEXCEPT
+ {
+ NonThrowingIterator temp = *this;
+ ++(*this);
+ return temp;
+ }
+
+ NonThrowingIterator & operator--() TEST_NOEXCEPT
+ {
+ --current_;
+ return *this;
+ }
+
+ NonThrowingIterator operator--(int) TEST_NOEXCEPT
+ {
+ NonThrowingIterator temp = *this;
+ --(*this);
+ return temp;
+ }
+
+ bool operator== (const NonThrowingIterator &rhs) const TEST_NOEXCEPT
+ {
+ bool atEndL = current_ == end_;
+ bool atEndR = rhs.current_ == rhs.end_;
+ if (atEndL != atEndR) return false; // one is at the end (or empty), the other is not.
+ if (atEndL) return true; // both are at the end (or empty)
+ return current_ == rhs.current_;
+ }
private:
- const T* begin_;
- const T* end_;
- const T* current_;
+ const T* begin_;
+ const T* end_;
+ const T* current_;
};
template <typename T>
bool operator== (const NonThrowingIterator<T>& a, const NonThrowingIterator<T>& b) TEST_NOEXCEPT
-{ return a.operator==(b); }
+{ return a.operator==(b); }
template <typename T>
bool operator!= (const NonThrowingIterator<T>& a, const NonThrowingIterator<T>& b) TEST_NOEXCEPT
-{ return !a.operator==(b); }
+{ return !a.operator==(b); }
#undef DELETE_FUNCTION
More information about the cfe-commits
mailing list