root/lang/objective-cplusplus/i3/trunk/src/Test1.cpp @ 34447

Revision 34447, 2.8 kB (checked in by saturday06, 4 years ago)

iojasdfaodfd

Line 
1#include <PrecompiledHeaders.h>
2#include "Common.h"
3#include "Mediator.h"
4#include <boost/algorithm/string.hpp>
5#include <algorithm>
6#include <boost/range.hpp>
7#include <mil/MscCrt.h>
8
9#include <quicktest/quicktest.h>
10
11using namespace std;
12using namespace boost;
13
14namespace ns_intrusrangaaaaaaaaa {
15//using namespace boost::intrusive;
16//
17////This is a base hook
18//class MyClass : public slist_base_hook<>
19//{
20//    int int_;
21//
22//public:
23//
24//    MyClass(int i)
25//            :  int_(i)
26//    {}
27//};
28//
29////Define an slist that will store MyClass using the public base hook
30//typedef slist<MyClass, constant_time_size<false> > BaseList;
31//
32}
33//
34//QT_TEST(intrusrangeaaa)
35//{
36//    using namespace ns_intrusrangaaaaaaaaa;
37//    typedef std::vector<MyClass>::iterator VectIt;
38//    typedef std::vector<MyClass>::reverse_iterator VectRit;
39//
40//    //Create several MyClass objects, each one with a different value
41//    std::vector<MyClass> values;
42//    for (int i = 0; i < 100; ++i)  values.push_back(MyClass(i));
43//
44//    BaseList baselist;
45//
46//    //Now insert them in the reverse order in the base hook list
47//    for (VectIt it(values.begin()), itend(values.end()); it != itend; ++it)
48//        baselist.push_front(*it);
49//
50//    //Now test lists
51//    {
52//        BaseList::iterator bit(baselist.begin()), bitend(baselist.end());
53//
54//        VectRit rit(values.rbegin()), ritend(values.rend());
55//        VectIt  it(values.begin()), itend(values.end());
56//
57//        //Test the objects inserted in the base hook list
58//        for (; rit != ritend; ++rit, ++bit)
59//        {
60//            QT_CHECK(&*bit == &*rit);
61//        }
62//
63//    }
64//
65//    return;
66//}
67
68
69QT_TEST(rangeaaa) {
70//    char a[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
71//    char b[] = { 0x03, 0x04 };
72//    char* foo = std::search(boost::begin(a), boost::end(a),
73//                            boost::begin(b), boost::end(b));
74#undef printf
75//    printf("%d %d %d %d\n", foo[0], foo[1], foo[2], foo[3]);
76}
77
78QT_TEST(test_sgrin) {
79    //char before_buffer[] = {0,1,2,3,4,5,6,7,8,9};
80    //boost::array<char, 5> data = {{}};
81    //char after_buffer[] = {9,8,7,6,5,4,3,2,1,0};
82    char foo[2];
83    char* bar = strdup("foobarbaz");
84//    QT_CHECK(strcpy_s(foo, bar) == ERANGE);
85    free(bar);
86
87}
88
89
90#if defined(UNICODE) || defined(_UNICODE)
91
92QT_TEST(test_gettext) {
93    const char* buf = (const char*)wgettext("ABCDE");
94    QT_CHECK(buf[0] == 0x41);
95    QT_CHECK(buf[1] == 0);
96    QT_CHECK(buf[2] == 0x42);
97    QT_CHECK(buf[3] == 0);
98    QT_CHECK(buf[4] == 0x43);
99    QT_CHECK(buf[5] == 0);
100    QT_CHECK(buf[6] == 0x44);
101    QT_CHECK(buf[7] == 0);
102    QT_CHECK(buf[8] == 0x45);
103    QT_CHECK(buf[9] == 0);
104    QT_CHECK(buf[10] == 0);
105    QT_CHECK(buf[11] == 0);
106}
107
108#endif
109
Note: See TracBrowser for help on using the browser.