My asserts aren't generating message boxes, sometimes they send a message to debug output and end the thread without giving me a more aggressive notification. How can I force all my Debug.Asserts to just throw, so I know that I see them?
...
I'm working on a multi-threaded win32 MFC application. We are rendering a map and displaying it in a pane in the user interface along with custom-rendered objects on top. It's slow to render (~800 ms), which is happening on the User Interface thread.
I'm trying to move the rendering onto its own thread so that the menus still remain s...
There appear to be Assert.assertArrayEquals() methods in Junit4 for all primitives other than double, e.g.
Assert.assertArrayEquals(int[] expected, int[] actual)
and
Assert.assertArrayEquals(char[] expected, char[] actual)
but not
Assert.assertArrayEquals(double[] expected, double[] actual, double eps)
or
Assert.assertArrayEqu...
I have an exe using a dll which is using another dll. This situation has arisen:
In dll1:
class abc
{
static bool FindSubFolders(const std::string & sFolderToCheck,
std::vector< std::string > & vecSubFoldersFound);
}
In dll2:
void aFunction()
{
std::vector<std::string> folders;
std::string...
I find myself writing the same argument checking code all the time for number-crunching:
def myfun(a, b):
if a < 0:
raise ValueError('a cannot be < 0 (was a=%s)' % a)
# more if.. raise exception stuff here ...
return a + b
Is there a better way? I was told not to use 'assert' for these things (though I don't see th...
Could you give an example where static_assert(...) 'C++0x' would solve the problem in hand elegantly?
I am familiar with run-time assert(...). When should I prefer static_assert(...) over regular assert(...)?
Also, in boost there is something called BOOST_STATIC_ASSERT, is it the same as static_assert(...)?
...
Python has a flag -O that you can execute the interpreter with. The option will generate "optimized" bytecode (written to .pyo files), and given twice, it will discard docstrings. From Python's man page:
-O Turn on basic optimizations. This changes the filename exten‐
sion for compiled (bytecode) files from .pyc ...
I have a very big constant array that is initialized at compile time.
typedef enum {
VALUE_A, VALUE_B,...,VALUE_GGF
} VALUES;
const int arr[VALUE_GGF+1] = { VALUE_A, VALUE_B, ... ,VALUE_GGF};
I want to verify that the array is initialized properly, something like:
if (arr[VALUE_GGF] != VALUE_GGF) {
printf("Error occurred. arr[VA...
When an assertion fails with Visual C++ on Windows, the debugger stops, displays the message, and then lets you continue (or, if no debugging session is running, offers to launch visual studio for you).
On Linux, it seems that the default behavior of assert() is to display the error and quit the program. Since all my asserts go through ...
This question is close, but still not what I want. I'd like to assert in a generic way that two bean objects are equivalent. In case they are not, I'd like a detailed error message explaining the difference instead of a boolean "equal" or "not equal".
...
I have a WPF application in which I'm moving data around on a Canvas.
The problem started when I tried moving the data with the mouse like a freak.
Here's the sequence of the actions:
The MouseMove on the Canvas is triggered
In the MouseMove, I change some data
A Trace.Assert FAILS. The debugger does not break, neither is the message...
Short question, why do Assert.AreEqual(1.0, double.NaN, 0.0) pass when Assert.AreEqual(1.0, double.NaN) do not?
Is it an error in MSTest or am I missing something here?
Best regards, Egil.
Update: Should probably add, that the reason behind my question is, that I have a bunch of unit tests that unfortunately passed due to the result o...
A Flash movie loads another movie that contains various asserts - movie clips in its library with 'Export for Action Script' settings set.
Is there any way to determine the list of class names of all these exported asserts from within the movie that loads them?
...
Hey SO
for (int i = TrueProbDie; i < 100; i++) {
assert(i>=0);
probs[i] = 1;
}
Im getting an ArrayIndexOutOfBoundsException on this code, due to i becoming negative, this I can solve by editing my other code, what getting me is that its ever making it to the
probs[i] = 1;
line as should throw an error on
assert(i>=0);
, if ...
I have some code-under-test that calls on a java logger to report its status.
In the junit test code, I would like to verify that the correct log entry was made in this logger. Something along the following lines:
methodUnderTest(bool x){
if(x)
logger.info("x happened")
}
@Test tester(){
// perhaps setup a logger first...
This is what I normally do in order to ascertain that the input is a list/tuple - but not a str. Because many times I stumbled upon bugs where a function passes a str object by mistake, and the target function does for x in lst assuming that lst is actually a list or tuple.
assert isinstance(lst, (list, tuple))
My question is: is ther...
In C and C++ assert is a very heavyweight routine, writing an error to stdout and terminating the program. In our application we have implemented a much more robust replacement for assert and given it its own macro. Every effort has been made to replace assert with our macro, however there are still many ways assert can be reintroduced (...
The Go language creators write:
Go doesn't provide assertions. (...) Programmers use them as a crutch to
avoid thinking about proper error
handling and reporting.
What is your opinion about this?
...
When do we need to use "assert" for pointers in C++, and when they are used, how are they most commonly implemented?
...
Should unit testing be run in debug or release mode?
I am using Visual Studio Standard Edition 2005 which does not come with any unit testing framework. Since I also do not want to make use of any other 3rd party unit testing framework, I used Debug.Assert to perform the actual test inside all unit test methods. However, Debug.Assert on...