Skip to content
Open
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LIBNAME=orange
DC?=dmd
PREFIX?=/usr/local
#Warning, unittests fail with VERSION=release
#Note: unittests now work well with -inline and -release
VERSION?=standard
LIBDIR=lib/$(MODEL)
ARCH=$(shell arch || uname -m)
Expand Down
2 changes: 1 addition & 1 deletion Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
LIBNAME=orange
PREFIX?=Install
DC?=dmd
#Warning, unittests fail with VERSION=release
#Note: unittests now work well with -inline and -release
VERSION?=standard
LIBDIR=lib/$(MODEL)

Expand Down
8 changes: 6 additions & 2 deletions orange/serialization/archives/Archive.d
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,9 @@ abstract class ArchiveBase (U) : Archive
static if (isFloatingPoint!(T))
return floatingPointToData(value);

else
//Note: Inlining bug workaround: "if(true)" is necessary to prevent
// omission of "else" clause. Also works with: "if (!isFloatingPoint!(T))".
else if (true)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this issue reported?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but tests failed when -O -inline was added to unittest.sh (and there was an obscure comment in the Makefile's). The output was the following:

    orange.serialization.SerializationException.SerializationException@orange\serial
    ization\SerializationException.d(25): Could not find an element "array" with the
     attribute "key" with the value "arr".
    ----------------
    0x004273EA in D6orange13serialization10Serializer10Serializer6__ctorMFC6orange13
    serialization8archives7Archive7ArchiveZC6orange13serialization10Serializer10Seri
    alizer9__lambda2MFNaNfC6orange13serialization22SerializationException22Serializa
    tionExceptionZv
    ----------------

when compiling with -g -O -inline -release.
--jm

return to!(Data)(value);
}

Expand Down Expand Up @@ -1383,7 +1385,9 @@ abstract class ArchiveBase (U) : Archive
static if (is(T == wchar))
return toWchar(value);

else
//Note: Inlining bug workaround: "if(true)" is necessary to prevent
// omission of "else" clause. Also works with: "if (!isFloatingPoint!(T))".
else if (true)
return to!(T)(value);
}

Expand Down
5 changes: 4 additions & 1 deletion tests/Primitive.d
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ unittest
h.ushort_ = 1U;
h.wchar_ = 'c';

enum zero = "0x0p+0";
version(Windows)
enum zero = "0x0.p+0";
else
enum zero = "0x0p+0";

describe("serialize primitives") in {
it("should return serialized primitives") in {
Expand Down
42 changes: 42 additions & 0 deletions unittest.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@echo off
REM ___Builds and runs Orange unit tests___


rem Test for 'delayed environment variable expansion':
set TESTVAR=before
if "%TESTVAR%" == "before" (
set TESTVAR=after
if not "!TESTVAR!" == "after" (
rem Enabling env var expansion with /V, to build the list of .d files:
cmd.exe /V /C unittest.bat
exit /B
)
)


rem Build list of .d files:
set dfiles=
for %%D in (
orange\core
orange\serialization
orange\serialization\archives
orange\test
orange\util
orange\util\collection
orange\xml
tests
) do (
for %%X in (%%D\*.d) do (
set dfiles=!dfiles! %%X
)
)


rem Compile:
dmd -unittest -ofunittest %dfiles%


rem Run (only if compilation succeded):
if "%errorlevel%" == "0" (
.\unittest.exe
)