00001 /*!@file TestSuite/whitebox-strings.C */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/TestSuite/whitebox-strings.C $ 00035 // $Id: whitebox-strings.C 12776 2010-02-05 07:56:46Z irock $ 00036 // 00037 00038 #ifndef WHITEBOX_STRINGS_C_DEFINED 00039 #define WHITEBOX_STRINGS_C_DEFINED 00040 00041 #include "TestSuite/TestSuite.H" 00042 #include "Util/StringConversions.H" 00043 #include "Util/StringUtil.H" 00044 #include "Util/sformat.H" 00045 #include "Util/SortUtil.H" 00046 00047 #include <iterator> // for back_inserter() 00048 #include <string> 00049 #include <vector> 00050 00051 static void sformat_xx_format_xx_1(TestSuite& suite) 00052 { 00053 REQUIRE_EQ(sformat(0), ""); 00054 REQUIRE_EQ(sformat("%s", ""), ""); 00055 } 00056 00057 static void sformat_xx_format_xx_2(TestSuite& suite) 00058 { 00059 REQUIRE_EQ(sformat("%%"), "%"); 00060 REQUIRE_EQ(sformat("%s", "hello"), "hello"); 00061 REQUIRE_EQ(sformat("%d", 123), "123"); 00062 REQUIRE_EQ(sformat("%4d", 123), " 123"); 00063 REQUIRE_EQ(sformat("%04d", 123), "0123"); 00064 REQUIRE_EQ(sformat("%-8s", "foobar"), "foobar "); 00065 REQUIRE_EQ(sformat("%8s", "foobar"), " foobar"); 00066 REQUIRE_EQ(sformat("%6.2f", 10.55), " 10.55"); 00067 REQUIRE_EQ(sformat("%s-frame%06d.%s", "mycool", 4567, "png"), 00068 "mycool-frame004567.png"); 00069 } 00070 00071 static void stringutil_xx_split_xx_1(TestSuite& suite) 00072 { 00073 const std::string s = ""; 00074 std::vector<std::string> toks; 00075 split(s, "", std::back_inserter(toks)); 00076 00077 REQUIRE_EQ(toks.size(), size_t(0)); 00078 } 00079 00080 static void stringutil_xx_split_xx_2(TestSuite& suite) 00081 { 00082 const std::string s = ""; 00083 std::vector<std::string> toks; 00084 split(s, "abcdefg", std::back_inserter(toks)); 00085 00086 REQUIRE_EQ(toks.size(), size_t(0)); 00087 } 00088 00089 static void stringutil_xx_split_xx_3(TestSuite& suite) 00090 { 00091 const std::string s = "/:/"; 00092 std::vector<std::string> toks; 00093 split(s, ":/", std::back_inserter(toks)); 00094 00095 REQUIRE_EQ(toks.size(), size_t(0)); 00096 } 00097 00098 static void stringutil_xx_split_xx_4(TestSuite& suite) 00099 { 00100 const std::string s = "foo bar baz"; 00101 std::vector<std::string> toks; 00102 split(s, ":/", std::back_inserter(toks)); 00103 00104 if (REQUIRE_EQ(toks.size(), size_t(1))) 00105 { 00106 REQUIRE_EQ(toks[0], "foo bar baz"); 00107 } 00108 } 00109 00110 static void stringutil_xx_split_xx_5(TestSuite& suite) 00111 { 00112 const std::string s = "foo bar baz"; 00113 std::vector<std::string> toks; 00114 split(s, "", std::back_inserter(toks)); 00115 00116 if (REQUIRE_EQ(toks.size(), size_t(1))) 00117 { 00118 REQUIRE_EQ(toks[0], "foo bar baz"); 00119 } 00120 } 00121 00122 static void stringutil_xx_split_xx_6(TestSuite& suite) 00123 { 00124 const std::string s = "/:/foo :: bar:/baz// /:"; 00125 std::vector<std::string> toks; 00126 split(s, ":/", std::back_inserter(toks)); 00127 00128 if (REQUIRE_EQ(toks.size(), size_t(4))) 00129 { 00130 REQUIRE_EQ(toks[0], "foo "); 00131 REQUIRE_EQ(toks[1], " bar"); 00132 REQUIRE_EQ(toks[2], "baz"); 00133 REQUIRE_EQ(toks[3], " "); 00134 } 00135 } 00136 00137 static void stringutil_xx_join_xx_1(TestSuite& suite) 00138 { 00139 const char* toks[] = { 0 }; 00140 00141 REQUIRE_EQ(join(&toks[0], &toks[0], ":::"), ""); 00142 } 00143 00144 static void stringutil_xx_join_xx_2(TestSuite& suite) 00145 { 00146 const char* toks[] = { "foo", "bar", "baz" }; 00147 00148 REQUIRE_EQ(join(&toks[0], &toks[0] + 3, ""), "foobarbaz"); 00149 } 00150 00151 static void stringutil_xx_join_xx_3(TestSuite& suite) 00152 { 00153 const char* toks[] = { "foo" }; 00154 00155 REQUIRE_EQ(join(&toks[0], &toks[0] + 1, ":::"), "foo"); 00156 } 00157 00158 static void stringutil_xx_join_xx_4(TestSuite& suite) 00159 { 00160 const char* toks[] = { "foo", "bar", "baz" }; 00161 00162 REQUIRE_EQ(join(&toks[0], &toks[0] + 3, ":::"), "foo:::bar:::baz"); 00163 } 00164 00165 static void stringutil_xx_tolowercase_xx_1(TestSuite& suite) 00166 { 00167 REQUIRE_EQ(toLowerCase("abcdefghijklmnopqrstuvwxyz"), 00168 std::string("abcdefghijklmnopqrstuvwxyz")); 00169 00170 REQUIRE_EQ(toLowerCase("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 00171 std::string("abcdefghijklmnopqrstuvwxyz")); 00172 00173 REQUIRE_EQ(toLowerCase("01234567890`~!@#$%^&*()-_=+[]{}\\|;:'\",<.>/? \t\n"), 00174 std::string("01234567890`~!@#$%^&*()-_=+[]{}\\|;:'\",<.>/? \t\n")); 00175 00176 REQUIRE_EQ(toLowerCase("SomE miXeD-Ca$e\nstr!NG!!?"), 00177 std::string("some mixed-ca$e\nstr!ng!!?")); 00178 } 00179 00180 static void stringutil_xx_touppercase_xx_1(TestSuite& suite) 00181 { 00182 REQUIRE_EQ(toUpperCase("abcdefghijklmnopqrstuvwxyz"), 00183 std::string("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); 00184 00185 REQUIRE_EQ(toUpperCase("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 00186 std::string("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); 00187 00188 REQUIRE_EQ(toUpperCase("01234567890`~!@#$%^&*()-_=+[]{}\\|;:'\",<.>/? \t\n"), 00189 std::string("01234567890`~!@#$%^&*()-_=+[]{}\\|;:'\",<.>/? \t\n")); 00190 00191 REQUIRE_EQ(toUpperCase("SomE miXeD-Ca$e\nstr!NG!!?"), 00192 std::string("SOME MIXED-CA$E\nSTR!NG!!?")); 00193 } 00194 00195 static void stringutil_xx_levenshtein_xx_1(TestSuite& suite) 00196 { 00197 REQUIRE_EQ(levenshteinDistance("", ""), uint(0)); 00198 REQUIRE_EQ(levenshteinDistance("", "a"), uint(1)); 00199 REQUIRE_EQ(levenshteinDistance("a", ""), uint(1)); 00200 REQUIRE_EQ(levenshteinDistance("a", "b"), uint(1)); 00201 REQUIRE_EQ(levenshteinDistance("kitten", "kitten"), uint(0)); 00202 REQUIRE_EQ(levenshteinDistance("kitten", "kittens"), uint(1)); 00203 REQUIRE_EQ(levenshteinDistance("kittens", "kitten"), uint(1)); 00204 REQUIRE_EQ(levenshteinDistance("kitten", "smitten"), uint(2)); 00205 REQUIRE_EQ(levenshteinDistance("kitten", "kitchen"), uint(2)); 00206 REQUIRE_EQ(levenshteinDistance("abcdefg", "12345678"), uint(8)); 00207 00208 REQUIRE_EQ(levenshteinDistance("12", "21"), uint(2)); 00209 REQUIRE_EQ(damerauLevenshteinDistance("12", "21"), uint(1)); 00210 REQUIRE_EQ(damerauLevenshteinDistance("123456", "124356"), uint(1)); 00211 REQUIRE_EQ(damerauLevenshteinDistance("123456", "132546"), uint(2)); 00212 } 00213 00214 static void stringutil_xx_camelcase_xx_1(TestSuite& suite) 00215 { 00216 std::set<std::string> acronyms; 00217 acronyms.insert("AGM"); 00218 acronyms.insert("ALIAS"); 00219 acronyms.insert("ASAC"); 00220 acronyms.insert("EHC"); 00221 acronyms.insert("FOA"); 00222 acronyms.insert("FOV"); 00223 acronyms.insert("FPE"); 00224 acronyms.insert("FPS"); 00225 acronyms.insert("H2SV1"); 00226 acronyms.insert("IOR"); 00227 acronyms.insert("ITC"); 00228 acronyms.insert("MPEG"); 00229 acronyms.insert("MRV"); 00230 acronyms.insert("NP"); 00231 acronyms.insert("SC"); 00232 acronyms.insert("SDL"); 00233 acronyms.insert("SM"); 00234 acronyms.insert("SV"); 00235 acronyms.insert("SVCOMP"); 00236 acronyms.insert("SVEM"); 00237 acronyms.insert("TCP"); 00238 acronyms.insert("TRM"); 00239 acronyms.insert("VODB"); 00240 acronyms.insert("VB"); 00241 acronyms.insert("VCO"); 00242 acronyms.insert("VCC4"); 00243 acronyms.insert("VCEM"); 00244 acronyms.insert("VCX"); 00245 acronyms.insert("WTA"); 00246 00247 // this set of words was compiled from the list of all 00248 // ModelOptionDef param names as of 2007-Mar-21, but feel free to 00249 // add other test case words here: 00250 const char* const words[] = 00251 { 00252 "AGMsaveResults" , "agm save results" , 00253 "ALIAScamBttv" , "alias cam bttv" , 00254 "ALIAScamMacbook" , "alias cam macbook" , 00255 "ALIASeyeCompare" , "alias eye compare" , 00256 "ALIASinitialVCO" , "alias initial vco" , 00257 "ALIASmovie" , "alias movie" , 00258 "ALIASmovieanim" , "alias movieanim" , 00259 "ALIASmovieeyehead" , "alias movieeyehead" , 00260 "ALIASmoviefov" , "alias moviefov" , 00261 "ALIASsaveChannelInternals" , "alias save channel internals" , 00262 "ALIASsaveChannelOutputs" , "alias save channel outputs" , 00263 "ALIASsaveall" , "alias saveall" , 00264 "ALIASsaveall" , "alias saveall" , 00265 "ALIASsurprise" , "alias surprise" , 00266 "ALIAStop5" , "alias top5" , 00267 "ASACconfigFile" , "asac config file" , 00268 "ASACdrawBetaParts" , "asac draw beta parts" , 00269 "ASACdrawBiasParts" , "asac draw bias parts" , 00270 "ASACdrawDiffParts" , "asac draw diff parts" , 00271 "ASACdrawSeperableParts" , "asac draw seperable parts" , 00272 "AsyncUi" , "async ui" , 00273 "AsyncUiQueueSize" , "async ui queue size" , 00274 "AttentionGuidanceMapType" , "attention guidance map type" , 00275 "AudioGrabberBits" , "audio grabber bits" , 00276 "AudioGrabberBufSamples" , "audio grabber buf samples" , 00277 "AudioGrabberDevice" , "audio grabber device" , 00278 "AudioGrabberFreq" , "audio grabber freq" , 00279 "AudioGrabberStereo" , "audio grabber stereo" , 00280 "AudioMixerCdIn" , "audio mixer cd in" , 00281 "AudioMixerDevice" , "audio mixer device" , 00282 "AudioMixerLineIn" , "audio mixer line in" , 00283 "AudioMixerMicIn" , "audio mixer mic in" , 00284 "BeowulfInitTimeout" , "beowulf init timeout" , 00285 "BeowulfMaster" , "beowulf master" , 00286 "BeowulfSelfDropLast" , "beowulf self drop last" , 00287 "BeowulfSelfQlen" , "beowulf self qlen" , 00288 "BeowulfSlaveNames" , "beowulf slave names" , 00289 "BiasFeatures" , "bias features" , 00290 "BiasTRM" , "bias trm" , 00291 "BlankBlink" , "blank blink" , 00292 "BrainBoringDelay" , "brain boring delay" , 00293 "BrainBoringSMmv" , "brain boring sm mv" , 00294 "BrainSaveObjMask" , "brain save obj mask" , 00295 "BrainSaveWinnerFeatures" , "brain save winner features" , 00296 "BrainTooManyShifts" , "brain too many shifts" , 00297 "CacheSavePrefix" , "cache save prefix" , 00298 "ChannelOutputRangeMax" , "channel output range max" , 00299 "ChannelOutputRangeMin" , "channel output range min" , 00300 "CheckPristine" , "check pristine" , 00301 "ClipMaskFname" , "clip mask fname" , 00302 "ColorComputeType" , "color compute type" , 00303 "CompColorDoubleOppWeight" , "comp color double opp weight" , 00304 "CompColorSingleOppWeight" , "comp color single opp weight" , 00305 "ComplexChannelSaveOutputMap" , "complex channel save output map" , 00306 "DebugMode" , "debug mode" , 00307 "DeinterlacerType" , "deinterlacer type" , 00308 "DescriptorVecFOV" , "descriptor vec fov" , 00309 "DirectionChannelLowThresh" , "direction channel low thresh" , 00310 "DirectionChannelTakeSqrt" , "direction channel take sqrt" , 00311 "DiskDataStreamNumThreads" , "disk data stream num threads" , 00312 "DiskDataStreamSavePath" , "disk data stream save path" , 00313 "DiskDataStreamSavePeriod" , "disk data stream save period" , 00314 "DiskDataStreamSleepUsecs" , "disk data stream sleep usecs" , 00315 "DiskDataStreamUseMmap" , "disk data stream use mmap" , 00316 "DoBottomUpContext" , "do bottom up context" , 00317 "DownVODBfname" , "down vodb fname" , 00318 "DummyChannelFactor" , "dummy channel factor" , 00319 "EFullImplementation" , "e full implementation" , 00320 "EHCeyeTrackConfig" , "ehc eye track config" , 00321 "EsmInertiaHalfLife" , "esm inertia half life" , 00322 "EsmInertiaRadius" , "esm inertia radius" , 00323 "EsmInertiaShiftThresh" , "esm inertia shift thresh" , 00324 "EsmInertiaStrength" , "esm inertia strength" , 00325 "EsmIorHalfLife" , "esm ior half life" , 00326 "EsmIorRadius" , "esm ior radius" , 00327 "EsmIorStrength" , "esm ior strength" , 00328 "EvcColorSmoothing" , "evc color smoothing" , 00329 "EvcFlickerThresh" , "evc flicker thresh" , 00330 "EvcLevelSpec" , "evc level spec" , 00331 "EvcMaxnormType" , "evc maxnorm type" , 00332 "EvcMotionThresh" , "evc motion thresh" , 00333 "EvcMultiScaleFlicker" , "evc multi scale flicker" , 00334 "EvcNumDirections" , "evc num directions" , 00335 "EvcNumOrientations" , "evc num orientations" , 00336 "EvcScaleBits" , "evc scale bits" , 00337 "EvcType" , "evc type" , 00338 "EventLogFileName" , "event log file name" , 00339 "EyeHeadControllerType" , "eye head controller type" , 00340 "EyeSFileName" , "eye s file name" , 00341 "EyeSNumSkip" , "eye s num skip" , 00342 "EyeSPeriod" , "eye s period" , 00343 "EyeTrackerEDFfname" , "eye tracker e d ffname" , 00344 "EyeTrackerParDev" , "eye tracker par dev" , 00345 "EyeTrackerParTrig" , "eye tracker par trig" , 00346 "EyeTrackerSerDev" , "eye tracker ser dev" , 00347 "EyeTrackerType" , "eye tracker type" , 00348 "FOAradius" , "foa radius" , 00349 "FlushUiQueue" , "flush ui queue" , 00350 "FoveaRadius" , "fovea radius" , 00351 "FoveateInput" , "foveate input" , 00352 "FoveateInputDepth" , "foveate input depth" , 00353 "FpuPrecision" , "fpu precision" , 00354 "FpuRoundingMode" , "fpu rounding mode" , 00355 "FrameGrabberBrightness" , "frame grabber brightness" , 00356 "FrameGrabberByteSwap" , "frame grabber byte swap" , 00357 "FrameGrabberChannel" , "frame grabber channel" , 00358 "FrameGrabberColour" , "frame grabber colour" , 00359 "FrameGrabberContrast" , "frame grabber contrast" , 00360 "FrameGrabberDevice" , "frame grabber device" , 00361 "FrameGrabberDims" , "frame grabber dims" , 00362 "FrameGrabberExposure" , "frame grabber exposure" , 00363 "FrameGrabberFPS" , "frame grabber fps" , 00364 "FrameGrabberGain" , "frame grabber gain" , 00365 "FrameGrabberGamma" , "frame grabber gamma" , 00366 "FrameGrabberHue" , "frame grabber hue" , 00367 "FrameGrabberMode" , "frame grabber mode" , 00368 "FrameGrabberNbuf" , "frame grabber nbuf" , 00369 "FrameGrabberSaturation" , "frame grabber saturation" , 00370 "FrameGrabberSharpness" , "frame grabber sharpness" , 00371 "FrameGrabberShutter" , "frame grabber shutter" , 00372 "FrameGrabberStreaming" , "frame grabber streaming" , 00373 "FrameGrabberSubChan" , "frame grabber sub chan" , 00374 "FrameGrabberType" , "frame grabber type" , 00375 "FrameGrabberWhiteBalBU" , "frame grabber white bal b u" , 00376 "FrameGrabberWhiteBalRV" , "frame grabber white bal r v" , 00377 "FrameGrabberWhiteness" , "frame grabber whiteness" , 00378 "FrontVODBfname" , "front vodb fname" , 00379 "FxSaveIllustrations" , "fx save illustrations" , 00380 "FxSaveRawMaps" , "fx save raw maps" , 00381 "GaborChannelIntensity" , "gabor channel intensity" , 00382 "GetSingleChannelStats" , "get single channel stats" , 00383 "GetSingleChannelStatsFile" , "get single channel stats file" , 00384 "GetSingleChannelStatsTag" , "get single channel stats tag" , 00385 "GistEstimatorType" , "gist estimator type" , 00386 "HeadMarkerRadius" , "head marker radius" , 00387 "HueBandWidth" , "hue band width" , 00388 "IORtype" , "ior type" , 00389 "ITCAttentionObjRecog" , "itc attention obj recog" , 00390 "ITCInferoTemporalType" , "itc infero temporal type" , 00391 "ITCMatchObjects" , "itc match objects" , 00392 "ITCMatchingAlgorithm" , "itc matching algorithm" , 00393 "ITCObjectDatabaseFileName" , "itc object database file name" , 00394 "ITCOutputFileName" , "itc output file name" , 00395 "ITCPromptUserTrainDB" , "itc prompt user train d b" , 00396 "ITCRecognitionMinMatch" , "itc recognition min match" , 00397 "ITCRecognitionMinMatchPercent" , "itc recognition min match percent" , 00398 "ITCSortKeys" , "itc sort keys" , 00399 "ITCSortObjects" , "itc sort objects" , 00400 "ITCSortObjectsBy" , "itc sort objects by" , 00401 "ITCTrainObjectDB" , "itc train object d b" , 00402 "ImageDisplayType" , "image display type" , 00403 "InputBufferSize" , "input buffer size" , 00404 "InputEchoDest" , "input echo dest" , 00405 "InputFOV" , "input fov" , 00406 "InputFrameCrop" , "input frame crop" , 00407 "InputFrameDims" , "input frame dims" , 00408 "InputFrameRange" , "input frame range" , 00409 "InputFrameSource" , "input frame source" , 00410 "InputFramingImageName" , "input framing image name" , 00411 "InputFramingImagePos" , "input framing image pos" , 00412 "InputMPEGStreamCodec" , "input mpeg stream codec" , 00413 "InputMPEGStreamPreload" , "input mpeg stream preload" , 00414 "InputMbariFrameRange" , "input mbari frame range" , 00415 "InputMbariPreserveAspect" , "input mbari preserve aspect" , 00416 "InputOutputComboSpec" , "input output combo spec" , 00417 "InputPreserveAspect" , "input preserve aspect" , 00418 "InputRasterFileFormat" , "input raster file format" , 00419 "InputYuvDims" , "input yuv dims" , 00420 "InputYuvDimsLoose" , "input yuv dims loose" , 00421 "IntChannelOutputRangeMax" , "int channel output range max" , 00422 "IntChannelOutputRangeMin" , "int channel output range min" , 00423 "IntChannelScaleBits" , "int channel scale bits" , 00424 "IntDecodeType" , "int decode type" , 00425 "IntMathLowPass5" , "int math low pass5" , 00426 "IntMathLowPass9" , "int math low pass9" , 00427 "IntensityBandWidth" , "intensity band width" , 00428 "IscanSerialPortDevice" , "iscan serial port device" , 00429 "JobServerNumThreads" , "job server num threads" , 00430 "KeepGoing" , "keep going" , 00431 "LFullImplementation" , "l full implementation" , 00432 "LearnTRM" , "learn trm" , 00433 "LearnUpdateTRM" , "learn update trm" , 00434 "LevelSpec" , "level spec" , 00435 "LoadConfigFile" , "load config file" , 00436 "LogVerb" , "log verb" , 00437 "LsqSvdThresholdFactor" , "lsq svd threshold factor" , 00438 "LsqUseWeightsFile" , "lsq use weights file" , 00439 "MRVdisplayOutput" , "mrv display output" , 00440 "MRVdisplayResults" , "mrv display results" , 00441 "MRVloadEvents" , "mrv load events" , 00442 "MRVloadProperties" , "mrv load properties" , 00443 "MRVmarkCandidate" , "mrv mark candidate" , 00444 "MRVmarkFOE" , "mrv mark f o e" , 00445 "MRVmarkInteresting" , "mrv mark interesting" , 00446 "MRVmarkPrediction" , "mrv mark prediction" , 00447 "MRVopacity" , "mrv opacity" , 00448 "MRVrescaleDisplay" , "mrv rescale display" , 00449 "MRVsaveEventNums" , "mrv save event nums" , 00450 "MRVsaveEvents" , "mrv save events" , 00451 "MRVsaveOutput" , "mrv save output" , 00452 "MRVsavePositions" , "mrv save positions" , 00453 "MRVsaveProperties" , "mrv save properties" , 00454 "MRVsaveResults" , "mrv save results" , 00455 "MRVshowEventLabels" , "mrv show event labels" , 00456 "MRVsizeAvgCache" , "mrv size avg cache" , 00457 "MapLevel" , "map level" , 00458 "MaxImageDisplay" , "max image display" , 00459 "MaxNormType" , "max norm type" , 00460 "MgzOutputStreamCompLevel" , "mgz output stream comp level" , 00461 "MovieHertz" , "movie hertz" , 00462 "MovingAvgFactor" , "moving avg factor" , 00463 "MultiRetinaDepth" , "multi retina depth" , 00464 "NPconfig" , "np config" , 00465 "NerdCamConfigFile" , "nerd cam config file" , 00466 "NumColorBands" , "num color bands" , 00467 "NumDirections" , "num directions" , 00468 "NumEOrients" , "num e orients" , 00469 "NumIntensityBands" , "num intensity bands" , 00470 "NumLOrients" , "num l orients" , 00471 "NumOrientations" , "num orientations" , 00472 "NumSatBands" , "num sat bands" , 00473 "NumSkipFrames" , "num skip frames" , 00474 "NumTOrients" , "num t orients" , 00475 "NumTestingFrames" , "num testing frames" , 00476 "NumTheta" , "num theta" , 00477 "NumTrainingFrames" , "num training frames" , 00478 "NumXOrients" , "num x orients" , 00479 "Nv2CompactDisplay" , "nv2 compact display" , 00480 "Nv2ExtendedDisplay" , "nv2 extended display" , 00481 "Nv2Network" , "nv2 network" , 00482 "OriInteraction" , "ori interaction" , 00483 "OrientComputeType" , "orient compute type" , 00484 "OutputFrameDims" , "output frame dims" , 00485 "OutputFrameRange" , "output frame range" , 00486 "OutputFrameSink" , "output frame sink" , 00487 "OutputMPEGStreamBitRate" , "output mpeg stream bit rate" , 00488 "OutputMPEGStreamBufSize" , "output mpeg stream buf size" , 00489 "OutputMPEGStreamCodec" , "output mpeg stream codec" , 00490 "OutputMPEGStreamFrameRate" , "output mpeg stream frame rate" , 00491 "OutputMbariShowFrames" , "output mbari show frames" , 00492 "OutputPreserveAspect" , "output preserve aspect" , 00493 "OutputRasterFileFormat" , "output raster file format" , 00494 "OutputZoom" , "output zoom" , 00495 "PixelsPerDegree" , "pixels per degree" , 00496 "Polyconfig" , "polyconfig" , 00497 "ProfileOutFile" , "profile out file" , 00498 "PsychoDisplayBackgroundColor" , "psycho display background color" , 00499 "PsychoDisplayBlack" , "psycho display black" , 00500 "PsychoDisplayFullscreen" , "psycho display fullscreen" , 00501 "PsychoDisplayPriority" , "psycho display priority" , 00502 "PsychoDisplayRefreshUsec" , "psycho display refresh usec" , 00503 "PsychoDisplayTextColor" , "psycho display text color" , 00504 "PsychoDisplayWhite" , "psycho display white" , 00505 "QdisplayEcho" , "qdisplay echo" , 00506 "QdisplayPrefDims" , "qdisplay pref dims" , 00507 "QdisplayPrefMaxDims" , "qdisplay pref max dims" , 00508 "RawInpRectBorder" , "raw inp rect border" , 00509 "RetinaFlipHoriz" , "retina flip horiz" , 00510 "RetinaFlipVertic" , "retina flip vertic" , 00511 "RetinaMaskFname" , "retina mask fname" , 00512 "RetinaSaveInput" , "retina save input" , 00513 "RetinaSaveOutput" , "retina save output" , 00514 "RetinaStdSavePyramid" , "retina std save pyramid" , 00515 "RetinaType" , "retina type" , 00516 "SCeyeBlinkDuration" , "sc eye blink duration" , 00517 "SCeyeBlinkWaitTime" , "sc eye blink wait time" , 00518 "SCeyeFrictionMu" , "sc eye friction mu" , 00519 "SCeyeInitialPosition" , "sc eye initial position" , 00520 "SCeyeMaxIdleSecs" , "sc eye max idle secs" , 00521 "SCeyeMinSacLen" , "sc eye min sac len" , 00522 "SCeyeSpringK" , "sc eye spring k" , 00523 "SCeyeThreshMaxCovert" , "sc eye thresh max covert" , 00524 "SCeyeThreshMinNum" , "sc eye thresh min num" , 00525 "SCeyeThreshMinOvert" , "sc eye thresh min overt" , 00526 "SCeyeThreshSalWeigh" , "sc eye thresh sal weigh" , 00527 "SCheadFrictionMu" , "sc head friction mu" , 00528 "SCheadInitialPosition" , "sc head initial position" , 00529 "SCheadMaxIdleSecs" , "sc head max idle secs" , 00530 "SCheadMinSacLen" , "sc head min sac len" , 00531 "SCheadSpringK" , "sc head spring k" , 00532 "SCheadThreshMaxCovert" , "sc head thresh max covert" , 00533 "SCheadThreshMinNum" , "sc head thresh min num" , 00534 "SCheadThreshMinOvert" , "sc head thresh min overt" , 00535 "SCheadThreshSalWeigh" , "sc head thresh sal weigh" , 00536 "SDLdisplayDims" , "sdl display dims" , 00537 "SDLdisplayFullscreen" , "sdl display fullscreen" , 00538 "SDLdisplayPriority" , "sdl display priority" , 00539 "SDLdisplayRefreshUsec" , "sdl display refresh usec" , 00540 "SMTnumThreads" , "sm tnum threads" , 00541 "SMfastInputCoeff" , "sm fast input coeff" , 00542 "SMfastItoVcoeff" , "sm fast ito vcoeff" , 00543 "SMginhDecay" , "sm ginh decay" , 00544 "SMsaveCumResults" , "sm save cum results" , 00545 "SMsaveResults" , "sm save results" , 00546 "SMuseBlinkSuppress" , "sm use blink suppress" , 00547 "SMuseSacSuppress" , "sm use sac suppress" , 00548 "SVCOMPMultiRetinaDepth" , "svcomp multi retina depth" , 00549 "SVCOMPcacheSize" , "svcomp cache size" , 00550 "SVCOMPdisplayHumanEye" , "svcomp display human eye" , 00551 "SVCOMPfoveaSCtype" , "svcomp fovea sc type" , 00552 "SVCOMPiframePeriod" , "svcomp iframe period" , 00553 "SVCOMPnumFoveas" , "svcomp num foveas" , 00554 "SVCOMPsaveEyeCombo" , "svcomp save eye combo" , 00555 "SVCOMPsaveMegaCombo" , "svcomp save mega combo" , 00556 "SVCOMPsaveXcombo" , "svcomp save xcombo" , 00557 "SVCOMPsaveXcomboOrig" , "svcomp save xcombo orig" , 00558 "SVCOMPsaveYcombo" , "svcomp save ycombo" , 00559 "SVCOMPsaveYcomboOrig" , "svcomp save ycombo orig" , 00560 "SVCOMPuseTRMmax" , "svcomp use trm max" , 00561 "SVEMbufDims" , "svem buf dims" , 00562 "SVEMdelayCacheSize" , "svem delay cache size" , 00563 "SVEMdisplaySacNum" , "svem display sac num" , 00564 "SVEMmaxCacheSize" , "svem max cache size" , 00565 "SVEMmaxComboWidth" , "svem max combo width" , 00566 "SVEMnumRandomSamples" , "svem num random samples" , 00567 "SVEMoutFname" , "svem out fname" , 00568 "SVEMsampleAtStart" , "svem sample at start" , 00569 "SVEMsaveMegaCombo" , "svem save mega combo" , 00570 "SVEMuseIOR" , "svem use ior" , 00571 "SVcropFOA" , "sv crop foa" , 00572 "SVdisplayAdditive" , "sv display additive" , 00573 "SVdisplayBoring" , "sv display boring" , 00574 "SVdisplayEye" , "sv display eye" , 00575 "SVdisplayEyeLinks" , "sv display eye links" , 00576 "SVdisplayFOA" , "sv display foa" , 00577 "SVdisplayFOALinks" , "sv display foa links" , 00578 "SVdisplayHead" , "sv display head" , 00579 "SVdisplayHeadLinks" , "sv display head links" , 00580 "SVdisplayHighlights" , "sv display highlights" , 00581 "SVdisplayInterp" , "sv display interp" , 00582 "SVdisplayMapFactor" , "sv display map factor" , 00583 "SVdisplayMapType" , "sv display map type" , 00584 "SVdisplayPatch" , "sv display patch" , 00585 "SVdisplaySMmodulate" , "sv display sm modulate" , 00586 "SVdisplayTime" , "sv display time" , 00587 "SVeyeSimFname" , "sv eye sim fname" , 00588 "SVeyeSimPeriod" , "sv eye sim period" , 00589 "SVeyeSimTrash" , "sv eye sim trash" , 00590 "SVfontSize" , "sv font size" , 00591 "SVfoveateTraj" , "sv foveate traj" , 00592 "SVmegaCombo" , "sv mega combo" , 00593 "SVmotionSixPack" , "sv motion six pack" , 00594 "SVsaveTRMXcombo" , "sv save trm xcombo" , 00595 "SVsaveTRMYcombo" , "sv save trm ycombo" , 00596 "SVsaveTraj" , "sv save traj" , 00597 "SVsaveXcombo" , "sv save xcombo" , 00598 "SVsaveYcombo" , "sv save ycombo" , 00599 "SVstatsFname" , "sv stats fname" , 00600 "SVuseLargerDrawings" , "sv use larger drawings" , 00601 "SVwarp3D" , "sv warp3 d" , 00602 "SVxwindow" , "sv xwindow" , 00603 "SaccadeControllerEyeType" , "saccade controller eye type" , 00604 "SaccadeControllerHeadType" , "saccade controller head type" , 00605 "SaliencyMapType" , "saliency map type" , 00606 "SatBandWidth" , "sat band width" , 00607 "SaveConfigFile" , "save config file" , 00608 "SaveInputCopy" , "save input copy" , 00609 "ScorrChannelRadius" , "scorr channel radius" , 00610 "ShapeEstimatorMode" , "shape estimator mode" , 00611 "ShapeEstimatorSmoothMethod" , "shape estimator smooth method" , 00612 "ShapeEstimatorUseLargeNeigh" , "shape estimator use large neigh" , 00613 "ShiftInputToEye" , "shift input to eye" , 00614 "ShiftInputToEyeBGcol" , "shift input to eye b gcol" , 00615 "ShowHelpMessage" , "show help message" , 00616 "ShowMemStats" , "show mem stats" , 00617 "ShowMemStatsUnits" , "show mem stats units" , 00618 "ShowSvnVersion" , "show svn version" , 00619 "ShowVersion" , "show version" , 00620 "SimEventQueueType" , "sim event queue type" , 00621 "SimulationTimeStep" , "simulation time step" , 00622 "SimulationTooMuchTime" , "simulation too much time" , 00623 "SimulationViewerType" , "simulation viewer type" , 00624 "SingleChannelBeoServerQuickMode" , "single channel beo server quick mode", 00625 "SingleChannelQueueLen" , "single channel queue len" , 00626 "SingleChannelSaveFeatureMaps" , "single channel save feature maps" , 00627 "SingleChannelSaveOutputMap" , "single channel save output map" , 00628 "SingleChannelSaveRawMaps" , "single channel save raw maps" , 00629 "SingleChannelSurpriseLogged" , "single channel surprise logged" , 00630 "SingleChannelSurpriseNeighUpdFac" , "single channel surprise neigh upd fac", 00631 "SingleChannelSurpriseProbe" , "single channel surprise probe" , 00632 "SingleChannelSurpriseSLfac" , "single channel surprise s lfac" , 00633 "SingleChannelSurpriseSQlen" , "single channel surprise s qlen" , 00634 "SingleChannelSurpriseSSfac" , "single channel surprise s sfac" , 00635 "SingleChannelSurpriseUpdFac" , "single channel surprise upd fac" , 00636 "SingleChannelTimeDecay" , "single channel time decay" , 00637 "SingleChannelUseSplitCS" , "single channel use split c s" , 00638 "SmfxNormType" , "smfx norm type" , 00639 "SmfxRescale512" , "smfx rescale512" , 00640 "SmfxVcType" , "smfx vc type" , 00641 "SockServPort" , "sock serv port" , 00642 "SubmapAlgoType" , "submap algo type" , 00643 "TCPcommunicatorDisableShm" , "tcp communicator disable shm" , 00644 "TCPcommunicatorIPaddr" , "tcp communicator i paddr" , 00645 "TCPcommunicatorInDropLast" , "tcp communicator in drop last" , 00646 "TCPcommunicatorInQlen" , "tcp communicator in qlen" , 00647 "TCPcommunicatorOuDropLast" , "tcp communicator ou drop last" , 00648 "TCPcommunicatorOuQlen" , "tcp communicator ou qlen" , 00649 "TFullImplementation" , "t full implementation" , 00650 "TRMKillStaticCoeff" , "trm kill static coeff" , 00651 "TRMKillStaticThresh" , "trm kill static thresh" , 00652 "TRMkillN" , "trm kill n" , 00653 "TRMsaveResults" , "trm save results" , 00654 "TargetMaskFname" , "target mask fname" , 00655 "TaskRelevanceMapType" , "task relevance map type" , 00656 "TcorrChannelFrameLag" , "tcorr channel frame lag" , 00657 "TdcLocalMax" , "tdc local max" , 00658 "TdcRectifyTd" , "tdc rectify td" , 00659 "TdcSaveMaps" , "tdc save maps" , 00660 "TdcSaveMapsNormalized" , "tdc save maps normalized" , 00661 "TdcSaveRawData" , "tdc save raw data" , 00662 "TdcSaveSumo" , "tdc save sumo" , 00663 "TdcSaveSumo2" , "tdc save sumo2" , 00664 "TdcTemporalMax" , "tdc temporal max" , 00665 "TestMode" , "test mode" , 00666 "TextLogFile" , "text log file" , 00667 "TopdownContextSpec" , "topdown context spec" , 00668 "TraceXEvents" , "trace x events" , 00669 "TrainingSetDecimation" , "training set decimation" , 00670 "TrainingSetRebalance" , "training set rebalance" , 00671 "TrainingSetRebalanceGroupSize" , "training set rebalance group size" , 00672 "TrainingSetRebalanceThresh" , "training set rebalance thresh" , 00673 "UcbMpegFrameRate" , "ucb mpeg frame rate" , 00674 "UcbMpegQuality" , "ucb mpeg quality" , 00675 "UnderflowStrategy" , "underflow strategy" , 00676 "UpVODBfname" , "up vodb fname" , 00677 "UseH2SV1" , "use h2sv1" , 00678 "UseOlderVersion" , "use older version" , 00679 "UseRandom" , "use random" , 00680 "UsingFPE" , "using fpe" , 00681 "VBdecayFactor" , "vb decay factor" , 00682 "VBdims" , "vb dims" , 00683 "VBignoreBoring" , "vb ignore boring" , 00684 "VBmaxNormType" , "vb max norm type" , 00685 "VBobjectBased" , "vb object based" , 00686 "VBtimePeriod" , "vb time period" , 00687 "VCC4maxAngle" , "vcc4 max angle" , 00688 "VCC4pulseRatio" , "vcc4 pulse ratio" , 00689 "VCC4serialDevice" , "vcc4 serial device" , 00690 "VCC4unitNo" , "vcc4 unit no" , 00691 "VCEMdelay" , "vcem delay" , 00692 "VCEMeyeFnames" , "vcem eye fnames" , 00693 "VCEMforgetFac" , "vcem forget fac" , 00694 "VCEMsaccadeOnly" , "vcem saccade only" , 00695 "VCEMsigma" , "vcem sigma" , 00696 "VCEMuseMax" , "vcem use max" , 00697 "VCXSurpriseExp" , "vcx surprise exp" , 00698 "VCXSurpriseSemisat" , "vcx surprise semisat" , 00699 "VCXSurpriseThresh" , "vcx surprise thresh" , 00700 "VCXloadOutFrom" , "vcx load out from" , 00701 "VCXnormSurp" , "vcx norm surp" , 00702 "VCXsaveOutTo" , "vcx save out to" , 00703 "VisualCortexOutputFactor" , "visual cortex output factor" , 00704 "VisualCortexSaveOutput" , "visual cortex save output" , 00705 "VisualCortexSurpriseType" , "visual cortex surprise type" , 00706 "VisualCortexType" , "visual cortex type" , 00707 "WTAsaveResults" , "wta save results" , 00708 "WTAuseBlinkSuppress" , "wta use blink suppress" , 00709 "WTAuseSacSuppress" , "wta use sac suppress" , 00710 "WaitForUser" , "wait for user" , 00711 "WinnerTakeAllGreedyThreshFac" , "winner take all greedy thresh fac" , 00712 "WinnerTakeAllType" , "winner take all type" , 00713 "XFullImplementation" , "x full implementation" , 00714 "XptSavePrefix" , "xpt save prefix" , 00715 "ZeroNumberFrames" , "zero number frames" , 00716 "hflip" , "hflip" , 00717 "icamatrix" , "icamatrix" , 00718 "localconfig" , "localconfig" , 00719 "name" , "name" , 00720 0 00721 }; 00722 00723 for (size_t i = 0; words[i] != 0; i += 2) 00724 { 00725 REQUIRE_EQ(camelCaseToSpaces(words[i], &acronyms), 00726 std::string(words[i+1])); 00727 } 00728 } 00729 00730 namespace 00731 { 00732 // try to convert the string to type T, return true if the 00733 // conversion FAILED 00734 template <class T> 00735 bool conversionFails(const std::string& str) 00736 { 00737 try { 00738 (void) fromStr<T>(str); 00739 } 00740 catch (conversion_error& e) { 00741 return true; 00742 } 00743 return false; 00744 } 00745 } 00746 00747 static void stringconversions_xx_int_xx_1(TestSuite& suite) 00748 { 00749 REQUIRE_EQ(toStr(int(-12345)), "-12345"); 00750 00751 REQUIRE_EQ(fromStr<int>(" 456"), 456); // leading space ok 00752 REQUIRE_EQ(fromStr<int>("789 "), 789); // trailing space ok 00753 00754 REQUIRE(conversionFails<int>("1.")); // trailing junk NOT ok 00755 REQUIRE(conversionFails<int>("1 a")); // trailing junk NOT ok 00756 REQUIRE(conversionFails<int>("1-")); // trailing junk NOT ok 00757 REQUIRE(conversionFails<int>("-")); 00758 REQUIRE(conversionFails<int>("-abc")); 00759 REQUIRE(conversionFails<int>(".2")); 00760 } 00761 00762 static void stringconversions_xx_unsigned_char_xx_1(TestSuite& suite) 00763 { 00764 REQUIRE_EQ(toStr((unsigned char)(255)), "255"); 00765 00766 REQUIRE(conversionFails<unsigned char>("256")); 00767 REQUIRE(conversionFails<unsigned char>("-1")); 00768 REQUIRE(conversionFails<unsigned char>(".2")); 00769 } 00770 00771 static void stringconversions_xx_unsigned_int_xx_1(TestSuite& suite) 00772 { 00773 REQUIRE_EQ(toStr((unsigned int)(67890)), "67890"); 00774 00775 // somehow this passes on mandriva 2010 / gcc 4.4.1 00776 //REQUIRE(conversionFails<unsigned int>("-12345")); 00777 REQUIRE(conversionFails<unsigned int>(".2")); 00778 } 00779 00780 static void sortutil_xx_sortrank_xx_1(TestSuite& suite) 00781 { 00782 std::vector<float> v; 00783 v.push_back(2.0F); 00784 v.push_back(1.0F); 00785 v.push_back(3.0F); 00786 00787 std::vector<size_t> ranks; 00788 00789 util::sortrank(v, ranks); 00790 00791 REQUIRE_EQ(int(ranks.size()), 3); 00792 REQUIRE_EQ(int(ranks[0]), 1); 00793 REQUIRE_EQ(int(ranks[1]), 0); 00794 REQUIRE_EQ(int(ranks[2]), 2); 00795 } 00796 00797 /////////////////////////////////////////////////////////////////////// 00798 // 00799 // main 00800 // 00801 /////////////////////////////////////////////////////////////////////// 00802 00803 int main(int argc, const char** argv) 00804 { 00805 TestSuite suite; 00806 00807 suite.ADD_TEST(sformat_xx_format_xx_1); 00808 suite.ADD_TEST(sformat_xx_format_xx_2); 00809 suite.ADD_TEST(stringutil_xx_split_xx_1); 00810 suite.ADD_TEST(stringutil_xx_split_xx_2); 00811 suite.ADD_TEST(stringutil_xx_split_xx_3); 00812 suite.ADD_TEST(stringutil_xx_split_xx_4); 00813 suite.ADD_TEST(stringutil_xx_split_xx_5); 00814 suite.ADD_TEST(stringutil_xx_split_xx_6); 00815 suite.ADD_TEST(stringutil_xx_join_xx_1); 00816 suite.ADD_TEST(stringutil_xx_join_xx_2); 00817 suite.ADD_TEST(stringutil_xx_join_xx_3); 00818 suite.ADD_TEST(stringutil_xx_join_xx_4); 00819 suite.ADD_TEST(stringutil_xx_tolowercase_xx_1); 00820 suite.ADD_TEST(stringutil_xx_touppercase_xx_1); 00821 suite.ADD_TEST(stringutil_xx_levenshtein_xx_1); 00822 suite.ADD_TEST(stringutil_xx_camelcase_xx_1); 00823 00824 suite.ADD_TEST(stringconversions_xx_int_xx_1); 00825 suite.ADD_TEST(stringconversions_xx_unsigned_char_xx_1); 00826 suite.ADD_TEST(stringconversions_xx_unsigned_int_xx_1); 00827 00828 suite.ADD_TEST(sortutil_xx_sortrank_xx_1); 00829 00830 suite.parseAndRun(argc, argv); 00831 00832 return 0; 00833 } 00834 00835 // ###################################################################### 00836 /* So things look consistent in everyone's emacs... */ 00837 /* Local Variables: */ 00838 /* indent-tabs-mode: nil */ 00839 /* End: */ 00840 00841 #endif // WHITEBOX_STRINGS_C_DEFINED