Commit de05cfb508ab319b47abae95f1444c5c70ccee5e
1 parent
df1fa529
add test case to buffer test suite
git-svn-id: svn+q:///qpdf/trunk@1038 71b93d88-0707-0410-a8cf-f5a4172ac649
Showing
1 changed file
with
9 additions
and
0 deletions
libtests/buffer.cc
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | #include <qpdf/Pl_Count.hh> | 2 | #include <qpdf/Pl_Count.hh> |
| 3 | #include <qpdf/Pl_Discard.hh> | 3 | #include <qpdf/Pl_Discard.hh> |
| 4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
| 5 | +#include <stdexcept> | ||
| 5 | 6 | ||
| 6 | typedef unsigned char* uc; | 7 | typedef unsigned char* uc; |
| 7 | 8 | ||
| @@ -49,6 +50,14 @@ int main() | @@ -49,6 +50,14 @@ int main() | ||
| 49 | std::cout << "size: " << b->getSize() << std::endl; | 50 | std::cout << "size: " << b->getSize() << std::endl; |
| 50 | std::cout << "data: " << b->getBuffer() << std::endl; | 51 | std::cout << "data: " << b->getBuffer() << std::endl; |
| 51 | delete b; | 52 | delete b; |
| 53 | + | ||
| 54 | + unsigned char lbuf[10]; | ||
| 55 | + Buffer b1(lbuf, 10); | ||
| 56 | + if (! ((b1.getBuffer() == lbuf) && | ||
| 57 | + (b1.getSize() == 10))) | ||
| 58 | + { | ||
| 59 | + throw std::logic_error("hand-created buffer is not as expected"); | ||
| 60 | + } | ||
| 52 | } | 61 | } |
| 53 | catch (std::exception& e) | 62 | catch (std::exception& e) |
| 54 | { | 63 | { |