Changeset 2294


Ignore:
Timestamp:
Jul 7, 2010, 8:19:22 PM (11 years ago)
Author:
Peter
Message:

refs #635. fix return type (int) in compare_3way and add some more test for Segment.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/segment_test.cc

    r2293 r2294  
    8888  suite.add(segment14.end()==2);
    8989
     90  if (!suite.add(compare(Segment<double>(0,2), Segment<double>(3,4))))
     91    suite.err() << "error: compare: expected 1\n";
     92  if (!suite.add(compare_3way(Segment<double>(0,2), Segment<double>(3,4))==-1))
     93    suite.err() << "error: compare_3way: expected -1\n";
     94
     95  if (!suite.add(compare(Segment<double>(0,2), Segment<double>(1,2))==false))
     96    suite.err() << "error: compare: expected 0\n";
     97  if (!suite.add(compare_3way(Segment<double>(0,2), Segment<double>(1,2))==0))
     98    suite.err() << "error: compare_3way: expected 0\n";
     99
     100  if (!suite.add(compare(Segment<double>(3,4), Segment<double>(0,2))==false))
     101    suite.err() << "error: compare: expected 0\n";
     102  if (!suite.add(compare_3way(Segment<double>(3,4), Segment<double>(0,2))==1))
     103    suite.err() << "error: compare_3way: expected 1\n";
     104
    90105  return suite.return_value();
    91106}
  • trunk/yat/utility/Segment.h

    r2293 r2294  
    113113   */
    114114  template<typename T, class Compare>
    115   bool compare_3way(const Segment<T, Compare>& lhs,
     115  int compare_3way(const Segment<T, Compare>& lhs,
    116116                    const Segment<T, Compare>& rhs)
    117117  {
     
    132132   */
    133133  template<typename T, class Compare>
    134   bool compare_3way(const T& lhs,
    135                     const Segment<T, Compare>& rhs)
     134  int compare_3way(const T& lhs,
     135                   const Segment<T, Compare>& rhs)
    136136  {
    137137    Compare comp;
Note: See TracChangeset for help on using the changeset viewer.