Files
sdk/runtime/tools/dartfuzz/dartfuzz_values.dart
T
Aart Bik f29e100f42 [dart/fuzzer] Generate DartFuzz API tables automatically
Rationale:
Rather than manually constructing the API tables for DartFuzz,
this introduces a utility to generate API tables based on
the analyzer traversal of common libraries. The utility
recognizes DartTypes that are currently understood by DartFuzz
and constructs the tables organized by return type.

TBD:
DartFuzz's type system is rather simple; as this improves,
more and more methods will be accepted by the utility,
thereby increasing fuzzing coverage of our libraries.
Change-Id: Idcc607a4a592dbbf80bd79cdfec429cb397b7f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98041
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-03-28 16:31:45 +00:00

87 lines
2.3 KiB
Dart

// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Class that represents some common Dart types.
///
/// TODO(ajcbik): generalize Dart types
///
class DartType {
final String name;
const DartType._withName(this.name);
static const VOID = const DartType._withName('void');
static const BOOL = const DartType._withName('bool');
static const INT = const DartType._withName('int');
static const DOUBLE = const DartType._withName('double');
static const STRING = const DartType._withName('String');
static const INT_LIST = const DartType._withName('List<int>');
static const INT_SET = const DartType._withName('Set<int>');
static const INT_STRING_MAP = const DartType._withName('Map<int, String>');
// All value types.
static const allTypes = [
BOOL,
INT,
DOUBLE,
STRING,
INT_LIST,
INT_SET,
INT_STRING_MAP
];
}
/// Class with interesting values for fuzzing.
class DartFuzzValues {
// Interesting characters.
static const List<String> interestingChars = [
'\\u2665',
'\\u{1f600}', // rune
];
// Regular characters.
static const regularChars =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#&()+- ';
// Interesting integer values.
static const List<int> interestingIntegers = [
0x0000000000000000,
0x0000000000000001,
0x000000007fffffff,
0x0000000080000000,
0x0000000080000001,
0x00000000ffffffff,
0x0000000100000000,
0x0000000100000001,
0x000000017fffffff,
0x0000000180000000,
0x0000000180000001,
0x00000001ffffffff,
0x7fffffff00000000,
0x7fffffff00000001,
0x7fffffff7fffffff,
0x7fffffff80000000,
0x7fffffff80000001,
0x7fffffffffffffff,
0x8000000000000000,
0x8000000000000001,
0x800000007fffffff,
0x8000000080000000,
0x8000000080000001,
0x80000000ffffffff,
0x8000000100000000,
0x8000000100000001,
0x800000017fffffff,
0x8000000180000000,
0x8000000180000001,
0x80000001ffffffff,
0xffffffff00000000,
0xffffffff00000001,
0xffffffff7fffffff,
0xffffffff80000000,
0xffffffff80000001,
0xffffffffffffffff
];
}