[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kocienda
kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:46:57 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 1dbd5ec98b2c910498a294f55818f9a2c10d2d81
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Sep 24 23:27:09 2001 +0000
Added more tests and modified existing ones
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@190 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/kwq/qt/_qdatetime.cpp b/WebCore/kwq/qt/_qdatetime.cpp
index 7b461f8..1d31ddb 100644
--- a/WebCore/kwq/qt/_qdatetime.cpp
+++ b/WebCore/kwq/qt/_qdatetime.cpp
@@ -1364,6 +1364,61 @@ QDateTime QDateTime::currentDateTime()
Date/time stream functions
*****************************************************************************/
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QDate &d)
+{
+ return o <<
+ "QDate: [yy/mm/dd: " <<
+ d.year() <<
+ '/' <<
+ d.month() <<
+ '/' <<
+ d.day() <<
+ ']';
+}
+#endif
+
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QTime &t)
+{
+ return o <<
+ "QTime: [hh:mm:ss:ms = " <<
+ t.hour() <<
+ ':' <<
+ t.minute() <<
+ ':' <<
+ t.second() <<
+ ':' <<
+ t.msec() <<
+ ']';
+}
+#endif
+
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QDateTime &dt)
+{
+ QDate d = dt.date();
+ QTime t = dt.time();
+
+ return o <<
+ "QDateTime: [yy/mm/dd hh:mm:ss:ms = " <<
+ d.year() <<
+ '/' <<
+ d.month() <<
+ '/' <<
+ d.day() <<
+ ' ' <<
+ t.hour() <<
+ ':' <<
+ t.minute() <<
+ ':' <<
+ t.second() <<
+ ':' <<
+ t.msec() <<
+ ']';
+}
+#endif
+
#ifndef QT_NO_DATASTREAM
/*!
\relates QDate
diff --git a/WebCore/kwq/qt/_qdatetime.h b/WebCore/kwq/qt/_qdatetime.h
index 0a3d04e..d5a530a 100644
--- a/WebCore/kwq/qt/_qdatetime.h
+++ b/WebCore/kwq/qt/_qdatetime.h
@@ -45,6 +45,7 @@
#endif
#include <KWQDef.h>
+#include <iostream>
// -------------------------------------------------------------------------
@@ -95,6 +96,10 @@ public:
static bool isValid( int y, int m, int d );
static bool leapYear( int year );
+#ifdef _KWQ_IOSTREAM_
+ friend ostream &operator<<(ostream &, const QDate &);
+#endif
+
protected:
static uint greg2jul( int y, int m, int d );
static void jul2greg( uint jd, int &y, int &m, int &d );
@@ -151,6 +156,10 @@ public:
int restart();
int elapsed();
+#ifdef _KWQ_IOSTREAM_
+ friend ostream &operator<<(ostream &, const QTime &);
+#endif
+
private:
static bool currentTime( QTime * );
@@ -199,6 +208,10 @@ public:
static QDateTime currentDateTime();
+#ifdef _KWQ_IOSTREAM_
+ friend ostream &operator<<(ostream &, const QDateTime &);
+#endif
+
private:
QDate d;
QTime t;
diff --git a/WebCore/kwq/qt/_qdict.h b/WebCore/kwq/qt/_qdict.h
index 3a03d00..39fc24f 100644
--- a/WebCore/kwq/qt/_qdict.h
+++ b/WebCore/kwq/qt/_qdict.h
@@ -45,6 +45,7 @@
#endif
#include <KWQDef.h>
+#include <iostream>
// -------------------------------------------------------------------------
@@ -80,6 +81,7 @@ public:
void clear() { QGDict::clear(); }
void resize( uint n ) { QGDict::resize(n); }
void statistics() const { QGDict::statistics(); }
+
private:
void deleteItem( Item d );
};
@@ -112,5 +114,26 @@ public:
type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);}
};
-
+#ifdef _KWQ_IOSTREAM_
+template <class T>
+ostream &operator<<(ostream &o, const QDict<T>&d)
+{
+ o <<
+ "QDict: [size: " <<
+ (Q_UINT32)d.count() <<
+ "; items: ";
+ QDictIterator<T> it = QDictIterator<T>(d);
+ int count = it.count();
+ for (int i = 0; i < count; i++) {
+ o << "(" << it.currentKey() << "," << *(it.current()) << ")";
+ if (i < count - 1) {
+ o << ", ";
+ }
+ ++it;
+ }
+ o << "]";
+ return o;
+}
+#endif
+
#endif // QDICT_H
diff --git a/WebCore/kwq/qt/_qglist.h b/WebCore/kwq/qt/_qglist.h
index 69e8fca..ce21e30 100644
--- a/WebCore/kwq/qt/_qglist.h
+++ b/WebCore/kwq/qt/_qglist.h
@@ -264,5 +264,4 @@ inline QCollection::Item QGListIterator::get() const
return curNode ? curNode->data : 0;
}
-
#endif // QGLIST_H
diff --git a/WebCore/kwq/qt/_qptrdict.h b/WebCore/kwq/qt/_qptrdict.h
index fe3a46b..6ac8cc5 100644
--- a/WebCore/kwq/qt/_qptrdict.h
+++ b/WebCore/kwq/qt/_qptrdict.h
@@ -45,6 +45,7 @@
#endif
#include <KWQDef.h>
+#include <iostream>
// -------------------------------------------------------------------------
@@ -109,5 +110,27 @@ public:
type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);}
};
+#ifdef _KWQ_IOSTREAM_
+template <class T>
+ostream &operator<<(ostream &o, const QPtrDict<T>&d)
+{
+ o <<
+ "QPtrDict: [size: " <<
+ (Q_UINT32)d.count() <<
+ "; items: ";
+ QPtrDictIterator<T> it = QPtrDictIterator<T>(d);
+ int count = it.count();
+ for (int i = 0; i < count; i++) {
+ o << "(" << it.currentKey() << "," << *(it.current()) << ")";
+ if (i < count - 1) {
+ o << ", ";
+ }
+ ++it;
+ }
+ o << "]";
+ return o;
+}
+#endif
+
#endif // QPTRDICT_H
diff --git a/WebCore/kwq/tests/qt/Makefile.in b/WebCore/kwq/tests/qt/Makefile.in
index 63a4122..b0eb9fd 100644
--- a/WebCore/kwq/tests/qt/Makefile.in
+++ b/WebCore/kwq/tests/qt/Makefile.in
@@ -29,8 +29,15 @@ PROGRAMS = \
qvaluelist-test \
qstringlist-test \
qlist-test \
+ qvector-test \
+ qdict-test \
+ qptrdict-test \
+ qstack-test \
qregexp-test \
qchar-test \
+ qdate-test \
+ qtime-test \
+ qdatetime-test \
$(NULL)
CLEAN_FILES = *.o \
@@ -91,12 +98,33 @@ qstringlist-test: qstringlist-test.o
qlist-test: qlist-test.o
$(CXX) -o $@ $< $(LDFLAGS)
+qvector-test: qvector-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qdict-test: qdict-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qptrdict-test: qptrdict-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qstack-test: qstack-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
qregexp-test: qregexp-test.o
$(CXX) -o $@ $< $(LDFLAGS)
qchar-test: qchar-test.o
$(CXX) -o $@ $< $(LDFLAGS)
+qdate-test: qdate-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qtime-test: qtime-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qdatetime-test: qdatetime-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
depend:
#----------------------------------------------------------------------
diff --git a/WebCore/kwq/tests/qt/qdate-test.chk b/WebCore/kwq/tests/qt/qdate-test.chk
new file mode 100644
index 0000000..693e1e2
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qdate-test.chk
@@ -0,0 +1,17 @@
+QDate: [yy/mm/dd: 1999/12/31]
+assignment: QDate: [yy/mm/dd: 1999/12/31]
+y2k: QDate: [yy/mm/dd: 2000/1/1]
+is not leap year: QDate: [yy/mm/dd: 1900/3/1]
+is leap year: QDate: [yy/mm/dd: 2000/2/29]
+Feb
+d0 is: QDate: [yy/mm/dd: 2000/2/29]
+d1 is: QDate: [yy/mm/dd: 2000/2/28]
+d2 is: QDate: [yy/mm/dd: 2000/2/28]
+(d0 < d1): 0
+(d0 <= d1): 0
+(d0 > d1): 1
+(d0 >= d1): 1
+(d2 < d1): 0
+(d2 <= d1): 1
+(d2 > d1): 0
+(d2 >= d1): 1
diff --git a/WebCore/kwq/tests/qt/qdate-test.cpp b/WebCore/kwq/tests/qt/qdate-test.cpp
new file mode 100644
index 0000000..f8f40c5
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qdate-test.cpp
@@ -0,0 +1,43 @@
+#include <iostream>
+
+#include <qdatetime.h>
+
+int main() {
+
+ QDate d0;
+ QDate d1 = QDate(1999, 12, 31);
+ QDate d2;
+
+ cout << d1 << endl;
+
+ d0 = d1;
+ cout << "assignment: " << d0 << endl;
+
+ d0 = d1.addDays(1);
+ cout << "y2k: " << d0 << endl;
+
+ d1 = QDate(1900, 2, 28);
+ d0 = d1.addDays(1);
+ cout << "is not leap year: " << d0 << endl;
+
+ d1 = QDate(2000, 2, 28);
+ d0 = d1.addDays(1);
+ cout << "is leap year: " << d0 << endl;
+
+ cout << d1.monthName(d1.month()) << endl;
+
+ d2 = d1;
+ cout << "d0 is: " << d0 << endl;
+ cout << "d1 is: " << d1 << endl;
+ cout << "d2 is: " << d2 << endl;
+ cout << "(d0 < d1): " << (d0 < d1) << endl;
+ cout << "(d0 <= d1): " << (d0 <= d1) << endl;
+ cout << "(d0 > d1): " << (d0 > d1) << endl;
+ cout << "(d0 >= d1): " << (d0 >= d1) << endl;
+ cout << "(d2 < d1): " << (d2 < d1) << endl;
+ cout << "(d2 <= d1): " << (d2 <= d1) << endl;
+ cout << "(d2 > d1): " << (d2 > d1) << endl;
+ cout << "(d2 >= d1): " << (d2 >= d1) << endl;
+
+ return 0;
+}
diff --git a/WebCore/kwq/tests/qt/qdatetime-test.chk b/WebCore/kwq/tests/qt/qdatetime-test.chk
new file mode 100644
index 0000000..0f979c5
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qdatetime-test.chk
@@ -0,0 +1,7 @@
+QDateTime: [yy/mm/dd hh:mm:ss:ms = 1999/12/31 0:0:0:0]
+QDateTime: [yy/mm/dd hh:mm:ss:ms = 1999/12/31 23:59:59:999]
+assignment: QDateTime: [yy/mm/dd hh:mm:ss:ms = 1999/12/31 0:0:0:0]
+string: Fri Dec 31 00:00:00 1999
+setDate: QDateTime: [yy/mm/dd hh:mm:ss:ms = 2000/1/1 0:0:0:0]
+setTime: QDateTime: [yy/mm/dd hh:mm:ss:ms = 2000/1/1 0:0:0:999]
+setTime_t: QDateTime: [yy/mm/dd hh:mm:ss:ms = 2001/9/8 18:46:40:0]
diff --git a/WebCore/kwq/tests/qt/qdatetime-test.cpp b/WebCore/kwq/tests/qt/qdatetime-test.cpp
new file mode 100644
index 0000000..8279cd7
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qdatetime-test.cpp
@@ -0,0 +1,36 @@
+#include <iostream>
+
+#include <qdatetime.h>
+
+int main() {
+
+ QDate d0;
+ QDate d1 = QDate(1999, 12, 31);
+
+ QTime t0;
+ QTime t1 = QTime(23, 59, 59, 999);
+
+ QDateTime dt0;
+ QDateTime dt1 = QDateTime(d1);
+ QDateTime dt2 = QDateTime(d1, t1);
+
+ cout << dt1 << endl;
+ cout << dt2 << endl;
+
+ dt0 = dt1;
+ cout << "assignment: " << dt0 << endl;
+ cout << "string: " << dt0.toString() << endl;
+
+ d0 = d1.addDays(1);
+ dt0.setDate(d0);
+ cout << "setDate: " << dt0 << endl;
+
+ t0 = t1.addSecs(1);
+ dt0.setTime(t0);
+ cout << "setTime: " << dt0 << endl;
+
+ dt0.setTime_t(1000000000);
+ cout << "setTime_t: " << dt0 << endl;
+
+ return 0;
+}
diff --git a/WebCore/kwq/tests/qt/qdict-test.chk b/WebCore/kwq/tests/qt/qdict-test.chk
new file mode 100644
index 0000000..dd181c7
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qdict-test.chk
@@ -0,0 +1,5 @@
+QDict: [size: 5; items: (one,1), (five,5), (four,4), (two,2), (three,3)]
+item keyed to 'one': 1
+remove item keyed to 'three': QDict: [size: 4; items: (one,1), (five,5), (four,4), (two,2)]
+d0 is empty: 1
+d1 is empty: 0
diff --git a/WebCore/kwq/tests/qt/qdict-test.cpp b/WebCore/kwq/tests/qt/qdict-test.cpp
new file mode 100644
index 0000000..1d1603d
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qdict-test.cpp
@@ -0,0 +1,34 @@
+#include <iostream>
+
+#include <qstring.h>
+#include <qdict.h>
+
+int main() {
+
+ QDict<int> d0;
+ QDict<int> d1;
+
+ int v1 = 1;
+ int v2 = 2;
+ int v3 = 3;
+ int v4 = 4;
+ int v5 = 5;
+
+ d1.insert("one", &v1);
+ d1.insert("two", &v2);
+ d1.insert("three", &v3);
+ d1.insert("four", &v4);
+ d1.insert("five", &v5);
+
+ cout << d1 << endl;
+
+ cout << "item keyed to 'one': " << *(d1.find("one")) << endl;
+
+ d1.remove("three");
+ cout << "remove item keyed to 'three': " << d1 << endl;
+
+ cout << "d0 is empty: " << d0.isEmpty() << endl;
+ cout << "d1 is empty: " << d1.isEmpty() << endl;
+
+ return 0;
+}
diff --git a/WebCore/kwq/tests/qt/qmap-test.chk b/WebCore/kwq/tests/qt/qmap-test.chk
index b57c787..a8e9d11 100644
--- a/WebCore/kwq/tests/qt/qmap-test.chk
+++ b/WebCore/kwq/tests/qt/qmap-test.chk
@@ -1 +1,5 @@
-QMap: [size: 2; items: (1,10), (2,20)]
+QMap: [size: 5; items: (1,10), (2,20), (3,30), (4,40), (5,50)]
+item keyed to 'one': 10
+remove item keyed to 'three': QMap: [size: 4; items: (1,10), (2,20), (4,40), (5,50)]
+d0 is empty: 1
+d1 is empty: 0
diff --git a/WebCore/kwq/tests/qt/qmap-test.cpp b/WebCore/kwq/tests/qt/qmap-test.cpp
index 916f478..fc6a1e3 100644
--- a/WebCore/kwq/tests/qt/qmap-test.cpp
+++ b/WebCore/kwq/tests/qt/qmap-test.cpp
@@ -4,12 +4,24 @@
int main() {
- QMap<int,int> m1;
+ QMap<int,int> d0;
+ QMap<int,int> d1;
- m1.insert(1,10);
- m1.insert(2,20);
+ d1.insert(1, 10);
+ d1.insert(2, 20);
+ d1.insert(3, 30);
+ d1.insert(4, 40);
+ d1.insert(5, 50);
- cout << m1 << endl;
+ cout << d1 << endl;
+
+ cout << "item keyed to 'one': " << *(d1.find(1)) << endl;
+
+ d1.remove(3);
+ cout << "remove item keyed to 'three': " << d1 << endl;
+
+ cout << "d0 is empty: " << d0.isEmpty() << endl;
+ cout << "d1 is empty: " << d1.isEmpty() << endl;
return 0;
}
diff --git a/WebCore/kwq/tests/qt/qptrdict-test.chk b/WebCore/kwq/tests/qt/qptrdict-test.chk
new file mode 100644
index 0000000..b3ed2c9
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qptrdict-test.chk
@@ -0,0 +1,8 @@
+item keyed to 1: 1
+item keyed to 2: 2
+item keyed to 3: 3
+item keyed to 4: 4
+item keyed to 5: 5
+item keyed to 2: 0x0
+d0 is empty: 1
+d1 is empty: 0
diff --git a/WebCore/kwq/tests/qt/qptrdict-test.cpp b/WebCore/kwq/tests/qt/qptrdict-test.cpp
new file mode 100644
index 0000000..47bebff
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qptrdict-test.cpp
@@ -0,0 +1,36 @@
+#include <iostream>
+
+#include <qstring.h>
+#include <qptrdict.h>
+
+int main() {
+
+ QPtrDict<int> d0;
+ QPtrDict<int> d1;
+
+ int v1 = 1;
+ int v2 = 2;
+ int v3 = 3;
+ int v4 = 4;
+ int v5 = 5;
+
+ d1.insert(&v1, &v1);
+ d1.insert(&v2, &v2);
+ d1.insert(&v3, &v3);
+ d1.insert(&v4, &v4);
+ d1.insert(&v5, &v5);
+
+ cout << "item keyed to 1: " << *(d1.find(&v1)) << endl;
+ cout << "item keyed to 2: " << *(d1.find(&v2)) << endl;
+ cout << "item keyed to 3: " << *(d1.find(&v3)) << endl;
+ cout << "item keyed to 4: " << *(d1.find(&v4)) << endl;
+ cout << "item keyed to 5: " << *(d1.find(&v5)) << endl;
+
+ d1.remove(&v2);
+ cout << "item keyed to 2: " << d1.find(&v2) << endl;
+
+ cout << "d0 is empty: " << d0.isEmpty() << endl;
+ cout << "d1 is empty: " << d1.isEmpty() << endl;
+
+ return 0;
+}
diff --git a/WebCore/kwq/tests/qt/qstack-test.chk b/WebCore/kwq/tests/qt/qstack-test.chk
new file mode 100644
index 0000000..7268411
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qstack-test.chk
@@ -0,0 +1,12 @@
+QStack: [size: 0; items: ]
+push test:
+QStack: [size: 5; items: 4, 3, 2, 1, 0]
+pop test:
+4
+3
+2
+1
+0
+QStack: [size: 5; items: 4, 3, 2, 1, 0]
+clear test:
+QStack: [size: 0; items: ]
diff --git a/WebCore/kwq/tests/qt/qstack-test.cpp b/WebCore/kwq/tests/qt/qstack-test.cpp
new file mode 100644
index 0000000..e87602c
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qstack-test.cpp
@@ -0,0 +1,41 @@
+#include <iostream>
+
+#include <qstack.h>
+
+int main() {
+
+ QStack<int> s0;
+ QStack<int> s1 = QStack<int>();
+
+ int i0 = 0;
+ int i1 = 1;
+ int i2 = 2;
+ int i3 = 3;
+ int i4 = 4;
+
+ cout << s0 << endl;
+
+ s0.push(&i0);
+ s0.push(&i1);
+ s0.push(&i2);
+ s0.push(&i3);
+ s0.push(&i4);
+
+ cout << "push test: " << endl;
+ cout << s0 << endl;
+
+ s1 = s0;
+ cout << "pop test: " << endl;
+ int count = s1.count();
+ for (int i = 0; i < count; i++) {
+ cout << *(s1.pop()) << endl;
+ }
+
+ s1 = s0;
+ cout << s1 << endl;
+ cout << "clear test: " << endl;
+ s1.clear();
+ cout << s1 << endl;
+
+ return 0;
+}
diff --git a/WebCore/kwq/tests/qt/qtime-test.chk b/WebCore/kwq/tests/qt/qtime-test.chk
new file mode 100644
index 0000000..ca9d7c1
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qtime-test.chk
@@ -0,0 +1,15 @@
+QTime: [hh:mm:ss:ms = 23:59:59:999]
+assignment: QTime: [hh:mm:ss:ms = 23:59:59:999]
+day roll (seconds): QTime: [hh:mm:ss:ms = 0:0:0:999]
+day roll (milli-seconds): QTime: [hh:mm:ss:ms = 0:0:0:0]
+d0 is: QTime: [hh:mm:ss:ms = 0:0:0:0]
+d1 is: QTime: [hh:mm:ss:ms = 23:59:59:999]
+d2 is: QTime: [hh:mm:ss:ms = 23:59:59:999]
+(d0 < d1): 1
+(d0 <= d1): 1
+(d0 > d1): 0
+(d0 >= d1): 0
+(d2 < d1): 0
+(d2 <= d1): 1
+(d2 > d1): 0
+(d2 >= d1): 1
diff --git a/WebCore/kwq/tests/qt/qtime-test.cpp b/WebCore/kwq/tests/qt/qtime-test.cpp
new file mode 100644
index 0000000..67acba9
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qtime-test.cpp
@@ -0,0 +1,37 @@
+#include <iostream>
+
+#include <qdatetime.h>
+
+int main() {
+
+ QTime d0;
+ QTime d1 = QTime(23, 59, 59, 999);
+ QTime d2;
+
+ cout << d1 << endl;
+
+ d0 = d1;
+ cout << "assignment: " << d0 << endl;
+
+ d0 = d1.addSecs(1);
+ cout << "day roll (seconds): " << d0 << endl;
+
+ d0 = d1;
+ d0 = d1.addMSecs(1);
+ cout << "day roll (milli-seconds): " << d0 << endl;
+
+ d2 = d1;
+ cout << "d0 is: " << d0 << endl;
+ cout << "d1 is: " << d1 << endl;
+ cout << "d2 is: " << d2 << endl;
+ cout << "(d0 < d1): " << (d0 < d1) << endl;
+ cout << "(d0 <= d1): " << (d0 <= d1) << endl;
+ cout << "(d0 > d1): " << (d0 > d1) << endl;
+ cout << "(d0 >= d1): " << (d0 >= d1) << endl;
+ cout << "(d2 < d1): " << (d2 < d1) << endl;
+ cout << "(d2 <= d1): " << (d2 <= d1) << endl;
+ cout << "(d2 > d1): " << (d2 > d1) << endl;
+ cout << "(d2 >= d1): " << (d2 >= d1) << endl;
+
+ return 0;
+}
diff --git a/WebCore/kwq/tests/qt/qvector-test.cpp b/WebCore/kwq/tests/qt/qvector-test.cpp
new file mode 100644
index 0000000..7fceda2
--- /dev/null
+++ b/WebCore/kwq/tests/qt/qvector-test.cpp
@@ -0,0 +1,33 @@
+#include <iostream>
+
+#include <qvector.h>
+
+int main() {
+
+ QVector<int> v0 = QVector<int>(10);
+
+ int i = 0;
+ int j = 1;
+ int k = 2;
+ int l = 3;
+ int m = 4;
+ int n = 5;
+ int o = 6;
+
+ v0.insert(0,&i);
+ v0.insert(1,&j);
+ v0.insert(2,&k);
+ v0.insert(3,&l);
+ v0.insert(4,&m);
+ v0.insert(5,&n);
+ v0.insert(6,&o);
+
+ cout << v0 << endl;
+
+ cout << "finding index of 2: " << v0.find(&k) << endl;
+
+ cout << "contains 3: " << v0.containsRef(&l) << endl;
+ cout << "contains 0: " << v0.containsRef(&i) << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/qt/_qdatetime.cpp b/WebCore/src/kwq/qt/_qdatetime.cpp
index 7b461f8..1d31ddb 100644
--- a/WebCore/src/kwq/qt/_qdatetime.cpp
+++ b/WebCore/src/kwq/qt/_qdatetime.cpp
@@ -1364,6 +1364,61 @@ QDateTime QDateTime::currentDateTime()
Date/time stream functions
*****************************************************************************/
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QDate &d)
+{
+ return o <<
+ "QDate: [yy/mm/dd: " <<
+ d.year() <<
+ '/' <<
+ d.month() <<
+ '/' <<
+ d.day() <<
+ ']';
+}
+#endif
+
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QTime &t)
+{
+ return o <<
+ "QTime: [hh:mm:ss:ms = " <<
+ t.hour() <<
+ ':' <<
+ t.minute() <<
+ ':' <<
+ t.second() <<
+ ':' <<
+ t.msec() <<
+ ']';
+}
+#endif
+
+#ifdef _KWQ_IOSTREAM_
+ostream &operator<<(ostream &o, const QDateTime &dt)
+{
+ QDate d = dt.date();
+ QTime t = dt.time();
+
+ return o <<
+ "QDateTime: [yy/mm/dd hh:mm:ss:ms = " <<
+ d.year() <<
+ '/' <<
+ d.month() <<
+ '/' <<
+ d.day() <<
+ ' ' <<
+ t.hour() <<
+ ':' <<
+ t.minute() <<
+ ':' <<
+ t.second() <<
+ ':' <<
+ t.msec() <<
+ ']';
+}
+#endif
+
#ifndef QT_NO_DATASTREAM
/*!
\relates QDate
diff --git a/WebCore/src/kwq/qt/_qdatetime.h b/WebCore/src/kwq/qt/_qdatetime.h
index 0a3d04e..d5a530a 100644
--- a/WebCore/src/kwq/qt/_qdatetime.h
+++ b/WebCore/src/kwq/qt/_qdatetime.h
@@ -45,6 +45,7 @@
#endif
#include <KWQDef.h>
+#include <iostream>
// -------------------------------------------------------------------------
@@ -95,6 +96,10 @@ public:
static bool isValid( int y, int m, int d );
static bool leapYear( int year );
+#ifdef _KWQ_IOSTREAM_
+ friend ostream &operator<<(ostream &, const QDate &);
+#endif
+
protected:
static uint greg2jul( int y, int m, int d );
static void jul2greg( uint jd, int &y, int &m, int &d );
@@ -151,6 +156,10 @@ public:
int restart();
int elapsed();
+#ifdef _KWQ_IOSTREAM_
+ friend ostream &operator<<(ostream &, const QTime &);
+#endif
+
private:
static bool currentTime( QTime * );
@@ -199,6 +208,10 @@ public:
static QDateTime currentDateTime();
+#ifdef _KWQ_IOSTREAM_
+ friend ostream &operator<<(ostream &, const QDateTime &);
+#endif
+
private:
QDate d;
QTime t;
diff --git a/WebCore/src/kwq/qt/_qdict.h b/WebCore/src/kwq/qt/_qdict.h
index 3a03d00..39fc24f 100644
--- a/WebCore/src/kwq/qt/_qdict.h
+++ b/WebCore/src/kwq/qt/_qdict.h
@@ -45,6 +45,7 @@
#endif
#include <KWQDef.h>
+#include <iostream>
// -------------------------------------------------------------------------
@@ -80,6 +81,7 @@ public:
void clear() { QGDict::clear(); }
void resize( uint n ) { QGDict::resize(n); }
void statistics() const { QGDict::statistics(); }
+
private:
void deleteItem( Item d );
};
@@ -112,5 +114,26 @@ public:
type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);}
};
-
+#ifdef _KWQ_IOSTREAM_
+template <class T>
+ostream &operator<<(ostream &o, const QDict<T>&d)
+{
+ o <<
+ "QDict: [size: " <<
+ (Q_UINT32)d.count() <<
+ "; items: ";
+ QDictIterator<T> it = QDictIterator<T>(d);
+ int count = it.count();
+ for (int i = 0; i < count; i++) {
+ o << "(" << it.currentKey() << "," << *(it.current()) << ")";
+ if (i < count - 1) {
+ o << ", ";
+ }
+ ++it;
+ }
+ o << "]";
+ return o;
+}
+#endif
+
#endif // QDICT_H
diff --git a/WebCore/src/kwq/qt/_qglist.h b/WebCore/src/kwq/qt/_qglist.h
index 69e8fca..ce21e30 100644
--- a/WebCore/src/kwq/qt/_qglist.h
+++ b/WebCore/src/kwq/qt/_qglist.h
@@ -264,5 +264,4 @@ inline QCollection::Item QGListIterator::get() const
return curNode ? curNode->data : 0;
}
-
#endif // QGLIST_H
diff --git a/WebCore/src/kwq/qt/_qptrdict.h b/WebCore/src/kwq/qt/_qptrdict.h
index fe3a46b..6ac8cc5 100644
--- a/WebCore/src/kwq/qt/_qptrdict.h
+++ b/WebCore/src/kwq/qt/_qptrdict.h
@@ -45,6 +45,7 @@
#endif
#include <KWQDef.h>
+#include <iostream>
// -------------------------------------------------------------------------
@@ -109,5 +110,27 @@ public:
type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);}
};
+#ifdef _KWQ_IOSTREAM_
+template <class T>
+ostream &operator<<(ostream &o, const QPtrDict<T>&d)
+{
+ o <<
+ "QPtrDict: [size: " <<
+ (Q_UINT32)d.count() <<
+ "; items: ";
+ QPtrDictIterator<T> it = QPtrDictIterator<T>(d);
+ int count = it.count();
+ for (int i = 0; i < count; i++) {
+ o << "(" << it.currentKey() << "," << *(it.current()) << ")";
+ if (i < count - 1) {
+ o << ", ";
+ }
+ ++it;
+ }
+ o << "]";
+ return o;
+}
+#endif
+
#endif // QPTRDICT_H
diff --git a/WebCore/src/kwq/tests/qt/Makefile.in b/WebCore/src/kwq/tests/qt/Makefile.in
index 63a4122..b0eb9fd 100644
--- a/WebCore/src/kwq/tests/qt/Makefile.in
+++ b/WebCore/src/kwq/tests/qt/Makefile.in
@@ -29,8 +29,15 @@ PROGRAMS = \
qvaluelist-test \
qstringlist-test \
qlist-test \
+ qvector-test \
+ qdict-test \
+ qptrdict-test \
+ qstack-test \
qregexp-test \
qchar-test \
+ qdate-test \
+ qtime-test \
+ qdatetime-test \
$(NULL)
CLEAN_FILES = *.o \
@@ -91,12 +98,33 @@ qstringlist-test: qstringlist-test.o
qlist-test: qlist-test.o
$(CXX) -o $@ $< $(LDFLAGS)
+qvector-test: qvector-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qdict-test: qdict-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qptrdict-test: qptrdict-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qstack-test: qstack-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
qregexp-test: qregexp-test.o
$(CXX) -o $@ $< $(LDFLAGS)
qchar-test: qchar-test.o
$(CXX) -o $@ $< $(LDFLAGS)
+qdate-test: qdate-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qtime-test: qtime-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
+qdatetime-test: qdatetime-test.o
+ $(CXX) -o $@ $< $(LDFLAGS)
+
depend:
#----------------------------------------------------------------------
diff --git a/WebCore/src/kwq/tests/qt/qdate-test.chk b/WebCore/src/kwq/tests/qt/qdate-test.chk
new file mode 100644
index 0000000..693e1e2
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qdate-test.chk
@@ -0,0 +1,17 @@
+QDate: [yy/mm/dd: 1999/12/31]
+assignment: QDate: [yy/mm/dd: 1999/12/31]
+y2k: QDate: [yy/mm/dd: 2000/1/1]
+is not leap year: QDate: [yy/mm/dd: 1900/3/1]
+is leap year: QDate: [yy/mm/dd: 2000/2/29]
+Feb
+d0 is: QDate: [yy/mm/dd: 2000/2/29]
+d1 is: QDate: [yy/mm/dd: 2000/2/28]
+d2 is: QDate: [yy/mm/dd: 2000/2/28]
+(d0 < d1): 0
+(d0 <= d1): 0
+(d0 > d1): 1
+(d0 >= d1): 1
+(d2 < d1): 0
+(d2 <= d1): 1
+(d2 > d1): 0
+(d2 >= d1): 1
diff --git a/WebCore/src/kwq/tests/qt/qdate-test.cpp b/WebCore/src/kwq/tests/qt/qdate-test.cpp
new file mode 100644
index 0000000..f8f40c5
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qdate-test.cpp
@@ -0,0 +1,43 @@
+#include <iostream>
+
+#include <qdatetime.h>
+
+int main() {
+
+ QDate d0;
+ QDate d1 = QDate(1999, 12, 31);
+ QDate d2;
+
+ cout << d1 << endl;
+
+ d0 = d1;
+ cout << "assignment: " << d0 << endl;
+
+ d0 = d1.addDays(1);
+ cout << "y2k: " << d0 << endl;
+
+ d1 = QDate(1900, 2, 28);
+ d0 = d1.addDays(1);
+ cout << "is not leap year: " << d0 << endl;
+
+ d1 = QDate(2000, 2, 28);
+ d0 = d1.addDays(1);
+ cout << "is leap year: " << d0 << endl;
+
+ cout << d1.monthName(d1.month()) << endl;
+
+ d2 = d1;
+ cout << "d0 is: " << d0 << endl;
+ cout << "d1 is: " << d1 << endl;
+ cout << "d2 is: " << d2 << endl;
+ cout << "(d0 < d1): " << (d0 < d1) << endl;
+ cout << "(d0 <= d1): " << (d0 <= d1) << endl;
+ cout << "(d0 > d1): " << (d0 > d1) << endl;
+ cout << "(d0 >= d1): " << (d0 >= d1) << endl;
+ cout << "(d2 < d1): " << (d2 < d1) << endl;
+ cout << "(d2 <= d1): " << (d2 <= d1) << endl;
+ cout << "(d2 > d1): " << (d2 > d1) << endl;
+ cout << "(d2 >= d1): " << (d2 >= d1) << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/tests/qt/qdatetime-test.chk b/WebCore/src/kwq/tests/qt/qdatetime-test.chk
new file mode 100644
index 0000000..0f979c5
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qdatetime-test.chk
@@ -0,0 +1,7 @@
+QDateTime: [yy/mm/dd hh:mm:ss:ms = 1999/12/31 0:0:0:0]
+QDateTime: [yy/mm/dd hh:mm:ss:ms = 1999/12/31 23:59:59:999]
+assignment: QDateTime: [yy/mm/dd hh:mm:ss:ms = 1999/12/31 0:0:0:0]
+string: Fri Dec 31 00:00:00 1999
+setDate: QDateTime: [yy/mm/dd hh:mm:ss:ms = 2000/1/1 0:0:0:0]
+setTime: QDateTime: [yy/mm/dd hh:mm:ss:ms = 2000/1/1 0:0:0:999]
+setTime_t: QDateTime: [yy/mm/dd hh:mm:ss:ms = 2001/9/8 18:46:40:0]
diff --git a/WebCore/src/kwq/tests/qt/qdatetime-test.cpp b/WebCore/src/kwq/tests/qt/qdatetime-test.cpp
new file mode 100644
index 0000000..8279cd7
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qdatetime-test.cpp
@@ -0,0 +1,36 @@
+#include <iostream>
+
+#include <qdatetime.h>
+
+int main() {
+
+ QDate d0;
+ QDate d1 = QDate(1999, 12, 31);
+
+ QTime t0;
+ QTime t1 = QTime(23, 59, 59, 999);
+
+ QDateTime dt0;
+ QDateTime dt1 = QDateTime(d1);
+ QDateTime dt2 = QDateTime(d1, t1);
+
+ cout << dt1 << endl;
+ cout << dt2 << endl;
+
+ dt0 = dt1;
+ cout << "assignment: " << dt0 << endl;
+ cout << "string: " << dt0.toString() << endl;
+
+ d0 = d1.addDays(1);
+ dt0.setDate(d0);
+ cout << "setDate: " << dt0 << endl;
+
+ t0 = t1.addSecs(1);
+ dt0.setTime(t0);
+ cout << "setTime: " << dt0 << endl;
+
+ dt0.setTime_t(1000000000);
+ cout << "setTime_t: " << dt0 << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/tests/qt/qdict-test.chk b/WebCore/src/kwq/tests/qt/qdict-test.chk
new file mode 100644
index 0000000..dd181c7
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qdict-test.chk
@@ -0,0 +1,5 @@
+QDict: [size: 5; items: (one,1), (five,5), (four,4), (two,2), (three,3)]
+item keyed to 'one': 1
+remove item keyed to 'three': QDict: [size: 4; items: (one,1), (five,5), (four,4), (two,2)]
+d0 is empty: 1
+d1 is empty: 0
diff --git a/WebCore/src/kwq/tests/qt/qdict-test.cpp b/WebCore/src/kwq/tests/qt/qdict-test.cpp
new file mode 100644
index 0000000..1d1603d
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qdict-test.cpp
@@ -0,0 +1,34 @@
+#include <iostream>
+
+#include <qstring.h>
+#include <qdict.h>
+
+int main() {
+
+ QDict<int> d0;
+ QDict<int> d1;
+
+ int v1 = 1;
+ int v2 = 2;
+ int v3 = 3;
+ int v4 = 4;
+ int v5 = 5;
+
+ d1.insert("one", &v1);
+ d1.insert("two", &v2);
+ d1.insert("three", &v3);
+ d1.insert("four", &v4);
+ d1.insert("five", &v5);
+
+ cout << d1 << endl;
+
+ cout << "item keyed to 'one': " << *(d1.find("one")) << endl;
+
+ d1.remove("three");
+ cout << "remove item keyed to 'three': " << d1 << endl;
+
+ cout << "d0 is empty: " << d0.isEmpty() << endl;
+ cout << "d1 is empty: " << d1.isEmpty() << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/tests/qt/qmap-test.chk b/WebCore/src/kwq/tests/qt/qmap-test.chk
index b57c787..a8e9d11 100644
--- a/WebCore/src/kwq/tests/qt/qmap-test.chk
+++ b/WebCore/src/kwq/tests/qt/qmap-test.chk
@@ -1 +1,5 @@
-QMap: [size: 2; items: (1,10), (2,20)]
+QMap: [size: 5; items: (1,10), (2,20), (3,30), (4,40), (5,50)]
+item keyed to 'one': 10
+remove item keyed to 'three': QMap: [size: 4; items: (1,10), (2,20), (4,40), (5,50)]
+d0 is empty: 1
+d1 is empty: 0
diff --git a/WebCore/src/kwq/tests/qt/qmap-test.cpp b/WebCore/src/kwq/tests/qt/qmap-test.cpp
index 916f478..fc6a1e3 100644
--- a/WebCore/src/kwq/tests/qt/qmap-test.cpp
+++ b/WebCore/src/kwq/tests/qt/qmap-test.cpp
@@ -4,12 +4,24 @@
int main() {
- QMap<int,int> m1;
+ QMap<int,int> d0;
+ QMap<int,int> d1;
- m1.insert(1,10);
- m1.insert(2,20);
+ d1.insert(1, 10);
+ d1.insert(2, 20);
+ d1.insert(3, 30);
+ d1.insert(4, 40);
+ d1.insert(5, 50);
- cout << m1 << endl;
+ cout << d1 << endl;
+
+ cout << "item keyed to 'one': " << *(d1.find(1)) << endl;
+
+ d1.remove(3);
+ cout << "remove item keyed to 'three': " << d1 << endl;
+
+ cout << "d0 is empty: " << d0.isEmpty() << endl;
+ cout << "d1 is empty: " << d1.isEmpty() << endl;
return 0;
}
diff --git a/WebCore/src/kwq/tests/qt/qptrdict-test.chk b/WebCore/src/kwq/tests/qt/qptrdict-test.chk
new file mode 100644
index 0000000..b3ed2c9
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qptrdict-test.chk
@@ -0,0 +1,8 @@
+item keyed to 1: 1
+item keyed to 2: 2
+item keyed to 3: 3
+item keyed to 4: 4
+item keyed to 5: 5
+item keyed to 2: 0x0
+d0 is empty: 1
+d1 is empty: 0
diff --git a/WebCore/src/kwq/tests/qt/qptrdict-test.cpp b/WebCore/src/kwq/tests/qt/qptrdict-test.cpp
new file mode 100644
index 0000000..47bebff
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qptrdict-test.cpp
@@ -0,0 +1,36 @@
+#include <iostream>
+
+#include <qstring.h>
+#include <qptrdict.h>
+
+int main() {
+
+ QPtrDict<int> d0;
+ QPtrDict<int> d1;
+
+ int v1 = 1;
+ int v2 = 2;
+ int v3 = 3;
+ int v4 = 4;
+ int v5 = 5;
+
+ d1.insert(&v1, &v1);
+ d1.insert(&v2, &v2);
+ d1.insert(&v3, &v3);
+ d1.insert(&v4, &v4);
+ d1.insert(&v5, &v5);
+
+ cout << "item keyed to 1: " << *(d1.find(&v1)) << endl;
+ cout << "item keyed to 2: " << *(d1.find(&v2)) << endl;
+ cout << "item keyed to 3: " << *(d1.find(&v3)) << endl;
+ cout << "item keyed to 4: " << *(d1.find(&v4)) << endl;
+ cout << "item keyed to 5: " << *(d1.find(&v5)) << endl;
+
+ d1.remove(&v2);
+ cout << "item keyed to 2: " << d1.find(&v2) << endl;
+
+ cout << "d0 is empty: " << d0.isEmpty() << endl;
+ cout << "d1 is empty: " << d1.isEmpty() << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/tests/qt/qstack-test.chk b/WebCore/src/kwq/tests/qt/qstack-test.chk
new file mode 100644
index 0000000..7268411
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qstack-test.chk
@@ -0,0 +1,12 @@
+QStack: [size: 0; items: ]
+push test:
+QStack: [size: 5; items: 4, 3, 2, 1, 0]
+pop test:
+4
+3
+2
+1
+0
+QStack: [size: 5; items: 4, 3, 2, 1, 0]
+clear test:
+QStack: [size: 0; items: ]
diff --git a/WebCore/src/kwq/tests/qt/qstack-test.cpp b/WebCore/src/kwq/tests/qt/qstack-test.cpp
new file mode 100644
index 0000000..e87602c
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qstack-test.cpp
@@ -0,0 +1,41 @@
+#include <iostream>
+
+#include <qstack.h>
+
+int main() {
+
+ QStack<int> s0;
+ QStack<int> s1 = QStack<int>();
+
+ int i0 = 0;
+ int i1 = 1;
+ int i2 = 2;
+ int i3 = 3;
+ int i4 = 4;
+
+ cout << s0 << endl;
+
+ s0.push(&i0);
+ s0.push(&i1);
+ s0.push(&i2);
+ s0.push(&i3);
+ s0.push(&i4);
+
+ cout << "push test: " << endl;
+ cout << s0 << endl;
+
+ s1 = s0;
+ cout << "pop test: " << endl;
+ int count = s1.count();
+ for (int i = 0; i < count; i++) {
+ cout << *(s1.pop()) << endl;
+ }
+
+ s1 = s0;
+ cout << s1 << endl;
+ cout << "clear test: " << endl;
+ s1.clear();
+ cout << s1 << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/tests/qt/qtime-test.chk b/WebCore/src/kwq/tests/qt/qtime-test.chk
new file mode 100644
index 0000000..ca9d7c1
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qtime-test.chk
@@ -0,0 +1,15 @@
+QTime: [hh:mm:ss:ms = 23:59:59:999]
+assignment: QTime: [hh:mm:ss:ms = 23:59:59:999]
+day roll (seconds): QTime: [hh:mm:ss:ms = 0:0:0:999]
+day roll (milli-seconds): QTime: [hh:mm:ss:ms = 0:0:0:0]
+d0 is: QTime: [hh:mm:ss:ms = 0:0:0:0]
+d1 is: QTime: [hh:mm:ss:ms = 23:59:59:999]
+d2 is: QTime: [hh:mm:ss:ms = 23:59:59:999]
+(d0 < d1): 1
+(d0 <= d1): 1
+(d0 > d1): 0
+(d0 >= d1): 0
+(d2 < d1): 0
+(d2 <= d1): 1
+(d2 > d1): 0
+(d2 >= d1): 1
diff --git a/WebCore/src/kwq/tests/qt/qtime-test.cpp b/WebCore/src/kwq/tests/qt/qtime-test.cpp
new file mode 100644
index 0000000..67acba9
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qtime-test.cpp
@@ -0,0 +1,37 @@
+#include <iostream>
+
+#include <qdatetime.h>
+
+int main() {
+
+ QTime d0;
+ QTime d1 = QTime(23, 59, 59, 999);
+ QTime d2;
+
+ cout << d1 << endl;
+
+ d0 = d1;
+ cout << "assignment: " << d0 << endl;
+
+ d0 = d1.addSecs(1);
+ cout << "day roll (seconds): " << d0 << endl;
+
+ d0 = d1;
+ d0 = d1.addMSecs(1);
+ cout << "day roll (milli-seconds): " << d0 << endl;
+
+ d2 = d1;
+ cout << "d0 is: " << d0 << endl;
+ cout << "d1 is: " << d1 << endl;
+ cout << "d2 is: " << d2 << endl;
+ cout << "(d0 < d1): " << (d0 < d1) << endl;
+ cout << "(d0 <= d1): " << (d0 <= d1) << endl;
+ cout << "(d0 > d1): " << (d0 > d1) << endl;
+ cout << "(d0 >= d1): " << (d0 >= d1) << endl;
+ cout << "(d2 < d1): " << (d2 < d1) << endl;
+ cout << "(d2 <= d1): " << (d2 <= d1) << endl;
+ cout << "(d2 > d1): " << (d2 > d1) << endl;
+ cout << "(d2 >= d1): " << (d2 >= d1) << endl;
+
+ return 0;
+}
diff --git a/WebCore/src/kwq/tests/qt/qvector-test.cpp b/WebCore/src/kwq/tests/qt/qvector-test.cpp
new file mode 100644
index 0000000..7fceda2
--- /dev/null
+++ b/WebCore/src/kwq/tests/qt/qvector-test.cpp
@@ -0,0 +1,33 @@
+#include <iostream>
+
+#include <qvector.h>
+
+int main() {
+
+ QVector<int> v0 = QVector<int>(10);
+
+ int i = 0;
+ int j = 1;
+ int k = 2;
+ int l = 3;
+ int m = 4;
+ int n = 5;
+ int o = 6;
+
+ v0.insert(0,&i);
+ v0.insert(1,&j);
+ v0.insert(2,&k);
+ v0.insert(3,&l);
+ v0.insert(4,&m);
+ v0.insert(5,&n);
+ v0.insert(6,&o);
+
+ cout << v0 << endl;
+
+ cout << "finding index of 2: " << v0.find(&k) << endl;
+
+ cout << "contains 3: " << v0.containsRef(&l) << endl;
+ cout << "contains 0: " << v0.containsRef(&i) << endl;
+
+ return 0;
+}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list