FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compilation problems

 
Post new topic   Reply to topic     Forum Index -> DMocks
View previous topic :: View next topic  
Author Message
manni



Joined: 16 Jan 2006
Posts: 25

PostPosted: Fri Dec 28, 2007 2:33 am    Post subject: Compilation problems Reply with quote

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
View user's profile Send private message
dhasenan



Joined: 03 Feb 2005
Posts: 73
Location: New York

PostPosted: Fri Jan 18, 2008 9:15 am    Post subject: Reply with quote

Fixed on trunk.
Back to top
View user's profile Send private message AIM Address
manni



Joined: 16 Jan 2006
Posts: 25

PostPosted: Mon Jan 21, 2008 1:38 am    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DMocks All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group