]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/operator-new-dylib/main.cxx
dyld-655.1.1.tar.gz
[apple/dyld.git] / unit-tests / test-cases / operator-new-dylib / main.cxx
1 #include <stdio.h> // fprintf(), NULL
2 #include <stdlib.h> // exit(), EXIT_SUCCESS
3
4 #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
5
6 #include <stdlib.h>
7 #include <new>
8
9
10 extern char* foo();
11
12 static char all[] = "hello";
13
14 void* operator new[](std::size_t) throw (std::bad_alloc)
15 {
16 return all;
17 }
18
19
20 int main()
21 {
22 char* newArray = new char[24];
23 char* fromFoo = foo();
24
25 if ( fromFoo == newArray )
26 PASS("operator-new-dylib");
27 else
28 FAIL("operator-new-dylib");
29 return EXIT_SUCCESS;
30 }
31