View previous topic :: View next topic |
Author |
Message |
manni
Joined: 16 Jan 2006 Posts: 25
|
Posted: Fri Dec 28, 2007 2:33 am Post subject: Compilation problems |
|
|
Hello,
i try to compile the example BasicMocks.
Code: |
import dmocks.Mocks;
interface IAssociate (T) {
uint calculate (ubyte[] data);
bool isStored (T item);
void store (T item);
}
class ToTest {
private IAssociate!(real) _associate;
public this (IAssociate!(real) associate) {
_associate = associate;
}
uint calculate (real number, ubyte[] data) {
if (!_associate.isStored(number)) {
_associate.store(number);
return _associate.calculate(data);
} else {
return 0;
}
}
unittest {
auto mock = new Mocker;
auto associate = mock.Mock!(IAssociate!(real));
real number = 7.23;
ubyte[] data = new ubyte[4];
uint result = 42;
mock.Expect(associate.isStored(number)).Return(false);
associate.store(number);
mock.Expect(associate.calculate(data)).Return(result);
mock.Replay();
auto target = new ToTest(associate);
assert (target.calculate(number, data) == result);
mock.Verify();
}
}
|
dmd -unittest ToTest.d
dmd/src/phobos/std/variant.d(584): static assert is false
dmd 2.0.8 under linux
Manfred |
|
Back to top |
|
|
dhasenan
Joined: 03 Feb 2005 Posts: 73 Location: New York
|
Posted: Fri Jan 18, 2008 9:15 am Post subject: |
|
|
Fixed on trunk. |
|
Back to top |
|
|
manni
Joined: 16 Jan 2006 Posts: 25
|
Posted: Mon Jan 21, 2008 1:38 am Post subject: |
|
|
Thanks |
|
Back to top |
|
|
|