aboutsummaryrefslogtreecommitdiff
path: root/src/test/util_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into single_prodnameLuke Dashjr2016-02-031-1/+1
|\
| * Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
| |
* | Rewrite FormatParagraph to handle newlines within input strings correctlyLuke Dashjr2016-02-031-3/+18
|/
* SanitizeString: Allow hypen charMarcoFalke2015-09-231-2/+2
|
* [uacomment] Sanitize per BIP-0014MarcoFalke2015-09-161-2/+2
| | | | | | * SanitizeString() can be requested to be more strict * Throw error when SanitizeString() changes uacomments * Fix tests
* rpc: Accept scientific notation for monetary amounts in JSONWladimir J. van der Laan2015-07-101-0/+66
| | | | | | | | | | | Add a function `ParseFixedPoint` that parses numbers according to the JSON number specification and returns a 64-bit integer. Then this in `AmountFromValue`, rather than `ParseMoney`. Also add lots of tests (thanks to @jonasschnelli for some of them). Fixes issue #6297.
* Merge pull request #6239Wladimir J. van der Laan2015-06-091-23/+21
|\ | | | | | | | | | | 7d8ffac Changes necessary now that zero values accepted in AmountFromValue (Wladimir J. van der Laan) a04bdef Get rid of fPlus argument to FormatMoney (Wladimir J. van der Laan) 4b4b9a8 Don't go through double in AmountFromValue and ValueFromAmount (Wladimir J. van der Laan)
| * Get rid of fPlus argument to FormatMoneyWladimir J. van der Laan2015-06-061-23/+21
| | | | | | | | It's never used with any other value than false, the default.
* | fix util_tests.cpp clang warningsJonas Schnelli2015-06-061-2/+2
|/ | | | was introduced with #6121
* util: Add ParseInt64 and ParseDouble functionsWladimir J. van der Laan2015-06-041-0/+65
| | | | | | | | | | | Strict parsing functions for other numeric types. - ParseInt64 analogous to ParseInt32, but for 64-bit values. - ParseDouble for doubles. - Make all three Parse* functions more strict (e.g. reject whitespace on the inside) Also add tests.
* tests: add a BasicTestingSetup and apply to all testsWladimir J. van der Laan2015-03-121-1/+2
| | | | | | | | Make sure that chainparams and logging is properly initialized. Doing this for every test may be overkill, but this initialization is so simple that that does not matter. This should fix the travis issues.
* c++11: These look like user-defined literals.Cory Fields2015-02-031-9/+9
| | | | Add a space to keep the compiler happy
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Add a new test for FormatParagraph (string longer than the default width).Pavel Janík2014-12-061-0/+1
|
* MOVEONLY: core/ -> primitives/Luke Dashjr2014-12-031-1/+1
|
* Separate protocol versioning from clientversionCory Fields2014-10-291-1/+1
|
* MOVEONLY: Separate CTransaction and dependencies from corejtimon2014-10-271-1/+1
|
* boost: drop boost dependency in version.cpp.Cory Fields2014-10-151-0/+12
| | | | Also add a test to verify.
* Use a typedef for monetary valuesMark Friedenbach2014-09-261-1/+1
|
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-0/+3
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* Move CMedianFilter to timedata.cppWladimir J. van der Laan2014-08-261-25/+0
| | | | | Now that we no longer use the median filter to keep track of the number of blocks of peers, that's the only place it is used.
* move rand functions from util to new random.h/.cppPhilip Kaufmann2014-07-091-0/+1
|
* util: Add function FormatParagraph to format paragraph to fixed-widthWladimir J. van der Laan2014-06-111-0/+11
| | | | This is to be used for the `-version` and `-help` messages.
* Replace non-threadsafe gmtime and setlocaleWladimir J. van der Laan2014-05-231-3/+1
| | | | | | | Make DateTimeStrFormat use boost::posix_time. Also re-enable the util_DateTimeStrFormat tests, as they are no longer platform specific.
* Merge pull request #4138Wladimir J. van der Laan2014-05-121-6/+6
|\ | | | | | | 783b182 Remove dummy PRIszX macros for formatting (Wladimir J. van der Laan)
| * Remove dummy PRIszX macros for formattingWladimir J. van der Laan2014-05-061-6/+6
| | | | | | | | | | | | | | | | | | Size specifiers are no longer needed now that we use typesafe tinyformat for string formatting, instead of the system's sprintf. No functional changes. This continues the work in #3735.
* | Remove unused function WildcardMatchWladimir J. van der Laan2014-05-091-11/+0
| | | | | | | | | | No longer necessary after implementing netmask-based matching. Also remove a longer-unused function `skipspaces`.
* | util: add parseint32 function with strict error reportingWladimir J. van der Laan2014-05-091-0/+22
|/ | | | | | None of the current integer parsing functions in util check whether the result is valid and fits in the range of the type. This is required for less sloppy error reporting.
* Add licenses for tests and test dataWladimir J. van der Laan2014-03-181-0/+4
| | | | | | | | - Add license headers to source files (years based on commit dates) in `src/test` as well as `qa` - Add `README.md` to `src/test/data` specifying MIT license Fixes #3848
* Get rid of C99 PRI?64 usage in source filesWladimir J. van der Laan2014-02-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h indirectly, so we cannot fix this with just macros. Trivial commit: apply the following script to all .cpp and .h files: # Middle sed -i 's/"PRIx64"/x/g' "$1" sed -i 's/"PRIu64"/u/g' "$1" sed -i 's/"PRId64"/d/g' "$1" # Initial sed -i 's/PRIx64"/"x/g' "$1" sed -i 's/PRIu64"/"u/g' "$1" sed -i 's/PRId64"/"d/g' "$1" # Trailing sed -i 's/"PRIx64/x"/g' "$1" sed -i 's/"PRIu64/u"/g' "$1" sed -i 's/"PRId64/d"/g' "$1" After this commit, `git grep` for PRI.64 should turn up nothing except the defines in util.h.
* Add test for GetTime()Wladimir J. van der Laan2014-01-091-0/+8
| | | | | Test for mingw/wine issue #3494, where the upper word of time(NULL) return value gets clobbered.
* tests: add testcases for strprintfWladimir J. van der Laan2013-11-131-0/+27
|
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-6/+7
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* Make RPC password resistant to timing attacksGavin Andresen2013-08-081-0/+11
| | | | | | | Fixes issue#2838; this is a tweaked version of pull#2845 that should not leak the length of the password and is more generic, in case we run into other situations where we need timing-attack-resistant comparisons.
* Make the rand tests determinstic. (fixes #2714)Gregory Maxwell2013-07-071-33/+1
| | | | | | This avoids spurious errors with the old tests but still tests enough that if the rng is replaced with a totally broken one it should still fail.
* remove GetBoolArg() fDefault parameter defaulting to falsePhilip Kaufmann2013-06-011-12/+12
| | | | | | | | - explicitly set the default of all GetBoolArg() calls - rework getarg_test.cpp and util_tests.cpp to cover this change - some indentation fixes - move macdockiconhandler.h include in bitcoin.cpp to the "our headers" section
* Remove flaky util thread unit testsGavin Andresen2013-05-031-58/+0
|
* LoopForever and ThreadTrace helpersGavin Andresen2013-04-031-0/+58
|
* Internal RNG for approximateBestSubset to prevent degenerate behavior.Gregory Maxwell2013-02-181-0/+62
| | | | | | | | | | | | | | | This fixes test_bitcoin failures on openbsd reported by dhill on IRC. On some systems rand() is a simple LCG over 2^31 and so it produces an even-odd sequence. ApproximateBestSubset was only using the least significant bit and so every run of the iterative solver would be the same for some inputs, resulting in some pretty dumb decisions. Using something other than the least significant bit would paper over the issue but who knows what other way a system's rand() might get us here. Instead we use an internal RNG with a period of something like 2^60 which is well behaved. This also makes it possible to make the selection deterministic for the tests, if we wanted to implement that.
* test/util_tests.cpp: one more DateTimeStrFormat 'T' removalJeff Garzik2013-01-011-4/+4
|
* Change timestamps to use ISO8601 formattingRichard Schwab2012-12-121-4/+4
|
* Remove useless non-cross-platform tests.Matt Corallo2012-08-171-0/+2
|
* change strings to Bitcoin (uppercase), where it is used as a noun and update ↵Philip Kaufmann2012-05-181-1/+1
| | | | strings to use "Qt" (and not qt or QT) / update initialisation of notificator to use qApp->applicationName() instead of a static string
* Integrate @JoelKatz's optimized ToHex (#562) into current HexStr functionWladimir J. van der Laan2012-04-211-0/+11
|
* Use scoped locks instead of CRITICAL_BLOCKPieter Wuille2012-04-091-3/+4
|
* Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen2012-01-131-0/+15
|
* Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan2011-12-211-3/+1
| | | | This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
* Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr2011-12-201-1/+3
|
* Rework unit tests so test_bitcoin.cpp does not #include them allGavin Andresen2011-12-191-1/+3
|
* Added simple critical section test cases.Clark Gaebel2011-11-021-0/+19
|