]> git.saurik.com Git - wxWidgets.git/blame - tests/vectors/vectors.cpp
Some code renaming to avoid confusion. Test editable column in sample.
[wxWidgets.git] / tests / vectors / vectors.cpp
CommitLineData
e966f815
VS
1///////////////////////////////////////////////////////////////////////////////
2// Name: tests/vectors/vectors.cpp
3// Purpose: wxVector<T> unit test
4// Author: Vaclav Slavik
5// Created: 2007-07-07
6// RCS-ID: $Id$
7// Copyright: (c) 2007 Vaclav Slavik
8///////////////////////////////////////////////////////////////////////////////
9
10// ----------------------------------------------------------------------------
11// headers
12// ----------------------------------------------------------------------------
13
14#include "testprec.h"
15
16#ifdef __BORLANDC__
17 #pragma hdrstop
18#endif
19
20#ifndef WX_PRECOMP
21 #include "wx/wx.h"
22#endif // WX_PRECOMP
23
24#include "wx/vector.h"
25
26// --------------------------------------------------------------------------
27// test class
28// --------------------------------------------------------------------------
29
30class VectorsTestCase : public CppUnit::TestCase
31{
32public:
33 VectorsTestCase() {}
34
35private:
36 CPPUNIT_TEST_SUITE( VectorsTestCase );
37 CPPUNIT_TEST( PushTest );
38 CPPUNIT_TEST_SUITE_END();
39
40 void PushTest();
41
42 DECLARE_NO_COPY_CLASS(VectorsTestCase)
43};
44
45// register in the unnamed registry so that these tests are run by default
46CPPUNIT_TEST_SUITE_REGISTRATION( VectorsTestCase );
47
48// also include in it's own registry so that these tests can be run alone
49CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( VectorsTestCase, "VectorsTestCase" );
50
51void VectorsTestCase::PushTest()
52{
53 wxVector<int> v;
54
55 CPPUNIT_ASSERT( v.size() == 0 );
56 v.push_back(1);
57 CPPUNIT_ASSERT( v.size() == 1 );
58 v.push_back(2);
59 CPPUNIT_ASSERT( v.size() == 2 );
60 v.push_back(42);
61 CPPUNIT_ASSERT( v.size() == 3 );
62
63 CPPUNIT_ASSERT( v[0] == 1 );
64 CPPUNIT_ASSERT( v[1] == 2 );
65 CPPUNIT_ASSERT( v[2] == 42 );
66}