assertion

Assertions in C89?

I'm writing C89 on MSFT Visual Studio 2010 Beta. How can I make an assertion, similar to Java's assert keyword? I think I need to define a macro, but I'm not sure how. (It seems like this is something that's been done before, so I'd rather use that than try to roll my own.) Here's a guess: int assert(int truth_value) { // crash the ...

How to validate a SAML signature value

Hi, I have a customer who is sending a Security key. The encryption they are using is triple DES. Every Assertion they send has a signature value which needs to be validated to give them necessary privileges. Can you give me a sample code which does this? Thanks, King ...

Assertion Error: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

I get the error in the title in the following code: std::vector<short> GetIndicesFromID3DXMesh(ID3DXMesh* model) { //LPVOID * ppData; DWORD stride = sizeof(short); BYTE* ibptr = NULL; short* indices = new short[model->GetNumFaces() * 3]; std::vector<short> copy; model->LockIndexBuffer(0, (LPVOID*)&indices); ...

Rhino Mocks -- assert no interaction with mock/stub

Is it possible to tell that a mock/stub has seen no interaction at all in RhinoMocks. Something along the lines of: logger.AssertNoInteraction(); Which would assert no method has been called on the stubbed logger. This would be a much less tedious than calling the following each time: logger.AssertWasNotCalled(l => l.Debug(Arg<strin...

how to insert a SAML Assertion to SOAPHeader

NB-6.8 jdk-1.6.14 WSS4j-1.5.8 ,OpenSAML-2.3.0 I try to modify WSS4J-1.5.8 to operate SAML 2.0, and I could not insert a generated assertion to existing SOAP Header, the code like this: Assertion assertion = createAssertion("some subject", "some issuer"); Document doc = docBuilder.parse("request.xml"); Element parent = doc.getD...

How do i assert my exception message with JUNIT Test annotation ?

i have written a few junits with @Test annotation. If my test method throws a checked exception and if i want to assert the message along with the exception, is there a way to do so with JUNIT @Test annotation.AFAIK, Junit 4.7 doesnt provide this feature but does any future versions provide it. I know in .NET you can assert the message a...

Accessing a dialog from Another dialog MFC

Hi, I want to open a separate dialog box when I cllick on a button on my main dialog. I used separateDialog.DoModal() to do it. It open successfully but when I try to add data to a edit control (text box) in that seperate dialog, a debug assertion failure occurs. What is the matter and how can I overcome it? This is what I did: void C...

C malloc assertion help

I am implementing a divide and conquer polynomial algorithm so i can bench it against an opencl implementation, but i can't seem to get malloc to work. When I run the program it allocates a bunch of stuff, checks some things, then sends the size/2 to the algorithm. Then when I hit the malloc line again it spits out this: malloc.c:309...

Has anyone encountered performance issues with post assertions

Has anyone moved to use artifact versus post assertions to improve performance and security ...

Debug assertion failure in C++

Hello everyone, This is my first question on stackoverflow. I am trying to debug a program but when I try to run it, it terminates with error message Debug Assertion failed and when I retry to debug it a break-point is created which takes me to vector in this function #if _HAS_ITERATOR_DEBUGGING _Vector_const_iterator(_Tptr _Ptr, co...

In rspec, why can't I use be_false etc in helper classes?

When using a helper class with an rspec test, I can't see to use the .should be_false idiom. It's okay in a function defined in a helper .rb file, but when it's within a class the be_false symbol is not found. Example below -- why doesn't this work? How can I use be_false et al in a helper? It seems possible that it's intentional tha...

MFC CWnd::CreateEx throws exception when the project is DLL, but runnig fine when exe

I have a C++ gui application(MFC). I have made it dll and used its functionality from my C# windows exe application. Surely I'm not showing any window that previously were shown from C++ application. For the following line i'm getting the error Error: "Microsoft Visual C++ Debug Library... Debug Assertion Failed!... afxwin1.inl Line:2...

Python assertion error, converting string to int

Hey, I am trying to rewrite my lib written in PHP into python. It handles all sphinx requests. In the init function, I am trying to set default search and match modes, but I have run into a little problem. I get the modes from a config file. In PHP, you need to use a constant as an input: $this->sphinx->SetMatchMode(constant($this->c...

Build failed in xcode 3.2.3

Hi frends, I have upgraded my iphone sdk from 3.1.3 to 3.2.3. But now i have a problem. The project i m working on is not compiling in new sdk. I have changed the target info settings also i.e. base sdk is set to iphone device 4.0. I have follwing build error: Internal error occurred while creating dependency graph: ASSERTION FAILURE in...

Getting strange debugger message: Assertion failed: (cls), function getName: what is this?

Since I upgraded from Xcode 3.2.3 to 3.2.4 and iOS 4.0.1 to iOS 4.1 SDK, when I set a breakpoint in my code and single-step over instructions, at each step, the debugger will spit one or more of that line: Assertion failed: (cls), function getName, file /SourceCache/objc4_Sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939 It doesn...

Why does Python disables MSCRT assertions when built with debug mode?

Python disables MSCRT assertions for debug mode during the initialization of exceptions module when it is built in debug mode. At least from the source code, I can see Python 2.6.5 doing this for _MSC_VER >= 1400 i.e. Visual C++ 2005. Does anyone know why? ...

Assertion and exception on iPad simulator but not iPhone sim or device!

So I've been working on getting my app ready for iOS 4 and iPhone 4. Installed the latest Xcode and SDK and have been tweaking out graphics, etc. All is working flawlessly except I'm having problems running the app on the iPad simulator. I don't have an actual iPad to test. My app uses an ABUnknownPersonViewController and it crashes whe...

Assertion Failed! error

Hi I have a C# web application with a C# ActiveX tool that connects to the user's hardware to collect information. anyways all works fine on most computer except on some it shows me a (sometime on resetting of CAS permissions it works but soon starts throwing a fit) "Assertion failed!" error (See screenshot) new SecurityPermission(P...

What is the strategy if assertion fails

Assertion is used to check whether a condition is met(precondition, postcondition, invariants) and help programmers find holes during debugging phase. For example, void f(int *p) { assert(p); p->do(); } My question is do we need to assume the condition could not be met in release mode and handle the case accordingly? void f(int ...

Dynamic rule assertion in SWI-prolog

I am trying to add a rule dynamically to the knowledge base using SWI-prolog where the body of the rule is unknown beforehand. The desired rule looks something like this: rule(a) :- fact(1), fact(2). Normally you would simply state assert((rule(a):-fact(1),fact(2))). but the problem is that the facts are decided at runtime(the num...