Changeset 2143 for trunk/test/Suite.h


Ignore:
Timestamp:
Jan 15, 2010, 3:12:56 PM (13 years ago)
Author:
Peter
Message:

fixes #449

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Suite.h

    r2119 r2143  
    123123    template<typename RandomAccessIterator>
    124124    void test_random_access_iterator(RandomAccessIterator);
     125
     126    template<typename Container2D>
     127    void test_concept_container2d(const Container2D&);
     128
     129    template<typename MutableContainer2D>
     130    void test_concept_mutable_container2d(MutableContainer2D&);
    125131
    126132    /**
     
    320326  }
    321327
     328  template<typename Container2D>
     329  void Suite::test_concept_container2d(const Container2D& c)
     330  {
     331    typedef typename Container2D::value_type value_type;
     332    typedef typename Container2D::const_reference const_reference;
     333    typedef typename Container2D::const_iterator const_iterator;
     334    typedef typename Container2D::const_column_iterator const_column_iterator;
     335    typedef typename Container2D::const_row_iterator const_row_iterator;
     336    const_iterator ci = c.begin();
     337    const_column_iterator cci = c.begin_column(0);
     338    const_row_iterator cri = c.begin_row(0);
     339    ci = c.end();
     340    cci = c.end_column(0);
     341    cri = c.end_row(0);
     342    size_t cols = c.columns();
     343    size_t rows = c.rows();
     344    cols = rows; // just to avoid compiler warning
     345    const_reference x = c(0,0);
     346    value_type y;
     347    y = x;
     348  }
     349
     350  template<typename MutableContainer2D>
     351  void Suite::test_concept_mutable_container2d(MutableContainer2D& mc)
     352  {
     353    test_concept_container2d(mc);
     354    typedef typename MutableContainer2D::reference reference;
     355    typedef typename MutableContainer2D::iterator iterator;
     356    typedef typename MutableContainer2D::column_iterator column_iterator;
     357    typedef typename MutableContainer2D::row_iterator row_iterator;
     358    iterator i = mc.begin();
     359    column_iterator ci = mc.begin_column(0);
     360    row_iterator ri = mc.begin_row(0);
     361    *i = *ci;
     362    *ci = *i;
     363    *ri = *i;
     364    i = mc.end();
     365    ci = mc.end_column(0);
     366    ri = mc.end_row(0);
     367    reference x = mc(0,0);
     368    x = *mc.begin();
     369  }
     370
    322371}}}
    323372
Note: See TracChangeset for help on using the changeset viewer.