| Thread overview |
|---|
August 26, 2014 There is a bug for '-unittest'? | ||||
|---|---|---|---|---|
| ||||
Hello,every one:
There is a unit test for a.d,it will be pass,do you think it's right?
or it's my error?
/////// the file name is a.d
class Math
{
/// add function
static int add(int x, int y) { return x + y; }
///
unittest
{
// assert(add(2, 2) == 5);
assert(add(-2,0) == 0);
}
}
class Sum {
int add(int x, int y) { return x + y; }
unittest
{
Sum sum = new Sum;
//assert(sum.add(-2,0) == -2);
assert(sum.add(-2,0) == 2);
}
}
void main()
{
}
//// build.bat
dmd -unittest a.d
pause
-------------------------end----------------------------
Thank you.
| ||||
August 26, 2014 Re: There is a bug for '-unittest'? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to FrankLike Attachments: | On Tue, 26 Aug 2014 13:38:17 +0000 FrankLike via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > dmd -unittest a.d so? you compiled the code. but you need to run the resulting .exe to invoke unittests. or just use 'rdmd' instead. | |||
August 26, 2014 Re: There is a bug for '-unittest'? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Tuesday, 26 August 2014 at 13:49:39 UTC, ketmar via Digitalmars-d-learn wrote:
> On Tue, 26 Aug 2014 13:38:17 +0000
> FrankLike via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com>
> wrote:
>
>> dmd -unittest a.d
> so? you compiled the code. but you need to run the resulting .exe to
> invoke unittests.
>
> or just use 'rdmd' instead.
Thank you,l use it by d.chm.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply