TEST(Solution, TwoStrings) {
    PriorityQueue pq = PriorityQueue();
    std::string x = "xxx";
    std::string w = "www";

    pq.insert(10, w);
    pq.insert(20, x);
    EXPECT_EQ(x, pq.next());
    EXPECT_EQ(w, pq.next());
    // How to handle when there are no elements? EXPECT_TRUE(NULL == pq.next);
}
TEST(Solution, TwoSamePrioString) {
    PriorityQueue pq = PriorityQueue();
    std::string x = "xxx";
    std::string w = "www";
    std::string y = "yyy";

    pq.insert(20, x);
    pq.insert(20, w);
    pq.insert(10, y);

    std::string call1 = pq.next();
    EXPECT_TRUE(call1 == w || call1 == x);
    std::string call2 = pq.next();
    EXPECT_TRUE(call2 == w || call2 == x);
    // How to handle when there are no elements? EXPECT_TRUE(NULL == pq.next());
    EXPECT_EQ(y, pq.next());
}
 static PriorityQueue GetDefaultPriorityQueue( const Allocator& )
 {
     return PriorityQueue();
 }
 static PriorityQueue GetCopiedPriorityQueue( const Allocator& a )
 {
     // Priority queues require a comparison functor prior to the
     // allocator object in the container ctor.
     return PriorityQueue( std::less< typename Allocator::value_type >(), Container( a ) );
 }
TEST(Solution, WhenNextOnEmptyThenException) {
    PriorityQueue pq = PriorityQueue();

    EXPECT_ANY_THROW({
        pq.next();
    });
TEST(Solution, OneString) {
    PriorityQueue pq = PriorityQueue();
    std::string x = "xxx";
    pq.insert(20, x);
    EXPECT_EQ(x, pq.next());
}
Beispiel #7
0
TESTS::TESTS(void)
{
	pq = gcnew PriorityQueue();

}