Commit Graph

15 Commits

Author SHA1 Message Date
Max Horn
94dfc8f638 Fixed a bug in Common::Array (including a unit test for it), and changed the way the internal storage growth over time.
The bug could result in incorrect results when using push_back (or insert_at)
to insert data from an array into itself if this insertions would cause the
internal array storage to grow. Also added a unit test for this bug.

Furthermore, if the internal storage needs to grow, it will now be resized to the next power of two,
instead of being increased by 32.

svn-id: r40907
2009-05-26 11:28:38 +00:00
Max Horn
2b32ba7cb3 Converted unit tests to use TS_ASSERT_EQUALS / TS_ASSERT_DIFFERS where possible; also made them comply a bit more to our code formatting guideline
svn-id: r40722
2009-05-19 11:22:49 +00:00
Max Horn
c379927d3a Added unit test for Common::Array::resize()
svn-id: r40261
2009-05-03 09:00:13 +00:00
Max Horn
e579f91b5c COMMON: Made sure Common::List and Common::array each have all front/back/push_back/push_front, as have their STL counterparts
svn-id: r40163
2009-04-27 14:23:20 +00:00
Max Horn
b98f79fe12 COMMON: changed class StringList to a simple typedef; enhanced the Common::Array constructor which converts regular arrays to Array objects to be more flexible in its type (allows e.g. to assign an array of char* to a StringList
svn-id: r40077
2009-04-22 17:52:56 +00:00
Johannes Schickel
1453f1849b Fix warnings (patch for array.h was supplied via salty-horse on IRC).
svn-id: r40054
2009-04-21 19:14:11 +00:00
Max Horn
78cf5a4ccf COMMON & TESTS: Added new constructor to Array<T>, namely Array(const T* data, int n), which makes it possible to clone a regular array into a Common::Array; added a unit test for that and slightly extended existing Common::Array unit tests
svn-id: r40027
2009-04-20 19:27:11 +00:00
Max Horn
faa9117949 TESTS: Code formatting; also changed some TS_ASSERT to TS_ASSERT_EQUALS
svn-id: r40026
2009-04-20 19:26:50 +00:00
Nicola Mettifogo
258901bab9 Merged common/stdafx.h into common/scummsys.h. All referencing files have been updated.
svn-id: r28966
2007-09-19 08:40:12 +00:00
Johannes Schickel
ad03c72bdb Commit of patch #1715313 ("CORE: STL like algorithm implementation").
svn-id: r26929
2007-05-23 12:02:31 +00:00
Max Horn
9f93e5bb81 Renamed various container isEmpty() methods to empty() to match STL conventions
svn-id: r21472
2006-03-28 09:42:54 +00:00
Eugene Sandulenko
6b4484472b Remove trailing whitespaces.
svn-id: r18604
2005-07-30 21:11:48 +00:00
Max Horn
8b1d7b9166 When including files from common/, explicitly use the common/ prefix
svn-id: r18444
2005-06-24 15:23:51 +00:00
Max Horn
7a772513c5 Updated unit tests
svn-id: r13847
2004-05-21 17:43:16 +00:00
Max Horn
3b206ee83e Skeleton unit test for array class
svn-id: r13556
2004-04-12 01:19:39 +00:00