Changeset 4032 for trunk/test/segment.cc


Ignore:
Timestamp:
Jan 21, 2021, 8:44:38 AM (2 years ago)
Author:
Peter
Message:

merge release 0.18.1 into trunk

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/test/segment.cc

    r4027 r4032  
    22
    33/*
    4   Copyright (C) 2010, 2011, 2012, 2014, 2015, 2016, 2017 Peter Johansson
     4  Copyright (C) 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2021 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3030using namespace theplu::yat;
    3131using namespace utility;
     32void test_comp(test::Suite& suite);
    3233void test_compare(test::Suite& suite);
    3334void test_count(test::Suite&);
     
    5253  test::Suite suite(argc, argv);
    5354
     55  test_comp(suite);
    5456  test_compare(suite);
    5557  test_count(suite);
     
    6870
    6971  return suite.return_value();
     72}
     73
     74
     75void test_comp(test::Suite& suite)
     76{
     77  Segment<double> key;
     78  {
     79    SegmentSet<double> set;
     80    SegmentSet<double>::key_compare kcompare = set.key_comp();
     81    if (kcompare(key, key))
     82      suite.add(false);
     83    test::avoid_compiler_warning(kcompare);
     84    SegmentSet<double>::value_compare vcompare = set.value_comp();
     85    if (vcompare(key, key))
     86      suite.add(false);
     87    test::avoid_compiler_warning(vcompare);
     88  }
     89
     90  {
     91    SegmentMap<double, std::string> map;
     92    std::pair<const Segment<double>, std::string> value(key, "hello");
     93    SegmentMap<double, std::string>::key_compare kcompare = map.key_comp();
     94    if (kcompare(key, key))
     95      suite.add(false);
     96    test::avoid_compiler_warning(kcompare);
     97    SegmentMap<double, std::string>::value_compare vcompare = map.value_comp();
     98    if (vcompare(value, value))
     99      suite.add(false);
     100    test::avoid_compiler_warning(vcompare);
     101  }
    70102}
    71103
Note: See TracChangeset for help on using the changeset viewer.