Thread overview | ||||||
---|---|---|---|---|---|---|
|
December 18, 2002 postconditions? | ||||
---|---|---|---|---|
| ||||
Is there any way to do tests on out/inout stuff that gets changed in functions in the function postconditions? Although I guess you can use other contracts to get around this lack, I think that it would be nice to be able to test them in the postcondition code, so that all of the tests for the functions are in the same place. Evan |
December 18, 2002 Re: postconditions? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Evan McClanahan | Evan McClanahan wrote:
> Is there any way to do tests on out/inout stuff that gets changed in functions in the function postconditions? Although I guess you can use other contracts to get around this lack, I think that it would be nice to be able to test them in the postcondition code, so that all of the tests for the functions are in the same place.
>
> Evan
Are you talking about testing the effects of a function, not just the result? That might be better tested in a unittest function that runs the function many times with different inputs and then checks the result. I think (not 100% sure) that you can defined multiple unittests in a single module; I would write the unittest right next to the function declaration.
|
December 18, 2002 Re: postconditions? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Evan McClanahan | Yes, just put the assert's in the out { } block. "Evan McClanahan" <evan@dontSPAMaltarinteractive.com> wrote in message news:atq57d$2nr6$1@digitaldaemon.com... > Is there any way to do tests on out/inout stuff that gets changed in functions in the function postconditions? Although I guess you can use other contracts to get around this lack, I think that it would be nice to be able to test them in the postcondition code, so that all of the tests for the functions are in the same place. > > Evan > |
Copyright © 1999-2021 by the D Language Foundation