1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: TestOStreamWrapper.cxx 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 #define VTK_STREAMS_FWD_ONLY // like wrapper-generated sources 16 #include "vtkSystemIncludes.h" 17 18 #include <stdio.h> // test covers NOT including <iostream> 19 #include <string> 20 TestOStreamWrapper(int,char * [])21int TestOStreamWrapper(int, char *[]) 22 { 23 int failed = 0; 24 std::string const expect = "hello, world: 1"; 25 std::string actual; 26 std::string s = "hello, world"; 27 vtkOStrStreamWrapper vtkmsg; 28 vtkmsg << s << ": " << 1; 29 actual = vtkmsg.str(); 30 vtkmsg.rdbuf()->freeze(0); 31 if(actual != expect) 32 { 33 failed = 1; 34 fprintf(stderr, "Expected '%s' but got '%s'\n", 35 expect.c_str(), actual.c_str()); 36 } 37 return failed; 38 } 39