dart-sdk/tests
Ömer Sinan Ağacan acd82f974b [tests] Add int.tryParse overflow check tests
See the comments before tests for details.

The test cases are generated with this Rust program:

```
use num::*;

fn main() {
    // 10111...., 65 bits
    let lo: u64 = (1 << 63) - 1;
    let mut err_pattern: BigUint = BigUint::from(lo);
    err_pattern.set_bit(64, true);

    // In the error case, the bit after the sign bit should be set (this bit will be lost), and
    // sign bit should be unset (so that overflow won't make the result negative).
    assert!(err_pattern.bit(64));
    assert!(!err_pattern.bit(63));

    // For each radix, find the number and digit where
    // `<error> = (<old number> * <radix>) + <digit>`.
    'radix_loop: for radix in 4..=36u32 {
        for digit in 0..radix {
            let i: BigUint = (err_pattern.clone() - BigUint::from(digit)) / BigUint::from(radix);
            if !i.bit(64) && !i.bit(63) {
                println!(
                    "{}: {} + {} ({} + {})",
                    radix,
                    i.to_str_radix(radix),

                    BigUint::from(digit).to_str_radix(radix),
                    i,
                    digit,
                );
                continue 'radix_loop;
            }
        }
    }
}
```
Change-Id: I6fe92c46b31373f465702744ee069394db949b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372422
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-06-20 18:01:57 +00:00
..
co19 [co19] Roll co19 to 0a9f7daccd0e682ab791f04ecc23f1dbcee04977 2024-06-03 09:12:56 +00:00
corelib [tests] Add int.tryParse overflow check tests 2024-06-20 18:01:57 +00:00
dartdevc Reland "Tweak expect.dart library." 2024-04-26 15:28:26 +00:00
ffi [vm] Native asset path resolution symlinks with spaces 2024-06-20 14:36:36 +00:00
hot_reload [reload_test] Adding several new reload tests. 2024-05-01 20:01:19 +00:00
language [cfe] Top level function wildcard parameters are non-binding. 2024-06-18 18:23:55 +00:00
lib Forgotten last patch-set for landed CL 2024-06-20 11:27:53 +00:00
macro_build add package:_macros (SDK vendored) and package:macros (pub published) 2024-03-26 18:40:00 +00:00
modular Support prebuilt macros in the incremental compiler mode for DDC 2024-04-09 07:37:26 +00:00
standalone Add TypedDataList superinterface on typed data lists. 2024-06-20 08:18:38 +00:00
web [dart2wasm] Fix new web/wasm/allow_import_export_pragmas_test test: Add --extra-compiler-option= before the flag name 2024-06-14 10:18:23 +00:00
legacy_status_dart2js.csv Spelling tests 2022-12-19 12:56:47 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
README.md [wiki] move the https://github.com/dart-lang/sdk/wiki to the docs/ dir 2024-05-16 18:19:40 +00:00

This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/tree/main/docs/Testing.md.