Changeset 68:3a737e06dc50
- Timestamp:
- 07/04/08 13:49:16
(6 months ago)
- Author:
- Diggory Hardy <diggory.hardy@gmail.com>
- branch:
- default
- Message:
Unittests: fixes and changes. Plus some doc changes.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r15 |
r68 |
|
| 3 | 3 | {Default} |
|---|
| 4 | 4 | <uint[][uint]|B=[ 0x8800001B : [[0x1000, 0x0]] ]> |
|---|
| 5 | | {UnitTest} |
|---|
| 6 | | <uint[][uint]|B=[ |
|---|
| 7 | | 0x88000124 : [[0x1000, 0x00F0]], |
|---|
| 8 | | 0x40000003 : [[0x1000, 0x01F0]], |
|---|
| 9 | | 0x20002005 : [ [0x1000,0x02F0],[0x1000,0x03F0] ], |
|---|
| 10 | | 0x110D600C : [[0x1000,0x04F0]], |
|---|
| 11 | | 0x120D600C : [[0x1000,0x05F0]], |
|---|
| 12 | | 0x140D600C : [[0x1000,0x06F0]], |
|---|
| 13 | | 0x180D600C : [[0x1000,0x07F0]] ]> |
|---|
| 14 | | <uint[][uint]|A=[0x80001008 : [[0x1000,0x20F0]],0x130D600C : [[0x1000,0x21F0]] , 0x1C0D600C : [[0x1000,0x22F0]]]> |
|---|
| 15 | | <uint[][uint]|M=[ 0x88000000 : [[0x1000, 0x10F0], [0x1000, 0x11F0]], 0x40016064:[[0x1000,0x12F0]]]> |
|---|
| r54 |
r68 |
|
| 2 | 2 | License: GNU General Public License version 2 or later (see COPYING) |
|---|
| 3 | 3 | |
|---|
| 4 | | Some brief info: |
|---|
| | 4 | --- Some brief info --- |
|---|
| 5 | 5 | |
|---|
| 6 | | Platforms: |
|---|
| 7 | | I work on mde using linux and perform most testing on this platform. |
|---|
| 8 | | I have done a little testing on Windows, but currently it's highly likely there may be problems on this platform. |
|---|
| | 6 | -- Platforms -- |
|---|
| | 7 | Linux: My development platform. |
|---|
| | 8 | Windows: Poorly tested; dsss.conf needs some adjusting. |
|---|
| | 9 | |
|---|
| | 10 | -- Dependencies -- |
|---|
| | 11 | Compile-time: |
|---|
| | 12 | tango (at least r3697) |
|---|
| | 13 | tango.scrapple (newer than current r58!) |
|---|
| | 14 | derelict (at least r300) |
|---|
| | 15 | |
|---|
| | 16 | Run-time: |
|---|
| | 17 | Sdl |
|---|
| | 18 | FreeType 2.3.5 (2.3.0 might work; older versions probably won't due to the binding not finding some (unneeded) symbols). |
|---|
| | 19 | OpenGL 1.3 or higher |
|---|
| | 20 | |
|---|
| 9 | 21 | |
|---|
| 10 | 22 | Build instructions: |
|---|
| … | … | |
| 15 | 27 | Testing: |
|---|
| 16 | 28 | dsss clean (this is important if a previous build exists!) |
|---|
| 17 | | dsss build bin/mdeTest |
|---|
| | 29 | dsss build -debug -debug=mdeUnitTest -C-unittest |
|---|
| | 30 | bin/mde or bin\mde |
|---|
| 18 | 31 | |
|---|
| 19 | 32 | Credits: |
|---|
| r56 |
r68 |
|
| 17 | 17 | [util/mtcp.d] |
|---|
| 18 | 18 | target=bin/mtcp |
|---|
| 19 | | |
|---|
| 20 | | [test/mdeTest.d] |
|---|
| 21 | | buildflags=-debug -debug=mdeUnitTest -unittest |
|---|
| 22 | | target=bin/mdeTest |
|---|
| 23 | | noinstall |
|---|
| 24 | | version (Posix) { |
|---|
| 25 | | buildflags+=-L-ldl |
|---|
| 26 | | } |
|---|
| r67 |
r68 |
|
| 155 | 155 | else file.read(); // otherwise read all |
|---|
| 156 | 156 | } |
|---|
| 157 | | catch (MT.MTException) { |
|---|
| 158 | | logger.fatal ("Unable to load configs from: " ~ filename); |
|---|
| | 157 | catch (MT.MTException e) { |
|---|
| | 158 | logger.fatal ("Unable to load configs from: " ~ filename ~ ":"); |
|---|
| | 159 | logger.fatal (e.msg); |
|---|
| 159 | 160 | throw new ConfigLoadException; |
|---|
| 160 | 161 | } |
|---|
| r63 |
r68 |
|
| 350 | 350 | * Throws: ConfigLoadException if unable to load any configs or the requested config id wasn't |
|---|
| 351 | 351 | * found. */ |
|---|
| 352 | | void loadConfig (char[] profile = "Default") { |
|---|
| 353 | | Config.load("input"); // FIXME: filename |
|---|
| | 352 | void loadConfig (char[] file, char[] profile = "Default") { |
|---|
| | 353 | Config.load(file); |
|---|
| 354 | 354 | Config* c_p = profile in Config.configs; |
|---|
| 355 | 355 | if (c_p) config = *c_p; |
|---|
| … | … | |
| 546 | 546 | |
|---|
| 547 | 547 | /* This unittest covers input.config.Config and input.input.Input for some events of all types. |
|---|
| 548 | | * It is not bullet-proof, and does not cover the steam-functions other than the direct output |
|---|
| | 548 | * It is not bullet-proof, and does not cover the stream-functions other than the direct output |
|---|
| 549 | 549 | * ones (largely because these may get added at any time and tested via input tests). |
|---|
| 550 | 550 | * |
|---|
| … | … | |
| 558 | 558 | debug (mdeUnitTest) unittest { |
|---|
| 559 | 559 | Input ut = new Input(); |
|---|
| 560 | | ut.loadConfig ("UnitTest"); |
|---|
| | 560 | ut.loadConfig ("unittest/InputConfig"); |
|---|
| 561 | 561 | |
|---|
| 562 | 562 | int[6] counters; // counters for callbacks |
|---|
| r64 |
r68 |
|
| 41 | 41 | //BEGIN Initialisation |
|---|
| 42 | 42 | Logger logger = Log.getLogger ("mde.mde"); |
|---|
| | 43 | debug (mdeUnitTest) { |
|---|
| | 44 | logger.info ("Compiled unittests have completed; terminating."); |
|---|
| | 45 | return 0; |
|---|
| | 46 | } |
|---|
| 43 | 47 | |
|---|
| 44 | 48 | // Create instances now, so they can be used during init (if necessary) |
|---|
| r63 |
r68 |
|
| 72 | 72 | void initInput () { // init func |
|---|
| 73 | 73 | try { |
|---|
| 74 | | imde.input.loadConfig (); // (may also create instance) |
|---|
| | 74 | imde.input.loadConfig ("input"); |
|---|
| 75 | 75 | |
|---|
| 76 | 76 | // Quit on escape. NOTE: quit via SDL_QUIT event is handled completely independently! |
|---|
| r67 |
r68 |
|
| 132 | 132 | } body { |
|---|
| 133 | 133 | FilePath[] ret; |
|---|
| | 134 | |
|---|
| | 135 | debug (mdeUnitTest) { |
|---|
| | 136 | /* Alternate approach - just try from current directory. |
|---|
| | 137 | * Really just for unittests, but with the if condition it shouldn't break anything else. */ |
|---|
| | 138 | if (pathsLen == 0) { |
|---|
| | 139 | FilePath file = findFile (filename); |
|---|
| | 140 | if (file !is null) |
|---|
| | 141 | ret ~= file; |
|---|
| | 142 | return ret; |
|---|
| | 143 | } |
|---|
| | 144 | } |
|---|
| | 145 | |
|---|
| 134 | 146 | if (readOrder == PRIORITY.LOW_HIGH) { |
|---|
| 135 | 147 | for (size_t i = 0; i < pathsLen; ++i) { |
|---|