summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Golden <xdg@xdg.me>2019-01-15 13:46:14 -0500
committerDavid Golden <xdg@xdg.me>2019-01-15 14:09:23 -0500
commita0c5635a5ee27ac30af2e6d3d01c663589f28824 (patch)
tree5c2f2d8a6363b104c6e054af20ab5aa5ee330ba5
parentd03e38b3766207db9dd8e1fb1c4bc40c9446df31 (diff)
downloadmongo-a0c5635a5ee27ac30af2e6d3d01c663589f28824.tar.gz
Import tools: fde6c854adf7b359336f8b4a3e2828ffca0bb1af from branch v4.1
ref: db7b61e2db..fde6c854ad for: 4.1.7 TOOLS-2030 mongodump does not dump system.js collections TOOLS-2109 Build Tools with Go 1.11 TOOLS-2150 Manage dependencies with 'dep' tool TOOLS-2152 Rationalize test types TOOLS-2158 mongodump failing on Windows with "error opening system CA store: Access is denied." TOOLS-2159 mongoimport --upsertFields does not accept nested keys by dot notation from CSV TOOLS-2167 Add CGO flags for building on Windows TOOLS-2168 Add CGO flags for building on MacOS TOOLS-2183 Fix broken Kerberos and SSL tests
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/.gitignore1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/CONTRIBUTING.md8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/Godeps21
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.lock213
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.toml118
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/bsondump/bsondump_test.go8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common.yml156
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/multiplexer_roundtrip_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/parser_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/prelude_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/converter_test.go32
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/date_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/marshal_d_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/maxkey_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/minkey_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberint_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberlong_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/objectid_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/regexp_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/timestamp_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/undefined_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/bson_stream_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/buffered_bulk_test.go44
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_sasl_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go29
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/db_test.go26
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/namespaces_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/tlsgo/config_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/write_concern_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/failpoint/failpoint_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_prioritizer_test.go10
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bench_test.go9
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bindata_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/boolean_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/date_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbpointer_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbref_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_d_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_test.go26
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/encode_test.go15
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/float_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/fold_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/frac_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/hex_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/infinity_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/iso_date_test.go173
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/maxkey_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/minkey_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/nan_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/new_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/number_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/objectid_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/regexp_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/scanner_test.go10
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/single_quoted_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/stream_test.go8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tagkey_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tags_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/timestamp_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/undefined_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/unquoted_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/log/tool_logger_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/options/options_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/manager_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/progress_bar_test.go7
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testtype/types.go48
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/auth.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/testutil.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/grid_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/units_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/bool_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/format_date_test.go80
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/math_test.go6
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/mongo_test.go6
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/import.data2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump_test.go10
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare.go9
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare_test.go40
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/csv_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/json_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/kerberos_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/mongoexport_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/options_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common.go13
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common_test.go33
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/csv_test.go6
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/json_test.go8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport.go1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport_test.go60
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/options_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/testdata/test_nested_upsert.csv3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/tsv_test.go6
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/typed_fields_test.go5
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/auth_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/cursors_test.go7
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/execute_test.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/filter_test.go5
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/mongoreplay_test.go21
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/packet_handler.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/pcap_test.go7
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_livedb_test.go16
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath.go2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath_test.go9
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/metadata_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_archive_test.go4
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_test.go6
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/ns/ns_test.go8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/oplog_test.go8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/options_test.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongostat/mongostat_test.go4
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/runTests.sh54
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/set_goenv.sh17
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/test.sh43
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor.sh42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/escaper/escaper_test.go112
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/auth_test.go1163
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/bson_test.go1675
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/specdata_test.go241
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bulk_test.go376
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/cluster_test.go1914
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/dbserver_test.go108
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/export_test.go12
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/export_test.go33
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/gridfs_test.go691
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/internal/scram/scram_test.go67
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/queue_test.go84
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/session_test.go3907
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/suite_test.go242
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_test.go15
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_windows_test.go11
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/export_test.go12
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/testserver_test.go108
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/dockey_test.go205
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/mgo_test.go101
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/sim_test.go388
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/tarjan_test.go44
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/txn_test.go753
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/.evergreen/config.yml11
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/cert_test.go139
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ciphers_test.go307
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ctx_test.go48
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/dh_test.go51
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/fips_test.go27
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/hmac_test.go74
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_1_0_test.go149
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_test.go176
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha1_test.go109
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha256_test.go107
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sni_test.go23
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ssl_test.go656
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/system_certs.c2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/version_test.go29
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/lint_test.go197
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/5_test.go17
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/blank-import-lib_test.go20
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/golden_test.go1965
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/snappy_test.go1353
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/afpacket/afpacket_test.go40
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/benchmark_test.go194
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/bytediff/bytediff_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/ip4defrag/defrag_test.go1343
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/base_test.go42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/decode_test.go1272
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/dot11_test.go495
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/gre_test.go102
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/icmp6_test.go84
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip4_test.go55
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip6_test.go430
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ipsec_test.go154
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/prism_test.go120
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/radiotap_test.go79
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/sflow_test.go820
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/tcpip_test.go185
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/udp_test.go372
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/usb_test.go73
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/macs/benchmark_test.go18
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcap_test.go242
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcapgo_test.go56
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/read_test.go119
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/write_test.go71
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/assembly_test.go562
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/tcpreader/reader_test.go129
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/writer_test.go94
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/.gitignore2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/LICENSE24
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/README.md143
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/build/build.go875
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/circle.yml140
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/bool.go43
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/break.go32
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/escape.go70
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/info.go254
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/sideeffect.go37
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/astutil/astutil.go48
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/compiler.go297
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/expressions.go1373
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/assign.go106
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/incdecstmt.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/doc.go12
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs.go31
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs_vfsdata.go232
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/doc.go8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs.go29
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs_vfsdata.go993
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/bytes/bytes.go43
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/internal/subtle/aliasing.go15
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/rand/rand.go49
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/x509/x509.go9
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/cpu/cpu_js.go5
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/poll/fd_poll_js.go88
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/syscall/unix/unix_js.go9
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/testenv/testenv.go26
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/big/big.go7
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/math.go255
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/fetch.go134
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/http.go113
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/net.go65
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/os.go32
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/signal/signal.go12
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect.go1371
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go111.go142
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go1111.go142
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/swapper.go36
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/debug/debug.go14
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/pprof/pprof.go49
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/runtime.go234
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/strings/strings.go67
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/atomic/atomic.go185
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/cond.go41
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/pool.go35
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/sync.go80
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/waitgroup.go30
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall.go64
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_linux.go5
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_nonlinux.go5
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_unix.go133
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_windows.go100
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/example.go70
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/ioutil.go66
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/testing.go26
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/time/time.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/unicode/unicode.go28
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/package.go809
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/genmin.go63
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/goroutines.go358
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/jsmapping.go379
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/numeric.go196
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude.go425
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude_min.go6
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/types.go747
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/statements.go786
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/typesutil/typesutil.go16
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/utils.go673
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/version_check.go9
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/packages.md157
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/syscalls.md34
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil.go13
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil_windows.go7
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/js/js.go168
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/binding.gyp8
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/syscall.cc98
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/map.go67
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/mutex.go85
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/once.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/pool.go63
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/doc.go2
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/gopherjsvendored_test.sh48
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/main/main.go7
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/otherpkg/otherpkg.go3
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/run.go1218
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/testdata/time_inexternalization.go19
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tool.go963
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/.gitignore5
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/LICENSE202
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/README.md58
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of.go70
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of_test.go110
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any.go32
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of.go94
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of_test.go139
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains.go61
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains_test.go233
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals.go88
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals_test.go343
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are.go91
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are_test.go208
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals.go557
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals_test.go3843
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error.go51
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal_test.go1059
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than_test.go1079
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as.go37
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as_test.go181
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr.go46
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr_test.go93
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to.go134
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to_test.go849
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal.go41
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal_test.go1079
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than.go152
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than_test.go1059
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matcher.go86
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp.go69
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/new_matcher.go43
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not_test.go108
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics.go74
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics_test.go141
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee.go65
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee_test.go152
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/transform_description.go36
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/arg_test.go133
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/assert_test.go177
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/command_test.go544
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/completion_test.go294
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/convert_test.go159
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/example_test.go110
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/group_test.go255
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/help_test.go460
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/ini_test.go950
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/long_test.go85
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/marshal_test.go97
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/options_test.go45
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/parser_test.go487
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/pointer_test.go81
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/short_test.go194
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/tag_test.go38
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/unknown_test.go66
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jtolds/gls/context_test.go139
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mattn/go-runewidth/runewidth_test.go229
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/cache_test.go1678
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/sharded_test.go85
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/collections_test.go157
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/doc_test.go57
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/equality_test.go269
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_test.go170
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of_test.go110
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of_test.go139
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains_test.go233
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals_test.go343
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are_test.go208
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals_test.go3864
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/error_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal_test.go1101
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than_test.go1077
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as_test.go181
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr_test.go93
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to_test.go849
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal_test.go1077
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than_test.go1057
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/not_test.go108
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/panics_test.go141
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee_test.go152
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/controller_test.go1249
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/createmock/createmock_test.go233
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/do_all_test.go90
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/generate_test.go168
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/type_string_test.go220
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/integration_test.go129
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/internal_expectation_test.go265
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/invoke_test.go110
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/return_test.go978
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/save_arg_test.go132
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/expect_that_test.go168
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/integration_test.go265
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/srcutil/methods_test.go107
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/panic_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/quantity_test.go145
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/serializer_test.go36
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/strings_test.go118
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/time_test.go159
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/type_test.go76
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/utilities_for_test.go75
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go72
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/gotest/doc_test.go1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go774
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go40
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go66
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go181
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go51
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go94
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go317
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go175
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/doc_test.go1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/assertion_examples_test.go125
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/bowling_game_test.go80
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/simple_example_test.go36
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/OFL.txt186
-rwxr-xr-xsrc/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/OFL.txt184
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/api/server_test.go462
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/contract/doc_test.go1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/executor_test.go160
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/tester_test.go254
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/messaging/doc_test.go1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/package_parser_test.go792
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/parser_test.go47
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_integration_test.go33
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_test.go217
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core_test.go419
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_test.go200
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/doc_test.go1
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/stuff_test.go17
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/util_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/examples_test.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/map_test.go51
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/profile_test.go107
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/saslprep_test.go56
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/set_test.go85
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bcrypt/bcrypt_test.go226
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/blowfish/blowfish_test.go274
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/bn256_test.go304
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/example_test.go43
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/cast5/cast5_test.go106
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/curve25519/curve25519_test.go29
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/example_test.go61
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/hkdf_test.go370
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/md4/md4_test.go71
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/box/box_test.go78
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/secretbox/secretbox_test.go91
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ocsp/ocsp_test.go584
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/armor/armor_test.go95
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/canonical_text_test.go52
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/clearsign/clearsign_test.go197
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal_test.go49
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/keys_test.go370
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/compressed_test.go41
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key_test.go146
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/ocfb_test.go46
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/opaque_test.go67
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/packet_test.go255
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/private_key_test.go69
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_test.go202
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3_test.go82
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_test.go42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_v3_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted_test.go103
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted_test.go123
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userattribute_test.go109
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userid_test.go87
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/read_test.go512
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/s2k/s2k_test.go137
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/write_test.go259
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/otr/otr_test.go470
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pbkdf2/pbkdf2_test.go157
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/bmp-string_test.go63
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/crypto_test.go125
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/bench_test.go27
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2_test.go93
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/mac_test.go42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pbkdf_test.go34
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pkcs12_test.go138
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/poly1305/poly1305_test.go86
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ripemd160/ripemd160_test.go64
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go35
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa20_test.go139
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/scrypt/scrypt_test.go160
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/sha3/sha3_test.go306
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/client_test.go287
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go78
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/server_test.go77
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go64
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/benchmark_test.go122
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/buffer_test.go87
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/certs_test.go216
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/cipher_test.go127
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_auth_test.go393
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_test.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/example_test.go211
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/handshake_test.go415
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/kex_test.go50
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/keys_test.go437
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mempipe_test.go110
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/messages_test.go254
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mux_test.go525
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/session_test.go774
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/tcpip_test.go20
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go269
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go59
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/cert_test.go47
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go160
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/session_test.go340
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go46
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go261
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/testdata_test.go64
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/testdata_test.go63
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/transport_test.go109
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/tea/tea_test.go93
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/twofish/twofish_test.go129
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xtea/xtea_test.go229
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xts/xts_test.go85
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/context_test.go438
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/example_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/fold_test.go51
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/icu_test.go210
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/map_test.go950
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables10.0.0_test.go1160
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables9.0.0_test.go1156
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/builder_test.go290
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/colelem_test.go215
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/contract_test.go266
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/order_test.go229
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/trie_test.go107
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/collate_test.go482
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/export_test.go51
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/option_test.go209
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/reg_test.go230
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/sort_test.go55
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/table_test.go291
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/currency_test.go171
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/example_test.go27
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/format_test.go70
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/query_test.go107
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/tables_test.go93
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/data_test.go335
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/gen_test.go241
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/charmap/charmap_test.go258
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/encoding_test.go290
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/example_test.go42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go144
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/example_test.go27
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go192
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/japanese/all_test.go248
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/korean/all_test.go94
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go143
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go114
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/unicode_test.go499
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go248
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/data_test.go197
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/example_test.go46
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/message_test.go197
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/plural_test.go216
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go316
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/varint_test.go123
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/cldrtree/cldrtree_test.go456
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collate_test.go121
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collelem_test.go183
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/colltab_test.go64
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/contract_test.go131
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/iter_test.go63
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/numeric_test.go159
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/trie_test.go106
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/weighter_test.go42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/common_test.go55
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/example_test.go68
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen10.0.0_test.go93
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen9.0.0_test.go84
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna10.0.0_test.go140
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna9.0.0_test.go136
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna_test.go178
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/punycode_test.go198
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/format/parser_test.go32
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/gen_test.go38
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/internal_test.go38
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/match_test.go56
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/decimal_test.go329
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/format_test.go522
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/number_test.go104
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/pattern_test.go438
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/tables_test.go125
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/stringset/set_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/tag/tag_test.go67
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/data_test.go875
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_compact_test.go71
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_test.go148
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/gen_test.go68
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/example_test.go81
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/ucd_test.go105
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/coverage_test.go154
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/dict_test.go39
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/display_test.go714
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/examples_test.go116
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/examples_test.go413
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/httpexample_test.go48
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/language_test.go911
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/lookup_test.go457
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/match_test.go505
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/parse_test.go517
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog/catalog_test.go296
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog_test.go43
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/examples_test.go42
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/fmt_test.go1871
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/message_test.go181
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/examples_test.go28
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/format_test.go112
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/number_test.go190
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/cond_test.go282
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/example_test.go60
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/runes_test.go664
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/search/pattern_test.go357
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bench_test.go54
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go694
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go668
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go168
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/benchmark_test.go82
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/class_test.go50
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce10.0.0_test.go244
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce9.0.0_test.go244
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce_test.go162
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/profile_test.go149
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/tables_test.go69
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/examples_test.go37
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/transform_test.go1317
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/core_test.go224
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/ranges_test.go53
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/tables_test.go82
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/cldr_test.go27
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/collate_test.go275
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/data_test.go186
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/examples_test.go21
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/resolve_test.go368
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/slice_test.go175
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/composition_test.go130
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go7424
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go7409
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_iter_test.go82
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_test.go27
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/forminfo_test.go54
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/iter_test.go98
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/normalize_test.go1287
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/readwriter_test.go56
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/transform_test.go101
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/ucd_test.go275
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/merge_test.go184
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go55
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/example_test.go118
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/runenames_test.go46
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/common_test.go92
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/example_test.go52
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/runes_test.go461
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/tables_test.go59
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/transform_test.go701
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/.travis.yml2
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/auth_test.go1294
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson.go30
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_corpus_spec_test.go1926
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_test.go1770
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/decimal_test.go4109
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/json_test.go184
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bulk_test.go504
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/cluster_test.go2101
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/dbserver_test.go108
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/export_test.go12
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/export_test.go33
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/gridfs_test.go708
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/bench_test.go223
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/decode_test.go1512
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/encode_test.go613
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/example_test.go252
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/extension_test.go221
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/fold_test.go116
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/number_test.go133
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/scanner_test.go316
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/stream_test.go418
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tagkey_test.go115
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tags_test.go28
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/scram/scram_test.go67
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/queue_test.go101
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session.go44
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session_test.go4373
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/suite_test.go266
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_test.go15
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_windows_test.go11
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/dockey_test.go205
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/sim_test.go388
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/tarjan_test.go44
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/txn_test.go778
-rw-r--r--src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/tomb.v2/tomb_test.go183
677 files changed, 17542 insertions, 151563 deletions
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/.gitignore b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/.gitignore
index d0892b2be26..b01f90d4472 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/.gitignore
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/.gitignore
@@ -16,6 +16,7 @@
*temp*
bin/
+testing_output/
vendor/pkg
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/CONTRIBUTING.md b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/CONTRIBUTING.md
index 6f7b50bdce9..92c43bec1a0 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/CONTRIBUTING.md
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/CONTRIBUTING.md
@@ -44,12 +44,12 @@ Testing
To run unit and integration tests:
```
-go test -v -test.types=unit,integration
+go test -v ./...
```
+If TOOLS_TESTING_UNIT is set to "true" in the environment, unit tests will run.
+If TOOLS_TESTING_INTEGRATION is set to "true" in the environment, integration tests will run.
-This should be run in all package directories - common, mongorestore, mongoexport, etc.
-
-The `test.types` flag indicates what kinds of tests to run. Integration tests require a `mongod` (running on port 33333) while unit tests do not.
+Integration tests require a `mongod` (running on port 33333) while unit tests do not.
To run the quality assurance tests, you need to have the latest stable version of the rebuilt tools, `mongod`, `mongos`, and `mongo` in your current working directory.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Godeps b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Godeps
deleted file mode 100644
index 2cd638c5c60..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Godeps
+++ /dev/null
@@ -1,21 +0,0 @@
-gopkg.in/mgo.v2 fd632d79a0f7ffcf190737ba2d5e2548cf56ceeb github.com/10gen/mgo
-gopkg.in/tomb.v2 14b3d72120e8d10ea6e6b7f87f7175734b1faab8
-github.com/jtolds/gls 8ddce2a84170772b95dd5d576c48d517b22cac63
-github.com/jacobsa/oglematchers 3ecefc49db07722beca986d9bb71ddd026b133f0
-github.com/smartystreets/assertions 287b4346dc4e71a038c346375a9d572453bc469b
-github.com/smartystreets/goconvey bf58a9a1291224109919756b4dcc469c670cc7e4
-github.com/jessevdk/go-flags 97448c91aac742cbca3d020b3e769013a420a06f
-github.com/3rf/mongo-lint 3550fdcf1f43b89aaeabaa4559eaae6dc4407e42
-github.com/10gen/openssl bed982ee200d16c1cfc6c0845d0be025864c1c1b
-github.com/spacemonkeygo/spacelog f936fb050dc6b5fe4a96b485a6f069e8bdc59aeb
-github.com/howeyc/gopass 44476384cd4721b68705e72f19e95d1a3a504370
-github.com/nsf/termbox-go 0723e7c3d0a317dea811f0fbe4d6edd81908c971
-github.com/mattn/go-runewidth d6bea18f789704b5f83375793155289da36a3c7f
-golang.org/x/crypto 1f22c0103821b9390939b6776727195525381532 github.com/golang/crypto
-github.com/10gen/llmgo afcced55e92d9b6b93ccf32508238c08cfbaddb8
-github.com/google/gopacket 1b0b78901cdd351ecfc68bf1a2adafcd2ff30220
-github.com/patrickmn/go-cache 1881a9bccb818787f68c52bfba648c6cf34c34fa
-github.com/10gen/escaper 17fe61c658dcbdcbf246c783f4f7dc97efde3a8b
-github.com/golang/snappy d9eb7a3d35ec988b8585d4a0068e462c27d28380
-github.com/xdg/stringprep v1.0.0
-golang.org/x/text v0.3.0 github.com/golang/text
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.lock b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.lock
new file mode 100644
index 00000000000..6876b8ba377
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.lock
@@ -0,0 +1,213 @@
+# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
+
+
+[[projects]]
+ digest = "1:0fa31abb24eb9fb04d85d4872cc7526035b1b5dfa4f6a03644cfdabe79b5fbb1"
+ name = "github.com/10gen/escaper"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "17fe61c658dcbdcbf246c783f4f7dc97efde3a8b"
+
+[[projects]]
+ digest = "1:ce468ed868c85187d86cf35327e6560c515c45077e787140ce37226515cdc42e"
+ name = "github.com/10gen/llmgo"
+ packages = [
+ ".",
+ "bson",
+ "internal/sasl",
+ "internal/scram",
+ ]
+ pruneopts = "T"
+ revision = "afcced55e92d9b6b93ccf32508238c08cfbaddb8"
+
+[[projects]]
+ digest = "1:17fd6441926671a4ff4580786816ae9f9f4f08705821d41907c26b4b9a0ddbaa"
+ name = "github.com/10gen/openssl"
+ packages = [
+ ".",
+ "utils",
+ ]
+ pruneopts = "T"
+ revision = "812b95859f13cba543f6ad860fcff4bb0f7fcdaa"
+
+[[projects]]
+ digest = "1:d9d83b3d983f3e6f78baf83e19666facd3377e81acde31f7db8a6fcd31eae009"
+ name = "github.com/3rf/mongo-lint"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "3550fdcf1f43b89aaeabaa4559eaae6dc4407e42"
+
+[[projects]]
+ digest = "1:5bced478af5ed1c177ed96002039dd5c3b304fb89f883c3da87e14c54942b545"
+ name = "github.com/golang/snappy"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "d9eb7a3d35ec988b8585d4a0068e462c27d28380"
+
+[[projects]]
+ digest = "1:6ab71fd3d97c04408a09606acd1c3e56d2546f962b1c57dd6e249ed36c5ed1f9"
+ name = "github.com/google/gopacket"
+ packages = [
+ ".",
+ "layers",
+ "pcap",
+ "tcpassembly",
+ ]
+ pruneopts = "T"
+ revision = "1b0b78901cdd351ecfc68bf1a2adafcd2ff30220"
+
+[[projects]]
+ branch = "master"
+ digest = "1:4d4c5d77b8fc930d16722d1d271788b96e304db03888d4552ade6d8cfc650d11"
+ name = "github.com/gopherjs/gopherjs"
+ packages = ["js"]
+ pruneopts = "T"
+ revision = "d547d1d9531ed93dbdebcbff7f83e7c876a1e0ee"
+
+[[projects]]
+ digest = "1:8e9ae4fedb2abb5267f2cd69f8d3010e6c464a9c51d1fa1f9d192c0757ac691a"
+ name = "github.com/howeyc/gopass"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "44476384cd4721b68705e72f19e95d1a3a504370"
+
+[[projects]]
+ digest = "1:267d807c74d5b9f38d0b606bdcc119543274b693e82da0be3f86226abe612e8e"
+ name = "github.com/jessevdk/go-flags"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "97448c91aac742cbca3d020b3e769013a420a06f"
+
+[[projects]]
+ digest = "1:e60e4265f8a89c03c9a01de4849f413e8db802662176e4087d0fdbad868bf5f3"
+ name = "github.com/jtolds/gls"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "8ddce2a84170772b95dd5d576c48d517b22cac63"
+
+[[projects]]
+ digest = "1:1583473db99b1057f15e6acf80fee5848c055aad49614f56862690aadcb87694"
+ name = "github.com/mattn/go-runewidth"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "d6bea18f789704b5f83375793155289da36a3c7f"
+
+[[projects]]
+ digest = "1:f363c75e8cac5653bc5c0c2b90cbd8a522fdc48c13a5f8d85078750f82d1a009"
+ name = "github.com/nsf/termbox-go"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "0723e7c3d0a317dea811f0fbe4d6edd81908c971"
+
+[[projects]]
+ digest = "1:fc61a390fb0ad4b97e31cd1040b91ed02f7ed175f55285efa7a4d10ae208282b"
+ name = "github.com/patrickmn/go-cache"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "1881a9bccb818787f68c52bfba648c6cf34c34fa"
+
+[[projects]]
+ digest = "1:c6ee5f0b23f2bc65fa69e006e0afd8e516d4c601573701cc700e3f492654b55c"
+ name = "github.com/smartystreets/assertions"
+ packages = [
+ ".",
+ "internal/go-render/render",
+ "internal/oglematchers",
+ ]
+ pruneopts = "T"
+ revision = "287b4346dc4e71a038c346375a9d572453bc469b"
+
+[[projects]]
+ digest = "1:57331f6e8d757f98e32c228406b9efd02e31ee40f35114b80e09dae71d56e6f6"
+ name = "github.com/smartystreets/goconvey"
+ packages = [
+ "convey",
+ "convey/gotest",
+ "convey/reporting",
+ ]
+ pruneopts = "T"
+ revision = "bf58a9a1291224109919756b4dcc469c670cc7e4"
+
+[[projects]]
+ digest = "1:7e8f154e6a411458c05d33ed6676ca6b4c0757743a14f37ebc25b2fcc2f50d9c"
+ name = "github.com/spacemonkeygo/spacelog"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "f936fb050dc6b5fe4a96b485a6f069e8bdc59aeb"
+
+[[projects]]
+ digest = "1:577b99fc55ee19cbf1ffd072808c91ced78cd732bd9d0517bec9b90e532069cb"
+ name = "github.com/xdg/stringprep"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "bd625b8dc1e3b0f57412280ccbcc317f0c69d8db"
+ version = "v1.0.0"
+
+[[projects]]
+ digest = "1:0f2b2cb9f84318c0f71fed3087ff9ac370370f842469b71b00348c3d72a19b44"
+ name = "golang.org/x/crypto"
+ packages = ["ssh/terminal"]
+ pruneopts = "T"
+ revision = "1f22c0103821b9390939b6776727195525381532"
+
+[[projects]]
+ digest = "1:6164911cb5e94e8d8d5131d646613ff82c14f5a8ce869de2f6d80d9889df8c5a"
+ name = "golang.org/x/text"
+ packages = [
+ "internal/gen",
+ "internal/triegen",
+ "internal/ucd",
+ "transform",
+ "unicode/cldr",
+ "unicode/norm",
+ ]
+ pruneopts = "T"
+ revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
+ version = "v0.3.0"
+
+[[projects]]
+ digest = "1:202d7e19a366151a68e5d96a09caaf02d0e951ece729ac2c760b837af05558a9"
+ name = "gopkg.in/mgo.v2"
+ packages = [
+ ".",
+ "bson",
+ "internal/json",
+ "internal/sasl",
+ "internal/scram",
+ ]
+ pruneopts = "T"
+ revision = "8c133fd1d0fc316302df84fc12769e17fb473bb1"
+ source = "github.com/10gen/mgo"
+
+[[projects]]
+ digest = "1:4563d77fdfd224dafc10b09754e68da5563cfec113893d298c7841be66a5cb01"
+ name = "gopkg.in/tomb.v2"
+ packages = ["."]
+ pruneopts = "T"
+ revision = "14b3d72120e8d10ea6e6b7f87f7175734b1faab8"
+
+[solve-meta]
+ analyzer-name = "dep"
+ analyzer-version = 1
+ input-imports = [
+ "github.com/10gen/escaper",
+ "github.com/10gen/llmgo",
+ "github.com/10gen/llmgo/bson",
+ "github.com/10gen/openssl",
+ "github.com/3rf/mongo-lint",
+ "github.com/google/gopacket",
+ "github.com/google/gopacket/layers",
+ "github.com/google/gopacket/pcap",
+ "github.com/google/gopacket/tcpassembly",
+ "github.com/howeyc/gopass",
+ "github.com/jessevdk/go-flags",
+ "github.com/nsf/termbox-go",
+ "github.com/patrickmn/go-cache",
+ "github.com/smartystreets/goconvey/convey",
+ "golang.org/x/crypto/ssh/terminal",
+ "gopkg.in/mgo.v2",
+ "gopkg.in/mgo.v2/bson",
+ "gopkg.in/tomb.v2",
+ ]
+ solver-name = "gps-cdcl"
+ solver-version = 1
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.toml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.toml
new file mode 100644
index 00000000000..6d9f47550ac
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/Gopkg.toml
@@ -0,0 +1,118 @@
+# Gopkg.toml example
+#
+# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
+# for detailed Gopkg.toml documentation.
+#
+# required = ["github.com/user/thing/cmd/thing"]
+# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
+#
+# [[constraint]]
+# name = "github.com/user/project"
+# version = "1.0.0"
+#
+# [[constraint]]
+# name = "github.com/user/project2"
+# branch = "dev"
+# source = "github.com/myfork/project2"
+#
+# [[override]]
+# name = "github.com/x/y"
+# version = "2.4.0"
+#
+# [prune]
+# non-go = false
+# go-tests = true
+# unused-packages = true
+
+# mongo-lint is a custom linter that is not called in any of the go code.
+required = ["github.com/3rf/mongo-lint"]
+
+[[constraint]]
+ name = "github.com/10gen/escaper"
+ revision = "17fe61c658dcbdcbf246c783f4f7dc97efde3a8b"
+
+[[constraint]]
+ name = "github.com/10gen/llmgo"
+ revision = "afcced55e92d9b6b93ccf32508238c08cfbaddb8"
+
+[[constraint]]
+ name = "github.com/10gen/openssl"
+ revision = "812b95859f13cba543f6ad860fcff4bb0f7fcdaa"
+
+[[constraint]]
+ name = "github.com/google/gopacket"
+ revision = "1b0b78901cdd351ecfc68bf1a2adafcd2ff30220"
+
+[[constraint]]
+ name = "github.com/howeyc/gopass"
+ revision = "44476384cd4721b68705e72f19e95d1a3a504370"
+
+[[constraint]]
+ name = "github.com/jessevdk/go-flags"
+ revision = "97448c91aac742cbca3d020b3e769013a420a06f"
+
+[[constraint]]
+ name = "github.com/nsf/termbox-go"
+ revision = "0723e7c3d0a317dea811f0fbe4d6edd81908c971"
+
+[[constraint]]
+ name = "github.com/patrickmn/go-cache"
+ revision = "1881a9bccb818787f68c52bfba648c6cf34c34fa"
+
+[[constraint]]
+ name = "github.com/smartystreets/goconvey"
+ revision = "bf58a9a1291224109919756b4dcc469c670cc7e4"
+
+[[constraint]]
+ name = "golang.org/x/crypto"
+ revision = "1f22c0103821b9390939b6776727195525381532"
+
+[[override]]
+ name = "gopkg.in/mgo.v2"
+ source = "github.com/10gen/mgo"
+ revision = "8c133fd1d0fc316302df84fc12769e17fb473bb1"
+
+[[constraint]]
+ name = "gopkg.in/tomb.v2"
+ revision = "14b3d72120e8d10ea6e6b7f87f7175734b1faab8"
+
+[[override]]
+ name = "github.com/jtolds/gls"
+ revision = "8ddce2a84170772b95dd5d576c48d517b22cac63"
+
+[[override]]
+ name = "github.com/jacobsa/oglematchers"
+ revision = "3ecefc49db07722beca986d9bb71ddd026b133f0"
+
+[[override]]
+ name = "github.com/smartystreets/assertions"
+ revision = "287b4346dc4e71a038c346375a9d572453bc469b"
+
+[[override]]
+ name = "github.com/3rf/mongo-lint"
+ revision = "3550fdcf1f43b89aaeabaa4559eaae6dc4407e42"
+
+[[override]]
+ name = "github.com/spacemonkeygo/spacelog"
+ revision = "f936fb050dc6b5fe4a96b485a6f069e8bdc59aeb"
+
+[[override]]
+ name = "github.com/mattn/go-runewidth"
+ revision = "d6bea18f789704b5f83375793155289da36a3c7f"
+
+[[override]]
+ name = "github.com/golang/snappy"
+ revision = "d9eb7a3d35ec988b8585d4a0068e462c27d28380"
+
+[[override]]
+ name = "github.com/xdp/stringprep"
+ version = "v1.0.0"
+
+[[override]]
+ name = "github.com/golang/text"
+ version = "v0.3.0"
+
+[prune]
+ go-tests = true
+ # unused-packages = true
+
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/bsondump/bsondump_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/bsondump/bsondump_test.go
index daf9d5ed16f..c1d7251d8df 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/bsondump/bsondump_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/bsondump/bsondump_test.go
@@ -10,13 +10,19 @@ import (
"bytes"
"os"
"os/exec"
+ "runtime"
"testing"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
func TestBsondump(t *testing.T) {
-
+ // TOOLS-2179 filed to figure out why this is neccessary
+ if runtime.GOOS == "windows" {
+ t.SkipNow()
+ }
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Test bsondump reading from stdin and writing to stdout", t, func() {
cmd := exec.Command("../bin/bsondump")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common.yml
index 41efd877796..c7ef7534d02 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common.yml
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common.yml
@@ -12,7 +12,6 @@ mongo_tools_variables:
## List of tests to run on each buildvariant
mongo_tools_task_lists:
mac_task_list: &macos_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -42,7 +41,6 @@ mongo_tools_variables:
- name: unit
- name: replay-dist
rhel_x86_64_task_list: &rhel_x86_64_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -77,7 +75,6 @@ mongo_tools_variables:
- name: native-cert-ssl
- name: replay-dist
rhel_x86_64_enterprise_task_list: &rhel_x86_64_enterprise_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -95,7 +92,6 @@ mongo_tools_variables:
# Disabled due to TOOLS-2116
# - name: replay-replay_test
ubuntu_x86_64_task_list: &ubuntu_x86_64_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -129,7 +125,6 @@ mongo_tools_variables:
- name: native-cert-ssl
- name: replay-dist
ubuntu_x86_64_enterprise_task_list: &ubuntu_x86_64_enterprise_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -146,7 +141,6 @@ mongo_tools_variables:
# Disabled due to TOOLS-2108
# - name: replay-replay_test
ubuntu_x86_64_race_task_list: &ubuntu_x86_64_race_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -161,7 +155,6 @@ mongo_tools_variables:
# Disabled due to TOOLS-2108
# - name: replay-replay_test
windows_64_task_list: &windows_64_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -202,7 +195,6 @@ mongo_tools_variables:
- name: native-cert-ssl
- name: unit
windows_64_enterprise_task_list: &windows_64_enterprise_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -227,7 +219,6 @@ mongo_tools_variables:
- name: unit
- name: native-cert-ssl
rhel71_ppc64le_enterprise_task_list: &rhel71_ppc64le_enterprise_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -248,7 +239,6 @@ mongo_tools_variables:
# Disabled due to TOOLS-2108
# - name: replay-replay_test
rhel67_s390x_enterprise_task_list: &rhel67_s390x_enterprise_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -270,7 +260,6 @@ mongo_tools_variables:
# Disabled due to TOOLS-2108
# - name: replay-replay_test
ubuntu1604_arm64_ssl_task_list: &ubuntu1604_arm64_ssl_tasks
- - name: db
- name: dist
- name: integration
- name: integration-auth
@@ -451,7 +440,7 @@ functions:
. ./set_goenv.sh
GOROOT="" set_goenv || exit
cd ${package}
- go test -ldflags "$(print_ldflags)" ${coverage_args} ${args} -tags "$(print_tags ${build_tags})" -test.v > unit.suite
+ go test -ldflags "$(print_ldflags)" ${coverage_args} -tags "$(print_tags ${build_tags})" -test.v > unit.suite
export exitcode=$?
cat unit.suite
cp unit.suite $basedir/.
@@ -497,40 +486,16 @@ functions:
. ./set_goenv.sh
GOROOT="" set_goenv || exit
- cwd=$(pwd)
- # run unit tests under common package
- for i in archive bsonutil db/tlsgo failpoint intents json log options progress text util; do
- cd $cwd/common/$i
- COMMON_SUBPKG=$(basename $i)
- COVERAGE_ARGS=""
- if [ "${run_coverage}" ]; then
- COVERAGE_ARGS="-coverprofile=coverage_$COMMON_SUBPKG.out"
- fi;
- go test -ldflags "$(print_ldflags)" $COVERAGE_ARGS ${args} -tags "$(print_tags failpoints ${build_tags})" -test.v > $COMMON_SUBPKG.suite
- if [ $? -ne 0 ]; then
- echo "suite failed, will exit with error on finish"
- export exitcode=1
- fi
- cat $COMMON_SUBPKG.suite
- cp $COMMON_SUBPKG.suite $cwd
- done
-
- #TODO mongotop needs a test
- for i in mongoimport mongoexport mongostat mongorestore mongodump mongofiles; do
- cd $cwd/$i
- COVERAGE_ARGS=""
- if [ "${run_coverage}" ]; then
- COVERAGE_ARGS="-coverprofile=coverage_$i.out"
- fi;
- go test -ldflags "$(print_ldflags)" $COVERAGE_ARGS ${args} -tags "$(print_tags ${build_tags})" -test.v > $i.suite
- if [ $? -ne 0 ]; then
- echo "suite failed, will exit with error on finish"
- export exitcode=1
- fi
- cat $i.suite
- cp $i.suite $cwd
- done
- exit $exitcode
+ if [ "${UNIT_TEST}" = "true" ]; then
+ export TOOLS_TESTING_UNIT="true"
+ fi;
+ if [ "${run_coverage}" = "true" ]; then
+ export RUN_COVERAGE="true"
+ fi
+ export ON_EVERGREEN="true"
+ export TOOLS_BUILD_TAGS=${build_tags}
+ ./runTests.sh -v
+ exit $?
"run tool integration tests":
command: shell.exec
@@ -547,29 +512,29 @@ functions:
set -v
. ./set_goenv.sh
GOROOT="" set_goenv || exit
-
+ if [ "${KERBEROS_TEST}" = "true" ]; then
+ export TOOLS_TESTING_KERBEROS="true"
+ elif [ "${USE_SSL}" = "true" ]; then
+ export TOOLS_TESTING_SSL="true"
+ export TOOLS_TESTING_INTEGRATION="true"
+ fi;
+ if [ "${AUTH_TEST}" = "true" ]; then
+ export TOOLS_TESTING_AUTH="true"
+ export TOOLS_TESTING_INTEGRATION="true"
+ fi;
+ if [ "${INT_TEST}" = "true" ]; then
+ export TOOLS_TESTING_INTEGRATION="true"
+ fi;
if [ "${create_mongod_users_command}" != "" ]; then
- export AUTH_USERNAME=${auth_username}
- export AUTH_PASSWORD=${auth_password}
+ export TOOLS_TESTING_AUTH_USERNAME=${auth_username}
+ export TOOLS_TESTING_AUTH_PASSWORD=${auth_password}
echo "${create_mongod_users_command}" | ./bin/mongo${extension} ${mongo_args} admin
fi;
+ export ON_EVERGREEN="true"
+ export TOOLS_BUILD_TAGS="${build_tags}"
+ ./runTests.sh -v
+ exit $?
- for i in mongoimport mongoexport mongostat mongorestore mongodump mongofiles; do
- cd $i
- COVERAGE_ARGS=""
- if [ "${run_coverage}" ]; then
- COVERAGE_ARGS="-coverprofile=coverage_$i.out"
- fi;
- go test -ldflags "$(print_ldflags)" $COVERAGE_ARGS -test.v ${args} -tags "$(print_tags ${build_tags})" > $i.suite
- if [ $? -ne 0 ]; then
- echo "suite failed, will exit with error on finish"
- export exitcode=1
- fi
- cat $i.suite
- cp $i.suite ../.
- cd ..
- done
- exit $exitcode
"create coverage reports":
command: shell.exec
@@ -826,7 +791,7 @@ functions:
set -e
./bin/mongo --nodb --eval 'assert.soon(function(x){try{var d = new Mongo("localhost:${mongod_port}"); return true} catch(e){return false}}, "timed out connection")'
- "run go_test" :
+ "run replay go_test" :
- command: shell.exec
type: test
params:
@@ -837,6 +802,10 @@ functions:
set -e
. ./set_goenv.sh
GOROOT="" set_goenv || exit
+
+ if [ "${TESTING_REPLAY}" = "true" ]; then
+ export TOOLS_TESTING_REPLAY="true"
+ fi
${environment_vars} go test -ldflags "$(print_ldflags)" ${additional_args} -v > ${filename}.suite
@@ -893,24 +862,6 @@ timeout:
tasks:
-- name: db
- commands:
- - func: "fetch source"
- - command: expansions.update
- params:
- updates:
- - key: "package"
- value: "common/db"
- - key: "args"
- value: "${args} -test.types=db"
- - func: "download mongod"
- vars:
- mongo_version: "4.0"
- - func: "start mongod"
- - func: "wait for mongod to be ready"
- - func: "setup integration test"
- - func: "run unit test"
-
- name: dist
depends_on:
commands:
@@ -976,16 +927,14 @@ tasks:
commands:
- func: "fetch source"
- command: expansions.update
- params:
- updates:
- - key: "args"
- value: "${args} -test.types=${integration_test_args}"
- func: "download mongod"
vars:
mongo_version: "4.0"
- func: "start mongod"
- func: "wait for mongod to be ready"
- func: "run tool integration tests"
+ vars:
+ INT_TEST: "true"
- name: integration-auth
commands:
@@ -994,8 +943,6 @@ tasks:
- command: expansions.update
params:
updates:
- - key: "args"
- value: "${args} -test.types=${integration_test_args},auth"
- key: "mongod_args"
concat: " --auth"
- key: "auth_username"
@@ -1010,6 +957,9 @@ tasks:
- func: "start mongod"
- func: "wait for mongod to be ready"
- func: "run tool integration tests"
+ vars:
+ INT_TEST: "true"
+ AUTH_TEST: "true"
- name: kerberos
commands:
@@ -1022,6 +972,8 @@ tasks:
value: "${args} -test.types=kerberos"
- func: "setup integration test"
- func: "run tool integration tests"
+ vars:
+ KERBEROS_TEST: "true"
- name: legacy30
depends_on:
@@ -1416,12 +1368,11 @@ tasks:
- name: unit
commands:
- command: expansions.update
- params:
- updates:
- - key: "run_coverage"
- value: "true"
- func: "fetch source"
- func: "run tool unit tests"
+ vars:
+ UNIT_TEST: "true"
+ run_coverage: "true"
- func: "create coverage reports"
- command: expansions.update
params:
@@ -1526,11 +1477,12 @@ tasks:
mongo_version: "4.0"
- func: "start mongod"
- func: "wait for mongod to be ready"
- - func: "run go_test"
+ - func: "run replay go_test"
vars:
filename: playtest
environment_vars: DB_PORT=${mongod_port}
additional_args: github.com/mongodb/mongo-tools/mongoreplay
+ TESTING_REPLAY: true
- name: replay-sharded_test
depends_on:
@@ -1550,11 +1502,12 @@ tasks:
vars:
mongo_version: "4.0"
- func: "create sharded_cluster"
- - func: "run go_test"
+ - func: "run replay go_test"
vars:
filename: sharded
environment_vars: DB_PORT=${mongod_port}
additional_args: github.com/mongodb/mongo-tools/mongoreplay --run "LiveDB"
+ TESTING_REPLAY: true
- name: replay-auth_test
depends_on:
@@ -1580,11 +1533,12 @@ tasks:
- func: "create auth_user"
vars:
mongod_port: ${mongod_port}
- - func: "run go_test"
+ - func: "run replay go_test"
vars:
filename: authtest
environment_vars: AUTH=1 DB_PORT=${mongod_port}
additional_args: github.com/mongodb/mongo-tools/mongoreplay --run "(LiveDB)|(Authed)"
+ TESTING_REPLAY: true
- name: replay-repl_test
depends_on:
@@ -1606,11 +1560,12 @@ tasks:
- func: "create repl_set"
vars:
mongod_port: ${mongod_port}
- - func: "run go_test"
+ - func: "run replay go_test"
vars:
filename: repltest
environment_vars: DB_PORT=${mongod_port}
additional_args: github.com/mongodb/mongo-tools/mongoreplay --run "LiveDB"
+ TESTING_REPLAY: true
- name: replay-replay_test
depends_on:
@@ -1804,6 +1759,8 @@ buildvariants:
resmoke_use_ssl: _ssl
resmoke_args: --jobs $(grep -c ^processor /proc/cpuinfo)
integration_test_args: "integration,ssl"
+ USE_SSL: "true"
+
tasks: *rhel_x86_64_ssl_tasks
- name: rhel62-enterprise
@@ -1924,6 +1881,7 @@ buildvariants:
resmoke_use_ssl: _ssl
resmoke_args: --jobs $(grep -c ^processor /proc/cpuinfo)
integration_test_args: "integration,ssl"
+ USE_SSL: "true"
tasks: *ubuntu_x86_64_ssl_tasks
- name: ubuntu1604-enterprise
@@ -2005,6 +1963,7 @@ buildvariants:
arch: "win32/x86_64"
preproc_gpm: "perl -pi -e 's/\\r\\n/\\n/g' "
integration_test_args: "integration,ssl"
+ USE_SSL: "true"
tasks: *windows_64_ssl_tasks
- name: windows-64-enterprise
@@ -2052,6 +2011,7 @@ buildvariants:
arch: "linux/arm64"
edition: ssl
integration_test_args: integration
+ USE_SSL: "true"
tasks: *ubuntu1604_arm64_ssl_tasks
#######################################
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/multiplexer_roundtrip_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/multiplexer_roundtrip_test.go
index 8e6cabb6608..62bd54eb570 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/multiplexer_roundtrip_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/multiplexer_roundtrip_test.go
@@ -16,6 +16,7 @@ import (
"github.com/mongodb/mongo-tools/common/db"
"github.com/mongodb/mongo-tools/common/intents"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
)
@@ -61,6 +62,7 @@ type testNotifier struct{}
func (n *testNotifier) Notify() {}
func TestBasicMux(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var err error
Convey("with 10000 docs in each of five collections", t, func() {
@@ -123,6 +125,7 @@ func TestBasicMux(t *testing.T) {
}
func TestParallelMux(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("parallel mux/demux over a pipe", t, func() {
readPipe, writePipe, err := os.Pipe()
So(err, ShouldBeNil)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/parser_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/parser_test.go
index 61f4ee4fd07..ef92ac0922f 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/parser_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/parser_test.go
@@ -12,6 +12,7 @@ import (
"io"
"testing"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
)
@@ -52,6 +53,7 @@ var term = []byte{0xFF, 0xFF, 0xFF, 0xFF}
var notTerm = []byte{0xFF, 0xFF, 0xFF, 0xFE}
func TestParsing(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a parser with a simple parser consumer", t, func() {
tc := &testConsumer{}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/prelude_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/prelude_test.go
index 60e9eebeb93..d32e8458eb2 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/prelude_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/archive/prelude_test.go
@@ -11,10 +11,12 @@ import (
. "github.com/smartystreets/goconvey/convey"
// "gopkg.in/mgo.v2/bson"
+ "github.com/mongodb/mongo-tools/common/testtype"
"testing"
)
func TestPrelude(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var err error
Convey("WritePrelude/ReadPrelude roundtrip", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/converter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/converter_test.go
index b3d694befdf..e43ae011f0f 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/converter_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/converter_test.go
@@ -20,7 +20,7 @@ import (
)
func TestObjectIdBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON ObjectId", t, func() {
Convey("that is valid to JSON should produce a json.ObjectId", func() {
@@ -39,7 +39,7 @@ func TestObjectIdBSONToJSON(t *testing.T) {
}
func TestArraysBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting BSON arrays to JSON arrays", t, func() {
Convey("should work for empty arrays", func() {
@@ -94,7 +94,7 @@ func TestArraysBSONToJSON(t *testing.T) {
}
func TestDateBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
timeNow := time.Now()
secs := int64(timeNow.Unix())
@@ -138,7 +138,7 @@ func TestDateBSONToJSON(t *testing.T) {
}
func TestMaxKeyBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON Maxkey to JSON", t, func() {
Convey("should produce a json.MaxKey", func() {
@@ -153,7 +153,7 @@ func TestMaxKeyBSONToJSON(t *testing.T) {
}
func TestMinKeyBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON Maxkey to JSON", t, func() {
Convey("should produce a json.MinKey", func() {
@@ -168,7 +168,7 @@ func TestMinKeyBSONToJSON(t *testing.T) {
}
func Test64BitIntBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON int64 to JSON", t, func() {
Convey("should produce a json.NumberLong", func() {
@@ -184,7 +184,7 @@ func Test64BitIntBSONToJSON(t *testing.T) {
}
func Test32BitIntBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON int32 integer to JSON", t, func() {
Convey("should produce a json.NumberInt", func() {
@@ -200,7 +200,7 @@ func Test32BitIntBSONToJSON(t *testing.T) {
}
func TestRegExBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON Regular Expression (= /decision/gi) to JSON", t, func() {
Convey("should produce a json.RegExp", func() {
@@ -216,7 +216,7 @@ func TestRegExBSONToJSON(t *testing.T) {
}
func TestUndefinedValueBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON Undefined type to JSON", t, func() {
Convey("should produce a json.Undefined", func() {
@@ -231,7 +231,7 @@ func TestUndefinedValueBSONToJSON(t *testing.T) {
}
func TestDBRefBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting BSON DBRef to JSON", t, func() {
Convey("should produce a json.DBRef", func() {
@@ -247,7 +247,7 @@ func TestDBRefBSONToJSON(t *testing.T) {
}
func TestTimestampBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting a BSON Timestamp to JSON", t, func() {
Convey("should produce a json.Timestamp", func() {
@@ -264,7 +264,7 @@ func TestTimestampBSONToJSON(t *testing.T) {
}
func TestBinaryBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting BSON Binary data to JSON", t, func() {
Convey("should produce a json.BinData", func() {
@@ -282,7 +282,7 @@ func TestBinaryBSONToJSON(t *testing.T) {
}
func TestGenericBytesBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting Go bytes to JSON", t, func() {
Convey("should produce a json.BinData with Type=0x00 (Generic)", func() {
@@ -299,7 +299,7 @@ func TestGenericBytesBSONToJSON(t *testing.T) {
}
func TestUnknownBSONTypeToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting an unknown BSON type to JSON", t, func() {
Convey("should produce an error", func() {
@@ -310,7 +310,7 @@ func TestUnknownBSONTypeToJSON(t *testing.T) {
}
func TestDBPointerBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting BSON DBPointer to JSON", t, func() {
Convey("should produce a json.DBPointer", func() {
@@ -326,7 +326,7 @@ func TestDBPointerBSONToJSON(t *testing.T) {
}
func TestJSCodeBSONToJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Converting BSON Javascript code to JSON", t, func() {
Convey("should produce a json.Javascript", func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/date_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/date_test.go
index 5c8200b9cc1..f929c35c12b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/date_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/date_test.go
@@ -9,12 +9,14 @@ package bsonutil
import (
"fmt"
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
"time"
)
func TestDateValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with Date values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/marshal_d_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/marshal_d_test.go
index 0ee5e02d61c..9961e488b18 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/marshal_d_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/marshal_d_test.go
@@ -8,6 +8,7 @@ package bsonutil
import (
"encoding/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"strings"
@@ -15,6 +16,7 @@ import (
)
func TestMarshalDMarshalJSON(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a valid bson.D", t, func() {
testD := bson.D{
@@ -82,6 +84,7 @@ func TestMarshalDMarshalJSON(t *testing.T) {
}
func TestFindValueByKey(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a bson.D document and a specific key", t, func() {
subDocument := &bson.D{
bson.DocElem{Name: "field4", Value: "c"},
@@ -110,6 +113,7 @@ func TestFindValueByKey(t *testing.T) {
}
func TestEscapedKey(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a bson.D document with a key that requires escaping", t, func() {
document := bson.D{
bson.DocElem{Name: `foo"bar`, Value: "a"},
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/maxkey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/maxkey_test.go
index 89eeed0af9a..f64df05ad4d 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/maxkey_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/maxkey_test.go
@@ -8,12 +8,14 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestMaxKeyValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with MaxKey values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/minkey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/minkey_test.go
index 987576f54b1..22d6e3382ba 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/minkey_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/minkey_test.go
@@ -8,12 +8,14 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestMinKeyValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with MinKey values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberint_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberint_test.go
index 7ecee5b825e..78050471fdd 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberint_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberint_test.go
@@ -8,11 +8,13 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNumberIntValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with NumberInt values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberlong_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberlong_test.go
index 97a1e8afe5e..9be09850f7c 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberlong_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/numberlong_test.go
@@ -8,11 +8,13 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNumberLongValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with NumberLong values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/objectid_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/objectid_test.go
index 1adec240247..10a88ab9f8b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/objectid_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/objectid_test.go
@@ -8,12 +8,14 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestObjectIdValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with ObjectId values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/regexp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/regexp_test.go
index b4060158285..efa0891d9e2 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/regexp_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/regexp_test.go
@@ -8,12 +8,14 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestRegExpValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with RegExp values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/timestamp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/timestamp_test.go
index d1d7de62777..9310e05ded0 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/timestamp_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/timestamp_test.go
@@ -8,12 +8,14 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestTimestampValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with Timestamp values", t, func() {
testTS := bson.MongoTimestamp(123456<<32 | 55)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/undefined_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/undefined_test.go
index 8aee1a61488..02acc63188e 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/undefined_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/bsonutil/undefined_test.go
@@ -8,12 +8,14 @@ package bsonutil
import (
"github.com/mongodb/mongo-tools/common/json"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestUndefinedValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When converting JSON with undefined values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/bson_stream_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/bson_stream_test.go
index 55f485774ff..e26f6f3aeb0 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/bson_stream_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/bson_stream_test.go
@@ -12,9 +12,12 @@ import (
"gopkg.in/mgo.v2/bson"
"io/ioutil"
"testing"
+
+ "github.com/mongodb/mongo-tools/common/testtype"
)
func TestBufferlessBSONSource(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
var testValues = []bson.M{
{"_": bson.Binary{Kind: 0x80, Data: []byte("apples")}},
{"_": bson.Binary{Kind: 0x80, Data: []byte("bananas")}},
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/buffered_bulk_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/buffered_bulk_test.go
index 0df00d28ecd..9d7b98cfcd6 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/buffered_bulk_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/buffered_bulk_test.go
@@ -7,6 +7,7 @@
package db
import (
+ "os"
"testing"
"github.com/mongodb/mongo-tools/common/options"
@@ -15,18 +16,55 @@ import (
"gopkg.in/mgo.v2/bson"
)
+// Copied this var block, GetSSLOptions, and GetAuthOptions from common/testutil/auth.go to avoid circular dependency
+var (
+ UserAdmin = "uAdmin"
+ UserAdminPassword = "password"
+ CreatedUserNameEnv = "TOOLS_TESTING_AUTH_USERNAME"
+ CreatedUserPasswordEnv = "TOOLS_TESTING_AUTH_PASSWORD"
+)
+
+func DBGetSSLOptions() options.SSL {
+ if testtype.HasTestType(testtype.SSLTestType) {
+ return options.SSL{
+ UseSSL: true,
+ SSLCAFile: "./openssl/testdata/ca.pem",
+ SSLPEMKeyFile: "./openssl/testdata/server.pem",
+ }
+ }
+
+ return options.SSL{
+ UseSSL: false,
+ }
+}
+
+func DBGetAuthOptions() options.Auth {
+ if testtype.HasTestType(testtype.AuthTestType) {
+ return options.Auth{
+ Username: os.Getenv(CreatedUserNameEnv),
+ Password: os.Getenv(CreatedUserPasswordEnv),
+ Source: "admin",
+ }
+ }
+
+ return options.Auth{}
+}
+
func TestBufferedBulkInserterInserts(t *testing.T) {
var bufBulk *BufferedBulkInserter
- testtype.VerifyTestType(t, "db")
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
+
+ auth := DBGetAuthOptions()
+ ssl := DBGetSSLOptions()
Convey("With a valid session", t, func() {
opts := options.ToolOptions{
Connection: &options.Connection{
Port: DefaultTestPort,
},
- SSL: &options.SSL{},
- Auth: &options.Auth{},
+ SSL: &ssl,
+ Auth: &auth,
}
provider, err := NewSessionProvider(opts)
So(provider, ShouldNotBeNil)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_sasl_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_sasl_test.go
index dcde56fea08..00c6f640f4a 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_sasl_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_sasl_test.go
@@ -28,7 +28,7 @@ var (
)
func TestKerberosAuthMechanism(t *testing.T) {
- testtype.VerifyTestType(t, testtype.KerberosTestType)
+ testtype.SkipUnlessTestType(t, testtype.KerberosTestType)
Convey("should be able to successfully connect", t, func() {
connector := &db.VanillaDBConnector{}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
index 48ef3611587..18eb9b4b64f 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/connector_test.go
@@ -15,12 +15,15 @@ import (
"github.com/mongodb/mongo-tools/common/testtype"
"github.com/mongodb/mongo-tools/common/testutil"
. "github.com/smartystreets/goconvey/convey"
- "gopkg.in/mgo.v2"
)
func TestVanillaDBConnector(t *testing.T) {
- testtype.VerifyTestType(t, "db")
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
+ // VanillaDBConnector can't connect if SSL or Auth are enabled
+ if testtype.HasTestType(testtype.SSLTestType) || testtype.HasTestType(testtype.AuthTestType) {
+ t.SkipNow()
+ }
Convey("With a vanilla db connector", t, func() {
@@ -72,22 +75,17 @@ func TestVanillaDBConnector(t *testing.T) {
}
func TestVanillaDBConnectorWithAuth(t *testing.T) {
- testtype.VerifyTestType(t, "auth")
- session, err := mgo.Dial("localhost:33333")
- if err != nil {
- t.Fatalf("error dialing server: %v", err)
+ testtype.SkipUnlessTestType(t, testtype.AuthTestType)
+ // VanillaDBConnector can't connect if SSL is enabled
+ if testtype.HasTestType(testtype.SSLTestType) {
+ t.SkipNow()
}
- err = testutil.CreateUserAdmin(session)
- So(err, ShouldBeNil)
- err = testutil.CreateUserWithRole(session, "cAdmin", "password",
- mgo.RoleClusterAdmin, true)
- So(err, ShouldBeNil)
- session.Close()
-
Convey("With a vanilla db connector and a mongod running with"+
" auth", t, func() {
+ auth := testutil.GetAuthOptions()
+
var connector *db.VanillaDBConnector
Convey("connecting without authentication should not be able"+
@@ -123,10 +121,7 @@ func TestVanillaDBConnectorWithAuth(t *testing.T) {
Host: "localhost",
Port: db.DefaultTestPort,
},
- Auth: &options.Auth{
- Username: "cAdmin",
- Password: "password",
- },
+ Auth: &auth,
}
So(connector.Configure(opts), ShouldBeNil)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/db_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/db_test.go
index 44d60845740..a922bbdff44 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/db_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/db_test.go
@@ -18,7 +18,9 @@ import (
func TestNewSessionProvider(t *testing.T) {
- testtype.VerifyTestType(t, "db")
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
+ auth := DBGetAuthOptions()
+ ssl := DBGetSSLOptions()
Convey("When initializing a session provider", t, func() {
@@ -28,13 +30,15 @@ func TestNewSessionProvider(t *testing.T) {
Connection: &options.Connection{
Port: DefaultTestPort,
},
- SSL: &options.SSL{},
- Auth: &options.Auth{},
+ SSL: &ssl,
+ Auth: &auth,
}
provider, err := NewSessionProvider(opts)
So(err, ShouldBeNil)
- So(reflect.TypeOf(provider.connector), ShouldEqual,
- reflect.TypeOf(&VanillaDBConnector{}))
+ if !testtype.HasTestType(testtype.SSLTestType) {
+ So(reflect.TypeOf(provider.connector), ShouldEqual,
+ reflect.TypeOf(&VanillaDBConnector{}))
+ }
Convey("and should be closeable", func() {
provider.Close()
@@ -48,8 +52,8 @@ func TestNewSessionProvider(t *testing.T) {
Connection: &options.Connection{
Port: DefaultTestPort,
},
- SSL: &options.SSL{},
- Auth: &options.Auth{},
+ SSL: &ssl,
+ Auth: &auth,
}
provider, err := NewSessionProvider(opts)
So(err, ShouldBeNil)
@@ -74,15 +78,17 @@ func TestNewSessionProvider(t *testing.T) {
func TestGetIndexes(t *testing.T) {
- testtype.VerifyTestType(t, "db")
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
Convey("With a valid session", t, func() {
+ auth := DBGetAuthOptions()
+ ssl := DBGetSSLOptions()
opts := options.ToolOptions{
Connection: &options.Connection{
Port: DefaultTestPort,
},
- SSL: &options.SSL{},
- Auth: &options.Auth{},
+ SSL: &ssl,
+ Auth: &auth,
}
provider, err := NewSessionProvider(opts)
So(err, ShouldBeNil)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/namespaces_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/namespaces_test.go
index 15ccb02f3ff..324ef59f151 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/namespaces_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/namespaces_test.go
@@ -10,6 +10,7 @@ import (
"fmt"
"testing"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
@@ -22,6 +23,7 @@ type stripDBFromNamespaceTestCase struct {
}
func TestStripDBFromNamespace(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When testing StripDBFromNamespace with cases", t, func() {
testCases := []stripDBFromNamespaceTestCase{
{
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/tlsgo/config_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/tlsgo/config_test.go
index 9fa3585c5e2..be46a87dcf7 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/tlsgo/config_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/tlsgo/config_test.go
@@ -8,7 +8,7 @@ import (
)
func TestAddClientCert(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
cases := []struct {
Path string
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/write_concern_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/write_concern_test.go
index 94573bb2005..e9783525eeb 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/write_concern_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/db/write_concern_test.go
@@ -8,6 +8,7 @@ package db
import (
"github.com/mongodb/mongo-tools/common/connstring"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"fmt"
@@ -16,6 +17,7 @@ import (
)
func TestBuildWriteConcern(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When building write concern object", t, func() {
Convey("and given a write concern string value, and a boolean indicating if the "+
"write concern is to be used on a replica set, on calling BuildWriteConcern...", func() {
@@ -100,6 +102,7 @@ func TestBuildWriteConcern(t *testing.T) {
}
func TestConstructWCObject(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a write concern string value, on calling constructWCObject...", t, func() {
Convey("non-JSON string values should be assigned to the 'WMode' "+
@@ -213,6 +216,7 @@ func TestConstructWCObject(t *testing.T) {
}
func TestConstructSafetyFromConnString(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a parsed &connstring, on calling constructSafetyFromConnString...", t, func() {
Convey("non string values should be assigned to the 'WMode' "+
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/failpoint/failpoint_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/failpoint/failpoint_test.go
index 88f95fa3485..713b0172717 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/failpoint/failpoint_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/failpoint/failpoint_test.go
@@ -16,7 +16,7 @@ import (
)
func TestFailpointParsing(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With test args", t, func() {
args := "foo=bar,baz,biz=,=a"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_prioritizer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_prioritizer_test.go
index 7e79e72b927..4ab94bc7906 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_prioritizer_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_prioritizer_test.go
@@ -17,7 +17,7 @@ import (
func TestLegacyPrioritizer(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a legacyPrioritizer initialized with an ordered intent list", t, func() {
testList := []*Intent{
@@ -43,7 +43,7 @@ func TestLegacyPrioritizer(t *testing.T) {
func TestBasicDBHeapBehavior(t *testing.T) {
var dbheap heap.Interface
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With an empty dbHeap", t, func() {
dbheap = &DBHeap{}
@@ -93,7 +93,7 @@ func TestBasicDBHeapBehavior(t *testing.T) {
func TestDBCounterCollectionSorting(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a dbCounter and an unordered collection of intents", t, func() {
dbc := &dbCounter{
@@ -120,7 +120,7 @@ func TestDBCounterCollectionSorting(t *testing.T) {
func TestBySizeAndView(t *testing.T) {
var prioritizer IntentPrioritizer
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a prioritizer initialized with on a set of intents", t, func() {
intents := []*Intent{
@@ -151,7 +151,7 @@ func TestBySizeAndView(t *testing.T) {
func TestSimulatedMultiDBJob(t *testing.T) {
var prioritizer IntentPrioritizer
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a prioritizer initialized with a set of intents", t, func() {
intents := []*Intent{
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_test.go
index e13b844969f..693994d1394 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/intents/intent_test.go
@@ -16,7 +16,7 @@ import (
func TestIntentManager(t *testing.T) {
var manager *Manager
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With an empty IntentManager", t, func() {
manager = NewIntentManager()
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bench_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bench_test.go
index 9ed3c014078..ba34a4015fc 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bench_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bench_test.go
@@ -18,6 +18,7 @@ package json
import (
"bytes"
"compress/gzip"
+ "github.com/mongodb/mongo-tools/common/testtype"
"io/ioutil"
"os"
"testing"
@@ -81,6 +82,7 @@ func codeInit() {
}
func BenchmarkCodeEncoder(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
if codeJSON == nil {
b.StopTimer()
codeInit()
@@ -96,6 +98,7 @@ func BenchmarkCodeEncoder(b *testing.B) {
}
func BenchmarkCodeMarshal(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
if codeJSON == nil {
b.StopTimer()
codeInit()
@@ -110,6 +113,7 @@ func BenchmarkCodeMarshal(b *testing.B) {
}
func BenchmarkCodeDecoder(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
if codeJSON == nil {
b.StopTimer()
codeInit()
@@ -132,6 +136,7 @@ func BenchmarkCodeDecoder(b *testing.B) {
}
func BenchmarkCodeUnmarshal(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
if codeJSON == nil {
b.StopTimer()
codeInit()
@@ -147,6 +152,7 @@ func BenchmarkCodeUnmarshal(b *testing.B) {
}
func BenchmarkCodeUnmarshalReuse(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
if codeJSON == nil {
b.StopTimer()
codeInit()
@@ -161,6 +167,7 @@ func BenchmarkCodeUnmarshalReuse(b *testing.B) {
}
func BenchmarkUnmarshalString(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
data := []byte(`"hello, world"`)
var s string
@@ -172,6 +179,7 @@ func BenchmarkUnmarshalString(b *testing.B) {
}
func BenchmarkUnmarshalFloat64(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
var f float64
data := []byte(`3.14`)
@@ -183,6 +191,7 @@ func BenchmarkUnmarshalFloat64(b *testing.B) {
}
func BenchmarkUnmarshalInt64(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
var x int64
data := []byte(`3`)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bindata_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bindata_test.go
index 7f5ea704f3e..cf38992217a 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bindata_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/bindata_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestBinDataValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with BinData values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/boolean_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/boolean_test.go
index 6b434eeafb7..6e41b09918d 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/boolean_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/boolean_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestBooleanValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with Boolean values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/date_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/date_test.go
index d6e54d4e17b..79d9a84994c 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/date_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/date_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestDateValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with Date values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbpointer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbpointer_test.go
index 73bafbdc869..130321ddf4e 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbpointer_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbpointer_test.go
@@ -8,12 +8,14 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestDBPointerValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Unmarshalling JSON with DBPointer values", t, func() {
key := "key"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbref_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbref_test.go
index b9b533706c1..c27522f6ec0 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbref_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/dbref_test.go
@@ -8,13 +8,14 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"math"
"testing"
)
func TestDBRefValue(t *testing.T) {
-
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with DBRef values", t, func() {
Convey("works for a single key", func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_d_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_d_test.go
index 2f867f99eeb..d08d9c2ef9f 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_d_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_d_test.go
@@ -8,12 +8,14 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"testing"
)
func TestDecodeBsonD(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON into a bson.D", t, func() {
Convey("a document should be stored with keys in the same order", func() {
data := `{"a":1, "b":2, "c":3, "d":4, "e":5, "f":6}`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_test.go
index 107321d1f5e..330792c0e3f 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/decode_test.go
@@ -13,6 +13,7 @@ import (
"bytes"
"encoding"
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
"image"
"reflect"
"strings"
@@ -422,6 +423,7 @@ var unmarshalTests = []unmarshalTest{
}
func TestMarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
b, err := Marshal(allValue)
if err != nil {
t.Fatalf("Marshal allValue: %v", err)
@@ -455,6 +457,7 @@ var badUTF8 = []struct {
}
func TestMarshalBadUTF8(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for _, tt := range badUTF8 {
b, err := Marshal(tt.in)
if string(b) != tt.out || err != nil {
@@ -464,6 +467,7 @@ func TestMarshalBadUTF8(t *testing.T) {
}
func TestMarshalNumberZeroVal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var n Number
out, err := Marshal(n)
if err != nil {
@@ -476,6 +480,7 @@ func TestMarshalNumberZeroVal(t *testing.T) {
}
func TestMarshalEmbeds(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
top := &Top{
Level0: 1,
Embed0: Embed0{
@@ -515,6 +520,7 @@ func TestMarshalEmbeds(t *testing.T) {
}
func TestUnmarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for i, tt := range unmarshalTests {
var scan scanner
in := []byte(tt.in)
@@ -573,6 +579,7 @@ func TestUnmarshal(t *testing.T) {
}
func TestUnmarshalMarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
initBig()
var v interface{}
if err := Unmarshal(jsonBig, &v); err != nil {
@@ -603,6 +610,7 @@ var numberTests = []struct {
// Independent of Decode, basic coverage of the accessors in Number
func TestNumberAccessors(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for _, tt := range numberTests {
n := Number(tt.in)
if s := n.String(); s != tt.in {
@@ -622,6 +630,7 @@ func TestNumberAccessors(t *testing.T) {
}
func TestLargeByteSlice(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
s0 := make([]byte, 2000)
for i := range s0 {
s0[i] = byte(i)
@@ -645,6 +654,7 @@ type Xint struct {
}
func TestUnmarshalInterface(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var xint Xint
var i interface{} = &xint
if err := Unmarshal([]byte(`{"X":1}`), &i); err != nil {
@@ -656,6 +666,7 @@ func TestUnmarshalInterface(t *testing.T) {
}
func TestUnmarshalPtrPtr(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var xint Xint
pxint := &xint
if err := Unmarshal([]byte(`{"X":1}`), &pxint); err != nil {
@@ -667,6 +678,7 @@ func TestUnmarshalPtrPtr(t *testing.T) {
}
func TestEscape(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
const input = `"foobar"<html>` + " [\u2028 \u2029]"
const expected = `"\"foobar\"\u003chtml\u003e [\u2028 \u2029]"`
b, err := Marshal(input)
@@ -696,6 +708,7 @@ var wrongStringTests = []wrongStringTest{
// If people misuse the ,string modifier, the error message should be
// helpful, telling the user that they're doing it wrong.
func TestErrorMessageFromMisusedString(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for n, tt := range wrongStringTests {
r := strings.NewReader(tt.in)
var s WrongString
@@ -1029,6 +1042,7 @@ var pallValueIndent = `{
var pallValueCompact = strings.Map(noSpace, pallValueIndent)
func TestRefUnmarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
type S struct {
// Ref is defined in encode_test.go.
R0 Ref
@@ -1057,6 +1071,7 @@ func TestRefUnmarshal(t *testing.T) {
// Test that the empty string doesn't panic decoding when ,string is specified
// Issue 3450
func TestEmptyString(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
type T2 struct {
Number1 int `json:",string"`
Number2 int `json:",string"`
@@ -1076,6 +1091,7 @@ func TestEmptyString(t *testing.T) {
// Test that the returned error is non-nil when trying to unmarshal null string into int, for successive ,string option
// Issue 7046
func TestNullString(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
type T struct {
A int `json:",string"`
B int `json:",string"`
@@ -1121,6 +1137,7 @@ var interfaceSetTests = []struct {
}
func TestInterfaceSet(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for _, tt := range interfaceSetTests {
b := struct{ X interface{} }{tt.pre}
blob := `{"X":` + tt.json + `}`
@@ -1137,6 +1154,7 @@ func TestInterfaceSet(t *testing.T) {
// JSON null values should be ignored for primitives and string values instead of resulting in an error.
// Issue 2540
func TestUnmarshalNulls(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
jsonData := []byte(`{
"Bool" : null,
"Int" : null,
@@ -1182,6 +1200,7 @@ func TestUnmarshalNulls(t *testing.T) {
}
func TestStringKind(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
type stringKind string
var m1, m2 map[stringKind]int
@@ -1218,6 +1237,7 @@ var decodeTypeErrorTests = []struct {
}
func TestUnmarshalTypeError(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for _, item := range decodeTypeErrorTests {
err := Unmarshal([]byte(item.src), item.dest)
if _, ok := err.(*UnmarshalTypeError); !ok {
@@ -1239,6 +1259,7 @@ var unmarshalSyntaxTests = []string{
}
func TestUnmarshalSyntax(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var x interface{}
for _, src := range unmarshalSyntaxTests {
err := Unmarshal([]byte(src), &x)
@@ -1257,6 +1278,7 @@ type unexportedFields struct {
}
func TestUnmarshalUnexported(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
input := `{"Name": "Bob", "m": {"x": 123}, "m2": {"y": 456}, "abcd": {"z": 789}}`
want := &unexportedFields{Name: "Bob"}
@@ -1287,6 +1309,7 @@ func (t *Time3339) UnmarshalJSON(b []byte) error {
}
func TestUnmarshalJSONLiteralError(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var t3 Time3339
err := Unmarshal([]byte(`"0000-00-00T00:00:00Z"`), &t3)
if err == nil {
@@ -1301,6 +1324,7 @@ func TestUnmarshalJSONLiteralError(t *testing.T) {
// "data changing underfoot" error.
// Issue 3717
func TestSkipArrayObjects(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
json := `[{}]`
var dest [0]interface{}
@@ -1313,6 +1337,7 @@ func TestSkipArrayObjects(t *testing.T) {
// Test semantics of pre-filled struct fields and pre-filled map fields.
// Issue 4900.
func TestPrefilled(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
ptrToMap := func(m map[string]interface{}) *map[string]interface{} { return &m }
// Values here change, cannot reuse table across runs.
@@ -1355,6 +1380,7 @@ var invalidUnmarshalTests = []struct {
}
func TestInvalidUnmarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
buf := []byte(`{"a":"1"}`)
for _, tt := range invalidUnmarshalTests {
err := Unmarshal(buf, tt.v)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/encode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/encode_test.go
index a0c0df8aa5e..e821c4583bb 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/encode_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/encode_test.go
@@ -15,6 +15,8 @@ import (
"reflect"
"testing"
"unicode"
+
+ "github.com/mongodb/mongo-tools/common/testtype"
)
type Optionals struct {
@@ -57,6 +59,7 @@ var optionalsExpected = `{
}`
func TestOmitEmpty(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var o Optionals
o.Sw = "something"
o.Mr = map[string]interface{}{}
@@ -84,6 +87,7 @@ var stringTagExpected = `{
}`
func TestStringTag(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var s StringTag
s.BoolStr = true
s.IntStr = 42
@@ -113,6 +117,7 @@ type renamedByteSlice []byte
type renamedRenamedByteSlice []renamedByte
func TestEncodeRenamedByteSlice(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
s := renamedByteSlice("abc")
result, err := Marshal(s)
if err != nil {
@@ -133,6 +138,7 @@ func TestEncodeRenamedByteSlice(t *testing.T) {
}
func TestFloatSpecialValues(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
_, err := Marshal(math.NaN())
if err != nil {
t.Errorf("Got error for NaN: %v", err)
@@ -188,6 +194,7 @@ func (ValText) MarshalText() ([]byte, error) {
}
func TestRefValMarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var s = struct {
R0 Ref
R1 *Ref
@@ -232,6 +239,7 @@ func (CText) MarshalText() ([]byte, error) {
}
func TestMarshalerEscaping(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var c C1
want := `"\u003c\u0026\u003e"`
b, err := Marshal(c)
@@ -260,6 +268,7 @@ type MyStruct struct {
}
func TestAnonymousNonstruct(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var i IntType = 11
a := MyStruct{i}
const want = `{"IntType":11}`
@@ -295,6 +304,7 @@ type BugX struct {
// Issue 5245.
func TestEmbeddedBug(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
v := BugB{
BugA{"A"},
"B",
@@ -335,6 +345,7 @@ type BugY struct {
// Test that a field with a tag dominates untagged fields.
func TestTaggedFieldDominates(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
v := BugY{
BugA{"BugA"},
BugD{"BugD"},
@@ -358,6 +369,7 @@ type BugZ struct {
}
func TestDuplicatedFieldDisappears(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
v := BugZ{
BugA{"BugA"},
BugC{"BugC"},
@@ -378,6 +390,7 @@ func TestDuplicatedFieldDisappears(t *testing.T) {
}
func TestStringBytes(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
// Test that encodeState.stringBytes and encodeState.string use the same encoding.
es := &encodeState{}
var r []rune
@@ -424,6 +437,7 @@ func TestStringBytes(t *testing.T) {
}
func TestIssue6458(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
type Foo struct {
M RawMessage
}
@@ -448,6 +462,7 @@ func TestIssue6458(t *testing.T) {
}
func TestHTMLEscape(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var b, want bytes.Buffer
m := `{"M":"<html>foo &` + "\xe2\x80\xa8 \xe2\x80\xa9" + `</html>"}`
want.Write([]byte(`{"M":"\u003chtml\u003efoo \u0026\u2028 \u2029\u003c/html\u003e"}`))
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/float_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/float_test.go
index 062b330a1e1..787a2b7e137 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/float_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/float_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNumberFloatValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshaling JSON with float values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/fold_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/fold_test.go
index 1c10dbcf64b..9024ee08c80 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/fold_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/fold_test.go
@@ -11,6 +11,7 @@ package json
import (
"bytes"
+ "github.com/mongodb/mongo-tools/common/testtype"
"strings"
"testing"
"unicode/utf8"
@@ -45,6 +46,7 @@ var foldTests = []struct {
}
func TestFold(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for i, tt := range foldTests {
if got := tt.fn([]byte(tt.s), []byte(tt.t)); got != tt.want {
t.Errorf("%d. %q, %q = %v; want %v", i, tt.s, tt.t, got, tt.want)
@@ -57,6 +59,7 @@ func TestFold(t *testing.T) {
}
func TestFoldAgainstUnicode(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
const bufSize = 5
buf1 := make([]byte, 0, bufSize)
buf2 := make([]byte, 0, bufSize)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/frac_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/frac_test.go
index ed8daae6a08..1a7a7b72bc4 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/frac_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/frac_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestFractionalNumber(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with fractional numeric values "+
"without a leading zero", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/hex_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/hex_test.go
index 0f6ed7686f3..7ea44bc351c 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/hex_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/hex_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestHexadecimalNumber(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
value := "0x123"
intValue := 0x123
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/infinity_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/infinity_test.go
index 63a14d3b633..e01e7f621f9 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/infinity_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/infinity_test.go
@@ -8,12 +8,14 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"math"
"testing"
)
func TestInfinityValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with Infinity values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/iso_date_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/iso_date_test.go
index a61c4ce9225..95238dadfc6 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/iso_date_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/iso_date_test.go
@@ -7,124 +7,121 @@
package json
import (
- "fmt"
- . "github.com/smartystreets/goconvey/convey"
- "testing"
+ "fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
+ . "github.com/smartystreets/goconvey/convey"
+ "testing"
)
func TestISODateValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
- Convey("When unmarshalling JSON with ISODate values", t, func() {
+ Convey("When unmarshalling JSON with ISODate values", t, func() {
- Convey("works for a single key", func() {
- var jsonMap map[string]interface{}
+ Convey("works for a single key", func() {
+ var jsonMap map[string]interface{}
- key := "key"
- value := "ISODate(\"2006-01-02T15:04-0700\")"
- data := fmt.Sprintf(`{"%v":%v}`, key, value)
+ key := "key"
+ value := "ISODate(\"2006-01-02T15:04-0700\")"
+ data := fmt.Sprintf(`{"%v":%v}`, key, value)
- err := Unmarshal([]byte(data), &jsonMap)
- So(err, ShouldBeNil)
+ err := Unmarshal([]byte(data), &jsonMap)
+ So(err, ShouldBeNil)
- jsonValue, ok := jsonMap[key].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04-0700"))
- })
+ jsonValue, ok := jsonMap[key].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04-0700"))
+ })
- Convey("works for multiple keys", func() {
- var jsonMap map[string]interface{}
+ Convey("works for multiple keys", func() {
+ var jsonMap map[string]interface{}
- key1, key2, key3 := "key1", "key2", "key3"
- value1, value2, value3 := "ISODate(\"2006-01-02T15:04Z0700\")", "ISODate(\"2013-01-02T15:04Z0700\")", "ISODate(\"2014-02-02T15:04Z0700\")"
- data := fmt.Sprintf(`{"%v":%v,"%v":%v,"%v":%v}`,
- key1, value1, key2, value2, key3, value3)
+ key1, key2, key3 := "key1", "key2", "key3"
+ value1, value2, value3 := "ISODate(\"2006-01-02T15:04Z0700\")", "ISODate(\"2013-01-02T15:04Z0700\")", "ISODate(\"2014-02-02T15:04Z0700\")"
+ data := fmt.Sprintf(`{"%v":%v,"%v":%v,"%v":%v}`,
+ key1, value1, key2, value2, key3, value3)
- err := Unmarshal([]byte(data), &jsonMap)
- So(err, ShouldBeNil)
+ err := Unmarshal([]byte(data), &jsonMap)
+ So(err, ShouldBeNil)
- jsonValue1, ok := jsonMap[key1].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue1, ShouldEqual, ISODate("2006-01-02T15:04Z0700"))
+ jsonValue1, ok := jsonMap[key1].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue1, ShouldEqual, ISODate("2006-01-02T15:04Z0700"))
- jsonValue2, ok := jsonMap[key2].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue2, ShouldEqual, ISODate("2013-01-02T15:04Z0700"))
+ jsonValue2, ok := jsonMap[key2].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue2, ShouldEqual, ISODate("2013-01-02T15:04Z0700"))
- jsonValue3, ok := jsonMap[key3].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue3, ShouldEqual, ISODate("2014-02-02T15:04Z0700"))
- })
+ jsonValue3, ok := jsonMap[key3].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue3, ShouldEqual, ISODate("2014-02-02T15:04Z0700"))
+ })
- Convey("works in an array", func() {
- var jsonMap map[string]interface{}
+ Convey("works in an array", func() {
+ var jsonMap map[string]interface{}
- key := "key"
- value := "ISODate(\"2006-01-02T15:04-0700\")"
- data := fmt.Sprintf(`{"%v":[%v,%v,%v]}`,
- key, value, value, value)
+ key := "key"
+ value := "ISODate(\"2006-01-02T15:04-0700\")"
+ data := fmt.Sprintf(`{"%v":[%v,%v,%v]}`,
+ key, value, value, value)
- err := Unmarshal([]byte(data), &jsonMap)
- So(err, ShouldBeNil)
+ err := Unmarshal([]byte(data), &jsonMap)
+ So(err, ShouldBeNil)
- jsonArray, ok := jsonMap[key].([]interface{})
- So(ok, ShouldBeTrue)
+ jsonArray, ok := jsonMap[key].([]interface{})
+ So(ok, ShouldBeTrue)
- for _, _jsonValue := range jsonArray {
- jsonValue, ok := _jsonValue.(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04-0700"))
- }
- })
+ for _, _jsonValue := range jsonArray {
+ jsonValue, ok := _jsonValue.(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04-0700"))
+ }
+ })
- Convey("will take valid format 2006-01-02T15:04:05.000-0700", func() {
- var jsonMap map[string]interface{}
+ Convey("will take valid format 2006-01-02T15:04:05.000-0700", func() {
+ var jsonMap map[string]interface{}
- key := "key"
- value := "ISODate(\"2006-01-02T15:04:05.000-0700\")"
- data := fmt.Sprintf(`{"%v":%v}`, key, value)
+ key := "key"
+ value := "ISODate(\"2006-01-02T15:04:05.000-0700\")"
+ data := fmt.Sprintf(`{"%v":%v}`, key, value)
- err := Unmarshal([]byte(data), &jsonMap)
- So(err, ShouldBeNil)
+ err := Unmarshal([]byte(data), &jsonMap)
+ So(err, ShouldBeNil)
- jsonValue, ok := jsonMap[key].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04:05.000-0700"))
- })
+ jsonValue, ok := jsonMap[key].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04:05.000-0700"))
+ })
+ Convey("will take valid format 2006-01-02T15:04:05", func() {
+ var jsonMap map[string]interface{}
- Convey("will take valid format 2006-01-02T15:04:05", func() {
- var jsonMap map[string]interface{}
+ key := "key"
+ value := "ISODate(\"2014-01-02T15:04:05Z\")"
+ data := fmt.Sprintf(`{"%v":%v}`, key, value)
- key := "key"
- value := "ISODate(\"2014-01-02T15:04:05Z\")"
- data := fmt.Sprintf(`{"%v":%v}`, key, value)
+ err := Unmarshal([]byte(data), &jsonMap)
+ So(err, ShouldBeNil)
- err := Unmarshal([]byte(data), &jsonMap)
- So(err, ShouldBeNil)
+ jsonValue, ok := jsonMap[key].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue, ShouldEqual, ISODate("2014-01-02T15:04:05Z"))
+ })
- jsonValue, ok := jsonMap[key].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue, ShouldEqual, ISODate("2014-01-02T15:04:05Z"))
- })
+ Convey("will take valid format 2006-01-02T15:04-0700", func() {
+ var jsonMap map[string]interface{}
+ key := "key"
+ value := "ISODate(\"2006-01-02T15:04-0700\")"
+ data := fmt.Sprintf(`{"%v":%v}`, key, value)
- Convey("will take valid format 2006-01-02T15:04-0700", func() {
- var jsonMap map[string]interface{}
+ err := Unmarshal([]byte(data), &jsonMap)
+ So(err, ShouldBeNil)
- key := "key"
- value := "ISODate(\"2006-01-02T15:04-0700\")"
- data := fmt.Sprintf(`{"%v":%v}`, key, value)
+ jsonValue, ok := jsonMap[key].(ISODate)
+ So(ok, ShouldBeTrue)
+ So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04-0700"))
+ })
- err := Unmarshal([]byte(data), &jsonMap)
- So(err, ShouldBeNil)
-
- jsonValue, ok := jsonMap[key].(ISODate)
- So(ok, ShouldBeTrue)
- So(jsonValue, ShouldEqual, ISODate("2006-01-02T15:04-0700"))
- })
-
-
-
- })
+ })
}
-
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/maxkey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/maxkey_test.go
index 0934a75c0df..6914ba420d3 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/maxkey_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/maxkey_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestMaxKeyValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
key := "key"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/minkey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/minkey_test.go
index d83325b67af..3fb469ea397 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/minkey_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/minkey_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestMinKeyValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
key := "key"
Convey("Unmarshalling JSON with MinKey values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/nan_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/nan_test.go
index df26075a532..9cd4a920a11 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/nan_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/nan_test.go
@@ -8,12 +8,14 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"math"
"testing"
)
func TestNaNValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with NaN values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/new_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/new_test.go
index cbb9a132289..936327b1dc4 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/new_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/new_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNewKeyword(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON using the new keyword", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/number_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/number_test.go
index 99fc92f745e..3edadd93745 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/number_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/number_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNumberIntValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with NumberInt values", t, func() {
@@ -105,6 +107,7 @@ func TestNumberIntValue(t *testing.T) {
}
func TestNumberLongValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with NumberLong values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/objectid_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/objectid_test.go
index ab5bd99dd93..1f20af30170 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/objectid_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/objectid_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestObjectIdValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with ObjectId values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/regexp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/regexp_test.go
index d1632b76392..1eae1ddf389 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/regexp_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/regexp_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestRegExpValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with RegExp values", t, func() {
@@ -113,6 +115,7 @@ func TestRegExpValue(t *testing.T) {
}
func TestRegexpLiteral(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with regular expression literals", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/scanner_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/scanner_test.go
index 0c6cae7e081..51d842c1fdf 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/scanner_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/scanner_test.go
@@ -11,6 +11,7 @@ package json
import (
"bytes"
+ "github.com/mongodb/mongo-tools/common/testtype"
"math"
"math/rand"
"reflect"
@@ -49,6 +50,7 @@ var ex1i = `[
]`
func TestCompact(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var buf bytes.Buffer
for _, tt := range examples {
buf.Reset()
@@ -69,6 +71,7 @@ func TestCompact(t *testing.T) {
}
func TestCompactSeparators(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
// U+2028 and U+2029 should be escaped inside strings.
// They should not appear outside strings.
tests := []struct {
@@ -88,6 +91,7 @@ func TestCompactSeparators(t *testing.T) {
}
func TestIndent(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var buf bytes.Buffer
for _, tt := range examples {
buf.Reset()
@@ -110,6 +114,7 @@ func TestIndent(t *testing.T) {
// Tests of a large random structure.
func TestCompactBig(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
initBig()
var buf bytes.Buffer
if err := Compact(&buf, jsonBig); err != nil {
@@ -124,6 +129,7 @@ func TestCompactBig(t *testing.T) {
}
func TestIndentBig(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
initBig()
var buf bytes.Buffer
if err := Indent(&buf, jsonBig, "", "\t"); err != nil {
@@ -172,6 +178,7 @@ var indentErrorTests = []indentErrorTest{
}
func TestIndentErrors(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for i, tt := range indentErrorTests {
var slice []uint8
buf := bytes.NewBuffer(slice)
@@ -185,6 +192,7 @@ func TestIndentErrors(t *testing.T) {
}
func TestNextValueBig(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
initBig()
var scan scanner
item, rest, err := nextValue(jsonBig, &scan)
@@ -213,6 +221,7 @@ func TestNextValueBig(t *testing.T) {
var benchScan scanner
func BenchmarkSkipValue(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
initBig()
for i := 0; i < b.N; i++ {
nextValue(jsonBig, &benchScan)
@@ -221,6 +230,7 @@ func BenchmarkSkipValue(b *testing.B) {
}
func diff(t *testing.T, a, b []byte) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for i := 0; ; i++ {
if i >= len(a) || i >= len(b) || a[i] != b[i] {
j := i - 10
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/single_quoted_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/single_quoted_test.go
index 741f96da037..596b0d0b08a 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/single_quoted_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/single_quoted_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestSingleQuotedKeys(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with single quotes around its keys", t, func() {
@@ -48,6 +50,7 @@ func TestSingleQuotedKeys(t *testing.T) {
}
func TestSingleQuotedValues(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with single quotes around its values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/stream_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/stream_test.go
index ec8f4f54043..a45ac3d2ddf 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/stream_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/stream_test.go
@@ -11,6 +11,7 @@ package json
import (
"bytes"
+ "github.com/mongodb/mongo-tools/common/testtype"
"io/ioutil"
"net"
"reflect"
@@ -42,6 +43,7 @@ false
`
func TestEncoder(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for i := 0; i <= len(streamTest); i++ {
var buf bytes.Buffer
enc := NewEncoder(&buf)
@@ -59,6 +61,7 @@ func TestEncoder(t *testing.T) {
}
func TestDecoder(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for i := 0; i <= len(streamTest); i++ {
// Use stream without newlines as input,
// just to stress the decoder even more.
@@ -91,6 +94,7 @@ func TestDecoder(t *testing.T) {
}
func TestDecoderBuffered(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
r := strings.NewReader(`{"Name": "Gopher"} extra `)
var m struct {
Name string
@@ -127,6 +131,7 @@ func nlines(s string, n int) string {
}
func TestRawMessage(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
// TODO(rsc): Should not need the * in *RawMessage
var data struct {
X float64
@@ -152,6 +157,7 @@ func TestRawMessage(t *testing.T) {
}
func TestNullRawMessage(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
// TODO(rsc): Should not need the * in *RawMessage
var data struct {
X float64
@@ -182,6 +188,7 @@ var blockingTests = []string{
}
func TestBlocking(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for _, enc := range blockingTests {
r, w := net.Pipe()
go w.Write([]byte(enc))
@@ -198,6 +205,7 @@ func TestBlocking(t *testing.T) {
}
func BenchmarkEncoderEncode(b *testing.B) {
+ testtype.SkipUnlessBenchmarkType(b, testtype.UnitTestType)
b.ReportAllocs()
type T struct {
X, Y string
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tagkey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tagkey_test.go
index 60e129dcf9f..67c2a852689 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tagkey_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tagkey_test.go
@@ -10,6 +10,7 @@
package json
import (
+ "github.com/mongodb/mongo-tools/common/testtype"
"testing"
)
@@ -91,6 +92,7 @@ var structTagObjectKeyTests = []struct {
}
func TestStructTagObjectKey(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
for _, tt := range structTagObjectKeyTests {
b, err := Marshal(tt.raw)
if err != nil {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tags_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tags_test.go
index 24036587f0a..bf2a782c4ab 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tags_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/tags_test.go
@@ -10,10 +10,12 @@
package json
import (
+ "github.com/mongodb/mongo-tools/common/testtype"
"testing"
)
func TestTagParsing(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
name, opts := parseTag("field,foobar,foo")
if name != "field" {
t.Fatalf("name = %q, want field", name)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/timestamp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/timestamp_test.go
index fdf2708a2a7..f522f923c70 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/timestamp_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/timestamp_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestTimestampValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with Timestamp values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/undefined_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/undefined_test.go
index 76500bb607e..29df73bc9ae 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/undefined_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/undefined_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestUndefinedValue(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON with undefined values", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/unquoted_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/unquoted_test.go
index d2a780c38c1..7a4a99a584b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/unquoted_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/json/unquoted_test.go
@@ -8,11 +8,13 @@ package json
import (
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestUnquotedKeys(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When unmarshalling JSON without quotes around its keys", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/log/tool_logger_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/log/tool_logger_test.go
index 1244b1f30cf..d258b225980 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/log/tool_logger_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/log/tool_logger_test.go
@@ -13,6 +13,7 @@ import (
"testing"
"time"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
@@ -25,6 +26,7 @@ func (v verbosity) IsQuiet() bool { return v.Q }
func (v verbosity) Level() int { return v.L }
func TestBasicToolLoggerFunctionality(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var tl *ToolLogger
oldTime := time.Now()
@@ -73,6 +75,7 @@ func TestBasicToolLoggerFunctionality(t *testing.T) {
}
func TestGlobalToolLoggerFunctionality(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
globalToolLogger = nil // just to be sure
Convey("With an initialized global ToolLogger", t, func() {
@@ -89,6 +92,7 @@ func TestGlobalToolLoggerFunctionality(t *testing.T) {
}
func TestToolLoggerWriter(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a tool logger that writes to a buffer", t, func() {
buff := bytes.NewBuffer(make([]byte, 1024))
tl := NewToolLogger(&verbosity{L: 3})
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/options/options_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/options/options_test.go
index fbf603c8947..cda13773d75 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/options/options_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/options/options_test.go
@@ -10,12 +10,14 @@ import (
"github.com/mongodb/mongo-tools/common/connstring"
. "github.com/smartystreets/goconvey/convey"
+ "github.com/mongodb/mongo-tools/common/testtype"
"runtime"
"testing"
"time"
)
func TestVerbosityFlag(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a new ToolOptions", t, func() {
enabled := EnabledOptions{false, false, false, false}
optPtr := New("", "", enabled)
@@ -96,6 +98,7 @@ type uriTester struct {
}
func TestParseAndSetOptions(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a matrix of URIs and expected results", t, func() {
enabledURIOnly := EnabledOptions{false, false, false, true}
testCases := []uriTester{
@@ -410,6 +413,7 @@ func TestParseAndSetOptions(t *testing.T) {
// Regression test for TOOLS-1694 to prevent issue from TOOLS-1115
func TestHiddenOptionsDefaults(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a ToolOptions parsed", t, func() {
enabled := EnabledOptions{Connection: true}
opts := New("", "", enabled)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/manager_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/manager_test.go
index e9121cc7b68..1fc4d7f7c1c 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/manager_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/manager_test.go
@@ -8,6 +8,7 @@ package progress
import (
"bytes"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"strconv"
"strings"
@@ -40,6 +41,7 @@ func (b *safeBuffer) Reset() {
}
func TestManagerAttachAndDetach(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
writeBuffer := new(safeBuffer)
var manager *BarWriter
@@ -111,6 +113,7 @@ func TestManagerAttachAndDetach(t *testing.T) {
}
func TestManagerStartAndStop(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
writeBuffer := new(safeBuffer)
var manager *BarWriter
@@ -143,6 +146,7 @@ func TestManagerStartAndStop(t *testing.T) {
}
func TestNumberOfWrites(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var cw *CountWriter
var manager *BarWriter
Convey("With a test manager and counting writer", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/progress_bar_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/progress_bar_test.go
index b6a58dadc37..f5851196ada 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/progress_bar_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/progress/progress_bar_test.go
@@ -15,9 +15,12 @@ import (
"strings"
"testing"
"time"
+
+ "github.com/mongodb/mongo-tools/common/testtype"
)
func TestBasicProgressBar(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
writeBuffer := &bytes.Buffer{}
@@ -66,6 +69,7 @@ func TestBasicProgressBar(t *testing.T) {
}
func TestProgressBarWithNoMax(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
writeBuffer := &bytes.Buffer{}
Convey("With a simple ProgressBar with no max value", t, func() {
@@ -87,6 +91,7 @@ func TestProgressBarWithNoMax(t *testing.T) {
}
func TestBarConcurrency(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
writeBuffer := &bytes.Buffer{}
Convey("With a simple ProgressBar", t, func() {
@@ -123,6 +128,7 @@ func TestBarConcurrency(t *testing.T) {
}
func TestBarDrawing(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Drawing some test bars and checking their character counts", t, func() {
Convey("20 wide @ 50%", func() {
b := drawBar(20, .5)
@@ -170,6 +176,7 @@ func TestBarDrawing(t *testing.T) {
}
func TestBarUnits(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
writeBuffer := &bytes.Buffer{}
Convey("With a simple ProgressBar with IsBytes==true", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testtype/types.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testtype/types.go
index 52c6c58d187..0993f9b4cbc 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testtype/types.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testtype/types.go
@@ -7,8 +7,7 @@
package testtype
import (
- "flag"
- "strings"
+ "os"
"testing"
)
@@ -16,48 +15,43 @@ const (
// Integration tests require a mongod running on localhost:33333. If your
// mongod uses SSL you need to specify the "ssl" type below, and ditto for
// if your mongod requires auth.
- IntegrationTestType = "integration"
+ // First checks for a URI for a Mongod in the env variable TOOLS_TESTING_MONGOD. If it does not find it, looks on localhost:33333
+ IntegrationTestType = "TOOLS_TESTING_INTEGRATION"
// Unit tests don't require a real mongod. They may still do file I/O.
- UnitTestType = "unit"
+ UnitTestType = "TOOLS_TESTING_UNIT"
// Kerberos tests are a special type of integration test that test tools
// with Kerberos authentication against the drivers Kerberos testing cluster
// because setting up a KDC every time is too brittle and expensive.
// (See https://wiki.mongodb.com/display/DH/Testing+Kerberos)
- KerberosTestType = "kerberos"
+ KerberosTestType = "TOOLS_TESTING_KERBEROS"
- // "ssl" and "auth" are used to configure integration tests to run against
- // different mongod configurations. "ssl" will configure the integration tests
- // to expect an SSL-enabled mongod on localhost:33333. "auth" will do the same
+ // "TOOLS_TESTING_SSL" and "TOOLS_TESTING_AUTH" are used to configure integration tests to run against
+ // different mongod configurations. "TOOLS_TESTING_SSL" will configure the integration tests
+ // to expect an SSL-enabled mongod on localhost:33333. "TOOLS_TESTING_AUTH" will do the same
// for an auth-enabled mongod on localhost:33333.
- SSLTestType = "ssl"
- AuthTestType = "auth"
-)
+ SSLTestType = "TOOLS_TESTING_SSL"
+ AuthTestType = "TOOLS_TESTING_AUTH"
-var (
- // the types of tests that should be run
- testTypes = flag.String("test.types", UnitTestType, "Comma-separated list of the"+
- " types of tests to be run")
+ // For now mongoreplay tests are unique, and will have to be explicitly run.
+ MongoReplayTestType = "TOOLS_TESTING_REPLAY"
)
func HasTestType(testType string) bool {
- if !flag.Parsed() {
- flag.Parse()
- }
-
- // skip the test if the passed-in type is not being run
- for _, typ := range strings.Split(*testTypes, ",") {
- if typ == testType {
- return true
- }
- }
- return false
+ envVal := os.Getenv(testType)
+ return envVal == "true"
}
// Skip the test if the specified type is not being run.
-func VerifyTestType(t *testing.T, testType string) {
+func SkipUnlessTestType(t *testing.T, testType string) {
if !HasTestType(testType) {
t.SkipNow()
}
}
+
+func SkipUnlessBenchmarkType(b *testing.B, testType string) {
+ if !HasTestType(testType) {
+ b.SkipNow()
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/auth.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/auth.go
index 9264781b649..dbb21946015 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/auth.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/auth.go
@@ -18,8 +18,8 @@ import (
var (
UserAdmin = "uAdmin"
UserAdminPassword = "password"
- CreatedUserNameEnv = "AUTH_USERNAME"
- CreatedUserPasswordEnv = "AUTH_PASSWORD"
+ CreatedUserNameEnv = "TOOLS_TESTING_AUTH_USERNAME"
+ CreatedUserPasswordEnv = "TOOLS_TESTING_AUTH_PASSWORD"
)
// Initialize a user admin, using the already-connected session passed in.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/testutil.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/testutil.go
index 5fdadc499e8..4efedd9e149 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/testutil.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/testutil/testutil.go
@@ -38,7 +38,7 @@ func GetBareSessionProvider() (*db.SessionProvider, *options.ToolOptions, error)
var toolOptions *options.ToolOptions
// get ToolOptions from URI or defaults
- if uri := os.Getenv("MONGOD"); uri != "" {
+ if uri := os.Getenv("TOOLS_TESTING_MONGOD"); uri != "" {
fakeArgs := []string{"--uri=" + uri}
toolOptions = options.New("mongodump", "", options.EnabledOptions{URI: true})
toolOptions.URI.AddKnownURIParameters(options.KnownURIOptionsReadPreference)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/grid_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/grid_test.go
index 39008d7f274..d55000959e9 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/grid_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/grid_test.go
@@ -9,11 +9,13 @@ package text
import (
"bytes"
"fmt"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestUpdateWidths(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Using a grid writer, the cached column width", t, func() {
gw := GridWriter{}
defaultWidths := []int{1, 2, 3, 4}
@@ -51,6 +53,7 @@ func writeData(gw *GridWriter) {
}
func TestWriteGrid(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Test grid writer with no min width", t, func() {
gw := GridWriter{}
writeData(&gw)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/units_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/units_test.go
index bc25e14affc..90011240cbc 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/units_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/text/units_test.go
@@ -7,12 +7,14 @@
package text
import (
+ "github.com/mongodb/mongo-tools/common/testtype"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestFormatByteCount(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With some sample byte amounts", t, func() {
Convey("0 Bytes -> 0B", func() {
So(FormatByteAmount(0), ShouldEqual, "0B")
@@ -36,6 +38,7 @@ func TestFormatByteCount(t *testing.T) {
}
func TestOtherByteFormats(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With some sample byte amounts", t, func() {
Convey("with '10'", func() {
Convey("FormatMegabyteAmount -> 10.0M", func() {
@@ -64,6 +67,7 @@ func TestOtherByteFormats(t *testing.T) {
}
func TestBitFormatPrecision(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With values less than 1k", t, func() {
Convey("with '999'", func() {
Convey("FormatBits -> 999b", func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/bool_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/bool_test.go
index 770b94c8912..0068defee3a 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/bool_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/bool_test.go
@@ -7,6 +7,7 @@
package util
import (
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
"gopkg.in/mgo.v2/bson"
"math"
@@ -14,6 +15,7 @@ import (
)
func TestJSTruthyValues(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With some sample values", t, func() {
Convey("known server code edge cases are correct", func() {
Convey("true -> true", func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/format_date_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/format_date_test.go
index 5ae5923731a..73a4aca64de 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/format_date_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/format_date_test.go
@@ -7,49 +7,47 @@
package util
import (
- . "github.com/smartystreets/goconvey/convey"
- "testing"
+ "github.com/mongodb/mongo-tools/common/testtype"
+ . "github.com/smartystreets/goconvey/convey"
+ "testing"
)
func TestFormatDate(t *testing.T) {
-
- Convey("will take valid format 2006-01-02T15:04:05.000Z", t, func() {
- _, err := FormatDate("2014-01-02T15:04:05.000Z")
- So(err, ShouldBeNil)
- })
-
-
- Convey("will take valid format 2006-01-02T15:04:05Z", t, func() {
- _, err := FormatDate("2014-03-02T15:05:05Z")
- So(err, ShouldBeNil)
- })
-
-
- Convey("will take valid format 2006-01-02T15:04Z", t, func() {
- _, err := FormatDate("2014-04-02T15:04Z")
- So(err, ShouldBeNil)
- })
-
- Convey("will take valid format 2006-01-02T15:04-0700", t, func() {
- _, err := FormatDate("2014-04-02T15:04-0800")
- So(err, ShouldBeNil)
- })
-
- Convey("will take valid format 2006-01-02T15:04:05.000-0700", t, func() {
- _, err := FormatDate("2014-04-02T15:04:05.000-0600")
- So(err, ShouldBeNil)
- })
-
-
- Convey("will take valid format 2006-01-02T15:04:05-0700", t, func() {
- _, err := FormatDate("2014-04-02T15:04:05-0500")
- So(err, ShouldBeNil)
- })
-
- Convey("will return an error for an invalid format", t, func() {
- _, err := FormatDate("invalid string format")
- So(err, ShouldNotBeNil)
- })
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
+
+ Convey("will take valid format 2006-01-02T15:04:05.000Z", t, func() {
+ _, err := FormatDate("2014-01-02T15:04:05.000Z")
+ So(err, ShouldBeNil)
+ })
+
+ Convey("will take valid format 2006-01-02T15:04:05Z", t, func() {
+ _, err := FormatDate("2014-03-02T15:05:05Z")
+ So(err, ShouldBeNil)
+ })
+
+ Convey("will take valid format 2006-01-02T15:04Z", t, func() {
+ _, err := FormatDate("2014-04-02T15:04Z")
+ So(err, ShouldBeNil)
+ })
+
+ Convey("will take valid format 2006-01-02T15:04-0700", t, func() {
+ _, err := FormatDate("2014-04-02T15:04-0800")
+ So(err, ShouldBeNil)
+ })
+
+ Convey("will take valid format 2006-01-02T15:04:05.000-0700", t, func() {
+ _, err := FormatDate("2014-04-02T15:04:05.000-0600")
+ So(err, ShouldBeNil)
+ })
+
+ Convey("will take valid format 2006-01-02T15:04:05-0700", t, func() {
+ _, err := FormatDate("2014-04-02T15:04:05-0500")
+ So(err, ShouldBeNil)
+ })
+
+ Convey("will return an error for an invalid format", t, func() {
+ _, err := FormatDate("invalid string format")
+ So(err, ShouldNotBeNil)
+ })
}
-
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/math_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/math_test.go
index 51bf93a986f..43349931237 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/math_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/math_test.go
@@ -16,7 +16,7 @@ import (
func TestMaxInt(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When finding the maximum of two ints", t, func() {
@@ -32,7 +32,7 @@ func TestMaxInt(t *testing.T) {
func TestNumberConverter(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a number converter for float32", t, func() {
floatConverter := newNumberConverter(reflect.TypeOf(float32(0)))
@@ -62,7 +62,7 @@ func TestNumberConverter(t *testing.T) {
func TestUInt32Converter(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a series of test values, conversions should pass", t, func() {
out, err := ToUInt32(int64(99))
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/mongo_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/mongo_test.go
index 15ced783966..0bff112d8e5 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/mongo_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/common/util/mongo_test.go
@@ -15,7 +15,7 @@ import (
func TestParseConnectionString(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When extracting the replica set and hosts from a connection"+
" url", t, func() {
@@ -47,7 +47,7 @@ func TestParseConnectionString(t *testing.T) {
func TestCreateConnectionAddrs(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("When creating the slice of connection addresses", t, func() {
@@ -73,6 +73,8 @@ func TestCreateConnectionAddrs(t *testing.T) {
func TestInvalidNames(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
+
Convey("Checking some invalid collection names, ", t, func() {
Convey("test.col$ is invalid", func() {
So(ValidateDBName("test"), ShouldBeNil)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/import.data b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/import.data
index 30f2551b64e..a7be3618dba 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/import.data
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/import.data
@@ -1,5 +1,5 @@
{
- "commit": "db7b61e2dbde09b4abdaf27d90486bf63b9f290f",
+ "commit": "fde6c854adf7b359336f8b4a3e2828ffca0bb1af",
"github": "mongodb/mongo-tools.git",
"vendor": "tools",
"branch": "v4.1"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump_test.go
index 2ed0799695d..99f7674091b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/mongodump_test.go
@@ -352,7 +352,7 @@ func testQuery(md *MongoDump, session *mgo.Session) string {
}
func TestMongoDumpValidateOptions(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a MongoDump instance", t, func() {
md := simpleMongoDumpInstance()
@@ -380,7 +380,7 @@ func TestMongoDumpValidateOptions(t *testing.T) {
}
func TestMongoDumpKerberos(t *testing.T) {
- testtype.VerifyTestType(t, testtype.KerberosTestType)
+ testtype.SkipUnlessTestType(t, testtype.KerberosTestType)
Convey("Should be able to run mongodump with Kerberos auth", t, func() {
opts, err := testutil.GetKerberosOptions()
@@ -419,7 +419,7 @@ func TestMongoDumpKerberos(t *testing.T) {
}
func TestMongoDumpBSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
log.SetWriter(ioutil.Discard)
Convey("With a MongoDump instance", t, func() {
@@ -629,7 +629,7 @@ func TestMongoDumpBSON(t *testing.T) {
}
func TestMongoDumpMetaData(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
log.SetWriter(ioutil.Discard)
Convey("With a MongoDump instance", t, func() {
@@ -714,7 +714,7 @@ func TestMongoDumpMetaData(t *testing.T) {
}
func TestMongoDumpOplog(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
session, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare.go
index 301ff89fe88..8f9b12e9bbf 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare.go
@@ -135,10 +135,10 @@ func (f *stdoutFile) Close() error {
return nil
}
-// isReservedSystemNamespace returns true when a namespace (database +
+// shouldSkipSystemNamespace returns true when a namespace (database +
// collection name) match certain reserved system namespaces that must
// not be dumped.
-func (dump *MongoDump) isReservedSystemNamespace(dbName, collName string) bool {
+func shouldSkipSystemNamespace(dbName, collName string) bool {
// ignore <db>.system.* except for admin; ignore other specific
// collections in config and admin databases used for 3.6 features.
switch dbName {
@@ -151,6 +151,9 @@ func (dump *MongoDump) isReservedSystemNamespace(dbName, collName string) bool {
return true
}
default:
+ if collName == "system.js" {
+ return false
+ }
if strings.HasPrefix(collName, "system.") {
return true
}
@@ -383,7 +386,7 @@ func (dump *MongoDump) CreateIntentsForDatabase(dbName string) error {
}
collInfo.Name = collName
}
- if dump.isReservedSystemNamespace(dbName, collInfo.Name) {
+ if shouldSkipSystemNamespace(dbName, collInfo.Name) {
log.Logvf(log.DebugHigh, "will not dump system collection '%s.%s'", dbName, collInfo.Name)
continue
}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare_test.go
index 1ee11101128..7a0a682bff7 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongodump/prepare_test.go
@@ -15,7 +15,7 @@ import (
func TestSkipCollection(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a mongodump that excludes collections 'test' and 'fake'"+
" and excludes prefixes 'pre-' and 'no'", t, func() {
@@ -56,3 +56,41 @@ func TestSkipCollection(t *testing.T) {
})
}
+
+type testTable struct {
+ db string
+ coll string
+ output bool
+}
+
+func TestShouldSkipSystemNamespace(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
+ tests := []testTable{
+ testTable{
+ db: "test",
+ coll: "system",
+ output: false,
+ },
+ testTable{
+ db: "test",
+ coll: "system.nonsense",
+ output: true,
+ },
+ testTable{
+ db: "test",
+ coll: "system.js",
+ output: false,
+ },
+ testTable{
+ db: "test",
+ coll: "test",
+ output: false,
+ },
+ }
+
+ for _, testVals := range tests {
+ if shouldSkipSystemNamespace(testVals.db, testVals.coll) != testVals.output {
+ t.Errorf("%s.%s should have been %v but failed\n", testVals.db, testVals.coll, testVals.output)
+ }
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/csv_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/csv_test.go
index e824a5fc67d..76165b21c2b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/csv_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/csv_test.go
@@ -19,7 +19,7 @@ import (
)
func TestWriteCSV(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a CSV export output", t, func() {
fields := []string{"_id", "x", " y", "z.1.a"}
@@ -78,6 +78,7 @@ func TestWriteCSV(t *testing.T) {
}
func TestExtractDField(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a test bson.D", t, func() {
b := []interface{}{"inner", bsonutil.MarshalD{{"inner2", 1}}}
c := bsonutil.MarshalD{{"x", 5}}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/json_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/json_test.go
index 02bed7c8eca..d2bad44ada4 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/json_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/json_test.go
@@ -17,7 +17,7 @@ import (
)
func TestWriteJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a JSON export output", t, func() {
out := &bytes.Buffer{}
@@ -45,7 +45,7 @@ func TestWriteJSON(t *testing.T) {
}
func TestJSONArray(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a JSON export output in array mode", t, func() {
out := &bytes.Buffer{}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/kerberos_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/kerberos_test.go
index 9c7970cd06f..185da0bd603 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/kerberos_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/kerberos_test.go
@@ -19,7 +19,7 @@ import (
)
func TestKerberos(t *testing.T) {
- testtype.VerifyTestType(t, testtype.KerberosTestType)
+ testtype.SkipUnlessTestType(t, testtype.KerberosTestType)
Convey("Should be able to run mongoexport with Kerberos auth", t, func() {
opts, err := testutil.GetKerberosOptions()
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/mongoexport_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/mongoexport_test.go
index 2a729b3df30..919497d1a79 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/mongoexport_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoexport/mongoexport_test.go
@@ -18,7 +18,7 @@ import (
)
func TestExtendedJSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Serializing a doc to extended JSON should work", t, func() {
x := bson.M{
@@ -41,7 +41,7 @@ func TestExtendedJSON(t *testing.T) {
}
func TestFieldSelect(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Using makeFieldSelector should return correct projection doc", t, func() {
So(makeFieldSelector("a,b"), ShouldResemble, bson.M{"_id": 1, "a": 1, "b": 1})
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go
index fb186a0d95d..5c57159ed4d 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/mongofiles_test.go
@@ -233,7 +233,7 @@ func fileExists(name string) bool {
// Test that it works whenever valid arguments are passed in and that
// it barfs whenever invalid ones are passed
func TestValidArguments(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a MongoFiles instance", t, func() {
mf, err := simpleMongoFilesInstanceWithFilename("search", "file")
@@ -296,7 +296,7 @@ func TestValidArguments(t *testing.T) {
// Test that the output from mongofiles is actually correct
func TestMongoFilesCommands(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
Convey("Testing the various commands (get|get_id|put|delete|delete_id|search|list) "+
"with a MongoDump instance", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/options_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/options_test.go
index 5c74e2355be..8a9609f82be 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/options_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongofiles/options_test.go
@@ -12,11 +12,13 @@ import (
"github.com/mongodb/mongo-tools/common/db"
"github.com/mongodb/mongo-tools/common/options"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
// Regression test for TOOLS-1741
func TestWriteConcernWithURIParsing(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With an IngestOptions and ToolsOptions", t, func() {
// create an 'EnabledOptions' to determine what options should be able to be
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common.go
index 0e292eeaef5..7c66b4ffe6e 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common.go
@@ -219,13 +219,20 @@ func getUpsertValue(field string, document bson.D) interface{} {
left := field[0:index]
subDoc, _ := bsonutil.FindValueByKey(left, &document)
if subDoc == nil {
+ log.Logvf(log.DebugHigh, "no subdoc found for '%v'", left)
return nil
}
- subDocD, ok := subDoc.(bson.D)
- if !ok {
+ switch subDoc.(type) {
+ case bson.D:
+ subDocD := subDoc.(bson.D)
+ return getUpsertValue(field[index+1:], subDocD)
+ case *bson.D:
+ subDocD := subDoc.(*bson.D)
+ return getUpsertValue(field[index+1:], *subDocD)
+ default:
+ log.Logvf(log.DebugHigh, "subdoc found for '%v', but couldn't coerce to bson.D", left)
return nil
}
- return getUpsertValue(field[index+1:], subDocD)
}
// filterIngestError accepts a boolean indicating if a non-nil error should be,
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common_test.go
index 56df48ce195..f428b029e23 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/common_test.go
@@ -111,7 +111,7 @@ func convertBSONDToRaw(documents []bson.D) []bson.Raw {
}
func TestValidateFields(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given an import input, in validating the headers", t, func() {
Convey("if the fields contain '..', an error should be thrown", func() {
@@ -147,7 +147,7 @@ func TestValidateFields(t *testing.T) {
}
func TestGetUpsertValue(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a field and a BSON document, on calling getUpsertValue", t, func() {
Convey("the value of the key should be correct for unnested documents", func() {
@@ -159,6 +159,11 @@ func TestGetUpsertValue(t *testing.T) {
bsonDocument := bson.D{{"a", inner}}
So(getUpsertValue("a.b", bsonDocument), ShouldEqual, 4)
})
+ Convey("the value of the key should be correct for nested document pointer fields", func() {
+ inner := bson.D{{"b", 4}}
+ bsonDocument := bson.D{{"a", &inner}}
+ So(getUpsertValue("a.b", bsonDocument), ShouldEqual, 4)
+ })
Convey("the value of the key should be nil for unnested document "+
"fields that do not exist", func() {
bsonDocument := bson.D{{"a", 4}}
@@ -170,6 +175,12 @@ func TestGetUpsertValue(t *testing.T) {
bsonDocument := bson.D{{"a", inner}}
So(getUpsertValue("a.c", bsonDocument), ShouldBeNil)
})
+ Convey("the value of the key should be nil for nested document pointer "+
+ "fields that do not exist", func() {
+ inner := bson.D{{"b", 4}}
+ bsonDocument := bson.D{{"a", &inner}}
+ So(getUpsertValue("a.c", bsonDocument), ShouldBeNil)
+ })
Convey("the value of the key should be nil for nil document values", func() {
So(getUpsertValue("a", bson.D{{"a", nil}}), ShouldBeNil)
})
@@ -177,7 +188,7 @@ func TestGetUpsertValue(t *testing.T) {
}
func TestConstructUpsertDocument(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a set of upsert fields and a BSON document, on calling "+
"constructUpsertDocument", t, func() {
@@ -219,7 +230,7 @@ func TestConstructUpsertDocument(t *testing.T) {
}
func TestSetNestedValue(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a field, its value, and an existing BSON document...", t, func() {
b := bson.D{{"c", "d"}}
@@ -271,7 +282,7 @@ func TestSetNestedValue(t *testing.T) {
}
func TestRemoveBlankFields(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given an unordered BSON document", t, func() {
Convey("the same document should be returned if there are no blanks", func() {
@@ -308,7 +319,7 @@ func TestRemoveBlankFields(t *testing.T) {
}
func TestTokensToBSON(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given an slice of column specs and tokens to convert to BSON", t, func() {
Convey("the expected ordered BSON should be produced for the given"+
@@ -385,7 +396,7 @@ func TestTokensToBSON(t *testing.T) {
}
func TestProcessDocuments(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given an import worker", t, func() {
index := uint64(0)
@@ -468,7 +479,7 @@ func TestProcessDocuments(t *testing.T) {
}
func TestDoSequentialStreaming(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given some import workers, a Converters input channel and an bson.D output channel", t, func() {
inputChannel := make(chan Converter, 5)
@@ -512,7 +523,7 @@ func TestDoSequentialStreaming(t *testing.T) {
}
func TestStreamDocuments(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey(`Given:
1. a boolean indicating streaming order
2. an input channel where documents are streamed in
@@ -554,7 +565,7 @@ func TestStreamDocuments(t *testing.T) {
}
func TestChannelQuorumError(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a channel and a quorum...", t, func() {
Convey("an error should be returned if one is received", func() {
ch := make(chan error, 2)
@@ -579,7 +590,7 @@ func TestChannelQuorumError(t *testing.T) {
}
func TestFilterIngestError(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a boolean 'stopOnError' and an error...", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/csv_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/csv_test.go
index f04d53dd8f7..e3bdc9e009c 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/csv_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/csv_test.go
@@ -27,7 +27,7 @@ func init() {
}
func TestCSVStreamDocument(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a CSV input reader", t, func() {
Convey("badly encoded CSV should result in a parsing error", func() {
contents := `1, 2, foo"bar`
@@ -208,7 +208,7 @@ func TestCSVStreamDocument(t *testing.T) {
}
func TestCSVReadAndValidateHeader(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
var err error
Convey("With a CSV input reader", t, func() {
Convey("setting the header should read the first line of the CSV", func() {
@@ -335,7 +335,7 @@ func TestCSVReadAndValidateHeader(t *testing.T) {
}
func TestCSVConvert(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a CSV input reader", t, func() {
Convey("calling convert on a CSVConverter should return the expected BSON document", func() {
csvConverter := CSVConverter{
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/json_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/json_test.go
index 92b52cf36c3..446871f2c41 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/json_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/json_test.go
@@ -18,7 +18,7 @@ import (
)
func TestJSONArrayStreamDocument(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a JSON array input reader", t, func() {
var jsonFile, fileHandle *os.File
Convey("an error should be thrown if a plain JSON document is supplied", func() {
@@ -81,7 +81,7 @@ func TestJSONArrayStreamDocument(t *testing.T) {
}
func TestJSONPlainStreamDocument(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a plain JSON input reader", t, func() {
var jsonFile, fileHandle *os.File
Convey("string valued JSON documents should be imported properly", func() {
@@ -184,7 +184,7 @@ func TestJSONPlainStreamDocument(t *testing.T) {
}
func TestReadJSONArraySeparator(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With an array JSON input reader", t, func() {
Convey("reading a JSON array separator should consume [",
func() {
@@ -250,7 +250,7 @@ func TestReadJSONArraySeparator(t *testing.T) {
}
func TestJSONConvert(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a JSON input reader", t, func() {
Convey("calling convert on a JSONConverter should return the expected BSON document", func() {
jsonConverter := JSONConverter{
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport.go
index 9617146d9e4..7e63c4bedcf 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport.go
@@ -537,6 +537,7 @@ func (up *upserter) Insert(doc interface{}) error {
selector := constructUpsertDocument(up.imp.upsertFields, document)
var err error
if selector == nil { // modeInsert || doc-not-exist
+ log.Logvf(log.Info, "Could not construct selector from %v, falling back to insert mode", up.imp.upsertFields)
err = up.collection.Insert(document)
} else if up.imp.IngestOptions.Mode == modeUpsert {
_, err = up.collection.Upsert(selector, document)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport_test.go
index 973e3b7579e..f5e759a86cf 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/mongoimport_test.go
@@ -57,6 +57,23 @@ func checkOnlyHasDocuments(sessionProvider db.SessionProvider, expectedDocuments
return nil
}
+func countDocuments(sessionProvider *db.SessionProvider) (int, error) {
+ session, err := (*sessionProvider).GetSession()
+ if err != nil {
+ return 0, err
+ }
+ defer session.Close()
+
+ collection := session.DB(testDb).C(testCollection)
+ dbDocuments := []bson.M{}
+ // Count via scan because 'count' command can be an approximation
+ err = collection.Find(nil).All(&dbDocuments)
+ if err != nil {
+ return 0, err
+ }
+ return len(dbDocuments), nil
+}
+
// getBasicToolOptions returns a test helper to instantiate the session provider
// for calls to StreamDocument
func getBasicToolOptions() *options.ToolOptions {
@@ -101,7 +118,7 @@ func NewMongoImport() (*MongoImport, error) {
}
func TestSplitInlineHeader(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("handle normal, untyped headers", t, func() {
fields := []string{"foo.bar", "baz", "boo"}
header := strings.Join(fields, ",")
@@ -126,7 +143,7 @@ func TestSplitInlineHeader(t *testing.T) {
}
func TestMongoImportValidateSettings(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a mongoimport instance for validation, ", t, func() {
Convey("an error should be thrown if no collection is given", func() {
@@ -363,7 +380,7 @@ func TestMongoImportValidateSettings(t *testing.T) {
}
func TestGetSourceReader(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a mongoimport instance, on calling getSourceReader", t,
func() {
Convey("an error should be thrown if the given file referenced by "+
@@ -397,7 +414,7 @@ func TestGetSourceReader(t *testing.T) {
}
func TestGetInputReader(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Given a io.Reader on calling getInputReader", t, func() {
Convey("should parse --fields using valid csv escaping", func() {
imp, err := NewMongoImport()
@@ -499,7 +516,7 @@ func TestGetInputReader(t *testing.T) {
}
func TestImportDocuments(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
Convey("With a mongoimport instance", t, func() {
Reset(func() {
sessionProvider, err := db.NewSessionProvider(*getBasicToolOptions())
@@ -511,7 +528,7 @@ func TestImportDocuments(t *testing.T) {
t.Fatalf("error getting session: %v", err)
}
defer session.Close()
- session.DB(testDb).C(testCollection).DropCollection()
+ session.DB(testDb).C(testCollection).RemoveAll(nil)
})
Convey("no error should be thrown for CSV import on test data and all "+
"CSV data lines should be imported correctly", func() {
@@ -782,11 +799,42 @@ func TestImportDocuments(t *testing.T) {
_, err = imp.ImportDocuments()
So(err, ShouldNotBeNil)
})
+ Convey("CSV import with --mode=upsert/--upsertFields with a nested upsert field should succeed when repeated", func() {
+ imp, err := NewMongoImport()
+ So(err, ShouldBeNil)
+ imp.InputOptions.Type = CSV
+ imp.InputOptions.File = "testdata/test_nested_upsert.csv"
+ imp.InputOptions.HeaderLine = true
+ imp.IngestOptions.Mode = modeUpsert
+ imp.upsertFields = []string{"level1.level2.key1"}
+ numImported, err := imp.ImportDocuments()
+ So(err, ShouldBeNil)
+ So(numImported, ShouldEqual, 1)
+ n, err := countDocuments(imp.SessionProvider)
+ So(err, ShouldBeNil)
+ So(n, ShouldEqual, 1)
+
+ // Repeat must succeed
+ imp, err = NewMongoImport()
+ So(err, ShouldBeNil)
+ imp.InputOptions.Type = CSV
+ imp.InputOptions.File = "testdata/test_nested_upsert.csv"
+ imp.InputOptions.HeaderLine = true
+ imp.IngestOptions.Mode = modeUpsert
+ imp.upsertFields = []string{"level1.level2.key1"}
+ numImported, err = imp.ImportDocuments()
+ So(err, ShouldBeNil)
+ So(numImported, ShouldEqual, 1)
+ n, err = countDocuments(imp.SessionProvider)
+ So(err, ShouldBeNil)
+ So(n, ShouldEqual, 1)
+ })
})
}
// Regression test for TOOLS-1694 to prevent issue from TOOLS-1115
func TestHiddenOptionsDefaults(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a new mongoimport with empty options", t, func() {
imp, err := NewMongoImport()
imp.ToolOptions = options.New("", "", options.EnabledOptions{})
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/options_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/options_test.go
index 1ea39c1a151..a015fce9388 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/options_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/options_test.go
@@ -12,11 +12,13 @@ import (
"github.com/mongodb/mongo-tools/common/db"
"github.com/mongodb/mongo-tools/common/options"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
// Regression test for TOOLS-1741
func TestWriteConcernWithURIParsing(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With an IngestOptions and ToolsOptions", t, func() {
// create an 'EnabledOptions' to determine what options should be able to be
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/testdata/test_nested_upsert.csv b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/testdata/test_nested_upsert.csv
new file mode 100644
index 00000000000..c41c46edcbe
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/testdata/test_nested_upsert.csv
@@ -0,0 +1,3 @@
+level1.level2.key1.string(),level1.level2.key2.string()
+34532,aabb
+
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/tsv_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/tsv_test.go
index 51339699d7e..842d732b7dc 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/tsv_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/tsv_test.go
@@ -17,7 +17,7 @@ import (
)
func TestTSVStreamDocument(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a TSV input reader", t, func() {
Convey("integer valued strings should be converted tsv1", func() {
contents := "1\t2\t3e\n"
@@ -200,7 +200,7 @@ func TestTSVStreamDocument(t *testing.T) {
}
func TestTSVReadAndValidateHeader(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a TSV input reader", t, func() {
Convey("setting the header should read the first line of the TSV", func() {
contents := "extraHeader1\textraHeader2\textraHeader3\n"
@@ -213,7 +213,7 @@ func TestTSVReadAndValidateHeader(t *testing.T) {
}
func TestTSVConvert(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a TSV input reader", t, func() {
Convey("calling convert on a TSVConverter should return the expected BSON document", func() {
tsvConverter := TSVConverter{
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/typed_fields_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/typed_fields_test.go
index d8b43829ff0..37294336933 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/typed_fields_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoimport/typed_fields_test.go
@@ -24,7 +24,7 @@ func init() {
}
func TestTypedHeaderParser(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Using 'zip.string(),number.double(),foo.auto()'", t, func() {
var headers = []string{"zip.string()", "number.double()", "foo.auto()", `bar.date(January 2\, \(2006\))`}
@@ -82,6 +82,7 @@ func TestTypedHeaderParser(t *testing.T) {
}
func TestAutoHeaderParser(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Using 'zip,number'", t, func() {
var headers = []string{"zip", "number", "foo"}
var colSpecs = ParseAutoHeaders(headers)
@@ -94,7 +95,7 @@ func TestAutoHeaderParser(t *testing.T) {
}
func TestFieldParsers(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Using FieldAutoParser", t, func() {
var p, _ = NewFieldParser(ctAuto, "")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/auth_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/auth_test.go
index 93e73308211..dd044ce990a 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/auth_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/auth_test.go
@@ -11,12 +11,14 @@ import (
mgo "github.com/10gen/llmgo"
"github.com/10gen/llmgo/bson"
+ "github.com/mongodb/mongo-tools/common/testtype"
)
// TestCommandsAgainstAuthedDBWhenAuthed tests some basic commands against a
// database that requires authentication when the driver has proper
// authentication credentials
func TestCommandsAgainstAuthedDBWhenAuthed(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if !authTestServerMode {
t.Skipf("Skipping auth test with non-auth DB")
}
@@ -90,6 +92,7 @@ func TestCommandsAgainstAuthedDBWhenAuthed(t *testing.T) {
// authentication. It generates a series of inserts and ensures that the docs
// they are attempting to insert are not later found in the database
func TestCommandsAgainstAuthedDBWhenNotAuthed(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if !authTestServerMode {
t.Skipf("Skipping auth test with non-auth DB")
}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/cursors_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/cursors_test.go
index 06a7153536d..ff943b29431 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/cursors_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/cursors_test.go
@@ -7,6 +7,7 @@
package mongoreplay
import (
+ "github.com/mongodb/mongo-tools/common/testtype"
"sync"
"testing"
"time"
@@ -21,6 +22,7 @@ import (
// to establish a timeout in case the goroutine running GetCursor has not
// returned because the cursorID was not set properly.
func TestFetchingCursorFromPreprocessManager(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
fileCursor := int64(1234)
wireCursor := int64(4567)
// Make a cursorManager
@@ -72,6 +74,7 @@ func TestFetchingCursorFromPreprocessManager(t *testing.T) {
// function. Finally, it verifies that the predefined cursorID was set in the
// manager.
func TestPreprocessingFileWithOpCommand(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
requestID := int32(1234)
testCursorID := int64(4567)
@@ -116,6 +119,7 @@ func TestPreprocessingFileWithOpCommand(t *testing.T) {
// newPreprocessCursorManager function. Finally, it verifies that the predefined
// cursorID was set in the manager.
func TestPreprocessingFile(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
requestID := int32(1234)
testCursorID := int64(4567)
@@ -157,6 +161,7 @@ func TestPreprocessingFile(t *testing.T) {
// block execution on a call to GetCursor if the corresponding live cursorID has
// not been found to a cursorID that was mapped during preprocessing.
func TestBlockOnUnresolvedCursor(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
fileCursor := int64(1234)
liveCursor := int64(4567)
@@ -224,6 +229,7 @@ func TestBlockOnUnresolvedCursor(t *testing.T) {
// be skipped. This 'out of order' may be caused by severe packet lose during
// traffic capture and would result in total deadlock of the program.
func TestSkipOutOfOrderCursor(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
requestID := int32(1234)
testCursorID := int64(4567)
generator := newRecordedOpGenerator()
@@ -277,6 +283,7 @@ func TestSkipOutOfOrderCursor(t *testing.T) {
// TestSkipMarkFailed verifies that fetching a cursorID stops blocking if the op
// that was supposed to create the cursor it was waiting on fails to execute.
func TestSkipOnMarkFailed(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
requestID := int32(1234)
testCursorID := int64(4567)
generator := newRecordedOpGenerator()
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/execute_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/execute_test.go
index fd000f7d006..1346876aa82 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/execute_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/execute_test.go
@@ -10,9 +10,11 @@ import (
"testing"
mgo "github.com/10gen/llmgo"
+ "github.com/mongodb/mongo-tools/common/testtype"
)
func TestCompleteReply(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
context := NewExecutionContext(&StatCollector{}, nil, &ExecutionOptions{})
// AddFromWire takes a recorded request and a live reply to the re-execution
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/filter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/filter_test.go
index c2c022cb2a0..3e89f0792ff 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/filter_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/filter_test.go
@@ -13,9 +13,11 @@ import (
"time"
"github.com/10gen/llmgo/bson"
+ "github.com/mongodb/mongo-tools/common/testtype"
)
func TestRemoveDriverOpsFromFile(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
cases := []struct {
name string
@@ -129,6 +131,7 @@ func TestRemoveDriverOpsFromFile(t *testing.T) {
}
func TestSplitInputFile(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
cases := []struct {
name string
@@ -216,6 +219,7 @@ func TestSplitInputFile(t *testing.T) {
}
func TestRemoveOpsBeforeTime(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
// array of times to use for testing
timesForTest := make([]time.Time, 16)
now := time.Now()
@@ -315,6 +319,7 @@ func TestRemoveOpsBeforeTime(t *testing.T) {
}
func TestRemoveOpsAfterDuration(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
// array of times to use for testing
timesForTest := make([]time.Time, 16)
now := time.Now()
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/mongoreplay_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/mongoreplay_test.go
index b43c768ad43..f8c8624f518 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/mongoreplay_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/mongoreplay_test.go
@@ -15,6 +15,7 @@ import (
mgo "github.com/10gen/llmgo"
"github.com/10gen/llmgo/bson"
+ "github.com/mongodb/mongo-tools/common/testtype"
)
type testDoc struct {
@@ -24,6 +25,7 @@ type testDoc struct {
}
func TestOpGetMore(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := GetMoreOp{}
@@ -55,6 +57,7 @@ func TestOpGetMore(t *testing.T) {
}
func TestOpDelete(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := DeleteOp{}
@@ -87,6 +90,7 @@ func TestOpDelete(t *testing.T) {
}
func TestInsertOp(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := InsertOp{}
@@ -133,6 +137,7 @@ func TestInsertOp(t *testing.T) {
}
func TestKillCursorsOp(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := KillCursorsOp{}
@@ -157,6 +162,7 @@ func TestKillCursorsOp(t *testing.T) {
}
func TestQueryOp(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := QueryOp{}
@@ -201,6 +207,7 @@ func TestQueryOp(t *testing.T) {
}
func TestOpUpdate(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := UpdateOp{}
@@ -238,6 +245,7 @@ func TestOpUpdate(t *testing.T) {
}
func TestCommandOp(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := CommandOp{}
@@ -298,6 +306,7 @@ func TestCommandOp(t *testing.T) {
}
func TestOpMsg(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
var testDocs []interface{}
testDocs = append(testDocs, bson.D{{"doc", 1}})
testDocs = append(testDocs, bson.D{{"doc", 2}})
@@ -444,6 +453,7 @@ func TestOpMsg(t *testing.T) {
}
func comparePayloadType0(t *testing.T, p1, p2 interface{}) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
dataAsRaw, ok := p1.(*bson.Raw)
if !ok {
t.Errorf("type of section data incorrect")
@@ -462,6 +472,7 @@ func comparePayloadType0(t *testing.T, p1, p2 interface{}) {
}
func comparePayloadType1(t *testing.T, p1, p2 interface{}) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
p1AsPayload, ok := p1.(mgo.PayloadType1)
if !ok {
t.Error("incorrect type when expecting PayloadType1")
@@ -481,6 +492,7 @@ func comparePayloadType1(t *testing.T, p1, p2 interface{}) {
}
func TestPreciseTimeMarshal(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
t1 := time.Date(2015, 4, 8, 15, 16, 23, 651387237, time.UTC)
preciseTime := &PreciseTime{t1}
asBson, err := bson.Marshal(preciseTime)
@@ -499,6 +511,7 @@ func TestPreciseTimeMarshal(t *testing.T) {
}
func TestCommandOpGetMoreCursorsRewriteable(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
oldCursorID := int64(1234)
newCursorID := int64(5678)
@@ -567,6 +580,7 @@ func TestCommandOpGetMoreCursorsRewriteable(t *testing.T) {
}
func TestOpGetMoreCursorsRewriteable(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
oldCursorID := int64(1234)
newCursorID := int64(5678)
@@ -608,6 +622,7 @@ func TestOpGetMoreCursorsRewriteable(t *testing.T) {
}
func TestKillCursorsRewriteable(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
oldCursorIDs := []int64{11, 12, 13}
newCursorIDs := []int64{21, 22}
@@ -649,6 +664,7 @@ func TestKillCursorsRewriteable(t *testing.T) {
}
func TestOpCommandReplyGetCursorID(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
testCursorID := int64(123)
doc := &struct {
Cursor struct {
@@ -684,6 +700,7 @@ func TestOpCommandReplyGetCursorID(t *testing.T) {
}
func TestShortenLegacyReply(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := ReplyOp{}
@@ -761,6 +778,7 @@ type findReply struct {
}
func TestShortenCommandReply(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
generator := newRecordedOpGenerator()
op := CommandReplyOp{}
@@ -855,6 +873,7 @@ func TestShortenCommandReply(t *testing.T) {
}
func TestLegacyOpReplyGetCursorID(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
testCursorID := int64(123)
doc := &struct {
Cursor struct {
@@ -904,6 +923,7 @@ func TestLegacyOpReplyGetCursorID(t *testing.T) {
}
func TestFilterCommandOpMetadata(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
testMetadata := &bson.D{{"test", 1}}
testCases := []struct {
@@ -953,6 +973,7 @@ func TestFilterCommandOpMetadata(t *testing.T) {
}
}
func TestReadSection(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
data := bson.D{{"k", "v"}}
dataAsSlice, err := bson.Marshal(data)
if err != nil {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/packet_handler.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/packet_handler.go
index 86fa4e0adde..64156113e6c 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/packet_handler.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/packet_handler.go
@@ -63,7 +63,7 @@ func (p *PacketHandler) Handle(streamHandler StreamHandler, numToHandle int) err
count := int64(0)
start := time.Now()
if p.Verbose && numToHandle > 0 {
- userInfoLogger.Logvf(Always, "Processing", numToHandle, "packets")
+ userInfoLogger.Logvf(Always, "Processing %v %v", numToHandle, "packets")
}
source := gopacket.NewPacketSource(p.pcap, p.pcap.LinkType())
streamPool := NewStreamPool(streamHandler)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/pcap_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/pcap_test.go
index 0f8f8f7b6d3..dc7a5ef82e2 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/pcap_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/pcap_test.go
@@ -14,11 +14,13 @@ import (
mgo "github.com/10gen/llmgo"
"github.com/10gen/llmgo/bson"
+ "github.com/mongodb/mongo-tools/common/testtype"
)
type verifyFunc func(*testing.T, *mgo.Session, *BufferedStatRecorder, *preprocessCursorManager)
func TestOpCommandFromPcapFileLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -57,6 +59,7 @@ func TestOpCommandFromPcapFileLiveDB(t *testing.T) {
}
func TestWireCompression(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
pcapFname := "compressed.pcap"
var verifier = func(t *testing.T, session *mgo.Session, statRecorder *BufferedStatRecorder, cursorMap *preprocessCursorManager) {
opsSeen := len(statRecorder.Buffer)
@@ -75,6 +78,7 @@ func TestWireCompression(t *testing.T) {
}
func TestSingleChannelGetMoreLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
pcapFname := "getmore_single_channel.pcap"
var verifier = func(t *testing.T, session *mgo.Session, statRecorder *BufferedStatRecorder, cursorMap *preprocessCursorManager) {
getMoresSeen := 0
@@ -101,6 +105,7 @@ func TestSingleChannelGetMoreLiveDB(t *testing.T) {
}
func TestMultiChannelGetMoreLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
pcapFname := "getmore_multi_channel.pcap"
var verifier = func(t *testing.T, session *mgo.Session, statRecorder *BufferedStatRecorder, cursorMap *preprocessCursorManager) {
@@ -134,6 +139,7 @@ func TestMultiChannelGetMoreLiveDB(t *testing.T) {
}
func TestRecordEOF(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
pcapFile := "testPcap/workload_with_EOF.pcap"
if _, err := os.Stat(pcapFile); err != nil {
@@ -195,6 +201,7 @@ func playbackFileFromPcap(pcapFname, playbackFname string) error {
}
func pcapTestHelper(t *testing.T, pcapFname string, preprocess bool, verifier verifyFunc) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
pcapFile := "mongoreplay/testPcap/" + pcapFname
if _, err := os.Stat(pcapFile); err != nil {
t.Skipf("pcap file %v not present, skipping test", pcapFile)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_livedb_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_livedb_test.go
index e56a526a368..ba3f367c0ac 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_livedb_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_livedb_test.go
@@ -15,6 +15,7 @@ import (
mgo "github.com/10gen/llmgo"
"github.com/10gen/llmgo/bson"
+ "github.com/mongodb/mongo-tools/common/testtype"
)
const (
@@ -112,6 +113,9 @@ func getPrimaryPort(session *mgo.Session) (string, error) {
}
func TestMain(m *testing.M) {
+ if !testtype.HasTestType(testtype.MongoReplayTestType) {
+ os.Exit(0)
+ }
err := setConnectionURL()
if err != nil {
panic(err)
@@ -131,6 +135,7 @@ func TestMain(m *testing.M) {
// completed. It then checks its BufferedStatCollector to ensure the inserts
// match what we expected
func TestOpInsertLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -229,6 +234,7 @@ func TestOpInsertLiveDB(t *testing.T) {
// verify they were completed. It then checks its BufferedStatCollector to
// ensure the update matches what we expected.
func TestUpdateOpLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -345,6 +351,7 @@ func TestUpdateOpLiveDB(t *testing.T) {
// It generates inserts and queries and sends them to the main execution of mongoreplay.
// TestQueryOp then examines a BufferedStatCollector to ensure the queries executed as expected
func TestQueryOpLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -429,6 +436,7 @@ func TestQueryOpLiveDB(t *testing.T) {
// based on the original query. It then Uses a BufferedStatCollector to ensure
// the getmores executed as expected
func TestOpGetMoreLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -457,6 +465,7 @@ func TestOpGetMoreLiveDB(t *testing.T) {
// BufferedStatCollector to ensure that each getmore played against the database
// is executed and receives the response expected
func TestOpGetMoreMultiCursorLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -576,6 +585,7 @@ func TestOpGetMoreMultiCursorLiveDB(t *testing.T) {
// ensure that each killcursors played against the database is executed and
// receives the response expected
func TestOpKillCursorsLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -696,6 +706,7 @@ func TestOpKillCursorsLiveDB(t *testing.T) {
}
}
func TestCommandOpInsertLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -782,6 +793,7 @@ func TestCommandOpInsertLiveDB(t *testing.T) {
}
func TestCommandOpFindLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -870,6 +882,7 @@ func TestCommandOpFindLiveDB(t *testing.T) {
}
func TestCommandOpGetMoreLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if isMongosTestServer {
t.Skipf("Skipping OpCommand test against mongos")
}
@@ -902,6 +915,7 @@ func TestCommandOpGetMoreLiveDB(t *testing.T) {
// completed. It then checks its BufferedStatCollector to ensure the inserts
// match what we expected
func TestMsgOpInsertLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -983,6 +997,7 @@ func TestMsgOpInsertLiveDB(t *testing.T) {
}
func TestMsgOpGetMoreLiveDB(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
if err := teardownDB(); err != nil {
t.Error(err)
}
@@ -1028,6 +1043,7 @@ func getmoreTestHelper(t *testing.T,
getmoreFunc getmoreGeneratorFunc,
replyFunc replyGeneratorFunc,
findFunc findGeneratorFunc) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
var requestID int32 = 2
numInserts := 20
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_test.go
index 6a8237faf87..5fd3e3a04e6 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongoreplay/play_test.go
@@ -11,9 +11,12 @@ import (
"io"
"testing"
"time"
+
+ "github.com/mongodb/mongo-tools/common/testtype"
)
func TestRepeatGeneration(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
recOp := &RecordedOp{
Seen: &PreciseTime{time.Now()},
}
@@ -67,6 +70,7 @@ func TestRepeatGeneration(t *testing.T) {
}
func TestPlayOpEOF(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.MongoReplayTestType)
ops := []RecordedOp{{
Seen: &PreciseTime{time.Now()},
}, {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath.go
index 1ff7c8e4e0a..1db7186b3d8 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath.go
@@ -360,7 +360,7 @@ func (restore *MongoRestore) CreateIntentsForDB(db string, dir archive.DirLike)
// Server versions >= 3.0.3 disallow user inserts to system.profile so
// it would likely fail anyway.
if collection == "system.profile" {
- log.Logvf(log.DebugLow, "skipping restore of system.profile collection", db)
+ log.Logvf(log.DebugLow, "skipping restore of system.profile collection in %v", db)
skip = true
}
// skip restoring the indexes collection if we are using metadata
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath_test.go
index ff666dc263b..88248e8f72b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/filepath_test.go
@@ -62,7 +62,7 @@ func TestCreateAllIntents(t *testing.T) {
var mr *MongoRestore
var buff bytes.Buffer
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a test MongoRestore", t, func() {
mr = newMongoRestore()
@@ -126,7 +126,7 @@ func TestCreateIntentsForDB(t *testing.T) {
var mr *MongoRestore
var buff bytes.Buffer
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a test MongoRestore", t, func() {
mr = newMongoRestore()
@@ -174,6 +174,7 @@ func TestCreateIntentsForDB(t *testing.T) {
}
func TestCreateIntentsRenamed(t *testing.T) {
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a test MongoRestore", t, func() {
mr := newMongoRestore()
mr.renamer, _ = ns.NewRenamer([]string{"db1.*"}, []string{"db4.test.*"})
@@ -209,7 +210,7 @@ func TestCreateIntentsRenamed(t *testing.T) {
func TestHandlingBSON(t *testing.T) {
var mr *MongoRestore
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a test MongoRestore", t, func() {
mr = newMongoRestore()
@@ -249,7 +250,7 @@ func TestCreateIntentsForCollection(t *testing.T) {
var mr *MongoRestore
var buff bytes.Buffer
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a test MongoRestore", t, func() {
buff = bytes.Buffer{}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/metadata_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/metadata_test.go
index c0d073c6e13..c5bc34b5624 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/metadata_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/metadata_test.go
@@ -21,7 +21,7 @@ const ExistsDB = "restore_collection_exists"
func TestCollectionExists(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
_, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
@@ -82,7 +82,7 @@ func TestCollectionExists(t *testing.T) {
func TestGetDumpAuthVersion(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
restore := &MongoRestore{}
Convey("With a test mongorestore", t, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_archive_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_archive_test.go
index 4896c06a236..cddc14d01a1 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_archive_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_archive_test.go
@@ -34,7 +34,7 @@ var (
)
func TestMongorestoreShortArchive(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
_, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
@@ -90,7 +90,7 @@ func TestMongorestoreShortArchive(t *testing.T) {
}
func TestMongorestoreArchiveWithOplog(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
_, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_test.go
index bba951e4e58..09d02e41b87 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/mongorestore_test.go
@@ -33,7 +33,7 @@ var (
)
func TestMongorestore(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
_, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
@@ -89,7 +89,7 @@ func TestMongorestore(t *testing.T) {
}
func TestMongorestoreCantPreserveUUID(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
session, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
@@ -132,7 +132,7 @@ func TestMongorestoreCantPreserveUUID(t *testing.T) {
}
func TestMongorestorePreserveUUID(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
session, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/ns/ns_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/ns/ns_test.go
index df338440856..ae84f66a1cd 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/ns/ns_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/ns/ns_test.go
@@ -23,7 +23,7 @@ func init() {
}
func TestEscape(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("with a few strings", t, func() {
So(Escape("(blah)"), ShouldEqual, "(blah)")
@@ -34,7 +34,7 @@ func TestEscape(t *testing.T) {
}
func TestUnescape(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("with a few escaped strings", t, func() {
So(Unescape("(blah)"), ShouldEqual, "(blah)")
@@ -45,7 +45,7 @@ func TestUnescape(t *testing.T) {
}
func TestReplacer(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("with replacements", t, func() {
Convey(`'$db$.user$$' -> 'test.user$$_$db$', 'pr\*d\.*' -> 'st\*g\\ing.*'`, func() {
@@ -87,7 +87,7 @@ func TestReplacer(t *testing.T) {
}
func TestMatcher(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("with matcher", t, func() {
Convey(`'*.user*', 'pr\*d\.*'`, func() {
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/oplog_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/oplog_test.go
index 770c14beeb8..d35a87918b6 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/oplog_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/oplog_test.go
@@ -20,7 +20,7 @@ import (
func TestTimestampStringParsing(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("Testing some possible timestamp strings:", t, func() {
Convey("123:456 [should pass]", func() {
@@ -75,7 +75,7 @@ func TestTimestampStringParsing(t *testing.T) {
func TestValidOplogLimitChecking(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With a MongoRestore instance with oplogLimit of 5:0", t, func() {
mr := &MongoRestore{
@@ -126,7 +126,7 @@ func TestValidOplogLimitChecking(t *testing.T) {
}
func TestOplogRestore(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
_, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
@@ -185,7 +185,7 @@ func TestOplogRestore(t *testing.T) {
}
func TestOplogRestoreTools2002(t *testing.T) {
- testtype.VerifyTestType(t, testtype.IntegrationTestType)
+ testtype.SkipUnlessTestType(t, testtype.IntegrationTestType)
_, err := testutil.GetBareSession()
if err != nil {
t.Fatalf("No server available")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/options_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/options_test.go
index b41949533a4..4d9fd84e325 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/options_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongorestore/options_test.go
@@ -12,11 +12,14 @@ import (
"github.com/mongodb/mongo-tools/common/db"
"github.com/mongodb/mongo-tools/common/options"
+ "github.com/mongodb/mongo-tools/common/testtype"
. "github.com/smartystreets/goconvey/convey"
)
// Regression test for TOOLS-1741
func TestWriteConcernWithURIParsing(t *testing.T) {
+
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
Convey("With an IngestOptions and ToolsOptions", t, func() {
// create an 'EnabledOptions' to determine what options should be able to be
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongostat/mongostat_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongostat/mongostat_test.go
index f47ef2b267c..b589b6ce138 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongostat/mongostat_test.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/mongostat/mongostat_test.go
@@ -33,7 +33,7 @@ func readBSONFile(file string, t *testing.T) (stat *status.ServerStatus) {
}
func TestStatLine(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
defaultHeaders := make([]string, len(line.CondHeaders))
for i, h := range line.CondHeaders {
@@ -103,7 +103,7 @@ func TestStatLine(t *testing.T) {
}
func TestIsMongos(t *testing.T) {
- testtype.VerifyTestType(t, testtype.UnitTestType)
+ testtype.SkipUnlessTestType(t, testtype.UnitTestType)
runCheck := func(process string) bool {
return status.IsMongos(&status.ServerStatus{
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/runTests.sh b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/runTests.sh
new file mode 100755
index 00000000000..59a8458ab52
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/runTests.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+tags=""
+if [ ! -z "$1" ]
+ then
+ tags="$@"
+fi
+
+# make sure we're in the directory where the script lives
+SCRIPT_DIR="$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)"
+cd $SCRIPT_DIR
+OUTPUT_DIR="$SCRIPT_DIR/testing_output"
+mkdir -p "$OUTPUT_DIR"
+
+. ./set_goenv.sh
+set_goenv || exit
+
+# remove stale packages
+rm -rf vendor/pkg
+
+# build binaries for any tests that expect them for blackbox testing
+./build.sh $tags
+ec=0
+
+# Run all tests depending on what flags are set in the environment
+# TODO: mongotop needs a test
+# Note: Does not test mongoreplay
+for i in common/db common/archive common/bsonutil common/db/tlsgo common/failpoint common/intents common/json common/log common/options common/progress common/text common/util mongostat mongofiles mongoexport mongoimport mongorestore mongodump mongotop bsondump ; do
+ echo "Testing ${i}..."
+ COMMON_SUBPKG=$(basename $i)
+ COVERAGE_ARGS="";
+ if [ "$RUN_COVERAGE" == "true" ]; then
+ export COVERAGE_ARGS="-coverprofile=coverage_$COMMON_SUBPKG.out"
+ fi
+ if [ "$ON_EVERGREEN" = "true" ]; then
+ (cd $i && go test -ldflags "$(print_ldflags)" -tags "$(print_tags $tags $TOOLS_BUILD_TAGS)" "$COVERAGE_ARGS" > "$OUTPUT_DIR/$COMMON_SUBPKG.suite")
+ exitcode=$?
+ cat "$OUTPUT_DIR/$COMMON_SUBPKG.suite"
+ # Evergreen looks for test files here
+ cp "$OUTPUT_DIR/$COMMON_SUBPKG.suite" "$SCRIPT_DIR"
+ else
+ (cd $i && go test -ldflags "$(print_ldflags)" "$(print_tags $tags)" "$COVERAGE_ARGS" )
+ exitcode=$?
+ fi
+ if [ $exitcode -ne 0 ]; then
+ echo "Error testing $i"
+ ec=1
+ fi
+done
+
+if [ -t /dev/stdin ]; then
+ stty sane
+fi
+
+exit $ec
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/set_goenv.sh b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/set_goenv.sh
index 348a131d86a..66ecf7fcb20 100755
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/set_goenv.sh
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/set_goenv.sh
@@ -11,16 +11,27 @@ set_goenv() {
UNAME_S=$(PATH="/usr/bin:/bin" uname -s)
case $UNAME_S in
CYGWIN*)
- PREF_GOROOT="c:/golang/go1.10"
- PREF_PATH="/cygdrive/c/golang/go1.10/bin:/cygdrive/c/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin:$PATH"
+ PREF_GOROOT="c:/golang/go1.11"
+ PREF_PATH="/cygdrive/c/golang/go1.11/bin:/cygdrive/c/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin:$PATH"
;;
*)
- PREF_GOROOT="/opt/golang/go1.10"
+ PREF_GOROOT="/opt/golang/go1.11"
# XXX might not need mongodbtoolchain anymore
PREF_PATH="$PREF_GOROOT/bin:/opt/mongodbtoolchain/v2/bin/:$PATH"
;;
esac
+ # Set OS-level compilation flags
+ case $UNAME_S in
+ 'CYGWIN*')
+ export CGO_CFLAGS="-D_WIN32_WINNT=0x0601 -DNTDDI_VERSION=0x06010000"
+ ;;
+ 'Darwin')
+ export CGO_CFLAGS="-mmacosx-version-min=10.11"
+ export CGO_LDFLAGS="-mmacosx-version-min=10.11"
+ ;;
+ esac
+
# XXX Setting the compiler might not be necessary anymore now that we're
# using standard Go toolchain and if we don't put mongodbtoolchain into the
# path. But if we need to keep mongodbtoolchain for other tools (eg. python),
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test.sh b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test.sh
index 57601981d3a..3a40d79261b 100755
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test.sh
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/test.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-set -o errexit
+
tags=""
if [ ! -z "$1" ]
then
@@ -10,39 +10,10 @@ fi
SCRIPT_DIR="$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)"
cd $SCRIPT_DIR
-. ./set_goenv.sh
-set_goenv || exit
-
-# remove stale packages
-rm -rf vendor/pkg
-
-# build binaries for any tests that expect them for blackbox testing
-./build.sh $tags
-
-ec=0
-
-# common can't recurse because we need different flags for different packages
-
-# Test common/db with test type flags
-for i in common/db; do
- echo "Testing ${i}..."
- (go test -ldflags "$(print_ldflags)" -tags "$(print_tags $tags)" ./$i -test.types=unit,integration) || { echo "Error testing $i"; ec=1; }
-done
-
-for i in common/db mongostat mongofiles mongoexport mongoimport mongorestore mongodump mongotop; do
- echo "Testing ${i}..."
- (cd $i && go test -ldflags "$(print_ldflags)" -tags "$(print_tags $tags)" ./... -test.types=unit,integration) || { echo "Error testing $i"; ec=1; }
-done
-
-# These don't support the test.types flag
-common_with_test=$(find common -iname '*_test.go' | xargs -I % dirname % | sort -u | grep -v 'common/db')
-for i in bsondump mongoreplay $common_with_test; do
- echo "Testing ${i}..."
- (cd $i && go test -ldflags "$(print_ldflags)" -tags "$(print_tags $tags)" . ) || { echo "Error testing $i"; ec=1; }
-done
-
-if [ -t /dev/stdin ]; then
- stty sane
-fi
+export COVERAGE_ARGS=""
-exit $ec
+export TOOLS_TESTING_UNIT="true"
+export TOOLS_TESTING_INTEGRATION="true"
+./runTests.sh "$tags"
+ec=$?
+exit "$ec"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor.sh b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor.sh
deleted file mode 100755
index ca7e003fe16..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-
-# To add new directories, after running this tool, manually delete the
-# .git directory in the vended directory before running "git add". Then
-# you can run this tool again to reclone it.
-
-set -eu
-set -x
-set -o errexit
-
-rm -rf vendor
-SCRIPT_DIR="$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)"
-cd $SCRIPT_DIR
-
-set_dependencies() {
- local pids=()
- while read line; do
- local line=`echo $line | sed 's/#.*//;/^\s*$/d' || echo ""`
- [ ! "$line" ] && continue
- line=($line)
- local dest=${line[0]}
- local version=${line[1]}
- if [[ -n ${line[2]:-} ]]; then
- package=${line[2]}
- else
- package=$dest
- fi
-
- local giturl="https://$package"
- local install_path="vendor/$dest"
-
- mkdir -p "$install_path"
-
- git clone $giturl "$install_path"
-
- ( cd $install_path && git checkout "$version" && rm -rf '.git' )
- done < $1
-
- echo ">> All Done"
-}
-
-set_dependencies "Godeps"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/escaper/escaper_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/escaper/escaper_test.go
deleted file mode 100644
index 18a7d02d84d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/escaper/escaper_test.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package escaper
-
-import (
- "strconv"
- "testing"
-)
-
-func TestUnassigned(t *testing.T) {
- esc := New()
- format := "I am 100%% sure this is a tes%t."
- expected := "I am 100% sure this is a test."
- output := esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- } else {
- t.Logf("success: %s", output)
- }
-}
-
-func TestDefaultEscapes(t *testing.T) {
- esc := Default()
-
- // bold, underline, standout
- format := "%Bbold%bs, %Uunderline%us, and %Sstandout%ss."
- expected := "\x1b[1mbold\x1b[22ms, \x1b[4munderline\x1b[24ms, and \x1b[7mstandout\x1b[27ms."
- output := esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- } else {
- t.Logf("success: %s", output)
- }
-
- // colors
- format = "%F{blue}color%f, %K{red}background%k and %F{6}with%f %K{4}numbers%k."
- expected = "\x1b[34mcolor\x1b[39m, \x1b[41mbackground\x1b[49m and \x1b[36mwith\x1b[39m \x1b[44mnumbers\x1b[49m."
- output = esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- t.Fail()
- } else {
- t.Logf("success: %s", output)
- }
-}
-
-func TestCustomEscapes(t *testing.T) {
- format := "my name is %n, and my square is %q{20}."
- expected := "my name is Ben Bitdiddle, and my square is 400."
- name := "Ben Bitdiddle"
- esc := New()
- esc.Register('n', func() string {
- return name
- })
- esc.RegisterArg('q', func(arg string) string {
- i, _ := strconv.Atoi(arg)
- return strconv.Itoa(i * i)
- })
- output := esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- t.Fail()
- } else {
- t.Logf("success: %s", output)
- }
-}
-
-func TestArgumentEscapes(t *testing.T) {
- format := "please echo %e{some %{100%%%} string}"
- expected := "please echo some {100%} string"
- esc := New()
- esc.RegisterArg('e', func(arg string) string {
- return arg
- })
- output := esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- t.Fail()
- } else {
- t.Logf("success: %s", output)
- }
-}
-
-func TestEmptyArgument(t *testing.T) {
- format := "doubling a %d{string}, and an empty one: %d{},%dfoo"
- expected := "doubling a stringstring, and an empty one: ,foo"
- esc := New()
- esc.RegisterArg('d', func(arg string) string {
- return arg + arg
- })
- output := esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- t.Fail()
- } else {
- t.Logf("success: %s", output)
- }
-}
-
-func TestEdge(t *testing.T) {
- format := "foo%a"
- expected := "foobar"
- esc := New()
- esc.RegisterArg('a', func(_ string) string {
- return "bar"
- })
- output := esc.Expand(format)
- if output != expected {
- t.Errorf("expected %s, got %s", expected, output)
- t.Fail()
- } else {
- t.Logf("success: %s", output)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/auth_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/auth_test.go
deleted file mode 100644
index 2361e728033..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/auth_test.go
+++ /dev/null
@@ -1,1163 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo_test
-
-import (
- "crypto/tls"
- "flag"
- "fmt"
- "io/ioutil"
- "net"
- "net/url"
- "os"
- "runtime"
- "sync"
- "time"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
-)
-
-func (s *S) TestAuthLoginDatabase(c *C) {
- // Test both with a normal database and with an authenticated shard.
- for _, addr := range []string{"localhost:40002", "localhost:40203"} {
- session, err := mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- admindb := session.DB("admin")
-
- err = admindb.Login("root", "wrong")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
- }
-}
-
-func (s *S) TestAuthLoginSession(c *C) {
- // Test both with a normal database and with an authenticated shard.
- for _, addr := range []string{"localhost:40002", "localhost:40203"} {
- session, err := mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- cred := mgo.Credential{
- Username: "root",
- Password: "wrong",
- }
- err = session.Login(&cred)
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-
- cred.Password = "rapadura"
-
- err = session.Login(&cred)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
- }
-}
-
-func (s *S) TestAuthLoginLogout(c *C) {
- // Test both with a normal database and with an authenticated shard.
- for _, addr := range []string{"localhost:40002", "localhost:40203"} {
- session, err := mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- // Must have dropped auth from the session too.
- session = session.Copy()
- defer session.Close()
-
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
- }
-}
-
-func (s *S) TestAuthLoginLogoutAll(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session.LogoutAll()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- // Must have dropped auth from the session too.
- session = session.Copy()
- defer session.Close()
-
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-}
-
-func (s *S) TestAuthUpsertUserErrors(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
-
- err = mydb.UpsertUser(&mgo.User{})
- c.Assert(err, ErrorMatches, "user has no Username")
-
- err = mydb.UpsertUser(&mgo.User{Username: "user", Password: "pass", UserSource: "source"})
- c.Assert(err, ErrorMatches, "user has both Password/PasswordHash and UserSource set")
-
- err = mydb.UpsertUser(&mgo.User{Username: "user", Password: "pass", OtherDBRoles: map[string][]mgo.Role{"db": nil}})
- c.Assert(err, ErrorMatches, "user with OtherDBRoles is only supported in the admin or \\$external databases")
-}
-
-func (s *S) TestAuthUpsertUser(c *C) {
- if !s.versionAtLeast(2, 4) {
- c.Skip("UpsertUser only works on 2.4+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
-
- ruser := &mgo.User{
- Username: "myruser",
- Password: "mypass",
- Roles: []mgo.Role{mgo.RoleRead},
- }
- rwuser := &mgo.User{
- Username: "myrwuser",
- Password: "mypass",
- Roles: []mgo.Role{mgo.RoleReadWrite},
- }
-
- err = mydb.UpsertUser(ruser)
- c.Assert(err, IsNil)
- err = mydb.UpsertUser(rwuser)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myruser", "mypass")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- err = mydb.Login("myrwuser", "mypass")
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- myotherdb := session.DB("myotherdb")
-
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- // Test UserSource.
- rwuserother := &mgo.User{
- Username: "myrwuser",
- UserSource: "mydb",
- Roles: []mgo.Role{mgo.RoleRead},
- }
-
- err = myotherdb.UpsertUser(rwuserother)
- if s.versionAtLeast(2, 6) {
- c.Assert(err, ErrorMatches, `MongoDB 2.6\+ does not support the UserSource setting`)
- return
- }
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- // Test indirection via UserSource: we can't write to it, because
- // the roles for myrwuser are different there.
- othercoll := myotherdb.C("myothercoll")
- err = othercoll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // Reading works, though.
- err = othercoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- // Can't login directly into the database using UserSource, though.
- err = myotherdb.Login("myrwuser", "mypass")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-}
-
-func (s *S) TestAuthUpsertUserOtherDBRoles(c *C) {
- if !s.versionAtLeast(2, 4) {
- c.Skip("UpsertUser only works on 2.4+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- ruser := &mgo.User{
- Username: "myruser",
- Password: "mypass",
- OtherDBRoles: map[string][]mgo.Role{"mydb": []mgo.Role{mgo.RoleRead}},
- }
-
- err = admindb.UpsertUser(ruser)
- c.Assert(err, IsNil)
- defer admindb.RemoveUser("myruser")
-
- admindb.Logout()
- err = admindb.Login("myruser", "mypass")
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- err = coll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthUpsertUserUpdates(c *C) {
- if !s.versionAtLeast(2, 4) {
- c.Skip("UpsertUser only works on 2.4+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
-
- // Insert a user that can read.
- user := &mgo.User{
- Username: "myruser",
- Password: "mypass",
- Roles: []mgo.Role{mgo.RoleRead},
- }
- err = mydb.UpsertUser(user)
- c.Assert(err, IsNil)
-
- // Now update the user password.
- user = &mgo.User{
- Username: "myruser",
- Password: "mynewpass",
- }
- err = mydb.UpsertUser(user)
- c.Assert(err, IsNil)
-
- // Login with the new user.
- usession, err := mgo.Dial("myruser:mynewpass@localhost:40002/mydb")
- c.Assert(err, IsNil)
- defer usession.Close()
-
- // Can read, but not write.
- err = usession.DB("mydb").C("mycoll").Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
- err = usession.DB("mydb").C("mycoll").Insert(M{"ok": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // Update the user role.
- user = &mgo.User{
- Username: "myruser",
- Roles: []mgo.Role{mgo.RoleReadWrite},
- }
- err = mydb.UpsertUser(user)
- c.Assert(err, IsNil)
-
- // Dial again to ensure the password hasn't changed.
- usession, err = mgo.Dial("myruser:mynewpass@localhost:40002/mydb")
- c.Assert(err, IsNil)
- defer usession.Close()
-
- // Now it can write.
- err = usession.DB("mydb").C("mycoll").Insert(M{"ok": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthAddUser(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myruser", "mypass", true)
- c.Assert(err, IsNil)
- err = mydb.AddUser("mywuser", "mypass", false)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myruser", "mypass")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- err = mydb.Login("mywuser", "mypass")
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthAddUserReplaces(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "myoldpass", false)
- c.Assert(err, IsNil)
- err = mydb.AddUser("myuser", "mynewpass", true)
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- err = mydb.Login("myuser", "myoldpass")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
- err = mydb.Login("myuser", "mynewpass")
- c.Assert(err, IsNil)
-
- // ReadOnly flag was changed too.
- err = mydb.C("mycoll").Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-}
-
-func (s *S) TestAuthRemoveUser(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "mypass", true)
- c.Assert(err, IsNil)
- err = mydb.RemoveUser("myuser")
- c.Assert(err, IsNil)
- err = mydb.RemoveUser("myuser")
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = mydb.Login("myuser", "mypass")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-}
-
-func (s *S) TestAuthLoginTwiceDoesNothing(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- oldStats := mgo.GetStats()
-
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-}
-
-func (s *S) TestAuthLoginLogoutLoginDoesNothing(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- oldStats := mgo.GetStats()
-
- admindb.Logout()
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-}
-
-func (s *S) TestAuthLoginSwitchUser(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- err = admindb.Login("reader", "rapadura")
- c.Assert(err, IsNil)
-
- // Can't write.
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // But can read.
- result := struct{ N int }{}
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-}
-
-func (s *S) TestAuthLoginChangePassword(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "myoldpass", false)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "myoldpass")
- c.Assert(err, IsNil)
-
- err = mydb.AddUser("myuser", "mynewpass", true)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "mynewpass")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- // The second login must be in effect, which means read-only.
- err = mydb.C("mycoll").Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-}
-
-func (s *S) TestAuthLoginCachingWithSessionRefresh(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session.Refresh()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingWithSessionCopy(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session = session.Copy()
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingWithSessionClone(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session = session.Clone()
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingWithNewSession(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session = session.New()
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-}
-
-func (s *S) TestAuthLoginCachingAcrossPool(c *C) {
- // Logins are cached even when the conenction goes back
- // into the pool.
-
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- // Add another user to test the logout case at the same time.
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "mypass", false)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Logout root explicitly, to test both cases.
- admindb.Logout()
-
- // Give socket back to pool.
- session.Refresh()
-
- // Brand new session, should use socket from the pool.
- other := session.New()
- defer other.Close()
-
- oldStats := mgo.GetStats()
-
- err = other.DB("admin").Login("root", "rapadura")
- c.Assert(err, IsNil)
- err = other.DB("mydb").Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Both logins were cached, so no ops.
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-
- // And they actually worked.
- err = other.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- other.DB("admin").Logout()
-
- err = other.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingAcrossPoolWithLogout(c *C) {
- // Now verify that logouts are properly flushed if they
- // are not revalidated after leaving the pool.
-
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- // Add another user to test the logout case at the same time.
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "mypass", true)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Just some data to query later.
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- // Give socket back to pool.
- session.Refresh()
-
- // Brand new session, should use socket from the pool.
- other := session.New()
- defer other.Close()
-
- oldStats := mgo.GetStats()
-
- err = other.DB("mydb").Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Login was cached, so no ops.
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-
- // Can't write, since root has been implicitly logged out
- // when the collection went into the pool, and not revalidated.
- err = other.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // But can read due to the revalidated myuser login.
- result := struct{ N int }{}
- err = other.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-}
-
-func (s *S) TestAuthEventual(c *C) {
- // Eventual sessions don't keep sockets around, so they are
- // an interesting test case.
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- var wg sync.WaitGroup
- wg.Add(20)
-
- for i := 0; i != 10; i++ {
- go func() {
- defer wg.Done()
- var result struct{ N int }
- err := session.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
- }()
- }
-
- for i := 0; i != 10; i++ {
- go func() {
- defer wg.Done()
- err := session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
- }()
- }
-
- wg.Wait()
-}
-
-func (s *S) TestAuthURL(c *C) {
- session, err := mgo.Dial("mongodb://root:rapadura@localhost:40002/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthURLWrongCredentials(c *C) {
- session, err := mgo.Dial("mongodb://root:wrong@localhost:40002/")
- if session != nil {
- session.Close()
- }
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
- c.Assert(session, IsNil)
-}
-
-func (s *S) TestAuthURLWithNewSession(c *C) {
- // When authentication is in the URL, the new session will
- // actually carry it on as well, even if logged out explicitly.
- session, err := mgo.Dial("mongodb://root:rapadura@localhost:40002/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.DB("admin").Logout()
-
- // Do it twice to ensure it passes the needed data on.
- session = session.New()
- defer session.Close()
- session = session.New()
- defer session.Close()
-
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthURLWithDatabase(c *C) {
- session, err := mgo.Dial("mongodb://root:rapadura@localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myruser", "mypass", true)
- c.Assert(err, IsNil)
-
- // Test once with database, and once with source.
- for i := 0; i < 2; i++ {
- var url string
- if i == 0 {
- url = "mongodb://myruser:mypass@localhost:40002/mydb"
- } else {
- url = "mongodb://myruser:mypass@localhost:40002/admin?authSource=mydb"
- }
- usession, err := mgo.Dial(url)
- c.Assert(err, IsNil)
- defer usession.Close()
-
- ucoll := usession.DB("mydb").C("mycoll")
- err = ucoll.FindId(0).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
- err = ucoll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
- }
-}
-
-func (s *S) TestDefaultDatabase(c *C) {
- tests := []struct{ url, db string }{
- {"mongodb://root:rapadura@localhost:40002", "test"},
- {"mongodb://root:rapadura@localhost:40002/admin", "admin"},
- {"mongodb://localhost:40001", "test"},
- {"mongodb://localhost:40001/", "test"},
- {"mongodb://localhost:40001/mydb", "mydb"},
- }
-
- for _, test := range tests {
- session, err := mgo.Dial(test.url)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("test: %#v", test)
- c.Assert(session.DB("").Name, Equals, test.db)
-
- scopy := session.Copy()
- c.Check(scopy.DB("").Name, Equals, test.db)
- scopy.Close()
- }
-}
-
-func (s *S) TestAuthDirect(c *C) {
- // Direct connections must work to the master and slaves.
- for _, port := range []string{"40031", "40032", "40033"} {
- url := fmt.Sprintf("mongodb://root:rapadura@localhost:%s/?connect=direct", port)
- session, err := mgo.Dial(url)
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- var result struct{}
- err = session.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-}
-
-func (s *S) TestAuthDirectWithLogin(c *C) {
- // Direct connections must work to the master and slaves.
- for _, port := range []string{"40031", "40032", "40033"} {
- url := fmt.Sprintf("mongodb://localhost:%s/?connect=direct", port)
- session, err := mgo.Dial(url)
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
- session.SetSyncTimeout(3 * time.Second)
-
- err = session.DB("admin").Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- var result struct{}
- err = session.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-}
-
-func (s *S) TestAuthScramSha1Cred(c *C) {
- if !s.versionAtLeast(2, 7, 7) {
- c.Skip("SCRAM-SHA-1 tests depend on 2.7.7")
- }
- cred := &mgo.Credential{
- Username: "root",
- Password: "rapadura",
- Mechanism: "SCRAM-SHA-1",
- Source: "admin",
- }
- host := "localhost:40002"
- c.Logf("Connecting to %s...", host)
- session, err := mgo.Dial(host)
- c.Assert(err, IsNil)
- defer session.Close()
-
- mycoll := session.DB("admin").C("mycoll")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthScramSha1URL(c *C) {
- if !s.versionAtLeast(2, 7, 7) {
- c.Skip("SCRAM-SHA-1 tests depend on 2.7.7")
- }
- host := "localhost:40002"
- c.Logf("Connecting to %s...", host)
- session, err := mgo.Dial(fmt.Sprintf("root:rapadura@%s?authMechanism=SCRAM-SHA-1", host))
- c.Assert(err, IsNil)
- defer session.Close()
-
- mycoll := session.DB("admin").C("mycoll")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthX509Cred(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- binfo, err := session.BuildInfo()
- c.Assert(err, IsNil)
- if binfo.OpenSSLVersion == "" {
- c.Skip("server does not support SSL")
- }
-
- clientCertPEM, err := ioutil.ReadFile("testdb/client.pem")
- c.Assert(err, IsNil)
-
- clientCert, err := tls.X509KeyPair(clientCertPEM, clientCertPEM)
- c.Assert(err, IsNil)
-
- tlsConfig := &tls.Config{
- // Isolating tests to client certs, don't care about server validation.
- InsecureSkipVerify: true,
- Certificates: []tls.Certificate{clientCert},
- }
-
- var host = "localhost:40003"
- c.Logf("Connecting to %s...", host)
- session, err = mgo.DialWithInfo(&mgo.DialInfo{
- Addrs: []string{host},
- DialServer: func(addr *mgo.ServerAddr) (net.Conn, error) {
- return tls.Dial("tcp", addr.String(), tlsConfig)
- },
- })
- c.Assert(err, IsNil)
- defer session.Close()
-
- err = session.Login(&mgo.Credential{Username: "root", Password: "rapadura"})
- c.Assert(err, IsNil)
-
- // This needs to be kept in sync with client.pem
- x509Subject := "CN=localhost,OU=Client,O=MGO,L=MGO,ST=MGO,C=GO"
-
- externalDB := session.DB("$external")
- var x509User mgo.User = mgo.User{
- Username: x509Subject,
- OtherDBRoles: map[string][]mgo.Role{"admin": []mgo.Role{mgo.RoleRoot}},
- }
- err = externalDB.UpsertUser(&x509User)
- c.Assert(err, IsNil)
-
- session.LogoutAll()
-
- c.Logf("Connected! Ensuring authentication is required...")
- names, err := session.DatabaseNames()
- c.Assert(err, ErrorMatches, "not authorized .*")
-
- cred := &mgo.Credential{
- Username: x509Subject,
- Mechanism: "MONGODB-X509",
- Source: "$external",
- }
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- names, err = session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(len(names) > 0, Equals, true)
-}
-
-var (
- plainFlag = flag.String("plain", "", "Host to test PLAIN authentication against (depends on custom environment)")
- plainUser = "einstein"
- plainPass = "password"
-)
-
-func (s *S) TestAuthPlainCred(c *C) {
- if *plainFlag == "" {
- c.Skip("no -plain")
- }
- cred := &mgo.Credential{
- Username: plainUser,
- Password: plainPass,
- Source: "$external",
- Mechanism: "PLAIN",
- }
- c.Logf("Connecting to %s...", *plainFlag)
- session, err := mgo.Dial(*plainFlag)
- c.Assert(err, IsNil)
- defer session.Close()
-
- records := session.DB("records").C("records")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = records.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = records.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthPlainURL(c *C) {
- if *plainFlag == "" {
- c.Skip("no -plain")
- }
- c.Logf("Connecting to %s...", *plainFlag)
- session, err := mgo.Dial(fmt.Sprintf("%s:%s@%s?authMechanism=PLAIN", url.QueryEscape(plainUser), url.QueryEscape(plainPass), *plainFlag))
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Connected! Testing the need for authentication...")
- err = session.DB("records").C("records").Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-var (
- kerberosFlag = flag.Bool("kerberos", false, "Test Kerberos authentication (depends on custom environment)")
- kerberosHost = "ldaptest.10gen.cc"
- kerberosUser = "drivers@LDAPTEST.10GEN.CC"
-
- winKerberosPasswordEnv = "MGO_KERBEROS_PASSWORD"
-)
-
-// Kerberos has its own suite because it talks to a remote server
-// that is prepared to authenticate against a kerberos deployment.
-type KerberosSuite struct{}
-
-var _ = Suite(&KerberosSuite{})
-
-func (kerberosSuite *KerberosSuite) SetUpSuite(c *C) {
- mgo.SetDebug(true)
- mgo.SetStats(true)
-}
-
-func (kerberosSuite *KerberosSuite) TearDownSuite(c *C) {
- mgo.SetDebug(false)
- mgo.SetStats(false)
-}
-
-func (kerberosSuite *KerberosSuite) SetUpTest(c *C) {
- mgo.SetLogger((*cLogger)(c))
- mgo.ResetStats()
-}
-
-func (kerberosSuite *KerberosSuite) TearDownTest(c *C) {
- mgo.SetLogger(nil)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosCred(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
- cred := &mgo.Credential{
- Username: kerberosUser,
- Mechanism: "GSSAPI",
- }
- windowsAppendPasswordToCredential(cred)
- c.Logf("Connecting to %s...", kerberosHost)
- session, err := mgo.Dial(kerberosHost)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Connected! Testing the need for authentication...")
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, ErrorMatches, ".*authorized.*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- n, err = session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosURL(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
- c.Logf("Connecting to %s...", kerberosHost)
- connectUri := url.QueryEscape(kerberosUser) + "@" + kerberosHost + "?authMechanism=GSSAPI"
- if runtime.GOOS == "windows" {
- connectUri = url.QueryEscape(kerberosUser) + ":" + url.QueryEscape(getWindowsKerberosPassword()) + "@" + kerberosHost + "?authMechanism=GSSAPI"
- }
- session, err := mgo.Dial(connectUri)
- c.Assert(err, IsNil)
- defer session.Close()
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosServiceName(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
-
- wrongServiceName := "wrong"
- rightServiceName := "mongodb"
-
- cred := &mgo.Credential{
- Username: kerberosUser,
- Mechanism: "GSSAPI",
- Service: wrongServiceName,
- }
- windowsAppendPasswordToCredential(cred)
-
- c.Logf("Connecting to %s...", kerberosHost)
- session, err := mgo.Dial(kerberosHost)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Authenticating with incorrect service name...")
- err = session.Login(cred)
- c.Assert(err, ErrorMatches, ".*@LDAPTEST.10GEN.CC not found.*")
-
- cred.Service = rightServiceName
- c.Logf("Authenticating with correct service name...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosServiceHost(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
-
- wrongServiceHost := "eggs.bacon.tk"
- rightServiceHost := kerberosHost
-
- cred := &mgo.Credential{
- Username: kerberosUser,
- Mechanism: "GSSAPI",
- ServiceHost: wrongServiceHost,
- }
- windowsAppendPasswordToCredential(cred)
-
- c.Logf("Connecting to %s...", kerberosHost)
- session, err := mgo.Dial(kerberosHost)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Authenticating with incorrect service host...")
- err = session.Login(cred)
- c.Assert(err, ErrorMatches, ".*@LDAPTEST.10GEN.CC not found.*")
-
- cred.ServiceHost = rightServiceHost
- c.Logf("Authenticating with correct service host...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-// No kinit on SSPI-style Kerberos, so we need to provide a password. In order
-// to avoid inlining password, require it to be set as an environment variable,
-// for instance: `SET MGO_KERBEROS_PASSWORD=this_isnt_the_password`
-func getWindowsKerberosPassword() string {
- pw := os.Getenv(winKerberosPasswordEnv)
- if pw == "" {
- panic(fmt.Sprintf("Need to set %v environment variable to run Kerberos tests on Windows", winKerberosPasswordEnv))
- }
- return pw
-}
-
-func windowsAppendPasswordToCredential(cred *mgo.Credential) {
- if runtime.GOOS == "windows" {
- cred.Password = getWindowsKerberosPassword()
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/bson_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/bson_test.go
deleted file mode 100644
index 8b396102c4f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/bson_test.go
+++ /dev/null
@@ -1,1675 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package bson_test
-
-import (
- "encoding/binary"
- "encoding/hex"
- "encoding/json"
- "errors"
- "net/url"
- "reflect"
- "strings"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2/bson"
- "gopkg.in/yaml.v2"
-)
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct{}
-
-var _ = Suite(&S{})
-
-// Wrap up the document elements contained in data, prepending the int32
-// length of the data, and appending the '\x00' value closing the document.
-func wrapInDoc(data string) string {
- result := make([]byte, len(data)+5)
- binary.LittleEndian.PutUint32(result, uint32(len(result)))
- copy(result[4:], []byte(data))
- return string(result)
-}
-
-func makeZeroDoc(value interface{}) (zero interface{}) {
- v := reflect.ValueOf(value)
- t := v.Type()
- switch t.Kind() {
- case reflect.Map:
- mv := reflect.MakeMap(t)
- zero = mv.Interface()
- case reflect.Ptr:
- pv := reflect.New(v.Type().Elem())
- zero = pv.Interface()
- case reflect.Slice, reflect.Int:
- zero = reflect.New(t).Interface()
- default:
- panic("unsupported doc type")
- }
- return zero
-}
-
-func testUnmarshal(c *C, data string, obj interface{}) {
- zero := makeZeroDoc(obj)
- err := bson.Unmarshal([]byte(data), zero)
- c.Assert(err, IsNil)
- c.Assert(zero, DeepEquals, obj)
-}
-
-type testItemType struct {
- obj interface{}
- data string
-}
-
-// --------------------------------------------------------------------------
-// Samples from bsonspec.org:
-
-var sampleItems = []testItemType{
- {bson.M{"hello": "world"},
- "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"},
- {bson.M{"BSON": []interface{}{"awesome", float64(5.05), 1986}},
- "1\x00\x00\x00\x04BSON\x00&\x00\x00\x00\x020\x00\x08\x00\x00\x00" +
- "awesome\x00\x011\x00333333\x14@\x102\x00\xc2\x07\x00\x00\x00\x00"},
-}
-
-func (s *S) TestMarshalSampleItems(c *C) {
- for i, item := range sampleItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, item.data, Commentf("Failed on item %d", i))
- }
-}
-
-func (s *S) TestUnmarshalSampleItems(c *C) {
- for i, item := range sampleItems {
- value := bson.M{}
- err := bson.Unmarshal([]byte(item.data), value)
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, item.obj, Commentf("Failed on item %d", i))
- }
-}
-
-// --------------------------------------------------------------------------
-// Every type, ordered by the type flag. These are not wrapped with the
-// length and last \x00 from the document. wrapInDoc() computes them.
-// Note that all of them should be supported as two-way conversions.
-
-var allItems = []testItemType{
- {bson.M{},
- ""},
- {bson.M{"_": float64(5.05)},
- "\x01_\x00333333\x14@"},
- {bson.M{"_": "yo"},
- "\x02_\x00\x03\x00\x00\x00yo\x00"},
- {bson.M{"_": bson.M{"a": true}},
- "\x03_\x00\x09\x00\x00\x00\x08a\x00\x01\x00"},
- {bson.M{"_": []interface{}{true, false}},
- "\x04_\x00\r\x00\x00\x00\x080\x00\x01\x081\x00\x00\x00"},
- {bson.M{"_": []byte("yo")},
- "\x05_\x00\x02\x00\x00\x00\x00yo"},
- {bson.M{"_": bson.Binary{0x80, []byte("udef")}},
- "\x05_\x00\x04\x00\x00\x00\x80udef"},
- {bson.M{"_": bson.Undefined}, // Obsolete, but still seen in the wild.
- "\x06_\x00"},
- {bson.M{"_": bson.ObjectId("0123456789ab")},
- "\x07_\x000123456789ab"},
- {bson.M{"_": bson.DBPointer{"testnamespace", bson.ObjectId("0123456789ab")}},
- "\x0C_\x00\x0e\x00\x00\x00testnamespace\x000123456789ab"},
- {bson.M{"_": false},
- "\x08_\x00\x00"},
- {bson.M{"_": true},
- "\x08_\x00\x01"},
- {bson.M{"_": time.Unix(0, 258e6)}, // Note the NS <=> MS conversion.
- "\x09_\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"_": nil},
- "\x0A_\x00"},
- {bson.M{"_": bson.RegEx{"ab", "cd"}},
- "\x0B_\x00ab\x00cd\x00"},
- {bson.M{"_": bson.JavaScript{"code", nil}},
- "\x0D_\x00\x05\x00\x00\x00code\x00"},
- {bson.M{"_": bson.Symbol("sym")},
- "\x0E_\x00\x04\x00\x00\x00sym\x00"},
- {bson.M{"_": bson.JavaScript{"code", bson.M{"": nil}}},
- "\x0F_\x00\x14\x00\x00\x00\x05\x00\x00\x00code\x00" +
- "\x07\x00\x00\x00\x0A\x00\x00"},
- {bson.M{"_": 258},
- "\x10_\x00\x02\x01\x00\x00"},
- {bson.M{"_": bson.MongoTimestamp(258)},
- "\x11_\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"_": int64(258)},
- "\x12_\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"_": int64(258 << 32)},
- "\x12_\x00\x00\x00\x00\x00\x02\x01\x00\x00"},
- {bson.M{"_": bson.MaxKey},
- "\x7F_\x00"},
- {bson.M{"_": bson.MinKey},
- "\xFF_\x00"},
-}
-
-func (s *S) TestMarshalAllItems(c *C) {
- for i, item := range allItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data), Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalAllItems(c *C) {
- for i, item := range allItems {
- value := bson.M{}
- err := bson.Unmarshal([]byte(wrapInDoc(item.data)), value)
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, item.obj, Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalRawAllItems(c *C) {
- for i, item := range allItems {
- if len(item.data) == 0 {
- continue
- }
- value := item.obj.(bson.M)["_"]
- if value == nil {
- continue
- }
- pv := reflect.New(reflect.ValueOf(value).Type())
- raw := bson.Raw{item.data[0], []byte(item.data[3:])}
- c.Logf("Unmarshal raw: %#v, %#v", raw, pv.Interface())
- err := raw.Unmarshal(pv.Interface())
- c.Assert(err, IsNil)
- c.Assert(pv.Elem().Interface(), DeepEquals, value, Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalRawIncompatible(c *C) {
- raw := bson.Raw{0x08, []byte{0x01}} // true
- err := raw.Unmarshal(&struct{}{})
- c.Assert(err, ErrorMatches, "BSON kind 0x08 isn't compatible with type struct \\{\\}")
-}
-
-func (s *S) TestUnmarshalZeroesStruct(c *C) {
- data, err := bson.Marshal(bson.M{"b": 2})
- c.Assert(err, IsNil)
- type T struct{ A, B int }
- v := T{A: 1}
- err = bson.Unmarshal(data, &v)
- c.Assert(err, IsNil)
- c.Assert(v.A, Equals, 0)
- c.Assert(v.B, Equals, 2)
-}
-
-func (s *S) TestUnmarshalZeroesMap(c *C) {
- data, err := bson.Marshal(bson.M{"b": 2})
- c.Assert(err, IsNil)
- m := bson.M{"a": 1}
- err = bson.Unmarshal(data, &m)
- c.Assert(err, IsNil)
- c.Assert(m, DeepEquals, bson.M{"b": 2})
-}
-
-func (s *S) TestUnmarshalNonNilInterface(c *C) {
- data, err := bson.Marshal(bson.M{"b": 2})
- c.Assert(err, IsNil)
- m := bson.M{"a": 1}
- var i interface{}
- i = m
- err = bson.Unmarshal(data, &i)
- c.Assert(err, IsNil)
- c.Assert(i, DeepEquals, bson.M{"b": 2})
- c.Assert(m, DeepEquals, bson.M{"a": 1})
-}
-
-// --------------------------------------------------------------------------
-// Some one way marshaling operations which would unmarshal differently.
-
-var oneWayMarshalItems = []testItemType{
- // These are being passed as pointers, and will unmarshal as values.
- {bson.M{"": &bson.Binary{0x02, []byte("old")}},
- "\x05\x00\x07\x00\x00\x00\x02\x03\x00\x00\x00old"},
- {bson.M{"": &bson.Binary{0x80, []byte("udef")}},
- "\x05\x00\x04\x00\x00\x00\x80udef"},
- {bson.M{"": &bson.RegEx{"ab", "cd"}},
- "\x0B\x00ab\x00cd\x00"},
- {bson.M{"": &bson.JavaScript{"code", nil}},
- "\x0D\x00\x05\x00\x00\x00code\x00"},
- {bson.M{"": &bson.JavaScript{"code", bson.M{"": nil}}},
- "\x0F\x00\x14\x00\x00\x00\x05\x00\x00\x00code\x00" +
- "\x07\x00\x00\x00\x0A\x00\x00"},
-
- // There's no float32 type in BSON. Will encode as a float64.
- {bson.M{"": float32(5.05)},
- "\x01\x00\x00\x00\x00@33\x14@"},
-
- // The array will be unmarshaled as a slice instead.
- {bson.M{"": [2]bool{true, false}},
- "\x04\x00\r\x00\x00\x00\x080\x00\x01\x081\x00\x00\x00"},
-
- // The typed slice will be unmarshaled as []interface{}.
- {bson.M{"": []bool{true, false}},
- "\x04\x00\r\x00\x00\x00\x080\x00\x01\x081\x00\x00\x00"},
-
- // Will unmarshal as a []byte.
- {bson.M{"": bson.Binary{0x00, []byte("yo")}},
- "\x05\x00\x02\x00\x00\x00\x00yo"},
- {bson.M{"": bson.Binary{0x02, []byte("old")}},
- "\x05\x00\x07\x00\x00\x00\x02\x03\x00\x00\x00old"},
-
- // No way to preserve the type information here. We might encode as a zero
- // value, but this would mean that pointer values in structs wouldn't be
- // able to correctly distinguish between unset and set to the zero value.
- {bson.M{"": (*byte)(nil)},
- "\x0A\x00"},
-
- // No int types smaller than int32 in BSON. Could encode this as a char,
- // but it would still be ambiguous, take more, and be awkward in Go when
- // loaded without typing information.
- {bson.M{"": byte(8)},
- "\x10\x00\x08\x00\x00\x00"},
-
- // There are no unsigned types in BSON. Will unmarshal as int32 or int64.
- {bson.M{"": uint32(258)},
- "\x10\x00\x02\x01\x00\x00"},
- {bson.M{"": uint64(258)},
- "\x12\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"": uint64(258 << 32)},
- "\x12\x00\x00\x00\x00\x00\x02\x01\x00\x00"},
-
- // This will unmarshal as int.
- {bson.M{"": int32(258)},
- "\x10\x00\x02\x01\x00\x00"},
-
- // That's a special case. The unsigned value is too large for an int32,
- // so an int64 is used instead.
- {bson.M{"": uint32(1<<32 - 1)},
- "\x12\x00\xFF\xFF\xFF\xFF\x00\x00\x00\x00"},
- {bson.M{"": uint(1<<32 - 1)},
- "\x12\x00\xFF\xFF\xFF\xFF\x00\x00\x00\x00"},
-}
-
-func (s *S) TestOneWayMarshalItems(c *C) {
- for i, item := range oneWayMarshalItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data),
- Commentf("Failed on item %d", i))
- }
-}
-
-// --------------------------------------------------------------------------
-// Two-way tests for user-defined structures using the samples
-// from bsonspec.org.
-
-type specSample1 struct {
- Hello string
-}
-
-type specSample2 struct {
- BSON []interface{} "BSON"
-}
-
-var structSampleItems = []testItemType{
- {&specSample1{"world"},
- "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"},
- {&specSample2{[]interface{}{"awesome", float64(5.05), 1986}},
- "1\x00\x00\x00\x04BSON\x00&\x00\x00\x00\x020\x00\x08\x00\x00\x00" +
- "awesome\x00\x011\x00333333\x14@\x102\x00\xc2\x07\x00\x00\x00\x00"},
-}
-
-func (s *S) TestMarshalStructSampleItems(c *C) {
- for i, item := range structSampleItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, item.data,
- Commentf("Failed on item %d", i))
- }
-}
-
-func (s *S) TestUnmarshalStructSampleItems(c *C) {
- for _, item := range structSampleItems {
- testUnmarshal(c, item.data, item.obj)
- }
-}
-
-func (s *S) Test64bitInt(c *C) {
- var i int64 = (1 << 31)
- if int(i) > 0 {
- data, err := bson.Marshal(bson.M{"i": int(i)})
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc("\x12i\x00\x00\x00\x00\x80\x00\x00\x00\x00"))
-
- var result struct{ I int }
- err = bson.Unmarshal(data, &result)
- c.Assert(err, IsNil)
- c.Assert(int64(result.I), Equals, i)
- }
-}
-
-// --------------------------------------------------------------------------
-// Generic two-way struct marshaling tests.
-
-var bytevar = byte(8)
-var byteptr = &bytevar
-
-var structItems = []testItemType{
- {&struct{ Ptr *byte }{nil},
- "\x0Aptr\x00"},
- {&struct{ Ptr *byte }{&bytevar},
- "\x10ptr\x00\x08\x00\x00\x00"},
- {&struct{ Ptr **byte }{&byteptr},
- "\x10ptr\x00\x08\x00\x00\x00"},
- {&struct{ Byte byte }{8},
- "\x10byte\x00\x08\x00\x00\x00"},
- {&struct{ Byte byte }{0},
- "\x10byte\x00\x00\x00\x00\x00"},
- {&struct {
- V byte "Tag"
- }{8},
- "\x10Tag\x00\x08\x00\x00\x00"},
- {&struct {
- V *struct {
- Byte byte
- }
- }{&struct{ Byte byte }{8}},
- "\x03v\x00" + "\x0f\x00\x00\x00\x10byte\x00\b\x00\x00\x00\x00"},
- {&struct{ priv byte }{}, ""},
-
- // The order of the dumped fields should be the same in the struct.
- {&struct{ A, C, B, D, F, E *byte }{},
- "\x0Aa\x00\x0Ac\x00\x0Ab\x00\x0Ad\x00\x0Af\x00\x0Ae\x00"},
-
- {&struct{ V bson.Raw }{bson.Raw{0x03, []byte("\x0f\x00\x00\x00\x10byte\x00\b\x00\x00\x00\x00")}},
- "\x03v\x00" + "\x0f\x00\x00\x00\x10byte\x00\b\x00\x00\x00\x00"},
- {&struct{ V bson.Raw }{bson.Raw{0x10, []byte("\x00\x00\x00\x00")}},
- "\x10v\x00" + "\x00\x00\x00\x00"},
-
- // Byte arrays.
- {&struct{ V [2]byte }{[2]byte{'y', 'o'}},
- "\x05v\x00\x02\x00\x00\x00\x00yo"},
-}
-
-func (s *S) TestMarshalStructItems(c *C) {
- for i, item := range structItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data),
- Commentf("Failed on item %d", i))
- }
-}
-
-func (s *S) TestUnmarshalStructItems(c *C) {
- for _, item := range structItems {
- testUnmarshal(c, wrapInDoc(item.data), item.obj)
- }
-}
-
-func (s *S) TestUnmarshalRawStructItems(c *C) {
- for i, item := range structItems {
- raw := bson.Raw{0x03, []byte(wrapInDoc(item.data))}
- zero := makeZeroDoc(item.obj)
- err := raw.Unmarshal(zero)
- c.Assert(err, IsNil)
- c.Assert(zero, DeepEquals, item.obj, Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalRawNil(c *C) {
- // Regression test: shouldn't try to nil out the pointer itself,
- // as it's not settable.
- raw := bson.Raw{0x0A, []byte{}}
- err := raw.Unmarshal(&struct{}{})
- c.Assert(err, IsNil)
-}
-
-// --------------------------------------------------------------------------
-// One-way marshaling tests.
-
-type dOnIface struct {
- D interface{}
-}
-
-type ignoreField struct {
- Before string
- Ignore string `bson:"-"`
- After string
-}
-
-var marshalItems = []testItemType{
- // Ordered document dump. Will unmarshal as a dictionary by default.
- {bson.D{{"a", nil}, {"c", nil}, {"b", nil}, {"d", nil}, {"f", nil}, {"e", true}},
- "\x0Aa\x00\x0Ac\x00\x0Ab\x00\x0Ad\x00\x0Af\x00\x08e\x00\x01"},
- {MyD{{"a", nil}, {"c", nil}, {"b", nil}, {"d", nil}, {"f", nil}, {"e", true}},
- "\x0Aa\x00\x0Ac\x00\x0Ab\x00\x0Ad\x00\x0Af\x00\x08e\x00\x01"},
- {&dOnIface{bson.D{{"a", nil}, {"c", nil}, {"b", nil}, {"d", true}}},
- "\x03d\x00" + wrapInDoc("\x0Aa\x00\x0Ac\x00\x0Ab\x00\x08d\x00\x01")},
-
- {bson.RawD{{"a", bson.Raw{0x0A, nil}}, {"c", bson.Raw{0x0A, nil}}, {"b", bson.Raw{0x08, []byte{0x01}}}},
- "\x0Aa\x00" + "\x0Ac\x00" + "\x08b\x00\x01"},
- {MyRawD{{"a", bson.Raw{0x0A, nil}}, {"c", bson.Raw{0x0A, nil}}, {"b", bson.Raw{0x08, []byte{0x01}}}},
- "\x0Aa\x00" + "\x0Ac\x00" + "\x08b\x00\x01"},
- {&dOnIface{bson.RawD{{"a", bson.Raw{0x0A, nil}}, {"c", bson.Raw{0x0A, nil}}, {"b", bson.Raw{0x08, []byte{0x01}}}}},
- "\x03d\x00" + wrapInDoc("\x0Aa\x00"+"\x0Ac\x00"+"\x08b\x00\x01")},
-
- {&ignoreField{"before", "ignore", "after"},
- "\x02before\x00\a\x00\x00\x00before\x00\x02after\x00\x06\x00\x00\x00after\x00"},
-
- // Marshalling a Raw document does nothing.
- {bson.Raw{0x03, []byte(wrapInDoc("anything"))},
- "anything"},
- {bson.Raw{Data: []byte(wrapInDoc("anything"))},
- "anything"},
-}
-
-func (s *S) TestMarshalOneWayItems(c *C) {
- for _, item := range marshalItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data))
- }
-}
-
-// --------------------------------------------------------------------------
-// One-way unmarshaling tests.
-
-var unmarshalItems = []testItemType{
- // Field is private. Should not attempt to unmarshal it.
- {&struct{ priv byte }{},
- "\x10priv\x00\x08\x00\x00\x00"},
-
- // Wrong casing. Field names are lowercased.
- {&struct{ Byte byte }{},
- "\x10Byte\x00\x08\x00\x00\x00"},
-
- // Ignore non-existing field.
- {&struct{ Byte byte }{9},
- "\x10boot\x00\x08\x00\x00\x00" + "\x10byte\x00\x09\x00\x00\x00"},
-
- // Do not unmarshal on ignored field.
- {&ignoreField{"before", "", "after"},
- "\x02before\x00\a\x00\x00\x00before\x00" +
- "\x02-\x00\a\x00\x00\x00ignore\x00" +
- "\x02after\x00\x06\x00\x00\x00after\x00"},
-
- // Ignore unsuitable types silently.
- {map[string]string{"str": "s"},
- "\x02str\x00\x02\x00\x00\x00s\x00" + "\x10int\x00\x01\x00\x00\x00"},
- {map[string][]int{"array": []int{5, 9}},
- "\x04array\x00" + wrapInDoc("\x100\x00\x05\x00\x00\x00"+"\x021\x00\x02\x00\x00\x00s\x00"+"\x102\x00\x09\x00\x00\x00")},
-
- // Wrong type. Shouldn't init pointer.
- {&struct{ Str *byte }{},
- "\x02str\x00\x02\x00\x00\x00s\x00"},
- {&struct{ Str *struct{ Str string } }{},
- "\x02str\x00\x02\x00\x00\x00s\x00"},
-
- // Ordered document.
- {&struct{ bson.D }{bson.D{{"a", nil}, {"c", nil}, {"b", nil}, {"d", true}}},
- "\x03d\x00" + wrapInDoc("\x0Aa\x00\x0Ac\x00\x0Ab\x00\x08d\x00\x01")},
-
- // Raw document.
- {&bson.Raw{0x03, []byte(wrapInDoc("\x10byte\x00\x08\x00\x00\x00"))},
- "\x10byte\x00\x08\x00\x00\x00"},
-
- // RawD document.
- {&struct{ bson.RawD }{bson.RawD{{"a", bson.Raw{0x0A, []byte{}}}, {"c", bson.Raw{0x0A, []byte{}}}, {"b", bson.Raw{0x08, []byte{0x01}}}}},
- "\x03rawd\x00" + wrapInDoc("\x0Aa\x00\x0Ac\x00\x08b\x00\x01")},
-
- // Decode old binary.
- {bson.M{"_": []byte("old")},
- "\x05_\x00\x07\x00\x00\x00\x02\x03\x00\x00\x00old"},
-
- // Decode old binary without length. According to the spec, this shouldn't happen.
- {bson.M{"_": []byte("old")},
- "\x05_\x00\x03\x00\x00\x00\x02old"},
-}
-
-func (s *S) TestUnmarshalOneWayItems(c *C) {
- for _, item := range unmarshalItems {
- testUnmarshal(c, wrapInDoc(item.data), item.obj)
- }
-}
-
-func (s *S) TestUnmarshalNilInStruct(c *C) {
- // Nil is the default value, so we need to ensure it's indeed being set.
- b := byte(1)
- v := &struct{ Ptr *byte }{&b}
- err := bson.Unmarshal([]byte(wrapInDoc("\x0Aptr\x00")), v)
- c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, &struct{ Ptr *byte }{nil})
-}
-
-// --------------------------------------------------------------------------
-// Marshalling error cases.
-
-type structWithDupKeys struct {
- Name byte
- Other byte "name" // Tag should precede.
-}
-
-var marshalErrorItems = []testItemType{
- {bson.M{"": uint64(1 << 63)},
- "BSON has no uint64 type, and value is too large to fit correctly in an int64"},
- {bson.M{"": bson.ObjectId("tooshort")},
- "ObjectIDs must be exactly 12 bytes long \\(got 8\\)"},
- {int64(123),
- "Can't marshal int64 as a BSON document"},
- {bson.M{"": 1i},
- "Can't marshal complex128 in a BSON document"},
- {&structWithDupKeys{},
- "Duplicated key 'name' in struct bson_test.structWithDupKeys"},
- {bson.Raw{0xA, []byte{}},
- "Attempted to marshal Raw kind 10 as a document"},
- {bson.Raw{0x3, []byte{}},
- "Attempted to marshal empty Raw document"},
- {bson.M{"w": bson.Raw{0x3, []byte{}}},
- "Attempted to marshal empty Raw document"},
- {&inlineCantPtr{&struct{ A, B int }{1, 2}},
- "Option ,inline needs a struct value or map field"},
- {&inlineDupName{1, struct{ A, B int }{2, 3}},
- "Duplicated key 'a' in struct bson_test.inlineDupName"},
- {&inlineDupMap{},
- "Multiple ,inline maps in struct bson_test.inlineDupMap"},
- {&inlineBadKeyMap{},
- "Option ,inline needs a map with string keys in struct bson_test.inlineBadKeyMap"},
- {&inlineMap{A: 1, M: map[string]interface{}{"a": 1}},
- `Can't have key "a" in inlined map; conflicts with struct field`},
-}
-
-func (s *S) TestMarshalErrorItems(c *C) {
- for _, item := range marshalErrorItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, ErrorMatches, item.data)
- c.Assert(data, IsNil)
- }
-}
-
-// --------------------------------------------------------------------------
-// Unmarshalling error cases.
-
-type unmarshalErrorType struct {
- obj interface{}
- data string
- error string
-}
-
-var unmarshalErrorItems = []unmarshalErrorType{
- // Tag name conflicts with existing parameter.
- {&structWithDupKeys{},
- "\x10name\x00\x08\x00\x00\x00",
- "Duplicated key 'name' in struct bson_test.structWithDupKeys"},
-
- // Non-string map key.
- {map[int]interface{}{},
- "\x10name\x00\x08\x00\x00\x00",
- "BSON map must have string keys. Got: map\\[int\\]interface \\{\\}"},
-
- {nil,
- "\xEEname\x00",
- "Unknown element kind \\(0xEE\\)"},
-
- {struct{ Name bool }{},
- "\x10name\x00\x08\x00\x00\x00",
- "Unmarshal can't deal with struct values. Use a pointer."},
-
- {123,
- "\x10name\x00\x08\x00\x00\x00",
- "Unmarshal needs a map or a pointer to a struct."},
-
- {nil,
- "\x08\x62\x00\x02",
- "encoded boolean must be 1 or 0, found 2"},
-}
-
-func (s *S) TestUnmarshalErrorItems(c *C) {
- for _, item := range unmarshalErrorItems {
- data := []byte(wrapInDoc(item.data))
- var value interface{}
- switch reflect.ValueOf(item.obj).Kind() {
- case reflect.Map, reflect.Ptr:
- value = makeZeroDoc(item.obj)
- case reflect.Invalid:
- value = bson.M{}
- default:
- value = item.obj
- }
- err := bson.Unmarshal(data, value)
- c.Assert(err, ErrorMatches, item.error)
- }
-}
-
-type unmarshalRawErrorType struct {
- obj interface{}
- raw bson.Raw
- error string
-}
-
-var unmarshalRawErrorItems = []unmarshalRawErrorType{
- // Tag name conflicts with existing parameter.
- {&structWithDupKeys{},
- bson.Raw{0x03, []byte("\x10byte\x00\x08\x00\x00\x00")},
- "Duplicated key 'name' in struct bson_test.structWithDupKeys"},
-
- {&struct{}{},
- bson.Raw{0xEE, []byte{}},
- "Unknown element kind \\(0xEE\\)"},
-
- {struct{ Name bool }{},
- bson.Raw{0x10, []byte("\x08\x00\x00\x00")},
- "Raw Unmarshal can't deal with struct values. Use a pointer."},
-
- {123,
- bson.Raw{0x10, []byte("\x08\x00\x00\x00")},
- "Raw Unmarshal needs a map or a valid pointer."},
-}
-
-func (s *S) TestUnmarshalRawErrorItems(c *C) {
- for i, item := range unmarshalRawErrorItems {
- err := item.raw.Unmarshal(item.obj)
- c.Assert(err, ErrorMatches, item.error, Commentf("Failed on item %d: %#v\n", i, item))
- }
-}
-
-var corruptedData = []string{
- "\x04\x00\x00\x00\x00", // Document shorter than minimum
- "\x06\x00\x00\x00\x00", // Not enough data
- "\x05\x00\x00", // Broken length
- "\x05\x00\x00\x00\xff", // Corrupted termination
- "\x0A\x00\x00\x00\x0Aooop\x00", // Unfinished C string
-
- // Array end past end of string (s[2]=0x07 is correct)
- wrapInDoc("\x04\x00\x09\x00\x00\x00\x0A\x00\x00"),
-
- // Array end within string, but past acceptable.
- wrapInDoc("\x04\x00\x08\x00\x00\x00\x0A\x00\x00"),
-
- // Document end within string, but past acceptable.
- wrapInDoc("\x03\x00\x08\x00\x00\x00\x0A\x00\x00"),
-
- // String with corrupted end.
- wrapInDoc("\x02\x00\x03\x00\x00\x00yo\xFF"),
-
- // String with negative length (issue #116).
- "\x0c\x00\x00\x00\x02x\x00\xff\xff\xff\xff\x00",
-
- // String with zero length (must include trailing '\x00')
- "\x0c\x00\x00\x00\x02x\x00\x00\x00\x00\x00\x00",
-
- // Binary with negative length.
- "\r\x00\x00\x00\x05x\x00\xff\xff\xff\xff\x00\x00",
-}
-
-func (s *S) TestUnmarshalMapDocumentTooShort(c *C) {
- for _, data := range corruptedData {
- err := bson.Unmarshal([]byte(data), bson.M{})
- c.Assert(err, ErrorMatches, "Document is corrupted")
-
- err = bson.Unmarshal([]byte(data), &struct{}{})
- c.Assert(err, ErrorMatches, "Document is corrupted")
- }
-}
-
-// --------------------------------------------------------------------------
-// Setter test cases.
-
-var setterResult = map[string]error{}
-
-type setterType struct {
- received interface{}
-}
-
-func (o *setterType) SetBSON(raw bson.Raw) error {
- err := raw.Unmarshal(&o.received)
- if err != nil {
- panic("The panic:" + err.Error())
- }
- if s, ok := o.received.(string); ok {
- if result, ok := setterResult[s]; ok {
- return result
- }
- }
- return nil
-}
-
-type ptrSetterDoc struct {
- Field *setterType "_"
-}
-
-type valSetterDoc struct {
- Field setterType "_"
-}
-
-func (s *S) TestUnmarshalAllItemsWithPtrSetter(c *C) {
- for _, item := range allItems {
- for i := 0; i != 2; i++ {
- var field *setterType
- if i == 0 {
- obj := &ptrSetterDoc{}
- err := bson.Unmarshal([]byte(wrapInDoc(item.data)), obj)
- c.Assert(err, IsNil)
- field = obj.Field
- } else {
- obj := &valSetterDoc{}
- err := bson.Unmarshal([]byte(wrapInDoc(item.data)), obj)
- c.Assert(err, IsNil)
- field = &obj.Field
- }
- if item.data == "" {
- // Nothing to unmarshal. Should be untouched.
- if i == 0 {
- c.Assert(field, IsNil)
- } else {
- c.Assert(field.received, IsNil)
- }
- } else {
- expected := item.obj.(bson.M)["_"]
- c.Assert(field, NotNil, Commentf("Pointer not initialized (%#v)", expected))
- c.Assert(field.received, DeepEquals, expected)
- }
- }
- }
-}
-
-func (s *S) TestUnmarshalWholeDocumentWithSetter(c *C) {
- obj := &setterType{}
- err := bson.Unmarshal([]byte(sampleItems[0].data), obj)
- c.Assert(err, IsNil)
- c.Assert(obj.received, DeepEquals, bson.M{"hello": "world"})
-}
-
-func (s *S) TestUnmarshalSetterOmits(c *C) {
- setterResult["2"] = &bson.TypeError{}
- setterResult["4"] = &bson.TypeError{}
- defer func() {
- delete(setterResult, "2")
- delete(setterResult, "4")
- }()
-
- m := map[string]*setterType{}
- data := wrapInDoc("\x02abc\x00\x02\x00\x00\x001\x00" +
- "\x02def\x00\x02\x00\x00\x002\x00" +
- "\x02ghi\x00\x02\x00\x00\x003\x00" +
- "\x02jkl\x00\x02\x00\x00\x004\x00")
- err := bson.Unmarshal([]byte(data), m)
- c.Assert(err, IsNil)
- c.Assert(m["abc"], NotNil)
- c.Assert(m["def"], IsNil)
- c.Assert(m["ghi"], NotNil)
- c.Assert(m["jkl"], IsNil)
-
- c.Assert(m["abc"].received, Equals, "1")
- c.Assert(m["ghi"].received, Equals, "3")
-}
-
-func (s *S) TestUnmarshalSetterErrors(c *C) {
- boom := errors.New("BOOM")
- setterResult["2"] = boom
- defer delete(setterResult, "2")
-
- m := map[string]*setterType{}
- data := wrapInDoc("\x02abc\x00\x02\x00\x00\x001\x00" +
- "\x02def\x00\x02\x00\x00\x002\x00" +
- "\x02ghi\x00\x02\x00\x00\x003\x00")
- err := bson.Unmarshal([]byte(data), m)
- c.Assert(err, Equals, boom)
- c.Assert(m["abc"], NotNil)
- c.Assert(m["def"], IsNil)
- c.Assert(m["ghi"], IsNil)
-
- c.Assert(m["abc"].received, Equals, "1")
-}
-
-func (s *S) TestDMap(c *C) {
- d := bson.D{{"a", 1}, {"b", 2}}
- c.Assert(d.Map(), DeepEquals, bson.M{"a": 1, "b": 2})
-}
-
-func (s *S) TestUnmarshalSetterSetZero(c *C) {
- setterResult["foo"] = bson.SetZero
- defer delete(setterResult, "field")
-
- data, err := bson.Marshal(bson.M{"field": "foo"})
- c.Assert(err, IsNil)
-
- m := map[string]*setterType{}
- err = bson.Unmarshal([]byte(data), m)
- c.Assert(err, IsNil)
-
- value, ok := m["field"]
- c.Assert(ok, Equals, true)
- c.Assert(value, IsNil)
-}
-
-// --------------------------------------------------------------------------
-// Getter test cases.
-
-type typeWithGetter struct {
- result interface{}
- err error
-}
-
-func (t *typeWithGetter) GetBSON() (interface{}, error) {
- if t == nil {
- return "<value is nil>", nil
- }
- return t.result, t.err
-}
-
-type docWithGetterField struct {
- Field *typeWithGetter "_"
-}
-
-func (s *S) TestMarshalAllItemsWithGetter(c *C) {
- for i, item := range allItems {
- if item.data == "" {
- continue
- }
- obj := &docWithGetterField{}
- obj.Field = &typeWithGetter{result: item.obj.(bson.M)["_"]}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data),
- Commentf("Failed on item #%d", i))
- }
-}
-
-func (s *S) TestMarshalWholeDocumentWithGetter(c *C) {
- obj := &typeWithGetter{result: sampleItems[0].obj}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, sampleItems[0].data)
-}
-
-func (s *S) TestGetterErrors(c *C) {
- e := errors.New("oops")
-
- obj1 := &docWithGetterField{}
- obj1.Field = &typeWithGetter{sampleItems[0].obj, e}
- data, err := bson.Marshal(obj1)
- c.Assert(err, ErrorMatches, "oops")
- c.Assert(data, IsNil)
-
- obj2 := &typeWithGetter{sampleItems[0].obj, e}
- data, err = bson.Marshal(obj2)
- c.Assert(err, ErrorMatches, "oops")
- c.Assert(data, IsNil)
-}
-
-type intGetter int64
-
-func (t intGetter) GetBSON() (interface{}, error) {
- return int64(t), nil
-}
-
-type typeWithIntGetter struct {
- V intGetter ",minsize"
-}
-
-func (s *S) TestMarshalShortWithGetter(c *C) {
- obj := typeWithIntGetter{42}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- m := bson.M{}
- err = bson.Unmarshal(data, m)
- c.Assert(err, IsNil)
- c.Assert(m["v"], Equals, 42)
-}
-
-func (s *S) TestMarshalWithGetterNil(c *C) {
- obj := docWithGetterField{}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- m := bson.M{}
- err = bson.Unmarshal(data, m)
- c.Assert(err, IsNil)
- c.Assert(m, DeepEquals, bson.M{"_": "<value is nil>"})
-}
-
-// --------------------------------------------------------------------------
-// Cross-type conversion tests.
-
-type crossTypeItem struct {
- obj1 interface{}
- obj2 interface{}
-}
-
-type condStr struct {
- V string ",omitempty"
-}
-type condStrNS struct {
- V string `a:"A" bson:",omitempty" b:"B"`
-}
-type condBool struct {
- V bool ",omitempty"
-}
-type condInt struct {
- V int ",omitempty"
-}
-type condUInt struct {
- V uint ",omitempty"
-}
-type condFloat struct {
- V float64 ",omitempty"
-}
-type condIface struct {
- V interface{} ",omitempty"
-}
-type condPtr struct {
- V *bool ",omitempty"
-}
-type condSlice struct {
- V []string ",omitempty"
-}
-type condMap struct {
- V map[string]int ",omitempty"
-}
-type namedCondStr struct {
- V string "myv,omitempty"
-}
-type condTime struct {
- V time.Time ",omitempty"
-}
-type condStruct struct {
- V struct{ A []int } ",omitempty"
-}
-type condRaw struct {
- V bson.Raw ",omitempty"
-}
-
-type shortInt struct {
- V int64 ",minsize"
-}
-type shortUint struct {
- V uint64 ",minsize"
-}
-type shortIface struct {
- V interface{} ",minsize"
-}
-type shortPtr struct {
- V *int64 ",minsize"
-}
-type shortNonEmptyInt struct {
- V int64 ",minsize,omitempty"
-}
-
-type inlineInt struct {
- V struct{ A, B int } ",inline"
-}
-type inlineCantPtr struct {
- V *struct{ A, B int } ",inline"
-}
-type inlineDupName struct {
- A int
- V struct{ A, B int } ",inline"
-}
-type inlineMap struct {
- A int
- M map[string]interface{} ",inline"
-}
-type inlineMapInt struct {
- A int
- M map[string]int ",inline"
-}
-type inlineMapMyM struct {
- A int
- M MyM ",inline"
-}
-type inlineDupMap struct {
- M1 map[string]interface{} ",inline"
- M2 map[string]interface{} ",inline"
-}
-type inlineBadKeyMap struct {
- M map[int]int ",inline"
-}
-
-type getterSetterD bson.D
-
-func (s getterSetterD) GetBSON() (interface{}, error) {
- if len(s) == 0 {
- return bson.D{}, nil
- }
- return bson.D(s[:len(s)-1]), nil
-}
-
-func (s *getterSetterD) SetBSON(raw bson.Raw) error {
- var doc bson.D
- err := raw.Unmarshal(&doc)
- doc = append(doc, bson.DocElem{"suffix", true})
- *s = getterSetterD(doc)
- return err
-}
-
-type getterSetterInt int
-
-func (i getterSetterInt) GetBSON() (interface{}, error) {
- return bson.D{{"a", int(i)}}, nil
-}
-
-func (i *getterSetterInt) SetBSON(raw bson.Raw) error {
- var doc struct{ A int }
- err := raw.Unmarshal(&doc)
- *i = getterSetterInt(doc.A)
- return err
-}
-
-type ifaceType interface {
- Hello()
-}
-
-type ifaceSlice []ifaceType
-
-func (s *ifaceSlice) SetBSON(raw bson.Raw) error {
- var ns []int
- if err := raw.Unmarshal(&ns); err != nil {
- return err
- }
- *s = make(ifaceSlice, ns[0])
- return nil
-}
-
-func (s ifaceSlice) GetBSON() (interface{}, error) {
- return []int{len(s)}, nil
-}
-
-type (
- MyString string
- MyBytes []byte
- MyBool bool
- MyD []bson.DocElem
- MyRawD []bson.RawDocElem
- MyM map[string]interface{}
-)
-
-var (
- truevar = true
- falsevar = false
-
- int64var = int64(42)
- int64ptr = &int64var
- intvar = int(42)
- intptr = &intvar
-
- gsintvar = getterSetterInt(42)
-)
-
-func parseURL(s string) *url.URL {
- u, err := url.Parse(s)
- if err != nil {
- panic(err)
- }
- return u
-}
-
-// That's a pretty fun test. It will dump the first item, generate a zero
-// value equivalent to the second one, load the dumped data onto it, and then
-// verify that the resulting value is deep-equal to the untouched second value.
-// Then, it will do the same in the *opposite* direction!
-var twoWayCrossItems = []crossTypeItem{
- // int<=>int
- {&struct{ I int }{42}, &struct{ I int8 }{42}},
- {&struct{ I int }{42}, &struct{ I int32 }{42}},
- {&struct{ I int }{42}, &struct{ I int64 }{42}},
- {&struct{ I int8 }{42}, &struct{ I int32 }{42}},
- {&struct{ I int8 }{42}, &struct{ I int64 }{42}},
- {&struct{ I int32 }{42}, &struct{ I int64 }{42}},
-
- // uint<=>uint
- {&struct{ I uint }{42}, &struct{ I uint8 }{42}},
- {&struct{ I uint }{42}, &struct{ I uint32 }{42}},
- {&struct{ I uint }{42}, &struct{ I uint64 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I uint32 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I uint64 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I uint64 }{42}},
-
- // float32<=>float64
- {&struct{ I float32 }{42}, &struct{ I float64 }{42}},
-
- // int<=>uint
- {&struct{ I uint }{42}, &struct{ I int }{42}},
- {&struct{ I uint }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint }{42}, &struct{ I int64 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int64 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int64 }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int64 }{42}},
-
- // int <=> float
- {&struct{ I int }{42}, &struct{ I float64 }{42}},
-
- // int <=> bool
- {&struct{ I int }{1}, &struct{ I bool }{true}},
- {&struct{ I int }{0}, &struct{ I bool }{false}},
-
- // uint <=> float64
- {&struct{ I uint }{42}, &struct{ I float64 }{42}},
-
- // uint <=> bool
- {&struct{ I uint }{1}, &struct{ I bool }{true}},
- {&struct{ I uint }{0}, &struct{ I bool }{false}},
-
- // float64 <=> bool
- {&struct{ I float64 }{1}, &struct{ I bool }{true}},
- {&struct{ I float64 }{0}, &struct{ I bool }{false}},
-
- // string <=> string and string <=> []byte
- {&struct{ S []byte }{[]byte("abc")}, &struct{ S string }{"abc"}},
- {&struct{ S []byte }{[]byte("def")}, &struct{ S bson.Symbol }{"def"}},
- {&struct{ S string }{"ghi"}, &struct{ S bson.Symbol }{"ghi"}},
-
- // map <=> struct
- {&struct {
- A struct {
- B, C int
- }
- }{struct{ B, C int }{1, 2}},
- map[string]map[string]int{"a": map[string]int{"b": 1, "c": 2}}},
-
- {&struct{ A bson.Symbol }{"abc"}, map[string]string{"a": "abc"}},
- {&struct{ A bson.Symbol }{"abc"}, map[string][]byte{"a": []byte("abc")}},
- {&struct{ A []byte }{[]byte("abc")}, map[string]string{"a": "abc"}},
- {&struct{ A uint }{42}, map[string]int{"a": 42}},
- {&struct{ A uint }{42}, map[string]float64{"a": 42}},
- {&struct{ A uint }{1}, map[string]bool{"a": true}},
- {&struct{ A int }{42}, map[string]uint{"a": 42}},
- {&struct{ A int }{42}, map[string]float64{"a": 42}},
- {&struct{ A int }{1}, map[string]bool{"a": true}},
- {&struct{ A float64 }{42}, map[string]float32{"a": 42}},
- {&struct{ A float64 }{42}, map[string]int{"a": 42}},
- {&struct{ A float64 }{42}, map[string]uint{"a": 42}},
- {&struct{ A float64 }{1}, map[string]bool{"a": true}},
- {&struct{ A bool }{true}, map[string]int{"a": 1}},
- {&struct{ A bool }{true}, map[string]uint{"a": 1}},
- {&struct{ A bool }{true}, map[string]float64{"a": 1}},
- {&struct{ A **byte }{&byteptr}, map[string]byte{"a": 8}},
-
- // url.URL <=> string
- {&struct{ URL *url.URL }{parseURL("h://e.c/p")}, map[string]string{"url": "h://e.c/p"}},
- {&struct{ URL url.URL }{*parseURL("h://e.c/p")}, map[string]string{"url": "h://e.c/p"}},
-
- // Slices
- {&struct{ S []int }{[]int{1, 2, 3}}, map[string][]int{"s": []int{1, 2, 3}}},
- {&struct{ S *[]int }{&[]int{1, 2, 3}}, map[string][]int{"s": []int{1, 2, 3}}},
-
- // Conditionals
- {&condBool{true}, map[string]bool{"v": true}},
- {&condBool{}, map[string]bool{}},
- {&condInt{1}, map[string]int{"v": 1}},
- {&condInt{}, map[string]int{}},
- {&condUInt{1}, map[string]uint{"v": 1}},
- {&condUInt{}, map[string]uint{}},
- {&condFloat{}, map[string]int{}},
- {&condStr{"yo"}, map[string]string{"v": "yo"}},
- {&condStr{}, map[string]string{}},
- {&condStrNS{"yo"}, map[string]string{"v": "yo"}},
- {&condStrNS{}, map[string]string{}},
- {&condSlice{[]string{"yo"}}, map[string][]string{"v": []string{"yo"}}},
- {&condSlice{}, map[string][]string{}},
- {&condMap{map[string]int{"k": 1}}, bson.M{"v": bson.M{"k": 1}}},
- {&condMap{}, map[string][]string{}},
- {&condIface{"yo"}, map[string]string{"v": "yo"}},
- {&condIface{""}, map[string]string{"v": ""}},
- {&condIface{}, map[string]string{}},
- {&condPtr{&truevar}, map[string]bool{"v": true}},
- {&condPtr{&falsevar}, map[string]bool{"v": false}},
- {&condPtr{}, map[string]string{}},
-
- {&condTime{time.Unix(123456789, 123e6)}, map[string]time.Time{"v": time.Unix(123456789, 123e6)}},
- {&condTime{}, map[string]string{}},
-
- {&condStruct{struct{ A []int }{[]int{1}}}, bson.M{"v": bson.M{"a": []interface{}{1}}}},
- {&condStruct{struct{ A []int }{}}, bson.M{}},
-
- {&condRaw{bson.Raw{Kind: 0x0A, Data: []byte{}}}, bson.M{"v": nil}},
- {&condRaw{bson.Raw{Kind: 0x00}}, bson.M{}},
-
- {&namedCondStr{"yo"}, map[string]string{"myv": "yo"}},
- {&namedCondStr{}, map[string]string{}},
-
- {&shortInt{1}, map[string]interface{}{"v": 1}},
- {&shortInt{1 << 30}, map[string]interface{}{"v": 1 << 30}},
- {&shortInt{1 << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortUint{1 << 30}, map[string]interface{}{"v": 1 << 30}},
- {&shortUint{1 << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortIface{int64(1) << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortPtr{int64ptr}, map[string]interface{}{"v": intvar}},
-
- {&shortNonEmptyInt{1}, map[string]interface{}{"v": 1}},
- {&shortNonEmptyInt{1 << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortNonEmptyInt{}, map[string]interface{}{}},
-
- {&inlineInt{struct{ A, B int }{1, 2}}, map[string]interface{}{"a": 1, "b": 2}},
- {&inlineMap{A: 1, M: map[string]interface{}{"b": 2}}, map[string]interface{}{"a": 1, "b": 2}},
- {&inlineMap{A: 1, M: nil}, map[string]interface{}{"a": 1}},
- {&inlineMapInt{A: 1, M: map[string]int{"b": 2}}, map[string]int{"a": 1, "b": 2}},
- {&inlineMapInt{A: 1, M: nil}, map[string]int{"a": 1}},
- {&inlineMapMyM{A: 1, M: MyM{"b": MyM{"c": 3}}}, map[string]interface{}{"a": 1, "b": map[string]interface{}{"c": 3}}},
-
- // []byte <=> Binary
- {&struct{ B []byte }{[]byte("abc")}, map[string]bson.Binary{"b": bson.Binary{Data: []byte("abc")}}},
-
- // []byte <=> MyBytes
- {&struct{ B MyBytes }{[]byte("abc")}, map[string]string{"b": "abc"}},
- {&struct{ B MyBytes }{[]byte{}}, map[string]string{"b": ""}},
- {&struct{ B MyBytes }{}, map[string]bool{}},
- {&struct{ B []byte }{[]byte("abc")}, map[string]MyBytes{"b": []byte("abc")}},
-
- // bool <=> MyBool
- {&struct{ B MyBool }{true}, map[string]bool{"b": true}},
- {&struct{ B MyBool }{}, map[string]bool{"b": false}},
- {&struct{ B MyBool }{}, map[string]string{}},
- {&struct{ B bool }{}, map[string]MyBool{"b": false}},
-
- // arrays
- {&struct{ V [2]int }{[...]int{1, 2}}, map[string][2]int{"v": [2]int{1, 2}}},
- {&struct{ V [2]byte }{[...]byte{1, 2}}, map[string][2]byte{"v": [2]byte{1, 2}}},
-
- // zero time
- {&struct{ V time.Time }{}, map[string]interface{}{"v": time.Time{}}},
-
- // zero time + 1 second + 1 millisecond; overflows int64 as nanoseconds
- {&struct{ V time.Time }{time.Unix(-62135596799, 1e6).Local()},
- map[string]interface{}{"v": time.Unix(-62135596799, 1e6).Local()}},
-
- // bson.D <=> []DocElem
- {&bson.D{{"a", bson.D{{"b", 1}, {"c", 2}}}}, &bson.D{{"a", bson.D{{"b", 1}, {"c", 2}}}}},
- {&bson.D{{"a", bson.D{{"b", 1}, {"c", 2}}}}, &MyD{{"a", MyD{{"b", 1}, {"c", 2}}}}},
- {&struct{ V MyD }{MyD{{"a", 1}}}, &bson.D{{"v", bson.D{{"a", 1}}}}},
-
- // bson.RawD <=> []RawDocElem
- {&bson.RawD{{"a", bson.Raw{0x08, []byte{0x01}}}}, &bson.RawD{{"a", bson.Raw{0x08, []byte{0x01}}}}},
- {&bson.RawD{{"a", bson.Raw{0x08, []byte{0x01}}}}, &MyRawD{{"a", bson.Raw{0x08, []byte{0x01}}}}},
-
- // bson.M <=> map
- {bson.M{"a": bson.M{"b": 1, "c": 2}}, MyM{"a": MyM{"b": 1, "c": 2}}},
- {bson.M{"a": bson.M{"b": 1, "c": 2}}, map[string]interface{}{"a": map[string]interface{}{"b": 1, "c": 2}}},
-
- // bson.M <=> map[MyString]
- {bson.M{"a": bson.M{"b": 1, "c": 2}}, map[MyString]interface{}{"a": map[MyString]interface{}{"b": 1, "c": 2}}},
-
- // json.Number <=> int64, float64
- {&struct{ N json.Number }{"5"}, map[string]interface{}{"n": int64(5)}},
- {&struct{ N json.Number }{"5.05"}, map[string]interface{}{"n": 5.05}},
- {&struct{ N json.Number }{"9223372036854776000"}, map[string]interface{}{"n": float64(1 << 63)}},
-
- // bson.D <=> non-struct getter/setter
- {&bson.D{{"a", 1}}, &getterSetterD{{"a", 1}, {"suffix", true}}},
- {&bson.D{{"a", 42}}, &gsintvar},
-
- // Interface slice setter.
- {&struct{ V ifaceSlice }{ifaceSlice{nil, nil, nil}}, bson.M{"v": []interface{}{3}}},
-}
-
-// Same thing, but only one way (obj1 => obj2).
-var oneWayCrossItems = []crossTypeItem{
- // map <=> struct
- {map[string]interface{}{"a": 1, "b": "2", "c": 3}, map[string]int{"a": 1, "c": 3}},
-
- // inline map elides badly typed values
- {map[string]interface{}{"a": 1, "b": "2", "c": 3}, &inlineMapInt{A: 1, M: map[string]int{"c": 3}}},
-
- // Can't decode int into struct.
- {bson.M{"a": bson.M{"b": 2}}, &struct{ A bool }{}},
-
- // Would get decoded into a int32 too in the opposite direction.
- {&shortIface{int64(1) << 30}, map[string]interface{}{"v": 1 << 30}},
-
- // Ensure omitempty on struct with private fields works properly.
- {&struct {
- V struct{ v time.Time } ",omitempty"
- }{}, map[string]interface{}{}},
-
- // Attempt to marshal slice into RawD (issue #120).
- {bson.M{"x": []int{1, 2, 3}}, &struct{ X bson.RawD }{}},
-}
-
-func testCrossPair(c *C, dump interface{}, load interface{}) {
- c.Logf("Dump: %#v", dump)
- c.Logf("Load: %#v", load)
- zero := makeZeroDoc(load)
- data, err := bson.Marshal(dump)
- c.Assert(err, IsNil)
- c.Logf("Dumped: %#v", string(data))
- err = bson.Unmarshal(data, zero)
- c.Assert(err, IsNil)
- c.Logf("Loaded: %#v", zero)
- c.Assert(zero, DeepEquals, load)
-}
-
-func (s *S) TestTwoWayCrossPairs(c *C) {
- for _, item := range twoWayCrossItems {
- testCrossPair(c, item.obj1, item.obj2)
- testCrossPair(c, item.obj2, item.obj1)
- }
-}
-
-func (s *S) TestOneWayCrossPairs(c *C) {
- for _, item := range oneWayCrossItems {
- testCrossPair(c, item.obj1, item.obj2)
- }
-}
-
-// --------------------------------------------------------------------------
-// ObjectId hex representation test.
-
-func (s *S) TestObjectIdHex(c *C) {
- id := bson.ObjectIdHex("4d88e15b60f486e428412dc9")
- c.Assert(id.String(), Equals, `ObjectIdHex("4d88e15b60f486e428412dc9")`)
- c.Assert(id.Hex(), Equals, "4d88e15b60f486e428412dc9")
-}
-
-func (s *S) TestIsObjectIdHex(c *C) {
- test := []struct {
- id string
- valid bool
- }{
- {"4d88e15b60f486e428412dc9", true},
- {"4d88e15b60f486e428412dc", false},
- {"4d88e15b60f486e428412dc9e", false},
- {"4d88e15b60f486e428412dcx", false},
- }
- for _, t := range test {
- c.Assert(bson.IsObjectIdHex(t.id), Equals, t.valid)
- }
-}
-
-// --------------------------------------------------------------------------
-// ObjectId parts extraction tests.
-
-type objectIdParts struct {
- id bson.ObjectId
- timestamp int64
- machine []byte
- pid uint16
- counter int32
-}
-
-var objectIds = []objectIdParts{
- objectIdParts{
- bson.ObjectIdHex("4d88e15b60f486e428412dc9"),
- 1300816219,
- []byte{0x60, 0xf4, 0x86},
- 0xe428,
- 4271561,
- },
- objectIdParts{
- bson.ObjectIdHex("000000000000000000000000"),
- 0,
- []byte{0x00, 0x00, 0x00},
- 0x0000,
- 0,
- },
- objectIdParts{
- bson.ObjectIdHex("00000000aabbccddee000001"),
- 0,
- []byte{0xaa, 0xbb, 0xcc},
- 0xddee,
- 1,
- },
-}
-
-func (s *S) TestObjectIdPartsExtraction(c *C) {
- for i, v := range objectIds {
- t := time.Unix(v.timestamp, 0)
- c.Assert(v.id.Time(), Equals, t, Commentf("#%d Wrong timestamp value", i))
- c.Assert(v.id.Machine(), DeepEquals, v.machine, Commentf("#%d Wrong machine id value", i))
- c.Assert(v.id.Pid(), Equals, v.pid, Commentf("#%d Wrong pid value", i))
- c.Assert(v.id.Counter(), Equals, v.counter, Commentf("#%d Wrong counter value", i))
- }
-}
-
-func (s *S) TestNow(c *C) {
- before := time.Now()
- time.Sleep(1e6)
- now := bson.Now()
- time.Sleep(1e6)
- after := time.Now()
- c.Assert(now.After(before) && now.Before(after), Equals, true, Commentf("now=%s, before=%s, after=%s", now, before, after))
-}
-
-// --------------------------------------------------------------------------
-// ObjectId generation tests.
-
-func (s *S) TestNewObjectId(c *C) {
- // Generate 10 ids
- ids := make([]bson.ObjectId, 10)
- for i := 0; i < 10; i++ {
- ids[i] = bson.NewObjectId()
- }
- for i := 1; i < 10; i++ {
- prevId := ids[i-1]
- id := ids[i]
- // Test for uniqueness among all other 9 generated ids
- for j, tid := range ids {
- if j != i {
- c.Assert(id, Not(Equals), tid, Commentf("Generated ObjectId is not unique"))
- }
- }
- // Check that timestamp was incremented and is within 30 seconds of the previous one
- secs := id.Time().Sub(prevId.Time()).Seconds()
- c.Assert((secs >= 0 && secs <= 30), Equals, true, Commentf("Wrong timestamp in generated ObjectId"))
- // Check that machine ids are the same
- c.Assert(id.Machine(), DeepEquals, prevId.Machine())
- // Check that pids are the same
- c.Assert(id.Pid(), Equals, prevId.Pid())
- // Test for proper increment
- delta := int(id.Counter() - prevId.Counter())
- c.Assert(delta, Equals, 1, Commentf("Wrong increment in generated ObjectId"))
- }
-}
-
-func (s *S) TestNewObjectIdWithTime(c *C) {
- t := time.Unix(12345678, 0)
- id := bson.NewObjectIdWithTime(t)
- c.Assert(id.Time(), Equals, t)
- c.Assert(id.Machine(), DeepEquals, []byte{0x00, 0x00, 0x00})
- c.Assert(int(id.Pid()), Equals, 0)
- c.Assert(int(id.Counter()), Equals, 0)
-}
-
-// --------------------------------------------------------------------------
-// ObjectId JSON marshalling.
-
-type jsonType struct {
- Id bson.ObjectId
-}
-
-var jsonIdTests = []struct {
- value jsonType
- json string
- marshal bool
- unmarshal bool
- error string
-}{{
- value: jsonType{Id: bson.ObjectIdHex("4d88e15b60f486e428412dc9")},
- json: `{"Id":"4d88e15b60f486e428412dc9"}`,
- marshal: true,
- unmarshal: true,
-}, {
- value: jsonType{},
- json: `{"Id":""}`,
- marshal: true,
- unmarshal: true,
-}, {
- value: jsonType{},
- json: `{"Id":null}`,
- marshal: false,
- unmarshal: true,
-}, {
- json: `{"Id":"4d88e15b60f486e428412dc9A"}`,
- error: `Invalid ObjectId in JSON: "4d88e15b60f486e428412dc9A"`,
- marshal: false,
- unmarshal: true,
-}, {
- json: `{"Id":"4d88e15b60f486e428412dcZ"}`,
- error: `Invalid ObjectId in JSON: "4d88e15b60f486e428412dcZ" .*`,
- marshal: false,
- unmarshal: true,
-}}
-
-func (s *S) TestObjectIdJSONMarshaling(c *C) {
- for _, test := range jsonIdTests {
- if test.marshal {
- data, err := json.Marshal(&test.value)
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, test.json)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
-
- if test.unmarshal {
- var value jsonType
- err := json.Unmarshal([]byte(test.json), &value)
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, test.value)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
- }
-}
-
-type specTest struct {
- Description string
- Documents []struct {
- Decoded map[string]interface{}
- Encoded string
- DecodeOnly bool `yaml:"decodeOnly"`
- Error interface{}
- }
-}
-
-func (s *S) TestSpecTests(c *C) {
- for _, data := range specTests {
- var test specTest
- err := yaml.Unmarshal([]byte(data), &test)
- c.Assert(err, IsNil)
-
- c.Logf("Running spec test set %q", test.Description)
-
- for _, doc := range test.Documents {
- if doc.Error != nil {
- continue
- }
- c.Logf("Ensuring %q decodes as %v", doc.Encoded, doc.Decoded)
- var decoded map[string]interface{}
- encoded, err := hex.DecodeString(doc.Encoded)
- c.Assert(err, IsNil)
- err = bson.Unmarshal(encoded, &decoded)
- c.Assert(err, IsNil)
- c.Assert(decoded, DeepEquals, doc.Decoded)
- }
-
- for _, doc := range test.Documents {
- if doc.DecodeOnly || doc.Error != nil {
- continue
- }
- c.Logf("Ensuring %v encodes as %q", doc.Decoded, doc.Encoded)
- encoded, err := bson.Marshal(doc.Decoded)
- c.Assert(err, IsNil)
- c.Assert(strings.ToUpper(hex.EncodeToString(encoded)), Equals, doc.Encoded)
- }
-
- for _, doc := range test.Documents {
- if doc.Error == nil {
- continue
- }
- c.Logf("Ensuring %q errors when decoded: %s", doc.Encoded, doc.Error)
- var decoded map[string]interface{}
- encoded, err := hex.DecodeString(doc.Encoded)
- c.Assert(err, IsNil)
- err = bson.Unmarshal(encoded, &decoded)
- c.Assert(err, NotNil)
- c.Logf("Failed with: %v", err)
- }
- }
-}
-
-// --------------------------------------------------------------------------
-// Some simple benchmarks.
-
-type BenchT struct {
- A, B, C, D, E, F string
-}
-
-type BenchRawT struct {
- A string
- B int
- C bson.M
- D []float64
-}
-
-func (s *S) BenchmarkUnmarhsalStruct(c *C) {
- v := BenchT{A: "A", D: "D", E: "E"}
- data, err := bson.Marshal(&v)
- if err != nil {
- panic(err)
- }
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- err = bson.Unmarshal(data, &v)
- }
- if err != nil {
- panic(err)
- }
-}
-
-func (s *S) BenchmarkUnmarhsalMap(c *C) {
- m := bson.M{"a": "a", "d": "d", "e": "e"}
- data, err := bson.Marshal(&m)
- if err != nil {
- panic(err)
- }
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- err = bson.Unmarshal(data, &m)
- }
- if err != nil {
- panic(err)
- }
-}
-
-func (s *S) BenchmarkUnmarshalRaw(c *C) {
- var err error
- m := BenchRawT{
- A: "test_string",
- B: 123,
- C: bson.M{
- "subdoc_int": 12312,
- "subdoc_doc": bson.M{"1": 1},
- },
- D: []float64{0.0, 1.3333, -99.9997, 3.1415},
- }
- data, err := bson.Marshal(&m)
- if err != nil {
- panic(err)
- }
- raw := bson.Raw{}
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- err = bson.Unmarshal(data, &raw)
- }
- if err != nil {
- panic(err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/specdata_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/specdata_test.go
deleted file mode 100644
index 513f9b209c7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bson/specdata_test.go
+++ /dev/null
@@ -1,241 +0,0 @@
-package bson_test
-
-var specTests = []string{
- `
----
-description: "Array type"
-documents:
- -
- decoded:
- a : []
- encoded: 0D000000046100050000000000
- -
- decoded:
- a: [10]
- encoded: 140000000461000C0000001030000A0000000000
- -
- # Decode an array that uses an empty string as the key
- decodeOnly : true
- decoded:
- a: [10]
- encoded: 130000000461000B00000010000A0000000000
- -
- # Decode an array that uses a non-numeric string as the key
- decodeOnly : true
- decoded:
- a: [10]
- encoded: 150000000461000D000000106162000A0000000000
-
-
-`, `
----
-description: "Boolean type"
-documents:
- -
- encoded: "090000000862000100"
- decoded: { "b" : true }
- -
- encoded: "090000000862000000"
- decoded: { "b" : false }
-
-
- `, `
----
-description: "Corrupted BSON"
-documents:
- -
- encoded: "09000000016600"
- error: "truncated double"
- -
- encoded: "09000000026600"
- error: "truncated string"
- -
- encoded: "09000000036600"
- error: "truncated document"
- -
- encoded: "09000000046600"
- error: "truncated array"
- -
- encoded: "09000000056600"
- error: "truncated binary"
- -
- encoded: "09000000076600"
- error: "truncated objectid"
- -
- encoded: "09000000086600"
- error: "truncated boolean"
- -
- encoded: "09000000096600"
- error: "truncated date"
- -
- encoded: "090000000b6600"
- error: "truncated regex"
- -
- encoded: "090000000c6600"
- error: "truncated db pointer"
- -
- encoded: "0C0000000d6600"
- error: "truncated javascript"
- -
- encoded: "0C0000000e6600"
- error: "truncated symbol"
- -
- encoded: "0C0000000f6600"
- error: "truncated javascript with scope"
- -
- encoded: "0C000000106600"
- error: "truncated int32"
- -
- encoded: "0C000000116600"
- error: "truncated timestamp"
- -
- encoded: "0C000000126600"
- error: "truncated int64"
- -
- encoded: "0400000000"
- error: basic
- -
- encoded: "0500000001"
- error: basic
- -
- encoded: "05000000"
- error: basic
- -
- encoded: "0700000002610078563412"
- error: basic
- -
- encoded: "090000001061000500"
- error: basic
- -
- encoded: "00000000000000000000"
- error: basic
- -
- encoded: "1300000002666f6f00040000006261720000"
- error: "basic"
- -
- encoded: "1800000003666f6f000f0000001062617200ffffff7f0000"
- error: basic
- -
- encoded: "1500000003666f6f000c0000000862617200010000"
- error: basic
- -
- encoded: "1c00000003666f6f001200000002626172000500000062617a000000"
- error: basic
- -
- encoded: "1000000002610004000000616263ff00"
- error: string is not null-terminated
- -
- encoded: "0c0000000200000000000000"
- error: bad_string_length
- -
- encoded: "120000000200ffffffff666f6f6261720000"
- error: bad_string_length
- -
- encoded: "0c0000000e00000000000000"
- error: bad_string_length
- -
- encoded: "120000000e00ffffffff666f6f6261720000"
- error: bad_string_length
- -
- encoded: "180000000c00fa5bd841d6585d9900"
- error: ""
- -
- encoded: "1e0000000c00ffffffff666f6f626172005259b56afa5bd841d6585d9900"
- error: bad_string_length
- -
- encoded: "0c0000000d00000000000000"
- error: bad_string_length
- -
- encoded: "0c0000000d00ffffffff0000"
- error: bad_string_length
- -
- encoded: "1c0000000f001500000000000000000c000000020001000000000000"
- error: bad_string_length
- -
- encoded: "1c0000000f0015000000ffffffff000c000000020001000000000000"
- error: bad_string_length
- -
- encoded: "1c0000000f001500000001000000000c000000020000000000000000"
- error: bad_string_length
- -
- encoded: "1c0000000f001500000001000000000c0000000200ffffffff000000"
- error: bad_string_length
- -
- encoded: "0E00000008616263646566676869707172737475"
- error: "Run-on CString"
- -
- encoded: "0100000000"
- error: "An object size that's too small to even include the object size, but is correctly encoded, along with a correct EOO (and no data)"
- -
- encoded: "1a0000000e74657374000c00000068656c6c6f20776f726c6400000500000000"
- error: "One object, but with object size listed smaller than it is in the data"
- -
- encoded: "05000000"
- error: "One object, missing the EOO at the end"
- -
- encoded: "0500000001"
- error: "One object, sized correctly, with a spot for an EOO, but the EOO is 0x01"
- -
- encoded: "05000000ff"
- error: "One object, sized correctly, with a spot for an EOO, but the EOO is 0xff"
- -
- encoded: "0500000070"
- error: "One object, sized correctly, with a spot for an EOO, but the EOO is 0x70"
- -
- encoded: "07000000000000"
- error: "Invalid BSON type low range"
- -
- encoded: "07000000800000"
- error: "Invalid BSON type high range"
- -
- encoded: "090000000862000200"
- error: "Invalid boolean value of 2"
- -
- encoded: "09000000086200ff00"
- error: "Invalid boolean value of -1"
- `, `
----
-description: "Int32 type"
-documents:
- -
- decoded:
- i: -2147483648
- encoded: 0C0000001069000000008000
- -
- decoded:
- i: 2147483647
- encoded: 0C000000106900FFFFFF7F00
- -
- decoded:
- i: -1
- encoded: 0C000000106900FFFFFFFF00
- -
- decoded:
- i: 0
- encoded: 0C0000001069000000000000
- -
- decoded:
- i: 1
- encoded: 0C0000001069000100000000
-
-`, `
----
-description: "String type"
-documents:
- -
- decoded:
- s : ""
- encoded: 0D000000027300010000000000
- -
- decoded:
- s: "a"
- encoded: 0E00000002730002000000610000
- -
- decoded:
- s: "This is a string"
- encoded: 1D0000000273001100000054686973206973206120737472696E670000
- -
- decoded:
- s: "κόσμε"
- encoded: 180000000273000C000000CEBAE1BDB9CF83CEBCCEB50000
-`}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bulk_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bulk_test.go
deleted file mode 100644
index 7437a88e914..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/bulk_test.go
+++ /dev/null
@@ -1,376 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo_test
-
-import (
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
-)
-
-func (s *S) TestBulkInsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Insert(M{"n": 1})
- bulk.Insert(M{"n": 2}, M{"n": 3})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {2}, {3}})
-}
-
-func (s *S) TestBulkInsertError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Insert(M{"_id": 1}, M{"_id": 2}, M{"_id": 2}, M{"_id": 3})
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-
- type doc struct {
- N int `_id`
- }
- var res []doc
- err = coll.Find(nil).Sort("_id").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {2}})
-}
-
-func (s *S) TestBulkInsertErrorUnordered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": 1}, M{"_id": 2}, M{"_id": 2}, M{"_id": 3})
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
-
- type doc struct {
- N int `_id`
- }
- var res []doc
- err = coll.Find(nil).Sort("_id").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {2}, {3}})
-}
-
-func (s *S) TestBulkInsertErrorUnorderedSplitBatch(c *C) {
- // The server has a batch limit of 1000 documents when using write commands.
- // This artificial limit did not exist with the old wire protocol, so to
- // avoid compatibility issues the implementation internally split batches
- // into the proper size and delivers them one by one. This test ensures that
- // the behavior of unordered (that is, continue on error) remains correct
- // when errors happen and there are batches left.
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Unordered()
-
- const total = 4096
- type doc struct {
- Id int `_id`
- }
- docs := make([]interface{}, total)
- for i := 0; i < total; i++ {
- docs[i] = doc{i}
- }
- docs[1] = doc{0}
- bulk.Insert(docs...)
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
-
- n, err := coll.Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, total-1)
-
- var res doc
- err = coll.FindId(1500).One(&res)
- c.Assert(err, IsNil)
- c.Assert(res.Id, Equals, 1500)
-}
-
-func (s *S) TestBulkError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // If it's just the same string multiple times, join it into a single message.
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": 1}, M{"_id": 2}, M{"_id": 2})
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
- c.Assert(err, Not(ErrorMatches), ".*duplicate key.*duplicate key")
- c.Assert(mgo.IsDup(err), Equals, true)
-
- // With matching errors but different messages, present them all.
- bulk = coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": "dupone"}, M{"_id": "dupone"}, M{"_id": "duptwo"}, M{"_id": "duptwo"})
- _, err = bulk.Run()
- if s.versionAtLeast(2, 6) {
- c.Assert(err, ErrorMatches, "multiple errors in bulk operation:\n( - .*duplicate.*\n){2}$")
- c.Assert(err, ErrorMatches, "(?s).*dupone.*")
- c.Assert(err, ErrorMatches, "(?s).*duptwo.*")
- } else {
- // Wire protocol query doesn't return all errors.
- c.Assert(err, ErrorMatches, ".*duplicate.*")
- }
- c.Assert(mgo.IsDup(err), Equals, true)
-
- // With mixed errors, present them all.
- bulk = coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": 1}, M{"_id": []int{2}})
- _, err = bulk.Run()
- if s.versionAtLeast(2, 6) {
- c.Assert(err, ErrorMatches, "multiple errors in bulk operation:\n - .*duplicate.*\n - .*array.*\n$")
- } else {
- // Wire protocol query doesn't return all errors.
- c.Assert(err, ErrorMatches, ".*array.*")
- }
- c.Assert(mgo.IsDup(err), Equals, false)
-}
-
-func (s *S) TestBulkUpdate(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Update(M{"n": 1}, M{"$set": M{"n": 1}})
- bulk.Update(M{"n": 2}, M{"$set": M{"n": 20}})
- bulk.Update(M{"n": 5}, M{"$set": M{"n": 50}}) // Won't match.
- bulk.Update(M{"n": 1}, M{"$set": M{"n": 10}}, M{"n": 3}, M{"$set": M{"n": 30}})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 4)
- if s.versionAtLeast(2, 6) {
- c.Assert(r.Modified, Equals, 3)
- }
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{10}, {20}, {30}})
-}
-
-func (s *S) TestBulkUpdateError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Update(
- M{"n": 1}, M{"$set": M{"n": 10}},
- M{"n": 2}, M{"$set": M{"n": 20, "_id": 20}},
- M{"n": 3}, M{"$set": M{"n": 30}},
- )
- r, err := bulk.Run()
- c.Assert(err, ErrorMatches, ".*_id.*")
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{2}, {3}, {10}})
-}
-
-func (s *S) TestBulkUpdateErrorUnordered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Update(
- M{"n": 1}, M{"$set": M{"n": 10}},
- M{"n": 2}, M{"$set": M{"n": 20, "_id": 20}},
- M{"n": 3}, M{"$set": M{"n": 30}},
- )
- r, err := bulk.Run()
- c.Assert(err, ErrorMatches, ".*_id.*")
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{2}, {10}, {30}})
-}
-
-func (s *S) TestBulkUpdateAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.UpdateAll(M{"n": 1}, M{"$set": M{"n": 10}})
- bulk.UpdateAll(M{"n": 2}, M{"$set": M{"n": 2}})
- bulk.UpdateAll(M{"n": 5}, M{"$set": M{"n": 50}}) // Won't match.
- bulk.UpdateAll(M{}, M{"$inc": M{"n": 1}}, M{"n": 11}, M{"$set": M{"n": 5}})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 6)
- if s.versionAtLeast(2, 6) {
- c.Assert(r.Modified, Equals, 5)
- }
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{3}, {4}, {5}})
-}
-
-func (s *S) TestBulkMixedUnordered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Abuse undefined behavior to ensure the desired implementation is in place.
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"n": 1})
- bulk.Update(M{"n": 2}, M{"$inc": M{"n": 1}})
- bulk.Insert(M{"n": 2})
- bulk.Update(M{"n": 3}, M{"$inc": M{"n": 1}})
- bulk.Update(M{"n": 1}, M{"$inc": M{"n": 1}})
- bulk.Insert(M{"n": 3})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 3)
- if s.versionAtLeast(2, 6) {
- c.Assert(r.Modified, Equals, 3)
- }
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{2}, {3}, {4}})
-}
-
-func (s *S) TestBulkUpsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Upsert(M{"n": 2}, M{"$set": M{"n": 20}})
- bulk.Upsert(M{"n": 4}, M{"$set": M{"n": 40}}, M{"n": 3}, M{"$set": M{"n": 30}})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {20}, {30}, {40}})
-}
-
-func (s *S) TestBulkRemove(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3}, M{"n": 4}, M{"n": 4})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Remove(M{"n": 1})
- bulk.Remove(M{"n": 2}, M{"n": 4})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 3)
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{3}, {4}})
-}
-
-func (s *S) TestBulkRemoveAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3}, M{"n": 4}, M{"n": 4})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.RemoveAll(M{"n": 1})
- bulk.RemoveAll(M{"n": 2}, M{"n": 4})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 4)
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{3}})
-}
-
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/cluster_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/cluster_test.go
deleted file mode 100644
index 791d96864a8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/cluster_test.go
+++ /dev/null
@@ -1,1914 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo_test
-
-import (
- "fmt"
- "io"
- "net"
- "strings"
- "sync"
- "time"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/bson"
-)
-
-func (s *S) TestNewSession(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Do a dummy operation to wait for connection.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Tweak safety and query settings to ensure other has copied those.
- session.SetSafe(nil)
- session.SetBatch(-1)
- other := session.New()
- defer other.Close()
- session.SetSafe(&mgo.Safe{})
-
- // Clone was copied while session was unsafe, so no errors.
- otherColl := other.DB("mydb").C("mycoll")
- err = otherColl.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Original session was made safe again.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, NotNil)
-
- // With New(), each session has its own socket now.
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 2)
-
- // Ensure query parameters were cloned.
- err = otherColl.Insert(M{"_id": 2})
- c.Assert(err, IsNil)
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(other.Ping(), IsNil)
-
- mgo.ResetStats()
-
- iter := otherColl.Find(M{}).Iter()
- c.Assert(err, IsNil)
-
- m := M{}
- ok := iter.Next(m)
- c.Assert(ok, Equals, true)
- err = iter.Close()
- c.Assert(err, IsNil)
-
- // If Batch(-1) is in effect, a single document must have been received.
- stats = mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 1)
-}
-
-func (s *S) TestCloneSession(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Do a dummy operation to wait for connection.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Tweak safety and query settings to ensure clone is copying those.
- session.SetSafe(nil)
- session.SetBatch(-1)
- clone := session.Clone()
- defer clone.Close()
- session.SetSafe(&mgo.Safe{})
-
- // Clone was copied while session was unsafe, so no errors.
- cloneColl := clone.DB("mydb").C("mycoll")
- err = cloneColl.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Original session was made safe again.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, NotNil)
-
- // With Clone(), same socket is shared between sessions now.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
- c.Assert(stats.SocketRefs, Equals, 2)
-
- // Refreshing one of them should let the original socket go,
- // while preserving the safety settings.
- clone.Refresh()
- err = cloneColl.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Must have used another connection now.
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 2)
- c.Assert(stats.SocketRefs, Equals, 2)
-
- // Ensure query parameters were cloned.
- err = cloneColl.Insert(M{"_id": 2})
- c.Assert(err, IsNil)
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(clone.Ping(), IsNil)
-
- mgo.ResetStats()
-
- iter := cloneColl.Find(M{}).Iter()
- c.Assert(err, IsNil)
-
- m := M{}
- ok := iter.Next(m)
- c.Assert(ok, Equals, true)
- err = iter.Close()
- c.Assert(err, IsNil)
-
- // If Batch(-1) is in effect, a single document must have been received.
- stats = mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 1)
-}
-
-func (s *S) TestModeStrong(c *C) {
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
- session.SetMode(mgo.Strong, false)
-
- c.Assert(session.Mode(), Equals, mgo.Strong)
-
- result := M{}
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- session.SetMode(mgo.Strong, true)
-
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeMonotonic(c *C) {
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
-
- c.Assert(session.Mode(), Equals, mgo.Monotonic)
-
- var result struct{ IsMaster bool }
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.IsMaster, Equals, false)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.IsMaster, Equals, true)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 2)
-
- session.SetMode(mgo.Monotonic, true)
-
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeMonotonicAfterStrong(c *C) {
- // Test that a strong session shifting to a monotonic
- // one preserves the socket untouched.
-
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Insert something to force a connection to the master.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- session.SetMode(mgo.Monotonic, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // Master socket should still be reserved.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Confirm it's the master even though it's Monotonic by now.
- result := M{}
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-}
-
-func (s *S) TestModeStrongAfterMonotonic(c *C) {
- // Test that shifting from Monotonic to Strong while
- // using a slave socket will keep the socket reserved
- // until the master socket is necessary, so that no
- // switch over occurs unless it's actually necessary.
-
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
-
- // Ensure we're talking to a slave, and reserve the socket.
- result := M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, false)
-
- // Switch to a Strong session.
- session.SetMode(mgo.Strong, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // Slave socket should still be reserved.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // But any operation will switch it to the master.
- result = M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-}
-
-func (s *S) TestModeMonotonicWriteOnIteration(c *C) {
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
-
- c.Assert(session.Mode(), Equals, mgo.Monotonic)
-
- coll1 := session.DB("mydb").C("mycoll1")
- coll2 := session.DB("mydb").C("mycoll2")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll1.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- // Release master so we can grab a slave again.
- session.Refresh()
-
- // Wait until synchronization is done.
- for {
- n, err := coll1.Count()
- c.Assert(err, IsNil)
- if n == len(ns) {
- break
- }
- }
-
- iter := coll1.Find(nil).Batch(2).Iter()
- i := 0
- m := M{}
- for iter.Next(&m) {
- i++
- if i > 3 {
- err := coll2.Insert(M{"n": 47 + i})
- c.Assert(err, IsNil)
- }
- }
- c.Assert(i, Equals, len(ns))
-}
-
-func (s *S) TestModeEventual(c *C) {
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Eventual, false)
-
- c.Assert(session.Mode(), Equals, mgo.Eventual)
-
- result := M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, false)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- result = M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeEventualAfterStrong(c *C) {
- // Test that a strong session shifting to an eventual
- // one preserves the socket untouched.
-
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Insert something to force a connection to the master.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- session.SetMode(mgo.Eventual, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // Master socket should still be reserved.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Confirm it's the master even though it's Eventual by now.
- result := M{}
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-
- session.SetMode(mgo.Eventual, true)
-
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeStrongFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // With strong consistency, this will open a socket to the master.
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Kill the master.
- host := result.Host
- s.Stop(host)
-
- // This must fail, since the connection was broken.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // With strong consistency, it fails again until reset.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Now we should be able to talk to the new master.
- // Increase the timeout since this may take quite a while.
- session.SetSyncTimeout(3 * time.Minute)
-
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Not(Equals), host)
-
- // Insert some data to confirm it's indeed a master.
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 42})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModePrimaryHiccup(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // With strong consistency, this will open a socket to the master.
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Establish a few extra sessions to create spare sockets to
- // the master. This increases a bit the chances of getting an
- // incorrect cached socket.
- var sessions []*mgo.Session
- for i := 0; i < 20; i++ {
- sessions = append(sessions, session.Copy())
- err = sessions[len(sessions)-1].Run("serverStatus", result)
- c.Assert(err, IsNil)
- }
- for i := range sessions {
- sessions[i].Close()
- }
-
- // Kill the master, but bring it back immediatelly.
- host := result.Host
- s.Stop(host)
- s.StartAll()
-
- // This must fail, since the connection was broken.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // With strong consistency, it fails again until reset.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Now we should be able to talk to the new master.
- // Increase the timeout since this may take quite a while.
- session.SetSyncTimeout(3 * time.Minute)
-
- // Insert some data to confirm it's indeed a master.
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 42})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModeMonotonicFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- // Insert something to force a switch to the master.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait a bit for this to be synchronized to slaves.
- time.Sleep(3 * time.Second)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Kill the master.
- host := result.Host
- s.Stop(host)
-
- // This must fail, since the connection was broken.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // With monotonic consistency, it fails again until reset.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Now we should be able to talk to the new master.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Not(Equals), host)
-}
-
-func (s *S) TestModeMonotonicWithSlaveFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // Create new monotonic session with an explicit address to ensure
- // a slave is synchronized before the master, otherwise a connection
- // with the master may be used below for lack of other options.
- var addr string
- switch {
- case strings.HasSuffix(ssresult.Host, ":40021"):
- addr = "localhost:40022"
- case strings.HasSuffix(ssresult.Host, ":40022"):
- addr = "localhost:40021"
- case strings.HasSuffix(ssresult.Host, ":40023"):
- addr = "localhost:40021"
- default:
- c.Fatal("Unknown host: ", ssresult.Host)
- }
-
- session, err = mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- // Check the address of the socket associated with the monotonic session.
- c.Log("Running serverStatus and isMaster with monotonic session")
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- slave := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, false, Commentf("%s is not a slave", slave))
-
- c.Assert(master, Not(Equals), slave)
-
- // Kill the master.
- s.Stop(master)
-
- // Session must still be good, since we were talking to a slave.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
-
- c.Assert(ssresult.Host, Equals, slave,
- Commentf("Monotonic session moved from %s to %s", slave, ssresult.Host))
-
- // If we try to insert something, it'll have to hold until the new
- // master is available to move the connection, and work correctly.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Must now be talking to the new master.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // ... which is not the old one, since it's still dead.
- c.Assert(ssresult.Host, Not(Equals), master)
-}
-
-func (s *S) TestModeEventualFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- master := result.Host
-
- session.SetMode(mgo.Eventual, true)
-
- // Should connect to the master when needed.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait a bit for this to be synchronized to slaves.
- time.Sleep(3 * time.Second)
-
- // Kill the master.
- s.Stop(master)
-
- // Should still work, with the new master now.
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Not(Equals), master)
-}
-
-func (s *S) TestModeSecondaryJustPrimary(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Secondary, true)
-
- err = session.Ping()
- c.Assert(err, ErrorMatches, "no reachable servers")
-}
-
-func (s *S) TestModeSecondaryPreferredJustPrimary(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.SecondaryPreferred, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModeSecondaryPreferredFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Ensure secondaries are available for being picked up.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- session.SetMode(mgo.SecondaryPreferred, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Not(Equals), "rs1a")
- secondary := result.Host
-
- // Should connect to the primary when needed.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait a bit for this to be synchronized to slaves.
- time.Sleep(3 * time.Second)
-
- // Kill the primary.
- s.Stop("localhost:40011")
-
- // It can still talk to the selected secondary.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Equals, secondary)
-
- // But cannot speak to the primary until reset.
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Can still talk to a secondary.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Not(Equals), "rs1a")
-
- s.StartAll()
-
- // Should now be able to talk to the primary again.
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModePrimaryPreferredFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.PrimaryPreferred, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Equals, "rs1a")
-
- // Kill the primary.
- s.Stop("localhost:40011")
-
- // Should now fail as there was a primary socket in use already.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // Refresh so the reserved primary socket goes away.
- session.Refresh()
-
- // Should be able to talk to the secondary.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- s.StartAll()
-
- // Should wait for the new primary to become available.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // And should use the new primary in general, as it is preferred.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Equals, "rs1a")
-}
-
-func (s *S) TestModePrimaryFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSyncTimeout(3 * time.Second)
-
- session.SetMode(mgo.Primary, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Equals, "rs1a")
-
- // Kill the primary.
- s.Stop("localhost:40011")
-
- session.Refresh()
-
- err = session.Ping()
- c.Assert(err, ErrorMatches, "no reachable servers")
-}
-
-func (s *S) TestModeSecondary(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Secondary, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Not(Equals), "rs1a")
- secondary := result.Host
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Equals, secondary)
-}
-
-func (s *S) TestPreserveSocketCountOnSync(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- stats := mgo.GetStats()
- for stats.SocketsAlive != 3 {
- c.Logf("Waiting for all connections to be established (sockets alive currently %d)...", stats.SocketsAlive)
- stats = mgo.GetStats()
- time.Sleep(5e8)
- }
-
- c.Assert(stats.SocketsAlive, Equals, 3)
-
- // Kill the master (with rs1, 'a' is always the master).
- s.Stop("localhost:40011")
-
- // Wait for the logic to run for a bit and bring it back.
- startedAll := make(chan bool)
- go func() {
- time.Sleep(5e9)
- s.StartAll()
- startedAll <- true
- }()
-
- // Do not allow the test to return before the goroutine above is done.
- defer func() {
- <-startedAll
- }()
-
- // Do an action to kick the resync logic in, and also to
- // wait until the cluster recognizes the server is back.
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, true)
-
- for i := 0; i != 20; i++ {
- stats = mgo.GetStats()
- if stats.SocketsAlive == 3 {
- break
- }
- c.Logf("Waiting for 3 sockets alive, have %d", stats.SocketsAlive)
- time.Sleep(5e8)
- }
-
- // Ensure the number of sockets is preserved after syncing.
- stats = mgo.GetStats()
- c.Assert(stats.SocketsAlive, Equals, 3)
- c.Assert(stats.SocketsInUse, Equals, 1)
- c.Assert(stats.SocketRefs, Equals, 1)
-}
-
-// Connect to the master of a deployment with a single server,
-// run an insert, and then ensure the insert worked and that a
-// single connection was established.
-func (s *S) TestTopologySyncWithSingleMaster(c *C) {
- // Use hostname here rather than IP, to make things trickier.
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
-
- // One connection used for discovery. Master socket recycled for
- // insert. Socket is reserved after insert.
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 0)
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Refresh session and socket must be released.
- session.Refresh()
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestTopologySyncWithSlaveSeed(c *C) {
- // That's supposed to be a slave. Must run discovery
- // and find out master to insert successfully.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, true)
-
- // One connection to each during discovery. Master
- // socket recycled for insert.
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
-
- // Only one socket reference alive, in the master socket owned
- // by the above session.
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Refresh it, and it must be gone.
- session.Refresh()
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestSyncTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- s.Stop("localhost:40001")
-
- timeout := 3 * time.Second
- session.SetSyncTimeout(timeout)
- started := time.Now()
-
- // Do something.
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, ErrorMatches, "no reachable servers")
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-timeout*2)), Equals, true)
-}
-
-func (s *S) TestDialWithTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- timeout := 2 * time.Second
- started := time.Now()
-
- // 40009 isn't used by the test servers.
- session, err := mgo.DialWithTimeout("localhost:40009", timeout)
- if session != nil {
- session.Close()
- }
- c.Assert(err, ErrorMatches, "no reachable servers")
- c.Assert(session, IsNil)
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-timeout*2)), Equals, true)
-}
-
-func (s *S) TestSocketTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- s.Freeze("localhost:40001")
-
- timeout := 3 * time.Second
- session.SetSocketTimeout(timeout)
- started := time.Now()
-
- // Do something.
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, ErrorMatches, ".*: i/o timeout")
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-timeout*2)), Equals, true)
-}
-
-func (s *S) TestSocketTimeoutOnDial(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- timeout := 1 * time.Second
-
- defer mgo.HackSyncSocketTimeout(timeout)()
-
- s.Freeze("localhost:40001")
-
- started := time.Now()
-
- session, err := mgo.DialWithTimeout("localhost:40001", timeout)
- c.Assert(err, ErrorMatches, "no reachable servers")
- c.Assert(session, IsNil)
-
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-20*time.Second)), Equals, true)
-}
-
-func (s *S) TestSocketTimeoutOnInactiveSocket(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- timeout := 2 * time.Second
- session.SetSocketTimeout(timeout)
-
- // Do something that relies on the timeout and works.
- c.Assert(session.Ping(), IsNil)
-
- // Freeze and wait for the timeout to go by.
- s.Freeze("localhost:40001")
- time.Sleep(timeout + 500*time.Millisecond)
- s.Thaw("localhost:40001")
-
- // Do something again. The timeout above should not have killed
- // the socket as there was nothing to be done.
- c.Assert(session.Ping(), IsNil)
-}
-
-func (s *S) TestDialWithReplicaSetName(c *C) {
- seedLists := [][]string{
- // rs1 primary and rs2 primary
- []string{"localhost:40011", "localhost:40021"},
- // rs1 primary and rs2 secondary
- []string{"localhost:40011", "localhost:40022"},
- // rs1 secondary and rs2 primary
- []string{"localhost:40012", "localhost:40021"},
- // rs1 secondary and rs2 secondary
- []string{"localhost:40012", "localhost:40022"},
- }
-
- rs2Members := []string{":40021", ":40022", ":40023"}
-
- verifySyncedServers := func(session *mgo.Session, numServers int) {
- // wait for the server(s) to be synced
- for len(session.LiveServers()) != numServers {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // ensure none of the rs2 set members are communicated with
- for _, addr := range session.LiveServers() {
- for _, rs2Member := range rs2Members {
- c.Assert(strings.HasSuffix(addr, rs2Member), Equals, false)
- }
- }
- }
-
- // only communication with rs1 members is expected
- for _, seedList := range seedLists {
- info := mgo.DialInfo{
- Addrs: seedList,
- Timeout: 5 * time.Second,
- ReplicaSetName: "rs1",
- }
-
- session, err := mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 3)
- session.Close()
-
- info.Direct = true
- session, err = mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 1)
- session.Close()
-
- connectionUrl := fmt.Sprintf("mongodb://%v/?replicaSet=rs1", strings.Join(seedList, ","))
- session, err = mgo.Dial(connectionUrl)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 3)
- session.Close()
-
- connectionUrl += "&connect=direct"
- session, err = mgo.Dial(connectionUrl)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 1)
- session.Close()
- }
-
-}
-
-func (s *S) TestDirect(c *C) {
- session, err := mgo.Dial("localhost:40012?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // We know that server is a slave.
- session.SetMode(mgo.Monotonic, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40012"), Equals, true)
-
- stats := mgo.GetStats()
- c.Assert(stats.SocketsAlive, Equals, 1)
- c.Assert(stats.SocketsInUse, Equals, 1)
- c.Assert(stats.SocketRefs, Equals, 1)
-
- // We've got no master, so it'll timeout.
- session.SetSyncTimeout(5e8 * time.Nanosecond)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"test": 1})
- c.Assert(err, ErrorMatches, "no reachable servers")
-
- // Writing to the local database is okay.
- coll = session.DB("local").C("mycoll")
- defer coll.RemoveAll(nil)
- id := bson.NewObjectId()
- err = coll.Insert(M{"_id": id})
- c.Assert(err, IsNil)
-
- // Data was stored in the right server.
- n, err := coll.Find(M{"_id": id}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-
- // Server hasn't changed.
- result.Host = ""
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40012"), Equals, true)
-}
-
-func (s *S) TestDirectToUnknownStateMember(c *C) {
- session, err := mgo.Dial("localhost:40041?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40041"), Equals, true)
-
- // We've got no master, so it'll timeout.
- session.SetSyncTimeout(5e8 * time.Nanosecond)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"test": 1})
- c.Assert(err, ErrorMatches, "no reachable servers")
-
- // Slave is still reachable.
- result.Host = ""
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40041"), Equals, true)
-}
-
-func (s *S) TestFailFast(c *C) {
- info := mgo.DialInfo{
- Addrs: []string{"localhost:99999"},
- Timeout: 5 * time.Second,
- FailFast: true,
- }
-
- started := time.Now()
-
- _, err := mgo.DialWithInfo(&info)
- c.Assert(err, ErrorMatches, "no reachable servers")
-
- c.Assert(started.After(time.Now().Add(-time.Second)), Equals, true)
-}
-
-func (s *S) countQueries(c *C, server string) (n int) {
- defer func() { c.Logf("Queries for %q: %d", server, n) }()
- session, err := mgo.Dial(server + "?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetMode(mgo.Monotonic, true)
- var result struct {
- OpCounters struct {
- Query int
- }
- Metrics struct {
- Commands struct{ Find struct{ Total int } }
- }
- }
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- if s.versionAtLeast(3, 2) {
- return result.Metrics.Commands.Find.Total
- }
- return result.OpCounters.Query
-}
-
-func (s *S) TestMonotonicSlaveOkFlagWithMongos(c *C) {
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // Ensure mongos is aware about the current topology.
- s.Stop(":40201")
- s.StartAll()
-
- mongos, err := mgo.Dial("localhost:40202")
- c.Assert(err, IsNil)
- defer mongos.Close()
-
- // Insert some data as otherwise 3.2+ doesn't seem to run the query at all.
- err = mongos.DB("mydb").C("mycoll").Insert(bson.M{"n": 1})
- c.Assert(err, IsNil)
-
- // Wait until all servers see the data.
- for _, addr := range []string{"localhost:40021", "localhost:40022", "localhost:40023"} {
- session, err := mgo.Dial(addr + "?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetMode(mgo.Monotonic, true)
- for i := 300; i >= 0; i-- {
- n, err := session.DB("mydb").C("mycoll").Find(nil).Count()
- c.Assert(err, IsNil)
- if n == 1 {
- break
- }
- if i == 0 {
- c.Fatalf("Inserted data never reached " + addr)
- }
- time.Sleep(100 * time.Millisecond)
- }
- }
-
- // Collect op counters for everyone.
- q21a := s.countQueries(c, "localhost:40021")
- q22a := s.countQueries(c, "localhost:40022")
- q23a := s.countQueries(c, "localhost:40023")
-
- // Do a SlaveOk query through MongoS
-
- mongos.SetMode(mgo.Monotonic, true)
-
- coll := mongos.DB("mydb").C("mycoll")
- var result struct{ N int }
- for i := 0; i != 5; i++ {
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
- }
-
- // Collect op counters for everyone again.
- q21b := s.countQueries(c, "localhost:40021")
- q22b := s.countQueries(c, "localhost:40022")
- q23b := s.countQueries(c, "localhost:40023")
-
- var masterDelta, slaveDelta int
- switch hostPort(master) {
- case "40021":
- masterDelta = q21b - q21a
- slaveDelta = (q22b - q22a) + (q23b - q23a)
- case "40022":
- masterDelta = q22b - q22a
- slaveDelta = (q21b - q21a) + (q23b - q23a)
- case "40023":
- masterDelta = q23b - q23a
- slaveDelta = (q21b - q21a) + (q22b - q22a)
- default:
- c.Fatal("Uh?")
- }
-
- c.Check(masterDelta, Equals, 0) // Just the counting itself.
- c.Check(slaveDelta, Equals, 5) // The counting for both, plus 5 queries above.
-}
-
-func (s *S) TestRemovalOfClusterMember(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- master, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer master.Close()
-
- // Wait for cluster to fully sync up.
- for i := 0; i < 10; i++ {
- if len(master.LiveServers()) == 3 {
- break
- }
- time.Sleep(5e8)
- }
- if len(master.LiveServers()) != 3 {
- c.Fatalf("Test started with bad cluster state: %v", master.LiveServers())
- }
-
- result := &struct {
- IsMaster bool
- Me string
- }{}
- slave := master.Copy()
- slave.SetMode(mgo.Monotonic, true) // Monotonic can hold a non-master socket persistently.
- err = slave.Run("isMaster", result)
- c.Assert(err, IsNil)
- c.Assert(result.IsMaster, Equals, false)
- slaveAddr := result.Me
-
- defer func() {
- config := map[string]string{
- "40021": `{_id: 1, host: "127.0.0.1:40021", priority: 1, tags: {rs2: "a"}}`,
- "40022": `{_id: 2, host: "127.0.0.1:40022", priority: 0, tags: {rs2: "b"}}`,
- "40023": `{_id: 3, host: "127.0.0.1:40023", priority: 0, tags: {rs2: "c"}}`,
- }
- master.Refresh()
- master.Run(bson.D{{"$eval", `rs.add(` + config[hostPort(slaveAddr)] + `)`}}, nil)
- master.Close()
- slave.Close()
-
- // Ensure suite syncs up with the changes before next test.
- s.Stop(":40201")
- s.StartAll()
- time.Sleep(8 * time.Second)
- // TODO Find a better way to find out when mongos is fully aware that all
- // servers are up. Without that follow up tests that depend on mongos will
- // break due to their expectation of things being in a working state.
- }()
-
- c.Logf("========== Removing slave: %s ==========", slaveAddr)
-
- master.Run(bson.D{{"$eval", `rs.remove("` + slaveAddr + `")`}}, nil)
-
- master.Refresh()
-
- // Give the cluster a moment to catch up by doing a roundtrip to the master.
- err = master.Ping()
- c.Assert(err, IsNil)
-
- time.Sleep(3e9)
-
- // This must fail since the slave has been taken off the cluster.
- err = slave.Ping()
- c.Assert(err, NotNil)
-
- for i := 0; i < 15; i++ {
- if len(master.LiveServers()) == 2 {
- break
- }
- time.Sleep(time.Second)
- }
- live := master.LiveServers()
- if len(live) != 2 {
- c.Errorf("Removed server still considered live: %#s", live)
- }
-
- c.Log("========== Test succeeded. ==========")
-}
-
-func (s *S) TestPoolLimitSimple(c *C) {
- for test := 0; test < 2; test++ {
- var session *mgo.Session
- var err error
- if test == 0 {
- session, err = mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- session.SetPoolLimit(1)
- } else {
- session, err = mgo.Dial("localhost:40001?maxPoolSize=1")
- c.Assert(err, IsNil)
- }
- defer session.Close()
-
- // Put one socket in use.
- c.Assert(session.Ping(), IsNil)
-
- done := make(chan time.Duration)
-
- // Now block trying to get another one due to the pool limit.
- go func() {
- copy := session.Copy()
- defer copy.Close()
- started := time.Now()
- c.Check(copy.Ping(), IsNil)
- done <- time.Now().Sub(started)
- }()
-
- time.Sleep(300 * time.Millisecond)
-
- // Put the one socket back in the pool, freeing it for the copy.
- session.Refresh()
- delay := <-done
- c.Assert(delay > 300*time.Millisecond, Equals, true, Commentf("Delay: %s", delay))
- }
-}
-
-func (s *S) TestPoolLimitMany(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- stats := mgo.GetStats()
- for stats.SocketsAlive != 3 {
- c.Logf("Waiting for all connections to be established (sockets alive currently %d)...", stats.SocketsAlive)
- stats = mgo.GetStats()
- time.Sleep(5e8)
- }
-
- const poolLimit = 64
- session.SetPoolLimit(poolLimit)
-
- // Consume the whole limit for the master.
- var master []*mgo.Session
- for i := 0; i < poolLimit; i++ {
- s := session.Copy()
- defer s.Close()
- c.Assert(s.Ping(), IsNil)
- master = append(master, s)
- }
-
- before := time.Now()
- go func() {
- time.Sleep(3e9)
- master[0].Refresh()
- }()
-
- // Then, a single ping must block, since it would need another
- // connection to the master, over the limit. Once the goroutine
- // above releases its socket, it should move on.
- session.Ping()
- delay := time.Now().Sub(before)
- c.Assert(delay > 3e9, Equals, true)
- c.Assert(delay < 6e9, Equals, true)
-}
-
-func (s *S) TestSetModeEventualIterBug(c *C) {
- session1, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session1.Close()
-
- session1.SetMode(mgo.Eventual, false)
-
- coll1 := session1.DB("mydb").C("mycoll")
-
- const N = 100
- for i := 0; i < N; i++ {
- err = coll1.Insert(M{"_id": i})
- c.Assert(err, IsNil)
- }
-
- c.Logf("Waiting until secondary syncs")
- for {
- n, err := coll1.Count()
- c.Assert(err, IsNil)
- if n == N {
- c.Logf("Found all")
- break
- }
- }
-
- session2, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session2.Close()
-
- session2.SetMode(mgo.Eventual, false)
-
- coll2 := session2.DB("mydb").C("mycoll")
-
- i := 0
- iter := coll2.Find(nil).Batch(10).Iter()
- var result struct{}
- for iter.Next(&result) {
- i++
- }
- c.Assert(iter.Close(), Equals, nil)
- c.Assert(i, Equals, N)
-}
-
-func (s *S) TestCustomDialOld(c *C) {
- dials := make(chan bool, 16)
- dial := func(addr net.Addr) (net.Conn, error) {
- tcpaddr, ok := addr.(*net.TCPAddr)
- if !ok {
- return nil, fmt.Errorf("unexpected address type: %T", addr)
- }
- dials <- true
- return net.DialTCP("tcp", nil, tcpaddr)
- }
- info := mgo.DialInfo{
- Addrs: []string{"localhost:40012"},
- Dial: dial,
- }
-
- // Use hostname here rather than IP, to make things trickier.
- session, err := mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- defer session.Close()
-
- const N = 3
- for i := 0; i < N; i++ {
- select {
- case <-dials:
- case <-time.After(5 * time.Second):
- c.Fatalf("expected %d dials, got %d", N, i)
- }
- }
- select {
- case <-dials:
- c.Fatalf("got more dials than expected")
- case <-time.After(100 * time.Millisecond):
- }
-}
-
-func (s *S) TestCustomDialNew(c *C) {
- dials := make(chan bool, 16)
- dial := func(addr *mgo.ServerAddr) (net.Conn, error) {
- dials <- true
- if addr.TCPAddr().Port == 40012 {
- c.Check(addr.String(), Equals, "localhost:40012")
- }
- return net.DialTCP("tcp", nil, addr.TCPAddr())
- }
- info := mgo.DialInfo{
- Addrs: []string{"localhost:40012"},
- DialServer: dial,
- }
-
- // Use hostname here rather than IP, to make things trickier.
- session, err := mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- defer session.Close()
-
- const N = 3
- for i := 0; i < N; i++ {
- select {
- case <-dials:
- case <-time.After(5 * time.Second):
- c.Fatalf("expected %d dials, got %d", N, i)
- }
- }
- select {
- case <-dials:
- c.Fatalf("got more dials than expected")
- case <-time.After(100 * time.Millisecond):
- }
-}
-
-func (s *S) TestPrimaryShutdownOnAuthShard(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- // Dial the shard.
- session, err := mgo.Dial("localhost:40203")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Login and insert something to make it more realistic.
- session.DB("admin").Login("root", "rapadura")
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(bson.M{"n": 1})
- c.Assert(err, IsNil)
-
- // Dial the replica set to figure the master out.
- rs, err := mgo.Dial("root:rapadura@localhost:40031")
- c.Assert(err, IsNil)
- defer rs.Close()
-
- // With strong consistency, this will open a socket to the master.
- result := &struct{ Host string }{}
- err = rs.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Kill the master.
- host := result.Host
- s.Stop(host)
-
- // This must fail, since the connection was broken.
- err = rs.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // This won't work because the master just died.
- err = coll.Insert(bson.M{"n": 2})
- c.Assert(err, NotNil)
-
- // Refresh session and wait for re-election.
- session.Refresh()
- for i := 0; i < 60; i++ {
- err = coll.Insert(bson.M{"n": 3})
- if err == nil {
- break
- }
- c.Logf("Waiting for replica set to elect a new master. Last error: %v", err)
- time.Sleep(500 * time.Millisecond)
- }
- c.Assert(err, IsNil)
-
- count, err := coll.Count()
- c.Assert(count > 1, Equals, true)
-}
-
-func (s *S) TestNearestSecondary(c *C) {
- defer mgo.HackPingDelay(300 * time.Millisecond)()
-
- rs1a := "127.0.0.1:40011"
- rs1b := "127.0.0.1:40012"
- rs1c := "127.0.0.1:40013"
- s.Freeze(rs1b)
-
- session, err := mgo.Dial(rs1a)
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Wait for the sync up to run through the first couple of servers.
- for len(session.LiveServers()) != 2 {
- c.Log("Waiting for two servers to be alive...")
- time.Sleep(100 * time.Millisecond)
- }
-
- // Extra delay to ensure the third server gets penalized.
- time.Sleep(500 * time.Millisecond)
-
- // Release third server.
- s.Thaw(rs1b)
-
- // Wait for it to come up.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for all servers to be alive...")
- time.Sleep(100 * time.Millisecond)
- }
-
- session.SetMode(mgo.Monotonic, true)
- var result struct{ Host string }
-
- // See which slave picks the line, several times to avoid chance.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1c))
- }
-
- if *fast {
- // Don't hold back for several seconds.
- return
- }
-
- // Now hold the other server for long enough to penalize it.
- s.Freeze(rs1c)
- time.Sleep(5 * time.Second)
- s.Thaw(rs1c)
-
- // Wait for the ping to be processed.
- time.Sleep(500 * time.Millisecond)
-
- // Repeating the test should now pick the former server consistently.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1b))
- }
-}
-
-func (s *S) TestNearestServer(c *C) {
- defer mgo.HackPingDelay(300 * time.Millisecond)()
-
- rs1a := "127.0.0.1:40011"
- rs1b := "127.0.0.1:40012"
- rs1c := "127.0.0.1:40013"
-
- session, err := mgo.Dial(rs1a)
- c.Assert(err, IsNil)
- defer session.Close()
-
- s.Freeze(rs1a)
- s.Freeze(rs1b)
-
- // Extra delay to ensure the first two servers get penalized.
- time.Sleep(500 * time.Millisecond)
-
- // Release them.
- s.Thaw(rs1a)
- s.Thaw(rs1b)
-
- // Wait for everyone to come up.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for all servers to be alive...")
- time.Sleep(100 * time.Millisecond)
- }
-
- session.SetMode(mgo.Nearest, true)
- var result struct{ Host string }
-
- // See which server picks the line, several times to avoid chance.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1c))
- }
-
- if *fast {
- // Don't hold back for several seconds.
- return
- }
-
- // Now hold the two secondaries for long enough to penalize them.
- s.Freeze(rs1b)
- s.Freeze(rs1c)
- time.Sleep(5 * time.Second)
- s.Thaw(rs1b)
- s.Thaw(rs1c)
-
- // Wait for the ping to be processed.
- time.Sleep(500 * time.Millisecond)
-
- // Repeating the test should now pick the primary server consistently.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1a))
- }
-}
-
-func (s *S) TestConnectCloseConcurrency(c *C) {
- restore := mgo.HackPingDelay(500 * time.Millisecond)
- defer restore()
- var wg sync.WaitGroup
- const n = 500
- wg.Add(n)
- for i := 0; i < n; i++ {
- go func() {
- defer wg.Done()
- session, err := mgo.Dial("localhost:40001")
- if err != nil {
- c.Fatal(err)
- }
- time.Sleep(1)
- session.Close()
- }()
- }
- wg.Wait()
-}
-
-func (s *S) TestSelectServers(c *C) {
- if !s.versionAtLeast(2, 2) {
- c.Skip("read preferences introduced in 2.2")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Eventual, true)
-
- var result struct{ Host string }
-
- session.Refresh()
- session.SelectServers(bson.D{{"rs1", "b"}})
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, "40012")
-
- session.Refresh()
- session.SelectServers(bson.D{{"rs1", "c"}})
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, "40013")
-}
-
-func (s *S) TestSelectServersWithMongos(c *C) {
- if !s.versionAtLeast(2, 2) {
- c.Skip("read preferences introduced in 2.2")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- var slave1, slave2 string
- switch hostPort(master) {
- case "40021":
- slave1, slave2 = "b", "c"
- case "40022":
- slave1, slave2 = "a", "c"
- case "40023":
- slave1, slave2 = "a", "b"
- }
-
- // Collect op counters for everyone.
- q21a := s.countQueries(c, "localhost:40021")
- q22a := s.countQueries(c, "localhost:40022")
- q23a := s.countQueries(c, "localhost:40023")
-
- // Do a SlaveOk query through MongoS
- mongos, err := mgo.Dial("localhost:40202")
- c.Assert(err, IsNil)
- defer mongos.Close()
-
- mongos.SetMode(mgo.Monotonic, true)
-
- mongos.Refresh()
- mongos.SelectServers(bson.D{{"rs2", slave1}})
- coll := mongos.DB("mydb").C("mycoll")
- result := &struct{}{}
- for i := 0; i != 5; i++ {
- err := coll.Find(nil).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-
- mongos.Refresh()
- mongos.SelectServers(bson.D{{"rs2", slave2}})
- coll = mongos.DB("mydb").C("mycoll")
- for i := 0; i != 7; i++ {
- err := coll.Find(nil).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-
- // Collect op counters for everyone again.
- q21b := s.countQueries(c, "localhost:40021")
- q22b := s.countQueries(c, "localhost:40022")
- q23b := s.countQueries(c, "localhost:40023")
-
- switch hostPort(master) {
- case "40021":
- c.Check(q21b-q21a, Equals, 0)
- c.Check(q22b-q22a, Equals, 5)
- c.Check(q23b-q23a, Equals, 7)
- case "40022":
- c.Check(q21b-q21a, Equals, 5)
- c.Check(q22b-q22a, Equals, 0)
- c.Check(q23b-q23a, Equals, 7)
- case "40023":
- c.Check(q21b-q21a, Equals, 5)
- c.Check(q22b-q22a, Equals, 7)
- c.Check(q23b-q23a, Equals, 0)
- default:
- c.Fatal("Uh?")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/dbserver_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/dbserver_test.go
deleted file mode 100644
index 9dbf86d0e4f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/dbserver_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package dbtest_test
-
-import (
- "os"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/dbtest"
-)
-
-type M map[string]interface{}
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- oldCheckSessions string
-}
-
-var _ = Suite(&S{})
-
-func (s *S) SetUpTest(c *C) {
- s.oldCheckSessions = os.Getenv("CHECK_SESSIONS")
- os.Setenv("CHECK_SESSIONS", "")
-}
-
-func (s *S) TearDownTest(c *C) {
- os.Setenv("CHECK_SESSIONS", s.oldCheckSessions)
-}
-
-func (s *S) TestWipeData(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- session := server.Session()
- err := session.DB("mydb").C("mycoll").Insert(M{"a": 1})
- session.Close()
- c.Assert(err, IsNil)
-
- server.Wipe()
-
- session = server.Session()
- names, err := session.DatabaseNames()
- session.Close()
- c.Assert(err, IsNil)
- for _, name := range names {
- if name != "local" && name != "admin" {
- c.Fatalf("Wipe should have removed this database: %s", name)
- }
- }
-}
-
-func (s *S) TestStop(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- // Server should not be running.
- process := server.ProcessTest()
- c.Assert(process, IsNil)
-
- session := server.Session()
- addr := session.LiveServers()[0]
- session.Close()
-
- // Server should be running now.
- process = server.ProcessTest()
- p, err := os.FindProcess(process.Pid)
- c.Assert(err, IsNil)
- p.Release()
-
- server.Stop()
-
- // Server should not be running anymore.
- session, err = mgo.DialWithTimeout(addr, 500*time.Millisecond)
- if session != nil {
- session.Close()
- c.Fatalf("Stop did not stop the server")
- }
-}
-
-func (s *S) TestCheckSessions(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- session := server.Session()
- defer session.Close()
- c.Assert(server.Wipe, PanicMatches, "There are mgo sessions still alive.")
-}
-
-func (s *S) TestCheckSessionsDisabled(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- os.Setenv("CHECK_SESSIONS", "0")
-
- // Should not panic, although it looks to Wipe like this session will leak.
- session := server.Session()
- defer session.Close()
- server.Wipe()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/export_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/export_test.go
deleted file mode 100644
index 65f1cb02388..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/dbtest/export_test.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package dbtest
-
-import (
- "os"
-)
-
-func (dbs *DBServer) ProcessTest() *os.Process {
- if dbs.server == nil {
- return nil
- }
- return dbs.server.Process
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/export_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/export_test.go
deleted file mode 100644
index 690f84d3835..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/export_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package mgo
-
-import (
- "time"
-)
-
-func HackPingDelay(newDelay time.Duration) (restore func()) {
- globalMutex.Lock()
- defer globalMutex.Unlock()
-
- oldDelay := pingDelay
- restore = func() {
- globalMutex.Lock()
- pingDelay = oldDelay
- globalMutex.Unlock()
- }
- pingDelay = newDelay
- return
-}
-
-func HackSyncSocketTimeout(newTimeout time.Duration) (restore func()) {
- globalMutex.Lock()
- defer globalMutex.Unlock()
-
- oldTimeout := syncSocketTimeout
- restore = func() {
- globalMutex.Lock()
- syncSocketTimeout = oldTimeout
- globalMutex.Unlock()
- }
- syncSocketTimeout = newTimeout
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/gridfs_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/gridfs_test.go
deleted file mode 100644
index f5256ab132b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/gridfs_test.go
+++ /dev/null
@@ -1,691 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo_test
-
-import (
- "io"
- "os"
- "time"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/bson"
-)
-
-func (s *S) TestGridFSCreate(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- before := bson.Now()
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- n, err := file.Write([]byte("some data"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 9)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- after := bson.Now()
-
- // Check the file information.
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- fileId, ok := result["_id"].(bson.ObjectId)
- c.Assert(ok, Equals, true)
- c.Assert(fileId.Valid(), Equals, true)
- result["_id"] = "<id>"
-
- ud, ok := result["uploadDate"].(time.Time)
- c.Assert(ok, Equals, true)
- c.Assert(ud.After(before) && ud.Before(after), Equals, true)
- result["uploadDate"] = "<timestamp>"
-
- expected := M{
- "_id": "<id>",
- "length": 9,
- "chunkSize": 255 * 1024,
- "uploadDate": "<timestamp>",
- "md5": "1e50210a0202497fb79bc38b6ade6c34",
- }
- c.Assert(result, DeepEquals, expected)
-
- // Check the chunk.
- result = M{}
- err = db.C("fs.chunks").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- chunkId, ok := result["_id"].(bson.ObjectId)
- c.Assert(ok, Equals, true)
- c.Assert(chunkId.Valid(), Equals, true)
- result["_id"] = "<id>"
-
- expected = M{
- "_id": "<id>",
- "files_id": fileId,
- "n": 0,
- "data": []byte("some data"),
- }
- c.Assert(result, DeepEquals, expected)
-
- // Check that an index was created.
- indexes, err := db.C("fs.chunks").Indexes()
- c.Assert(err, IsNil)
- c.Assert(len(indexes), Equals, 2)
- c.Assert(indexes[1].Key, DeepEquals, []string{"files_id", "n"})
-}
-
-func (s *S) TestGridFSFileDetails(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile1.txt")
- c.Assert(err, IsNil)
-
- n, err := file.Write([]byte("some"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
-
- c.Assert(file.Size(), Equals, int64(4))
-
- n, err = file.Write([]byte(" data"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 5)
-
- c.Assert(file.Size(), Equals, int64(9))
-
- id, _ := file.Id().(bson.ObjectId)
- c.Assert(id.Valid(), Equals, true)
- c.Assert(file.Name(), Equals, "myfile1.txt")
- c.Assert(file.ContentType(), Equals, "")
-
- var info interface{}
- err = file.GetMeta(&info)
- c.Assert(err, IsNil)
- c.Assert(info, IsNil)
-
- file.SetId("myid")
- file.SetName("myfile2.txt")
- file.SetContentType("text/plain")
- file.SetMeta(M{"any": "thing"})
-
- c.Assert(file.Id(), Equals, "myid")
- c.Assert(file.Name(), Equals, "myfile2.txt")
- c.Assert(file.ContentType(), Equals, "text/plain")
-
- err = file.GetMeta(&info)
- c.Assert(err, IsNil)
- c.Assert(info, DeepEquals, bson.M{"any": "thing"})
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- c.Assert(file.MD5(), Equals, "1e50210a0202497fb79bc38b6ade6c34")
-
- ud := file.UploadDate()
- now := time.Now()
- c.Assert(ud.Before(now), Equals, true)
- c.Assert(ud.After(now.Add(-3*time.Second)), Equals, true)
-
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- result["uploadDate"] = "<timestamp>"
-
- expected := M{
- "_id": "myid",
- "length": 9,
- "chunkSize": 255 * 1024,
- "uploadDate": "<timestamp>",
- "md5": "1e50210a0202497fb79bc38b6ade6c34",
- "filename": "myfile2.txt",
- "contentType": "text/plain",
- "metadata": M{"any": "thing"},
- }
- c.Assert(result, DeepEquals, expected)
-}
-
-func (s *S) TestGridFSSetUploadDate(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- t := time.Date(2014, 1, 1, 1, 1, 1, 0, time.Local)
- file.SetUploadDate(t)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- // Check the file information.
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- ud := result["uploadDate"].(time.Time)
- if !ud.Equal(t) {
- c.Fatalf("want upload date %s, got %s", t, ud)
- }
-}
-
-func (s *S) TestGridFSCreateWithChunking(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- file.SetChunkSize(5)
-
- // Smaller than the chunk size.
- n, err := file.Write([]byte("abc"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-
- // Boundary in the middle.
- n, err = file.Write([]byte("defg"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
-
- // Boundary at the end.
- n, err = file.Write([]byte("hij"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-
- // Larger than the chunk size, with 3 chunks.
- n, err = file.Write([]byte("klmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 12)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- // Check the file information.
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- fileId, _ := result["_id"].(bson.ObjectId)
- c.Assert(fileId.Valid(), Equals, true)
- result["_id"] = "<id>"
- result["uploadDate"] = "<timestamp>"
-
- expected := M{
- "_id": "<id>",
- "length": 22,
- "chunkSize": 5,
- "uploadDate": "<timestamp>",
- "md5": "44a66044834cbe55040089cabfc102d5",
- }
- c.Assert(result, DeepEquals, expected)
-
- // Check the chunks.
- iter := db.C("fs.chunks").Find(nil).Sort("n").Iter()
- dataChunks := []string{"abcde", "fghij", "klmno", "pqrst", "uv"}
- for i := 0; ; i++ {
- result = M{}
- if !iter.Next(result) {
- if i != 5 {
- c.Fatalf("Expected 5 chunks, got %d", i)
- }
- break
- }
- c.Assert(iter.Close(), IsNil)
-
- result["_id"] = "<id>"
-
- expected = M{
- "_id": "<id>",
- "files_id": fileId,
- "n": i,
- "data": []byte(dataChunks[i]),
- }
- c.Assert(result, DeepEquals, expected)
- }
-}
-
-func (s *S) TestGridFSAbort(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("some data"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 9)
-
- var count int
- for i := 0; i < 10; i++ {
- count, err = db.C("fs.chunks").Count()
- if count > 0 || err != nil {
- break
- }
- }
- c.Assert(err, IsNil)
- c.Assert(count, Equals, 1)
-
- file.Abort()
-
- err = file.Close()
- c.Assert(err, ErrorMatches, "write aborted")
-
- count, err = db.C("fs.chunks").Count()
- c.Assert(err, IsNil)
- c.Assert(count, Equals, 0)
-}
-
-func (s *S) TestGridFSCloseConflict(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- db.C("fs.files").EnsureIndex(mgo.Index{Key: []string{"filename"}, Unique: true})
-
- // For a closing-time conflict
- err = db.C("fs.files").Insert(M{"filename": "foo.txt"})
- c.Assert(err, IsNil)
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("foo.txt")
- c.Assert(err, IsNil)
-
- _, err = file.Write([]byte("some data"))
- c.Assert(err, IsNil)
-
- err = file.Close()
- c.Assert(mgo.IsDup(err), Equals, true)
-
- count, err := db.C("fs.chunks").Count()
- c.Assert(err, IsNil)
- c.Assert(count, Equals, 0)
-}
-
-func (s *S) TestGridFSOpenNotFound(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.OpenId("non-existent")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
- c.Assert(file, IsNil)
-
- file, err = gfs.Open("non-existent")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
- c.Assert(file, IsNil)
-}
-
-func (s *S) TestGridFSReadAll(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
- id := file.Id()
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("abcdefghijklmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 22)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- file, err = gfs.OpenId(id)
- c.Assert(err, IsNil)
-
- b := make([]byte, 30)
- n, err = file.Read(b)
- c.Assert(n, Equals, 22)
- c.Assert(err, IsNil)
-
- n, err = file.Read(b)
- c.Assert(n, Equals, 0)
- c.Assert(err == io.EOF, Equals, true)
-
- err = file.Close()
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGridFSReadChunking(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- id := file.Id()
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("abcdefghijklmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 22)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- file, err = gfs.OpenId(id)
- c.Assert(err, IsNil)
-
- b := make([]byte, 30)
-
- // Smaller than the chunk size.
- n, err = file.Read(b[:3])
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
- c.Assert(b[:3], DeepEquals, []byte("abc"))
-
- // Boundary in the middle.
- n, err = file.Read(b[:4])
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
- c.Assert(b[:4], DeepEquals, []byte("defg"))
-
- // Boundary at the end.
- n, err = file.Read(b[:3])
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
- c.Assert(b[:3], DeepEquals, []byte("hij"))
-
- // Larger than the chunk size, with 3 chunks.
- n, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 12)
- c.Assert(b[:12], DeepEquals, []byte("klmnopqrstuv"))
-
- n, err = file.Read(b)
- c.Assert(n, Equals, 0)
- c.Assert(err == io.EOF, Equals, true)
-
- err = file.Close()
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGridFSOpen(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- file.Close()
-
- file, err = gfs.Open("myfile.txt")
- c.Assert(err, IsNil)
- defer file.Close()
-
- var b [1]byte
-
- _, err = file.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "2")
-}
-
-func (s *S) TestGridFSSeek(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
- id := file.Id()
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("abcdefghijklmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 22)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- b := make([]byte, 5)
-
- file, err = gfs.OpenId(id)
- c.Assert(err, IsNil)
-
- o, err := file.Seek(3, os.SEEK_SET)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(3))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("defgh"))
-
- o, err = file.Seek(5, os.SEEK_CUR)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(13))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("nopqr"))
-
- o, err = file.Seek(0, os.SEEK_END)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(22))
- n, err = file.Read(b)
- c.Assert(err, Equals, io.EOF)
- c.Assert(n, Equals, 0)
-
- o, err = file.Seek(-10, os.SEEK_END)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(12))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("mnopq"))
-
- o, err = file.Seek(8, os.SEEK_SET)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(8))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("ijklm"))
-
- // Trivial seek forward within same chunk. Already
- // got the data, shouldn't touch the database.
- sent := mgo.GetStats().SentOps
- o, err = file.Seek(1, os.SEEK_CUR)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(14))
- c.Assert(mgo.GetStats().SentOps, Equals, sent)
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("opqrs"))
-
- // Try seeking past end of file.
- file.Seek(3, os.SEEK_SET)
- o, err = file.Seek(23, os.SEEK_SET)
- c.Assert(err, ErrorMatches, "seek past end of file")
- c.Assert(o, Equals, int64(3))
-}
-
-func (s *S) TestGridFSRemoveId(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- id := file.Id()
- file.Close()
-
- err = gfs.RemoveId(id)
- c.Assert(err, IsNil)
-
- file, err = gfs.Open("myfile.txt")
- c.Assert(err, IsNil)
- defer file.Close()
-
- var b [1]byte
-
- _, err = file.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "1")
-
- n, err := db.C("fs.chunks").Find(M{"files_id": id}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 0)
-}
-
-func (s *S) TestGridFSRemove(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- file.Close()
-
- err = gfs.Remove("myfile.txt")
- c.Assert(err, IsNil)
-
- _, err = gfs.Open("myfile.txt")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
-
- n, err := db.C("fs.chunks").Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 0)
-}
-
-func (s *S) TestGridFSOpenNext(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile1.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile2.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- file.Close()
-
- var f *mgo.GridFile
- var b [1]byte
-
- iter := gfs.Find(nil).Sort("-filename").Iter()
-
- ok := gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, true)
- c.Check(f.Name(), Equals, "myfile2.txt")
-
- _, err = f.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "2")
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, true)
- c.Check(f.Name(), Equals, "myfile1.txt")
-
- _, err = f.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "1")
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
- c.Assert(f, IsNil)
-
- // Do it again with a more restrictive query to make sure
- // it's actually taken into account.
- iter = gfs.Find(bson.M{"filename": "myfile1.txt"}).Iter()
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, true)
- c.Check(f.Name(), Equals, "myfile1.txt")
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
- c.Assert(f, IsNil)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/internal/scram/scram_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/internal/scram/scram_test.go
deleted file mode 100644
index 61c19edb1b6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/internal/scram/scram_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package scram_test
-
-import (
- "crypto/sha1"
- "testing"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo/internal/scram"
- "strings"
-)
-
-var _ = Suite(&S{})
-
-func Test(t *testing.T) { TestingT(t) }
-
-type S struct{}
-
-var tests = [][]string{{
- "U: user pencil",
- "N: fyko+d2lbbFgONRv9qkxdawL",
- "C: n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL",
- "S: r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,s=QSXCR+Q6sek8bf92,i=4096",
- "C: c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts=",
- "S: v=rmF9pqV8S7suAoZWja4dJRkFsKQ=",
-}, {
- "U: root fe8c89e308ec08763df36333cbf5d3a2",
- "N: OTcxNDk5NjM2MzE5",
- "C: n,,n=root,r=OTcxNDk5NjM2MzE5",
- "S: r=OTcxNDk5NjM2MzE581Ra3provgG0iDsMkDiIAlrh4532dDLp,s=XRDkVrFC9JuL7/F4tG0acQ==,i=10000",
- "C: c=biws,r=OTcxNDk5NjM2MzE581Ra3provgG0iDsMkDiIAlrh4532dDLp,p=6y1jp9R7ETyouTXS9fW9k5UHdBc=",
- "S: v=LBnd9dUJRxdqZiEq91NKP3z/bHA=",
-}}
-
-func (s *S) TestExamples(c *C) {
- for _, steps := range tests {
- if len(steps) < 2 || len(steps[0]) < 3 || !strings.HasPrefix(steps[0], "U: ") {
- c.Fatalf("Invalid test: %#v", steps)
- }
- auth := strings.Fields(steps[0][3:])
- client := scram.NewClient(sha1.New, auth[0], auth[1])
- first, done := true, false
- c.Logf("-----")
- c.Logf("%s", steps[0])
- for _, step := range steps[1:] {
- c.Logf("%s", step)
- switch step[:3] {
- case "N: ":
- client.SetNonce([]byte(step[3:]))
- case "C: ":
- if first {
- first = false
- done = client.Step(nil)
- }
- c.Assert(done, Equals, false)
- c.Assert(client.Err(), IsNil)
- c.Assert(string(client.Out()), Equals, step[3:])
- case "S: ":
- first = false
- done = client.Step([]byte(step[3:]))
- default:
- panic("invalid test line: " + step)
- }
- }
- c.Assert(done, Equals, true)
- c.Assert(client.Err(), IsNil)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/queue_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/queue_test.go
deleted file mode 100644
index 23723d34af3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/queue_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo
-
-import (
- . "gopkg.in/check.v1"
-)
-
-type QS struct{}
-
-var _ = Suite(&QS{})
-
-func (s *QS) TestSequentialGrowth(c *C) {
- q := queue{}
- n := 2048
- for i := 0; i != n; i++ {
- q.Push(i)
- }
- for i := 0; i != n; i++ {
- c.Assert(q.Pop(), Equals, i)
- }
-}
-
-var queueTestLists = [][]int{
- // {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
-
- // {8, 9, 10, 11, ... 2, 3, 4, 5, 6, 7}
- {0, 1, 2, 3, 4, 5, 6, 7, -1, -1, 8, 9, 10, 11},
-
- // {8, 9, 10, 11, ... 2, 3, 4, 5, 6, 7}
- {0, 1, 2, 3, -1, -1, 4, 5, 6, 7, 8, 9, 10, 11},
-
- // {0, 1, 2, 3, 4, 5, 6, 7, 8}
- {0, 1, 2, 3, 4, 5, 6, 7, 8,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 0, 1, 2, 3, 4, 5, 6, 7, 8},
-}
-
-func (s *QS) TestQueueTestLists(c *C) {
- test := []int{}
- testi := 0
- reset := func() {
- test = test[0:0]
- testi = 0
- }
- push := func(i int) {
- test = append(test, i)
- }
- pop := func() (i int) {
- if testi == len(test) {
- return -1
- }
- i = test[testi]
- testi++
- return
- }
-
- for _, list := range queueTestLists {
- reset()
- q := queue{}
- for _, n := range list {
- if n == -1 {
- c.Assert(q.Pop(), Equals, pop(), Commentf("With list %#v", list))
- } else {
- q.Push(n)
- push(n)
- }
- }
-
- for n := pop(); n != -1; n = pop() {
- c.Assert(q.Pop(), Equals, n, Commentf("With list %#v", list))
- }
-
- c.Assert(q.Pop(), Equals, nil, Commentf("With list %#v", list))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/session_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/session_test.go
deleted file mode 100644
index e8ddbc1def6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/session_test.go
+++ /dev/null
@@ -1,3907 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo_test
-
-import (
- "flag"
- "fmt"
- "math"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "time"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/bson"
-)
-
-func (s *S) TestRunString(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run("ping", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestRunValue(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run(M{"ping": 1}, &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestPing(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Just ensure the nonce has been received.
- result := struct{}{}
- err = session.Run("ping", &result)
-
- mgo.ResetStats()
-
- err = session.Ping()
- c.Assert(err, IsNil)
-
- // Pretty boring.
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 1)
- c.Assert(stats.ReceivedOps, Equals, 1)
-}
-
-func (s *S) TestDialIPAddress(c *C) {
- session, err := mgo.Dial("127.0.0.1:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session, err = mgo.Dial("[::1%]:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-}
-
-func (s *S) TestURLSingle(c *C) {
- session, err := mgo.Dial("mongodb://localhost:40001/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run("ping", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestURLMany(c *C) {
- session, err := mgo.Dial("mongodb://localhost:40011,localhost:40012/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run("ping", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestURLParsing(c *C) {
- urls := []string{
- "localhost:40001?foo=1&bar=2",
- "localhost:40001?foo=1;bar=2",
- }
- for _, url := range urls {
- session, err := mgo.Dial(url)
- if session != nil {
- session.Close()
- }
- c.Assert(err, ErrorMatches, "unsupported connection URL option: (foo=1|bar=2)")
- }
-}
-
-func (s *S) TestInsertFindOne(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 1, "b": 3})
- c.Assert(err, IsNil)
-
- result := struct{ A, B int }{}
-
- err = coll.Find(M{"a": 1}).Sort("b").One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 1)
- c.Assert(result.B, Equals, 2)
-}
-
-func (s *S) TestInsertFindOneNil(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized.*|not authorized.*")
-}
-
-func (s *S) TestInsertFindOneMap(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
- result := make(M)
- err = coll.Find(M{"a": 1}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["a"], Equals, 1)
- c.Assert(result["b"], Equals, 2)
-}
-
-func (s *S) TestInsertFindAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 3, "b": 4})
- c.Assert(err, IsNil)
-
- type R struct{ A, B int }
- var result []R
-
- assertResult := func() {
- c.Assert(len(result), Equals, 2)
- c.Assert(result[0].A, Equals, 1)
- c.Assert(result[0].B, Equals, 2)
- c.Assert(result[1].A, Equals, 3)
- c.Assert(result[1].B, Equals, 4)
- }
-
- // nil slice
- err = coll.Find(nil).Sort("a").All(&result)
- c.Assert(err, IsNil)
- assertResult()
-
- // Previously allocated slice
- allocd := make([]R, 5)
- result = allocd
- err = coll.Find(nil).Sort("a").All(&result)
- c.Assert(err, IsNil)
- assertResult()
-
- // Ensure result is backed by the originally allocated array
- c.Assert(&result[0], Equals, &allocd[0])
-
- // Non-pointer slice error
- f := func() { coll.Find(nil).All(result) }
- c.Assert(f, Panics, "result argument must be a slice address")
-
- // Non-slice error
- f = func() { coll.Find(nil).All(new(int)) }
- c.Assert(f, Panics, "result argument must be a slice address")
-}
-
-func (s *S) TestFindRef(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db1 := session.DB("db1")
- db1col1 := db1.C("col1")
-
- db2 := session.DB("db2")
- db2col1 := db2.C("col1")
-
- err = db1col1.Insert(M{"_id": 1, "n": 1})
- c.Assert(err, IsNil)
- err = db1col1.Insert(M{"_id": 2, "n": 2})
- c.Assert(err, IsNil)
- err = db2col1.Insert(M{"_id": 2, "n": 3})
- c.Assert(err, IsNil)
-
- result := struct{ N int }{}
-
- ref1 := &mgo.DBRef{Collection: "col1", Id: 1}
- ref2 := &mgo.DBRef{Collection: "col1", Id: 2, Database: "db2"}
-
- err = db1.FindRef(ref1).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-
- err = db1.FindRef(ref2).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 3)
-
- err = db2.FindRef(ref1).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = db2.FindRef(ref2).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 3)
-
- err = session.FindRef(ref2).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 3)
-
- f := func() { session.FindRef(ref1).One(&result) }
- c.Assert(f, PanicMatches, "Can't resolve database for &mgo.DBRef{Collection:\"col1\", Id:1, Database:\"\"}")
-}
-
-func (s *S) TestDatabaseAndCollectionNames(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db1 := session.DB("db1")
- db1col1 := db1.C("col1")
- db1col2 := db1.C("col2")
-
- db2 := session.DB("db2")
- db2col1 := db2.C("col3")
-
- err = db1col1.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = db1col2.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = db2col1.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- names, err := session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(filterDBs(names), DeepEquals, []string{"db1", "db2"})
-
- // Try to exercise cursor logic. 2.8.0-rc3 still ignores this.
- session.SetBatch(2)
-
- names, err = db1.CollectionNames()
- c.Assert(err, IsNil)
- c.Assert(names, DeepEquals, []string{"col1", "col2", "system.indexes"})
-
- names, err = db2.CollectionNames()
- c.Assert(err, IsNil)
- c.Assert(names, DeepEquals, []string{"col3", "system.indexes"})
-}
-
-func (s *S) TestSelect(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- result := struct{ A, B int }{}
-
- err = coll.Find(M{"a": 1}).Select(M{"b": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 0)
- c.Assert(result.B, Equals, 2)
-}
-
-func (s *S) TestInlineMap(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- var v, result1 struct {
- A int
- M map[string]int ",inline"
- }
-
- v.A = 1
- v.M = map[string]int{"b": 2}
- err = coll.Insert(v)
- c.Assert(err, IsNil)
-
- noId := M{"_id": 0}
-
- err = coll.Find(nil).Select(noId).One(&result1)
- c.Assert(err, IsNil)
- c.Assert(result1.A, Equals, 1)
- c.Assert(result1.M, DeepEquals, map[string]int{"b": 2})
-
- var result2 M
- err = coll.Find(nil).Select(noId).One(&result2)
- c.Assert(err, IsNil)
- c.Assert(result2, DeepEquals, M{"a": 1, "b": 2})
-
-}
-
-func (s *S) TestUpdate(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"k": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- // No changes is a no-op and shouldn't return an error.
- err = coll.Update(M{"k": 42}, M{"$set": M{"n": 42}})
- c.Assert(err, IsNil)
-
- err = coll.Update(M{"k": 42}, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- result := make(M)
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 43)
-
- err = coll.Update(M{"k": 47}, M{"k": 47, "n": 47})
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.Find(M{"k": 47}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestUpdateId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"_id": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- err = coll.UpdateId(42, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- result := make(M)
- err = coll.FindId(42).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 43)
-
- err = coll.UpdateId(47, M{"k": 47, "n": 47})
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.FindId(47).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestUpdateNil(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"k": 42, "n": 42})
- c.Assert(err, IsNil)
- err = coll.Update(nil, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- result := make(M)
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 43)
-
- err = coll.Insert(M{"k": 45, "n": 45})
- c.Assert(err, IsNil)
- _, err = coll.UpdateAll(nil, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 44)
- err = coll.Find(M{"k": 45}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 46)
-}
-
-func (s *S) TestUpsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"k": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.Upsert(M{"k": 42}, M{"k": 42, "n": 24})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- result := M{}
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 24)
-
- // Insert with internally created id.
- info, err = coll.Upsert(M{"k": 47}, M{"k": 47, "n": 47})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.UpsertedId, NotNil)
-
- err = coll.Find(M{"k": 47}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 47)
-
- result = M{}
- err = coll.Find(M{"_id": info.UpsertedId}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 47)
-
- // Insert with provided id.
- info, err = coll.Upsert(M{"k": 48}, M{"k": 48, "n": 48, "_id": 48})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- if s.versionAtLeast(2, 6) {
- c.Assert(info.UpsertedId, Equals, 48)
- } else {
- c.Assert(info.UpsertedId, IsNil) // Unfortunate, but that's what Mongo gave us.
- }
-
- err = coll.Find(M{"k": 48}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 48)
-}
-
-func (s *S) TestUpsertId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"_id": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.UpsertId(42, M{"n": 24})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- result := M{}
- err = coll.FindId(42).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 24)
-
- info, err = coll.UpsertId(47, M{"_id": 47, "n": 47})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- if s.versionAtLeast(2, 6) {
- c.Assert(info.UpsertedId, Equals, 47)
- } else {
- c.Assert(info.UpsertedId, IsNil)
- }
-
- err = coll.FindId(47).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 47)
-}
-
-func (s *S) TestUpdateAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"k": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- // Don't actually modify the documents. Should still report 4 matching updates.
- info, err := coll.UpdateAll(M{"k": M{"$gt": 42}}, M{"$unset": M{"missing": 1}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 4)
-
- info, err = coll.UpdateAll(M{"k": M{"$gt": 42}}, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 4)
-
- result := make(M)
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 42)
-
- err = coll.Find(M{"k": 43}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 44)
-
- err = coll.Find(M{"k": 44}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 45)
-
- if !s.versionAtLeast(2, 6) {
- // 2.6 made this invalid.
- info, err = coll.UpdateAll(M{"k": 47}, M{"k": 47, "n": 47})
- c.Assert(err, Equals, nil)
- c.Assert(info.Updated, Equals, 0)
- }
-}
-
-func (s *S) TestRemove(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- err = coll.Remove(M{"n": M{"$gt": 42}})
- c.Assert(err, IsNil)
-
- result := &struct{ N int }{}
- err = coll.Find(M{"n": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 42)
-
- err = coll.Find(M{"n": 43}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.Find(M{"n": 44}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 44)
-}
-
-func (s *S) TestRemoveId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"_id": 40}, M{"_id": 41}, M{"_id": 42})
- c.Assert(err, IsNil)
-
- err = coll.RemoveId(41)
- c.Assert(err, IsNil)
-
- c.Assert(coll.FindId(40).One(nil), IsNil)
- c.Assert(coll.FindId(41).One(nil), Equals, mgo.ErrNotFound)
- c.Assert(coll.FindId(42).One(nil), IsNil)
-}
-
-func (s *S) TestRemoveUnsafe(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSafe(nil)
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"_id": 40}, M{"_id": 41}, M{"_id": 42})
- c.Assert(err, IsNil)
-
- err = coll.RemoveId(41)
- c.Assert(err, IsNil)
-
- c.Assert(coll.FindId(40).One(nil), IsNil)
- c.Assert(coll.FindId(41).One(nil), Equals, mgo.ErrNotFound)
- c.Assert(coll.FindId(42).One(nil), IsNil)
-}
-
-func (s *S) TestRemoveAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.RemoveAll(M{"n": M{"$gt": 42}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 4)
- c.Assert(info.UpsertedId, IsNil)
-
- result := &struct{ N int }{}
- err = coll.Find(M{"n": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 42)
-
- err = coll.Find(M{"n": 43}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.Find(M{"n": 44}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- info, err = coll.RemoveAll(nil)
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 3)
- c.Assert(info.UpsertedId, IsNil)
-
- n, err := coll.Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 0)
-}
-
-func (s *S) TestDropDatabase(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db1 := session.DB("db1")
- db1.C("col").Insert(M{"_id": 1})
-
- db2 := session.DB("db2")
- db2.C("col").Insert(M{"_id": 1})
-
- err = db1.DropDatabase()
- c.Assert(err, IsNil)
-
- names, err := session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(filterDBs(names), DeepEquals, []string{"db2"})
-
- err = db2.DropDatabase()
- c.Assert(err, IsNil)
-
- names, err = session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(filterDBs(names), DeepEquals, []string{})
-}
-
-func filterDBs(dbs []string) []string {
- var i int
- for _, name := range dbs {
- switch name {
- case "admin", "local":
- default:
- dbs[i] = name
- i++
- }
- }
- if len(dbs) == 0 {
- return []string{}
- }
- return dbs[:i]
-}
-
-func (s *S) TestDropCollection(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("db1")
- db.C("col1").Insert(M{"_id": 1})
- db.C("col2").Insert(M{"_id": 1})
-
- err = db.C("col1").DropCollection()
- c.Assert(err, IsNil)
-
- names, err := db.CollectionNames()
- c.Assert(err, IsNil)
- c.Assert(names, DeepEquals, []string{"col2", "system.indexes"})
-
- err = db.C("col2").DropCollection()
- c.Assert(err, IsNil)
-
- names, err = db.CollectionNames()
- c.Assert(err, IsNil)
- c.Assert(names, DeepEquals, []string{"system.indexes"})
-}
-
-func (s *S) TestCreateCollectionCapped(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- Capped: true,
- MaxBytes: 1024,
- MaxDocs: 3,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- ns := []int{1, 2, 3, 4, 5}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-}
-
-func (s *S) TestCreateCollectionNoIndex(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- DisableIdIndex: true,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(indexes, HasLen, 0)
-}
-
-func (s *S) TestCreateCollectionForceIndex(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- ForceIdIndex: true,
- Capped: true,
- MaxBytes: 1024,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(indexes, HasLen, 1)
-}
-
-func (s *S) TestIsDupValues(c *C) {
- c.Assert(mgo.IsDup(nil), Equals, false)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 1}), Equals, false)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 1}), Equals, false)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 11000}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 11000}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 11001}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 11001}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 12582}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 12582}), Equals, true)
- lerr := &mgo.LastError{Code: 16460, Err: "error inserting 1 documents to shard ... caused by :: E11000 duplicate key error index: ..."}
- c.Assert(mgo.IsDup(lerr), Equals, true)
-}
-
-func (s *S) TestIsDupPrimary(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestIsDupUnique(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- index := mgo.Index{
- Key: []string{"a", "b"},
- Unique: true,
- }
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(index)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"a": 1, "b": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 1, "b": 1})
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestIsDupCapped(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- ForceIdIndex: true,
- Capped: true,
- MaxBytes: 1024,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"_id": 1})
- // The error was different for capped collections before 2.6.
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
- // The issue is reduced by using IsDup.
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestIsDupFindAndModify(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"n"}, Unique: true})
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"n": 2})
- c.Assert(err, IsNil)
- _, err = coll.Find(M{"n": 1}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}}, bson.M{})
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestFindAndModify(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 42})
-
- session.SetMode(mgo.Monotonic, true)
-
- result := M{}
- info, err := coll.Find(M{"n": 42}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 42)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- // A nil result parameter should be acceptable.
- info, err = coll.Find(M{"n": 43}).Apply(mgo.Change{Update: M{"$unset": M{"missing": 1}}}, nil)
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 43}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}, ReturnNew: true}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 44)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 50}).Apply(mgo.Change{Upsert: true, Update: M{"n": 51, "o": 52}}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, NotNil)
-
- result = M{}
- info, err = coll.Find(nil).Sort("-n").Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}, ReturnNew: true}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 52)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 52}).Select(M{"o": 1}).Apply(mgo.Change{Remove: true}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], IsNil)
- c.Assert(result["o"], Equals, 52)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 60}).Apply(mgo.Change{Remove: true}, result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- c.Assert(len(result), Equals, 0)
- c.Assert(info, IsNil)
-}
-
-func (s *S) TestFindAndModifyBug997828(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": "not-a-number"})
-
- result := make(M)
- _, err = coll.Find(M{"n": "not-a-number"}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}}, result)
- c.Assert(err, ErrorMatches, `(exception: )?Cannot apply \$inc .*`)
- if s.versionAtLeast(2, 1) {
- qerr, _ := err.(*mgo.QueryError)
- c.Assert(qerr, NotNil, Commentf("err: %#v", err))
- if s.versionAtLeast(2, 6) {
- // Oh, the dance of error codes. :-(
- c.Assert(qerr.Code, Equals, 16837)
- } else {
- c.Assert(qerr.Code, Equals, 10140)
- }
- } else {
- lerr, _ := err.(*mgo.LastError)
- c.Assert(lerr, NotNil, Commentf("err: %#v", err))
- c.Assert(lerr.Code, Equals, 10140)
- }
-}
-
-func (s *S) TestCountCollection(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-}
-
-func (s *S) TestCountQuery(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(M{"n": M{"$gt": 40}}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestCountQuerySorted(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(M{"n": M{"$gt": 40}}).Sort("n").Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestCountSkipLimit(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(nil).Skip(1).Limit(3).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-
- n, err = coll.Find(nil).Skip(1).Limit(5).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
-}
-
-func (s *S) TestQueryExplain(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- m := M{}
- query := coll.Find(nil).Limit(2)
- err = query.Explain(m)
- c.Assert(err, IsNil)
- if m["queryPlanner"] != nil {
- c.Assert(m["executionStats"].(M)["totalDocsExamined"], Equals, 2)
- } else {
- c.Assert(m["cursor"], Equals, "BasicCursor")
- c.Assert(m["nscanned"], Equals, 2)
- c.Assert(m["n"], Equals, 2)
- }
-
- n := 0
- var result M
- iter := query.Iter()
- for iter.Next(&result) {
- n++
- }
- c.Assert(iter.Close(), IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestQuerySetMaxScan(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(nil).SetMaxScan(2)
- var result []M
- err = query.All(&result)
- c.Assert(err, IsNil)
- c.Assert(result, HasLen, 2)
-}
-
-func (s *S) TestQuerySetMaxTime(c *C) {
- if !s.versionAtLeast(2, 6) {
- c.Skip("SetMaxTime only supported in 2.6+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 1000; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(nil)
- query.SetMaxTime(1 * time.Millisecond)
- query.Batch(2)
- var result []M
- err = query.All(&result)
- c.Assert(err, ErrorMatches, "operation exceeded time limit")
-}
-
-func (s *S) TestQueryHint(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.EnsureIndexKey("a")
-
- m := M{}
- err = coll.Find(nil).Hint("a").Explain(m)
- c.Assert(err, IsNil)
-
- if m["queryPlanner"] != nil {
- m = m["queryPlanner"].(M)
- m = m["winningPlan"].(M)
- m = m["inputStage"].(M)
- c.Assert(m["indexName"], Equals, "a_1")
- } else {
- c.Assert(m["indexBounds"], NotNil)
- c.Assert(m["indexBounds"].(M)["a"], NotNil)
- }
-}
-
-func (s *S) TestQueryComment(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
- coll := db.C("mycoll")
-
- err = db.Run(bson.M{"profile": 2}, nil)
- c.Assert(err, IsNil)
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(bson.M{"n": 41})
- query.Comment("some comment")
- err = query.One(nil)
- c.Assert(err, IsNil)
-
- query = coll.Find(bson.M{"n": 41})
- query.Comment("another comment")
- err = query.One(nil)
- c.Assert(err, IsNil)
-
- commentField := "query.$comment"
- nField := "query.$query.n"
- if s.versionAtLeast(3, 2) {
- commentField = "query.comment"
- nField = "query.filter.n"
- }
- n, err := session.DB("mydb").C("system.profile").Find(bson.M{nField: 41, commentField: "some comment"}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (s *S) TestFindOneNotFound(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- result := struct{ A, B int }{}
- err = coll.Find(M{"a": 1}).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- c.Assert(err, ErrorMatches, "not found")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
-}
-
-func (s *S) TestFindNil(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- result := struct{ N int }{}
-
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-}
-
-func (s *S) TestFindId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"_id": 41, "n": 41})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"_id": 42, "n": 42})
- c.Assert(err, IsNil)
-
- result := struct{ N int }{}
-
- err = coll.FindId(42).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 42)
-}
-
-func (s *S) TestFindIterAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- iter := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2).Iter()
- result := struct{ N int }{}
- for i := 2; i < 7; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 1 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and their REPLY_OPs.
- c.Assert(stats.ReceivedDocs, Equals, 5)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindIterTwiceWithSameQuery(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 40; i != 47; i++ {
- coll.Insert(M{"n": i})
- }
-
- query := coll.Find(M{}).Sort("n")
-
- result1 := query.Skip(1).Iter()
- result2 := query.Skip(2).Iter()
-
- result := struct{ N int }{}
- ok := result2.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, 42)
- ok = result1.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, 41)
-}
-
-func (s *S) TestFindIterWithoutResults(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"n": 42})
-
- iter := coll.Find(M{"n": 0}).Iter()
-
- result := struct{ N int }{}
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
- c.Assert(result.N, Equals, 0)
-}
-
-func (s *S) TestFindIterLimit(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Limit(3)
- iter := query.Iter()
-
- result := struct{ N int }{}
- for i := 2; i < 5; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 2) // 1*QUERY_OP + 1*KILL_CURSORS_OP
- c.Assert(stats.ReceivedOps, Equals, 1) // and its REPLY_OP
- c.Assert(stats.ReceivedDocs, Equals, 3)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-var cursorTimeout = flag.Bool("cursor-timeout", false, "Enable cursor timeout test")
-
-func (s *S) TestFindIterCursorTimeout(c *C) {
- if !*cursorTimeout {
- c.Skip("-cursor-timeout")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- type Doc struct {
- Id int "_id"
- }
-
- coll := session.DB("test").C("test")
- coll.Remove(nil)
- for i := 0; i < 100; i++ {
- err = coll.Insert(Doc{i})
- c.Assert(err, IsNil)
- }
-
- session.SetBatch(1)
- iter := coll.Find(nil).Iter()
- var doc Doc
- if !iter.Next(&doc) {
- c.Fatalf("iterator failed to return any documents")
- }
-
- for i := 10; i > 0; i-- {
- c.Logf("Sleeping... %d minutes to go...", i)
- time.Sleep(1*time.Minute + 2*time.Second)
- }
-
- // Drain any existing documents that were fetched.
- if !iter.Next(&doc) {
- c.Fatalf("iterator with timed out cursor failed to return previously cached document")
- }
- if iter.Next(&doc) {
- c.Fatalf("timed out cursor returned document")
- }
-
- c.Assert(iter.Err(), Equals, mgo.ErrCursor)
-}
-
-func (s *S) TestTooManyItemsLimitBug(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(runtime.NumCPU()))
-
- mgo.SetDebug(false)
- coll := session.DB("mydb").C("mycoll")
- words := strings.Split("foo bar baz", " ")
- for i := 0; i < 5; i++ {
- words = append(words, words...)
- }
- doc := bson.D{{"words", words}}
- inserts := 10000
- limit := 5000
- iters := 0
- c.Assert(inserts > limit, Equals, true)
- for i := 0; i < inserts; i++ {
- err := coll.Insert(&doc)
- c.Assert(err, IsNil)
- }
- iter := coll.Find(nil).Limit(limit).Iter()
- for iter.Next(&doc) {
- if iters%100 == 0 {
- c.Logf("Seen %d docments", iters)
- }
- iters++
- }
- c.Assert(iter.Close(), IsNil)
- c.Assert(iters, Equals, limit)
-}
-
-func serverCursorsOpen(session *mgo.Session) int {
- var result struct {
- Cursors struct {
- TotalOpen int `bson:"totalOpen"`
- TimedOut int `bson:"timedOut"`
- }
- }
- err := session.Run("serverStatus", &result)
- if err != nil {
- panic(err)
- }
- return result.Cursors.TotalOpen
-}
-
-func (s *S) TestFindIterLimitWithMore(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Insane amounts of logging otherwise due to the
- // amount of data being shuffled.
- mgo.SetDebug(false)
- defer mgo.SetDebug(true)
-
- // Should amount to more than 4MB bson payload,
- // the default limit per result chunk.
- const total = 4096
- var d struct{ A [1024]byte }
- docs := make([]interface{}, total)
- for i := 0; i < total; i++ {
- docs[i] = &d
- }
- err = coll.Insert(docs...)
- c.Assert(err, IsNil)
-
- n, err := coll.Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, total)
-
- // First, try restricting to a single chunk with a negative limit.
- nresults := 0
- iter := coll.Find(nil).Limit(-total).Iter()
- var discard struct{}
- for iter.Next(&discard) {
- nresults++
- }
- if nresults < total/2 || nresults >= total {
- c.Fatalf("Bad result size with negative limit: %d", nresults)
- }
-
- cursorsOpen := serverCursorsOpen(session)
-
- // Try again, with a positive limit. Should reach the end now,
- // using multiple chunks.
- nresults = 0
- iter = coll.Find(nil).Limit(total).Iter()
- for iter.Next(&discard) {
- nresults++
- }
- c.Assert(nresults, Equals, total)
-
- // Ensure the cursor used is properly killed.
- c.Assert(serverCursorsOpen(session), Equals, cursorsOpen)
-
- // Edge case, -MinInt == -MinInt.
- nresults = 0
- iter = coll.Find(nil).Limit(math.MinInt32).Iter()
- for iter.Next(&discard) {
- nresults++
- }
- if nresults < total/2 || nresults >= total {
- c.Fatalf("Bad result size with MinInt32 limit: %d", nresults)
- }
-}
-
-func (s *S) TestFindIterLimitWithBatch(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(session.Ping(), IsNil)
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Limit(3).Batch(2)
- iter := query.Iter()
- result := struct{ N int }{}
- for i := 2; i < 5; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 1*GET_MORE_OP + 1*KILL_CURSORS_OP
- c.Assert(stats.ReceivedOps, Equals, 2) // and its REPLY_OPs
- c.Assert(stats.ReceivedDocs, Equals, 3)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindIterSortWithBatch(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- // Without this, the logic above breaks because Mongo refuses to
- // return a cursor with an in-memory sort.
- coll.EnsureIndexKey("n")
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(session.Ping(), IsNil)
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$lte": 44}}).Sort("-n").Batch(2)
- iter := query.Iter()
- ns = []int{46, 45, 44, 43, 42, 41, 40}
- result := struct{ N int }{}
- for i := 2; i < len(ns); i++ {
- c.Logf("i=%d", i)
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and its REPLY_OPs
- c.Assert(stats.ReceivedDocs, Equals, 5)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-// Test tailable cursors in a situation where Next has to sleep to
-// respect the timeout requested on Tail.
-func (s *S) TestFindTailTimeoutWithSleep(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cresult := struct{ ErrMsg string }{}
-
- db := session.DB("mydb")
- err = db.Run(bson.D{{"create", "mycoll"}, {"capped", true}, {"size", 1024}}, &cresult)
- c.Assert(err, IsNil)
- c.Assert(cresult.ErrMsg, Equals, "")
- coll := db.C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- timeout := 5 * time.Second
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Tail(timeout)
-
- n := len(ns)
- result := struct{ N int }{}
- for i := 2; i != n; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 { // The batch boundary.
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- mgo.ResetStats()
-
- // The following call to Next will block.
- done := make(chan bool)
- defer func() { <-done }()
- go func() {
- // The internal AwaitData timing of MongoDB is around 2 seconds,
- // so this should force mgo to sleep at least once by itself to
- // respect the requested timeout.
- c.Logf("[GOROUTINE] Starting and sleeping...")
- time.Sleep(timeout - 2*time.Second)
- c.Logf("[GOROUTINE] Woke up...")
- session := session.New()
- c.Logf("[GOROUTINE] Session created and will insert...")
- err := coll.Insert(M{"n": 47})
- c.Logf("[GOROUTINE] Insert attempted, err=%v...", err)
- session.Close()
- c.Logf("[GOROUTINE] Session closed.")
- c.Check(err, IsNil)
- done <- true
- }()
-
- c.Log("Will wait for Next with N=47...")
- ok := iter.Next(&result)
- c.Log("Next unblocked...")
- c.Assert(ok, Equals, true)
-
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 47)
- c.Log("Got Next with N=47!")
-
- c.Log("Will wait for a result which will never come...")
-
- started := time.Now()
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, true)
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
-
- c.Log("Will now reuse the timed out tail cursor...")
-
- coll.Insert(M{"n": 48})
- ok = iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Close(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 48)
-}
-
-// Test tailable cursors in a situation where Next never gets to sleep once
-// to respect the timeout requested on Tail.
-func (s *S) TestFindTailTimeoutNoSleep(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cresult := struct{ ErrMsg string }{}
-
- db := session.DB("mydb")
- err = db.Run(bson.D{{"create", "mycoll"}, {"capped", true}, {"size", 1024}}, &cresult)
- c.Assert(err, IsNil)
- c.Assert(cresult.ErrMsg, Equals, "")
- coll := db.C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- timeout := 1 * time.Second
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Tail(timeout)
-
- n := len(ns)
- result := struct{ N int }{}
- for i := 2; i != n; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 { // The batch boundary.
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- mgo.ResetStats()
-
- // The following call to Next will block.
- go func() {
- // The internal AwaitData timing of MongoDB is around 2 seconds,
- // so this item should arrive within the AwaitData threshold.
- time.Sleep(5e8)
- session := session.New()
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"n": 47})
- }()
-
- c.Log("Will wait for Next with N=47...")
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 47)
- c.Log("Got Next with N=47!")
-
- // The following may break because it depends a bit on the internal
- // timing used by MongoDB's AwaitData logic. If it does, the problem
- // will be observed as more GET_MORE_OPs than predicted:
- // 1*QUERY_OP for nonce + 1*GET_MORE_OP on Next +
- // 1*INSERT_OP + 1*QUERY_OP for getLastError on insert of 47
- stats := mgo.GetStats()
- if s.versionAtLeast(2, 6) {
- c.Assert(stats.SentOps, Equals, 3)
- } else {
- c.Assert(stats.SentOps, Equals, 4)
- }
- c.Assert(stats.ReceivedOps, Equals, 3) // REPLY_OPs for 1*QUERY_OP for nonce + 1*GET_MORE_OPs and 1*QUERY_OP
- c.Assert(stats.ReceivedDocs, Equals, 3) // nonce + N=47 result + getLastError response
-
- c.Log("Will wait for a result which will never come...")
-
- started := time.Now()
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, true)
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
-
- c.Log("Will now reuse the timed out tail cursor...")
-
- coll.Insert(M{"n": 48})
- ok = iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Close(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 48)
-}
-
-// Test tailable cursors in a situation where Next never gets to sleep once
-// to respect the timeout requested on Tail.
-func (s *S) TestFindTailNoTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cresult := struct{ ErrMsg string }{}
-
- db := session.DB("mydb")
- err = db.Run(bson.D{{"create", "mycoll"}, {"capped", true}, {"size", 1024}}, &cresult)
- c.Assert(err, IsNil)
- c.Assert(cresult.ErrMsg, Equals, "")
- coll := db.C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Tail(-1)
- c.Assert(err, IsNil)
-
- n := len(ns)
- result := struct{ N int }{}
- for i := 2; i != n; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 { // The batch boundary.
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- mgo.ResetStats()
-
- // The following call to Next will block.
- go func() {
- time.Sleep(5e8)
- session := session.New()
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"n": 47})
- }()
-
- c.Log("Will wait for Next with N=47...")
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 47)
- c.Log("Got Next with N=47!")
-
- c.Log("Will wait for a result which will never come...")
-
- gotNext := make(chan bool)
- go func() {
- ok := iter.Next(&result)
- gotNext <- ok
- }()
-
- select {
- case ok := <-gotNext:
- c.Fatalf("Next returned: %v", ok)
- case <-time.After(3e9):
- // Good. Should still be sleeping at that point.
- }
-
- // Closing the session should cause Next to return.
- session.Close()
-
- select {
- case ok := <-gotNext:
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), ErrorMatches, "Closed explicitly")
- c.Assert(iter.Timeout(), Equals, false)
- case <-time.After(1e9):
- c.Fatal("Closing the session did not unblock Next")
- }
-}
-
-func (s *S) TestIterNextResetsResult(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{1, 2, 3}
- for _, n := range ns {
- coll.Insert(M{"n" + strconv.Itoa(n): n})
- }
-
- query := coll.Find(nil).Sort("$natural")
-
- i := 0
- var sresult *struct{ N1, N2, N3 int }
- iter := query.Iter()
- for iter.Next(&sresult) {
- switch i {
- case 0:
- c.Assert(sresult.N1, Equals, 1)
- c.Assert(sresult.N2+sresult.N3, Equals, 0)
- case 1:
- c.Assert(sresult.N2, Equals, 2)
- c.Assert(sresult.N1+sresult.N3, Equals, 0)
- case 2:
- c.Assert(sresult.N3, Equals, 3)
- c.Assert(sresult.N1+sresult.N2, Equals, 0)
- }
- i++
- }
- c.Assert(iter.Close(), IsNil)
-
- i = 0
- var mresult M
- iter = query.Iter()
- for iter.Next(&mresult) {
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, M{"n3": 3})
- }
- i++
- }
- c.Assert(iter.Close(), IsNil)
-
- i = 0
- var iresult interface{}
- iter = query.Iter()
- for iter.Next(&iresult) {
- mresult, ok := iresult.(bson.M)
- c.Assert(ok, Equals, true, Commentf("%#v", iresult))
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, bson.M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, bson.M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, bson.M{"n3": 3})
- }
- i++
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestFindForOnIter(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Iter()
-
- i := 2
- var result *struct{ N int }
- err = iter.For(&result, func() error {
- c.Assert(i < 7, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 1 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and their REPLY_OPs.
- c.Assert(stats.ReceivedDocs, Equals, 5)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindFor(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
-
- i := 2
- var result *struct{ N int }
- err = query.For(&result, func() error {
- c.Assert(i < 7, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 1 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and their REPLY_OPs.
- c.Assert(stats.ReceivedDocs, Equals, 5)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindForStopOnError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- query := coll.Find(M{"n": M{"$gte": 42}})
- i := 2
- var result *struct{ N int }
- err = query.For(&result, func() error {
- c.Assert(i < 4, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 {
- return fmt.Errorf("stop!")
- }
- i++
- return nil
- })
- c.Assert(err, ErrorMatches, "stop!")
-}
-
-func (s *S) TestFindForResetsResult(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{1, 2, 3}
- for _, n := range ns {
- coll.Insert(M{"n" + strconv.Itoa(n): n})
- }
-
- query := coll.Find(nil).Sort("$natural")
-
- i := 0
- var sresult *struct{ N1, N2, N3 int }
- err = query.For(&sresult, func() error {
- switch i {
- case 0:
- c.Assert(sresult.N1, Equals, 1)
- c.Assert(sresult.N2+sresult.N3, Equals, 0)
- case 1:
- c.Assert(sresult.N2, Equals, 2)
- c.Assert(sresult.N1+sresult.N3, Equals, 0)
- case 2:
- c.Assert(sresult.N3, Equals, 3)
- c.Assert(sresult.N1+sresult.N2, Equals, 0)
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- i = 0
- var mresult M
- err = query.For(&mresult, func() error {
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, M{"n3": 3})
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- i = 0
- var iresult interface{}
- err = query.For(&iresult, func() error {
- mresult, ok := iresult.(bson.M)
- c.Assert(ok, Equals, true, Commentf("%#v", iresult))
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, bson.M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, bson.M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, bson.M{"n3": 3})
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestFindIterSnapshot(c *C) {
- if s.versionAtLeast(3, 2) {
- c.Skip("Broken in 3.2: https://jira.mongodb.org/browse/SERVER-21403")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Insane amounts of logging otherwise due to the
- // amount of data being shuffled.
- mgo.SetDebug(false)
- defer mgo.SetDebug(true)
-
- coll := session.DB("mydb").C("mycoll")
-
- var a [1024000]byte
-
- for n := 0; n < 10; n++ {
- err := coll.Insert(M{"_id": n, "n": n, "a1": &a})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(M{"n": M{"$gt": -1}}).Batch(2).Prefetch(0)
- query.Snapshot()
- iter := query.Iter()
-
- seen := map[int]bool{}
- result := struct {
- Id int "_id"
- }{}
- for iter.Next(&result) {
- if len(seen) == 2 {
- // Grow all entries so that they have to move.
- // Backwards so that the order is inverted.
- for n := 10; n >= 0; n-- {
- _, err := coll.Upsert(M{"_id": n}, M{"$set": M{"a2": &a}})
- c.Assert(err, IsNil)
- }
- }
- if seen[result.Id] {
- c.Fatalf("seen duplicated key: %d", result.Id)
- }
- seen[result.Id] = true
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestSort(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- coll.Insert(M{"a": 1, "b": 1})
- coll.Insert(M{"a": 2, "b": 2})
- coll.Insert(M{"a": 2, "b": 1})
- coll.Insert(M{"a": 0, "b": 1})
- coll.Insert(M{"a": 2, "b": 0})
- coll.Insert(M{"a": 0, "b": 2})
- coll.Insert(M{"a": 1, "b": 2})
- coll.Insert(M{"a": 0, "b": 0})
- coll.Insert(M{"a": 1, "b": 0})
-
- query := coll.Find(M{})
- query.Sort("-a") // Should be ignored.
- query.Sort("-b", "a")
- iter := query.Iter()
-
- l := make([]int, 18)
- r := struct{ A, B int }{}
- for i := 0; i != len(l); i += 2 {
- ok := iter.Next(&r)
- c.Assert(ok, Equals, true)
- c.Assert(err, IsNil)
- l[i] = r.A
- l[i+1] = r.B
- }
-
- c.Assert(l, DeepEquals, []int{0, 2, 1, 2, 2, 2, 0, 1, 1, 1, 2, 1, 0, 0, 1, 0, 2, 0})
-}
-
-func (s *S) TestSortWithBadArgs(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- f1 := func() { coll.Find(nil).Sort("") }
- f2 := func() { coll.Find(nil).Sort("+") }
- f3 := func() { coll.Find(nil).Sort("foo", "-") }
-
- for _, f := range []func(){f1, f2, f3} {
- c.Assert(f, PanicMatches, "Sort: empty field name")
- }
-}
-
-func (s *S) TestSortScoreText(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{
- Key: []string{"$text:a", "$text:b"},
- })
- msg := "text search not enabled"
- if err != nil && strings.Contains(err.Error(), msg) {
- c.Skip(msg)
- }
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{
- "a": "none",
- "b": "twice: foo foo",
- })
- c.Assert(err, IsNil)
- err = coll.Insert(M{
- "a": "just once: foo",
- "b": "none",
- })
- c.Assert(err, IsNil)
- err = coll.Insert(M{
- "a": "many: foo foo foo",
- "b": "none",
- })
- c.Assert(err, IsNil)
- err = coll.Insert(M{
- "a": "none",
- "b": "none",
- "c": "ignore: foo",
- })
- c.Assert(err, IsNil)
-
- query := coll.Find(M{"$text": M{"$search": "foo"}})
- query.Select(M{"score": M{"$meta": "textScore"}})
- query.Sort("$textScore:score")
- iter := query.Iter()
-
- var r struct{ A, B string }
- var results []string
- for iter.Next(&r) {
- results = append(results, r.A, r.B)
- }
-
- c.Assert(results, DeepEquals, []string{
- "many: foo foo foo", "none",
- "none", "twice: foo foo",
- "just once: foo", "none",
- })
-}
-
-func (s *S) TestPrefetching(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- const total = 600
- mgo.SetDebug(false)
- docs := make([]interface{}, total)
- for i := 0; i != total; i++ {
- docs[i] = bson.D{{"n", i}}
- }
- err = coll.Insert(docs...)
- c.Assert(err, IsNil)
-
- for testi := 0; testi < 5; testi++ {
- mgo.ResetStats()
-
- var iter *mgo.Iter
- var beforeMore int
-
- switch testi {
- case 0: // The default session value.
- session.SetBatch(100)
- iter = coll.Find(M{}).Iter()
- beforeMore = 75
-
- case 2: // Changing the session value.
- session.SetBatch(100)
- session.SetPrefetch(0.27)
- iter = coll.Find(M{}).Iter()
- beforeMore = 73
-
- case 1: // Changing via query methods.
- iter = coll.Find(M{}).Prefetch(0.27).Batch(100).Iter()
- beforeMore = 73
-
- case 3: // With prefetch on first document.
- iter = coll.Find(M{}).Prefetch(1.0).Batch(100).Iter()
- beforeMore = 0
-
- case 4: // Without prefetch.
- iter = coll.Find(M{}).Prefetch(0).Batch(100).Iter()
- beforeMore = 100
- }
-
- pings := 0
- for batchi := 0; batchi < len(docs)/100-1; batchi++ {
- c.Logf("Iterating over %d documents on batch %d", beforeMore, batchi)
- var result struct{ N int }
- for i := 0; i < beforeMore; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true, Commentf("iter.Err: %v", iter.Err()))
- }
- beforeMore = 99
- c.Logf("Done iterating.")
-
- session.Run("ping", nil) // Roundtrip to settle down.
- pings++
-
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, (batchi+1)*100+pings)
-
- c.Logf("Iterating over one more document on batch %d", batchi)
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true, Commentf("iter.Err: %v", iter.Err()))
- c.Logf("Done iterating.")
-
- session.Run("ping", nil) // Roundtrip to settle down.
- pings++
-
- stats = mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, (batchi+2)*100+pings)
- }
- }
-}
-
-func (s *S) TestSafeSetting(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Check the default
- safe := session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 0)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, false)
-
- // Tweak it
- session.SetSafe(&mgo.Safe{W: 1, WTimeout: 2, FSync: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 1)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // Reset it again.
- session.SetSafe(&mgo.Safe{})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 0)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, false)
-
- // Ensure safety to something more conservative.
- session.SetSafe(&mgo.Safe{W: 5, WTimeout: 6, J: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 5)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 6)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, true)
-
- // Ensure safety to something less conservative won't change it.
- session.EnsureSafe(&mgo.Safe{W: 4, WTimeout: 7})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 5)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 6)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, true)
-
- // But to something more conservative will.
- session.EnsureSafe(&mgo.Safe{W: 6, WTimeout: 4, FSync: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 6)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 4)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // Even more conservative.
- session.EnsureSafe(&mgo.Safe{WMode: "majority", WTimeout: 2})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "majority")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // WMode always overrides, whatever it is, but J doesn't.
- session.EnsureSafe(&mgo.Safe{WMode: "something", J: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "something")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // EnsureSafe with nil does nothing.
- session.EnsureSafe(nil)
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "something")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // Changing the safety of a cloned session doesn't touch the original.
- clone := session.Clone()
- defer clone.Close()
- clone.EnsureSafe(&mgo.Safe{WMode: "foo"})
- safe = session.Safe()
- c.Assert(safe.WMode, Equals, "something")
-}
-
-func (s *S) TestSafeInsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Insert an element with a predefined key.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- // Session should be safe by default, so inserting it again must fail.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, ErrorMatches, ".*E11000 duplicate.*")
- c.Assert(err.(*mgo.LastError).Code, Equals, 11000)
-
- // It must have sent two operations (INSERT_OP + getLastError QUERY_OP)
- stats := mgo.GetStats()
-
- if s.versionAtLeast(2, 6) {
- c.Assert(stats.SentOps, Equals, 1)
- } else {
- c.Assert(stats.SentOps, Equals, 2)
- }
-
- mgo.ResetStats()
-
- // If we disable safety, though, it won't complain.
- session.SetSafe(nil)
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Must have sent a single operation this time (just the INSERT_OP)
- stats = mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 1)
-}
-
-func (s *S) TestSafeParameters(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Tweak the safety parameters to something unachievable.
- session.SetSafe(&mgo.Safe{W: 4, WTimeout: 100})
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, ErrorMatches, "timeout|timed out waiting for slaves|Not enough data-bearing nodes|waiting for replication timed out") // :-(
- if !s.versionAtLeast(2, 6) {
- // 2.6 turned it into a query error.
- c.Assert(err.(*mgo.LastError).WTimeout, Equals, true)
- }
-}
-
-func (s *S) TestQueryErrorOne(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- result := struct {
- Err string "$err"
- }{}
-
- err = coll.Find(M{"a": 1}).Select(M{"a": M{"b": 1}}).One(&result)
- c.Assert(err, ErrorMatches, ".*Unsupported projection option:.*")
- c.Assert(err.(*mgo.QueryError).Message, Matches, ".*Unsupported projection option:.*")
- if s.versionAtLeast(2, 6) {
- // Oh, the dance of error codes. :-(
- c.Assert(err.(*mgo.QueryError).Code, Equals, 17287)
- } else {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 13097)
- }
-
- // The result should be properly unmarshalled with QueryError
- c.Assert(result.Err, Matches, ".*Unsupported projection option:.*")
-}
-
-func (s *S) TestQueryErrorNext(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- result := struct {
- Err string "$err"
- }{}
-
- iter := coll.Find(M{"a": 1}).Select(M{"a": M{"b": 1}}).Iter()
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
-
- err = iter.Close()
- c.Assert(err, ErrorMatches, ".*Unsupported projection option:.*")
- c.Assert(err.(*mgo.QueryError).Message, Matches, ".*Unsupported projection option:.*")
- if s.versionAtLeast(2, 6) {
- // Oh, the dance of error codes. :-(
- c.Assert(err.(*mgo.QueryError).Code, Equals, 17287)
- } else {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 13097)
- }
- c.Assert(iter.Err(), Equals, err)
-
- // The result should be properly unmarshalled with QueryError
- c.Assert(result.Err, Matches, ".*Unsupported projection option:.*")
-}
-
-var indexTests = []struct {
- index mgo.Index
- expected M
-}{{
- mgo.Index{
- Key: []string{"a"},
- Background: true,
- },
- M{
- "name": "a_1",
- "key": M{"a": 1},
- "ns": "mydb.mycoll",
- "background": true,
- },
-}, {
- mgo.Index{
- Key: []string{"a", "-b"},
- Unique: true,
- DropDups: true,
- },
- M{
- "name": "a_1_b_-1",
- "key": M{"a": 1, "b": -1},
- "ns": "mydb.mycoll",
- "unique": true,
- "dropDups": true,
- },
-}, {
- mgo.Index{
- Key: []string{"@loc_old"}, // Obsolete
- Min: -500,
- Max: 500,
- Bits: 32,
- },
- M{
- "name": "loc_old_2d",
- "key": M{"loc_old": "2d"},
- "ns": "mydb.mycoll",
- "min": -500.0,
- "max": 500.0,
- "bits": 32,
- },
-}, {
- mgo.Index{
- Key: []string{"$2d:loc"},
- Min: -500,
- Max: 500,
- Bits: 32,
- },
- M{
- "name": "loc_2d",
- "key": M{"loc": "2d"},
- "ns": "mydb.mycoll",
- "min": -500.0,
- "max": 500.0,
- "bits": 32,
- },
-}, {
- mgo.Index{
- Key: []string{"$2d:loc"},
- Minf: -500.1,
- Maxf: 500.1,
- Min: 1, // Should be ignored
- Max: 2,
- Bits: 32,
- },
- M{
- "name": "loc_2d",
- "key": M{"loc": "2d"},
- "ns": "mydb.mycoll",
- "min": -500.1,
- "max": 500.1,
- "bits": 32,
- },
-}, {
- mgo.Index{
- Key: []string{"$geoHaystack:loc", "type"},
- BucketSize: 1,
- },
- M{
- "name": "loc_geoHaystack_type_1",
- "key": M{"loc": "geoHaystack", "type": 1},
- "ns": "mydb.mycoll",
- "bucketSize": 1.0,
- },
-}, {
- mgo.Index{
- Key: []string{"$text:a", "$text:b"},
- Weights: map[string]int{"b": 42},
- },
- M{
- "name": "a_text_b_text",
- "key": M{"_fts": "text", "_ftsx": 1},
- "ns": "mydb.mycoll",
- "weights": M{"a": 1, "b": 42},
- "default_language": "english",
- "language_override": "language",
- "textIndexVersion": 2,
- },
-}, {
- mgo.Index{
- Key: []string{"$text:a"},
- DefaultLanguage: "portuguese",
- LanguageOverride: "idioma",
- },
- M{
- "name": "a_text",
- "key": M{"_fts": "text", "_ftsx": 1},
- "ns": "mydb.mycoll",
- "weights": M{"a": 1},
- "default_language": "portuguese",
- "language_override": "idioma",
- "textIndexVersion": 2,
- },
-}, {
- mgo.Index{
- Key: []string{"$text:$**"},
- },
- M{
- "name": "$**_text",
- "key": M{"_fts": "text", "_ftsx": 1},
- "ns": "mydb.mycoll",
- "weights": M{"$**": 1},
- "default_language": "english",
- "language_override": "language",
- "textIndexVersion": 2,
- },
-}, {
- mgo.Index{
- Key: []string{"cn"},
- Name: "CustomName",
- },
- M{
- "name": "CustomName",
- "key": M{"cn": 1},
- "ns": "mydb.mycoll",
- },
-}}
-
-func (s *S) TestEnsureIndex(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- idxs := session.DB("mydb").C("system.indexes")
-
- for _, test := range indexTests {
- err = coll.EnsureIndex(test.index)
- msg := "text search not enabled"
- if err != nil && strings.Contains(err.Error(), msg) {
- continue
- }
- c.Assert(err, IsNil)
-
- expectedName := test.index.Name
- if expectedName == "" {
- expectedName, _ = test.expected["name"].(string)
- }
-
- obtained := M{}
- err = idxs.Find(M{"name": expectedName}).One(obtained)
- c.Assert(err, IsNil)
-
- delete(obtained, "v")
-
- if s.versionAtLeast(2, 7) {
- // Was deprecated in 2.6, and not being reported by 2.7+.
- delete(test.expected, "dropDups")
- test.index.DropDups = false
- }
- if s.versionAtLeast(3, 2) && test.expected["textIndexVersion"] != nil {
- test.expected["textIndexVersion"] = 3
- }
-
- c.Assert(obtained, DeepEquals, test.expected)
-
- // The result of Indexes must match closely what was used to create the index.
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
- c.Assert(indexes, HasLen, 2)
- gotIndex := indexes[0]
- if gotIndex.Name == "_id_" {
- gotIndex = indexes[1]
- }
- wantIndex := test.index
- if wantIndex.Name == "" {
- wantIndex.Name = gotIndex.Name
- }
- if strings.HasPrefix(wantIndex.Key[0], "@") {
- wantIndex.Key[0] = "$2d:" + wantIndex.Key[0][1:]
- }
- if wantIndex.Minf == 0 && wantIndex.Maxf == 0 {
- wantIndex.Minf = float64(wantIndex.Min)
- wantIndex.Maxf = float64(wantIndex.Max)
- } else {
- wantIndex.Min = gotIndex.Min
- wantIndex.Max = gotIndex.Max
- }
- if wantIndex.DefaultLanguage == "" {
- wantIndex.DefaultLanguage = gotIndex.DefaultLanguage
- }
- if wantIndex.LanguageOverride == "" {
- wantIndex.LanguageOverride = gotIndex.LanguageOverride
- }
- for name, _ := range gotIndex.Weights {
- if _, ok := wantIndex.Weights[name]; !ok {
- if wantIndex.Weights == nil {
- wantIndex.Weights = make(map[string]int)
- }
- wantIndex.Weights[name] = 1
- }
- }
- c.Assert(gotIndex, DeepEquals, wantIndex)
-
- // Drop created index by key or by name if a custom name was used.
- if test.index.Name == "" {
- err = coll.DropIndex(test.index.Key...)
- c.Assert(err, IsNil)
- } else {
- err = coll.DropIndexName(test.index.Name)
- c.Assert(err, IsNil)
- }
- }
-}
-
-func (s *S) TestEnsureIndexWithBadInfo(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{})
- c.Assert(err, ErrorMatches, "invalid index key:.*")
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{""}})
- c.Assert(err, ErrorMatches, "invalid index key:.*")
-}
-
-func (s *S) TestEnsureIndexWithUnsafeSession(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSafe(nil)
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Should fail since there are duplicated entries.
- index := mgo.Index{
- Key: []string{"a"},
- Unique: true,
- }
-
- err = coll.EnsureIndex(index)
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
-}
-
-func (s *S) TestEnsureIndexKey(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("a", "-b")
- c.Assert(err, IsNil)
-
- sysidx := session.DB("mydb").C("system.indexes")
-
- result1 := M{}
- err = sysidx.Find(M{"name": "a_1"}).One(result1)
- c.Assert(err, IsNil)
-
- result2 := M{}
- err = sysidx.Find(M{"name": "a_1_b_-1"}).One(result2)
- c.Assert(err, IsNil)
-
- delete(result1, "v")
- expected1 := M{
- "name": "a_1",
- "key": M{"a": 1},
- "ns": "mydb.mycoll",
- }
- c.Assert(result1, DeepEquals, expected1)
-
- delete(result2, "v")
- expected2 := M{
- "name": "a_1_b_-1",
- "key": M{"a": 1, "b": -1},
- "ns": "mydb.mycoll",
- }
- c.Assert(result2, DeepEquals, expected2)
-}
-
-func (s *S) TestEnsureIndexDropIndex(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("-b")
- c.Assert(err, IsNil)
-
- err = coll.DropIndex("-b")
- c.Assert(err, IsNil)
-
- sysidx := session.DB("mydb").C("system.indexes")
-
- err = sysidx.Find(M{"name": "a_1"}).One(nil)
- c.Assert(err, IsNil)
-
- err = sysidx.Find(M{"name": "b_1"}).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndex("a")
- c.Assert(err, IsNil)
-
- err = sysidx.Find(M{"name": "a_1"}).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndex("a")
- c.Assert(err, ErrorMatches, "index not found.*")
-}
-
-func (s *S) TestEnsureIndexDropIndexName(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"b"}, Name: "a"})
- c.Assert(err, IsNil)
-
- err = coll.DropIndexName("a")
- c.Assert(err, IsNil)
-
- sysidx := session.DB("mydb").C("system.indexes")
-
- err = sysidx.Find(M{"name": "a_1"}).One(nil)
- c.Assert(err, IsNil)
-
- err = sysidx.Find(M{"name": "a"}).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndexName("a_1")
- c.Assert(err, IsNil)
-
- err = sysidx.Find(M{"name": "a_1"}).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndexName("a_1")
- c.Assert(err, ErrorMatches, "index not found.*")
-}
-
-func (s *S) TestEnsureIndexCaching(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- // Second EnsureIndex should be cached and do nothing.
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 0)
-
- // Resetting the cache should make it contact the server again.
- session.ResetIndexCache()
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-
- // Dropping the index should also drop the cached index key.
- err = coll.DropIndex("a")
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-}
-
-func (s *S) TestEnsureIndexGetIndexes(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("-b")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- // Obsolete.
- err = coll.EnsureIndexKey("@c")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("$2d:d")
- c.Assert(err, IsNil)
-
- // Try to exercise cursor logic. 2.8.0-rc3 still ignores this.
- session.SetBatch(2)
-
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
-
- c.Assert(indexes[0].Name, Equals, "_id_")
- c.Assert(indexes[1].Name, Equals, "a_1")
- c.Assert(indexes[1].Key, DeepEquals, []string{"a"})
- c.Assert(indexes[2].Name, Equals, "b_-1")
- c.Assert(indexes[2].Key, DeepEquals, []string{"-b"})
- c.Assert(indexes[3].Name, Equals, "c_2d")
- c.Assert(indexes[3].Key, DeepEquals, []string{"$2d:c"})
- c.Assert(indexes[4].Name, Equals, "d_2d")
- c.Assert(indexes[4].Key, DeepEquals, []string{"$2d:d"})
-}
-
-func (s *S) TestEnsureIndexNameCaching(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- // Second EnsureIndex should be cached and do nothing.
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 0)
-
- // Resetting the cache should make it contact the server again.
- session.ResetIndexCache()
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-
- // Dropping the index should also drop the cached index key.
- err = coll.DropIndexName("custom")
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-}
-
-func (s *S) TestEnsureIndexEvalGetIndexes(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({b: -1})"}}, nil)
- c.Assert(err, IsNil)
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({a: 1})"}}, nil)
- c.Assert(err, IsNil)
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({c: -1, e: 1})"}}, nil)
- c.Assert(err, IsNil)
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({d: '2d'})"}}, nil)
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
-
- c.Assert(indexes[0].Name, Equals, "_id_")
- c.Assert(indexes[1].Name, Equals, "a_1")
- c.Assert(indexes[1].Key, DeepEquals, []string{"a"})
- c.Assert(indexes[2].Name, Equals, "b_-1")
- c.Assert(indexes[2].Key, DeepEquals, []string{"-b"})
- c.Assert(indexes[3].Name, Equals, "c_-1_e_1")
- c.Assert(indexes[3].Key, DeepEquals, []string{"-c", "e"})
- if s.versionAtLeast(2, 2) {
- c.Assert(indexes[4].Name, Equals, "d_2d")
- c.Assert(indexes[4].Key, DeepEquals, []string{"$2d:d"})
- } else {
- c.Assert(indexes[4].Name, Equals, "d_")
- c.Assert(indexes[4].Key, DeepEquals, []string{"$2d:d"})
- }
-}
-
-var testTTL = flag.Bool("test-ttl", false, "test TTL collections (may take 1 minute)")
-
-func (s *S) TestEnsureIndexExpireAfter(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSafe(nil)
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1, "t": time.Now().Add(-120 * time.Second)})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"n": 2, "t": time.Now()})
- c.Assert(err, IsNil)
-
- // Should fail since there are duplicated entries.
- index := mgo.Index{
- Key: []string{"t"},
- ExpireAfter: 1 * time.Minute,
- }
-
- err = coll.EnsureIndex(index)
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
- c.Assert(indexes[1].Name, Equals, "t_1")
- c.Assert(indexes[1].ExpireAfter, Equals, 1*time.Minute)
-
- if *testTTL {
- worked := false
- stop := time.Now().Add(70 * time.Second)
- for time.Now().Before(stop) {
- n, err := coll.Count()
- c.Assert(err, IsNil)
- if n == 1 {
- worked = true
- break
- }
- c.Assert(n, Equals, 2)
- c.Logf("Still has 2 entries...")
- time.Sleep(1 * time.Second)
- }
- if !worked {
- c.Fatalf("TTL index didn't work")
- }
- }
-}
-
-func (s *S) TestDistinct(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- var result []int
- err = coll.Find(M{"n": M{"$gt": 2}}).Sort("n").Distinct("n", &result)
-
- sort.IntSlice(result).Sort()
- c.Assert(result, DeepEquals, []int{3, 4, 6})
-}
-
-func (s *S) TestMapReduce(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- }
- var result []struct {
- Id int "_id"
- Value int
- }
-
- info, err := coll.Find(M{"n": M{"$gt": 2}}).MapReduce(job, &result)
- c.Assert(err, IsNil)
- c.Assert(info.InputCount, Equals, 4)
- c.Assert(info.EmitCount, Equals, 4)
- c.Assert(info.OutputCount, Equals, 3)
- c.Assert(info.VerboseTime, IsNil)
-
- expected := map[int]int{3: 1, 4: 2, 6: 1}
- for _, item := range result {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
-}
-
-func (s *S) TestMapReduceFinalize(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1) }",
- Reduce: "function(key, values) { return Array.sum(values) }",
- Finalize: "function(key, count) { return {count: count} }",
- }
- var result []struct {
- Id int "_id"
- Value struct{ Count int }
- }
- _, err = coll.Find(nil).MapReduce(job, &result)
- c.Assert(err, IsNil)
-
- expected := map[int]int{1: 1, 2: 2, 3: 1, 4: 2, 6: 1}
- for _, item := range result {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value.Count, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
-}
-
-func (s *S) TestMapReduceToCollection(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Out: "mr",
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.InputCount, Equals, 7)
- c.Assert(info.EmitCount, Equals, 7)
- c.Assert(info.OutputCount, Equals, 5)
- c.Assert(info.Collection, Equals, "mr")
- c.Assert(info.Database, Equals, "mydb")
-
- expected := map[int]int{1: 1, 2: 2, 3: 1, 4: 2, 6: 1}
- var item *struct {
- Id int "_id"
- Value int
- }
- mr := session.DB("mydb").C("mr")
- iter := mr.Find(nil).Iter()
- for iter.Next(&item) {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestMapReduceToOtherDb(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Out: bson.D{{"replace", "mr"}, {"db", "otherdb"}},
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.InputCount, Equals, 7)
- c.Assert(info.EmitCount, Equals, 7)
- c.Assert(info.OutputCount, Equals, 5)
- c.Assert(info.Collection, Equals, "mr")
- c.Assert(info.Database, Equals, "otherdb")
-
- expected := map[int]int{1: 1, 2: 2, 3: 1, 4: 2, 6: 1}
- var item *struct {
- Id int "_id"
- Value int
- }
- mr := session.DB("otherdb").C("mr")
- iter := mr.Find(nil).Iter()
- for iter.Next(&item) {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestMapReduceOutOfOrder(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Out: bson.M{"a": "a", "z": "z", "replace": "mr", "db": "otherdb", "b": "b", "y": "y"},
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.Collection, Equals, "mr")
- c.Assert(info.Database, Equals, "otherdb")
-}
-
-func (s *S) TestMapReduceScope(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- coll.Insert(M{"n": 1})
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, x); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Scope: M{"x": 42},
- }
-
- var result []bson.M
- _, err = coll.Find(nil).MapReduce(job, &result)
- c.Assert(len(result), Equals, 1)
- c.Assert(result[0]["value"], Equals, 42.0)
-}
-
-func (s *S) TestMapReduceVerbose(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 100; i++ {
- err = coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Verbose: true,
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.VerboseTime, NotNil)
-}
-
-func (s *S) TestMapReduceLimit(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- }
-
- var result []bson.M
- _, err = coll.Find(nil).Limit(3).MapReduce(job, &result)
- c.Assert(err, IsNil)
- c.Assert(len(result), Equals, 3)
-}
-
-func (s *S) TestBuildInfo(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- info, err := session.BuildInfo()
- c.Assert(err, IsNil)
-
- var v []int
- for i, a := range strings.Split(info.Version, ".") {
- for _, token := range []string{"-rc", "-pre"} {
- if i == 2 && strings.Contains(a, token) {
- a = a[:strings.Index(a, token)]
- info.VersionArray[len(info.VersionArray)-1] = 0
- }
- }
- n, err := strconv.Atoi(a)
- c.Assert(err, IsNil)
- v = append(v, n)
- }
- for len(v) < 4 {
- v = append(v, 0)
- }
-
- c.Assert(info.VersionArray, DeepEquals, v)
- c.Assert(info.GitVersion, Matches, "[a-z0-9]+")
-
- if s.versionAtLeast(3, 2) {
- // It was deprecated in 3.2.
- c.Assert(info.SysInfo, Equals, "")
- } else {
- c.Assert(info.SysInfo, Matches, ".*[0-9:]+.*")
- }
- if info.Bits != 32 && info.Bits != 64 {
- c.Fatalf("info.Bits is %d", info.Bits)
- }
- if info.MaxObjectSize < 8192 {
- c.Fatalf("info.MaxObjectSize seems too small: %d", info.MaxObjectSize)
- }
-}
-
-func (s *S) TestZeroTimeRoundtrip(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- var d struct{ T time.Time }
- conn := session.DB("mydb").C("mycoll")
- err = conn.Insert(d)
- c.Assert(err, IsNil)
-
- var result bson.M
- err = conn.Find(nil).One(&result)
- c.Assert(err, IsNil)
- t, isTime := result["t"].(time.Time)
- c.Assert(isTime, Equals, true)
- c.Assert(t, Equals, time.Time{})
-}
-
-func (s *S) TestFsyncLock(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- clone := session.Clone()
- defer clone.Close()
-
- err = session.FsyncLock()
- c.Assert(err, IsNil)
-
- done := make(chan time.Time)
- go func() {
- time.Sleep(3e9)
- now := time.Now()
- err := session.FsyncUnlock()
- c.Check(err, IsNil)
- done <- now
- }()
-
- err = clone.DB("mydb").C("mycoll").Insert(bson.M{"n": 1})
- unlocked := time.Now()
- unlocking := <-done
- c.Assert(err, IsNil)
-
- c.Assert(unlocked.After(unlocking), Equals, true)
- c.Assert(unlocked.Sub(unlocking) < 1e9, Equals, true)
-}
-
-func (s *S) TestFsync(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Not much to do here. Just a smoke check.
- err = session.Fsync(false)
- c.Assert(err, IsNil)
- err = session.Fsync(true)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestRepairCursor(c *C) {
- if !s.versionAtLeast(2, 7) {
- c.Skip("RepairCursor only works on 2.7+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetBatch(2)
-
- coll := session.DB("mydb").C("mycoll3")
- err = coll.DropCollection()
-
- ns := []int{0, 10, 20, 30, 40, 50}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- repairIter := coll.Repair()
-
- c.Assert(repairIter.Err(), IsNil)
-
- result := struct{ N int }{}
- resultCounts := map[int]int{}
- for repairIter.Next(&result) {
- resultCounts[result.N]++
- }
-
- c.Assert(repairIter.Next(&result), Equals, false)
- c.Assert(repairIter.Err(), IsNil)
- c.Assert(repairIter.Close(), IsNil)
-
- // Verify that the results of the repair cursor are valid.
- // The repair cursor can return multiple copies
- // of the same document, so to check correctness we only
- // need to verify that at least 1 of each document was returned.
-
- for _, key := range ns {
- c.Assert(resultCounts[key] > 0, Equals, true)
- }
-}
-
-func (s *S) TestPipeIter(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- pipe := coll.Pipe([]M{{"$match": M{"n": M{"$gte": 42}}}})
-
- // Ensure cursor logic is working by forcing a small batch.
- pipe.Batch(2)
-
- // Smoke test for AllowDiskUse.
- pipe.AllowDiskUse()
-
- iter := pipe.Iter()
- result := struct{ N int }{}
- for i := 2; i < 7; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- }
-
- c.Assert(iter.Next(&result), Equals, false)
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestPipeAll(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- var result []struct{ N int }
- err = coll.Pipe([]M{{"$match": M{"n": M{"$gte": 42}}}}).All(&result)
- c.Assert(err, IsNil)
- for i := 2; i < 7; i++ {
- c.Assert(result[i-2].N, Equals, ns[i])
- }
-}
-
-func (s *S) TestPipeOne(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- result := struct{ A, B int }{}
-
- pipe := coll.Pipe([]M{{"$project": M{"a": 1, "b": M{"$add": []interface{}{"$b", 1}}}}})
- err = pipe.One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 1)
- c.Assert(result.B, Equals, 3)
-
- pipe = coll.Pipe([]M{{"$match": M{"a": 2}}})
- err = pipe.One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestPipeExplain(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- pipe := coll.Pipe([]M{{"$project": M{"a": 1, "b": M{"$add": []interface{}{"$b", 1}}}}})
-
- // The explain command result changes across versions.
- var result struct{ Ok int }
- err = pipe.Explain(&result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestBatch1Bug(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 3; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- var ns []struct{ N int }
- err = coll.Find(nil).Batch(1).All(&ns)
- c.Assert(err, IsNil)
- c.Assert(len(ns), Equals, 3)
-
- session.SetBatch(1)
- err = coll.Find(nil).All(&ns)
- c.Assert(err, IsNil)
- c.Assert(len(ns), Equals, 3)
-}
-
-func (s *S) TestInterfaceIterBug(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 3; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- var result interface{}
-
- i := 0
- iter := coll.Find(nil).Sort("n").Iter()
- for iter.Next(&result) {
- c.Assert(result.(bson.M)["n"], Equals, i)
- i++
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestFindIterCloseKillsCursor(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cursors := serverCursorsOpen(session)
-
- coll := session.DB("mydb").C("mycoll")
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err = coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- iter := coll.Find(nil).Batch(2).Iter()
- c.Assert(iter.Next(bson.M{}), Equals, true)
-
- c.Assert(iter.Close(), IsNil)
- c.Assert(serverCursorsOpen(session), Equals, cursors)
-}
-
-func (s *S) TestLogReplay(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- for i := 0; i < 5; i++ {
- err = coll.Insert(M{"ts": time.Now()})
- c.Assert(err, IsNil)
- }
-
- iter := coll.Find(nil).LogReplay().Iter()
- if s.versionAtLeast(2, 6) {
- // This used to fail in 2.4. Now it's just a smoke test.
- c.Assert(iter.Err(), IsNil)
- } else {
- c.Assert(iter.Next(bson.M{}), Equals, false)
- c.Assert(iter.Err(), ErrorMatches, "no ts field in query")
- }
-}
-
-func (s *S) TestSetCursorTimeout(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 42})
-
- // This is just a smoke test. Won't wait 10 minutes for an actual timeout.
-
- session.SetCursorTimeout(0)
-
- var result struct{ N int }
- iter := coll.Find(nil).Iter()
- c.Assert(iter.Next(&result), Equals, true)
- c.Assert(result.N, Equals, 42)
- c.Assert(iter.Next(&result), Equals, false)
-}
-
-func (s *S) TestNewIterNoServer(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- data, err := bson.Marshal(bson.M{"a": 1})
-
- coll := session.DB("mydb").C("mycoll")
- iter := coll.NewIter(nil, []bson.Raw{{3, data}}, 42, nil)
-
- var result struct{ A int }
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.A, Equals, 1)
-
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
-
- c.Assert(iter.Err(), ErrorMatches, "server not available")
-}
-
-func (s *S) TestNewIterNoServerPresetErr(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- data, err := bson.Marshal(bson.M{"a": 1})
-
- coll := session.DB("mydb").C("mycoll")
- iter := coll.NewIter(nil, []bson.Raw{{3, data}}, 42, fmt.Errorf("my error"))
-
- var result struct{ A int }
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.A, Equals, 1)
-
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
-
- c.Assert(iter.Err(), ErrorMatches, "my error")
-}
-
-func (s *S) TestBypassValidation(c *C) {
- if !s.versionAtLeast(3, 2) {
- c.Skip("validation supported on 3.2+")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- err = coll.Database.Run(bson.D{
- {"collMod", "mycoll"},
- {"validator", M{"s": M{"$type": "string"}}},
- }, nil)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 2})
- c.Assert(err, ErrorMatches, "Document failed validation")
-
- err = coll.Update(M{"n": 1}, M{"n": 10})
- c.Assert(err, ErrorMatches, "Document failed validation")
-
- session.SetBypassValidation(true)
-
- err = coll.Insert(M{"n": 3})
- c.Assert(err, IsNil)
-
- err = coll.Update(M{"n": 3}, M{"n": 4})
- c.Assert(err, IsNil)
-
- // Ensure this still works. Shouldn't be affected.
- err = coll.Remove(M{"n": 1})
- c.Assert(err, IsNil)
-
- var result struct{ N int }
- var ns []int
- iter := coll.Find(nil).Iter()
- for iter.Next(&result) {
- ns = append(ns, result.N)
- }
- c.Assert(iter.Err(), IsNil)
- sort.Ints(ns)
- c.Assert(ns, DeepEquals, []int{4})
-}
-
-// --------------------------------------------------------------------------
-// Some benchmarks that require a running database.
-
-func (s *S) BenchmarkFindIterRaw(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- doc := bson.D{
- {"f2", "a short string"},
- {"f3", bson.D{{"1", "one"}, {"2", 2.0}}},
- {"f4", []string{"a", "b", "c", "d", "e", "f", "g"}},
- }
-
- for i := 0; i < c.N+1; i++ {
- err := coll.Insert(doc)
- c.Assert(err, IsNil)
- }
-
- session.SetBatch(c.N)
-
- var raw bson.Raw
- iter := coll.Find(nil).Iter()
- iter.Next(&raw)
- c.ResetTimer()
- i := 0
- for iter.Next(&raw) {
- i++
- }
- c.StopTimer()
- c.Assert(iter.Err(), IsNil)
- c.Assert(i, Equals, c.N)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/suite_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/suite_test.go
deleted file mode 100644
index ea3806f58eb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/suite_test.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2015-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-//
-// Based on gopkg.io/mgo.v2 by Gustavo Niemeyer.
-// See THIRD-PARTY-NOTICES for original license terms.
-
-package mgo_test
-
-import (
- "errors"
- "flag"
- "fmt"
- "net"
- "os/exec"
- "runtime"
- "strconv"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/bson"
-)
-
-var fast = flag.Bool("fast", false, "Skip slow tests")
-
-type M bson.M
-
-type cLogger C
-
-func (c *cLogger) Output(calldepth int, s string) error {
- ns := time.Now().UnixNano()
- t := float64(ns%100e9) / 1e9
- ((*C)(c)).Logf("[LOG] %.05f %s", t, s)
- return nil
-}
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- session *mgo.Session
- stopped bool
- build mgo.BuildInfo
- frozen []string
-}
-
-func (s *S) versionAtLeast(v ...int) (result bool) {
- for i := range v {
- if i == len(s.build.VersionArray) {
- return false
- }
- if s.build.VersionArray[i] != v[i] {
- return s.build.VersionArray[i] >= v[i]
- }
- }
- return true
-}
-
-var _ = Suite(&S{})
-
-func (s *S) SetUpSuite(c *C) {
- mgo.SetDebug(true)
- mgo.SetStats(true)
- s.StartAll()
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- s.build, err = session.BuildInfo()
- c.Check(err, IsNil)
- session.Close()
-}
-
-func (s *S) SetUpTest(c *C) {
- err := run("mongo --nodb testdb/dropall.js")
- if err != nil {
- panic(err.Error())
- }
- mgo.SetLogger((*cLogger)(c))
- mgo.ResetStats()
-}
-
-func (s *S) TearDownTest(c *C) {
- if s.stopped {
- s.Stop(":40201")
- s.Stop(":40202")
- s.Stop(":40203")
- s.StartAll()
- }
- for _, host := range s.frozen {
- if host != "" {
- s.Thaw(host)
- }
- }
- var stats mgo.Stats
- for i := 0; ; i++ {
- stats = mgo.GetStats()
- if stats.SocketsInUse == 0 && stats.SocketsAlive == 0 {
- break
- }
- if i == 20 {
- c.Fatal("Test left sockets in a dirty state")
- }
- c.Logf("Waiting for sockets to die: %d in use, %d alive", stats.SocketsInUse, stats.SocketsAlive)
- time.Sleep(500 * time.Millisecond)
- }
- for i := 0; ; i++ {
- stats = mgo.GetStats()
- if stats.Clusters == 0 {
- break
- }
- if i == 60 {
- c.Fatal("Test left clusters alive")
- }
- c.Logf("Waiting for clusters to die: %d alive", stats.Clusters)
- time.Sleep(1 * time.Second)
- }
-}
-
-func (s *S) Stop(host string) {
- // Give a moment for slaves to sync and avoid getting rollback issues.
- panicOnWindows()
- time.Sleep(2 * time.Second)
- err := run("cd _testdb && supervisorctl stop " + supvName(host))
- if err != nil {
- panic(err)
- }
- s.stopped = true
-}
-
-func (s *S) pid(host string) int {
- output, err := exec.Command("lsof", "-iTCP:"+hostPort(host), "-sTCP:LISTEN", "-Fp").CombinedOutput()
- if err != nil {
- panic(err)
- }
- pidstr := string(output[1 : len(output)-1])
- pid, err := strconv.Atoi(pidstr)
- if err != nil {
- panic("cannot convert pid to int: " + pidstr)
- }
- return pid
-}
-
-func (s *S) Freeze(host string) {
- err := stop(s.pid(host))
- if err != nil {
- panic(err)
- }
- s.frozen = append(s.frozen, host)
-}
-
-func (s *S) Thaw(host string) {
- err := cont(s.pid(host))
- if err != nil {
- panic(err)
- }
- for i, frozen := range s.frozen {
- if frozen == host {
- s.frozen[i] = ""
- }
- }
-}
-
-func (s *S) StartAll() {
- if s.stopped {
- // Restart any stopped nodes.
- run("cd _testdb && supervisorctl start all")
- err := run("cd testdb && mongo --nodb wait.js")
- if err != nil {
- panic(err)
- }
- s.stopped = false
- }
-}
-
-func run(command string) error {
- var output []byte
- var err error
- if runtime.GOOS == "windows" {
- output, err = exec.Command("cmd", "/C", command).CombinedOutput()
- } else {
- output, err = exec.Command("/bin/sh", "-c", command).CombinedOutput()
- }
-
- if err != nil {
- msg := fmt.Sprintf("Failed to execute: %s: %s\n%s", command, err.Error(), string(output))
- return errors.New(msg)
- }
- return nil
-}
-
-var supvNames = map[string]string{
- "40001": "db1",
- "40002": "db2",
- "40011": "rs1a",
- "40012": "rs1b",
- "40013": "rs1c",
- "40021": "rs2a",
- "40022": "rs2b",
- "40023": "rs2c",
- "40031": "rs3a",
- "40032": "rs3b",
- "40033": "rs3c",
- "40041": "rs4a",
- "40101": "cfg1",
- "40102": "cfg2",
- "40103": "cfg3",
- "40201": "s1",
- "40202": "s2",
- "40203": "s3",
-}
-
-// supvName returns the supervisord name for the given host address.
-func supvName(host string) string {
- host, port, err := net.SplitHostPort(host)
- if err != nil {
- panic(err)
- }
- name, ok := supvNames[port]
- if !ok {
- panic("Unknown host: " + host)
- }
- return name
-}
-
-func hostPort(host string) string {
- _, port, err := net.SplitHostPort(host)
- if err != nil {
- panic(err)
- }
- return port
-}
-
-func panicOnWindows() {
- if runtime.GOOS == "windows" {
- panic("the test suite is not yet fully supported on Windows")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_test.go
deleted file mode 100644
index b8bbd7b340f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_test.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !windows
-
-package mgo_test
-
-import (
- "syscall"
-)
-
-func stop(pid int) (err error) {
- return syscall.Kill(pid, syscall.SIGSTOP)
-}
-
-func cont(pid int) (err error) {
- return syscall.Kill(pid, syscall.SIGCONT)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_windows_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_windows_test.go
deleted file mode 100644
index f2deaca86ec..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/syscall_windows_test.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package mgo_test
-
-func stop(pid int) (err error) {
- panicOnWindows() // Always does.
- return nil
-}
-
-func cont(pid int) (err error) {
- panicOnWindows() // Always does.
- return nil
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/export_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/export_test.go
deleted file mode 100644
index 2b2e093fc2f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/export_test.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package testserver
-
-import (
- "os"
-)
-
-func (ts *TestServer) ProcessTest() *os.Process {
- if ts.server == nil {
- return nil
- }
- return ts.server.Process
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/testserver_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/testserver_test.go
deleted file mode 100644
index 6a65cf69aeb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/testserver/testserver_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package testserver_test
-
-import (
- "os"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/testserver"
-)
-
-type M map[string]interface{}
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- oldCheckSessions string
-}
-
-var _ = Suite(&S{})
-
-func (s *S) SetUpTest(c *C) {
- s.oldCheckSessions = os.Getenv("CHECK_SESSIONS")
- os.Setenv("CHECK_SESSIONS", "")
-}
-
-func (s *S) TearDownTest(c *C) {
- os.Setenv("CHECK_SESSIONS", s.oldCheckSessions)
-}
-
-func (s *S) TestWipeData(c *C) {
- var server testserver.TestServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- session := server.Session()
- err := session.DB("mydb").C("mycoll").Insert(M{"a": 1})
- session.Close()
- c.Assert(err, IsNil)
-
- server.Wipe()
-
- session = server.Session()
- names, err := session.DatabaseNames()
- session.Close()
- c.Assert(err, IsNil)
- for _, name := range names {
- if name != "local" && name != "admin" {
- c.Fatalf("Wipe should have removed this database: %s", name)
- }
- }
-}
-
-func (s *S) TestStop(c *C) {
- var server testserver.TestServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- // Server should not be running.
- process := server.ProcessTest()
- c.Assert(process, IsNil)
-
- session := server.Session()
- addr := session.LiveServers()[0]
- session.Close()
-
- // Server should be running now.
- process = server.ProcessTest()
- p, err := os.FindProcess(process.Pid)
- c.Assert(err, IsNil)
- p.Release()
-
- server.Stop()
-
- // Server should not be running anymore.
- session, err = mgo.DialWithTimeout(addr, 500*time.Millisecond)
- if session != nil {
- session.Close()
- c.Fatalf("Stop did not stop the server")
- }
-}
-
-func (s *S) TestCheckSessions(c *C) {
- var server testserver.TestServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- session := server.Session()
- defer session.Close()
- c.Assert(server.Wipe, PanicMatches, "There are mgo sessions still alive.")
-}
-
-func (s *S) TestCheckSessionsDisabled(c *C) {
- var server testserver.TestServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- os.Setenv("CHECK_SESSIONS", "0")
-
- // Should not panic, although it looks to Wipe like this session will leak.
- session := server.Session()
- defer session.Close()
- server.Wipe()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/dockey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/dockey_test.go
deleted file mode 100644
index e8dee952cf4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/dockey_test.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package txn
-
-import (
- "sort"
-
- . "gopkg.in/check.v1"
-)
-
-type DocKeySuite struct{}
-
-var _ = Suite(&DocKeySuite{})
-
-type T struct {
- A int
- B string
-}
-
-type T2 struct {
- A int
- B string
-}
-
-type T3 struct {
- A int
- B string
-}
-
-type T4 struct {
- A int
- B string
-}
-
-type T5 struct {
- F int
- Q string
-}
-
-type T6 struct {
- A int
- B string
-}
-
-type T7 struct {
- A bool
- B float64
-}
-
-type T8 struct {
- A int
- B string
-}
-
-type T9 struct {
- A int
- B string
- C bool
-}
-
-type T10 struct {
- C int `bson:"a"`
- D string `bson:"b,omitempty"`
-}
-
-type T11 struct {
- C int
- D string
-}
-
-type T12 struct {
- S string
-}
-
-type T13 struct {
- p, q, r bool
- S string
-}
-
-var docKeysTests = [][]docKeys{
- {{
- {"c", 1},
- {"c", 5},
- {"c", 2},
- }, {
- {"c", 1},
- {"c", 2},
- {"c", 5},
- }}, {{
- {"c", "foo"},
- {"c", "bar"},
- {"c", "bob"},
- }, {
- {"c", "bar"},
- {"c", "bob"},
- {"c", "foo"},
- }}, {{
- {"c", 0.2},
- {"c", 0.07},
- {"c", 0.9},
- }, {
- {"c", 0.07},
- {"c", 0.2},
- {"c", 0.9},
- }}, {{
- {"c", true},
- {"c", false},
- {"c", true},
- }, {
- {"c", false},
- {"c", true},
- {"c", true},
- }}, {{
- {"c", T{1, "b"}},
- {"c", T{1, "a"}},
- {"c", T{0, "b"}},
- {"c", T{0, "a"}},
- }, {
- {"c", T{0, "a"}},
- {"c", T{0, "b"}},
- {"c", T{1, "a"}},
- {"c", T{1, "b"}},
- }}, {{
- {"c", T{1, "a"}},
- {"c", T{0, "a"}},
- }, {
- {"c", T{0, "a"}},
- {"c", T{1, "a"}},
- }}, {{
- {"c", T3{0, "b"}},
- {"c", T2{1, "b"}},
- {"c", T3{1, "a"}},
- {"c", T2{0, "a"}},
- }, {
- {"c", T2{0, "a"}},
- {"c", T3{0, "b"}},
- {"c", T3{1, "a"}},
- {"c", T2{1, "b"}},
- }}, {{
- {"c", T5{1, "b"}},
- {"c", T4{1, "b"}},
- {"c", T5{0, "a"}},
- {"c", T4{0, "a"}},
- }, {
- {"c", T4{0, "a"}},
- {"c", T5{0, "a"}},
- {"c", T4{1, "b"}},
- {"c", T5{1, "b"}},
- }}, {{
- {"c", T6{1, "b"}},
- {"c", T7{true, 0.2}},
- {"c", T6{0, "a"}},
- {"c", T7{false, 0.04}},
- }, {
- {"c", T6{0, "a"}},
- {"c", T6{1, "b"}},
- {"c", T7{false, 0.04}},
- {"c", T7{true, 0.2}},
- }}, {{
- {"c", T9{1, "b", true}},
- {"c", T8{1, "b"}},
- {"c", T9{0, "a", false}},
- {"c", T8{0, "a"}},
- }, {
- {"c", T9{0, "a", false}},
- {"c", T8{0, "a"}},
- {"c", T9{1, "b", true}},
- {"c", T8{1, "b"}},
- }}, {{
- {"b", 2},
- {"a", 5},
- {"c", 2},
- {"b", 1},
- }, {
- {"a", 5},
- {"b", 1},
- {"b", 2},
- {"c", 2},
- }}, {{
- {"c", T11{1, "a"}},
- {"c", T11{1, "a"}},
- {"c", T10{1, "a"}},
- }, {
- {"c", T10{1, "a"}},
- {"c", T11{1, "a"}},
- {"c", T11{1, "a"}},
- }}, {{
- {"c", T12{"a"}},
- {"c", T13{false, true, false, "a"}},
- {"c", T12{"b"}},
- {"c", T13{false, true, false, "b"}},
- }, {
- {"c", T12{"a"}},
- {"c", T13{false, true, false, "a"}},
- {"c", T12{"b"}},
- {"c", T13{false, true, false, "b"}},
- }},
-}
-
-func (s *DocKeySuite) TestSort(c *C) {
- for _, test := range docKeysTests {
- keys := test[0]
- expected := test[1]
- sort.Sort(keys)
- c.Check(keys, DeepEquals, expected)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/mgo_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/mgo_test.go
deleted file mode 100644
index 589e134063c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/mgo_test.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package txn_test
-
-import (
- "bytes"
- "github.com/10gen/llmgo"
- . "gopkg.in/check.v1"
- "os/exec"
- "time"
-)
-
-// ----------------------------------------------------------------------------
-// The mgo test suite
-
-type MgoSuite struct {
- output bytes.Buffer
- server *exec.Cmd
- session *mgo.Session
-}
-
-var mgoaddr = "127.0.0.1:50017"
-
-func (s *MgoSuite) SetUpSuite(c *C) {
- //mgo.SetDebug(true)
- mgo.SetStats(true)
- dbdir := c.MkDir()
- args := []string{
- "--dbpath", dbdir,
- "--bind_ip", "127.0.0.1",
- "--port", "50017",
- "--nssize", "1",
- "--noprealloc",
- "--smallfiles",
- "--nojournal",
- "-vvvvv",
- }
- s.server = exec.Command("mongod", args...)
- s.server.Stdout = &s.output
- s.server.Stderr = &s.output
- err := s.server.Start()
- if err != nil {
- panic(err)
- }
-}
-
-func (s *MgoSuite) TearDownSuite(c *C) {
- s.server.Process.Kill()
- s.server.Process.Wait()
-}
-
-func (s *MgoSuite) SetUpTest(c *C) {
- err := DropAll(mgoaddr)
- if err != nil {
- panic(err)
- }
- mgo.SetLogger(c)
- mgo.ResetStats()
-
- s.session, err = mgo.Dial(mgoaddr)
- c.Assert(err, IsNil)
-}
-
-func (s *MgoSuite) TearDownTest(c *C) {
- if s.session != nil {
- s.session.Close()
- }
- for i := 0; ; i++ {
- stats := mgo.GetStats()
- if stats.SocketsInUse == 0 && stats.SocketsAlive == 0 {
- break
- }
- if i == 20 {
- c.Fatal("Test left sockets in a dirty state")
- }
- c.Logf("Waiting for sockets to die: %d in use, %d alive", stats.SocketsInUse, stats.SocketsAlive)
- time.Sleep(500 * time.Millisecond)
- }
-}
-
-func DropAll(mongourl string) (err error) {
- session, err := mgo.Dial(mongourl)
- if err != nil {
- return err
- }
- defer session.Close()
-
- names, err := session.DatabaseNames()
- if err != nil {
- return err
- }
- for _, name := range names {
- switch name {
- case "admin", "local", "config":
- default:
- err = session.DB(name).DropDatabase()
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/sim_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/sim_test.go
deleted file mode 100644
index 645735461e9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/sim_test.go
+++ /dev/null
@@ -1,388 +0,0 @@
-package txn_test
-
-import (
- "flag"
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/bson"
- "github.com/10gen/llmgo/txn"
- . "gopkg.in/check.v1"
- "math/rand"
- "time"
-)
-
-var (
- duration = flag.Duration("duration", 200*time.Millisecond, "duration for each simulation")
- seed = flag.Int64("seed", 0, "seed for rand")
-)
-
-type params struct {
- killChance float64
- slowdownChance float64
- slowdown time.Duration
-
- unsafe bool
- workers int
- accounts int
- changeHalf bool
- reinsertCopy bool
- reinsertZeroed bool
- changelog bool
-
- changes int
-}
-
-func (s *S) TestSim1Worker(c *C) {
- simulate(c, params{
- workers: 1,
- accounts: 4,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSim4WorkersDense(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 2,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSim4WorkersSparse(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 10,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimHalf1Worker(c *C) {
- simulate(c, params{
- workers: 1,
- accounts: 4,
- changeHalf: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimHalf4WorkersDense(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 2,
- changeHalf: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimHalf4WorkersSparse(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 10,
- changeHalf: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertCopy1Worker(c *C) {
- simulate(c, params{
- workers: 1,
- accounts: 10,
- reinsertCopy: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertCopy4Workers(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 10,
- reinsertCopy: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertZeroed1Worker(c *C) {
- simulate(c, params{
- workers: 1,
- accounts: 10,
- reinsertZeroed: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertZeroed4Workers(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 10,
- reinsertZeroed: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimChangeLog(c *C) {
- simulate(c, params{
- workers: 4,
- accounts: 10,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- changelog: true,
- })
-}
-
-type balanceChange struct {
- id bson.ObjectId
- origin int
- target int
- amount int
-}
-
-func simulate(c *C, params params) {
- seed := *seed
- if seed == 0 {
- seed = time.Now().UnixNano()
- }
- rand.Seed(seed)
- c.Logf("Seed: %v", seed)
-
- txn.SetChaos(txn.Chaos{
- KillChance: params.killChance,
- SlowdownChance: params.slowdownChance,
- Slowdown: params.slowdown,
- })
- defer txn.SetChaos(txn.Chaos{})
-
- session, err := mgo.Dial(mgoaddr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("test")
- tc := db.C("tc")
-
- runner := txn.NewRunner(tc)
-
- tclog := db.C("tc.log")
- if params.changelog {
- info := mgo.CollectionInfo{
- Capped: true,
- MaxBytes: 1000000,
- }
- err := tclog.Create(&info)
- c.Assert(err, IsNil)
- runner.ChangeLog(tclog)
- }
-
- accounts := db.C("accounts")
- for i := 0; i < params.accounts; i++ {
- err := accounts.Insert(M{"_id": i, "balance": 300})
- c.Assert(err, IsNil)
- }
- var stop time.Time
- if params.changes <= 0 {
- stop = time.Now().Add(*duration)
- }
-
- max := params.accounts
- if params.reinsertCopy || params.reinsertZeroed {
- max = int(float64(params.accounts) * 1.5)
- }
-
- changes := make(chan balanceChange, 1024)
-
- //session.SetMode(mgo.Eventual, true)
- for i := 0; i < params.workers; i++ {
- go func() {
- n := 0
- for {
- if n > 0 && n == params.changes {
- break
- }
- if !stop.IsZero() && time.Now().After(stop) {
- break
- }
-
- change := balanceChange{
- id: bson.NewObjectId(),
- origin: rand.Intn(max),
- target: rand.Intn(max),
- amount: 100,
- }
-
- var old Account
- var oldExists bool
- if params.reinsertCopy || params.reinsertZeroed {
- if err := accounts.FindId(change.origin).One(&old); err != mgo.ErrNotFound {
- c.Check(err, IsNil)
- change.amount = old.Balance
- oldExists = true
- }
- }
-
- var ops []txn.Op
- switch {
- case params.reinsertCopy && oldExists:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": change.amount},
- Remove: true,
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocMissing,
- Insert: M{"balance": change.amount},
- }}
- case params.reinsertZeroed && oldExists:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.target,
- Assert: txn.DocMissing,
- Insert: M{"balance": 0},
- }, {
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": change.amount},
- Remove: true,
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocExists,
- Update: M{"$inc": M{"balance": change.amount}},
- }}
- case params.changeHalf:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": M{"$gte": change.amount}},
- Update: M{"$inc": M{"balance": -change.amount / 2}},
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocExists,
- Update: M{"$inc": M{"balance": change.amount / 2}},
- }, {
- C: "accounts",
- Id: change.origin,
- Update: M{"$inc": M{"balance": -change.amount / 2}},
- }, {
- C: "accounts",
- Id: change.target,
- Update: M{"$inc": M{"balance": change.amount / 2}},
- }}
- default:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": M{"$gte": change.amount}},
- Update: M{"$inc": M{"balance": -change.amount}},
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocExists,
- Update: M{"$inc": M{"balance": change.amount}},
- }}
- }
-
- err = runner.Run(ops, change.id, nil)
- if err != nil && err != txn.ErrAborted && err != txn.ErrChaos {
- c.Check(err, IsNil)
- }
- n++
- changes <- change
- }
- changes <- balanceChange{}
- }()
- }
-
- alive := params.workers
- changeLog := make([]balanceChange, 0, 1024)
- for alive > 0 {
- change := <-changes
- if change.id == "" {
- alive--
- } else {
- changeLog = append(changeLog, change)
- }
- }
- c.Check(len(changeLog), Not(Equals), 0, Commentf("No operations were even attempted."))
-
- txn.SetChaos(txn.Chaos{})
- err = runner.ResumeAll()
- c.Assert(err, IsNil)
-
- n, err := accounts.Count()
- c.Check(err, IsNil)
- c.Check(n, Equals, params.accounts, Commentf("Number of accounts has changed."))
-
- n, err = accounts.Find(M{"balance": M{"$lt": 0}}).Count()
- c.Check(err, IsNil)
- c.Check(n, Equals, 0, Commentf("There are %d accounts with negative balance.", n))
-
- globalBalance := 0
- iter := accounts.Find(nil).Iter()
- account := Account{}
- for iter.Next(&account) {
- globalBalance += account.Balance
- }
- c.Check(iter.Close(), IsNil)
- c.Check(globalBalance, Equals, params.accounts*300, Commentf("Total amount of money should be constant."))
-
- // Compute and verify the exact final state of all accounts.
- balance := make(map[int]int)
- for i := 0; i < params.accounts; i++ {
- balance[i] += 300
- }
- var applied, aborted int
- for _, change := range changeLog {
- err := runner.Resume(change.id)
- if err == txn.ErrAborted {
- aborted++
- continue
- } else if err != nil {
- c.Fatalf("resuming %s failed: %v", change.id, err)
- }
- balance[change.origin] -= change.amount
- balance[change.target] += change.amount
- applied++
- }
- iter = accounts.Find(nil).Iter()
- for iter.Next(&account) {
- c.Assert(account.Balance, Equals, balance[account.Id])
- }
- c.Check(iter.Close(), IsNil)
- c.Logf("Total transactions: %d (%d applied, %d aborted)", len(changeLog), applied, aborted)
-
- if params.changelog {
- n, err := tclog.Count()
- c.Assert(err, IsNil)
- // Check if the capped collection is full.
- dummy := make([]byte, 1024)
- tclog.Insert(M{"_id": bson.NewObjectId(), "dummy": dummy})
- m, err := tclog.Count()
- c.Assert(err, IsNil)
- if m == n+1 {
- // Wasn't full, so it must have seen it all.
- c.Assert(err, IsNil)
- c.Assert(n, Equals, applied)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/tarjan_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/tarjan_test.go
deleted file mode 100644
index f57890bb401..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/tarjan_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package txn
-
-import (
- "fmt"
- "github.com/10gen/llmgo/bson"
- . "gopkg.in/check.v1"
-)
-
-type TarjanSuite struct{}
-
-var _ = Suite(TarjanSuite{})
-
-func bid(n int) bson.ObjectId {
- return bson.ObjectId(fmt.Sprintf("%024d", n))
-}
-
-func bids(ns ...int) (ids []bson.ObjectId) {
- for _, n := range ns {
- ids = append(ids, bid(n))
- }
- return
-}
-
-func (TarjanSuite) TestExample(c *C) {
- successors := map[bson.ObjectId][]bson.ObjectId{
- bid(1): bids(2, 3),
- bid(2): bids(1, 5),
- bid(3): bids(4),
- bid(4): bids(3, 5),
- bid(5): bids(6),
- bid(6): bids(7),
- bid(7): bids(8),
- bid(8): bids(6, 9),
- bid(9): bids(),
- }
-
- c.Assert(tarjanSort(successors), DeepEquals, [][]bson.ObjectId{
- bids(9),
- bids(6, 7, 8),
- bids(5),
- bids(3, 4),
- bids(1, 2),
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/txn_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/txn_test.go
deleted file mode 100644
index 9f17fab8f14..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/llmgo/txn/txn_test.go
+++ /dev/null
@@ -1,753 +0,0 @@
-package txn_test
-
-import (
- "fmt"
- "sync"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
- "github.com/10gen/llmgo"
- "github.com/10gen/llmgo/bson"
- "github.com/10gen/llmgo/txn"
-)
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- MgoSuite
-
- db *mgo.Database
- tc, sc *mgo.Collection
- accounts *mgo.Collection
- runner *txn.Runner
-}
-
-var _ = Suite(&S{})
-
-type M map[string]interface{}
-
-func (s *S) SetUpTest(c *C) {
- txn.SetChaos(txn.Chaos{})
- txn.SetLogger(c)
- txn.SetDebug(true)
- s.MgoSuite.SetUpTest(c)
-
- s.db = s.session.DB("test")
- s.tc = s.db.C("tc")
- s.sc = s.db.C("tc.stash")
- s.accounts = s.db.C("accounts")
- s.runner = txn.NewRunner(s.tc)
-}
-
-func (s *S) TearDownTest(c *C) {
- txn.SetLogger(nil)
- txn.SetDebug(false)
-}
-
-type Account struct {
- Id int `bson:"_id"`
- Balance int
-}
-
-func (s *S) TestDocExists(c *C) {
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- exists := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: txn.DocExists,
- }}
- missing := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: txn.DocMissing,
- }}
-
- err = s.runner.Run(exists, "", nil)
- c.Assert(err, IsNil)
- err = s.runner.Run(missing, "", nil)
- c.Assert(err, Equals, txn.ErrAborted)
-
- err = s.accounts.RemoveId(0)
- c.Assert(err, IsNil)
-
- err = s.runner.Run(exists, "", nil)
- c.Assert(err, Equals, txn.ErrAborted)
- err = s.runner.Run(missing, "", nil)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestInsert(c *C) {
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 200},
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-
- ops[0].Id = 1
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(1).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 200)
-}
-
-func (s *S) TestInsertStructID(c *C) {
- type id struct {
- FirstName string
- LastName string
- }
- ops := []txn.Op{{
- C: "accounts",
- Id: id{FirstName: "John", LastName: "Jones"},
- Assert: txn.DocMissing,
- Insert: M{"balance": 200},
- }, {
- C: "accounts",
- Id: id{FirstName: "Sally", LastName: "Smith"},
- Assert: txn.DocMissing,
- Insert: M{"balance": 800},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- n, err := s.accounts.Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestRemove(c *C) {
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Remove: true,
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(0).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestUpdate(c *C) {
- var err error
- err = s.accounts.Insert(M{"_id": 0, "balance": 200})
- c.Assert(err, IsNil)
- err = s.accounts.Insert(M{"_id": 1, "balance": 200})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-
- ops[0].Id = 1
-
- err = s.accounts.FindId(1).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 200)
-}
-
-func (s *S) TestInsertUpdate(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 200},
- }, {
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 400)
-}
-
-func (s *S) TestUpdateInsert(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }, {
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 200},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 200)
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-}
-
-func (s *S) TestInsertRemoveInsert(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 200},
- }, {
- C: "accounts",
- Id: 0,
- Remove: true,
- }, {
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 300},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-}
-
-func (s *S) TestQueueStashing(c *C) {
- txn.SetChaos(txn.Chaos{
- KillChance: 1,
- Breakpoint: "set-applying",
- })
-
- opses := [][]txn.Op{{{
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 100},
- }}, {{
- C: "accounts",
- Id: 0,
- Remove: true,
- }}, {{
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 200},
- }}, {{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}}
-
- var last bson.ObjectId
- for _, ops := range opses {
- last = bson.NewObjectId()
- err := s.runner.Run(ops, last, nil)
- c.Assert(err, Equals, txn.ErrChaos)
- }
-
- txn.SetChaos(txn.Chaos{})
- err := s.runner.Resume(last)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-}
-
-func (s *S) TestInfo(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: txn.DocMissing,
- }}
-
- id := bson.NewObjectId()
- err := s.runner.Run(ops, id, M{"n": 42})
- c.Assert(err, IsNil)
-
- var t struct{ I struct{ N int } }
- err = s.tc.FindId(id).One(&t)
- c.Assert(err, IsNil)
- c.Assert(t.I.N, Equals, 42)
-}
-
-func (s *S) TestErrors(c *C) {
- doc := bson.M{"foo": 1}
- tests := []txn.Op{{
- C: "c",
- Id: 0,
- }, {
- C: "c",
- Id: 0,
- Insert: doc,
- Remove: true,
- }, {
- C: "c",
- Id: 0,
- Insert: doc,
- Update: doc,
- }, {
- C: "c",
- Id: 0,
- Update: doc,
- Remove: true,
- }, {
- C: "c",
- Assert: doc,
- }, {
- Id: 0,
- Assert: doc,
- }}
-
- txn.SetChaos(txn.Chaos{KillChance: 1.0})
- for _, op := range tests {
- c.Logf("op: %v", op)
- err := s.runner.Run([]txn.Op{op}, "", nil)
- c.Assert(err, ErrorMatches, "error in transaction op 0: .*")
- }
-}
-
-func (s *S) TestAssertNestedOr(c *C) {
- // Assert uses $or internally. Ensure nesting works.
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: bson.D{{"$or", []bson.D{{{"balance", 100}}, {{"balance", 300}}}}},
- Update: bson.D{{"$inc", bson.D{{"balance", 100}}}},
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 400)
-}
-
-func (s *S) TestVerifyFieldOrdering(c *C) {
- // Used to have a map in certain operations, which means
- // the ordering of fields would be messed up.
- fields := bson.D{{"a", 1}, {"b", 2}, {"c", 3}}
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: fields,
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var d bson.D
- err = s.accounts.FindId(0).One(&d)
- c.Assert(err, IsNil)
-
- var filtered bson.D
- for _, e := range d {
- switch e.Name {
- case "a", "b", "c":
- filtered = append(filtered, e)
- }
- }
- c.Assert(filtered, DeepEquals, fields)
-}
-
-func (s *S) TestChangeLog(c *C) {
- chglog := s.db.C("chglog")
- s.runner.ChangeLog(chglog)
-
- ops := []txn.Op{{
- C: "debts",
- Id: 0,
- Assert: txn.DocMissing,
- }, {
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 300},
- }, {
- C: "accounts",
- Id: 1,
- Insert: M{"balance": 300},
- }, {
- C: "people",
- Id: "joe",
- Insert: M{"accounts": []int64{0, 1}},
- }}
- id := bson.NewObjectId()
- err := s.runner.Run(ops, id, nil)
- c.Assert(err, IsNil)
-
- type IdList []interface{}
- type Log struct {
- Docs IdList "d"
- Revnos []int64 "r"
- }
- var m map[string]*Log
- err = chglog.FindId(id).One(&m)
- c.Assert(err, IsNil)
-
- c.Assert(m["accounts"], DeepEquals, &Log{IdList{0, 1}, []int64{2, 2}})
- c.Assert(m["people"], DeepEquals, &Log{IdList{"joe"}, []int64{2}})
- c.Assert(m["debts"], IsNil)
-
- ops = []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }, {
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 100}},
- }}
- id = bson.NewObjectId()
- err = s.runner.Run(ops, id, nil)
- c.Assert(err, IsNil)
-
- m = nil
- err = chglog.FindId(id).One(&m)
- c.Assert(err, IsNil)
-
- c.Assert(m["accounts"], DeepEquals, &Log{IdList{0, 1}, []int64{3, 3}})
- c.Assert(m["people"], IsNil)
-
- ops = []txn.Op{{
- C: "accounts",
- Id: 0,
- Remove: true,
- }, {
- C: "people",
- Id: "joe",
- Remove: true,
- }}
- id = bson.NewObjectId()
- err = s.runner.Run(ops, id, nil)
- c.Assert(err, IsNil)
-
- m = nil
- err = chglog.FindId(id).One(&m)
- c.Assert(err, IsNil)
-
- c.Assert(m["accounts"], DeepEquals, &Log{IdList{0}, []int64{-4}})
- c.Assert(m["people"], DeepEquals, &Log{IdList{"joe"}, []int64{-3}})
-}
-
-func (s *S) TestPurgeMissing(c *C) {
- txn.SetChaos(txn.Chaos{
- KillChance: 1,
- Breakpoint: "set-applying",
- })
-
- err := s.accounts.Insert(M{"_id": 0, "balance": 100})
- c.Assert(err, IsNil)
- err = s.accounts.Insert(M{"_id": 1, "balance": 100})
- c.Assert(err, IsNil)
-
- ops1 := []txn.Op{{
- C: "accounts",
- Id: 3,
- Insert: M{"balance": 100},
- }}
-
- ops2 := []txn.Op{{
- C: "accounts",
- Id: 0,
- Remove: true,
- }, {
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 100}},
- }, {
- C: "accounts",
- Id: 2,
- Insert: M{"balance": 100},
- }}
-
- first := bson.NewObjectId()
- c.Logf("---- Running ops1 under transaction %q, to be canceled by chaos", first.Hex())
- err = s.runner.Run(ops1, first, nil)
- c.Assert(err, Equals, txn.ErrChaos)
-
- last := bson.NewObjectId()
- c.Logf("---- Running ops2 under transaction %q, to be canceled by chaos", last.Hex())
- err = s.runner.Run(ops2, last, nil)
- c.Assert(err, Equals, txn.ErrChaos)
-
- c.Logf("---- Removing transaction %q", last.Hex())
- err = s.tc.RemoveId(last)
- c.Assert(err, IsNil)
-
- c.Logf("---- Disabling chaos and attempting to resume all")
- txn.SetChaos(txn.Chaos{})
- err = s.runner.ResumeAll()
- c.Assert(err, IsNil)
-
- again := bson.NewObjectId()
- c.Logf("---- Running ops2 again under transaction %q, to fail for missing transaction", again.Hex())
- err = s.runner.Run(ops2, again, nil)
- c.Assert(err, ErrorMatches, "cannot find transaction .*")
-
- c.Logf("---- Purging missing transactions")
- err = s.runner.PurgeMissing("accounts")
- c.Assert(err, IsNil)
-
- c.Logf("---- Resuming pending transactions")
- err = s.runner.ResumeAll()
- c.Assert(err, IsNil)
-
- expect := []struct{ Id, Balance int }{
- {0, -1},
- {1, 200},
- {2, 100},
- {3, 100},
- }
- var got Account
- for _, want := range expect {
- err = s.accounts.FindId(want.Id).One(&got)
- if want.Balance == -1 {
- if err != mgo.ErrNotFound {
- c.Errorf("Account %d should not exist, find got err=%#v", err)
- }
- } else if err != nil {
- c.Errorf("Account %d should have balance of %d, but wasn't found", want.Id, want.Balance)
- } else if got.Balance != want.Balance {
- c.Errorf("Account %d should have balance of %d, got %d", want.Id, want.Balance, got.Balance)
- }
- }
-}
-
-func (s *S) TestTxnQueueStashStressTest(c *C) {
- txn.SetChaos(txn.Chaos{
- SlowdownChance: 0.3,
- Slowdown: 50 * time.Millisecond,
- })
- defer txn.SetChaos(txn.Chaos{})
-
- // So we can run more iterations of the test in less time.
- txn.SetDebug(false)
-
- const runners = 10
- const inserts = 10
- const repeat = 100
-
- for r := 0; r < repeat; r++ {
- var wg sync.WaitGroup
- wg.Add(runners)
- for i := 0; i < runners; i++ {
- go func(i, r int) {
- defer wg.Done()
-
- session := s.session.New()
- defer session.Close()
- runner := txn.NewRunner(s.tc.With(session))
-
- for j := 0; j < inserts; j++ {
- ops := []txn.Op{{
- C: "accounts",
- Id: fmt.Sprintf("insert-%d-%d", r, j),
- Insert: bson.M{
- "added-by": i,
- },
- }}
- err := runner.Run(ops, "", nil)
- if err != txn.ErrAborted {
- c.Check(err, IsNil)
- }
- }
- }(i, r)
- }
- wg.Wait()
- }
-}
-
-func (s *S) TestPurgeMissingPipelineSizeLimit(c *C) {
- // This test ensures that PurgeMissing can handle very large
- // txn-queue fields. Previous iterations of PurgeMissing would
- // trigger a 16MB aggregation pipeline result size limit when run
- // against a documents or stashes with large numbers of txn-queue
- // entries. PurgeMissing now no longer uses aggregation pipelines
- // to work around this limit.
-
- // The pipeline result size limitation was removed from MongoDB in 2.6 so
- // this test is only run for older MongoDB version.
- build, err := s.session.BuildInfo()
- c.Assert(err, IsNil)
- if build.VersionAtLeast(2, 6) {
- c.Skip("This tests a problem that can only happen with MongoDB < 2.6 ")
- }
-
- // Insert a single document to work with.
- err = s.accounts.Insert(M{"_id": 0, "balance": 100})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}
-
- // Generate one successful transaction.
- good := bson.NewObjectId()
- c.Logf("---- Running ops under transaction %q", good.Hex())
- err = s.runner.Run(ops, good, nil)
- c.Assert(err, IsNil)
-
- // Generate another transaction which which will go missing.
- missing := bson.NewObjectId()
- c.Logf("---- Running ops under transaction %q (which will go missing)", missing.Hex())
- err = s.runner.Run(ops, missing, nil)
- c.Assert(err, IsNil)
-
- err = s.tc.RemoveId(missing)
- c.Assert(err, IsNil)
-
- // Generate a txn-queue on the test document that's large enough
- // that it used to cause PurgeMissing to exceed MongoDB's pipeline
- // result 16MB size limit (MongoDB 2.4 and older only).
- //
- // The contents of the txn-queue field doesn't matter, only that
- // it's big enough to trigger the size limit. The required size
- // can also be achieved by using multiple documents as long as the
- // cumulative size of all the txn-queue fields exceeds the
- // pipeline limit. A single document is easier to work with for
- // this test however.
- //
- // The txn id of the successful transaction is used fill the
- // txn-queue because this takes advantage of a short circuit in
- // PurgeMissing, dramatically speeding up the test run time.
- const fakeQueueLen = 250000
- fakeTxnQueue := make([]string, fakeQueueLen)
- token := good.Hex() + "_12345678" // txn id + nonce
- for i := 0; i < fakeQueueLen; i++ {
- fakeTxnQueue[i] = token
- }
-
- err = s.accounts.UpdateId(0, bson.M{
- "$set": bson.M{"txn-queue": fakeTxnQueue},
- })
- c.Assert(err, IsNil)
-
- // PurgeMissing could hit the same pipeline result size limit when
- // processing the txn-queue fields of stash documents so insert
- // the large txn-queue there too to ensure that no longer happens.
- err = s.sc.Insert(
- bson.D{{"c", "accounts"}, {"id", 0}},
- bson.M{"txn-queue": fakeTxnQueue},
- )
- c.Assert(err, IsNil)
-
- c.Logf("---- Purging missing transactions")
- err = s.runner.PurgeMissing("accounts")
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestTxnQueueStressTest(c *C) {
- txn.SetChaos(txn.Chaos{
- SlowdownChance: 0.3,
- Slowdown: 50 * time.Millisecond,
- })
- defer txn.SetChaos(txn.Chaos{})
-
- // So we can run more iterations of the test in less time.
- txn.SetDebug(false)
-
- err := s.accounts.Insert(M{"_id": 0, "balance": 0}, M{"_id": 1, "balance": 0})
- c.Assert(err, IsNil)
-
- // Run half of the operations changing account 0 and then 1,
- // and the other half in the opposite order.
- ops01 := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 1}},
- }, {
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 1}},
- }}
-
- ops10 := []txn.Op{{
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 1}},
- }, {
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 1}},
- }}
-
- ops := [][]txn.Op{ops01, ops10}
-
- const runners = 4
- const changes = 1000
-
- var wg sync.WaitGroup
- wg.Add(runners)
- for n := 0; n < runners; n++ {
- n := n
- go func() {
- defer wg.Done()
- for i := 0; i < changes; i++ {
- err = s.runner.Run(ops[n%2], "", nil)
- c.Assert(err, IsNil)
- }
- }()
- }
- wg.Wait()
-
- for id := 0; id < 2; id++ {
- var account Account
- err = s.accounts.FindId(id).One(&account)
- if account.Balance != runners*changes {
- c.Errorf("Account should have balance of %d, got %d", runners*changes, account.Balance)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/.evergreen/config.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/.evergreen/config.yml
index b8bbabba9a9..a51e615a122 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/.evergreen/config.yml
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/.evergreen/config.yml
@@ -210,17 +210,6 @@ buildvariants:
# SUSE Buildvariants #
#######################################
-- name: suse11
- display_name: SUSE 11 (Go 1.8)
- run_on:
- - suse11-test
- expansions:
- gorootvars: 'PATH="/opt/go1.8/go/bin:/opt/mongodbtoolchain/v2/bin/:$PATH" GOROOT=/opt/go1.8/go'
- build_tags: "openssl_pre_1.0"
- tasks:
- - name: build
- - name: test
-
- name: suse12
display_name: SUSE 12 (Go 1.8)
run_on:
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/cert_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/cert_test.go
deleted file mode 100644
index 96083260507..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/cert_test.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import (
- "math/big"
- "testing"
- "time"
-)
-
-func TestCertGenerate(t *testing.T) {
- key, err := GenerateRSAKey(2048)
- if err != nil {
- t.Fatal(err)
- }
- info := &CertificateInfo{
- Serial: big.NewInt(int64(1)),
- Issued: 0,
- Expires: 24 * time.Hour,
- Country: "US",
- Organization: "Test",
- CommonName: "localhost",
- }
- cert, err := NewCertificate(info, key)
- if err != nil {
- t.Fatal(err)
- }
- if err := cert.Sign(key, EVP_SHA256); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestCAGenerate(t *testing.T) {
- cakey, err := GenerateRSAKey(2048)
- if err != nil {
- t.Fatal(err)
- }
- info := &CertificateInfo{
- Serial: big.NewInt(int64(1)),
- Issued: 0,
- Expires: 24 * time.Hour,
- Country: "US",
- Organization: "Test CA",
- CommonName: "CA",
- }
- ca, err := NewCertificate(info, cakey)
- if err != nil {
- t.Fatal(err)
- }
- if err := ca.AddExtensions(map[NID]string{
- NID_basic_constraints: "critical,CA:TRUE",
- NID_key_usage: "critical,keyCertSign,cRLSign",
- NID_subject_key_identifier: "hash",
- NID_netscape_cert_type: "sslCA",
- }); err != nil {
- t.Fatal(err)
- }
- if err := ca.Sign(cakey, EVP_SHA256); err != nil {
- t.Fatal(err)
- }
- key, err := GenerateRSAKey(2048)
- if err != nil {
- t.Fatal(err)
- }
- info = &CertificateInfo{
- Serial: big.NewInt(int64(1)),
- Issued: 0,
- Expires: 24 * time.Hour,
- Country: "US",
- Organization: "Test",
- CommonName: "localhost",
- }
- cert, err := NewCertificate(info, key)
- if err != nil {
- t.Fatal(err)
- }
- if err := cert.AddExtensions(map[NID]string{
- NID_basic_constraints: "critical,CA:FALSE",
- NID_key_usage: "keyEncipherment",
- NID_ext_key_usage: "serverAuth",
- }); err != nil {
- t.Fatal(err)
- }
- if err := cert.SetIssuer(ca); err != nil {
- t.Fatal(err)
- }
- if err := cert.Sign(cakey, EVP_SHA256); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestCertGetNameEntry(t *testing.T) {
- key, err := GenerateRSAKey(2048)
- if err != nil {
- t.Fatal(err)
- }
- info := &CertificateInfo{
- Serial: big.NewInt(int64(1)),
- Issued: 0,
- Expires: 24 * time.Hour,
- Country: "US",
- Organization: "Test",
- CommonName: "localhost",
- }
- cert, err := NewCertificate(info, key)
- if err != nil {
- t.Fatal(err)
- }
- name, err := cert.GetSubjectName()
- if err != nil {
- t.Fatal(err)
- }
- entry, ok := name.GetEntry(NID_commonName)
- if !ok {
- t.Fatal("no common name")
- }
- if entry != "localhost" {
- t.Fatalf("expected localhost; got %q", entry)
- }
- entry, ok = name.GetEntry(NID_localityName)
- if ok {
- t.Fatal("did not expect a locality name")
- }
- if entry != "" {
- t.Fatalf("entry should be empty; got %q", entry)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ciphers_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ciphers_test.go
deleted file mode 100644
index 463b30dfe55..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ciphers_test.go
+++ /dev/null
@@ -1,307 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !openssl_pre_1.0
-
-package openssl
-
-import (
- "bytes"
- "fmt"
- "strings"
- "testing"
-)
-
-func expectError(t *testing.T, err error, msg string) {
- if err == nil {
- t.Fatalf("Expected error containing %#v, but got none", msg)
- }
- if !strings.Contains(err.Error(), msg) {
- t.Fatalf("Expected error containing %#v, but got %s", msg, err)
- }
-}
-
-func TestBadInputs(t *testing.T) {
- _, err := NewGCMEncryptionCipherCtx(256, nil,
- []byte("abcdefghijklmnopqrstuvwxyz"), nil)
- expectError(t, err, "bad key size")
- _, err = NewGCMEncryptionCipherCtx(128, nil,
- []byte("abcdefghijklmnopqrstuvwxyz"), nil)
- expectError(t, err, "bad key size")
- _, err = NewGCMEncryptionCipherCtx(200, nil,
- []byte("abcdefghijklmnopqrstuvwxy"), nil)
- expectError(t, err, "unknown block size")
- c, err := GetCipherByName("AES-128-CBC")
- if err != nil {
- t.Fatal("Could not look up AES-128-CBC")
- }
- _, err = NewEncryptionCipherCtx(c, nil, []byte("abcdefghijklmnop"),
- []byte("abc"))
- expectError(t, err, "bad IV size")
-}
-
-func doEncryption(key, iv, aad, plaintext []byte, blocksize, bufsize int) (
- ciphertext, tag []byte, err error) {
- ectx, err := NewGCMEncryptionCipherCtx(blocksize, nil, key, iv)
- if err != nil {
- return nil, nil, fmt.Errorf("Failed making GCM encryption ctx: %s", err)
- }
- err = ectx.ExtraData(aad)
- if err != nil {
- return nil, nil, fmt.Errorf("Failed to add authenticated data: %s",
- err)
- }
- plainb := bytes.NewBuffer(plaintext)
- cipherb := new(bytes.Buffer)
- for plainb.Len() > 0 {
- moar, err := ectx.EncryptUpdate(plainb.Next(bufsize))
- if err != nil {
- return nil, nil, fmt.Errorf("Failed to perform an encryption: %s",
- err)
- }
- cipherb.Write(moar)
- }
- moar, err := ectx.EncryptFinal()
- if err != nil {
- return nil, nil, fmt.Errorf("Failed to finalize encryption: %s", err)
- }
- cipherb.Write(moar)
- tag, err = ectx.GetTag()
- if err != nil {
- return nil, nil, fmt.Errorf("Failed to get GCM tag: %s", err)
- }
- return cipherb.Bytes(), tag, nil
-}
-
-func doDecryption(key, iv, aad, ciphertext, tag []byte, blocksize,
- bufsize int) (plaintext []byte, err error) {
- dctx, err := NewGCMDecryptionCipherCtx(blocksize, nil, key, iv)
- if err != nil {
- return nil, fmt.Errorf("Failed making GCM decryption ctx: %s", err)
- }
- err = dctx.SetTag(tag)
- if err != nil {
- return nil, fmt.Errorf("Failed to set expected GCM tag: %s", err)
- }
- aadbuf := bytes.NewBuffer(aad)
- for aadbuf.Len() > 0 {
- err = dctx.ExtraData(aadbuf.Next(bufsize))
- if err != nil {
- return nil, fmt.Errorf("Failed to add authenticated data: %s", err)
- }
- }
- plainb := new(bytes.Buffer)
- cipherb := bytes.NewBuffer(ciphertext)
- for cipherb.Len() > 0 {
- moar, err := dctx.DecryptUpdate(cipherb.Next(bufsize))
- if err != nil {
- return nil, fmt.Errorf("Failed to perform a decryption: %s", err)
- }
- plainb.Write(moar)
- }
- moar, err := dctx.DecryptFinal()
- if err != nil {
- return nil, fmt.Errorf("Failed to finalize decryption: %s", err)
- }
- plainb.Write(moar)
- return plainb.Bytes(), nil
-}
-
-func checkEqual(t *testing.T, output []byte, original string) {
- output_s := string(output)
- if output_s != original {
- t.Fatalf("output != original! %#v != %#v", output_s, original)
- }
-}
-
-func TestGCM(t *testing.T) {
- aad := []byte("foo bar baz")
- key := []byte("nobody can guess this i'm sure..") // len=32
- iv := []byte("just a bunch of bytes")
- plaintext := "Long long ago, in a land far away..."
-
- blocksizes_to_test := []int{256, 192, 128}
-
- // best for this to have no common factors with blocksize, so that the
- // buffering layer inside the CIPHER_CTX gets exercised
- bufsize := 33
-
- if len(plaintext)%8 == 0 {
- plaintext += "!" // make sure padding is exercised
- }
-
- for _, bsize := range blocksizes_to_test {
- subkey := key[:bsize/8]
- ciphertext, tag, err := doEncryption(subkey, iv, aad, []byte(plaintext),
- bsize, bufsize)
- if err != nil {
- t.Fatalf("Encryption with b=%d: %s", bsize, err)
- }
- plaintext_out, err := doDecryption(subkey, iv, aad, ciphertext, tag,
- bsize, bufsize)
- if err != nil {
- t.Fatalf("Decryption with b=%d: %s", bsize, err)
- }
- checkEqual(t, plaintext_out, plaintext)
- }
-}
-
-func TestGCMWithNoAAD(t *testing.T) {
- key := []byte("0000111122223333")
- iv := []byte("9999")
- plaintext := "ABORT ABORT ABORT DANGAR"
-
- ciphertext, tag, err := doEncryption(key, iv, nil, []byte(plaintext),
- 128, 32)
- if err != nil {
- t.Fatal("Encryption failure:", err)
- }
- plaintext_out, err := doDecryption(key, iv, nil, ciphertext, tag, 128, 129)
- if err != nil {
- t.Fatal("Decryption failure:", err)
- }
- checkEqual(t, plaintext_out, plaintext)
-}
-
-func TestBadTag(t *testing.T) {
- key := []byte("abcdefghijklmnop")
- iv := []byte("v7239qjfv3qr793fuaj")
- plaintext := "The red rooster has flown the coop I REPEAT" +
- "the red rooster has flown the coop!!1!"
-
- ciphertext, tag, err := doEncryption(key, iv, nil, []byte(plaintext),
- 128, 32)
- if err != nil {
- t.Fatal("Encryption failure:", err)
- }
- // flip the last bit
- tag[len(tag)-1] ^= 1
- plaintext_out, err := doDecryption(key, iv, nil, ciphertext, tag, 128, 129)
- if err == nil {
- t.Fatal("Expected error for bad tag, but got none")
- }
- // flip it back, try again just to make sure
- tag[len(tag)-1] ^= 1
- plaintext_out, err = doDecryption(key, iv, nil, ciphertext, tag, 128, 129)
- if err != nil {
- t.Fatal("Decryption failure:", err)
- }
- checkEqual(t, plaintext_out, plaintext)
-}
-
-func TestBadCiphertext(t *testing.T) {
- key := []byte("hard boiled eggs & bacon")
- iv := []byte("x") // it's not a very /good/ IV, is it
- aad := []byte("mu")
- plaintext := "Roger roger bingo charlie, we have a niner fourteen tango"
-
- ciphertext, tag, err := doEncryption(key, iv, aad, []byte(plaintext),
- 192, 1)
- if err != nil {
- t.Fatal("Encryption failure:", err)
- }
- // flip the last bit
- ciphertext[len(ciphertext)-1] ^= 1
- plaintext_out, err := doDecryption(key, iv, aad, ciphertext, tag, 192, 192)
- if err == nil {
- t.Fatal("Expected error for bad ciphertext, but got none")
- }
- // flip it back, try again just to make sure
- ciphertext[len(ciphertext)-1] ^= 1
- plaintext_out, err = doDecryption(key, iv, aad, ciphertext, tag, 192, 192)
- if err != nil {
- t.Fatal("Decryption failure:", err)
- }
- checkEqual(t, plaintext_out, plaintext)
-}
-
-func TestBadAAD(t *testing.T) {
- key := []byte("Ive got a lovely buncha coconuts")
- iv := []byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab")
- aad := []byte("Hi i am a plain")
- plaintext := "Whatever."
-
- ciphertext, tag, err := doEncryption(key, iv, aad, []byte(plaintext),
- 256, 256)
- if err != nil {
- t.Fatal("Encryption failure:", err)
- }
- // flip the last bit
- aad[len(aad)-1] ^= 1
- plaintext_out, err := doDecryption(key, iv, aad, ciphertext, tag, 256, 256)
- if err == nil {
- t.Fatal("Expected error for bad AAD, but got none")
- }
- // flip it back, try again just to make sure
- aad[len(aad)-1] ^= 1
- plaintext_out, err = doDecryption(key, iv, aad, ciphertext, tag, 256, 256)
- if err != nil {
- t.Fatal("Decryption failure:", err)
- }
- checkEqual(t, plaintext_out, plaintext)
-}
-
-func TestNonAuthenticatedEncryption(t *testing.T) {
- key := []byte("never gonna give you up, never g")
- iv := []byte("onna let you dow")
- plaintext1 := "n, never gonna run around"
- plaintext2 := " and desert you"
-
- cipher, err := GetCipherByName("aes-256-cbc")
- if err != nil {
- t.Fatal("Could not get cipher: ", err)
- }
-
- eCtx, err := NewEncryptionCipherCtx(cipher, nil, key, iv)
- if err != nil {
- t.Fatal("Could not create encryption context: ", err)
- }
- cipherbytes, err := eCtx.EncryptUpdate([]byte(plaintext1))
- if err != nil {
- t.Fatal("EncryptUpdate(plaintext1) failure: ", err)
- }
- ciphertext := string(cipherbytes)
- cipherbytes, err = eCtx.EncryptUpdate([]byte(plaintext2))
- if err != nil {
- t.Fatal("EncryptUpdate(plaintext2) failure: ", err)
- }
- ciphertext += string(cipherbytes)
- cipherbytes, err = eCtx.EncryptFinal()
- if err != nil {
- t.Fatal("EncryptFinal() failure: ", err)
- }
- ciphertext += string(cipherbytes)
-
- dCtx, err := NewDecryptionCipherCtx(cipher, nil, key, iv)
- if err != nil {
- t.Fatal("Could not create decryption context: ", err)
- }
- plainbytes, err := dCtx.DecryptUpdate([]byte(ciphertext[:15]))
- if err != nil {
- t.Fatal("DecryptUpdate(ciphertext part 1) failure: ", err)
- }
- plainOutput := string(plainbytes)
- plainbytes, err = dCtx.DecryptUpdate([]byte(ciphertext[15:]))
- if err != nil {
- t.Fatal("DecryptUpdate(ciphertext part 2) failure: ", err)
- }
- plainOutput += string(plainbytes)
- plainbytes, err = dCtx.DecryptFinal()
- if err != nil {
- t.Fatal("DecryptFinal() failure: ", err)
- }
- plainOutput += string(plainbytes)
-
- checkEqual(t, []byte(plainOutput), plaintext1+plaintext2)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ctx_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ctx_test.go
deleted file mode 100644
index cd2a82a5a66..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ctx_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import (
- "testing"
- "time"
-)
-
-func TestCtxTimeoutOption(t *testing.T) {
- ctx, _ := NewCtx()
- oldTimeout1 := ctx.GetTimeout()
- newTimeout1 := oldTimeout1 + (time.Duration(99) * time.Second)
- oldTimeout2 := ctx.SetTimeout(newTimeout1)
- newTimeout2 := ctx.GetTimeout()
- if oldTimeout1 != oldTimeout2 {
- t.Error("SetTimeout() returns something undocumented")
- }
- if newTimeout1 != newTimeout2 {
- t.Error("SetTimeout() does not save anything to ctx")
- }
-}
-
-func TestCtxSessCacheSizeOption(t *testing.T) {
- ctx, _ := NewCtx()
- oldSize1 := ctx.SessGetCacheSize()
- newSize1 := oldSize1 + 42
- oldSize2 := ctx.SessSetCacheSize(newSize1)
- newSize2 := ctx.SessGetCacheSize()
- if oldSize1 != oldSize2 {
- t.Error("SessSetCacheSize() returns something undocumented")
- }
- if newSize1 != newSize2 {
- t.Error("SessSetCacheSize() does not save anything to ctx")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/dh_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/dh_test.go
deleted file mode 100644
index e6b5ae59905..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/dh_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !openssl_pre_1.0
-
-package openssl
-
-import (
- "bytes"
- "testing"
-)
-
-func TestECDH(t *testing.T) {
- t.Parallel()
- if !HasECDH() {
- t.Skip("ECDH not available")
- }
-
- myKey, err := GenerateECKey(Prime256v1)
- if err != nil {
- t.Fatal(err)
- }
- peerKey, err := GenerateECKey(Prime256v1)
- if err != nil {
- t.Fatal(err)
- }
-
- mySecret, err := DeriveSharedSecret(myKey, peerKey)
- if err != nil {
- t.Fatal(err)
- }
- theirSecret, err := DeriveSharedSecret(peerKey, myKey)
- if err != nil {
- t.Fatal(err)
- }
-
- if bytes.Compare(mySecret, theirSecret) != 0 {
- t.Fatal("shared secrets are different")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/fips_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/fips_test.go
deleted file mode 100644
index 31218edb33b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/fips_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package openssl_test
-
-import (
- "testing"
-
- "github.com/10gen/openssl"
-)
-
-func TestSetFIPSMode(t *testing.T) {
- if !openssl.FIPSModeDefined() {
- t.Skip("OPENSSL_FIPS not defined in headers")
- }
-
- if openssl.FIPSMode() {
- t.Skip("FIPS mode already enabled")
- }
-
- err := openssl.FIPSModeSet(true)
- if err != nil {
- t.Fatal(err)
- }
-
- if !openssl.FIPSMode() {
- t.Fatal("Expected FIPS mode to be enabled, but was disabled")
- }
-
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/hmac_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/hmac_test.go
deleted file mode 100644
index 424720e2171..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/hmac_test.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !openssl_pre_1.0
-
-package openssl
-
-import (
- "crypto/hmac"
- "crypto/sha256"
- "encoding/hex"
- "testing"
-)
-
-func TestSHA256HMAC(t *testing.T) {
- key := []byte("d741787cc61851af045ccd37")
- data := []byte("5912EEFD-59EC-43E3-ADB8-D5325AEC3271")
-
- h, err := NewHMAC(key, EVP_SHA256)
- if err != nil {
- t.Fatalf("Unable to create new HMAC: %s", err)
- }
- if _, err := h.Write(data); err != nil {
- t.Fatalf("Unable to write data into HMAC: %s", err)
- }
-
- var actualHMACBytes []byte
- if actualHMACBytes, err = h.Final(); err != nil {
- t.Fatalf("Error while finalizing HMAC: %s", err)
- }
- actualString := hex.EncodeToString(actualHMACBytes)
-
- // generate HMAC with built-in crypto lib
- mac := hmac.New(sha256.New, key)
- mac.Write(data)
- expectedString := hex.EncodeToString(mac.Sum(nil))
-
- if expectedString != actualString {
- t.Errorf("HMAC was incorrect: expected=%s, actual=%s", expectedString, actualString)
- }
-}
-
-func BenchmarkSHA256HMAC(b *testing.B) {
- key := []byte("d741787cc61851af045ccd37")
- data := []byte("5912EEFD-59EC-43E3-ADB8-D5325AEC3271")
-
- h, err := NewHMAC(key, EVP_SHA256)
- if err != nil {
- b.Fatalf("Unable to create new HMAC: %s", err)
- }
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if _, err := h.Write(data); err != nil {
- b.Fatalf("Unable to write data into HMAC: %s", err)
- }
-
- var err error
- if _, err = h.Final(); err != nil {
- b.Fatalf("Error while finalizing HMAC: %s", err)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_1_0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_1_0_test.go
deleted file mode 100644
index 2a2eda887b7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_1_0_test.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !openssl_pre_1.0
-
-package openssl
-
-import (
- "bytes"
- "crypto/ecdsa"
- "crypto/tls"
- "crypto/x509"
- "encoding/hex"
- pem_pkg "encoding/pem"
- "io/ioutil"
- "testing"
-)
-
-func TestMarshalEC(t *testing.T) {
- if !HasECDH() {
- t.Skip("ECDH not available")
- }
-
- key, err := LoadPrivateKeyFromPEM(prime256v1KeyBytes)
- if err != nil {
- t.Fatal(err)
- }
- cert, err := LoadCertificateFromPEM(prime256v1CertBytes)
- if err != nil {
- t.Fatal(err)
- }
-
- privateBlock, _ := pem_pkg.Decode(prime256v1KeyBytes)
- key, err = LoadPrivateKeyFromDER(privateBlock.Bytes)
- if err != nil {
- t.Fatal(err)
- }
-
- pem, err := cert.MarshalPEM()
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(pem, prime256v1CertBytes) {
- ioutil.WriteFile("generated", pem, 0644)
- ioutil.WriteFile("hardcoded", prime256v1CertBytes, 0644)
- t.Fatal("invalid cert pem bytes")
- }
-
- pem, err = key.MarshalPKCS1PrivateKeyPEM()
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(pem, prime256v1KeyBytes) {
- ioutil.WriteFile("generated", pem, 0644)
- ioutil.WriteFile("hardcoded", prime256v1KeyBytes, 0644)
- t.Fatal("invalid private key pem bytes")
- }
- tls_cert, err := tls.X509KeyPair(prime256v1CertBytes, prime256v1KeyBytes)
- if err != nil {
- t.Fatal(err)
- }
- tls_key, ok := tls_cert.PrivateKey.(*ecdsa.PrivateKey)
- if !ok {
- t.Fatal("FASDFASDF")
- }
- _ = tls_key
-
- der, err := key.MarshalPKCS1PrivateKeyDER()
- if err != nil {
- t.Fatal(err)
- }
- tls_der, err := x509.MarshalECPrivateKey(tls_key)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(der, tls_der) {
- t.Fatalf("invalid private key der bytes: %s\n v.s. %s\n",
- hex.Dump(der), hex.Dump(tls_der))
- }
-
- der, err = key.MarshalPKIXPublicKeyDER()
- if err != nil {
- t.Fatal(err)
- }
- tls_der, err = x509.MarshalPKIXPublicKey(&tls_key.PublicKey)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(der, tls_der) {
- ioutil.WriteFile("generated", []byte(hex.Dump(der)), 0644)
- ioutil.WriteFile("hardcoded", []byte(hex.Dump(tls_der)), 0644)
- t.Fatal("invalid public key der bytes")
- }
-
- pem, err = key.MarshalPKIXPublicKeyPEM()
- if err != nil {
- t.Fatal(err)
- }
- tls_pem := pem_pkg.EncodeToMemory(&pem_pkg.Block{
- Type: "PUBLIC KEY", Bytes: tls_der})
- if !bytes.Equal(pem, tls_pem) {
- ioutil.WriteFile("generated", pem, 0644)
- ioutil.WriteFile("hardcoded", tls_pem, 0644)
- t.Fatal("invalid public key pem bytes")
- }
-
- loaded_pubkey_from_pem, err := LoadPublicKeyFromPEM(pem)
- if err != nil {
- t.Fatal(err)
- }
-
- loaded_pubkey_from_der, err := LoadPublicKeyFromDER(der)
- if err != nil {
- t.Fatal(err)
- }
-
- new_der_from_pem, err := loaded_pubkey_from_pem.MarshalPKIXPublicKeyDER()
- if err != nil {
- t.Fatal(err)
- }
-
- new_der_from_der, err := loaded_pubkey_from_der.MarshalPKIXPublicKeyDER()
- if err != nil {
- t.Fatal(err)
- }
-
- if !bytes.Equal(new_der_from_der, tls_der) {
- ioutil.WriteFile("generated", []byte(hex.Dump(new_der_from_der)), 0644)
- ioutil.WriteFile("hardcoded", []byte(hex.Dump(tls_der)), 0644)
- t.Fatal("invalid public key der bytes")
- }
-
- if !bytes.Equal(new_der_from_pem, tls_der) {
- ioutil.WriteFile("generated", []byte(hex.Dump(new_der_from_pem)), 0644)
- ioutil.WriteFile("hardcoded", []byte(hex.Dump(tls_der)), 0644)
- t.Fatal("invalid public key der bytes")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_test.go
deleted file mode 100644
index 635ef638ec9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/key_test.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import (
- "bytes"
- "crypto/rsa"
- "crypto/tls"
- "crypto/x509"
- "encoding/hex"
- pem_pkg "encoding/pem"
- "io/ioutil"
- "testing"
-)
-
-func TestMarshal(t *testing.T) {
- key, err := LoadPrivateKeyFromPEM(keyBytes)
- if err != nil {
- t.Fatal(err)
- }
- cert, err := LoadCertificateFromPEM(certBytes)
- if err != nil {
- t.Fatal(err)
- }
-
- privateBlock, _ := pem_pkg.Decode(keyBytes)
- key, err = LoadPrivateKeyFromDER(privateBlock.Bytes)
- if err != nil {
- t.Fatal(err)
- }
-
- pem, err := cert.MarshalPEM()
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(pem, certBytes) {
- ioutil.WriteFile("generated", pem, 0644)
- ioutil.WriteFile("hardcoded", certBytes, 0644)
- t.Fatal("invalid cert pem bytes")
- }
-
- pem, err = key.MarshalPKCS1PrivateKeyPEM()
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(pem, keyBytes) {
- ioutil.WriteFile("generated", pem, 0644)
- ioutil.WriteFile("hardcoded", keyBytes, 0644)
- t.Fatal("invalid private key pem bytes")
- }
- tls_cert, err := tls.X509KeyPair(certBytes, keyBytes)
- if err != nil {
- t.Fatal(err)
- }
- tls_key, ok := tls_cert.PrivateKey.(*rsa.PrivateKey)
- if !ok {
- t.Fatal("FASDFASDF")
- }
- _ = tls_key
-
- der, err := key.MarshalPKCS1PrivateKeyDER()
- if err != nil {
- t.Fatal(err)
- }
- tls_der := x509.MarshalPKCS1PrivateKey(tls_key)
- if !bytes.Equal(der, tls_der) {
- t.Fatalf("invalid private key der bytes: %s\n v.s. %s\n",
- hex.Dump(der), hex.Dump(tls_der))
- }
-
- der, err = key.MarshalPKIXPublicKeyDER()
- if err != nil {
- t.Fatal(err)
- }
- tls_der, err = x509.MarshalPKIXPublicKey(&tls_key.PublicKey)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(der, tls_der) {
- ioutil.WriteFile("generated", []byte(hex.Dump(der)), 0644)
- ioutil.WriteFile("hardcoded", []byte(hex.Dump(tls_der)), 0644)
- t.Fatal("invalid public key der bytes")
- }
-
- pem, err = key.MarshalPKIXPublicKeyPEM()
- if err != nil {
- t.Fatal(err)
- }
- tls_pem := pem_pkg.EncodeToMemory(&pem_pkg.Block{
- Type: "PUBLIC KEY", Bytes: tls_der})
- if !bytes.Equal(pem, tls_pem) {
- ioutil.WriteFile("generated", pem, 0644)
- ioutil.WriteFile("hardcoded", tls_pem, 0644)
- t.Fatal("invalid public key pem bytes")
- }
-
- loaded_pubkey_from_pem, err := LoadPublicKeyFromPEM(pem)
- if err != nil {
- t.Fatal(err)
- }
-
- loaded_pubkey_from_der, err := LoadPublicKeyFromDER(der)
- if err != nil {
- t.Fatal(err)
- }
-
- new_der_from_pem, err := loaded_pubkey_from_pem.MarshalPKIXPublicKeyDER()
- if err != nil {
- t.Fatal(err)
- }
-
- new_der_from_der, err := loaded_pubkey_from_der.MarshalPKIXPublicKeyDER()
- if err != nil {
- t.Fatal(err)
- }
-
- if !bytes.Equal(new_der_from_der, tls_der) {
- ioutil.WriteFile("generated", []byte(hex.Dump(new_der_from_der)), 0644)
- ioutil.WriteFile("hardcoded", []byte(hex.Dump(tls_der)), 0644)
- t.Fatal("invalid public key der bytes")
- }
-
- if !bytes.Equal(new_der_from_pem, tls_der) {
- ioutil.WriteFile("generated", []byte(hex.Dump(new_der_from_pem)), 0644)
- ioutil.WriteFile("hardcoded", []byte(hex.Dump(tls_der)), 0644)
- t.Fatal("invalid public key der bytes")
- }
-}
-
-func TestGenerate(t *testing.T) {
- key, err := GenerateRSAKey(2048)
- if err != nil {
- t.Fatal(err)
- }
- _, err = key.MarshalPKIXPublicKeyPEM()
- if err != nil {
- t.Fatal(err)
- }
- _, err = key.MarshalPKCS1PrivateKeyPEM()
- if err != nil {
- t.Fatal(err)
- }
- _, err = GenerateRSAKeyWithExponent(1024, 65537)
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func TestSign(t *testing.T) {
- key, _ := GenerateRSAKey(1024)
- data := []byte("the quick brown fox jumps over the lazy dog")
- _, err := key.SignPKCS1v15(SHA1_Method, data)
- if err != nil {
- t.Fatal(err)
- }
- _, err = key.SignPKCS1v15(SHA256_Method, data)
- if err != nil {
- t.Fatal(err)
- }
- _, err = key.SignPKCS1v15(SHA512_Method, data)
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha1_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha1_test.go
deleted file mode 100644
index 37808b5a53e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha1_test.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import (
- "crypto/rand"
- "crypto/sha1"
- "io"
- "testing"
-)
-
-func TestSHA1(t *testing.T) {
- for i := 0; i < 100; i++ {
- buf := make([]byte, 10*1024-i)
- if _, err := io.ReadFull(rand.Reader, buf); err != nil {
- t.Fatal(err)
- }
-
- expected := sha1.Sum(buf)
- got, err := SHA1(buf)
- if err != nil {
- t.Fatal(err)
- }
-
- if expected != got {
- t.Fatalf("exp:%x got:%x", expected, got)
- }
- }
-}
-
-func TestSHA1Writer(t *testing.T) {
- ohash, err := NewSHA1Hash()
- if err != nil {
- t.Fatal(err)
- }
- hash := sha1.New()
-
- for i := 0; i < 100; i++ {
- if err := ohash.Reset(); err != nil {
- t.Fatal(err)
- }
- hash.Reset()
- buf := make([]byte, 10*1024-i)
- if _, err := io.ReadFull(rand.Reader, buf); err != nil {
- t.Fatal(err)
- }
-
- if _, err := ohash.Write(buf); err != nil {
- t.Fatal(err)
- }
- if _, err := hash.Write(buf); err != nil {
- t.Fatal(err)
- }
-
- var got, exp [20]byte
-
- hash.Sum(exp[:0])
- got, err := ohash.Sum()
- if err != nil {
- t.Fatal(err)
- }
-
- if got != exp {
- t.Fatalf("exp:%x got:%x", exp, got)
- }
- }
-}
-
-type shafunc func([]byte)
-
-func benchmarkSHA1(b *testing.B, length int64, fn shafunc) {
- buf := make([]byte, length)
- if _, err := io.ReadFull(rand.Reader, buf); err != nil {
- b.Fatal(err)
- }
- b.SetBytes(length)
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- fn(buf)
- }
-}
-
-func BenchmarkSHA1Large_openssl(b *testing.B) {
- benchmarkSHA1(b, 1024*1024, func(buf []byte) { SHA1(buf) })
-}
-
-func BenchmarkSHA1Large_stdlib(b *testing.B) {
- benchmarkSHA1(b, 1024*1024, func(buf []byte) { sha1.Sum(buf) })
-}
-
-func BenchmarkSHA1Small_openssl(b *testing.B) {
- benchmarkSHA1(b, 1, func(buf []byte) { SHA1(buf) })
-}
-
-func BenchmarkSHA1Small_stdlib(b *testing.B) {
- benchmarkSHA1(b, 1, func(buf []byte) { sha1.Sum(buf) })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha256_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha256_test.go
deleted file mode 100644
index 467e503ab42..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sha256_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import (
- "crypto/rand"
- "crypto/sha256"
- "io"
- "testing"
-)
-
-func TestSHA256(t *testing.T) {
- for i := 0; i < 100; i++ {
- buf := make([]byte, 10*1024-i)
- if _, err := io.ReadFull(rand.Reader, buf); err != nil {
- t.Fatal(err)
- }
-
- expected := sha256.Sum256(buf)
- got, err := SHA256(buf)
- if err != nil {
- t.Fatal(err)
- }
-
- if expected != got {
- t.Fatalf("exp:%x got:%x", expected, got)
- }
- }
-}
-
-func TestSHA256Writer(t *testing.T) {
- ohash, err := NewSHA256Hash()
- if err != nil {
- t.Fatal(err)
- }
- hash := sha256.New()
-
- for i := 0; i < 100; i++ {
- if err := ohash.Reset(); err != nil {
- t.Fatal(err)
- }
- hash.Reset()
- buf := make([]byte, 10*1024-i)
- if _, err := io.ReadFull(rand.Reader, buf); err != nil {
- t.Fatal(err)
- }
-
- if _, err := ohash.Write(buf); err != nil {
- t.Fatal(err)
- }
- if _, err := hash.Write(buf); err != nil {
- t.Fatal(err)
- }
-
- var got, exp [32]byte
-
- hash.Sum(exp[:0])
- got, err := ohash.Sum()
- if err != nil {
- t.Fatal(err)
- }
-
- if got != exp {
- t.Fatalf("exp:%x got:%x", exp, got)
- }
- }
-}
-
-func benchmarkSHA256(b *testing.B, length int64, fn shafunc) {
- buf := make([]byte, length)
- if _, err := io.ReadFull(rand.Reader, buf); err != nil {
- b.Fatal(err)
- }
- b.SetBytes(length)
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- fn(buf)
- }
-}
-
-func BenchmarkSHA256Large_openssl(b *testing.B) {
- benchmarkSHA256(b, 1024*1024, func(buf []byte) { SHA256(buf) })
-}
-
-func BenchmarkSHA256Large_stdlib(b *testing.B) {
- benchmarkSHA256(b, 1024*1024, func(buf []byte) { sha256.Sum256(buf) })
-}
-
-func BenchmarkSHA256Small_openssl(b *testing.B) {
- benchmarkSHA256(b, 1, func(buf []byte) { SHA256(buf) })
-}
-
-func BenchmarkSHA256Small_stdlib(b *testing.B) {
- benchmarkSHA256(b, 1, func(buf []byte) { sha256.Sum256(buf) })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sni_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sni_test.go
deleted file mode 100644
index 09e831a45c9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/sni_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import "fmt"
-
-// We can implemant SNI rfc6066 (http://tools.ietf.org/html/rfc6066) on the server side using foolowing callback.
-// You should implement context storage (tlsCtxStorage) by your self.
-func ExampleSetTLSExtServernameCallback() {
- fmt.Println("Hello")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ssl_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ssl_test.go
deleted file mode 100644
index fe2e0de4592..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/ssl_test.go
+++ /dev/null
@@ -1,656 +0,0 @@
-// Copyright (C) 2017. See AUTHORS.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openssl
-
-import (
- "bytes"
- "crypto/rand"
- "crypto/tls"
- "io"
- "io/ioutil"
- "net"
- "sync"
- "testing"
- "time"
-
- "github.com/10gen/openssl/utils"
-)
-
-var (
- certBytes = []byte(`-----BEGIN CERTIFICATE-----
-MIIDxDCCAqygAwIBAgIVAMcK/0VWQr2O3MNfJCydqR7oVELcMA0GCSqGSIb3DQEB
-BQUAMIGQMUkwRwYDVQQDE0A1NjdjZGRmYzRjOWZiNTYwZTk1M2ZlZjA1N2M0NGFm
-MDdiYjc4MDIzODIxYTA5NThiY2RmMGMwNzJhOTdiMThhMQswCQYDVQQGEwJVUzEN
-MAsGA1UECBMEVXRhaDEQMA4GA1UEBxMHTWlkdmFsZTEVMBMGA1UEChMMU3BhY2Ug
-TW9ua2V5MB4XDTEzMTIxNzE4MzgyMloXDTIzMTIxNTE4MzgyMlowgZAxSTBHBgNV
-BAMTQDM4NTg3ODRkMjU1NTdiNTM1MWZmNjRmMmQzMTQ1ZjkwYTJlMTIzMDM4Y2Yz
-Mjc1Yzg1OTM1MjcxYWIzMmNiMDkxCzAJBgNVBAYTAlVTMQ0wCwYDVQQIEwRVdGFo
-MRAwDgYDVQQHEwdNaWR2YWxlMRUwEwYDVQQKEwxTcGFjZSBNb25rZXkwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdf3icNvFsrlrnNLi8SocscqlSbFq+
-pEvmhcSoqgDLqebnqu8Ld73HJJ74MGXEgRX8xZT5FinOML31CR6t9E/j3dqV6p+G
-fdlFLe3IqtC0/bPVnCDBirBygBI4uCrMq+1VhAxPWclrDo7l9QRYbsExH9lfn+Ry
-vxeNMZiOASasvVZNncY8E9usBGRdH17EfDL/TPwXqWOLyxSN5o54GTztjjy9w9CG
-QP7jcCueKYyQJQCtEmnwc6P/q6/EPv5R6drBkX6loAPtmCUAkHqxkWOJrRq/v7Pw
-zRYhfY+ZpVHGc7WEkDnLzRiUypr1C9oxvLKS10etZEIwEdKyOkSg2fdPAgMBAAGj
-EzARMA8GA1UdEwEB/wQFMAMCAQAwDQYJKoZIhvcNAQEFBQADggEBAEcz0RTTJ99l
-HTK/zTyfV5VZEhtwqu6bwre/hD7lhI+1ji0DZYGIgCbJLKuZhj+cHn2h5nPhN7zE
-M9tc4pn0TgeVS0SVFSe6TGnIFipNogvP17E+vXpDZcW/xn9kPKeVCZc1hlDt1W4Z
-5q+ub3aUwuMwYs7bcArtDrumCmciJ3LFyNhebPi4mntb5ooeLFLaujEmVYyrQnpo
-tWKC9sMlJmLm4yAso64Sv9KLS2T9ivJBNn0ZtougozBCCTqrqgZVjha+B2yjHe9f
-sRkg/uxcJf7wC5Y0BLlp1+aPwdmZD87T3a1uQ1Ij93jmHG+2T9U20MklHAePOl0q
-yTqdSPnSH1c=
------END CERTIFICATE-----
-`)
- keyBytes = []byte(`-----BEGIN RSA PRIVATE KEY-----
-MIIEpQIBAAKCAQEA3X94nDbxbK5a5zS4vEqHLHKpUmxavqRL5oXEqKoAy6nm56rv
-C3e9xySe+DBlxIEV/MWU+RYpzjC99QkerfRP493aleqfhn3ZRS3tyKrQtP2z1Zwg
-wYqwcoASOLgqzKvtVYQMT1nJaw6O5fUEWG7BMR/ZX5/kcr8XjTGYjgEmrL1WTZ3G
-PBPbrARkXR9exHwy/0z8F6lji8sUjeaOeBk87Y48vcPQhkD+43ArnimMkCUArRJp
-8HOj/6uvxD7+UenawZF+paAD7ZglAJB6sZFjia0av7+z8M0WIX2PmaVRxnO1hJA5
-y80YlMqa9QvaMbyyktdHrWRCMBHSsjpEoNn3TwIDAQABAoIBAQCwgp6YzmgCFce3
-LBpzYmjqEM3CMzr1ZXRe1gbr6d4Mbu7leyBX4SpJAnP0kIzo1X2yG7ol7XWPLOST
-2pqqQWFQ00EX6wsJYEy+hmVRXl5HfU3MUkkAMwd9l3Xt4UWqKPBPD5XHvmN2fvl9
-Y4388vXdseXGAGNK1eFs0TMjJuOtDxDyrmJcnxpJ7y/77y/Hb5rUa9DCvj8tkKHg
-HmeIwQE0HhIFofj+qCYbqeVyjbPAaYZMrISXb2HmcyULKEOGRbMH24IzInKA0NxV
-kdP9qmV8Y2bJ609Fft/y8Vpj31iEdq/OFXyobdVvnXMnaVyAetoaWy7AOTIQ2Cnw
-wGbJ/F8BAoGBAN/pCnLQrWREeVMuFjf+MgYgCtRRaQ8EOVvjYcXXi0PhtOMFTAb7
-djqhlgmBOFsmeXcb8YRZsF+pNtu1xk5RJOquyKfK8j1rUdAJfoxGHiaUFI2/1i9E
-zuXX/Ao0xNRkWMxMKuwYBmmt1fMuVo+1M8UEwFMdHRtgxe+/+eOV1J2PAoGBAP09
-7GLOYSYAI1OO3BN/bEVNau6tAxP5YShGmX2Qxy0+ooxHZ1V3D8yo6C0hSg+H+fPT
-mjMgGcvaW6K+QyCdHDjgbk2hfdZ+Beq92JApPrH9gMV7MPhwHzgwjzDDio9OFxYY
-3vjBQ2yX+9jvz9lkvq2NM3fqFqbsG6Et+5mCc6pBAoGBAI62bxVtEgbladrtdfXs
-S6ABzkUzOl362EBL9iZuUnJKqstDtgiBQALwuLuIJA5cwHB9W/t6WuMt7CwveJy0
-NW5rRrNDtBAXlgad9o2bp135ZfxO+EoadjCi8B7lMUsaRkq4hWcDjRrQVJxxvXRN
-DxkVBSw0Uzf+/0nnN3OqLODbAoGACCY+/isAC1YDzQOS53m5RT2pjEa7C6CB1Ob4
-t4a6MiWK25LMq35qXr6swg8JMBjDHWqY0r5ctievvTv8Mwd7SgVG526j+wwRKq2z
-U2hQYS/0Peap+8S37Hn7kakpQ1VS/t4MBttJTSxS6XdGLAvG6xTZLCm3UuXUOcqe
-ByGgkUECgYEAmop45kRi974g4MPvyLplcE4syb19ifrHj76gPRBi94Cp8jZosY1T
-ucCCa4lOGgPtXJ0Qf1c8yq5vh4yqkQjrgUTkr+CFDGR6y4CxmNDQxEMYIajaIiSY
-qmgvgyRayemfO2zR0CPgC6wSoGBth+xW6g+WA8y0z76ZSaWpFi8lVM4=
------END RSA PRIVATE KEY-----
-`)
- prime256v1KeyBytes = []byte(`-----BEGIN EC PRIVATE KEY-----
-MHcCAQEEIB/XL0zZSsAu+IQF1AI/nRneabb2S126WFlvvhzmYr1KoAoGCCqGSM49
-AwEHoUQDQgAESSFGWwF6W1hoatKGPPorh4+ipyk0FqpiWdiH+4jIiU39qtOeZGSh
-1QgSbzfdHxvoYI0FXM+mqE7wec0kIvrrHw==
------END EC PRIVATE KEY-----
-`)
- prime256v1CertBytes = []byte(`-----BEGIN CERTIFICATE-----
-MIIChTCCAiqgAwIBAgIJAOQII2LQl4uxMAoGCCqGSM49BAMCMIGcMQswCQYDVQQG
-EwJVUzEPMA0GA1UECAwGS2Fuc2FzMRAwDgYDVQQHDAdOb3doZXJlMR8wHQYDVQQK
-DBZGYWtlIENlcnRpZmljYXRlcywgSW5jMUkwRwYDVQQDDEBhMWJkZDVmZjg5ZjQy
-N2IwZmNiOTdlNDMyZTY5Nzg2NjI2ODJhMWUyNzM4MDhkODE0ZWJiZjY4ODBlYzA3
-NDljMB4XDTE3MTIxNTIwNDU1MVoXDTI3MTIxMzIwNDU1MVowgZwxCzAJBgNVBAYT
-AlVTMQ8wDQYDVQQIDAZLYW5zYXMxEDAOBgNVBAcMB05vd2hlcmUxHzAdBgNVBAoM
-FkZha2UgQ2VydGlmaWNhdGVzLCBJbmMxSTBHBgNVBAMMQGExYmRkNWZmODlmNDI3
-YjBmY2I5N2U0MzJlNjk3ODY2MjY4MmExZTI3MzgwOGQ4MTRlYmJmNjg4MGVjMDc0
-OWMwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARJIUZbAXpbWGhq0oY8+iuHj6Kn
-KTQWqmJZ2If7iMiJTf2q055kZKHVCBJvN90fG+hgjQVcz6aoTvB5zSQi+usfo1Mw
-UTAdBgNVHQ4EFgQUfRYAFhlGM1wzvusyGrm26Vrbqm4wHwYDVR0jBBgwFoAUfRYA
-FhlGM1wzvusyGrm26Vrbqm4wDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNJ
-ADBGAiEA6PWNjm4B6zs3Wcha9qyDdfo1ILhHfk9rZEAGrnfyc2UCIQD1IDVJUkI4
-J/QVoOtP5DOdRPs/3XFy0Bk0qH+Uj5D7LQ==
------END CERTIFICATE-----
-`)
-)
-
-func NetPipe(t testing.TB) (net.Conn, net.Conn) {
- l, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatal(err)
- }
- defer l.Close()
- client_future := utils.NewFuture()
- go func() {
- client_future.Set(net.Dial(l.Addr().Network(), l.Addr().String()))
- }()
- var errs utils.ErrorGroup
- server_conn, err := l.Accept()
- errs.Add(err)
- client_conn, err := client_future.Get()
- errs.Add(err)
- err = errs.Finalize()
- if err != nil {
- if server_conn != nil {
- server_conn.Close()
- }
- if client_conn != nil {
- client_conn.(net.Conn).Close()
- }
- t.Fatal(err)
- }
- return server_conn, client_conn.(net.Conn)
-}
-
-type HandshakingConn interface {
- net.Conn
- Handshake() error
-}
-
-func SimpleConnTest(t testing.TB, constructor func(
- t testing.TB, conn1, conn2 net.Conn) (sslconn1, sslconn2 HandshakingConn)) {
- server_conn, client_conn := NetPipe(t)
- defer server_conn.Close()
- defer client_conn.Close()
-
- data := "first test string\n"
-
- server, client := constructor(t, server_conn, client_conn)
- defer close_both(server, client)
-
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
-
- err := client.Handshake()
- if err != nil {
- t.Fatal(err)
- }
-
- _, err = io.Copy(client, bytes.NewReader([]byte(data)))
- if err != nil {
- t.Fatal(err)
- }
-
- err = client.Close()
- if err != nil {
- t.Fatal(err)
- }
- }()
- go func() {
- defer wg.Done()
-
- err := server.Handshake()
- if err != nil {
- t.Fatal(err)
- }
-
- buf := bytes.NewBuffer(make([]byte, 0, len(data)))
- _, err = io.CopyN(buf, server, int64(len(data)))
- if err != nil {
- t.Fatal(err)
- }
- if string(buf.Bytes()) != data {
- t.Fatal("mismatched data")
- }
-
- err = server.Close()
- if err != nil {
- t.Fatal(err)
- }
- }()
- wg.Wait()
-}
-
-func close_both(closer1, closer2 io.Closer) {
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- closer1.Close()
- }()
- go func() {
- defer wg.Done()
- closer2.Close()
- }()
- wg.Wait()
-}
-
-func ClosingTest(t testing.TB, constructor func(
- t testing.TB, conn1, conn2 net.Conn) (sslconn1, sslconn2 HandshakingConn)) {
-
- run_test := func(close_tcp bool, server_writes bool) {
- server_conn, client_conn := NetPipe(t)
- defer server_conn.Close()
- defer client_conn.Close()
- server, client := constructor(t, server_conn, client_conn)
- defer close_both(server, client)
-
- var sslconn1, sslconn2 HandshakingConn
- var conn1 net.Conn
- if server_writes {
- sslconn1 = server
- conn1 = server_conn
- sslconn2 = client
- } else {
- sslconn1 = client
- conn1 = client_conn
- sslconn2 = server
- }
-
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- _, err := sslconn1.Write([]byte("hello"))
- if err != nil {
- t.Fatal(err)
- }
- if close_tcp {
- err = conn1.Close()
- } else {
- err = sslconn1.Close()
- }
- if err != nil {
- t.Fatal(err)
- }
- }()
-
- go func() {
- defer wg.Done()
- data, err := ioutil.ReadAll(sslconn2)
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(data, []byte("hello")) {
- t.Fatal("bytes don't match")
- }
- }()
-
- wg.Wait()
- }
-
- run_test(true, false)
- run_test(false, false)
- run_test(true, true)
- run_test(false, true)
-}
-
-func ThroughputBenchmark(b *testing.B, constructor func(
- t testing.TB, conn1, conn2 net.Conn) (sslconn1, sslconn2 HandshakingConn)) {
- server_conn, client_conn := NetPipe(b)
- defer server_conn.Close()
- defer client_conn.Close()
-
- server, client := constructor(b, server_conn, client_conn)
- defer close_both(server, client)
-
- b.SetBytes(1024)
- data := make([]byte, b.N*1024)
- _, err := io.ReadFull(rand.Reader, data[:])
- if err != nil {
- b.Fatal(err)
- }
-
- b.ResetTimer()
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- _, err = io.Copy(client, bytes.NewReader([]byte(data)))
- if err != nil {
- b.Fatal(err)
- }
- }()
- go func() {
- defer wg.Done()
-
- buf := &bytes.Buffer{}
- _, err = io.CopyN(buf, server, int64(len(data)))
- if err != nil {
- b.Fatal(err)
- }
- if !bytes.Equal(buf.Bytes(), data) {
- b.Fatal("mismatched data")
- }
- }()
- wg.Wait()
- b.StopTimer()
-}
-
-func StdlibConstructor(t testing.TB, server_conn, client_conn net.Conn) (
- server, client HandshakingConn) {
- cert, err := tls.X509KeyPair(certBytes, keyBytes)
- if err != nil {
- t.Fatal(err)
- }
- config := &tls.Config{
- Certificates: []tls.Certificate{cert},
- InsecureSkipVerify: true,
- CipherSuites: []uint16{tls.TLS_RSA_WITH_AES_128_CBC_SHA}}
- server = tls.Server(server_conn, config)
- client = tls.Client(client_conn, config)
- return server, client
-}
-
-func passThruVerify(t testing.TB) func(bool, *CertificateStoreCtx) bool {
- x := func(ok bool, store *CertificateStoreCtx) bool {
- cert := store.GetCurrentCert()
- if cert == nil {
- t.Fatalf("Could not obtain cert from store\n")
- }
- sn := cert.GetSerialNumberHex()
- if len(sn) == 0 {
- t.Fatalf("Could not obtain serial number from cert")
- }
- return ok
- }
- return x
-}
-
-func OpenSSLConstructor(t testing.TB, server_conn, client_conn net.Conn) (
- server, client HandshakingConn) {
- ctx, err := NewCtx()
- if err != nil {
- t.Fatal(err)
- }
- ctx.SetVerify(VerifyNone, passThruVerify(t))
- key, err := LoadPrivateKeyFromPEM(keyBytes)
- if err != nil {
- t.Fatal(err)
- }
- err = ctx.UsePrivateKey(key)
- if err != nil {
- t.Fatal(err)
- }
- cert, err := LoadCertificateFromPEM(certBytes)
- if err != nil {
- t.Fatal(err)
- }
- err = ctx.UseCertificate(cert)
- if err != nil {
- t.Fatal(err)
- }
- err = ctx.SetCipherList("AES128-SHA")
- if err != nil {
- t.Fatal(err)
- }
- server, err = Server(server_conn, ctx)
- if err != nil {
- t.Fatal(err)
- }
- client, err = Client(client_conn, ctx)
- if err != nil {
- t.Fatal(err)
- }
- return server, client
-}
-
-func StdlibOpenSSLConstructor(t testing.TB, server_conn, client_conn net.Conn) (
- server, client HandshakingConn) {
- server_std, _ := StdlibConstructor(t, server_conn, client_conn)
- _, client_ssl := OpenSSLConstructor(t, server_conn, client_conn)
- return server_std, client_ssl
-}
-
-func OpenSSLStdlibConstructor(t testing.TB, server_conn, client_conn net.Conn) (
- server, client HandshakingConn) {
- _, client_std := StdlibConstructor(t, server_conn, client_conn)
- server_ssl, _ := OpenSSLConstructor(t, server_conn, client_conn)
- return server_ssl, client_std
-}
-
-func TestStdlibSimple(t *testing.T) {
- SimpleConnTest(t, StdlibConstructor)
-}
-
-func TestOpenSSLSimple(t *testing.T) {
- SimpleConnTest(t, OpenSSLConstructor)
-}
-
-func TestStdlibClosing(t *testing.T) {
- ClosingTest(t, StdlibConstructor)
-}
-
-func TestOpenSSLClosing(t *testing.T) {
- ClosingTest(t, OpenSSLConstructor)
-}
-
-func BenchmarkStdlibThroughput(b *testing.B) {
- ThroughputBenchmark(b, StdlibConstructor)
-}
-
-func BenchmarkOpenSSLThroughput(b *testing.B) {
- ThroughputBenchmark(b, OpenSSLConstructor)
-}
-
-func TestStdlibOpenSSLSimple(t *testing.T) {
- SimpleConnTest(t, StdlibOpenSSLConstructor)
-}
-
-func TestOpenSSLStdlibSimple(t *testing.T) {
- SimpleConnTest(t, OpenSSLStdlibConstructor)
-}
-
-func TestStdlibOpenSSLClosing(t *testing.T) {
- ClosingTest(t, StdlibOpenSSLConstructor)
-}
-
-func TestOpenSSLStdlibClosing(t *testing.T) {
- ClosingTest(t, OpenSSLStdlibConstructor)
-}
-
-func BenchmarkStdlibOpenSSLThroughput(b *testing.B) {
- ThroughputBenchmark(b, StdlibOpenSSLConstructor)
-}
-
-func BenchmarkOpenSSLStdlibThroughput(b *testing.B) {
- ThroughputBenchmark(b, OpenSSLStdlibConstructor)
-}
-
-func FullDuplexRenegotiationTest(t testing.TB, constructor func(
- t testing.TB, conn1, conn2 net.Conn) (sslconn1, sslconn2 HandshakingConn)) {
-
- server_conn, client_conn := NetPipe(t)
- defer server_conn.Close()
- defer client_conn.Close()
-
- times := 256
- data_len := 4 * SSLRecordSize
- data1 := make([]byte, data_len)
- _, err := io.ReadFull(rand.Reader, data1[:])
- if err != nil {
- t.Fatal(err)
- }
- data2 := make([]byte, data_len)
- _, err = io.ReadFull(rand.Reader, data1[:])
- if err != nil {
- t.Fatal(err)
- }
-
- server, client := constructor(t, server_conn, client_conn)
- defer close_both(server, client)
-
- var wg sync.WaitGroup
-
- send_func := func(sender HandshakingConn, data []byte) {
- defer wg.Done()
- for i := 0; i < times; i++ {
- if i == times/2 {
- wg.Add(1)
- go func() {
- defer wg.Done()
- err := sender.Handshake()
- if err != nil {
- t.Fatal(err)
- }
- }()
- }
- _, err := sender.Write(data)
- if err != nil {
- t.Fatal(err)
- }
- }
- }
-
- recv_func := func(receiver net.Conn, data []byte) {
- defer wg.Done()
-
- buf := make([]byte, len(data))
- for i := 0; i < times; i++ {
- n, err := io.ReadFull(receiver, buf[:])
- if err != nil {
- t.Fatal(err)
- }
- if !bytes.Equal(buf[:n], data) {
- t.Fatal(err)
- }
- }
- }
-
- wg.Add(4)
- go recv_func(server, data1)
- go send_func(client, data1)
- go send_func(server, data2)
- go recv_func(client, data2)
- wg.Wait()
-}
-
-func TestStdlibFullDuplexRenegotiation(t *testing.T) {
- FullDuplexRenegotiationTest(t, StdlibConstructor)
-}
-
-func TestOpenSSLFullDuplexRenegotiation(t *testing.T) {
- FullDuplexRenegotiationTest(t, OpenSSLConstructor)
-}
-
-func TestOpenSSLStdlibFullDuplexRenegotiation(t *testing.T) {
- FullDuplexRenegotiationTest(t, OpenSSLStdlibConstructor)
-}
-
-func TestStdlibOpenSSLFullDuplexRenegotiation(t *testing.T) {
- FullDuplexRenegotiationTest(t, StdlibOpenSSLConstructor)
-}
-
-func LotsOfConns(t *testing.T, payload_size int64, loops, clients int,
- sleep time.Duration, newListener func(net.Listener) net.Listener,
- newClient func(net.Conn) (net.Conn, error)) {
- tcp_listener, err := net.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatal(err)
- }
- ssl_listener := newListener(tcp_listener)
- go func() {
- for {
- conn, err := ssl_listener.Accept()
- if err != nil {
- t.Fatalf("failed accept: %s", err)
- continue
- }
- go func() {
- defer func() {
- err = conn.Close()
- if err != nil {
- t.Fatalf("failed closing: %s", err)
- }
- }()
- for i := 0; i < loops; i++ {
- _, err := io.Copy(ioutil.Discard,
- io.LimitReader(conn, payload_size))
- if err != nil {
- t.Fatalf("failed reading: %s", err)
- return
- }
- _, err = io.Copy(conn, io.LimitReader(rand.Reader,
- payload_size))
- if err != nil {
- t.Fatalf("failed writing: %s", err)
- return
- }
- }
- time.Sleep(sleep)
- }()
- }
- }()
- var wg sync.WaitGroup
- for i := 0; i < clients; i++ {
- tcp_client, err := net.Dial(tcp_listener.Addr().Network(),
- tcp_listener.Addr().String())
- if err != nil {
- t.Fatal(err)
- }
- ssl_client, err := newClient(tcp_client)
- if err != nil {
- t.Fatal(err)
- }
- wg.Add(1)
- go func(i int) {
- defer func() {
- err = ssl_client.Close()
- if err != nil {
- t.Fatalf("failed closing: %s", err)
- }
- wg.Done()
- }()
- for i := 0; i < loops; i++ {
- _, err := io.Copy(ssl_client, io.LimitReader(rand.Reader,
- payload_size))
- if err != nil {
- t.Fatalf("failed writing: %s", err)
- return
- }
- _, err = io.Copy(ioutil.Discard,
- io.LimitReader(ssl_client, payload_size))
- if err != nil {
- t.Fatalf("failed reading: %s", err)
- return
- }
- }
- time.Sleep(sleep)
- }(i)
- }
- wg.Wait()
-}
-
-func TestStdlibLotsOfConns(t *testing.T) {
- tls_cert, err := tls.X509KeyPair(certBytes, keyBytes)
- if err != nil {
- t.Fatal(err)
- }
- tls_config := &tls.Config{
- Certificates: []tls.Certificate{tls_cert},
- InsecureSkipVerify: true,
- CipherSuites: []uint16{tls.TLS_RSA_WITH_AES_128_CBC_SHA}}
- LotsOfConns(t, 1024*64, 10, 100, 0*time.Second,
- func(l net.Listener) net.Listener {
- return tls.NewListener(l, tls_config)
- }, func(c net.Conn) (net.Conn, error) {
- return tls.Client(c, tls_config), nil
- })
-}
-
-func TestOpenSSLLotsOfConns(t *testing.T) {
- ctx, err := NewCtx()
- if err != nil {
- t.Fatal(err)
- }
- key, err := LoadPrivateKeyFromPEM(keyBytes)
- if err != nil {
- t.Fatal(err)
- }
- err = ctx.UsePrivateKey(key)
- if err != nil {
- t.Fatal(err)
- }
- cert, err := LoadCertificateFromPEM(certBytes)
- if err != nil {
- t.Fatal(err)
- }
- err = ctx.UseCertificate(cert)
- if err != nil {
- t.Fatal(err)
- }
- err = ctx.SetCipherList("AES128-SHA")
- if err != nil {
- t.Fatal(err)
- }
- LotsOfConns(t, 1024*64, 10, 100, 0*time.Second,
- func(l net.Listener) net.Listener {
- return NewListener(l, ctx)
- }, func(c net.Conn) (net.Conn, error) {
- return Client(c, ctx)
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/system_certs.c b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/system_certs.c
index 056f524aa1e..7f96fe95065 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/system_certs.c
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/system_certs.c
@@ -54,7 +54,7 @@ static int importCertStoreToX509_STORE(
int status = 1;
X509* x509Cert = NULL;
HCERTSTORE systemStore =
- CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, (HCRYPTPROV)NULL, storeLocation, storeName);
+ CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, (HCRYPTPROV)NULL, storeLocation | CERT_STORE_READONLY_FLAG, storeName);
if (systemStore == NULL) {
formatError(GetLastError(),"error opening system CA store",err,err_len);
status = 0;
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/version_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/version_test.go
deleted file mode 100644
index 9877fb9c7dd..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/10gen/openssl/version_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) MongoDB, Inc. 2018-present.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-
-package openssl
-
-import (
- "testing"
-)
-
-func TestVersion(t *testing.T) {
- v := Version
- b := BuildVersion
- x := VersionNumber
- if len(v) == 0 {
- t.Fatal("Version string is empty")
- }
- if len(b) == 0 {
- t.Fatal("BuildVersion string is empty")
- }
- if x == 0 {
- t.Fatal("VersionNumber is zero")
- }
- t.Logf("Built with headers from: %s", BuildVersion)
- t.Logf(" Tests linked against: %s", Version)
- t.Logf(" Linked hex version is: %x", VersionNumber)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/lint_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/lint_test.go
deleted file mode 100644
index 12e3afb8138..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/lint_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2013 The Go Authors. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file or at
-// https://developers.google.com/open-source/licenses/bsd.
-
-package lint
-
-import (
- "bytes"
- "flag"
- "go/parser"
- "go/printer"
- "go/token"
- "io/ioutil"
- "path"
- "regexp"
- "strings"
- "testing"
-)
-
-var lintMatch = flag.String("lint.match", "", "restrict testdata matches to this pattern")
-
-func TestAll(t *testing.T) {
- l := new(Linter)
- rx, err := regexp.Compile(*lintMatch)
- if err != nil {
- t.Fatalf("Bad -lint.match value %q: %v", *lintMatch, err)
- }
-
- baseDir := "testdata"
- fis, err := ioutil.ReadDir(baseDir)
- if err != nil {
- t.Fatalf("ioutil.ReadDir: %v", err)
- }
- if len(fis) == 0 {
- t.Fatalf("no files in %v", baseDir)
- }
- for _, fi := range fis {
- if !rx.MatchString(fi.Name()) {
- continue
- }
- //t.Logf("Testing %s", fi.Name())
- src, err := ioutil.ReadFile(path.Join(baseDir, fi.Name()))
- if err != nil {
- t.Fatalf("Failed reading %s: %v", fi.Name(), err)
- }
-
- ins := parseInstructions(t, fi.Name(), src)
- if ins == nil {
- t.Errorf("Test file %v does not have instructions", fi.Name())
- continue
- }
-
- ps, err := l.Lint(fi.Name(), src)
- if err != nil {
- t.Errorf("Linting %s: %v", fi.Name(), err)
- continue
- }
-
- for _, in := range ins {
- ok := false
- for i, p := range ps {
- if p.Position.Line != in.Line {
- continue
- }
- if in.Match.MatchString(p.Text) {
- // remove this problem from ps
- copy(ps[i:], ps[i+1:])
- ps = ps[:len(ps)-1]
-
- //t.Logf("/%v/ matched at %s:%d", in.Match, fi.Name(), in.Line)
- ok = true
- break
- }
- }
- if !ok {
- t.Errorf("Lint failed at %s:%d; /%v/ did not match", fi.Name(), in.Line, in.Match)
- }
- }
- for _, p := range ps {
- t.Errorf("Unexpected problem at %s:%d: %v", fi.Name(), p.Position.Line, p.Text)
- }
- }
-}
-
-type instruction struct {
- Line int // the line number this applies to
- Match *regexp.Regexp // what pattern to match
-}
-
-// parseInstructions parses instructions from the comments in a Go source file.
-// It returns nil if none were parsed.
-func parseInstructions(t *testing.T, filename string, src []byte) []instruction {
- fset := token.NewFileSet()
- f, err := parser.ParseFile(fset, filename, src, parser.ParseComments)
- if err != nil {
- t.Fatalf("Test file %v does not parse: %v", filename, err)
- }
- var ins []instruction
- for _, cg := range f.Comments {
- ln := fset.Position(cg.Pos()).Line
- raw := cg.Text()
- for _, line := range strings.Split(raw, "\n") {
- if line == "" || strings.HasPrefix(line, "#") {
- continue
- }
- if line == "OK" && ins == nil {
- // so our return value will be non-nil
- ins = make([]instruction, 0)
- continue
- }
- if strings.Contains(line, "MATCH") {
- a, b := strings.Index(line, "/"), strings.LastIndex(line, "/")
- if a == -1 || a == b {
- t.Fatalf("Malformed match instruction %q at %v:%d", line, filename, ln)
- }
- pat := line[a+1 : b]
- rx, err := regexp.Compile(pat)
- if err != nil {
- t.Fatalf("Bad match pattern %q at %v:%d: %v", pat, filename, ln, err)
- }
- ins = append(ins, instruction{
- Line: ln,
- Match: rx,
- })
- }
- }
- }
- return ins
-}
-
-func render(fset *token.FileSet, x interface{}) string {
- var buf bytes.Buffer
- if err := printer.Fprint(&buf, fset, x); err != nil {
- panic(err)
- }
- return buf.String()
-}
-
-func TestLine(t *testing.T) {
- tests := []struct {
- src string
- offset int
- want string
- }{
- {"single line file", 5, "single line file"},
- {"single line file with newline\n", 5, "single line file with newline\n"},
- {"first\nsecond\nthird\n", 2, "first\n"},
- {"first\nsecond\nthird\n", 9, "second\n"},
- {"first\nsecond\nthird\n", 14, "third\n"},
- {"first\nsecond\nthird with no newline", 16, "third with no newline"},
- {"first byte\n", 0, "first byte\n"},
- }
- for _, test := range tests {
- got := srcLine([]byte(test.src), token.Position{Offset: test.offset})
- if got != test.want {
- t.Errorf("srcLine(%q, offset=%d) = %q, want %q", test.src, test.offset, got, test.want)
- }
- }
-}
-
-func TestLintName(t *testing.T) {
- tests := []struct {
- name, want string
- }{
- {"foo_bar", "fooBar"},
- {"foo_bar_baz", "fooBarBaz"},
- {"Foo_bar", "FooBar"},
- {"foo_WiFi", "fooWiFi"},
- {"id", "id"},
- {"Id", "ID"},
- {"foo_id", "fooID"},
- {"fooId", "fooID"},
- {"fooUid", "fooUID"},
- {"idFoo", "idFoo"},
- {"uidFoo", "uidFoo"},
- {"midIdDle", "midIDDle"},
- {"APIProxy", "APIProxy"},
- {"ApiProxy", "APIProxy"},
- {"apiProxy", "apiProxy"},
- {"_Leading", "_Leading"},
- {"___Leading", "_Leading"},
- {"trailing_", "trailing"},
- {"trailing___", "trailing"},
- {"a_b", "aB"},
- {"a__b", "aB"},
- {"a___b", "aB"},
- {"Rpc1150", "RPC1150"},
- }
- for _, test := range tests {
- got := lintName(test.name)
- if got != test.want {
- t.Errorf("lintName(%q) = %q, want %q", test.name, got, test.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/5_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/5_test.go
deleted file mode 100644
index af174587c0a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/5_test.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// This file ends in _test.go, so we should not warn about doc comments.
-// OK
-
-package pkg
-
-import "testing"
-
-type H int
-
-func TestSomething(t *testing.T) {
-}
-
-func TestSomething_suffix(t *testing.T) {
-}
-
-func ExampleBuffer_reader() {
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/blank-import-lib_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/blank-import-lib_test.go
deleted file mode 100644
index 0307985f86c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/3rf/mongo-lint/testdata/blank-import-lib_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test that blank imports in test packages are not flagged.
-// OK
-
-// Package foo ...
-package foo
-
-// These are essentially the same imports as in the "library" package, but
-// these should not trigger the warning because this is a test.
-
-import _ "encoding/json"
-
-import (
- "fmt"
- "testing"
-
- _ "os"
-
- _ "net/http"
- _ "path"
-)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/golden_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/golden_test.go
deleted file mode 100644
index e4496f92e30..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/golden_test.go
+++ /dev/null
@@ -1,1965 +0,0 @@
-// Copyright 2016 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package snappy
-
-// extendMatchGoldenTestCases is the i and j arguments, and the returned value,
-// for every extendMatch call issued when encoding the
-// testdata/Mark.Twain-Tom.Sawyer.txt file. It is used to benchmark the
-// extendMatch implementation.
-//
-// It was generated manually by adding some print statements to the (pure Go)
-// extendMatch implementation:
-//
-// func extendMatch(src []byte, i, j int) int {
-// i0, j0 := i, j
-// for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 {
-// }
-// println("{", i0, ",", j0, ",", j, "},")
-// return j
-// }
-//
-// and running "go test -test.run=EncodeGoldenInput -tags=noasm".
-var extendMatchGoldenTestCases = []struct {
- i, j, want int
-}{
- {11, 61, 62},
- {80, 81, 82},
- {86, 87, 101},
- {85, 133, 149},
- {152, 153, 162},
- {133, 168, 193},
- {168, 207, 225},
- {81, 255, 275},
- {278, 279, 283},
- {306, 417, 417},
- {373, 428, 430},
- {389, 444, 447},
- {474, 510, 512},
- {465, 533, 533},
- {47, 547, 547},
- {307, 551, 554},
- {420, 582, 587},
- {309, 604, 604},
- {604, 625, 625},
- {538, 629, 629},
- {328, 640, 640},
- {573, 645, 645},
- {319, 657, 657},
- {30, 664, 664},
- {45, 679, 680},
- {621, 684, 684},
- {376, 700, 700},
- {33, 707, 708},
- {601, 733, 733},
- {334, 744, 745},
- {625, 758, 759},
- {382, 763, 763},
- {550, 769, 771},
- {533, 789, 789},
- {804, 813, 813},
- {342, 841, 842},
- {742, 847, 847},
- {74, 852, 852},
- {810, 864, 864},
- {758, 868, 869},
- {714, 883, 883},
- {582, 889, 891},
- {61, 934, 935},
- {894, 942, 942},
- {939, 949, 949},
- {785, 956, 957},
- {886, 978, 978},
- {792, 998, 998},
- {998, 1005, 1005},
- {572, 1032, 1032},
- {698, 1051, 1053},
- {599, 1067, 1069},
- {1056, 1079, 1079},
- {942, 1089, 1090},
- {831, 1094, 1096},
- {1088, 1100, 1103},
- {732, 1113, 1114},
- {1037, 1118, 1118},
- {872, 1128, 1130},
- {1079, 1140, 1142},
- {332, 1162, 1162},
- {207, 1168, 1186},
- {1189, 1190, 1225},
- {105, 1229, 1230},
- {79, 1256, 1257},
- {1190, 1261, 1283},
- {255, 1306, 1306},
- {1319, 1339, 1358},
- {364, 1370, 1370},
- {955, 1378, 1380},
- {122, 1403, 1403},
- {1325, 1407, 1419},
- {664, 1423, 1424},
- {941, 1461, 1463},
- {867, 1477, 1478},
- {757, 1488, 1489},
- {1140, 1499, 1499},
- {31, 1506, 1506},
- {1487, 1510, 1512},
- {1089, 1520, 1521},
- {1467, 1525, 1529},
- {1394, 1537, 1537},
- {1499, 1541, 1541},
- {367, 1558, 1558},
- {1475, 1564, 1564},
- {1525, 1568, 1571},
- {1541, 1582, 1583},
- {864, 1587, 1588},
- {704, 1597, 1597},
- {336, 1602, 1602},
- {1383, 1613, 1613},
- {1498, 1617, 1618},
- {1051, 1623, 1625},
- {401, 1643, 1645},
- {1072, 1654, 1655},
- {1067, 1667, 1669},
- {699, 1673, 1674},
- {1587, 1683, 1684},
- {920, 1696, 1696},
- {1505, 1710, 1710},
- {1550, 1723, 1723},
- {996, 1727, 1727},
- {833, 1733, 1734},
- {1638, 1739, 1740},
- {1654, 1744, 1744},
- {753, 1761, 1761},
- {1548, 1773, 1773},
- {1568, 1777, 1780},
- {1683, 1793, 1794},
- {948, 1801, 1801},
- {1666, 1805, 1808},
- {1502, 1814, 1814},
- {1696, 1822, 1822},
- {502, 1836, 1837},
- {917, 1843, 1843},
- {1733, 1854, 1855},
- {970, 1859, 1859},
- {310, 1863, 1863},
- {657, 1872, 1872},
- {1005, 1876, 1876},
- {1662, 1880, 1880},
- {904, 1892, 1892},
- {1427, 1910, 1910},
- {1772, 1929, 1930},
- {1822, 1937, 1940},
- {1858, 1949, 1950},
- {1602, 1956, 1956},
- {1150, 1962, 1962},
- {1504, 1966, 1967},
- {51, 1971, 1971},
- {1605, 1979, 1979},
- {1458, 1983, 1988},
- {1536, 2001, 2006},
- {1373, 2014, 2018},
- {1494, 2025, 2025},
- {1667, 2029, 2031},
- {1592, 2035, 2035},
- {330, 2045, 2045},
- {1376, 2053, 2053},
- {1991, 2058, 2059},
- {1635, 2065, 2065},
- {1992, 2073, 2074},
- {2014, 2080, 2081},
- {1546, 2085, 2087},
- {59, 2099, 2099},
- {1996, 2106, 2106},
- {1836, 2110, 2110},
- {2068, 2114, 2114},
- {1338, 2122, 2122},
- {1562, 2128, 2130},
- {1934, 2134, 2134},
- {2114, 2141, 2142},
- {977, 2149, 2150},
- {956, 2154, 2155},
- {1407, 2162, 2162},
- {1773, 2166, 2166},
- {883, 2171, 2171},
- {623, 2175, 2178},
- {1520, 2191, 2192},
- {1162, 2200, 2200},
- {912, 2204, 2204},
- {733, 2208, 2208},
- {1777, 2212, 2215},
- {1532, 2219, 2219},
- {718, 2223, 2225},
- {2069, 2229, 2229},
- {2207, 2245, 2246},
- {1139, 2264, 2264},
- {677, 2274, 2274},
- {2099, 2279, 2279},
- {1863, 2283, 2283},
- {1966, 2305, 2306},
- {2279, 2313, 2313},
- {1628, 2319, 2319},
- {755, 2329, 2329},
- {1461, 2334, 2334},
- {2117, 2340, 2340},
- {2313, 2349, 2349},
- {1859, 2353, 2353},
- {1048, 2362, 2362},
- {895, 2366, 2366},
- {2278, 2373, 2373},
- {1884, 2377, 2377},
- {1402, 2387, 2392},
- {700, 2398, 2398},
- {1971, 2402, 2402},
- {2009, 2419, 2419},
- {1441, 2426, 2428},
- {2208, 2432, 2432},
- {2038, 2436, 2436},
- {932, 2443, 2443},
- {1759, 2447, 2448},
- {744, 2452, 2452},
- {1875, 2458, 2458},
- {2405, 2468, 2468},
- {1596, 2472, 2473},
- {1953, 2480, 2482},
- {736, 2487, 2487},
- {1913, 2493, 2493},
- {774, 2497, 2497},
- {1484, 2506, 2508},
- {2432, 2512, 2512},
- {752, 2519, 2519},
- {2497, 2523, 2523},
- {2409, 2528, 2529},
- {2122, 2533, 2533},
- {2396, 2537, 2538},
- {2410, 2547, 2548},
- {1093, 2555, 2560},
- {551, 2564, 2565},
- {2268, 2569, 2569},
- {1362, 2580, 2580},
- {1916, 2584, 2585},
- {994, 2589, 2590},
- {1979, 2596, 2596},
- {1041, 2602, 2602},
- {2104, 2614, 2616},
- {2609, 2621, 2628},
- {2329, 2638, 2638},
- {2211, 2657, 2658},
- {2638, 2662, 2667},
- {2578, 2676, 2679},
- {2153, 2685, 2686},
- {2608, 2696, 2697},
- {598, 2712, 2712},
- {2620, 2719, 2720},
- {1888, 2724, 2728},
- {2709, 2732, 2732},
- {1365, 2739, 2739},
- {784, 2747, 2748},
- {424, 2753, 2753},
- {2204, 2759, 2759},
- {812, 2768, 2769},
- {2455, 2773, 2773},
- {1722, 2781, 2781},
- {1917, 2792, 2792},
- {2705, 2799, 2799},
- {2685, 2806, 2807},
- {2742, 2811, 2811},
- {1370, 2818, 2818},
- {2641, 2830, 2830},
- {2512, 2837, 2837},
- {2457, 2841, 2841},
- {2756, 2845, 2845},
- {2719, 2855, 2855},
- {1423, 2859, 2859},
- {2849, 2863, 2865},
- {1474, 2871, 2871},
- {1161, 2875, 2876},
- {2282, 2880, 2881},
- {2746, 2888, 2888},
- {1783, 2893, 2893},
- {2401, 2899, 2900},
- {2632, 2920, 2923},
- {2422, 2928, 2930},
- {2715, 2939, 2939},
- {2162, 2943, 2943},
- {2859, 2947, 2947},
- {1910, 2951, 2951},
- {1431, 2955, 2956},
- {1439, 2964, 2964},
- {2501, 2968, 2969},
- {2029, 2973, 2976},
- {689, 2983, 2984},
- {1658, 2988, 2988},
- {1031, 2996, 2996},
- {2149, 3001, 3002},
- {25, 3009, 3013},
- {2964, 3023, 3023},
- {953, 3027, 3028},
- {2359, 3036, 3036},
- {3023, 3049, 3049},
- {2880, 3055, 3056},
- {2973, 3076, 3077},
- {2874, 3090, 3090},
- {2871, 3094, 3094},
- {2532, 3100, 3100},
- {2938, 3107, 3108},
- {350, 3115, 3115},
- {2196, 3119, 3121},
- {1133, 3127, 3129},
- {1797, 3134, 3150},
- {3032, 3158, 3158},
- {3016, 3172, 3172},
- {2533, 3179, 3179},
- {3055, 3187, 3188},
- {1384, 3192, 3193},
- {2799, 3199, 3199},
- {2126, 3203, 3207},
- {2334, 3215, 3215},
- {2105, 3220, 3221},
- {3199, 3229, 3229},
- {2891, 3233, 3233},
- {855, 3240, 3240},
- {1852, 3253, 3256},
- {2140, 3263, 3263},
- {1682, 3268, 3270},
- {3243, 3274, 3274},
- {924, 3279, 3279},
- {2212, 3283, 3283},
- {2596, 3287, 3287},
- {2999, 3291, 3291},
- {2353, 3295, 3295},
- {2480, 3302, 3304},
- {1959, 3308, 3311},
- {3000, 3318, 3318},
- {845, 3330, 3330},
- {2283, 3334, 3334},
- {2519, 3342, 3342},
- {3325, 3346, 3348},
- {2397, 3353, 3354},
- {2763, 3358, 3358},
- {3198, 3363, 3364},
- {3211, 3368, 3372},
- {2950, 3376, 3377},
- {3245, 3388, 3391},
- {2264, 3398, 3398},
- {795, 3403, 3403},
- {3287, 3407, 3407},
- {3358, 3411, 3411},
- {3317, 3415, 3415},
- {3232, 3431, 3431},
- {2128, 3435, 3437},
- {3236, 3441, 3441},
- {3398, 3445, 3446},
- {2814, 3450, 3450},
- {3394, 3466, 3466},
- {2425, 3470, 3470},
- {3330, 3476, 3476},
- {1612, 3480, 3480},
- {1004, 3485, 3486},
- {2732, 3490, 3490},
- {1117, 3494, 3495},
- {629, 3501, 3501},
- {3087, 3514, 3514},
- {684, 3518, 3518},
- {3489, 3522, 3524},
- {1760, 3529, 3529},
- {617, 3537, 3537},
- {3431, 3541, 3541},
- {997, 3547, 3547},
- {882, 3552, 3553},
- {2419, 3558, 3558},
- {610, 3562, 3563},
- {1903, 3567, 3569},
- {3005, 3575, 3575},
- {3076, 3585, 3586},
- {3541, 3590, 3590},
- {3490, 3594, 3594},
- {1899, 3599, 3599},
- {3545, 3606, 3606},
- {3290, 3614, 3615},
- {2056, 3619, 3620},
- {3556, 3625, 3625},
- {3294, 3632, 3633},
- {637, 3643, 3644},
- {3609, 3648, 3650},
- {3175, 3658, 3658},
- {3498, 3665, 3665},
- {1597, 3669, 3669},
- {1983, 3673, 3673},
- {3215, 3682, 3682},
- {3544, 3689, 3689},
- {3694, 3698, 3698},
- {3228, 3715, 3716},
- {2594, 3720, 3722},
- {3573, 3726, 3726},
- {2479, 3732, 3735},
- {3191, 3741, 3742},
- {1113, 3746, 3747},
- {2844, 3751, 3751},
- {3445, 3756, 3757},
- {3755, 3766, 3766},
- {3421, 3775, 3780},
- {3593, 3784, 3786},
- {3263, 3796, 3796},
- {3469, 3806, 3806},
- {2602, 3815, 3815},
- {723, 3819, 3821},
- {1608, 3826, 3826},
- {3334, 3830, 3830},
- {2198, 3835, 3835},
- {2635, 3840, 3840},
- {3702, 3852, 3853},
- {3406, 3858, 3859},
- {3681, 3867, 3870},
- {3407, 3880, 3880},
- {340, 3889, 3889},
- {3772, 3893, 3893},
- {593, 3897, 3897},
- {2563, 3914, 3916},
- {2981, 3929, 3929},
- {1835, 3933, 3934},
- {3906, 3951, 3951},
- {1459, 3958, 3958},
- {3889, 3974, 3974},
- {2188, 3982, 3982},
- {3220, 3986, 3987},
- {3585, 3991, 3993},
- {3712, 3997, 4001},
- {2805, 4007, 4007},
- {1879, 4012, 4013},
- {3618, 4018, 4018},
- {1145, 4031, 4032},
- {3901, 4037, 4037},
- {2772, 4046, 4047},
- {2802, 4053, 4054},
- {3299, 4058, 4058},
- {3725, 4066, 4066},
- {2271, 4070, 4070},
- {385, 4075, 4076},
- {3624, 4089, 4090},
- {3745, 4096, 4098},
- {1563, 4102, 4102},
- {4045, 4106, 4111},
- {3696, 4115, 4119},
- {3376, 4125, 4126},
- {1880, 4130, 4130},
- {2048, 4140, 4141},
- {2724, 4149, 4149},
- {1767, 4156, 4156},
- {2601, 4164, 4164},
- {2757, 4168, 4168},
- {3974, 4172, 4172},
- {3914, 4178, 4178},
- {516, 4185, 4185},
- {1032, 4189, 4190},
- {3462, 4197, 4198},
- {3805, 4202, 4203},
- {3910, 4207, 4212},
- {3075, 4221, 4221},
- {3756, 4225, 4226},
- {1872, 4236, 4237},
- {3844, 4241, 4241},
- {3991, 4245, 4249},
- {2203, 4258, 4258},
- {3903, 4267, 4268},
- {705, 4272, 4272},
- {1896, 4276, 4276},
- {1955, 4285, 4288},
- {3746, 4302, 4303},
- {2672, 4311, 4311},
- {3969, 4317, 4317},
- {3883, 4322, 4322},
- {1920, 4339, 4340},
- {3527, 4344, 4346},
- {1160, 4358, 4358},
- {3648, 4364, 4366},
- {2711, 4387, 4387},
- {3619, 4391, 4392},
- {1944, 4396, 4396},
- {4369, 4400, 4400},
- {2736, 4404, 4407},
- {2546, 4411, 4412},
- {4390, 4422, 4422},
- {3610, 4426, 4427},
- {4058, 4431, 4431},
- {4374, 4435, 4435},
- {3463, 4445, 4446},
- {1813, 4452, 4452},
- {3669, 4456, 4456},
- {3830, 4460, 4460},
- {421, 4464, 4465},
- {1719, 4471, 4471},
- {3880, 4475, 4475},
- {1834, 4485, 4487},
- {3590, 4491, 4491},
- {442, 4496, 4497},
- {4435, 4501, 4501},
- {3814, 4509, 4509},
- {987, 4513, 4513},
- {4494, 4518, 4521},
- {3218, 4526, 4529},
- {4221, 4537, 4537},
- {2778, 4543, 4545},
- {4422, 4552, 4552},
- {4031, 4558, 4559},
- {4178, 4563, 4563},
- {3726, 4567, 4574},
- {4027, 4578, 4578},
- {4339, 4585, 4587},
- {3796, 4592, 4595},
- {543, 4600, 4613},
- {2855, 4620, 4621},
- {2795, 4627, 4627},
- {3440, 4631, 4632},
- {4279, 4636, 4639},
- {4245, 4643, 4645},
- {4516, 4649, 4650},
- {3133, 4654, 4654},
- {4042, 4658, 4659},
- {3422, 4663, 4663},
- {4046, 4667, 4668},
- {4267, 4672, 4672},
- {4004, 4676, 4677},
- {2490, 4682, 4682},
- {2451, 4697, 4697},
- {3027, 4705, 4705},
- {4028, 4717, 4717},
- {4460, 4721, 4721},
- {2471, 4725, 4727},
- {3090, 4735, 4735},
- {3192, 4739, 4740},
- {3835, 4760, 4760},
- {4540, 4764, 4764},
- {4007, 4772, 4774},
- {619, 4784, 4784},
- {3561, 4789, 4791},
- {3367, 4805, 4805},
- {4490, 4810, 4811},
- {2402, 4815, 4815},
- {3352, 4819, 4822},
- {2773, 4828, 4828},
- {4552, 4832, 4832},
- {2522, 4840, 4841},
- {316, 4847, 4852},
- {4715, 4858, 4858},
- {2959, 4862, 4862},
- {4858, 4868, 4869},
- {2134, 4873, 4873},
- {578, 4878, 4878},
- {4189, 4889, 4890},
- {2229, 4894, 4894},
- {4501, 4898, 4898},
- {2297, 4903, 4903},
- {2933, 4909, 4909},
- {3008, 4913, 4913},
- {3153, 4917, 4917},
- {4819, 4921, 4921},
- {4921, 4932, 4933},
- {4920, 4944, 4945},
- {4814, 4954, 4955},
- {576, 4966, 4966},
- {1854, 4970, 4971},
- {1374, 4975, 4976},
- {3307, 4980, 4980},
- {974, 4984, 4988},
- {4721, 4992, 4992},
- {4898, 4996, 4996},
- {4475, 5006, 5006},
- {3819, 5012, 5012},
- {1948, 5019, 5021},
- {4954, 5027, 5029},
- {3740, 5038, 5040},
- {4763, 5044, 5045},
- {1936, 5051, 5051},
- {4844, 5055, 5060},
- {4215, 5069, 5072},
- {1146, 5076, 5076},
- {3845, 5082, 5082},
- {4865, 5090, 5090},
- {4624, 5094, 5094},
- {4815, 5098, 5098},
- {5006, 5105, 5105},
- {4980, 5109, 5109},
- {4795, 5113, 5115},
- {5043, 5119, 5121},
- {4782, 5129, 5129},
- {3826, 5139, 5139},
- {3876, 5156, 5156},
- {3111, 5167, 5171},
- {1470, 5177, 5177},
- {4431, 5181, 5181},
- {546, 5189, 5189},
- {4225, 5193, 5193},
- {1672, 5199, 5201},
- {4207, 5205, 5209},
- {4220, 5216, 5217},
- {4658, 5224, 5225},
- {3295, 5235, 5235},
- {2436, 5239, 5239},
- {2349, 5246, 5246},
- {2175, 5250, 5250},
- {5180, 5257, 5258},
- {3161, 5263, 5263},
- {5105, 5272, 5272},
- {3552, 5282, 5282},
- {4944, 5299, 5300},
- {4130, 5312, 5313},
- {902, 5323, 5323},
- {913, 5327, 5327},
- {2987, 5333, 5334},
- {5150, 5344, 5344},
- {5249, 5348, 5348},
- {1965, 5358, 5359},
- {5330, 5364, 5364},
- {2012, 5373, 5377},
- {712, 5384, 5386},
- {5235, 5390, 5390},
- {5044, 5398, 5399},
- {564, 5406, 5406},
- {39, 5410, 5410},
- {4642, 5422, 5425},
- {4421, 5437, 5438},
- {2347, 5449, 5449},
- {5333, 5453, 5454},
- {4136, 5458, 5459},
- {3793, 5468, 5468},
- {2243, 5480, 5480},
- {4889, 5492, 5493},
- {4295, 5504, 5504},
- {2785, 5511, 5511},
- {2377, 5518, 5518},
- {3662, 5525, 5525},
- {5097, 5529, 5530},
- {4781, 5537, 5538},
- {4697, 5547, 5548},
- {436, 5552, 5553},
- {5542, 5558, 5558},
- {3692, 5562, 5562},
- {2696, 5568, 5569},
- {4620, 5578, 5578},
- {2898, 5590, 5590},
- {5557, 5596, 5618},
- {2797, 5623, 5625},
- {2792, 5629, 5629},
- {5243, 5633, 5633},
- {5348, 5637, 5637},
- {5547, 5643, 5643},
- {4296, 5654, 5655},
- {5568, 5662, 5662},
- {3001, 5670, 5671},
- {3794, 5679, 5679},
- {4006, 5685, 5686},
- {4969, 5690, 5692},
- {687, 5704, 5704},
- {4563, 5708, 5708},
- {1723, 5738, 5738},
- {649, 5742, 5742},
- {5163, 5748, 5755},
- {3907, 5759, 5759},
- {3074, 5764, 5764},
- {5326, 5771, 5771},
- {2951, 5776, 5776},
- {5181, 5780, 5780},
- {2614, 5785, 5788},
- {4709, 5794, 5794},
- {2784, 5799, 5799},
- {5518, 5803, 5803},
- {4155, 5812, 5815},
- {921, 5819, 5819},
- {5224, 5823, 5824},
- {2853, 5830, 5836},
- {5776, 5840, 5840},
- {2955, 5844, 5845},
- {5745, 5853, 5853},
- {3291, 5857, 5857},
- {2988, 5861, 5861},
- {2647, 5865, 5865},
- {5398, 5869, 5870},
- {1085, 5874, 5875},
- {4906, 5881, 5881},
- {802, 5886, 5886},
- {5119, 5890, 5893},
- {5802, 5899, 5900},
- {3415, 5904, 5904},
- {5629, 5908, 5908},
- {3714, 5912, 5914},
- {5558, 5921, 5921},
- {2710, 5927, 5928},
- {1094, 5932, 5934},
- {2653, 5940, 5941},
- {4735, 5954, 5954},
- {5861, 5958, 5958},
- {1040, 5971, 5971},
- {5514, 5977, 5977},
- {5048, 5981, 5982},
- {5953, 5992, 5993},
- {3751, 5997, 5997},
- {4991, 6001, 6002},
- {5885, 6006, 6007},
- {5529, 6011, 6012},
- {4974, 6019, 6020},
- {5857, 6024, 6024},
- {3483, 6032, 6032},
- {3594, 6036, 6036},
- {1997, 6040, 6040},
- {5997, 6044, 6047},
- {5197, 6051, 6051},
- {1764, 6055, 6055},
- {6050, 6059, 6059},
- {5239, 6063, 6063},
- {5049, 6067, 6067},
- {5957, 6073, 6074},
- {1022, 6078, 6078},
- {3414, 6083, 6084},
- {3809, 6090, 6090},
- {4562, 6095, 6096},
- {5878, 6104, 6104},
- {594, 6108, 6109},
- {3353, 6115, 6116},
- {4992, 6120, 6121},
- {2424, 6125, 6125},
- {4484, 6130, 6130},
- {3900, 6134, 6135},
- {5793, 6139, 6141},
- {3562, 6145, 6145},
- {1438, 6152, 6153},
- {6058, 6157, 6158},
- {4411, 6162, 6163},
- {4590, 6167, 6171},
- {4748, 6175, 6175},
- {5517, 6183, 6184},
- {6095, 6191, 6192},
- {1471, 6203, 6203},
- {2643, 6209, 6210},
- {450, 6220, 6220},
- {5266, 6226, 6226},
- {2576, 6233, 6233},
- {2607, 6239, 6240},
- {5164, 6244, 6251},
- {6054, 6255, 6255},
- {1789, 6260, 6261},
- {5250, 6265, 6265},
- {6062, 6273, 6278},
- {5990, 6282, 6282},
- {3283, 6286, 6286},
- {5436, 6290, 6290},
- {6059, 6294, 6294},
- {5668, 6298, 6300},
- {3072, 6324, 6329},
- {3132, 6338, 6339},
- {3246, 6343, 6344},
- {28, 6348, 6349},
- {1503, 6353, 6355},
- {6067, 6359, 6359},
- {3384, 6364, 6364},
- {545, 6375, 6376},
- {5803, 6380, 6380},
- {5522, 6384, 6385},
- {5908, 6389, 6389},
- {2796, 6393, 6396},
- {4831, 6403, 6404},
- {6388, 6412, 6412},
- {6005, 6417, 6420},
- {4450, 6430, 6430},
- {4050, 6435, 6435},
- {5372, 6441, 6441},
- {4378, 6447, 6447},
- {6199, 6452, 6452},
- {3026, 6456, 6456},
- {2642, 6460, 6462},
- {6392, 6470, 6470},
- {6459, 6474, 6474},
- {2829, 6487, 6488},
- {2942, 6499, 6504},
- {5069, 6508, 6511},
- {5341, 6515, 6516},
- {5853, 6521, 6525},
- {6104, 6531, 6531},
- {5759, 6535, 6538},
- {4672, 6542, 6543},
- {2443, 6550, 6550},
- {5109, 6554, 6554},
- {6494, 6558, 6560},
- {6006, 6570, 6572},
- {6424, 6576, 6580},
- {4693, 6591, 6592},
- {6439, 6596, 6597},
- {3179, 6601, 6601},
- {5299, 6606, 6607},
- {4148, 6612, 6613},
- {3774, 6617, 6617},
- {3537, 6623, 6624},
- {4975, 6628, 6629},
- {3848, 6636, 6636},
- {856, 6640, 6640},
- {5724, 6645, 6645},
- {6632, 6651, 6651},
- {4630, 6656, 6658},
- {1440, 6662, 6662},
- {4281, 6666, 6667},
- {4302, 6671, 6672},
- {2589, 6676, 6677},
- {5647, 6681, 6687},
- {6082, 6691, 6693},
- {6144, 6698, 6698},
- {6103, 6709, 6710},
- {3710, 6714, 6714},
- {4253, 6718, 6721},
- {2467, 6730, 6730},
- {4778, 6734, 6734},
- {6528, 6738, 6738},
- {4358, 6747, 6747},
- {5889, 6753, 6753},
- {5193, 6757, 6757},
- {5797, 6761, 6761},
- {3858, 6765, 6766},
- {5951, 6776, 6776},
- {6487, 6781, 6782},
- {3282, 6786, 6787},
- {4667, 6797, 6799},
- {1927, 6803, 6806},
- {6583, 6810, 6810},
- {4937, 6814, 6814},
- {6099, 6824, 6824},
- {4415, 6835, 6836},
- {6332, 6840, 6841},
- {5160, 6850, 6850},
- {4764, 6854, 6854},
- {6814, 6858, 6859},
- {3018, 6864, 6864},
- {6293, 6868, 6869},
- {6359, 6877, 6877},
- {3047, 6884, 6886},
- {5262, 6890, 6891},
- {5471, 6900, 6900},
- {3268, 6910, 6912},
- {1047, 6916, 6916},
- {5904, 6923, 6923},
- {5798, 6933, 6938},
- {4149, 6942, 6942},
- {1821, 6946, 6946},
- {3599, 6952, 6952},
- {6470, 6957, 6957},
- {5562, 6961, 6961},
- {6268, 6965, 6967},
- {6389, 6971, 6971},
- {6596, 6975, 6976},
- {6553, 6980, 6981},
- {6576, 6985, 6989},
- {1375, 6993, 6993},
- {652, 6998, 6998},
- {4876, 7002, 7003},
- {5768, 7011, 7013},
- {3973, 7017, 7017},
- {6802, 7025, 7025},
- {6955, 7034, 7036},
- {6974, 7040, 7040},
- {5944, 7044, 7044},
- {6992, 7048, 7054},
- {6872, 7059, 7059},
- {2943, 7063, 7063},
- {6923, 7067, 7067},
- {5094, 7071, 7071},
- {4873, 7075, 7075},
- {5819, 7079, 7079},
- {5945, 7085, 7085},
- {1540, 7090, 7091},
- {2090, 7095, 7095},
- {5024, 7104, 7105},
- {6900, 7109, 7109},
- {6024, 7113, 7114},
- {6000, 7118, 7120},
- {2187, 7124, 7125},
- {6760, 7129, 7130},
- {5898, 7134, 7136},
- {7032, 7144, 7144},
- {4271, 7148, 7148},
- {3706, 7152, 7152},
- {6970, 7156, 7157},
- {7088, 7161, 7163},
- {2718, 7168, 7169},
- {5674, 7175, 7175},
- {4631, 7182, 7182},
- {7070, 7188, 7189},
- {6220, 7196, 7196},
- {3458, 7201, 7202},
- {2041, 7211, 7212},
- {1454, 7216, 7216},
- {5199, 7225, 7227},
- {3529, 7234, 7234},
- {6890, 7238, 7238},
- {3815, 7242, 7243},
- {5490, 7250, 7253},
- {6554, 7257, 7263},
- {5890, 7267, 7269},
- {6877, 7273, 7273},
- {4877, 7277, 7277},
- {2502, 7285, 7285},
- {1483, 7289, 7295},
- {7210, 7304, 7308},
- {6845, 7313, 7316},
- {7219, 7320, 7320},
- {7001, 7325, 7329},
- {6853, 7333, 7334},
- {6120, 7338, 7338},
- {6606, 7342, 7343},
- {7020, 7348, 7350},
- {3509, 7354, 7354},
- {7133, 7359, 7363},
- {3434, 7371, 7374},
- {2787, 7384, 7384},
- {7044, 7388, 7388},
- {6960, 7394, 7395},
- {6676, 7399, 7400},
- {7161, 7404, 7404},
- {7285, 7417, 7418},
- {4558, 7425, 7426},
- {4828, 7430, 7430},
- {6063, 7436, 7436},
- {3597, 7442, 7442},
- {914, 7446, 7446},
- {7320, 7452, 7454},
- {7267, 7458, 7460},
- {5076, 7464, 7464},
- {7430, 7468, 7469},
- {6273, 7473, 7474},
- {7440, 7478, 7487},
- {7348, 7491, 7494},
- {1021, 7510, 7510},
- {7473, 7515, 7515},
- {2823, 7519, 7519},
- {6264, 7527, 7527},
- {7302, 7531, 7531},
- {7089, 7535, 7535},
- {7342, 7540, 7541},
- {3688, 7547, 7551},
- {3054, 7558, 7560},
- {4177, 7566, 7567},
- {6691, 7574, 7575},
- {7156, 7585, 7586},
- {7147, 7590, 7592},
- {7407, 7598, 7598},
- {7403, 7602, 7603},
- {6868, 7607, 7607},
- {6636, 7611, 7611},
- {4805, 7617, 7617},
- {5779, 7623, 7623},
- {7063, 7627, 7627},
- {5079, 7632, 7632},
- {7377, 7637, 7637},
- {7337, 7641, 7642},
- {6738, 7655, 7655},
- {7338, 7659, 7659},
- {6541, 7669, 7671},
- {595, 7675, 7675},
- {7658, 7679, 7680},
- {7647, 7685, 7686},
- {2477, 7690, 7690},
- {5823, 7694, 7694},
- {4156, 7699, 7699},
- {5931, 7703, 7706},
- {6854, 7712, 7712},
- {4931, 7718, 7718},
- {6979, 7722, 7722},
- {5085, 7727, 7727},
- {6965, 7732, 7732},
- {7201, 7736, 7737},
- {3639, 7741, 7743},
- {7534, 7749, 7749},
- {4292, 7753, 7753},
- {3427, 7759, 7763},
- {7273, 7767, 7767},
- {940, 7778, 7778},
- {4838, 7782, 7785},
- {4216, 7790, 7792},
- {922, 7800, 7801},
- {7256, 7810, 7811},
- {7789, 7815, 7819},
- {7225, 7823, 7825},
- {7531, 7829, 7829},
- {6997, 7833, 7833},
- {7757, 7837, 7838},
- {4129, 7842, 7842},
- {7333, 7848, 7849},
- {6776, 7855, 7855},
- {7527, 7859, 7859},
- {4370, 7863, 7863},
- {4512, 7868, 7868},
- {5679, 7880, 7880},
- {3162, 7884, 7885},
- {3933, 7892, 7894},
- {7804, 7899, 7902},
- {6363, 7906, 7907},
- {7848, 7911, 7912},
- {5584, 7917, 7921},
- {874, 7926, 7926},
- {3342, 7930, 7930},
- {4507, 7935, 7937},
- {3672, 7943, 7944},
- {7911, 7948, 7949},
- {6402, 7956, 7956},
- {7940, 7960, 7960},
- {7113, 7964, 7964},
- {1073, 7968, 7968},
- {7740, 7974, 7974},
- {7601, 7978, 7982},
- {6797, 7987, 7988},
- {3528, 7994, 7995},
- {5483, 7999, 7999},
- {5717, 8011, 8011},
- {5480, 8017, 8017},
- {7770, 8023, 8030},
- {2452, 8034, 8034},
- {5282, 8047, 8047},
- {7967, 8051, 8051},
- {1128, 8058, 8066},
- {6348, 8070, 8070},
- {8055, 8077, 8077},
- {7925, 8081, 8086},
- {6810, 8090, 8090},
- {5051, 8101, 8101},
- {4696, 8109, 8110},
- {5129, 8119, 8119},
- {4449, 8123, 8123},
- {7222, 8127, 8127},
- {4649, 8131, 8134},
- {7994, 8138, 8138},
- {5954, 8148, 8148},
- {475, 8152, 8153},
- {7906, 8157, 8157},
- {7458, 8164, 8166},
- {7632, 8171, 8173},
- {3874, 8177, 8183},
- {4391, 8187, 8187},
- {561, 8191, 8191},
- {2417, 8195, 8195},
- {2357, 8204, 8204},
- {2269, 8216, 8218},
- {3968, 8222, 8222},
- {2200, 8226, 8227},
- {3453, 8247, 8247},
- {2439, 8251, 8252},
- {7175, 8257, 8257},
- {976, 8262, 8264},
- {4953, 8273, 8273},
- {4219, 8278, 8278},
- {6, 8285, 8291},
- {5703, 8295, 8296},
- {5272, 8300, 8300},
- {8037, 8304, 8304},
- {8186, 8314, 8314},
- {8304, 8318, 8318},
- {8051, 8326, 8326},
- {8318, 8330, 8330},
- {2671, 8334, 8335},
- {2662, 8339, 8339},
- {8081, 8349, 8350},
- {3328, 8356, 8356},
- {2879, 8360, 8362},
- {8050, 8370, 8371},
- {8330, 8375, 8376},
- {8375, 8386, 8386},
- {4961, 8390, 8390},
- {1017, 8403, 8405},
- {3533, 8416, 8416},
- {4555, 8422, 8422},
- {6445, 8426, 8426},
- {8169, 8432, 8432},
- {990, 8436, 8436},
- {4102, 8440, 8440},
- {7398, 8444, 8446},
- {3480, 8450, 8450},
- {6324, 8462, 8462},
- {7948, 8466, 8467},
- {5950, 8471, 8471},
- {5189, 8476, 8476},
- {4026, 8490, 8490},
- {8374, 8494, 8495},
- {4682, 8501, 8501},
- {7387, 8506, 8506},
- {8164, 8510, 8515},
- {4079, 8524, 8524},
- {8360, 8529, 8531},
- {7446, 8540, 8543},
- {7971, 8547, 8548},
- {4311, 8552, 8552},
- {5204, 8556, 8557},
- {7968, 8562, 8562},
- {7847, 8571, 8573},
- {8547, 8577, 8577},
- {5320, 8581, 8581},
- {8556, 8585, 8586},
- {8504, 8590, 8590},
- {7669, 8602, 8604},
- {5874, 8608, 8609},
- {5828, 8613, 8613},
- {7998, 8617, 8617},
- {8519, 8625, 8625},
- {7250, 8637, 8637},
- {426, 8641, 8641},
- {8436, 8645, 8645},
- {5986, 8649, 8656},
- {8157, 8660, 8660},
- {7182, 8665, 8665},
- {8421, 8675, 8675},
- {8509, 8681, 8681},
- {5137, 8688, 8689},
- {8625, 8694, 8695},
- {5228, 8701, 8702},
- {6661, 8714, 8714},
- {1010, 8719, 8719},
- {6648, 8723, 8723},
- {3500, 8728, 8728},
- {2442, 8735, 8735},
- {8494, 8740, 8741},
- {8171, 8753, 8755},
- {7242, 8763, 8764},
- {4739, 8768, 8769},
- {7079, 8773, 8773},
- {8386, 8777, 8777},
- {8624, 8781, 8787},
- {661, 8791, 8794},
- {8631, 8801, 8801},
- {7753, 8805, 8805},
- {4783, 8809, 8810},
- {1673, 8814, 8815},
- {6623, 8819, 8819},
- {4404, 8823, 8823},
- {8089, 8827, 8828},
- {8773, 8832, 8832},
- {5394, 8836, 8836},
- {6231, 8841, 8843},
- {1015, 8852, 8853},
- {6873, 8857, 8857},
- {6289, 8865, 8865},
- {8577, 8869, 8869},
- {8114, 8873, 8875},
- {8534, 8883, 8883},
- {3007, 8887, 8888},
- {8827, 8892, 8893},
- {4788, 8897, 8900},
- {5698, 8906, 8907},
- {7690, 8911, 8911},
- {6643, 8919, 8919},
- {7206, 8923, 8924},
- {7866, 8929, 8931},
- {8880, 8942, 8942},
- {8630, 8951, 8952},
- {6027, 8958, 8958},
- {7749, 8966, 8967},
- {4932, 8972, 8973},
- {8892, 8980, 8981},
- {634, 9003, 9003},
- {8109, 9007, 9008},
- {8777, 9012, 9012},
- {3981, 9016, 9017},
- {5723, 9025, 9025},
- {7662, 9034, 9038},
- {8955, 9042, 9042},
- {8070, 9060, 9062},
- {8910, 9066, 9066},
- {5363, 9070, 9071},
- {7699, 9075, 9076},
- {8991, 9081, 9081},
- {6850, 9085, 9085},
- {5811, 9092, 9094},
- {9079, 9098, 9102},
- {6456, 9106, 9106},
- {2259, 9111, 9111},
- {4752, 9116, 9116},
- {9060, 9120, 9123},
- {8090, 9127, 9127},
- {5305, 9131, 9132},
- {8623, 9137, 9137},
- {7417, 9141, 9141},
- {6564, 9148, 9149},
- {9126, 9157, 9158},
- {4285, 9169, 9170},
- {8698, 9174, 9174},
- {8869, 9178, 9178},
- {2572, 9182, 9183},
- {6482, 9188, 9190},
- {9181, 9201, 9201},
- {2968, 9208, 9209},
- {2506, 9213, 9215},
- {9127, 9219, 9219},
- {7910, 9225, 9227},
- {5422, 9235, 9239},
- {8813, 9244, 9246},
- {9178, 9250, 9250},
- {8748, 9255, 9255},
- {7354, 9265, 9265},
- {7767, 9269, 9269},
- {7710, 9281, 9283},
- {8826, 9288, 9290},
- {861, 9295, 9295},
- {4482, 9301, 9301},
- {9264, 9305, 9306},
- {8805, 9310, 9310},
- {4995, 9314, 9314},
- {6730, 9318, 9318},
- {7457, 9328, 9328},
- {2547, 9335, 9336},
- {6298, 9340, 9343},
- {9305, 9353, 9354},
- {9269, 9358, 9358},
- {6338, 9370, 9370},
- {7289, 9376, 9379},
- {5780, 9383, 9383},
- {7607, 9387, 9387},
- {2065, 9392, 9392},
- {7238, 9396, 9396},
- {8856, 9400, 9400},
- {8069, 9412, 9413},
- {611, 9420, 9420},
- {7071, 9424, 9424},
- {3089, 9430, 9431},
- {7117, 9435, 9438},
- {1976, 9445, 9445},
- {6640, 9449, 9449},
- {5488, 9453, 9453},
- {8739, 9457, 9459},
- {5958, 9466, 9466},
- {7985, 9470, 9470},
- {8735, 9475, 9475},
- {5009, 9479, 9479},
- {8073, 9483, 9484},
- {2328, 9490, 9491},
- {9250, 9495, 9495},
- {4043, 9502, 9502},
- {7712, 9506, 9506},
- {9012, 9510, 9510},
- {9028, 9514, 9515},
- {2190, 9521, 9524},
- {9029, 9528, 9528},
- {9519, 9532, 9532},
- {9495, 9536, 9536},
- {8527, 9540, 9540},
- {2137, 9550, 9550},
- {8419, 9557, 9557},
- {9383, 9561, 9562},
- {8970, 9575, 9578},
- {8911, 9582, 9582},
- {7828, 9595, 9596},
- {6180, 9600, 9600},
- {8738, 9604, 9607},
- {7540, 9611, 9612},
- {9599, 9616, 9618},
- {9187, 9623, 9623},
- {9294, 9628, 9629},
- {4536, 9639, 9639},
- {3867, 9643, 9643},
- {6305, 9648, 9648},
- {1617, 9654, 9657},
- {5762, 9666, 9666},
- {8314, 9670, 9670},
- {9666, 9674, 9675},
- {9506, 9679, 9679},
- {9669, 9685, 9686},
- {9683, 9690, 9690},
- {8763, 9697, 9698},
- {7468, 9702, 9702},
- {460, 9707, 9707},
- {3115, 9712, 9712},
- {9424, 9716, 9717},
- {7359, 9721, 9724},
- {7547, 9728, 9729},
- {7151, 9733, 9738},
- {7627, 9742, 9742},
- {2822, 9747, 9747},
- {8247, 9751, 9753},
- {9550, 9758, 9758},
- {7585, 9762, 9763},
- {1002, 9767, 9767},
- {7168, 9772, 9773},
- {6941, 9777, 9780},
- {9728, 9784, 9786},
- {9770, 9792, 9796},
- {6411, 9801, 9802},
- {3689, 9806, 9808},
- {9575, 9814, 9816},
- {7025, 9820, 9821},
- {2776, 9826, 9826},
- {9806, 9830, 9830},
- {9820, 9834, 9835},
- {9800, 9839, 9847},
- {9834, 9851, 9852},
- {9829, 9856, 9862},
- {1400, 9866, 9866},
- {3197, 9870, 9871},
- {9851, 9875, 9876},
- {9742, 9883, 9884},
- {3362, 9888, 9889},
- {9883, 9893, 9893},
- {5711, 9899, 9910},
- {7806, 9915, 9915},
- {9120, 9919, 9919},
- {9715, 9925, 9934},
- {2580, 9938, 9938},
- {4907, 9942, 9944},
- {6239, 9953, 9954},
- {6961, 9963, 9963},
- {5295, 9967, 9968},
- {1915, 9972, 9973},
- {3426, 9983, 9985},
- {9875, 9994, 9995},
- {6942, 9999, 9999},
- {6621, 10005, 10005},
- {7589, 10010, 10012},
- {9286, 10020, 10020},
- {838, 10024, 10024},
- {9980, 10028, 10031},
- {9994, 10035, 10041},
- {2702, 10048, 10051},
- {2621, 10059, 10059},
- {10054, 10065, 10065},
- {8612, 10073, 10074},
- {7033, 10078, 10078},
- {916, 10082, 10082},
- {10035, 10086, 10087},
- {8613, 10097, 10097},
- {9919, 10107, 10108},
- {6133, 10114, 10115},
- {10059, 10119, 10119},
- {10065, 10126, 10127},
- {7732, 10131, 10131},
- {7155, 10135, 10136},
- {6728, 10140, 10140},
- {6162, 10144, 10145},
- {4724, 10150, 10150},
- {1665, 10154, 10154},
- {10126, 10163, 10163},
- {9783, 10168, 10168},
- {1715, 10172, 10173},
- {7152, 10177, 10182},
- {8760, 10187, 10187},
- {7829, 10191, 10191},
- {9679, 10196, 10196},
- {9369, 10201, 10201},
- {2928, 10206, 10208},
- {6951, 10214, 10217},
- {5633, 10221, 10221},
- {7199, 10225, 10225},
- {10118, 10230, 10231},
- {9999, 10235, 10236},
- {10045, 10240, 10249},
- {5565, 10256, 10256},
- {9866, 10261, 10261},
- {10163, 10268, 10268},
- {9869, 10272, 10272},
- {9789, 10276, 10283},
- {10235, 10287, 10288},
- {10214, 10298, 10299},
- {6971, 10303, 10303},
- {3346, 10307, 10307},
- {10185, 10311, 10312},
- {9993, 10318, 10320},
- {2779, 10332, 10334},
- {1726, 10338, 10338},
- {741, 10354, 10360},
- {10230, 10372, 10373},
- {10260, 10384, 10385},
- {10131, 10389, 10398},
- {6946, 10406, 10409},
- {10158, 10413, 10420},
- {10123, 10424, 10424},
- {6157, 10428, 10429},
- {4518, 10434, 10434},
- {9893, 10438, 10438},
- {9865, 10442, 10446},
- {7558, 10454, 10454},
- {10434, 10460, 10460},
- {10064, 10466, 10468},
- {2703, 10472, 10474},
- {9751, 10478, 10479},
- {6714, 10485, 10485},
- {8020, 10490, 10490},
- {10303, 10494, 10494},
- {3521, 10499, 10500},
- {9281, 10513, 10515},
- {6028, 10519, 10523},
- {9387, 10527, 10527},
- {7614, 10531, 10531},
- {3611, 10536, 10536},
- {9162, 10540, 10540},
- {10081, 10546, 10547},
- {10034, 10560, 10562},
- {6726, 10567, 10571},
- {8237, 10575, 10575},
- {10438, 10579, 10583},
- {10140, 10587, 10587},
- {5784, 10592, 10592},
- {9819, 10597, 10600},
- {10567, 10604, 10608},
- {9335, 10613, 10613},
- {8300, 10617, 10617},
- {10575, 10621, 10621},
- {9678, 10625, 10626},
- {9962, 10632, 10633},
- {10535, 10637, 10638},
- {8199, 10642, 10642},
- {10372, 10647, 10648},
- {10637, 10656, 10657},
- {10579, 10667, 10668},
- {10465, 10677, 10680},
- {6702, 10684, 10685},
- {10073, 10691, 10692},
- {4505, 10696, 10697},
- {9042, 10701, 10701},
- {6460, 10705, 10706},
- {10010, 10714, 10716},
- {10656, 10720, 10722},
- {7282, 10727, 10729},
- {2327, 10733, 10733},
- {2491, 10740, 10741},
- {10704, 10748, 10750},
- {6465, 10754, 10754},
- {10647, 10758, 10759},
- {10424, 10763, 10763},
- {10748, 10776, 10776},
- {10546, 10780, 10781},
- {10758, 10785, 10786},
- {10287, 10790, 10797},
- {10785, 10801, 10807},
- {10240, 10811, 10826},
- {9509, 10830, 10830},
- {2579, 10836, 10838},
- {9801, 10843, 10845},
- {7555, 10849, 10850},
- {10776, 10860, 10865},
- {8023, 10869, 10869},
- {10046, 10876, 10884},
- {10253, 10888, 10892},
- {9941, 10897, 10897},
- {7898, 10901, 10905},
- {6725, 10909, 10913},
- {10757, 10921, 10923},
- {10160, 10931, 10931},
- {10916, 10935, 10942},
- {10261, 10946, 10946},
- {10318, 10952, 10954},
- {5911, 10959, 10961},
- {10801, 10965, 10966},
- {10946, 10970, 10977},
- {10592, 10982, 10984},
- {9913, 10988, 10990},
- {8510, 10994, 10996},
- {9419, 11000, 11001},
- {6765, 11006, 11007},
- {10725, 11011, 11011},
- {5537, 11017, 11019},
- {9208, 11024, 11025},
- {5850, 11030, 11030},
- {9610, 11034, 11036},
- {8846, 11041, 11047},
- {9697, 11051, 11051},
- {1622, 11055, 11058},
- {2370, 11062, 11062},
- {8393, 11067, 11067},
- {9756, 11071, 11071},
- {10172, 11076, 11076},
- {27, 11081, 11081},
- {7357, 11087, 11092},
- {8151, 11104, 11106},
- {6115, 11110, 11110},
- {10667, 11114, 11115},
- {11099, 11121, 11123},
- {10705, 11127, 11127},
- {8938, 11131, 11131},
- {11114, 11135, 11136},
- {1390, 11140, 11141},
- {10964, 11146, 11148},
- {11140, 11152, 11155},
- {9813, 11159, 11166},
- {624, 11171, 11172},
- {3118, 11177, 11179},
- {11029, 11184, 11186},
- {10186, 11190, 11190},
- {10306, 11196, 11196},
- {8665, 11201, 11201},
- {7382, 11205, 11205},
- {1100, 11210, 11210},
- {2337, 11216, 11217},
- {1609, 11221, 11223},
- {5763, 11228, 11229},
- {5220, 11233, 11233},
- {11061, 11241, 11241},
- {10617, 11246, 11246},
- {11190, 11250, 11251},
- {10144, 11255, 11256},
- {11232, 11260, 11260},
- {857, 11264, 11265},
- {10994, 11269, 11271},
- {3879, 11280, 11281},
- {11184, 11287, 11289},
- {9611, 11293, 11295},
- {11250, 11299, 11299},
- {4495, 11304, 11304},
- {7574, 11308, 11309},
- {9814, 11315, 11317},
- {1713, 11321, 11324},
- {1905, 11328, 11328},
- {8745, 11335, 11340},
- {8883, 11351, 11351},
- {8119, 11358, 11358},
- {1842, 11363, 11364},
- {11237, 11368, 11368},
- {8814, 11373, 11374},
- {5684, 11378, 11378},
- {11011, 11382, 11382},
- {6520, 11389, 11389},
- {11183, 11393, 11396},
- {1790, 11404, 11404},
- {9536, 11408, 11408},
- {11298, 11418, 11419},
- {3929, 11425, 11425},
- {5588, 11429, 11429},
- {8476, 11436, 11436},
- {4096, 11440, 11442},
- {11084, 11446, 11454},
- {10603, 11458, 11463},
- {7332, 11472, 11474},
- {7611, 11483, 11486},
- {4836, 11490, 11491},
- {10024, 11495, 11495},
- {4917, 11501, 11506},
- {6486, 11510, 11512},
- {11269, 11516, 11518},
- {3603, 11522, 11525},
- {11126, 11535, 11535},
- {11418, 11539, 11541},
- {11408, 11545, 11545},
- {9021, 11549, 11552},
- {6745, 11557, 11557},
- {5118, 11561, 11564},
- {7590, 11568, 11569},
- {4426, 11573, 11578},
- {9790, 11582, 11583},
- {6447, 11587, 11587},
- {10229, 11591, 11594},
- {10457, 11598, 11598},
- {10168, 11604, 11604},
- {10543, 11608, 11608},
- {7404, 11612, 11612},
- {11127, 11616, 11616},
- {3337, 11620, 11620},
- {11501, 11624, 11628},
- {4543, 11633, 11635},
- {8449, 11642, 11642},
- {4943, 11646, 11648},
- {10526, 11652, 11654},
- {11620, 11659, 11659},
- {8927, 11664, 11669},
- {532, 11673, 11673},
- {10513, 11677, 11679},
- {10428, 11683, 11683},
- {10999, 11689, 11690},
- {9469, 11695, 11695},
- {3606, 11699, 11699},
- {9560, 11708, 11709},
- {1564, 11714, 11714},
- {10527, 11718, 11718},
- {3071, 11723, 11726},
- {11590, 11731, 11732},
- {6605, 11737, 11737},
- {11624, 11741, 11745},
- {7822, 11749, 11752},
- {5269, 11757, 11758},
- {1339, 11767, 11767},
- {1363, 11771, 11773},
- {3704, 11777, 11777},
- {10952, 11781, 11783},
- {6764, 11793, 11795},
- {8675, 11800, 11800},
- {9963, 11804, 11804},
- {11573, 11808, 11809},
- {9548, 11813, 11813},
- {11591, 11817, 11818},
- {11446, 11822, 11822},
- {9224, 11828, 11828},
- {3158, 11836, 11836},
- {10830, 11840, 11840},
- {7234, 11846, 11846},
- {11299, 11850, 11850},
- {11544, 11854, 11855},
- {11498, 11859, 11859},
- {10993, 11865, 11868},
- {9720, 11872, 11878},
- {10489, 11882, 11890},
- {11712, 11898, 11904},
- {11516, 11908, 11910},
- {11568, 11914, 11915},
- {10177, 11919, 11924},
- {11363, 11928, 11929},
- {10494, 11933, 11933},
- {9870, 11937, 11938},
- {9427, 11942, 11942},
- {11481, 11949, 11949},
- {6030, 11955, 11957},
- {11718, 11961, 11961},
- {10531, 11965, 11983},
- {5126, 11987, 11987},
- {7515, 11991, 11991},
- {10646, 11996, 11997},
- {2947, 12001, 12001},
- {9582, 12009, 12010},
- {6202, 12017, 12018},
- {11714, 12022, 12022},
- {9235, 12033, 12037},
- {9721, 12041, 12044},
- {11932, 12051, 12052},
- {12040, 12056, 12056},
- {12051, 12060, 12060},
- {11601, 12066, 12066},
- {8426, 12070, 12070},
- {4053, 12077, 12077},
- {4262, 12081, 12081},
- {9761, 12086, 12088},
- {11582, 12092, 12093},
- {10965, 12097, 12098},
- {11803, 12103, 12104},
- {11933, 12108, 12109},
- {10688, 12117, 12117},
- {12107, 12125, 12126},
- {6774, 12130, 12132},
- {6286, 12137, 12137},
- {9543, 12141, 12141},
- {12097, 12145, 12146},
- {10790, 12150, 12150},
- {10125, 12154, 12156},
- {12125, 12164, 12164},
- {12064, 12168, 12172},
- {10811, 12178, 12188},
- {12092, 12192, 12193},
- {10058, 12197, 12198},
- {11611, 12211, 12212},
- {3459, 12216, 12216},
- {10291, 12225, 12228},
- {12191, 12232, 12234},
- {12145, 12238, 12238},
- {12001, 12242, 12250},
- {3840, 12255, 12255},
- {12216, 12259, 12259},
- {674, 12272, 12272},
- {12141, 12276, 12276},
- {10766, 12280, 12280},
- {11545, 12284, 12284},
- {6496, 12290, 12290},
- {11381, 12294, 12295},
- {603, 12302, 12303},
- {12276, 12308, 12308},
- {11850, 12313, 12314},
- {565, 12319, 12319},
- {9351, 12324, 12324},
- {11822, 12328, 12328},
- {2691, 12333, 12334},
- {11840, 12338, 12338},
- {11070, 12343, 12343},
- {9510, 12347, 12347},
- {11024, 12352, 12353},
- {7173, 12359, 12359},
- {517, 12363, 12363},
- {6311, 12367, 12368},
- {11367, 12372, 12373},
- {12008, 12377, 12377},
- {11372, 12382, 12384},
- {11358, 12391, 12392},
- {11382, 12396, 12396},
- {6882, 12400, 12401},
- {11246, 12405, 12405},
- {8359, 12409, 12412},
- {10154, 12418, 12418},
- {12016, 12425, 12426},
- {8972, 12434, 12435},
- {10478, 12439, 12440},
- {12395, 12449, 12449},
- {11612, 12454, 12454},
- {12347, 12458, 12458},
- {10700, 12466, 12467},
- {3637, 12471, 12476},
- {1042, 12480, 12481},
- {6747, 12488, 12488},
- {12396, 12492, 12493},
- {9420, 12497, 12497},
- {11285, 12501, 12510},
- {4470, 12515, 12515},
- {9374, 12519, 12519},
- {11293, 12528, 12528},
- {2058, 12534, 12535},
- {6521, 12539, 12539},
- {12492, 12543, 12543},
- {3043, 12547, 12547},
- {2982, 12551, 12553},
- {11030, 12557, 12563},
- {7636, 12568, 12568},
- {9639, 12572, 12572},
- {12543, 12576, 12576},
- {5989, 12580, 12583},
- {11051, 12587, 12587},
- {1061, 12592, 12594},
- {12313, 12599, 12601},
- {11846, 12605, 12605},
- {12576, 12609, 12609},
- {11040, 12618, 12625},
- {12479, 12629, 12629},
- {6903, 12633, 12633},
- {12322, 12639, 12639},
- {12253, 12643, 12645},
- {5594, 12651, 12651},
- {12522, 12655, 12655},
- {11703, 12659, 12659},
- {1377, 12665, 12665},
- {8022, 12669, 12669},
- {12280, 12674, 12674},
- {9023, 12680, 12681},
- {12328, 12685, 12685},
- {3085, 12689, 12693},
- {4700, 12698, 12698},
- {10224, 12702, 12702},
- {8781, 12706, 12706},
- {1651, 12710, 12710},
- {12458, 12714, 12714},
- {12005, 12718, 12721},
- {11908, 12725, 12726},
- {8202, 12733, 12733},
- {11708, 12739, 12740},
- {12599, 12744, 12745},
- {12284, 12749, 12749},
- {5285, 12756, 12756},
- {12055, 12775, 12777},
- {6919, 12782, 12782},
- {12242, 12786, 12786},
- {12009, 12790, 12790},
- {9628, 12794, 12796},
- {11354, 12801, 12802},
- {10225, 12806, 12807},
- {579, 12813, 12813},
- {8935, 12817, 12822},
- {8753, 12827, 12829},
- {11006, 12835, 12835},
- {858, 12841, 12845},
- {476, 12849, 12849},
- {7667, 12854, 12854},
- {12760, 12860, 12871},
- {11677, 12875, 12877},
- {12714, 12881, 12881},
- {12731, 12885, 12890},
- {7108, 12894, 12896},
- {1165, 12900, 12900},
- {4021, 12906, 12906},
- {10829, 12910, 12911},
- {12331, 12915, 12915},
- {8887, 12919, 12921},
- {11639, 12925, 12925},
- {7964, 12929, 12929},
- {12528, 12937, 12937},
- {8148, 12941, 12941},
- {12770, 12948, 12950},
- {12609, 12954, 12954},
- {12685, 12958, 12958},
- {2803, 12962, 12962},
- {9561, 12966, 12966},
- {6671, 12972, 12973},
- {12056, 12977, 12977},
- {6380, 12981, 12981},
- {12048, 12985, 12985},
- {11961, 12989, 12993},
- {3368, 12997, 12999},
- {6634, 13004, 13004},
- {6775, 13009, 13010},
- {12136, 13014, 13019},
- {10341, 13023, 13023},
- {13002, 13027, 13027},
- {10587, 13031, 13031},
- {10307, 13035, 13035},
- {12736, 13039, 13039},
- {12744, 13043, 13044},
- {6175, 13048, 13048},
- {9702, 13053, 13054},
- {662, 13059, 13061},
- {12718, 13065, 13068},
- {12893, 13072, 13075},
- {8299, 13086, 13091},
- {12604, 13095, 13096},
- {12848, 13100, 13101},
- {12749, 13105, 13105},
- {12526, 13109, 13114},
- {9173, 13122, 13122},
- {12769, 13128, 13128},
- {13038, 13132, 13132},
- {12725, 13136, 13137},
- {12639, 13146, 13146},
- {9711, 13150, 13151},
- {12137, 13155, 13155},
- {13039, 13159, 13159},
- {4681, 13163, 13164},
- {12954, 13168, 13168},
- {13158, 13175, 13176},
- {13105, 13180, 13180},
- {10754, 13184, 13184},
- {13167, 13188, 13188},
- {12658, 13192, 13192},
- {4294, 13199, 13200},
- {11682, 13204, 13205},
- {11695, 13209, 13209},
- {11076, 13214, 13214},
- {12232, 13218, 13218},
- {9399, 13223, 13224},
- {12880, 13228, 13229},
- {13048, 13234, 13234},
- {9701, 13238, 13239},
- {13209, 13243, 13243},
- {3658, 13248, 13248},
- {3698, 13252, 13254},
- {12237, 13260, 13260},
- {8872, 13266, 13266},
- {12957, 13272, 13273},
- {1393, 13281, 13281},
- {2013, 13285, 13288},
- {4244, 13296, 13299},
- {9428, 13303, 13303},
- {12702, 13307, 13307},
- {13078, 13311, 13311},
- {6071, 13315, 13315},
- {3061, 13319, 13319},
- {2051, 13324, 13324},
- {11560, 13328, 13331},
- {6584, 13336, 13336},
- {8482, 13340, 13340},
- {5331, 13344, 13344},
- {4171, 13348, 13348},
- {8501, 13352, 13352},
- {9219, 13356, 13356},
- {9473, 13360, 13363},
- {12881, 13367, 13367},
- {13065, 13371, 13375},
- {2979, 13379, 13384},
- {1518, 13388, 13388},
- {11177, 13392, 13392},
- {9457, 13398, 13398},
- {12293, 13407, 13410},
- {3697, 13414, 13417},
- {10338, 13425, 13425},
- {13367, 13429, 13429},
- {11074, 13433, 13437},
- {4201, 13441, 13443},
- {1812, 13447, 13448},
- {13360, 13452, 13456},
- {13188, 13463, 13463},
- {9732, 13470, 13470},
- {11332, 13477, 13477},
- {9918, 13487, 13487},
- {6337, 13497, 13497},
- {13429, 13501, 13501},
- {11413, 13505, 13505},
- {4685, 13512, 13513},
- {13136, 13517, 13519},
- {7416, 13528, 13530},
- {12929, 13534, 13534},
- {11110, 13539, 13539},
- {11521, 13543, 13543},
- {12825, 13553, 13553},
- {13447, 13557, 13558},
- {12299, 13562, 13563},
- {9003, 13570, 13570},
- {12500, 13577, 13577},
- {13501, 13581, 13581},
- {9392, 13586, 13586},
- {12454, 13590, 13590},
- {6189, 13595, 13595},
- {13053, 13599, 13599},
- {11881, 13604, 13604},
- {13159, 13608, 13608},
- {4894, 13612, 13612},
- {13221, 13621, 13621},
- {8950, 13625, 13625},
- {13533, 13629, 13629},
- {9633, 13633, 13633},
- {7892, 13637, 13639},
- {13581, 13643, 13643},
- {13616, 13647, 13649},
- {12794, 13653, 13654},
- {8919, 13659, 13659},
- {9674, 13663, 13663},
- {13577, 13668, 13668},
- {12966, 13672, 13672},
- {12659, 13676, 13683},
- {6124, 13688, 13688},
- {9225, 13693, 13695},
- {11833, 13702, 13702},
- {12904, 13709, 13717},
- {13647, 13721, 13722},
- {11687, 13726, 13727},
- {12434, 13731, 13732},
- {12689, 13736, 13742},
- {13168, 13746, 13746},
- {6151, 13751, 13752},
- {11821, 13756, 13757},
- {6467, 13764, 13764},
- {5730, 13769, 13769},
- {5136, 13780, 13780},
- {724, 13784, 13785},
- {13517, 13789, 13791},
- {640, 13795, 13796},
- {7721, 13800, 13802},
- {11121, 13806, 13807},
- {5791, 13811, 13815},
- {12894, 13819, 13819},
- {11100, 13824, 13824},
- {7011, 13830, 13830},
- {7129, 13834, 13837},
- {13833, 13841, 13841},
- {11276, 13847, 13847},
- {13621, 13853, 13853},
- {13589, 13862, 13863},
- {12989, 13867, 13867},
- {12789, 13871, 13871},
- {1239, 13875, 13875},
- {4675, 13879, 13881},
- {4686, 13885, 13885},
- {707, 13889, 13889},
- {5449, 13897, 13898},
- {13867, 13902, 13903},
- {10613, 13908, 13908},
- {13789, 13912, 13914},
- {4451, 13918, 13919},
- {9200, 13924, 13924},
- {2011, 13930, 13930},
- {11433, 13934, 13936},
- {4695, 13942, 13943},
- {9435, 13948, 13951},
- {13688, 13955, 13957},
- {11694, 13961, 13962},
- {5712, 13966, 13966},
- {5991, 13970, 13972},
- {13477, 13976, 13976},
- {10213, 13987, 13987},
- {11839, 13991, 13993},
- {12272, 13997, 13997},
- {6206, 14001, 14001},
- {13179, 14006, 14007},
- {2939, 14011, 14011},
- {12972, 14016, 14017},
- {13918, 14021, 14022},
- {7436, 14026, 14027},
- {7678, 14032, 14034},
- {13586, 14040, 14040},
- {13347, 14044, 14044},
- {13109, 14048, 14051},
- {9244, 14055, 14057},
- {13315, 14061, 14061},
- {13276, 14067, 14067},
- {11435, 14073, 14074},
- {13853, 14078, 14078},
- {13452, 14082, 14082},
- {14044, 14087, 14087},
- {4440, 14091, 14095},
- {4479, 14100, 14103},
- {9395, 14107, 14109},
- {6834, 14119, 14119},
- {10458, 14123, 14124},
- {1429, 14129, 14129},
- {8443, 14135, 14135},
- {10365, 14140, 14140},
- {5267, 14145, 14145},
- {11834, 14151, 14153},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/snappy_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/snappy_test.go
deleted file mode 100644
index 2712710df58..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/golang/snappy/snappy_test.go
+++ /dev/null
@@ -1,1353 +0,0 @@
-// Copyright 2011 The Snappy-Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package snappy
-
-import (
- "bytes"
- "encoding/binary"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "math/rand"
- "net/http"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "strings"
- "testing"
-)
-
-var (
- download = flag.Bool("download", false, "If true, download any missing files before running benchmarks")
- testdataDir = flag.String("testdataDir", "testdata", "Directory containing the test data")
- benchdataDir = flag.String("benchdataDir", "testdata/bench", "Directory containing the benchmark data")
-)
-
-// goEncoderShouldMatchCppEncoder is whether to test that the algorithm used by
-// Go's encoder matches byte-for-byte what the C++ snappy encoder produces, on
-// this GOARCH. There is more than one valid encoding of any given input, and
-// there is more than one good algorithm along the frontier of trading off
-// throughput for output size. Nonetheless, we presume that the C++ encoder's
-// algorithm is a good one and has been tested on a wide range of inputs, so
-// matching that exactly should mean that the Go encoder's algorithm is also
-// good, without needing to gather our own corpus of test data.
-//
-// The exact algorithm used by the C++ code is potentially endian dependent, as
-// it puns a byte pointer to a uint32 pointer to load, hash and compare 4 bytes
-// at a time. The Go implementation is endian agnostic, in that its output is
-// the same (as little-endian C++ code), regardless of the CPU's endianness.
-//
-// Thus, when comparing Go's output to C++ output generated beforehand, such as
-// the "testdata/pi.txt.rawsnappy" file generated by C++ code on a little-
-// endian system, we can run that test regardless of the runtime.GOARCH value.
-//
-// When comparing Go's output to dynamically generated C++ output, i.e. the
-// result of fork/exec'ing a C++ program, we can run that test only on
-// little-endian systems, because the C++ output might be different on
-// big-endian systems. The runtime package doesn't export endianness per se,
-// but we can restrict this match-C++ test to common little-endian systems.
-const goEncoderShouldMatchCppEncoder = runtime.GOARCH == "386" || runtime.GOARCH == "amd64" || runtime.GOARCH == "arm"
-
-func TestMaxEncodedLenOfMaxBlockSize(t *testing.T) {
- got := maxEncodedLenOfMaxBlockSize
- want := MaxEncodedLen(maxBlockSize)
- if got != want {
- t.Fatalf("got %d, want %d", got, want)
- }
-}
-
-func cmp(a, b []byte) error {
- if bytes.Equal(a, b) {
- return nil
- }
- if len(a) != len(b) {
- return fmt.Errorf("got %d bytes, want %d", len(a), len(b))
- }
- for i := range a {
- if a[i] != b[i] {
- return fmt.Errorf("byte #%d: got 0x%02x, want 0x%02x", i, a[i], b[i])
- }
- }
- return nil
-}
-
-func roundtrip(b, ebuf, dbuf []byte) error {
- d, err := Decode(dbuf, Encode(ebuf, b))
- if err != nil {
- return fmt.Errorf("decoding error: %v", err)
- }
- if err := cmp(d, b); err != nil {
- return fmt.Errorf("roundtrip mismatch: %v", err)
- }
- return nil
-}
-
-func TestEmpty(t *testing.T) {
- if err := roundtrip(nil, nil, nil); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestSmallCopy(t *testing.T) {
- for _, ebuf := range [][]byte{nil, make([]byte, 20), make([]byte, 64)} {
- for _, dbuf := range [][]byte{nil, make([]byte, 20), make([]byte, 64)} {
- for i := 0; i < 32; i++ {
- s := "aaaa" + strings.Repeat("b", i) + "aaaabbbb"
- if err := roundtrip([]byte(s), ebuf, dbuf); err != nil {
- t.Errorf("len(ebuf)=%d, len(dbuf)=%d, i=%d: %v", len(ebuf), len(dbuf), i, err)
- }
- }
- }
- }
-}
-
-func TestSmallRand(t *testing.T) {
- rng := rand.New(rand.NewSource(1))
- for n := 1; n < 20000; n += 23 {
- b := make([]byte, n)
- for i := range b {
- b[i] = uint8(rng.Intn(256))
- }
- if err := roundtrip(b, nil, nil); err != nil {
- t.Fatal(err)
- }
- }
-}
-
-func TestSmallRegular(t *testing.T) {
- for n := 1; n < 20000; n += 23 {
- b := make([]byte, n)
- for i := range b {
- b[i] = uint8(i%10 + 'a')
- }
- if err := roundtrip(b, nil, nil); err != nil {
- t.Fatal(err)
- }
- }
-}
-
-func TestInvalidVarint(t *testing.T) {
- testCases := []struct {
- desc string
- input string
- }{{
- "invalid varint, final byte has continuation bit set",
- "\xff",
- }, {
- "invalid varint, value overflows uint64",
- "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00",
- }, {
- // https://github.com/google/snappy/blob/master/format_description.txt
- // says that "the stream starts with the uncompressed length [as a
- // varint] (up to a maximum of 2^32 - 1)".
- "valid varint (as uint64), but value overflows uint32",
- "\x80\x80\x80\x80\x10",
- }}
-
- for _, tc := range testCases {
- input := []byte(tc.input)
- if _, err := DecodedLen(input); err != ErrCorrupt {
- t.Errorf("%s: DecodedLen: got %v, want ErrCorrupt", tc.desc, err)
- }
- if _, err := Decode(nil, input); err != ErrCorrupt {
- t.Errorf("%s: Decode: got %v, want ErrCorrupt", tc.desc, err)
- }
- }
-}
-
-func TestDecode(t *testing.T) {
- lit40Bytes := make([]byte, 40)
- for i := range lit40Bytes {
- lit40Bytes[i] = byte(i)
- }
- lit40 := string(lit40Bytes)
-
- testCases := []struct {
- desc string
- input string
- want string
- wantErr error
- }{{
- `decodedLen=0; valid input`,
- "\x00",
- "",
- nil,
- }, {
- `decodedLen=3; tagLiteral, 0-byte length; length=3; valid input`,
- "\x03" + "\x08\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=2; tagLiteral, 0-byte length; length=3; not enough dst bytes`,
- "\x02" + "\x08\xff\xff\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 0-byte length; length=3; not enough src bytes`,
- "\x03" + "\x08\xff\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=40; tagLiteral, 0-byte length; length=40; valid input`,
- "\x28" + "\x9c" + lit40,
- lit40,
- nil,
- }, {
- `decodedLen=1; tagLiteral, 1-byte length; not enough length bytes`,
- "\x01" + "\xf0",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 1-byte length; length=3; valid input`,
- "\x03" + "\xf0\x02\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=1; tagLiteral, 2-byte length; not enough length bytes`,
- "\x01" + "\xf4\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 2-byte length; length=3; valid input`,
- "\x03" + "\xf4\x02\x00\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=1; tagLiteral, 3-byte length; not enough length bytes`,
- "\x01" + "\xf8\x00\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 3-byte length; length=3; valid input`,
- "\x03" + "\xf8\x02\x00\x00\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=1; tagLiteral, 4-byte length; not enough length bytes`,
- "\x01" + "\xfc\x00\x00\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=1; tagLiteral, 4-byte length; length=3; not enough dst bytes`,
- "\x01" + "\xfc\x02\x00\x00\x00\xff\xff\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagLiteral, 4-byte length; length=3; not enough src bytes`,
- "\x04" + "\xfc\x02\x00\x00\x00\xff",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=3; tagLiteral, 4-byte length; length=3; valid input`,
- "\x03" + "\xfc\x02\x00\x00\x00\xff\xff\xff",
- "\xff\xff\xff",
- nil,
- }, {
- `decodedLen=4; tagCopy1, 1 extra length|offset byte; not enough extra bytes`,
- "\x04" + "\x01",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagCopy2, 2 extra length|offset bytes; not enough extra bytes`,
- "\x04" + "\x02\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagCopy4, 4 extra length|offset bytes; not enough extra bytes`,
- "\x04" + "\x03\x00\x00\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=4; tagLiteral (4 bytes "abcd"); valid input`,
- "\x04" + "\x0cabcd",
- "abcd",
- nil,
- }, {
- `decodedLen=13; tagLiteral (4 bytes "abcd"); tagCopy1; length=9 offset=4; valid input`,
- "\x0d" + "\x0cabcd" + "\x15\x04",
- "abcdabcdabcda",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=4; valid input`,
- "\x08" + "\x0cabcd" + "\x01\x04",
- "abcdabcd",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=2; valid input`,
- "\x08" + "\x0cabcd" + "\x01\x02",
- "abcdcdcd",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=1; valid input`,
- "\x08" + "\x0cabcd" + "\x01\x01",
- "abcddddd",
- nil,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=0; zero offset`,
- "\x08" + "\x0cabcd" + "\x01\x00",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=9; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=4; inconsistent dLen`,
- "\x09" + "\x0cabcd" + "\x01\x04",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=5; offset too large`,
- "\x08" + "\x0cabcd" + "\x01\x05",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=7; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=4; length too large`,
- "\x07" + "\x0cabcd" + "\x01\x04",
- "",
- ErrCorrupt,
- }, {
- `decodedLen=6; tagLiteral (4 bytes "abcd"); tagCopy2; length=2 offset=3; valid input`,
- "\x06" + "\x0cabcd" + "\x06\x03\x00",
- "abcdbc",
- nil,
- }, {
- `decodedLen=6; tagLiteral (4 bytes "abcd"); tagCopy4; length=2 offset=3; valid input`,
- "\x06" + "\x0cabcd" + "\x07\x03\x00\x00\x00",
- "abcdbc",
- nil,
- }}
-
- const (
- // notPresentXxx defines a range of byte values [0xa0, 0xc5) that are
- // not present in either the input or the output. It is written to dBuf
- // to check that Decode does not write bytes past the end of
- // dBuf[:dLen].
- //
- // The magic number 37 was chosen because it is prime. A more 'natural'
- // number like 32 might lead to a false negative if, for example, a
- // byte was incorrectly copied 4*8 bytes later.
- notPresentBase = 0xa0
- notPresentLen = 37
- )
-
- var dBuf [100]byte
-loop:
- for i, tc := range testCases {
- input := []byte(tc.input)
- for _, x := range input {
- if notPresentBase <= x && x < notPresentBase+notPresentLen {
- t.Errorf("#%d (%s): input shouldn't contain %#02x\ninput: % x", i, tc.desc, x, input)
- continue loop
- }
- }
-
- dLen, n := binary.Uvarint(input)
- if n <= 0 {
- t.Errorf("#%d (%s): invalid varint-encoded dLen", i, tc.desc)
- continue
- }
- if dLen > uint64(len(dBuf)) {
- t.Errorf("#%d (%s): dLen %d is too large", i, tc.desc, dLen)
- continue
- }
-
- for j := range dBuf {
- dBuf[j] = byte(notPresentBase + j%notPresentLen)
- }
- g, gotErr := Decode(dBuf[:], input)
- if got := string(g); got != tc.want || gotErr != tc.wantErr {
- t.Errorf("#%d (%s):\ngot %q, %v\nwant %q, %v",
- i, tc.desc, got, gotErr, tc.want, tc.wantErr)
- continue
- }
- for j, x := range dBuf {
- if uint64(j) < dLen {
- continue
- }
- if w := byte(notPresentBase + j%notPresentLen); x != w {
- t.Errorf("#%d (%s): Decode overrun: dBuf[%d] was modified: got %#02x, want %#02x\ndBuf: % x",
- i, tc.desc, j, x, w, dBuf)
- continue loop
- }
- }
- }
-}
-
-func TestDecodeCopy4(t *testing.T) {
- dots := strings.Repeat(".", 65536)
-
- input := strings.Join([]string{
- "\x89\x80\x04", // decodedLen = 65545.
- "\x0cpqrs", // 4-byte literal "pqrs".
- "\xf4\xff\xff" + dots, // 65536-byte literal dots.
- "\x13\x04\x00\x01\x00", // tagCopy4; length=5 offset=65540.
- }, "")
-
- gotBytes, err := Decode(nil, []byte(input))
- if err != nil {
- t.Fatal(err)
- }
- got := string(gotBytes)
- want := "pqrs" + dots + "pqrs."
- if len(got) != len(want) {
- t.Fatalf("got %d bytes, want %d", len(got), len(want))
- }
- if got != want {
- for i := 0; i < len(got); i++ {
- if g, w := got[i], want[i]; g != w {
- t.Fatalf("byte #%d: got %#02x, want %#02x", i, g, w)
- }
- }
- }
-}
-
-// TestDecodeLengthOffset tests decoding an encoding of the form literal +
-// copy-length-offset + literal. For example: "abcdefghijkl" + "efghij" + "AB".
-func TestDecodeLengthOffset(t *testing.T) {
- const (
- prefix = "abcdefghijklmnopqr"
- suffix = "ABCDEFGHIJKLMNOPQR"
-
- // notPresentXxx defines a range of byte values [0xa0, 0xc5) that are
- // not present in either the input or the output. It is written to
- // gotBuf to check that Decode does not write bytes past the end of
- // gotBuf[:totalLen].
- //
- // The magic number 37 was chosen because it is prime. A more 'natural'
- // number like 32 might lead to a false negative if, for example, a
- // byte was incorrectly copied 4*8 bytes later.
- notPresentBase = 0xa0
- notPresentLen = 37
- )
- var gotBuf, wantBuf, inputBuf [128]byte
- for length := 1; length <= 18; length++ {
- for offset := 1; offset <= 18; offset++ {
- loop:
- for suffixLen := 0; suffixLen <= 18; suffixLen++ {
- totalLen := len(prefix) + length + suffixLen
-
- inputLen := binary.PutUvarint(inputBuf[:], uint64(totalLen))
- inputBuf[inputLen] = tagLiteral + 4*byte(len(prefix)-1)
- inputLen++
- inputLen += copy(inputBuf[inputLen:], prefix)
- inputBuf[inputLen+0] = tagCopy2 + 4*byte(length-1)
- inputBuf[inputLen+1] = byte(offset)
- inputBuf[inputLen+2] = 0x00
- inputLen += 3
- if suffixLen > 0 {
- inputBuf[inputLen] = tagLiteral + 4*byte(suffixLen-1)
- inputLen++
- inputLen += copy(inputBuf[inputLen:], suffix[:suffixLen])
- }
- input := inputBuf[:inputLen]
-
- for i := range gotBuf {
- gotBuf[i] = byte(notPresentBase + i%notPresentLen)
- }
- got, err := Decode(gotBuf[:], input)
- if err != nil {
- t.Errorf("length=%d, offset=%d; suffixLen=%d: %v", length, offset, suffixLen, err)
- continue
- }
-
- wantLen := 0
- wantLen += copy(wantBuf[wantLen:], prefix)
- for i := 0; i < length; i++ {
- wantBuf[wantLen] = wantBuf[wantLen-offset]
- wantLen++
- }
- wantLen += copy(wantBuf[wantLen:], suffix[:suffixLen])
- want := wantBuf[:wantLen]
-
- for _, x := range input {
- if notPresentBase <= x && x < notPresentBase+notPresentLen {
- t.Errorf("length=%d, offset=%d; suffixLen=%d: input shouldn't contain %#02x\ninput: % x",
- length, offset, suffixLen, x, input)
- continue loop
- }
- }
- for i, x := range gotBuf {
- if i < totalLen {
- continue
- }
- if w := byte(notPresentBase + i%notPresentLen); x != w {
- t.Errorf("length=%d, offset=%d; suffixLen=%d; totalLen=%d: "+
- "Decode overrun: gotBuf[%d] was modified: got %#02x, want %#02x\ngotBuf: % x",
- length, offset, suffixLen, totalLen, i, x, w, gotBuf)
- continue loop
- }
- }
- for _, x := range want {
- if notPresentBase <= x && x < notPresentBase+notPresentLen {
- t.Errorf("length=%d, offset=%d; suffixLen=%d: want shouldn't contain %#02x\nwant: % x",
- length, offset, suffixLen, x, want)
- continue loop
- }
- }
-
- if !bytes.Equal(got, want) {
- t.Errorf("length=%d, offset=%d; suffixLen=%d:\ninput % x\ngot % x\nwant % x",
- length, offset, suffixLen, input, got, want)
- continue
- }
- }
- }
- }
-}
-
-const (
- goldenText = "Mark.Twain-Tom.Sawyer.txt"
- goldenCompressed = goldenText + ".rawsnappy"
-)
-
-func TestDecodeGoldenInput(t *testing.T) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenCompressed))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- got, err := Decode(nil, src)
- if err != nil {
- t.Fatalf("Decode: %v", err)
- }
- want, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- if err := cmp(got, want); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestEncodeGoldenInput(t *testing.T) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- got := Encode(nil, src)
- want, err := ioutil.ReadFile(filepath.Join(tDir, goldenCompressed))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- if err := cmp(got, want); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestExtendMatchGoldenInput(t *testing.T) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- t.Fatalf("ReadFile: %v", err)
- }
- for i, tc := range extendMatchGoldenTestCases {
- got := extendMatch(src, tc.i, tc.j)
- if got != tc.want {
- t.Errorf("test #%d: i, j = %5d, %5d: got %5d (= j + %6d), want %5d (= j + %6d)",
- i, tc.i, tc.j, got, got-tc.j, tc.want, tc.want-tc.j)
- }
- }
-}
-
-func TestExtendMatch(t *testing.T) {
- // ref is a simple, reference implementation of extendMatch.
- ref := func(src []byte, i, j int) int {
- for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 {
- }
- return j
- }
-
- nums := []int{0, 1, 2, 7, 8, 9, 29, 30, 31, 32, 33, 34, 38, 39, 40}
- for yIndex := 40; yIndex > 30; yIndex-- {
- xxx := bytes.Repeat([]byte("x"), 40)
- if yIndex < len(xxx) {
- xxx[yIndex] = 'y'
- }
- for _, i := range nums {
- for _, j := range nums {
- if i >= j {
- continue
- }
- got := extendMatch(xxx, i, j)
- want := ref(xxx, i, j)
- if got != want {
- t.Errorf("yIndex=%d, i=%d, j=%d: got %d, want %d", yIndex, i, j, got, want)
- }
- }
- }
- }
-}
-
-const snappytoolCmdName = "cmd/snappytool/snappytool"
-
-func skipTestSameEncodingAsCpp() (msg string) {
- if !goEncoderShouldMatchCppEncoder {
- return fmt.Sprintf("skipping testing that the encoding is byte-for-byte identical to C++: GOARCH=%s", runtime.GOARCH)
- }
- if _, err := os.Stat(snappytoolCmdName); err != nil {
- return fmt.Sprintf("could not find snappytool: %v", err)
- }
- return ""
-}
-
-func runTestSameEncodingAsCpp(src []byte) error {
- got := Encode(nil, src)
-
- cmd := exec.Command(snappytoolCmdName, "-e")
- cmd.Stdin = bytes.NewReader(src)
- want, err := cmd.Output()
- if err != nil {
- return fmt.Errorf("could not run snappytool: %v", err)
- }
- return cmp(got, want)
-}
-
-func TestSameEncodingAsCppShortCopies(t *testing.T) {
- if msg := skipTestSameEncodingAsCpp(); msg != "" {
- t.Skip(msg)
- }
- src := bytes.Repeat([]byte{'a'}, 20)
- for i := 0; i <= len(src); i++ {
- if err := runTestSameEncodingAsCpp(src[:i]); err != nil {
- t.Errorf("i=%d: %v", i, err)
- }
- }
-}
-
-func TestSameEncodingAsCppLongFiles(t *testing.T) {
- if msg := skipTestSameEncodingAsCpp(); msg != "" {
- t.Skip(msg)
- }
- bDir := filepath.FromSlash(*benchdataDir)
- failed := false
- for i, tf := range testFiles {
- if err := downloadBenchmarkFiles(t, tf.filename); err != nil {
- t.Fatalf("failed to download testdata: %s", err)
- }
- data := readFile(t, filepath.Join(bDir, tf.filename))
- if n := tf.sizeLimit; 0 < n && n < len(data) {
- data = data[:n]
- }
- if err := runTestSameEncodingAsCpp(data); err != nil {
- t.Errorf("i=%d: %v", i, err)
- failed = true
- }
- }
- if failed {
- t.Errorf("was the snappytool program built against the C++ snappy library version " +
- "d53de187 or later, commited on 2016-04-05? See " +
- "https://github.com/google/snappy/commit/d53de18799418e113e44444252a39b12a0e4e0cc")
- }
-}
-
-// TestSlowForwardCopyOverrun tests the "expand the pattern" algorithm
-// described in decode_amd64.s and its claim of a 10 byte overrun worst case.
-func TestSlowForwardCopyOverrun(t *testing.T) {
- const base = 100
-
- for length := 1; length < 18; length++ {
- for offset := 1; offset < 18; offset++ {
- highWaterMark := base
- d := base
- l := length
- o := offset
-
- // makeOffsetAtLeast8
- for o < 8 {
- if end := d + 8; highWaterMark < end {
- highWaterMark = end
- }
- l -= o
- d += o
- o += o
- }
-
- // fixUpSlowForwardCopy
- a := d
- d += l
-
- // finishSlowForwardCopy
- for l > 0 {
- if end := a + 8; highWaterMark < end {
- highWaterMark = end
- }
- a += 8
- l -= 8
- }
-
- dWant := base + length
- overrun := highWaterMark - dWant
- if d != dWant || overrun < 0 || 10 < overrun {
- t.Errorf("length=%d, offset=%d: d and overrun: got (%d, %d), want (%d, something in [0, 10])",
- length, offset, d, overrun, dWant)
- }
- }
- }
-}
-
-// TestEncodeNoiseThenRepeats encodes input for which the first half is very
-// incompressible and the second half is very compressible. The encoded form's
-// length should be closer to 50% of the original length than 100%.
-func TestEncodeNoiseThenRepeats(t *testing.T) {
- for _, origLen := range []int{256 * 1024, 2048 * 1024} {
- src := make([]byte, origLen)
- rng := rand.New(rand.NewSource(1))
- firstHalf, secondHalf := src[:origLen/2], src[origLen/2:]
- for i := range firstHalf {
- firstHalf[i] = uint8(rng.Intn(256))
- }
- for i := range secondHalf {
- secondHalf[i] = uint8(i >> 8)
- }
- dst := Encode(nil, src)
- if got, want := len(dst), origLen*3/4; got >= want {
- t.Errorf("origLen=%d: got %d encoded bytes, want less than %d", origLen, got, want)
- }
- }
-}
-
-func TestFramingFormat(t *testing.T) {
- // src is comprised of alternating 1e5-sized sequences of random
- // (incompressible) bytes and repeated (compressible) bytes. 1e5 was chosen
- // because it is larger than maxBlockSize (64k).
- src := make([]byte, 1e6)
- rng := rand.New(rand.NewSource(1))
- for i := 0; i < 10; i++ {
- if i%2 == 0 {
- for j := 0; j < 1e5; j++ {
- src[1e5*i+j] = uint8(rng.Intn(256))
- }
- } else {
- for j := 0; j < 1e5; j++ {
- src[1e5*i+j] = uint8(i)
- }
- }
- }
-
- buf := new(bytes.Buffer)
- if _, err := NewWriter(buf).Write(src); err != nil {
- t.Fatalf("Write: encoding: %v", err)
- }
- dst, err := ioutil.ReadAll(NewReader(buf))
- if err != nil {
- t.Fatalf("ReadAll: decoding: %v", err)
- }
- if err := cmp(dst, src); err != nil {
- t.Fatal(err)
- }
-}
-
-func TestWriterGoldenOutput(t *testing.T) {
- buf := new(bytes.Buffer)
- w := NewBufferedWriter(buf)
- defer w.Close()
- w.Write([]byte("abcd")) // Not compressible.
- w.Flush()
- w.Write(bytes.Repeat([]byte{'A'}, 150)) // Compressible.
- w.Flush()
- // The next chunk is also compressible, but a naive, greedy encoding of the
- // overall length 67 copy as a length 64 copy (the longest expressible as a
- // tagCopy1 or tagCopy2) plus a length 3 remainder would be two 3-byte
- // tagCopy2 tags (6 bytes), since the minimum length for a tagCopy1 is 4
- // bytes. Instead, we could do it shorter, in 5 bytes: a 3-byte tagCopy2
- // (of length 60) and a 2-byte tagCopy1 (of length 7).
- w.Write(bytes.Repeat([]byte{'B'}, 68))
- w.Write([]byte("efC")) // Not compressible.
- w.Write(bytes.Repeat([]byte{'C'}, 20)) // Compressible.
- w.Write(bytes.Repeat([]byte{'B'}, 20)) // Compressible.
- w.Write([]byte("g")) // Not compressible.
- w.Flush()
-
- got := buf.String()
- want := strings.Join([]string{
- magicChunk,
- "\x01\x08\x00\x00", // Uncompressed chunk, 8 bytes long (including 4 byte checksum).
- "\x68\x10\xe6\xb6", // Checksum.
- "\x61\x62\x63\x64", // Uncompressed payload: "abcd".
- "\x00\x11\x00\x00", // Compressed chunk, 17 bytes long (including 4 byte checksum).
- "\x5f\xeb\xf2\x10", // Checksum.
- "\x96\x01", // Compressed payload: Uncompressed length (varint encoded): 150.
- "\x00\x41", // Compressed payload: tagLiteral, length=1, "A".
- "\xfe\x01\x00", // Compressed payload: tagCopy2, length=64, offset=1.
- "\xfe\x01\x00", // Compressed payload: tagCopy2, length=64, offset=1.
- "\x52\x01\x00", // Compressed payload: tagCopy2, length=21, offset=1.
- "\x00\x18\x00\x00", // Compressed chunk, 24 bytes long (including 4 byte checksum).
- "\x30\x85\x69\xeb", // Checksum.
- "\x70", // Compressed payload: Uncompressed length (varint encoded): 112.
- "\x00\x42", // Compressed payload: tagLiteral, length=1, "B".
- "\xee\x01\x00", // Compressed payload: tagCopy2, length=60, offset=1.
- "\x0d\x01", // Compressed payload: tagCopy1, length=7, offset=1.
- "\x08\x65\x66\x43", // Compressed payload: tagLiteral, length=3, "efC".
- "\x4e\x01\x00", // Compressed payload: tagCopy2, length=20, offset=1.
- "\x4e\x5a\x00", // Compressed payload: tagCopy2, length=20, offset=90.
- "\x00\x67", // Compressed payload: tagLiteral, length=1, "g".
- }, "")
- if got != want {
- t.Fatalf("\ngot: % x\nwant: % x", got, want)
- }
-}
-
-func TestEmitLiteral(t *testing.T) {
- testCases := []struct {
- length int
- want string
- }{
- {1, "\x00"},
- {2, "\x04"},
- {59, "\xe8"},
- {60, "\xec"},
- {61, "\xf0\x3c"},
- {62, "\xf0\x3d"},
- {254, "\xf0\xfd"},
- {255, "\xf0\xfe"},
- {256, "\xf0\xff"},
- {257, "\xf4\x00\x01"},
- {65534, "\xf4\xfd\xff"},
- {65535, "\xf4\xfe\xff"},
- {65536, "\xf4\xff\xff"},
- }
-
- dst := make([]byte, 70000)
- nines := bytes.Repeat([]byte{0x99}, 65536)
- for _, tc := range testCases {
- lit := nines[:tc.length]
- n := emitLiteral(dst, lit)
- if !bytes.HasSuffix(dst[:n], lit) {
- t.Errorf("length=%d: did not end with that many literal bytes", tc.length)
- continue
- }
- got := string(dst[:n-tc.length])
- if got != tc.want {
- t.Errorf("length=%d:\ngot % x\nwant % x", tc.length, got, tc.want)
- continue
- }
- }
-}
-
-func TestEmitCopy(t *testing.T) {
- testCases := []struct {
- offset int
- length int
- want string
- }{
- {8, 04, "\x01\x08"},
- {8, 11, "\x1d\x08"},
- {8, 12, "\x2e\x08\x00"},
- {8, 13, "\x32\x08\x00"},
- {8, 59, "\xea\x08\x00"},
- {8, 60, "\xee\x08\x00"},
- {8, 61, "\xf2\x08\x00"},
- {8, 62, "\xf6\x08\x00"},
- {8, 63, "\xfa\x08\x00"},
- {8, 64, "\xfe\x08\x00"},
- {8, 65, "\xee\x08\x00\x05\x08"},
- {8, 66, "\xee\x08\x00\x09\x08"},
- {8, 67, "\xee\x08\x00\x0d\x08"},
- {8, 68, "\xfe\x08\x00\x01\x08"},
- {8, 69, "\xfe\x08\x00\x05\x08"},
- {8, 80, "\xfe\x08\x00\x3e\x08\x00"},
-
- {256, 04, "\x21\x00"},
- {256, 11, "\x3d\x00"},
- {256, 12, "\x2e\x00\x01"},
- {256, 13, "\x32\x00\x01"},
- {256, 59, "\xea\x00\x01"},
- {256, 60, "\xee\x00\x01"},
- {256, 61, "\xf2\x00\x01"},
- {256, 62, "\xf6\x00\x01"},
- {256, 63, "\xfa\x00\x01"},
- {256, 64, "\xfe\x00\x01"},
- {256, 65, "\xee\x00\x01\x25\x00"},
- {256, 66, "\xee\x00\x01\x29\x00"},
- {256, 67, "\xee\x00\x01\x2d\x00"},
- {256, 68, "\xfe\x00\x01\x21\x00"},
- {256, 69, "\xfe\x00\x01\x25\x00"},
- {256, 80, "\xfe\x00\x01\x3e\x00\x01"},
-
- {2048, 04, "\x0e\x00\x08"},
- {2048, 11, "\x2a\x00\x08"},
- {2048, 12, "\x2e\x00\x08"},
- {2048, 13, "\x32\x00\x08"},
- {2048, 59, "\xea\x00\x08"},
- {2048, 60, "\xee\x00\x08"},
- {2048, 61, "\xf2\x00\x08"},
- {2048, 62, "\xf6\x00\x08"},
- {2048, 63, "\xfa\x00\x08"},
- {2048, 64, "\xfe\x00\x08"},
- {2048, 65, "\xee\x00\x08\x12\x00\x08"},
- {2048, 66, "\xee\x00\x08\x16\x00\x08"},
- {2048, 67, "\xee\x00\x08\x1a\x00\x08"},
- {2048, 68, "\xfe\x00\x08\x0e\x00\x08"},
- {2048, 69, "\xfe\x00\x08\x12\x00\x08"},
- {2048, 80, "\xfe\x00\x08\x3e\x00\x08"},
- }
-
- dst := make([]byte, 1024)
- for _, tc := range testCases {
- n := emitCopy(dst, tc.offset, tc.length)
- got := string(dst[:n])
- if got != tc.want {
- t.Errorf("offset=%d, length=%d:\ngot % x\nwant % x", tc.offset, tc.length, got, tc.want)
- }
- }
-}
-
-func TestNewBufferedWriter(t *testing.T) {
- // Test all 32 possible sub-sequences of these 5 input slices.
- //
- // Their lengths sum to 400,000, which is over 6 times the Writer ibuf
- // capacity: 6 * maxBlockSize is 393,216.
- inputs := [][]byte{
- bytes.Repeat([]byte{'a'}, 40000),
- bytes.Repeat([]byte{'b'}, 150000),
- bytes.Repeat([]byte{'c'}, 60000),
- bytes.Repeat([]byte{'d'}, 120000),
- bytes.Repeat([]byte{'e'}, 30000),
- }
-loop:
- for i := 0; i < 1<<uint(len(inputs)); i++ {
- var want []byte
- buf := new(bytes.Buffer)
- w := NewBufferedWriter(buf)
- for j, input := range inputs {
- if i&(1<<uint(j)) == 0 {
- continue
- }
- if _, err := w.Write(input); err != nil {
- t.Errorf("i=%#02x: j=%d: Write: %v", i, j, err)
- continue loop
- }
- want = append(want, input...)
- }
- if err := w.Close(); err != nil {
- t.Errorf("i=%#02x: Close: %v", i, err)
- continue
- }
- got, err := ioutil.ReadAll(NewReader(buf))
- if err != nil {
- t.Errorf("i=%#02x: ReadAll: %v", i, err)
- continue
- }
- if err := cmp(got, want); err != nil {
- t.Errorf("i=%#02x: %v", i, err)
- continue
- }
- }
-}
-
-func TestFlush(t *testing.T) {
- buf := new(bytes.Buffer)
- w := NewBufferedWriter(buf)
- defer w.Close()
- if _, err := w.Write(bytes.Repeat([]byte{'x'}, 20)); err != nil {
- t.Fatalf("Write: %v", err)
- }
- if n := buf.Len(); n != 0 {
- t.Fatalf("before Flush: %d bytes were written to the underlying io.Writer, want 0", n)
- }
- if err := w.Flush(); err != nil {
- t.Fatalf("Flush: %v", err)
- }
- if n := buf.Len(); n == 0 {
- t.Fatalf("after Flush: %d bytes were written to the underlying io.Writer, want non-0", n)
- }
-}
-
-func TestReaderUncompressedDataOK(t *testing.T) {
- r := NewReader(strings.NewReader(magicChunk +
- "\x01\x08\x00\x00" + // Uncompressed chunk, 8 bytes long (including 4 byte checksum).
- "\x68\x10\xe6\xb6" + // Checksum.
- "\x61\x62\x63\x64", // Uncompressed payload: "abcd".
- ))
- g, err := ioutil.ReadAll(r)
- if err != nil {
- t.Fatal(err)
- }
- if got, want := string(g), "abcd"; got != want {
- t.Fatalf("got %q, want %q", got, want)
- }
-}
-
-func TestReaderUncompressedDataNoPayload(t *testing.T) {
- r := NewReader(strings.NewReader(magicChunk +
- "\x01\x04\x00\x00" + // Uncompressed chunk, 4 bytes long.
- "", // No payload; corrupt input.
- ))
- if _, err := ioutil.ReadAll(r); err != ErrCorrupt {
- t.Fatalf("got %v, want %v", err, ErrCorrupt)
- }
-}
-
-func TestReaderUncompressedDataTooLong(t *testing.T) {
- // https://github.com/google/snappy/blob/master/framing_format.txt section
- // 4.3 says that "the maximum legal chunk length... is 65540", or 0x10004.
- const n = 0x10005
-
- r := NewReader(strings.NewReader(magicChunk +
- "\x01\x05\x00\x01" + // Uncompressed chunk, n bytes long.
- strings.Repeat("\x00", n),
- ))
- if _, err := ioutil.ReadAll(r); err != ErrCorrupt {
- t.Fatalf("got %v, want %v", err, ErrCorrupt)
- }
-}
-
-func TestReaderReset(t *testing.T) {
- gold := bytes.Repeat([]byte("All that is gold does not glitter,\n"), 10000)
- buf := new(bytes.Buffer)
- if _, err := NewWriter(buf).Write(gold); err != nil {
- t.Fatalf("Write: %v", err)
- }
- encoded, invalid, partial := buf.String(), "invalid", "partial"
- r := NewReader(nil)
- for i, s := range []string{encoded, invalid, partial, encoded, partial, invalid, encoded, encoded} {
- if s == partial {
- r.Reset(strings.NewReader(encoded))
- if _, err := r.Read(make([]byte, 101)); err != nil {
- t.Errorf("#%d: %v", i, err)
- continue
- }
- continue
- }
- r.Reset(strings.NewReader(s))
- got, err := ioutil.ReadAll(r)
- switch s {
- case encoded:
- if err != nil {
- t.Errorf("#%d: %v", i, err)
- continue
- }
- if err := cmp(got, gold); err != nil {
- t.Errorf("#%d: %v", i, err)
- continue
- }
- case invalid:
- if err == nil {
- t.Errorf("#%d: got nil error, want non-nil", i)
- continue
- }
- }
- }
-}
-
-func TestWriterReset(t *testing.T) {
- gold := bytes.Repeat([]byte("Not all those who wander are lost;\n"), 10000)
- const n = 20
- for _, buffered := range []bool{false, true} {
- var w *Writer
- if buffered {
- w = NewBufferedWriter(nil)
- defer w.Close()
- } else {
- w = NewWriter(nil)
- }
-
- var gots, wants [][]byte
- failed := false
- for i := 0; i <= n; i++ {
- buf := new(bytes.Buffer)
- w.Reset(buf)
- want := gold[:len(gold)*i/n]
- if _, err := w.Write(want); err != nil {
- t.Errorf("#%d: Write: %v", i, err)
- failed = true
- continue
- }
- if buffered {
- if err := w.Flush(); err != nil {
- t.Errorf("#%d: Flush: %v", i, err)
- failed = true
- continue
- }
- }
- got, err := ioutil.ReadAll(NewReader(buf))
- if err != nil {
- t.Errorf("#%d: ReadAll: %v", i, err)
- failed = true
- continue
- }
- gots = append(gots, got)
- wants = append(wants, want)
- }
- if failed {
- continue
- }
- for i := range gots {
- if err := cmp(gots[i], wants[i]); err != nil {
- t.Errorf("#%d: %v", i, err)
- }
- }
- }
-}
-
-func TestWriterResetWithoutFlush(t *testing.T) {
- buf0 := new(bytes.Buffer)
- buf1 := new(bytes.Buffer)
- w := NewBufferedWriter(buf0)
- if _, err := w.Write([]byte("xxx")); err != nil {
- t.Fatalf("Write #0: %v", err)
- }
- // Note that we don't Flush the Writer before calling Reset.
- w.Reset(buf1)
- if _, err := w.Write([]byte("yyy")); err != nil {
- t.Fatalf("Write #1: %v", err)
- }
- if err := w.Flush(); err != nil {
- t.Fatalf("Flush: %v", err)
- }
- got, err := ioutil.ReadAll(NewReader(buf1))
- if err != nil {
- t.Fatalf("ReadAll: %v", err)
- }
- if err := cmp(got, []byte("yyy")); err != nil {
- t.Fatal(err)
- }
-}
-
-type writeCounter int
-
-func (c *writeCounter) Write(p []byte) (int, error) {
- *c++
- return len(p), nil
-}
-
-// TestNumUnderlyingWrites tests that each Writer flush only makes one or two
-// Write calls on its underlying io.Writer, depending on whether or not the
-// flushed buffer was compressible.
-func TestNumUnderlyingWrites(t *testing.T) {
- testCases := []struct {
- input []byte
- want int
- }{
- {bytes.Repeat([]byte{'x'}, 100), 1},
- {bytes.Repeat([]byte{'y'}, 100), 1},
- {[]byte("ABCDEFGHIJKLMNOPQRST"), 2},
- }
-
- var c writeCounter
- w := NewBufferedWriter(&c)
- defer w.Close()
- for i, tc := range testCases {
- c = 0
- if _, err := w.Write(tc.input); err != nil {
- t.Errorf("#%d: Write: %v", i, err)
- continue
- }
- if err := w.Flush(); err != nil {
- t.Errorf("#%d: Flush: %v", i, err)
- continue
- }
- if int(c) != tc.want {
- t.Errorf("#%d: got %d underlying writes, want %d", i, c, tc.want)
- continue
- }
- }
-}
-
-func benchDecode(b *testing.B, src []byte) {
- encoded := Encode(nil, src)
- // Bandwidth is in amount of uncompressed data.
- b.SetBytes(int64(len(src)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Decode(src, encoded)
- }
-}
-
-func benchEncode(b *testing.B, src []byte) {
- // Bandwidth is in amount of uncompressed data.
- b.SetBytes(int64(len(src)))
- dst := make([]byte, MaxEncodedLen(len(src)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Encode(dst, src)
- }
-}
-
-func testOrBenchmark(b testing.TB) string {
- if _, ok := b.(*testing.B); ok {
- return "benchmark"
- }
- return "test"
-}
-
-func readFile(b testing.TB, filename string) []byte {
- src, err := ioutil.ReadFile(filename)
- if err != nil {
- b.Skipf("skipping %s: %v", testOrBenchmark(b), err)
- }
- if len(src) == 0 {
- b.Fatalf("%s has zero length", filename)
- }
- return src
-}
-
-// expand returns a slice of length n containing repeated copies of src.
-func expand(src []byte, n int) []byte {
- dst := make([]byte, n)
- for x := dst; len(x) > 0; {
- i := copy(x, src)
- x = x[i:]
- }
- return dst
-}
-
-func benchWords(b *testing.B, n int, decode bool) {
- // Note: the file is OS-language dependent so the resulting values are not
- // directly comparable for non-US-English OS installations.
- data := expand(readFile(b, "/usr/share/dict/words"), n)
- if decode {
- benchDecode(b, data)
- } else {
- benchEncode(b, data)
- }
-}
-
-func BenchmarkWordsDecode1e1(b *testing.B) { benchWords(b, 1e1, true) }
-func BenchmarkWordsDecode1e2(b *testing.B) { benchWords(b, 1e2, true) }
-func BenchmarkWordsDecode1e3(b *testing.B) { benchWords(b, 1e3, true) }
-func BenchmarkWordsDecode1e4(b *testing.B) { benchWords(b, 1e4, true) }
-func BenchmarkWordsDecode1e5(b *testing.B) { benchWords(b, 1e5, true) }
-func BenchmarkWordsDecode1e6(b *testing.B) { benchWords(b, 1e6, true) }
-func BenchmarkWordsEncode1e1(b *testing.B) { benchWords(b, 1e1, false) }
-func BenchmarkWordsEncode1e2(b *testing.B) { benchWords(b, 1e2, false) }
-func BenchmarkWordsEncode1e3(b *testing.B) { benchWords(b, 1e3, false) }
-func BenchmarkWordsEncode1e4(b *testing.B) { benchWords(b, 1e4, false) }
-func BenchmarkWordsEncode1e5(b *testing.B) { benchWords(b, 1e5, false) }
-func BenchmarkWordsEncode1e6(b *testing.B) { benchWords(b, 1e6, false) }
-
-func BenchmarkRandomEncode(b *testing.B) {
- rng := rand.New(rand.NewSource(1))
- data := make([]byte, 1<<20)
- for i := range data {
- data[i] = uint8(rng.Intn(256))
- }
- benchEncode(b, data)
-}
-
-// testFiles' values are copied directly from
-// https://raw.githubusercontent.com/google/snappy/master/snappy_unittest.cc
-// The label field is unused in snappy-go.
-var testFiles = []struct {
- label string
- filename string
- sizeLimit int
-}{
- {"html", "html", 0},
- {"urls", "urls.10K", 0},
- {"jpg", "fireworks.jpeg", 0},
- {"jpg_200", "fireworks.jpeg", 200},
- {"pdf", "paper-100k.pdf", 0},
- {"html4", "html_x_4", 0},
- {"txt1", "alice29.txt", 0},
- {"txt2", "asyoulik.txt", 0},
- {"txt3", "lcet10.txt", 0},
- {"txt4", "plrabn12.txt", 0},
- {"pb", "geo.protodata", 0},
- {"gaviota", "kppkn.gtb", 0},
-}
-
-const (
- // The benchmark data files are at this canonical URL.
- benchURL = "https://raw.githubusercontent.com/google/snappy/master/testdata/"
-)
-
-func downloadBenchmarkFiles(b testing.TB, basename string) (errRet error) {
- bDir := filepath.FromSlash(*benchdataDir)
- filename := filepath.Join(bDir, basename)
- if stat, err := os.Stat(filename); err == nil && stat.Size() != 0 {
- return nil
- }
-
- if !*download {
- b.Skipf("test data not found; skipping %s without the -download flag", testOrBenchmark(b))
- }
- // Download the official snappy C++ implementation reference test data
- // files for benchmarking.
- if err := os.MkdirAll(bDir, 0777); err != nil && !os.IsExist(err) {
- return fmt.Errorf("failed to create %s: %s", bDir, err)
- }
-
- f, err := os.Create(filename)
- if err != nil {
- return fmt.Errorf("failed to create %s: %s", filename, err)
- }
- defer f.Close()
- defer func() {
- if errRet != nil {
- os.Remove(filename)
- }
- }()
- url := benchURL + basename
- resp, err := http.Get(url)
- if err != nil {
- return fmt.Errorf("failed to download %s: %s", url, err)
- }
- defer resp.Body.Close()
- if s := resp.StatusCode; s != http.StatusOK {
- return fmt.Errorf("downloading %s: HTTP status code %d (%s)", url, s, http.StatusText(s))
- }
- _, err = io.Copy(f, resp.Body)
- if err != nil {
- return fmt.Errorf("failed to download %s to %s: %s", url, filename, err)
- }
- return nil
-}
-
-func benchFile(b *testing.B, i int, decode bool) {
- if err := downloadBenchmarkFiles(b, testFiles[i].filename); err != nil {
- b.Fatalf("failed to download testdata: %s", err)
- }
- bDir := filepath.FromSlash(*benchdataDir)
- data := readFile(b, filepath.Join(bDir, testFiles[i].filename))
- if n := testFiles[i].sizeLimit; 0 < n && n < len(data) {
- data = data[:n]
- }
- if decode {
- benchDecode(b, data)
- } else {
- benchEncode(b, data)
- }
-}
-
-// Naming convention is kept similar to what snappy's C++ implementation uses.
-func Benchmark_UFlat0(b *testing.B) { benchFile(b, 0, true) }
-func Benchmark_UFlat1(b *testing.B) { benchFile(b, 1, true) }
-func Benchmark_UFlat2(b *testing.B) { benchFile(b, 2, true) }
-func Benchmark_UFlat3(b *testing.B) { benchFile(b, 3, true) }
-func Benchmark_UFlat4(b *testing.B) { benchFile(b, 4, true) }
-func Benchmark_UFlat5(b *testing.B) { benchFile(b, 5, true) }
-func Benchmark_UFlat6(b *testing.B) { benchFile(b, 6, true) }
-func Benchmark_UFlat7(b *testing.B) { benchFile(b, 7, true) }
-func Benchmark_UFlat8(b *testing.B) { benchFile(b, 8, true) }
-func Benchmark_UFlat9(b *testing.B) { benchFile(b, 9, true) }
-func Benchmark_UFlat10(b *testing.B) { benchFile(b, 10, true) }
-func Benchmark_UFlat11(b *testing.B) { benchFile(b, 11, true) }
-func Benchmark_ZFlat0(b *testing.B) { benchFile(b, 0, false) }
-func Benchmark_ZFlat1(b *testing.B) { benchFile(b, 1, false) }
-func Benchmark_ZFlat2(b *testing.B) { benchFile(b, 2, false) }
-func Benchmark_ZFlat3(b *testing.B) { benchFile(b, 3, false) }
-func Benchmark_ZFlat4(b *testing.B) { benchFile(b, 4, false) }
-func Benchmark_ZFlat5(b *testing.B) { benchFile(b, 5, false) }
-func Benchmark_ZFlat6(b *testing.B) { benchFile(b, 6, false) }
-func Benchmark_ZFlat7(b *testing.B) { benchFile(b, 7, false) }
-func Benchmark_ZFlat8(b *testing.B) { benchFile(b, 8, false) }
-func Benchmark_ZFlat9(b *testing.B) { benchFile(b, 9, false) }
-func Benchmark_ZFlat10(b *testing.B) { benchFile(b, 10, false) }
-func Benchmark_ZFlat11(b *testing.B) { benchFile(b, 11, false) }
-
-func BenchmarkExtendMatch(b *testing.B) {
- tDir := filepath.FromSlash(*testdataDir)
- src, err := ioutil.ReadFile(filepath.Join(tDir, goldenText))
- if err != nil {
- b.Fatalf("ReadFile: %v", err)
- }
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- for _, tc := range extendMatchGoldenTestCases {
- extendMatch(src, tc.i, tc.j)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/afpacket/afpacket_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/afpacket/afpacket_test.go
deleted file mode 100644
index 57f6480d548..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/afpacket/afpacket_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-// +build linux
-
-package afpacket
-
-import (
- "reflect"
- "testing"
-)
-
-func TestParseOptions(t *testing.T) {
- wanted1 := defaultOpts
- wanted1.frameSize = 1 << 10
- wanted1.framesPerBlock = wanted1.blockSize / wanted1.frameSize
- for i, test := range []struct {
- opts []interface{}
- want options
- err bool
- }{
- {opts: []interface{}{OptBlockSize(2)}, err: true},
- {opts: []interface{}{OptFrameSize(333)}, err: true},
- {opts: []interface{}{OptTPacketVersion(-3)}, err: true},
- {opts: []interface{}{OptTPacketVersion(5)}, err: true},
- {opts: []interface{}{OptFrameSize(1 << 10)}, want: wanted1},
- } {
- got, err := parseOptions(test.opts...)
- t.Logf("got: %#v\nerr: %v", got, err)
- if test.err && err == nil || !test.err && err != nil {
- t.Errorf("%d error mismatch, want error? %v. error: %v", i, test.err, err)
- }
- if !test.err && !reflect.DeepEqual(test.want, got) {
- t.Errorf("%d opts mismatch, want\n%#v", i, test.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/benchmark_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/benchmark_test.go
deleted file mode 100644
index 74a1d28dfe4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/benchmark_test.go
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright 2012, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package gopacket
-
-import (
- "runtime"
- "testing"
-)
-
-// A few benchmarks for figuring out exactly how fast some underlying Go
-// things are.
-
-type testError struct{}
-
-func (t *testError) Error() string { return "abc" }
-
-func BenchmarkTypeAssertion(b *testing.B) {
- var e error = &testError{}
- for i := 0; i < b.N; i++ {
- _, _ = e.(*testError)
- }
-}
-
-func BenchmarkMapLookup(b *testing.B) {
- m := map[LayerType]bool{
- LayerTypePayload: true,
- }
- for i := 0; i < b.N; i++ {
- _ = m[LayerTypePayload]
- }
-}
-
-func BenchmarkNilMapLookup(b *testing.B) {
- var m map[LayerType]bool
- for i := 0; i < b.N; i++ {
- _ = m[LayerTypePayload]
- }
-}
-
-func BenchmarkNilMapLookupWithNilCheck(b *testing.B) {
- var m map[LayerType]bool
- for i := 0; i < b.N; i++ {
- if m != nil {
- _ = m[LayerTypePayload]
- }
- }
-}
-
-func BenchmarkArrayLookup(b *testing.B) {
- m := make([]bool, 100)
- for i := 0; i < b.N; i++ {
- _ = m[LayerTypePayload]
- }
-}
-
-var testError1 = &testError{}
-var testError2 error = testError1
-
-func BenchmarkTypeToInterface1(b *testing.B) {
- var e error
- for i := 0; i < b.N; i++ {
- e = testError1
- }
- // Have to do someting with 'e' or the compiler complains about an unused
- // variable.
- testError2 = e
-}
-func BenchmarkTypeToInterface2(b *testing.B) {
- var e error
- for i := 0; i < b.N; i++ {
- e = testError2
- }
- // Have to do someting with 'e' or the compiler complains about an unused
- // variable.
- testError2 = e
-}
-
-var decodeOpts DecodeOptions
-
-func decodeOptsByValue(_ DecodeOptions) {}
-func decodeOptsByPointer(_ *DecodeOptions) {}
-func BenchmarkPassDecodeOptionsByValue(b *testing.B) {
- for i := 0; i < b.N; i++ {
- decodeOptsByValue(decodeOpts)
- }
-}
-func BenchmarkPassDecodeOptionsByPointer(b *testing.B) {
- for i := 0; i < b.N; i++ {
- decodeOptsByPointer(&decodeOpts)
- }
-}
-
-func BenchmarkLockOSThread(b *testing.B) {
- for i := 0; i < b.N; i++ {
- runtime.LockOSThread()
- }
-}
-func BenchmarkUnlockOSThread(b *testing.B) {
- for i := 0; i < b.N; i++ {
- runtime.UnlockOSThread()
- }
-}
-func lockUnlock() {
- runtime.LockOSThread()
- runtime.UnlockOSThread()
-}
-func lockDeferUnlock() {
- runtime.LockOSThread()
- defer runtime.UnlockOSThread()
-}
-func BenchmarkLockUnlockOSThread(b *testing.B) {
- for i := 0; i < b.N; i++ {
- lockUnlock()
- }
-}
-func BenchmarkLockDeferUnlockOSThread(b *testing.B) {
- for i := 0; i < b.N; i++ {
- lockDeferUnlock()
- }
-}
-
-func BenchmarkUnbufferedChannel(b *testing.B) {
- ca := make(chan bool)
- cb := make(chan bool)
- defer close(ca)
- go func() {
- defer close(cb)
- for _ = range ca {
- cb <- true
- }
- }()
- for i := 0; i < b.N; i++ {
- ca <- true
- <-cb
- }
-}
-func BenchmarkSmallBufferedChannel(b *testing.B) {
- ca := make(chan bool, 1)
- cb := make(chan bool, 1)
- defer close(ca)
- go func() {
- defer close(cb)
- for _ = range ca {
- cb <- true
- }
- }()
- for i := 0; i < b.N; i++ {
- ca <- true
- <-cb
- }
-}
-func BenchmarkLargeBufferedChannel(b *testing.B) {
- ca := make(chan bool, 1000)
- cb := make(chan bool, 1000)
- defer close(ca)
- go func() {
- defer close(cb)
- for _ = range ca {
- cb <- true
- }
- }()
- for i := 0; i < b.N; i++ {
- ca <- true
- <-cb
- }
-}
-func BenchmarkEndpointFastHashShort(b *testing.B) {
- e := Endpoint{typ: 1, len: 2}
- for i := 0; i < b.N; i++ {
- e.FastHash()
- }
-}
-func BenchmarkEndpointFastHashLong(b *testing.B) {
- e := Endpoint{typ: 1, len: 16}
- for i := 0; i < b.N; i++ {
- e.FastHash()
- }
-}
-func BenchmarkFlowFastHashShort(b *testing.B) {
- e := Flow{typ: 1, slen: 2, dlen: 2}
- for i := 0; i < b.N; i++ {
- e.FastHash()
- }
-}
-func BenchmarkFlowFastHashLong(b *testing.B) {
- e := Flow{typ: 1, slen: 16, dlen: 16}
- for i := 0; i < b.N; i++ {
- e.FastHash()
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/bytediff/bytediff_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/bytediff/bytediff_test.go
deleted file mode 100644
index 022ad4bc5ef..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/bytediff/bytediff_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package bytediff
-
-import (
- "reflect"
- "testing"
-)
-
-func TestLCS(t *testing.T) {
- for i, test := range []struct {
- a, b []byte
- indexA, indexB, length int
- }{
- {[]byte{1, 2, 3}, []byte{1, 2, 3}, 0, 0, 3},
- {[]byte{0, 1, 2, 3}, []byte{1, 2, 3, 4}, 1, 0, 3},
- {[]byte{0, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3}, []byte{1, 2, 3, 4}, 4, 0, 4},
- {[]byte{1, 2, 2, 3, 4}, []byte{1, 2, 3, 4}, 2, 1, 3},
- {[]byte{0, 1, 2, 3, 4}, []byte{1, 1, 2, 2, 3, 4}, 2, 3, 3},
- } {
- ia, ib, l := longestCommonSubstring(test.a, test.b)
- if ia != test.indexA || ib != test.indexB || l != test.length {
- t.Errorf("%d: want (%d %d %d) got (%d %d %d)", i, test.indexA, test.indexB, test.length, ia, ib, l)
- }
- }
-}
-
-func TestDiff(t *testing.T) {
- for i, test := range []struct {
- a, b []byte
- d Differences
- }{
- {
- []byte{0, 1, 2, 3, 4},
- []byte{1, 1, 2, 2, 3, 4},
- Differences{
- Difference{true, []byte{0}, []byte{}},
- Difference{false, []byte{1}, []byte{1}},
- Difference{true, []byte{}, []byte{1, 2}},
- Difference{false, []byte{2, 3, 4}, []byte{2, 3, 4}},
- },
- },
- } {
- diffs := Diff(test.a, test.b)
- if !reflect.DeepEqual(diffs, test.d) {
- t.Errorf("%d want %v got %v", i, test.d, diffs)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/ip4defrag/defrag_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/ip4defrag/defrag_test.go
deleted file mode 100644
index e121a44fede..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/ip4defrag/defrag_test.go
+++ /dev/null
@@ -1,1343 +0,0 @@
-// Copyright 2013 Google, Inc. All rights reserved.
-package ip4defrag
-
-import (
- "bytes"
- "fmt"
- "net"
- "testing"
-
- "github.com/google/gopacket"
- "github.com/google/gopacket/bytediff"
- "github.com/google/gopacket/layers"
-)
-
-func TestNotFrag(t *testing.T) {
- ip := layers.IPv4{
- Version: 4,
- TTL: 220,
- SrcIP: net.IPv4(1, 1, 1, 1),
- DstIP: net.IPv4(2, 2, 2, 2),
- Flags: layers.IPv4DontFragment,
- }
- defrag := NewIPv4Defragmenter()
-
- out, err := defrag.DefragIPv4(&ip)
- if out == nil || err != nil {
- t.Errorf("defrag: this packet do not need to be defrag ['%s']", err)
- }
-}
-
-func TestDefragPing1(t *testing.T) {
- defrag := NewIPv4Defragmenter()
-
- // We inject the 4 fragment and test the DefragIPv4 interface
- gentestDefrag(t, defrag, testPing1Frag1, false, "Ping1Frag1")
- gentestDefrag(t, defrag, testPing1Frag3, false, "Ping1Frag3")
- gentestDefrag(t, defrag, testPing1Frag2, false, "Ping1Frag2")
- ip := gentestDefrag(t, defrag, testPing1Frag4, true, "Ping1Frag4")
-
- if len(ip.Payload) != 4508 {
- t.Fatalf("defrag: expecting a packet of 4508 bytes, got %d", len(ip.Payload))
- }
-
- validPayload := append(testPing1Frag1[34:], testPing1Frag2[34:]...)
- validPayload = append(validPayload, testPing1Frag3[34:]...)
- validPayload = append(validPayload, testPing1Frag4[34:]...)
-
- if bytes.Compare(validPayload, ip.Payload) != 0 {
- fmt.Println(bytediff.BashOutput.String(
- bytediff.Diff(validPayload, ip.Payload)))
- t.Errorf("defrag: payload is not correctly defragmented")
- }
-}
-
-func TestDefragPing1and2(t *testing.T) {
- debug = false
- defrag := NewIPv4Defragmenter()
-
- // We inject the 8 mixed fragments from two "flows"
- // and test the DefragIPv4 interface
- gentestDefrag(t, defrag, testPing1Frag1, false, "Ping1Frag1")
- gentestDefrag(t, defrag, testPing1Frag3, false, "Ping1Frag3")
- gentestDefrag(t, defrag, testPing2Frag3, false, "Ping2Frag3")
- gentestDefrag(t, defrag, testPing2Frag4, false, "Ping2Frag4")
- gentestDefrag(t, defrag, testPing1Frag2, false, "Ping1Frag2")
- gentestDefrag(t, defrag, testPing2Frag1, false, "Ping2Frag1")
- ip := gentestDefrag(t, defrag, testPing1Frag4, true, "Ping1Frag4")
-
- if len(ip.Payload) != 4508 {
- t.Fatalf("defrag: expecting a packet Ping1 of 4508 bytes, got %d",
- len(ip.Payload))
- }
-
- validPayload := append(testPing1Frag1[34:], testPing1Frag2[34:]...)
- validPayload = append(validPayload, testPing1Frag3[34:]...)
- validPayload = append(validPayload, testPing1Frag4[34:]...)
-
- if bytes.Compare(validPayload, ip.Payload) != 0 {
- fmt.Println(bytediff.BashOutput.String(
- bytediff.Diff(validPayload, ip.Payload)))
- t.Errorf("defrag: payload Ping1 is not correctly defragmented")
- }
-
- ip = gentestDefrag(t, defrag, testPing2Frag2, true, "Ping2Frag2")
- if len(ip.Payload) != 4508 {
- t.Fatalf("defrag: expecting a packet Ping2 of 4508 bytes, got %d",
- len(ip.Payload))
- }
-
- validPayload2 := append(testPing2Frag1[34:], testPing2Frag2[34:]...)
- validPayload2 = append(validPayload2, testPing2Frag3[34:]...)
- validPayload2 = append(validPayload2, testPing2Frag4[34:]...)
-
- if bytes.Compare(validPayload2, ip.Payload) != 0 {
- fmt.Println(bytediff.BashOutput.String(
- bytediff.Diff(validPayload2, ip.Payload)))
- t.Errorf("defrag: payload Ping2 is not correctly defragmented")
- }
- debug = false
-}
-
-func TestDefragPingTooMuch(t *testing.T) {
- defrag := NewIPv4Defragmenter()
-
- // We inject the 7 fragments, and expect to hit an error at the
- // 8th fragment
- gentestDefrag(t, defrag, testPing1Frag1, false, "Ping1Frag1")
- gentestDefrag(t, defrag, testPing1Frag2, false, "Ping1Frag2")
- gentestDefrag(t, defrag, testPing1Frag1, false, "Ping1Frag1")
- gentestDefrag(t, defrag, testPing1Frag2, false, "Ping1Frag2")
- gentestDefrag(t, defrag, testPing1Frag1, false, "Ping1Frag1")
- gentestDefrag(t, defrag, testPing1Frag2, false, "Ping1Frag2")
- gentestDefrag(t, defrag, testPing1Frag1, false, "Ping1Frag1")
-
- p := gopacket.NewPacket(testPing1Frag1, layers.LinkTypeEthernet,
- gopacket.Default)
- ip, _ := p.Layer(layers.LayerTypeIPv4).(*layers.IPv4)
-
- _, err := defrag.DefragIPv4(ip)
- if err == nil {
- t.Fatalf("defrag: Maximum number of fragments are supposed to be 8")
- }
-}
-
-func gentestDefrag(t *testing.T, defrag *IPv4Defragmenter, buf []byte, expect bool, label string) *layers.IPv4 {
- p := gopacket.NewPacket(buf, layers.LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- ipL := p.Layer(layers.LayerTypeIPv4)
- in, _ := ipL.(*layers.IPv4)
-
- out, err := defrag.DefragIPv4(in)
- if err != nil {
- t.Fatalf("defrag: %s", err)
- }
- status := false
- if out != nil {
- status = true
- }
- if status != expect {
- t.Fatalf("defrag: a fragment was not detected (%s)", label)
- }
- return out
-}
-
-/* Frame 1-1 (1514 bytes) */
-var testPing1Frag1 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x05, 0xdc, 0xb3, 0xe1, 0x20, 0x00, 0x40, 0x01, /* .... .@. */
- 0xcf, 0x70, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* .p...... */
- 0x08, 0x08, 0x08, 0x00, 0x45, 0xa6, 0x14, 0xbf, /* ....E... */
- 0x00, 0x01, 0x9e, 0x3e, 0x20, 0x55, 0x00, 0x00, /* ...> U.. */
- 0x00, 0x00, 0x16, 0x91, 0x0d, 0x00, 0x00, 0x00, /* ........ */
- 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, /* .. */
-}
-
-/* Frame (1514 bytes) */
-var testPing1Frag2 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x05, 0xdc, 0xb3, 0xe1, 0x20, 0xb9, 0x40, 0x01, /* .... .@. */
- 0xce, 0xb7, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* ........ */
- 0x08, 0x08, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, /* .. */
-}
-
-/* Frame (1514 bytes) */
-var testPing1Frag3 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x05, 0xdc, 0xb3, 0xe1, 0x21, 0x72, 0x40, 0x01, /* ....!r@. */
- 0xcd, 0xfe, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* ........ */
- 0x08, 0x08, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, /* NO */
-}
-
-/* Frame (102 bytes) */
-var testPing1Frag4 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x00, 0x58, 0xb3, 0xe1, 0x02, 0x2b, 0x40, 0x01, /* .X...+@. */
- 0xf2, 0xc9, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* ........ */
- 0x08, 0x08, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* ..PQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, /* ...... */
-}
-
-/* Frame (1514 bytes) */
-var testPing2Frag1 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x05, 0xdc, 0xb4, 0x9e, 0x20, 0x00, 0x40, 0x01, /* .... .@. */
- 0xce, 0xb3, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* ........ */
- 0x08, 0x08, 0x08, 0x00, 0x9e, 0xa0, 0x14, 0xbf, /* ........ */
- 0x00, 0x02, 0x9f, 0x3e, 0x20, 0x55, 0x00, 0x00, /* ...> U.. */
- 0x00, 0x00, 0xbc, 0x95, 0x0d, 0x00, 0x00, 0x00, /* ........ */
- 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, /* .. */
-}
-
-/* Frame (1514 bytes) */
-var testPing2Frag2 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x05, 0xdc, 0xb4, 0x9e, 0x20, 0xb9, 0x40, 0x01, /* .... .@. */
- 0xcd, 0xfa, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* ........ */
- 0x08, 0x08, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, /* .. */
-}
-
-/* Frame (1514 bytes) */
-var testPing2Frag3 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x05, 0xdc, 0xb4, 0x9e, 0x21, 0x72, 0x40, 0x01, /* ....!r@. */
- 0xcd, 0x41, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* .A...... */
- 0x08, 0x08, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* NOPQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, /* ........ */
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, /* ........ */
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, /* ........ */
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, /* ........ */
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, /* ........ */
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, /* ........ */
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, /* ........ */
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, /* ........ */
- 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, /* ........ */
- 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, /* ........ */
- 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, /* ........ */
- 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, /* ........ */
- 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, /* ........ */
- 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, /* ........ */
- 0xfe, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* ........ */
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, /* ........ */
- 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* ........ */
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, /* ........ */
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, /* .. !"#$% */
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, /* &'()*+,- */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, /* ./012345 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, /* 6789:;<= */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, /* >?@ABCDE */
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, /* FGHIJKLM */
- 0x4e, 0x4f, /* NO */
-}
-
-/* Frame (102 bytes) */
-var testPing2Frag4 = []byte{
- 0xf4, 0xca, 0xe5, 0x4e, 0xe1, 0x46, 0x7c, 0x7a, /* ...N.F|z */
- 0x91, 0x7d, 0x7c, 0x74, 0x08, 0x00, 0x45, 0x00, /* .}|t..E. */
- 0x00, 0x58, 0xb4, 0x9e, 0x02, 0x2b, 0x40, 0x01, /* .X...+@. */
- 0xf2, 0x0c, 0xc0, 0xa8, 0x01, 0x17, 0x08, 0x08, /* ........ */
- 0x08, 0x08, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, /* ..PQRSTU */
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, /* VWXYZ[\] */
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, /* ^_`abcde */
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, /* fghijklm */
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, /* nopqrstu */
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, /* vwxyz{|} */
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, /* ~....... */
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, /* ........ */
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, /* ...... */
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/base_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/base_test.go
deleted file mode 100644
index 4be7480bc24..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/base_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-// This file contains some test helper functions.
-
-package layers
-
-import (
- "github.com/google/gopacket"
- "testing"
-)
-
-func min(a, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-func checkLayers(p gopacket.Packet, want []gopacket.LayerType, t *testing.T) {
- layers := p.Layers()
- t.Log("Checking packet layers, want", want)
- for _, l := range layers {
- t.Logf(" Got layer %v, %d bytes, payload of %d bytes", l.LayerType(),
- len(l.LayerContents()), len(l.LayerPayload()))
- }
- t.Log(p)
- if len(layers) != len(want) {
- t.Errorf(" Number of layers mismatch: got %d want %d", len(layers),
- len(want))
- return
- }
- for i, l := range layers {
- if l.LayerType() != want[i] {
- t.Errorf(" Layer %d mismatch: got %v want %v", i, l.LayerType(),
- want[i])
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/decode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/decode_test.go
deleted file mode 100644
index 396e08d9610..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/decode_test.go
+++ /dev/null
@@ -1,1272 +0,0 @@
-// Copyright 2012, Google, Inc. All rights reserved.
-// Copyright 2009-2011 Andreas Krennmair. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "github.com/google/gopacket"
- "github.com/google/gopacket/bytediff"
- "net"
- "reflect"
- "strings"
- "testing"
-)
-
-var testSimpleTCPPacket []byte = []byte{
- 0x00, 0x00, 0x0c, 0x9f, 0xf0, 0x20, 0xbc, 0x30, 0x5b, 0xe8, 0xd3, 0x49,
- 0x08, 0x00, 0x45, 0x00, 0x01, 0xa4, 0x39, 0xdf, 0x40, 0x00, 0x40, 0x06,
- 0x55, 0x5a, 0xac, 0x11, 0x51, 0x49, 0xad, 0xde, 0xfe, 0xe1, 0xc5, 0xf7,
- 0x00, 0x50, 0xc5, 0x7e, 0x0e, 0x48, 0x49, 0x07, 0x42, 0x32, 0x80, 0x18,
- 0x00, 0x73, 0x9a, 0x8f, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x03, 0x77,
- 0x37, 0x9c, 0x42, 0x77, 0x5e, 0x3a, 0x47, 0x45, 0x54, 0x20, 0x2f, 0x20,
- 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x48, 0x6f,
- 0x73, 0x74, 0x3a, 0x20, 0x77, 0x77, 0x77, 0x2e, 0x66, 0x69, 0x73, 0x68,
- 0x2e, 0x63, 0x6f, 0x6d, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x6b, 0x65, 0x65, 0x70, 0x2d, 0x61,
- 0x6c, 0x69, 0x76, 0x65, 0x0d, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41,
- 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c,
- 0x61, 0x2f, 0x35, 0x2e, 0x30, 0x20, 0x28, 0x58, 0x31, 0x31, 0x3b, 0x20,
- 0x4c, 0x69, 0x6e, 0x75, 0x78, 0x20, 0x78, 0x38, 0x36, 0x5f, 0x36, 0x34,
- 0x29, 0x20, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x57, 0x65, 0x62, 0x4b, 0x69,
- 0x74, 0x2f, 0x35, 0x33, 0x35, 0x2e, 0x32, 0x20, 0x28, 0x4b, 0x48, 0x54,
- 0x4d, 0x4c, 0x2c, 0x20, 0x6c, 0x69, 0x6b, 0x65, 0x20, 0x47, 0x65, 0x63,
- 0x6b, 0x6f, 0x29, 0x20, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x2f, 0x31,
- 0x35, 0x2e, 0x30, 0x2e, 0x38, 0x37, 0x34, 0x2e, 0x31, 0x32, 0x31, 0x20,
- 0x53, 0x61, 0x66, 0x61, 0x72, 0x69, 0x2f, 0x35, 0x33, 0x35, 0x2e, 0x32,
- 0x0d, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x3a, 0x20, 0x74, 0x65,
- 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c,
- 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x68, 0x74, 0x6d,
- 0x6c, 0x2b, 0x78, 0x6d, 0x6c, 0x2c, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63,
- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x78, 0x6d, 0x6c, 0x3b, 0x71, 0x3d,
- 0x30, 0x2e, 0x39, 0x2c, 0x2a, 0x2f, 0x2a, 0x3b, 0x71, 0x3d, 0x30, 0x2e,
- 0x38, 0x0d, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x45, 0x6e,
- 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3a, 0x20, 0x67, 0x7a, 0x69, 0x70,
- 0x2c, 0x64, 0x65, 0x66, 0x6c, 0x61, 0x74, 0x65, 0x2c, 0x73, 0x64, 0x63,
- 0x68, 0x0d, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x4c, 0x61,
- 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a, 0x20, 0x65, 0x6e, 0x2d, 0x55,
- 0x53, 0x2c, 0x65, 0x6e, 0x3b, 0x71, 0x3d, 0x30, 0x2e, 0x38, 0x0d, 0x0a,
- 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2d, 0x43, 0x68, 0x61, 0x72, 0x73,
- 0x65, 0x74, 0x3a, 0x20, 0x49, 0x53, 0x4f, 0x2d, 0x38, 0x38, 0x35, 0x39,
- 0x2d, 0x31, 0x2c, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x3b, 0x71, 0x3d, 0x30,
- 0x2e, 0x37, 0x2c, 0x2a, 0x3b, 0x71, 0x3d, 0x30, 0x2e, 0x33, 0x0d, 0x0a,
- 0x0d, 0x0a,
-}
-
-var testDecodeOptions = gopacket.DecodeOptions{
- SkipDecodeRecovery: true,
-}
-
-// Benchmarks for actual gopacket code
-
-func BenchmarkLayerClassSliceContains(b *testing.B) {
- lc := gopacket.NewLayerClassSlice([]gopacket.LayerType{LayerTypeTCP, LayerTypeEthernet})
- for i := 0; i < b.N; i++ {
- _ = lc.Contains(LayerTypeTCP)
- }
-}
-
-func BenchmarkLayerClassMapContains(b *testing.B) {
- lc := gopacket.NewLayerClassMap([]gopacket.LayerType{LayerTypeTCP, LayerTypeEthernet})
- for i := 0; i < b.N; i++ {
- _ = lc.Contains(LayerTypeTCP)
- }
-}
-
-func BenchmarkLazyNoCopyEthLayer(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true}).Layer(LayerTypeEthernet)
- }
-}
-
-func BenchmarkLazyNoCopyIPLayer(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true}).Layer(LayerTypeIPv4)
- }
-}
-
-func BenchmarkLazyNoCopyTCPLayer(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true}).Layer(LayerTypeTCP)
- }
-}
-
-func BenchmarkLazyNoCopyAllLayers(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true}).Layers()
- }
-}
-
-func BenchmarkDefault(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.Default)
- }
-}
-
-func getSerializeLayers() []gopacket.SerializableLayer {
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- slayers := []gopacket.SerializableLayer{}
- for _, l := range p.Layers() {
- slayers = append(slayers, l.(gopacket.SerializableLayer))
- }
- p.Layer(LayerTypeTCP).(*TCP).SetNetworkLayerForChecksum(
- p.NetworkLayer())
- return slayers
-}
-
-func BenchmarkSerializeTcpNoOptions(b *testing.B) {
- slayers := getSerializeLayers()
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{}
- for i := 0; i < b.N; i++ {
- gopacket.SerializeLayers(buf, opts, slayers...)
- }
-}
-
-func BenchmarkSerializeTcpFixLengths(b *testing.B) {
- slayers := getSerializeLayers()
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true}
- for i := 0; i < b.N; i++ {
- gopacket.SerializeLayers(buf, opts, slayers...)
- }
-}
-
-func BenchmarkSerializeTcpComputeChecksums(b *testing.B) {
- slayers := getSerializeLayers()
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{ComputeChecksums: true}
- for i := 0; i < b.N; i++ {
- gopacket.SerializeLayers(buf, opts, slayers...)
- }
-}
-
-func BenchmarkSerializeTcpFixLengthsComputeChecksums(b *testing.B) {
- slayers := getSerializeLayers()
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true}
- for i := 0; i < b.N; i++ {
- gopacket.SerializeLayers(buf, opts, slayers...)
- }
-}
-
-func BenchmarkLazy(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.Lazy)
- }
-}
-
-func BenchmarkNoCopy(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-func BenchmarkLazyNoCopy(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true})
- }
-}
-
-func BenchmarkKnownStack(b *testing.B) {
- stack := []gopacket.DecodingLayer{&Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{}}
- var nf gopacket.DecodeFeedback = gopacket.NilDecodeFeedback
- for i := 0; i < b.N; i++ {
- data := testSimpleTCPPacket[:]
- for _, d := range stack {
- _ = d.DecodeFromBytes(data, nf)
- data = d.LayerPayload()
- }
- }
-}
-
-func BenchmarkDecodingLayerParserIgnorePanic(b *testing.B) {
- decoded := make([]gopacket.LayerType, 0, 20)
- dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet, &Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{})
- dlp.IgnorePanic = true
- for i := 0; i < b.N; i++ {
- dlp.DecodeLayers(testSimpleTCPPacket, &decoded)
- }
-}
-
-func BenchmarkDecodingLayerParserHandlePanic(b *testing.B) {
- decoded := make([]gopacket.LayerType, 0, 20)
- dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet, &Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{})
- dlp.IgnorePanic = false
- for i := 0; i < b.N; i++ {
- dlp.DecodeLayers(testSimpleTCPPacket, &decoded)
- }
-}
-
-func BenchmarkAlloc(b *testing.B) {
- for i := 0; i < b.N; i++ {
- _ = &TCP{}
- }
-}
-
-func BenchmarkFlow(b *testing.B) {
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true})
- net := p.NetworkLayer()
- for i := 0; i < b.N; i++ {
- net.NetworkFlow()
- }
-}
-
-func BenchmarkEndpoints(b *testing.B) {
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true})
- flow := p.NetworkLayer().NetworkFlow()
- for i := 0; i < b.N; i++ {
- flow.Endpoints()
- }
-}
-
-func BenchmarkTCPLayerFromDecodedPacket(b *testing.B) {
- b.StopTimer()
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- _ = p.Layer(LayerTypeTCP)
- }
-}
-
-func BenchmarkTCPLayerClassFromDecodedPacket(b *testing.B) {
- b.StopTimer()
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- lc := gopacket.NewLayerClass([]gopacket.LayerType{LayerTypeTCP})
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- _ = p.LayerClass(lc)
- }
-}
-
-func BenchmarkTCPTransportLayerFromDecodedPacket(b *testing.B) {
- b.StopTimer()
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- _ = p.TransportLayer()
- }
-}
-
-func testDecoder([]byte, gopacket.PacketBuilder) error {
- return nil
-}
-
-func BenchmarkDecodeFuncCallOverheadDirectCall(b *testing.B) {
- var data []byte
- var pb gopacket.PacketBuilder
- for i := 0; i < b.N; i++ {
- _ = testDecoder(data, pb)
- }
-}
-
-func BenchmarkDecodeFuncCallOverheadDecoderCall(b *testing.B) {
- d := gopacket.DecodeFunc(testDecoder)
- var data []byte
- var pb gopacket.PacketBuilder
- for i := 0; i < b.N; i++ {
- _ = d.Decode(data, pb)
- }
-}
-
-func BenchmarkDecodeFuncCallOverheadArrayCall(b *testing.B) {
- EthernetTypeMetadata[1] = EnumMetadata{DecodeWith: gopacket.DecodeFunc(testDecoder)}
- d := EthernetType(1)
- var data []byte
- var pb gopacket.PacketBuilder
- for i := 0; i < b.N; i++ {
- _ = d.Decode(data, pb)
- }
-}
-
-func BenchmarkFmtVerboseString(b *testing.B) {
- b.StopTimer()
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- fmt.Sprintf("%#v", p)
- }
-}
-
-func BenchmarkPacketString(b *testing.B) {
- b.StopTimer()
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- p.String()
- }
-}
-
-func BenchmarkPacketDumpString(b *testing.B) {
- b.StopTimer()
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, testDecodeOptions)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- p.String()
- }
-}
-
-// TestFlowMapKey makes sure a flow and an endpoint can be used as map keys.
-func TestFlowMapKey(t *testing.T) {
- _ = map[gopacket.Flow]bool{}
- _ = map[gopacket.Endpoint]bool{}
- _ = map[[2]gopacket.Flow]bool{}
-}
-
-func TestDecodeSimpleTCPPacket(t *testing.T) {
- equal := func(desc, want string, got fmt.Stringer) {
- if want != got.String() {
- t.Errorf("%s: got %q want %q", desc, got.String(), want)
- }
- }
- p := gopacket.NewPacket(testSimpleTCPPacket, LinkTypeEthernet, gopacket.DecodeOptions{Lazy: true, NoCopy: true})
- if eth := p.LinkLayer(); eth == nil {
- t.Error("No ethernet layer found")
- } else {
- equal("Eth Src", "bc:30:5b:e8:d3:49", eth.LinkFlow().Src())
- equal("Eth Dst", "00:00:0c:9f:f0:20", eth.LinkFlow().Dst())
- }
- if net := p.NetworkLayer(); net == nil {
- t.Error("No net layer found")
- } else if ip, ok := net.(*IPv4); !ok {
- t.Error("Net layer is not IP layer")
- } else {
- equal("IP Src", "172.17.81.73", net.NetworkFlow().Src())
- equal("IP Dst", "173.222.254.225", net.NetworkFlow().Dst())
- want := &IPv4{
- BaseLayer: BaseLayer{testSimpleTCPPacket[14:34], testSimpleTCPPacket[34:]},
- Version: 4,
- IHL: 5,
- TOS: 0,
- Length: 420,
- Id: 14815,
- Flags: 0x02,
- FragOffset: 0,
- TTL: 64,
- Protocol: 6,
- Checksum: 0x555A,
- SrcIP: []byte{172, 17, 81, 73},
- DstIP: []byte{173, 222, 254, 225},
- }
- if !reflect.DeepEqual(ip, want) {
- t.Errorf("IP layer mismatch, \ngot %#v\nwant %#v\n", ip, want)
- }
- }
- if trans := p.TransportLayer(); trans == nil {
- t.Error("No transport layer found")
- } else if tcp, ok := trans.(*TCP); !ok {
- t.Error("Transport layer is not TCP layer")
- } else {
- equal("TCP Src", "50679", trans.TransportFlow().Src())
- equal("TCP Dst", "80", trans.TransportFlow().Dst())
- want := &TCP{
- BaseLayer: BaseLayer{testSimpleTCPPacket[34:66], testSimpleTCPPacket[66:]},
- SrcPort: 50679,
- DstPort: 80,
- Seq: 0xc57e0e48,
- Ack: 0x49074232,
- DataOffset: 8,
- ACK: true,
- PSH: true,
- Window: 0x73,
- Checksum: 0x9a8f,
- Urgent: 0,
- sPort: []byte{0xc5, 0xf7},
- dPort: []byte{0x0, 0x50},
- Options: []TCPOption{
- TCPOption{
- OptionType: 0x1,
- OptionLength: 0x1,
- },
- TCPOption{
- OptionType: 0x1,
- OptionLength: 0x1,
- },
- TCPOption{
- OptionType: 0x8,
- OptionLength: 0xa,
- OptionData: []byte{0x3, 0x77, 0x37, 0x9c, 0x42, 0x77, 0x5e, 0x3a},
- },
- },
- opts: [4]TCPOption{
- TCPOption{
- OptionType: 0x1,
- OptionLength: 0x1,
- },
- TCPOption{
- OptionType: 0x1,
- OptionLength: 0x1,
- },
- TCPOption{
- OptionType: 0x8,
- OptionLength: 0xa,
- OptionData: []byte{0x3, 0x77, 0x37, 0x9c, 0x42, 0x77, 0x5e, 0x3a},
- },
- TCPOption{},
- },
- }
- if !reflect.DeepEqual(tcp, want) {
- t.Errorf("TCP layer mismatch\ngot %#v\nwant %#v", tcp, want)
- }
- }
- if payload, ok := p.Layer(gopacket.LayerTypePayload).(*gopacket.Payload); payload == nil || !ok {
- t.Error("No payload layer found")
- } else {
- if string(payload.Payload()) != "GET / HTTP/1.1\r\nHost: www.fish.com\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Encoding: gzip,deflate,sdch\r\nAccept-Language: en-US,en;q=0.8\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n\r\n" {
- t.Error("--- Payload STRING ---\n", string(payload.Payload()), "\n--- Payload BYTES ---\n", payload.Payload())
- }
- }
-
- // Test re-serialization.
- testSerialization(t, p, testSimpleTCPPacket)
-}
-
-type canSetNetLayer interface {
- SetNetworkLayerForChecksum(gopacket.NetworkLayer) error
-}
-
-func testSerialization(t *testing.T, p gopacket.Packet, data []byte) {
- for _, opts := range []gopacket.SerializeOptions{
- gopacket.SerializeOptions{},
- gopacket.SerializeOptions{FixLengths: true},
- gopacket.SerializeOptions{ComputeChecksums: true},
- gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true},
- } {
- testSerializationWithOpts(t, p, data, opts)
- }
-}
-
-func testSerializationWithOpts(t *testing.T, p gopacket.Packet, data []byte, opts gopacket.SerializeOptions) {
- // Test re-serialization.
- slayers := []gopacket.SerializableLayer{}
- for _, l := range p.Layers() {
- slayers = append(slayers, l.(gopacket.SerializableLayer))
- if h, ok := l.(canSetNetLayer); ok {
- if err := h.SetNetworkLayerForChecksum(p.NetworkLayer()); err != nil {
- t.Fatal("can't set network layer:", err)
- }
- }
- }
- buf := gopacket.NewSerializeBuffer()
- err := gopacket.SerializeLayers(buf, opts, slayers...)
- if err != nil {
- t.Errorf("unable to reserialize layers with opts %#v: %v", opts, err)
- } else if !bytes.Equal(buf.Bytes(), data) {
- t.Errorf("serialization failure with opts %#v:\n---want---\n%v\n---got---\n%v\nBASH-colorized diff, want->got:\n%v\n\n---PACKET---\n%v",
- opts, hex.Dump(data), hex.Dump(buf.Bytes()), bytediff.BashOutput.String(bytediff.Diff(data, buf.Bytes())), p)
- }
-}
-
-// Makes sure packet payload doesn't display the 6 trailing null of this packet
-// as part of the payload. They're actually the ethernet trailer.
-func TestDecodeSmallTCPPacketHasEmptyPayload(t *testing.T) {
- smallPacket := []byte{
- 0xbc, 0x30, 0x5b, 0xe8, 0xd3, 0x49, 0xb8, 0xac, 0x6f, 0x92, 0xd5, 0xbf,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x28, 0x00, 0x00, 0x40, 0x00, 0x40, 0x06,
- 0x3f, 0x9f, 0xac, 0x11, 0x51, 0xc5, 0xac, 0x11, 0x51, 0x49, 0x00, 0x63,
- 0x9a, 0xef, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xc1, 0x27, 0x83, 0x50, 0x14,
- 0x00, 0x00, 0xc3, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- }
- p := gopacket.NewPacket(smallPacket, LinkTypeEthernet, testDecodeOptions)
-
- if payload := p.Layer(gopacket.LayerTypePayload); payload != nil {
- t.Error("Payload found for empty TCP packet")
- }
-
- testSerialization(t, p, smallPacket)
-}
-
-func TestDecodeVLANPacket(t *testing.T) {
- p := gopacket.NewPacket(
- []byte{
- 0x00, 0x10, 0xdb, 0xff, 0x10, 0x00, 0x00, 0x15, 0x2c, 0x9d, 0xcc, 0x00,
- 0x81, 0x00, 0x01, 0xf7, 0x08, 0x00, 0x45, 0x00, 0x00, 0x28, 0x29, 0x8d,
- 0x40, 0x00, 0x7d, 0x06, 0x83, 0xa0, 0xac, 0x1b, 0xca, 0x8e, 0x45, 0x16,
- 0x94, 0xe2, 0xd4, 0x0a, 0x00, 0x50, 0xdf, 0xab, 0x9c, 0xc6, 0xcd, 0x1e,
- 0xe5, 0xd1, 0x50, 0x10, 0x01, 0x00, 0x5a, 0x74, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- }, LinkTypeEthernet, testDecodeOptions)
- if err := p.ErrorLayer(); err != nil {
- t.Error("Error while parsing vlan packet:", err)
- }
- if vlan := p.Layer(LayerTypeDot1Q); vlan == nil {
- t.Error("Didn't detect vlan")
- } else if _, ok := vlan.(*Dot1Q); !ok {
- t.Error("LayerTypeDot1Q layer is not a Dot1Q object")
- }
- for i, l := range p.Layers() {
- t.Logf("Layer %d: %#v", i, l)
- }
- want := []gopacket.LayerType{LayerTypeEthernet, LayerTypeDot1Q, LayerTypeIPv4, LayerTypeTCP}
- checkLayers(p, want, t)
-}
-
-func TestDecodeSCTPPackets(t *testing.T) {
- sctpPackets := [][]byte{
- []byte{ // INIT
- 0x00, 0x00, 0x0c, 0x9f, 0xf0, 0x1f, 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x08, 0x00, 0x45, 0x02,
- 0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0xc4, 0x22, 0xac, 0x1d, 0x14, 0x0f, 0xac, 0x19,
- 0x09, 0xcc, 0x27, 0x0f, 0x22, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x19, 0x6b, 0x0b, 0x40, 0x01, 0x00,
- 0x00, 0x24, 0xb6, 0x96, 0xb0, 0x9e, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x0a, 0xff, 0xff, 0xdb, 0x85,
- 0x60, 0x23, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0xc0, 0x00,
- 0x00, 0x04,
- }, []byte{ // INIT ACK
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x76, 0x40, 0x08, 0x00, 0x45, 0x20,
- 0x01, 0x24, 0x00, 0x00, 0x40, 0x00, 0x36, 0x84, 0xcd, 0x24, 0xac, 0x19, 0x09, 0xcc, 0xac, 0x1d,
- 0x14, 0x0f, 0x22, 0xb8, 0x27, 0x0f, 0xb6, 0x96, 0xb0, 0x9e, 0x4b, 0xab, 0x40, 0x9a, 0x02, 0x00,
- 0x01, 0x04, 0x32, 0x80, 0xfb, 0x42, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x85, 0x98,
- 0xb1, 0x26, 0x00, 0x07, 0x00, 0xe8, 0xd3, 0x08, 0xce, 0xe2, 0x52, 0x95, 0xcc, 0x09, 0xa1, 0x4c,
- 0x6f, 0xa7, 0x9e, 0xba, 0x03, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xfb, 0x80, 0x32, 0x9e, 0xb0,
- 0x96, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x46, 0xc2, 0x50, 0x00, 0x00,
- 0x00, 0x00, 0x5e, 0x25, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x26, 0xb1,
- 0x98, 0x85, 0x02, 0x00, 0x27, 0x0f, 0xac, 0x1d, 0x14, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x22,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x24, 0x6a, 0x72, 0x5c, 0x1c, 0x3c, 0xaa,
- 0x7a, 0xcd, 0xd3, 0x8f, 0x52, 0x78, 0x7c, 0x77, 0xfd, 0x46, 0xbd, 0x72, 0x82, 0xc1, 0x1f, 0x70,
- 0x44, 0xcc, 0xc7, 0x9b, 0x9b, 0x7b, 0x13, 0x54, 0x3f, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x24, 0xb6, 0x96,
- 0xb0, 0x9e, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x0a, 0xff, 0xff, 0xdb, 0x85, 0x60, 0x23, 0x00, 0x0c,
- 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0xc0, 0x00, 0x00, 0x04, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0xc0, 0x00,
- 0x00, 0x04,
- }, []byte{ // COOKIE ECHO, DATA
- 0x00, 0x00, 0x0c, 0x9f, 0xf0, 0x1f, 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x08, 0x00, 0x45, 0x02,
- 0x01, 0x20, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0xc3, 0x46, 0xac, 0x1d, 0x14, 0x0f, 0xac, 0x19,
- 0x09, 0xcc, 0x27, 0x0f, 0x22, 0xb8, 0x32, 0x80, 0xfb, 0x42, 0x01, 0xf9, 0xf3, 0xa9, 0x0a, 0x00,
- 0x00, 0xe8, 0xd3, 0x08, 0xce, 0xe2, 0x52, 0x95, 0xcc, 0x09, 0xa1, 0x4c, 0x6f, 0xa7, 0x9e, 0xba,
- 0x03, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xfb, 0x80, 0x32, 0x9e, 0xb0, 0x96, 0xb6, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x46, 0xc2, 0x50, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x25,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x26, 0xb1, 0x98, 0x85, 0x02, 0x00,
- 0x27, 0x0f, 0xac, 0x1d, 0x14, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x22, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x80, 0x02, 0x00, 0x24, 0x6a, 0x72, 0x5c, 0x1c, 0x3c, 0xaa, 0x7a, 0xcd, 0xd3, 0x8f,
- 0x52, 0x78, 0x7c, 0x77, 0xfd, 0x46, 0xbd, 0x72, 0x82, 0xc1, 0x1f, 0x70, 0x44, 0xcc, 0xc7, 0x9b,
- 0x9b, 0x7b, 0x13, 0x54, 0x3f, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x24, 0xb6, 0x96, 0xb0, 0x9e, 0x00, 0x01,
- 0xc0, 0x00, 0x00, 0x0a, 0xff, 0xff, 0xdb, 0x85, 0x60, 0x23, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x05,
- 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0xc0, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x16, 0xdb, 0x85, 0x60, 0x23, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x21, 0x0a, 0x00, 0x00, 0x00,
- }, []byte{ // COOKIE ACK, SACK
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x76, 0x40, 0x08, 0x00, 0x45, 0x20,
- 0x00, 0x34, 0x00, 0x00, 0x40, 0x00, 0x36, 0x84, 0xce, 0x14, 0xac, 0x19, 0x09, 0xcc, 0xac, 0x1d,
- 0x14, 0x0f, 0x22, 0xb8, 0x27, 0x0f, 0xb6, 0x96, 0xb0, 0x9e, 0xed, 0x64, 0x30, 0x98, 0x0b, 0x00,
- 0x00, 0x04, 0x03, 0x00, 0x00, 0x10, 0xdb, 0x85, 0x60, 0x23, 0x00, 0x00, 0xf3, 0xfa, 0x00, 0x00,
- 0x00, 0x00,
- }, []byte{ // DATA
- 0x00, 0x00, 0x0c, 0x9f, 0xf0, 0x1f, 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x08, 0x00, 0x45, 0x02,
- 0x00, 0x3c, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0xc4, 0x2a, 0xac, 0x1d, 0x14, 0x0f, 0xac, 0x19,
- 0x09, 0xcc, 0x27, 0x0f, 0x22, 0xb8, 0x32, 0x80, 0xfb, 0x42, 0xa1, 0xe3, 0xb2, 0x31, 0x00, 0x03,
- 0x00, 0x19, 0xdb, 0x85, 0x60, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x62, 0x69,
- 0x7a, 0x7a, 0x6c, 0x65, 0x21, 0x0a, 0x00, 0x00, 0x00, 0x00,
- }, []byte{ // SACK
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x76, 0x40, 0x08, 0x00, 0x45, 0x20,
- 0x00, 0x30, 0x00, 0x00, 0x40, 0x00, 0x36, 0x84, 0xce, 0x18, 0xac, 0x19, 0x09, 0xcc, 0xac, 0x1d,
- 0x14, 0x0f, 0x22, 0xb8, 0x27, 0x0f, 0xb6, 0x96, 0xb0, 0x9e, 0xfa, 0x49, 0x94, 0x3a, 0x03, 0x00,
- 0x00, 0x10, 0xdb, 0x85, 0x60, 0x24, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00,
- }, []byte{ // SHUTDOWN
- 0x00, 0x00, 0x0c, 0x9f, 0xf0, 0x1f, 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x08, 0x00, 0x45, 0x02,
- 0x00, 0x28, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0xc4, 0x3e, 0xac, 0x1d, 0x14, 0x0f, 0xac, 0x19,
- 0x09, 0xcc, 0x27, 0x0f, 0x22, 0xb8, 0x32, 0x80, 0xfb, 0x42, 0x3f, 0x29, 0x59, 0x23, 0x07, 0x00,
- 0x00, 0x08, 0x85, 0x98, 0xb1, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- }, []byte{ // SHUTDOWN ACK
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x76, 0x40, 0x08, 0x00, 0x45, 0x20,
- 0x00, 0x24, 0x00, 0x00, 0x40, 0x00, 0x36, 0x84, 0xce, 0x24, 0xac, 0x19, 0x09, 0xcc, 0xac, 0x1d,
- 0x14, 0x0f, 0x22, 0xb8, 0x27, 0x0f, 0xb6, 0x96, 0xb0, 0x9e, 0xb2, 0xc8, 0x99, 0x24, 0x08, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- }, []byte{ // SHUTDOWN COMPLETE
- 0x00, 0x00, 0x0c, 0x9f, 0xf0, 0x1f, 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x08, 0x00, 0x45, 0x02,
- 0x00, 0x24, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84, 0xc4, 0x42, 0xac, 0x1d, 0x14, 0x0f, 0xac, 0x19,
- 0x09, 0xcc, 0x27, 0x0f, 0x22, 0xb8, 0x32, 0x80, 0xfb, 0x42, 0xa8, 0xd1, 0x86, 0x85, 0x0e, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- }}
- wantLayers := [][]gopacket.LayerType{
- []gopacket.LayerType{LayerTypeSCTPInit},
- []gopacket.LayerType{LayerTypeSCTPInitAck},
- []gopacket.LayerType{LayerTypeSCTPCookieEcho, LayerTypeSCTPData},
- []gopacket.LayerType{LayerTypeSCTPCookieAck, LayerTypeSCTPSack},
- []gopacket.LayerType{LayerTypeSCTPData},
- []gopacket.LayerType{LayerTypeSCTPSack},
- []gopacket.LayerType{LayerTypeSCTPShutdown},
- []gopacket.LayerType{LayerTypeSCTPShutdownAck},
- []gopacket.LayerType{LayerTypeSCTPShutdownComplete},
- }
- for i, data := range sctpPackets {
- p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- for _, typ := range wantLayers[i] {
- if p.Layer(typ) == nil {
- t.Errorf("Packet %d missing layer type %v, got:", i, typ)
- for _, layer := range p.Layers() {
- t.Errorf("\t%v", layer.LayerType())
- }
- if p.ErrorLayer() != nil {
- t.Error("\tPacket layer error:", p.ErrorLayer().Error())
- }
- }
- }
- // Test re-serialization.
- testSerializationWithOpts(t, p, data, gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true})
- }
-}
-
-func TestDecodeCiscoDiscovery(t *testing.T) {
- // http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=get&target=cdp_v2.pcap
- data := []byte{
- 0x01, 0x00, 0x0c, 0xcc, 0xcc, 0xcc, 0x00, 0x0b, 0xbe, 0x18, 0x9a, 0x41, 0x01, 0xc3, 0xaa, 0xaa,
- 0x03, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x02, 0xb4, 0x09, 0xa0, 0x00, 0x01, 0x00, 0x0c, 0x6d, 0x79,
- 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x00, 0x02, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
- 0xcc, 0x00, 0x04, 0xc0, 0xa8, 0x00, 0xfd, 0x00, 0x03, 0x00, 0x13, 0x46, 0x61, 0x73, 0x74, 0x45,
- 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x30, 0x2f, 0x31, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00,
- 0x00, 0x28, 0x00, 0x05, 0x01, 0x14, 0x43, 0x69, 0x73, 0x63, 0x6f, 0x20, 0x49, 0x6e, 0x74, 0x65,
- 0x72, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
- 0x6e, 0x67, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61,
- 0x72, 0x65, 0x20, 0x0a, 0x49, 0x4f, 0x53, 0x20, 0x28, 0x74, 0x6d, 0x29, 0x20, 0x43, 0x32, 0x39,
- 0x35, 0x30, 0x20, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x28, 0x43, 0x32, 0x39,
- 0x35, 0x30, 0x2d, 0x49, 0x36, 0x4b, 0x32, 0x4c, 0x32, 0x51, 0x34, 0x2d, 0x4d, 0x29, 0x2c, 0x20,
- 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x32, 0x2e, 0x31, 0x28, 0x32, 0x32, 0x29,
- 0x45, 0x41, 0x31, 0x34, 0x2c, 0x20, 0x52, 0x45, 0x4c, 0x45, 0x41, 0x53, 0x45, 0x20, 0x53, 0x4f,
- 0x46, 0x54, 0x57, 0x41, 0x52, 0x45, 0x20, 0x28, 0x66, 0x63, 0x31, 0x29, 0x0a, 0x54, 0x65, 0x63,
- 0x68, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x20, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x3a, 0x20,
- 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x63, 0x69, 0x73, 0x63, 0x6f,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x63, 0x68, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74,
- 0x0a, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31,
- 0x39, 0x38, 0x36, 0x2d, 0x32, 0x30, 0x31, 0x30, 0x20, 0x62, 0x79, 0x20, 0x63, 0x69, 0x73, 0x63,
- 0x6f, 0x20, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73, 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x0a,
- 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x54, 0x75, 0x65, 0x20, 0x32, 0x36, 0x2d,
- 0x4f, 0x63, 0x74, 0x2d, 0x31, 0x30, 0x20, 0x31, 0x30, 0x3a, 0x33, 0x35, 0x20, 0x62, 0x79, 0x20,
- 0x6e, 0x62, 0x75, 0x72, 0x72, 0x61, 0x00, 0x06, 0x00, 0x15, 0x63, 0x69, 0x73, 0x63, 0x6f, 0x20,
- 0x57, 0x53, 0x2d, 0x43, 0x32, 0x39, 0x35, 0x30, 0x2d, 0x31, 0x32, 0x00, 0x08, 0x00, 0x24, 0x00,
- 0x00, 0x0c, 0x01, 0x12, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x02, 0x20, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xbe, 0x18, 0x9a, 0x40, 0xff, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x0c, 0x4d, 0x59, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e, 0x00, 0x0a, 0x00, 0x06, 0x00,
- 0x01, 0x00, 0x0b, 0x00, 0x05, 0x01, 0x00, 0x12, 0x00, 0x05, 0x00, 0x00, 0x13, 0x00, 0x05, 0x00,
- 0x00, 0x16, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0xcc, 0x00, 0x04, 0xc0, 0xa8, 0x00,
- 0xfd,
- }
- p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- wantLayers := []gopacket.LayerType{LayerTypeEthernet, LayerTypeLLC, LayerTypeSNAP, LayerTypeCiscoDiscovery, LayerTypeCiscoDiscoveryInfo}
- checkLayers(p, wantLayers, t)
-
- want := &CiscoDiscoveryInfo{
- CDPHello: CDPHello{
- OUI: []byte{0, 0, 12},
- ProtocolID: 274,
- ClusterMaster: []byte{0, 0, 0, 0},
- Unknown1: []byte{255, 255, 255, 255},
- Version: 1,
- SubVersion: 2,
- Status: 32,
- Unknown2: 255,
- ClusterCommander: net.HardwareAddr{0, 0, 0, 0, 0, 0},
- SwitchMAC: net.HardwareAddr{0, 0x0b, 0xbe, 0x18, 0x9a, 0x40},
- Unknown3: 255,
- ManagementVLAN: 0,
- },
- DeviceID: "myswitch",
- Addresses: []net.IP{net.IPv4(192, 168, 0, 253)},
- PortID: "FastEthernet0/1",
- Capabilities: CDPCapabilities{false, false, false, true, false, true, false, false, false},
- Version: "Cisco Internetwork Operating System Software \nIOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14, RELEASE SOFTWARE (fc1)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2010 by cisco Systems, Inc.\nCompiled Tue 26-Oct-10 10:35 by nburra",
- Platform: "cisco WS-C2950-12",
- VTPDomain: "MYDOMAIN",
- NativeVLAN: 1,
- FullDuplex: true,
- MgmtAddresses: []net.IP{net.IPv4(192, 168, 0, 253)},
- BaseLayer: BaseLayer{Contents: data[26:]},
- }
- cdpL := p.Layer(LayerTypeCiscoDiscoveryInfo)
- info, _ := cdpL.(*CiscoDiscoveryInfo)
- if !reflect.DeepEqual(info, want) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info, want)
- }
-}
-
-func TestDecodeLinkLayerDiscovery(t *testing.T) {
- // http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=get&target=lldp.detailed.pcap
- data := []byte{
- 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0,
- 0x88, 0xcc, 0x02, 0x07, 0x04, 0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0, 0x04,
- 0x04, 0x05, 0x31, 0x2f, 0x31, 0x06, 0x02, 0x00, 0x78, 0x08, 0x17, 0x53,
- 0x75, 0x6d, 0x6d, 0x69, 0x74, 0x33, 0x30, 0x30, 0x2d, 0x34, 0x38, 0x2d,
- 0x50, 0x6f, 0x72, 0x74, 0x20, 0x31, 0x30, 0x30, 0x31, 0x00, 0x0a, 0x0d,
- 0x53, 0x75, 0x6d, 0x6d, 0x69, 0x74, 0x33, 0x30, 0x30, 0x2d, 0x34, 0x38,
- 0x00, 0x0c, 0x4c, 0x53, 0x75, 0x6d, 0x6d, 0x69, 0x74, 0x33, 0x30, 0x30,
- 0x2d, 0x34, 0x38, 0x20, 0x2d, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
- 0x6e, 0x20, 0x37, 0x2e, 0x34, 0x65, 0x2e, 0x31, 0x20, 0x28, 0x42, 0x75,
- 0x69, 0x6c, 0x64, 0x20, 0x35, 0x29, 0x20, 0x62, 0x79, 0x20, 0x52, 0x65,
- 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72,
- 0x20, 0x30, 0x35, 0x2f, 0x32, 0x37, 0x2f, 0x30, 0x35, 0x20, 0x30, 0x34,
- 0x3a, 0x35, 0x33, 0x3a, 0x31, 0x31, 0x00, 0x0e, 0x04, 0x00, 0x14, 0x00,
- 0x14, 0x10, 0x0e, 0x07, 0x06, 0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0, 0x02,
- 0x00, 0x00, 0x03, 0xe9, 0x00, 0xfe, 0x07, 0x00, 0x12, 0x0f, 0x02, 0x07,
- 0x01, 0x00, 0xfe, 0x09, 0x00, 0x12, 0x0f, 0x01, 0x03, 0x6c, 0x00, 0x00,
- 0x10, 0xfe, 0x09, 0x00, 0x12, 0x0f, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0xfe, 0x06, 0x00, 0x12, 0x0f, 0x04, 0x05, 0xf2, 0xfe, 0x06, 0x00, 0x80,
- 0xc2, 0x01, 0x01, 0xe8, 0xfe, 0x07, 0x00, 0x80, 0xc2, 0x02, 0x01, 0x00,
- 0x00, 0xfe, 0x17, 0x00, 0x80, 0xc2, 0x03, 0x01, 0xe8, 0x10, 0x76, 0x32,
- 0x2d, 0x30, 0x34, 0x38, 0x38, 0x2d, 0x30, 0x33, 0x2d, 0x30, 0x35, 0x30,
- 0x35, 0x00, 0xfe, 0x05, 0x00, 0x80, 0xc2, 0x04, 0x00, 0x00, 0x00,
- }
-
- p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- wantLayers := []gopacket.LayerType{LayerTypeEthernet, LayerTypeLinkLayerDiscovery, LayerTypeLinkLayerDiscoveryInfo}
- checkLayers(p, wantLayers, t)
- lldpL := p.Layer(LayerTypeLinkLayerDiscovery)
- lldp := lldpL.(*LinkLayerDiscovery)
- want := &LinkLayerDiscovery{
- ChassisID: LLDPChassisID{LLDPChassisIDSubTypeMACAddr, []byte{0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0}},
- PortID: LLDPPortID{LLDPPortIDSubtypeIfaceName, []byte("1/1")},
- TTL: 120,
- BaseLayer: BaseLayer{Contents: data[14:]},
- }
- lldp.Values = nil // test these in next stage
- if !reflect.DeepEqual(lldp, want) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", lldp, want)
- }
-
- infoL := p.Layer(LayerTypeLinkLayerDiscoveryInfo)
- info := infoL.(*LinkLayerDiscoveryInfo)
- wantinfo := &LinkLayerDiscoveryInfo{
- PortDescription: "Summit300-48-Port 1001\x00",
- SysName: "Summit300-48\x00",
- SysDescription: "Summit300-48 - Version 7.4e.1 (Build 5) by Release_Master 05/27/05 04:53:11\x00",
- SysCapabilities: LLDPSysCapabilities{
- SystemCap: LLDPCapabilities{Bridge: true, Router: true},
- EnabledCap: LLDPCapabilities{Bridge: true, Router: true},
- },
- MgmtAddress: LLDPMgmtAddress{IANAAddressFamily802, []byte{0x00, 0x01, 0x30, 0xf9, 0xad, 0xa0}, LLDPInterfaceSubtypeifIndex, 1001, ""},
- OrgTLVs: []LLDPOrgSpecificTLV{
- LLDPOrgSpecificTLV{OUI: 0x120f, SubType: 0x2, Info: []uint8{0x7, 0x1, 0x0}},
- LLDPOrgSpecificTLV{OUI: 0x120f, SubType: 0x1, Info: []uint8{0x3, 0x6c, 0x0, 0x0, 0x10}},
- LLDPOrgSpecificTLV{OUI: 0x120f, SubType: 0x3, Info: []uint8{0x1, 0x0, 0x0, 0x0, 0x0}},
- LLDPOrgSpecificTLV{OUI: 0x120f, SubType: 0x4, Info: []uint8{0x5, 0xf2}},
- LLDPOrgSpecificTLV{OUI: 0x80c2, SubType: 0x1, Info: []uint8{0x1, 0xe8}},
- LLDPOrgSpecificTLV{OUI: 0x80c2, SubType: 0x2, Info: []uint8{0x1, 0x0, 0x0}},
- LLDPOrgSpecificTLV{OUI: 0x80c2, SubType: 0x3, Info: []uint8{0x1, 0xe8, 0x10, 0x76, 0x32, 0x2d, 0x30, 0x34, 0x38, 0x38, 0x2d, 0x30, 0x33, 0x2d, 0x30, 0x35, 0x30, 0x35, 0x0}},
- LLDPOrgSpecificTLV{OUI: 0x80c2, SubType: 0x4, Info: []uint8{0x0}},
- },
- Unknown: nil,
- }
- if !reflect.DeepEqual(info, wantinfo) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info, wantinfo)
- }
- info8021, err := info.Decode8021()
- if err != nil {
- t.Errorf("8021 Values decode error: %v", err)
- }
- want8021 := LLDPInfo8021{
- PVID: 488,
- PPVIDs: []PortProtocolVLANID{PortProtocolVLANID{false, false, 0}},
- VLANNames: []VLANName{VLANName{488, "v2-0488-03-0505\x00"}},
- ProtocolIdentities: nil,
- VIDUsageDigest: 0,
- ManagementVID: 0,
- LinkAggregation: LLDPLinkAggregation{false, false, 0},
- }
- if !reflect.DeepEqual(info8021, want8021) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info8021, want8021)
- }
- info8023, err := info.Decode8023()
- if err != nil {
- t.Errorf("8023 Values decode error: %v", err)
- }
- want8023 := LLDPInfo8023{
- LinkAggregation: LLDPLinkAggregation{true, false, 0},
- MACPHYConfigStatus: LLDPMACPHYConfigStatus{true, true, 0x6c00, 0x0010},
- PowerViaMDI: LLDPPowerViaMDI8023{true, true, true, false, 1, 0, 0, 0, 0, 0, 0},
- MTU: 1522,
- }
-
- if !reflect.DeepEqual(info8023, want8023) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info8023, want8023)
- }
-
- // http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=get&target=lldpmed_civicloc.pcap
- data = []byte{
- 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e, 0x00, 0x13, 0x21, 0x57, 0xca, 0x7f,
- 0x88, 0xcc, 0x02, 0x07, 0x04, 0x00, 0x13, 0x21, 0x57, 0xca, 0x40, 0x04,
- 0x02, 0x07, 0x31, 0x06, 0x02, 0x00, 0x78, 0x08, 0x01, 0x31, 0x0a, 0x1a,
- 0x50, 0x72, 0x6f, 0x43, 0x75, 0x72, 0x76, 0x65, 0x20, 0x53, 0x77, 0x69,
- 0x74, 0x63, 0x68, 0x20, 0x32, 0x36, 0x30, 0x30, 0x2d, 0x38, 0x2d, 0x50,
- 0x57, 0x52, 0x0c, 0x5f, 0x50, 0x72, 0x6f, 0x43, 0x75, 0x72, 0x76, 0x65,
- 0x20, 0x4a, 0x38, 0x37, 0x36, 0x32, 0x41, 0x20, 0x53, 0x77, 0x69, 0x74,
- 0x63, 0x68, 0x20, 0x32, 0x36, 0x30, 0x30, 0x2d, 0x38, 0x2d, 0x50, 0x57,
- 0x52, 0x2c, 0x20, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x20,
- 0x48, 0x2e, 0x30, 0x38, 0x2e, 0x38, 0x39, 0x2c, 0x20, 0x52, 0x4f, 0x4d,
- 0x20, 0x48, 0x2e, 0x30, 0x38, 0x2e, 0x35, 0x58, 0x20, 0x28, 0x2f, 0x73,
- 0x77, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64,
- 0x2f, 0x66, 0x69, 0x73, 0x68, 0x28, 0x74, 0x73, 0x5f, 0x30, 0x38, 0x5f,
- 0x35, 0x29, 0x29, 0x0e, 0x04, 0x00, 0x14, 0x00, 0x04, 0x10, 0x0c, 0x05,
- 0x01, 0x0f, 0xff, 0x7a, 0x94, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
- 0x09, 0x00, 0x12, 0x0f, 0x01, 0x03, 0x6c, 0x00, 0x00, 0x10, 0xfe, 0x07,
- 0x00, 0x12, 0xbb, 0x01, 0x00, 0x0f, 0x04, 0xfe, 0x08, 0x00, 0x12, 0xbb,
- 0x02, 0x01, 0x40, 0x65, 0xae, 0xfe, 0x2e, 0x00, 0x12, 0xbb, 0x03, 0x02,
- 0x28, 0x02, 0x55, 0x53, 0x01, 0x02, 0x43, 0x41, 0x03, 0x09, 0x52, 0x6f,
- 0x73, 0x65, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x06, 0x09, 0x46, 0x6f, 0x6f,
- 0x74, 0x68, 0x69, 0x6c, 0x6c, 0x73, 0x13, 0x04, 0x38, 0x30, 0x30, 0x30,
- 0x1a, 0x03, 0x52, 0x33, 0x4c, 0xfe, 0x07, 0x00, 0x12, 0xbb, 0x04, 0x03,
- 0x00, 0x41, 0x00, 0x00,
- }
-
- p = gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- wantLayers = []gopacket.LayerType{LayerTypeEthernet, LayerTypeLinkLayerDiscovery, LayerTypeLinkLayerDiscoveryInfo}
- checkLayers(p, wantLayers, t)
- lldpL = p.Layer(LayerTypeLinkLayerDiscovery)
- lldp = lldpL.(*LinkLayerDiscovery)
- want = &LinkLayerDiscovery{
- ChassisID: LLDPChassisID{LLDPChassisIDSubTypeMACAddr, []byte{0x00, 0x13, 0x21, 0x57, 0xca, 0x40}},
- PortID: LLDPPortID{LLDPPortIDSubtypeLocal, []byte("1")},
- TTL: 120,
- BaseLayer: BaseLayer{Contents: data[14:]},
- }
- lldp.Values = nil // test these in next stage
- if !reflect.DeepEqual(lldp, want) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", lldp, want)
- }
-
- infoL = p.Layer(LayerTypeLinkLayerDiscoveryInfo)
- info = infoL.(*LinkLayerDiscoveryInfo)
- wantinfo = &LinkLayerDiscoveryInfo{
- PortDescription: "1",
- SysName: "ProCurve Switch 2600-8-PWR",
- SysDescription: "ProCurve J8762A Switch 2600-8-PWR, revision H.08.89, ROM H.08.5X (/sw/code/build/fish(ts_08_5))",
- SysCapabilities: LLDPSysCapabilities{
- SystemCap: LLDPCapabilities{Bridge: true, Router: true},
- EnabledCap: LLDPCapabilities{Bridge: true},
- },
- MgmtAddress: LLDPMgmtAddress{IANAAddressFamilyIPV4, []byte{0x0f, 0xff, 0x7a, 0x94}, LLDPInterfaceSubtypeifIndex, 0, ""},
- OrgTLVs: []LLDPOrgSpecificTLV{
- LLDPOrgSpecificTLV{OUI: 0x120f, SubType: 0x1, Info: []uint8{0x3, 0x6c, 0x0, 0x0, 0x10}},
- LLDPOrgSpecificTLV{OUI: 0x12bb, SubType: 0x1, Info: []uint8{0x0, 0xf, 0x4}},
- LLDPOrgSpecificTLV{OUI: 0x12bb, SubType: 0x2, Info: []uint8{0x1, 0x40, 0x65, 0xae}},
- LLDPOrgSpecificTLV{OUI: 0x12bb, SubType: 0x3, Info: []uint8{0x2, 0x28, 0x2, 0x55, 0x53, 0x1, 0x2, 0x43, 0x41, 0x3, 0x9, 0x52, 0x6f, 0x73, 0x65, 0x76, 0x69, 0x6c, 0x6c, 0x65, 0x6, 0x9, 0x46, 0x6f, 0x6f, 0x74, 0x68, 0x69, 0x6c, 0x6c, 0x73, 0x13, 0x4, 0x38, 0x30, 0x30, 0x30, 0x1a, 0x3, 0x52, 0x33, 0x4c}},
- LLDPOrgSpecificTLV{OUI: 0x12bb, SubType: 0x4, Info: []uint8{0x3, 0x0, 0x41}},
- },
- Unknown: nil,
- }
- if !reflect.DeepEqual(info, wantinfo) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info, wantinfo)
- }
- info8023, err = info.Decode8023()
- if err != nil {
- t.Errorf("8023 Values decode error: %v", err)
- }
- want8023 = LLDPInfo8023{
- MACPHYConfigStatus: LLDPMACPHYConfigStatus{true, true, 0x6c00, 0x0010},
- }
-
- if !reflect.DeepEqual(info8023, want8023) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info8023, want8023)
- }
-
- infoMedia, err := info.DecodeMedia()
- if err != nil {
- t.Errorf("8023 Values decode error: %v", err)
- }
- wantMedia := LLDPInfoMedia{
- MediaCapabilities: LLDPMediaCapabilities{true, true, true, true, false, false, LLDPMediaClassNetwork},
- NetworkPolicy: LLDPNetworkPolicy{LLDPAppTypeVoice, true, true, 50, 6, 46},
- Location: LLDPLocation{Format: LLDPLocationFormatAddress, Address: LLDPLocationAddress{
- What: LLDPLocationAddressWhatClient,
- CountryCode: "US",
- AddressLines: []LLDPLocationAddressLine{
- LLDPLocationAddressLine{LLDPLocationAddressTypeNational, "CA"},
- LLDPLocationAddressLine{LLDPLocationAddressTypeCity, "Roseville"},
- LLDPLocationAddressLine{LLDPLocationAddressTypeStreet, "Foothills"},
- LLDPLocationAddressLine{LLDPLocationAddressTypeHouseNum, "8000"},
- LLDPLocationAddressLine{LLDPLocationAddressTypeUnit, "R3L"},
- },
- }},
- PowerViaMDI: LLDPPowerViaMDI{0, 0, LLDPPowerPriorityLow, 6500},
- }
-
- if !reflect.DeepEqual(infoMedia, wantMedia) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", infoMedia, wantMedia)
- }
-
-}
-
-func TestDecodeNortelDiscovery(t *testing.T) {
- // http://www.thetechfirm.com/packets/nortel_btdp/btdp_nai.enc
- data := []byte{
- 0x01, 0x00, 0x81, 0x00, 0x01, 0x00, 0x00, 0x04, 0x38, 0xe0, 0xcc, 0xde,
- 0x00, 0x13, 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x81, 0x01, 0xa2, 0xac, 0x13,
- 0x58, 0x03, 0x00, 0x04, 0x15, 0x30, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x38, 0xe0, 0xcc, 0xde, 0x80, 0x6a, 0x00, 0x01, 0x14, 0x00,
- 0x02, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- }
- p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- wantLayers := []gopacket.LayerType{LayerTypeEthernet, LayerTypeLLC, LayerTypeSNAP, LayerTypeNortelDiscovery}
- checkLayers(p, wantLayers, t)
-
- want := &NortelDiscovery{
- IPAddress: []byte{172, 19, 88, 3},
- SegmentID: []byte{0x00, 0x04, 0x15},
- Chassis: NDPChassisBayStack450101001000Switches,
- Backplane: NDPBackplaneEthernetFastEthernetGigabitEthernet,
- State: NDPStateHeartbeat,
- NumLinks: 0,
- }
- ndpL := p.Layer(LayerTypeNortelDiscovery)
- info, _ := ndpL.(*NortelDiscovery)
- if !reflect.DeepEqual(info, want) {
- t.Errorf("Values mismatch, \ngot %#v\nwant %#v\n", info, want)
- }
-}
-
-func TestDecodeIPv6Jumbogram(t *testing.T) {
- // Haven't found any of these in the wild or on example pcaps online, so had
- // to generate one myself via scapy. Unfortunately, scapy can only
- // str(packet) for packets with length < 65536, due to limitations in python's
- // struct library, so I generated the header with:
- // Ether() / IPv6(src='::1', dst='::2') / IPv6ExtHdrHopByHop(options=[Jumbo(jumboplen=70000)]) / TCP(sport=8888, dport=80)
- // then added the payload manually ("payload" * 9996). The checksums here are
- // not correct, but we don't check, so who cares ;)
- dataStr := "\x00\x1f\xca\xb3v@$\xbe\x05'\x0b\x17\x86\xdd`\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x06\x00\xc2\x04\x00\x01\x11p\"\xb8\x00P\x00\x00\x00\x00\x00\x00\x00\x00P\x02 \x00l\xd8\x00\x00"
- payload := strings.Repeat("payload", 9996)
- data := []byte(dataStr + payload)
- p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv6, LayerTypeIPv6HopByHop, LayerTypeTCP, gopacket.LayerTypePayload}, t)
- if p.ApplicationLayer() == nil {
- t.Error("Packet has no application layer")
- } else if string(p.ApplicationLayer().Payload()) != payload {
- t.Errorf("Jumbogram payload wrong")
- }
- // Check truncated for jumbograms
- data = data[:len(data)-1]
- p = gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv6, LayerTypeIPv6HopByHop, LayerTypeTCP, gopacket.LayerTypePayload}, t)
- if !p.Metadata().Truncated {
- t.Error("Jumbogram should be truncated")
- }
-}
-
-func TestDecodeUDPPacketTooSmall(t *testing.T) {
- data := []byte{
- 0x00, 0x15, 0x2c, 0x9d, 0xcc, 0x00, 0x00, 0x10, 0xdb, 0xff, 0x10, 0x00, 0x81, 0x00, 0x01, 0xf7,
- 0x08, 0x00, 0x45, 0x60, 0x00, 0x3c, 0x0f, 0xa9, 0x00, 0x00, 0x6e, 0x11, 0x01, 0x0a, 0x47, 0xe6,
- 0xee, 0x2e, 0xac, 0x16, 0x59, 0x73, 0x00, 0x50, 0x00, 0x50, 0x00, 0x28, 0x4d, 0xad, 0x00, 0x67,
- 0x00, 0x01, 0x00, 0x72, 0xd5, 0xc7, 0xf1, 0x07, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0d, 0x00, 0x00,
- 0x00, 0x14, 0x00, 0x00, 0x19, 0xba,
- }
- p := gopacket.NewPacket(data, LinkTypeEthernet, testDecodeOptions)
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeDot1Q, LayerTypeIPv4, LayerTypeUDP, gopacket.LayerTypePayload}, t)
- if !p.Metadata().Truncated {
- t.Error("UDP short packet should be truncated")
- }
-}
-
-func TestDecodingLayerParserFullTCPPacket(t *testing.T) {
- dlp := gopacket.NewDecodingLayerParser(LayerTypeEthernet, &Ethernet{}, &IPv4{}, &TCP{}, &gopacket.Payload{})
- decoded := make([]gopacket.LayerType, 1)
- err := dlp.DecodeLayers(testSimpleTCPPacket, &decoded)
- if err != nil {
- t.Error("Error from dlp parser: ", err)
- }
- if len(decoded) != 4 {
- t.Error("Expected 4 layers parsed, instead got ", len(decoded))
- }
-}
-
-// testICMP is the packet:
-// 15:49:15.773265 IP 72.14.222.226 > 172.29.20.15: ICMP host 10.66.73.201 unreachable - admin prohibited filter, length 36
-// 0x0000: 24be 0527 0b17 001f cab3 75c0 0800 4500 $..'......u...E.
-// 0x0010: 0038 0000 0000 fc01 d7a7 480e dee2 ac1d .8........H.....
-// 0x0020: 140f 030d 946e 0000 0000 4520 004d 0000 .....n....E..M..
-// 0x0030: 4000 3e11 2849 ac1d 140f 0a42 49c9 8ecc @.>.(I.....BI...
-// 0x0040: 62e1 0039 769d b..9v.
-var testICMP = []byte{
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x75, 0xc0, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0xd7, 0xa7, 0x48, 0x0e, 0xde, 0xe2, 0xac, 0x1d,
- 0x14, 0x0f, 0x03, 0x0d, 0x94, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x45, 0x20, 0x00, 0x4d, 0x00, 0x00,
- 0x40, 0x00, 0x3e, 0x11, 0x28, 0x49, 0xac, 0x1d, 0x14, 0x0f, 0x0a, 0x42, 0x49, 0xc9, 0x8e, 0xcc,
- 0x62, 0xe1, 0x00, 0x39, 0x76, 0x9d,
-}
-
-func TestICMP(t *testing.T) {
- p := gopacket.NewPacket(testICMP, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeICMPv4, gopacket.LayerTypePayload}, t)
- testSerialization(t, p, testICMP)
-}
-func BenchmarkDecodeICMP(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testICMP, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// testICMP6 is the packet:
-// 16:17:37.758937 IP6 fe80::21f:caff:feb3:75c0 > 2620:0:1005:0:26be:5ff:fe27:b17: ICMP6, neighbor solicitation, who has 2620:0:1005:0:26be:5ff:fe27:b17, length 32
-// 0x0000: 24be 0527 0b17 001f cab3 75c0 86dd 6e00 $..'......u...n.
-// 0x0010: 0000 0020 3aff fe80 0000 0000 0000 021f ....:...........
-// 0x0020: caff feb3 75c0 2620 0000 1005 0000 26be ....u.&.......&.
-// 0x0030: 05ff fe27 0b17 8700 1eba 0000 0000 2620 ...'..........&.
-// 0x0040: 0000 1005 0000 26be 05ff fe27 0b17 0101 ......&....'....
-// 0x0050: 001f cab3 75c0 ....u.
-var testICMP6 = []byte{
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x75, 0xc0, 0x86, 0xdd, 0x6e, 0x00,
- 0x00, 0x00, 0x00, 0x20, 0x3a, 0xff, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1f,
- 0xca, 0xff, 0xfe, 0xb3, 0x75, 0xc0, 0x26, 0x20, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x26, 0xbe,
- 0x05, 0xff, 0xfe, 0x27, 0x0b, 0x17, 0x87, 0x00, 0x1e, 0xba, 0x00, 0x00, 0x00, 0x00, 0x26, 0x20,
- 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x26, 0xbe, 0x05, 0xff, 0xfe, 0x27, 0x0b, 0x17, 0x01, 0x01,
- 0x00, 0x1f, 0xca, 0xb3, 0x75, 0xc0,
-}
-
-func TestICMP6(t *testing.T) {
- p := gopacket.NewPacket(testICMP6, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv6, LayerTypeICMPv6, gopacket.LayerTypePayload}, t)
- testSerialization(t, p, testICMP6)
-}
-func BenchmarkDecodeICMP6(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testICMP6, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// testMPLS is the packet:
-// 12:48:57.201014 MPLS (label 29, exp 0, [S], ttl 255) IP 10.1.2.1 > 10.34.0.1: ICMP echo request, id 2618, seq 1579, length 80
-// 0x0000: 0030 96e6 fc39 0030 9605 2838 8847 0001 .0...9.0..(8.G..
-// 0x0010: d1ff 4500 0064 000b 0000 ff01 a569 0a01 ..E..d.......i..
-// 0x0020: 0201 0a22 0001 0800 3a76 0a3a 062b 0000 ..."....:v.:.+..
-// 0x0030: 0000 001f 3350 abcd abcd abcd abcd abcd ....3P..........
-// 0x0040: abcd abcd abcd abcd abcd abcd abcd abcd ................
-// 0x0050: abcd abcd abcd abcd abcd abcd abcd abcd ................
-// 0x0060: abcd abcd abcd abcd abcd abcd abcd abcd ................
-// 0x0070: abcd abcd abcd ......
-var testMPLS = []byte{
- 0x00, 0x30, 0x96, 0xe6, 0xfc, 0x39, 0x00, 0x30, 0x96, 0x05, 0x28, 0x38, 0x88, 0x47, 0x00, 0x01,
- 0xd1, 0xff, 0x45, 0x00, 0x00, 0x64, 0x00, 0x0b, 0x00, 0x00, 0xff, 0x01, 0xa5, 0x69, 0x0a, 0x01,
- 0x02, 0x01, 0x0a, 0x22, 0x00, 0x01, 0x08, 0x00, 0x3a, 0x76, 0x0a, 0x3a, 0x06, 0x2b, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x1f, 0x33, 0x50, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
-}
-
-func TestMPLS(t *testing.T) {
- p := gopacket.NewPacket(testMPLS, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeMPLS, LayerTypeIPv4, LayerTypeICMPv4, gopacket.LayerTypePayload}, t)
- testSerialization(t, p, testMPLS)
-}
-func BenchmarkDecodeMPLS(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testMPLS, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// testPPPoE_ICMPv6 is the packet:
-// 07:43:31.091560 PPPoE [ses 0x11] IP6 fe80::c801:eff:fe88:8 > ff02::1: ICMP6, neighbor advertisement, tgt is fe80::c801:eff:fe88:8, length 24
-// 0x0000: cc05 0e88 0000 ca01 0e88 0006 8864 1100 .............d..
-// 0x0010: 0011 0042 0057 6e00 0000 0018 3aff fe80 ...B.Wn.....:...
-// 0x0020: 0000 0000 0000 c801 0eff fe88 0008 ff02 ................
-// 0x0030: 0000 0000 0000 0000 0000 0000 0001 8800 ................
-// 0x0040: 5083 8000 0000 fe80 0000 0000 0000 c801 P...............
-// 0x0050: 0eff fe88 0008 ......
-var testPPPoE_ICMPv6 = []byte{
- 0xcc, 0x05, 0x0e, 0x88, 0x00, 0x00, 0xca, 0x01, 0x0e, 0x88, 0x00, 0x06, 0x88, 0x64, 0x11, 0x00,
- 0x00, 0x11, 0x00, 0x42, 0x00, 0x57, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3a, 0xff, 0xfe, 0x80,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x0e, 0xff, 0xfe, 0x88, 0x00, 0x08, 0xff, 0x02,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x88, 0x00,
- 0x50, 0x83, 0x80, 0x00, 0x00, 0x00, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x01,
- 0x0e, 0xff, 0xfe, 0x88, 0x00, 0x08,
-}
-
-func TestPPPoE_ICMPv6(t *testing.T) {
- p := gopacket.NewPacket(testPPPoE_ICMPv6, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{
- LayerTypeEthernet,
- LayerTypePPPoE,
- LayerTypePPP,
- LayerTypeIPv6,
- LayerTypeICMPv6,
- gopacket.LayerTypePayload,
- }, t)
- testSerialization(t, p, testPPPoE_ICMPv6)
-}
-func BenchmarkDecodePPPoE_ICMPv6(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPPPoE_ICMPv6, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-var testPFLog_UDP = []byte{
- 0x3d, 0x02, 0x00, 0x00, 0x65, 0x6e, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xff, 0xff, 0xff, 0x7f,
- 0xa0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xb8, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x45, 0x00, 0x00, 0x2c, 0x02, 0x16, 0x00, 0x00, 0x40, 0x11, 0x4e, 0xb0, 0xac, 0x17, 0xe8, 0xcc,
- 0xac, 0x17, 0xe8, 0xff, 0xf0, 0xff, 0x21, 0xa4, 0x00, 0x18, 0x2a, 0x25, 0x50, 0x4e, 0x4a, 0x50,
- 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-}
-
-func TestPFLog_UDP(t *testing.T) {
- p := gopacket.NewPacket(testPFLog_UDP, LinkTypePFLog, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{
- LayerTypePFLog,
- LayerTypeIPv4,
- LayerTypeUDP,
- gopacket.LayerTypePayload,
- }, t)
-}
-
-func TestRegressionDot1QPriority(t *testing.T) {
- d := &Dot1Q{
- Priority: 2,
- }
- out := gopacket.NewSerializeBuffer()
- gopacket.SerializeLayers(out, gopacket.SerializeOptions{}, d)
- if err := d.DecodeFromBytes(out.Bytes(), gopacket.NilDecodeFeedback); err != nil {
- t.Errorf("could not decode encoded dot1q")
- } else if d.Priority != 2 {
- t.Errorf("priority mismatch, want 2 got %d", d.Priority)
- }
-}
-
-// testPacketMPLSInMPLS is the packet:
-// 15:27:44.753678 MPLS (label 18, exp 0, ttl 255) (label 16, exp 0, [S], ttl
-// 255) IP 10.31.0.1 > 10.34.0.1: ICMP echo request, id 3941, seq 4768, length
-// 80
-// 0x0000: 0030 96e6 fc39 0030 9605 2838 8847 0001 .0...9.0..(8.G..
-// 0x0010: 20ff 0001 01ff 4500 0064 0050 0000 ff01 ......E..d.P....
-// 0x0020: a706 0a1f 0001 0a22 0001 0800 bd11 0f65 .......".......e
-// 0x0030: 12a0 0000 0000 0053 9ee0 abcd abcd abcd .......S........
-// 0x0040: abcd abcd abcd abcd abcd abcd abcd abcd ................
-// 0x0050: abcd abcd abcd abcd abcd abcd abcd abcd ................
-// 0x0060: abcd abcd abcd abcd abcd abcd abcd abcd ................
-// 0x0070: abcd abcd abcd abcd abcd ..........
-var testPacketMPLSInMPLS = []byte{
- 0x00, 0x30, 0x96, 0xe6, 0xfc, 0x39, 0x00, 0x30, 0x96, 0x05, 0x28, 0x38, 0x88, 0x47, 0x00, 0x01,
- 0x20, 0xff, 0x00, 0x01, 0x01, 0xff, 0x45, 0x00, 0x00, 0x64, 0x00, 0x50, 0x00, 0x00, 0xff, 0x01,
- 0xa7, 0x06, 0x0a, 0x1f, 0x00, 0x01, 0x0a, 0x22, 0x00, 0x01, 0x08, 0x00, 0xbd, 0x11, 0x0f, 0x65,
- 0x12, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x9e, 0xe0, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
- 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
-}
-
-func TestPacketMPLSInMPLS(t *testing.T) {
- p := gopacket.NewPacket(testPacketMPLSInMPLS, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{
- LayerTypeEthernet,
- LayerTypeMPLS,
- LayerTypeMPLS,
- LayerTypeIPv4,
- LayerTypeICMPv4,
- gopacket.LayerTypePayload}, t)
-}
-
-// testPacketIPv4Fragmented is the packet:
-// 22:11:26.616090 IP 10.1.1.1.31915 > 129.111.30.27.20197: UDP, length 28
-// 0x0000: 0000 39cf d9cd 0040 33d9 7cfd 0800 4500 ..9....@3.|...E.
-// 0x0010: 0038 00f2 2000 4011 af37 0a01 0101 816f .8....@..7.....o
-// 0x0020: 1e1b 7cab 4ee5 0024 0000 0000 0000 0000 ..|.N..$........
-// 0x0030: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0040: 0000 0000 0000 ......
-var testPacketIPv4Fragmented = []byte{
- 0x00, 0x00, 0x39, 0xcf, 0xd9, 0xcd, 0x00, 0x40, 0x33, 0xd9, 0x7c, 0xfd, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x38, 0x00, 0xf2, 0x20, 0x00, 0x40, 0x11, 0xaf, 0x37, 0x0a, 0x01, 0x01, 0x01, 0x81, 0x6f,
- 0x1e, 0x1b, 0x7c, 0xab, 0x4e, 0xe5, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-}
-
-func TestPacketIPv4Fragmented(t *testing.T) {
- p := gopacket.NewPacket(testPacketIPv4Fragmented, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, gopacket.LayerTypeFragment}, t)
- testSerializationWithOpts(t, p, testPacketIPv4Fragmented, gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true})
-}
-
-// testPacketDNSRegression is the packet:
-// 11:08:05.708342 IP 109.194.160.4.57766 > 95.211.92.14.53: 63000% [1au] A? picslife.ru. (40)
-// 0x0000: 0022 19b6 7e22 000f 35bb 0b40 0800 4500 ."..~"..5..@..E.
-// 0x0010: 0044 89c4 0000 3811 2f3d 6dc2 a004 5fd3 .D....8./=m..._.
-// 0x0020: 5c0e e1a6 0035 0030 a597 f618 0010 0001 \....5.0........
-// 0x0030: 0000 0000 0001 0870 6963 736c 6966 6502 .......picslife.
-// 0x0040: 7275 0000 0100 0100 0029 1000 0000 8000 ru.......)......
-// 0x0050: 0000 ..
-var testPacketDNSRegression = []byte{
- 0x00, 0x22, 0x19, 0xb6, 0x7e, 0x22, 0x00, 0x0f, 0x35, 0xbb, 0x0b, 0x40, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x44, 0x89, 0xc4, 0x00, 0x00, 0x38, 0x11, 0x2f, 0x3d, 0x6d, 0xc2, 0xa0, 0x04, 0x5f, 0xd3,
- 0x5c, 0x0e, 0xe1, 0xa6, 0x00, 0x35, 0x00, 0x30, 0xa5, 0x97, 0xf6, 0x18, 0x00, 0x10, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x70, 0x69, 0x63, 0x73, 0x6c, 0x69, 0x66, 0x65, 0x02,
- 0x72, 0x75, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00, 0x80, 0x00,
- 0x00, 0x00,
-}
-
-func TestPacketDNSRegression(t *testing.T) {
- p := gopacket.NewPacket(testPacketDNSRegression, LinkTypeEthernet, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeUDP, LayerTypeDNS}, t)
-}
-func BenchmarkDecodePacketDNSRegression(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDNSRegression, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// response to `dig TXT google.com` over IPv4 link:
-var testParseDNSTypeTXTValue = `v=spf1 include:_spf.google.com ~all`
-var testParseDNSTypeTXT = []byte{
- 0x02, 0x00, 0x00, 0x00, // PF_INET
- 0x45, 0x00, 0x00, 0x73, 0x00, 0x00, 0x40, 0x00, 0x39, 0x11, 0x64, 0x98, 0xd0, 0x43, 0xde, 0xde,
- 0x0a, 0xba, 0x23, 0x06, 0x00, 0x35, 0x81, 0xb2, 0x00, 0x5f, 0xdc, 0xb5, 0x98, 0x71, 0x81, 0x80,
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03,
- 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x10, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00,
- 0x0e, 0x10, 0x00, 0x24, 0x23, 0x76, 0x3d, 0x73, 0x70, 0x66, 0x31, 0x20, 0x69, 0x6e, 0x63, 0x6c,
- 0x75, 0x64, 0x65, 0x3a, 0x5f, 0x73, 0x70, 0x66, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
- 0x63, 0x6f, 0x6d, 0x20, 0x7e, 0x61, 0x6c, 0x6c, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
-}
-
-func TestParseDNSTypeTXT(t *testing.T) {
- p := gopacket.NewPacket(testParseDNSTypeTXT, LinkTypeNull, testDecodeOptions)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeLoopback, LayerTypeIPv4, LayerTypeUDP, LayerTypeDNS}, t)
- answers := p.Layer(LayerTypeDNS).(*DNS).Answers
- if len(answers) != 1 {
- t.Error("Failed to parse 1 DNS answer")
- }
- if len(answers[0].TXTs) != 1 {
- t.Error("Failed to parse 1 TXT record")
- }
- txt := string(answers[0].TXTs[0])
- if txt != testParseDNSTypeTXTValue {
- t.Errorf("Incorrect TXT value, expected %q, got %q", testParseDNSTypeTXTValue, txt)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/dot11_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/dot11_test.go
deleted file mode 100644
index d39ce6ab1eb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/dot11_test.go
+++ /dev/null
@@ -1,495 +0,0 @@
-// Copyright 2014, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "bytes"
- _ "fmt"
- "github.com/google/gopacket"
- "net"
- "reflect"
- "testing"
-)
-
-// Generator: python layers/test_creator.py --layerType=LayerTypeRadioTap --linkType=LinkTypeIEEE80211Radio --name=Dot11%s ~/Downloads/mesh.pcap
-// http://wiki.wireshark.org/SampleCaptures#Sample_Captures
-
-// testPacketDot11CtrlCTS is the packet:
-// 09:28:41.830560 20604983us tsft short preamble 24.0 Mb/s 5240 MHz 11a -79dB signal -92dB noise antenna 1 Clear-To-Send RA:d8:a2:5e:97:61:c1
-// 0x0000: 0000 1900 6f08 0000 3768 3a01 0000 0000 ....o...7h:.....
-// 0x0010: 1230 7814 4001 b1a4 01c4 0094 00d8 a25e .0x.@..........^
-// 0x0020: 9761 c136 5095 8e .a.6P..
-
-var testPacketDot11CtrlCTS = []byte{
- 0x00, 0x00, 0x19, 0x00, 0x6f, 0x08, 0x00, 0x00, 0x37, 0x68, 0x3a, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x12, 0x30, 0x78, 0x14, 0x40, 0x01, 0xb1, 0xa4, 0x01, 0xc4, 0x00, 0x94, 0x00, 0xd8, 0xa2, 0x5e,
- 0x97, 0x61, 0xc1, 0x36, 0x50, 0x95, 0x8e,
-}
-
-func TestPacketDot11CtrlCTS(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11CtrlCTS, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11}, t)
-
- if got, ok := p.Layer(LayerTypeRadioTap).(*RadioTap); ok {
- want := &RadioTap{
- BaseLayer: BaseLayer{
- Contents: []uint8{0x0, 0x0, 0x19, 0x0, 0x6f, 0x8, 0x0, 0x0, 0x37, 0x68, 0x3a, 0x1, 0x0, 0x0, 0x0, 0x0, 0x12, 0x30, 0x78, 0x14, 0x40, 0x1, 0xb1, 0xa4, 0x1},
- Payload: []uint8{0xc4, 0x0, 0x94, 0x0, 0xd8, 0xa2, 0x5e, 0x97, 0x61, 0xc1, 0x36, 0x50, 0x95, 0x8e},
- },
- Version: 0x0,
- Length: 0x19,
- Present: 0x86f,
- TSFT: 0x13a6837,
- Flags: 0x12,
- Rate: 0x30,
- ChannelFrequency: 0x1478,
- ChannelFlags: 0x140,
- FHSS: 0x0,
- DBMAntennaSignal: -79,
- DBMAntennaNoise: -92,
- LockQuality: 0x0,
- TxAttenuation: 0x0,
- DBTxAttenuation: 0x0,
- DBMTxPower: 0,
- Antenna: 1,
- DBAntennaSignal: 0x0,
- DBAntennaNoise: 0x0,
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("RadioTap packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-
- if got, ok := p.Layer(LayerTypeDot11).(*Dot11); ok {
- if !got.ChecksumValid() {
- t.Errorf("Dot11 packet processing failed:\nchecksum failed. got :\n%#v\n\n", got)
- }
-
- want := &Dot11{
- BaseLayer: BaseLayer{
- Contents: []uint8{0xc4, 0x0, 0x94, 0x0, 0xd8, 0xa2, 0x5e, 0x97, 0x61, 0xc1},
- Payload: []uint8{},
- },
- Type: Dot11TypeCtrlCTS,
- Proto: 0x0,
- Flags: 0x0,
- DurationID: 0x94,
- Address1: net.HardwareAddr{0xd8, 0xa2, 0x5e, 0x97, 0x61, 0xc1}, // check
- Address2: net.HardwareAddr(nil),
- Address3: net.HardwareAddr(nil),
- Address4: net.HardwareAddr(nil),
- Checksum: 0x8e955036,
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("Dot11 packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-}
-
-func BenchmarkDecodePacketDot11CtrlCTS(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11CtrlCTS, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// testPacketDot11MgmtBeacon is the packet:
-// 15:44:56.531833 6.0 Mb/s 2412 MHz 11g -81dB signal antenna 5 Beacon (Wi2) [6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 Mbit] ESS CH: 1
-// 0x0000: 0000 1200 2e48 0000 100c 6c09 c000 af05 .....H....l.....
-// 0x0010: 0000 8000 0000 ffff ffff ffff c08a de01 ................
-// 0x0020: 11b8 c08a de01 11b8 f097 80f1 30bc 1300 ............0...
-// 0x0030: 0000 6400 2104 0003 5769 3201 088c 1298 ..d.!...Wi2.....
-// 0x0040: 24b0 4860 6c03 0101 0504 0001 0000 2a01 $.H`l.........*.
-// 0x0050: 00dd 1800 50f2 0201 0181 0007 a400 0023 ....P..........#
-// 0x0060: a400 0042 435e 0062 322f 00dd 1e00 904c ...BC^.b2/.....L
-// 0x0070: 338c 011b ffff 0000 0000 0000 0000 0000 3...............
-// 0x0080: 1000 0000 0000 0000 0000 002d 1a8c 011b ...........-....
-// 0x0090: ffff 0000 0000 0000 0000 0000 1000 0000 ................
-// 0x00a0: 0000 0000 0000 00dd 1a00 904c 3401 0000 ...........L4...
-// 0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00c0: 0000 003d 1601 0000 0000 0000 0000 0000 ...=............
-// 0x00d0: 0000 0000 0000 0000 0000 007f 0400 0000 ................
-// 0x00e0: 00dd 0800 1392 0100 0185 0094 0b90 15 ...............
-var testPacketDot11MgmtBeacon = []byte{
- 0x00, 0x00, 0x12, 0x00, 0x2e, 0x48, 0x00, 0x00, 0x10, 0x0c, 0x6c, 0x09, 0xc0, 0x00, 0xaf, 0x05,
- 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x8a, 0xde, 0x01,
- 0x11, 0xb8, 0xc0, 0x8a, 0xde, 0x01, 0x11, 0xb8, 0xf0, 0x97, 0x80, 0xf1, 0x30, 0xbc, 0x13, 0x00,
- 0x00, 0x00, 0x64, 0x00, 0x21, 0x04, 0x00, 0x03, 0x57, 0x69, 0x32, 0x01, 0x08, 0x8c, 0x12, 0x98,
- 0x24, 0xb0, 0x48, 0x60, 0x6c, 0x03, 0x01, 0x01, 0x05, 0x04, 0x00, 0x01, 0x00, 0x00, 0x2a, 0x01,
- 0x00, 0xdd, 0x18, 0x00, 0x50, 0xf2, 0x02, 0x01, 0x01, 0x81, 0x00, 0x07, 0xa4, 0x00, 0x00, 0x23,
- 0xa4, 0x00, 0x00, 0x42, 0x43, 0x5e, 0x00, 0x62, 0x32, 0x2f, 0x00, 0xdd, 0x1e, 0x00, 0x90, 0x4c,
- 0x33, 0x8c, 0x01, 0x1b, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x1a, 0x8c, 0x01, 0x1b,
- 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x1a, 0x00, 0x90, 0x4c, 0x34, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3d, 0x16, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0xdd, 0x08, 0x00, 0x13, 0x92, 0x01, 0x00, 0x01, 0x85, 0x00, 0x94, 0x0b, 0x90, 0x15,
-}
-
-func TestPacketDot11MgmtBeacon(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11MgmtBeacon, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- expectedLayers := []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11MgmtBeacon}
- for i := 0; i < 12; i++ {
- expectedLayers = append(expectedLayers, LayerTypeDot11InformationElement)
- }
- checkLayers(p, expectedLayers, t)
-
- if p.Layer(LayerTypeDot11).(*Dot11).SequenceNumber != 2431 {
- t.Error("dot11 invalid sequence number")
- }
- if p.Layer(LayerTypeDot11).(*Dot11).FragmentNumber != 0 {
- t.Error("dot11 invalid fragment number")
- }
- if _, ok := p.Layer(LayerTypeDot11MgmtBeacon).(*Dot11MgmtBeacon); !ok {
- t.Errorf("dot11 management beacon frame was expected")
- }
-}
-
-func BenchmarkDecodePacketDot11MgmtBeacon(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11MgmtBeacon, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// testPacketDot11DataQOSData is the packet:
-// 06:14:27.838634 638790765us tsft short preamble 54.0 Mb/s -51dB signal -96dB noise antenna 2 5180 MHz 11a CF +QoS ARP, Request who-has 140.180.51.68 tell 169.254.247.0, length 28
-// 0x0000: 0000 2000 6708 0400 6d2c 1326 0000 0000 ....g...m,.&....
-// 0x0010: 226c cda0 0200 0000 4001 0000 3c14 2411 "l......@...<.$.
-// 0x0020: 8801 2c00 0603 7f07 a016 0019 e3d3 5352 ..,...........SR
-// 0x0030: ffff ffff ffff 5064 0000 50aa aaaa 0300 ......Pd..P.....
-// 0x0040: 0000 0806 0001 0800 0604 0001 0019 e3d3 ................
-// 0x0050: 5352 a9fe f700 0000 0000 0000 8cb4 3344 SR............3D
-var testPacketDot11DataQOSData = []byte{
- 0x00, 0x00, 0x20, 0x00, 0x67, 0x08, 0x04, 0x00, 0x6d, 0x2c, 0x13, 0x26, 0x00, 0x00, 0x00, 0x00,
- 0x22, 0x6c, 0xcd, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x3c, 0x14, 0x24, 0x11,
- 0x88, 0x01, 0x2c, 0x00, 0x06, 0x03, 0x7f, 0x07, 0xa0, 0x16, 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50, 0x64, 0x00, 0x00, 0x50, 0xaa, 0xaa, 0xaa, 0x03, 0x00,
- 0x00, 0x00, 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x19, 0xe3, 0xd3,
- 0x53, 0x52, 0xa9, 0xfe, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0xb4, 0x33, 0x44,
-}
-
-func TestPacketDot11DataQOSData(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11DataQOSData, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11DataQOSData, LayerTypeDot11Data, LayerTypeLLC, LayerTypeSNAP, LayerTypeARP}, t)
-
- if got, ok := p.Layer(LayerTypeARP).(*ARP); ok {
- want := &ARP{BaseLayer: BaseLayer{
- Contents: []uint8{0x0, 0x1, 0x8, 0x0, 0x6, 0x4, 0x0, 0x1, 0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0xa9, 0xfe, 0xf7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8c, 0xb4, 0x33, 0x44},
- Payload: []uint8{},
- },
- AddrType: 0x1,
- Protocol: 0x800,
- HwAddressSize: 0x6,
- ProtAddressSize: 0x4,
- Operation: 0x1,
- SourceHwAddress: []uint8{0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52},
- SourceProtAddress: []uint8{0xa9, 0xfe, 0xf7, 0x0},
- DstHwAddress: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- DstProtAddress: []uint8{0x8c, 0xb4, 0x33, 0x44},
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("ARP packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-}
-func BenchmarkDecodePacketDot11DataQOSData(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11DataQOSData, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// testPacketDot11MgmtAction is the packet:
-// 15:54:43.236460 1.0 Mb/s 2412 MHz 11b -67dB signal antenna 5 Action (8e:3a:e3:44:ac:c6): Spectrum Management Act#4
-// 0x0000: 0000 1200 2e48 0000 1002 6c09 a000 bd05 .....H....l.....
-// 0x0010: 0000 d000 0000 ffff ffff ffff 8e3a e344 .............:.D
-// 0x0020: acc6 8e3a e344 acc6 001b 0004 2503 0001 ...:.D......%...
-// 0x0030: 0055 39f0 33 .U9.3
-var testPacketDot11MgmtAction = []byte{
- 0x00, 0x00, 0x12, 0x00, 0x2e, 0x48, 0x00, 0x00, 0x10, 0x02, 0x6c, 0x09, 0xa0, 0x00, 0xbd, 0x05,
- 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8e, 0x3a, 0xe3, 0x44,
- 0xac, 0xc6, 0x8e, 0x3a, 0xe3, 0x44, 0xac, 0xc6, 0x00, 0x1b, 0x00, 0x04, 0x25, 0x03, 0x00, 0x01,
- 0x00, 0x55, 0x39, 0xf0, 0x33,
-}
-
-func TestPacketDot11MgmtAction(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11MgmtAction, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11MgmtAction}, t)
- if got, ok := p.Layer(LayerTypeDot11).(*Dot11); !ok {
- t.Errorf("dot11 frame was not parsed")
- } else if !got.ChecksumValid() {
- t.Errorf("Dot11 packet processing failed: checksum failed")
- }
- if got, ok := p.Layer(LayerTypeDot11MgmtAction).(*Dot11MgmtAction); !ok {
- t.Errorf("management action frame was not parsed")
- } else if got.Contents[0] != 0 {
- t.Errorf("action category was not spectrum management")
- }
-}
-
-func BenchmarkDecodePacketDot11MgmtAction(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11MgmtAction, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// testPacketDot11CtrlAck is the packet:
-// 06:14:27.838669 638758038us tsft short preamble 24.0 Mb/s -39dB signal -96dB noise antenna 2 5180 MHz 11a Acknowledgment RA:00:19:e3:d3:53:52
-// 0x0000: 0000 2000 6708 0400 96ac 1226 0000 0000 ....g......&....
-// 0x0010: 2230 d9a0 0200 0000 4001 0000 3c14 2411 "0......@...<.$.
-// 0x0020: d400 0000 0019 e3d3 5352 46e9 7687 ........SRF.v.
-var testPacketDot11CtrlAck = []byte{
- 0x00, 0x00, 0x20, 0x00, 0x67, 0x08, 0x04, 0x00, 0x96, 0xac, 0x12, 0x26, 0x00, 0x00, 0x00, 0x00,
- 0x32, 0x30, 0xd9, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x3c, 0x14, 0x24, 0x11,
- 0xd4, 0x00, 0x00, 0x00, 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0x46, 0xe9, 0x76, 0x87,
-}
-
-func TestPacketDot11CtrlAck(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11CtrlAck, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11}, t)
-
- if got, ok := p.Layer(LayerTypeDot11).(*Dot11); ok {
- if !got.ChecksumValid() {
- t.Errorf("Dot11 packet processing failed:\nchecksum failed. got :\n%#v\n\n", got)
- }
- }
-
- if got, ok := p.Layer(LayerTypeDot11).(*Dot11); ok {
- if !got.ChecksumValid() {
- t.Errorf("Dot11 packet processing failed:\nchecksum failed. got :\n%#v\n\n", got)
- }
- want := &Dot11{
- BaseLayer: BaseLayer{
- Contents: []uint8{0xd4, 0x0, 0x0, 0x0, 0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52},
- Payload: []uint8{},
- },
- Type: Dot11TypeCtrlAck,
- Proto: 0x0,
- Flags: 0x0,
- DurationID: 0x0,
- Address1: net.HardwareAddr{0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52},
- Address2: net.HardwareAddr(nil),
- Address3: net.HardwareAddr(nil),
- Address4: net.HardwareAddr(nil),
- Checksum: 0x8776e946,
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("Dot11 packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-}
-func BenchmarkDecodePacketDot11CtrlAck(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11CtrlAck, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// testPacketDot11DataARP is the packet:
-// 06:14:11.512316 622463798us tsft short preamble 6.0 Mb/s -39dB signal -96dB noise antenna 2 5180 MHz 11a ARP, Request who-has 67.8.14.54 tell 169.254.247.0, length 28
-// 0x0000: 0000 2000 6708 0400 360b 1a25 0000 0000 ....g...6..%....
-// 0x0010: 220c d9a0 0200 0000 4001 0000 3c14 2411 ".......@...<.$.
-// 0x0020: 0802 0000 ffff ffff ffff 0603 7f07 a016 ................
-// 0x0030: 0019 e3d3 5352 e07f aaaa 0300 0000 0806 ....SR..........
-// 0x0040: 0001 0800 0604 0001 0019 e3d3 5352 a9fe ............SR..
-// 0x0050: f700 0000 0000 0000 4308 0e36 ........C..6
-var testPacketDot11DataARP = []byte{
- 0x00, 0x00, 0x20, 0x00, 0x67, 0x08, 0x04, 0x00, 0x36, 0x0b, 0x1a, 0x25, 0x00, 0x00, 0x00, 0x00,
- 0x22, 0x0c, 0xd9, 0xa0, 0x02, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x3c, 0x14, 0x24, 0x11,
- 0x08, 0x02, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x06, 0x03, 0x7f, 0x07, 0xa0, 0x16,
- 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0xe0, 0x7f, 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06,
- 0x00, 0x01, 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0xa9, 0xfe,
- 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x08, 0x0e, 0x36,
-}
-
-func TestPacketDot11DataARP(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11DataARP, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11Data, LayerTypeLLC, LayerTypeSNAP, LayerTypeARP}, t)
-
- if got, ok := p.Layer(LayerTypeARP).(*ARP); ok {
- want := &ARP{
- BaseLayer: BaseLayer{
- Contents: []uint8{0x0, 0x1, 0x8, 0x0, 0x6, 0x4, 0x0, 0x1, 0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0xa9, 0xfe, 0xf7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x43, 0x8, 0xe, 0x36},
- Payload: []uint8{},
- },
- AddrType: 0x1,
- Protocol: 0x800,
- HwAddressSize: 0x6,
- ProtAddressSize: 0x4,
- Operation: 0x1,
- SourceHwAddress: []uint8{0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52},
- SourceProtAddress: []uint8{0xa9, 0xfe, 0xf7, 0x0},
- DstHwAddress: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- DstProtAddress: []uint8{0x43, 0x8, 0xe, 0x36},
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("ARP packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-}
-
-func BenchmarkDecodePacketDot11DataARP(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11DataARP, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// testPacketDot11DataIP is the packet:
-// 06:14:21.388622 632340487us tsft short preamble 6.0 Mb/s -40dB signal -96dB noise antenna 1 5180 MHz 11a IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:19:e3:d3:53:52, length 300
-// 0x0000: 0000 2000 6708 0400 07c0 b025 0000 0000 ....g......%....
-// 0x0010: 220c d8a0 0100 0000 4001 0000 3c14 2411 ".......@...<.$.
-// 0x0020: 0802 0000 ffff ffff ffff 0603 7f07 a016 ................
-// 0x0030: 0019 e3d3 5352 4095 aaaa 0300 0000 0800 ....SR@.........
-// 0x0040: 4500 0148 c514 0000 ff11 f590 0000 0000 E..H............
-// 0x0050: ffff ffff 0044 0043 0134 2b39 0101 0600 .....D.C.4+9....
-// 0x0060: 131f 8c43 003c 0000 0000 0000 0000 0000 ...C.<..........
-// 0x0070: 0000 0000 0000 0000 0019 e3d3 5352 0000 ............SR..
-// 0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0110: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0120: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0130: 0000 0000 0000 0000 0000 0000 0000 0000 ................
-// 0x0140: 0000 0000 0000 0000 6382 5363 3501 0137 ........c.Sc5..7
-// 0x0150: 0a01 0306 0f77 5ffc 2c2e 2f39 0205 dc3d .....w_.,./9...=
-// 0x0160: 0701 0019 e3d3 5352 3304 0076 a700 0c0b ......SR3..v....
-// 0x0170: 4d61 6369 6e74 6f73 682d 34ff 0000 0000 Macintosh-4.....
-// 0x0180: 0000 0000 0000 0000 ........
-var testPacketDot11DataIP = []byte{
- 0x00, 0x00, 0x20, 0x00, 0x67, 0x08, 0x04, 0x00, 0x07, 0xc0, 0xb0, 0x25, 0x00, 0x00, 0x00, 0x00,
- 0x22, 0x0c, 0xd8, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x3c, 0x14, 0x24, 0x11,
- 0x08, 0x02, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x06, 0x03, 0x7f, 0x07, 0xa0, 0x16,
- 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0x40, 0x95, 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00,
- 0x45, 0x00, 0x01, 0x48, 0xc5, 0x14, 0x00, 0x00, 0xff, 0x11, 0xf5, 0x90, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0x00, 0x43, 0x01, 0x34, 0x2b, 0x39, 0x01, 0x01, 0x06, 0x00,
- 0x13, 0x1f, 0x8c, 0x43, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x82, 0x53, 0x63, 0x35, 0x01, 0x01, 0x37,
- 0x0a, 0x01, 0x03, 0x06, 0x0f, 0x77, 0x5f, 0xfc, 0x2c, 0x2e, 0x2f, 0x39, 0x02, 0x05, 0xdc, 0x3d,
- 0x07, 0x01, 0x00, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0x33, 0x04, 0x00, 0x76, 0xa7, 0x00, 0x0c, 0x0b,
- 0x4d, 0x61, 0x63, 0x69, 0x6e, 0x74, 0x6f, 0x73, 0x68, 0x2d, 0x34, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-}
-
-func TestPacketDot11DataIP(t *testing.T) {
- p := gopacket.NewPacket(testPacketDot11DataIP, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11Data, LayerTypeLLC, LayerTypeSNAP, LayerTypeIPv4, LayerTypeUDP, gopacket.LayerTypePayload}, t)
-}
-func BenchmarkDecodePacketDot11DataIP(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketDot11DataIP, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-// Encrypted
-
-/// testPacketP6196 is the packet:
-// 09:28:41.830631 20605036us tsft wep -69dB signal -92dB noise antenna 1 5240 MHz 11a ht/40- 162.0 Mb/s MCS 12 40 MHz lon GI mixed BCC FEC [bit 20] CF +QoS Data IV:50a9 Pad 20 KeyID 0
-// 0x0000: 0000 3000 6b08 1c00 6c68 3a01 0000 0000 ..0.k...lh:.....
-// 0x0010: 1400 7814 4001 bba4 0160 0e1a 4001 0400 ..x.@....`..@...
-// 0x0020: 7814 3022 1f01 0cff b10d 0000 0400 0000 x.0"............
-// 0x0030: 8841 2c00 0025 9c42 c262 d8a2 5e97 61c1 .A,..%.B.b..^.a.
-// 0x0040: 0025 9c42 c25f 10db 0000 a950 0020 0000 .%.B._.....P....
-// 0x0050: 0000 f8ab a97e 3fbd d6e1 785b 0040 5f15 .....~?...x[.@_.
-// 0x0060: 7123 8711 bd1f ffb9 e5b3 84bb ec2a 0a90 q#...........*..
-// 0x0070: d0a0 1a6f 9033 1083 5179 a0da f833 3a00 ...o.3..Qy...3:.
-// 0x0080: 5471 f596 539b 1823 a33c 4908 545c 266a Tq..S..#.<I.T\&j
-// 0x0090: 8540 515a 1da9 c49e a85a fbf7 de09 7f9c .@QZ.....Z......
-// 0x00a0: 6f35 0b8b 6831 2c10 43dc 8983 b1d9 dd29 o5..h1,.C......)
-// 0x00b0: 7395 65b9 4b43 b391 16ec 4201 86c9 ca s.e.KC....B....
-var testPacketP6196 = []byte{
- 0x00, 0x00, 0x30, 0x00, 0x6b, 0x08, 0x1c, 0x00, 0x6c, 0x68, 0x3a, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x78, 0x14, 0x40, 0x01, 0xbb, 0xa4, 0x01, 0x60, 0x0e, 0x1a, 0x40, 0x01, 0x04, 0x00,
- 0x78, 0x14, 0x30, 0x22, 0x1f, 0x01, 0x0c, 0xff, 0xb1, 0x0d, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x88, 0x41, 0x2c, 0x00, 0x00, 0x25, 0x9c, 0x42, 0xc2, 0x62, 0xd8, 0xa2, 0x5e, 0x97, 0x61, 0xc1,
- 0x00, 0x25, 0x9c, 0x42, 0xc2, 0x5f, 0x10, 0xdb, 0x00, 0x00, 0xa9, 0x50, 0x00, 0x20, 0x00, 0x00,
- 0x00, 0x00, 0xf8, 0xab, 0xa9, 0x7e, 0x3f, 0xbd, 0xd6, 0xe1, 0x78, 0x5b, 0x00, 0x40, 0x5f, 0x15,
- 0x71, 0x23, 0x87, 0x11, 0xbd, 0x1f, 0xff, 0xb9, 0xe5, 0xb3, 0x84, 0xbb, 0xec, 0x2a, 0x0a, 0x90,
- 0xd0, 0xa0, 0x1a, 0x6f, 0x90, 0x33, 0x10, 0x83, 0x51, 0x79, 0xa0, 0xda, 0xf8, 0x33, 0x3a, 0x00,
- 0x54, 0x71, 0xf5, 0x96, 0x53, 0x9b, 0x18, 0x23, 0xa3, 0x3c, 0x49, 0x08, 0x54, 0x5c, 0x26, 0x6a,
- 0x85, 0x40, 0x51, 0x5a, 0x1d, 0xa9, 0xc4, 0x9e, 0xa8, 0x5a, 0xfb, 0xf7, 0xde, 0x09, 0x7f, 0x9c,
- 0x6f, 0x35, 0x0b, 0x8b, 0x68, 0x31, 0x2c, 0x10, 0x43, 0xdc, 0x89, 0x83, 0xb1, 0xd9, 0xdd, 0x29,
- 0x73, 0x95, 0x65, 0xb9, 0x4b, 0x43, 0xb3, 0x91, 0x16, 0xec, 0x42, 0x01, 0x86, 0xc9, 0xca,
-}
-
-func TestPacketP6196(t *testing.T) {
- p := gopacket.NewPacket(testPacketP6196, LinkTypeIEEE80211Radio, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
-
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11WEP}, t)
-}
-
-func BenchmarkDecodePacketP6196(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketP6196, LinkTypeIEEE80211Radio, gopacket.NoCopy)
- }
-}
-
-func TestInformationElement(t *testing.T) {
- bin := []byte{
- 0, 0,
- 0, 2, 1, 3,
- 221, 5, 1, 2, 3, 4, 5,
- }
- pkt := gopacket.NewPacket(bin, LayerTypeDot11InformationElement, gopacket.NoCopy)
-
- buf := gopacket.NewSerializeBuffer()
- var sLayers []gopacket.SerializableLayer
- for _, l := range pkt.Layers() {
- sLayers = append(sLayers, l.(*Dot11InformationElement))
- }
- if err := gopacket.SerializeLayers(buf, gopacket.SerializeOptions{}, sLayers...); err != nil {
- t.Error(err.Error())
- }
- if !bytes.Equal(bin, buf.Bytes()) {
- t.Error("build failed")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/gre_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/gre_test.go
deleted file mode 100644
index c7c1ee12f50..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/gre_test.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-package layers
-
-import (
- "github.com/google/gopacket"
- "reflect"
- "testing"
-)
-
-// testPacketGRE is the packet:
-// 15:08:08.003196 IP 192.168.1.1 > 192.168.1.2: GREv0, length 88: IP 172.16.1.1 > 172.16.2.1: ICMP echo request, id 4724, seq 1, length 64
-// 0x0000: 3a56 6b69 595e 8e7a 12c3 a971 0800 4500 :VkiY^.z...q..E.
-// 0x0010: 006c 843c 4000 402f 32d3 c0a8 0101 c0a8 .l.<@.@/2.......
-// 0x0020: 0102 0000 0800 4500 0054 0488 4000 4001 ......E..T..@.@.
-// 0x0030: dafe ac10 0101 ac10 0201 0800 82c4 1274 ...............t
-// 0x0040: 0001 c892 a354 0000 0000 380c 0000 0000 .....T....8.....
-// 0x0050: 0000 1011 1213 1415 1617 1819 1a1b 1c1d ................
-// 0x0060: 1e1f 2021 2223 2425 2627 2829 2a2b 2c2d ...!"#$%&'()*+,-
-// 0x0070: 2e2f 3031 3233 3435 3637 ./01234567
-var testPacketGRE = []byte{
- 0x3a, 0x56, 0x6b, 0x69, 0x59, 0x5e, 0x8e, 0x7a, 0x12, 0xc3, 0xa9, 0x71, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x6c, 0x84, 0x3c, 0x40, 0x00, 0x40, 0x2f, 0x32, 0xd3, 0xc0, 0xa8, 0x01, 0x01, 0xc0, 0xa8,
- 0x01, 0x02, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, 0x00, 0x54, 0x04, 0x88, 0x40, 0x00, 0x40, 0x01,
- 0xda, 0xfe, 0xac, 0x10, 0x01, 0x01, 0xac, 0x10, 0x02, 0x01, 0x08, 0x00, 0x82, 0xc4, 0x12, 0x74,
- 0x00, 0x01, 0xc8, 0x92, 0xa3, 0x54, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-}
-
-func TestPacketGRE(t *testing.T) {
- p := gopacket.NewPacket(testPacketGRE, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeGRE, LayerTypeIPv4, LayerTypeICMPv4, gopacket.LayerTypePayload}, t)
- if got, ok := p.Layer(LayerTypeGRE).(*GRE); ok {
- want := &GRE{
- BaseLayer: BaseLayer{testPacketGRE[34:38], testPacketGRE[38:]},
- Protocol: EthernetTypeIPv4,
- }
- if !reflect.DeepEqual(want, got) {
- t.Errorf("GRE layer mismatch, \nwant %#v\ngot %#v\n", want, got)
- }
- }
-}
-
-func BenchmarkDecodePacketGRE(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketGRE, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// testPacketEthernetOverGRE is the packet:
-// 11:01:38.124768 IP 192.168.1.1 > 192.168.1.2: GREv0, length 102: IP 172.16.1.1 > 172.16.1.2: ICMP echo request, id 3842, seq 1, length 64
-// 0x0000: ea6b 4cd3 5513 d6b9 d880 56ef 0800 4500 .kL.U.....V...E.
-// 0x0010: 007a 0acd 4000 402f ac34 c0a8 0101 c0a8 .z..@.@/.4......
-// 0x0020: 0102 0000 6558 aa6a 36e6 c630 6e32 3ec7 ....eX.j6..0n2>.
-// 0x0030: 9def 0800 4500 0054 d970 4000 4001 0715 ....E..T.p@.@...
-// 0x0040: ac10 0101 ac10 0102 0800 3f15 0f02 0001 ..........?.....
-// 0x0050: 82d9 b154 0000 0000 b5e6 0100 0000 0000 ...T............
-// 0x0060: 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f ................
-// 0x0070: 2021 2223 2425 2627 2829 2a2b 2c2d 2e2f .!"#$%&'()*+,-./
-// 0x0080: 3031 3233 3435 3637 01234567
-var testPacketEthernetOverGRE = []byte{
- 0xea, 0x6b, 0x4c, 0xd3, 0x55, 0x13, 0xd6, 0xb9, 0xd8, 0x80, 0x56, 0xef, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7a, 0x0a, 0xcd, 0x40, 0x00, 0x40, 0x2f, 0xac, 0x34, 0xc0, 0xa8, 0x01, 0x01, 0xc0, 0xa8,
- 0x01, 0x02, 0x00, 0x00, 0x65, 0x58, 0xaa, 0x6a, 0x36, 0xe6, 0xc6, 0x30, 0x6e, 0x32, 0x3e, 0xc7,
- 0x9d, 0xef, 0x08, 0x00, 0x45, 0x00, 0x00, 0x54, 0xd9, 0x70, 0x40, 0x00, 0x40, 0x01, 0x07, 0x15,
- 0xac, 0x10, 0x01, 0x01, 0xac, 0x10, 0x01, 0x02, 0x08, 0x00, 0x3f, 0x15, 0x0f, 0x02, 0x00, 0x01,
- 0x82, 0xd9, 0xb1, 0x54, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-}
-
-func TestPacketEthernetOverGRE(t *testing.T) {
- p := gopacket.NewPacket(testPacketEthernetOverGRE, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeGRE, LayerTypeEthernet, LayerTypeIPv4, LayerTypeICMPv4, gopacket.LayerTypePayload}, t)
- if got, ok := p.Layer(LayerTypeGRE).(*GRE); ok {
- want := &GRE{
- BaseLayer: BaseLayer{testPacketEthernetOverGRE[34:38], testPacketEthernetOverGRE[38:]},
- Protocol: EthernetTypeTransparentEthernetBridging,
- }
- if !reflect.DeepEqual(want, got) {
- t.Errorf("GRE layer mismatch, \nwant %#v\ngot %#v\n", want, got)
- }
- }
-}
-
-func BenchmarkDecodePacketEthernetOverGRE(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketEthernetOverGRE, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/icmp6_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/icmp6_test.go
deleted file mode 100644
index 4a6d248fca5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/icmp6_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2012, Google, Inc. All rights reserved.
-// Copyright 2009-2011 Andreas Krennmair. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "github.com/google/gopacket"
- "net"
- "reflect"
- "testing"
-)
-
-// testPacketICMPv6 is the packet:
-// 10:48:30.088384 IP6 2620:0:1005:0:26be:5ff:fe27:b17 > fe80::21f:caff:feb3:7640: ICMP6, neighbor advertisement, tgt is 2620:0:1005:0:26be:5ff:fe27:b17, length 24
-// 0x0000: 001f cab3 7640 24be 0527 0b17 86dd 6000 ....v@$..'....`.
-// 0x0010: 0000 0018 3aff 2620 0000 1005 0000 26be ....:.&.......&.
-// 0x0020: 05ff fe27 0b17 fe80 0000 0000 0000 021f ...'............
-// 0x0030: caff feb3 7640 8800 1ed6 4000 0000 2620 ....v@....@...&.
-// 0x0040: 0000 1005 0000 26be 05ff fe27 0b17 ......&....'..
-var testPacketICMPv6 = []byte{
- 0x00, 0x1f, 0xca, 0xb3, 0x76, 0x40, 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x86, 0xdd, 0x60, 0x00,
- 0x00, 0x00, 0x00, 0x18, 0x3a, 0xff, 0x26, 0x20, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x26, 0xbe,
- 0x05, 0xff, 0xfe, 0x27, 0x0b, 0x17, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1f,
- 0xca, 0xff, 0xfe, 0xb3, 0x76, 0x40, 0x88, 0x00, 0x1e, 0xd6, 0x40, 0x00, 0x00, 0x00, 0x26, 0x20,
- 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x26, 0xbe, 0x05, 0xff, 0xfe, 0x27, 0x0b, 0x17,
-}
-
-func TestPacketICMPv6(t *testing.T) {
- p := gopacket.NewPacket(testPacketICMPv6, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv6, LayerTypeICMPv6, gopacket.LayerTypePayload}, t)
- if got, ok := p.Layer(LayerTypeIPv6).(*IPv6); ok {
- want := &IPv6{
- BaseLayer: BaseLayer{
- Contents: []byte{0x60, 0x0, 0x0, 0x0, 0x0, 0x18,
- 0x3a, 0xff, 0x26, 0x20, 0x0, 0x0, 0x10, 0x5, 0x0, 0x0, 0x26, 0xbe, 0x5,
- 0xff, 0xfe, 0x27, 0xb, 0x17, 0xfe, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x2, 0x1f, 0xca, 0xff, 0xfe, 0xb3, 0x76, 0x40},
- Payload: []byte{0x88, 0x0, 0x1e, 0xd6, 0x40, 0x0, 0x0, 0x0, 0x26, 0x20,
- 0x0, 0x0, 0x10, 0x5, 0x0, 0x0, 0x26, 0xbe, 0x5, 0xff, 0xfe, 0x27, 0xb,
- 0x17},
- },
- Version: 6,
- TrafficClass: 0,
- FlowLabel: 0,
- Length: 24,
- NextHeader: IPProtocolICMPv6,
- HopLimit: 255,
- SrcIP: net.IP{0x26, 0x20, 0x0, 0x0, 0x10, 0x5, 0x0, 0x0, 0x26, 0xbe, 0x5, 0xff, 0xfe, 0x27, 0xb, 0x17},
- DstIP: net.IP{0xfe, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x1f, 0xca, 0xff, 0xfe, 0xb3, 0x76, 0x40},
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6 packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- } else {
- t.Error("No IPv6 layer type found in packet")
- }
- if got, ok := p.Layer(LayerTypeICMPv6).(*ICMPv6); ok {
- want := &ICMPv6{
- BaseLayer: BaseLayer{
- Contents: []byte{0x88, 0x0, 0x1e, 0xd6, 0x40, 0x0, 0x0, 0x0},
- Payload: []byte{0x26, 0x20, 0x0, 0x0, 0x10,
- 0x5, 0x0, 0x0, 0x26, 0xbe, 0x5, 0xff, 0xfe, 0x27, 0xb, 0x17},
- },
- TypeCode: 0x8800,
- Checksum: 0x1ed6,
- TypeBytes: []byte{0x40, 0x0, 0x0, 0x0},
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("ICMPv6 packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- if got.TypeCode.String() != "NeighborAdvertisement" {
- t.Errorf("ICMPv6 type code, got %q want 'NeighborAdvertisement'", got.TypeCode.String())
- }
- } else {
- t.Error("No ICMPv6 layer type found in packet")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip4_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip4_test.go
deleted file mode 100644
index 5f326679c6c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip4_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-// This file tests some of the functionality provided in the ip4.go
-
-package layers
-
-import (
- "testing"
-)
-
-// Test the function getIPv4OptionSize when the ipv4 has no options
-func TestGetIPOptLengthNoOpt(t *testing.T) {
- ip := IPv4{}
- length := ip.getIPv4OptionSize()
- if length != 0 {
- t.Fatalf("Empty option list should have 0 length. Actual %d", length)
- }
-}
-
-// Test the function getIPv4OptionSize when the ipv4 has end of list option
-func TestGetIPOptLengthEndOfList(t *testing.T) {
- ip := IPv4{}
- ip.Options = append(ip.Options, IPv4Option{OptionType: 0, OptionLength: 1})
- length := ip.getIPv4OptionSize()
- if length != 4 {
- t.Fatalf("After padding, the list should have 4 length. Actual %d", length)
- }
-}
-
-// Test the function getIPv4OptionSize when the ipv4 has padding and end of list option
-func TestGetIPOptLengthPaddingEndOfList(t *testing.T) {
- ip := IPv4{}
- ip.Options = append(ip.Options, IPv4Option{OptionType: 1, OptionLength: 1})
- ip.Options = append(ip.Options, IPv4Option{OptionType: 0, OptionLength: 1})
- length := ip.getIPv4OptionSize()
- if length != 4 {
- t.Fatalf("After padding, the list should have 4 length. Actual %d", length)
- }
-}
-
-// Test the function getIPv4OptionSize when the ipv4 has some non-trivial option and end of list option
-func TestGetIPOptLengthOptionEndOfList(t *testing.T) {
- ip := IPv4{}
- someByte := make([]byte, 8)
- ip.Options = append(ip.Options, IPv4Option{OptionType: 2, OptionLength: 10, OptionData: someByte})
- ip.Options = append(ip.Options, IPv4Option{OptionType: 0, OptionLength: 1})
- length := ip.getIPv4OptionSize()
- if length != 12 {
- t.Fatalf("The list should have 12 length. Actual %d", length)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip6_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip6_test.go
deleted file mode 100644
index ab22f1784ce..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ip6_test.go
+++ /dev/null
@@ -1,430 +0,0 @@
-// Copyright 2014, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "bytes"
- "github.com/google/gopacket"
- "net"
- "reflect"
- "testing"
-)
-
-func TestSerializeIPv6HeaderTLVOptions(t *testing.T) {
- //RFC 2460 Appendix B
- /*
- Example 3
-
- A Hop-by-Hop or Destination Options header containing both options X
- and Y from Examples 1 and 2 would have one of the two following
- formats, depending on which option appeared first:
-
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Next Header | Hdr Ext Len=3 | Option Type=X |Opt Data Len=12|
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | 4-octet field |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | |
- + 8-octet field +
- | |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | PadN Option=1 |Opt Data Len=1 | 0 | Option Type=Y |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- |Opt Data Len=7 | 1-octet field | 2-octet field |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | 4-octet field |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | PadN Option=1 |Opt Data Len=2 | 0 | 0 |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
- opt1 := &ipv6HeaderTLVOption{}
- opt1.OptionType = 0x1e
- opt1.OptionData = []byte{0xaa, 0xaa, 0xaa, 0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb}
- opt1.OptionAlignment = [2]uint8{8, 2}
-
- opt2 := &ipv6HeaderTLVOption{}
- opt2.OptionType = 0x3e
- opt2.OptionData = []byte{0x11, 0x22, 0x22, 0x44, 0x44, 0x44, 0x44}
- opt2.OptionAlignment = [2]uint8{4, 3}
-
- l := serializeIPv6HeaderTLVOptions(nil, []*ipv6HeaderTLVOption{opt1, opt2}, true)
- b := make([]byte, l)
- serializeIPv6HeaderTLVOptions(b, []*ipv6HeaderTLVOption{opt1, opt2}, true)
- got := b
- want := []byte{0x1e, 0x0c, 0xaa, 0xaa, 0xaa, 0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0x01, 0x01, 0x00, 0x3e, 0x07, 0x11, 0x22, 0x22, 0x44, 0x44, 0x44, 0x44, 0x01, 0x02, 0x00, 0x00}
-
- if !bytes.Equal(got, want) {
- t.Errorf("IPv6HeaderTLVOption serialize (X,Y) failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-
- /*
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | Next Header | Hdr Ext Len=3 | Pad1 Option=0 | Option Type=Y |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- |Opt Data Len=7 | 1-octet field | 2-octet field |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | 4-octet field |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | PadN Option=1 |Opt Data Len=4 | 0 | 0 |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | 0 | 0 | Option Type=X |Opt Data Len=12|
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | 4-octet field |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- | |
- + 8-octet field +
- | |
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
- l = serializeIPv6HeaderTLVOptions(nil, []*ipv6HeaderTLVOption{opt2, opt1}, true)
- b = make([]byte, l)
- serializeIPv6HeaderTLVOptions(b, []*ipv6HeaderTLVOption{opt2, opt1}, true)
- got = b
- want = []byte{0x00, 0x3e, 0x07, 0x11, 0x22, 0x22, 0x44, 0x44, 0x44, 0x44, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0xaa, 0xaa, 0xaa, 0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb}
-
- if !bytes.Equal(got, want) {
- t.Errorf("IPv6HeaderTLVOption serialize (Y,X) failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-}
-
-var testPacketIPv6HopByHop0 = []byte{
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x40, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3b, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00,
-}
-
-func TestPacketIPv6HopByHop0Serialize(t *testing.T) {
- var serialize []gopacket.SerializableLayer = make([]gopacket.SerializableLayer, 0, 2)
- var err error
-
- ip6 := &IPv6{}
- ip6.Version = 6
- ip6.NextHeader = IPProtocolIPv6HopByHop
- ip6.HopLimit = 64
- ip6.SrcIP = net.ParseIP("2001:db8::1")
- ip6.DstIP = net.ParseIP("2001:db8::2")
- serialize = append(serialize, ip6)
-
- tlv := &IPv6HopByHopOption{}
- tlv.OptionType = 0x01 //PadN
- tlv.OptionData = []byte{0x00, 0x00, 0x00, 0x00}
- hop := &IPv6HopByHop{}
- hop.Options = append(hop.Options, tlv)
- hop.NextHeader = IPProtocolNoNextHeader
- ip6.HopByHop = hop
-
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true}
- err = gopacket.SerializeLayers(buf, opts, serialize...)
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.Bytes()
- want := testPacketIPv6HopByHop0
- if !bytes.Equal(got, want) {
- t.Errorf("IPv6HopByHop serialize failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-}
-
-func TestPacketIPv6HopByHop0Decode(t *testing.T) {
- ip6 := &IPv6{
- BaseLayer: BaseLayer{
- Contents: []byte{
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x40, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
- },
- Payload: []byte{0x3b, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00},
- },
- Version: 6,
- TrafficClass: 0,
- FlowLabel: 0,
- Length: 8,
- NextHeader: IPProtocolIPv6HopByHop,
- HopLimit: 64,
- SrcIP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
- DstIP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
- }
-
- hop := &ip6.hbh
- hop.ipv6ExtensionBase = ipv6ExtensionBase{
- BaseLayer: BaseLayer{
- Contents: []byte{0x3b, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00},
- Payload: []byte{},
- },
- NextHeader: IPProtocolNoNextHeader,
- HeaderLength: uint8(0),
- ActualLength: 8,
- }
- opt := &IPv6HopByHopOption{
- OptionType: uint8(0x01),
- OptionLength: uint8(0x04),
- ActualLength: 6,
- OptionData: []byte{0x00, 0x00, 0x00, 0x00},
- }
- hop.Options = append(hop.Options, opt)
- ip6.HopByHop = hop
-
- p := gopacket.NewPacket(testPacketIPv6HopByHop0, LinkTypeRaw, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeIPv6, LayerTypeIPv6HopByHop}, t)
- if got, ok := p.Layer(LayerTypeIPv6).(*IPv6); ok {
- want := ip6
- want.HopByHop = got.HopByHop // avoid comparing pointers
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6 packet processing failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
- } else {
- t.Error("No IPv6 layer type found in packet")
- }
- if got, ok := p.Layer(LayerTypeIPv6HopByHop).(*IPv6HopByHop); ok {
- want := hop
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6HopByHop packet processing failed:\ngot\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
- } else {
- t.Error("No IPv6HopByHop layer type found in packet")
- }
-}
-
-// testPacketIPv6Destination0 is the packet:
-// 12:40:14.429409595 IP6 2001:db8::1 > 2001:db8::2: DSTOPT no next header
-// 0x0000: 6000 0000 0008 3c40 2001 0db8 0000 0000 `.....<@........
-// 0x0010: 0000 0000 0000 0001 2001 0db8 0000 0000 ................
-// 0x0020: 0000 0000 0000 0002 3b00 0104 0000 0000 ........;.......
-var testPacketIPv6Destination0 = []byte{
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3c, 0x40, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3b, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00,
-}
-
-func TestPacketIPv6Destination0Serialize(t *testing.T) {
- var serialize []gopacket.SerializableLayer = make([]gopacket.SerializableLayer, 0, 2)
- var err error
-
- ip6 := &IPv6{}
- ip6.Version = 6
- ip6.NextHeader = IPProtocolIPv6Destination
- ip6.HopLimit = 64
- ip6.SrcIP = net.ParseIP("2001:db8::1")
- ip6.DstIP = net.ParseIP("2001:db8::2")
- serialize = append(serialize, ip6)
-
- tlv := &IPv6DestinationOption{}
- tlv.OptionType = 0x01 //PadN
- tlv.OptionData = []byte{0x00, 0x00, 0x00, 0x00}
- dst := &IPv6Destination{}
- dst.Options = append(dst.Options, tlv)
- dst.NextHeader = IPProtocolNoNextHeader
- serialize = append(serialize, dst)
-
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true}
- err = gopacket.SerializeLayers(buf, opts, serialize...)
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.Bytes()
- want := testPacketIPv6Destination0
- if !bytes.Equal(got, want) {
- t.Errorf("IPv6Destination serialize failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-}
-
-func TestPacketIPv6Destination0Decode(t *testing.T) {
- ip6 := &IPv6{
- BaseLayer: BaseLayer{
- Contents: []byte{
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3c, 0x40, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
- },
- Payload: []byte{0x3b, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00},
- },
- Version: 6,
- TrafficClass: 0,
- FlowLabel: 0,
- Length: 8,
- NextHeader: IPProtocolIPv6Destination,
- HopLimit: 64,
- SrcIP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
- DstIP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
- }
-
- dst := &IPv6Destination{}
- dst.BaseLayer = BaseLayer{
- Contents: []byte{0x3b, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00},
- Payload: []byte{},
- }
- dst.NextHeader = IPProtocolNoNextHeader
- dst.HeaderLength = uint8(0)
- dst.ActualLength = 8
- opt := &IPv6DestinationOption{
- OptionType: uint8(0x01),
- OptionLength: uint8(0x04),
- ActualLength: 6,
- OptionData: []byte{0x00, 0x00, 0x00, 0x00},
- }
- dst.Options = append(dst.Options, opt)
-
- p := gopacket.NewPacket(testPacketIPv6Destination0, LinkTypeRaw, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeIPv6, LayerTypeIPv6Destination}, t)
- if got, ok := p.Layer(LayerTypeIPv6).(*IPv6); ok {
- want := ip6
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6 packet processing failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
- } else {
- t.Error("No IPv6 layer type found in packet")
- }
- if got, ok := p.Layer(LayerTypeIPv6Destination).(*IPv6Destination); ok {
- want := dst
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6Destination packet processing failed:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
- } else {
- t.Error("No IPv6Destination layer type found in packet")
- }
-}
-
-var testPacketIPv6JumbogramHeader = []byte{
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3b, 0x00, 0xc2, 0x04, 0x00, 0x01, 0x00, 0x08,
-}
-
-func TestIPv6JumbogramSerialize(t *testing.T) {
- var serialize []gopacket.SerializableLayer = make([]gopacket.SerializableLayer, 0, 2)
- var err error
-
- ip6 := &IPv6{}
- ip6.Version = 6
- ip6.NextHeader = IPProtocolNoNextHeader
- ip6.HopLimit = 64
- ip6.SrcIP = net.ParseIP("2001:db8::1")
- ip6.DstIP = net.ParseIP("2001:db8::2")
- serialize = append(serialize, ip6)
-
- payload := make([]byte, ipv6MaxPayloadLength+1)
- for i := range payload {
- payload[i] = 0xfe
- }
- serialize = append(serialize, gopacket.Payload(payload))
-
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true}
- err = gopacket.SerializeLayers(buf, opts, serialize...)
- if err != nil {
- t.Fatal(err)
- }
-
- got := buf.Bytes()
- w := new(bytes.Buffer)
- w.Write(testPacketIPv6JumbogramHeader)
- w.Write(payload)
- want := w.Bytes()
-
- if !bytes.Equal(got, want) {
- t.Errorf("IPv6 Jumbogram serialize failed:\ngot:\n%v\n\nwant:\n%v\n\n",
- gopacket.LongBytesGoString(got), gopacket.LongBytesGoString(want))
- }
-}
-
-func TestIPv6JumbogramDecode(t *testing.T) {
- payload := make([]byte, ipv6MaxPayloadLength+1)
- for i := range payload {
- payload[i] = 0xfe
- }
-
- ip6 := &IPv6{
- BaseLayer: BaseLayer{
- Contents: []byte{
- 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
- },
- },
- Version: 6,
- TrafficClass: 0,
- FlowLabel: 0,
- Length: 0,
- NextHeader: IPProtocolIPv6HopByHop,
- HopLimit: 64,
- SrcIP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
- DstIP: net.IP{0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
- }
- buf := new(bytes.Buffer)
- buf.Write([]byte{0x3b, 0x00, 0xc2, 0x04, 0x00, 0x01, 0x00, 0x08})
- buf.Write(payload)
- ip6.Payload = buf.Bytes()
-
- hop := &ip6.hbh
- hop.Contents = []byte{0x3b, 0x00, 0xc2, 0x04, 0x00, 0x01, 0x00, 0x08}
- hop.Payload = payload
- hop.NextHeader = IPProtocolNoNextHeader
- hop.HeaderLength = uint8(0)
- hop.ActualLength = 8
- opt := &IPv6HopByHopOption{}
- opt.OptionType = uint8(0xc2)
- opt.OptionLength = uint8(0x04)
- opt.ActualLength = 6
- opt.OptionData = []byte{0x00, 0x01, 0x00, 0x08}
- hop.Options = append(hop.Options, opt)
- ip6.HopByHop = hop
-
- pkt := new(bytes.Buffer)
- pkt.Write(testPacketIPv6JumbogramHeader)
- pkt.Write(payload)
-
- p := gopacket.NewPacket(pkt.Bytes(), LinkTypeRaw, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeIPv6, LayerTypeIPv6HopByHop, gopacket.LayerTypePayload}, t)
-
- if got, ok := p.Layer(LayerTypeIPv6).(*IPv6); ok {
- want := ip6
- want.HopByHop = got.HopByHop // Hack, avoid comparing pointers
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6 packet processing failed:\ngot:\n%v\n\nwant:\n%v\n\n",
- gopacket.LayerGoString(got), gopacket.LayerGoString(want))
- }
- } else {
- t.Error("No IPv6 layer type found in packet")
- }
-
- if got, ok := p.Layer(LayerTypeIPv6HopByHop).(*IPv6HopByHop); ok {
- want := hop
- if !reflect.DeepEqual(got, want) {
- t.Errorf("IPv6HopByHop packet processing failed:\ngot:\n%v\n\nwant:\n%v\n\n",
- gopacket.LayerGoString(got), gopacket.LayerGoString(want))
- }
- } else {
- t.Error("No IPv6HopByHop layer type found in packet")
- }
-
- if got, ok := p.Layer(gopacket.LayerTypePayload).(*gopacket.Payload); ok {
- want := (*gopacket.Payload)(&payload)
- if !reflect.DeepEqual(got, want) {
- t.Errorf("Payload packet processing failed:\ngot:\n%v\n\nwant:\n%v\n\n",
- gopacket.LayerGoString(got), gopacket.LayerGoString(want))
- }
- } else {
- t.Error("No Payload layer type found in packet")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ipsec_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ipsec_test.go
deleted file mode 100644
index 466646d75f7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/ipsec_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2012, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "github.com/google/gopacket"
- "reflect"
- "testing"
-)
-
-// testPacketIPSecAHTransport is the packet:
-// 20:45:10.325850 IP 192.168.1.1 > 192.168.1.2: AH(spi=0x00000101,seq=0x1): ICMP echo request, id 1560, seq 1, length 64
-// 0x0000: 7ec0 ffc6 48f1 1a0e 3c4e 3b3a 0800 4500 ~...H...<N;:..E.
-// 0x0010: 006c 650a 4000 4033 5201 c0a8 0101 c0a8 .le.@.@3R.......
-// 0x0020: 0102 0104 0000 0000 0101 0000 0001 2533 ..............%3
-// 0x0030: 01b1 a20b b6f1 bdbf 9d9e 0800 fbe5 0618 ................
-// 0x0040: 0001 c6e1 a354 0000 0000 c8f7 0400 0000 .....T..........
-// 0x0050: 0000 1011 1213 1415 1617 1819 1a1b 1c1d ................
-// 0x0060: 1e1f 2021 2223 2425 2627 2829 2a2b 2c2d ...!"#$%&'()*+,-
-// 0x0070: 2e2f 3031 3233 3435 3637 ./01234567
-var testPacketIPSecAHTransport = []byte{
- 0x7e, 0xc0, 0xff, 0xc6, 0x48, 0xf1, 0x1a, 0x0e, 0x3c, 0x4e, 0x3b, 0x3a, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x6c, 0x65, 0x0a, 0x40, 0x00, 0x40, 0x33, 0x52, 0x01, 0xc0, 0xa8, 0x01, 0x01, 0xc0, 0xa8,
- 0x01, 0x02, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x25, 0x33,
- 0x01, 0xb1, 0xa2, 0x0b, 0xb6, 0xf1, 0xbd, 0xbf, 0x9d, 0x9e, 0x08, 0x00, 0xfb, 0xe5, 0x06, 0x18,
- 0x00, 0x01, 0xc6, 0xe1, 0xa3, 0x54, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xf7, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-}
-
-func TestPacketIPSecAHTransport(t *testing.T) {
- p := gopacket.NewPacket(testPacketIPSecAHTransport, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeIPSecAH, LayerTypeICMPv4, gopacket.LayerTypePayload}, t)
- if got, ok := p.Layer(LayerTypeIPSecAH).(*IPSecAH); ok {
- want := &IPSecAH{
- Reserved: 0x0,
- SPI: 0x101,
- Seq: 1,
- AuthenticationData: []byte{0x25, 0x33, 0x01, 0xb1, 0xa2, 0x0b, 0xb6, 0xf1, 0xbd, 0xbf, 0x9d, 0x9e},
- }
- want.BaseLayer = BaseLayer{testPacketIPSecAHTransport[34:58], testPacketIPSecAHTransport[58:]}
- want.NextHeader = IPProtocolICMPv4
- want.HeaderLength = 0x4
- want.ActualLength = 0x18
- if !reflect.DeepEqual(want, got) {
- t.Errorf("IPSecAH layer mismatch, \nwant %#v\ngot %#v\n", want, got)
- }
- }
-}
-
-func BenchmarkDecodePacketIPSecAHTransport(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketIPSecAHTransport, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// testPacketIPSecAHTunnel is the packet:
-// 14:45:43.252917 IP 192.168.1.1 > 192.168.1.2: AH(spi=0x00000101,seq=0x1): IP 172.16.1.1 > 172.16.2.1: ICMP echo request, id 31322, seq 1, length 64 (ipip-proto-4)
-// 0x0000: 7220 4d91 63c9 566c ed2d 73cd 0800 4500 r.M.c.Vl.-s...E.
-// 0x0010: 0080 0000 4000 4033 b6f7 c0a8 0101 c0a8 ....@.@3........
-// 0x0020: 0102 0404 0000 0000 0101 0000 0001 cca4 ................
-// 0x0030: 01da 9eb4 fb75 10fe 5a59 4500 0054 a96f .....u..ZYE..T.o
-// 0x0040: 4000 4001 3617 ac10 0101 ac10 0201 0800 @.@.6...........
-// 0x0050: d75f 7a5a 0001 0741 3355 0000 0000 a9db ._zZ...A3U......
-// 0x0060: 0300 0000 0000 1011 1213 1415 1617 1819 ................
-// 0x0070: 1a1b 1c1d 1e1f 2021 2223 2425 2627 2829 .......!"#$%&'()
-// 0x0080: 2a2b 2c2d 2e2f 3031 3233 3435 3637 *+,-./01234567
-var testPacketIPSecAHTunnel = []byte{
- 0x72, 0x20, 0x4d, 0x91, 0x63, 0xc9, 0x56, 0x6c, 0xed, 0x2d, 0x73, 0xcd, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x40, 0x33, 0xb6, 0xf7, 0xc0, 0xa8, 0x01, 0x01, 0xc0, 0xa8,
- 0x01, 0x02, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0xcc, 0xa4,
- 0x01, 0xda, 0x9e, 0xb4, 0xfb, 0x75, 0x10, 0xfe, 0x5a, 0x59, 0x45, 0x00, 0x00, 0x54, 0xa9, 0x6f,
- 0x40, 0x00, 0x40, 0x01, 0x36, 0x17, 0xac, 0x10, 0x01, 0x01, 0xac, 0x10, 0x02, 0x01, 0x08, 0x00,
- 0xd7, 0x5f, 0x7a, 0x5a, 0x00, 0x01, 0x07, 0x41, 0x33, 0x55, 0x00, 0x00, 0x00, 0x00, 0xa9, 0xdb,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
- 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-}
-
-func TestPacketIPSecAHTunnel(t *testing.T) {
- p := gopacket.NewPacket(testPacketIPSecAHTunnel, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeIPSecAH, LayerTypeIPv4, LayerTypeICMPv4, gopacket.LayerTypePayload}, t)
- if got, ok := p.Layer(LayerTypeIPSecAH).(*IPSecAH); ok {
- want := &IPSecAH{
- Reserved: 0x0,
- SPI: 0x101,
- Seq: 1,
- AuthenticationData: []byte{0xcc, 0xa4, 0x01, 0xda, 0x9e, 0xb4, 0xfb, 0x75, 0x10, 0xfe, 0x5a, 0x59},
- }
- want.BaseLayer = BaseLayer{testPacketIPSecAHTunnel[34:58], testPacketIPSecAHTunnel[58:]}
- want.NextHeader = IPProtocolIPv4
- want.HeaderLength = 0x4
- want.ActualLength = 0x18
- if !reflect.DeepEqual(want, got) {
- t.Errorf("IPSecAH layer mismatch, \nwant %#v\ngot %#v\n", want, got)
- }
- }
-}
-
-func BenchmarkDecodePacketIPSecAHTunnel(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketIPSecAHTunnel, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-// testPacketIPSecESP is the packet:
-// 04:30:37.629376 IP 190.0.0.1 > 190.0.0.2: ESP(spi=0x0000006e,seq=0x13), length 116
-// 0x0000: 0000 0000 0012 0011 434a d70a 0800 4500 ........CJ....E.
-// 0x0010: 0088 0000 4000 4032 be40 be00 0001 be00 ....@.@2.@......
-// 0x0020: 0002 0000 006e 0000 0013 82f4 1077 0418 .....n.......w..
-// 0x0030: e8ce dc45 1bac 22bb daaf 2ad2 c2e8 315b ...E.."...*...1[
-// 0x0040: ce9a 39da 2aae cf43 3716 70ab 7e7c 4676 ..9.*..C7.p.~|Fv
-// 0x0050: c3fc d109 c990 274d f81c 6534 9a40 a0ef ......'M..e4.@..
-// 0x0060: 46b1 7da5 05af dda8 d0ba 6e23 d1ee 1f10 F.}.......n#....
-// 0x0070: 730c 7371 03b1 445c 2f70 852f 8475 12fb s.sq..D\/p./.u..
-// 0x0080: b057 a19b a617 bae7 09ca 8836 942f 3334 .W.........6./34
-// 0x0090: 312b 96d2 a4e3 1+....
-var testPacketIPSecESP = []byte{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x11, 0x43, 0x4a, 0xd7, 0x0a, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x88, 0x00, 0x00, 0x40, 0x00, 0x40, 0x32, 0xbe, 0x40, 0xbe, 0x00, 0x00, 0x01, 0xbe, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x13, 0x82, 0xf4, 0x10, 0x77, 0x04, 0x18,
- 0xe8, 0xce, 0xdc, 0x45, 0x1b, 0xac, 0x22, 0xbb, 0xda, 0xaf, 0x2a, 0xd2, 0xc2, 0xe8, 0x31, 0x5b,
- 0xce, 0x9a, 0x39, 0xda, 0x2a, 0xae, 0xcf, 0x43, 0x37, 0x16, 0x70, 0xab, 0x7e, 0x7c, 0x46, 0x76,
- 0xc3, 0xfc, 0xd1, 0x09, 0xc9, 0x90, 0x27, 0x4d, 0xf8, 0x1c, 0x65, 0x34, 0x9a, 0x40, 0xa0, 0xef,
- 0x46, 0xb1, 0x7d, 0xa5, 0x05, 0xaf, 0xdd, 0xa8, 0xd0, 0xba, 0x6e, 0x23, 0xd1, 0xee, 0x1f, 0x10,
- 0x73, 0x0c, 0x73, 0x71, 0x03, 0xb1, 0x44, 0x5c, 0x2f, 0x70, 0x85, 0x2f, 0x84, 0x75, 0x12, 0xfb,
- 0xb0, 0x57, 0xa1, 0x9b, 0xa6, 0x17, 0xba, 0xe7, 0x09, 0xca, 0x88, 0x36, 0x94, 0x2f, 0x33, 0x34,
- 0x31, 0x2b, 0x96, 0xd2, 0xa4, 0xe3,
-}
-
-func TestPacketIPSecESP(t *testing.T) {
- p := gopacket.NewPacket(testPacketIPSecESP, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeIPSecESP}, t)
-}
-
-func BenchmarkDecodePacketIPSecESP(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketIPSecESP, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/prism_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/prism_test.go
deleted file mode 100644
index 136a04cb6fe..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/prism_test.go
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2014, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "net"
- "reflect"
- "testing"
-
- "github.com/google/gopacket"
-)
-
-// Generator: python layers/test_creator.py --layerType=LayerTypePrismHeader --linkType=LinkTypePrismHeader --name=Prism%s ~/tmp/dump.pcap
-// http://wiki.wireshark.org/SampleCaptures#Sample_Captures
-
-// testPacketPrism is the packet:
-// 21:32:37.616872 BSSID:Broadcast DA:Broadcast SA:cc:fa:00:ad:79:e8 (oui Unknown) Probe Request () [1.0 2.0 5.5 11.0 Mbit]
-// 0x0000: 4400 0000 9000 0000 7261 3000 0000 0000
-// 0x0010: 0000 0000 0000 0000 4400 0100 0000 0400
-// 0x0020: f9c1 2900 4400 0200 0000 0000 0000 0000
-// 0x0030: 4400 0300 0000 0400 0a00 0000 4400 0400
-// 0x0040: 0000 0400 e1ff ffff 0000 0000 0000 0000
-// 0x0050: 0000 0000 4400 0600 0000 0400 0000 0000
-// 0x0060: 4400 0700 0000 0400 0000 0000 4400 0800
-// 0x0070: 0000 0400 0200 0000 4400 0900 0000 0000
-// 0x0080: 0000 0000 4400 0a00 0000 0400 7e00 0000
-// 0x0090: 4000 0000 ffff ffff ffff ccfa 00ad 79e8
-// 0x00a0: ffff ffff ffff a041 0000 0104 0204 0b16
-// 0x00b0: 3208 0c12 1824 3048 606c 0301 012d 1a2d
-// 0x00c0: 1117 ff00 0000 0000 0000 0000 0000 0000
-// 0x00d0: 0000 0000 0000 0000 007f 0800 0000 0000
-// 0x00e0: 0000 40dd 0900 1018 0200 0010 0000 dd1e
-// 0x00f0: 0090 4c33 2d11 17ff 0000 0000 0000 0000
-// 0x0100: 0000 0000 0000 0000 0000 0000 0000
-
-var testPacketPrism = []byte{
- 0x44, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x72, 0x61, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00,
- 0xf9, 0xc1, 0x29, 0x00, 0x44, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x44, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x04, 0x00, 0xe1, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x08, 0x00,
- 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x00, 0x00,
- 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xfa, 0x00, 0xad, 0x79, 0xe8,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x41, 0x00, 0x00, 0x01, 0x04, 0x02, 0x04, 0x0b, 0x16,
- 0x32, 0x08, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0x03, 0x01, 0x01, 0x2d, 0x1a, 0x2d,
- 0x11, 0x17, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x40, 0xdd, 0x09, 0x00, 0x10, 0x18, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0xdd, 0x1e,
- 0x00, 0x90, 0x4c, 0x33, 0x2d, 0x11, 0x17, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-}
-
-func TestPacketPrism(t *testing.T) {
- p := gopacket.NewPacket(testPacketPrism, LinkTypePrismHeader, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypePrismHeader, LayerTypeDot11, LayerTypeDot11MgmtProbeReq}, t)
-
- if got, ok := p.Layer(LayerTypePrismHeader).(*PrismHeader); ok {
- want := &PrismHeader{
- BaseLayer: BaseLayer{
- Contents: []uint8{0x44, 0x0, 0x0, 0x0, 0x90, 0x0, 0x0, 0x0, 0x72, 0x61, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x1, 0x0, 0x0, 0x0, 0x4, 0x0, 0xf9, 0xc1, 0x29, 0x0, 0x44, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x3, 0x0, 0x0, 0x0, 0x4, 0x0, 0xa, 0x0, 0x0, 0x0, 0x44, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0xe1, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x6, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x7, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0x8, 0x0, 0x0, 0x0, 0x4, 0x0, 0x2, 0x0, 0x0, 0x0, 0x44, 0x0, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x44, 0x0, 0xa, 0x0, 0x0, 0x0, 0x4, 0x0, 0x7e, 0x0, 0x0, 0x0},
- Payload: []uint8{0x40, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xfa, 0x0, 0xad, 0x79, 0xe8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x41, 0x0, 0x0, 0x1, 0x4, 0x2, 0x4, 0xb, 0x16, 0x32, 0x8, 0xc, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0x3, 0x1, 0x1, 0x2d, 0x1a, 0x2d, 0x11, 0x17, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0xdd, 0x9, 0x0, 0x10, 0x18, 0x2, 0x0, 0x0, 0x10, 0x0, 0x0, 0xdd, 0x1e, 0x0, 0x90, 0x4c, 0x33, 0x2d, 0x11, 0x17, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, Code: 0x44, Length: 0x90, DeviceName: "ra0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
- Values: []PrismValue{
- PrismValue{DID: PrismDIDType1HostTime, Status: 0x0, Length: 0x4, Data: []uint8{0xf9, 0xc1, 0x29, 0x0}},
- PrismValue{DID: PrismDIDType1MACTime, Status: 0x0, Length: 0x0, Data: []uint8{}},
- PrismValue{DID: PrismDIDType1Channel, Status: 0x0, Length: 0x4, Data: []uint8{0xa, 0x0, 0x0, 0x0}},
- PrismValue{DID: PrismDIDType1RSSI, Status: 0x0, Length: 0x4, Data: []uint8{0xe1, 0xff, 0xff, 0xff}},
- PrismValue{DID: 0x0, Status: 0x0, Length: 0x0, Data: []uint8{}},
- PrismValue{DID: PrismDIDType1Signal, Status: 0x0, Length: 0x4, Data: []uint8{0x0, 0x0, 0x0, 0x0}},
- PrismValue{DID: PrismDIDType1Noise, Status: 0x0, Length: 0x4, Data: []uint8{0x0, 0x0, 0x0, 0x0}},
- PrismValue{DID: PrismDIDType1Rate, Status: 0x0, Length: 0x4, Data: []uint8{0x2, 0x0, 0x0, 0x0}},
- PrismValue{DID: PrismDIDType1TransmittedFrameIndicator, Status: 0x0, Length: 0x0, Data: []uint8{}},
- PrismValue{DID: PrismDIDType1FrameLength, Status: 0x0, Length: 0x4, Data: []uint8{0x7e, 0x0, 0x0, 0x0}},
- },
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("RadioTap packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-
- if got, ok := p.Layer(LayerTypeDot11).(*Dot11); ok {
- want := &Dot11{
- BaseLayer: BaseLayer{
- Contents: []uint8{0x40, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcc, 0xfa, 0x0, 0xad, 0x79, 0xe8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa0, 0x41},
- Payload: []uint8{0x0, 0x0, 0x1, 0x4, 0x2, 0x4, 0xb, 0x16, 0x32, 0x8, 0xc, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 0x3, 0x1, 0x1, 0x2d, 0x1a, 0x2d, 0x11, 0x17, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0xdd, 0x9, 0x0, 0x10, 0x18, 0x2, 0x0, 0x0, 0x10, 0x0, 0x0, 0xdd, 0x1e, 0x0, 0x90, 0x4c, 0x33, 0x2d, 0x11, 0x17, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- },
- Type: 0x10,
- Proto: 0x0,
- Flags: 0x0,
- DurationID: 0x0,
- Address1: net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- Address2: net.HardwareAddr{0xcc, 0xfa, 0x0, 0xad, 0x79, 0xe8},
- Address3: net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- Address4: net.HardwareAddr(nil),
- SequenceNumber: 0x041a,
- FragmentNumber: 0x0,
- Checksum: 0x0,
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("Dot11 packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-}
-
-func BenchmarkDecodePacketPrism(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketPrism, LinkTypePrismHeader, gopacket.NoCopy)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/radiotap_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/radiotap_test.go
deleted file mode 100644
index 4d3c7d01f95..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/radiotap_test.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-package layers
-
-import (
- "github.com/google/gopacket"
- "testing"
-)
-
-// testPacketRadiotap0 is the packet:
-// 09:34:34.799438 1.0 Mb/s 2412 MHz 11b -58dB signal antenna 7 Acknowledgment RA:88:1f:a1:ae:9d:cb
-// 0x0000: 0000 1200 2e48 0000 1002 6c09 a000 c607 .....H....l.....
-// 0x0010: 0000 d400 0000 881f a1ae 9dcb c630 4b4b .............0KK
-var testPacketRadiotap0 = []byte{
- 0x00, 0x00, 0x12, 0x00, 0x2e, 0x48, 0x00, 0x00, 0x10, 0x02, 0x6c, 0x09, 0xa0, 0x00, 0xc6, 0x07,
- 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x88, 0x1f, 0xa1, 0xae, 0x9d, 0xcb, 0xc6, 0x30, 0x4b, 0x4b,
-}
-
-func TestPacketRadiotap0(t *testing.T) {
- p := gopacket.NewPacket(testPacketRadiotap0, LayerTypeRadioTap, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11}, t)
- rt := p.Layer(LayerTypeRadioTap).(*RadioTap)
- if rt.ChannelFrequency != 2412 || rt.DBMAntennaSignal != -58 || rt.Antenna != 7 {
- t.Error("Radiotap decode error")
- }
- if rt.Rate != 2 { // 500Kbps unit
- t.Error("Radiotap Rate decode error")
- }
-}
-func BenchmarkDecodePacketRadiotap0(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketRadiotap0, LayerTypeRadioTap, gopacket.NoCopy)
- }
-}
-
-// testPacketRadiotap1 is the packet:
-// 05:24:21.380948 2412 MHz 11g -36dB signal antenna 5 65.0 Mb/s MCS 7 20 MHz lon GI
-// 0x0000: 0000 1500 2a48 0800 1000 6c09 8004 dc05 ....*H....l.....
-// 0x0010: 0000 0700 0748 112c 0000 3a9d aaf0 191c .....H.,..:.....
-// 0x0020: aba7 f213 9d00 3a9d aaf0 1970 b2ee a9f1 ......:....p....
-// 0x0030: 16 .
-var testPacketRadiotap1 = []byte{
- 0x00, 0x00, 0x15, 0x00, 0x2a, 0x48, 0x08, 0x00, 0x10, 0x00, 0x6c, 0x09, 0x80, 0x04, 0xdc, 0x05,
- 0x00, 0x00, 0x07, 0x00, 0x07, 0x48, 0x11, 0x2c, 0x00, 0x00, 0x3a, 0x9d, 0xaa, 0xf0, 0x19, 0x1c,
- 0xab, 0xa7, 0xf2, 0x13, 0x9d, 0x00, 0x3a, 0x9d, 0xaa, 0xf0, 0x19, 0x70, 0xb2, 0xee, 0xa9, 0xf1,
- 0x16,
-}
-
-func TestPacketRadiotap1(t *testing.T) {
- p := gopacket.NewPacket(testPacketRadiotap1, LayerTypeRadioTap, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11}, t)
- rt := p.Layer(LayerTypeRadioTap).(*RadioTap)
- if rt.ChannelFrequency != 2412 || rt.DBMAntennaSignal != -36 || rt.Antenna != 5 {
- t.Error("Radiotap decode error")
- }
- if !rt.MCS.Known.MCSIndex() || rt.MCS.MCS != 7 {
- t.Error("Radiotap MCS error")
- }
- if !rt.MCS.Known.Bandwidth() || rt.MCS.Flags.Bandwidth() != 0 {
- t.Error("Radiotap bandwidth error")
- }
- if !rt.MCS.Known.GuardInterval() || rt.MCS.Flags.ShortGI() {
- t.Error("Radiotap GI error")
- }
-}
-func BenchmarkDecodePacketRadiotap1(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketRadiotap1, LayerTypeRadioTap, gopacket.NoCopy)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/sflow_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/sflow_test.go
deleted file mode 100644
index a070465cbea..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/sflow_test.go
+++ /dev/null
@@ -1,820 +0,0 @@
-// Copyright 2014 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-package layers
-
-import (
- "github.com/google/gopacket"
- "reflect"
- "testing"
-)
-
-// Test packet collected from live network. See the test below for contents
-var SFlowTestPacket1 = []byte{
- 0x84, 0x2b, 0x2b, 0x16, 0x8b, 0x62, 0xf0, 0x50, 0x56, 0x85, 0x3a, 0xfd, 0x08, 0x00, 0x45, 0x00,
- 0x05, 0xbc, 0x9c, 0x04, 0x40, 0x00, 0xff, 0x11, 0xc7, 0x00, 0x0a, 0x01, 0xff, 0x0e, 0x0a, 0x01,
- 0x00, 0x1b, 0xc7, 0x57, 0x18, 0xc7, 0x05, 0xa8, 0x22, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
- 0x00, 0x01, 0x0a, 0x01, 0xf8, 0x16, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x9d, 0xfb, 0x40, 0x49,
- 0xc6, 0xcd, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x26,
- 0x27, 0xe8, 0x00, 0x00, 0x02, 0x13, 0x00, 0x00, 0x3e, 0x80, 0x50, 0xbd, 0xe5, 0x80, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xd2, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x3c, 0x8a, 0xb0, 0xe7, 0x54, 0x41, 0xb8, 0xca, 0x3a, 0x6d,
- 0xf0, 0x40, 0x08, 0x00, 0x45, 0x00, 0x05, 0xc0, 0x6b, 0xaa, 0x40, 0x00, 0x40, 0x06, 0x8f, 0x41,
- 0x0a, 0x01, 0x0e, 0x16, 0x36, 0xf0, 0xeb, 0x45, 0x76, 0xfd, 0x00, 0x50, 0xca, 0x77, 0xef, 0x96,
- 0xfc, 0x28, 0x63, 0x40, 0x50, 0x10, 0x00, 0x3c, 0x64, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0xf4, 0x00, 0x00, 0x02, 0x77, 0x00, 0x00, 0x00, 0xfd, 0x3b, 0x8c, 0xe7, 0x04, 0x4a, 0x2d, 0xb2,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x01, 0x48, 0xcc, 0x11, 0x0d, 0xe3, 0x00,
- 0x26, 0x85, 0x30, 0x00, 0x00, 0x07, 0x66, 0x00, 0x02, 0xd0, 0x8a, 0x00, 0x02, 0xce, 0xf0, 0x00,
- 0x29, 0x7e, 0x80, 0x00, 0x02, 0xd0, 0x98, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x26, 0x85, 0x30, 0x00,
- 0x00, 0x00, 0xf4, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
- 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x5e, 0x5c, 0x1e, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00,
- 0x07, 0xd0, 0xb1, 0x2f, 0xa2, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x05, 0xee, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x3c, 0x8a,
- 0xb0, 0xe7, 0x54, 0x41, 0xb8, 0xca, 0x3a, 0x6f, 0xbe, 0xd8, 0x08, 0x00, 0x45, 0x00, 0x05, 0xdc,
- 0x9f, 0xfd, 0x40, 0x00, 0x40, 0x06, 0x6a, 0xfa, 0x0a, 0x01, 0x0e, 0x10, 0x0a, 0x01, 0x08, 0x13,
- 0x23, 0x84, 0xb7, 0x22, 0x8a, 0xc9, 0x50, 0xb5, 0x4e, 0x10, 0x2a, 0x87, 0x80, 0x10, 0x06, 0x01,
- 0x10, 0xa6, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0xef, 0x1f, 0xf4, 0x07, 0x99, 0x3a, 0xd8, 0x5b,
- 0x01, 0x46, 0x09, 0x00, 0x0c, 0x00, 0x0c, 0x3c, 0xac, 0x4a, 0x1b, 0x06, 0x04, 0x78, 0x78, 0x4e,
- 0xc2, 0x05, 0x46, 0x43, 0x06, 0x04, 0x78, 0x78, 0xee, 0x9c, 0x00, 0x41, 0xef, 0x05, 0x81, 0x32,
- 0x1b, 0x06, 0x04, 0x78, 0x78, 0x56, 0x72, 0x05, 0x4e, 0x92, 0x00, 0x96, 0x39, 0x00, 0xea, 0x3f,
- 0x01, 0x15, 0xa3, 0x08, 0x04, 0x42, 0x6a, 0x82, 0x87, 0x08, 0x05, 0xcc, 0x00, 0x04, 0x00, 0x00,
- 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x5a,
- 0xcd, 0xd0, 0x00, 0x00, 0x02, 0x55, 0x00, 0x00, 0x07, 0xd0, 0x95, 0x67, 0xe1, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x46, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x3c, 0x8a, 0xb0, 0xe7, 0x54, 0x41, 0xb8, 0xca, 0x3a, 0x6f,
- 0x11, 0x28, 0x08, 0x00, 0x45, 0x00, 0x04, 0x34, 0xdb, 0x36, 0x40, 0x00, 0x40, 0x06, 0x38, 0xac,
- 0x0a, 0x01, 0x0e, 0x11, 0x0a, 0x01, 0x00, 0xcf, 0x23, 0x84, 0xa0, 0x3f, 0x3c, 0xce, 0xd5, 0x4a,
- 0x72, 0x0b, 0x5d, 0x1a, 0x80, 0x10, 0x06, 0x01, 0x8a, 0x50, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a,
- 0xef, 0x1f, 0xa2, 0xba, 0xe6, 0xfa, 0xae, 0xb3, 0xfe, 0xcf, 0x00, 0x19, 0xcf, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x01, 0xb9, 0x79, 0xdd, 0x42, 0x00, 0x00, 0x02, 0x84, 0x9b, 0xa9, 0x02, 0xe2, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x32, 0x39, 0x35, 0x34, 0x33, 0x36, 0x00, 0x00, 0x02, 0x70, 0xcd,
- 0x16, 0x40, 0xa6, 0x98, 0x88, 0x24, 0x06, 0x50, 0xb0, 0xf4, 0xee, 0x03, 0xa6, 0xfa, 0x87, 0xaf,
- 0xc1, 0x99, 0x52, 0x0d, 0x07, 0xa8, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
- 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x20, 0xf2, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00,
- 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x54, 0x0b, 0xe4, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x03, 0x00, 0x01, 0x29, 0x82, 0x6d, 0xb0, 0x6c, 0x0b, 0xcb, 0x0d, 0xdd, 0x96, 0x00, 0x06,
- 0xa8, 0xc6, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x34, 0x02, 0x35, 0x58, 0x7c, 0x9e, 0x56, 0x64, 0x25, 0x71, 0x00, 0x70,
- 0x5a, 0xc4, 0x00, 0x09, 0x08, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x5e, 0x5c, 0x1f, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00,
- 0x07, 0xd0, 0xb1, 0x2f, 0xaa, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x05, 0xee, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x3c, 0x8a,
- 0xb0, 0xe7, 0x54, 0x41, 0xb8, 0xca, 0x3a, 0x6f, 0xbe, 0xd8, 0x08, 0x00, 0x45, 0x00, 0x05, 0xdc,
- 0x0f, 0xba, 0x40, 0x00, 0x40, 0x06, 0xf4, 0x3f, 0x0a, 0x01, 0x0e, 0x10, 0x0a, 0x01, 0x0f, 0x11,
- 0x23, 0x84, 0xcd, 0xc0, 0xf4, 0x0e, 0x90, 0x23, 0xd7, 0x32, 0x8b, 0x31, 0x80, 0x10, 0x00, 0x1d,
- 0x6b, 0x12, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0xef, 0x1f, 0xf4, 0x28, 0xef, 0x1f, 0xec, 0x76,
- 0xaa, 0x25, 0x01, 0x04, 0xc0, 0xac, 0xfe, 0x25, 0x01, 0x8e, 0x25, 0x01, 0x16, 0xc7, 0x28, 0xfe,
- 0x7e, 0x70, 0xfe, 0x7e, 0x70, 0x52, 0x7e, 0x70, 0x15, 0x9b, 0xfe, 0x35, 0x01, 0xfe, 0x35, 0x01,
- 0x42, 0x35, 0x01, 0xfe, 0x95, 0x77, 0xfe, 0x95, 0x77, 0xfe, 0x95, 0x77, 0x52, 0x95, 0x77, 0x00,
- 0xd2, 0xfe, 0x70, 0x02, 0x92, 0x70, 0x02, 0x16, 0x60, 0x22, 0x00, 0x7e, 0xb2, 0x15, 0x00, 0x00,
- 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x5a,
- 0xcd, 0xd1, 0x00, 0x00, 0x02, 0x55, 0x00, 0x00, 0x07, 0xd0, 0x95, 0x67, 0xe9, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x55, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0xee, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xb8, 0xca, 0x3a, 0x6f, 0xbe, 0xd8, 0xb8, 0xca, 0x3a, 0x6f,
- 0x11, 0x28, 0x08, 0x00, 0x45, 0x00, 0x05, 0xdc, 0xfe, 0x05, 0x40, 0x00, 0x40, 0x06, 0x06, 0xf4,
- 0x0a, 0x01, 0x0e, 0x11, 0x0a, 0x01, 0x0e, 0x10, 0x23, 0x84, 0xfa, 0x29, 0xae, 0xd4, 0x95, 0x03,
- 0x99, 0xb8, 0x77, 0xd0, 0x80, 0x10, 0x00, 0x1d, 0x6f, 0x4f, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a,
- 0xef, 0x1f, 0xa2, 0xcc, 0xef, 0x1f, 0xf4, 0x2c, 0xfe, 0xdb, 0x05, 0xa1, 0xdb, 0x04, 0x9e, 0xc0,
- 0xfe, 0x30, 0x08, 0xb2, 0x30, 0x08, 0xda, 0x2b, 0xbd, 0xfe, 0x2a, 0x01, 0xfe, 0x2a, 0x01, 0x21,
- 0x2a, 0x00, 0xb2, 0xfe, 0x57, 0xb0, 0xb6, 0x57, 0xb0, 0x14, 0x74, 0xf4, 0xf0, 0x4c, 0x05, 0x68,
- 0xfe, 0x54, 0x02, 0xfe, 0x54, 0x02, 0xd2, 0x54, 0x02, 0x00, 0xbe, 0xfe, 0x32, 0x0f, 0xb6, 0x32,
- 0x0f, 0x14, 0x2e, 0x16, 0xaf, 0x47, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
- 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x94, 0x01, 0x5e, 0x5c, 0x20, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00,
- 0x07, 0xd0, 0xb1, 0x2f, 0xb2, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x57, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x42, 0x3c, 0x8a,
- 0xb0, 0xe7, 0x54, 0x41, 0xb8, 0xca, 0x3a, 0x6f, 0xbe, 0xd8, 0x08, 0x00, 0x45, 0x00, 0x00, 0x34,
- 0xa8, 0x23, 0x40, 0x00, 0x40, 0x06, 0x61, 0x7f, 0x0a, 0x01, 0x0e, 0x10, 0x0a, 0x01, 0x0f, 0x10,
- 0x97, 0x91, 0x23, 0x84, 0x24, 0xfa, 0x91, 0xf7, 0xb4, 0xe8, 0xf3, 0x2d, 0x80, 0x10, 0x00, 0xab,
- 0x7b, 0x7d, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0xef, 0x1f, 0xf4, 0x36, 0xef, 0x1f, 0xdc, 0xde,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-}
-
-// Test collected from the SFlow reference agent. Contains dummy data for several record types
-// that wern't available on an actual network for sampling.
-var SFlowTestPacket2 = []byte{
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
- 0x04, 0x88, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, 0x38, 0x63, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
- 0x00, 0x01, 0xdc, 0xb8, 0x18, 0xc7, 0x04, 0x74, 0x02, 0x88, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
- 0x00, 0x01, 0xc0, 0xa8, 0x5b, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x3a, 0x00, 0x00,
- 0xcb, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x54, 0x00, 0x02,
- 0x1f, 0x6e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x1f, 0x6e, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
- 0x03, 0xed, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x68, 0x74,
- 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x6f,
- 0x72, 0x67, 0x00, 0x00, 0x00, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x31, 0x2e, 0x73, 0x66, 0x6c, 0x6f,
- 0x77, 0x2e, 0x6f, 0x72, 0x67, 0x06, 0x00, 0x00, 0x03, 0xec, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00,
- 0x00, 0x6a, 0x00, 0x00, 0x00, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x75, 0x73, 0x65,
- 0x72, 0xdc, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e,
- 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, 0x00, 0x00, 0x03, 0xeb, 0x00, 0x00,
- 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, 0x0d, 0x0c, 0x0b, 0x0a, 0x00, 0x00, 0xfd, 0xe9, 0x00, 0x00,
- 0x00, 0x7b, 0x00, 0x00, 0x03, 0xe7, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x03, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x01, 0xc8, 0x00, 0x00, 0x03, 0x15, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x2b, 0x67, 0x00, 0x00, 0x56, 0xce, 0x00, 0x00,
- 0x82, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00,
- 0x03, 0x78, 0x00, 0x00, 0x03, 0xe7, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
- 0x00, 0x0d, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x42, 0x00, 0x0c,
- 0x29, 0x67, 0xa0, 0xe5, 0x00, 0x50, 0x56, 0xc0, 0x00, 0x09, 0x08, 0x00, 0x45, 0x10, 0x00, 0x34,
- 0x92, 0xc3, 0x40, 0x00, 0x40, 0x06, 0x70, 0x8d, 0xc0, 0xa8, 0x5b, 0x01, 0xc0, 0xa8, 0x5b, 0x11,
- 0xd3, 0xdd, 0x00, 0x16, 0xe3, 0x2e, 0x84, 0x77, 0x13, 0x6d, 0xc5, 0x53, 0x80, 0x10, 0x1f, 0xf7,
- 0xe7, 0x7d, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x2e, 0xc6, 0x70, 0x3a, 0x00, 0x0f, 0x84, 0x7a,
- 0xbc, 0xd2, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x90, 0x00, 0x02, 0x1f, 0x6f, 0x00, 0x00,
- 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x1f, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff,
- 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0xed, 0x00, 0x00,
- 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
- 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x6f, 0x72, 0x67, 0x00, 0x00,
- 0x00, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x31, 0x2e, 0x73, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x6f, 0x72,
- 0x67, 0x03, 0x00, 0x00, 0x03, 0xec, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00,
- 0x00, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x77, 0x00, 0x00,
- 0x00, 0x6a, 0x00, 0x00, 0x00, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
- 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, 0x00, 0x00, 0x03, 0xeb, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
- 0x00, 0x01, 0x0d, 0x0c, 0x0b, 0x0a, 0x00, 0x00, 0xfd, 0xe9, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00,
- 0x03, 0xe7, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
- 0x00, 0x7b, 0x00, 0x00, 0x01, 0xc8, 0x00, 0x00, 0x03, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x03, 0x00, 0x00, 0x2b, 0x67, 0x00, 0x00, 0x56, 0xce, 0x00, 0x00, 0x82, 0x35, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x03, 0x78, 0x00, 0x00,
- 0x03, 0xe7, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00,
- 0x01, 0xb0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x01, 0x86, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x00, 0x50, 0x56, 0xc0, 0x00, 0x09,
- 0x00, 0x0c, 0x29, 0x67, 0xa0, 0xe5, 0x08, 0x00, 0x45, 0x10, 0x01, 0x74, 0xbb, 0xfa, 0x40, 0x00,
- 0x40, 0x06, 0x46, 0x16, 0xc0, 0xa8, 0x5b, 0x11, 0xc0, 0xa8, 0x5b, 0x01, 0x00, 0x16, 0xd3, 0xdd,
- 0x13, 0x6d, 0xc5, 0x53, 0xe3, 0x2e, 0x84, 0x77, 0x80, 0x18, 0x01, 0x10, 0x38, 0xca, 0x00, 0x00,
- 0x01, 0x01, 0x08, 0x0a, 0x00, 0x0f, 0x84, 0x7d, 0x2e, 0xc6, 0x70, 0x3a, 0xe3, 0x92, 0x97, 0x1a,
- 0x67, 0x3b, 0xac, 0xec, 0xfa, 0x43, 0x71, 0x5e, 0x36, 0xa1, 0x0a, 0xc6, 0x1a, 0x6a, 0xed, 0x08,
- 0xac, 0xf4, 0xbe, 0xd8, 0x36, 0x59, 0xf6, 0xe2, 0x3d, 0x34, 0x26, 0xf2, 0x42, 0xbd, 0x32, 0xd3,
- 0x37, 0x52, 0xb8, 0xf4, 0x38, 0xf0, 0xf4, 0xeb, 0x76, 0x3b, 0xda, 0x23, 0xf1, 0x92, 0x96, 0xca,
- 0xbb, 0x9c, 0x20, 0x0a, 0x38, 0x37, 0x6f, 0xd9, 0x26, 0xe6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x01, 0x54, 0x00, 0x02, 0x1f, 0x70, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02,
- 0x1f, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x03, 0xed, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x14, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x73, 0x66, 0x6c,
- 0x6f, 0x77, 0x2e, 0x6f, 0x72, 0x67, 0x00, 0x00, 0x00, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x31, 0x2e,
- 0x73, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x6f, 0x72, 0x67, 0xff, 0x00, 0x00, 0x03, 0xec, 0x00, 0x00,
- 0x00, 0x2c, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
- 0x20, 0x75, 0x73, 0x65, 0x72, 0x77, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x10, 0x64, 0x65,
- 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, 0x00, 0x00,
- 0x03, 0xeb, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, 0x0d, 0x0c, 0x0b, 0x0a, 0x00, 0x00,
- 0xfd, 0xe9, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x03, 0xe7, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x01, 0xc8, 0x00, 0x00,
- 0x03, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x2b, 0x67, 0x00, 0x00,
- 0x56, 0xce, 0x00, 0x00, 0x82, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
- 0x03, 0x09, 0x00, 0x00, 0x03, 0x78, 0x00, 0x00, 0x03, 0xe7, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
- 0x00, 0x42, 0x00, 0x0c, 0x29, 0x67, 0xa0, 0xe5, 0x00, 0x50, 0x56, 0xc0, 0x00, 0x09, 0x08, 0x00,
- 0x45, 0x10, 0x00, 0x34, 0x65, 0x7d, 0x40, 0x00, 0x40, 0x06, 0x9d, 0xd3, 0xc0, 0xa8, 0x5b, 0x01,
- 0xc0, 0xa8, 0x5b, 0x11, 0xd3, 0xdd, 0x00, 0x16, 0xe3, 0x2e, 0x84, 0x77, 0x13, 0x6d, 0xc6, 0x93,
- 0x80, 0x10, 0x1f, 0xec, 0xe6, 0x43, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x2e, 0xc6, 0x70, 0x3c,
- 0x00, 0x0f, 0x84, 0x7d, 0x00, 0x50,
-}
-
-func TestDecodeUDPSFlow(t *testing.T) {
- p := gopacket.NewPacket(SFlowTestPacket1, LayerTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeUDP, LayerTypeSFlow}, t)
- if got, ok := p.TransportLayer().(*UDP); ok {
- want := &UDP{
- BaseLayer: BaseLayer{SFlowTestPacket1[34:42], SFlowTestPacket1[42:]},
- sPort: []byte{199, 87},
- dPort: []byte{24, 199},
- SrcPort: 51031,
- DstPort: 6343,
- Checksum: 8763,
- Length: 1448,
- }
- if !reflect.DeepEqual(want, got) {
- t.Errorf("UDP layer mismatch, \nwant %#v\ngot %#v\n", want, got)
- }
- } else {
- t.Error("Transport layer packet not UDP")
- }
-}
-
-func TestDecodeSFlowDatagram(t *testing.T) {
- p := gopacket.NewPacket(SFlowTestPacket1, LayerTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeUDP, LayerTypeSFlow}, t)
- if got, ok := p.ApplicationLayer().(*SFlowDatagram); ok {
- want := &SFlowDatagram{
- DatagramVersion: uint32(5),
- AgentAddress: []byte{0xa, 0x1, 0xf8, 0x16},
- SubAgentID: uint32(17),
- SequenceNumber: uint32(40443),
- AgentUptime: uint32(1078576845),
- SampleCount: uint32(7),
- FlowSamples: []SFlowFlowSample{
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 0xd0,
- SequenceNumber: 0x2627e8,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x213,
- SamplingRate: 0x3e80,
- SamplePool: 0x50bde580,
- Dropped: 0x0,
- InputInterface: 0x213,
- OutputInterface: 0x0,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x90,
- },
- HeaderProtocol: 0x1,
- FrameLength: 0x5d2,
- PayloadRemoved: 0x4,
- HeaderLength: 0x80,
- Header: gopacket.NewPacket(SFlowTestPacket1[134:262], LayerTypeEthernet, gopacket.Default),
- },
- SFlowExtendedSwitchFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x3e9,
- FlowDataLength: 0x10,
- },
- IncomingVLAN: 0x202,
- IncomingVLANPriority: 0x0,
- OutgoingVLAN: 0x0,
- OutgoingVLANPriority: 0x0,
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 0xd0,
- SequenceNumber: 0x15e5c1e,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x257,
- SamplingRate: 0x7d0,
- SamplePool: 0xb12fa290,
- Dropped: 0x0,
- InputInterface: 0x257,
- OutputInterface: 0x0,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x90,
- },
- HeaderProtocol: 0x1,
- FrameLength: 0x5ee,
- PayloadRemoved: 0x4,
- HeaderLength: 0x80,
- Header: gopacket.NewPacket(SFlowTestPacket1[350:478], LayerTypeEthernet, gopacket.Default),
- },
- SFlowExtendedSwitchFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x3e9,
- FlowDataLength: 0x10,
- },
- IncomingVLAN: 0x202,
- IncomingVLANPriority: 0x0,
- OutgoingVLAN: 0x0,
- OutgoingVLANPriority: 0x0,
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 0xd0,
- SequenceNumber: 0x15acdd0,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x255,
- SamplingRate: 0x7d0,
- SamplePool: 0x9567e130,
- Dropped: 0x0,
- InputInterface: 0x255,
- OutputInterface: 0x0,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x90,
- },
- HeaderProtocol: 0x1,
- FrameLength: 0x446,
- PayloadRemoved: 0x4,
- HeaderLength: 0x80,
- Header: gopacket.NewPacket(SFlowTestPacket1[566:694], LayerTypeEthernet, gopacket.Default),
- },
- SFlowExtendedSwitchFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x3e9,
- FlowDataLength: 0x10,
- },
- IncomingVLAN: 0x202,
- IncomingVLANPriority: 0x0,
- OutgoingVLAN: 0x0,
- OutgoingVLANPriority: 0x0,
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 0xd0,
- SequenceNumber: 0x15e5c1f,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x257,
- SamplingRate: 0x7d0,
- SamplePool: 0xb12faa60,
- Dropped: 0x0,
- InputInterface: 0x257,
- OutputInterface: 0x0,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x90,
- },
- HeaderProtocol: 0x1,
- FrameLength: 0x5ee,
- PayloadRemoved: 0x4,
- HeaderLength: 0x80,
- Header: gopacket.NewPacket(SFlowTestPacket1[958:1086], LayerTypeEthernet, gopacket.Default),
- },
- SFlowExtendedSwitchFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x3e9,
- FlowDataLength: 0x10,
- },
- IncomingVLAN: 0x202,
- IncomingVLANPriority: 0x0,
- OutgoingVLAN: 0x0,
- OutgoingVLANPriority: 0x0,
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 0xd0,
- SequenceNumber: 0x15acdd1,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x255,
- SamplingRate: 0x7d0,
- SamplePool: 0x9567e900,
- Dropped: 0x0,
- InputInterface: 0x255,
- OutputInterface: 0x257,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x90,
- },
- HeaderProtocol: 0x1,
- FrameLength: 0x5ee,
- PayloadRemoved: 0x4,
- HeaderLength: 0x80,
- Header: gopacket.NewPacket(SFlowTestPacket1[1174:1302], LayerTypeEthernet, gopacket.Default),
- },
- SFlowExtendedSwitchFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x3e9,
- FlowDataLength: 0x10,
- },
- IncomingVLAN: 0x202,
- IncomingVLANPriority: 0x0,
- OutgoingVLAN: 0x202,
- OutgoingVLANPriority: 0x0,
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 0x94,
- SequenceNumber: 0x15e5c20,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x257,
- SamplingRate: 0x7d0,
- SamplePool: 0xb12fb230,
- Dropped: 0x0,
- InputInterface: 0x257,
- OutputInterface: 0x0,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x54,
- },
- HeaderProtocol: 0x1,
- FrameLength: 0x46,
- PayloadRemoved: 0x4,
- HeaderLength: 0x42,
- Header: gopacket.NewPacket(SFlowTestPacket1[1390:1458], LayerTypeEthernet, gopacket.Default),
- },
- SFlowExtendedSwitchFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x3e9,
- FlowDataLength: 0x10,
- },
- IncomingVLAN: 0x202,
- IncomingVLANPriority: 0x0,
- OutgoingVLAN: 0x0,
- OutgoingVLANPriority: 0x0,
- },
- },
- },
- },
- CounterSamples: []SFlowCounterSample{
- SFlowCounterSample{
- Format: 0x2,
- SampleLength: 0xa8,
- SequenceNumber: 0x20f2,
- SourceIDClass: 0x0,
- SourceIDIndex: 0x20a,
- RecordCount: 0x2,
- Records: []SFlowRecord{
- SFlowGenericInterfaceCounters{
- SFlowBaseCounterRecord: SFlowBaseCounterRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 0x58,
- },
- IfIndex: 0x20a,
- IfType: 0x6,
- IfSpeed: 0x2540be400,
- IfDirection: 0x1,
- IfStatus: 0x3,
- IfInOctets: 0x129826db06c0b,
- IfInUcastPkts: 0xcb0ddd96,
- IfInMulticastPkts: 0x6a8c6,
- IfInBroadcastPkts: 0x7b,
- IfInDiscards: 0x0,
- IfInErrors: 0x0,
- IfInUnknownProtos: 0x0,
- IfOutOctets: 0x340235587c9e,
- IfOutUcastPkts: 0x56642571,
- IfOutMulticastPkts: 0x705ac4,
- IfOutBroadcastPkts: 0x908f1,
- IfOutDiscards: 0x0,
- IfOutErrors: 0x0,
- IfPromiscuousMode: 0x0,
- },
- SFlowEthernetCounters{
- SFlowBaseCounterRecord: SFlowBaseCounterRecord{
- EnterpriseID: 0x0,
- Format: 0x2,
- FlowDataLength: 0x34,
- },
- AlignmentErrors: 0x0,
- FCSErrors: 0x0,
- SingleCollisionFrames: 0x0,
- MultipleCollisionFrames: 0x0,
- SQETestErrors: 0x0,
- DeferredTransmissions: 0x0,
- LateCollisions: 0x0,
- ExcessiveCollisions: 0x0,
- InternalMacTransmitErrors: 0x0,
- CarrierSenseErrors: 0x0,
- FrameTooLongs: 0x0,
- InternalMacReceiveErrors: 0x0,
- SymbolErrors: 0x0,
- },
- },
- },
- },
- }
- if !reflect.DeepEqual(want, got) {
- t.Errorf("SFlow layer mismatch, \nwant:\n\n%#v\ngot:\n\n\n%#v\n\n", want, got)
- }
- } else {
- t.Error("Application layer packet not UDP")
- }
-}
-
-func TestPacketPacket0(t *testing.T) {
- p := gopacket.NewPacket(SFlowTestPacket2, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeUDP, LayerTypeSFlow}, t)
- if got, ok := p.ApplicationLayer().(*SFlowDatagram); ok {
- want := &SFlowDatagram{
- DatagramVersion: uint32(5),
- AgentAddress: []byte{192, 168, 91, 17},
- SubAgentID: uint32(0),
- SequenceNumber: uint32(46394),
- AgentUptime: uint32(52000),
- SampleCount: uint32(3),
- FlowSamples: []SFlowFlowSample{
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 340,
- SequenceNumber: 139118,
- SourceIDClass: 0,
- SourceIDIndex: 3,
- SamplingRate: 1,
- SamplePool: 139118,
- Dropped: 0,
- InputInterface: 3,
- OutputInterface: 1073741823,
- RecordCount: 4,
- Records: []SFlowRecord{
- SFlowExtendedURLRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1005,
- FlowDataLength: 48,
- },
- Direction: SFlowURLsrc,
- URL: "http://www.sflow.org",
- Host: "host1.sflow.org",
- },
- SFlowExtendedUserFlow{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1004,
- FlowDataLength: 44,
- },
- SourceCharSet: SFlowCSUTF8,
- SourceUserID: "source user",
- DestinationCharSet: SFlowCSUTF8,
- DestinationUserID: "destination user",
- },
- SFlowExtendedGatewayFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1003,
- FlowDataLength: 100,
- },
- NextHop: []byte{0x0d, 0x0c, 0x0b, 0x0a},
- AS: 65001,
- SourceAS: 123,
- PeerAS: 999,
- ASPathCount: 3,
- ASPath: []SFlowASDestination{
- SFlowASDestination{
- Type: SFlowASSequence,
- Count: 3,
- Members: []uint32{123, 456, 789},
- },
- SFlowASDestination{
- Type: SFlowASSet,
- Count: 3,
- Members: []uint32{11111, 22222, 33333},
- },
- SFlowASDestination{
- Type: SFlowASSequence,
- Count: 3,
- Members: []uint32{777, 888, 999},
- },
- },
- Communities: []uint32{12, 13},
- LocalPref: 432,
- },
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 84,
- },
- HeaderProtocol: 1,
- FrameLength: 70,
- PayloadRemoved: 4,
- HeaderLength: 0x42,
- Header: gopacket.NewPacket(SFlowTestPacket2[350:418], LayerTypeEthernet, gopacket.Default),
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 400,
- SequenceNumber: 139119,
- SourceIDClass: 0,
- SourceIDIndex: 3,
- SamplingRate: 1,
- SamplePool: 139119,
- Dropped: 0,
- InputInterface: 1073741823,
- OutputInterface: 3,
- RecordCount: 4,
- Records: []SFlowRecord{
- SFlowExtendedURLRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1005,
- FlowDataLength: 48,
- },
- Direction: SFlowURLsrc,
- URL: "http://www.sflow.org",
- Host: "host1.sflow.org",
- },
- SFlowExtendedUserFlow{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1004,
- FlowDataLength: 44,
- },
- SourceCharSet: SFlowCSUTF8,
- SourceUserID: "source user",
- DestinationCharSet: SFlowCSUTF8,
- DestinationUserID: "destination user",
- },
- SFlowExtendedGatewayFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1003,
- FlowDataLength: 100,
- },
- NextHop: []byte{0x0d, 0x0c, 0x0b, 0x0a},
- AS: 65001,
- SourceAS: 123,
- PeerAS: 999,
- ASPathCount: 3,
- ASPath: []SFlowASDestination{
- SFlowASDestination{
- Type: SFlowASSequence,
- Count: 3,
- Members: []uint32{123, 456, 789},
- },
- SFlowASDestination{
- Type: SFlowASSet,
- Count: 3,
- Members: []uint32{11111, 22222, 33333},
- },
- SFlowASDestination{
- Type: SFlowASSequence,
- Count: 3,
- Members: []uint32{777, 888, 999},
- },
- },
- Communities: []uint32{12, 13},
- LocalPref: 432,
- },
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 144,
- },
- HeaderProtocol: 1,
- FrameLength: 390,
- PayloadRemoved: 4,
- HeaderLength: 0x80,
- Header: gopacket.NewPacket(SFlowTestPacket2[698:826], LayerTypeEthernet, gopacket.Default),
- },
- },
- },
- SFlowFlowSample{
- EnterpriseID: 0x0,
- Format: 0x1,
- SampleLength: 340,
- SequenceNumber: 139120,
- SourceIDClass: 0,
- SourceIDIndex: 3,
- SamplingRate: 1,
- SamplePool: 139120,
- Dropped: 0,
- InputInterface: 3,
- OutputInterface: 1073741823,
- RecordCount: 4,
- Records: []SFlowRecord{
- SFlowExtendedURLRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1005,
- FlowDataLength: 48,
- },
- Direction: SFlowURLsrc,
- URL: "http://www.sflow.org",
- Host: "host1.sflow.org",
- },
- SFlowExtendedUserFlow{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1004,
- FlowDataLength: 44,
- },
- SourceCharSet: SFlowCSUTF8,
- SourceUserID: "source user",
- DestinationCharSet: SFlowCSUTF8,
- DestinationUserID: "destination user",
- },
- SFlowExtendedGatewayFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0,
- Format: 1003,
- FlowDataLength: 100,
- },
- NextHop: []byte{0x0d, 0x0c, 0x0b, 0x0a},
- AS: 65001,
- SourceAS: 123,
- PeerAS: 999,
- ASPathCount: 3,
- ASPath: []SFlowASDestination{
- SFlowASDestination{
- Type: SFlowASSequence,
- Count: 3,
- Members: []uint32{123, 456, 789},
- },
- SFlowASDestination{
- Type: SFlowASSet,
- Count: 3,
- Members: []uint32{11111, 22222, 33333},
- },
- SFlowASDestination{
- Type: SFlowASSequence,
- Count: 3,
- Members: []uint32{777, 888, 999},
- },
- },
- Communities: []uint32{12, 13},
- LocalPref: 432,
- },
- SFlowRawPacketFlowRecord{
- SFlowBaseFlowRecord: SFlowBaseFlowRecord{
- EnterpriseID: 0x0,
- Format: 0x1,
- FlowDataLength: 84,
- },
- HeaderProtocol: 1,
- FrameLength: 70,
- PayloadRemoved: 4,
- HeaderLength: 0x42,
- Header: gopacket.NewPacket(SFlowTestPacket2[1106:1174], LayerTypeEthernet, gopacket.Default),
- },
- },
- },
- },
- }
- if !reflect.DeepEqual(want, got) {
- t.Errorf("SFlow layer mismatch, \nwant:\n\n%#v\ngot:\n\n\n%#v\n\n", want, got)
- }
- } else {
- t.Error("Application layer packet not UDP")
- }
-}
-
-func BenchmarkDecodeSFlowPacket1(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(SFlowTestPacket1, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-func BenchmarkDecodeSFlowPacket2(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(SFlowTestPacket2, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-
-func BenchmarkDecodeSFlowLayerPacket1(b *testing.B) {
- var sflow SFlowDatagram
- for i := 0; i < b.N; i++ {
- sflow.DecodeFromBytes(SFlowTestPacket1[ /*eth*/ 14+ /*ipv4*/ 20+ /*udp*/ 8:], gopacket.NilDecodeFeedback)
- }
-}
-
-func BenchmarkDecodeSFlowLayerPacket2(b *testing.B) {
- var sflow SFlowDatagram
- for i := 0; i < b.N; i++ {
- sflow.DecodeFromBytes(SFlowTestPacket2[ /*eth*/ 14+ /*ipv4*/ 20+ /*udp*/ 8:], gopacket.NilDecodeFeedback)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/tcpip_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/tcpip_test.go
deleted file mode 100644
index c002e8491ac..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/tcpip_test.go
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2014, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "github.com/google/gopacket"
- "net"
- "testing"
-)
-
-const (
- ipv4UDPChecksum = uint16(0xbc5f) // Wireshark
- ipv6UDPChecksumWithIPv6DstOpts = uint16(0x4d21) // Wireshark
- ipv6UDPChecksumJumbogram = uint16(0xcda8)
-)
-
-func createIPv4ChecksumTestLayer() (ip4 *IPv4) {
- ip4 = &IPv4{}
- ip4.Version = 4
- ip4.TTL = 64
- ip4.SrcIP = net.ParseIP("192.0.2.1")
- ip4.DstIP = net.ParseIP("198.51.100.1")
- return
-}
-
-func createIPv6ChecksumTestLayer() (ip6 *IPv6) {
- ip6 = &IPv6{}
- ip6.Version = 6
- ip6.NextHeader = IPProtocolNoNextHeader
- ip6.HopLimit = 64
- ip6.SrcIP = net.ParseIP("2001:db8::1")
- ip6.DstIP = net.ParseIP("2001:db8::2")
- return
-}
-
-func createIPv6DestinationChecksumTestLayer() (dst *IPv6Destination) {
- tlv := &IPv6DestinationOption{}
- tlv.OptionType = 0x01 //PadN
- tlv.OptionData = []byte{0x00, 0x00, 0x00, 0x00}
- dst = &IPv6Destination{}
- dst.Options = append(dst.Options, tlv)
- dst.NextHeader = IPProtocolNoNextHeader
- return
-}
-
-func createUDPChecksumTestLayer() (udp *UDP) {
- udp = &UDP{}
- udp.SrcPort = UDPPort(12345)
- udp.DstPort = UDPPort(9999)
- return
-}
-
-func TestIPv4UDPChecksum(t *testing.T) {
- var serialize []gopacket.SerializableLayer = make([]gopacket.SerializableLayer, 0, 2)
- var u *UDP
- var err error
-
- ip4 := createIPv4ChecksumTestLayer()
- ip4.Protocol = IPProtocolUDP
- serialize = append(serialize, ip4)
-
- udp := createUDPChecksumTestLayer()
- udp.SetNetworkLayerForChecksum(ip4)
- serialize = append(serialize, udp)
-
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true}
- err = gopacket.SerializeLayers(buf, opts, serialize...)
- if err != nil {
- t.Fatal(err)
- }
-
- p := gopacket.NewPacket(buf.Bytes(), LinkTypeRaw, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Fatal("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeIPv4, LayerTypeUDP}, t)
-
- if l, ok := p.Layer(LayerTypeUDP).(*UDP); !ok {
- t.Fatal("No UDP layer type found in packet")
- } else {
- u = l
- }
- got := u.Checksum
- want := ipv4UDPChecksum
- if got != want {
- t.Errorf("Bad checksum:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-}
-
-func TestIPv6UDPChecksumWithIPv6DstOpts(t *testing.T) {
- var serialize []gopacket.SerializableLayer = make([]gopacket.SerializableLayer, 0, 3)
- var u *UDP
- var err error
-
- ip6 := createIPv6ChecksumTestLayer()
- ip6.NextHeader = IPProtocolIPv6Destination
- serialize = append(serialize, ip6)
-
- dst := createIPv6DestinationChecksumTestLayer()
- dst.NextHeader = IPProtocolUDP
- serialize = append(serialize, dst)
-
- udp := createUDPChecksumTestLayer()
- udp.SetNetworkLayerForChecksum(ip6)
- serialize = append(serialize, udp)
-
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true}
- err = gopacket.SerializeLayers(buf, opts, serialize...)
- if err != nil {
- t.Fatal(err)
- }
-
- p := gopacket.NewPacket(buf.Bytes(), LinkTypeRaw, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Fatal("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeIPv6, LayerTypeIPv6Destination, LayerTypeUDP}, t)
-
- if l, ok := p.Layer(LayerTypeUDP).(*UDP); !ok {
- t.Fatal("No UDP layer type found in packet")
- } else {
- u = l
- }
- got := u.Checksum
- want := ipv6UDPChecksumWithIPv6DstOpts
- if got != want {
- t.Errorf("Bad checksum:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-}
-
-func TestIPv6JumbogramUDPChecksum(t *testing.T) {
- var serialize []gopacket.SerializableLayer = make([]gopacket.SerializableLayer, 0, 4)
- var u *UDP
- var err error
-
- ip6 := &IPv6{}
- ip6.Version = 6
- ip6.NextHeader = IPProtocolUDP
- ip6.HopLimit = 64
- ip6.SrcIP = net.ParseIP("2001:db8::1")
- ip6.DstIP = net.ParseIP("2001:db8::2")
- serialize = append(serialize, ip6)
-
- udp := &UDP{}
- udp.SrcPort = UDPPort(12345)
- udp.DstPort = UDPPort(9999)
- udp.SetNetworkLayerForChecksum(ip6)
- serialize = append(serialize, udp)
-
- payload := make([]byte, ipv6MaxPayloadLength+1)
- for i := range payload {
- payload[i] = 0xfe
- }
- serialize = append(serialize, gopacket.Payload(payload))
-
- buf := gopacket.NewSerializeBuffer()
- opts := gopacket.SerializeOptions{FixLengths: true, ComputeChecksums: true}
- err = gopacket.SerializeLayers(buf, opts, serialize...)
- if err != nil {
- t.Fatal(err)
- }
-
- p := gopacket.NewPacket(buf.Bytes(), LinkTypeRaw, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Fatal("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeIPv6, LayerTypeIPv6HopByHop, LayerTypeUDP, gopacket.LayerTypePayload}, t)
-
- if l, ok := p.Layer(LayerTypeUDP).(*UDP); !ok {
- t.Fatal("No UDP layer type found in packet")
- } else {
- u = l
- }
- got := u.Checksum
- want := ipv6UDPChecksumJumbogram
- if got != want {
- t.Errorf("Bad checksum:\ngot:\n%#v\n\nwant:\n%#v\n\n", got, want)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/udp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/udp_test.go
deleted file mode 100644
index e71236cc5de..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/udp_test.go
+++ /dev/null
@@ -1,372 +0,0 @@
-// Copyright 2012, Google, Inc. All rights reserved.
-// Copyright 2009-2011 Andreas Krennmair. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- "reflect"
- "testing"
-
- "github.com/google/gopacket"
-)
-
-// testUDPPacketDNS is the packet:
-// 10:33:07.883637 IP 172.16.255.1.53 > 172.29.20.15.35181: 47320 7/0/0 MX ALT2.ASPMX.L.GOOGLE.com. 20, MX ASPMX2.GOOGLEMAIL.com. 30, MX ASPMX3.GOOGLEMAIL.com. 30, MX ASPMX4.GOOGLEMAIL.com. 30, MX ASPMX5.GOOGLEMAIL.com. 30, MX ASPMX.L.GOOGLE.com. 10, MX ALT1.ASPMX.L.GOOGLE.com. 20 (202)
-// 0x0000: 24be 0527 0b17 001f cab3 75c0 0800 4500 $..'......u...E.
-// 0x0010: 00e6 68cf 0000 3f11 a6f9 ac10 ff01 ac1d ..h...?.........
-// 0x0020: 140f 0035 896d 00d2 754a b8d8 8180 0001 ...5.m..uJ......
-// 0x0030: 0007 0000 0000 0478 6b63 6403 636f 6d00 .......xkcd.com.
-// 0x0040: 000f 0001 c00c 000f 0001 0000 0258 0018 .............X..
-// 0x0050: 0014 0441 4c54 3205 4153 504d 5801 4c06 ...ALT2.ASPMX.L.
-// 0x0060: 474f 4f47 4c45 c011 c00c 000f 0001 0000 GOOGLE..........
-// 0x0070: 0258 0016 001e 0641 5350 4d58 320a 474f .X.....ASPMX2.GO
-// 0x0080: 4f47 4c45 4d41 494c c011 c00c 000f 0001 OGLEMAIL........
-// 0x0090: 0000 0258 000b 001e 0641 5350 4d58 33c0 ...X.....ASPMX3.
-// 0x00a0: 53c0 0c00 0f00 0100 0002 5800 0b00 1e06 S.........X.....
-// 0x00b0: 4153 504d 5834 c053 c00c 000f 0001 0000 ASPMX4.S........
-// 0x00c0: 0258 000b 001e 0641 5350 4d58 35c0 53c0 .X.....ASPMX5.S.
-// 0x00d0: 0c00 0f00 0100 0002 5800 0400 0ac0 2dc0 ........X.....-.
-// 0x00e0: 0c00 0f00 0100 0002 5800 0900 1404 414c ........X.....AL
-// 0x00f0: 5431 c02d T1.-
-// Packet generated by doing DNS query for 'xkcd.com'
-var testUDPPacketDNS = []byte{
- 0x24, 0xbe, 0x05, 0x27, 0x0b, 0x17, 0x00, 0x1f, 0xca, 0xb3, 0x75, 0xc0, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0xe6, 0x68, 0xcf, 0x00, 0x00, 0x3f, 0x11, 0xa6, 0xf9, 0xac, 0x10, 0xff, 0x01, 0xac, 0x1d,
- 0x14, 0x0f, 0x00, 0x35, 0x89, 0x6d, 0x00, 0xd2, 0x75, 0x4a, 0xb8, 0xd8, 0x81, 0x80, 0x00, 0x01,
- 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x78, 0x6b, 0x63, 0x64, 0x03, 0x63, 0x6f, 0x6d, 0x00,
- 0x00, 0x0f, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00, 0x02, 0x58, 0x00, 0x18,
- 0x00, 0x14, 0x04, 0x41, 0x4c, 0x54, 0x32, 0x05, 0x41, 0x53, 0x50, 0x4d, 0x58, 0x01, 0x4c, 0x06,
- 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, 0xc0, 0x11, 0xc0, 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00,
- 0x02, 0x58, 0x00, 0x16, 0x00, 0x1e, 0x06, 0x41, 0x53, 0x50, 0x4d, 0x58, 0x32, 0x0a, 0x47, 0x4f,
- 0x4f, 0x47, 0x4c, 0x45, 0x4d, 0x41, 0x49, 0x4c, 0xc0, 0x11, 0xc0, 0x0c, 0x00, 0x0f, 0x00, 0x01,
- 0x00, 0x00, 0x02, 0x58, 0x00, 0x0b, 0x00, 0x1e, 0x06, 0x41, 0x53, 0x50, 0x4d, 0x58, 0x33, 0xc0,
- 0x53, 0xc0, 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00, 0x02, 0x58, 0x00, 0x0b, 0x00, 0x1e, 0x06,
- 0x41, 0x53, 0x50, 0x4d, 0x58, 0x34, 0xc0, 0x53, 0xc0, 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00,
- 0x02, 0x58, 0x00, 0x0b, 0x00, 0x1e, 0x06, 0x41, 0x53, 0x50, 0x4d, 0x58, 0x35, 0xc0, 0x53, 0xc0,
- 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00, 0x02, 0x58, 0x00, 0x04, 0x00, 0x0a, 0xc0, 0x2d, 0xc0,
- 0x0c, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00, 0x02, 0x58, 0x00, 0x09, 0x00, 0x14, 0x04, 0x41, 0x4c,
- 0x54, 0x31, 0xc0, 0x2d,
-}
-
-func TestUDPPacketDNS(t *testing.T) {
- p := gopacket.NewPacket(testUDPPacketDNS, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4, LayerTypeUDP, LayerTypeDNS}, t)
- if got, ok := p.TransportLayer().(*UDP); ok {
- want := &UDP{
- BaseLayer: BaseLayer{
- Contents: []byte{0x0, 0x35, 0x89, 0x6d, 0x0, 0xd2, 0x75, 0x4a},
- Payload: []byte{0xb8, 0xd8, 0x81, 0x80, 0x0, 0x1, 0x0,
- 0x7, 0x0, 0x0, 0x0, 0x0, 0x4, 0x78, 0x6b, 0x63, 0x64, 0x3, 0x63, 0x6f,
- 0x6d, 0x0, 0x0, 0xf, 0x0, 0x1, 0xc0, 0xc, 0x0, 0xf, 0x0, 0x1, 0x0, 0x0,
- 0x2, 0x58, 0x0, 0x18, 0x0, 0x14, 0x4, 0x41, 0x4c, 0x54, 0x32, 0x5, 0x41,
- 0x53, 0x50, 0x4d, 0x58, 0x1, 0x4c, 0x6, 0x47, 0x4f, 0x4f, 0x47, 0x4c,
- 0x45, 0xc0, 0x11, 0xc0, 0xc, 0x0, 0xf, 0x0, 0x1, 0x0, 0x0, 0x2, 0x58, 0x0,
- 0x16, 0x0, 0x1e, 0x6, 0x41, 0x53, 0x50, 0x4d, 0x58, 0x32, 0xa, 0x47, 0x4f,
- 0x4f, 0x47, 0x4c, 0x45, 0x4d, 0x41, 0x49, 0x4c, 0xc0, 0x11, 0xc0, 0xc,
- 0x0, 0xf, 0x0, 0x1, 0x0, 0x0, 0x2, 0x58, 0x0, 0xb, 0x0, 0x1e, 0x6, 0x41,
- 0x53, 0x50, 0x4d, 0x58, 0x33, 0xc0, 0x53, 0xc0, 0xc, 0x0, 0xf, 0x0, 0x1,
- 0x0, 0x0, 0x2, 0x58, 0x0, 0xb, 0x0, 0x1e, 0x6, 0x41, 0x53, 0x50, 0x4d,
- 0x58, 0x34, 0xc0, 0x53, 0xc0, 0xc, 0x0, 0xf, 0x0, 0x1, 0x0, 0x0, 0x2,
- 0x58, 0x0, 0xb, 0x0, 0x1e, 0x6, 0x41, 0x53, 0x50, 0x4d, 0x58, 0x35, 0xc0,
- 0x53, 0xc0, 0xc, 0x0, 0xf, 0x0, 0x1, 0x0, 0x0, 0x2, 0x58, 0x0, 0x4, 0x0,
- 0xa, 0xc0, 0x2d, 0xc0, 0xc, 0x0, 0xf, 0x0, 0x1, 0x0, 0x0, 0x2, 0x58, 0x0,
- 0x9, 0x0, 0x14, 0x4, 0x41, 0x4c, 0x54, 0x31, 0xc0, 0x2d},
- },
- SrcPort: 53,
- DstPort: 35181,
- Length: 210,
- Checksum: 30026,
- sPort: []byte{0x0, 0x35},
- dPort: []byte{0x89, 0x6d},
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("UDP packet mismatch:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- } else {
- t.Error("Transport layer packet not UDP")
- }
-}
-
-func loadDNS(dnspacket []byte, t *testing.T) *DNS {
- p := gopacket.NewPacket(dnspacket, LinkTypeEthernet, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv4,
- LayerTypeUDP, LayerTypeDNS}, t)
-
- dnsL := p.Layer(LayerTypeDNS)
- if dnsL == nil {
- t.Error("No DNS Layer found")
- }
-
- dns, ok := dnsL.(*DNS)
- if !ok {
- return nil
- }
- return dns
-}
-
-var testDNSQueryA = []byte{
- 0xfe, 0x54, 0x00, 0x3e, 0x00, 0x96, 0x52, 0x54, /* .T.>..RT */
- 0x00, 0xbd, 0x1c, 0x70, 0x08, 0x00, 0x45, 0x00, /* ...p..E. */
- 0x00, 0x3c, 0x22, 0xe0, 0x00, 0x00, 0x40, 0x11, /* .<"...@. */
- 0xe2, 0x38, 0xc0, 0xa8, 0x7a, 0x46, 0xc0, 0xa8, /* .8..zF.. */
- 0x7a, 0x01, 0xc3, 0x35, 0x00, 0x35, 0x00, 0x28, /* z..5.5.( */
- 0x75, 0xd2, 0x52, 0x41, 0x01, 0x00, 0x00, 0x01, /* u.RA.... */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, /* .......w */
- 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, /* ww.googl */
- 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, /* e.com... */
- 0x00, 0x01, /* .. */
-}
-
-func TestDNSQueryA(t *testing.T) {
- dns := loadDNS(testDNSQueryA, t)
- if dns == nil {
- t.Fatal("Failed to get a pointer to DNS struct")
- }
-
- if uint16(len(dns.Questions)) != dns.QDCount {
- t.Fatal("Invalid query decoding, not the right number of questions")
- }
-
- if string(dns.Questions[0].Name) != "www.google.com" {
- t.Errorf("Invalid query decoding, expecting 'www.google.com', got '%s'",
- dns.Questions[0].Name)
- }
- if dns.Questions[0].Class != DNSClassIN {
- t.Errorf("Invalid query decoding, expecting Class IN, got '%d'",
- dns.Questions[0].Class)
- }
-
- if dns.Questions[0].Type != DNSTypeA {
- t.Errorf("Invalid query decoding, expecting Type A, got '%d'",
- dns.Questions[0].Type)
- }
-}
-
-var testDNSRRA = []byte{
- 0x52, 0x54, 0x00, 0xbd, 0x1c, 0x70, 0xfe, 0x54, /* RT...p.T */
- 0x00, 0x3e, 0x00, 0x96, 0x08, 0x00, 0x45, 0x00, /* .>....E. */
- 0x01, 0x24, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, /* .$..@.@. */
- 0xc4, 0x30, 0xc0, 0xa8, 0x7a, 0x01, 0xc0, 0xa8, /* .0..z... */
- 0x7a, 0x46, 0x00, 0x35, 0xc3, 0x35, 0x01, 0x10, /* zF.5.5.. */
- 0x76, 0xba, 0x52, 0x41, 0x81, 0x80, 0x00, 0x01, /* v.RA.... */
- 0x00, 0x06, 0x00, 0x04, 0x00, 0x04, 0x03, 0x77, /* .......w */
- 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, /* ww.googl */
- 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, /* e.com... */
- 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, /* ........ */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x4a, 0x7d, /* ...,..J} */
- 0xc3, 0x67, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, /* .g...... */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x4a, 0x7d, /* ...,..J} */
- 0xc3, 0x68, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, /* .h...... */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x4a, 0x7d, /* ...,..J} */
- 0xc3, 0x69, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, /* .i...... */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x4a, 0x7d, /* ...,..J} */
- 0xc3, 0x6a, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, /* .j...... */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x4a, 0x7d, /* ...,..J} */
- 0xc3, 0x93, 0xc0, 0x0c, 0x00, 0x01, 0x00, 0x01, /* ........ */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x04, 0x4a, 0x7d, /* ...,..J} */
- 0xc3, 0x63, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, /* .c...... */
- 0x00, 0x02, 0xa3, 0x00, 0x00, 0x06, 0x03, 0x6e, /* .......n */
- 0x73, 0x32, 0xc0, 0x10, 0xc0, 0x10, 0x00, 0x02, /* s2...... */
- 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, 0x00, 0x06, /* ........ */
- 0x03, 0x6e, 0x73, 0x33, 0xc0, 0x10, 0xc0, 0x10, /* .ns3.... */
- 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, /* ........ */
- 0x00, 0x06, 0x03, 0x6e, 0x73, 0x31, 0xc0, 0x10, /* ...ns1.. */
- 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, /* ........ */
- 0xa3, 0x00, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x34, /* .....ns4 */
- 0xc0, 0x10, 0xc0, 0xb0, 0x00, 0x01, 0x00, 0x01, /* ........ */
- 0x00, 0x02, 0xa3, 0x00, 0x00, 0x04, 0xd8, 0xef, /* ........ */
- 0x20, 0x0a, 0xc0, 0x8c, 0x00, 0x01, 0x00, 0x01, /* ....... */
- 0x00, 0x02, 0xa3, 0x00, 0x00, 0x04, 0xd8, 0xef, /* ........ */
- 0x22, 0x0a, 0xc0, 0x9e, 0x00, 0x01, 0x00, 0x01, /* "....... */
- 0x00, 0x02, 0xa3, 0x00, 0x00, 0x04, 0xd8, 0xef, /* ........ */
- 0x24, 0x0a, 0xc0, 0xc2, 0x00, 0x01, 0x00, 0x01, /* $....... */
- 0x00, 0x02, 0xa3, 0x00, 0x00, 0x04, 0xd8, 0xef, /* ........ */
- 0x26, 0x0a, /* &. */
-}
-
-func TestDNSRRA(t *testing.T) {
- dns := loadDNS(testDNSRRA, t)
- if dns == nil {
- t.Fatal("Failed to get a pointer to DNS struct")
- return
- }
-
- if uint16(len(dns.Questions)) != dns.QDCount {
- t.Fatal("Invalid query decoding, not the right number of questions")
- } else if uint16(len(dns.Answers)) != dns.ANCount {
- t.Fatal("Invalid query decoding, not the right number of answers")
- } else if uint16(len(dns.Authorities)) != dns.NSCount {
- t.Fatal("Invalid query decoding, not the right number of authorities")
- } else if uint16(len(dns.Additionals)) != dns.ARCount {
- t.Fatal("Invalid query decoding, not the right number of additionals info")
- }
-
- if string(dns.Questions[0].Name) != "www.google.com" {
- t.Errorf("Invalid query decoding, expecting 'www.google.com', got '%s'",
- dns.Questions[0].Name)
- }
- if string(dns.Answers[0].Name) != "www.google.com" {
- t.Errorf("Invalid query decoding, expecting 'www.google.com', got '%d'",
- dns.Questions[0].Class)
- }
- if dns.Answers[0].Class != DNSClassIN {
- t.Errorf("Invalid query decoding, expecting Class IN, got '%d'",
- dns.Questions[0].Class)
- }
- if dns.Answers[0].Type != DNSTypeA {
- t.Errorf("Invalid query decoding, expecting Type A, got '%d'",
- dns.Questions[0].Type)
- }
- if !dns.Answers[0].IP.Equal([]byte{74, 125, 195, 103}) {
- t.Errorf("Invalid query decoding, invalid IP address,"+
- " expecting '74.125.195.103', got '%s'",
- dns.Answers[0].IP.String())
- }
- if len(dns.Answers) != 6 {
- t.Errorf("No correct number of answers, expecting 6, go '%d'",
- len(dns.Answers))
- }
- if len(dns.Authorities) != 4 {
- t.Errorf("No correct number of answers, expecting 4, go '%d'",
- len(dns.Answers))
- }
- if len(dns.Additionals) != 4 {
- t.Errorf("No correct number of answers, expecting 4, go '%d'",
- len(dns.Answers))
- } else {
- for i, want := range []string{
- "ns1.google.com",
- "ns2.google.com",
- "ns3.google.com",
- "ns4.google.com",
- } {
- if got := string(dns.Additionals[i].Name); got != want {
- t.Errorf("got %q want %q", got, want)
- }
- }
- }
-}
-
-var testDNSAAAA = []byte{
- 0x52, 0x54, 0x00, 0xbd, 0x1c, 0x70, 0xfe, 0x54, /* RT...p.T */
- 0x00, 0x3e, 0x00, 0x96, 0x08, 0x00, 0x45, 0x00, /* .>....E. */
- 0x00, 0xe0, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, /* ....@.@. */
- 0xc4, 0x74, 0xc0, 0xa8, 0x7a, 0x01, 0xc0, 0xa8, /* .t..z... */
- 0x7a, 0x46, 0x00, 0x35, 0xdb, 0x13, 0x00, 0xcc, /* zF.5.... */
- 0x76, 0x76, 0xf3, 0x03, 0x81, 0x80, 0x00, 0x01, /* vv...... */
- 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x03, 0x77, /* .......w */
- 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, /* ww.googl */
- 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x1c, /* e.com... */
- 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x1c, 0x00, 0x01, /* ........ */
- 0x00, 0x00, 0x01, 0x2c, 0x00, 0x10, 0x2a, 0x00, /* ...,..*. */
- 0x14, 0x50, 0x40, 0x0c, 0x0c, 0x01, 0x00, 0x00, /* .P@..... */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0xc0, 0x10, /* .....i.. */
- 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, /* ........ */
- 0x00, 0x06, 0x03, 0x6e, 0x73, 0x34, 0xc0, 0x10, /* ...ns4.. */
- 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, /* ........ */
- 0xa3, 0x00, 0x00, 0x06, 0x03, 0x6e, 0x73, 0x32, /* .....ns2 */
- 0xc0, 0x10, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, /* ........ */
- 0x00, 0x02, 0xa3, 0x00, 0x00, 0x06, 0x03, 0x6e, /* .......n */
- 0x73, 0x31, 0xc0, 0x10, 0xc0, 0x10, 0x00, 0x02, /* s1...... */
- 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, 0x00, 0x06, /* ........ */
- 0x03, 0x6e, 0x73, 0x33, 0xc0, 0x10, 0xc0, 0x6c, /* .ns3...l */
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, /* ........ */
- 0x00, 0x04, 0xd8, 0xef, 0x20, 0x0a, 0xc0, 0x5a, /* .... ..Z */
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, /* ........ */
- 0x00, 0x04, 0xd8, 0xef, 0x22, 0x0a, 0xc0, 0x7e, /* ...."..~ */
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, /* ........ */
- 0x00, 0x04, 0xd8, 0xef, 0x24, 0x0a, 0xc0, 0x48, /* ....$..H */
- 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0xa3, 0x00, /* ........ */
- 0x00, 0x04, 0xd8, 0xef, 0x26, 0x0a, /* ....&. */
-}
-
-func TestDNSAAAA(t *testing.T) {
- dns := loadDNS(testDNSAAAA, t)
- if dns == nil {
- t.Error("Failed to get a pointer to DNS struct")
- return
- }
-
- if len(dns.Questions) != 1 {
- t.Error("Invalid number of question")
- return
- }
- if dns.Questions[0].Type != DNSTypeAAAA {
- t.Errorf("Invalid question, Type is not AAAA, found %d",
- dns.Questions[0].Type)
- }
-
- if len(dns.Answers) != 1 {
- t.Error("Invalid number of answers")
- }
- if !dns.Answers[0].IP.Equal([]byte{0x2a, 0x00, 0x14, 0x50, 0x40,
- 0x0c, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69}) {
- t.Error("Invalid IP address, found ",
- dns.Answers[0].IP.String())
- }
-}
-
-var testDNSMXSOA = []byte{
- 0x52, 0x54, 0x00, 0xbd, 0x1c, 0x70, 0xfe, 0x54, /* RT...p.T */
- 0x00, 0x3e, 0x00, 0x96, 0x08, 0x00, 0x45, 0x00, /* .>....E. */
- 0x00, 0x6e, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, /* .n..@.@. */
- 0xc4, 0xe6, 0xc0, 0xa8, 0x7a, 0x01, 0xc0, 0xa8, /* ....z... */
- 0x7a, 0x46, 0x00, 0x35, 0x9c, 0x60, 0x00, 0x5a, /* zF.5.`.Z */
- 0x76, 0x04, 0xfc, 0x7a, 0x81, 0x80, 0x00, 0x01, /* v..z.... */
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x77, /* .......w */
- 0x77, 0x77, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, /* ww.googl */
- 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x0f, /* e.com... */
- 0x00, 0x01, 0xc0, 0x10, 0x00, 0x06, 0x00, 0x01, /* ........ */
- 0x00, 0x00, 0x00, 0x3c, 0x00, 0x26, 0x03, 0x6e, /* ...<.&.n */
- 0x73, 0x31, 0xc0, 0x10, 0x09, 0x64, 0x6e, 0x73, /* s1...dns */
- 0x2d, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0xc0, 0x10, /* -admin.. */
- 0x00, 0x17, 0x9f, 0x64, 0x00, 0x00, 0x1c, 0x20, /* ...d... */
- 0x00, 0x00, 0x07, 0x08, 0x00, 0x12, 0x75, 0x00, /* ......u. */
- 0x00, 0x00, 0x01, 0x2c, /* ..., */
-}
-
-func TestDNSMXSOA(t *testing.T) {
- dns := loadDNS(testDNSMXSOA, t)
- if dns == nil {
- t.Error("Failed to get a pointer to DNS struct")
- return
- }
-
- if len(dns.Authorities) != 1 {
- t.Error("Invalid number of authoritative answers, found ",
- len(dns.Authorities))
- return
- }
-}
-
-func BenchmarkDecodeDNS(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testDNSQueryA, LinkTypeEthernet, gopacket.NoCopy)
- }
-}
-func BenchmarkDecodeDNSLayer(b *testing.B) {
- var dns DNS
- for i := 0; i < b.N; i++ {
- dns.DecodeFromBytes(testDNSAAAA[ /*eth*/ 14+ /*ipv4*/ 20+ /*udp*/ 8:], gopacket.NilDecodeFeedback)
- }
-}
-func TestDNSDoesNotMalloc(t *testing.T) {
- var dns DNS
- if n := testing.AllocsPerRun(1000, func() {
- if err := dns.DecodeFromBytes(testDNSAAAA[ /*eth*/ 14+ /*ipv4*/ 20+ /*udp*/ 8:], gopacket.NilDecodeFeedback); err != nil {
- t.Fatal(err)
- }
- }); n > 0 {
- t.Error(n, "mallocs decoding DNS")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/usb_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/usb_test.go
deleted file mode 100644
index 35e9c707dfa..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/layers/usb_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2014, Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package layers
-
-import (
- _ "fmt"
- "github.com/google/gopacket"
- "reflect"
- "testing"
-)
-
-// Generator python layers/test_creator.py --link_type USB --name USB dongle.pcap
-// http://wiki.wireshark.org/SampleCaptures#Sample_Captures
-
-// testPacketUSB0 is the packet:
-// 02:41:04.689546 INTERRUPT COMPLETE to 2:1:1
-// 0x0000: 0038 4a3b 0088 ffff 4301 8101 0200 2d00 .8J;....C.....-.
-// 0x0010: c0d3 5b50 0000 0000 8a85 0a00 0000 0000 ..[P............
-// 0x0020: 0100 0000 0100 0000 0000 0000 0000 0000 ................
-// 0x0030: 8000 0000 0000 0000 0002 0000 0000 0000 ................
-// 0x0040: 04 .
-var testPacketUSB0 = []byte{
- 0x00, 0x38, 0x4a, 0x3b, 0x00, 0x88, 0xff, 0xff, 0x43, 0x01, 0x81, 0x01, 0x02, 0x00, 0x2d, 0x00,
- 0xc0, 0xd3, 0x5b, 0x50, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x85, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04,
-}
-
-func TestPacketUSB0(t *testing.T) {
- p := gopacket.NewPacket(testPacketUSB0, LinkTypeLinuxUSB, gopacket.Default)
- if p.ErrorLayer() != nil {
- t.Error("Failed to decode packet:", p.ErrorLayer().Error())
- }
- checkLayers(p, []gopacket.LayerType{LayerTypeUSB, LayerTypeUSBInterrupt}, t)
-
- if got, ok := p.Layer(LayerTypeUSB).(*USB); ok {
- want := &USB{
- BaseLayer: BaseLayer{
- Contents: []uint8{0x0, 0x38, 0x4a, 0x3b, 0x0, 0x88, 0xff, 0xff, 0x43, 0x1, 0x81, 0x1, 0x2, 0x0, 0x2d, 0x0, 0xc0, 0xd3, 0x5b, 0x50, 0x0, 0x0, 0x0, 0x0, 0x8a, 0x85, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0},
- Payload: []uint8{0x4},
- },
- ID: 0xffff88003b4a3800,
- EventType: USBEventTypeComplete,
- TransferType: USBTransportTypeInterrupt,
- Direction: 0x1,
- EndpointNumber: 0x1,
- DeviceAddress: 0x1,
- BusID: 0x2,
- TimestampSec: 1348195264,
- TimestampUsec: 689546,
- Setup: false,
- Data: true,
- Status: 0,
- UrbLength: 0x1,
- UrbDataLength: 0x1,
- }
-
- if !reflect.DeepEqual(got, want) {
- t.Errorf("USB packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
- }
- }
-
-}
-func BenchmarkDecodePacketUSB0(b *testing.B) {
- for i := 0; i < b.N; i++ {
- gopacket.NewPacket(testPacketUSB0, LinkTypeLinuxUSB, gopacket.NoCopy)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/macs/benchmark_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/macs/benchmark_test.go
deleted file mode 100644
index 33af5c263fe..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/macs/benchmark_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package macs
-
-import (
- "testing"
-)
-
-func BenchmarkCheckEthernetPrefix(b *testing.B) {
- key := [3]byte{5, 5, 5}
- for i := 0; i < b.N; i++ {
- _ = ValidMACPrefixMap[key]
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcap_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcap_test.go
deleted file mode 100644
index f26590846f5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcap_test.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package pcap
-
-import (
- "fmt"
- "io"
- "log"
- "testing"
-
- "github.com/google/gopacket"
- "github.com/google/gopacket/layers"
-)
-
-func TestPcapFileRead(t *testing.T) {
- for _, file := range []struct {
- filename string
- num int
- expectedLayers []gopacket.LayerType
- }{
- {"test_loopback.pcap",
- 24,
- []gopacket.LayerType{
- layers.LayerTypeLoopback,
- layers.LayerTypeIPv6,
- layers.LayerTypeTCP,
- },
- },
- {"test_ethernet.pcap",
- 16,
- []gopacket.LayerType{
- layers.LayerTypeEthernet,
- layers.LayerTypeIPv4,
- layers.LayerTypeTCP,
- },
- },
- {"test_dns.pcap",
- 10,
- []gopacket.LayerType{
- layers.LayerTypeEthernet,
- layers.LayerTypeIPv4,
- layers.LayerTypeUDP,
- layers.LayerTypeDNS,
- },
- },
- } {
- t.Logf("\n\n\n\nProcessing file %s\n\n\n\n", file.filename)
-
- packets := []gopacket.Packet{}
- if handle, err := OpenOffline(file.filename); err != nil {
- t.Fatal(err)
- } else {
- packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
- for packet := range packetSource.Packets() {
- packets = append(packets, packet)
- }
- }
- if len(packets) != file.num {
- t.Fatal("Incorrect number of packets, want", file.num, "got", len(packets))
- }
- for i, p := range packets {
- t.Log(p.Dump())
- for _, layertype := range file.expectedLayers {
- if p.Layer(layertype) == nil {
- t.Fatal("Packet", i, "has no layer type\n%s", layertype, p.Dump())
- }
- }
- }
- }
-}
-
-func TestBPF(t *testing.T) {
- handle, err := OpenOffline("test_ethernet.pcap")
- if err != nil {
- t.Fatal(err)
- }
-
- for _, expected := range []struct {
- expr string
- Error bool
- Result bool
- }{
- {"foobar", true, false},
- {"tcp[tcpflags] & (tcp-syn|tcp-ack) == (tcp-syn|tcp-ack)", false, true},
- {"tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-ack", false, true},
- {"udp", false, false},
- } {
- data, ci, err := handle.ReadPacketData()
- if err != nil {
- t.Fatal(err)
- }
- t.Log("Testing filter", expected.expr)
- if bpf, err := handle.NewBPF(expected.expr); err != nil {
- if !expected.Error {
- t.Error(err, "while compiling filter was unexpected")
- }
- } else if expected.Error {
- t.Error("expected error but didn't see one")
- } else if matches := bpf.Matches(ci, data); matches != expected.Result {
- t.Error("Filter result was", matches, "but should be", expected.Result)
- }
- }
-}
-
-func TestBPFInstruction(t *testing.T) {
- handle, err := OpenOffline("test_ethernet.pcap")
- if err != nil {
- t.Fatal(err)
- }
-
- cntr := 0
- oversizedBpfInstructionBuffer := [MaxBpfInstructions + 1]BPFInstruction{}
-
- for _, expected := range []struct {
- BpfInstruction []BPFInstruction
- Error bool
- Result bool
- }{
- // {"foobar", true, false},
- {[]BPFInstruction{}, true, false},
-
- // {"tcp[tcpflags] & (tcp-syn|tcp-ack) == (tcp-syn|tcp-ack)", false, true},
- // tcpdump -dd 'tcp[tcpflags] & (tcp-syn|tcp-ack) == (tcp-syn|tcp-ack)'
- {[]BPFInstruction{
- {0x28, 0, 0, 0x0000000c},
- {0x15, 0, 9, 0x00000800},
- {0x30, 0, 0, 0x00000017},
- {0x15, 0, 7, 0x00000006},
- {0x28, 0, 0, 0x00000014},
- {0x45, 5, 0, 0x00001fff},
- {0xb1, 0, 0, 0x0000000e},
- {0x50, 0, 0, 0x0000001b},
- {0x54, 0, 0, 0x00000012},
- {0x15, 0, 1, 0x00000012},
- {0x6, 0, 0, 0x0000ffff},
- {0x6, 0, 0, 0x00000000},
- }, false, true},
-
- // {"tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-ack", false, true},
- // tcpdump -dd 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-ack'
- {[]BPFInstruction{
- {0x28, 0, 0, 0x0000000c},
- {0x15, 0, 9, 0x00000800},
- {0x30, 0, 0, 0x00000017},
- {0x15, 0, 7, 0x00000006},
- {0x28, 0, 0, 0x00000014},
- {0x45, 5, 0, 0x00001fff},
- {0xb1, 0, 0, 0x0000000e},
- {0x50, 0, 0, 0x0000001b},
- {0x54, 0, 0, 0x00000012},
- {0x15, 0, 1, 0x00000010},
- {0x6, 0, 0, 0x0000ffff},
- {0x6, 0, 0, 0x00000000},
- }, false, true},
-
- // {"udp", false, false},
- // tcpdump -dd 'udp'
- {[]BPFInstruction{
- {0x28, 0, 0, 0x0000000c},
- {0x15, 0, 5, 0x000086dd},
- {0x30, 0, 0, 0x00000014},
- {0x15, 6, 0, 0x00000011},
- {0x15, 0, 6, 0x0000002c},
- {0x30, 0, 0, 0x00000036},
- {0x15, 3, 4, 0x00000011},
- {0x15, 0, 3, 0x00000800},
- {0x30, 0, 0, 0x00000017},
- {0x15, 0, 1, 0x00000011},
- {0x6, 0, 0, 0x0000ffff},
- {0x6, 0, 0, 0x00000000},
- }, false, false},
-
- {oversizedBpfInstructionBuffer[:], true, false},
- } {
- cntr++
- data, ci, err := handle.ReadPacketData()
- if err != nil {
- t.Fatal(err)
- }
- t.Log("Testing BpfInstruction filter", cntr)
- if bpf, err := handle.NewBPFInstructionFilter(expected.BpfInstruction); err != nil {
- if !expected.Error {
- t.Error(err, "while compiling filter was unexpected")
- }
- } else if expected.Error {
- t.Error("expected error but didn't see one")
- } else if matches := bpf.Matches(ci, data); matches != expected.Result {
- t.Error("Filter result was", matches, "but should be", expected.Result)
- }
- }
-}
-
-func ExampleBPF() {
- handle, err := OpenOffline("test_ethernet.pcap")
- if err != nil {
- log.Fatal(err)
- }
- synack, err := handle.NewBPF("tcp[tcpflags] & (tcp-syn|tcp-ack) == (tcp-syn|tcp-ack)")
- if err != nil {
- log.Fatal(err)
- }
- syn, err := handle.NewBPF("tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn")
- if err != nil {
- log.Fatal(err)
- }
- for {
- data, ci, err := handle.ReadPacketData()
- switch {
- case err == io.EOF:
- return
- case err != nil:
- log.Fatal(err)
- case synack.Matches(ci, data):
- fmt.Println("SYN/ACK packet")
- case syn.Matches(ci, data):
- fmt.Println("SYN packet")
- default:
- fmt.Println("SYN flag not set")
- }
- }
- // Output:
- // SYN packet
- // SYN/ACK packet
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
- // SYN flag not set
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcapgo_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcapgo_test.go
deleted file mode 100644
index 4de018aee7a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcap/pcapgo_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package pcap
-
-import (
- "bytes"
- "github.com/google/gopacket"
- "github.com/google/gopacket/layers"
- "github.com/google/gopacket/pcapgo"
- "io/ioutil"
- "reflect"
- "testing"
- "time"
-)
-
-func TestPCAPGoWrite(t *testing.T) {
- f, err := ioutil.TempFile("", "pcapgo")
- if err != nil {
- t.Fatal(err)
- }
- data := []byte{0xab, 0xcd, 0xef, 0x01, 0x02, 0x03, 0x04}
- ci := gopacket.CaptureInfo{
- Timestamp: time.Unix(12345667, 1234567000),
- Length: 700,
- CaptureLength: len(data),
- }
- func() {
- defer f.Close()
- w := pcapgo.NewWriter(f)
- if err := w.WriteFileHeader(65536, layers.LinkTypeEthernet); err != nil {
- t.Fatal(err)
- }
- if err := w.WritePacket(ci, data); err != nil {
- t.Fatal(err)
- }
- }()
- h, err := OpenOffline(f.Name())
- if err != nil {
- t.Fatal(err)
- }
- defer h.Close()
- gotData, gotCI, err := h.ReadPacketData()
- if err != nil {
- t.Fatal("could not read first packet:", err)
- }
- if !bytes.Equal(gotData, data) {
- t.Errorf("byte mismatch:\nwant: %v\n got: %v", data, gotData)
- }
- if !reflect.DeepEqual(ci, gotCI) {
- t.Errorf("CI mismatch:\nwant: %v\n got: %v", ci, gotCI)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/read_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/read_test.go
deleted file mode 100644
index c2e6397d21c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/read_test.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2014 Damjan Cvetko. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-package pcapgo
-
-import (
- "bytes"
- "testing"
- "time"
-)
-
-// test header read
-func TestCreatePcapReader(t *testing.T) {
- test := []byte{
- 0xd4, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- }
- buf := bytes.NewBuffer(test)
- _, err := NewReader(buf)
- if err != nil {
- t.Error(err)
- t.FailNow()
- }
-}
-
-// test big endian file read
-func TestCreatePcapReaderBigEndian(t *testing.T) {
- test := []byte{
- 0xa1, 0xb2, 0xc3, 0xd4, 0x00, 0x02, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
- }
- buf := bytes.NewBuffer(test)
- _, err := NewReader(buf)
- if err != nil {
- t.Error(err)
- t.FailNow()
- }
-}
-
-// test opening invalid data
-func TestCreatePcapReaderFail(t *testing.T) {
- test := []byte{
- 0xd0, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- }
- buf := bytes.NewBuffer(test)
- _, err := NewReader(buf)
- if err == nil {
- t.Error("Should fail but did not")
- t.FailNow()
- }
-}
-
-func TestPacket(t *testing.T) {
- test := []byte{
- 0xd4, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00, // magic, maj, min
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tz, sigfigs
- 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // snaplen, linkType
- 0x5A, 0xCC, 0x1A, 0x54, 0x01, 0x00, 0x00, 0x00, // sec, usec
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // cap len, full len
- 0x01, 0x02, 0x03, 0x04, // data
- }
-
- buf := bytes.NewBuffer(test)
- r, err := NewReader(buf)
-
- data, ci, err := r.ReadPacketData()
- if err != nil {
- t.Error(err)
- t.FailNow()
- }
- if !ci.Timestamp.Equal(time.Date(2014, 9, 18, 12, 13, 14, 1000, time.UTC)) {
- t.Error("Invalid time read")
- t.FailNow()
- }
- if ci.CaptureLength != 4 || ci.Length != 8 {
- t.Error("Invalid CapLen or Len")
- }
- want := []byte{1, 2, 3, 4}
- if !bytes.Equal(data, want) {
- t.Errorf("buf mismatch:\nwant: %+v\ngot: %+v", want, data)
- }
-}
-
-func TestPacketNano(t *testing.T) {
- test := []byte{
- 0x4d, 0x3c, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00, // magic, maj, min
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tz, sigfigs
- 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // snaplen, linkType
- 0x5A, 0xCC, 0x1A, 0x54, 0x01, 0x00, 0x00, 0x00, // sec, usec
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // cap len, full len
- 0x01, 0x02, 0x03, 0x04, // data
- }
-
- buf := bytes.NewBuffer(test)
- r, err := NewReader(buf)
-
- data, ci, err := r.ReadPacketData()
- if err != nil {
- t.Error(err)
- t.FailNow()
- }
- if !ci.Timestamp.Equal(time.Date(2014, 9, 18, 12, 13, 14, 1, time.UTC)) {
- t.Error("Invalid time read")
- t.FailNow()
- }
- if ci.CaptureLength != 4 || ci.Length != 8 {
- t.Error("Invalid CapLen or Len")
- }
- want := []byte{1, 2, 3, 4}
- if !bytes.Equal(data, want) {
- t.Errorf("buf mismatch:\nwant: %+v\ngot: %+v", want, data)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/write_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/write_test.go
deleted file mode 100644
index 5b87d6a5aa7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/pcapgo/write_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package pcapgo
-
-import (
- "bytes"
- "github.com/google/gopacket"
- "testing"
- "time"
-)
-
-func TestWriteHeader(t *testing.T) {
- var buf bytes.Buffer
- w := NewWriter(&buf)
- w.WriteFileHeader(0x1234, 0x56)
- want := []byte{
- 0xd4, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x34, 0x12, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00,
- }
- if got := buf.Bytes(); !bytes.Equal(got, want) {
- t.Errorf("buf mismatch:\nwant: %+v\ngot: %+v", want, got)
- }
-}
-
-func TestWritePacket(t *testing.T) {
- ci := gopacket.CaptureInfo{
- Timestamp: time.Unix(0x01020304, 0xAA*1000),
- Length: 0xABCD,
- CaptureLength: 10,
- }
- data := []byte{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
- var buf bytes.Buffer
- w := NewWriter(&buf)
- w.WritePacket(ci, data)
- want := []byte{
- 0x04, 0x03, 0x02, 0x01, 0xAA, 0x00, 0x00, 0x00,
- 0x0A, 0x00, 0x00, 0x00, 0xCD, 0xAB, 0x00, 0x00,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
- }
- if got := buf.Bytes(); !bytes.Equal(got, want) {
- t.Errorf("buf mismatch:\nwant: %+v\ngot: %+v", want, got)
- }
-}
-
-func TestCaptureInfoErrors(t *testing.T) {
- data := []byte{1, 2, 3, 4}
- ts := time.Unix(0, 0)
- for _, test := range []gopacket.CaptureInfo{
- gopacket.CaptureInfo{
- Timestamp: ts,
- Length: 5,
- CaptureLength: 5,
- },
- gopacket.CaptureInfo{
- Timestamp: ts,
- Length: 3,
- CaptureLength: 4,
- },
- } {
- var buf bytes.Buffer
- w := NewWriter(&buf)
- if err := w.WritePacket(test, data); err == nil {
- t.Errorf("CaptureInfo %+v should have error", test)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/assembly_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/assembly_test.go
deleted file mode 100644
index a7b81d430cb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/assembly_test.go
+++ /dev/null
@@ -1,562 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package tcpassembly
-
-import (
- "github.com/google/gopacket"
- "github.com/google/gopacket/layers"
- "net"
- "reflect"
- "testing"
- "time"
-)
-
-var netFlow gopacket.Flow
-
-func init() {
- netFlow, _ = gopacket.FlowFromEndpoints(
- layers.NewIPEndpoint(net.IP{1, 2, 3, 4}),
- layers.NewIPEndpoint(net.IP{5, 6, 7, 8}))
-}
-
-type testSequence struct {
- in layers.TCP
- want []Reassembly
-}
-
-type testFactory struct {
- reassembly []Reassembly
-}
-
-func (t *testFactory) New(a, b gopacket.Flow) Stream {
- return t
-}
-func (t *testFactory) Reassembled(r []Reassembly) {
- t.reassembly = r
- for i := 0; i < len(r); i++ {
- t.reassembly[i].Seen = time.Time{}
- }
-}
-func (t *testFactory) ReassemblyComplete() {
-}
-
-func test(t *testing.T, s []testSequence) {
- fact := &testFactory{}
- p := NewStreamPool(fact)
- a := NewAssembler(p)
- a.MaxBufferedPagesPerConnection = 4
- for i, test := range s {
- fact.reassembly = []Reassembly{}
- a.Assemble(netFlow, &test.in)
- if !reflect.DeepEqual(fact.reassembly, test.want) {
- t.Fatalf("test %v:\nwant: %v\n got: %v\n", i, test.want, fact.reassembly)
- }
- }
-}
-
-func TestReorder(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1001,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1004,
- BaseLayer: layers.BaseLayer{Payload: []byte{2, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1010,
- BaseLayer: layers.BaseLayer{Payload: []byte{4, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1007,
- BaseLayer: layers.BaseLayer{Payload: []byte{3, 2, 3}},
- },
- want: []Reassembly{
- Reassembly{
- Skip: -1,
- Bytes: []byte{1, 2, 3},
- },
- Reassembly{
- Bytes: []byte{2, 2, 3},
- },
- Reassembly{
- Bytes: []byte{3, 2, 3},
- },
- Reassembly{
- Bytes: []byte{4, 2, 3},
- },
- },
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1016,
- BaseLayer: layers.BaseLayer{Payload: []byte{2, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1019,
- BaseLayer: layers.BaseLayer{Payload: []byte{3, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1013,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3}},
- },
- want: []Reassembly{
- Reassembly{
- Bytes: []byte{1, 2, 3},
- },
- Reassembly{
- Bytes: []byte{2, 2, 3},
- },
- Reassembly{
- Bytes: []byte{3, 2, 3},
- },
- },
- },
- })
-}
-
-func TestMaxPerSkip(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1000,
- SYN: true,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{1, 2, 3},
- },
- },
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1007,
- BaseLayer: layers.BaseLayer{Payload: []byte{3, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1010,
- BaseLayer: layers.BaseLayer{Payload: []byte{4, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1013,
- BaseLayer: layers.BaseLayer{Payload: []byte{5, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1016,
- BaseLayer: layers.BaseLayer{Payload: []byte{6, 2, 3}},
- },
- want: []Reassembly{
- Reassembly{
- Skip: 3,
- Bytes: []byte{3, 2, 3},
- },
- Reassembly{
- Bytes: []byte{4, 2, 3},
- },
- Reassembly{
- Bytes: []byte{5, 2, 3},
- },
- Reassembly{
- Bytes: []byte{6, 2, 3},
- },
- },
- },
- })
-}
-
-func TestReorderFast(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{1, 2, 3},
- },
- },
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1007,
- BaseLayer: layers.BaseLayer{Payload: []byte{3, 2, 3}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1004,
- BaseLayer: layers.BaseLayer{Payload: []byte{2, 2, 3}},
- },
- want: []Reassembly{
- Reassembly{
- Bytes: []byte{2, 2, 3},
- },
- Reassembly{
- Bytes: []byte{3, 2, 3},
- },
- },
- },
- })
-}
-
-func TestOverlap(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
- },
- },
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1007,
- BaseLayer: layers.BaseLayer{Payload: []byte{7, 8, 9, 0, 1, 2, 3, 4, 5}},
- },
- want: []Reassembly{
- Reassembly{
- Bytes: []byte{1, 2, 3, 4, 5},
- },
- },
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1010,
- BaseLayer: layers.BaseLayer{Payload: []byte{0, 1, 2, 3, 4, 5, 6, 7}},
- },
- want: []Reassembly{
- Reassembly{
- Bytes: []byte{6, 7},
- },
- },
- },
- })
-}
-
-func TestBufferedOverlap(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1007,
- BaseLayer: layers.BaseLayer{Payload: []byte{7, 8, 9, 0, 1, 2, 3, 4, 5}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1010,
- BaseLayer: layers.BaseLayer{Payload: []byte{0, 1, 2, 3, 4, 5, 6, 7}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
- },
- Reassembly{
- Bytes: []byte{1, 2, 3, 4, 5},
- },
- Reassembly{
- Bytes: []byte{6, 7},
- },
- },
- },
- })
-}
-
-func TestOverrun1(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 0xFFFFFFFF,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
- },
- },
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 10,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4}},
- },
- want: []Reassembly{
- Reassembly{
- Bytes: []byte{1, 2, 3, 4},
- },
- },
- },
- })
-}
-
-func TestOverrun2(t *testing.T) {
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 10,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4}},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 0xFFFFFFFF,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0},
- },
- Reassembly{
- Bytes: []byte{1, 2, 3, 4},
- },
- },
- },
- })
-}
-
-func TestCacheLargePacket(t *testing.T) {
- data := make([]byte, pageBytes*3)
- test(t, []testSequence{
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1001,
- BaseLayer: layers.BaseLayer{Payload: data},
- },
- want: []Reassembly{},
- },
- {
- in: layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 1000,
- SYN: true,
- BaseLayer: layers.BaseLayer{Payload: []byte{}},
- },
- want: []Reassembly{
- Reassembly{
- Start: true,
- Bytes: []byte{},
- },
- Reassembly{
- Bytes: data[:pageBytes],
- },
- Reassembly{
- Bytes: data[pageBytes : pageBytes*2],
- },
- Reassembly{
- Bytes: data[pageBytes*2 : pageBytes*3],
- },
- },
- },
- })
-}
-
-func BenchmarkSingleStream(b *testing.B) {
- t := layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- }
- a := NewAssembler(NewStreamPool(&testFactory{}))
- for i := 0; i < b.N; i++ {
- a.Assemble(netFlow, &t)
- if t.SYN {
- t.SYN = false
- t.Seq++
- }
- t.Seq += 10
- }
-}
-
-func BenchmarkSingleStreamSkips(b *testing.B) {
- t := layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- }
- a := NewAssembler(NewStreamPool(&testFactory{}))
- skipped := false
- for i := 0; i < b.N; i++ {
- if i%10 == 9 {
- t.Seq += 10
- skipped = true
- } else if skipped {
- t.Seq -= 20
- }
- a.Assemble(netFlow, &t)
- if t.SYN {
- t.SYN = false
- t.Seq++
- }
- t.Seq += 10
- if skipped {
- t.Seq += 10
- skipped = false
- }
- }
-}
-
-func BenchmarkSingleStreamLoss(b *testing.B) {
- t := layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- SYN: true,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- }
- a := NewAssembler(NewStreamPool(&testFactory{}))
- for i := 0; i < b.N; i++ {
- a.Assemble(netFlow, &t)
- t.SYN = false
- t.Seq += 11
- }
-}
-
-func BenchmarkMultiStreamGrow(b *testing.B) {
- t := layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 0,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- }
- a := NewAssembler(NewStreamPool(&testFactory{}))
- for i := 0; i < b.N; i++ {
- t.SrcPort = layers.TCPPort(i)
- a.Assemble(netFlow, &t)
- t.Seq += 10
- }
-}
-
-func BenchmarkMultiStreamConn(b *testing.B) {
- t := layers.TCP{
- SrcPort: 1,
- DstPort: 2,
- Seq: 0,
- SYN: true,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}},
- }
- a := NewAssembler(NewStreamPool(&testFactory{}))
- for i := 0; i < b.N; i++ {
- t.SrcPort = layers.TCPPort(i)
- a.Assemble(netFlow, &t)
- if i%65536 == 65535 {
- if t.SYN {
- t.SYN = false
- t.Seq += 1
- }
- t.Seq += 10
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/tcpreader/reader_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/tcpreader/reader_test.go
deleted file mode 100644
index 7da9fd9a23c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/tcpassembly/tcpreader/reader_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package tcpreader
-
-import (
- "bytes"
- "fmt"
- "github.com/google/gopacket"
- "github.com/google/gopacket/layers"
- "github.com/google/gopacket/tcpassembly"
- "io"
- "net"
- "testing"
-)
-
-var netFlow gopacket.Flow
-
-func init() {
- netFlow, _ = gopacket.FlowFromEndpoints(
- layers.NewIPEndpoint(net.IP{1, 2, 3, 4}),
- layers.NewIPEndpoint(net.IP{5, 6, 7, 8}))
-}
-
-type readReturn struct {
- data []byte
- err error
-}
-type readSequence struct {
- in []layers.TCP
- want []readReturn
-}
-type testReaderFactory struct {
- lossErrors bool
- readSize int
- ReaderStream
- output chan []byte
-}
-
-func (t *testReaderFactory) New(a, b gopacket.Flow) tcpassembly.Stream {
- return &t.ReaderStream
-}
-
-func testReadSequence(t *testing.T, lossErrors bool, readSize int, seq readSequence) {
- f := &testReaderFactory{ReaderStream: NewReaderStream()}
- f.ReaderStream.LossErrors = lossErrors
- p := tcpassembly.NewStreamPool(f)
- a := tcpassembly.NewAssembler(p)
- buf := make([]byte, readSize)
- go func() {
- for i, test := range seq.in {
- fmt.Println("Assembling", i)
- a.Assemble(netFlow, &test)
- fmt.Println("Assembly done")
- }
- }()
- for i, test := range seq.want {
- fmt.Println("Waiting for read", i)
- n, err := f.Read(buf[:])
- fmt.Println("Got read")
- if n != len(test.data) {
- t.Errorf("test %d want %d bytes, got %d bytes", i, len(test.data), n)
- } else if err != test.err {
- t.Errorf("test %d want err %v, got err %v", i, test.err, err)
- } else if !bytes.Equal(buf[:n], test.data) {
- t.Errorf("test %d\nwant: %v\n got: %v\n", i, test.data, buf[:n])
- }
- }
- fmt.Println("All done reads")
-}
-
-func TestRead(t *testing.T) {
- testReadSequence(t, false, 10, readSequence{
- in: []layers.TCP{
- {
- SYN: true,
- SrcPort: 1,
- DstPort: 2,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3}},
- },
- {
- FIN: true,
- SrcPort: 1,
- DstPort: 2,
- Seq: 1004,
- },
- },
- want: []readReturn{
- {data: []byte{1, 2, 3}},
- {err: io.EOF},
- },
- })
-}
-
-func TestReadSmallChunks(t *testing.T) {
- testReadSequence(t, false, 2, readSequence{
- in: []layers.TCP{
- {
- SYN: true,
- SrcPort: 1,
- DstPort: 2,
- Seq: 1000,
- BaseLayer: layers.BaseLayer{Payload: []byte{1, 2, 3}},
- },
- {
- FIN: true,
- SrcPort: 1,
- DstPort: 2,
- Seq: 1004,
- },
- },
- want: []readReturn{
- {data: []byte{1, 2}},
- {data: []byte{3}},
- {err: io.EOF},
- },
- })
-}
-
-func ExampleDiscardBytesToEOF() {
- b := bytes.NewBuffer([]byte{1, 2, 3, 4, 5})
- fmt.Println(DiscardBytesToEOF(b))
- // Output:
- // 5
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/writer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/writer_test.go
deleted file mode 100644
index e19069b7eb6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/google/gopacket/writer_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2012 Google, Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file in the root of the source
-// tree.
-
-package gopacket
-
-import (
- "fmt"
- "testing"
-)
-
-func TestExponentialSizeIncreasePrepend(t *testing.T) {
- var b serializeBuffer
- for i, test := range []struct {
- prepend, size int
- }{
- {2, 2},
- {2, 4},
- {2, 8},
- {2, 8},
- {2, 16},
- {2, 16},
- {2, 16},
- {2, 16},
- {2, 32},
- } {
- b.PrependBytes(test.prepend)
- if test.size != cap(b.data) {
- t.Error(i, "size want", test.size, "got", cap(b.data))
- }
- }
- b.Clear()
- if b.start != 32 {
- t.Error(b.start)
- }
-}
-
-func TestExponentialSizeIncreaseAppend(t *testing.T) {
- var b serializeBuffer
- for i, test := range []struct {
- appnd, size int
- }{
- {2, 2},
- {2, 4},
- {2, 8},
- {2, 8},
- {2, 16},
- {2, 16},
- {2, 16},
- {2, 16},
- {2, 32},
- } {
- b.AppendBytes(test.appnd)
- if test.size != cap(b.data) {
- t.Error(i, "size want", test.size, "got", cap(b.data))
- }
- }
- b.Clear()
- if b.start != 0 {
- t.Error(b.start)
- }
-}
-
-func ExampleSerializeBuffer() {
- b := NewSerializeBuffer()
- fmt.Println("1:", b.Bytes())
- bytes, _ := b.PrependBytes(3)
- copy(bytes, []byte{1, 2, 3})
- fmt.Println("2:", b.Bytes())
- bytes, _ = b.AppendBytes(2)
- copy(bytes, []byte{4, 5})
- fmt.Println("3:", b.Bytes())
- bytes, _ = b.PrependBytes(1)
- copy(bytes, []byte{0})
- fmt.Println("4:", b.Bytes())
- bytes, _ = b.AppendBytes(3)
- copy(bytes, []byte{6, 7, 8})
- fmt.Println("5:", b.Bytes())
- b.Clear()
- fmt.Println("6:", b.Bytes())
- bytes, _ = b.PrependBytes(2)
- copy(bytes, []byte{9, 9})
- fmt.Println("7:", b.Bytes())
- // Output:
- // 1: []
- // 2: [1 2 3]
- // 3: [1 2 3 4 5]
- // 4: [0 1 2 3 4 5]
- // 5: [0 1 2 3 4 5 6 7 8]
- // 6: []
- // 7: [9 9]
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/.gitignore b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/.gitignore
new file mode 100644
index 00000000000..e0870976009
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/.gitignore
@@ -0,0 +1,2 @@
+/node-syscall/build
+/node_modules
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/LICENSE b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/LICENSE
new file mode 100644
index 00000000000..d496fef1092
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2013 Richard Musiol. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/README.md b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/README.md
new file mode 100644
index 00000000000..64b2b22a40d
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/README.md
@@ -0,0 +1,143 @@
+GopherJS - A compiler from Go to JavaScript
+-------------------------------------------
+
+[![GoDoc](https://godoc.org/github.com/gopherjs/gopherjs/js?status.svg)](https://godoc.org/github.com/gopherjs/gopherjs/js)
+[![Sourcegraph](https://sourcegraph.com/github.com/gopherjs/gopherjs/-/badge.svg)](https://sourcegraph.com/github.com/gopherjs/gopherjs?badge)
+[![Circle CI](https://circleci.com/gh/gopherjs/gopherjs.svg?style=svg)](https://circleci.com/gh/gopherjs/gopherjs)
+
+GopherJS compiles Go code ([golang.org](https://golang.org/)) to pure JavaScript code. Its main purpose is to give you the opportunity to write front-end code in Go which will still run in all browsers.
+
+### Playground
+Give GopherJS a try on the [GopherJS Playground](http://gopherjs.github.io/playground/).
+
+### What is supported?
+Nearly everything, including Goroutines ([compatibility table](https://github.com/gopherjs/gopherjs/blob/master/doc/packages.md)). Performance is quite good in most cases, see [HTML5 game engine benchmark](https://ajhager.github.io/engi/demos/botmark.html). Cgo is not supported.
+
+### Installation and Usage
+Get or update GopherJS and dependencies with:
+
+```
+go get -u github.com/gopherjs/gopherjs
+```
+
+Now you can use `gopherjs build [package]`, `gopherjs build [files]` or `gopherjs install [package]` which behave similar to the `go` tool. For `main` packages, these commands create a `.js` file and `.js.map` source map in the current directory or in `$GOPATH/bin`. The generated JavaScript file can be used as usual in a website. Use `gopherjs help [command]` to get a list of possible command line flags, e.g. for minification and automatically watching for changes.
+
+`gopherjs` uses your platform's default `GOOS` value when generating code. Supported `GOOS` values are: `linux`, `darwin`. If you're on a different platform (e.g., Windows or FreeBSD), you'll need to set the `GOOS` environment variable to a supported value. For example, `GOOS=linux gopherjs build [package]`.
+
+*Note: GopherJS will try to write compiled object files of the core packages to your $GOROOT/pkg directory. If that fails, it will fall back to $GOPATH/pkg.*
+
+#### gopherjs run, gopherjs test
+
+If you want to use `gopherjs run` or `gopherjs test` to run the generated code locally, install Node.js 10.0.0 (or newer), and the `source-map-support` module:
+
+```
+npm install --global source-map-support
+```
+
+On supported `GOOS` platforms, it's possible to make system calls (file system access, etc.) available. See [doc/syscalls.md](https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md) for instructions on how to do so.
+
+#### gopherjs serve
+
+`gopherjs serve` is a useful command you can use during development. It will start an HTTP server serving on ":8080" by default, then dynamically compile your Go packages with GopherJS and serve them.
+
+For example, navigating to `http://localhost:8080/example.com/user/project/` should compile and run the Go package `example.com/user/project`. The generated JavaScript output will be served at `http://localhost:8080/example.com/user/project/project.js` (the .js file name will be equal to the base directory name). If the directory contains `index.html` it will be served, otherwise a minimal `index.html` that includes `<script src="project.js"></script>` will be provided, causing the JavaScript to be executed. All other static files will be served too.
+
+Refreshing in the browser will rebuild the served files if needed. Compilation errors will be displayed in terminal, and in browser console. Additionally, it will serve $GOROOT and $GOPATH for sourcemaps.
+
+If you include an argument, it will be the root from which everything is served. For example, if you run `gopherjs serve github.com/user/project` then the generated JavaScript for the package github.com/user/project/mypkg will be served at http://localhost:8080/mypkg/mypkg.js.
+
+### Performance Tips
+
+- Use the `-m` command line flag to generate minified code.
+- Apply gzip compression (https://en.wikipedia.org/wiki/HTTP_compression).
+- Use `int` instead of `(u)int8/16/32/64`.
+- Use `float64` instead of `float32`.
+
+### Community
+- [#gopherjs Channel on Gophers Slack](https://gophers.slack.com/messages/gopherjs/) (invites to Gophers Slack are available [here](http://blog.gopheracademy.com/gophers-slack-community/#how-can-i-be-invited-to-join:2facdc921b2310f18cb851c36fa92369))
+- [Bindings to JavaScript APIs and libraries](https://github.com/gopherjs/gopherjs/wiki/bindings)
+- [GopherJS Blog](https://medium.com/gopherjs)
+- [GopherJS on Twitter](https://twitter.com/GopherJS)
+
+### Getting started
+
+#### Interacting with the DOM
+The package `github.com/gopherjs/gopherjs/js` (see [documentation](https://godoc.org/github.com/gopherjs/gopherjs/js)) provides functions for interacting with native JavaScript APIs. For example the line
+
+```js
+document.write("Hello world!");
+```
+
+would look like this in Go:
+
+```go
+js.Global.Get("document").Call("write", "Hello world!")
+```
+
+You may also want use the [DOM bindings](http://dominik.honnef.co/go/js/dom), the [jQuery bindings](https://github.com/gopherjs/jquery) (see [TodoMVC Example](https://github.com/gopherjs/todomvc)) or the [AngularJS bindings](https://github.com/wvell/go-angularjs). Those are some of the [bindings to JavaScript APIs and libraries](https://github.com/gopherjs/gopherjs/wiki/bindings) by community members.
+
+#### Providing library functions for use in other JavaScript code
+Set a global variable to a map that contains the functions:
+
+```go
+package main
+
+import "github.com/gopherjs/gopherjs/js"
+
+func main() {
+ js.Global.Set("pet", map[string]interface{}{
+ "New": New,
+ })
+}
+
+type Pet struct {
+ name string
+}
+
+func New(name string) *js.Object {
+ return js.MakeWrapper(&Pet{name})
+}
+
+func (p *Pet) Name() string {
+ return p.name
+}
+
+func (p *Pet) SetName(name string) {
+ p.name = name
+}
+```
+
+For more details see [Jason Stone's blog post](http://legacytotheedge.blogspot.de/2014/03/gopherjs-go-to-javascript-transpiler.html) about GopherJS.
+
+### Architecture
+
+#### General
+GopherJS emulates a 32-bit environment. This means that `int`, `uint` and `uintptr` have a precision of 32 bits. However, the explicit 64-bit integer types `int64` and `uint64` are supported. The `GOARCH` value of GopherJS is "js". You may use it as a build constraint: `// +build js`.
+
+#### Application Lifecycle
+
+The `main` function is executed as usual after all `init` functions have run. JavaScript callbacks can also invoke Go functions, even after the `main` function has exited. Therefore the end of the `main` function should not be regarded as the end of the application and does not end the execution of other goroutines.
+
+In the browser, calling `os.Exit` (e.g. indirectly by `log.Fatal`) also does not terminate the execution of the program. For convenience, it calls `runtime.Goexit` to immediately terminate the calling goroutine.
+
+#### Goroutines
+Goroutines are fully supported by GopherJS. The only restriction is that you need to start a new goroutine if you want to use blocking code called from external JavaScript:
+
+```go
+js.Global.Get("myButton").Call("addEventListener", "click", func() {
+ go func() {
+ [...]
+ someBlockingFunction()
+ [...]
+ }()
+})
+```
+
+How it works:
+
+JavaScript has no concept of concurrency (except web workers, but those are too strictly separated to be used for goroutines). Because of that, instructions in JavaScript are never blocking. A blocking call would effectively freeze the responsiveness of your web page, so calls with callback arguments are used instead.
+
+GopherJS does some heavy lifting to work around this restriction: Whenever an instruction is blocking (e.g. communicating with a channel that isn't ready), the whole stack will unwind (= all functions return) and the goroutine will be put to sleep. Then another goroutine which is ready to resume gets picked and its stack with all local variables will be restored.
+
+### GopherJS Development
+If you're looking to make changes to the GopherJS compiler, see [Developer Guidelines](https://github.com/gopherjs/gopherjs/wiki/Developer-Guidelines) for additional developer information.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/build/build.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/build/build.go
new file mode 100644
index 00000000000..f2513ba5b6e
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/build/build.go
@@ -0,0 +1,875 @@
+package build
+
+import (
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/parser"
+ "go/scanner"
+ "go/token"
+ "go/types"
+ "io"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "path/filepath"
+ "runtime"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/fsnotify/fsnotify"
+ "github.com/gopherjs/gopherjs/compiler"
+ "github.com/gopherjs/gopherjs/compiler/gopherjspkg"
+ "github.com/gopherjs/gopherjs/compiler/natives"
+ "github.com/neelance/sourcemap"
+ "github.com/shurcooL/httpfs/vfsutil"
+ "golang.org/x/tools/go/buildutil"
+)
+
+type ImportCError struct {
+ pkgPath string
+}
+
+func (e *ImportCError) Error() string {
+ return e.pkgPath + `: importing "C" is not supported by GopherJS`
+}
+
+// NewBuildContext creates a build context for building Go packages
+// with GopherJS compiler.
+//
+// Core GopherJS packages (i.e., "github.com/gopherjs/gopherjs/js", "github.com/gopherjs/gopherjs/nosync")
+// are loaded from gopherjspkg.FS virtual filesystem rather than GOPATH.
+func NewBuildContext(installSuffix string, buildTags []string) *build.Context {
+ gopherjsRoot := filepath.Join(build.Default.GOROOT, "src", "github.com", "gopherjs", "gopherjs")
+ return &build.Context{
+ GOROOT: build.Default.GOROOT,
+ GOPATH: build.Default.GOPATH,
+ GOOS: build.Default.GOOS,
+ GOARCH: "js",
+ InstallSuffix: installSuffix,
+ Compiler: "gc",
+ BuildTags: append(buildTags,
+ "netgo", // See https://godoc.org/net#hdr-Name_Resolution.
+ "purego", // See https://golang.org/issues/23172.
+ ),
+ ReleaseTags: build.Default.ReleaseTags,
+ CgoEnabled: true, // detect `import "C"` to throw proper error
+
+ IsDir: func(path string) bool {
+ if strings.HasPrefix(path, gopherjsRoot+string(filepath.Separator)) {
+ path = filepath.ToSlash(path[len(gopherjsRoot):])
+ if fi, err := vfsutil.Stat(gopherjspkg.FS, path); err == nil {
+ return fi.IsDir()
+ }
+ }
+ fi, err := os.Stat(path)
+ return err == nil && fi.IsDir()
+ },
+ ReadDir: func(path string) ([]os.FileInfo, error) {
+ if strings.HasPrefix(path, gopherjsRoot+string(filepath.Separator)) {
+ path = filepath.ToSlash(path[len(gopherjsRoot):])
+ if fis, err := vfsutil.ReadDir(gopherjspkg.FS, path); err == nil {
+ return fis, nil
+ }
+ }
+ return ioutil.ReadDir(path)
+ },
+ OpenFile: func(path string) (io.ReadCloser, error) {
+ if strings.HasPrefix(path, gopherjsRoot+string(filepath.Separator)) {
+ path = filepath.ToSlash(path[len(gopherjsRoot):])
+ if f, err := gopherjspkg.FS.Open(path); err == nil {
+ return f, nil
+ }
+ }
+ return os.Open(path)
+ },
+ }
+}
+
+// statFile returns an os.FileInfo describing the named file.
+// For files in "$GOROOT/src/github.com/gopherjs/gopherjs" directory,
+// gopherjspkg.FS is consulted first.
+func statFile(path string) (os.FileInfo, error) {
+ gopherjsRoot := filepath.Join(build.Default.GOROOT, "src", "github.com", "gopherjs", "gopherjs")
+ if strings.HasPrefix(path, gopherjsRoot+string(filepath.Separator)) {
+ path = filepath.ToSlash(path[len(gopherjsRoot):])
+ if fi, err := vfsutil.Stat(gopherjspkg.FS, path); err == nil {
+ return fi, nil
+ }
+ }
+ return os.Stat(path)
+}
+
+// Import returns details about the Go package named by the import path. If the
+// path is a local import path naming a package that can be imported using
+// a standard import path, the returned package will set p.ImportPath to
+// that path.
+//
+// In the directory containing the package, .go and .inc.js files are
+// considered part of the package except for:
+//
+// - .go files in package documentation
+// - files starting with _ or . (likely editor temporary files)
+// - files with build constraints not satisfied by the context
+//
+// If an error occurs, Import returns a non-nil error and a nil
+// *PackageData.
+func Import(path string, mode build.ImportMode, installSuffix string, buildTags []string) (*PackageData, error) {
+ wd, err := os.Getwd()
+ if err != nil {
+ // Getwd may fail if we're in GOARCH=js mode. That's okay, handle
+ // it by falling back to empty working directory. It just means
+ // Import will not be able to resolve relative import paths.
+ wd = ""
+ }
+ bctx := NewBuildContext(installSuffix, buildTags)
+ return importWithSrcDir(*bctx, path, wd, mode, installSuffix)
+}
+
+func importWithSrcDir(bctx build.Context, path string, srcDir string, mode build.ImportMode, installSuffix string) (*PackageData, error) {
+ // bctx is passed by value, so it can be modified here.
+ var isVirtual bool
+ switch path {
+ case "syscall":
+ // syscall needs to use a typical GOARCH like amd64 to pick up definitions for _Socklen, BpfInsn, IFNAMSIZ, Timeval, BpfStat, SYS_FCNTL, Flock_t, etc.
+ bctx.GOARCH = runtime.GOARCH
+ bctx.InstallSuffix = "js"
+ if installSuffix != "" {
+ bctx.InstallSuffix += "_" + installSuffix
+ }
+ case "math/big":
+ // Use pure Go version of math/big; we don't want non-Go assembly versions.
+ bctx.BuildTags = append(bctx.BuildTags, "math_big_pure_go")
+ case "crypto/x509", "os/user":
+ // These stdlib packages have cgo and non-cgo versions (via build tags); we want the latter.
+ bctx.CgoEnabled = false
+ case "github.com/gopherjs/gopherjs/js", "github.com/gopherjs/gopherjs/nosync":
+ // These packages are already embedded via gopherjspkg.FS virtual filesystem (which can be
+ // safely vendored). Don't try to use vendor directory to resolve them.
+ mode |= build.IgnoreVendor
+ isVirtual = true
+ }
+ pkg, err := bctx.Import(path, srcDir, mode)
+ if err != nil {
+ return nil, err
+ }
+
+ switch path {
+ case "os":
+ pkg.GoFiles = excludeExecutable(pkg.GoFiles) // Need to exclude executable implementation files, because some of them contain package scope variables that perform (indirectly) syscalls on init.
+ case "runtime":
+ pkg.GoFiles = []string{"error.go"}
+ case "runtime/internal/sys":
+ pkg.GoFiles = []string{fmt.Sprintf("zgoos_%s.go", bctx.GOOS), "zversion.go"}
+ case "runtime/pprof":
+ pkg.GoFiles = nil
+ case "internal/poll":
+ pkg.GoFiles = exclude(pkg.GoFiles, "fd_poll_runtime.go")
+ case "crypto/rand":
+ pkg.GoFiles = []string{"rand.go", "util.go"}
+ pkg.TestGoFiles = exclude(pkg.TestGoFiles, "rand_linux_test.go") // Don't want linux-specific tests (since linux-specific package files are excluded too).
+ }
+
+ if len(pkg.CgoFiles) > 0 {
+ return nil, &ImportCError{path}
+ }
+
+ if pkg.IsCommand() {
+ pkg.PkgObj = filepath.Join(pkg.BinDir, filepath.Base(pkg.ImportPath)+".js")
+ }
+
+ if _, err := os.Stat(pkg.PkgObj); os.IsNotExist(err) && strings.HasPrefix(pkg.PkgObj, build.Default.GOROOT) {
+ // fall back to GOPATH
+ firstGopathWorkspace := filepath.SplitList(build.Default.GOPATH)[0] // TODO: Need to check inside all GOPATH workspaces.
+ gopathPkgObj := filepath.Join(firstGopathWorkspace, pkg.PkgObj[len(build.Default.GOROOT):])
+ if _, err := os.Stat(gopathPkgObj); err == nil {
+ pkg.PkgObj = gopathPkgObj
+ }
+ }
+
+ jsFiles, err := jsFilesFromDir(&bctx, pkg.Dir)
+ if err != nil {
+ return nil, err
+ }
+
+ return &PackageData{Package: pkg, JSFiles: jsFiles, IsVirtual: isVirtual}, nil
+}
+
+// excludeExecutable excludes all executable implementation .go files.
+// They have "executable_" prefix.
+func excludeExecutable(goFiles []string) []string {
+ var s []string
+ for _, f := range goFiles {
+ if strings.HasPrefix(f, "executable_") {
+ continue
+ }
+ s = append(s, f)
+ }
+ return s
+}
+
+// exclude returns files, excluding specified files.
+func exclude(files []string, exclude ...string) []string {
+ var s []string
+Outer:
+ for _, f := range files {
+ for _, e := range exclude {
+ if f == e {
+ continue Outer
+ }
+ }
+ s = append(s, f)
+ }
+ return s
+}
+
+// ImportDir is like Import but processes the Go package found in the named
+// directory.
+func ImportDir(dir string, mode build.ImportMode, installSuffix string, buildTags []string) (*PackageData, error) {
+ bctx := NewBuildContext(installSuffix, buildTags)
+ pkg, err := bctx.ImportDir(dir, mode)
+ if err != nil {
+ return nil, err
+ }
+
+ jsFiles, err := jsFilesFromDir(bctx, pkg.Dir)
+ if err != nil {
+ return nil, err
+ }
+
+ return &PackageData{Package: pkg, JSFiles: jsFiles}, nil
+}
+
+// parseAndAugment parses and returns all .go files of given pkg.
+// Standard Go library packages are augmented with files in compiler/natives folder.
+// If isTest is true and pkg.ImportPath has no _test suffix, package is built for running internal tests.
+// If isTest is true and pkg.ImportPath has _test suffix, package is built for running external tests.
+//
+// The native packages are augmented by the contents of natives.FS in the following way.
+// The file names do not matter except the usual `_test` suffix. The files for
+// native overrides get added to the package (even if they have the same name
+// as an existing file from the standard library). For all identifiers that exist
+// in the original AND the overrides, the original identifier in the AST gets
+// replaced by `_`. New identifiers that don't exist in original package get added.
+func parseAndAugment(bctx *build.Context, pkg *build.Package, isTest bool, fileSet *token.FileSet) ([]*ast.File, error) {
+ var files []*ast.File
+ replacedDeclNames := make(map[string]bool)
+ funcName := func(d *ast.FuncDecl) string {
+ if d.Recv == nil || len(d.Recv.List) == 0 {
+ return d.Name.Name
+ }
+ recv := d.Recv.List[0].Type
+ if star, ok := recv.(*ast.StarExpr); ok {
+ recv = star.X
+ }
+ return recv.(*ast.Ident).Name + "." + d.Name.Name
+ }
+ isXTest := strings.HasSuffix(pkg.ImportPath, "_test")
+ importPath := pkg.ImportPath
+ if isXTest {
+ importPath = importPath[:len(importPath)-5]
+ }
+
+ nativesContext := &build.Context{
+ GOROOT: "/",
+ GOOS: build.Default.GOOS,
+ GOARCH: "js",
+ Compiler: "gc",
+ JoinPath: path.Join,
+ SplitPathList: func(list string) []string {
+ if list == "" {
+ return nil
+ }
+ return strings.Split(list, "/")
+ },
+ IsAbsPath: path.IsAbs,
+ IsDir: func(name string) bool {
+ dir, err := natives.FS.Open(name)
+ if err != nil {
+ return false
+ }
+ defer dir.Close()
+ info, err := dir.Stat()
+ if err != nil {
+ return false
+ }
+ return info.IsDir()
+ },
+ HasSubdir: func(root, name string) (rel string, ok bool) {
+ panic("not implemented")
+ },
+ ReadDir: func(name string) (fi []os.FileInfo, err error) {
+ dir, err := natives.FS.Open(name)
+ if err != nil {
+ return nil, err
+ }
+ defer dir.Close()
+ return dir.Readdir(0)
+ },
+ OpenFile: func(name string) (r io.ReadCloser, err error) {
+ return natives.FS.Open(name)
+ },
+ }
+
+ // reflect needs to tell Go 1.11 apart from Go 1.11.1 for https://github.com/gopherjs/gopherjs/issues/862,
+ // so provide it with the custom go1.11.1 build tag whenever we're on Go 1.11.1 or later.
+ // TODO: Remove this ad hoc special behavior in GopherJS 1.12.
+ if runtime.Version() != "go1.11" {
+ nativesContext.ReleaseTags = append(nativesContext.ReleaseTags, "go1.11.1")
+ }
+
+ if nativesPkg, err := nativesContext.Import(importPath, "", 0); err == nil {
+ names := nativesPkg.GoFiles
+ if isTest {
+ names = append(names, nativesPkg.TestGoFiles...)
+ }
+ if isXTest {
+ names = nativesPkg.XTestGoFiles
+ }
+ for _, name := range names {
+ fullPath := path.Join(nativesPkg.Dir, name)
+ r, err := nativesContext.OpenFile(fullPath)
+ if err != nil {
+ panic(err)
+ }
+ file, err := parser.ParseFile(fileSet, fullPath, r, parser.ParseComments)
+ if err != nil {
+ panic(err)
+ }
+ r.Close()
+ for _, decl := range file.Decls {
+ switch d := decl.(type) {
+ case *ast.FuncDecl:
+ replacedDeclNames[funcName(d)] = true
+ case *ast.GenDecl:
+ switch d.Tok {
+ case token.TYPE:
+ for _, spec := range d.Specs {
+ replacedDeclNames[spec.(*ast.TypeSpec).Name.Name] = true
+ }
+ case token.VAR, token.CONST:
+ for _, spec := range d.Specs {
+ for _, name := range spec.(*ast.ValueSpec).Names {
+ replacedDeclNames[name.Name] = true
+ }
+ }
+ }
+ }
+ }
+ files = append(files, file)
+ }
+ }
+ delete(replacedDeclNames, "init")
+
+ var errList compiler.ErrorList
+ for _, name := range pkg.GoFiles {
+ if !filepath.IsAbs(name) { // name might be absolute if specified directly. E.g., `gopherjs build /abs/file.go`.
+ name = filepath.Join(pkg.Dir, name)
+ }
+ r, err := buildutil.OpenFile(bctx, name)
+ if err != nil {
+ return nil, err
+ }
+ file, err := parser.ParseFile(fileSet, name, r, parser.ParseComments)
+ r.Close()
+ if err != nil {
+ if list, isList := err.(scanner.ErrorList); isList {
+ if len(list) > 10 {
+ list = append(list[:10], &scanner.Error{Pos: list[9].Pos, Msg: "too many errors"})
+ }
+ for _, entry := range list {
+ errList = append(errList, entry)
+ }
+ continue
+ }
+ errList = append(errList, err)
+ continue
+ }
+
+ switch pkg.ImportPath {
+ case "crypto/rand", "encoding/gob", "encoding/json", "expvar", "go/token", "log", "math/big", "math/rand", "regexp", "testing", "time":
+ for _, spec := range file.Imports {
+ path, _ := strconv.Unquote(spec.Path.Value)
+ if path == "sync" {
+ if spec.Name == nil {
+ spec.Name = ast.NewIdent("sync")
+ }
+ spec.Path.Value = `"github.com/gopherjs/gopherjs/nosync"`
+ }
+ }
+ }
+
+ for _, decl := range file.Decls {
+ switch d := decl.(type) {
+ case *ast.FuncDecl:
+ if replacedDeclNames[funcName(d)] {
+ d.Name = ast.NewIdent("_")
+ }
+ case *ast.GenDecl:
+ switch d.Tok {
+ case token.TYPE:
+ for _, spec := range d.Specs {
+ s := spec.(*ast.TypeSpec)
+ if replacedDeclNames[s.Name.Name] {
+ s.Name = ast.NewIdent("_")
+ }
+ }
+ case token.VAR, token.CONST:
+ for _, spec := range d.Specs {
+ s := spec.(*ast.ValueSpec)
+ for i, name := range s.Names {
+ if replacedDeclNames[name.Name] {
+ s.Names[i] = ast.NewIdent("_")
+ }
+ }
+ }
+ }
+ }
+ }
+ files = append(files, file)
+ }
+ if errList != nil {
+ return nil, errList
+ }
+ return files, nil
+}
+
+type Options struct {
+ GOROOT string
+ GOPATH string
+ Verbose bool
+ Quiet bool
+ Watch bool
+ CreateMapFile bool
+ MapToLocalDisk bool
+ Minify bool
+ Color bool
+ BuildTags []string
+}
+
+func (o *Options) PrintError(format string, a ...interface{}) {
+ if o.Color {
+ format = "\x1B[31m" + format + "\x1B[39m"
+ }
+ fmt.Fprintf(os.Stderr, format, a...)
+}
+
+func (o *Options) PrintSuccess(format string, a ...interface{}) {
+ if o.Color {
+ format = "\x1B[32m" + format + "\x1B[39m"
+ }
+ fmt.Fprintf(os.Stderr, format, a...)
+}
+
+type PackageData struct {
+ *build.Package
+ JSFiles []string
+ IsTest bool // IsTest is true if the package is being built for running tests.
+ SrcModTime time.Time
+ UpToDate bool
+ IsVirtual bool // If true, the package does not have a corresponding physical directory on disk.
+}
+
+type Session struct {
+ options *Options
+ bctx *build.Context
+ Archives map[string]*compiler.Archive
+ Types map[string]*types.Package
+ Watcher *fsnotify.Watcher
+}
+
+func NewSession(options *Options) *Session {
+ if options.GOROOT == "" {
+ options.GOROOT = build.Default.GOROOT
+ }
+ if options.GOPATH == "" {
+ options.GOPATH = build.Default.GOPATH
+ }
+ options.Verbose = options.Verbose || options.Watch
+
+ s := &Session{
+ options: options,
+ Archives: make(map[string]*compiler.Archive),
+ }
+ s.bctx = NewBuildContext(s.InstallSuffix(), s.options.BuildTags)
+ s.Types = make(map[string]*types.Package)
+ if options.Watch {
+ if out, err := exec.Command("ulimit", "-n").Output(); err == nil {
+ if n, err := strconv.Atoi(strings.TrimSpace(string(out))); err == nil && n < 1024 {
+ fmt.Printf("Warning: The maximum number of open file descriptors is very low (%d). Change it with 'ulimit -n 8192'.\n", n)
+ }
+ }
+
+ var err error
+ s.Watcher, err = fsnotify.NewWatcher()
+ if err != nil {
+ panic(err)
+ }
+ }
+ return s
+}
+
+// BuildContext returns the session's build context.
+func (s *Session) BuildContext() *build.Context { return s.bctx }
+
+func (s *Session) InstallSuffix() string {
+ if s.options.Minify {
+ return "min"
+ }
+ return ""
+}
+
+func (s *Session) BuildDir(packagePath string, importPath string, pkgObj string) error {
+ if s.Watcher != nil {
+ s.Watcher.Add(packagePath)
+ }
+ buildPkg, err := s.bctx.ImportDir(packagePath, 0)
+ if err != nil {
+ return err
+ }
+ pkg := &PackageData{Package: buildPkg}
+ jsFiles, err := jsFilesFromDir(s.bctx, pkg.Dir)
+ if err != nil {
+ return err
+ }
+ pkg.JSFiles = jsFiles
+ archive, err := s.BuildPackage(pkg)
+ if err != nil {
+ return err
+ }
+ if pkgObj == "" {
+ pkgObj = filepath.Base(packagePath) + ".js"
+ }
+ if pkg.IsCommand() && !pkg.UpToDate {
+ if err := s.WriteCommandPackage(archive, pkgObj); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func (s *Session) BuildFiles(filenames []string, pkgObj string, packagePath string) error {
+ pkg := &PackageData{
+ Package: &build.Package{
+ Name: "main",
+ ImportPath: "main",
+ Dir: packagePath,
+ },
+ }
+
+ for _, file := range filenames {
+ if strings.HasSuffix(file, ".inc.js") {
+ pkg.JSFiles = append(pkg.JSFiles, file)
+ continue
+ }
+ pkg.GoFiles = append(pkg.GoFiles, file)
+ }
+
+ archive, err := s.BuildPackage(pkg)
+ if err != nil {
+ return err
+ }
+ if s.Types["main"].Name() != "main" {
+ return fmt.Errorf("cannot build/run non-main package")
+ }
+ return s.WriteCommandPackage(archive, pkgObj)
+}
+
+func (s *Session) BuildImportPath(path string) (*compiler.Archive, error) {
+ _, archive, err := s.buildImportPathWithSrcDir(path, "")
+ return archive, err
+}
+
+func (s *Session) buildImportPathWithSrcDir(path string, srcDir string) (*PackageData, *compiler.Archive, error) {
+ pkg, err := importWithSrcDir(*s.bctx, path, srcDir, 0, s.InstallSuffix())
+ if s.Watcher != nil && pkg != nil { // add watch even on error
+ s.Watcher.Add(pkg.Dir)
+ }
+ if err != nil {
+ return nil, nil, err
+ }
+
+ archive, err := s.BuildPackage(pkg)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ return pkg, archive, nil
+}
+
+func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
+ if archive, ok := s.Archives[pkg.ImportPath]; ok {
+ return archive, nil
+ }
+
+ if pkg.PkgObj != "" {
+ var fileInfo os.FileInfo
+ gopherjsBinary, err := os.Executable()
+ if err == nil {
+ fileInfo, err = os.Stat(gopherjsBinary)
+ if err == nil {
+ pkg.SrcModTime = fileInfo.ModTime()
+ }
+ }
+ if err != nil {
+ os.Stderr.WriteString("Could not get GopherJS binary's modification timestamp. Please report issue.\n")
+ pkg.SrcModTime = time.Now()
+ }
+
+ for _, importedPkgPath := range pkg.Imports {
+ // Ignore all imports that aren't mentioned in import specs of pkg.
+ // For example, this ignores imports such as runtime/internal/sys and runtime/internal/atomic.
+ ignored := true
+ for _, pos := range pkg.ImportPos[importedPkgPath] {
+ importFile := filepath.Base(pos.Filename)
+ for _, file := range pkg.GoFiles {
+ if importFile == file {
+ ignored = false
+ break
+ }
+ }
+ if !ignored {
+ break
+ }
+ }
+
+ if importedPkgPath == "unsafe" || ignored {
+ continue
+ }
+ importedPkg, _, err := s.buildImportPathWithSrcDir(importedPkgPath, pkg.Dir)
+ if err != nil {
+ return nil, err
+ }
+ impModTime := importedPkg.SrcModTime
+ if impModTime.After(pkg.SrcModTime) {
+ pkg.SrcModTime = impModTime
+ }
+ }
+
+ for _, name := range append(pkg.GoFiles, pkg.JSFiles...) {
+ fileInfo, err := statFile(filepath.Join(pkg.Dir, name))
+ if err != nil {
+ return nil, err
+ }
+ if fileInfo.ModTime().After(pkg.SrcModTime) {
+ pkg.SrcModTime = fileInfo.ModTime()
+ }
+ }
+
+ pkgObjFileInfo, err := os.Stat(pkg.PkgObj)
+ if err == nil && !pkg.SrcModTime.After(pkgObjFileInfo.ModTime()) {
+ // package object is up to date, load from disk if library
+ pkg.UpToDate = true
+ if pkg.IsCommand() {
+ return nil, nil
+ }
+
+ objFile, err := os.Open(pkg.PkgObj)
+ if err != nil {
+ return nil, err
+ }
+ defer objFile.Close()
+
+ archive, err := compiler.ReadArchive(pkg.PkgObj, pkg.ImportPath, objFile, s.Types)
+ if err != nil {
+ return nil, err
+ }
+
+ s.Archives[pkg.ImportPath] = archive
+ return archive, err
+ }
+ }
+
+ fileSet := token.NewFileSet()
+ files, err := parseAndAugment(s.bctx, pkg.Package, pkg.IsTest, fileSet)
+ if err != nil {
+ return nil, err
+ }
+
+ localImportPathCache := make(map[string]*compiler.Archive)
+ importContext := &compiler.ImportContext{
+ Packages: s.Types,
+ Import: func(path string) (*compiler.Archive, error) {
+ if archive, ok := localImportPathCache[path]; ok {
+ return archive, nil
+ }
+ _, archive, err := s.buildImportPathWithSrcDir(path, pkg.Dir)
+ if err != nil {
+ return nil, err
+ }
+ localImportPathCache[path] = archive
+ return archive, nil
+ },
+ }
+ archive, err := compiler.Compile(pkg.ImportPath, files, fileSet, importContext, s.options.Minify)
+ if err != nil {
+ return nil, err
+ }
+
+ for _, jsFile := range pkg.JSFiles {
+ code, err := ioutil.ReadFile(filepath.Join(pkg.Dir, jsFile))
+ if err != nil {
+ return nil, err
+ }
+ archive.IncJSCode = append(archive.IncJSCode, []byte("\t(function() {\n")...)
+ archive.IncJSCode = append(archive.IncJSCode, code...)
+ archive.IncJSCode = append(archive.IncJSCode, []byte("\n\t}).call($global);\n")...)
+ }
+
+ if s.options.Verbose {
+ fmt.Println(pkg.ImportPath)
+ }
+
+ s.Archives[pkg.ImportPath] = archive
+
+ if pkg.PkgObj == "" || pkg.IsCommand() {
+ return archive, nil
+ }
+
+ if err := s.writeLibraryPackage(archive, pkg.PkgObj); err != nil {
+ if strings.HasPrefix(pkg.PkgObj, s.options.GOROOT) {
+ // fall back to first GOPATH workspace
+ firstGopathWorkspace := filepath.SplitList(s.options.GOPATH)[0]
+ if err := s.writeLibraryPackage(archive, filepath.Join(firstGopathWorkspace, pkg.PkgObj[len(s.options.GOROOT):])); err != nil {
+ return nil, err
+ }
+ return archive, nil
+ }
+ return nil, err
+ }
+
+ return archive, nil
+}
+
+func (s *Session) writeLibraryPackage(archive *compiler.Archive, pkgObj string) error {
+ if err := os.MkdirAll(filepath.Dir(pkgObj), 0777); err != nil {
+ return err
+ }
+
+ objFile, err := os.Create(pkgObj)
+ if err != nil {
+ return err
+ }
+ defer objFile.Close()
+
+ return compiler.WriteArchive(archive, objFile)
+}
+
+func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string) error {
+ if err := os.MkdirAll(filepath.Dir(pkgObj), 0777); err != nil {
+ return err
+ }
+ codeFile, err := os.Create(pkgObj)
+ if err != nil {
+ return err
+ }
+ defer codeFile.Close()
+
+ sourceMapFilter := &compiler.SourceMapFilter{Writer: codeFile}
+ if s.options.CreateMapFile {
+ m := &sourcemap.Map{File: filepath.Base(pkgObj)}
+ mapFile, err := os.Create(pkgObj + ".map")
+ if err != nil {
+ return err
+ }
+
+ defer func() {
+ m.WriteTo(mapFile)
+ mapFile.Close()
+ fmt.Fprintf(codeFile, "//# sourceMappingURL=%s.map\n", filepath.Base(pkgObj))
+ }()
+
+ sourceMapFilter.MappingCallback = NewMappingCallback(m, s.options.GOROOT, s.options.GOPATH, s.options.MapToLocalDisk)
+ }
+
+ deps, err := compiler.ImportDependencies(archive, func(path string) (*compiler.Archive, error) {
+ if archive, ok := s.Archives[path]; ok {
+ return archive, nil
+ }
+ _, archive, err := s.buildImportPathWithSrcDir(path, "")
+ return archive, err
+ })
+ if err != nil {
+ return err
+ }
+ return compiler.WriteProgramCode(deps, sourceMapFilter)
+}
+
+func NewMappingCallback(m *sourcemap.Map, goroot, gopath string, localMap bool) func(generatedLine, generatedColumn int, originalPos token.Position) {
+ return func(generatedLine, generatedColumn int, originalPos token.Position) {
+ if !originalPos.IsValid() {
+ m.AddMapping(&sourcemap.Mapping{GeneratedLine: generatedLine, GeneratedColumn: generatedColumn})
+ return
+ }
+
+ file := originalPos.Filename
+
+ switch hasGopathPrefix, prefixLen := hasGopathPrefix(file, gopath); {
+ case localMap:
+ // no-op: keep file as-is
+ case hasGopathPrefix:
+ file = filepath.ToSlash(file[prefixLen+4:])
+ case strings.HasPrefix(file, goroot):
+ file = filepath.ToSlash(file[len(goroot)+4:])
+ default:
+ file = filepath.Base(file)
+ }
+
+ m.AddMapping(&sourcemap.Mapping{GeneratedLine: generatedLine, GeneratedColumn: generatedColumn, OriginalFile: file, OriginalLine: originalPos.Line, OriginalColumn: originalPos.Column})
+ }
+}
+
+func jsFilesFromDir(bctx *build.Context, dir string) ([]string, error) {
+ files, err := buildutil.ReadDir(bctx, dir)
+ if err != nil {
+ return nil, err
+ }
+ var jsFiles []string
+ for _, file := range files {
+ if strings.HasSuffix(file.Name(), ".inc.js") && file.Name()[0] != '_' && file.Name()[0] != '.' {
+ jsFiles = append(jsFiles, file.Name())
+ }
+ }
+ return jsFiles, nil
+}
+
+// hasGopathPrefix returns true and the length of the matched GOPATH workspace,
+// iff file has a prefix that matches one of the GOPATH workspaces.
+func hasGopathPrefix(file, gopath string) (hasGopathPrefix bool, prefixLen int) {
+ gopathWorkspaces := filepath.SplitList(gopath)
+ for _, gopathWorkspace := range gopathWorkspaces {
+ gopathWorkspace = filepath.Clean(gopathWorkspace)
+ if strings.HasPrefix(file, gopathWorkspace) {
+ return true, len(gopathWorkspace)
+ }
+ }
+ return false, 0
+}
+
+func (s *Session) WaitForChange() {
+ s.options.PrintSuccess("watching for changes...\n")
+ for {
+ select {
+ case ev := <-s.Watcher.Events:
+ if ev.Op&(fsnotify.Create|fsnotify.Write|fsnotify.Remove|fsnotify.Rename) == 0 || filepath.Base(ev.Name)[0] == '.' {
+ continue
+ }
+ if !strings.HasSuffix(ev.Name, ".go") && !strings.HasSuffix(ev.Name, ".inc.js") {
+ continue
+ }
+ s.options.PrintSuccess("change detected: %s\n", ev.Name)
+ case err := <-s.Watcher.Errors:
+ s.options.PrintError("watcher error: %s\n", err.Error())
+ }
+ break
+ }
+
+ go func() {
+ for range s.Watcher.Events {
+ // consume, else Close() may deadlock
+ }
+ }()
+ s.Watcher.Close()
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/circle.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/circle.yml
new file mode 100644
index 00000000000..8861bd80d4d
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/circle.yml
@@ -0,0 +1,140 @@
+version: 2
+jobs:
+ build:
+ docker:
+ - image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
+ command: /sbin/init
+ environment:
+ SOURCE_MAP_SUPPORT: false
+ working_directory: ~/go/src/github.com/gopherjs/gopherjs
+ steps:
+ - checkout
+ - run: git clone https://github.com/creationix/nvm $HOME/.nvm && cd $HOME/.nvm && git checkout v0.33.9 && echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
+ - run: nvm install 10.0.0 && nvm alias default 10.0.0
+ - run: cd /usr/local && sudo rm -rf go && curl https://storage.googleapis.com/golang/go1.11.2.linux-amd64.tar.gz | sudo tar -xz
+ - run: echo 'export PATH="$PATH:/usr/local/go/bin:$HOME/go/bin"' >> $BASH_ENV
+ - run: go get -t -d -v ./...
+ - run: go install -v
+ - run: npm install # Install our (dev) dependencies from package.json.
+ - run: npm install --global node-gyp
+ - run: cd node-syscall && node-gyp rebuild && mkdir -p ~/.node_libraries && cp build/Release/syscall.node ~/.node_libraries/syscall.node
+
+ - run: go generate github.com/gopherjs/gopherjs/compiler/prelude
+ - run: diff -u <(echo -n) <(git status --porcelain)
+ - run: diff -u <(echo -n) <(gofmt -d .)
+ - run: go tool vet *.go # Go package in root directory.
+ - run: for d in */; do echo $d; done | grep -v tests/ | grep -v third_party/ | xargs go tool vet # All subdirectories except "tests", "third_party".
+ - run: diff -u <(echo -n) <(go list ./compiler/natives/src/...) # All those packages should have // +build js.
+ - run: gopherjs install -v net/http # Should build successfully (can't run tests, since only client is supported).
+ - run: >
+ ulimit -s 10000 && gopherjs test --minify -v --short
+ github.com/gopherjs/gopherjs/tests
+ github.com/gopherjs/gopherjs/tests/main
+ github.com/gopherjs/gopherjs/js
+ archive/tar
+ archive/zip
+ bufio
+ bytes
+ compress/bzip2
+ compress/flate
+ compress/gzip
+ compress/lzw
+ compress/zlib
+ container/heap
+ container/list
+ container/ring
+ crypto/aes
+ crypto/cipher
+ crypto/des
+ crypto/dsa
+ crypto/ecdsa
+ crypto/elliptic
+ crypto/hmac
+ crypto/md5
+ crypto/rand
+ crypto/rc4
+ crypto/rsa
+ crypto/sha1
+ crypto/sha256
+ crypto/sha512
+ crypto/subtle
+ crypto/x509
+ database/sql
+ database/sql/driver
+ debug/dwarf
+ debug/elf
+ debug/macho
+ debug/pe
+ encoding/ascii85
+ encoding/asn1
+ encoding/base32
+ encoding/base64
+ encoding/binary
+ encoding/csv
+ encoding/gob
+ encoding/hex
+ encoding/json
+ encoding/pem
+ encoding/xml
+ errors
+ expvar
+ flag
+ fmt
+ go/ast
+ go/constant
+ go/doc
+ go/format
+ go/parser
+ go/printer
+ go/scanner
+ go/token
+ hash/adler32
+ hash/crc32
+ hash/crc64
+ hash/fnv
+ html
+ html/template
+ image
+ image/color
+ image/draw
+ image/gif
+ image/jpeg
+ image/png
+ index/suffixarray
+ io
+ io/ioutil
+ math
+ math/big
+ math/bits
+ math/cmplx
+ math/rand
+ mime
+ mime/multipart
+ mime/quotedprintable
+ net/http/cookiejar
+ net/http/fcgi
+ net/mail
+ net/rpc/jsonrpc
+ net/textproto
+ net/url
+ path
+ path/filepath
+ reflect
+ regexp
+ regexp/syntax
+ sort
+ strconv
+ strings
+ sync
+ sync/atomic
+ testing/quick
+ text/scanner
+ text/tabwriter
+ text/template
+ text/template/parse
+ time
+ unicode
+ unicode/utf16
+ unicode/utf8
+ - run: go test -v -race ./...
+ - run: gopherjs test -v fmt # No minification should work.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/bool.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/bool.go
new file mode 100644
index 00000000000..cba7c1c1497
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/bool.go
@@ -0,0 +1,43 @@
+package analysis
+
+import (
+ "go/ast"
+ "go/constant"
+ "go/token"
+ "go/types"
+)
+
+func BoolValue(expr ast.Expr, info *types.Info) (bool, bool) {
+ v := info.Types[expr].Value
+ if v != nil && v.Kind() == constant.Bool {
+ return constant.BoolVal(v), true
+ }
+ switch e := expr.(type) {
+ case *ast.BinaryExpr:
+ switch e.Op {
+ case token.LAND:
+ if b, ok := BoolValue(e.X, info); ok {
+ if !b {
+ return false, true
+ }
+ return BoolValue(e.Y, info)
+ }
+ case token.LOR:
+ if b, ok := BoolValue(e.X, info); ok {
+ if b {
+ return true, true
+ }
+ return BoolValue(e.Y, info)
+ }
+ }
+ case *ast.UnaryExpr:
+ if e.Op == token.NOT {
+ if b, ok := BoolValue(e.X, info); ok {
+ return !b, true
+ }
+ }
+ case *ast.ParenExpr:
+ return BoolValue(e.X, info)
+ }
+ return false, false
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/break.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/break.go
new file mode 100644
index 00000000000..579815d9215
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/break.go
@@ -0,0 +1,32 @@
+package analysis
+
+import (
+ "go/ast"
+ "go/token"
+)
+
+func HasBreak(n ast.Node) bool {
+ v := hasBreakVisitor{}
+ ast.Walk(&v, n)
+ return v.hasBreak
+}
+
+type hasBreakVisitor struct {
+ hasBreak bool
+}
+
+func (v *hasBreakVisitor) Visit(node ast.Node) (w ast.Visitor) {
+ if v.hasBreak {
+ return nil
+ }
+ switch n := node.(type) {
+ case *ast.BranchStmt:
+ if n.Tok == token.BREAK && n.Label == nil {
+ v.hasBreak = true
+ return nil
+ }
+ case *ast.ForStmt, *ast.RangeStmt, *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt, ast.Expr:
+ return nil
+ }
+ return v
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/escape.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/escape.go
new file mode 100644
index 00000000000..2807ecf641f
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/escape.go
@@ -0,0 +1,70 @@
+package analysis
+
+import (
+ "go/ast"
+ "go/token"
+ "go/types"
+)
+
+func EscapingObjects(n ast.Node, info *types.Info) []*types.Var {
+ v := escapeAnalysis{
+ info: info,
+ escaping: make(map[*types.Var]bool),
+ topScope: info.Scopes[n],
+ bottomScopes: make(map[*types.Scope]bool),
+ }
+ ast.Walk(&v, n)
+ var list []*types.Var
+ for obj := range v.escaping {
+ list = append(list, obj)
+ }
+ return list
+}
+
+type escapeAnalysis struct {
+ info *types.Info
+ escaping map[*types.Var]bool
+ topScope *types.Scope
+ bottomScopes map[*types.Scope]bool
+}
+
+func (v *escapeAnalysis) Visit(node ast.Node) (w ast.Visitor) {
+ // huge overapproximation
+ switch n := node.(type) {
+ case *ast.UnaryExpr:
+ if n.Op == token.AND {
+ if _, ok := n.X.(*ast.Ident); ok {
+ return &escapingObjectCollector{v}
+ }
+ }
+ case *ast.FuncLit:
+ v.bottomScopes[v.info.Scopes[n.Type]] = true
+ return &escapingObjectCollector{v}
+ case *ast.ForStmt:
+ v.bottomScopes[v.info.Scopes[n.Body]] = true
+ case *ast.RangeStmt:
+ v.bottomScopes[v.info.Scopes[n.Body]] = true
+ }
+ return v
+}
+
+type escapingObjectCollector struct {
+ analysis *escapeAnalysis
+}
+
+func (v *escapingObjectCollector) Visit(node ast.Node) (w ast.Visitor) {
+ if id, ok := node.(*ast.Ident); ok {
+ if obj, ok := v.analysis.info.Uses[id].(*types.Var); ok {
+ for s := obj.Parent(); s != nil; s = s.Parent() {
+ if s == v.analysis.topScope {
+ v.analysis.escaping[obj] = true
+ break
+ }
+ if v.analysis.bottomScopes[s] {
+ break
+ }
+ }
+ }
+ }
+ return v
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/info.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/info.go
new file mode 100644
index 00000000000..a8181615ff7
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/info.go
@@ -0,0 +1,254 @@
+package analysis
+
+import (
+ "go/ast"
+ "go/token"
+ "go/types"
+
+ "github.com/gopherjs/gopherjs/compiler/astutil"
+ "github.com/gopherjs/gopherjs/compiler/typesutil"
+)
+
+type continueStmt struct {
+ forStmt *ast.ForStmt
+ analyzeStack []ast.Node
+}
+
+type Info struct {
+ *types.Info
+ Pkg *types.Package
+ IsBlocking func(*types.Func) bool
+ HasPointer map[*types.Var]bool
+ FuncDeclInfos map[*types.Func]*FuncInfo
+ FuncLitInfos map[*ast.FuncLit]*FuncInfo
+ InitFuncInfo *FuncInfo
+ allInfos []*FuncInfo
+ comments ast.CommentMap
+}
+
+type FuncInfo struct {
+ HasDefer bool
+ Flattened map[ast.Node]bool
+ Blocking map[ast.Node]bool
+ GotoLabel map[*types.Label]bool
+ LocalCalls map[*types.Func][][]ast.Node
+ ContinueStmts []continueStmt
+ p *Info
+ analyzeStack []ast.Node
+}
+
+func (info *Info) newFuncInfo() *FuncInfo {
+ funcInfo := &FuncInfo{
+ p: info,
+ Flattened: make(map[ast.Node]bool),
+ Blocking: make(map[ast.Node]bool),
+ GotoLabel: make(map[*types.Label]bool),
+ LocalCalls: make(map[*types.Func][][]ast.Node),
+ }
+ info.allInfos = append(info.allInfos, funcInfo)
+ return funcInfo
+}
+
+func AnalyzePkg(files []*ast.File, fileSet *token.FileSet, typesInfo *types.Info, typesPkg *types.Package, isBlocking func(*types.Func) bool) *Info {
+ info := &Info{
+ Info: typesInfo,
+ Pkg: typesPkg,
+ HasPointer: make(map[*types.Var]bool),
+ comments: make(ast.CommentMap),
+ IsBlocking: isBlocking,
+ FuncDeclInfos: make(map[*types.Func]*FuncInfo),
+ FuncLitInfos: make(map[*ast.FuncLit]*FuncInfo),
+ }
+ info.InitFuncInfo = info.newFuncInfo()
+
+ for _, file := range files {
+ for k, v := range ast.NewCommentMap(fileSet, file, file.Comments) {
+ info.comments[k] = v
+ }
+ ast.Walk(info.InitFuncInfo, file)
+ }
+
+ for {
+ done := true
+ for _, funcInfo := range info.allInfos {
+ for obj, calls := range funcInfo.LocalCalls {
+ if len(info.FuncDeclInfos[obj].Blocking) != 0 {
+ for _, call := range calls {
+ funcInfo.markBlocking(call)
+ }
+ delete(funcInfo.LocalCalls, obj)
+ done = false
+ }
+ }
+ }
+ if done {
+ break
+ }
+ }
+
+ for _, funcInfo := range info.allInfos {
+ for _, continueStmt := range funcInfo.ContinueStmts {
+ if funcInfo.Blocking[continueStmt.forStmt.Post] {
+ funcInfo.markBlocking(continueStmt.analyzeStack)
+ }
+ }
+ }
+
+ return info
+}
+
+func (c *FuncInfo) Visit(node ast.Node) ast.Visitor {
+ if node == nil {
+ if len(c.analyzeStack) != 0 {
+ c.analyzeStack = c.analyzeStack[:len(c.analyzeStack)-1]
+ }
+ return nil
+ }
+ c.analyzeStack = append(c.analyzeStack, node)
+
+ switch n := node.(type) {
+ case *ast.FuncDecl:
+ newInfo := c.p.newFuncInfo()
+ c.p.FuncDeclInfos[c.p.Defs[n.Name].(*types.Func)] = newInfo
+ return newInfo
+ case *ast.FuncLit:
+ newInfo := c.p.newFuncInfo()
+ c.p.FuncLitInfos[n] = newInfo
+ return newInfo
+ case *ast.BranchStmt:
+ switch n.Tok {
+ case token.GOTO:
+ for _, n2 := range c.analyzeStack {
+ c.Flattened[n2] = true
+ }
+ c.GotoLabel[c.p.Uses[n.Label].(*types.Label)] = true
+ case token.CONTINUE:
+ if n.Label != nil {
+ label := c.p.Uses[n.Label].(*types.Label)
+ for i := len(c.analyzeStack) - 1; i >= 0; i-- {
+ if labelStmt, ok := c.analyzeStack[i].(*ast.LabeledStmt); ok && c.p.Defs[labelStmt.Label] == label {
+ if _, ok := labelStmt.Stmt.(*ast.RangeStmt); ok {
+ return nil
+ }
+ stack := make([]ast.Node, len(c.analyzeStack))
+ copy(stack, c.analyzeStack)
+ c.ContinueStmts = append(c.ContinueStmts, continueStmt{labelStmt.Stmt.(*ast.ForStmt), stack})
+ return nil
+ }
+ }
+ return nil
+ }
+ for i := len(c.analyzeStack) - 1; i >= 0; i-- {
+ if _, ok := c.analyzeStack[i].(*ast.RangeStmt); ok {
+ return nil
+ }
+ if forStmt, ok := c.analyzeStack[i].(*ast.ForStmt); ok {
+ stack := make([]ast.Node, len(c.analyzeStack))
+ copy(stack, c.analyzeStack)
+ c.ContinueStmts = append(c.ContinueStmts, continueStmt{forStmt, stack})
+ return nil
+ }
+ }
+ }
+ case *ast.CallExpr:
+ callTo := func(obj types.Object) {
+ switch o := obj.(type) {
+ case *types.Func:
+ if recv := o.Type().(*types.Signature).Recv(); recv != nil {
+ if _, ok := recv.Type().Underlying().(*types.Interface); ok {
+ c.markBlocking(c.analyzeStack)
+ return
+ }
+ }
+ if o.Pkg() != c.p.Pkg {
+ if c.p.IsBlocking(o) {
+ c.markBlocking(c.analyzeStack)
+ }
+ return
+ }
+ stack := make([]ast.Node, len(c.analyzeStack))
+ copy(stack, c.analyzeStack)
+ c.LocalCalls[o] = append(c.LocalCalls[o], stack)
+ case *types.Var:
+ c.markBlocking(c.analyzeStack)
+ }
+ }
+ switch f := astutil.RemoveParens(n.Fun).(type) {
+ case *ast.Ident:
+ callTo(c.p.Uses[f])
+ case *ast.SelectorExpr:
+ if sel := c.p.Selections[f]; sel != nil && typesutil.IsJsObject(sel.Recv()) {
+ break
+ }
+ callTo(c.p.Uses[f.Sel])
+ case *ast.FuncLit:
+ ast.Walk(c, n.Fun)
+ for _, arg := range n.Args {
+ ast.Walk(c, arg)
+ }
+ if len(c.p.FuncLitInfos[f].Blocking) != 0 {
+ c.markBlocking(c.analyzeStack)
+ }
+ return nil
+ default:
+ if !astutil.IsTypeExpr(f, c.p.Info) {
+ c.markBlocking(c.analyzeStack)
+ }
+ }
+ case *ast.SendStmt:
+ c.markBlocking(c.analyzeStack)
+ case *ast.UnaryExpr:
+ switch n.Op {
+ case token.AND:
+ if id, ok := astutil.RemoveParens(n.X).(*ast.Ident); ok {
+ c.p.HasPointer[c.p.Uses[id].(*types.Var)] = true
+ }
+ case token.ARROW:
+ c.markBlocking(c.analyzeStack)
+ }
+ case *ast.RangeStmt:
+ if _, ok := c.p.TypeOf(n.X).Underlying().(*types.Chan); ok {
+ c.markBlocking(c.analyzeStack)
+ }
+ case *ast.SelectStmt:
+ for _, s := range n.Body.List {
+ if s.(*ast.CommClause).Comm == nil { // default clause
+ return c
+ }
+ }
+ c.markBlocking(c.analyzeStack)
+ case *ast.CommClause:
+ switch comm := n.Comm.(type) {
+ case *ast.SendStmt:
+ ast.Walk(c, comm.Chan)
+ ast.Walk(c, comm.Value)
+ case *ast.ExprStmt:
+ ast.Walk(c, comm.X.(*ast.UnaryExpr).X)
+ case *ast.AssignStmt:
+ ast.Walk(c, comm.Rhs[0].(*ast.UnaryExpr).X)
+ }
+ for _, s := range n.Body {
+ ast.Walk(c, s)
+ }
+ return nil
+ case *ast.GoStmt:
+ ast.Walk(c, n.Call.Fun)
+ for _, arg := range n.Call.Args {
+ ast.Walk(c, arg)
+ }
+ return nil
+ case *ast.DeferStmt:
+ c.HasDefer = true
+ if funcLit, ok := n.Call.Fun.(*ast.FuncLit); ok {
+ ast.Walk(c, funcLit.Body)
+ }
+ }
+ return c
+}
+
+func (c *FuncInfo) markBlocking(stack []ast.Node) {
+ for _, n := range stack {
+ c.Blocking[n] = true
+ c.Flattened[n] = true
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/sideeffect.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/sideeffect.go
new file mode 100644
index 00000000000..a94d92b6781
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/analysis/sideeffect.go
@@ -0,0 +1,37 @@
+package analysis
+
+import (
+ "go/ast"
+ "go/token"
+ "go/types"
+)
+
+func HasSideEffect(n ast.Node, info *types.Info) bool {
+ v := hasSideEffectVisitor{info: info}
+ ast.Walk(&v, n)
+ return v.hasSideEffect
+}
+
+type hasSideEffectVisitor struct {
+ info *types.Info
+ hasSideEffect bool
+}
+
+func (v *hasSideEffectVisitor) Visit(node ast.Node) (w ast.Visitor) {
+ if v.hasSideEffect {
+ return nil
+ }
+ switch n := node.(type) {
+ case *ast.CallExpr:
+ if _, isSig := v.info.TypeOf(n.Fun).(*types.Signature); isSig { // skip conversions
+ v.hasSideEffect = true
+ return nil
+ }
+ case *ast.UnaryExpr:
+ if n.Op == token.ARROW {
+ v.hasSideEffect = true
+ return nil
+ }
+ }
+ return v
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/astutil/astutil.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/astutil/astutil.go
new file mode 100644
index 00000000000..7cd93b3ddc1
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/astutil/astutil.go
@@ -0,0 +1,48 @@
+package astutil
+
+import (
+ "go/ast"
+ "go/types"
+)
+
+func RemoveParens(e ast.Expr) ast.Expr {
+ for {
+ p, isParen := e.(*ast.ParenExpr)
+ if !isParen {
+ return e
+ }
+ e = p.X
+ }
+}
+
+func SetType(info *types.Info, t types.Type, e ast.Expr) ast.Expr {
+ info.Types[e] = types.TypeAndValue{Type: t}
+ return e
+}
+
+func NewIdent(name string, t types.Type, info *types.Info, pkg *types.Package) *ast.Ident {
+ ident := ast.NewIdent(name)
+ info.Types[ident] = types.TypeAndValue{Type: t}
+ obj := types.NewVar(0, pkg, name, t)
+ info.Uses[ident] = obj
+ return ident
+}
+
+func IsTypeExpr(expr ast.Expr, info *types.Info) bool {
+ switch e := expr.(type) {
+ case *ast.ArrayType, *ast.ChanType, *ast.FuncType, *ast.InterfaceType, *ast.MapType, *ast.StructType:
+ return true
+ case *ast.StarExpr:
+ return IsTypeExpr(e.X, info)
+ case *ast.Ident:
+ _, ok := info.Uses[e].(*types.TypeName)
+ return ok
+ case *ast.SelectorExpr:
+ _, ok := info.Uses[e.Sel].(*types.TypeName)
+ return ok
+ case *ast.ParenExpr:
+ return IsTypeExpr(e.X, info)
+ default:
+ return false
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/compiler.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/compiler.go
new file mode 100644
index 00000000000..7d2ebeb3b38
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/compiler.go
@@ -0,0 +1,297 @@
+package compiler
+
+import (
+ "bytes"
+ "encoding/binary"
+ "encoding/gob"
+ "encoding/json"
+ "fmt"
+ "go/token"
+ "go/types"
+ "io"
+ "strings"
+
+ "github.com/gopherjs/gopherjs/compiler/prelude"
+ "golang.org/x/tools/go/gcexportdata"
+)
+
+var sizes32 = &types.StdSizes{WordSize: 4, MaxAlign: 8}
+var reservedKeywords = make(map[string]bool)
+var _ = ___GOPHERJS_REQUIRES_GO_VERSION_1_11___ // Compile error on other Go versions, because they're not supported.
+
+func init() {
+ for _, keyword := range []string{"abstract", "arguments", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "eval", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "undefined", "var", "void", "volatile", "while", "with", "yield"} {
+ reservedKeywords[keyword] = true
+ }
+}
+
+type ErrorList []error
+
+func (err ErrorList) Error() string {
+ return err[0].Error()
+}
+
+type Archive struct {
+ ImportPath string
+ Name string
+ Imports []string
+ ExportData []byte
+ Declarations []*Decl
+ IncJSCode []byte
+ FileSet []byte
+ Minified bool
+}
+
+type Decl struct {
+ FullName string
+ Vars []string
+ DeclCode []byte
+ MethodListCode []byte
+ TypeInitCode []byte
+ InitCode []byte
+ DceObjectFilter string
+ DceMethodFilter string
+ DceDeps []string
+ Blocking bool
+}
+
+type Dependency struct {
+ Pkg string
+ Type string
+ Method string
+}
+
+func ImportDependencies(archive *Archive, importPkg func(string) (*Archive, error)) ([]*Archive, error) {
+ var deps []*Archive
+ paths := make(map[string]bool)
+ var collectDependencies func(path string) error
+ collectDependencies = func(path string) error {
+ if paths[path] {
+ return nil
+ }
+ dep, err := importPkg(path)
+ if err != nil {
+ return err
+ }
+ for _, imp := range dep.Imports {
+ if err := collectDependencies(imp); err != nil {
+ return err
+ }
+ }
+ deps = append(deps, dep)
+ paths[dep.ImportPath] = true
+ return nil
+ }
+
+ if err := collectDependencies("runtime"); err != nil {
+ return nil, err
+ }
+ for _, imp := range archive.Imports {
+ if err := collectDependencies(imp); err != nil {
+ return nil, err
+ }
+ }
+
+ deps = append(deps, archive)
+ return deps, nil
+}
+
+type dceInfo struct {
+ decl *Decl
+ objectFilter string
+ methodFilter string
+}
+
+func WriteProgramCode(pkgs []*Archive, w *SourceMapFilter) error {
+ mainPkg := pkgs[len(pkgs)-1]
+ minify := mainPkg.Minified
+
+ byFilter := make(map[string][]*dceInfo)
+ var pendingDecls []*Decl
+ for _, pkg := range pkgs {
+ for _, d := range pkg.Declarations {
+ if d.DceObjectFilter == "" && d.DceMethodFilter == "" {
+ pendingDecls = append(pendingDecls, d)
+ continue
+ }
+ info := &dceInfo{decl: d}
+ if d.DceObjectFilter != "" {
+ info.objectFilter = pkg.ImportPath + "." + d.DceObjectFilter
+ byFilter[info.objectFilter] = append(byFilter[info.objectFilter], info)
+ }
+ if d.DceMethodFilter != "" {
+ info.methodFilter = pkg.ImportPath + "." + d.DceMethodFilter
+ byFilter[info.methodFilter] = append(byFilter[info.methodFilter], info)
+ }
+ }
+ }
+
+ dceSelection := make(map[*Decl]struct{})
+ for len(pendingDecls) != 0 {
+ d := pendingDecls[len(pendingDecls)-1]
+ pendingDecls = pendingDecls[:len(pendingDecls)-1]
+
+ dceSelection[d] = struct{}{}
+
+ for _, dep := range d.DceDeps {
+ if infos, ok := byFilter[dep]; ok {
+ delete(byFilter, dep)
+ for _, info := range infos {
+ if info.objectFilter == dep {
+ info.objectFilter = ""
+ }
+ if info.methodFilter == dep {
+ info.methodFilter = ""
+ }
+ if info.objectFilter == "" && info.methodFilter == "" {
+ pendingDecls = append(pendingDecls, info.decl)
+ }
+ }
+ }
+ }
+ }
+
+ if _, err := w.Write([]byte("\"use strict\";\n(function() {\n\n")); err != nil {
+ return err
+ }
+ preludeJS := prelude.Prelude
+ if minify {
+ preludeJS = prelude.Minified
+ }
+ if _, err := io.WriteString(w, preludeJS); err != nil {
+ return err
+ }
+ if _, err := w.Write([]byte("\n")); err != nil {
+ return err
+ }
+
+ // write packages
+ for _, pkg := range pkgs {
+ if err := WritePkgCode(pkg, dceSelection, minify, w); err != nil {
+ return err
+ }
+ }
+
+ if _, err := w.Write([]byte("$synthesizeMethods();\nvar $mainPkg = $packages[\"" + string(mainPkg.ImportPath) + "\"];\n$packages[\"runtime\"].$init();\n$go($mainPkg.$init, []);\n$flushConsole();\n\n}).call(this);\n")); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func WritePkgCode(pkg *Archive, dceSelection map[*Decl]struct{}, minify bool, w *SourceMapFilter) error {
+ if w.MappingCallback != nil && pkg.FileSet != nil {
+ w.fileSet = token.NewFileSet()
+ if err := w.fileSet.Read(json.NewDecoder(bytes.NewReader(pkg.FileSet)).Decode); err != nil {
+ panic(err)
+ }
+ }
+ if _, err := w.Write(pkg.IncJSCode); err != nil {
+ return err
+ }
+ if _, err := w.Write(removeWhitespace([]byte(fmt.Sprintf("$packages[\"%s\"] = (function() {\n", pkg.ImportPath)), minify)); err != nil {
+ return err
+ }
+ vars := []string{"$pkg = {}", "$init"}
+ var filteredDecls []*Decl
+ for _, d := range pkg.Declarations {
+ if _, ok := dceSelection[d]; ok {
+ vars = append(vars, d.Vars...)
+ filteredDecls = append(filteredDecls, d)
+ }
+ }
+ if _, err := w.Write(removeWhitespace([]byte(fmt.Sprintf("\tvar %s;\n", strings.Join(vars, ", "))), minify)); err != nil {
+ return err
+ }
+ for _, d := range filteredDecls {
+ if _, err := w.Write(d.DeclCode); err != nil {
+ return err
+ }
+ }
+ for _, d := range filteredDecls {
+ if _, err := w.Write(d.MethodListCode); err != nil {
+ return err
+ }
+ }
+ for _, d := range filteredDecls {
+ if _, err := w.Write(d.TypeInitCode); err != nil {
+ return err
+ }
+ }
+
+ if _, err := w.Write(removeWhitespace([]byte("\t$init = function() {\n\t\t$pkg.$init = function() {};\n\t\t/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:\n"), minify)); err != nil {
+ return err
+ }
+ for _, d := range filteredDecls {
+ if _, err := w.Write(d.InitCode); err != nil {
+ return err
+ }
+ }
+ if _, err := w.Write(removeWhitespace([]byte("\t\t/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;\n\t};\n\t$pkg.$init = $init;\n\treturn $pkg;\n})();"), minify)); err != nil {
+ return err
+ }
+ if _, err := w.Write([]byte("\n")); err != nil { // keep this \n even when minified
+ return err
+ }
+ return nil
+}
+
+func ReadArchive(filename, path string, r io.Reader, packages map[string]*types.Package) (*Archive, error) {
+ var a Archive
+ if err := gob.NewDecoder(r).Decode(&a); err != nil {
+ return nil, err
+ }
+
+ var err error
+ packages[path], err = gcexportdata.Read(bytes.NewReader(a.ExportData), token.NewFileSet(), packages, path)
+ if err != nil {
+ return nil, err
+ }
+
+ return &a, nil
+}
+
+func WriteArchive(a *Archive, w io.Writer) error {
+ return gob.NewEncoder(w).Encode(a)
+}
+
+type SourceMapFilter struct {
+ Writer io.Writer
+ MappingCallback func(generatedLine, generatedColumn int, originalPos token.Position)
+ line int
+ column int
+ fileSet *token.FileSet
+}
+
+func (f *SourceMapFilter) Write(p []byte) (n int, err error) {
+ var n2 int
+ for {
+ i := bytes.IndexByte(p, '\b')
+ w := p
+ if i != -1 {
+ w = p[:i]
+ }
+
+ n2, err = f.Writer.Write(w)
+ n += n2
+ for {
+ i := bytes.IndexByte(w, '\n')
+ if i == -1 {
+ f.column += len(w)
+ break
+ }
+ f.line++
+ f.column = 0
+ w = w[i+1:]
+ }
+
+ if err != nil || i == -1 {
+ return
+ }
+ if f.MappingCallback != nil {
+ f.MappingCallback(f.line+1, f.column, f.fileSet.Position(token.Pos(binary.BigEndian.Uint32(p[i+1:i+5]))))
+ }
+ p = p[i+5:]
+ n += 5
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/expressions.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/expressions.go
new file mode 100644
index 00000000000..42fe624b6ef
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/expressions.go
@@ -0,0 +1,1373 @@
+package compiler
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/constant"
+ "go/token"
+ "go/types"
+ "sort"
+ "strconv"
+ "strings"
+
+ "github.com/gopherjs/gopherjs/compiler/analysis"
+ "github.com/gopherjs/gopherjs/compiler/astutil"
+ "github.com/gopherjs/gopherjs/compiler/typesutil"
+)
+
+type expression struct {
+ str string
+ parens bool
+}
+
+func (e *expression) String() string {
+ return e.str
+}
+
+func (e *expression) StringWithParens() string {
+ if e.parens {
+ return "(" + e.str + ")"
+ }
+ return e.str
+}
+
+func (c *funcContext) translateExpr(expr ast.Expr) *expression {
+ exprType := c.p.TypeOf(expr)
+ if value := c.p.Types[expr].Value; value != nil {
+ basic := exprType.Underlying().(*types.Basic)
+ switch {
+ case isBoolean(basic):
+ return c.formatExpr("%s", strconv.FormatBool(constant.BoolVal(value)))
+ case isInteger(basic):
+ if is64Bit(basic) {
+ if basic.Kind() == types.Int64 {
+ d, ok := constant.Int64Val(constant.ToInt(value))
+ if !ok {
+ panic("could not get exact uint")
+ }
+ return c.formatExpr("new %s(%s, %s)", c.typeName(exprType), strconv.FormatInt(d>>32, 10), strconv.FormatUint(uint64(d)&(1<<32-1), 10))
+ }
+ d, ok := constant.Uint64Val(constant.ToInt(value))
+ if !ok {
+ panic("could not get exact uint")
+ }
+ return c.formatExpr("new %s(%s, %s)", c.typeName(exprType), strconv.FormatUint(d>>32, 10), strconv.FormatUint(d&(1<<32-1), 10))
+ }
+ d, ok := constant.Int64Val(constant.ToInt(value))
+ if !ok {
+ panic("could not get exact int")
+ }
+ return c.formatExpr("%s", strconv.FormatInt(d, 10))
+ case isFloat(basic):
+ f, _ := constant.Float64Val(value)
+ return c.formatExpr("%s", strconv.FormatFloat(f, 'g', -1, 64))
+ case isComplex(basic):
+ r, _ := constant.Float64Val(constant.Real(value))
+ i, _ := constant.Float64Val(constant.Imag(value))
+ if basic.Kind() == types.UntypedComplex {
+ exprType = types.Typ[types.Complex128]
+ }
+ return c.formatExpr("new %s(%s, %s)", c.typeName(exprType), strconv.FormatFloat(r, 'g', -1, 64), strconv.FormatFloat(i, 'g', -1, 64))
+ case isString(basic):
+ return c.formatExpr("%s", encodeString(constant.StringVal(value)))
+ default:
+ panic("Unhandled constant type: " + basic.String())
+ }
+ }
+
+ var obj types.Object
+ switch e := expr.(type) {
+ case *ast.SelectorExpr:
+ obj = c.p.Uses[e.Sel]
+ case *ast.Ident:
+ obj = c.p.Defs[e]
+ if obj == nil {
+ obj = c.p.Uses[e]
+ }
+ }
+
+ if obj != nil && typesutil.IsJsPackage(obj.Pkg()) {
+ switch obj.Name() {
+ case "Global":
+ return c.formatExpr("$global")
+ case "Module":
+ return c.formatExpr("$module")
+ case "Undefined":
+ return c.formatExpr("undefined")
+ }
+ }
+
+ switch e := expr.(type) {
+ case *ast.CompositeLit:
+ if ptrType, isPointer := exprType.(*types.Pointer); isPointer {
+ exprType = ptrType.Elem()
+ }
+
+ collectIndexedElements := func(elementType types.Type) []string {
+ var elements []string
+ i := 0
+ zero := c.translateExpr(c.zeroValue(elementType)).String()
+ for _, element := range e.Elts {
+ if kve, isKve := element.(*ast.KeyValueExpr); isKve {
+ key, ok := constant.Int64Val(constant.ToInt(c.p.Types[kve.Key].Value))
+ if !ok {
+ panic("could not get exact int")
+ }
+ i = int(key)
+ element = kve.Value
+ }
+ for len(elements) <= i {
+ elements = append(elements, zero)
+ }
+ elements[i] = c.translateImplicitConversionWithCloning(element, elementType).String()
+ i++
+ }
+ return elements
+ }
+
+ switch t := exprType.Underlying().(type) {
+ case *types.Array:
+ elements := collectIndexedElements(t.Elem())
+ if len(elements) == 0 {
+ return c.formatExpr("%s.zero()", c.typeName(t))
+ }
+ zero := c.translateExpr(c.zeroValue(t.Elem())).String()
+ for len(elements) < int(t.Len()) {
+ elements = append(elements, zero)
+ }
+ return c.formatExpr(`$toNativeArray(%s, [%s])`, typeKind(t.Elem()), strings.Join(elements, ", "))
+ case *types.Slice:
+ return c.formatExpr("new %s([%s])", c.typeName(exprType), strings.Join(collectIndexedElements(t.Elem()), ", "))
+ case *types.Map:
+ entries := make([]string, len(e.Elts))
+ for i, element := range e.Elts {
+ kve := element.(*ast.KeyValueExpr)
+ entries[i] = fmt.Sprintf("{ k: %s, v: %s }", c.translateImplicitConversionWithCloning(kve.Key, t.Key()), c.translateImplicitConversionWithCloning(kve.Value, t.Elem()))
+ }
+ return c.formatExpr("$makeMap(%s.keyFor, [%s])", c.typeName(t.Key()), strings.Join(entries, ", "))
+ case *types.Struct:
+ elements := make([]string, t.NumFields())
+ isKeyValue := true
+ if len(e.Elts) != 0 {
+ _, isKeyValue = e.Elts[0].(*ast.KeyValueExpr)
+ }
+ if !isKeyValue {
+ for i, element := range e.Elts {
+ elements[i] = c.translateImplicitConversionWithCloning(element, t.Field(i).Type()).String()
+ }
+ }
+ if isKeyValue {
+ for i := range elements {
+ elements[i] = c.translateExpr(c.zeroValue(t.Field(i).Type())).String()
+ }
+ for _, element := range e.Elts {
+ kve := element.(*ast.KeyValueExpr)
+ for j := range elements {
+ if kve.Key.(*ast.Ident).Name == t.Field(j).Name() {
+ elements[j] = c.translateImplicitConversionWithCloning(kve.Value, t.Field(j).Type()).String()
+ break
+ }
+ }
+ }
+ }
+ return c.formatExpr("new %s.ptr(%s)", c.typeName(exprType), strings.Join(elements, ", "))
+ default:
+ panic(fmt.Sprintf("Unhandled CompositeLit type: %T\n", t))
+ }
+
+ case *ast.FuncLit:
+ _, fun := translateFunction(e.Type, nil, e.Body, c, exprType.(*types.Signature), c.p.FuncLitInfos[e], "")
+ if len(c.p.escapingVars) != 0 {
+ names := make([]string, 0, len(c.p.escapingVars))
+ for obj := range c.p.escapingVars {
+ names = append(names, c.p.objectNames[obj])
+ }
+ sort.Strings(names)
+ list := strings.Join(names, ", ")
+ return c.formatExpr("(function(%s) { return %s; })(%s)", list, fun, list)
+ }
+ return c.formatExpr("(%s)", fun)
+
+ case *ast.UnaryExpr:
+ t := c.p.TypeOf(e.X)
+ switch e.Op {
+ case token.AND:
+ if typesutil.IsJsObject(exprType) {
+ return c.formatExpr("%e.object", e.X)
+ }
+
+ switch t.Underlying().(type) {
+ case *types.Struct, *types.Array:
+ return c.translateExpr(e.X)
+ }
+
+ switch x := astutil.RemoveParens(e.X).(type) {
+ case *ast.CompositeLit:
+ return c.formatExpr("$newDataPointer(%e, %s)", x, c.typeName(c.p.TypeOf(e)))
+ case *ast.Ident:
+ obj := c.p.Uses[x].(*types.Var)
+ if c.p.escapingVars[obj] {
+ return c.formatExpr("(%1s.$ptr || (%1s.$ptr = new %2s(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, %1s)))", c.p.objectNames[obj], c.typeName(exprType))
+ }
+ return c.formatExpr(`(%1s || (%1s = new %2s(function() { return %3s; }, function($v) { %4s })))`, c.varPtrName(obj), c.typeName(exprType), c.objectName(obj), c.translateAssign(x, c.newIdent("$v", exprType), false))
+ case *ast.SelectorExpr:
+ sel, ok := c.p.SelectionOf(x)
+ if !ok {
+ // qualified identifier
+ obj := c.p.Uses[x.Sel].(*types.Var)
+ return c.formatExpr(`(%1s || (%1s = new %2s(function() { return %3s; }, function($v) { %4s })))`, c.varPtrName(obj), c.typeName(exprType), c.objectName(obj), c.translateAssign(x, c.newIdent("$v", exprType), false))
+ }
+ newSel := &ast.SelectorExpr{X: c.newIdent("this.$target", c.p.TypeOf(x.X)), Sel: x.Sel}
+ c.setType(newSel, exprType)
+ c.p.additionalSelections[newSel] = sel
+ return c.formatExpr("(%1e.$ptr_%2s || (%1e.$ptr_%2s = new %3s(function() { return %4e; }, function($v) { %5s }, %1e)))", x.X, x.Sel.Name, c.typeName(exprType), newSel, c.translateAssign(newSel, c.newIdent("$v", exprType), false))
+ case *ast.IndexExpr:
+ if _, ok := c.p.TypeOf(x.X).Underlying().(*types.Slice); ok {
+ return c.formatExpr("$indexPtr(%1e.$array, %1e.$offset + %2e, %3s)", x.X, x.Index, c.typeName(exprType))
+ }
+ return c.formatExpr("$indexPtr(%e, %e, %s)", x.X, x.Index, c.typeName(exprType))
+ case *ast.StarExpr:
+ return c.translateExpr(x.X)
+ default:
+ panic(fmt.Sprintf("Unhandled: %T\n", x))
+ }
+
+ case token.ARROW:
+ call := &ast.CallExpr{
+ Fun: c.newIdent("$recv", types.NewSignature(nil, types.NewTuple(types.NewVar(0, nil, "", t)), types.NewTuple(types.NewVar(0, nil, "", exprType), types.NewVar(0, nil, "", types.Typ[types.Bool])), false)),
+ Args: []ast.Expr{e.X},
+ }
+ c.Blocking[call] = true
+ if _, isTuple := exprType.(*types.Tuple); isTuple {
+ return c.formatExpr("%e", call)
+ }
+ return c.formatExpr("%e[0]", call)
+ }
+
+ basic := t.Underlying().(*types.Basic)
+ switch e.Op {
+ case token.ADD:
+ return c.translateExpr(e.X)
+ case token.SUB:
+ switch {
+ case is64Bit(basic):
+ return c.formatExpr("new %1s(-%2h, -%2l)", c.typeName(t), e.X)
+ case isComplex(basic):
+ return c.formatExpr("new %1s(-%2r, -%2i)", c.typeName(t), e.X)
+ case isUnsigned(basic):
+ return c.fixNumber(c.formatExpr("-%e", e.X), basic)
+ default:
+ return c.formatExpr("-%e", e.X)
+ }
+ case token.XOR:
+ if is64Bit(basic) {
+ return c.formatExpr("new %1s(~%2h, ~%2l >>> 0)", c.typeName(t), e.X)
+ }
+ return c.fixNumber(c.formatExpr("~%e", e.X), basic)
+ case token.NOT:
+ return c.formatExpr("!%e", e.X)
+ default:
+ panic(e.Op)
+ }
+
+ case *ast.BinaryExpr:
+ if e.Op == token.NEQ {
+ return c.formatExpr("!(%s)", c.translateExpr(&ast.BinaryExpr{
+ X: e.X,
+ Op: token.EQL,
+ Y: e.Y,
+ }))
+ }
+
+ t := c.p.TypeOf(e.X)
+ t2 := c.p.TypeOf(e.Y)
+ _, isInterface := t2.Underlying().(*types.Interface)
+ if isInterface || types.Identical(t, types.Typ[types.UntypedNil]) {
+ t = t2
+ }
+
+ if basic, isBasic := t.Underlying().(*types.Basic); isBasic && isNumeric(basic) {
+ if is64Bit(basic) {
+ switch e.Op {
+ case token.MUL:
+ return c.formatExpr("$mul64(%e, %e)", e.X, e.Y)
+ case token.QUO:
+ return c.formatExpr("$div64(%e, %e, false)", e.X, e.Y)
+ case token.REM:
+ return c.formatExpr("$div64(%e, %e, true)", e.X, e.Y)
+ case token.SHL:
+ return c.formatExpr("$shiftLeft64(%e, %f)", e.X, e.Y)
+ case token.SHR:
+ return c.formatExpr("$shiftRight%s(%e, %f)", toJavaScriptType(basic), e.X, e.Y)
+ case token.EQL:
+ return c.formatExpr("(%1h === %2h && %1l === %2l)", e.X, e.Y)
+ case token.LSS:
+ return c.formatExpr("(%1h < %2h || (%1h === %2h && %1l < %2l))", e.X, e.Y)
+ case token.LEQ:
+ return c.formatExpr("(%1h < %2h || (%1h === %2h && %1l <= %2l))", e.X, e.Y)
+ case token.GTR:
+ return c.formatExpr("(%1h > %2h || (%1h === %2h && %1l > %2l))", e.X, e.Y)
+ case token.GEQ:
+ return c.formatExpr("(%1h > %2h || (%1h === %2h && %1l >= %2l))", e.X, e.Y)
+ case token.ADD, token.SUB:
+ return c.formatExpr("new %3s(%1h %4t %2h, %1l %4t %2l)", e.X, e.Y, c.typeName(t), e.Op)
+ case token.AND, token.OR, token.XOR:
+ return c.formatExpr("new %3s(%1h %4t %2h, (%1l %4t %2l) >>> 0)", e.X, e.Y, c.typeName(t), e.Op)
+ case token.AND_NOT:
+ return c.formatExpr("new %3s(%1h & ~%2h, (%1l & ~%2l) >>> 0)", e.X, e.Y, c.typeName(t))
+ default:
+ panic(e.Op)
+ }
+ }
+
+ if isComplex(basic) {
+ switch e.Op {
+ case token.EQL:
+ return c.formatExpr("(%1r === %2r && %1i === %2i)", e.X, e.Y)
+ case token.ADD, token.SUB:
+ return c.formatExpr("new %3s(%1r %4t %2r, %1i %4t %2i)", e.X, e.Y, c.typeName(t), e.Op)
+ case token.MUL:
+ return c.formatExpr("new %3s(%1r * %2r - %1i * %2i, %1r * %2i + %1i * %2r)", e.X, e.Y, c.typeName(t))
+ case token.QUO:
+ return c.formatExpr("$divComplex(%e, %e)", e.X, e.Y)
+ default:
+ panic(e.Op)
+ }
+ }
+
+ switch e.Op {
+ case token.EQL:
+ return c.formatParenExpr("%e === %e", e.X, e.Y)
+ case token.LSS, token.LEQ, token.GTR, token.GEQ:
+ return c.formatExpr("%e %t %e", e.X, e.Op, e.Y)
+ case token.ADD, token.SUB:
+ return c.fixNumber(c.formatExpr("%e %t %e", e.X, e.Op, e.Y), basic)
+ case token.MUL:
+ switch basic.Kind() {
+ case types.Int32, types.Int:
+ return c.formatParenExpr("$imul(%e, %e)", e.X, e.Y)
+ case types.Uint32, types.Uintptr:
+ return c.formatParenExpr("$imul(%e, %e) >>> 0", e.X, e.Y)
+ }
+ return c.fixNumber(c.formatExpr("%e * %e", e.X, e.Y), basic)
+ case token.QUO:
+ if isInteger(basic) {
+ // cut off decimals
+ shift := ">>"
+ if isUnsigned(basic) {
+ shift = ">>>"
+ }
+ return c.formatExpr(`(%1s = %2e / %3e, (%1s === %1s && %1s !== 1/0 && %1s !== -1/0) ? %1s %4s 0 : $throwRuntimeError("integer divide by zero"))`, c.newVariable("_q"), e.X, e.Y, shift)
+ }
+ if basic.Kind() == types.Float32 {
+ return c.fixNumber(c.formatExpr("%e / %e", e.X, e.Y), basic)
+ }
+ return c.formatExpr("%e / %e", e.X, e.Y)
+ case token.REM:
+ return c.formatExpr(`(%1s = %2e %% %3e, %1s === %1s ? %1s : $throwRuntimeError("integer divide by zero"))`, c.newVariable("_r"), e.X, e.Y)
+ case token.SHL, token.SHR:
+ op := e.Op.String()
+ if e.Op == token.SHR && isUnsigned(basic) {
+ op = ">>>"
+ }
+ if v := c.p.Types[e.Y].Value; v != nil {
+ i, _ := constant.Uint64Val(constant.ToInt(v))
+ if i >= 32 {
+ return c.formatExpr("0")
+ }
+ return c.fixNumber(c.formatExpr("%e %s %s", e.X, op, strconv.FormatUint(i, 10)), basic)
+ }
+ if e.Op == token.SHR && !isUnsigned(basic) {
+ return c.fixNumber(c.formatParenExpr("%e >> $min(%f, 31)", e.X, e.Y), basic)
+ }
+ y := c.newVariable("y")
+ return c.fixNumber(c.formatExpr("(%s = %f, %s < 32 ? (%e %s %s) : 0)", y, e.Y, y, e.X, op, y), basic)
+ case token.AND, token.OR:
+ if isUnsigned(basic) {
+ return c.formatParenExpr("(%e %t %e) >>> 0", e.X, e.Op, e.Y)
+ }
+ return c.formatParenExpr("%e %t %e", e.X, e.Op, e.Y)
+ case token.AND_NOT:
+ return c.fixNumber(c.formatParenExpr("%e & ~%e", e.X, e.Y), basic)
+ case token.XOR:
+ return c.fixNumber(c.formatParenExpr("%e ^ %e", e.X, e.Y), basic)
+ default:
+ panic(e.Op)
+ }
+ }
+
+ switch e.Op {
+ case token.ADD, token.LSS, token.LEQ, token.GTR, token.GEQ:
+ return c.formatExpr("%e %t %e", e.X, e.Op, e.Y)
+ case token.LAND:
+ if c.Blocking[e.Y] {
+ skipCase := c.caseCounter
+ c.caseCounter++
+ resultVar := c.newVariable("_v")
+ c.Printf("if (!(%s)) { %s = false; $s = %d; continue s; }", c.translateExpr(e.X), resultVar, skipCase)
+ c.Printf("%s = %s; case %d:", resultVar, c.translateExpr(e.Y), skipCase)
+ return c.formatExpr("%s", resultVar)
+ }
+ return c.formatExpr("%e && %e", e.X, e.Y)
+ case token.LOR:
+ if c.Blocking[e.Y] {
+ skipCase := c.caseCounter
+ c.caseCounter++
+ resultVar := c.newVariable("_v")
+ c.Printf("if (%s) { %s = true; $s = %d; continue s; }", c.translateExpr(e.X), resultVar, skipCase)
+ c.Printf("%s = %s; case %d:", resultVar, c.translateExpr(e.Y), skipCase)
+ return c.formatExpr("%s", resultVar)
+ }
+ return c.formatExpr("%e || %e", e.X, e.Y)
+ case token.EQL:
+ switch u := t.Underlying().(type) {
+ case *types.Array, *types.Struct:
+ return c.formatExpr("$equal(%e, %e, %s)", e.X, e.Y, c.typeName(t))
+ case *types.Interface:
+ return c.formatExpr("$interfaceIsEqual(%s, %s)", c.translateImplicitConversion(e.X, t), c.translateImplicitConversion(e.Y, t))
+ case *types.Pointer:
+ if _, ok := u.Elem().Underlying().(*types.Array); ok {
+ return c.formatExpr("$equal(%s, %s, %s)", c.translateImplicitConversion(e.X, t), c.translateImplicitConversion(e.Y, t), c.typeName(u.Elem()))
+ }
+ case *types.Basic:
+ if isBoolean(u) {
+ if b, ok := analysis.BoolValue(e.X, c.p.Info.Info); ok && b {
+ return c.translateExpr(e.Y)
+ }
+ if b, ok := analysis.BoolValue(e.Y, c.p.Info.Info); ok && b {
+ return c.translateExpr(e.X)
+ }
+ }
+ }
+ return c.formatExpr("%s === %s", c.translateImplicitConversion(e.X, t), c.translateImplicitConversion(e.Y, t))
+ default:
+ panic(e.Op)
+ }
+
+ case *ast.ParenExpr:
+ return c.formatParenExpr("%e", e.X)
+
+ case *ast.IndexExpr:
+ switch t := c.p.TypeOf(e.X).Underlying().(type) {
+ case *types.Array, *types.Pointer:
+ pattern := rangeCheck("%1e[%2f]", c.p.Types[e.Index].Value != nil, true)
+ if _, ok := t.(*types.Pointer); ok { // check pointer for nix (attribute getter causes a panic)
+ pattern = `(%1e.nilCheck, ` + pattern + `)`
+ }
+ return c.formatExpr(pattern, e.X, e.Index)
+ case *types.Slice:
+ return c.formatExpr(rangeCheck("%1e.$array[%1e.$offset + %2f]", c.p.Types[e.Index].Value != nil, false), e.X, e.Index)
+ case *types.Map:
+ if typesutil.IsJsObject(c.p.TypeOf(e.Index)) {
+ c.p.errList = append(c.p.errList, types.Error{Fset: c.p.fileSet, Pos: e.Index.Pos(), Msg: "cannot use js.Object as map key"})
+ }
+ key := fmt.Sprintf("%s.keyFor(%s)", c.typeName(t.Key()), c.translateImplicitConversion(e.Index, t.Key()))
+ if _, isTuple := exprType.(*types.Tuple); isTuple {
+ return c.formatExpr(`(%1s = %2e[%3s], %1s !== undefined ? [%1s.v, true] : [%4e, false])`, c.newVariable("_entry"), e.X, key, c.zeroValue(t.Elem()))
+ }
+ return c.formatExpr(`(%1s = %2e[%3s], %1s !== undefined ? %1s.v : %4e)`, c.newVariable("_entry"), e.X, key, c.zeroValue(t.Elem()))
+ case *types.Basic:
+ return c.formatExpr("%e.charCodeAt(%f)", e.X, e.Index)
+ default:
+ panic(fmt.Sprintf("Unhandled IndexExpr: %T\n", t))
+ }
+
+ case *ast.SliceExpr:
+ if b, isBasic := c.p.TypeOf(e.X).Underlying().(*types.Basic); isBasic && isString(b) {
+ switch {
+ case e.Low == nil && e.High == nil:
+ return c.translateExpr(e.X)
+ case e.Low == nil:
+ return c.formatExpr("$substring(%e, 0, %f)", e.X, e.High)
+ case e.High == nil:
+ return c.formatExpr("$substring(%e, %f)", e.X, e.Low)
+ default:
+ return c.formatExpr("$substring(%e, %f, %f)", e.X, e.Low, e.High)
+ }
+ }
+ slice := c.translateConversionToSlice(e.X, exprType)
+ switch {
+ case e.Low == nil && e.High == nil:
+ return c.formatExpr("%s", slice)
+ case e.Low == nil:
+ if e.Max != nil {
+ return c.formatExpr("$subslice(%s, 0, %f, %f)", slice, e.High, e.Max)
+ }
+ return c.formatExpr("$subslice(%s, 0, %f)", slice, e.High)
+ case e.High == nil:
+ return c.formatExpr("$subslice(%s, %f)", slice, e.Low)
+ default:
+ if e.Max != nil {
+ return c.formatExpr("$subslice(%s, %f, %f, %f)", slice, e.Low, e.High, e.Max)
+ }
+ return c.formatExpr("$subslice(%s, %f, %f)", slice, e.Low, e.High)
+ }
+
+ case *ast.SelectorExpr:
+ sel, ok := c.p.SelectionOf(e)
+ if !ok {
+ // qualified identifier
+ return c.formatExpr("%s", c.objectName(obj))
+ }
+
+ switch sel.Kind() {
+ case types.FieldVal:
+ fields, jsTag := c.translateSelection(sel, e.Pos())
+ if jsTag != "" {
+ if _, ok := sel.Type().(*types.Signature); ok {
+ return c.formatExpr("$internalize(%1e.%2s%3s, %4s, %1e.%2s)", e.X, strings.Join(fields, "."), formatJSStructTagVal(jsTag), c.typeName(sel.Type()))
+ }
+ return c.internalize(c.formatExpr("%e.%s%s", e.X, strings.Join(fields, "."), formatJSStructTagVal(jsTag)), sel.Type())
+ }
+ return c.formatExpr("%e.%s", e.X, strings.Join(fields, "."))
+ case types.MethodVal:
+ return c.formatExpr(`$methodVal(%s, "%s")`, c.makeReceiver(e), sel.Obj().(*types.Func).Name())
+ case types.MethodExpr:
+ if !sel.Obj().Exported() {
+ c.p.dependencies[sel.Obj()] = true
+ }
+ if _, ok := sel.Recv().Underlying().(*types.Interface); ok {
+ return c.formatExpr(`$ifaceMethodExpr("%s")`, sel.Obj().(*types.Func).Name())
+ }
+ return c.formatExpr(`$methodExpr(%s, "%s")`, c.typeName(sel.Recv()), sel.Obj().(*types.Func).Name())
+ default:
+ panic(fmt.Sprintf("unexpected sel.Kind(): %T", sel.Kind()))
+ }
+
+ case *ast.CallExpr:
+ plainFun := astutil.RemoveParens(e.Fun)
+
+ if astutil.IsTypeExpr(plainFun, c.p.Info.Info) {
+ return c.formatExpr("(%s)", c.translateConversion(e.Args[0], c.p.TypeOf(plainFun)))
+ }
+
+ sig := c.p.TypeOf(plainFun).Underlying().(*types.Signature)
+
+ switch f := plainFun.(type) {
+ case *ast.Ident:
+ obj := c.p.Uses[f]
+ if o, ok := obj.(*types.Builtin); ok {
+ return c.translateBuiltin(o.Name(), sig, e.Args, e.Ellipsis.IsValid())
+ }
+ if typesutil.IsJsPackage(obj.Pkg()) && obj.Name() == "InternalObject" {
+ return c.translateExpr(e.Args[0])
+ }
+ return c.translateCall(e, sig, c.translateExpr(f))
+
+ case *ast.SelectorExpr:
+ sel, ok := c.p.SelectionOf(f)
+ if !ok {
+ // qualified identifier
+ obj := c.p.Uses[f.Sel]
+ if typesutil.IsJsPackage(obj.Pkg()) {
+ switch obj.Name() {
+ case "Debugger":
+ return c.formatExpr("debugger")
+ case "InternalObject":
+ return c.translateExpr(e.Args[0])
+ }
+ }
+ return c.translateCall(e, sig, c.translateExpr(f))
+ }
+
+ externalizeExpr := func(e ast.Expr) string {
+ t := c.p.TypeOf(e)
+ if types.Identical(t, types.Typ[types.UntypedNil]) {
+ return "null"
+ }
+ return c.externalize(c.translateExpr(e).String(), t)
+ }
+ externalizeArgs := func(args []ast.Expr) string {
+ s := make([]string, len(args))
+ for i, arg := range args {
+ s[i] = externalizeExpr(arg)
+ }
+ return strings.Join(s, ", ")
+ }
+
+ switch sel.Kind() {
+ case types.MethodVal:
+ recv := c.makeReceiver(f)
+ declaredFuncRecv := sel.Obj().(*types.Func).Type().(*types.Signature).Recv().Type()
+ if typesutil.IsJsObject(declaredFuncRecv) {
+ globalRef := func(id string) string {
+ if recv.String() == "$global" && id[0] == '$' && len(id) > 1 {
+ return id
+ }
+ return recv.String() + "." + id
+ }
+ switch sel.Obj().Name() {
+ case "Get":
+ if id, ok := c.identifierConstant(e.Args[0]); ok {
+ return c.formatExpr("%s", globalRef(id))
+ }
+ return c.formatExpr("%s[$externalize(%e, $String)]", recv, e.Args[0])
+ case "Set":
+ if id, ok := c.identifierConstant(e.Args[0]); ok {
+ return c.formatExpr("%s = %s", globalRef(id), externalizeExpr(e.Args[1]))
+ }
+ return c.formatExpr("%s[$externalize(%e, $String)] = %s", recv, e.Args[0], externalizeExpr(e.Args[1]))
+ case "Delete":
+ return c.formatExpr("delete %s[$externalize(%e, $String)]", recv, e.Args[0])
+ case "Length":
+ return c.formatExpr("$parseInt(%s.length)", recv)
+ case "Index":
+ return c.formatExpr("%s[%e]", recv, e.Args[0])
+ case "SetIndex":
+ return c.formatExpr("%s[%e] = %s", recv, e.Args[0], externalizeExpr(e.Args[1]))
+ case "Call":
+ if id, ok := c.identifierConstant(e.Args[0]); ok {
+ if e.Ellipsis.IsValid() {
+ objVar := c.newVariable("obj")
+ return c.formatExpr("(%s = %s, %s.%s.apply(%s, %s))", objVar, recv, objVar, id, objVar, externalizeExpr(e.Args[1]))
+ }
+ return c.formatExpr("%s(%s)", globalRef(id), externalizeArgs(e.Args[1:]))
+ }
+ if e.Ellipsis.IsValid() {
+ objVar := c.newVariable("obj")
+ return c.formatExpr("(%s = %s, %s[$externalize(%e, $String)].apply(%s, %s))", objVar, recv, objVar, e.Args[0], objVar, externalizeExpr(e.Args[1]))
+ }
+ return c.formatExpr("%s[$externalize(%e, $String)](%s)", recv, e.Args[0], externalizeArgs(e.Args[1:]))
+ case "Invoke":
+ if e.Ellipsis.IsValid() {
+ return c.formatExpr("%s.apply(undefined, %s)", recv, externalizeExpr(e.Args[0]))
+ }
+ return c.formatExpr("%s(%s)", recv, externalizeArgs(e.Args))
+ case "New":
+ if e.Ellipsis.IsValid() {
+ return c.formatExpr("new ($global.Function.prototype.bind.apply(%s, [undefined].concat(%s)))", recv, externalizeExpr(e.Args[0]))
+ }
+ return c.formatExpr("new (%s)(%s)", recv, externalizeArgs(e.Args))
+ case "Bool":
+ return c.internalize(recv, types.Typ[types.Bool])
+ case "String":
+ return c.internalize(recv, types.Typ[types.String])
+ case "Int":
+ return c.internalize(recv, types.Typ[types.Int])
+ case "Int64":
+ return c.internalize(recv, types.Typ[types.Int64])
+ case "Uint64":
+ return c.internalize(recv, types.Typ[types.Uint64])
+ case "Float":
+ return c.internalize(recv, types.Typ[types.Float64])
+ case "Interface":
+ return c.internalize(recv, types.NewInterface(nil, nil))
+ case "Unsafe":
+ return recv
+ default:
+ panic("Invalid js package object: " + sel.Obj().Name())
+ }
+ }
+
+ methodName := sel.Obj().Name()
+ if reservedKeywords[methodName] {
+ methodName += "$"
+ }
+ return c.translateCall(e, sig, c.formatExpr("%s.%s", recv, methodName))
+
+ case types.FieldVal:
+ fields, jsTag := c.translateSelection(sel, f.Pos())
+ if jsTag != "" {
+ call := c.formatExpr("%e.%s%s(%s)", f.X, strings.Join(fields, "."), formatJSStructTagVal(jsTag), externalizeArgs(e.Args))
+ switch sig.Results().Len() {
+ case 0:
+ return call
+ case 1:
+ return c.internalize(call, sig.Results().At(0).Type())
+ default:
+ c.p.errList = append(c.p.errList, types.Error{Fset: c.p.fileSet, Pos: f.Pos(), Msg: "field with js tag can not have func type with multiple results"})
+ }
+ }
+ return c.translateCall(e, sig, c.formatExpr("%e.%s", f.X, strings.Join(fields, ".")))
+
+ case types.MethodExpr:
+ return c.translateCall(e, sig, c.translateExpr(f))
+
+ default:
+ panic(fmt.Sprintf("unexpected sel.Kind(): %T", sel.Kind()))
+ }
+ default:
+ return c.translateCall(e, sig, c.translateExpr(plainFun))
+ }
+
+ case *ast.StarExpr:
+ if typesutil.IsJsObject(c.p.TypeOf(e.X)) {
+ return c.formatExpr("new $jsObjectPtr(%e)", e.X)
+ }
+ if c1, isCall := e.X.(*ast.CallExpr); isCall && len(c1.Args) == 1 {
+ if c2, isCall := c1.Args[0].(*ast.CallExpr); isCall && len(c2.Args) == 1 && types.Identical(c.p.TypeOf(c2.Fun), types.Typ[types.UnsafePointer]) {
+ if unary, isUnary := c2.Args[0].(*ast.UnaryExpr); isUnary && unary.Op == token.AND {
+ return c.translateExpr(unary.X) // unsafe conversion
+ }
+ }
+ }
+ switch exprType.Underlying().(type) {
+ case *types.Struct, *types.Array:
+ return c.translateExpr(e.X)
+ }
+ return c.formatExpr("%e.$get()", e.X)
+
+ case *ast.TypeAssertExpr:
+ if e.Type == nil {
+ return c.translateExpr(e.X)
+ }
+ t := c.p.TypeOf(e.Type)
+ if _, isTuple := exprType.(*types.Tuple); isTuple {
+ return c.formatExpr("$assertType(%e, %s, true)", e.X, c.typeName(t))
+ }
+ return c.formatExpr("$assertType(%e, %s)", e.X, c.typeName(t))
+
+ case *ast.Ident:
+ if e.Name == "_" {
+ panic("Tried to translate underscore identifier.")
+ }
+ switch o := obj.(type) {
+ case *types.Var, *types.Const:
+ return c.formatExpr("%s", c.objectName(o))
+ case *types.Func:
+ return c.formatExpr("%s", c.objectName(o))
+ case *types.TypeName:
+ return c.formatExpr("%s", c.typeName(o.Type()))
+ case *types.Nil:
+ if typesutil.IsJsObject(exprType) {
+ return c.formatExpr("null")
+ }
+ switch t := exprType.Underlying().(type) {
+ case *types.Basic:
+ if t.Kind() != types.UnsafePointer {
+ panic("unexpected basic type")
+ }
+ return c.formatExpr("0")
+ case *types.Slice, *types.Pointer:
+ return c.formatExpr("%s.nil", c.typeName(exprType))
+ case *types.Chan:
+ return c.formatExpr("$chanNil")
+ case *types.Map:
+ return c.formatExpr("false")
+ case *types.Interface:
+ return c.formatExpr("$ifaceNil")
+ case *types.Signature:
+ return c.formatExpr("$throwNilPointerError")
+ default:
+ panic(fmt.Sprintf("unexpected type: %T", t))
+ }
+ default:
+ panic(fmt.Sprintf("Unhandled object: %T\n", o))
+ }
+
+ case nil:
+ return c.formatExpr("")
+
+ default:
+ panic(fmt.Sprintf("Unhandled expression: %T\n", e))
+
+ }
+}
+
+func (c *funcContext) translateCall(e *ast.CallExpr, sig *types.Signature, fun *expression) *expression {
+ args := c.translateArgs(sig, e.Args, e.Ellipsis.IsValid())
+ if c.Blocking[e] {
+ resumeCase := c.caseCounter
+ c.caseCounter++
+ returnVar := "$r"
+ if sig.Results().Len() != 0 {
+ returnVar = c.newVariable("_r")
+ }
+ c.Printf("%[1]s = %[2]s(%[3]s); /* */ $s = %[4]d; case %[4]d: if($c) { $c = false; %[1]s = %[1]s.$blk(); } if (%[1]s && %[1]s.$blk !== undefined) { break s; }", returnVar, fun, strings.Join(args, ", "), resumeCase)
+ if sig.Results().Len() != 0 {
+ return c.formatExpr("%s", returnVar)
+ }
+ return c.formatExpr("")
+ }
+ return c.formatExpr("%s(%s)", fun, strings.Join(args, ", "))
+}
+
+func (c *funcContext) makeReceiver(e *ast.SelectorExpr) *expression {
+ sel, _ := c.p.SelectionOf(e)
+ if !sel.Obj().Exported() {
+ c.p.dependencies[sel.Obj()] = true
+ }
+
+ x := e.X
+ recvType := sel.Recv()
+ if len(sel.Index()) > 1 {
+ for _, index := range sel.Index()[:len(sel.Index())-1] {
+ if ptr, isPtr := recvType.(*types.Pointer); isPtr {
+ recvType = ptr.Elem()
+ }
+ s := recvType.Underlying().(*types.Struct)
+ recvType = s.Field(index).Type()
+ }
+
+ fakeSel := &ast.SelectorExpr{X: x, Sel: ast.NewIdent("o")}
+ c.p.additionalSelections[fakeSel] = &fakeSelection{
+ kind: types.FieldVal,
+ recv: sel.Recv(),
+ index: sel.Index()[:len(sel.Index())-1],
+ typ: recvType,
+ }
+ x = c.setType(fakeSel, recvType)
+ }
+
+ _, isPointer := recvType.Underlying().(*types.Pointer)
+ methodsRecvType := sel.Obj().Type().(*types.Signature).Recv().Type()
+ _, pointerExpected := methodsRecvType.(*types.Pointer)
+ if !isPointer && pointerExpected {
+ recvType = types.NewPointer(recvType)
+ x = c.setType(&ast.UnaryExpr{Op: token.AND, X: x}, recvType)
+ }
+ if isPointer && !pointerExpected {
+ x = c.setType(x, methodsRecvType)
+ }
+
+ recv := c.translateImplicitConversionWithCloning(x, methodsRecvType)
+ if isWrapped(recvType) {
+ recv = c.formatExpr("new %s(%s)", c.typeName(methodsRecvType), recv)
+ }
+ return recv
+}
+
+func (c *funcContext) translateBuiltin(name string, sig *types.Signature, args []ast.Expr, ellipsis bool) *expression {
+ switch name {
+ case "new":
+ t := sig.Results().At(0).Type().(*types.Pointer)
+ if c.p.Pkg.Path() == "syscall" && types.Identical(t.Elem().Underlying(), types.Typ[types.Uintptr]) {
+ return c.formatExpr("new Uint8Array(8)")
+ }
+ switch t.Elem().Underlying().(type) {
+ case *types.Struct, *types.Array:
+ return c.formatExpr("%e", c.zeroValue(t.Elem()))
+ default:
+ return c.formatExpr("$newDataPointer(%e, %s)", c.zeroValue(t.Elem()), c.typeName(t))
+ }
+ case "make":
+ switch argType := c.p.TypeOf(args[0]).Underlying().(type) {
+ case *types.Slice:
+ t := c.typeName(c.p.TypeOf(args[0]))
+ if len(args) == 3 {
+ return c.formatExpr("$makeSlice(%s, %f, %f)", t, args[1], args[2])
+ }
+ return c.formatExpr("$makeSlice(%s, %f)", t, args[1])
+ case *types.Map:
+ if len(args) == 2 && c.p.Types[args[1]].Value == nil {
+ return c.formatExpr(`((%1f < 0 || %1f > 2147483647) ? $throwRuntimeError("makemap: size out of range") : {})`, args[1])
+ }
+ return c.formatExpr("{}")
+ case *types.Chan:
+ length := "0"
+ if len(args) == 2 {
+ length = c.formatExpr("%f", args[1]).String()
+ }
+ return c.formatExpr("new $Chan(%s, %s)", c.typeName(c.p.TypeOf(args[0]).Underlying().(*types.Chan).Elem()), length)
+ default:
+ panic(fmt.Sprintf("Unhandled make type: %T\n", argType))
+ }
+ case "len":
+ switch argType := c.p.TypeOf(args[0]).Underlying().(type) {
+ case *types.Basic:
+ return c.formatExpr("%e.length", args[0])
+ case *types.Slice:
+ return c.formatExpr("%e.$length", args[0])
+ case *types.Pointer:
+ return c.formatExpr("(%e, %d)", args[0], argType.Elem().(*types.Array).Len())
+ case *types.Map:
+ return c.formatExpr("$keys(%e).length", args[0])
+ case *types.Chan:
+ return c.formatExpr("%e.$buffer.length", args[0])
+ // length of array is constant
+ default:
+ panic(fmt.Sprintf("Unhandled len type: %T\n", argType))
+ }
+ case "cap":
+ switch argType := c.p.TypeOf(args[0]).Underlying().(type) {
+ case *types.Slice, *types.Chan:
+ return c.formatExpr("%e.$capacity", args[0])
+ case *types.Pointer:
+ return c.formatExpr("(%e, %d)", args[0], argType.Elem().(*types.Array).Len())
+ // capacity of array is constant
+ default:
+ panic(fmt.Sprintf("Unhandled cap type: %T\n", argType))
+ }
+ case "panic":
+ return c.formatExpr("$panic(%s)", c.translateImplicitConversion(args[0], types.NewInterface(nil, nil)))
+ case "append":
+ if ellipsis || len(args) == 1 {
+ argStr := c.translateArgs(sig, args, ellipsis)
+ return c.formatExpr("$appendSlice(%s, %s)", argStr[0], argStr[1])
+ }
+ sliceType := sig.Results().At(0).Type().Underlying().(*types.Slice)
+ return c.formatExpr("$append(%e, %s)", args[0], strings.Join(c.translateExprSlice(args[1:], sliceType.Elem()), ", "))
+ case "delete":
+ keyType := c.p.TypeOf(args[0]).Underlying().(*types.Map).Key()
+ return c.formatExpr(`delete %e[%s.keyFor(%s)]`, args[0], c.typeName(keyType), c.translateImplicitConversion(args[1], keyType))
+ case "copy":
+ if basic, isBasic := c.p.TypeOf(args[1]).Underlying().(*types.Basic); isBasic && isString(basic) {
+ return c.formatExpr("$copyString(%e, %e)", args[0], args[1])
+ }
+ return c.formatExpr("$copySlice(%e, %e)", args[0], args[1])
+ case "print", "println":
+ return c.formatExpr("console.log(%s)", strings.Join(c.translateExprSlice(args, nil), ", "))
+ case "complex":
+ argStr := c.translateArgs(sig, args, ellipsis)
+ return c.formatExpr("new %s(%s, %s)", c.typeName(sig.Results().At(0).Type()), argStr[0], argStr[1])
+ case "real":
+ return c.formatExpr("%e.$real", args[0])
+ case "imag":
+ return c.formatExpr("%e.$imag", args[0])
+ case "recover":
+ return c.formatExpr("$recover()")
+ case "close":
+ return c.formatExpr(`$close(%e)`, args[0])
+ default:
+ panic(fmt.Sprintf("Unhandled builtin: %s\n", name))
+ }
+}
+
+func (c *funcContext) identifierConstant(expr ast.Expr) (string, bool) {
+ val := c.p.Types[expr].Value
+ if val == nil {
+ return "", false
+ }
+ s := constant.StringVal(val)
+ if len(s) == 0 {
+ return "", false
+ }
+ for i, c := range s {
+ if !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (i > 0 && c >= '0' && c <= '9') || c == '_' || c == '$') {
+ return "", false
+ }
+ }
+ return s, true
+}
+
+func (c *funcContext) translateExprSlice(exprs []ast.Expr, desiredType types.Type) []string {
+ parts := make([]string, len(exprs))
+ for i, expr := range exprs {
+ parts[i] = c.translateImplicitConversion(expr, desiredType).String()
+ }
+ return parts
+}
+
+func (c *funcContext) translateConversion(expr ast.Expr, desiredType types.Type) *expression {
+ exprType := c.p.TypeOf(expr)
+ if types.Identical(exprType, desiredType) {
+ return c.translateExpr(expr)
+ }
+
+ if c.p.Pkg.Path() == "reflect" {
+ if call, isCall := expr.(*ast.CallExpr); isCall && types.Identical(c.p.TypeOf(call.Fun), types.Typ[types.UnsafePointer]) {
+ if ptr, isPtr := desiredType.(*types.Pointer); isPtr {
+ if named, isNamed := ptr.Elem().(*types.Named); isNamed {
+ switch named.Obj().Name() {
+ case "arrayType", "chanType", "funcType", "interfaceType", "mapType", "ptrType", "sliceType", "structType":
+ return c.formatExpr("%e.kindType", call.Args[0]) // unsafe conversion
+ default:
+ return c.translateExpr(expr)
+ }
+ }
+ }
+ }
+ }
+
+ switch t := desiredType.Underlying().(type) {
+ case *types.Basic:
+ switch {
+ case isInteger(t):
+ basicExprType := exprType.Underlying().(*types.Basic)
+ switch {
+ case is64Bit(t):
+ if !is64Bit(basicExprType) {
+ if basicExprType.Kind() == types.Uintptr { // this might be an Object returned from reflect.Value.Pointer()
+ return c.formatExpr("new %1s(0, %2e.constructor === Number ? %2e : 1)", c.typeName(desiredType), expr)
+ }
+ return c.formatExpr("new %s(0, %e)", c.typeName(desiredType), expr)
+ }
+ return c.formatExpr("new %1s(%2h, %2l)", c.typeName(desiredType), expr)
+ case is64Bit(basicExprType):
+ if !isUnsigned(t) && !isUnsigned(basicExprType) {
+ return c.fixNumber(c.formatParenExpr("%1l + ((%1h >> 31) * 4294967296)", expr), t)
+ }
+ return c.fixNumber(c.formatExpr("%s.$low", c.translateExpr(expr)), t)
+ case isFloat(basicExprType):
+ return c.formatParenExpr("%e >> 0", expr)
+ case types.Identical(exprType, types.Typ[types.UnsafePointer]):
+ return c.translateExpr(expr)
+ default:
+ return c.fixNumber(c.translateExpr(expr), t)
+ }
+ case isFloat(t):
+ if t.Kind() == types.Float32 && exprType.Underlying().(*types.Basic).Kind() == types.Float64 {
+ return c.formatExpr("$fround(%e)", expr)
+ }
+ return c.formatExpr("%f", expr)
+ case isComplex(t):
+ return c.formatExpr("new %1s(%2r, %2i)", c.typeName(desiredType), expr)
+ case isString(t):
+ value := c.translateExpr(expr)
+ switch et := exprType.Underlying().(type) {
+ case *types.Basic:
+ if is64Bit(et) {
+ value = c.formatExpr("%s.$low", value)
+ }
+ if isNumeric(et) {
+ return c.formatExpr("$encodeRune(%s)", value)
+ }
+ return value
+ case *types.Slice:
+ if types.Identical(et.Elem().Underlying(), types.Typ[types.Rune]) {
+ return c.formatExpr("$runesToString(%s)", value)
+ }
+ return c.formatExpr("$bytesToString(%s)", value)
+ default:
+ panic(fmt.Sprintf("Unhandled conversion: %v\n", et))
+ }
+ case t.Kind() == types.UnsafePointer:
+ if unary, isUnary := expr.(*ast.UnaryExpr); isUnary && unary.Op == token.AND {
+ if indexExpr, isIndexExpr := unary.X.(*ast.IndexExpr); isIndexExpr {
+ return c.formatExpr("$sliceToArray(%s)", c.translateConversionToSlice(indexExpr.X, types.NewSlice(types.Typ[types.Uint8])))
+ }
+ if ident, isIdent := unary.X.(*ast.Ident); isIdent && ident.Name == "_zero" {
+ return c.formatExpr("new Uint8Array(0)")
+ }
+ }
+ if ptr, isPtr := c.p.TypeOf(expr).(*types.Pointer); c.p.Pkg.Path() == "syscall" && isPtr {
+ if s, isStruct := ptr.Elem().Underlying().(*types.Struct); isStruct {
+ array := c.newVariable("_array")
+ target := c.newVariable("_struct")
+ c.Printf("%s = new Uint8Array(%d);", array, sizes32.Sizeof(s))
+ c.Delayed(func() {
+ c.Printf("%s = %s, %s;", target, c.translateExpr(expr), c.loadStruct(array, target, s))
+ })
+ return c.formatExpr("%s", array)
+ }
+ }
+ if call, ok := expr.(*ast.CallExpr); ok {
+ if id, ok := call.Fun.(*ast.Ident); ok && id.Name == "new" {
+ return c.formatExpr("new Uint8Array(%d)", int(sizes32.Sizeof(c.p.TypeOf(call.Args[0]))))
+ }
+ }
+ }
+
+ case *types.Slice:
+ switch et := exprType.Underlying().(type) {
+ case *types.Basic:
+ if isString(et) {
+ if types.Identical(t.Elem().Underlying(), types.Typ[types.Rune]) {
+ return c.formatExpr("new %s($stringToRunes(%e))", c.typeName(desiredType), expr)
+ }
+ return c.formatExpr("new %s($stringToBytes(%e))", c.typeName(desiredType), expr)
+ }
+ case *types.Array, *types.Pointer:
+ return c.formatExpr("new %s(%e)", c.typeName(desiredType), expr)
+ }
+
+ case *types.Pointer:
+ switch u := t.Elem().Underlying().(type) {
+ case *types.Array:
+ return c.translateExpr(expr)
+ case *types.Struct:
+ if c.p.Pkg.Path() == "syscall" && types.Identical(exprType, types.Typ[types.UnsafePointer]) {
+ array := c.newVariable("_array")
+ target := c.newVariable("_struct")
+ return c.formatExpr("(%s = %e, %s = %e, %s, %s)", array, expr, target, c.zeroValue(t.Elem()), c.loadStruct(array, target, u), target)
+ }
+ return c.formatExpr("$pointerOfStructConversion(%e, %s)", expr, c.typeName(t))
+ }
+
+ if !types.Identical(exprType, types.Typ[types.UnsafePointer]) {
+ exprTypeElem := exprType.Underlying().(*types.Pointer).Elem()
+ ptrVar := c.newVariable("_ptr")
+ getterConv := c.translateConversion(c.setType(&ast.StarExpr{X: c.newIdent(ptrVar, exprType)}, exprTypeElem), t.Elem())
+ setterConv := c.translateConversion(c.newIdent("$v", t.Elem()), exprTypeElem)
+ return c.formatExpr("(%1s = %2e, new %3s(function() { return %4s; }, function($v) { %1s.$set(%5s); }, %1s.$target))", ptrVar, expr, c.typeName(desiredType), getterConv, setterConv)
+ }
+
+ case *types.Interface:
+ if types.Identical(exprType, types.Typ[types.UnsafePointer]) {
+ return c.translateExpr(expr)
+ }
+ }
+
+ return c.translateImplicitConversionWithCloning(expr, desiredType)
+}
+
+func (c *funcContext) translateImplicitConversionWithCloning(expr ast.Expr, desiredType types.Type) *expression {
+ switch desiredType.Underlying().(type) {
+ case *types.Struct, *types.Array:
+ switch expr.(type) {
+ case nil, *ast.CompositeLit:
+ // nothing
+ default:
+ return c.formatExpr("$clone(%e, %s)", expr, c.typeName(desiredType))
+ }
+ }
+
+ return c.translateImplicitConversion(expr, desiredType)
+}
+
+func (c *funcContext) translateImplicitConversion(expr ast.Expr, desiredType types.Type) *expression {
+ if desiredType == nil {
+ return c.translateExpr(expr)
+ }
+
+ exprType := c.p.TypeOf(expr)
+ if types.Identical(exprType, desiredType) {
+ return c.translateExpr(expr)
+ }
+
+ basicExprType, isBasicExpr := exprType.Underlying().(*types.Basic)
+ if isBasicExpr && basicExprType.Kind() == types.UntypedNil {
+ return c.formatExpr("%e", c.zeroValue(desiredType))
+ }
+
+ switch desiredType.Underlying().(type) {
+ case *types.Slice:
+ return c.formatExpr("$subslice(new %1s(%2e.$array), %2e.$offset, %2e.$offset + %2e.$length)", c.typeName(desiredType), expr)
+
+ case *types.Interface:
+ if typesutil.IsJsObject(exprType) {
+ // wrap JS object into js.Object struct when converting to interface
+ return c.formatExpr("new $jsObjectPtr(%e)", expr)
+ }
+ if isWrapped(exprType) {
+ return c.formatExpr("new %s(%e)", c.typeName(exprType), expr)
+ }
+ if _, isStruct := exprType.Underlying().(*types.Struct); isStruct {
+ return c.formatExpr("new %1e.constructor.elem(%1e)", expr)
+ }
+ }
+
+ return c.translateExpr(expr)
+}
+
+func (c *funcContext) translateConversionToSlice(expr ast.Expr, desiredType types.Type) *expression {
+ switch c.p.TypeOf(expr).Underlying().(type) {
+ case *types.Array, *types.Pointer:
+ return c.formatExpr("new %s(%e)", c.typeName(desiredType), expr)
+ }
+ return c.translateExpr(expr)
+}
+
+func (c *funcContext) loadStruct(array, target string, s *types.Struct) string {
+ view := c.newVariable("_view")
+ code := fmt.Sprintf("%s = new DataView(%s.buffer, %s.byteOffset)", view, array, array)
+ var fields []*types.Var
+ var collectFields func(s *types.Struct, path string)
+ collectFields = func(s *types.Struct, path string) {
+ for i := 0; i < s.NumFields(); i++ {
+ field := s.Field(i)
+ if fs, isStruct := field.Type().Underlying().(*types.Struct); isStruct {
+ collectFields(fs, path+"."+fieldName(s, i))
+ continue
+ }
+ fields = append(fields, types.NewVar(0, nil, path+"."+fieldName(s, i), field.Type()))
+ }
+ }
+ collectFields(s, target)
+ offsets := sizes32.Offsetsof(fields)
+ for i, field := range fields {
+ switch t := field.Type().Underlying().(type) {
+ case *types.Basic:
+ if isNumeric(t) {
+ if is64Bit(t) {
+ code += fmt.Sprintf(", %s = new %s(%s.getUint32(%d, true), %s.getUint32(%d, true))", field.Name(), c.typeName(field.Type()), view, offsets[i]+4, view, offsets[i])
+ break
+ }
+ code += fmt.Sprintf(", %s = %s.get%s(%d, true)", field.Name(), view, toJavaScriptType(t), offsets[i])
+ }
+ case *types.Array:
+ code += fmt.Sprintf(`, %s = new ($nativeArray(%s))(%s.buffer, $min(%s.byteOffset + %d, %s.buffer.byteLength))`, field.Name(), typeKind(t.Elem()), array, array, offsets[i], array)
+ }
+ }
+ return code
+}
+
+func (c *funcContext) fixNumber(value *expression, basic *types.Basic) *expression {
+ switch basic.Kind() {
+ case types.Int8:
+ return c.formatParenExpr("%s << 24 >> 24", value)
+ case types.Uint8:
+ return c.formatParenExpr("%s << 24 >>> 24", value)
+ case types.Int16:
+ return c.formatParenExpr("%s << 16 >> 16", value)
+ case types.Uint16:
+ return c.formatParenExpr("%s << 16 >>> 16", value)
+ case types.Int32, types.Int, types.UntypedInt:
+ return c.formatParenExpr("%s >> 0", value)
+ case types.Uint32, types.Uint, types.Uintptr:
+ return c.formatParenExpr("%s >>> 0", value)
+ case types.Float32:
+ return c.formatExpr("$fround(%s)", value)
+ case types.Float64:
+ return value
+ default:
+ panic(fmt.Sprintf("fixNumber: unhandled basic.Kind(): %s", basic.String()))
+ }
+}
+
+func (c *funcContext) internalize(s *expression, t types.Type) *expression {
+ if typesutil.IsJsObject(t) {
+ return s
+ }
+ switch u := t.Underlying().(type) {
+ case *types.Basic:
+ switch {
+ case isBoolean(u):
+ return c.formatExpr("!!(%s)", s)
+ case isInteger(u) && !is64Bit(u):
+ return c.fixNumber(c.formatExpr("$parseInt(%s)", s), u)
+ case isFloat(u):
+ return c.formatExpr("$parseFloat(%s)", s)
+ }
+ }
+ return c.formatExpr("$internalize(%s, %s)", s, c.typeName(t))
+}
+
+func (c *funcContext) formatExpr(format string, a ...interface{}) *expression {
+ return c.formatExprInternal(format, a, false)
+}
+
+func (c *funcContext) formatParenExpr(format string, a ...interface{}) *expression {
+ return c.formatExprInternal(format, a, true)
+}
+
+func (c *funcContext) formatExprInternal(format string, a []interface{}, parens bool) *expression {
+ processFormat := func(f func(uint8, uint8, int)) {
+ n := 0
+ for i := 0; i < len(format); i++ {
+ b := format[i]
+ if b == '%' {
+ i++
+ k := format[i]
+ if k >= '0' && k <= '9' {
+ n = int(k - '0' - 1)
+ i++
+ k = format[i]
+ }
+ f(0, k, n)
+ n++
+ continue
+ }
+ f(b, 0, 0)
+ }
+ }
+
+ counts := make([]int, len(a))
+ processFormat(func(b, k uint8, n int) {
+ switch k {
+ case 'e', 'f', 'h', 'l', 'r', 'i':
+ counts[n]++
+ }
+ })
+
+ out := bytes.NewBuffer(nil)
+ vars := make([]string, len(a))
+ hasAssignments := false
+ for i, e := range a {
+ if counts[i] <= 1 {
+ continue
+ }
+ if _, isIdent := e.(*ast.Ident); isIdent {
+ continue
+ }
+ if val := c.p.Types[e.(ast.Expr)].Value; val != nil {
+ continue
+ }
+ if !hasAssignments {
+ hasAssignments = true
+ out.WriteByte('(')
+ parens = false
+ }
+ v := c.newVariable("x")
+ out.WriteString(v + " = " + c.translateExpr(e.(ast.Expr)).String() + ", ")
+ vars[i] = v
+ }
+
+ processFormat(func(b, k uint8, n int) {
+ writeExpr := func(suffix string) {
+ if vars[n] != "" {
+ out.WriteString(vars[n] + suffix)
+ return
+ }
+ out.WriteString(c.translateExpr(a[n].(ast.Expr)).StringWithParens() + suffix)
+ }
+ switch k {
+ case 0:
+ out.WriteByte(b)
+ case 's':
+ if e, ok := a[n].(*expression); ok {
+ out.WriteString(e.StringWithParens())
+ return
+ }
+ out.WriteString(a[n].(string))
+ case 'd':
+ out.WriteString(strconv.Itoa(a[n].(int)))
+ case 't':
+ out.WriteString(a[n].(token.Token).String())
+ case 'e':
+ e := a[n].(ast.Expr)
+ if val := c.p.Types[e].Value; val != nil {
+ out.WriteString(c.translateExpr(e).String())
+ return
+ }
+ writeExpr("")
+ case 'f':
+ e := a[n].(ast.Expr)
+ if val := c.p.Types[e].Value; val != nil {
+ d, _ := constant.Int64Val(constant.ToInt(val))
+ out.WriteString(strconv.FormatInt(d, 10))
+ return
+ }
+ if is64Bit(c.p.TypeOf(e).Underlying().(*types.Basic)) {
+ out.WriteString("$flatten64(")
+ writeExpr("")
+ out.WriteString(")")
+ return
+ }
+ writeExpr("")
+ case 'h':
+ e := a[n].(ast.Expr)
+ if val := c.p.Types[e].Value; val != nil {
+ d, _ := constant.Uint64Val(constant.ToInt(val))
+ if c.p.TypeOf(e).Underlying().(*types.Basic).Kind() == types.Int64 {
+ out.WriteString(strconv.FormatInt(int64(d)>>32, 10))
+ return
+ }
+ out.WriteString(strconv.FormatUint(d>>32, 10))
+ return
+ }
+ writeExpr(".$high")
+ case 'l':
+ if val := c.p.Types[a[n].(ast.Expr)].Value; val != nil {
+ d, _ := constant.Uint64Val(constant.ToInt(val))
+ out.WriteString(strconv.FormatUint(d&(1<<32-1), 10))
+ return
+ }
+ writeExpr(".$low")
+ case 'r':
+ if val := c.p.Types[a[n].(ast.Expr)].Value; val != nil {
+ r, _ := constant.Float64Val(constant.Real(val))
+ out.WriteString(strconv.FormatFloat(r, 'g', -1, 64))
+ return
+ }
+ writeExpr(".$real")
+ case 'i':
+ if val := c.p.Types[a[n].(ast.Expr)].Value; val != nil {
+ i, _ := constant.Float64Val(constant.Imag(val))
+ out.WriteString(strconv.FormatFloat(i, 'g', -1, 64))
+ return
+ }
+ writeExpr(".$imag")
+ case '%':
+ out.WriteRune('%')
+ default:
+ panic(fmt.Sprintf("formatExpr: %%%c%d", k, n))
+ }
+ })
+
+ if hasAssignments {
+ out.WriteByte(')')
+ }
+ return &expression{str: out.String(), parens: parens}
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/assign.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/assign.go
new file mode 100644
index 00000000000..2681d4c6ac3
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/assign.go
@@ -0,0 +1,106 @@
+package filter
+
+import (
+ "go/ast"
+ "go/token"
+ "go/types"
+
+ "github.com/gopherjs/gopherjs/compiler/astutil"
+)
+
+func Assign(stmt ast.Stmt, info *types.Info, pkg *types.Package) ast.Stmt {
+ if s, ok := stmt.(*ast.AssignStmt); ok && s.Tok != token.ASSIGN && s.Tok != token.DEFINE {
+ var op token.Token
+ switch s.Tok {
+ case token.ADD_ASSIGN:
+ op = token.ADD
+ case token.SUB_ASSIGN:
+ op = token.SUB
+ case token.MUL_ASSIGN:
+ op = token.MUL
+ case token.QUO_ASSIGN:
+ op = token.QUO
+ case token.REM_ASSIGN:
+ op = token.REM
+ case token.AND_ASSIGN:
+ op = token.AND
+ case token.OR_ASSIGN:
+ op = token.OR
+ case token.XOR_ASSIGN:
+ op = token.XOR
+ case token.SHL_ASSIGN:
+ op = token.SHL
+ case token.SHR_ASSIGN:
+ op = token.SHR
+ case token.AND_NOT_ASSIGN:
+ op = token.AND_NOT
+ default:
+ panic(s.Tok)
+ }
+
+ var list []ast.Stmt
+
+ var viaTmpVars func(expr ast.Expr, name string) ast.Expr
+ viaTmpVars = func(expr ast.Expr, name string) ast.Expr {
+ switch e := astutil.RemoveParens(expr).(type) {
+ case *ast.IndexExpr:
+ return astutil.SetType(info, info.TypeOf(e), &ast.IndexExpr{
+ X: viaTmpVars(e.X, "_slice"),
+ Index: viaTmpVars(e.Index, "_index"),
+ })
+
+ case *ast.SelectorExpr:
+ sel, ok := info.Selections[e]
+ if !ok {
+ // qualified identifier
+ return e
+ }
+ newSel := &ast.SelectorExpr{
+ X: viaTmpVars(e.X, "_struct"),
+ Sel: e.Sel,
+ }
+ info.Selections[newSel] = sel
+ return astutil.SetType(info, info.TypeOf(e), newSel)
+
+ case *ast.StarExpr:
+ return astutil.SetType(info, info.TypeOf(e), &ast.StarExpr{
+ X: viaTmpVars(e.X, "_ptr"),
+ })
+
+ case *ast.Ident, *ast.BasicLit:
+ return e
+
+ default:
+ tmpVar := astutil.NewIdent(name, info.TypeOf(e), info, pkg)
+ list = append(list, &ast.AssignStmt{
+ Lhs: []ast.Expr{tmpVar},
+ Tok: token.DEFINE,
+ Rhs: []ast.Expr{e},
+ })
+ return tmpVar
+
+ }
+ }
+
+ lhs := viaTmpVars(s.Lhs[0], "_val")
+
+ list = append(list, &ast.AssignStmt{
+ Lhs: []ast.Expr{lhs},
+ Tok: token.ASSIGN,
+ Rhs: []ast.Expr{
+ astutil.SetType(info, info.TypeOf(s.Lhs[0]), &ast.BinaryExpr{
+ X: lhs,
+ Op: op,
+ Y: astutil.SetType(info, info.TypeOf(s.Rhs[0]), &ast.ParenExpr{
+ X: s.Rhs[0],
+ }),
+ }),
+ },
+ })
+
+ return &ast.BlockStmt{
+ List: list,
+ }
+ }
+ return stmt
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/incdecstmt.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/incdecstmt.go
new file mode 100644
index 00000000000..c4899ba1de7
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/filter/incdecstmt.go
@@ -0,0 +1,39 @@
+package filter
+
+import (
+ "go/ast"
+ "go/constant"
+ "go/token"
+ "go/types"
+)
+
+func IncDecStmt(stmt ast.Stmt, info *types.Info) ast.Stmt {
+ if s, ok := stmt.(*ast.IncDecStmt); ok {
+ t := info.TypeOf(s.X)
+ if iExpr, isIExpr := s.X.(*ast.IndexExpr); isIExpr {
+ switch u := info.TypeOf(iExpr.X).Underlying().(type) {
+ case *types.Array:
+ t = u.Elem()
+ case *types.Slice:
+ t = u.Elem()
+ case *types.Map:
+ t = u.Elem()
+ }
+ }
+
+ tok := token.ADD_ASSIGN
+ if s.Tok == token.DEC {
+ tok = token.SUB_ASSIGN
+ }
+
+ one := &ast.BasicLit{Kind: token.INT}
+ info.Types[one] = types.TypeAndValue{Type: t, Value: constant.MakeInt64(1)}
+
+ return &ast.AssignStmt{
+ Lhs: []ast.Expr{s.X},
+ Tok: tok,
+ Rhs: []ast.Expr{one},
+ }
+ }
+ return stmt
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/doc.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/doc.go
new file mode 100644
index 00000000000..f57e84f74d4
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/doc.go
@@ -0,0 +1,12 @@
+// Package gopherjspkg provides core GopherJS packages via a virtual filesystem.
+//
+// Core GopherJS packages are packages that are critical for GopherJS compiler
+// operation. They are needed to build the Go standard library with GopherJS.
+// Currently, they include:
+//
+// github.com/gopherjs/gopherjs/js
+// github.com/gopherjs/gopherjs/nosync
+//
+package gopherjspkg
+
+//go:generate vfsgendev -source="github.com/gopherjs/gopherjs/compiler/gopherjspkg".FS -tag=gopherjsdev
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs.go
new file mode 100644
index 00000000000..f6fb2622db0
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs.go
@@ -0,0 +1,31 @@
+// +build gopherjsdev
+
+package gopherjspkg
+
+import (
+ "go/build"
+ "log"
+ "net/http"
+ "os"
+ pathpkg "path"
+
+ "github.com/shurcooL/httpfs/filter"
+)
+
+// FS is a virtual filesystem that contains core GopherJS packages.
+var FS = filter.Keep(
+ http.Dir(importPathToDir("github.com/gopherjs/gopherjs")),
+ func(path string, fi os.FileInfo) bool {
+ return path == "/" ||
+ path == "/js" || (pathpkg.Dir(path) == "/js" && !fi.IsDir()) ||
+ path == "/nosync" || (pathpkg.Dir(path) == "/nosync" && !fi.IsDir())
+ },
+)
+
+func importPathToDir(importPath string) string {
+ p, err := build.Import(importPath, "", build.FindOnly)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ return p.Dir
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs_vfsdata.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs_vfsdata.go
new file mode 100644
index 00000000000..6d0e63c7f5c
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/gopherjspkg/fs_vfsdata.go
@@ -0,0 +1,232 @@
+// Code generated by vfsgen; DO NOT EDIT.
+
+// +build !gopherjsdev
+
+package gopherjspkg
+
+import (
+ "bytes"
+ "compress/gzip"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "os"
+ pathpkg "path"
+ "time"
+)
+
+// FS is a virtual filesystem that contains core GopherJS packages.
+var FS = func() http.FileSystem {
+ fs := vfsgen۰FS{
+ "/": &vfsgen۰DirInfo{
+ name: "/",
+ modTime: time.Date(2018, 8, 25, 20, 19, 15, 877321084, time.UTC),
+ },
+ "/js": &vfsgen۰DirInfo{
+ name: "js",
+ modTime: time.Date(2018, 4, 22, 1, 21, 6, 233507855, time.UTC),
+ },
+ "/js/js.go": &vfsgen۰CompressedFileInfo{
+ name: "js.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 8002,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x59\x5f\x6f\xdc\x36\x12\x7f\x5e\x7d\x8a\x39\xa1\x40\x56\xcd\x56\xbe\xb6\x86\x51\x38\xe7\x87\xa4\xb9\xfa\xdc\x4b\xdc\x00\x6e\xd0\x07\x23\x30\xb8\xd2\x68\x97\xb1\x44\xea\x48\x6a\x37\x7b\xb6\xbf\xfb\x61\xf8\x47\x2b\xad\xa4\xc4\xbe\x24\x2f\x75\xc5\xe1\x6f\x7e\x9c\x19\xce\x1f\xee\xd1\x11\xbc\x63\xd9\x2d\x5b\x21\x7c\xd4\x50\x2b\xb9\xe1\x39\x6a\x28\x1a\x91\x19\x2e\x85\x86\x42\x2a\xe0\xc2\xa0\x62\x99\xe1\x62\x05\x5b\x6e\xd6\x20\x98\xe1\x1b\x84\xdf\xd9\x86\x5d\x65\x8a\xd7\x06\x5e\xbe\xbb\xd0\x29\xfc\xca\xca\x52\x83\x91\x60\xd6\xa8\xb1\x83\xc2\x14\x82\x51\xc8\x0c\xe6\xa0\x6b\xcc\x38\x2b\xcb\x1d\x2c\x77\x70\x2e\xeb\x35\xaa\xdf\xaf\x80\x89\x1c\x8c\x62\x42\x97\x56\x28\xe7\x0a\x33\x53\xee\x3c\x18\x57\x90\x49\xa5\x50\xd7\x52\xe4\x44\xa3\xa3\x5a\xef\x84\x61\x9f\xd2\xe8\xe8\x28\x3a\x3a\x82\xf7\x1a\xe1\x2d\xbb\xc5\xbf\x14\xab\x6b\x54\xb4\x1f\x3f\xd5\x52\x23\x54\x68\xd6\x32\xb7\xf4\xf6\xbb\x53\xf8\x6b\x8d\x02\x6a\xa6\x35\xc1\x6e\x58\xd9\xa0\x6e\xb5\x2f\x48\x37\x14\xb2\x2c\xe5\x96\x96\xcd\xae\x46\xc8\xa4\xd8\xa0\xd2\xed\xb9\x6a\x54\x85\x54\x15\xe6\xa7\x9e\x02\xdc\xc3\xb9\x74\xb2\xfd\x7f\xf7\x5d\xda\x9d\xf5\x7b\xf8\xb5\x83\xb9\x64\xd9\x2d\x91\xb4\x56\x2f\x58\x86\x77\x0f\x70\xef\x71\x7f\x18\xfb\xf7\xd4\xef\x5d\x09\x8f\xbb\x94\xb2\x84\xc1\xbf\x7b\x78\x25\x65\x89\x4c\x0c\xbe\x8f\xcb\x77\x24\x3c\x2e\x9d\x61\x85\x4a\x5b\xf7\x16\xa5\x64\x46\xdb\xfd\x97\x4d\xb5\x44\x35\xd4\x67\x45\x4e\x8e\xbf\x88\xab\x8d\x22\x7f\x0c\xf6\x5f\x4d\x7c\x1f\x97\x1f\xe2\x5e\x7f\xe0\xc2\xfc\x32\xdc\x7f\x21\xcc\x2f\x2f\x95\x62\xbb\x83\xef\xe3\xf2\x13\xb8\x3f\x9e\x8c\xe1\xfe\x78\x32\x00\x9e\x92\x9f\xc0\xfd\xf9\xa7\x85\xfb\xa3\x87\xfb\xf3\x4f\x53\xb8\xd3\x74\x3b\xb8\xcd\xc8\xc1\xee\xe1\x3d\x1f\x33\xc4\x94\xfc\x14\xee\xe1\xc1\x1c\xee\xd0\x10\x53\xf2\x53\xb8\xce\x10\x4d\x7b\x44\x87\x3b\x34\xc4\x7d\x4f\xea\xf3\xb8\x36\x22\x7f\xfe\xe9\x80\xef\x6f\xee\xeb\x01\xf0\x94\xfc\x24\xee\x41\xa4\x7b\xdc\x93\xe3\x29\xdc\xc9\x9b\x11\x70\x59\x59\x82\x34\x6b\x54\xa0\x4b\x9e\xa1\x0e\xfb\x87\xb1\x0b\xfb\x78\x68\xb3\xcc\x67\x70\x69\xbf\x1e\xee\xd7\x88\x4e\x53\x2f\xdd\x4d\x7d\x1f\xe2\xee\x2b\xc4\x81\x1d\xfc\xf7\x43\x7d\x24\x3f\x4f\xd3\xb4\xc3\x3a\x81\xef\x3f\xea\xf4\x8f\xe5\x47\xcc\x4c\x8b\x6b\x78\x85\xe9\x9f\xbc\xc2\x83\xfd\xaf\x99\x19\x63\x33\x21\x3f\xe4\xfb\xc3\xf8\x2a\x70\xa1\x0d\x13\x19\xca\x02\x2e\x65\xbe\xcf\xeb\x1d\x6a\x9f\xc5\xad\x58\xad\x17\x94\xa5\x9a\xcc\xe8\x71\xdc\x0e\x8c\x95\xbf\x76\x39\x6d\xdc\x81\xf7\xbe\x14\xbd\xcc\x73\x4e\x76\xa4\x72\xbb\xb0\xb5\x9c\x79\x2d\x54\xc6\x0c\xe3\x82\xd2\x22\xeb\xf2\x2c\x38\x96\xf9\x02\xa4\xa0\xe2\xbb\xb6\xe5\xce\xa0\x30\x20\x0b\x57\x0c\x69\x19\xb6\xbc\x2c\x61\x89\xb6\x6e\x62\xde\x2f\xa9\x36\xd7\x6f\xc8\xf7\x54\xd2\x58\x1a\xd5\x6d\x83\x11\x11\x27\xaf\x87\x6b\x60\x81\x04\x2a\xcf\x6d\xd8\x58\x48\x2b\xdd\x69\x2d\xb8\xd1\x6d\x29\xff\x06\x6d\xc5\xb0\x91\x80\x97\x20\x78\x09\xb5\xb4\x96\x25\xc9\x3d\x63\xfc\x4f\xc3\xca\xfe\x71\x9f\x69\x88\x45\x53\x96\x71\x1a\xe4\x32\x26\x40\x48\x43\xf6\x69\xc8\x3a\x8c\x4e\x5a\xb1\x1a\x6e\x71\x97\x46\xf6\x42\x78\x49\xe7\x8a\x3b\x7f\x48\xf8\xde\x7f\x7e\xb0\x76\x3a\x47\x03\x0a\x4d\xa3\x84\xb6\x96\x77\x42\xcf\x6c\x97\x56\xa3\x32\x3b\xd7\x8b\xd1\xd2\x8a\x6f\x50\x38\x78\xba\x21\x30\x97\x01\x2b\x21\x98\xf9\x2d\xee\x7c\x09\x4c\x5a\x25\x77\x1e\x1c\x64\xea\x6d\xec\x25\x13\xaf\xff\x0a\x0d\x50\x5b\xb4\xf2\xfa\x6d\x6f\xe4\x0d\xf7\xff\x92\xb9\xea\x91\x59\x78\xcc\xde\x6d\xbe\xdb\x13\xf2\xd2\x5e\x2c\xf0\x7a\x8d\x25\x1a\x04\x85\x95\xdc\xe0\x57\x99\xc6\x21\xf5\xac\xd3\xd1\xbe\x5f\x0d\x9a\xdf\xa0\x58\x99\xf5\xb8\x53\xe2\xd2\x2e\xc6\x2d\x85\x85\x6f\x14\x8d\xbb\x1f\x5c\x98\x11\x06\x0e\x71\x9e\xd0\xf2\x88\x47\xda\x65\xa7\xff\x42\xe4\xf8\xa9\xa7\x9e\x3f\x33\x6b\xc0\x12\x2b\x7f\x43\x99\x70\xa9\x7a\x44\x95\xdd\x3c\xe7\xa4\xe9\x73\x41\xe0\xc5\x3a\x41\xe0\xb4\x6a\x34\x4f\x56\x19\x36\x3b\xad\x8f\xf0\xb6\x97\x3e\x70\x38\x5d\x7d\xc8\xdc\xfd\xef\x9a\xdc\x65\x81\x43\x57\x0b\x56\xe1\x08\x17\x02\x99\xd3\x5a\x1b\x7b\x4c\xad\x34\x0c\x6a\xc9\xa4\x61\x5a\x00\xb7\x33\x4d\xd3\xbd\x5b\x36\xf2\x16\x07\x0c\x29\x53\x61\x59\xa4\xf0\xe7\x9a\x6b\x97\x31\x0b\xc6\x4b\xe0\x05\x70\x9b\x4c\x28\x47\xb0\xb6\x04\x8e\xba\x8c\x80\xe7\x4f\x24\xda\xd9\xd5\x21\x79\x89\x5b\xc8\x6c\xaa\xa4\x6c\x24\x70\xdb\xd6\x16\x97\xd9\xb9\x76\xa5\x3a\xe4\xdb\x51\xd2\x7d\xc6\x30\xcf\xa4\x70\x29\x4c\xaa\x64\x84\xff\x25\x6e\x9f\x4a\x3e\x6c\xe9\x30\xa7\x19\x64\xe4\xce\xf5\xaf\x97\x1d\x48\x58\x96\x49\x65\xc7\xc3\x7e\x41\x3a\x1c\xdb\x46\xa8\x92\x92\x79\xe2\x60\x86\xac\xfc\xaa\xbf\x12\x6e\x96\xf8\x12\x23\x3f\x72\x7c\x05\x27\xa7\x68\x9e\x04\xa8\x21\xaf\x56\x22\x04\xe2\x58\xc5\x18\xe4\xa1\x47\x73\x82\x79\xcd\x94\xc6\x0b\x61\xc6\xbc\x7b\x21\xcc\x64\xe2\x72\x6b\x2d\xab\x93\xe3\xc7\xf0\x3a\x39\xfe\x76\xcc\x4e\x8e\x1d\xb7\x93\xe3\x71\x76\x76\xdd\xf1\x7b\xcf\x1f\x45\xb0\xf9\x96\x0c\x9d\xce\x79\x12\x50\x87\x1c\x5b\x09\x47\xd2\x0e\x06\x5f\xe4\x18\x86\x84\x27\x92\xb4\xe0\x63\x34\xed\xc2\x3c\x69\x71\x87\x34\x83\x44\xeb\x6a\x77\xc9\x1f\xe3\xee\x90\x0e\x52\xb8\x42\x04\xc3\x96\x25\xd5\x06\x08\xdd\x62\x26\x2b\x5b\x62\xa8\x31\xcc\xd1\x30\x5e\x8e\xdd\x91\x56\xa3\x73\x77\xdb\x09\x8f\x3a\xbd\x95\xf4\x8e\x17\x9a\x15\xa3\x54\xa9\x63\x13\xd6\x37\xb5\x51\x0b\xd8\xae\x79\xb6\xb6\x6d\xdd\x12\x3b\xc7\xd8\x70\x06\x8d\xc5\x48\xdf\xb9\x66\x31\x85\x4b\x69\x2c\x0f\x91\x63\x6e\xa9\xd7\xcd\xb2\xe4\x19\x35\x82\x63\x61\x60\x77\xfb\x30\xa8\x8d\x1a\x8b\x83\x20\xe2\x38\xff\x53\x29\xa9\x00\x45\xc6\x6a\xdd\x94\x36\x9b\x77\xfc\x8b\xb4\xaa\x29\x79\x4b\x8d\xae\x3b\x6e\x94\xc0\x9c\x28\x49\x60\x70\x2e\xa1\x66\x82\x67\xb6\x2d\xae\xd8\x8e\xce\xa3\x30\x93\x1b\x54\x98\x2f\xa8\x80\xda\x94\x25\xe0\x7b\xa7\xc7\xac\x99\x81\xb5\x2c\x73\x67\x9d\x43\x4d\xa1\x58\xb8\x9e\xd6\x6d\xf1\xd3\xc5\x5d\x34\xf3\xa7\x8c\xba\xc4\xbb\xb6\xae\x50\x6b\x72\xb4\x1f\x2c\x3a\x67\xca\xa7\x35\x39\x13\xa2\x52\x9e\x62\xe2\x80\x3b\x49\x32\x9a\x79\x13\xc6\x87\x20\xa7\x10\xc3\x73\xfa\xd3\x76\xba\xb1\xd7\x1f\x27\x6d\x1a\x8d\x42\x82\x67\xd9\x6d\x8f\xaa\xb6\x5f\xda\xe6\xf2\x2b\x19\x5b\xfc\x31\xc6\x2d\x35\xab\x6f\x48\xec\xbc\x94\x4b\x56\xda\x3e\x47\xf7\x27\x90\x95\x5b\xf1\xe1\x3b\x8f\xb7\x5c\xe4\x72\x1b\xdb\x08\x5c\x2a\xb9\xd5\xe1\x0d\x2e\x3e\x7f\xf3\xc7\xab\x97\x6f\xdc\x0a\x8d\xaa\xe9\x47\x9d\xa4\xd1\x86\xa9\x80\x1e\xdc\x46\x0a\xdf\xca\xbc\x29\xd1\x2b\xdc\xcf\x00\xfe\xfc\x71\x65\x97\x63\xd8\x30\xc5\xed\xf5\xd5\x68\x68\xfa\xf2\xb8\x29\xfc\x8b\x0b\x73\xea\x06\x09\x70\xc2\xf6\x31\x56\x19\xd7\xb4\x3d\xfb\xa8\x53\xa7\xc2\x1d\xdb\xad\x69\x3a\xf8\xfe\x7f\x2f\x59\x85\xf1\x82\x5a\x88\xe4\x99\x23\xea\x59\x75\x89\xbe\x17\x39\x16\x9c\x22\x7d\xcf\xb5\xe3\x11\x47\x3b\x6e\x82\x54\xec\x80\xf6\xbb\xba\x58\xaf\x71\xd9\xac\x56\xa8\x60\x45\x2d\x6f\x26\xab\x9a\x97\x87\x33\x2e\x35\xfc\xb9\x97\x7b\x11\x53\x7c\x18\xdb\x10\x7b\x77\x07\x88\x79\x02\x77\x9d\xcc\x28\x58\xe9\x1b\x9f\x5e\x0f\xef\x97\x86\x53\xaf\xbb\x7f\x0a\x6b\x85\x1a\x85\xd1\xc0\x1f\x93\x60\xfa\xaa\x5c\xef\x3d\xd2\x7a\xb5\x51\x27\x78\xe9\xe3\xeb\x2d\xbb\xc5\xdf\x08\x62\xab\x58\xad\xbb\x9d\x1e\x85\x8e\xb3\x2c\xcb\x32\xd4\xe1\x8d\x3f\xbc\x97\xcb\xe2\xc0\x36\xd4\x4f\xc6\x2e\xe0\x98\x5a\x35\x64\x1a\x1d\xd3\x14\xb6\x95\x2a\x0f\x79\x3c\xa8\x9b\x17\xc2\x3d\xec\xd8\x2e\xd4\x13\xb4\x5d\xb6\xdb\x08\xd7\x1f\xda\x8c\xf9\x85\xb3\xb8\x18\x76\xbd\x7a\xfc\x5d\xe5\x15\xc4\x8b\x43\xa3\x14\x22\x09\x97\xea\xdf\xb8\xd3\x3d\x7f\xdc\xd2\x07\x1f\xe2\x6e\xa4\x18\x3e\x47\xb8\x03\xd0\xd6\x6e\x3a\xbf\xfe\xb0\xbf\xd2\xbc\x00\x09\x67\x67\xf6\x29\xe1\xfe\xde\xfd\xbd\x8f\xb7\xbb\x68\xd6\x35\xff\xec\x21\x9a\x31\x38\x3d\x0b\xfc\xed\x6d\x70\xa8\x71\xe2\x4f\x43\xb4\xe2\x05\xc8\x24\x9a\x69\x12\xa5\xc3\xcd\x83\xc6\x05\xb0\x76\x58\x4c\xa2\x99\xfd\xd1\x86\x84\xfe\xfe\x02\x38\xfc\xa3\xb3\xf8\x02\xf8\xf3\xe7\x56\xbd\xbe\xe6\x1f\xe0\x0c\x58\x3b\xf1\xed\xb3\x0d\xd1\xf1\xec\x74\x27\x34\xc2\x4f\x2a\xfb\x31\x62\x18\xb1\xae\x54\xae\x99\xb6\x31\x54\x53\xda\x29\x6c\x21\x09\x37\x1f\xf3\xf6\xf5\x46\x16\x14\xd0\xef\xb5\x5d\x2a\x79\xc6\x0d\x5d\x39\x83\xca\x06\x8e\x76\x7f\x76\x7e\xb5\xf1\xbf\xe3\xf8\x0a\x63\x1f\xa2\x0e\x7f\xcd\xd9\x07\x96\x27\xfb\x99\xf0\xdf\x90\x81\x0e\x2f\x4b\x12\xcd\xe4\xa4\x23\x68\x38\x21\x01\x97\x9e\x6e\x6e\xc2\xcd\xbd\x71\x87\xbf\xb9\x89\x17\xb0\x49\xa2\x59\xe0\x7c\x7a\x06\x1b\x07\xd1\x19\x94\xe2\x24\x94\x1f\x2b\x14\x8f\xb8\xcb\x2f\x8d\x38\xad\xb2\x9e\xf7\xcb\xc1\x71\xd1\x8c\xa2\xad\x72\xb0\xf5\xed\xaa\x53\x38\xe0\x6f\x67\x10\xc7\x70\x07\x47\x47\x76\x78\x0b\x3e\x88\x66\xb3\x59\x26\x85\xe1\xa2\xc1\x68\x46\xfe\xf6\xa7\xf2\x28\x34\xe7\x76\x60\x16\xee\x7e\x86\x59\xae\x0d\xf8\x8e\x35\x67\xe3\x57\x10\x3f\x39\x13\xf1\xff\x62\x78\xd3\x25\x23\x59\x2d\x81\xb1\x92\x75\x47\x57\xb2\x08\x47\x31\xbb\x3a\x4e\x16\x60\x54\x83\xe1\x12\xb0\xba\x2e\x77\x04\xe0\x86\x70\x3a\xfa\x43\x2f\x5e\x65\xd4\x8e\xbb\xf6\xcd\xfb\x55\x53\x14\x53\x21\xdb\x15\x28\x94\xac\x80\xc1\x72\x67\xfc\xc3\xb5\x0f\xa5\x3e\xce\x7c\x09\xd7\x1f\x48\xa6\x77\x74\xf7\xd0\x3d\x0c\xa6\x25\xc5\x4a\x51\x50\x51\x3c\x3d\xf3\xa8\xf6\x60\xdf\xb9\xaf\x71\xe2\xe6\xa4\x68\xe6\xde\x8e\x0e\xa5\xfc\x8b\x52\x2b\x15\xae\x64\x47\xc4\xbe\xbc\x84\x88\x5a\x5a\x8e\x6d\xc2\xb0\x72\x94\x31\xac\xb2\xf0\xdf\xe7\x0e\x35\x64\xbf\xb7\xee\x1d\x56\xf3\xaa\x2e\xd1\x3e\x52\x52\x2f\x97\xc2\x85\x7d\xa1\x68\x0b\x8d\x7d\xc2\xd4\x6b\xa9\xcc\xda\xfe\x92\x27\xd5\xf0\xee\x6b\x98\x2f\xb1\x90\xaa\x3b\x61\x24\xbe\x37\x7c\x3b\xf1\x62\xed\xfa\xad\x1e\x87\xfd\xcf\x06\x4f\x64\xe1\x7f\xa3\x98\x26\x71\xd5\xff\xb9\x23\x72\x1e\xe6\x82\xd3\x00\x73\x17\xcd\x8e\x8e\x80\x6d\x24\xcf\x21\x47\x96\x43\x26\x73\x04\x2c\x79\xc5\x05\xa3\xb0\x8d\x66\xd6\xc7\xb6\x87\xbb\x7b\x88\x66\x37\x70\x06\x18\x3d\x44\xff\x0b\x00\x00\xff\xff\x72\x0d\xcb\x80\x42\x1f\x00\x00"),
+ },
+ "/nosync": &vfsgen۰DirInfo{
+ name: "nosync",
+ modTime: time.Date(2018, 4, 20, 7, 53, 19, 113197068, time.UTC),
+ },
+ "/nosync/map.go": &vfsgen۰CompressedFileInfo{
+ name: "map.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 1958,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x55\x4d\x8f\xdb\x46\x0c\x3d\x5b\xbf\x82\x3d\x55\x2e\x14\xe7\x9e\x62\x0f\x05\x7a\x29\xd0\x34\x40\xdb\x5b\x90\x03\x2d\x71\xac\x81\xe7\x43\x1d\x52\xeb\x2a\x8b\xfd\xef\x05\x39\xb2\x57\xde\x24\x45\x0f\xbd\xd9\x23\x0e\xf9\xf8\xde\x23\x67\xc2\xfe\x8c\x27\x82\x94\x79\x49\x7d\xd3\xbc\x7d\x0b\xef\x71\x02\xcf\x80\xd0\xe7\xd4\xcf\xa5\x50\x12\x88\x38\xc1\xc5\xcb\x08\x18\x73\x11\xff\x99\x86\x37\x7d\x4e\x2c\x98\xe4\x8d\xf8\x48\x10\x32\x0e\xdc\x01\x4b\x2e\xc4\x1d\x60\x1a\x60\xa0\x40\x42\x7c\xd0\x9c\xbf\x88\xa6\x64\x74\x04\x2e\x17\x88\x73\x10\x3f\x05\x82\x53\x2e\x79\x16\x9f\x88\x41\x32\xf4\x18\x02\xa0\x02\xf8\x9e\x21\x92\x8c\x79\xe0\x0d\x8a\xb0\x68\x2e\x4d\xf7\xe7\x48\xf0\x99\x4a\xbe\x62\x7d\xc4\xe0\x07\x2b\x4a\x71\x92\x5b\xd8\x4f\xf6\x3d\xce\x2c\x90\xb2\xc0\x91\xa0\xcf\x93\xa7\x01\xd0\x09\x15\x70\xbe\xb0\xc0\xcc\x74\x68\x64\x99\xc8\x82\x59\xca\xdc\x0b\x3c\x35\xbb\xa8\x4d\x7f\xf4\x49\xa8\x38\xec\xe9\xe9\xf9\xd3\xe6\x77\xf3\x6c\x54\xfd\x9a\x71\x80\x42\x32\x97\xc4\x20\x23\x29\x90\x99\x2a\x0b\x03\xf8\x64\x67\xca\x9d\x36\x8d\x70\xa6\xa5\x83\x5c\x20\xf9\x00\xde\x41\xca\x9a\xa3\x5e\xf1\x0c\x53\x21\xa6\x24\x87\x6b\x83\xf9\x0c\x85\x78\x0e\x02\x3e\x0d\xbe\x47\x21\x86\xcb\x48\x32\x52\x59\x2f\x5d\x90\xc1\xe5\x39\x6d\x4b\x1d\x1a\x37\xa7\x1e\xda\x08\x3f\xbc\xc7\x69\x6f\x10\xdb\x33\x2d\xb0\x41\xbf\x87\x76\xad\xfa\x72\xd6\x69\xbd\x63\xce\x61\xaf\xcd\xdb\x67\x3b\x7a\x80\x78\x88\x1f\xcf\xb4\x7c\x6a\x76\xb5\x53\xb8\x7d\x5c\x59\xf8\x43\xdb\x05\x26\xd9\x72\x70\xeb\xf8\x35\x20\x8b\x6e\x8d\x8a\x2f\x40\x58\x6d\xef\xb4\x24\x3c\x3c\x18\x4f\x4f\xcd\x6e\x67\x7f\x21\xe2\x99\xda\x7f\xd1\x64\xdf\xec\x9e\x9b\xdd\x15\x2d\x3c\xd4\xf4\x1b\xa5\x3e\x94\x8a\x74\x2b\x18\xfd\xed\x59\x7c\x3a\x6d\x50\xeb\xb1\x11\xe6\xee\x24\xf9\xa0\xc4\x5f\x3c\x53\x07\x5e\x56\xa3\x9b\xe5\xb6\xe9\x4e\xfe\x91\x56\x82\x6e\x3a\xea\x68\xd0\x70\xd3\x92\x41\x8a\x76\xed\x36\x64\xa9\x90\x35\xac\x03\x87\x81\xed\x73\x75\xd1\xd7\xf4\x5c\x1b\xf9\x26\x89\x2d\xf6\x32\x63\xb8\x97\x77\x85\x71\x93\xd8\xbb\x17\x21\xe1\xdd\x8b\xcc\x3f\xea\x7f\x65\xfd\x5e\x6d\x05\x6d\x04\xff\xcf\xf2\xbc\x2a\x63\xdd\xaf\x9a\xfd\x6c\x0b\xe4\xba\x47\xfe\x8b\xb7\xea\x8d\x2f\xed\xfe\x55\x57\xd5\xc2\x86\xaa\x96\x68\xe3\x21\x76\x9a\x76\xbf\x02\xf8\x1d\xd3\x89\x6c\x2b\x31\x38\x60\xfa\x6b\xa6\x24\x1e\x43\x58\x0c\x02\x61\x3f\x9a\x53\xd4\x05\x15\xd9\x6a\x98\xbb\x79\xd4\xf5\xe7\xc0\xdd\x7c\x62\x2d\x76\x50\x2c\x39\x4b\x9e\x6a\x6b\x5e\xa8\xa0\xf8\x9c\xae\xdb\xab\x56\x1f\x32\xb1\x6d\xaf\x44\x3d\x31\x63\xf1\x61\x81\x3e\x97\x42\x3c\xe5\x34\xe8\xda\xc4\xa4\x27\x89\x3d\x8b\xd6\xe6\x84\x13\x8f\x59\x20\x57\x8b\xd9\x3a\xd5\x84\x7d\x4e\x1a\xc0\xef\x20\x65\xc3\x7d\xf1\x21\xe8\x56\x7c\xf4\xec\x85\x06\x88\x3a\x1d\x32\x62\x82\x9c\x7a\xea\xe0\x38\xcb\xbd\x4f\x8d\xf8\xb4\xe8\x65\x4d\xa8\x2b\xbd\xae\xba\x5c\x56\x99\x86\xbb\x7d\xdd\xad\x4d\x44\x5c\xa0\x90\x0b\xd4\x8b\xdd\x8f\x38\x4d\x3a\x74\x75\xdc\x50\xae\x09\x5d\xc9\xd1\x02\xa6\xec\x93\xc0\x30\x17\x8d\xd2\xfa\x2f\x52\xdc\xd3\xa3\x99\x8f\x04\x1f\xda\xdf\xf6\xf5\x81\xd2\xe0\x34\xc7\x23\x15\xed\x9f\x02\x45\x6d\x79\xbb\x8b\x49\x47\xd4\x6f\x14\xb1\xca\x36\x75\xf5\x5d\xb0\x97\xcf\xde\xb6\x4d\x26\x73\xc1\x6b\xbf\x19\x86\xd6\x81\x9e\x7e\x73\x1a\x6f\x13\xa7\xdd\x9e\x3b\x78\xd4\x69\xab\xea\xab\x23\xd5\x8a\xde\xc1\x77\xae\xd5\x6f\x16\xb8\xdb\x1d\x0b\xe1\xb9\xd9\xa9\x37\xf5\xad\xf9\x27\x00\x00\xff\xff\xe8\x19\x65\x16\xa6\x07\x00\x00"),
+ },
+ "/nosync/mutex.go": &vfsgen۰CompressedFileInfo{
+ name: "mutex.go",
+ modTime: time.Date(2014, 12, 8, 0, 47, 30, 0, time.UTC),
+ uncompressedSize: 2073,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x54\xcb\x6e\xdb\x30\x10\x3c\x4b\x5f\xb1\xc9\xc9\x4e\x62\xa5\xbd\xb6\xf5\xa1\x68\x81\x22\x40\x7a\x09\x50\xe4\x4c\x53\x2b\x99\xb0\x44\x1a\x24\x55\xd5\x4d\xf2\xef\xc5\xf2\x21\xcb\x92\xec\xc4\x2d\xaa\x93\xb0\xe4\xce\xce\xec\x0c\xb8\x65\x7c\xc3\x4a\x04\xa9\xcc\x4e\xf2\x34\xbd\xbd\x85\xef\x8d\xc5\x5f\x20\x0c\x30\xc8\x9b\xba\xde\x41\xbb\x16\x7c\x4d\x05\xa9\xe4\x62\x55\x29\xbe\x11\xb2\xcc\x52\xbb\xdb\x62\xb8\x6c\xac\x6e\xb8\x85\xa7\x34\xa1\x53\xcc\x61\xa5\x54\x95\xbe\x38\xb8\x7b\xc5\x37\x40\x65\x03\x75\x06\x77\xd6\x23\xeb\x46\x2e\xac\xa8\x11\x50\x6b\xa5\x41\x14\x50\xbb\x83\x4a\x23\xcb\x77\xe0\x61\xb2\xb4\x68\x24\x87\x59\x0d\x57\x6e\xce\xdc\x81\xcd\xe6\x34\x88\x3a\xb2\x30\xed\x29\x4d\x92\x2d\x93\x82\xcf\x2e\xbd\x8e\x0f\x50\x77\x22\x0e\x10\x2f\xe7\x69\xf2\x92\x26\x5d\xe7\x12\xac\x6e\x30\x30\xfd\x21\xa9\x0a\x8d\x7c\x2b\x5b\xa9\xec\x51\xa6\x1e\xac\xe3\x7a\x71\x8a\xac\x9f\x08\xaa\x08\x7f\x98\x7b\xfe\x63\xb6\x05\xab\x4c\xa4\xfb\xf0\x78\x96\x53\xf1\xfa\xde\xab\x56\x0b\x8b\xf7\x1e\x9a\x3e\x67\x5a\x42\xeb\xa2\xe2\x17\xd5\x48\x8b\x1a\x84\xb4\x13\x4e\x42\xa1\x34\x10\x00\x0d\x38\xb1\x27\xdd\x8e\x4d\x70\xbd\x54\x10\xb2\x84\x1e\x4c\xd8\xa1\x6e\xe1\x2a\x90\x1d\x18\xae\xdb\x6c\xc8\xee\x62\x09\xef\xe0\xf9\x99\x8e\xfa\x72\xce\x4e\xc4\xa0\xff\x54\x2e\x74\x7b\x9e\xf8\x7d\x4a\x0e\xfa\xa6\xd4\x0e\x43\xf3\xba\xaa\x57\xa2\x33\x92\x75\x10\xa0\x91\xa1\xc1\x94\xff\x69\xe8\xc3\xd0\xd1\x7f\xb5\x6d\x90\x88\xeb\xeb\xa8\xae\xb3\x2d\x57\x48\x5a\x8c\x90\x65\x85\x41\x35\x67\x55\xf5\x11\x84\x05\x77\x48\x16\xb1\xa2\x40\x6e\x41\xd9\x35\x6a\x30\xa2\x6e\x2a\xcb\x24\xaa\xc6\x38\x65\xa8\xcd\xd9\x4e\xc7\x6d\x4e\xae\x61\x60\xf5\x44\xb4\x97\x14\xed\xbf\xb2\x7c\x80\xb4\x58\x84\x95\x3c\x32\x61\xbf\x69\xd5\x6c\xdf\xfa\x66\xec\x1b\xf6\xaf\x06\x1f\xbd\x0b\x9f\xf3\x1c\x58\x9e\x1b\xc8\xb1\xb2\xec\x26\x20\xd6\x6c\x07\x2b\x04\x89\x25\xb3\xe2\x27\xde\x80\x55\x60\xd7\x7d\xcc\xbb\xc2\x15\x22\x60\xe9\x9c\xe8\xae\x13\xaa\x53\x6e\xe2\x02\xdb\x12\xae\xba\xee\x39\x5d\x98\xb9\x89\x44\xc5\xed\xb1\x2d\xb3\x08\x76\xbd\xf4\x6c\xdc\x72\x7b\xf5\x4f\x87\x3b\xf5\x1b\x8d\x43\x7b\xdc\xc2\x7d\xbf\x53\x2f\xf3\xab\x92\x08\x39\x72\x8d\x35\x4a\x6b\x06\x62\x42\xc3\x11\xae\xd4\x3b\x8b\x1c\x89\xf8\xe2\xfd\xbc\x67\x4a\x10\x4a\x49\x9a\x44\x8d\xe1\xfa\x8d\x5a\x1d\x99\x40\xbf\x5d\x9a\x7a\x82\x2f\x96\x53\x8a\xc7\x13\x22\x7c\x54\xfc\x27\x00\x00\xff\xff\xec\x95\x29\x83\x19\x08\x00\x00"),
+ },
+ "/nosync/once.go": &vfsgen۰CompressedFileInfo{
+ name: "once.go",
+ modTime: time.Date(2014, 12, 8, 0, 47, 30, 0, time.UTC),
+ uncompressedSize: 1072,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x53\xcb\x92\xda\x40\x0c\x3c\xdb\x5f\xd1\xb5\x27\x9c\xa2\xe0\xbe\xa9\x1c\x52\xc5\x65\x4f\x39\xe4\x0b\xc4\x58\x03\xca\x0e\x1a\x32\x0f\x58\x67\x8b\x7f\x4f\x69\x6c\x08\xb9\xd9\x92\xba\xd5\x6a\x69\xce\xe4\xde\xe9\xc0\xd0\x98\x27\x75\x7d\xbf\xdd\xe2\x87\x3a\x86\x64\x90\x22\xee\x7f\xb1\x2b\x28\x47\x2a\xb8\x4a\x08\x38\x73\xf2\x31\x9d\xc0\x1f\xe4\x4a\x98\x10\x95\x41\xae\x48\xd4\x4d\x5f\xa6\x33\xcf\xe0\x5c\x52\x75\x05\x9f\x7d\x37\x46\xd1\x03\xf6\x31\x06\xfb\x56\xc6\xfc\x7d\x6b\x8d\x76\x11\x8e\x42\xc8\x28\x47\x86\xaf\xda\x78\xe0\x21\x1e\xa4\x23\xa2\x86\xc9\xbe\x77\xd1\xd4\xec\xd9\x98\xac\x9e\x47\xf8\x98\x0c\x64\x24\x5e\x52\x2e\x28\x72\xe2\x25\x2a\x19\xa2\xb9\x90\x09\x89\xbe\x09\xda\xe0\x4d\x11\xcb\x91\x13\xae\x31\x8d\x79\x8d\x83\x5c\x58\x0d\xde\x5d\x28\x21\x5a\xad\x15\x5a\x44\x7c\xfb\xdf\xec\xe2\xca\x0f\xd6\x79\xe9\x79\xaa\xa1\xc8\x39\x70\xeb\x95\xd7\xb3\xbc\xa6\xbc\x29\xb0\xaa\xd9\x23\xd1\x4b\x7c\x67\xf8\xb5\xb1\xf1\x85\xd5\x28\x3d\x8e\x94\x41\x18\xc5\x7b\x4e\xac\x05\x17\x0a\x95\x21\x0a\x26\x77\x6c\x20\x47\xcd\x48\xe0\x3b\x94\xaf\xcf\x53\x3c\xaf\x25\xf1\xef\x2a\x69\x31\xa1\x61\x1f\xd6\x95\x08\xfe\x60\x57\x0b\x6f\xfa\xed\x76\xb1\xb8\xf9\x51\x58\xc7\x05\x22\x2a\x45\x28\xc8\x1f\x9a\x31\xb6\xdb\x53\xcd\x05\x7b\x46\xaa\xfa\xb4\x5a\x33\x0e\x3f\xc5\xfa\x36\x05\x92\xa1\x12\x68\x14\xb7\x86\x14\x9c\x68\x32\x8c\xb2\xe3\x9c\x29\x4d\xd6\xbe\x66\x06\xfd\x13\x14\xa4\x70\xa2\x60\x19\x47\xe7\x52\x13\xdf\xd7\x46\xe9\x50\x4f\xac\x25\x5b\x8e\xfe\x1b\x61\xcf\x8b\x85\x23\xf6\x13\x76\xf1\xb5\xed\xc9\x45\xf5\x72\xd8\x3c\x56\x53\xd5\xad\x06\x7c\x62\x89\xdb\x54\x2b\x2f\x81\x95\x4e\x3c\xe0\x36\x2c\x06\xbc\x99\xf5\x8e\x6a\xe6\x6c\x66\xcc\xf4\xf3\x46\xdb\x10\xf3\x55\x93\x8a\xdb\x3c\x23\x5a\x24\xaf\xdb\x89\x46\xcd\x32\x72\xca\x56\x5e\x22\x8e\x74\x61\x24\x2e\x35\x29\x8f\x5f\xe1\x6b\x1b\x6b\x3e\xe4\xd8\xae\x75\x4e\x1a\xd7\x55\xca\x31\xd6\xf9\x38\xec\x7c\x7d\x6b\x62\xda\xb1\x8a\xf8\x62\x2b\x1d\x60\xd3\x60\x9e\x67\xb0\x37\x63\x07\xb8\x69\x8f\xe5\xb3\xef\xba\x85\xac\xbb\x3d\x12\x46\x64\x99\xa6\x71\xf5\x32\xbf\xdc\xd7\xfb\x6b\xe2\xb1\x75\x15\x85\x7f\x19\x1a\xec\x8e\xf9\x86\x92\x2a\xf7\xdd\xc8\x9e\x13\xee\x06\xf6\xdd\x53\x81\xa7\x90\x79\x89\x28\x3f\x10\xb7\xd5\xd0\x77\x7e\x35\xf4\xb7\xfe\x6f\x00\x00\x00\xff\xff\xf9\x72\xbe\xa9\x30\x04\x00\x00"),
+ },
+ "/nosync/pool.go": &vfsgen۰CompressedFileInfo{
+ name: "pool.go",
+ modTime: time.Date(2014, 12, 8, 0, 47, 30, 0, time.UTC),
+ uncompressedSize: 2130,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x55\x3f\x93\xdb\xc6\x0f\xad\x4f\x9f\x02\xbf\xea\x77\xca\xe8\x74\x49\xeb\x99\x2b\x32\x29\x1c\x37\x89\x8b\x74\x1e\x17\x10\x09\x8a\x88\x97\x0b\x06\xc0\x4a\xa2\x3d\xf7\xdd\x33\x58\xfe\x39\x39\xee\x44\xee\xf2\xe1\xe1\xbd\x07\x68\xc4\xe6\x0b\x9e\x09\xb2\xd8\x94\x9b\xdd\xee\xf9\x19\x7e\x85\x8f\x22\x09\xd8\x00\xc1\xc8\x41\x3a\x70\x1a\x46\x51\xd4\x09\xe4\xf4\x37\x35\x6e\xe0\x3d\x3a\x0c\x38\xc1\x89\x80\x73\xcb\x17\x6e\x0b\xa6\x34\x81\xe1\x85\x5a\xc0\xdc\x06\x94\x92\x2b\xd3\x85\xda\xe3\xee\xf9\xb9\x62\xe7\x09\xd8\x69\x00\x73\x51\x6a\x81\x33\x78\x4f\x73\xc1\x05\x4d\x69\x90\x0a\x51\x5c\x06\x74\x6e\x2a\x2c\x3a\x60\x9e\xc0\x79\x20\xb8\xb2\xf7\x52\x3c\xf0\xb2\x38\x77\xdc\xa0\xb3\xe4\x23\x7c\xe8\xde\xd0\x7a\x49\xad\xd5\x47\xc9\x69\x02\xa5\x8e\x94\x72\x43\x70\xed\x29\x8a\xb2\x41\x8f\xe3\x48\xd9\x0e\x71\x2b\xc0\x2a\xb1\x81\xcf\xbd\x07\x8f\x96\x30\x25\x69\xd0\xef\xd8\x6f\xca\x18\x76\x04\x9d\x28\x14\x23\x38\x4d\x30\x94\xe4\x3c\x26\x82\xb3\xa8\x14\xe7\x4c\x06\xc6\xf1\x16\x33\x49\xb1\x34\xad\x18\x81\xf0\x7f\x83\xb1\xe8\x28\x46\x81\xe5\x02\x0d\x36\x3d\xc1\x56\x0f\x4e\xc5\xa1\xe4\x62\xa1\x90\xd3\x60\xb5\x54\x42\x27\x05\xa5\x62\x74\x98\xc5\x4d\x4c\x17\xce\x67\x18\x95\xcc\x8a\x46\xab\xb5\xe3\x33\xea\x29\x4c\x6d\x24\x25\x6a\x5c\xf4\x08\x7f\x85\x5f\x6c\x07\xe0\xb0\xed\x0b\x59\xfc\x20\xb4\x09\x5c\x02\xec\x54\x38\xb5\x40\x5d\xc7\x0d\x53\xf6\xd0\x44\x09\xdb\xa7\xb9\x51\x25\x82\xc4\xe6\x76\x84\xdf\xe5\x4a\x17\xd2\x0a\xc4\x16\x06\x80\x15\x76\x3c\xa5\x59\x10\x4c\x29\xf0\xee\x3e\xd9\xac\x07\x1c\x47\x95\x51\x19\x9d\xaa\x70\xd2\x01\x6e\x92\xba\xc0\x80\x39\x68\x23\x9c\x55\xca\xf8\x7d\xf0\xaa\x0e\x81\x63\x9c\x28\x7b\x24\xad\xc7\x88\x10\x0e\x92\xcf\x11\x38\x18\xc5\x29\x3b\xd7\xbc\x54\x99\xda\xb0\xa6\x91\xdc\x14\x55\xca\x1e\x41\xa5\x91\x72\x4b\xb9\x86\xa7\x49\xd1\xaa\xcd\x34\x96\x41\x38\xce\x7c\x46\x95\x0b\xb7\x14\x23\x70\xc5\xd0\x28\xca\xa8\xf3\xd7\xcd\x25\x96\x0c\x72\x21\xed\x09\x6b\xd4\xb1\x51\x31\x8b\x16\xa6\x15\xf8\xae\x73\xba\xe1\x10\xf1\x90\x0e\xce\x22\xed\x8f\xdd\x2f\x83\xd0\x0d\xbe\x32\x39\xc0\xb5\xe7\xa6\x87\x01\x39\x3b\x72\x36\xc0\x00\x6b\xa7\x8c\xc3\x3c\x14\x4f\xc6\x5f\xa9\x9d\x47\xe9\x3f\x53\x5a\x7c\x2c\x0e\xa7\xd2\x75\xa4\x16\xee\xd3\x72\xcd\x1a\x4c\x64\x50\x72\x4b\x1a\x70\x49\xb0\x85\xc7\x3a\x13\x95\xfa\x5d\x7e\x51\x09\xb0\x71\xbe\x50\x9a\x60\x54\xce\xce\xf9\xbc\xaf\x4a\x5b\xaf\x9c\xbf\x58\x9d\xa5\x40\xf9\xa7\x30\x59\x43\xd9\xd7\x96\xff\x9c\xdb\x11\xef\x49\xa1\xc7\xdc\x1e\x00\xdf\x32\xb1\xf5\x14\xf6\x19\x8c\xa8\x3e\xab\x61\xbd\xa8\x3f\x25\x8e\xf9\x9f\x37\x0d\xb0\x2d\x73\x1e\xc7\x6b\xd0\x42\xbe\x1a\xb6\xaa\xdf\x01\x8c\x63\xb2\x6b\xc5\xc5\x12\x68\x85\xe6\x74\x6e\xc6\x5d\x29\x25\xe0\xca\xb7\x6e\xaf\x20\x8c\xca\x72\x84\x0f\x35\xca\x43\xe8\xb3\x4d\x40\x78\xde\xe3\x85\xc0\x4a\xd3\x6f\x6b\x8f\xc3\xc5\xa1\x1e\xf7\xc4\x0a\x72\xcd\xdf\xa5\xbd\xf6\xef\xd3\xb8\x2c\x21\x73\x2d\x8d\xc3\xb7\xdd\xc3\xac\xfe\xa7\xcf\x9c\x9d\xb4\xc3\x86\xbe\xbd\xee\x1e\xfe\xa0\x2b\x00\x74\x25\x37\x8f\x7b\xb8\x3f\x79\xad\x8b\xf8\x3d\x39\x18\xa5\x5a\x18\x33\xa0\x9e\xd8\xb7\x59\x80\x4e\x65\xd8\xd6\xdd\x61\x59\x9b\x75\xac\xd7\x93\x75\xdd\x1c\xaa\x67\x4a\x5e\x34\xd7\x0b\x2e\xf5\xc3\x08\x11\xe9\x71\x2d\x15\xfb\xb7\xe9\x25\xb6\x92\x0b\xf0\x39\x07\xe3\xb8\x37\x46\x2b\x01\xe1\x4a\xb1\x45\x3c\x4c\xa3\x61\xf4\xba\xd4\xe0\xb7\x0a\x63\x61\x5e\x49\xed\xac\xb9\x59\x19\xa8\x6e\x6c\xa5\x34\x0f\xcb\x89\xfc\x4a\x94\xe1\x82\xa9\x50\x98\x6e\x31\xa0\x2e\xf0\xb1\xf8\xfa\x7f\x11\xd5\x96\xf3\x99\xee\x3c\xc2\xef\x69\x0b\xd6\x87\xae\x72\xbd\xd6\x52\x35\x5e\x57\x36\x5a\x6e\x43\xe6\x99\xe8\x78\x0c\x69\xeb\x7a\xca\x4f\x99\xd3\xa1\x7e\xb4\x28\xb0\x16\x52\xb2\x92\x6a\xf0\x42\x88\xba\x47\xe3\xb3\xe3\x2e\x0c\x81\xc7\x11\x7e\x0a\xf1\xf6\xf1\xe9\xf7\xf6\x84\x9f\xdc\x41\xa2\xfc\x38\x1e\xab\xb1\x7b\x78\x79\x81\x9f\xe3\x7d\x1c\xcc\xd5\xff\xf7\x52\xe9\xc4\xbb\x87\x85\x5e\x3d\x78\xdc\xef\x1e\x1e\x5e\x77\xdb\xcb\xcc\x69\x17\xcf\x37\x78\xf7\x02\x0b\xde\xa7\x7b\xec\xa7\x5f\x3e\xef\x1e\x96\x07\x78\xbb\xf2\xee\x87\x3b\x0b\xe0\x6d\x89\x4f\xd5\xb5\x6d\x0d\x6e\xab\xe1\x61\xe4\x0f\xed\x7d\x2c\xfe\x78\xbb\x6f\x6f\xbf\xf4\x77\x8b\xa6\xd6\x16\x66\xec\x4a\xf4\x8d\x4a\xfd\xff\x6c\x57\x12\x07\xb8\xed\x77\xaf\xbb\x7f\x03\x00\x00\xff\xff\x07\xba\x3e\x57\x52\x08\x00\x00"),
+ },
+ }
+ fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/js"].(os.FileInfo),
+ fs["/nosync"].(os.FileInfo),
+ }
+ fs["/js"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/js/js.go"].(os.FileInfo),
+ }
+ fs["/nosync"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/nosync/map.go"].(os.FileInfo),
+ fs["/nosync/mutex.go"].(os.FileInfo),
+ fs["/nosync/once.go"].(os.FileInfo),
+ fs["/nosync/pool.go"].(os.FileInfo),
+ }
+
+ return fs
+}()
+
+type vfsgen۰FS map[string]interface{}
+
+func (fs vfsgen۰FS) Open(path string) (http.File, error) {
+ path = pathpkg.Clean("/" + path)
+ f, ok := fs[path]
+ if !ok {
+ return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
+ }
+
+ switch f := f.(type) {
+ case *vfsgen۰CompressedFileInfo:
+ gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent))
+ if err != nil {
+ // This should never happen because we generate the gzip bytes such that they are always valid.
+ panic("unexpected error reading own gzip compressed bytes: " + err.Error())
+ }
+ return &vfsgen۰CompressedFile{
+ vfsgen۰CompressedFileInfo: f,
+ gr: gr,
+ }, nil
+ case *vfsgen۰DirInfo:
+ return &vfsgen۰Dir{
+ vfsgen۰DirInfo: f,
+ }, nil
+ default:
+ // This should never happen because we generate only the above types.
+ panic(fmt.Sprintf("unexpected type %T", f))
+ }
+}
+
+// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file.
+type vfsgen۰CompressedFileInfo struct {
+ name string
+ modTime time.Time
+ compressedContent []byte
+ uncompressedSize int64
+}
+
+func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) {
+ return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
+}
+func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil }
+
+func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte {
+ return f.compressedContent
+}
+
+func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name }
+func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize }
+func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 }
+func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime }
+func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false }
+func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil }
+
+// vfsgen۰CompressedFile is an opened compressedFile instance.
+type vfsgen۰CompressedFile struct {
+ *vfsgen۰CompressedFileInfo
+ gr *gzip.Reader
+ grPos int64 // Actual gr uncompressed position.
+ seekPos int64 // Seek uncompressed position.
+}
+
+func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
+ if f.grPos > f.seekPos {
+ // Rewind to beginning.
+ err = f.gr.Reset(bytes.NewReader(f.compressedContent))
+ if err != nil {
+ return 0, err
+ }
+ f.grPos = 0
+ }
+ if f.grPos < f.seekPos {
+ // Fast-forward.
+ _, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
+ if err != nil {
+ return 0, err
+ }
+ f.grPos = f.seekPos
+ }
+ n, err = f.gr.Read(p)
+ f.grPos += int64(n)
+ f.seekPos = f.grPos
+ return n, err
+}
+func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) {
+ switch whence {
+ case io.SeekStart:
+ f.seekPos = 0 + offset
+ case io.SeekCurrent:
+ f.seekPos += offset
+ case io.SeekEnd:
+ f.seekPos = f.uncompressedSize + offset
+ default:
+ panic(fmt.Errorf("invalid whence value: %v", whence))
+ }
+ return f.seekPos, nil
+}
+func (f *vfsgen۰CompressedFile) Close() error {
+ return f.gr.Close()
+}
+
+// vfsgen۰DirInfo is a static definition of a directory.
+type vfsgen۰DirInfo struct {
+ name string
+ modTime time.Time
+ entries []os.FileInfo
+}
+
+func (d *vfsgen۰DirInfo) Read([]byte) (int, error) {
+ return 0, fmt.Errorf("cannot Read from directory %s", d.name)
+}
+func (d *vfsgen۰DirInfo) Close() error { return nil }
+func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil }
+
+func (d *vfsgen۰DirInfo) Name() string { return d.name }
+func (d *vfsgen۰DirInfo) Size() int64 { return 0 }
+func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
+func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime }
+func (d *vfsgen۰DirInfo) IsDir() bool { return true }
+func (d *vfsgen۰DirInfo) Sys() interface{} { return nil }
+
+// vfsgen۰Dir is an opened dir instance.
+type vfsgen۰Dir struct {
+ *vfsgen۰DirInfo
+ pos int // Position within entries for Seek and Readdir.
+}
+
+func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) {
+ if offset == 0 && whence == io.SeekStart {
+ d.pos = 0
+ return 0, nil
+ }
+ return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
+}
+
+func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) {
+ if d.pos >= len(d.entries) && count > 0 {
+ return nil, io.EOF
+ }
+ if count <= 0 || count > len(d.entries)-d.pos {
+ count = len(d.entries) - d.pos
+ }
+ e := d.entries[d.pos : d.pos+count]
+ d.pos += count
+ return e, nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/doc.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/doc.go
new file mode 100644
index 00000000000..c176d5b331d
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/doc.go
@@ -0,0 +1,8 @@
+// Package natives provides native packages via a virtual filesystem.
+//
+// See documentation of parseAndAugment in github.com/gopherjs/gopherjs/build
+// for explanation of behavior used to augment the native packages using the files
+// in src subfolder.
+package natives
+
+//go:generate vfsgendev -source="github.com/gopherjs/gopherjs/compiler/natives".FS -tag=gopherjsdev
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs.go
new file mode 100644
index 00000000000..13bbd3b53dc
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs.go
@@ -0,0 +1,29 @@
+// +build gopherjsdev
+
+package natives
+
+import (
+ "go/build"
+ "log"
+ "net/http"
+ "os"
+ "strings"
+
+ "github.com/shurcooL/httpfs/filter"
+)
+
+// FS is a virtual filesystem that contains native packages.
+var FS = filter.Keep(
+ http.Dir(importPathToDir("github.com/gopherjs/gopherjs/compiler/natives")),
+ func(path string, fi os.FileInfo) bool {
+ return path == "/" || path == "/src" || strings.HasPrefix(path, "/src/")
+ },
+)
+
+func importPathToDir(importPath string) string {
+ p, err := build.Import(importPath, "", build.FindOnly)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ return p.Dir
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs_vfsdata.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs_vfsdata.go
new file mode 100644
index 00000000000..a9329d7da6b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/fs_vfsdata.go
@@ -0,0 +1,993 @@
+// Code generated by vfsgen; DO NOT EDIT.
+
+// +build !gopherjsdev
+
+package natives
+
+import (
+ "bytes"
+ "compress/gzip"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "os"
+ pathpkg "path"
+ "time"
+)
+
+// FS is a virtual filesystem that contains native packages.
+var FS = func() http.FileSystem {
+ fs := vfsgen۰FS{
+ "/": &vfsgen۰DirInfo{
+ name: "/",
+ modTime: time.Date(2018, 10, 3, 3, 25, 1, 34742792, time.UTC),
+ },
+ "/src": &vfsgen۰DirInfo{
+ name: "src",
+ modTime: time.Date(2018, 4, 20, 9, 8, 7, 919304753, time.UTC),
+ },
+ "/src/bytes": &vfsgen۰DirInfo{
+ name: "bytes",
+ modTime: time.Date(2018, 4, 20, 9, 33, 19, 948206308, time.UTC),
+ },
+ "/src/bytes/bytes.go": &vfsgen۰CompressedFileInfo{
+ name: "bytes.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 508,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x4e\xc3\x30\x10\x84\xcf\xde\xa7\x18\x6e\x8d\x68\x55\x72\x45\x4d\x0f\x20\x0e\x3c\x43\xd5\xc3\xda\xdd\x54\x86\xe0\x14\x27\x91\xa8\x50\xde\x1d\xd9\x71\x1a\x19\x55\xca\x21\xde\x9f\x99\x6f\x67\xbb\xc5\xa3\x1e\x6c\x73\xc2\x47\x47\x74\x61\xf3\xc9\x67\x81\xbe\xf6\xd2\x11\xd5\x83\x33\x78\x77\x27\xf9\x79\xb9\xf6\xb2\xea\x70\x38\x86\xce\x1a\x26\x4e\x14\xb0\xae\xc7\x2f\xa9\xba\xf5\xb0\x6b\x68\x3c\x57\xf0\xec\xce\x82\x2e\x94\x95\xad\xa1\x51\x55\x30\xf1\xa5\xbc\xf4\x83\x77\xb0\xa4\xd4\x48\xe1\x4b\x85\x4d\x49\x63\x32\x7b\xfb\x1e\xb8\x59\x71\xd0\x9a\xbc\x0a\xe8\xb6\x6d\xc2\xbe\xad\xd1\x88\x5b\x71\x81\x87\x2a\xfe\xe9\x22\xca\x26\x91\x9a\x9b\x4e\xa2\x6a\xa2\x31\x0b\x0d\xcf\x34\x26\xec\xea\x83\x3d\x66\x40\x69\x35\x87\xea\xfd\x20\x37\xac\xd7\xf6\xeb\xc2\x5e\x72\xb0\xfc\x78\xc3\x77\xfc\x2c\xf6\x19\xeb\x2c\x5e\x4e\x6e\xca\xc4\xc8\x02\x50\xe2\x63\xec\x60\x74\x36\xbb\x99\x87\xa7\xfe\xfe\x7f\xbf\xbc\x91\x2f\x09\xed\xee\x04\x14\x74\x96\xf3\x9e\x68\xa4\xbf\x00\x00\x00\xff\xff\x23\x2d\xfc\x5d\xfc\x01\x00\x00"),
+ },
+ "/src/bytes/bytes_test.go": &vfsgen۰CompressedFileInfo{
+ name: "bytes_test.go",
+ modTime: time.Date(2018, 2, 27, 18, 59, 8, 0, time.UTC),
+ uncompressedSize: 215,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xcc\xc1\x4a\xc4\x30\x10\x87\xf1\x73\xe7\x29\x86\x5c\x6c\x55\xba\x8f\xb1\xe0\xb5\xde\x44\x24\x4d\xff\xb6\xe3\xa6\x93\x90\x99\x22\xab\xf8\xee\xb2\xe0\xc5\xeb\xc7\x8f\xef\x74\xe2\x87\xf9\x90\xbc\xf0\x87\x11\xd5\x98\x2e\x71\x05\xcf\x57\x87\xbd\x39\xcc\x89\x64\xaf\xa5\x39\xf7\xd4\x85\x5b\x10\x5d\x03\x0d\x44\xef\x87\x26\x5e\xa2\xae\x68\xe5\xb0\x29\x4b\x42\xef\x7c\xff\x47\xc6\xe7\x81\x5f\x5e\x6f\x1b\xfe\xa6\xce\xc7\xe9\x22\xb5\x0f\xff\x39\x37\x64\x81\x71\x51\xb6\xab\xa5\x98\xf3\x78\x86\xd7\xb8\xc2\xe4\x0b\x8f\xfc\xb9\x49\xda\xf8\x5c\xea\x86\xf6\x34\xf1\x52\x60\x7a\xe7\x2c\x7b\xcd\xd8\xa1\x1e\x06\xa2\xae\x46\x95\xd4\x87\x43\x1b\x62\xda\xe2\x9c\x11\x06\xfa\xa1\xdf\x00\x00\x00\xff\xff\x25\x40\x6e\x83\xd7\x00\x00\x00"),
+ },
+ "/src/crypto": &vfsgen۰DirInfo{
+ name: "crypto",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 552154706, time.UTC),
+ },
+ "/src/crypto/internal": &vfsgen۰DirInfo{
+ name: "internal",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 552270972, time.UTC),
+ },
+ "/src/crypto/internal/subtle": &vfsgen۰DirInfo{
+ name: "subtle",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 552422592, time.UTC),
+ },
+ "/src/crypto/internal/subtle/aliasing.go": &vfsgen۰CompressedFileInfo{
+ name: "aliasing.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 552642511, time.UTC),
+ uncompressedSize: 654,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x90\x4d\x6f\xd4\x3c\x14\x85\xd7\xe3\x5f\x71\x14\xbd\xea\x9b\x68\xda\x84\x6e\x11\x45\x62\x55\xc1\xa6\x0b\x90\x58\x20\x16\x8e\x73\x27\x76\x70\xae\xa3\xeb\x1b\x88\x85\xf8\xef\x68\xa6\xa5\x7c\x0e\xec\x72\xa5\xe7\x39\xe7\xc4\x5d\x87\x7d\xbf\x86\x38\x60\xca\xc6\x2c\xd6\x7d\xb0\x23\x21\xaf\xbd\x46\x32\x26\xcc\x4b\x12\x45\x35\x06\xf5\x6b\xdf\xba\x34\x77\x63\x5a\x3c\xc9\x94\xbf\x7f\x4c\xb9\x32\xa6\xeb\xf0\x82\xcb\xdd\x47\x92\x68\x17\x08\x1d\xbd\x8c\x4f\x9e\xd4\x93\x60\x83\xe5\x01\x05\xd9\x5b\x21\xcc\x34\x27\x29\xb0\x0a\xcb\x05\x35\x27\x05\x93\xa3\x9c\xad\x84\x58\x8e\x51\x2e\x89\x50\x5e\x12\x0f\x81\xc7\x06\x81\x07\xda\x5a\xbc\xf1\x8f\x6e\x4f\x25\xf1\x00\xf5\x84\x1c\x83\x23\x44\xe2\x51\x3d\x42\x46\x18\x39\x09\x0d\xad\x39\xac\xec\x7e\x18\x55\x6f\x97\x28\x78\xf7\xbe\x2f\x4a\x0d\xfa\x94\x22\x3e\x9b\x5d\xd7\xe1\xf6\xf4\x23\xaf\x5e\x3f\xc5\x5b\x82\xb3\xfc\xbf\x42\x28\x16\x24\xc6\x92\x02\x2b\x09\xac\x04\xf5\x33\x69\x70\x97\xc8\x09\x6b\xa6\x47\xeb\xa1\xff\xc4\xb1\x8d\xb9\x35\x3b\x21\x5d\x85\x8f\x93\xea\xad\xc1\x73\x3c\xc1\xc5\xc5\xe9\x2a\xdf\x2e\xb3\xdb\x4d\xb9\x7d\xf9\xe0\xdc\xf5\x13\x39\xad\xb7\xa6\xbd\x25\xad\xab\xff\xac\x88\x2d\x55\x83\x9b\x1b\xfc\x4e\x95\x5f\xa9\x7f\xa5\xa5\xc3\x21\x93\x56\xcd\x11\xa8\x1b\x3c\xfb\x6b\xe8\xcf\xf0\xfe\x7e\xf4\xd5\xf5\xb9\x92\x33\xde\x9f\x4b\xce\x2c\xda\xdf\xbf\xd3\xd5\xb5\xf9\x62\xbe\x06\x00\x00\xff\xff\xb2\x4c\x59\x2e\x8e\x02\x00\x00"),
+ },
+ "/src/crypto/rand": &vfsgen۰DirInfo{
+ name: "rand",
+ modTime: time.Date(2018, 4, 20, 9, 32, 51, 244279158, time.UTC),
+ },
+ "/src/crypto/rand/rand.go": &vfsgen۰CompressedFileInfo{
+ name: "rand.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 1175,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x53\x4b\x6f\x9b\x40\x10\x3e\x7b\x7f\xc5\x94\x56\x15\xdb\x38\x50\x29\x4a\x0e\xa9\x5c\x29\x8d\xa2\x28\x97\xb4\x8d\xfa\x38\x54\x3d\x2c\x30\xc0\x3a\x30\x4b\x77\x07\x53\x2b\xe2\xbf\x57\xb0\xe0\xb8\x89\xab\x5e\x0c\xeb\xef\xb5\xf3\x20\x8e\xe1\x28\x69\x75\x95\xc1\xda\x09\xd1\xa8\xf4\x5e\x15\x08\x56\x51\x26\x84\xae\x1b\x63\x19\x42\xb1\x08\xd0\x5a\x63\x5d\x20\xc4\x22\x28\x34\x97\x6d\x12\xa5\xa6\x8e\x0b\xd3\x94\x68\xd7\xee\xf1\x65\xed\x02\x21\x85\xc8\x5b\x4a\x41\x93\xe6\x50\xc2\x83\x58\xdc\xa1\xca\xd0\xc2\x0a\x5e\x5b\x2a\xfc\xe1\xa1\x17\xbd\x10\xbc\x6d\x10\x76\xff\x81\x63\xdb\xa6\xfc\xd0\x4f\x06\xa1\x85\x37\x3b\x50\xc2\xf0\x0c\x13\xf8\xf1\x33\xd9\x32\x4a\x08\x09\x34\xf1\x12\xd0\x5a\x18\xaf\x37\x46\x29\x6b\xd5\x16\xce\x57\xb0\x76\xd1\x0d\x31\x5a\x52\xd5\xc7\x64\x8d\x29\x87\x89\x8c\xae\x91\xc3\xe0\xd5\xc8\x09\xa4\x58\x98\x3c\x77\xc8\xff\x61\x7b\x52\x20\x07\x42\x28\x85\x58\xc4\x31\x24\xd6\x74\x0e\xad\x58\xa4\x76\xdb\xb0\x99\x1c\xae\x2b\x93\xa8\xca\xcb\x3c\x30\x84\xe8\x1c\x26\xd6\x6a\x64\x7d\xa5\x0c\x73\x4d\x98\x0d\xd7\x9d\x0d\x9e\xe9\x6b\x77\xb9\x73\xe8\xf7\x4d\x5e\x1c\x30\xd9\xa1\x5e\x5b\x20\xdf\x29\xca\x4c\xfd\x4d\x55\x2d\xba\x40\x1e\x14\x2d\x08\x56\x50\x21\x85\x89\x1c\x4e\x3a\x07\x82\xf7\x70\x76\x7a\x7a\x72\xe6\xf1\xa1\xd0\x8b\x8d\xd1\x19\x7c\x6e\x0d\xab\xab\xdf\x29\x62\x86\xd9\xd5\xd0\x6b\xe0\xd2\x9a\x8e\x20\xd9\xc2\x93\xb4\x59\xd9\x95\x48\x83\x7d\xc1\x25\x68\x07\xb5\xb1\x08\x5c\x2a\xf2\x09\x4b\x50\x0e\x5c\x83\xa9\xce\x35\x66\xa0\x69\x96\x95\xcc\xcd\x79\x1c\x77\x5d\x17\x75\x27\x91\xb1\x45\xfc\xe5\x2e\xfe\x8e\x89\xef\xc6\xc5\xa7\x9b\xf8\xa5\x7f\x3d\xae\x91\x4b\x93\x1d\x1f\x8a\x1f\x2a\x1b\x63\x86\x53\x3f\xfc\x4c\xed\xb9\x54\x55\xf5\xbc\x3f\x4b\x18\x37\x62\x42\x5d\x9b\xf8\x05\x59\x82\x1f\xfd\xfc\x3c\x22\x39\x76\xca\x22\xb7\x96\x80\x96\x40\xba\x12\x63\x40\xef\xd7\xe2\xd6\x64\x18\xad\xdd\x38\x2e\x8b\xbf\x5a\x6d\xf1\xc0\x6a\x4c\x48\x20\xdf\xed\x48\xff\x18\xaa\x1d\x6f\xf9\x61\xcb\xe8\x06\x9f\x89\x1d\xdd\xd0\xc6\xdc\xe3\xe3\x8e\x4d\xb6\x8f\xe4\xd1\x7a\x4f\x7b\x70\xfc\x7f\xd5\x8c\x1c\x2c\xf7\x25\x73\x86\xdf\x0f\x39\xb7\x60\xbf\x7e\x0f\x3d\x69\xc2\x84\xbd\x5d\xfa\x4f\xd2\x45\xb7\xd8\xcd\x17\x8d\x07\x7f\x20\xc3\xa0\x36\x4a\x57\x2a\xa9\x10\x34\x01\x97\xda\x01\xd2\x46\x5b\x43\x35\x12\x07\x52\xf4\xe2\x4f\x00\x00\x00\xff\xff\xe9\xf9\x0b\x94\x97\x04\x00\x00"),
+ },
+ "/src/crypto/x509": &vfsgen۰DirInfo{
+ name: "x509",
+ modTime: time.Date(2018, 4, 20, 10, 26, 30, 238700007, time.UTC),
+ },
+ "/src/crypto/x509/x509.go": &vfsgen۰CompressedFileInfo{
+ name: "x509.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 177,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x34\x8d\xb1\x6e\xc2\x40\x10\x05\xeb\xec\x57\x3c\x5d\x65\x27\x51\x9c\x26\x45\xd2\xa6\x88\x94\x02\x21\xfc\x05\x67\x7b\x81\x83\xf3\xed\x69\x6f\x0d\x58\x88\x7f\x47\x58\xa2\x1d\x8d\x66\x9a\x06\x6f\xdd\x14\xe2\x80\x43\x21\xca\xbe\x3f\xfa\x1d\xe3\xf2\xf5\xf9\x4d\x14\xc6\x2c\x6a\x70\xac\x2a\x5a\x1c\xd1\x76\x4a\x3d\xa2\xf8\xa1\x9d\x8b\xf1\xb8\x11\xb1\x52\xd5\xa8\x5e\x7f\x59\x6d\x2d\x12\xdf\xb1\xb8\x35\xae\xf4\xa2\x6c\x93\x26\xa4\xf0\xa4\xe5\x63\xc5\xe7\xca\xf5\x3a\x67\x93\xe6\xb1\xf8\x41\x59\x42\x50\x11\x43\x16\x89\x08\x05\x49\x0c\xfe\xe4\x43\xf4\x5d\x64\x84\x84\x3f\xc9\x7b\xd6\xff\xd6\xd5\x74\xa3\x7b\x00\x00\x00\xff\xff\xa1\x8b\x91\x39\xb1\x00\x00\x00"),
+ },
+ "/src/crypto/x509/x509_test.go": &vfsgen۰CompressedFileInfo{
+ name: "x509_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 364,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x90\xb1\x0e\x82\x40\x0c\x40\x67\xfb\x15\xcd\x4d\xa0\x09\xb8\x38\x38\x1b\x07\x37\x23\x84\x1d\xb1\x90\x13\xb8\x92\x6b\x31\x12\xe3\xbf\x1b\xd1\x49\x17\xc2\xdc\xf7\x5e\x9b\xc6\x31\xae\xce\xbd\x6d\x2e\x78\x15\x80\x2e\x2f\xea\xbc\x22\xbc\x6f\xd6\x5b\x00\xdb\x76\xec\x15\x8d\x92\xa8\x75\x95\x01\x28\x7b\x57\x60\x4a\xa2\xc9\x20\x4a\xed\x8e\xbc\x1e\x99\x9b\x40\x71\xf9\x85\xa2\x34\xc4\x07\x2c\x34\x4a\x6a\xdb\x05\xc6\x31\xca\x88\xa2\x67\x56\x31\x21\x3c\xff\x2a\xa7\xf7\x64\x6e\x62\xef\x6e\x59\xee\x67\xeb\x9f\x0b\x32\xf2\xb6\x1c\x26\x34\x7e\xec\xc3\xf8\xa0\x29\xcb\x47\xf1\x15\x00\x00\xff\xff\xa4\x46\xbd\x49\x6c\x01\x00\x00"),
+ },
+ "/src/database": &vfsgen۰DirInfo{
+ name: "database",
+ modTime: time.Date(2018, 4, 20, 9, 16, 25, 459988033, time.UTC),
+ },
+ "/src/database/sql": &vfsgen۰DirInfo{
+ name: "sql",
+ modTime: time.Date(2018, 4, 20, 9, 32, 51, 261527036, time.UTC),
+ },
+ "/src/database/sql/driver": &vfsgen۰DirInfo{
+ name: "driver",
+ modTime: time.Date(2018, 4, 20, 12, 39, 47, 342057645, time.UTC),
+ },
+ "/src/database/sql/driver/driver_test.go": &vfsgen۰CompressedFileInfo{
+ name: "driver_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 1185,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x53\x4d\x8f\xd3\x30\x10\x3d\x93\x5f\x31\x9a\x03\x38\x60\x35\xc9\x0a\xad\x44\x24\x2e\xb0\xe2\xba\x1c\x7a\xdb\xf6\xe0\x24\x0e\x32\x18\x3b\xf8\x23\xa5\xaa\xfa\xdf\x91\xe3\x06\xa4\xd6\x6d\xc3\x25\x9e\xcc\x9b\x79\xf3\xe4\x79\x2e\x0a\x78\xd7\x78\x21\x3b\xf8\x6e\xb3\x6c\x60\xed\x0f\xf6\x8d\x43\x67\xc4\xc8\x4d\x96\x8d\xcc\xc0\xc8\xa4\xe7\x9f\xb5\x1a\xb9\x71\xdc\xac\xb9\x75\x16\x3e\xc2\xcb\xf6\x32\x7f\xc8\x5e\x1d\x3e\x69\x2d\x29\xa0\x33\x9e\x23\x85\x70\x50\x40\x3c\xd2\x7f\xd0\xfa\x2a\xf4\xb2\x6d\xf6\x8e\x13\x74\x98\x27\xf1\x98\x4a\x71\x56\x69\xc2\x2a\x99\x15\xca\x3d\xbe\x27\x55\x7a\x86\x17\xca\x55\x8f\xd7\x50\xec\x99\xb4\x41\xfd\x74\x9e\x81\xa7\x5c\x0a\xc2\xf2\x4a\x4f\x99\x4e\x47\x89\x65\x9e\x46\x4f\x1a\x2f\xe1\xb6\x86\xb9\xbf\x06\xec\xb5\x46\x0a\xdc\x98\x1a\xd0\xfe\x92\x45\x5c\x6a\x0d\xad\xf6\xb2\x53\x6f\x1c\xb4\x71\x79\xb0\x09\xa5\x1b\x0c\x53\x35\xb8\xfd\xc0\xa1\xd1\x5a\x26\x28\x1f\x16\xd1\x3d\x24\x89\x9e\x78\xcf\xbc\x74\x5f\x99\x61\x3f\xb9\xe3\xe6\xaf\x73\x28\x28\xbd\x3b\x7d\xf0\x6e\x2d\x79\x3b\xdd\x4d\x4e\x94\x90\x39\x05\x25\xe4\x92\xae\xd7\x4c\xd9\x5d\x08\xe6\x73\x41\xcb\xb9\xaa\xa2\xb8\x55\x2e\xc8\x87\x7c\xde\x5b\x88\x42\x0f\x14\x05\xac\x9f\x9f\x9e\x6b\xf8\x22\x7e\xaf\x6e\x8f\xeb\x49\xb9\x0a\xa6\xeb\xa5\x66\xd3\xee\xa7\xbf\xfb\x32\x1b\x12\x6c\x7a\xe6\xd6\xdb\x52\x1b\x7b\xa8\x8e\xf3\x6b\x9b\xc2\xff\x15\x6b\x09\xb2\xf0\x46\x91\xe1\x12\x8d\x22\x0e\x8c\xbb\xf2\xca\xfa\x61\xd0\xc6\xf1\x2e\x5a\x24\xfa\x68\x25\x2c\x05\x06\x56\x8a\x96\x83\xee\xc3\x4d\x06\xde\x63\xf6\x27\x00\x00\xff\xff\x8d\xf2\x41\x9a\xa1\x04\x00\x00"),
+ },
+ "/src/debug": &vfsgen۰DirInfo{
+ name: "debug",
+ modTime: time.Date(2018, 4, 20, 9, 10, 26, 815054147, time.UTC),
+ },
+ "/src/debug/elf": &vfsgen۰DirInfo{
+ name: "elf",
+ modTime: time.Date(2018, 4, 20, 9, 40, 48, 430335834, time.UTC),
+ },
+ "/src/debug/elf/elf_test.go": &vfsgen۰FileInfo{
+ name: "elf_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x65\x6c\x66\x0a\x0a\x69\x6d\x70\x6f\x72\x74\x20\x22\x74\x65\x73\x74\x69\x6e\x67\x22\x0a\x0a\x66\x75\x6e\x63\x20\x54\x65\x73\x74\x4e\x6f\x53\x65\x63\x74\x69\x6f\x6e\x4f\x76\x65\x72\x6c\x61\x70\x73\x28\x74\x20\x2a\x74\x65\x73\x74\x69\x6e\x67\x2e\x54\x29\x20\x7b\x0a\x09\x74\x2e\x53\x6b\x69\x70\x28\x22\x6e\x6f\x74\x20\x36\x6c\x22\x29\x0a\x7d\x0a"),
+ },
+ "/src/encoding": &vfsgen۰DirInfo{
+ name: "encoding",
+ modTime: time.Date(2018, 4, 20, 9, 17, 51, 678431000, time.UTC),
+ },
+ "/src/encoding/gob": &vfsgen۰DirInfo{
+ name: "gob",
+ modTime: time.Date(2018, 4, 20, 10, 28, 37, 407632207, time.UTC),
+ },
+ "/src/encoding/gob/gob_test.go": &vfsgen۰CompressedFileInfo{
+ name: "gob_test.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 2598,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x56\x51\x6f\xdb\x3e\x0e\x7f\xb6\x3e\x05\x67\xdc\x0a\xa7\xe7\x39\x95\x93\xae\x9d\x81\x3e\xac\x5b\x77\xd8\x43\x3b\x60\x33\x70\xdb\x8a\x62\x70\x6c\x26\xd1\xea\x48\x3e\x49\x6e\x1a\x04\xf9\xee\x07\x4a\x76\x9c\xae\xff\x0d\x2b\xd0\x56\xa4\x7e\xfc\x91\xa2\x48\xca\xe3\x31\xfc\x7b\xd6\x8a\xba\x82\x9f\x86\xb1\xa6\x28\xef\x8b\x05\xc2\x42\xcd\x18\x13\xab\x46\x69\x0b\x11\x0b\xc2\xd9\xc6\xa2\x09\x59\x10\x6a\x9c\xd7\x58\x5a\x5a\x5a\x34\x56\xc8\x45\xc8\x46\x8c\x8d\xc7\x90\x7f\x7a\xff\x29\x83\x1c\x8d\xbd\x92\x55\xae\xae\x64\x05\xea\x01\xb5\x16\x15\x42\x59\x48\x98\x21\x68\x5c\xa9\x07\xac\x40\xc9\x12\xc1\x2e\x11\x66\xed\x02\xd6\xc2\x2e\xe1\xba\xd0\x1a\xe6\x02\xeb\x0a\x84\x81\xb9\x78\xc4\x2a\x61\xf3\x56\x96\x4f\x08\x23\x0b\xc7\x9d\xd7\x24\x1f\xc1\x96\x05\x76\xd3\x20\xe4\x29\x18\xab\xdb\xd2\x92\x26\xc8\x49\x10\x72\xc1\x82\x5d\xbf\x3f\x39\xdc\xff\x0a\xf3\x5a\x15\xf6\xf5\x94\x05\xc1\x77\x38\x16\xd2\x1e\x20\xf9\x21\xf2\x6d\x0c\x97\x31\xbc\x03\x70\x98\xe0\x1a\xba\x9f\x55\xd1\xdc\x7a\x1f\x77\xc7\x03\xd7\x75\x7a\xb0\x2d\xa4\xbd\xcb\x27\xa4\xf5\xc0\x27\x46\x7d\x7c\xc1\xb5\x90\xb6\xb1\x7a\x30\x39\xee\x3c\x95\x6a\xd5\xf4\x54\xb4\xae\xf1\x91\xa7\xe7\x77\xc3\x92\x40\x94\xb2\x1e\x74\x9b\x76\xac\x77\xb7\xe9\x61\x50\x57\xab\xc6\x6e\xae\x8b\xe6\xd0\xbd\x90\x16\xc6\x63\xb0\x0a\xca\x25\x96\xf7\x60\x97\x85\x85\x35\xdd\x4e\x89\xe2\x01\xa1\x00\xa9\xe4\x2b\x29\x6a\x32\x4a\x58\x10\xdc\xf4\x07\x3f\xbe\x9d\xdc\x0d\xdc\x5f\xac\x36\x9d\x3a\x1d\xce\xf4\x51\xda\xd7\x53\xe3\xb4\xe4\xc9\x21\x3f\x7f\xec\x08\xba\x03\x78\xf3\x9e\x75\x6f\xfa\xad\xd7\xdc\xde\x51\xbd\xb9\xbb\xec\x3d\xe7\xa9\xbb\xa5\x46\x40\x76\x01\x93\x84\x4f\xf9\xe9\x1b\x16\x20\x49\x69\x72\xc6\xcf\x29\x25\x76\xad\xbc\x7c\xc2\x82\x15\x16\x92\xf2\x9e\x5d\xc0\x34\x65\xc1\x5c\xc8\x05\x6a\x43\xe2\x29\x0b\x0c\xa7\x45\xe8\x1d\xf3\x90\x05\x26\x3d\x50\xa4\x21\x0b\x1e\x0a\xed\x82\xe5\x30\xe4\x1c\x2e\x7a\x21\xe2\xc9\x49\x0c\x3c\x39\x19\x0d\xc8\xf4\xaf\x90\x85\xd6\x1c\x0e\xd2\x45\xf2\xed\xc9\x1d\x5c\x80\xe1\x9d\xc4\x9d\x94\xee\xf1\xe9\x2f\xf8\xb4\xc3\xa7\x9d\xc4\x7b\x6b\xc2\xbb\xdb\x79\xdb\x39\x19\xea\x60\xaf\xf6\xb6\x47\x8d\x38\xd4\x39\x86\x23\x7c\xca\x90\xfe\x33\x43\xe7\x9d\xd0\x83\xca\x13\xd8\xb5\x62\x81\x75\xa9\x3d\xca\xb9\x6b\xa0\xac\xbb\x3e\x7e\x16\xb3\x20\xb8\xdc\x8b\xe7\x24\xbe\xeb\xc5\x57\xa7\x24\x5e\x67\xbf\x6f\xaf\x6d\xd8\x88\x30\xa3\xb8\x63\x08\x91\x56\xb8\x73\x36\x69\xf6\x6b\xcf\x6d\xa7\x19\xe4\x93\xed\xd7\x0c\x08\xfc\x3d\x83\xa3\xae\x14\x76\x31\xf0\x93\x7e\x0f\xfd\x56\x57\x16\x3b\x4f\xe6\x9d\x66\xcf\x5b\xb5\x73\x1f\x52\xdd\x85\x5d\x04\x21\x95\x5d\xe8\x0d\x7d\x1b\x67\x4f\xda\x78\xdb\xb9\x1d\xbc\xc4\xd0\x2d\x0e\x63\xea\xbb\x3d\xfb\x53\xb7\x6f\x5d\x29\x66\xbe\xce\x62\xff\xcf\x4b\xdc\x31\xec\xa7\xef\x07\xf1\x08\x76\x29\x0c\x34\x5a\xcd\x6a\x5c\x65\x7e\x33\xc8\x37\x0d\x5e\x69\xad\x74\x06\x95\xb1\xc9\xbf\x0c\x5a\x9a\xb3\x52\x59\x28\x80\xc6\xac\x15\x4a\x76\x58\x4a\x67\x61\x81\xe6\x61\xb5\xc2\x15\x4d\x6c\x88\xc6\x0b\x61\x97\xed\x2c\x29\xd5\x6a\xbc\x50\xcd\x12\xf5\x4f\x33\x2c\xba\x47\x21\x59\xa8\x6c\x7a\x7e\x96\x4d\x46\x8e\x8a\x06\x54\xf6\xe7\x09\xb5\xa5\x8a\xcf\x86\xaa\x8d\x5d\xc1\x0f\x8a\xd4\x1d\xaf\x1f\x62\x94\xe0\x7b\x8c\x9e\x8e\xb2\x11\x21\x6e\xfa\xda\x81\xa3\x61\x44\x6d\x79\x72\x1a\x43\x4a\x7f\x26\xc9\xa9\x63\xa2\x91\x95\x75\xb8\x3e\x9e\xad\xe1\x31\x18\xef\xc9\x0f\xaf\xcc\xed\xfb\xe9\xb5\x3d\x3b\x8b\xe1\xfc\x4d\x0c\x3c\x9d\x4c\xe9\x37\xe5\x93\xa9\xc3\x7e\xfe\x38\x54\x37\xbc\x82\x74\x22\x9c\x87\x7d\x24\xe1\x8d\x5a\x53\x92\xe9\x9d\xb3\x62\x85\x21\x6d\x7f\xcb\x9e\xce\xb8\x28\x5c\x62\x5d\xab\x18\x4c\x21\x6a\xa5\x43\x77\x9a\x7c\x38\x4d\x9e\x6e\x43\x77\xa1\xc2\x40\x9e\xba\x72\xdb\xb1\x60\x46\x3d\x26\x71\x1d\xb9\x67\x39\xb9\x6c\xe7\x73\xd4\x23\x16\xa0\xd6\xb4\x73\x83\xeb\x2b\x59\xaa\x0a\x75\x34\x1b\x25\x7e\x19\x59\x3e\x62\x81\x98\x03\x61\x5e\x5c\x00\x8d\x77\x6a\x51\x9b\xb8\xba\x88\x42\x74\xb0\x2c\x8c\x09\x31\x72\x6e\x68\x1c\xfc\xb0\x1c\x72\xee\xa9\x1d\xf3\x7b\xdc\x33\xfb\x65\x74\xf4\xe3\xb7\xdc\x1f\x0a\x5b\xd4\x51\x58\xe1\x33\x6e\x31\x87\x17\x7d\xd9\xbc\x47\x6c\xae\xfe\xd7\x16\x75\x64\x79\x0c\x8e\xee\x30\xb6\x79\x1f\x1c\xe0\x63\x83\xa5\xc5\x0a\x5e\x3e\xc0\x42\x59\x78\xf9\x10\xc6\x70\x4c\x46\x3e\x84\x1d\xa3\x0a\xbe\x44\x28\x66\x46\xd5\xad\xc5\x7a\x03\xa6\xd5\xfe\x5b\xa3\x7b\xde\x2a\xaa\x46\x5f\xfc\xee\x91\x4b\x5c\x2c\x96\x27\xfb\xa7\xf2\xe2\x59\x76\xe6\x51\xd8\x3d\x87\x60\x50\xda\x70\x7f\x84\x1f\x7f\x6d\xd7\x7b\xf7\xb6\x3b\x36\x7c\xdc\x50\x6f\x7e\x2e\x4a\x7c\xfe\x71\x33\x1e\x83\x3b\xb8\x90\x8b\xf1\x42\xcd\xa0\x6c\xb5\x46\x69\xeb\x0d\xb4\x06\xe9\x00\x66\x23\xcb\x04\x72\xaa\x0f\xb2\xf4\x6a\xa7\xfc\x6f\x21\xec\x7f\xb4\x6a\x1b\x28\x64\xe5\x98\xca\x42\x52\xbb\x9b\xb6\x2c\x11\x2b\x58\x2f\x51\x76\x0c\x94\x8c\xd6\xd0\x07\x57\x60\x93\x2f\xf7\xa2\x89\xc2\xd6\xd0\xdb\xe9\xb7\xc3\x11\xdb\xb1\xff\x07\x00\x00\xff\xff\x9b\x7c\x41\xd0\x26\x0a\x00\x00"),
+ },
+ "/src/encoding/json": &vfsgen۰DirInfo{
+ name: "json",
+ modTime: time.Date(2018, 4, 20, 11, 15, 14, 520460736, time.UTC),
+ },
+ "/src/encoding/json/stream_test.go": &vfsgen۰FileInfo{
+ name: "stream_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x6a\x73\x6f\x6e\x0a\x0a\x69\x6d\x70\x6f\x72\x74\x20\x22\x74\x65\x73\x74\x69\x6e\x67\x22\x0a\x0a\x66\x75\x6e\x63\x20\x54\x65\x73\x74\x48\x54\x54\x50\x44\x65\x63\x6f\x64\x69\x6e\x67\x28\x74\x20\x2a\x74\x65\x73\x74\x69\x6e\x67\x2e\x54\x29\x20\x7b\x0a\x09\x74\x2e\x53\x6b\x69\x70\x28\x22\x6e\x65\x74\x77\x6f\x72\x6b\x20\x61\x63\x63\x65\x73\x73\x20\x69\x73\x20\x6e\x6f\x74\x20\x73\x75\x70\x70\x6f\x72\x74\x65\x64\x20\x62\x79\x20\x47\x6f\x70\x68\x65\x72\x4a\x53\x22\x29\x0a\x7d\x0a"),
+ },
+ "/src/fmt": &vfsgen۰DirInfo{
+ name: "fmt",
+ modTime: time.Date(2018, 4, 20, 9, 26, 36, 223979708, time.UTC),
+ },
+ "/src/fmt/fmt_test.go": &vfsgen۰FileInfo{
+ name: "fmt_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x66\x6d\x74\x5f\x74\x65\x73\x74\x0a\x0a\x63\x6f\x6e\x73\x74\x20\x69\x6e\x74\x43\x6f\x75\x6e\x74\x20\x3d\x20\x31\x30\x30\x0a"),
+ },
+ "/src/go": &vfsgen۰DirInfo{
+ name: "go",
+ modTime: time.Date(2018, 8, 20, 0, 59, 45, 382177476, time.UTC),
+ },
+ "/src/go/token": &vfsgen۰DirInfo{
+ name: "token",
+ modTime: time.Date(2018, 4, 20, 9, 43, 49, 174565883, time.UTC),
+ },
+ "/src/go/token/token_test.go": &vfsgen۰FileInfo{
+ name: "token_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x74\x6f\x6b\x65\x6e\x0a\x0a\x69\x6d\x70\x6f\x72\x74\x20\x28\x0a\x09\x22\x74\x65\x73\x74\x69\x6e\x67\x22\x0a\x29\x0a\x0a\x66\x75\x6e\x63\x20\x54\x65\x73\x74\x46\x69\x6c\x65\x53\x65\x74\x52\x61\x63\x65\x28\x74\x20\x2a\x74\x65\x73\x74\x69\x6e\x67\x2e\x54\x29\x20\x7b\x0a\x09\x74\x2e\x53\x6b\x69\x70\x28\x29\x0a\x7d\x0a"),
+ },
+ "/src/internal": &vfsgen۰DirInfo{
+ name: "internal",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 553233388, time.UTC),
+ },
+ "/src/internal/cpu": &vfsgen۰DirInfo{
+ name: "cpu",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 552854117, time.UTC),
+ },
+ "/src/internal/cpu/cpu_js.go": &vfsgen۰FileInfo{
+ name: "cpu_js.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 553103518, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x63\x70\x75\x0a\x0a\x63\x6f\x6e\x73\x74\x20\x43\x61\x63\x68\x65\x4c\x69\x6e\x65\x53\x69\x7a\x65\x20\x3d\x20\x30\x0a"),
+ },
+ "/src/internal/poll": &vfsgen۰DirInfo{
+ name: "poll",
+ modTime: time.Date(2018, 4, 20, 11, 5, 5, 132313667, time.UTC),
+ },
+ "/src/internal/poll/fd_poll_js.go": &vfsgen۰CompressedFileInfo{
+ name: "fd_poll_js.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 1931,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x54\x41\x6f\x2a\x37\x10\x3e\xaf\x7f\xc5\x28\x97\xec\x12\xd8\x4d\xdb\x5b\x14\x0e\x15\x69\xd2\x48\x55\xa9\x92\x48\x39\x20\x1a\x19\x7b\x80\x49\xbc\xb6\x6b\x7b\x83\x10\xca\x7f\xaf\xbc\xbb\x04\x48\xe0\x85\xf7\xa4\x77\x02\x79\x66\xbe\xf9\xbe\x6f\x67\xa6\x28\xe0\x6c\x52\x91\x92\xf0\xec\x19\xb3\x5c\xbc\xf0\x19\x82\x35\x4a\x31\x46\xa5\x35\x2e\xc0\x49\xa0\x12\x4f\x18\x2b\x8a\xfa\xfd\x0a\xbd\x00\xf2\xc0\x41\x9b\x9e\xb1\x40\xa5\x55\x58\xa2\x0e\x3c\x90\xd1\x60\xa6\xc0\x35\xdc\x16\xc3\x3a\x19\x1d\x4c\x8d\x83\x9b\xe1\xef\x77\x83\x3f\xfb\xcf\x3e\x67\x45\x11\x81\x6e\x83\xff\x58\x48\x1e\x26\xdc\xa3\x04\xa3\xe1\x6f\x3e\xf8\x0b\x48\xc3\x4c\x80\x30\xa5\xa5\x88\x93\x7a\x44\xb8\x19\xde\x0d\x87\x0f\x85\x77\xa2\x20\x1d\xd0\x69\xae\x8a\xd8\xa7\x98\xca\xa7\xf8\xfb\xa4\xb9\x50\xf9\xcc\x64\xdd\xd8\x65\x52\x05\xa0\x00\xd2\xa0\x07\x7c\x45\x0d\x0a\xbd\xcf\x59\x58\x5a\xdc\x48\xf1\xc1\x55\x22\xc0\x8a\x25\x42\x19\x4f\x7a\x06\x13\x63\x14\x7b\x63\x6c\x5a\x69\x01\xa9\x95\xd0\x59\x27\x67\x40\x9a\x42\x3a\x95\xd0\xb9\xbe\xca\x00\x9d\x33\x0e\x56\xe0\x30\x54\x4e\x83\x26\x05\x07\xca\x22\x34\xa6\x19\xac\x0e\xc4\xf1\x95\x44\x88\x71\xb0\x32\x5f\xf3\xe8\x43\x70\x15\x1e\x82\xb4\x0e\x2d\x77\x98\x96\x46\x22\x90\x0e\x5d\x20\x7f\x4d\x0a\x6b\xfa\xef\xdc\x58\x42\xd3\x6d\xcc\x15\x4b\x92\x96\x2e\x3a\x37\x68\x5e\xd3\xa6\x32\x63\xc9\x1b\x4b\x36\x62\x0e\x79\xd0\x76\xbe\x43\x2e\xd3\x7d\x3d\xd7\x7e\x58\x99\xaf\x49\x9e\xba\xd3\x35\xbf\xec\x0b\x41\x8f\x8e\x02\x1e\x8d\xbb\xf8\x1a\x77\xc1\x29\xfc\x2c\x97\xfe\x70\xee\x81\x4a\x34\x55\x38\x64\x56\xec\x7e\x8c\x53\x35\xcb\x63\x6c\x8a\x89\x47\x79\xd4\x20\xee\x35\xe8\x03\xdc\x80\x6b\x81\x0a\xe5\xbb\x4b\xdb\x83\xba\xfd\x85\x8c\x52\x7c\xa2\xe2\x20\xc7\xa6\x9b\x6e\xbb\x73\x5a\xef\xc6\x3d\x86\x2b\xe4\x52\x91\xc6\x34\x40\x3c\x21\x79\x74\xea\xdb\x4b\xb3\xae\x8c\x86\xfd\x78\x75\xed\xce\xf7\x94\x17\x05\xfc\xd3\x8a\x74\x64\x83\x71\x6d\xdc\x43\x98\x23\xc8\xcd\xf3\x04\xe3\x74\x54\xf1\x4a\x4d\x96\x75\xb0\x39\x72\xf5\xb5\x31\x0e\xfe\xad\x48\x07\x1b\x5c\x7a\x9e\x01\x4d\x63\x82\x43\x20\xaf\x4f\x03\x18\x8d\x39\x3c\xcc\xc9\xc7\x43\x67\xb4\x5a\x36\x30\xf1\x3a\x06\xf4\x81\xf4\x2c\x6f\x64\xec\x32\x49\x33\x68\x31\xe3\x50\xb6\xb4\xb7\xda\xb0\x86\xfe\xc0\xd8\x65\x3c\xbd\x7e\xa9\x45\xee\x2a\x1d\x25\x3f\xdd\x63\xc9\xc5\x7f\x15\x39\x6c\xa1\x3f\x07\x52\x0f\x9d\x08\xf6\xdb\xaf\x59\xbb\x05\x1d\x0f\xfd\x3e\x9c\xd7\x2b\x20\xe6\x70\xd1\x87\x92\xbf\x60\x2a\xe6\x5c\x37\x93\xc6\x92\xc4\x63\xf9\xc8\x29\xa0\xf3\x23\x3f\x86\x3e\x70\x6b\x51\xcb\x74\xe7\xb9\x0b\x62\x1e\x73\x2f\x7b\x62\x5e\x6f\x4c\xc7\xf7\x7a\x5f\xb0\x75\xa8\x90\xfb\x3d\x6c\xdb\xc0\x07\xb6\x1d\x7f\x76\xc6\x58\xb2\x88\x24\x77\x7a\xd7\x42\x14\xea\x74\x91\x6d\xc4\x34\xde\x45\x2a\xac\x15\xb6\x18\x9d\x8f\x63\x79\xfc\xf7\xcb\xc5\x98\x7d\xd2\xb5\xd8\x0b\x24\x51\x61\xc0\x2d\xb5\x5d\xf0\xd9\x3b\xee\x65\xaf\xde\x86\xa8\xf4\x95\xbb\x2d\x5e\xd0\x3a\x59\x72\x3b\x6a\x55\x8c\x47\xe3\x2d\x5f\xff\x0f\x00\x00\xff\xff\x9e\x79\xbb\x91\x8b\x07\x00\x00"),
+ },
+ "/src/internal/syscall": &vfsgen۰DirInfo{
+ name: "syscall",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 553279676, time.UTC),
+ },
+ "/src/internal/syscall/unix": &vfsgen۰DirInfo{
+ name: "unix",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 553336210, time.UTC),
+ },
+ "/src/internal/syscall/unix/unix_js.go": &vfsgen۰FileInfo{
+ name: "unix_js.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 553636186, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x75\x6e\x69\x78\x0a\x0a\x63\x6f\x6e\x73\x74\x20\x72\x61\x6e\x64\x6f\x6d\x54\x72\x61\x70\x20\x3d\x20\x30\x0a\x0a\x66\x75\x6e\x63\x20\x49\x73\x4e\x6f\x6e\x62\x6c\x6f\x63\x6b\x28\x66\x64\x20\x69\x6e\x74\x29\x20\x28\x6e\x6f\x6e\x62\x6c\x6f\x63\x6b\x69\x6e\x67\x20\x62\x6f\x6f\x6c\x2c\x20\x65\x72\x72\x20\x65\x72\x72\x6f\x72\x29\x20\x7b\x0a\x09\x72\x65\x74\x75\x72\x6e\x20\x66\x61\x6c\x73\x65\x2c\x20\x6e\x69\x6c\x0a\x7d\x0a"),
+ },
+ "/src/internal/testenv": &vfsgen۰DirInfo{
+ name: "testenv",
+ modTime: time.Date(2018, 4, 20, 11, 3, 8, 366769229, time.UTC),
+ },
+ "/src/internal/testenv/testenv.go": &vfsgen۰CompressedFileInfo{
+ name: "testenv.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 424,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8f\xc1\x6a\xc3\x30\x0c\x86\xcf\xd1\x53\x08\x9f\x12\x36\x92\xfb\x6e\xa3\x8c\xf5\xd6\xb2\x3e\x81\xeb\x2a\x8d\xbb\x58\x2e\x92\xb2\xb4\x8c\xbe\xfb\xf0\xd6\x52\xd8\x06\x3e\xfd\x9f\xfd\xf1\xb9\xeb\xf0\x61\x3b\xc5\x71\x87\x07\x05\x38\xfa\xf0\xee\xf7\x84\x46\x6a\xc4\x1f\x00\x31\x1d\xb3\x18\xd6\x50\x39\x99\xd8\x62\x22\x07\x95\x53\x93\xc8\x7b\x75\xd0\x00\x74\x1d\x2e\xbd\xbe\x9c\x28\xa0\x50\xb9\xac\x38\x0f\x64\x03\x09\xda\x40\x18\x26\x11\x62\x43\x3d\xab\x51\xc2\xe0\x19\xd5\xbc\x18\x32\xcd\x78\x94\x1c\x48\x95\xb4\x58\x26\x8d\xbc\xc7\xac\xed\xa6\xf0\xf5\x0f\xc2\x2c\x58\xa7\x2c\x84\x21\xa7\x94\x79\x3c\x37\x48\x27\x0a\xed\x22\xa7\xe4\x79\xd7\x42\x3f\x71\xb8\x15\xd4\x0d\x6e\x73\x1e\xf1\x13\x2a\x9d\xa3\x85\x01\xaf\xd1\xed\xeb\x6a\xb5\x29\x73\xf0\x4a\xe8\xd8\x87\xd1\x3d\x41\x55\x09\xd9\x24\x8c\xbd\x1f\x95\x6e\x70\xe7\x65\x8e\xfc\x8d\x63\x8f\xd7\xaf\xb6\x4b\xaf\x6b\xa1\x3e\x9e\xea\xbb\xf2\xf9\x6d\xb1\x7c\x44\xe7\x25\xb9\xa6\xc8\x7f\xfb\xaa\x0b\x94\xf3\x27\xa5\xbc\xbb\xc7\x1c\xf4\x9f\x94\x0b\xdc\x06\x93\x89\xe0\x02\x5f\x01\x00\x00\xff\xff\xdc\xf8\xeb\x9e\xa8\x01\x00\x00"),
+ },
+ "/src/io": &vfsgen۰DirInfo{
+ name: "io",
+ modTime: time.Date(2018, 4, 20, 9, 18, 9, 731474926, time.UTC),
+ },
+ "/src/io/io_test.go": &vfsgen۰CompressedFileInfo{
+ name: "io_test.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 574,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\xd0\x41\x4b\xfb\x40\x10\x05\xf0\x73\xf7\x53\x0c\xbd\xfc\x9b\xbf\x92\x7e\x06\x29\x46\x10\xbc\x98\x82\xc7\xb2\x26\xcf\x64\xec\x66\x76\x99\x9d\x45\x51\xfc\xee\xd2\xa6\xa7\x52\x0f\xde\x3c\x2d\x3c\x78\xcb\xef\xcd\x7a\x4d\x57\xcf\x85\x43\x4f\xaf\xd9\xb9\xe4\xbb\xbd\x1f\x40\x1c\x77\x86\x6c\xce\xf1\x94\xa2\x1a\xad\xdc\x62\x79\x08\x58\x86\xa5\xab\x9c\x7b\x29\xd2\xd1\x16\xd9\x1e\x4a\x30\x7e\x52\x36\xe8\xee\xf8\xb4\xa6\x2c\x43\xcb\x32\x04\xdc\x84\x10\xbb\x95\xd1\xff\x53\xb5\xde\x56\xf4\xe9\x16\x56\xb7\x7b\x4e\xab\xca\x7d\x9d\x7f\xf4\x08\xdf\x43\x9b\xe0\xcd\x20\x3f\x16\x8f\x12\x52\x04\x46\xa6\x28\xa4\x45\x8c\x27\xd4\x1b\x1f\x02\x34\x93\x97\xfe\x3c\x6b\xd4\x4f\xc8\xd7\xf4\x36\x72\x37\xd2\x5d\x4c\x23\xf4\xbe\xa5\x3e\x22\xcb\x3f\xa3\x5c\xd2\x61\xe6\xf2\x02\x69\xde\x36\xef\xd9\x8c\x9e\xe5\x4f\xe9\x4e\x07\x53\x20\xdf\xbe\x8f\xbe\x64\x43\x3f\x67\xf9\xd7\xc0\x16\xd6\xb0\xf8\xc0\x1f\xd0\x8b\x16\x92\x68\xc4\x53\x0a\x98\x20\x33\xe7\x3b\x00\x00\xff\xff\x75\x6f\xe1\xab\x3e\x02\x00\x00"),
+ },
+ "/src/math": &vfsgen۰DirInfo{
+ name: "math",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 553893160, time.UTC),
+ },
+ "/src/math/big": &vfsgen۰DirInfo{
+ name: "big",
+ modTime: time.Date(2018, 4, 20, 9, 34, 7, 314436336, time.UTC),
+ },
+ "/src/math/big/big.go": &vfsgen۰CompressedFileInfo{
+ name: "big.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 174,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x44\x8d\xbd\xaa\xc3\x30\x0c\x46\x77\x3f\x85\xf6\x0b\x11\x5c\x68\x87\xcc\xdd\x03\x25\xd0\xd9\x89\x15\xdb\xf9\x93\x91\xe4\x94\xbe\x7d\x49\x3b\xf4\x9b\xbe\xe1\x70\x0e\x22\xfc\x0d\x35\xaf\x01\x66\x75\xae\xf8\x71\xf1\x91\x60\xc8\xd1\x39\x44\xe8\xbb\x5b\xd7\x42\x9f\xb2\x42\x56\xf0\xf0\x64\x59\xbc\x70\xdd\x03\x4c\x2c\x90\xcc\x8a\xb6\x88\x31\x5b\xaa\x43\x33\xf2\x86\x91\x4b\x22\x99\xf5\x77\xb2\x6a\x25\xc5\xeb\xe5\xbf\x39\x95\xdf\xdd\x69\xe3\x83\xc0\x4f\x46\x02\x96\xbc\xc1\x07\x3b\x2b\x42\xca\xeb\x41\xa1\x71\xf6\x2a\x04\x0f\x96\x00\x35\xef\x56\x4c\xdc\x3b\x00\x00\xff\xff\x55\xc0\x14\x01\xae\x00\x00\x00"),
+ },
+ "/src/math/big/big_test.go": &vfsgen۰CompressedFileInfo{
+ name: "big_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 148,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd7\x57\xd0\x4e\x2a\xcd\xcc\x49\x51\xc8\x2a\xe6\xe2\x2a\x48\x4c\xce\x4e\x4c\x4f\x55\x48\xca\x4c\xe7\xe2\xca\xcc\x2d\xc8\x2f\x2a\x51\x50\x2a\x49\x2d\x2e\xc9\xcc\x4b\x57\xe2\xe2\x4a\x2b\xcd\x4b\x56\x08\x49\x2d\x2e\x71\xaa\x2c\x49\x2d\xd6\x28\x51\xd0\x82\xca\xe9\x85\x68\x2a\x54\x73\x71\x96\xe8\x05\x67\x67\x16\x68\x28\x25\x15\xe5\x67\xa7\xe6\x29\x69\x72\xd5\x22\xe9\xf1\xcd\x4f\x09\x2e\x2c\x2a\xc1\xad\xab\x38\x27\xbf\x1c\xac\x07\x10\x00\x00\xff\xff\x9b\x59\x2d\xf0\x94\x00\x00\x00"),
+ },
+ "/src/math/math.go": &vfsgen۰CompressedFileInfo{
+ name: "math.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 554245403, time.UTC),
+ uncompressedSize: 4568,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6e\xdb\x38\x13\xbd\xb6\x9e\x62\x3e\xe3\x43\x57\xda\x2a\xb2\xe5\x04\x41\x51\xc4\x05\xba\xc1\xa6\x5b\xa0\xed\x2e\x36\xed\xde\x04\xbe\xa0\x64\xd2\xa6\x2b\x91\x2a\x49\xc5\x72\x9b\xbe\xfb\x82\xd4\x1f\x25\x5b\xb1\xbd\x57\xb6\xc8\x33\x67\xce\x8c\x66\xc8\xd1\x64\x02\x2f\xa3\x9c\x26\x4b\xd8\x48\xc7\xc9\x50\xfc\x15\xad\x30\xa4\x48\xad\x1d\x87\xa6\x19\x17\x0a\x5c\x67\x34\x5e\x51\xb5\xce\xa3\x20\xe6\xe9\x64\xc5\xb3\x35\x16\x1b\xd9\xfe\xd9\xc8\xb1\xe3\x39\xce\x23\x12\xc6\x10\xe6\xb0\x91\xc1\xbb\x84\x47\x28\x09\xde\x61\xe5\x8e\x3f\x22\xb5\x1e\x7b\x06\xf0\x1d\x0b\x0e\x24\xe1\x48\x5d\x5f\xc1\x1c\xa6\x66\x31\xe3\xf2\x3d\x23\x30\x87\x10\x26\x06\x61\x56\x19\x5e\x95\xab\x17\xdd\x65\xc4\xb4\x61\xbd\xe4\x90\x9c\xc5\xf0\x36\xe6\xd2\x2d\x6a\x62\xaf\xf1\xf0\xc3\x19\x09\xac\x72\xc1\x8c\xb2\xe0\x16\x25\x89\x3b\x46\x31\x97\x63\x1f\x0a\x2f\xb8\xd3\x30\xd7\x73\x7e\x5a\x34\xeb\xb3\x78\xd6\x03\x44\x92\xb2\xd3\x79\x24\x65\xc3\x34\x67\xe8\xd1\xe8\x01\x22\x85\xce\xd0\xa3\xd0\x90\x1e\x85\xce\xd1\xa3\xd1\xc3\x44\x33\x77\xe7\xc3\x39\x5c\xb3\xb1\x0f\xbb\x83\x74\xb7\x91\x50\x27\xcb\x8a\x23\xa1\x0e\xab\xba\xc5\x34\x39\x9d\x06\xd3\x64\x80\x86\x67\x3b\x49\x57\xcc\x2d\x7c\xd8\x1d\x64\xa3\x04\xdc\x02\x6e\x60\x0a\x4f\x4f\x10\x4e\x0a\x98\xcf\xab\x72\xf7\xe0\x7f\x73\x70\x77\xed\xde\xce\xde\xfb\xe1\x8c\x6a\x25\x17\x85\x33\xfa\xd9\xe8\x2a\x2c\xe7\xa7\x37\xc2\x60\x1f\xdc\x9e\xd3\x06\xc3\x5d\xf0\xbb\x20\xcf\xb3\x60\x0d\xe8\xe0\xe3\xa3\x06\x71\xc7\xa2\xc8\x4e\xd6\x89\x8b\x6c\x40\x66\x91\xcd\x4e\x66\xc9\xf8\x76\xec\xc3\x6c\x88\x28\x0d\x8f\x04\x50\x42\x5a\x9b\xbb\x84\x73\x71\xb2\x77\xa2\xd1\x87\xa3\xb8\x13\xb8\xc8\x5c\xd2\x12\xb9\x44\xa0\xb8\x7e\xf4\xb5\x67\xa0\x4c\x79\x16\x31\x29\x4d\x5a\x8e\x3f\x76\x19\x57\x6e\xe6\xc3\xb7\xe7\xf4\xac\x1b\x54\x6b\xf9\x9e\x11\x57\xd7\x7c\xe9\xc2\xb2\x91\x5b\xaa\xe2\xb5\xfe\x17\x23\x89\xc1\x60\xde\xcc\x61\xfa\xba\x2d\xe5\xf2\xf8\x77\x46\x4b\x4c\x50\x9e\x28\x6b\xa7\xac\x7b\x5d\xe8\x8d\x1f\x0d\x6d\xa3\xf4\xa1\x75\x1a\x71\x9e\x54\xcd\x45\x74\xd3\x54\xb7\x8a\xd5\x33\x8d\x73\xd3\x3a\x35\xae\xba\x67\xfa\xb8\x9b\x1a\x57\x27\x0b\x25\x12\x5b\x3a\x3e\xa1\x4f\x9d\x6c\x53\x69\x14\x74\xf2\xab\x9b\x99\x34\x36\x1f\x96\x26\xdd\x87\xdf\x4a\xf7\x74\xb8\x08\xa7\xb3\x2b\xb8\x31\xdb\x2f\x5e\x98\x9f\x1b\x30\x6b\x3f\x60\x32\x81\x2f\x12\x83\xbe\x54\x83\x8c\x6f\x81\x70\x01\x32\x45\x49\x62\x60\x8f\x28\xc9\xb1\x84\xed\x1a\x0b\x0c\x54\xfd\x22\xe1\x91\xa2\x28\xc1\x01\xdc\x71\x01\x19\x16\x84\x8b\x14\xb1\x18\x07\xce\xc8\xa4\x40\xcb\x99\xeb\x0b\x55\x27\xa0\xad\x0c\x14\x3b\x23\x1d\xbd\xbd\x02\xbf\x1e\xec\x04\x5c\x64\x6d\x39\x5a\x19\x4b\x9a\x78\x4b\x4c\x9b\x08\xbe\x1a\xa8\x78\x4a\xa0\xd0\x49\x2b\xca\x38\xb7\x5c\x7c\x45\x82\xe7\x6c\x69\xa2\xe4\x99\xa2\x29\xfd\x8e\x05\x44\xf9\x0a\x28\x83\x7f\x5e\xf9\x20\x70\xca\x1f\x31\x20\x05\x92\xa7\x18\x32\x4e\x99\xb2\x2a\x08\x31\x5b\x92\x25\x3f\xe1\xab\xc3\x8d\xf4\x81\xaf\xc2\xe9\xf3\x1d\x99\x94\x90\xae\xcd\x91\x93\x28\x29\x21\x1d\x9b\x23\xc7\x4e\x62\x10\xad\xc5\x47\x54\x0c\xdf\x29\x4d\x84\x25\xc6\xb2\xa2\xcf\xdc\x44\xb5\x55\x85\xb1\xac\xf8\xf2\xa8\x55\x3b\xe6\x95\x29\xfd\x7f\xca\x97\x3a\xa7\x9a\x68\x2f\xad\x1f\xf9\x92\x74\x8f\xa7\xba\x07\x9a\xa5\xfd\xe6\x7d\x7a\x1a\xea\x51\xe2\x37\xef\x96\x12\x08\x27\xc3\x30\x73\x7e\x8c\x4c\xfd\xbe\x9e\x9b\xb8\x88\x0f\xa1\x67\x75\xe9\x05\x94\x45\x6a\xaa\xbe\xd6\xab\xfb\xfb\x50\xd0\xda\x6b\x8d\xf9\x8b\x6f\x9f\xbd\xe4\xcd\xc5\x1e\xea\x28\x5c\xf3\xf7\x22\xd4\xdd\xec\xee\xba\x11\xda\x57\x7c\xe7\x8e\x0f\x07\x4a\xb7\xec\xbc\xc3\x69\xfe\x1b\xa7\x88\xb2\x25\x16\x47\xdf\x9e\xe8\x20\x5b\x86\x7b\xba\x62\x11\xed\xcc\x53\xf5\xd1\x5a\x4f\x1b\x07\x47\x17\x8b\xe0\xf4\x59\x73\x70\xf4\xbd\x3f\x67\xf2\x1d\x1e\x7c\xef\x29\xeb\x7d\x1a\xb8\x92\x32\x1f\x62\x2e\x3b\x75\x57\x71\x1a\xe9\x9e\x5f\x4e\x51\x16\xcb\xb7\x33\xe6\x4b\xf9\x6d\x68\xbe\xfc\x7c\xc6\x10\x3e\x38\x83\x7f\x3e\x67\x04\x1f\x9e\xc0\x3f\x8b\x9c\x0d\x0d\x5b\x75\xe5\xb6\x25\x6a\xbd\xe6\xf2\xd1\x9c\xd1\xfd\x0a\xb0\x6b\xb7\x33\x9e\x56\xdc\x2e\x65\xca\x2d\x3c\x23\x42\x7f\xca\x45\x39\x01\xa9\x44\x1e\x2b\x6d\x99\x53\xa6\x2e\x67\x48\x08\xb4\x03\x78\x98\x2d\xca\x67\x67\x64\x8c\xeb\x8d\x87\xd9\xa2\x7a\xae\x36\xae\xaf\xaa\x8d\x70\x51\x3d\x37\x21\x52\x46\x95\x6b\xde\x2e\x8a\x74\xeb\xf7\xbe\x4a\xdf\x6a\xbb\xdf\x72\x42\xb0\x18\x7b\xc1\x27\xbc\x75\x5f\x79\xce\x68\x23\x83\xf7\x4c\x61\xc1\x50\xf2\x67\xb4\xc1\xb1\x72\xa3\x9c\x78\xc1\xbd\xb6\xb0\x14\x8e\xfd\x3e\xdd\x17\xb3\x69\x48\x2b\x3a\x14\x79\x47\x08\xed\xd0\xf6\x19\xef\xca\xdd\xff\x40\x59\x25\x65\x80\xf2\xfa\x6a\x8f\xd2\x9a\x46\xb5\xcb\x88\x2a\x59\x9f\xd5\x97\x33\x0f\xca\xc0\x75\x26\xa3\x9c\x04\xb6\xea\x87\xe9\x02\xf4\x8c\x53\xbf\x69\xbd\x6f\xa5\xe9\x61\xba\xe8\x73\x13\xc1\x53\xc3\x1f\x55\xb4\x5e\xed\xa7\xe6\xef\xda\xc3\x1c\xa2\x0e\x7d\xcf\x7d\x97\xff\xfa\xca\xd6\xae\xeb\x5a\xb3\x95\x65\xdd\x18\x57\xe9\xe9\x6b\x2f\x91\x6e\x5f\x42\xb8\xf0\x6e\x6e\x2e\x67\xf0\x72\x08\x30\x5d\x78\x7d\x11\xbd\x20\x7b\xfd\x75\x30\xc8\x72\xc1\x8d\xbc\xfd\xfd\xd0\xde\x87\x37\x6f\xe0\x72\xe6\xed\xa7\xa4\x8d\xca\xf9\xe9\xfc\x1b\x00\x00\xff\xff\xaa\x00\xcc\x0a\xd8\x11\x00\x00"),
+ },
+ "/src/math/math_test.go": &vfsgen۰CompressedFileInfo{
+ name: "math_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 587,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\x31\x6b\xdc\x40\x10\x85\x7b\xfd\x8a\xd7\x39\x26\x77\x27\x0c\x17\x17\x69\xae\x09\x04\x17\xe1\x02\x71\x1f\x46\xab\xd1\xed\x24\xab\xdd\xcb\xcc\xc8\xb2\x08\xf9\xef\x41\x92\x41\x6e\x6e\xbb\x85\xf7\xbe\xf7\xe6\xd5\x35\x3e\x36\x83\xa4\x16\xbf\xac\xaa\xae\x14\x7e\xd3\x85\xd1\x93\xc7\x9f\xce\xe6\x55\x55\xd7\xf8\x91\xe4\x12\xd3\x84\x28\x97\xc8\x0a\x2f\x89\x95\x72\x60\x83\x47\xca\x18\xae\xe6\xca\xd4\xef\x50\x3c\xb2\x8e\x62\x8c\x67\x36\xff\x4a\x7d\x4f\xe8\x48\x92\x1d\x66\xcc\xf3\xf9\xcb\xf9\x33\x9e\x66\x17\x2b\x83\xd0\xb0\x3b\x2b\x46\x9a\xe0\x05\x9d\xbc\x6e\xb6\x13\x9e\xfc\xce\x30\xb2\x68\x3b\xa7\x38\x4a\x4e\x13\x4a\x66\x2c\xb5\xea\x1a\xeb\x53\xfe\x33\x88\xb2\x41\x72\x50\x26\x93\x7c\x79\x57\xf0\x80\xef\xac\x91\xae\x6f\x99\x77\xb6\xa5\x76\xf2\x7a\xc2\x37\x9a\x1a\xc6\xc8\x1b\xcf\x62\x19\x52\x8b\xf2\xc2\xaa\xd2\xbe\x3f\xc4\xae\x1c\xa4\x93\x40\x29\x4d\xa0\xdc\x22\x17\x9f\xb1\x78\x1b\x6d\x3f\xce\xfa\x2d\x7b\xb7\x41\x1b\x0e\x34\x18\xc3\xa3\x18\x46\x49\x09\xeb\xbf\xa7\x3c\xad\xa3\x2d\x57\xd9\x3c\x43\xc3\x48\x6c\x06\x0a\x61\x50\x72\x3e\xe0\xac\xe8\x97\x9e\xb3\x7d\x83\x8a\xa1\x93\xcc\xa7\xaa\x1b\x72\x40\x48\xc5\xf8\x03\xed\xd0\xa0\x4b\x85\xfc\xf1\x78\x8f\xa6\x94\xb4\x48\xff\x42\xd9\x07\xcd\x5b\xbb\x45\xb9\xc3\x91\xf7\x0f\xc7\x7b\xfc\x5b\x19\x2f\xac\xd3\x4d\xce\x4d\xc6\x23\xef\x1f\x3e\xcd\x8c\xff\x01\x00\x00\xff\xff\xc7\x9d\xb5\x9f\x4b\x02\x00\x00"),
+ },
+ "/src/math/rand": &vfsgen۰DirInfo{
+ name: "rand",
+ modTime: time.Date(2018, 4, 20, 9, 43, 49, 187307567, time.UTC),
+ },
+ "/src/math/rand/rand_test.go": &vfsgen۰CompressedFileInfo{
+ name: "rand_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 160,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\xcb\x51\x0a\xc2\x30\x0c\x00\xd0\x6f\x73\x8a\xd0\xaf\x4d\x61\x03\x3d\x82\xe0\x05\xdc\x05\x6a\x57\x4b\x5c\x4d\x4a\x93\x22\x22\xde\x5d\x10\x3f\xfc\xd9\xf7\xe3\x8d\x23\xee\x2e\x8d\xf2\x8c\x37\x05\x28\x3e\x2c\x3e\x45\xac\x9e\x67\x00\xba\x17\xa9\x86\xce\xa2\x1a\x71\x72\x00\xd7\xc6\x01\xa7\xa8\x76\xca\xe2\xed\xb0\xef\x0c\xb7\x3f\x1d\xa6\x1e\x5f\xb0\xb1\xe1\xbc\x50\xe9\x9c\x66\x79\xb8\x1e\xde\x7f\xe7\x28\x1c\x5a\xad\x91\x6d\xbd\x35\x25\x4e\xc8\xa2\x4f\x0e\xdf\xfe\x09\x00\x00\xff\xff\x3d\xb4\x3b\xb8\xa0\x00\x00\x00"),
+ },
+ "/src/net": &vfsgen۰DirInfo{
+ name: "net",
+ modTime: time.Date(2018, 4, 20, 9, 12, 45, 414149374, time.UTC),
+ },
+ "/src/net/http": &vfsgen۰DirInfo{
+ name: "http",
+ modTime: time.Date(2018, 4, 20, 9, 31, 37, 938492727, time.UTC),
+ },
+ "/src/net/http/cookiejar": &vfsgen۰DirInfo{
+ name: "cookiejar",
+ modTime: time.Date(2018, 4, 20, 12, 39, 47, 414045680, time.UTC),
+ },
+ "/src/net/http/cookiejar/example_test.go": &vfsgen۰CompressedFileInfo{
+ name: "example_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 269,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\x41\x4e\xc3\x30\x10\x85\xe1\x75\xe7\x14\x4f\x5d\xb5\x02\x35\x82\x65\x77\xa8\x02\x24\x16\x05\xd1\x03\xd0\xa9\x3d\x21\x6e\x1c\xdb\x78\x26\x0d\x08\x71\x77\x14\xb1\x65\xfb\xf4\xbd\xbf\x69\x70\x75\x1a\x43\xf4\x38\x2b\x51\x61\xd7\xf3\xbb\xc0\xe5\xdc\x07\x39\x73\x7d\x33\x51\x23\x0a\x43\xc9\xd5\xb0\x6c\x07\x5b\x12\xb5\x63\x72\xb8\xff\xe4\xa1\x44\xd9\xcb\xb4\x5a\xe3\x9b\x16\x4d\x83\x24\x36\xe5\xda\x83\x9d\x13\x55\xa4\x6c\xd0\xb1\xcc\x4f\xf1\x38\x7d\xe1\x31\x97\x4e\xea\xd3\xe1\x1a\x9c\x3c\xac\x0b\x8a\x39\x0f\x2f\x45\x92\x57\xe4\x84\xce\xac\xcc\xdb\x66\x2f\xd3\x41\xea\x45\x2a\xd1\xa2\x1d\x6c\xf3\x52\x43\xb2\x98\x56\xc7\xbb\xd6\xa4\xe2\x46\x0d\x55\x3e\x46\x51\xdb\x12\xf0\x10\xf9\x92\xeb\x16\xbb\x2e\xbb\x1c\xd9\x04\xbb\x2e\x14\xfa\xb3\xb7\xc9\xff\x67\x9f\xd9\x06\xe1\x88\x57\x0e\x1a\xd2\x71\x4d\x3f\xf4\x1b\x00\x00\xff\xff\x4a\xaa\xb1\x5a\x0d\x01\x00\x00"),
+ },
+ "/src/net/http/fetch.go": &vfsgen۰CompressedFileInfo{
+ name: "fetch.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 3551,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x56\x5f\x6f\xdb\x36\x10\x7f\x16\x3f\xc5\x4d\xc3\x3a\x29\xb5\xa5\x16\x28\xfa\xe0\xc5\x0f\xa9\x9b\x76\xc1\xda\xa5\x48\xb2\xa7\x20\x18\x68\xe9\x24\x31\x91\x48\x85\xa4\x92\x18\x81\xbf\xfb\x70\xa4\x24\xcb\x49\xda\x62\x01\xea\x4a\xe2\xf1\xee\x77\x77\xbf\xfb\x93\xa6\xf0\x7a\xdd\x89\x3a\x87\x6b\xc3\x58\xcb\xb3\x1b\x5e\x22\x54\xd6\xb6\x8c\x89\xa6\x55\xda\x42\xc4\x82\x10\xb5\x56\xda\x84\x2c\x08\x8b\xc6\xd2\x7f\x42\xf9\xdf\x54\xa8\xce\x8a\x9a\x5e\x8c\xd5\x99\x92\x77\x21\x63\x41\x58\x0a\x5b\x75\xeb\x24\x53\x4d\x5a\xaa\xb6\x42\x7d\x6d\x76\x0f\xd7\x26\x64\x31\x63\x69\x0a\xc6\x6a\xe4\xcd\x19\xf2\x1c\x35\x88\xa6\xad\xb1\x41\x69\x0d\x70\x09\x42\x25\xf4\x7d\x55\x2b\x83\x1a\xee\x35\x6f\x5b\xd4\x50\x28\x0d\xf4\x99\xaf\x6b\x3c\x77\x97\x41\x15\x0e\xae\x59\xa4\x69\x81\x36\xab\x12\xd3\x62\x96\xdc\x57\xdc\xde\x97\x89\xd2\x65\x9a\x30\xbb\x69\x71\xdf\x96\xb1\xba\xcb\x2c\x3c\xb2\xa0\x45\x99\x0b\x59\xc2\xe5\xd5\x7a\x63\x91\x05\x5e\x0c\xe0\xe0\xda\x24\xa7\xeb\x6b\xcc\x2c\xdb\x32\x56\x74\x32\x83\x48\xc3\xc1\x54\x4b\xec\xa0\x44\x6d\x7f\x37\x86\x48\x82\x90\x76\x06\xa8\x35\xb8\x88\xc5\x64\x41\x14\x50\xa3\x8c\x74\xd2\x9b\x8a\x61\xb9\x84\x37\x74\x12\xdc\x71\x4d\xe1\x0d\x82\xf5\xaa\x02\x80\x25\x34\xfc\x06\xa3\xac\xe2\x72\xd0\x49\x87\xa8\xf5\xaa\xda\x3b\xf4\xca\x59\x10\xd0\x3f\x9d\x78\x50\xc9\x8a\xd7\x75\x14\x6a\xe4\x79\x18\xf7\x2f\xb6\x42\x19\xce\x48\x09\x79\x10\x69\x34\x5d\x6d\x27\xbe\x39\x80\x41\x40\x18\xfd\x59\xf2\x19\x6d\x14\xe6\x4a\x62\x18\x27\x1f\x94\xaa\xa3\x41\xa4\x87\x71\x38\xa7\xd4\x1c\x9f\x7e\xf2\x1f\x35\xda\x4e\x4b\xf7\xbc\x75\xbf\x6b\x2f\x33\xd5\x76\xc7\xeb\x8e\xd4\x9d\x48\x8b\xba\xe0\x19\x46\x71\x12\x4d\xfc\xdb\x4e\x01\x72\xa3\xe4\x0b\x00\xd3\x14\x8e\x8c\xe9\x1a\x34\x20\xec\xef\x06\x38\x7c\x3c\xfd\x7a\xfc\x90\x61\x6b\x85\x92\x09\xdb\x03\xe8\xd9\x9a\xfc\x8d\xf7\xbd\x42\x8f\xa3\x41\x63\x78\x49\x48\xce\xad\x16\xb2\x8c\xe2\x9d\x79\x7a\x32\x58\xa3\x27\x45\x90\x71\x83\xb0\x86\xc5\x12\x0e\xe7\xeb\x55\xb5\x20\xb9\x31\x81\xb0\x84\xf5\x20\x43\xa9\x76\x52\xce\xb8\x97\x73\x21\x81\x37\x8e\x07\xcc\xc5\x65\xcb\x02\x09\x4b\xc8\x54\xbb\x89\xda\x19\xec\xa8\xc0\xf6\xb4\x8e\xcf\x97\x72\x71\xc5\x06\x45\x72\x06\x52\xd4\x3f\x60\xa1\xab\x91\x28\xf6\x6e\x13\xfc\x34\x85\x8b\x4a\x18\x10\xa5\x54\x1a\xa9\x9c\x36\xfd\xa1\x57\x89\x39\x14\x5a\x35\x90\x71\x99\x61\x0d\x0d\xda\x4a\xe5\x09\x9c\x2b\x28\xb8\x9e\xc1\x09\xe4\x22\x07\xa9\x2c\xa0\xcc\x54\x47\x59\x73\x2a\x32\x25\x33\x8d\x54\x24\x54\xba\xc2\x76\x9c\x62\x0f\xf7\x15\x6a\x04\x8d\xd4\x2c\xc8\x0f\x5b\x61\x6f\x4d\x18\x68\x90\x4b\x21\xcb\xa2\xab\x13\xf8\xaa\x8c\x85\xce\xa0\x1e\x90\xf5\x62\x0e\x8b\x46\xd3\x26\x1f\x54\xbe\x49\x7a\x77\x12\x67\xe6\xa4\x20\x7d\x1a\x5d\xca\x25\x62\x0e\x56\xf5\xb6\xfa\xdb\x74\x3a\x03\x61\xc9\x1b\x58\xe3\xae\x8d\x60\x0e\x5c\xe6\x60\xd1\xd0\xe3\x7d\x85\x12\x6c\xc5\xad\xd7\x92\x29\xa2\x52\xd7\x26\xec\x69\xfd\xf8\xa0\x84\xf1\x2e\xfe\x3e\xf8\x69\x0a\xae\xbf\x5c\x68\x2e\x8d\xb3\x2f\x08\xd3\x99\xea\x64\x7e\xa1\x85\x6b\x4f\x4e\x3f\x05\x7e\x82\xa1\x33\x14\x94\x4f\x74\x15\x8e\xbe\x9d\x24\x70\x62\xc1\x74\x2d\x69\x30\x7d\x53\x12\xb2\x24\xf5\x14\x02\x25\x89\x78\x2a\x17\x68\xfa\xbe\xf5\xc4\xa8\xef\x5c\x8f\x23\x1b\x2c\x1c\xec\x4b\xc4\x3b\x48\x91\xc6\x5b\x38\x38\xc3\xdb\x0e\x8d\x8d\x21\x3a\x38\xeb\x2d\xcc\x26\xed\xa9\x72\x2c\x32\xc4\xe2\x6b\x93\x7c\xae\xd5\x9a\xd7\xbe\x5e\xfe\xf4\x27\x61\xec\x2a\x29\x66\x01\x75\xdf\x1b\xdc\xcc\xc0\x55\xb4\xbb\xa2\xb9\x2c\x29\xf9\xb7\x89\x97\x76\xd5\x43\x72\xff\xf6\x52\x3b\xa1\xfe\x92\xab\xe7\xde\x68\x1f\x72\xea\xed\x32\x0f\x67\x13\xe5\xf1\x58\x38\xaa\xb5\xa4\xa3\xe1\xed\xa5\x71\x65\x7b\x25\x86\x3e\xf2\xb8\x25\x65\xa1\xe7\x6f\xb8\x00\xf7\x47\x58\xbe\xba\x2f\x54\xd7\x61\x6f\xa9\x3f\xed\xdf\xdc\x49\xa6\x31\x47\x69\x05\xaf\xe9\x34\x34\xbc\xc1\xb9\xd2\xa2\x14\xae\x63\x6e\x99\x6f\x8a\xb7\x8e\x94\xf0\xcb\x92\x78\xe0\xc0\x53\x75\x9d\x7e\x3c\x5d\xc0\x27\x21\x73\x50\x9d\x05\x2f\x48\x41\xa6\xd4\x6d\x06\x26\xfa\xe4\x62\x4e\x43\x41\xb9\xb2\x70\x99\x1a\x65\x35\x27\x6a\x13\x69\x68\x6e\x00\xcf\xef\x88\x7a\x8e\xd0\x89\xb7\xe3\xff\xce\x11\xe1\x43\x57\x14\xa8\xcf\x55\xa7\x33\x04\x6e\x7f\x32\xf2\x7e\x25\x18\xf3\x46\x3c\x08\xd7\x1a\xe9\x6d\x36\xb4\x2a\x3f\xb0\xdd\x70\x3d\xaa\xeb\x68\xf0\x90\x02\x2e\x0a\x27\x34\xf1\x35\x18\x8e\x87\xaa\x84\x34\xdd\xf1\x0b\x9a\xce\x58\xe0\xf5\x3d\xdf\x18\xc8\x48\xc0\x79\xe9\xcd\x09\x99\xd5\x9d\x6b\x6c\x4a\x0e\x1d\x79\xd2\x1e\xa5\xa8\x27\x0d\xf2\x99\x1d\x16\x50\xe2\x2f\x43\xd2\x15\x5e\x51\xc7\x55\xf9\xc6\x65\x85\xaa\xe4\x9b\x56\x8d\x30\xb8\xcf\x59\xcf\x25\x17\x90\x70\xe6\x32\xf7\xcf\xd9\x97\xb1\xd5\xcf\x40\xb5\x36\x66\x6c\x9c\xb9\xa4\xe7\xc9\x58\x1d\xeb\x83\xcc\xfb\x69\xf2\xe2\xd8\x8d\xf7\x50\x3c\x1d\xb5\x3f\x9c\xb4\x9e\x80\x04\xdc\xd7\xcb\xe3\xd6\xc7\x64\x37\x2d\xab\xb1\xea\x7a\x87\x94\x3e\xe6\xce\x25\xa7\xd8\x55\x87\xab\x94\x17\xa6\x64\x76\x43\x9a\x57\x5c\x2a\x29\x32\x5e\x7b\x13\x7f\xe1\x26\xba\xc1\xcd\xfe\xd0\xeb\x81\x5c\x66\x37\x14\x5c\x5f\x80\xd1\xee\x5b\x5f\x85\x4f\x06\x25\x85\x2f\x08\x32\x25\x2d\x4a\xfb\x05\x65\x69\x2b\xc7\x28\x69\xdf\xbf\x8b\xe6\x6f\x9d\x90\x28\x20\xab\x47\xb2\xf5\x3b\x61\xf2\x8d\x6b\x83\x27\xd2\xf6\x26\xbc\xa7\x2b\xaf\x68\xee\x35\x85\xf1\x0c\xde\xbe\x99\xc1\xfb\x77\xf1\x1f\xee\xfa\x72\x42\xc3\x27\x46\x97\x90\xd5\x0e\x91\x03\x34\x99\xdb\x7e\x28\xf7\xa9\x3d\x9c\xc3\xab\x21\xa3\x5e\xcb\xb9\xe5\xb6\x33\x7d\xa3\x80\xbd\x25\xc5\xb8\xa3\xc9\x6e\x00\xaf\x21\x84\x10\x5e\x83\xbf\x74\x81\x0f\x36\x7a\xf1\x02\xb9\x15\xc7\xb3\x89\x81\x95\xca\x71\xf1\x5d\x03\x4e\xde\x8b\xfb\x04\x8d\x78\x7c\x70\xfc\xd1\x6a\xea\xf0\x02\xf6\xfc\xf7\x12\x54\x2e\xe3\x55\x80\x57\xd3\xa5\xe0\xd1\xbf\x2c\xf6\x10\xb8\x5a\x1a\x68\x55\xa2\xf5\xa2\x61\xec\xf7\xaf\xa0\x9f\x13\x8b\x31\x38\xb7\xee\xfb\x76\x31\xc6\xf5\x70\x4e\x55\xe5\x90\x3d\xd8\x28\x4e\x3e\x2a\x89\x51\xbc\x60\xfd\xf2\xb7\x9d\xb0\xff\xe5\x35\xee\x59\xa6\xc6\x95\xad\x68\x6c\x72\x4c\xe5\x55\x44\xa1\x44\x9b\x52\x7f\x5b\xf8\x7e\x19\xc5\x50\x70\x51\x63\xbe\x80\xdf\x8c\xab\x6c\xb7\xd2\x8d\xd4\xfc\x5f\xf8\x62\x36\x01\xf1\x93\x4b\x63\xa3\x3f\x5a\xd3\xe4\x1d\xda\xb6\x28\xa0\x55\xc6\x88\x75\x8d\xcf\x86\x3b\x7b\xd6\xdf\x86\x45\x74\xe2\xd5\xa0\xc8\x6f\x1a\x98\xd3\xae\x31\xf2\xd6\x6f\x93\x9e\xc1\x8b\x9d\x3a\xfa\xe0\xf7\xc0\xef\xed\x9d\xcf\xfa\xea\x96\x6d\xd9\x7f\x01\x00\x00\xff\xff\xcd\xea\xf8\xb6\xdf\x0d\x00\x00"),
+ },
+ "/src/net/http/http.go": &vfsgen۰CompressedFileInfo{
+ name: "http.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 2998,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x56\x61\x6f\xdb\x36\x10\xfd\x2c\xfe\x8a\xab\x06\x04\x52\xaa\xc8\x0d\x50\x74\x43\x1a\x63\xc8\xd2\xae\x09\xd0\x74\x85\x93\x02\x05\xba\xa2\xa0\xa5\x93\xc4\x84\x26\x15\x92\x8a\xe3\x15\xfe\xef\xc3\x91\xb2\x22\x3b\xe9\x86\x2d\x5f\x42\x93\xc7\xbb\x7b\x8f\xef\xee\x34\x99\xc0\xf3\x79\x27\x64\x09\xd7\x96\xb1\x96\x17\x37\xbc\x46\x68\x9c\x6b\x19\x13\x8b\x56\x1b\x07\x09\x8b\xe2\x79\x57\x09\x1d\xd3\x62\xe5\xd0\xd2\x02\x8d\xd1\xc6\xaf\x84\x9e\x08\xdd\x39\x21\xe9\x87\x42\x37\x71\x78\xef\x5a\xa3\x9d\xbf\x60\x9d\x29\xb4\xba\x8b\x19\x8b\xe2\x5a\xb8\xa6\x9b\xe7\x85\x5e\x4c\x6a\xdd\x36\x68\xae\xed\xc3\xe2\xda\xc6\x2c\x65\xec\x8e\x1b\x78\x83\x15\xef\xa4\xbb\x32\x5c\x59\x9f\xc2\x14\xaa\x4e\x15\x49\x0a\x33\xdd\xa9\xf2\xca\x88\xb6\x45\x03\xdf\x59\x64\x97\xc2\x15\x0d\xad\x0a\x6e\x11\xae\x6d\xfe\x4e\xea\x39\x97\xf9\x3b\x74\x49\x5c\xa1\x2b\x9a\x38\x85\x67\x53\x3a\xf9\xa4\x4a\xac\x84\xc2\x12\xf6\xf6\x76\x2d\x67\xc8\x4b\x3e\x97\x78\xe9\x0c\xf2\xc5\xe3\x2b\x47\x30\x99\xc0\xb6\x11\x08\x0b\x9d\xc5\x12\xb8\x05\x0e\x45\x83\xc5\x0d\x54\xda\x80\xed\x5a\x9f\xb3\xae\xc0\x7a\x43\xa1\x6a\x30\x68\x5b\xad\x2c\xc2\x5c\x97\x02\x6d\x06\x16\x03\xcb\xf6\x68\x32\xf1\x69\xe6\xb6\xc5\x22\x5f\x36\xdc\x2d\xeb\x5c\x9b\x7a\xf2\x53\xb8\x6d\x73\x16\x45\x06\x5d\x67\x14\xec\x79\xcb\x81\x96\xef\xeb\xa7\x61\x7f\xbe\x78\x7f\xe6\x5c\x3b\xc3\xdb\x0e\xad\x7b\x02\xcc\xc8\xe3\xe7\xb3\xd9\x96\xbf\x32\x50\x3f\x32\x51\x7a\xcb\x60\xcd\xd6\x49\xca\xd8\x64\x32\x3e\x18\xb8\x58\x36\xa8\x40\xa1\x70\x0d\x1a\xf8\x9d\xb2\x85\x93\x8f\xe7\xa0\xb4\x81\xed\xac\xfc\x36\x37\x08\xfc\x8e\x0b\x49\xac\xe6\x70\xee\x80\xcb\x25\x5f\x59\xa8\xb8\x90\x36\x67\x6e\xd5\xe2\x56\x18\xeb\x4c\x57\x50\x1a\x8c\xf4\x00\xc9\xe8\x6c\xa4\x8d\xc4\xe0\x2d\xec\xf7\x81\x52\x48\xf6\x67\x3d\xfb\x19\x78\xd5\xa6\xa4\x97\x0d\x3a\x21\xfb\x5d\x9b\x7f\xc0\x65\xe2\x05\x4c\x0f\x73\x34\xc0\xd0\x55\x8f\xe4\x69\x14\x96\xc0\x0f\x28\xe2\x94\xad\x59\x48\x7c\x4c\x6d\x9f\x39\x05\x16\xaa\x92\xa2\x6e\x1c\x2c\x78\xfb\x65\x93\xe5\xd7\xfd\x6b\x9b\xff\x31\xbf\xc6\xc2\xb1\x01\x9d\x83\xfd\xb1\x8f\xff\x8a\xf0\xbe\x31\x70\x34\xfd\x37\x71\x78\xd4\x29\x63\x91\xa8\xc0\xe5\x43\x72\xd3\x29\x51\x43\x6e\xa2\xf1\xee\x8f\x92\x0e\xca\x18\x99\x7e\x31\x78\xfb\x15\xa6\x70\xdf\x18\x2f\x2a\x34\x50\xa2\x44\x87\xc9\x83\x4d\x06\x06\x6f\x29\x34\x55\xc7\x69\x43\xc9\x2e\xf8\x0d\x26\x45\xc3\x15\x0c\x90\x52\x16\xa1\x31\xbb\xc7\x01\x26\xf3\x28\xf3\x4b\x02\xa6\x95\xd4\xbc\x8c\xb3\x4d\xab\xa0\xd4\x1b\xe4\x25\x9a\x0c\xbe\xd1\xe5\xa1\x2d\x11\xe4\x99\x3f\x49\x7c\x5f\x1b\xff\xa6\xf6\x36\xfa\xfd\xe5\x2b\xed\x24\x14\xe4\x94\x4b\x99\xc4\x35\xba\x13\x29\x37\xb9\x9d\x79\x2b\x1b\xa7\xf9\xa5\x33\x42\xd5\x49\x0a\xcf\x21\xfe\x53\xc5\x69\x9a\xa6\x39\xf9\xb8\x38\xbf\x78\x1b\xac\x92\x94\x45\xd1\x5c\x97\xab\x27\x1e\xe5\x93\x50\xee\x97\x13\x63\xf8\xaa\x7f\x10\x0a\xe8\x4f\x36\x8d\x23\x4e\xd3\xfc\x5c\x39\x34\x15\x2f\x30\x49\xf3\x3e\x33\x62\x20\x2a\xb4\x72\xa8\xdc\x7b\x54\xb5\xf3\x34\x09\xe5\x5e\xbd\x4c\x0e\x0e\x29\x62\xdf\x21\x0d\xde\xe6\x17\xe8\x1a\x5d\x7a\x62\x7c\xdb\x88\xcf\xde\x9e\xbc\x89\xa9\xd4\xe9\xf1\x43\x1d\xd0\xf5\xbe\x65\xe7\x1f\xb9\xb1\x78\xae\x5c\x12\x68\x0c\x09\x9d\x86\x60\x07\x21\x5a\x9c\x66\x70\xf8\x22\x83\x57\x2f\xd3\xd7\xfe\xfa\x48\x37\xbb\x89\x4d\x41\xd2\xee\x9a\x45\xe3\x2e\xf3\xc8\x28\x24\x2f\x51\x25\x44\x56\x4a\x18\xd6\xcc\xb7\x23\x2f\x92\xe3\x03\xd8\xdb\xd0\xef\xa3\x5c\x3a\xee\x3a\x7b\x04\xfd\xdf\xc0\x9c\xf5\xfb\x3b\x4f\x03\x31\x3c\xdf\x35\xb9\xc2\x7b\x37\x32\xcb\x1e\x9c\x9e\xea\x12\x8f\x9e\x76\x4a\xb4\x04\xd3\xf0\xba\x43\xfc\xfe\xb1\x03\x65\xc1\xe2\x74\x8c\xf0\x08\xb6\x00\x7b\x83\xdf\x74\xb9\x1a\x1c\x00\x84\x69\x9a\x7f\xd0\xed\xa9\xd4\xf6\x09\x55\x06\x62\xfc\xd5\xbe\x14\x37\xb7\x0d\xde\x66\x9e\xb0\x68\xbd\x53\x1c\xbe\x60\x36\xd5\x81\xf0\x50\xba\xa1\x52\x42\x89\x1d\x1f\xfc\xa0\x17\xee\xb4\x3d\xea\xcf\x58\xc6\xe9\xe3\x30\x7c\xae\x8d\xfb\xdf\x61\x4c\xef\xbf\xe0\xaa\xc0\xdd\x08\xa1\x00\x75\x8b\x2a\xce\x46\x7a\x0e\xeb\x4f\xb3\xf7\xc3\x0b\xa6\xa3\x8c\x36\xf5\x73\xb5\x6a\x31\xce\x20\xe6\x54\x64\xf3\xae\xaa\xd0\xc4\x29\x0d\xf5\x86\x5b\x70\x1a\xe6\x08\xbc\x72\x68\x20\x04\x80\x4e\x39\x21\x87\x09\x3d\xef\xea\xbf\x84\x94\x3c\x5f\xe8\xf0\x9f\x06\xb4\x6d\xf4\xf2\xdb\xbc\xab\xf3\xa2\x16\xbf\x8a\x72\x7a\x78\x78\xf8\xe2\xe7\x57\x87\x34\x0e\x0c\x5a\x2d\xef\xb0\x64\x11\x7d\x11\xdc\xe0\x2a\x83\x3b\x2e\x3b\xb4\x54\x5e\x86\xab\x1a\x7d\xd2\x41\x2b\x9e\x18\xb2\xfb\xd6\x5b\x3d\x18\xf5\x97\xbc\xce\x1f\x28\xb0\xe8\xfa\x87\x08\x0e\xe2\x6c\x14\x22\xed\x9f\xdf\x37\x74\x0a\x42\xe2\x1a\x97\xe5\xd8\x8f\x0a\x0c\x03\x4a\x8b\xfe\x90\x94\x35\xf4\x81\x5e\x87\x24\xba\x13\x29\x93\x8d\x33\x8a\x20\x2a\x6f\xf4\x6c\x54\xed\x9b\xe3\xdc\x8b\x36\xf1\xe4\x0e\x03\x0b\x16\x9d\x1d\xa6\x7b\x41\x06\xe0\x1a\xff\x35\xb4\xca\x40\xa8\x42\x76\x25\x7d\x26\x69\xb5\x11\x46\xf0\xb8\x35\xa2\x03\xb0\x47\x71\x1e\x43\xca\xbc\x5f\x02\xc6\x58\x64\x51\x62\x18\xbc\xbe\xe7\x91\x1e\x08\xdb\xf1\x41\xe8\x27\xa3\x0f\x1d\xda\xc8\x28\x5a\x6f\xda\xb3\x70\x7c\xe0\x45\x3b\xfe\x22\x1a\x12\x5a\xff\xc3\xb0\x3e\xf5\x1a\xee\x1f\x6a\x67\x60\x7f\xf7\xaf\x73\xdf\x98\x0c\xf4\x8d\x9f\x4d\xdb\x83\xf3\x35\x6d\x6f\x3f\x56\x28\xac\x34\xc4\xfc\x3b\x00\x00\xff\xff\x05\x0b\xbb\x60\xb6\x0b\x00\x00"),
+ },
+ "/src/net/net.go": &vfsgen۰CompressedFileInfo{
+ name: "net.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 1122,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x92\x41\x6f\x1a\x3d\x10\x86\xcf\xf8\x57\xcc\xe7\x93\xfd\x75\xbb\xa8\x52\xd4\x43\x25\x0e\x0d\xad\x22\xaa\x36\x44\x42\x6a\x2b\x45\x39\x78\xbd\xb3\x1b\x83\xb1\xb7\x1e\x6f\xc3\xaa\xe2\xbf\x57\x5e\x76\x49\x02\x5c\x7b\xc2\x0c\x33\xcf\xfb\x68\x86\xe9\x14\xde\x14\xad\xb1\x25\xac\x89\xb1\x46\xe9\x8d\xaa\x11\x1c\x46\xc6\xcc\xb6\xf1\x21\x82\x60\x13\x8e\x21\xf8\x40\x9c\x4d\x38\x75\xa4\x95\xb5\x9c\xb1\x09\xaf\x4d\x7c\x6c\x8b\x5c\xfb\xed\xb4\xf6\xcd\x23\x86\x35\x3d\x3f\xd6\xc4\x99\x64\xac\x6a\x9d\x86\xaf\x86\x22\x3a\xe1\x30\x66\x60\x55\x59\x06\xa0\x18\x8c\xab\x25\x88\xc3\x4f\x18\x32\xe8\x33\x24\xfc\x61\x93\x46\x39\xa3\xc5\x21\x33\xbf\xc5\x27\xc1\x1d\xc6\x27\x1f\x36\xa0\xb4\x46\x22\x30\x04\xce\x47\xa0\xb6\x49\x86\x58\x42\xd1\xc1\x4d\x1f\xfc\x65\xc5\xa5\x64\xfb\x21\x57\x94\xf0\xff\x27\xa3\x2c\x06\x09\xe9\x53\x0c\x9c\x0c\x92\x44\x22\x1d\x3d\xe6\xde\xb9\x7f\xe2\x40\x1d\x2d\x9c\x89\x22\x51\xc7\x5a\x13\x7c\x81\x8b\xbb\xdf\x57\xab\xa8\xf4\x46\x48\x28\xbc\xb7\x29\x35\x60\x6c\x83\x83\x4a\x59\xc2\xb3\xee\xf7\x63\xb7\x18\x42\x29\x15\x33\x78\xf1\xed\x6a\xab\x9a\x1e\x26\x4f\x69\xd9\x25\xe8\x0f\xe3\x4a\xff\x44\x8b\xbb\x33\xf2\x77\x43\x51\x2d\xee\x2e\xb3\x8e\x90\xad\xda\x8d\xf7\xbb\x56\x7a\x63\x7d\x2d\x24\x18\x17\x5f\x0c\x0c\xff\x97\x7c\xb5\xfc\xf6\xf1\xe7\x7c\x79\x7b\x9b\x86\xa7\x53\x98\xfb\xa6\x03\x5f\x0d\x07\xa0\x7c\xe1\x4a\xdc\x5d\x77\x11\xf3\x03\xba\xe8\x22\xf6\x35\x31\x1e\x29\x83\x43\xf5\x34\x61\x9d\x86\x23\x06\xa7\xec\xb2\x58\xa3\x8e\x82\x64\x3e\x57\xd6\x0a\x6e\x12\x60\x59\xf1\x2c\x35\xdd\x58\x5f\x28\x9b\xdf\x60\x14\x7c\xd5\x13\xf9\xd8\x57\x05\xbf\x9d\x3f\xaa\x30\xf7\x25\xf2\x0c\xb4\x94\x09\x29\xe4\x89\x6b\x4a\xa7\xfc\xf3\xaf\x56\xd9\x17\x96\xd4\x17\xc4\x2e\x83\x0e\xee\x1f\x0e\x86\xe3\x3d\x4d\x05\x16\x9d\xd8\x49\xf8\x6f\xd6\xbf\xba\x7e\x99\xaf\xb7\x39\xd9\xb3\x49\xe5\x03\x98\x0c\x0a\xf8\x30\x83\xa0\x5c\x8d\xb0\xeb\x1b\x4d\x05\x45\x9a\xed\xee\xcd\x43\x5f\x38\x19\x4d\xb3\xfb\xe3\x2a\x62\x68\xf1\xa2\xf3\xa5\xed\xd2\xb1\x28\x68\x10\x3f\x5b\xf1\xb9\x16\x3d\x6b\xcd\x66\xa0\x5f\x39\x99\x53\x9f\xb7\xef\xd8\x9e\xfd\x0d\x00\x00\xff\xff\x93\x28\xa9\x7f\x62\x04\x00\x00"),
+ },
+ "/src/os": &vfsgen۰DirInfo{
+ name: "os",
+ modTime: time.Date(2018, 6, 29, 21, 3, 27, 551348355, time.UTC),
+ },
+ "/src/os/os.go": &vfsgen۰CompressedFileInfo{
+ name: "os.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 581,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x91\x4f\x6b\xdc\x30\x10\xc5\xcf\x9e\x4f\x31\xd5\x49\x62\x5b\x3b\xb9\x76\x6b\x4a\x28\x61\x5b\x28\x2d\xb4\x94\x1e\x42\x28\xfe\x33\xd6\x8e\x23\x4b\x46\x92\x9b\x85\x65\xbf\x7b\x91\xd6\x4e\x21\xe0\x83\xd1\xfc\xde\x9b\x99\x37\x55\x85\xbb\x76\x61\xd3\xe3\x18\x00\xe6\xa6\x7b\x6a\x34\xa1\x0b\x00\x3c\xcd\xce\x47\x94\x50\x08\xf2\xde\xf9\x20\x00\x0a\xa1\x39\x1e\x97\xb6\xec\xdc\x54\x69\x37\x1f\xc9\x8f\xe1\xff\xcf\x18\x04\x28\x80\x61\xb1\x1d\xfa\xc5\x46\x9e\xe8\x4f\xe3\x75\x90\x0a\x1f\x1e\x43\xf4\x6c\x35\x9e\xb1\xaa\xd0\xba\x88\x5d\x63\x0c\xf5\xe8\x2c\xfe\x66\xdb\xbb\xe7\x00\x85\xa7\xb8\x78\x8b\x77\x5e\x07\xb8\xac\x3e\x6c\x39\x4a\x85\x67\x28\x78\xc0\xd9\xbb\x8e\x42\xc0\xf7\x35\x8e\xa1\x3c\x18\xd7\x36\xa6\x3c\x50\x94\x62\xad\x08\xb5\x7f\x81\xde\x64\xe8\x97\xed\x69\x60\x4b\x7d\xb2\x28\x1a\xaf\xff\x26\xf5\xca\x5c\xb5\xe9\x51\x28\x28\x8a\xd4\x18\x6b\x9c\x9a\x27\x92\xdb\xc0\x6f\x31\x95\xcb\xaf\x64\x75\x3c\x4a\xf5\xee\x36\x81\x83\xf3\xc8\xc9\xe7\x66\x8f\x8c\x1f\x5e\x23\x7b\xe4\xdd\x2e\xf7\xcb\x96\x0f\xfc\x88\xf5\x95\xf9\x62\x7b\x3a\x49\xc6\x1d\xde\xaa\xf2\x67\x6e\x20\x93\xe1\x05\xd2\xc7\x03\x1a\xb2\x32\x69\x14\xd6\x35\xde\x64\x8f\x75\xaa\x6d\xa0\xb3\xf8\x28\x32\x7e\x79\x95\x74\x4b\x83\xf3\x74\x7f\xba\xe6\xb5\x55\xe9\x44\xdd\x12\x9b\xd6\x90\x54\x28\xb7\x9d\xf2\x45\x73\xaa\x6b\xe6\x42\xac\x8f\xa1\xfc\x46\xcf\x52\xdc\xbf\xc8\xf2\xb1\x78\x9a\x0d\x4d\x64\x23\xf5\x98\x96\x3f\x7c\xbf\xfb\xf1\xe9\x73\x3d\x06\xa1\xe0\x02\xff\x02\x00\x00\xff\xff\x55\xfc\x3a\xb3\x45\x02\x00\x00"),
+ },
+ "/src/os/signal": &vfsgen۰DirInfo{
+ name: "signal",
+ modTime: time.Date(2018, 4, 20, 9, 32, 51, 274055626, time.UTC),
+ },
+ "/src/os/signal/signal.go": &vfsgen۰CompressedFileInfo{
+ name: "signal.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 233,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\xce\xbf\xca\xc2\x40\x10\x04\xf0\x7e\x9f\x62\xca\x84\x0f\xbe\x13\xad\x2d\xc4\x42\x3b\xc5\x17\x90\x4b\xb2\x09\x1b\x2f\x7b\xe1\xfe\xd8\x84\xbc\xbb\xa0\x69\x22\xd8\xce\x6f\x60\xc6\x18\xfc\x55\x59\x5c\x83\x3e\x12\x8d\xb6\x7e\xd8\x8e\x11\xa5\x53\xeb\x88\x8c\xc1\x75\x15\x41\x22\xd4\x27\xc8\x30\x3a\x1e\x58\x13\x37\x68\x7d\xc0\xe9\x72\xb8\x1d\xcf\xfb\x3e\xfe\x13\xb5\x59\xeb\xa5\x7e\x6f\x24\xda\xca\x71\x91\x45\xd3\x6e\x5b\x62\x9a\x57\xcc\xba\xd2\x6f\x96\x4e\x7d\xf8\xcd\x81\xeb\x67\x51\xe2\xc3\x00\x26\x04\x4e\x39\x28\x36\x98\x97\x1b\xce\xfb\xb1\x78\xcf\xbe\x02\x00\x00\xff\xff\x29\x0b\xd3\x08\xe9\x00\x00\x00"),
+ },
+ "/src/reflect": &vfsgen۰DirInfo{
+ name: "reflect",
+ modTime: time.Date(2018, 10, 3, 5, 41, 59, 483905749, time.UTC),
+ },
+ "/src/reflect/example_test.go": &vfsgen۰CompressedFileInfo{
+ name: "example_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 311,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8d\xcf\x4a\x33\x31\x14\xc5\xd7\xbd\x4f\x71\xc9\xe2\xa3\xe5\x93\xa4\x95\xba\xe8\xec\x5c\x88\xe2\xa6\x62\x1f\xc0\xa6\x93\x9b\x3f\x75\x92\x0c\xc9\x8d\x08\xa5\xef\x2e\x33\x22\x82\xbb\x03\xbf\x73\xce\x4f\x29\xfc\x7f\x6a\x61\x30\x78\xae\x00\xa3\xee\xdf\xb5\x23\x2c\x64\x07\xea\xf9\x8d\xa9\x32\x40\x88\x63\x2e\x8c\xc2\x46\x16\x00\xb6\xa5\x1e\x1f\x3e\x75\x1c\x07\x3a\x70\x69\x3d\xef\xed\x72\x85\x17\x58\x28\x85\x8f\x79\xf4\x54\x9e\x0f\x68\x32\x55\x4c\x99\x31\x4c\xbd\x48\x89\x7f\x4e\xa5\x36\xe6\xf5\x3b\xee\xad\xc5\x44\x64\xc8\xa0\xcd\x05\xd9\x87\x8a\x93\x52\xce\x5f\x07\x22\xf4\xcc\x63\xed\x94\x72\x81\x7d\x3b\xc9\x3e\x47\xe5\x66\xc5\xb9\xfe\x86\x50\x6b\xa3\xaa\xb6\xbb\x1d\xc0\xc2\x46\x96\x2f\x25\x24\x1e\xd2\xf2\xf8\xa1\x87\x46\x1d\xfe\xbb\x3c\x51\x70\x9e\xbb\xb5\xdc\xe2\xbd\xa3\xee\xf6\x0a\xe7\x9a\x53\x87\x78\x11\x7e\x46\x62\x62\x37\x42\x3b\x12\x13\xfd\x3b\xdc\xc8\xbb\x79\xb8\x59\x5f\x8f\x2b\xb8\xc2\x57\x00\x00\x00\xff\xff\x0d\x48\xa9\x1a\x37\x01\x00\x00"),
+ },
+ "/src/reflect/reflect.go": &vfsgen۰CompressedFileInfo{
+ name: "reflect.go",
+ modTime: time.Date(2018, 10, 3, 5, 44, 40, 711530110, time.UTC),
+ uncompressedSize: 34990,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\x7f\x73\xdc\x36\xb2\xe0\xdf\x33\x9f\x02\x9e\xda\xd2\x23\x6d\x3e\xca\xa3\xec\xa5\x52\x8a\x95\x57\x1b\x27\xd9\xd3\x6e\x6c\xa5\xa2\x75\xee\xea\xf4\x54\x7e\x10\x07\x1c\x41\xc3\x01\xb9\x24\x66\xac\x89\xa4\xef\x7e\x85\x6e\xfc\x26\x39\x92\x9c\xec\xdd\xd6\xab\xcd\x1f\xb1\x04\x02\x8d\x46\x77\xa3\xd1\xbf\x00\x1d\x1e\x92\x57\x57\x1b\x5e\x2d\xc8\x4d\x37\x9d\x36\xb4\x58\xd1\x25\x23\x2d\x2b\x2b\x56\xc8\xe9\x94\xaf\x9b\xba\x95\x24\x99\x4e\x66\xac\x6d\xeb\xb6\x9b\x4d\x27\xb3\x4e\xb6\x45\x2d\xb6\xea\xc7\x8d\xe8\x68\xc9\x66\xd3\xe9\x64\xb6\xe4\xf2\x7a\x73\x95\x17\xf5\xfa\x70\x59\x37\xd7\xac\xbd\xe9\xdc\x0f\x37\xdd\x6c\x9a\x4e\xa7\x5b\xda\x12\x2e\xb8\xe4\xb4\xe2\xbf\xb2\x05\x39\x21\x25\xad\x3a\x36\x9d\x96\x1b\x51\xc0\x97\x24\x25\x77\xd3\xc9\xe1\x21\xa1\xdb\x9a\x2f\xc8\x82\xd1\x05\x29\xea\x05\x23\xac\xe2\x6b\x2e\xa8\xe4\xb5\x98\x4e\x36\x1d\x5b\x90\xe3\x13\xa2\x86\x25\x9c\x70\x21\x59\x5b\xd2\x82\xdd\x3d\xa4\xe4\xee\x01\xbf\x27\xad\xdc\x35\xaa\x45\xff\xba\x11\x45\xbd\x5e\xd7\xe2\x6f\x41\xeb\x9a\xc9\xeb\x7a\xe1\x7e\xa7\x6d\x4b\x77\x61\x97\xe2\x9a\x46\x83\xd4\xb4\x61\x8b\xc5\x20\x82\x4e\x9b\xb0\xa1\x91\x6d\xd8\xd0\x55\x3c\x1e\xd4\xc9\x76\x53\xc8\x08\x7e\x8c\x27\x76\xfa\x81\xb3\x0a\x1a\xa7\x93\x90\xac\xb2\xdd\xb0\xe9\x64\xc3\x85\xfc\x4a\x01\x22\x27\x44\xfd\x73\x56\x26\xd0\x94\xbc\x4e\xd3\x3c\x79\x09\x04\x4a\xc9\xe1\x21\xe9\x98\x24\x65\xdd\x92\x96\xd1\x6a\xfa\xa0\xd9\x71\xd3\xa9\x31\x89\xdc\x35\x30\x38\x25\x2f\x6f\xba\xfc\xec\xea\x86\x15\x52\xf1\xa8\x65\x72\xd3\x0a\x72\xd3\xe5\xa7\x6a\xf1\x82\x56\xf8\x4d\x0d\x48\xf3\x3f\x33\x99\xcc\x10\xc2\x2c\xb5\x20\xb5\x5c\x59\xb8\x0e\x62\x4a\x10\x1d\x05\x99\x97\x44\xee\x1a\x04\xe1\x8d\x98\xa5\xe4\xe4\x44\xcd\xf7\x41\x2c\x58\xc9\x05\x5b\xa8\xce\x93\x56\x2a\x49\x38\x40\x6e\x4f\x27\x93\x49\xc7\x7f\x65\xc7\x44\x2d\xb4\x91\x6d\x62\x21\xa9\xe6\x59\xaa\x90\x4d\xd2\x34\x53\x1d\x57\x5c\x2c\xb0\xe3\x57\xae\x9b\x6a\x0c\xbb\x75\xb2\x3d\x26\x44\xb0\x4f\xef\xe9\x9a\x9d\x95\x65\xa2\x7f\x44\xa6\x0b\x5a\x9d\x07\xd3\xc8\x96\x8b\xe5\x2c\x4d\x33\x32\x9b\x65\x6e\x21\xec\x56\xed\x24\xa6\x60\x7f\x5b\xd7\x55\x92\x22\xf4\x87\xe9\x64\xd2\x27\x61\x2b\xd3\xfc\xdc\xa3\x20\xc0\x49\xa7\x93\x89\x02\x77\x1e\xd3\x25\x1b\x60\x42\x2b\x53\x25\x15\x13\x94\x9b\x73\x06\x44\xba\xe9\xf2\x3f\x57\xf5\x15\xad\xf2\xb7\xb4\xaa\x92\xd9\x1f\xec\x57\x37\x03\x2f\x89\x6d\xcd\x7f\x64\x62\x29\xaf\x93\x94\xbc\x38\x21\xaf\xc9\xfd\xbd\x5b\x8e\xa0\x6b\x6f\x2d\xc0\x88\x49\x2b\x73\x59\x56\x74\x49\xee\x4f\x08\xfc\xf0\x41\x6f\x39\xf5\xd1\x67\xea\xd0\xe0\xfe\x68\x45\xe3\x85\xfa\xa4\x68\x34\x51\xaa\x43\x2f\xfa\x1d\xe0\xd7\x91\x8b\x4b\xc4\x54\x7d\x56\xd2\xcb\xd5\x1a\x5f\x7f\x4d\x38\x79\x33\xb0\x86\xaf\x09\x7f\xf5\x8a\xdc\x29\x71\xff\x5e\xf3\x42\xf7\xea\x48\xc9\xdb\x4e\xe6\x80\xc6\x5a\x01\x71\xa3\x4f\xc5\x82\xdd\x26\x3c\x85\x6f\x86\x87\xaa\x8b\xcf\xfc\x35\x2e\xab\x59\x29\xbe\x2b\x21\x9d\xcd\xa0\x3f\x2f\xc9\x0b\x3b\x06\x57\x39\x29\x6a\x21\xb9\x50\xbb\xd3\xac\x6c\x12\x2d\xeb\x84\xd0\xa6\x61\x62\x91\x84\xed\x99\xc6\x4a\xc3\x51\x34\x3c\x7e\x4c\x2a\xd7\x8e\xde\x56\x22\x0d\x42\x5a\xba\x27\x93\xb5\xdc\x35\x00\x09\x55\x44\x99\xf8\xbb\x54\x43\x90\xbb\x66\x96\x9a\x11\x0f\xa9\xe5\xca\x6d\x51\x6f\x04\xc8\x96\xda\x46\xf3\x2f\x93\x8a\x89\x08\xef\x34\x7d\x36\x7f\x3e\x08\x16\x73\xa8\x63\x45\x2d\x16\xff\x10\x16\xfd\xf7\xe6\xd0\x06\xd5\x63\x70\xfa\x41\x9f\x66\xb5\xfc\x89\xca\xeb\x67\xa8\x36\x24\x1e\xe2\x08\xe7\xb6\x99\x6e\x0d\x52\x70\x4c\x88\x91\x82\x3e\x77\x75\xcf\x5b\xdb\x13\x7f\xc2\xd6\x8f\x9a\xcb\xc7\xd1\x0e\xcf\xdc\x2a\x3c\xf4\xdf\xd1\xe6\xa2\x95\x97\xe4\x84\x6c\xa4\xfa\xd6\x57\x7e\x9b\x31\xf5\xf9\xa0\x54\x62\xf7\x89\xcb\xe2\x9a\xb4\x32\xff\x2b\x17\x0b\xad\x7f\x0a\xda\x31\xf2\x27\x75\xf8\x1f\x83\xce\x67\x52\x7d\x04\x02\xb7\x32\x23\x07\xce\x2e\x40\x31\xab\xd8\xfa\x38\x3e\xce\xb4\xa2\xaf\xd8\x7a\x66\xd6\x5b\x31\x71\x4c\xfa\x67\x51\xc5\x44\x78\xc6\x00\xc3\x00\x87\xb7\xd7\x54\x00\x0a\x0b\xde\x2a\xce\x7d\x5b\xcb\xeb\xef\x78\x1b\xab\xd0\x8e\x89\xc5\x99\xa8\x76\xb1\x16\x55\xa3\x4e\xc8\x39\x13\x0b\x3d\xe8\x21\x1e\xd9\xb2\x62\x3b\x3e\xf2\x67\x56\x6c\xfd\x91\x3d\x42\x58\x6b\xe8\x59\x74\x58\xf0\xd6\xa3\xc3\x82\xb7\xf1\xb2\x7f\xd8\x88\x02\x96\xdd\xd0\x96\xae\x3b\xb5\x72\x27\x77\xd0\x34\x03\x99\xe6\x02\x36\x3f\x5d\xb1\xe4\xe2\x12\x4d\x86\x8c\x60\x07\x27\x6b\x81\xc2\x69\xa9\x58\x32\xc2\x85\x5e\x26\x17\x17\x5c\xc9\x8e\x8f\xb3\x1e\x6f\x14\x89\xdb\x3c\x2d\xeb\x36\x95\x0c\xb1\xd1\x6d\x88\x4e\x8d\xdb\x2b\xc2\x47\x77\xd9\x8b\x90\x1a\x89\x18\xd5\x1b\xd9\x47\xc9\x80\xe8\xe3\x54\x6f\xe4\xdb\x48\xe9\x0e\xce\xe7\xf3\x7c\x4b\x5b\x4e\x17\xbc\x88\x79\x6e\x61\xdd\x9f\x90\x39\x79\xf3\x86\xcc\xff\xc7\x38\xe7\xad\xd5\xab\x8f\xeb\x5d\xc3\xd4\x46\x56\x86\x5b\xa6\x49\xfb\x56\xef\x6e\x8d\x57\xcc\x97\x2c\x98\xf4\x98\x98\x9f\xb4\x16\xe0\x02\xe0\x11\xc2\x85\x6e\xa9\x37\x12\x9b\xea\x8d\x8c\x04\xe6\xd4\x58\xdc\x20\x35\xe6\x98\xf0\x19\xa5\xdb\xb4\xdc\x78\x3d\x34\xb7\x74\x93\xd1\xda\x8f\xc8\x8f\x19\x7f\x17\x1f\x41\x5d\x78\x00\x99\x8e\xc8\x52\xfe\xfb\x9c\x08\x8f\x9c\x64\xf6\xa0\x80\x73\xe2\x59\x07\xc5\x38\xbb\x43\x97\x26\xe4\xb9\x65\xb9\x3d\x44\x9e\x79\x70\xe8\x73\xc3\xa8\x7d\x43\xb4\x88\xc7\xef\x68\x33\xac\x8d\x8d\x5f\x05\x50\x56\x6c\x77\x4c\x86\x75\xd0\x8a\xed\x2c\x71\x9e\xa8\xaa\xdc\xec\x3f\xc9\x76\x78\x76\xe3\xc4\x7d\x1e\xd8\x73\xe5\xf1\x0d\x03\x76\xce\xe0\x67\x82\x06\xa7\x10\x60\x97\xca\x33\x0c\xf7\x03\x36\xe1\x76\xd0\x40\x7f\xb0\xbd\xf4\x9e\xf0\xdc\xca\x8c\xe0\x80\xbd\xdb\x22\x84\x83\x68\x97\xe0\x99\xe3\xd8\x60\x6b\xd4\x65\xd9\x31\xf9\xfd\xfa\x0a\xcd\x33\x73\x1a\xf0\x14\x34\x8f\x31\xc7\x4a\xbd\x42\xd5\x6d\xd1\x77\x13\x02\x28\x4a\x6d\xf5\xcd\x34\xc4\x06\x37\xa0\xef\x27\xfb\x9b\x50\xff\x37\x24\xb6\x65\xb4\x01\x07\xbe\x49\x8a\x02\x5d\x8e\xf9\x76\xc1\x7e\xd4\xff\xf9\x8c\x2c\xfd\xbd\x98\xf5\x16\x76\x4c\xbc\x5f\x1e\xdd\xa9\x5e\xc0\xe0\xb7\x6e\x53\xd5\x6b\x70\xab\x22\x3f\xdd\x3e\x43\x1a\x3b\xf9\x7b\x98\x82\x71\xa5\x83\x02\x26\xb6\x90\x60\x7c\x28\xff\xa9\x86\x09\x93\x61\xb7\x3e\xff\x00\xbd\x94\x4b\x6c\x23\x05\xe1\x22\x89\x39\x59\x57\xba\x2d\x0a\xf9\x4c\xf7\xf9\xd0\x66\xcc\xa0\x9f\x6c\x3e\x2a\xe9\xde\xf3\x55\x3b\xdd\x72\xaf\xbb\xfd\x30\x9d\x42\x08\xc3\x37\x56\xb5\x00\x2a\x14\x35\x79\x89\x40\xe5\x3f\xd5\x66\xb3\x39\x2d\xa7\xc6\x99\xb2\xbf\xaf\xeb\xb2\x24\xda\xa8\xfe\xe2\x68\x3a\xb5\x76\xb2\xf3\x7c\x0d\xb9\x12\x49\x5e\xfa\xd3\xa6\xe6\x70\x4a\x52\xdb\xd9\x0b\xda\xc8\xdc\x80\xda\x03\xc1\x48\xf5\xbb\xa7\x41\xba\x38\x96\xb9\x36\xef\xcd\x0f\x97\x0a\xba\x72\xdc\x23\xf3\x9d\x68\x7d\xb3\xa6\xcd\x05\x72\xf6\x32\x9c\xdb\xc3\x49\x07\xa9\xcc\xe7\x24\x0d\xd1\xf4\x50\x89\x7d\x04\x9c\x1e\x38\x62\x4c\x17\x8f\x1b\x18\x6d\x22\x84\xfc\x97\x96\xc5\xe3\x99\xea\x35\xfb\xaf\xa9\xb1\x63\x1c\x23\xac\x99\xa4\x1b\xa6\xca\x56\x21\xc4\x18\x7c\x53\x30\x54\xdc\xaf\x3e\x49\xcd\xcc\x29\xe1\x02\x28\xe8\xc2\x5c\x8e\x82\x5c\x8c\x8c\xa9\x37\x72\x74\x50\xbd\x91\x76\x7d\x4a\xa4\xbc\xb5\x5d\xed\x24\xeb\xc8\x4b\xf5\x4f\xd0\xe5\x3b\x2a\xa9\xd7\x0d\x46\xa9\xff\x30\x66\x35\x9d\x48\xba\x24\x41\x83\x75\x8d\xaf\xea\xba\x32\xcc\x54\xc3\x62\x26\xaa\xa9\x2e\x5f\x9a\x39\x2c\xff\x04\x74\x4e\xe1\xff\x49\x4a\x92\x4e\x43\x4e\xc9\x1d\xd1\x2b\xd1\xd0\x2e\x44\x0e\x58\x5f\xe6\x80\xd5\x43\x04\x40\xd2\x65\x38\x7e\x0f\x00\xb5\x8a\x78\xbc\xde\x7b\x49\xaa\x01\x78\xe3\x67\xb3\x5e\x6f\xde\x99\x08\x51\x92\xc2\xd2\xf7\xcc\x66\x49\x64\x38\x68\x54\xac\xc8\x14\xd6\x7a\x3e\xe7\xd4\x03\x3c\xa4\x08\xb0\x4a\x9d\x84\x82\x7d\x4a\x14\xb8\x14\x79\xa2\xe0\x5f\xa9\xc3\xeb\xc0\x10\x54\xe9\x75\x77\x6e\x81\x75\x2c\xe9\x52\x1f\x2d\x92\x2e\x55\x83\x99\xe0\xd8\x4e\x95\x29\x9d\x3c\xf1\x10\x57\x60\x00\xed\x63\x72\x05\x1f\x3d\x8e\x9e\x95\xe5\x8f\xbc\x53\x52\xac\x7e\xeb\x6f\x40\xdd\x27\x51\x3a\x49\xff\xec\x56\xe1\xcd\xa1\xe1\x5c\x70\x21\x55\xdf\xf4\x72\x1a\x11\x06\xec\x5e\x4f\x2e\xce\xca\x12\x82\xbe\x8a\x10\x15\x13\x89\x07\x44\xd3\xc3\xa0\x66\xc3\x2e\x5e\x63\x46\x44\x1a\xcf\xaf\xec\x0d\xbd\x32\x89\x76\xb0\x5e\x99\xde\x9f\xbd\xb5\xe9\x5e\xb0\x36\xfd\xb3\x1f\x8f\x36\x7b\xce\xc1\x1a\x5e\x9d\x31\xba\x7b\x80\x83\xf5\x79\x60\xd2\xe9\xc4\x47\xd0\xae\xcf\x6b\xcc\x88\x4c\x63\x0c\xf4\xfa\x74\xce\xc4\x1d\xe4\x9d\x6c\xcf\xae\x6e\x82\xa0\xba\x96\xf6\xbb\x29\xc4\x4f\x0b\xbd\xf9\xef\xd4\xbf\xe6\xdb\xc3\xd0\xc1\x57\xe8\x13\xaf\x93\xed\x2c\x23\x08\x18\x32\x05\x4b\x26\xcd\xc0\x4f\x5c\x5e\x2b\xbd\x67\x50\xe0\xbf\x82\xce\xd0\xb8\x16\x79\x27\x5b\x87\x66\xf7\xbf\x5a\xb5\xb8\x85\x97\x4e\xc0\x8d\xe5\x25\x12\x8c\x89\xab\xb3\x07\x9f\x70\x84\x35\xaa\x2c\xb0\xa2\x6e\x76\x68\xea\x26\x0b\x45\xa1\xae\x2d\xbc\x45\x43\xb0\x47\x4f\x71\x37\xf5\x0c\xe1\xde\x04\xce\x20\x8e\xa3\x93\x91\xe5\xab\x43\x93\xd3\xc9\xa4\x69\xeb\x66\xc0\xbc\xd5\xf6\x53\x5b\x37\xb3\x34\x3f\x07\xf2\x24\xca\x2a\x5a\x74\x12\xe8\xa8\xbe\x00\x9e\xd0\x51\xfd\xa6\xec\x8d\x07\xbb\x22\xa5\x48\x7f\xa1\xd5\x86\x25\x12\x30\xcf\xc8\x36\x58\x51\x59\x91\xb2\xa2\xcb\x94\x40\x27\x3c\xbe\xc0\xb6\xcf\xcd\xa9\x88\x59\x13\x13\xd1\x3a\x39\xc1\x58\x16\x84\xec\xbd\x46\xa4\x5a\xdc\xfa\x93\x6c\x31\x93\x82\x8c\x80\x39\xee\x94\x65\x19\x59\x6f\x5b\x67\xa8\x01\x4a\xf7\x80\x54\x62\x40\xa5\x0f\xbe\xbe\x19\x85\xd2\x4b\x42\x08\xf6\x49\xe9\x38\xfd\x7d\x96\x91\x6d\x66\x78\xd5\xca\x5c\x39\x5b\xb5\x32\x0d\x1f\x99\x5c\x37\x9c\x8a\x05\x6f\x1d\x61\xdf\xd1\x15\x03\x87\xcb\xca\x5d\xa6\x36\x61\x46\x0a\xda\x28\xc1\xf5\x28\xaa\xe3\x25\x9a\x2c\x2f\x4e\xd0\x51\x43\xae\x53\xc1\x0b\x6b\xb4\xe6\x16\x28\xa9\x4b\x22\x6a\xf1\xef\xe0\xb7\xc1\xee\x9c\x01\x5b\x15\xac\x8a\x09\xf2\x86\xbc\xde\x3b\x5e\xd9\xe3\x4b\x2a\xf9\x96\x11\x88\x08\x9a\xb1\x0a\xb9\x67\x8c\x2d\x68\x13\xce\xfb\x0d\x40\xd8\x3f\xda\xf6\xc3\xa1\x96\x6f\x9e\x28\xee\x9a\x6c\x20\x65\x64\x40\xcc\x32\x7f\x47\x39\xb2\x0e\x99\xc7\x90\xa7\x0d\x13\x88\xa4\xb7\xed\xf3\xef\x2b\xb6\x4e\xd2\x54\xcf\xf4\x2b\x6b\xeb\x59\x4a\x1e\x14\xbf\x5f\xbb\xcd\xaf\xf3\x98\x51\xd2\xf7\x6f\x2e\x75\xf8\xc2\xcf\x84\x42\x3a\x01\x53\xc9\x90\xbf\x56\x1c\xb3\x59\x51\x27\xf2\x3a\x7b\xf8\x60\x88\xc8\xd5\xb6\x10\xbc\xf2\xb7\x85\xe0\x95\x2f\xdf\xbe\x37\xd7\x5f\xb0\x51\x09\x45\x2d\x50\xe5\xd6\xed\xcc\xf3\x6e\x80\xc0\xfd\x55\xf8\xb2\x38\x84\x02\xee\xa9\x60\x9b\x39\x76\x7d\x0e\x42\x43\xbc\x32\x3d\xff\xb0\xa5\xd5\x2c\xa4\x3d\xe8\x94\xb3\x32\x41\x3f\x85\x0b\x99\x11\x56\xb1\xb5\x56\xb6\x91\x39\x1e\xe1\x13\x4a\x91\x0d\xa7\x3b\x29\x52\x90\xd2\x8c\x00\x6c\x8f\x54\x6f\xaf\xa9\x38\x2b\x93\x05\x6f\xe1\xc7\xef\x78\x9b\x11\xf9\x19\x33\x9a\xb8\xb5\x27\xb6\x69\x46\x20\xe8\x6d\xe3\xe5\xf6\x77\x1d\x05\xf7\xd0\xf8\x61\x23\x0a\xc5\x30\x91\x11\xb4\xf5\xb5\x9a\xd6\x81\x55\x6d\xd5\x79\x62\x68\xbf\x1c\x1c\x10\xc8\x8a\x71\x01\xca\x16\xd2\xa8\x5c\x5c\xe8\xa6\x7f\x9f\x5f\xc6\x2a\x27\x1d\xda\xb9\x38\xff\x31\xa9\x68\x27\x09\x6d\x97\x4a\x90\xed\x14\x78\x86\x6c\x3a\x49\xae\x18\x01\x65\x64\x36\xf5\x4d\x77\x1a\x04\xcc\xbd\x33\x45\x23\x60\x4e\x3f\x75\xe4\xc4\xd1\x72\x35\x1a\xc3\x28\x9a\x64\x5b\x54\x33\x37\xdd\x59\x18\xf7\x8e\xc0\xd6\x1b\x39\x0c\xd7\x04\xbd\x01\xc0\x10\xe4\xa7\x70\xd2\xb8\x47\xc0\xc9\x53\xa1\xfe\x7f\xb6\x91\x8e\x17\x1e\xd7\xde\xd1\xe6\xac\x4c\x56\x6c\x37\x28\xa8\x3a\x11\xb4\x62\x3b\x2f\x13\x64\xb3\x11\x99\x1a\x9d\xb9\x70\x5d\x4f\x95\x36\x8a\x1f\x5c\x6c\x69\xc5\x17\x0a\x08\x1c\x00\x64\x46\x5e\x01\x44\x63\x05\x84\xda\x75\xef\xc2\x74\x54\xd3\x49\xe8\x8a\xed\xd2\x70\x7f\x78\x6b\xf3\xcc\x4c\x7d\x46\xf6\x4d\xd6\xbd\xd3\xe9\x30\xa6\xbf\x21\x3c\xf0\xb0\xee\xb3\x32\xf9\x9c\xbd\x66\xe3\x98\x7d\xd8\x87\x87\x28\xad\x68\x89\x9c\x95\x89\xb6\xcf\x2e\x2e\xcf\x5d\xa4\xce\xce\x76\x78\x48\x26\x37\x5d\x2f\x4a\x19\xcb\x1b\xc2\x48\x53\xe8\x5f\x76\x4c\xcb\x66\x73\x81\x96\xaa\x8e\x6a\xde\x3d\xdc\x3d\x60\x0f\x94\xcb\xd2\xc9\x65\x69\xe2\x97\xea\x33\x06\x21\xb1\x6c\xc6\xa8\x60\x68\x8f\x45\xc0\xac\xe1\x18\xc7\x03\xeb\x75\x6d\x54\x7e\x2a\x6b\x9a\xf0\x94\xbc\x22\x33\x72\x4d\x3b\x22\x6a\x63\x1f\x00\x28\xa4\x04\x3a\x75\x60\x4f\xe6\xca\x35\xb2\xd3\x43\x33\x84\xf6\xed\xdc\x87\x87\xe4\x7b\x1d\x12\xc5\xe9\x74\xbb\x45\xb6\x67\xd0\xe1\xf7\x60\xe0\xcb\x97\x84\x8a\x05\x79\xe9\x9d\x3a\x84\xb6\x8c\xf0\xaa\x62\x4b\x5a\x99\x21\xb0\x57\x00\x2b\x00\x8c\xe7\xb2\xf9\xc8\x4b\xb2\x52\x1f\x55\x27\x3d\xe7\xd7\x64\x65\xa6\xbd\xbf\xc7\x9f\x6d\x7a\xc6\x21\x32\x4e\x3e\x3d\x3d\xa1\xa2\x16\xbb\x75\xbd\xe9\x34\x41\xed\x86\xd2\x88\xb8\x3d\xa5\x41\x3e\x98\x1f\x90\x60\x88\x93\xb5\xbf\xf1\xdb\x03\x61\x55\xe7\xa1\xa1\xbb\x46\x20\x4d\xe7\x90\x3d\xbc\x24\x1f\x33\xb2\xd8\xa0\xcd\xdf\x31\x79\xa1\x46\x5f\x7e\x0d\x4d\x8f\x4a\xc5\x62\xd3\x54\xbc\xa0\x92\x79\xf2\x01\x7e\xaf\x99\x04\xfe\x71\x60\x6d\xb8\x1a\x24\x15\xbf\xde\x74\x65\x58\xb9\x03\x67\x33\x0a\xff\x2c\xcd\xdf\xb3\x4f\x06\xf7\x9b\xae\x44\x9f\x0d\xdc\x90\xcc\x9f\xc9\x7e\x82\x98\xf6\xf0\x27\x1b\xc3\xce\xa0\x78\x2c\xfe\x2c\x77\x8d\xdb\xcc\x48\xbb\xb4\xd7\x87\x2e\x67\x99\x22\x2c\x5d\xda\x4f\x7e\x2c\xfe\xa6\x2b\xa1\x19\x17\xfe\x24\x45\x62\x23\xdb\x33\x0c\x49\x1b\x80\x38\xb7\xd1\x55\xff\x87\xb5\xb5\xe7\x58\x3a\x27\x69\xc4\xa4\x75\x7e\xa0\x6f\x6a\x06\xa6\x0e\x3a\x2d\x1f\x15\x7d\xa1\x50\xcd\x86\x21\x7d\x5f\xc6\x3b\x44\x3c\xd7\xc1\x1c\x22\x2e\x1b\x63\x03\x94\x91\x23\x14\xf9\xa3\x8d\x6c\x0d\x4b\x9d\xb3\x33\x8d\x4a\x13\x1e\x87\xe5\xaf\xc9\x87\xb3\x60\x25\xdd\x54\x7b\x11\x7a\xcc\x33\x1b\x27\x9d\x67\xc6\x0f\x78\x6c\xb1\xaf\x7b\x2a\x64\x52\x82\xbf\x96\x91\x2b\x2e\x3b\xb0\xc9\xbf\xfc\xa3\xb3\xec\x2c\x0b\x15\xf1\x23\x47\xb7\x91\x50\x18\x11\x72\x28\xdd\xc7\x89\x53\x21\xbf\x52\xcb\x7e\x99\x28\xcd\xf7\x55\x9a\x34\xb2\x4d\x09\x14\x08\x7d\x95\xa8\xf9\x53\xd7\x71\xfe\xa5\xeb\x39\xff\xd2\xef\x3a\xff\x32\xee\x9b\xa9\xff\x7d\x71\xe4\x06\x7c\x71\xe4\x0f\xf8\xe2\x28\x1e\xf0\xe5\x1f\x5d\xdf\x2f\xff\xe8\xf7\xfd\xf2\x8f\x41\xdf\x0f\xdc\xa1\xbc\x09\x70\xde\xf4\x90\xfe\xc0\x3d\xac\x37\x21\xda\x9b\x3e\xde\x1f\xc0\x6e\xff\x00\xf8\xe1\xbf\x0d\x26\x3a\xf5\x68\x6f\x0d\x9b\xfe\x22\x3e\x70\x6f\x15\x9b\x70\x19\x9b\x60\x1d\x71\x28\x00\xf6\x5e\x23\x5b\x75\xf0\x7a\xbe\xba\x75\xe4\x2d\xdb\xd2\xd0\x7d\x57\xb6\x98\xe7\xbd\x97\x02\xab\x7e\x69\xbb\x54\x56\x03\xc0\x4e\x89\x29\x81\xb0\x2d\xfb\x1c\x7b\x05\x71\xc0\xc6\x3e\x26\x05\xad\x2a\x65\x58\x9b\x69\x21\xc4\x05\x1e\x3e\xfc\xe6\x1c\xfc\xe9\x44\x9a\xd4\xaa\x93\xcb\x52\xcb\x6a\xe2\x02\xf8\xbd\xfc\x17\x14\x65\x96\x5b\xad\xd2\xed\xf2\x60\x45\xf2\x9a\x77\x41\xd4\x87\xb6\xcb\xcd\x9a\x09\x58\x95\x1f\xd4\xf3\x4f\x6f\xb5\x0c\x20\x85\xb3\x8e\x60\xe1\x19\x51\xe8\xe4\xef\x37\xeb\x53\x81\xa9\xdb\x28\x73\x0b\x83\x20\x5f\x48\xdb\x25\x18\x3b\xea\x88\x53\x63\x4e\x85\xf2\x01\xdd\xba\x70\x02\x54\xe1\x4e\x95\xea\x51\x1e\x96\x17\xfc\x12\x54\x28\xa6\x29\x35\x43\x30\x4e\xa2\x40\x0b\x60\x59\xea\x0a\xb0\x0c\x82\x67\x1b\xe9\x17\x61\xbd\x3e\xc6\x04\xb5\x73\xba\xb1\x7d\xee\xb7\xfb\xd0\x2f\x5e\x5f\xe6\x35\xfa\xae\x10\x73\x73\x6a\xce\xaf\xdf\x89\x4e\x50\xd0\xa7\x5a\xdb\x06\x88\xb8\x2c\x77\x46\x5a\x3f\xd1\xed\x2d\x47\xa7\x59\x75\xd5\xcd\x39\x93\x3a\x0e\x98\x91\xd6\x62\xe2\x17\x11\xf9\x28\xeb\x5c\x69\x3a\x8d\xb7\x47\x2f\x50\x56\x46\xf1\x36\xba\x4c\x94\xb0\x78\xdb\x43\x09\xe4\x62\xcd\xd6\xeb\x7a\xcb\x12\x97\x24\xb5\x41\xd1\x10\xe0\x48\x9e\x74\xd1\xc9\xd4\x9e\xb7\x50\x09\xdc\xef\xd3\xb5\x85\xed\xb3\x64\xd2\x0f\x65\x54\x35\x5d\x9c\x17\xb4\xa2\x6d\xd2\x44\x13\x66\x44\x98\x24\x7f\x6a\x7e\xd8\x5b\x39\xde\x84\x93\xd8\xe5\x07\x67\x87\x72\xe4\xbd\x33\x39\x23\x1d\xff\x95\x61\x2c\x2f\x29\xae\x87\xd6\x5c\xd8\x8d\x69\x82\x00\x43\x89\xe9\x34\x9d\x3e\x7a\x2e\x62\x60\xe4\xed\x35\x15\x5a\x74\xf4\xb1\xa7\x66\xc8\x75\x00\x43\xa1\xe3\x1f\x7d\x3e\xee\x6b\xda\x78\x7c\xb2\x31\xc8\x64\x3d\x84\xf6\x93\x90\x09\x2d\xc1\x81\x69\x57\x6c\xf7\x43\xdd\x7a\xb3\x2a\x4f\x35\x9e\x2d\xf1\xd5\x8e\x4d\xd1\x4d\x27\x2b\xa3\xa9\xe2\xbc\x38\xdb\x61\xc4\x79\xb5\xd5\x34\x01\x86\x29\xe5\xda\xab\xcf\x5f\x6d\xc9\x89\xea\xe7\x73\x16\x4e\x87\x95\x1f\x94\xcf\xff\xca\x76\x2e\xf6\x87\x48\xcf\x32\xb2\xda\xfa\xf1\x74\x4d\x91\xd5\x36\x23\x2b\x8f\xae\x0d\x2d\x0a\xd6\x75\xde\x1a\xd7\xc3\xcb\xec\x5b\x6f\x1f\x33\x74\x66\x0c\x95\x60\x5c\x3a\x9d\x30\x21\xdb\xdd\xf0\xda\xd7\x68\xad\xad\x90\x00\xd8\x71\xf0\x5e\xc2\x60\xd8\xf0\xd9\x26\x17\x4c\xa0\xab\xf8\x3c\x43\xeb\x27\x30\xb2\xa4\x89\x99\xa6\xc3\x12\xd7\xd0\xae\xe3\x4b\xd1\xa3\x4c\x46\xb6\xb4\x1a\x92\x39\x20\xed\x10\x41\x6e\xba\x5f\x68\x35\x4c\x90\x2d\xad\xd2\x88\xbb\x4c\x67\x27\xb4\xe7\x08\x84\x1a\xc8\x43\x40\x5a\x93\x7d\xb2\x90\x31\xce\x21\x43\xdb\x52\xe9\x7f\x97\xf0\xc1\xee\x8a\x0c\xf0\x0f\x93\x29\x84\x93\x14\x08\xc8\xa3\xfe\x42\x91\xdc\x3e\x03\xf7\x78\x4e\xd8\x4f\xd7\x89\xa0\xbc\x05\x6d\xdb\x99\x9e\x6a\xb0\x3c\x64\x8d\x59\xb2\x95\xe6\x52\x40\xf9\x05\xab\x98\xf4\xb5\x72\xbc\xc7\x87\x45\x74\x8f\x4c\x0e\xce\xff\x1d\x4e\xb3\x72\xd5\x27\x6b\xda\x9c\x2a\xe9\x76\x79\x7e\x49\x08\x21\x18\xf0\x5e\x43\xc1\xa6\xdd\xec\xd3\xc9\x8a\xed\xba\xa0\x81\x63\x01\xa6\xf4\xd7\xc2\x25\x6b\xe1\x72\xd6\xf8\x6a\x52\x2c\x37\xf0\xf4\x56\x02\x0d\x3d\x4d\x7b\xa0\xf1\x53\x07\xde\xd0\x8a\x06\x52\x0e\x0a\xc7\xc1\x63\x69\x0d\xb9\x81\x87\x50\xe4\x15\xb2\x2b\xb6\x4b\xb8\x44\x94\x86\xb6\xbd\xea\x83\x27\x82\xc6\xa6\x87\x26\x87\x08\x26\xf0\x41\x75\xce\x15\x0e\x26\xdd\xa7\x7e\xe7\x4f\x38\x2d\xc6\xb6\x34\x00\xc0\x6a\xcc\x95\x8b\x69\xe8\x8a\xc5\xde\x1e\x87\xde\x46\x3f\x8e\xed\x73\xd5\x49\xb0\x5b\xe9\xad\xfa\x19\xcb\xc4\x15\xbd\x7a\xe5\x43\xac\x98\x18\x38\x96\xb8\x88\xee\x7e\x3d\x9d\x53\x36\x9b\xea\xf2\xb8\x5b\xf9\x1d\x6f\x41\x85\x10\x6d\xb4\x0e\x38\xf1\x5b\xda\x2a\x63\x06\x77\xf8\xd6\xb3\xf4\x78\x69\xdb\x5d\x18\x39\x77\xee\xb4\xe0\xd5\x2c\xf5\x55\xf1\x9e\x38\x80\x1b\x90\x91\x6d\x0e\xb9\x56\xb4\xf3\xd5\xec\x4a\x57\xfa\x5b\xc4\xc4\x8d\x8d\x0b\xe0\x82\x60\xd6\xf5\x37\x41\xe3\xce\x98\xbf\xfe\x64\x4a\xf5\x20\xe6\xfa\xf0\xa4\x68\x8c\xa6\x66\x00\xea\x9e\x3f\x60\x0d\xe0\x2c\x23\x41\x67\xdd\xda\xeb\x5d\x01\x79\xe3\xde\xba\xb5\xd7\xbb\x50\xa7\x26\x97\xbb\xb8\xbf\x6d\x87\x11\x5b\x20\xfa\xe3\x12\x0d\x90\xe3\xb3\x49\x99\x54\xc6\x6d\xd4\xb5\xb4\xda\x15\xc3\x63\x61\xf8\x3c\x08\xfb\xa8\x8f\xc0\x53\xf3\x3b\x9a\xde\x88\x17\x22\x0e\x0d\x57\x2d\xa3\x2b\xef\xae\x58\x45\xfa\x24\x07\x8b\xdc\x3b\x4a\xb6\xea\x00\x41\x18\x99\x37\x25\x74\x33\xf0\x1e\xa6\x63\xd0\x02\xaa\xc1\xb1\x17\x51\xd2\x30\x29\x8a\x05\xf5\xa1\xc5\xb1\x9f\xe9\x5e\x2c\x83\x80\x50\x46\xbe\xad\xeb\x2a\x83\xcc\x58\xa6\xb3\x16\x36\xf2\x6a\x12\x18\xa0\x60\xfc\xa9\x7b\x07\x78\xae\x2c\xf4\x20\x40\x84\x9e\xf1\x01\xec\x96\xef\xdb\xb6\x6e\xef\x6c\x7c\xf3\x6d\x2d\xb6\xac\x55\x62\xb9\x7a\x18\x76\xf3\xad\xef\xd8\xaf\x20\xa0\x95\xef\xd3\xe0\x4e\xcb\xdb\x3a\x49\xc9\xbd\xfe\xed\xe0\x69\x91\x81\xb7\x75\xb3\x73\xd5\x1f\x3a\x0a\xa0\xb5\xd3\x02\x76\xe6\xa2\x93\xf9\x0a\x86\x81\xaa\x58\xac\x94\x75\x8a\x55\x11\x07\x07\xfa\xd7\x38\xc5\x3f\xb2\xe0\x46\x6d\x93\x85\x59\x2e\x02\xb3\x25\x16\x77\xba\xce\x63\xbd\xe9\xe4\xb7\xec\x4f\x60\x70\xd1\xab\x4a\xb9\x2d\xaa\xb7\xfb\xe4\x6a\xca\xa6\xd3\x49\x07\x38\x76\x6d\x61\x71\x04\x3d\x07\xbc\x52\x13\x62\xc5\x1d\xe8\xb8\x10\xf1\x2e\x42\xdc\x1b\x72\xa2\x3e\xe2\x6e\xe2\x62\x09\xab\xec\x64\x3e\xb8\xe1\x20\xbe\x84\x1b\xf2\x85\x07\xe1\x6e\x3a\x79\x0a\x29\xba\x95\xab\xf9\x9d\xa8\x35\x0c\x2c\x70\x00\xb2\xb2\x1c\xba\x77\x9b\x4e\xbe\xa3\xb2\xb8\x4e\x7a\x04\x0e\x90\xc5\x72\x99\x60\x5b\x2a\x7d\xbc\xe8\xa4\x36\x17\x55\xf7\xe0\x30\x18\x60\xca\x2f\xfe\x66\x33\x19\xad\x70\x9e\x14\x77\x1d\x76\xd6\x93\xe8\x63\x45\x33\x28\x3c\x71\xa2\x49\xec\xc9\x14\x4d\x12\x21\xef\xeb\x0c\x3d\x89\x02\x16\xd2\x67\xec\x54\xd5\xda\x80\x8b\x25\x52\xe9\x17\xa7\x12\xf4\x25\x32\x7f\x1b\x0e\x0f\xd7\x15\x1b\xc3\xa3\xcd\xa6\xda\x2a\x96\x5b\xfd\xe1\x4e\x65\xb5\x61\x75\x86\x3b\x8a\x3d\xf1\x52\x6f\x5b\x4c\x6d\x3f\xb2\x93\xa0\x2d\xb7\x13\xcc\xc0\x78\x33\x7b\x0a\x26\x39\x38\xf0\xd5\xc0\xcf\x67\x78\xf1\x78\x20\x1f\x1e\x81\x3a\x26\x05\x15\xa2\x96\xa6\xaa\x04\x56\x42\xea\x2b\x49\xc1\x1f\x2b\xdb\x5a\xd9\x32\xb6\x06\x13\xf3\x31\x75\xab\xab\xa4\x5d\xf5\x8c\x37\x39\x96\x3d\x3b\x04\xb6\x3a\xfc\x85\xed\x68\x47\xcc\xfc\xb5\x6c\x1d\x63\x5d\xb9\x1b\x1a\x24\x3e\x7b\x3d\x0a\xc6\xd6\x58\x68\xc4\x28\x89\x71\xf6\x4e\x50\x25\xef\xb1\x7b\x0f\x38\x37\x78\xa8\xc2\x9e\xab\x41\xdf\x1f\x9d\x7a\x46\xbd\x52\xa5\x1e\x3c\x10\x97\xdf\x37\x88\xe4\x19\xad\x40\xc6\xf7\x58\x18\xec\xca\x14\x4d\x51\xee\x7f\xfc\x70\xfa\xbf\xdf\x7d\xff\x1f\xb3\x20\x7c\xe2\x93\xbe\x6e\x6c\x69\xed\xd6\xe8\x7f\x3f\xe4\xdb\xe7\xe4\xc9\xb0\x28\x1d\xdb\x02\x46\x2c\x11\x72\x39\xfd\x4d\x07\x15\x5e\x6a\xe6\x9f\x68\x2b\x39\xad\xd4\x09\x6b\x22\xc0\x1f\x33\xf2\x11\xc2\xd1\xf6\x26\xd8\xcf\xac\x60\x7c\xcb\xda\xa4\x6e\xa0\x88\x8d\x0b\x75\xb6\x82\x31\xf9\xcd\x37\x0e\x91\xf3\x6b\x5e\x42\x51\x67\xb1\x05\xeb\x3c\xb2\x69\x87\x65\x47\xf5\x8d\xad\x5c\x25\x20\xea\x03\xca\xc3\xef\x1d\x55\x1e\x8d\xd2\x95\xc2\xb0\x9a\x36\x4d\xa5\x34\xb7\x42\xc2\x03\x9c\x42\x7c\x33\x34\x0b\xb6\x90\x32\x4c\xd2\x71\xdb\x20\x0c\x77\x86\xa6\xc1\x50\xf0\xd3\xaf\x7f\x40\x10\x5d\xe2\x8a\x4a\x4d\x32\x28\x4e\x05\xfd\x24\x5b\x6d\x17\xf9\x36\x13\xda\x5a\x59\x2f\xcb\x86\xcf\x68\xf4\x13\x67\xf8\x6a\xc9\x64\x10\x99\xb7\xf5\xba\xa1\x2d\x5a\x00\x8f\xa2\xa3\xa7\x47\xf3\x59\x5f\x77\x0b\xe7\x18\xcc\xfe\x99\xc8\x4a\xee\x4f\xd6\x33\x35\xe3\xaa\x56\x99\xbf\xdf\xac\x21\x7f\xea\x97\xb4\xc2\x49\x2d\x73\x6c\xe7\x29\xa6\xc5\x83\x45\x98\x70\xb7\x8f\x16\x9a\xc6\x41\x29\x1a\x10\x6b\x80\x20\x28\xf5\x58\xeb\x06\xb1\x4e\x6c\x48\x4d\x6e\xc6\x33\x4b\xfc\xaa\x81\xc9\x44\x4a\x74\x5e\x83\x9b\x88\x83\x39\x15\x47\x18\x99\x9b\xe9\x70\x57\xf8\x17\x43\xf3\xde\x8d\x16\x5d\x69\xf7\x46\x57\x65\x91\x6f\xb0\x44\x5b\x0f\x1a\x2a\xc4\x3a\xd6\xd8\x13\x2e\x16\xec\x16\x0a\x9a\xea\x12\x73\x04\xfa\x14\x69\xbc\xab\xa1\x17\xfc\x72\x3a\x69\x4c\x91\x87\xcc\x4d\x81\x7a\x93\x63\x0a\x7e\xb2\x86\xba\x0f\x72\x42\xa0\x53\x8e\xf7\x24\xa6\x93\x12\x8c\x0f\x27\xf5\x53\x78\x02\x00\x61\x98\x22\xf0\x26\x5f\xa3\x3b\x50\xca\x47\xb2\x4e\x6b\x1d\xdd\x0e\xee\x4e\x63\xf2\xe6\x75\x46\xe6\xaf\xa0\x84\x46\xe6\x5c\xe0\xd9\xc2\x85\xab\x44\xe7\x02\x0b\xd0\x95\x28\x7d\x84\x2d\xee\x15\xcd\xe0\x10\x20\x52\x3c\x86\xb6\xe8\x40\x47\x17\xa4\xed\xa4\x7a\x4a\xb8\xdf\x92\x3a\xf8\x2d\x06\x0e\x2d\xfc\xda\xa6\x86\x14\x1c\x3b\x43\xbd\x91\xd0\x57\xb3\x18\xc6\x84\x05\x7a\x99\x1a\x7d\xda\xfd\xa2\x4b\xc2\xc0\x7c\x5c\xeb\x9a\x1e\xb2\x96\x53\x5b\xc8\xbd\xf7\x49\x94\x81\xb7\x6d\xa2\x97\x6d\xd2\xc7\x4a\xc0\xf1\x7c\xf8\x1d\xb5\xb2\x3e\x34\x5c\xd6\xed\xf5\xa5\x13\x7f\xf5\xd5\x95\x98\xef\xd7\xd2\x17\xf3\xe3\x4b\xad\xa9\xd7\x50\x5e\x48\x4e\xb4\xae\x5e\x4b\xfb\x38\x50\x5f\x4b\x8b\x30\x29\xa5\x4e\xc2\x35\x12\x81\x9c\x10\xee\x6a\x2e\x9c\x26\xb0\xc7\xb3\x39\xe6\xa2\x87\x84\xe0\xb0\xf6\x32\xb4\x7e\xf1\x7a\xfc\xc1\x0b\x14\x8c\x9e\x4f\xc6\x9d\xed\x59\x74\xe8\x55\x3a\x83\x6e\x34\xa0\x0d\x00\xa2\x90\x36\xd6\x74\x56\x3a\xc5\x11\xe4\x83\xc0\x92\x7a\x0f\xd1\x26\x65\xbf\x9a\xf6\xa0\xd4\x16\xc7\x79\xa7\x37\x6a\x55\x7d\x2e\x04\xcb\x84\x0f\x5e\xb2\x3d\x73\x95\x03\x51\xf8\xc0\x37\x14\x2d\x36\xd7\x7c\x79\x0d\x61\x2c\x17\x03\xaa\x3f\x61\x38\x47\xbf\x30\x51\xaf\x9b\x8a\xdd\x2a\xc0\xfa\xc7\xf9\xd1\x57\x4f\x85\xde\x32\xac\x0a\x76\x2d\x7c\x0d\x97\x61\x2d\x78\x77\xbf\xd9\x90\xec\xe4\x64\x84\x28\x71\x9c\x6e\x04\x03\xd7\x0b\xfb\xd8\x60\x8f\xbe\xf6\xdb\x4b\x21\x0c\x62\xee\x05\xd9\xcc\x90\x38\xce\xb6\x1d\x0c\xb2\x45\xbd\x6d\x9c\x6d\x3b\x18\x64\x8b\x7a\x7b\x71\xb6\xed\x48\x90\xcd\x2c\xda\x64\x2f\xec\xd1\xba\x47\xc4\xfd\x38\x4a\xe4\xfc\x0d\xef\x86\xfe\x6e\xc4\xd4\xd0\xdf\xea\xa4\xa8\x85\x64\xb7\xd2\x9a\xd3\xca\xe8\x37\x1e\x81\xa4\xed\x92\xf5\x7d\x80\xfd\x86\xf6\x5e\x97\x49\xcf\xe6\xdc\x25\xbd\x05\x8c\x45\xb4\x80\x88\x70\xb5\xf3\x02\x29\x10\xe6\x41\x9e\x2a\xb9\x3a\x3c\x24\x67\x5b\xd6\x7e\x6a\xb9\xc4\x4b\x17\xa4\xab\x89\xbc\xa6\x92\xc8\x6b\xb6\x23\x6b\x2a\x8b\xeb\x1c\xfb\x9d\xab\xc3\x75\xcd\xd6\x75\xbb\x23\x15\xdd\xc1\xc1\xd0\xd5\x44\xd4\xe4\x9a\xb6\x6b\xb2\xa8\x05\x53\x3d\xf1\xb8\xd5\x0b\x49\xd4\xff\xff\xb4\x58\xb4\xf7\x56\x67\xb8\xe8\x14\x18\xa4\x38\xe2\x5e\x1f\xd0\x8b\xce\xde\x41\x89\x2b\xf5\x35\xe2\x58\xf4\x02\xaa\x12\x96\xc8\xd5\xa6\x03\x1d\x1c\x2f\x4d\x99\x43\x48\x71\xaf\xf8\x7f\x62\x9a\xfc\x92\xa7\x05\xdc\x1e\x03\x29\x39\x3c\x24\x7f\x86\x77\xf6\xfe\x72\x7e\x4c\xce\x57\xbc\x51\x74\x20\xdb\x41\xb3\x0a\xfc\xeb\xd3\xee\x3d\xaf\x92\x94\x40\x04\x82\x4a\x40\x05\xe1\xb8\xff\xd0\x63\x6e\x3a\xd9\x32\xba\xce\xad\xb3\x48\xae\x58\x55\x7f\x22\x8b\x9a\x75\x44\xb9\xdb\x60\x1c\x65\x50\x54\xca\x25\x11\x8c\x2d\xba\x18\x92\xac\x49\xbb\x11\x19\x59\xf2\x2d\x13\x84\xcb\x8e\x14\x9b\x4e\xd6\x6b\x47\x06\x78\xd4\x4f\xf1\xe1\x16\xd8\x10\x05\x21\xcc\x3d\x74\x24\x8f\xa2\xf6\xfb\xcd\x5a\x1b\x79\xa9\x73\xea\x74\x55\x95\xbd\x4c\x91\x20\xd5\x52\x72\x42\x6e\xa7\x5e\x15\x28\xa8\x25\xed\xf9\x02\xf5\x6f\x8d\x94\xa7\xe1\xae\xf3\x58\x88\xdf\xb3\x7e\xd1\x92\x45\x33\xd5\xf7\xdf\x0f\x0f\xc9\x0f\x94\x57\x6c\x91\x4f\xb5\xe1\x68\x76\xd7\x2b\x32\x3b\x36\x61\x89\xd2\x55\xb6\xa2\xe6\x37\xf6\x02\x94\x0b\x73\x24\x2d\xb5\x1b\x40\x91\xd0\x0e\x80\x2b\x65\xb6\x0e\x56\x5f\x73\x2c\x68\x55\xfd\x4f\x56\x35\xac\x25\xfd\xe3\x49\x7d\xc4\xd7\x86\x34\x49\xd3\x1c\x8d\x90\x3c\xcf\x83\xeb\x27\x9e\xdd\xd1\xd3\x16\x6f\x69\x93\xd8\x00\xeb\x0a\xb7\x8b\x89\x5c\xda\x7c\xc8\xdd\x88\xbb\x82\x8b\xfc\x91\x09\xeb\xa4\xa0\xf3\x65\x8f\x0a\xdb\xcf\x06\x2c\x62\x45\xe9\xc5\xb9\x1e\x0d\x30\xbd\xa5\x8d\x8e\x4e\x6b\xf2\xdc\x74\xb8\xac\x9f\x64\x1b\x3d\xb3\x13\xd3\xca\xeb\xa9\x94\x33\x52\xe1\x53\x4b\x9b\xbf\x74\xee\x75\x43\x73\x45\x2f\x48\x0b\x0d\x58\x35\xaa\x2b\xa4\xa6\xdc\xec\x81\xe1\xa2\x31\xb0\x5f\xed\x89\x15\xa8\xf4\xad\xf7\x24\xe3\x46\xfc\x63\x70\xb1\x47\x53\xad\xd3\xe3\x63\x08\x38\x81\xd0\xf9\x18\x7b\x12\xf8\x49\x31\x23\x1a\x7e\x4a\x2c\x78\xaf\x47\x9b\x5e\x7e\xe4\xc3\x33\x16\xf6\xd8\x57\x77\x5e\x41\x95\xbd\x0d\x05\xbb\x56\xfb\x47\x3e\x73\x87\x8d\x8e\x74\x34\x21\xe8\x0e\x68\x7d\xf5\xc9\xd3\xf9\xe9\xb4\x97\xc9\x72\x8a\x74\x1c\xab\xa1\x85\x1a\xb7\x56\xdf\xbf\xe8\xb9\x6b\x78\x1c\xa4\xf1\xb9\xa4\x03\xa2\xfd\xd2\x49\x75\x56\x85\x47\x92\x94\xb9\x57\x9d\xdf\x3b\x96\xf4\xe7\x9e\x6d\x1f\xca\x96\xe9\x04\xe5\x1d\x3d\x9b\xff\x69\xb9\x22\xdc\x8f\x4a\x54\x5c\xba\xa8\x2f\x4a\x3a\xf4\xd0\xbf\x8f\x69\xe4\x08\x32\x1e\xce\xf2\x7f\x74\x42\x00\xa8\x2c\x2e\x3d\x5e\x07\x99\x0d\xe1\x5d\x55\xf9\x38\xed\x39\xde\x13\x4c\x78\x4a\xbe\xc1\xca\x56\xb8\xc4\x25\x65\x6e\x2e\x9b\x0c\x06\x07\x60\xe6\xd1\xd8\x80\xef\x76\xf6\x0c\x5c\x73\x1b\xf9\x51\x8f\x12\xa6\x38\x3e\x21\x07\x16\x19\x08\x33\xe8\x0d\x00\x2d\x0a\xec\x74\x3a\x60\xd7\x9c\x4b\x5e\xac\x76\x3f\x9f\x39\xdb\xe6\xde\x88\x50\x3a\x90\x6f\xc3\x34\x0e\x82\x84\x00\x45\xf0\x32\xc2\x1d\xee\x03\xfc\x6c\xde\xeb\x31\xdb\xc1\x89\x23\xdc\x3e\xf9\xf9\x2c\x3a\x84\xdd\x77\x83\x93\x7b\x45\x06\xcc\x20\x88\x34\xf8\x4b\x44\x0c\xe0\x25\x88\xaf\xe1\xfb\x0b\xb8\x20\x73\x70\x40\xb8\x33\x39\x79\xa9\x68\x8b\x83\x97\x4c\xfe\x45\xfd\x9c\x48\xba\x4c\xbf\xd6\xed\x2f\xf4\xad\x1a\x5d\xe5\xa9\xf3\xc9\x50\x5a\x80\x72\xf8\x3a\xb5\xbe\x4b\x3e\xa2\x35\x27\x93\x49\x1d\x6e\xeb\x58\x7b\x4e\x62\x85\x00\x0a\x66\x38\xdc\xef\xa5\xcb\xe1\x00\xc0\xd1\x03\x41\xf6\xbd\xb7\x68\xa3\x30\x86\xbb\x94\xcf\x66\x19\xa9\x01\x3f\x20\x40\x50\xab\x9f\xa6\xe4\xc1\x3c\x3f\x34\x36\xe1\x6d\x70\xb0\xdc\x91\x1a\x3c\x1b\x80\x35\x50\xab\xc3\x6e\xfd\x79\x6f\xc3\xc9\xbc\xd9\x7a\x2a\xc5\xb9\x73\x03\xf1\x00\x8f\xf0\xc8\x2a\x53\x58\xe6\x3f\x8c\xa4\x85\xa7\xdb\xe7\xd4\x83\x6c\x95\x55\x1c\x0e\x38\x38\x88\x4a\xc4\x6d\xba\x35\xba\x12\xde\x0b\x3f\x7c\x16\x77\x9f\xc5\xda\xf8\xc4\xcf\x48\xe7\xbd\x22\x60\x28\xfa\x44\xe6\x75\xde\x73\x04\x7d\x63\x22\x23\xb7\x16\x62\x9f\x41\x43\x97\x8e\x61\xd0\x7e\x0c\xd5\x68\xe7\x7f\xfa\x7b\xd2\x56\x9a\xba\xf4\x8f\xda\x92\x32\xd8\xa5\x87\x87\xa4\x53\x3e\x4d\xc5\xe8\x42\x75\xea\x1a\x5a\x30\xb5\xd1\x21\xb0\x6d\xa3\xdc\x6f\xf0\x6d\x0d\xba\x84\x18\x8c\xa4\x4b\xa8\x57\x3f\x21\xff\x46\xfe\x4d\x1b\xfd\xaf\x5e\x19\x4b\x81\x2e\xc9\x09\x76\x39\xbe\x34\x4e\xd7\xd2\x5e\xb7\x0b\xaa\x3f\x34\x02\x05\x15\xca\x08\x2f\xea\x0a\x1d\x95\xc3\x43\x42\x11\x13\x52\xb7\x84\x92\xbf\x6f\x6a\xc9\x94\xe1\x4e\x49\xb7\x13\x92\xde\x62\x2a\x09\xd0\x7c\x14\xcb\x17\x88\x65\xd8\x70\x1c\x37\xcc\x7a\xeb\xe0\x25\xe1\xaf\xe6\x26\x66\x0d\x40\xef\xef\x23\x18\xa6\xe1\xd5\x3c\x84\xe2\xd7\xb7\x98\xf0\x34\x72\x41\x01\xba\x38\xe6\x97\x69\x48\xa9\x57\xf3\xe3\x4b\x9f\x1a\xb0\xe2\x85\xe1\x9c\xac\x49\xc9\xc5\x02\xfd\x1b\xbd\xea\xf9\xe3\xab\xb6\x6b\x2a\x7d\x8e\xfd\xe7\x7f\xea\x66\xbd\x56\xfd\x84\x69\xb0\xee\x60\xd5\xbd\x15\xfd\x1d\xfd\xac\x78\x4d\xaf\xe6\x63\xab\xf2\xaf\x5c\xde\x74\x5a\x0a\xb6\x98\xfc\xfe\xa8\xe1\xc0\xb5\xce\x0f\x02\x16\x9e\xe0\x0c\xa9\x67\xf7\x99\xa5\x07\x1b\x65\x36\x1b\x30\x77\xf4\xf9\x1e\x99\x3b\x8f\xd9\xcf\xd6\xa7\x32\x56\x8c\xbd\x42\xbf\xc7\x80\x8c\xb2\x1b\x90\x91\x94\x32\xaf\x98\x48\xfd\x5a\x0f\x67\xbf\x00\xd0\x11\xfb\xc5\x37\xb3\xb5\x75\x38\x18\x3b\xe9\x9b\x15\x03\xc9\x3c\xdf\xc8\x98\x4e\x26\x74\xbf\xd2\xfe\xdd\xb4\xf6\x6f\x3b\x94\x7f\xa3\xde\xa6\xee\x35\x57\x7b\x10\x3e\x51\x6f\xd3\xe0\x96\xc9\x7e\xcd\x3d\x74\xb6\x3e\x8c\x3a\x3d\x7b\xd1\x44\xdd\xdd\x2b\x6a\x1c\xf2\xdd\xc2\x2c\x5a\x17\x45\x46\xd1\x7d\x1f\x96\x39\xac\x91\xdc\x27\x73\xc6\x6e\x37\xd7\xca\xf7\x48\xfc\x88\x7c\x1a\x69\x8c\xdc\xa7\xc7\x05\x93\x93\x57\x6e\x35\x26\x2a\x6c\x82\x11\x28\xb6\x5d\x18\x60\xfe\x97\xb4\xfe\x73\x48\xab\x2d\x7b\xec\xf0\xbe\xe8\x4b\x70\xfc\x94\xbd\x11\xa8\x95\x7e\xf6\xb7\x93\xed\x98\xa4\xe2\x69\xb7\x47\x54\x7d\x6d\x18\x88\x15\x14\xdc\x05\x8f\x14\x4d\x27\x93\x42\x1f\x2d\xe0\xbf\x85\xcc\xb6\x8f\xd4\xf4\x58\x7e\x50\x7c\x96\x13\x0e\x54\xda\xe7\x85\xdb\x00\xcd\x77\x54\xd2\x24\x25\x17\x47\x97\xde\x9d\x2d\x84\x8f\x7f\x03\x06\x44\x6c\x16\xf4\x37\x41\xcb\x6e\xd3\x98\x67\xee\x76\x36\x2a\xed\x5f\x17\xf3\xe6\xd3\xc1\x93\xa8\x44\x62\xf4\x00\x84\xca\x8d\xf1\x88\xe1\xbe\x22\xf0\x69\xf8\xb4\xfa\xc8\xd8\x28\x6a\x7a\x4d\xc5\x7b\x6f\xb0\x79\xa0\xfc\x49\x83\xe5\x75\x5b\x7f\x7a\xcf\x2b\xcd\x33\x60\x88\x85\x14\x96\x79\xf4\x00\xc5\x1b\x4c\x07\xbf\xfb\x41\xb4\x27\x61\xe2\x62\x67\xcf\x14\x17\xc5\x9d\x7d\xe2\x02\xd1\x5c\x13\x10\x7e\x92\xf1\xe2\x97\x22\xf7\x03\xbe\xf6\x76\x40\x74\xd8\x8c\x85\x86\xc3\x93\xe5\x31\x0e\xeb\x41\x57\x9b\xb2\x64\x36\xf1\x38\x08\x22\xe4\xce\xd8\x0d\x07\xbf\x2e\xcf\x61\xfe\x1c\x02\xff\xc8\xc4\x3e\xf2\x9a\xdd\x1e\x5c\x9c\x7c\x8c\xcc\x18\x55\x87\xea\x26\xd8\x2d\xa8\x58\x35\xa8\xbd\x51\xcb\xd7\xa1\xd6\x1d\xa8\x1c\x8c\xb6\xc1\x53\x21\xcd\x63\x7e\x7e\x06\x0a\xc1\xf1\xea\x21\xf4\x1c\x72\xbb\xbb\x0a\xa3\x24\x57\x9e\xf1\xad\xf9\xe5\x6e\x3a\xd9\x0e\x96\x74\xdf\xf6\x8b\x9d\x27\xb7\xe4\x84\xdc\xe6\x36\xa1\xea\x9e\x02\xc1\xac\x72\x0e\x07\x95\xe0\x55\xfa\x48\x45\xc2\x58\x35\x40\xf4\xc7\x29\x42\x35\x87\x82\x59\x60\x0d\xf5\x98\x09\x3d\xf4\xe5\x16\xbe\x8c\x3c\xa8\xff\x58\x55\xc4\x58\x91\x67\x94\xbd\xbb\xb5\x7f\x29\x64\xe8\x91\x72\xef\x9a\xc3\xf3\x11\x37\x79\xd3\xe8\xca\xf7\xd3\x10\xbf\x0d\xee\x69\x3b\xb1\x03\xe7\x0d\x06\x00\x4b\x1b\xef\x09\xcb\x40\x50\xbe\xdd\x49\xd6\x25\xb7\xe4\xe2\xd2\x5e\xb6\x1a\x16\x17\xd3\x8a\x85\xe1\xa9\x57\xed\x12\xd6\xe4\xbf\xd0\x35\xf9\xe3\xb5\xce\x66\x56\xf3\xe8\x20\x5c\xb7\xf3\x1e\xfb\xf2\xef\x1a\xf5\x28\xe6\x4f\xac\x6b\x6e\x31\xc4\x62\x6b\x6c\x34\x3a\xc1\x47\x53\xb4\xbf\x38\x8f\xae\x31\x79\x05\x16\x78\xa9\xa8\x57\x62\xe1\x86\xf5\x2e\x33\x79\x03\xfc\x32\x8b\xde\x08\x77\xa1\xc9\x1b\xe1\x97\x5a\xf4\x46\xf8\x97\x9a\xbc\x31\x61\xb9\x05\x92\xe9\x84\xb8\xd1\xfa\x4d\xb3\xa7\xc8\x4d\x87\x5c\x1c\x94\x89\xb7\xb4\x49\x04\x7a\xf5\x4f\x17\x87\xbd\xd1\xca\xa8\x04\x89\x97\x44\x90\x37\x63\xbe\xd5\xfd\x3d\x11\xe4\x1b\xfb\x35\x4e\x9d\x0e\xa6\x2b\x90\x16\xa6\x6b\x60\xd2\x12\x2e\xf4\xa2\xb4\x78\x09\xf6\x69\x9f\x18\xf4\x44\xc0\xf4\xef\xf1\xbf\xcf\xfb\xa8\xab\x63\x7c\x9f\xe9\x51\x57\x8f\xe3\x62\xf0\x8a\xec\x10\x13\x0d\x8c\x11\x3e\x2a\xcb\xe6\xff\x05\x1f\x5f\xff\x06\x96\x21\x45\x86\x18\xf6\xa3\x7d\x48\xf4\xff\x03\xc3\xc4\x5e\x0e\xf5\xd7\xf9\xfb\xb0\x0c\xde\x77\xe5\x19\xb9\x89\x42\x6a\x5b\xda\x92\x04\x8e\x1d\x78\x67\x41\x47\x07\xf4\xcb\x9f\x5d\x74\x11\xda\xab\x63\xe0\x62\x11\x59\x58\xaa\xa5\x17\x88\x0b\x8f\x72\x88\x2e\xb8\x6a\x94\x61\x15\x8e\x4f\xaf\x76\xe6\xed\xd8\x8d\xa0\x8b\x45\xcb\xba\x0e\xaa\x3c\x5c\xfc\xe0\xe1\x99\x61\xbe\x02\x5e\x63\xf7\x82\x7b\x7a\xa9\x27\xee\x15\x3f\x8c\x87\x80\xfe\x1b\xb8\xcc\xe8\x99\xb3\xbd\x68\x0f\x02\x82\xc9\xf4\xe8\x20\xf4\x83\x73\x8f\x89\xf0\x67\x7b\xe3\x37\xe4\x0d\xe1\xf8\xc3\x37\x7b\xbd\xf2\x88\xb4\xe8\xa1\x0f\x84\x94\xae\xea\x8d\xd0\x7f\xfd\x24\x2e\xf2\x39\x2b\x13\x70\xc2\x8f\x6f\x2e\xd3\x67\x7a\xd5\xe6\x5e\x95\x92\x90\x07\xef\xfe\xcf\xe0\x32\x46\x1e\xe5\x1d\x90\x8d\x11\xcc\x9f\xf1\x4c\x6f\xb7\xb9\xea\x34\x6e\x5d\x46\xd4\xe6\x88\xeb\x19\x46\x36\xd2\x17\xb0\x93\x32\xb2\xfa\xd7\x66\xfa\x27\xdc\x4c\xcf\x96\xcd\x2f\x9e\x22\x9c\x2b\xf2\x86\xdc\xe0\x0f\x4f\x91\xd2\x2f\xfe\x91\x62\x9a\x91\xd5\xe3\x92\xfa\xb6\xaa\x3b\x7d\x33\xc5\x9e\xc4\xca\xf9\xf5\x4e\x66\xdf\x3f\xeb\x5f\x89\x54\xe3\x43\x37\xde\xd4\x8a\x75\x4c\x2d\x77\xb4\x98\x0e\x3f\x7f\x66\x39\x5d\x71\x4d\x45\xcb\x8a\x6d\xff\x9d\xa2\x8c\x88\x2b\x88\x84\x0d\xbf\xcc\x92\xe0\xb4\x6c\x91\x91\x16\x2f\x99\x99\xbf\x23\xa1\x36\x52\xbd\xc6\x3f\x98\x77\x71\xe9\xdf\x1d\xb8\xbb\x1b\x78\xd6\xff\x3a\x7d\xc0\xb2\x78\x71\x85\x9e\x25\x8c\xb5\x17\x2b\xe0\xd7\x2c\xb8\x82\x70\xa7\x8b\x67\x10\x83\x9f\x19\xcc\xe4\x13\x09\x07\xa5\x06\xea\xc1\x01\xb1\x5d\x75\x68\xf6\xb5\xb1\x67\x4e\x4e\xc8\xdc\x4f\x9e\x83\x6b\x98\xb9\xdb\x54\x13\x45\x9c\x60\x0a\x07\x64\x3e\x6c\x2b\x78\x6f\xcf\xa0\xa5\xa0\x41\xd8\xa9\xd3\xe0\x7e\x52\xfc\x7d\xde\xff\xe3\x02\xd7\x54\x74\x40\x8b\x3e\x8f\xfa\xac\xb1\x7c\x73\x71\xcc\xe7\xb1\x63\xc4\x87\x0e\x4d\xc6\x7f\x3a\x9e\x8d\x5e\xfb\x6a\x11\x4e\xa2\xff\xed\xc8\xc5\x65\xbb\x11\x92\xaf\xd9\x39\x34\xc0\x1b\x5d\x75\xc7\x04\xbe\x1e\x0e\x7f\x8b\xf2\xaf\x03\xa2\xac\xef\x0b\xf5\x9f\xfa\x35\x80\xbd\xf7\xa5\x3b\xef\x95\x36\x33\xad\x17\x4d\xc1\x89\xbf\xe3\x6d\xd2\xe5\x50\xcb\x6d\x23\x2a\xfa\x8b\x17\x3c\x80\xf9\xf1\xa5\xbb\x90\x9e\xe1\x90\x9f\x59\xb1\xc5\xfe\xd7\x03\x4f\x0c\xf9\xa1\x63\x5d\x90\xd4\xbb\x0a\x9b\x17\xd7\xe6\xb5\xac\xe8\xd3\x6b\x73\x15\xa2\xb8\x1e\x7c\xac\x01\x86\xda\xac\xf8\x18\xc2\xc5\x75\x84\xf2\x39\x13\x8b\xa7\xa2\x3c\xf4\xe6\xc9\x3f\x70\x21\xa3\xef\x52\x74\xf9\xc0\xd3\x52\x8f\x2e\x1c\xb6\xa9\xbb\x9c\xf8\xf8\x1e\x28\x86\xd4\xcd\x6b\x1b\x15\xe6\xa5\x27\x42\x46\xc0\x2e\x8a\x4b\x14\x26\x78\x3c\xde\xc8\x84\xde\x27\x7b\x75\xd8\xd0\x5f\x2a\xf3\x80\x3e\x49\xa1\xd9\xbf\xb1\x32\xae\xce\xbc\x0d\x5a\x18\x0d\x6b\x36\xe9\x77\x8c\x35\xdf\xff\x7d\x43\xab\x84\xce\x33\x42\x8f\xc2\x3f\x42\x60\xf4\x18\x9f\x0f\xbb\xb4\x54\xad\x82\x1f\x8d\x7c\x3c\xd2\x77\x2a\xe7\x8a\x32\xfc\xc8\xd7\x1c\x78\x99\xf6\xc1\xfb\x2e\x78\x05\x99\xb7\x23\xff\x97\xf9\xc8\xed\x29\x7e\x34\xf4\x61\x9f\x66\x5a\x30\xd6\xa0\x79\xa4\x16\xfb\x97\x2e\x31\xd6\x3e\x9d\xa7\x99\x35\xfd\xe9\x51\xaa\x83\xb3\x86\x3e\xbd\x71\xdb\x79\x46\xb6\x47\xe6\x35\x84\x2d\xef\xb8\x64\x0b\xa5\xdf\x8f\x2e\xe3\x93\xda\x52\xaf\x24\x2f\xb6\x73\xb8\x82\x58\xf1\x05\x86\x67\x5e\x6c\x8f\xbc\x06\x0f\xf3\xb0\xe7\xc1\x41\xd8\xd3\xde\x64\x9b\xeb\x3b\xd4\x8a\x1a\xdb\x23\xf3\xcb\x20\x05\x82\xee\xe3\x75\xdf\x51\x6a\xd6\xeb\x95\xa9\xf1\xd6\x38\x52\x20\xf6\xf6\x3d\xf2\xe3\xa9\xde\xad\x9e\xed\x3c\xbe\xf1\xac\x53\x41\xee\x6d\xfd\x2c\xba\xb1\xfc\x51\xbf\xa6\xe6\xb4\xba\x21\xb8\xa9\x15\xda\xce\x31\x40\x7b\x82\x1d\x2f\x5e\x5f\xc2\xbd\x96\xa3\xb0\x75\x7e\x19\x5e\x5c\x46\xf1\x73\x97\xab\x0c\x54\x7b\x90\xea\x86\x8c\xf4\xd8\x7a\x87\x33\x66\x7a\x8e\x87\x27\xae\x31\xc8\x79\xcc\xfd\x5b\x8c\xee\x15\x51\xfc\x64\xf2\x21\xc8\xd8\x20\x3b\x32\x78\xef\x5a\x0f\xf3\x13\x7f\x1e\x0b\x1e\x59\x37\x6d\x89\x50\x8e\xc7\xdc\xdc\xc8\xc0\x80\x14\xce\x8d\x69\x3d\x3f\x2f\x63\x26\x7e\x18\xb8\x51\x2e\xa2\x6b\xe4\x03\x3b\xc7\xa6\xe7\x81\x7a\xde\x2f\x48\xed\x47\x6e\x97\x87\x8b\xe8\xe7\x29\x42\xf2\xdd\xdf\xf7\xc8\x67\xb2\x49\xae\x13\x8a\x8a\xfe\x2d\x9c\x65\x08\x7d\xf3\x1a\xcd\xf6\xc8\xfd\xa8\x51\x0f\x6f\x04\xfc\x26\x18\xfe\xfb\x50\x96\x3d\xee\xb6\xfe\x67\x92\xde\xdc\xe9\x87\x99\xbd\x5f\x3e\x97\xf4\x3a\x37\xfa\xa8\xcc\x0e\x48\xce\x13\x04\x36\x94\x57\x23\xaa\xf0\x40\x21\x90\xe3\x1d\x6d\xfe\xca\x76\x9d\x91\x58\x65\x0d\xaa\x8f\xe9\x93\x25\xd7\x3c\xac\x88\x5a\x05\x00\x9b\x42\x3f\x38\xeb\x70\x0e\x14\xd1\x95\xb6\x84\x2a\x38\xe8\xb6\x47\xf1\x17\xd0\xef\xb4\xea\x69\x78\x5a\x1d\x45\x4d\x7d\xc6\xd0\x6a\x0e\x46\xca\xd1\x6f\x60\x45\x5c\x8e\x30\x2a\xdf\x78\x91\x38\x4e\x04\xbb\x61\x23\x2c\x09\xbc\xf8\xe1\xea\x72\xb5\x07\x4f\x3b\x58\xd5\x53\x52\x81\xea\x10\xd5\xb9\xc0\xa7\xf4\x3e\x72\x99\x43\xe7\xa2\xfd\xdf\x00\x00\x00\xff\xff\x29\x45\x71\xc5\xae\x88\x00\x00"),
+ },
+ "/src/reflect/reflect_go111.go": &vfsgen۰CompressedFileInfo{
+ name: "reflect_go111.go",
+ modTime: time.Date(2018, 10, 3, 6, 16, 29, 68543536, time.UTC),
+ uncompressedSize: 3460,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x56\xdf\x6f\xdb\x36\x10\x7e\x16\xff\x8a\x8b\x30\x04\x64\xad\x28\xc9\x6b\x5a\x07\x28\x86\xa2\xcb\x86\xb6\xc3\xd2\x76\x0f\x41\x50\x30\x32\xa5\xd0\x95\x8e\x02\x49\x39\xce\xd2\xfc\xef\xc3\x91\xb4\xfc\xa3\x2e\x92\x02\xdb\x8b\x21\xf3\xc7\xdd\x7d\xdf\x7d\x77\xc7\xe3\x63\x98\xdc\x0c\xba\x9d\xc1\xdc\xb1\xf5\x9f\x83\xc6\x9c\x96\xa7\xa7\xe5\x29\x63\xbd\xac\xbe\xca\x46\x81\x55\x75\xab\x2a\xcf\x98\xee\x7a\x63\x3d\x70\x96\xe5\x03\x3a\x59\xab\x9c\xb1\x2c\x6f\xb4\xbf\x1d\x6e\xca\xca\x74\xc7\x8d\xe9\x6f\x95\x9d\xbb\xf5\xc7\xdc\xe5\x4c\x30\x56\x0f\x58\x41\xa7\xfc\xad\x99\xfd\xa5\x2a\xa5\x17\xca\x72\xd3\x83\xf3\x56\x63\x53\xc0\x02\x3e\xcb\x76\x50\x05\x68\xd0\xe8\x05\xf0\x2f\x05\x78\x78\x61\xfd\x7d\xaf\x0a\xa8\x11\xa2\xbb\xf2\x4f\xa3\xd1\x2b\x2b\xe0\x81\x65\x0b\x69\xa1\xb7\xa3\x11\x96\xe9\x1a\x16\xa5\xbf\xef\xcb\x3f\x34\xce\xb8\x80\xe9\x14\x2e\xe8\x74\x2d\x2b\x45\x17\x32\xef\xe1\x6c\x0a\xfc\x85\x5e\xad\x7e\xbc\xef\x95\xe0\xdb\xb6\x79\xb0\x21\x04\xcb\xc8\xa0\x86\x57\x70\x02\xdf\xbe\x81\x86\xf3\x29\xb4\x0a\xb9\xf7\x65\xc4\xe1\x42\x14\x59\xd6\x4b\xd4\x15\xcf\x13\x49\x67\x10\xac\xa0\x6c\x41\x59\x6b\x2c\xfd\x5f\xc8\x56\xcf\x12\x7a\xd0\x38\x53\xcb\x9c\xcc\x3f\xb2\x2c\xeb\x28\xa2\xc3\xb5\xcd\x2b\x7d\x1d\x1d\x1f\x78\x5f\xa2\xec\xd4\x87\xba\xe6\x5d\xf8\x12\xa5\x76\x6f\x96\x94\x00\x45\xe8\xf6\xfa\xce\x61\x02\xa6\x87\x09\xe4\x60\x6a\x18\x50\xa5\xf3\xc9\xf9\xe8\xd6\xc3\x14\xbc\x27\xa0\xc9\x01\x41\x66\x59\x16\xf8\x0c\x5b\xbb\xbe\xe9\x97\x0b\x96\x3d\x82\x6a\x5d\xa4\xb3\x73\x14\x7c\xa4\x7c\xe5\xe8\x5d\x84\xc1\x13\x7d\x83\x46\xcf\xb5\x20\xee\xc2\x27\x11\xd8\x39\xf1\x9f\x31\xd7\x6d\x10\x16\x03\xf9\x7f\x39\x8b\x3e\xd6\xb4\x75\xdb\xbc\xcd\x5d\xf9\xb6\x35\x37\xb2\x2d\x7f\x95\x6d\xcb\xf3\x5f\xa2\x89\x4b\xe5\xf3\x02\xe6\x8e\xe4\xb6\x92\x57\x79\x41\x68\xb8\x16\xe5\x5b\xe5\x79\x4e\x06\x72\x51\x5e\x06\x29\x07\x9e\x59\x66\xab\x85\x8d\x0c\x9b\x9b\xb9\xaa\x3c\x2d\x93\x24\xdd\xdf\x56\xf6\xbd\x9a\x25\x53\x01\x55\x38\x3b\xdd\xf6\x51\xbe\x57\x77\x9c\x36\xa2\xb9\x1a\x61\xba\x53\x47\x61\x37\x04\x40\xfe\x45\xf9\x29\xec\x72\x12\xbf\x55\x7e\xb0\xc8\x1e\x53\xe9\xf2\x54\xa1\x02\x2a\x42\xb6\x51\xba\x1a\xe1\xea\x3a\xed\xa5\x8f\x55\x75\xf2\xc0\x1a\x40\x2a\x64\x96\x51\x0c\xb0\x13\xc3\x2a\xf8\x17\x73\x57\x7e\x08\x38\x59\x26\x52\x31\xd7\xad\x6c\x0e\xe9\x27\xca\x0a\x0e\xa6\x70\x12\xe0\x52\x7b\x08\x7d\x61\xfa\x7d\x53\x29\x60\x41\x51\x79\x1e\xef\x8b\xf3\xf3\xb5\x85\xcb\x5b\x5d\x7b\xb1\xe6\x6b\x93\xda\x1f\x72\xfb\x24\xb9\xc4\xee\x46\x5d\x8c\x42\x89\x80\xbf\x23\x7d\xed\x74\x93\xf0\xb5\x97\xf2\x13\xce\x54\xad\x51\xcd\x28\x6f\x81\x0a\x32\x33\x05\xd4\x6d\x70\xb0\xad\xe0\x32\x70\x1e\x14\x77\x16\xb2\x43\x32\xa6\xa3\x94\x38\xaf\x0d\xe6\x22\xd9\x71\x97\xad\xae\x14\x49\x8a\xd4\x3a\x85\x9c\xee\x84\xb5\x9c\x65\x48\xeb\xbe\x7c\x3f\x74\x17\x38\x2a\x2d\x5e\x78\x58\xb5\xa4\xf2\xc2\x7d\x96\x56\xcb\x99\xae\x7e\x54\x4d\xa3\xc9\x10\x85\xc1\xa3\x45\xba\xb0\x15\x4e\x28\x28\x5d\x87\x86\xaa\x51\xc0\x2b\xc0\xa7\xcc\xdd\x69\x7f\x0b\xde\x18\xa8\xd5\x1d\x68\xec\x07\x0f\xd2\x36\x43\xa7\xd0\xbb\x7d\x26\xcf\x7f\xc2\x64\x27\xf1\xfe\x47\x36\x37\x12\xab\x6b\xd8\x47\x01\x1e\x1d\xfd\x24\xa2\x67\x83\xd9\xa5\xfc\xf0\xf0\x79\xf8\x9e\x09\x8d\x65\xb5\xb1\xf0\xa5\x80\x25\x25\xdf\x4a\x6c\x14\xd5\x73\xc2\xba\xdc\x1a\xa4\xb1\x15\x3f\xd5\x41\x07\xa7\xb1\x81\x7f\x94\x35\xb1\x5f\x8c\x4e\x77\x7c\x6a\x72\x78\xf2\x32\xcc\x57\x7c\x09\x7a\x32\x19\xbd\xfa\x02\xbc\xb4\x0d\x1d\xd0\x78\xa5\xaf\xcb\x50\x75\xa2\x20\xee\x91\x6b\xf1\x12\x0e\x96\xbe\x7c\xed\x9c\x6e\x50\xde\xb4\xea\xa3\xe1\x74\xfe\xe9\xee\x1e\x63\xa3\x85\xa5\x1f\x3b\x6d\xd8\x91\x0e\xa8\x41\x85\x3d\xb2\x35\xee\xae\x83\xa6\x64\xac\xea\xe1\xf0\x70\x9f\x0e\x8e\x8f\xa1\xb7\xaa\x97\x56\x81\x0b\xc7\x08\xa7\x55\x9d\xd4\x48\x7e\x17\x44\x87\x5b\x0d\xae\x55\x16\x8f\x00\x59\x96\xb9\x55\x5d\xbe\x93\x5f\x55\xf0\xc1\x03\x58\x14\x05\x74\x05\x74\x14\x86\x6a\x55\x17\x4b\x34\x6c\x94\x6f\x5a\xd5\x85\xb6\xb5\x4b\x67\xb7\xa6\x33\x5b\x26\x16\x71\x12\xc6\x64\xe4\x97\xd6\x96\x89\xd5\x3d\x64\x92\xa3\x44\xe6\x77\x6c\x56\x12\xd1\x78\x18\x9c\x7a\x92\x47\x32\xb3\xbd\xab\x31\x65\x83\xa2\x0e\x0a\x8f\xc0\xd7\xa3\xf0\x52\x79\xbe\x5c\xc9\xdf\x58\xdd\x5c\x60\x04\x40\xd2\x08\xcd\x5e\x7e\x55\x3c\x4d\x99\x02\x70\x72\x4a\x87\x2b\xd3\xdf\x73\x8d\x57\x67\x78\x5d\x40\xbc\x15\xda\x39\x5e\xe1\x35\x4c\x63\x32\x62\x07\x44\x8d\x1b\xe4\x87\xa4\xd2\xd2\xc1\x46\xe3\x7b\xaa\xc1\xde\x59\x83\xcd\xa8\x6a\xa8\xcc\x10\xb5\xfd\xc8\x32\x34\x83\x1f\x9b\xe8\x87\x81\x86\x0a\xcb\xa4\x6d\xdc\x6b\x6b\xe5\x3d\xed\xac\xdf\x07\x61\xe8\x87\xf5\x3c\x8e\x92\x31\x00\x91\x0a\xa4\x80\x54\x04\x5b\x65\x39\x9a\x23\xae\x12\x6f\x05\x0c\x78\x67\x65\xff\xbb\x8b\xf3\x93\xa7\x42\x09\x16\x4a\x19\x72\xfb\xd1\xec\x83\x93\x8f\x45\x45\xaf\xf7\xce\x20\x95\x19\xea\x56\x8c\x13\x4a\xa4\xa7\x88\x72\x43\xeb\xc3\x7b\x8f\x26\xcc\x6f\xaa\xed\x95\xe5\x73\x57\x5e\xa4\x27\x5b\xf2\x5c\x93\x62\x69\x90\x05\xdf\x31\x52\x62\xc1\xdd\x69\x5f\xdd\x42\x60\xe8\x81\x65\x95\x74\x0a\x4e\xce\x68\xe8\x85\x67\x06\xf9\x4c\xab\xa7\x1b\xab\x29\xd1\x0f\x94\xf5\xf0\xc5\x7d\x49\xbc\x9e\x88\x02\x76\x00\xaf\x96\x53\xa0\xa2\x80\x13\xf1\xc8\xb2\x99\xaa\xe5\xd0\xfa\x64\x33\xbc\x18\xb7\x15\x64\x06\xbf\x55\x43\x91\x6c\x3a\x1b\x27\xbf\xf2\x57\xfa\x3a\x09\x6f\x33\x04\xbd\x3f\x04\xbd\x0e\x61\x54\x75\x88\x25\x69\x3a\x01\xb3\xca\x13\xad\x8f\xec\xdf\x00\x00\x00\xff\xff\x88\x68\xc5\x60\x84\x0d\x00\x00"),
+ },
+ "/src/reflect/reflect_go1111.go": &vfsgen۰CompressedFileInfo{
+ name: "reflect_go1111.go",
+ modTime: time.Date(2018, 10, 3, 6, 16, 32, 284955938, time.UTC),
+ uncompressedSize: 3559,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x57\xdf\x4f\xdc\xb8\x16\x7e\x8e\xff\x8a\x43\x74\x85\x6c\x08\x01\x5e\x69\x07\xa9\xba\xaa\x7a\xb9\xab\xb6\xab\xa5\xed\x3e\x20\x54\x99\x8c\x13\x3c\x4d\x8e\x23\xdb\x19\x86\xa5\xfc\xef\xab\x63\x7b\x92\x19\x3a\x15\x54\x5a\x69\x5f\x50\xc6\x3f\xbe\xf3\x9d\xef\xfc\x32\xc7\xc7\x70\x78\x33\xe8\x76\x0e\x0b\xc7\xa6\x1f\x8d\x39\x2d\x4f\x4f\xcb\x53\xc6\x7a\x59\x7d\x93\x8d\x02\xab\xea\x56\x55\x9e\x31\xdd\xf5\xc6\x7a\xe0\x2c\xcb\x07\x74\xb2\x56\x39\x63\x59\xde\x68\x7f\x3b\xdc\x94\x95\xe9\x8e\x1b\xd3\xdf\x2a\xbb\x70\xd3\xc7\xc2\xe5\x4c\x30\x56\x0f\x58\x41\xa7\xfc\xad\x99\xff\xa1\x2a\xa5\x97\xca\x72\xd3\x83\xf3\x56\x63\x53\xc0\x12\xbe\xc8\x76\x50\x05\x68\xd0\xe8\x05\xf0\xaf\x70\x60\xfd\x7d\xaf\x0a\xf0\x70\x40\x97\x3f\x85\x1f\x35\x42\x34\x5c\xfe\x6e\x34\x7a\x65\x05\x3c\xb0\x6c\x29\x2d\xf4\x76\x84\x63\x99\xae\x61\x59\xfa\xfb\xbe\xfc\x4d\xe3\x9c\x0b\x98\xcd\xe0\x82\x4e\xd7\xb2\x52\x74\x21\xf3\x1e\xce\x66\xc0\x0f\xf4\x7a\x95\xe0\x05\xdf\xc6\xe6\x01\x43\x08\x96\x11\xa0\x86\xd7\x70\x02\xdf\xbf\x83\x86\xf3\x19\xb4\x0a\xb9\xf7\x65\xf4\xc8\x05\x16\x59\xd6\x4b\xd4\x15\xcf\x93\x5c\x67\x10\x50\x50\xb6\xa0\xac\x35\x96\x7e\x2f\x65\xab\xe7\x49\x07\xd0\x38\x57\xab\x9c\xe0\x1f\x59\x96\x75\xc4\x68\x7f\xc2\xbc\xd2\xd7\xd1\xf0\x9e\xf7\x25\xca\x4e\x7d\xac\x6b\xde\x85\x2f\x51\x6a\xf7\x76\x45\xa1\x50\xe4\xdd\x4e\xdb\x39\x1c\x82\xe9\xe1\x10\x72\x30\x35\x0c\xa8\xd2\xf9\x64\x7c\x34\xeb\x81\x74\x58\x2b\xfc\x83\x04\xde\x93\x06\xc9\x76\x50\x83\x2e\x06\xb1\x67\xb0\x83\x18\xfd\xe5\x82\x65\x8f\xa0\x5a\x17\xb5\xee\x1c\x79\x16\xe3\xb1\x66\xf1\x3e\xfa\xc8\x93\xb6\x83\x46\xcf\xb5\x20\x61\xc3\x27\xa9\xdb\x39\xf1\x8f\xc9\xda\x6d\xa8\x19\x89\xfc\x6b\x82\x46\xf3\x93\xa6\xdd\x53\x51\x17\xae\x7c\xd7\x9a\x1b\xd9\x96\xff\x95\x6d\xcb\xf3\xff\x44\xfc\x4b\xe5\xf3\x02\x16\x8e\x40\xd7\x89\x59\x5e\x90\xab\x5c\x8b\xf2\x9d\xf2\x3c\x27\x80\x5c\x94\x97\xa1\x08\x42\x10\x58\x66\xab\xa5\x8d\xf2\x9b\x9b\x85\xaa\x3c\x2d\x53\x32\xbb\x3f\xad\xec\x7b\x35\x4f\x50\xc1\xe5\x70\x76\xb6\x6d\xa3\xfc\xa0\xee\x38\x6d\x44\xb8\x1a\x61\xf6\xa4\x02\xc3\x6e\x20\x40\xf6\x45\xf9\x39\xec\x72\x72\xc9\x2a\x3f\x58\x64\x8f\xa9\xfc\x79\xaa\x72\x01\x15\x79\xb6\x51\xfe\x1a\xe1\xea\x3a\xed\xa5\x8f\x75\x5d\xf3\x20\x29\xc0\xd4\x05\x58\x46\x34\xe0\x09\x8d\x35\xff\x83\x85\x2b\x3f\x06\x57\x59\x26\x52\x27\xa8\x5b\xd9\xec\xd3\x9f\x98\x76\xb0\x37\x83\x93\xe0\xf1\xd7\x02\x7c\x68\x2a\xb3\x1f\x7b\x53\x01\x4b\x22\xe6\x79\xbc\x2f\xce\xcf\x27\x84\xcb\x5b\x5d\x7b\x31\x49\xb6\xa9\xee\x4f\xe5\x7d\x56\x5f\x12\x78\xa3\x6e\x5e\x92\x48\x21\x71\x76\x05\x65\x62\xb4\x19\x90\x89\x42\xf9\x19\xe7\xaa\xd6\xa8\xe6\x14\xd7\xa0\x13\xc1\xcc\x00\x75\x1b\xac\x6f\xa7\x7f\x19\x62\x12\x32\xf2\x2c\x44\x8f\x6a\x80\x8e\x12\x3d\xaf\x0d\xe6\x22\xe1\xb8\xcb\x56\x57\x8a\x52\x8e\xb2\x79\x06\x39\xdd\x09\x6b\x39\xcb\x90\xd6\x7d\xf9\x61\xe8\x2e\x70\xcc\xc4\x78\xe1\x61\xdd\xec\xca\x0b\xf7\x45\x5a\x2d\xe7\xba\xfa\x59\x29\x8e\x90\x81\x85\xc1\xa3\x65\xba\xb0\x45\x27\x54\xa3\xae\x43\xab\xd6\x28\xe0\x35\xe0\x73\x70\x77\xda\xdf\x82\x37\x06\x6a\x75\x07\x1a\xfb\xc1\x83\xb4\xcd\xd0\x29\xf4\x6e\x17\xe4\xf9\x2f\x40\x76\x12\xef\x7f\x86\xb9\x11\x75\x5d\xc3\x2e\x09\xf0\xe8\xe8\x17\x3d\x7a\xb1\x33\x4f\x25\xdf\xdf\x7f\x99\x7f\x2f\x74\x8d\x65\xb5\xb1\xf0\xb5\x80\x15\x05\xdf\x4a\x6c\x14\xd5\x7b\xf2\x75\xb5\x35\xa2\x63\x1f\x7f\xae\xfd\x0e\x4e\x63\x03\x7f\x29\x6b\x62\x3f\x19\x8d\x3e\xb1\xa9\xc9\xe0\xc9\xab\x30\xb9\xf1\x15\xe8\xc3\xc3\xd1\xaa\x2f\xc0\x4b\xdb\xd0\x01\x8d\x57\xfa\xba\x0c\x25\x29\x0a\xd2\x1e\xb9\x16\xaf\x60\x6f\xe5\xcb\x37\xce\xe9\x06\xe5\x4d\xab\x3e\x19\x4e\xe7\x9f\x1f\x0d\x91\x1b\x2d\xac\xfc\xd8\x89\xc3\x8e\x74\x40\x5d\x3f\xec\x11\xd6\xb8\x3b\x91\xa6\x60\xac\xeb\x61\x7f\x7f\x57\x1e\x1c\x1f\x43\x6f\x55\x2f\xad\x02\x17\x8e\x91\x9f\x56\x75\x52\x23\xd9\x5d\x92\x1c\x6e\x3d\xf5\xd6\x51\x3c\x02\x64\x59\xe6\xd6\x75\xf9\x5e\x7e\x53\xc1\x06\x0f\xce\xa2\x28\xa0\x2b\xa0\x23\x1a\xaa\x55\x5d\x2c\xd1\xb0\x51\xbe\x6d\x55\x17\x7a\xda\x53\x39\xbb\x49\xce\x6c\x95\x54\xc4\xc3\x30\x63\xa3\xbe\xb4\xb6\x4a\xaa\xee\x10\x93\x0c\x25\x31\x7f\x50\xb3\x92\x88\xc6\xc3\xe0\xd4\xb3\x3a\x12\xcc\xf6\xae\xc6\x14\x0d\x62\x1d\x32\x3c\x3a\x3e\x8d\xca\x4b\xe5\xf9\x6a\x9d\xfe\xc6\xea\xe6\x02\xa3\x03\x94\x1a\x61\x12\xc8\x6f\x8a\xa7\x29\x54\x00\x1e\x9e\xd2\xe1\xca\xf4\xf7\x5c\xe3\xd5\x19\x5e\x17\x10\x6f\x85\x5e\x8f\x57\x78\x0d\xb3\x18\x8c\xd8\x01\x51\xe3\x86\xf8\x21\xa8\xb4\xb4\xb7\xd1\xf8\x9e\x6b\xb0\x77\xd6\x60\x33\x66\x35\x54\x66\x88\xb9\xfd\xc8\x32\x34\x83\x1f\x9b\xe8\xc7\x81\x26\x0e\xcb\xa4\x6d\xdc\x1b\x6b\xe5\x3d\xed\x4c\xef\x87\xf0\x28\x08\xeb\x79\x9c\x33\x23\x01\x91\x0a\xa4\x80\x54\x04\x5b\x65\x39\xc2\x91\x56\x49\xb7\x02\x06\xbc\xb3\xb2\xff\xbf\x8b\xc3\x95\xa7\x42\x09\x08\xa5\x0c\xb1\xfd\x64\x76\xb9\x93\x8f\x45\x45\xff\x21\x74\x06\xa9\xcc\x50\xb7\x62\x9c\x50\x22\x3d\x55\x94\x1b\x5a\x1f\x1e\x8b\x34\x61\xfe\xa7\xda\x5e\x59\xbe\x70\xe5\x45\x7a\xef\x25\xcb\x35\x65\x2c\x0d\xb2\x60\x3b\x32\x25\x15\xdc\x9d\xf6\xd5\x2d\x04\x85\x1e\x58\x56\x49\xa7\xe0\xe4\x8c\x86\x5e\x78\x86\x90\xcd\xb4\x7a\xba\xb1\x9a\x02\xfd\x40\x51\x0f\x5f\xdc\x97\xa4\xeb\x89\x28\xe0\x89\xc3\xeb\xe5\x44\x54\x14\x70\x22\x1e\x59\x36\x57\xb5\x1c\x5a\x9f\x30\xc3\x73\x73\x3b\x83\xcc\xe0\xb7\x6a\x28\x8a\x4d\x67\xe3\xb3\x40\xf9\x2b\x7d\x9d\x12\x6f\x93\x82\xde\x4d\x41\x4f\x14\xc6\xac\x0e\x5c\x52\x4e\x27\xc7\xac\xf2\x24\xeb\x23\xfb\x3b\x00\x00\xff\xff\x8a\x4a\xd5\xea\xe7\x0d\x00\x00"),
+ },
+ "/src/reflect/reflect_test.go": &vfsgen۰CompressedFileInfo{
+ name: "reflect_test.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 555503716, time.UTC),
+ uncompressedSize: 4442,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x6d\x6f\xdb\x38\x12\xfe\x6c\xfd\x8a\x39\xdd\x5d\x2b\xdd\x09\xb2\x65\xb7\x29\xa0\x22\x1f\xd2\xbc\x14\x59\xb4\xf1\xa2\x0e\x76\x3f\x18\xde\x05\x23\x8d\x2c\x36\x14\xa5\x25\x29\xa7\x5e\x43\xff\x7d\x41\xda\x96\xe9\xb7\xc6\x7d\x03\xea\x90\x33\xcf\x3c\xe4\xf0\x19\x8e\xe9\x6e\x17\xfe\xff\x50\x53\x96\xc2\x67\xe9\x38\x15\x49\x1e\xc9\x14\x41\x60\xc6\x30\x51\x7f\x2a\x94\xca\x71\x68\x51\x95\x42\x81\xe7\x74\xdc\x82\xa8\xdc\x75\x3a\xee\x0a\xa0\x87\x1a\x43\xf9\xd4\x75\x7c\xc7\xc9\x6a\x9e\xc0\x3d\x4a\x75\xc1\xe8\x94\x17\xc8\x95\xa7\xe0\x7f\x2b\x44\x78\xef\xc3\xc2\xe9\xa8\x70\xf4\x48\x2b\xcf\x77\x1a\x0b\x3f\x62\x34\xc1\xe1\x0c\x45\xc6\xca\xa7\x13\x63\x6e\x6a\x9e\x7c\x20\xf3\xb2\x3e\x75\x91\x0b\x21\xc8\x7c\x98\x5d\x51\x81\x89\xba\xcd\x48\x82\x27\x06\xde\xcf\x2b\x64\x94\x3f\xca\x51\x29\x14\xa6\x27\x46\xbd\xbf\x7c\x47\x95\x3c\x11\x7c\x99\x13\x7e\xc1\x58\x99\x9c\x88\xbf\x23\x05\xbe\x9b\x2b\x94\x17\x02\xcd\x61\x9f\xbc\xad\x61\x96\x49\x54\x1f\xca\xe4\xf1\x54\x6d\x50\x4b\x3d\xe4\xb7\x7c\x46\x18\x3d\xb0\xcc\xaa\x18\xc2\x25\xd0\x1b\x4f\xb6\x0d\x97\x44\xe2\xc2\xe9\x74\xf4\xff\xce\x15\x15\x31\xc0\x36\xe0\x13\x26\xb3\x40\x3b\xf5\x21\xc4\xad\xf3\x37\xc2\x6a\x5c\x34\xda\xd3\x04\x70\x34\x7a\x84\x3c\xfd\x7a\x74\x47\x43\x76\x3c\xc3\xcc\x8b\xfc\x3d\xea\x6d\xe6\x2b\xcc\x48\xcd\xd4\x12\xe5\x74\x9a\x9d\x63\x51\xa2\x4e\xd4\x30\xbb\xa1\xc8\x52\x2d\xc7\xd1\xe3\x74\xd7\x50\xf7\x30\xc3\x77\x07\x5e\x7f\xd1\x17\xf3\x53\xcd\xf0\x78\x99\x3d\xc7\xf1\xfe\xf2\xbb\x43\x2f\xd8\xf4\xfb\x97\x45\x8e\x82\x26\x3f\x42\x71\xca\x3d\x7e\x8e\xe3\x77\xaa\xf2\x5b\xae\x50\x7c\x0b\xcb\x8c\x08\x48\x11\xab\xeb\xbf\x6a\xc2\x34\x9b\x84\x73\x18\x4f\xae\x6c\xd3\xc2\xe9\x74\xbb\x60\xa6\x54\x51\x94\x4e\x67\xc1\x29\x0b\xc0\x7c\x28\x51\xa3\xae\xa8\x45\x14\x40\x64\x4d\x29\x57\x83\xbe\xae\x4b\xd8\x8c\x5a\x67\x2f\x7c\x1d\x80\xf9\x68\x4d\x19\x2b\x89\xc6\xf5\xc2\xd7\x7e\x00\xdb\xb3\x16\xe4\xe6\xc8\x58\xe9\x06\xd0\x0e\x5a\x57\x41\x1e\xd1\x1b\x4f\x28\x57\x01\x44\x3d\x3f\x80\x3d\x43\x0b\x7d\x31\x1e\x68\xb3\xde\x71\x3f\x80\x41\x13\xc0\xbe\xa5\x05\xbf\x23\x92\x26\xda\xd1\x0b\x5f\x37\x01\xec\x4c\x5b\x18\x0a\x51\x0a\x8f\x53\xe6\x07\x60\x8f\xad\xfd\x55\x63\xca\xd5\x44\x2a\x41\xf9\x74\x11\xc5\xe0\x96\x1c\xdd\x00\xfa\x31\xb8\xea\xa9\x74\x1b\xbd\xe5\x2d\xcc\xda\x13\xc0\x1a\x6d\xaf\x98\xf1\x28\x80\x8c\xf7\x5b\x93\x51\xe9\x96\xa3\xad\xd3\x32\xa1\x8c\x30\x79\x58\x95\xbe\x6f\x7b\x57\xb2\x9c\xd9\xb6\x63\xba\x9c\x6d\x45\xda\xc2\xcc\x5d\xdb\xf3\x75\x5d\xa2\x2d\x96\xe7\x84\x79\xd5\xd8\xe8\xe3\xca\x9c\x1d\xc1\xb5\xa8\xfe\x72\x62\xef\xf2\x88\x3a\x83\x6f\x53\xe7\x04\x46\x13\xf7\xe5\xe7\x31\xfe\x28\xcf\x41\xf4\xf1\xb5\x36\x3c\xe6\xfa\x47\xb6\x25\x5a\xf5\x04\xab\x7a\x96\x45\x3a\xd8\xb6\x0d\xf6\x6c\xe3\x89\xa9\x88\xc5\x22\x6a\x9a\x00\xda\x59\xbf\xd9\xd9\xb9\xca\xc3\x3b\x72\xe7\x99\x32\xda\x8c\xed\x0a\x8a\x26\xa6\x46\xcf\x5e\x59\x68\x53\x48\x47\x1c\x27\xc4\x4a\x64\xd9\xc2\xbe\x7a\xe3\xc3\xb8\x23\x66\x3b\xcb\xd3\xf8\xf5\xe9\xaf\x90\x07\x22\x62\x88\x56\x0a\xed\x62\xa2\x18\xfa\x7b\x52\x3f\x47\xb4\xb3\xba\xe9\x22\x77\x94\xc1\x4c\x02\x16\x95\x9a\xc7\xc0\x4b\x05\x2a\x47\x90\xa4\xc0\xd0\xa4\xa1\xc5\x31\x09\x53\xae\x56\x8d\xce\xce\xd2\x76\xef\x1c\xdc\x26\xc0\x1e\xef\x75\xc9\x55\xa0\x35\xdd\x5b\xe6\x38\x74\xef\x2c\xb7\x29\xf6\x2d\x76\xea\x1f\xa9\x2c\x88\x4a\x72\x4c\x41\xcd\xab\x75\x13\x8d\xc2\xde\xd1\x36\x7a\xf6\xca\x8b\xf6\xdb\x68\xdb\x11\x77\x0f\x66\xd3\xdc\xf6\xba\xdd\x5e\x27\x5c\x7e\x97\x2f\x1a\xab\xff\x1d\xf6\xb8\xd2\xfd\x5a\x6f\xbc\x2b\xd5\x8e\x65\xfb\x1c\xeb\x9f\xf1\xcd\xb4\xa6\x34\xc7\xf8\x6b\x29\x25\x7d\x60\x08\xac\x2c\x2b\xa9\xab\xe6\x85\x1e\x45\x01\xac\xff\xae\x15\xea\x76\xb7\x5d\xed\x17\x1a\x74\xbb\x70\x3f\xbc\x1a\xc6\x70\x43\xbf\xb4\x0c\xf3\x35\x6e\x7e\x80\x63\xe3\x3c\xc6\xd2\x38\x8e\x6d\x00\x95\x53\x19\xc2\x08\x11\x72\xa5\x2a\x19\x77\xbb\x53\xaa\xf2\xfa\x21\x4c\xca\xa2\x3b\x2d\xab\x1c\xc5\x67\xb9\x19\x50\x29\x6b\x94\xdd\x37\x67\x83\x70\xf3\x00\xbb\xd5\xc6\x7e\xbf\xf7\x66\xb0\xff\xea\x2a\x20\x3e\xdf\x7b\xad\xdf\x95\x7c\xf9\xdc\xc5\xf4\x86\x0a\xa9\xbc\x9e\xef\x87\x1f\x51\xe5\x65\xea\xf5\x7c\xc7\xe9\xd0\x0c\xa6\xa5\xd2\xa1\x45\xa8\x7f\xb0\x79\x7e\x78\x57\x17\xc3\x5a\x79\xfe\x5b\xe3\xf9\xd7\x39\xf4\xcc\x5b\x5f\x85\xd7\xfa\xb5\x91\x79\xee\x12\x10\x1b\xf7\x7f\x67\x01\x3c\x11\xae\xa0\xe7\x06\xda\xe0\x3b\x9d\x66\xa9\xcb\x6e\xe6\xf7\x39\x42\x42\x18\x83\x07\x64\xe5\x13\x64\x84\x32\x09\x4f\x54\xe5\xb1\x86\x9b\x90\x8e\x7e\x23\xfe\xc7\x80\xce\x41\x27\xad\x68\xc9\xbd\x8c\x07\x20\x92\x99\x08\x80\x88\xa9\xf4\x61\x01\x02\x55\x2d\x38\x64\x3c\x24\x55\xc5\xe6\x9e\xe5\x7d\x0b\xcd\xdb\x25\x17\x7c\xeb\xbf\x3f\x96\x71\xfa\x14\x4c\xa6\x31\x5c\x12\xae\x3b\x92\x40\x92\x42\x25\xca\x0a\x85\x9a\xc3\x4b\xb3\xe6\x4b\x28\x33\xa8\x79\x8a\x19\xe5\x98\x2e\x33\x1e\xe5\x65\xcd\x52\xfe\x52\x41\x45\x38\x4d\x42\x6d\x2c\xc2\x4b\xc2\x98\xb9\xfd\xdb\xbf\x5c\x09\x63\x9f\x4c\x1a\xf2\x5a\xf7\xbe\xe3\xaf\x68\x6d\x85\x5a\xa2\x04\x51\x73\x45\x0b\x0c\x47\xa8\x6e\x28\x27\x8c\xfe\x8d\x22\x80\xa7\x9c\x26\x39\x50\x69\x9a\xa7\xac\xab\xa5\xda\xf0\x30\x87\xf7\xa6\x96\x7e\x19\x59\xaf\x78\xca\xa9\xf2\x0c\x7d\xab\xd0\x7d\x4e\xa5\x0e\x27\x46\x92\x5a\x20\x50\x0e\x51\x18\x99\xa2\x9f\x83\x2a\x21\x45\x85\xa2\xa0\x1c\x4d\x6f\x4e\x48\x2d\x11\x08\x4f\x21\x33\x97\x45\xf7\xae\xf5\x73\x9e\x54\x15\xf2\xd4\x6b\x4d\xe3\x78\x10\x4d\x02\xd8\xcc\x07\xfd\x78\x12\x86\xa1\xaf\xef\x8a\x7c\xa4\x15\x98\xec\x12\x22\x11\xfe\x3d\x88\x9c\xc6\xf9\x27\x00\x00\xff\xff\x5f\x1b\x1d\x54\x5a\x11\x00\x00"),
+ },
+ "/src/reflect/swapper.go": &vfsgen۰CompressedFileInfo{
+ name: "swapper.go",
+ modTime: time.Date(2018, 4, 6, 18, 15, 56, 0, time.UTC),
+ uncompressedSize: 834,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x52\x4d\x8f\xd3\x30\x10\x3d\x7b\x7e\xc5\x23\x42\x28\xd6\x56\x69\xf7\x5a\xa9\xdc\x00\xad\x58\xd8\x43\x25\xee\x6e\x3a\x6e\x6c\x5a\xdb\xb2\x9d\x16\x68\xf3\xdf\x91\x93\xb2\x95\x40\x5a\x2d\x87\x48\x93\x79\x6f\x3e\xde\x1b\xcf\xe7\xb8\xdb\xf4\x66\xbf\x85\x4d\x44\x41\xb5\xdf\xd5\x8e\x11\x59\xef\xb9\xcd\x44\xe6\x10\x7c\xcc\xa8\x76\x26\x77\xfd\xa6\x69\xfd\x61\xbe\xf3\xa1\xe3\x68\xd3\x2d\xb0\xa9\x22\xd2\xbd\x6b\xb1\x3e\xa9\x10\x38\xd6\x69\x6f\x5a\x86\x71\x99\xa3\x56\x2d\x9f\x07\x89\x82\xd7\x66\x06\x5b\xd2\x12\x67\x12\x47\x2c\x57\xf8\xa6\xf6\x3d\x3f\xe9\xa9\x42\x92\x30\x1a\xc7\xe6\xb3\x71\xdb\x5a\xe2\xcd\x0a\xeb\xb1\xd1\x99\x84\x08\xca\x99\xb6\x7e\x37\xf2\x3f\xc4\xe8\xe3\xf9\x0b\xe7\xce\x6f\x97\xa8\xae\x53\xab\x19\x4a\xe1\xf2\xb9\xc1\x20\x49\x0c\x24\xe6\x73\x7c\x54\x29\x23\xa8\xdc\x41\xfb\x88\x71\x56\x82\xd7\x48\xe6\x17\x63\x01\xe5\xb6\xb8\x6f\xf0\xd5\xe7\xce\xb8\x1d\xb2\x47\x3a\xa9\xd0\x90\x38\x3e\xb2\x2b\x5b\xf6\xc6\xe5\xfa\xd8\x3c\xb2\xab\xa5\x24\x91\x4e\x26\xb7\x1d\x46\xf4\x4c\xa2\x55\x89\xb1\x58\x92\x10\x91\x73\x1f\xdd\x3f\x5a\x31\x2d\x5f\x5d\x6d\x5d\xe2\x8f\x3f\x5b\xfe\x01\xdf\xe7\xb2\x4a\x54\x6e\xc7\x95\xc4\x70\xed\x77\xff\x42\x3f\x12\xa2\x18\x65\x8a\x43\x0b\x5c\x2e\xb0\x53\x34\x02\xe2\xf5\xc3\x0a\x7d\xa0\xf1\x1b\x48\xa8\xa2\xd4\xa6\xe6\xa1\x9c\xcd\xa9\xfd\xd3\xc6\x72\x9b\xaf\x97\x69\x3e\x71\xae\xab\xb7\x2a\x46\xf5\xb3\x14\x7a\xad\x5f\x41\xf7\x5a\x27\xce\x95\x2c\xa4\x5a\xd2\x0b\x7a\x8c\x9e\x4c\x36\x12\xef\x57\x93\xb3\x97\xcb\x94\xb2\xb7\xd4\x28\xf0\xbf\xf4\x15\x79\x06\x77\x2b\x78\xad\x49\x08\x7b\x0b\xf3\x21\x14\x05\xaa\x79\x28\x95\xb5\x29\x6c\xd5\xac\x39\x5f\xff\x67\xcf\x90\x95\x7f\x61\x76\x86\x7c\x08\xe3\xeb\x1a\xe8\x77\x00\x00\x00\xff\xff\xf3\x76\x65\x45\x42\x03\x00\x00"),
+ },
+ "/src/regexp": &vfsgen۰DirInfo{
+ name: "regexp",
+ modTime: time.Date(2018, 4, 20, 9, 40, 48, 439830618, time.UTC),
+ },
+ "/src/regexp/regexp_test.go": &vfsgen۰FileInfo{
+ name: "regexp_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x72\x65\x67\x65\x78\x70\x0a\x0a\x69\x6d\x70\x6f\x72\x74\x20\x28\x0a\x09\x22\x74\x65\x73\x74\x69\x6e\x67\x22\x0a\x29\x0a\x0a\x66\x75\x6e\x63\x20\x54\x65\x73\x74\x4f\x6e\x65\x50\x61\x73\x73\x43\x75\x74\x6f\x66\x66\x28\x74\x20\x2a\x74\x65\x73\x74\x69\x6e\x67\x2e\x54\x29\x20\x7b\x0a\x09\x74\x2e\x53\x6b\x69\x70\x28\x29\x20\x2f\x2f\x20\x22\x4d\x61\x78\x69\x6d\x75\x6d\x20\x63\x61\x6c\x6c\x20\x73\x74\x61\x63\x6b\x20\x73\x69\x7a\x65\x20\x65\x78\x63\x65\x65\x64\x65\x64\x22\x20\x6f\x6e\x20\x56\x38\x0a\x7d\x0a"),
+ },
+ "/src/runtime": &vfsgen۰DirInfo{
+ name: "runtime",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 555853579, time.UTC),
+ },
+ "/src/runtime/debug": &vfsgen۰DirInfo{
+ name: "debug",
+ modTime: time.Date(2018, 4, 20, 9, 43, 49, 192511745, time.UTC),
+ },
+ "/src/runtime/debug/debug.go": &vfsgen۰CompressedFileInfo{
+ name: "debug.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 298,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\xce\xb1\x4e\x03\x31\x0c\xc6\xf1\xb9\x7e\x8a\x6f\x2c\x02\x9a\x34\xa5\x3c\x00\x0c\x9d\x8a\x10\xf0\x02\x49\xce\x1c\xa6\x77\x6e\x75\x71\x24\x2a\xd4\x77\x47\xbd\x0e\x87\xd8\xf0\xe2\xe1\x2f\xff\x64\xe7\x70\x9d\xaa\x74\x0d\x3e\x0b\xd1\x21\xe6\x5d\x6c\x19\x0d\xa7\xda\x12\xbd\x57\xcd\x28\x6c\x9b\xc7\x67\x1e\x32\xab\xcd\x45\x6d\x15\xae\x30\x2e\x7c\xd3\xcc\x39\x3c\xed\x0d\xd2\x1f\x3a\xee\x59\x8d\x9b\x05\x5e\xd8\xea\xa0\x10\x15\x93\xd8\x9d\xef\x4d\xb4\x5d\xd0\x6c\xb8\x84\xa5\xf7\x74\x9a\xf0\x6d\xfc\x7a\xb5\x98\x77\xf3\x74\x34\x2e\x67\x7a\xf4\xff\xad\x3b\x87\xb7\x0f\xfe\x1b\x20\x05\x4b\x6c\x1e\xb0\x57\xdc\xdf\xdd\x26\x31\x94\x63\x31\xee\xcb\x0d\xc2\xda\x63\x3b\x96\x55\xf8\x5d\xa6\x57\xc3\xda\x5f\x86\x4e\xf4\x13\x00\x00\xff\xff\xad\x79\xbd\xd2\x2a\x01\x00\x00"),
+ },
+ "/src/runtime/pprof": &vfsgen۰DirInfo{
+ name: "pprof",
+ modTime: time.Date(2018, 4, 20, 9, 43, 49, 197640393, time.UTC),
+ },
+ "/src/runtime/pprof/pprof.go": &vfsgen۰CompressedFileInfo{
+ name: "pprof.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 660,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x92\x4f\x6b\xc2\x40\x10\xc5\xcf\x99\x4f\x31\xe4\xb4\x69\x45\xfb\x15\x8a\x97\x1e\xda\x22\xb5\xa5\x07\xf1\xb0\x26\x13\xd9\x9a\xfd\xc3\x64\x56\x2b\xe2\x77\x2f\x6b\xa4\x2c\x18\x0a\x3d\xee\xcc\xfb\x0d\xef\x3d\x76\x36\xc3\xfb\x4d\x34\x5d\x83\x5f\x3d\x40\xd0\xf5\x4e\x6f\x09\x43\x60\xdf\x02\x18\x1b\x3c\x0b\x2a\x28\x4a\xe3\x4b\x28\xca\xfe\xe8\xea\x12\x2a\x00\x39\x06\xc2\x05\xfb\xd6\x74\x84\xbd\x70\xac\x05\x4f\x50\x38\x6d\x09\xd3\xdb\xb8\x2d\x14\x36\x22\x22\x26\x66\xfa\x12\x85\xbe\xa1\xb0\x69\x80\x56\x87\x95\x71\x42\xdc\xea\x9a\x4e\xe7\xf5\x6a\x1d\x8d\x93\x20\x0c\x45\xed\xa3\x13\x6c\xa3\xab\x55\x85\xc6\x09\x14\x07\x36\x42\xc3\xc4\xf8\xe9\x67\x7a\xf1\x24\xad\x2a\x24\x66\xcf\x70\x06\x48\x5b\x54\x01\xef\xae\x8e\x2a\xbc\xe8\xde\xbd\x3a\x60\x06\x35\xb4\x89\xdb\x0c\x4d\x8e\x99\x24\xb2\x43\x67\xba\xf1\x43\xf3\x64\x68\xf0\x92\xc9\x1f\xc6\xc5\xaf\xda\x92\xaa\xae\xf9\x33\x79\x59\x8e\xeb\x1f\x9b\x46\xed\x75\x17\x09\xb3\x3a\x26\xd8\xef\x4c\x18\x6c\x9e\xc6\xb9\x37\xb2\x7e\x4f\xb7\x68\x0e\x2c\x45\xb3\xcc\x17\x1f\x57\x28\x6f\xe2\xef\xf8\x4b\xf1\x21\xe3\xf2\x9b\x17\xfc\x89\x74\xf8\xf7\xd1\x67\xef\x77\x31\xa8\xcb\xff\x18\xea\xa9\x7e\xf3\xdc\x20\x3f\x01\x00\x00\xff\xff\x14\x4a\xfc\x56\x94\x02\x00\x00"),
+ },
+ "/src/runtime/runtime.go": &vfsgen۰CompressedFileInfo{
+ name: "runtime.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 556076244, time.UTC),
+ uncompressedSize: 5788,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x58\xef\x72\xdb\xb8\x11\xff\x4c\x3e\xc5\x96\xd3\xde\x91\x8e\x22\xd9\xe9\x25\x9d\x66\xea\x0f\x89\xee\xec\xcb\x34\xb6\x3c\x96\xd3\xde\x4c\x9a\xb9\x81\xc0\xa5\x04\x0b\x04\x58\x00\xb4\xac\xf3\xe8\x01\xfa\x20\x7d\xb1\x3e\x49\x67\x01\xfe\x93\x2d\x5f\xda\x4e\xf9\x45\xe2\xe2\xb7\x8b\xc5\xfe\xc3\x2e\x27\x13\x78\xb1\xa8\x85\xcc\xe1\xd6\xc6\x71\xc5\xf8\x9a\x2d\x11\x4c\xad\x9c\x28\x31\x8e\x45\x59\x69\xe3\x20\x8d\xa3\xa4\xa1\x4d\x84\x72\x68\x14\x93\x13\xbb\xb5\x49\x1c\x47\xc9\x52\xb8\x55\xbd\x18\x73\x5d\x4e\x96\xba\x5a\xa1\xb9\xb5\xfd\x9f\x5b\x9b\xc4\x59\x1c\x73\xad\xac\x83\xf3\xd9\x6c\x0e\xa7\x60\xb7\x76\x4c\x7f\x3b\xea\xbb\xeb\xe9\x8f\x70\x0a\x09\x81\x03\x6d\xaa\xcb\x4a\x48\x34\x44\x6d\x65\x25\x71\x3c\x99\x40\xc1\xd6\x08\x85\x36\x80\xc6\x68\x33\x5e\xea\xd8\x6d\x2b\x04\x2c\x18\x47\xb0\xce\xd4\xdc\xc1\x43\x1c\xfd\xec\xa9\x47\xfe\x27\xde\x05\x4c\xa0\xf5\x18\xeb\x0c\xbd\x09\xb5\x8c\x77\x71\x5c\xd4\x8a\x43\xea\x1a\x9e\xac\x59\x49\xdb\x3f\xc4\x60\xd0\xd5\x46\x81\x1b\x5b\x67\xe2\xdd\x13\x8e\x6a\xbd\xac\x98\x5b\x1d\x62\x49\x92\x6e\x0b\xa1\x84\x4b\x33\x5a\xbb\xb5\x57\xeb\x25\xbc\x3d\x85\x5b\x3b\x3e\x97\x7a\xc1\xe4\xf8\x1c\x5d\x9a\xfc\xb6\x71\x83\x4d\xb2\x40\xf8\x9a\x85\x33\x92\xd5\x8a\x98\x7b\x11\xb7\x76\xb6\xb8\x45\xee\xae\x9c\x49\x46\xe0\x77\x0a\xb2\x02\xb9\x95\x5c\x39\x93\x64\x07\xd9\x7f\x20\xf3\x3e\xe1\xf6\xd4\xaf\x31\xbb\x95\xd1\x9b\xeb\x10\x2e\x81\x81\x64\x8c\x3f\x34\x81\x13\x34\x48\x3d\x8a\xd8\x27\x13\x60\x77\x5a\xe4\x90\x23\xcb\x81\xeb\x1c\x01\xa5\x28\x85\x62\x4e\x68\x15\x47\x77\xcc\x00\x06\x77\xc7\x11\xc2\x29\x7c\x73\xb3\xad\xf0\x9d\xb5\x68\x08\xe0\x77\x78\xd8\xc5\xd1\xcf\x70\x0a\xd8\x99\xf9\x7c\x76\x3d\x9b\xdd\xec\xf9\xa2\x32\x9a\xa3\xb5\x07\x2c\xde\xac\x90\x21\x45\x01\x2d\xee\xd4\xe3\x3e\xa9\x1c\x0b\xa1\x30\x27\x11\x9d\x3f\x27\x49\x1c\xed\xe2\x68\xa9\x8d\xd6\x8e\x24\x36\x4c\x41\x1e\xaa\xbb\xd6\x48\x41\x8f\x46\x72\x03\xff\xcd\xf3\x82\x03\x62\x3c\x6f\x82\xcf\x6f\x32\x99\xf8\x94\xf9\x1e\x0b\x56\x4b\x77\x1e\x64\x08\x0b\x4a\x6f\x60\xa9\x15\x8e\x80\x33\xf5\xad\x83\xda\x22\x08\x07\xcc\x42\xc1\xa4\x5c\x30\xbe\x06\xa6\xb6\xa5\x36\x38\xf6\x42\x6e\x66\xdf\xcf\xde\xc2\x1c\x11\x44\x01\x0c\x16\xe8\x1c\x1a\xb0\x5a\xd6\x64\x47\x2f\x11\x31\xc7\x7c\xdc\x87\xed\xa4\xb6\x66\x22\x35\x67\x72\xb2\xd4\x7d\x0c\xbf\x37\xc8\xd6\x95\x16\xaa\x8b\xe4\xf1\xf7\xb8\xa8\x97\x4b\x34\x69\xd6\xa1\xa6\x4c\x4a\x34\xa9\x5d\x8b\x0a\x84\x72\x19\xa4\x15\x87\x5a\x28\x57\x39\x33\x82\x42\x48\x6c\x9c\x33\x02\x29\x14\x12\x66\x04\x7a\x0d\x0b\xad\xa5\x17\x2b\x54\xa1\x0f\x78\xab\x0d\xc2\x4b\xdc\xa4\x8d\x95\xad\x63\x7c\x9d\x64\x63\xda\x32\x4d\x6c\x25\x85\x4b\x46\x90\xfc\x4d\x25\xd9\xf8\x83\xca\xf1\x3e\x68\xf1\x02\x5e\x05\x47\x78\xc9\xbf\xe2\xdf\xe3\x11\x24\xc9\x88\x7e\x0a\x26\x2d\x7a\x37\x54\xcc\x38\x1f\x3c\xc4\xdc\xee\x54\x2f\xc2\x11\x92\xd1\x90\x2c\x68\xcb\x59\x41\x2a\xa4\x5e\x03\x97\x66\x2f\x4e\x9e\x83\x64\x2d\xe4\x89\xfe\x6f\x29\x6e\x7a\x95\xbc\x06\xcd\x79\x8e\xb3\x2e\x48\xf6\x17\x4e\x1a\x61\x23\x70\xa6\xc6\x47\xce\xb0\x9d\x37\x46\x50\x71\xf8\xfc\xa5\x71\x47\x46\xa4\x41\xbd\x3a\x26\xbe\xc9\xa4\xe5\x3a\x33\xac\x44\x1b\x62\xce\x81\x28\x2b\x89\x25\x2a\x87\xb9\xaf\xc4\xa1\x80\x9f\xde\xda\x71\xdc\x45\xd9\x87\x16\x43\xb1\x56\x69\x6b\xc5\x42\xe2\x78\x4f\x95\x20\x34\xe5\xe1\x6d\xa8\xcb\x51\xb3\xdf\x03\x34\xea\x7c\x13\x08\x0f\x3b\xd8\xc5\xa1\x96\x37\x88\x50\xcc\x1f\xba\xf2\xcd\x45\xcb\x9c\xc1\x25\xde\x53\x78\xa6\x05\xbd\x07\x86\x11\x50\x36\xb4\x01\xd6\x4a\xdf\x93\x39\xb8\x1f\xae\xa6\x10\x9e\x46\xb1\x38\x3a\xa3\x4d\xe8\x39\xa2\x7f\xe1\xdd\xe7\x4e\x73\x8d\x44\x67\x14\xd4\xf4\xb4\x84\x8f\x14\xd8\xf4\x08\xe5\xe2\xe8\x07\xe5\xcc\x76\x28\xb1\xab\x56\x53\x9f\x48\xdd\xab\xc6\xfb\xfe\x96\xd8\xbf\x1c\x78\x6d\xa8\x04\xd4\x4e\x28\x4c\xb2\x50\x72\x09\x9d\x04\x87\xef\xd5\xe3\x10\x4e\xa1\x20\x27\x23\x50\x42\x66\x83\x02\x79\xf1\xee\xa7\xab\xeb\xd9\x74\x9e\xaa\x90\x9e\xfb\x21\x70\x32\xd0\xc6\xf2\x15\xe6\x41\x1d\x4e\x19\x50\xb2\x35\xa6\x7c\xc5\x54\xe7\x80\x43\xdb\x5a\x74\x37\xa2\x44\x5d\xbb\x83\x17\x00\xc9\x26\x99\xc0\xa5\xb6\x98\xf2\x0c\x76\xd9\x08\x8e\xb3\x38\xfa\xd3\x4b\xde\x6d\x7e\x59\x97\xd3\xab\x4f\xe9\xf3\xda\x5d\xd6\x65\x67\x8f\x27\xb0\xc7\xc6\x73\xda\x31\xd9\xc1\x6d\x9b\x78\x71\x1b\x02\x17\x58\xce\x1d\x73\x76\x10\x05\x93\x09\x9c\xa3\x42\xc3\x24\x58\xc7\x9c\xb0\x4e\x70\x3b\x8e\xa3\x77\x52\x6a\xde\xc7\xc7\x9b\xef\x60\x32\x81\xc5\xd6\xa1\x05\x46\x4b\x8c\xd2\x83\xa9\x1c\xac\x13\x52\x82\x50\x54\x9f\xe3\xe8\x86\x34\x08\xbc\xcf\xb3\xa5\x78\x87\x8a\x32\xa7\x30\x88\x79\x16\x47\xf3\xad\x05\x38\xbc\x99\x5e\x38\xe6\xcb\x57\x61\x74\x49\x17\x85\xc3\x12\x52\x5b\x97\xa0\x0b\xf8\xe9\xfe\x9e\x58\x17\x28\xf5\x26\x8b\xa3\x8f\x5a\xaf\xeb\xca\xee\x8b\x51\x75\xb9\x40\x43\x68\x5f\xd1\xd1\x80\x0c\xb0\x38\xba\xf0\x2a\x3d\x8b\x2f\xc3\x72\x1c\x9d\x19\x44\xfb\x58\xbd\x1e\x47\xa7\xb0\xb1\x37\xe5\x05\x13\xaa\x3d\x28\x25\xce\x0a\x59\xb5\x6f\xd7\x1f\x91\x55\x9d\x6d\xff\x1b\xcb\x12\x63\x67\xa7\xff\xc4\x4a\x81\xe5\x43\xde\xa4\xec\x63\x16\xa1\x40\xd0\x9a\xad\x98\xb2\x0d\x56\xd1\x1d\x7b\x18\xab\xb4\x7a\xd9\xe1\x03\xfc\x1a\x25\x32\x8b\xf9\x13\xb8\x69\x17\x9c\x06\xb7\x42\x98\xcd\x03\x43\xc8\x0c\x3b\x94\xef\x23\x76\x60\xcb\xde\x02\x3a\x80\x83\x5d\x3f\xea\xcd\x4b\x89\x77\x28\xa1\x10\xf7\x98\xbf\xb4\xe2\x97\xb6\x94\xd5\x06\x5b\x2e\x6d\xf6\x6d\x3d\x99\x44\xe1\x48\xc2\x36\x9a\xd5\xa4\x95\xd2\x9b\xb0\x48\xe6\xec\x96\x0e\x99\x70\x1c\x47\x73\xba\x7a\x1b\xc3\x3c\x3e\xa7\x97\xb6\xd8\x82\xbf\x9e\x7b\x25\x1a\xa6\xc6\x59\x81\x29\x8e\x2e\xe6\x15\x53\x4f\x04\x95\x64\xce\xfe\x24\xb6\xc1\x3d\xe6\x9d\x32\xbe\xc2\xc0\x3c\xe0\xe5\x44\xdd\x67\xf6\xc0\xc0\xdd\x32\xbf\xaf\xf9\xfa\x47\x66\x57\x44\xed\x99\x2b\xa3\x0b\x21\xa9\x75\x5c\xd4\x7c\x8d\x0e\x56\xcc\xae\xc0\xb1\x85\xc4\x38\x3a\x9f\xf6\x19\xd9\xb3\x9c\x4f\xa1\x44\xc7\x72\xe6\x58\x1c\xcd\xdc\x0a\xcd\x9e\x9a\x04\xd1\x44\x6d\xb3\xb4\xcf\x83\xc6\x8b\xe7\xcc\x2c\x68\xfe\xe2\x5a\x4a\xe4\x4f\xdc\x45\x37\xda\xf9\xf4\x69\x21\x50\x78\xef\x5a\x1e\x4a\xaa\x0d\xa5\xc5\x8a\x55\x15\x2a\xd8\xac\x50\x41\x9f\x53\xff\xfa\xc7\x3f\xc1\xad\x84\x05\x56\xea\x9a\xae\xa4\x8f\xcc\x1e\x94\x89\x2a\x07\x6a\xe0\x29\xe6\x24\xb3\x7b\xf2\x53\xc5\x94\xb6\xc8\xb5\xca\x2d\x58\xa1\x38\xc2\xc9\x1f\xff\x40\x95\xfb\x8a\xd5\x16\x7d\x89\xbb\xb4\xbd\x81\x3d\xf5\xb2\xb5\xd7\xe7\x57\xaf\xdf\x7c\xe9\x37\xe2\xc2\xf0\x5a\x32\x03\x8b\xba\x28\x42\x8c\x1b\xe4\xd4\x39\x9c\x4f\xa1\x22\x4e\xc8\x6b\x13\xac\x44\xf7\xb7\x75\xed\x3a\x73\xf0\x39\xa5\xf2\x3f\x7d\xf1\xea\xf5\xeb\xec\x77\x24\xb7\xd9\xec\x07\x95\xff\xaf\x9b\xb5\x07\xb7\x71\xe4\x65\xc3\xd0\x36\xbf\x7f\x45\xbe\x9f\x5e\x7d\x3a\x33\x2c\xd8\xa2\x90\x9a\x35\xc2\x8b\x96\xa6\x0b\x98\x5e\x7d\x0a\xe6\x6b\x53\xe0\x7c\x4a\xd7\x3f\x45\x4f\x2b\x92\xba\x90\x38\xf2\x7d\x73\xb7\x8b\xa7\xf9\x50\xb8\x42\x13\x92\x78\x50\x2c\x1f\xe5\x2e\xbc\x39\xa1\xec\xbc\xac\xcb\xb9\xf8\x05\xa7\x92\x59\x1b\x4a\x11\x95\x94\xa9\x9f\xa4\xc6\x71\xf4\x7e\x4b\xab\xf0\xf9\xcd\xc9\x97\xfe\x52\x8b\x3c\x6d\x70\xa8\xae\xd4\xb7\x3e\xeb\x6a\x7a\x4b\xd8\x75\x37\xee\x35\xb2\xbc\xbd\x28\xd3\x12\x8e\xda\xff\xc3\x0e\x66\x8e\xee\x4c\x28\x26\xc5\x2f\x68\xd2\xfb\x11\x50\xcb\xed\xd0\xd0\x94\xfe\xb0\x6b\x80\xa1\xe9\x22\x74\xaf\x98\xae\xd8\xdf\x6b\xec\xda\x0a\x32\x6b\xad\xf0\xbe\xd2\xc6\x77\x9b\x02\xa5\x2f\x9a\xb9\xb0\xa4\xef\x06\xb8\x56\x77\x68\xac\x4f\xa1\xae\x0b\xfc\x39\xf4\x67\x19\xf8\x7e\x2b\xcd\xda\x76\x0b\x7e\xf5\xe9\xfa\xc1\x63\xd8\x3d\x16\x44\x7d\x1d\xb5\x72\x83\x09\x86\x3a\xcb\x43\x23\xcc\xa0\xb1\xf4\x23\xc4\x53\x61\x97\xac\xc4\x7e\x30\xfd\xca\x33\x10\x06\xed\x01\x49\xcc\x99\x36\x57\xd3\x3d\x75\xbc\xf4\x41\xef\xa3\x84\x24\x93\xd0\xf8\x7c\x81\xe5\x95\x2f\x67\x78\xcd\x9c\xd7\x12\x4e\xe1\xf5\xc9\x2b\x38\x82\x93\xe3\x57\xdf\xf5\x3e\x7b\x2f\x35\x5f\x0f\xa0\xa9\x69\xf0\x8f\x7c\x7b\x51\x3b\xbc\x6f\x70\x6d\x2a\x0c\xb0\x4d\x13\xd6\x4f\x03\xea\x0e\xad\x13\x4b\x02\x50\xf5\x19\xc3\x87\x02\x84\xfb\xd6\x76\xa3\x01\x39\xb5\x9b\x2b\x46\xe4\x56\x2b\x72\x34\x90\x6b\xb2\x91\xd5\xa3\x50\x39\x37\xc2\x22\x18\x2c\xf5\x5d\x10\x04\x5c\x97\xc4\x31\xde\x9f\x5c\x82\x9a\x74\xc7\xa4\x8b\xba\x80\xcf\x5f\xe8\x3a\x1a\x51\x2a\x35\xbd\x7f\xa3\xe0\xa1\x6f\x01\xcf\x4f\x97\x7e\x72\xfc\xd5\xcf\x02\xc7\x7e\x50\x6c\x5e\xb8\xae\xb6\xb4\xfd\x08\xec\xde\xb4\x98\xf4\x84\xc1\x10\xd8\x8c\xaa\x7e\x50\xec\x47\xbb\xbe\x5d\xff\xa8\xf9\x7a\x36\xbf\x59\x19\x64\xbe\x13\x6f\xe9\x9f\x94\x7c\x66\xe5\x2f\x21\x2f\x0e\x7d\x8e\xb2\x5b\x3b\xbe\x59\x61\x83\x18\x5a\xcc\xb8\x1b\xc3\x38\x85\xa7\xff\xe0\xd2\x87\x9f\x12\xb2\x8d\xe4\xb9\xd3\x55\x8b\x6a\xa3\x74\xd7\x97\x86\x76\x29\x58\xdd\x8f\x91\x7f\xc5\xf0\xdd\x8e\x01\x5f\x6a\x40\x75\x27\x8c\x56\x7e\x3a\x74\x1a\x38\x73\x7c\x15\xb6\xb3\x63\xb8\x59\xa1\x41\x9a\x2a\x37\x08\x2b\x76\xb7\x1f\x18\xcd\xd5\xa5\x72\x60\x72\xc3\xb6\xb6\xcb\xd8\x7e\x56\x58\x6a\x6f\x5a\xef\xe2\x37\xdf\x3d\x1e\x69\x3d\xcc\x7f\x2b\x9c\x15\x29\x56\x70\xb4\x57\x95\x8e\xc2\x57\xc4\x07\x9a\xf5\x95\xe0\x69\xd2\x20\xdf\xfa\xb1\xd7\xd6\x55\x28\x43\x49\xef\x95\x3f\x23\x56\xef\xa4\xb8\xc3\x74\xbf\xbc\xb5\xeb\x7e\xf2\x4a\x6d\xe3\x81\xac\x17\xed\x8f\xdb\x78\xd9\x06\x37\x53\xb6\xac\xd0\x22\x30\xd3\x5f\x1b\x1e\xbd\x31\xac\x1a\xc3\xe5\xff\x61\xf4\x5e\xa2\x0b\xf3\x76\xc5\x0f\x94\xc5\xa7\x15\xb0\x10\x2a\xf7\x73\xda\xb0\xd0\x10\xe1\x83\x2a\x74\x8f\x6f\x29\x7e\x40\x0f\x8c\xb5\xe2\x8a\xea\x5c\xd1\x2d\x0e\x2a\xde\xa3\xa2\xe6\x2f\x82\x4e\x6a\x37\xd3\xff\x3b\x00\x00\xff\xff\xa9\x51\x33\x3f\x9c\x16\x00\x00"),
+ },
+ "/src/strings": &vfsgen۰DirInfo{
+ name: "strings",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 556486401, time.UTC),
+ },
+ "/src/strings/strings.go": &vfsgen۰CompressedFileInfo{
+ name: "strings.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 1759,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x94\xd1\x6f\xe3\x44\x10\xc6\x9f\xbd\x7f\xc5\x60\x1e\xce\xa6\xa9\x9d\xb4\x4d\x49\x83\x82\x74\x0d\x52\x29\x42\xea\xe9\x0a\xe2\xe1\x74\x0f\xeb\xf5\x38\x9e\x64\xbd\x6b\xed\xac\xdb\x0b\xa8\xff\x3b\x5a\x3b\x6e\x73\xe5\x10\x02\xfa\xe4\xc6\xb3\xbf\xf9\xe6\xf3\x37\x9b\xe7\x70\x52\x74\xa4\x4b\xd8\xb2\x10\xad\x54\x3b\xb9\x41\x60\xef\xc8\x6c\x58\x08\x6a\x5a\xeb\x3c\x24\x22\x8a\x3b\x43\xca\x96\x98\x77\xbe\x5a\xc4\x42\x44\xf1\x86\x7c\xdd\x15\x99\xb2\x4d\xbe\xb1\x6d\x8d\x6e\xcb\x2f\x0f\x5b\x8e\x45\x2a\x44\xd5\x19\x05\xb7\xa6\xc4\x4f\xd7\x7b\x8f\x09\x1f\xc8\x13\x50\x50\xec\x3d\xa6\x40\xc6\xc3\x1f\x22\x72\xe8\x3b\x67\x60\xcb\xd9\xad\xf1\xe8\x8c\xd4\x77\xc5\x16\x95\x4f\x38\xcd\xd6\x52\xeb\x24\xa6\x00\xb9\xab\xe2\x49\x28\xba\xd1\xb6\x90\x3a\xbb\x41\x9f\xc4\xf7\x3d\x31\x1e\xeb\x2a\x67\x9b\x75\x2d\xdd\xda\x96\x18\x4f\x40\xa5\x69\x40\x26\xa9\x78\x3a\x56\x93\xf0\x04\x18\xdb\x83\x9c\xff\x2a\xe3\x75\x11\xb6\x7f\xe9\xf6\xb3\x64\xff\xff\x3a\xea\x91\xf0\x2f\xba\xae\x6d\x67\xfc\xdf\x74\x34\xb0\x5c\xc1\x54\x44\x79\x0e\xdc\xa2\x22\xa9\x41\x49\x46\x16\x11\x3f\x92\x57\x75\xa8\x09\x3f\x80\x46\xd3\xc3\x61\xb5\x82\xe9\x52\x44\xa3\xd6\x10\x80\xec\x7d\x67\xb0\xef\x72\x6b\x86\x0f\x90\x70\x0a\x27\x30\x7b\x7d\xf6\xfb\xe1\x31\x3d\x3a\x3f\xfd\x02\xff\xa5\x88\xaa\x5e\xf4\x6a\x05\x1c\x94\x3c\x9f\x9a\x89\x28\x7a\xfa\x0c\xf2\x24\x44\x54\x59\xd7\x57\xb5\x96\xc3\x58\xc7\x4e\xa7\x03\x2c\xbc\x59\xad\xe0\x74\x36\xd0\x0a\x87\x72\x77\x40\x99\x93\x13\x11\x45\x0c\x2b\xe0\x0f\xad\xe5\x93\x51\xd0\xf2\x63\x80\x8f\x9d\xcc\xb3\xab\x49\x01\xdf\x5c\x87\x5d\x41\x97\xc2\x61\xea\xf4\x60\x6f\xa0\xe7\x39\xfc\xda\xb2\x77\x28\x1b\x38\xd4\x65\x43\x19\x38\xd4\x84\x0c\xd6\xc0\xb8\x62\x9d\x61\x59\x61\x06\xbf\x21\x28\x69\xde\x78\x28\x2d\xf8\x5a\xfa\xac\xe7\xfc\x72\xf7\xc3\xdd\x12\x6e\xfd\x1b\x0e\x03\x30\x15\x1a\xfb\xb7\xe0\x6b\x04\x34\x9e\xdc\xf3\x92\x66\x87\x56\xf0\xf6\xdd\x6d\x40\x41\x81\x40\x4d\xab\xb1\x41\xe3\xb1\xec\x71\xc3\x5f\x63\x1d\x02\x56\x15\x29\x42\xe3\xf5\x1e\x82\x7b\x37\x77\x6f\xdf\xaf\x7f\x5c\x6d\x79\x48\x43\x45\x4a\x6a\xbd\x87\x44\x3e\x58\x2a\xa1\xe3\xa0\xfe\xc3\xc7\xb0\xac\x13\x20\xc3\x1e\xe5\x31\xb2\x63\x04\x79\xf0\x02\x4a\x72\xa8\xbc\xde\x7f\x07\xd6\x01\xdb\x06\xe1\x27\xf9\x20\xef\x95\xa3\xd6\x8f\x36\x15\x47\x62\xa9\x02\x6b\x10\xf0\x13\xb1\xe7\x34\x3b\xc2\x5e\x77\x61\x52\x62\x20\x1e\x54\x3f\x5a\xb7\x9b\x40\x89\x15\x3a\x28\x6d\x00\x91\x87\xce\x78\xd2\xc1\x11\x87\x6f\x18\x24\x18\xc4\x12\xb8\xb6\x8f\x06\x1e\x48\x42\xeb\x6c\x45\x3a\xdc\x36\x47\x64\x69\xca\xe1\x04\x48\x87\x50\xa0\x51\x75\x23\xdd\x8e\x41\x3e\x48\xd2\x32\xf8\x9c\x30\x22\xd4\xde\xb7\xbc\xcc\xf3\xcf\x2e\x39\x2d\xcd\x26\xdf\xd8\x9c\x98\x3b\xe4\x7c\xb6\xb8\xba\x9a\x7e\xdd\xff\xa3\x6c\x13\xec\x3e\x3d\x9f\x9f\x4d\x2f\x17\xf3\xf3\xf3\x30\xce\x21\x40\xc3\xe4\x49\x91\x15\x5d\x95\x7e\x39\x4c\xca\xb6\xfb\x75\x8d\x6a\x97\xa4\x21\x48\x54\x41\x91\xc9\xb2\x74\x21\xb9\x86\x74\x1f\xdd\xe3\x74\x3d\xd7\x87\x0f\xc0\x60\x2c\xb2\x92\x2d\x4e\xe0\xb1\x26\x55\x43\x8b\xae\xb2\xae\xe1\x31\x64\xef\x2c\x85\x3b\x03\x1a\x69\xa8\xed\xb4\xf4\x64\x4d\x36\x20\x5f\xc7\x6f\x02\x6c\x81\x77\xd4\x02\xf9\x0c\xee\xff\xc9\x89\x30\x37\xf9\xfc\x62\x71\x31\x5f\x5c\xaa\xc5\x4c\x4e\x67\x57\x97\x78\x71\x26\xd5\xfc\xac\xba\x9c\xcf\x0a\x35\xbf\x9c\xce\xbe\x55\xf2\x62\x7e\x71\xb6\x98\x86\xa6\xe3\x64\x50\x88\xe8\x09\x50\x33\xc2\xcb\xbc\x5f\xad\xa0\x18\x16\x5a\x1a\x52\x49\x7c\xc8\xf8\x12\x48\x6b\xdc\x48\xdd\x07\xce\x56\x60\xac\x39\xfd\x1d\x9d\x1d\xf7\x2c\x38\x42\x58\x42\xb1\x87\x07\xa9\x3b\x8c\xd3\xb0\xc2\x4f\xe2\xcf\x00\x00\x00\xff\xff\x3c\x43\xb4\x54\xdf\x06\x00\x00"),
+ },
+ "/src/strings/strings_test.go": &vfsgen۰CompressedFileInfo{
+ name: "strings_test.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 556754142, time.UTC),
+ uncompressedSize: 295,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\xcd\xb1\xaa\xc2\x40\x10\x85\xe1\xfa\xce\x53\x0c\x5b\x25\x57\x49\x9e\x41\x9b\x80\x20\x48\x92\x5e\xd6\x64\x8c\x6b\x92\xdd\x65\x66\x16\x0b\xf1\xdd\x25\xa8\x95\xbd\xe5\x81\xf3\xf3\x95\x25\xae\x4e\xc9\x4d\x3d\x5e\x05\x20\xda\x6e\xb4\x03\xa1\x28\x3b\x3f\xc8\x51\x49\x14\xc0\xcd\x31\xb0\xa2\x59\x96\xf3\x83\x01\x38\x27\xdf\x61\x4b\xa2\xdb\x25\x25\xde\x4c\x53\xe8\x24\x53\xfc\x7f\x7f\x8a\x36\xc7\x3b\xfc\x69\xd1\x8c\x2e\x66\x86\x93\x57\x37\x53\x51\x93\xed\xf7\x34\x37\x6a\x55\xd6\xf8\xf9\xbe\xea\x03\x71\x9d\x3c\xfa\xa0\x28\x29\x2e\x22\xf5\xe8\x3c\x56\x21\x5e\x88\x77\x8d\xc9\xe1\xf1\x2d\x57\x1c\x6e\x3f\x70\x9f\x01\x00\x00\xff\xff\x2e\xf1\x3b\x7a\x27\x01\x00\x00"),
+ },
+ "/src/sync": &vfsgen۰DirInfo{
+ name: "sync",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 557031836, time.UTC),
+ },
+ "/src/sync/atomic": &vfsgen۰DirInfo{
+ name: "atomic",
+ modTime: time.Date(2018, 4, 20, 10, 43, 19, 305171943, time.UTC),
+ },
+ "/src/sync/atomic/atomic.go": &vfsgen۰CompressedFileInfo{
+ name: "atomic.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 3060,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x56\xcf\x6f\x9b\x3e\x14\x3f\xe3\xbf\xe2\x7d\x39\x54\xd0\x7e\x45\xa4\xad\xea\xa1\x52\x0e\xd5\x0e\x53\xa5\x49\x9b\x54\x75\x77\x07\x4c\xea\xcc\xb1\x91\xb1\x69\xa2\x28\xff\xfb\x64\x03\xc1\x80\x61\x5d\xb2\xf6\x84\x8b\xfc\xf9\xc1\x7b\x9f\xf7\x9a\xc5\x02\x6e\x56\x9a\xb2\x0c\x36\x25\x42\x05\x4e\x7f\xe1\x35\x01\xac\xc4\x96\xa6\x08\xd1\x6d\x21\xa4\x82\x08\x05\xa1\xe6\x25\xce\x49\x88\x50\x10\xae\xa9\x7a\xd1\xab\x24\x15\xdb\xc5\x5a\x14\x2f\x44\x6e\xca\xee\xb0\x29\x43\x14\x23\x94\x6b\x9e\xc2\xd3\x2b\x2e\x1e\xb9\xfa\xfc\x29\xc2\x59\x26\xe1\x9a\x9a\xf3\xff\xc0\xc9\x2b\xd8\x63\x5c\x3f\xe0\x80\x02\xc1\x32\xb8\x5f\xc2\xb5\xb9\x88\x02\xfb\x80\xa5\xb9\x89\x02\x49\x94\x96\x1c\x04\xcb\xd0\xb1\x4f\x7c\x77\xdb\x11\xdf\xdd\x9e\x88\xef\x6e\xe3\xfa\x71\x1e\xf1\x33\x75\x2c\x6b\xc7\xb3\x6e\x4c\xeb\x0b\x5c\x3f\x53\xc7\xb6\x76\x7c\xeb\xc6\xb8\xbe\xd0\x79\xa1\xa4\xc3\x5e\x28\xd9\xd1\x17\x4a\xc6\xed\xe1\x3c\x81\x1f\x82\x72\x45\x4e\x02\x36\x12\x49\xf3\xb2\xd1\xe9\xbd\x8b\x07\x7f\xff\xbd\xea\x17\xb1\x2d\xb0\x24\x0f\x3c\x9b\x08\x93\x60\x59\x2f\x51\x2b\x21\x98\x91\xa1\x39\x34\xdc\x4b\x73\xc7\xbc\xea\x8b\xb5\x6a\x4a\x6a\x82\x82\xe3\x49\x3d\xc7\xac\x24\xd3\xfa\xc3\xcc\xb9\xfa\xa6\x7f\xef\xaa\xef\x8d\xe6\xc9\x81\xfe\x88\x12\x78\x03\xdc\xb3\xf0\x21\x55\xf0\xc4\xbc\x67\xc2\x66\xfd\x5d\x5d\xcc\xcf\x42\x67\x66\x30\x10\xff\xd8\xd3\x43\x96\x79\x86\x22\x23\x4c\xe1\xd1\x8e\x35\x76\xda\xc9\x83\x9b\xfa\x92\x7f\x02\xcd\xd9\x51\xf0\xc6\xae\xd6\x18\xef\xc4\xb3\x55\x3c\xc3\x75\xfa\x8e\xde\x4a\xbf\xe8\x3b\x46\xd9\xed\xbe\xa3\xbf\x7e\x2f\x52\xf1\xc4\xb3\xd3\x19\xee\xe1\xf3\x94\xbe\x09\x3c\x6e\xbd\xd3\xed\x06\x52\xef\xd9\x01\xa8\x5f\x67\xa7\xb4\x93\x20\x4f\x04\xdc\xa6\xcf\xe2\x06\x25\x77\x8b\x3c\x8b\x1b\x15\xb1\x57\xb5\x49\xe8\xdc\x60\xfa\xfe\x21\x79\x89\x9e\x94\x90\xc4\x33\x59\x15\x66\xed\x5c\x1d\xba\x1e\x55\x98\x8d\x90\xc3\x2c\x37\x48\xf3\xfd\x73\x48\xef\xac\x19\xac\x7e\x83\xac\x37\xe0\x2d\xf8\x2d\xca\x9e\xdc\xb6\x70\x5b\xff\x39\xfc\xfc\x42\xb4\x34\x83\x5e\x4c\xb0\x45\x15\x5c\xff\xc4\x4c\x93\xd8\xf6\x33\x8a\x21\xda\x81\x85\xe4\x38\x25\x87\x63\xec\x74\xad\x4a\x2a\x1f\xce\x1a\xf2\xa0\x68\x0e\x3b\xb3\x71\x39\xb5\x4b\x38\x28\x30\xa7\x69\x14\x96\x7b\x9e\x2e\xea\x1f\xbd\xf7\x50\x1a\x2c\x88\xdc\x5e\xaa\x0c\x9f\xa1\x11\x60\xa9\xc3\xd8\xee\x62\x9a\x1b\x65\xf8\xaf\x66\xba\xba\x82\x4d\x99\x3c\x1a\x2d\x8e\xd9\xf7\xd5\x86\xa4\x2a\xda\xc5\xc9\x57\xa2\xa2\x30\x15\xbc\x54\x52\xa7\x4a\xc8\x30\x36\x88\xf1\xd5\x2a\xa9\xbc\x97\xff\xe8\x90\x72\x03\xa0\xa5\x22\x5c\xb1\x3d\xa8\x7d\x41\xb2\x29\xcb\xc6\xef\x12\x76\xe8\x88\x7e\x07\x00\x00\xff\xff\x2a\xf7\xf1\xfd\xf4\x0b\x00\x00"),
+ },
+ "/src/sync/atomic/atomic_test.go": &vfsgen۰FileInfo{
+ name: "atomic_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x61\x74\x6f\x6d\x69\x63\x5f\x74\x65\x73\x74\x0a\x0a\x69\x6d\x70\x6f\x72\x74\x20\x22\x74\x65\x73\x74\x69\x6e\x67\x22\x0a\x0a\x66\x75\x6e\x63\x20\x54\x65\x73\x74\x48\x61\x6d\x6d\x65\x72\x53\x74\x6f\x72\x65\x4c\x6f\x61\x64\x28\x74\x20\x2a\x74\x65\x73\x74\x69\x6e\x67\x2e\x54\x29\x20\x7b\x0a\x09\x74\x2e\x53\x6b\x69\x70\x28\x22\x75\x73\x65\x20\x6f\x66\x20\x75\x6e\x73\x61\x66\x65\x22\x29\x0a\x7d\x0a"),
+ },
+ "/src/sync/cond.go": &vfsgen۰CompressedFileInfo{
+ name: "cond.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 511,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x8f\x31\x73\xab\x30\x10\x84\x6b\xdd\xaf\xd8\x12\x1e\x83\x71\xfd\x6c\x9a\xe7\x96\xee\x4d\x26\xb5\x2c\x84\x7d\x41\x3e\x31\x20\x92\x61\x32\xfc\xf7\x8c\x90\x93\x14\xb6\x9a\x93\x76\x75\xfb\xcd\x56\x15\x8a\xf3\xcc\xae\xc5\xdb\x44\x34\x68\xd3\xeb\x8b\xc5\xb4\x88\x21\x0a\xcb\x60\x71\xf2\xd2\x62\x0a\xe3\x6c\x02\x3e\x49\x55\x15\x3a\xb6\xae\x9d\x30\x4f\xb6\xc5\x79\xc1\xbb\x16\x76\x4e\x83\x6f\x83\xb3\x37\x2b\x41\x07\xf6\x42\x4a\xfc\xc9\x0f\x0b\x90\x26\xa9\x06\xe9\x34\xde\xf4\x76\x8c\x7e\xe0\x6e\xf3\xe3\x6c\x78\x0a\xa4\xcc\xd5\x46\x13\xc6\x0f\xcb\x29\xdd\xe9\x19\x53\xec\xc7\x23\x0f\x60\xd9\x32\x60\xae\x5a\x70\xf6\xde\xd1\x4a\xd4\xcd\x62\x90\x19\xfc\x89\x4d\x72\xbc\x6a\x0e\x59\x1e\xab\x98\x9d\x14\x05\x29\xee\x60\x76\xe6\x8a\xba\x86\xb0\x8b\x86\x4a\x6f\xdc\x74\x6f\xb3\x9f\xac\x9c\xd4\x1a\x97\x9a\xdd\x8b\x38\x6f\xfa\x2c\x27\x75\x2c\xe3\xd7\xa4\x36\x49\x7b\x24\xfe\xe7\x8b\x68\x97\x98\x1b\x4c\x22\x6b\xbf\x91\x46\x1b\xe6\x51\xee\xc9\x52\x96\x94\xd8\xc7\x12\x61\x9c\xed\x93\xb0\x7f\xa3\xd7\xad\xd1\xd3\xbd\x83\xe0\x6f\x1d\x13\xb7\x75\xd4\xd8\x93\xea\xfc\x08\x8e\xf2\xfe\x00\xc6\x11\x72\x00\x17\xc5\x6f\xaf\xef\x6c\xb5\xd2\x4a\x5f\x01\x00\x00\xff\xff\x2c\xcb\x53\xaf\xff\x01\x00\x00"),
+ },
+ "/src/sync/export_test.go": &vfsgen۰CompressedFileInfo{
+ name: "export_test.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 168,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\xca\x4d\x0a\xc2\x30\x10\x05\xe0\x7d\x4e\xf1\x96\x8a\x3f\xf1\x02\xde\x41\x0a\xae\x25\x4d\x5f\x35\xda\x4c\x42\x32\x29\x94\xd2\xbb\xbb\x15\xdc\x7f\xd6\xe2\xd0\xb7\x30\x0d\x78\x57\x63\xb2\xf3\x1f\xf7\x24\xea\x22\xde\x18\x6b\xd1\x71\x64\xa1\x78\x0e\xe8\x17\x28\xab\xd6\x23\x84\x1c\xa0\x09\x2f\x37\x13\x92\x4e\x29\x23\xc4\x3c\x31\x52\xd4\x69\x48\x52\xcf\x66\x76\x05\x5d\x13\x0d\x91\x8f\x5c\x92\xbf\x05\xc1\x15\x63\x13\xbf\xdb\x23\x88\x62\x45\xa1\xb6\x22\xb8\x60\xfb\xd3\x77\xc9\xbf\x7e\xdd\xcc\x37\x00\x00\xff\xff\x78\xcd\x49\xae\xa8\x00\x00\x00"),
+ },
+ "/src/sync/pool.go": &vfsgen۰CompressedFileInfo{
+ name: "pool.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 505,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcf\x4e\xf3\x30\x10\xc4\xcf\xde\xa7\x98\xaf\xa7\xe4\x03\x5a\xb8\x56\xca\x89\x03\x37\x54\x89\x63\x55\x21\xe3\x6e\x2a\x83\xeb\x58\xce\x5a\xa4\x54\x79\x77\xe4\x24\xfd\x83\x20\x97\x68\x77\x46\xbf\x99\xf5\x62\x81\x9b\xb7\x64\xdd\x16\xef\x2d\x51\xd0\xe6\x43\xef\x18\xed\xc1\x1b\x22\xbb\x0f\x4d\x14\xcc\x92\x6f\x75\xcd\x33\x22\x39\x04\xc6\xaa\x69\x1c\x5a\x89\xc9\x08\x8e\xa4\x5c\x63\xb4\x43\xfe\x46\xdb\x7c\xd5\x58\x2f\x1c\x27\xe5\xc5\x7e\x31\x92\xf5\x12\x24\x12\xa9\x56\x9a\xc8\x58\x6f\x06\x4b\xad\x0d\x1f\x7b\x52\xcf\xfc\x09\xa0\x4e\xde\x14\x25\xae\x95\x9e\x28\x6f\x51\x04\xfc\xcf\xb1\x25\x9e\x58\x7e\x7a\x72\x05\x5b\xc3\xb1\x2f\xc2\x7c\xa0\x97\xa8\x2a\xdc\xe7\x7d\x16\xc2\x3c\xd3\xff\x55\xf0\xd6\x0d\x3b\x15\x59\x52\xf4\xa3\x50\x94\xa4\x54\x4f\xe7\xa5\xb7\x8e\xf2\xdc\x61\x59\x61\xe2\xad\xaf\xd9\x77\x0f\x1b\x52\xd3\x80\x8b\x65\xf9\xcb\x33\x01\xbb\x3f\x6e\x58\x25\x29\xba\xeb\x1b\xca\xe9\x88\x2e\x37\x3f\xf5\x1c\x01\x43\x9b\x4b\x9e\x0e\x81\xfd\xf6\x94\x74\x8b\xae\x3c\xf3\x63\xf2\x62\xf7\xfc\x1a\x79\x67\x5b\xe1\x98\xb3\x1e\x1d\x6b\x9f\x42\x61\xc6\xff\xf4\xc4\x39\xae\xa7\xef\x00\x00\x00\xff\xff\xd6\xf1\x0f\x08\xf9\x01\x00\x00"),
+ },
+ "/src/sync/sync.go": &vfsgen۰CompressedFileInfo{
+ name: "sync.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 2015,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x55\xdb\x6e\xe3\x36\x10\x7d\x36\xbf\x62\x60\x14\xa8\x94\xd8\x52\xd2\x2d\xb6\x40\xb0\x7e\x28\xb2\xc5\x22\x40\xbb\x0b\x34\x29\xfa\x10\x18\x0d\x25\x8d\x4c\xc6\x14\xa9\x72\x28\xab\x6e\x90\x7f\x5f\x0c\xa5\xf8\x92\x9b\x5f\x4c\x90\x33\x67\xce\x9c\xb9\x28\xcf\xe1\xb4\xe8\xb4\xa9\xe0\x9e\x84\x68\x65\xb9\x96\x2b\x04\xda\xda\x52\x08\xdd\xb4\xce\x07\x98\xae\x74\x50\x5d\x91\x95\xae\xc9\x57\xae\x55\xe8\xef\x69\x7f\xb8\xa7\xa9\x10\x1b\xe9\x81\xb0\xf9\x5b\xea\x80\x9e\x60\x01\x8d\x5c\x63\xd2\xc8\xf6\xf6\xa4\xd3\x36\x7c\xf8\x69\x79\xbb\x2c\x95\xb4\x50\x38\x67\x52\x21\xf2\x9c\xcd\x7f\xed\xdd\x1a\x2d\x04\x2f\xcb\x35\x41\x50\x08\xb6\x6b\x0a\xf4\xe0\x6a\xe8\x47\x28\x39\xd8\x14\x5b\xf0\x9d\x0d\xba\xc1\x7f\xae\xb1\xf1\x68\x50\x12\x42\x72\x57\x2a\xf8\x34\x87\xe0\x3b\xbc\x4b\x19\x35\x28\x19\x40\xc9\x0d\x82\x75\x01\xb6\x18\x40\x96\xff\x76\xda\x63\x15\xf1\x09\x1b\xd9\x2a\xe7\xd9\xf5\xd3\xbc\x54\x77\xa0\xed\x21\xf0\x68\xfc\x47\x17\xf0\xbf\x34\x13\x79\xce\x98\x37\x4a\x13\xb4\x1e\x37\x68\x03\x81\x04\x8b\x3d\x94\xd2\x18\x08\xee\x2d\x5f\x7e\xea\xbd\xb3\x2b\xb3\x7d\x22\x70\x1c\x9f\x71\xb5\x85\x02\x43\x8f\x68\x21\x29\xb0\x94\x1d\xe1\x6b\x49\x2a\x49\x20\x8d\x47\x59\x6d\x41\xdb\xd2\x63\x83\x36\xbc\xc8\xa7\x57\xda\x44\xd4\x48\x4c\x21\xb4\x68\x2b\x6d\x57\x91\x29\xbd\x47\xf5\x48\x2d\x8f\x25\xea\x0d\x56\x50\x7b\xd7\x44\x1c\x2e\x9b\x45\x13\xa1\x2d\x47\xed\x08\x2a\x7c\x83\xc6\x4e\xb3\x6b\x44\x50\x21\xb4\x74\x91\xe7\xef\xb6\x8f\x26\xea\x90\xf2\x5f\x3e\x7c\xcc\x9e\xba\x68\x6c\x8b\x57\x9a\x68\xf8\x4b\x85\xa8\x3b\x5b\xbe\x92\x50\x42\x30\x9a\xa6\xf0\x20\x26\x6f\x64\x9c\xd0\x0c\x6a\x69\x08\x53\xf1\x28\x06\xb2\xc7\x8a\x68\x02\xa3\xd7\x78\x70\x3f\x83\xa2\x0b\x50\x3b\x0f\xad\x77\xb5\x36\x51\x58\x67\x03\xda\x0a\x2b\x88\x5e\x48\x9c\xfb\x70\x3e\xb0\xd2\x14\xb5\xa5\xae\xe5\x59\xc2\x6a\x06\xe4\xe0\xbe\xa3\x00\x5c\xee\x28\x9e\x6c\x10\x74\xd3\x9a\xa8\xa8\x0c\xda\x59\x90\xf4\x4a\x76\x11\xff\xe6\xdb\xe7\x6f\x17\x70\x65\x37\x48\x41\xaf\x64\x60\x0c\x4d\x19\x5c\xd5\xa0\xc3\x8f\x04\xad\x23\xd2\x85\x41\xae\xf8\x0e\x74\xc6\x64\x49\x57\xe8\xa1\x72\xcc\x8a\xdc\x0c\x5c\x50\xe8\x7b\xcd\x4d\x87\x8d\xdb\x0c\x40\x50\xba\x86\x3d\xb2\xb7\x24\x1e\x15\x7c\xd2\x79\x06\x46\xd7\x6e\x18\x6b\x96\x5c\xd7\x90\x9c\x10\xcc\xf7\x75\xbc\xa5\x65\x0a\x8b\x05\x9c\xf1\xf3\xa4\x54\x70\x31\x16\xf6\x60\x1f\x4c\xd8\x2f\x02\xb1\xcd\x64\xbf\x49\x6e\x69\x09\x0b\x90\x2d\x37\x73\x72\xb0\x42\x1e\x4a\xf5\x38\x83\x23\xbb\x2c\xcb\x18\xe8\x11\xd0\x10\xbe\x8b\x73\x74\x3d\x83\x52\x45\x3f\x31\x99\xf0\x46\x10\xd1\x6d\x47\x1d\xe6\x0b\x38\x1f\xf8\x1d\x5d\xef\x12\x9a\x54\x68\x30\x60\xb2\x7b\x9d\x01\x8d\x78\x8f\x62\x72\x42\xf3\x39\x37\xd9\x73\x31\xc7\xd9\x3e\xd4\x51\x49\x5b\xb9\xba\xde\x4b\xb9\x2b\xf6\x5f\x71\x09\x0c\xaf\xba\x06\x8b\x58\x61\x95\x3f\x15\x3a\xe3\x28\xa7\xa7\x42\x4c\x7a\x96\xf6\x28\xb9\x58\x0f\x83\x36\xe9\x0f\x4a\xe0\x31\x74\xde\x32\x3d\x31\x96\xa3\xbf\x3d\x5b\xb2\x3b\x9f\xce\x2f\x96\xe2\x85\x70\xfd\xab\x40\xfb\xcc\x47\xe3\x21\x75\xc6\x3d\xd2\xea\x94\x25\x8c\xb1\xc6\x55\xfd\x42\x11\xeb\x82\xae\xb7\xbf\x6b\x0a\x97\x0a\xcb\x75\x42\xfa\x7f\x04\x16\xa6\x0d\x3e\x85\x87\xe7\xe6\xa5\xb4\xd7\xad\xb6\x89\x06\x6d\x43\x1a\x15\x8b\xe3\x1e\x13\x1b\x46\x7b\x9c\xec\x4b\xd7\x6e\xf9\x6b\xc2\x6e\xd9\xe8\xfe\x55\x5a\xf7\xac\xbd\xad\x64\x06\x0d\x26\x29\x23\x7e\xfc\x99\xd1\x78\x62\x02\x34\xda\x18\x4d\x58\x3a\x5b\xc1\x02\xce\xcf\xe2\x6f\x17\xea\x9e\xb2\x2f\xc6\x15\xd2\x64\x5f\x30\x24\xd3\xcf\x32\xe0\x34\xcd\xbe\x62\x9f\xa4\xd9\xa5\x34\x26\x99\xae\x30\xdc\xe8\x86\x6f\xaf\x18\x38\x49\xe1\xe4\x10\x73\xa4\x79\xf5\x34\xa8\x58\x1d\x7c\x90\x46\x92\x41\x79\xd7\x27\x04\x14\xbc\xb6\xab\xd8\x1a\xfb\xb8\x43\x94\x1f\xa2\xcd\x9f\x83\xdb\x6f\xde\x3b\x3f\x8d\xb5\x78\x14\xdf\x03\x00\x00\xff\xff\xaa\x5d\x20\xc4\xdf\x07\x00\x00"),
+ },
+ "/src/sync/sync_test.go": &vfsgen۰CompressedFileInfo{
+ name: "sync_test.go",
+ modTime: time.Date(2018, 1, 25, 23, 45, 7, 0, time.UTC),
+ uncompressedSize: 240,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd7\x57\xd0\x4e\x2a\xcd\xcc\x49\x51\xc8\x2a\xe6\xe2\x2a\x48\x4c\xce\x4e\x4c\x4f\x55\x28\xae\xcc\x4b\x8e\x2f\x49\x2d\x2e\xe1\xe2\xca\xcc\x2d\xc8\x2f\x2a\x51\xd0\xe0\xe2\x54\x02\x09\x64\xe6\xa5\x2b\x71\x69\x72\x71\xa5\x95\xe6\x25\x2b\x84\xa4\x16\x97\x04\xe4\xe7\xe7\x68\x94\x28\x68\x41\x25\xf5\x42\x34\x15\xaa\xb9\x38\x4b\xf4\x82\xb3\x33\x0b\x34\x34\xb9\x6a\xd1\x94\xba\x3b\x93\xa0\x38\x28\x35\x27\x35\xb1\x38\x95\x48\x1d\xce\xf9\x79\x29\xce\xf9\x05\x95\x78\x95\x03\x02\x00\x00\xff\xff\x93\xcf\x90\x60\xf0\x00\x00\x00"),
+ },
+ "/src/sync/waitgroup.go": &vfsgen۰CompressedFileInfo{
+ name: "waitgroup.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 557321982, time.UTC),
+ uncompressedSize: 446,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\xd0\x4d\x4e\xc3\x30\x10\x05\xe0\xb5\xe7\x14\x8f\x2e\x2a\x87\x0a\x5a\xe8\x0e\x35\x48\xac\x38\x02\x0b\xc4\xc2\x38\x6e\x62\x1a\x26\x51\x32\xa6\xaa\xaa\xdc\x1d\xd9\x04\x08\x3f\xcd\x2a\x7a\x1e\x7d\x7e\x9e\xe5\x12\x8b\xe7\xe0\xeb\x02\x2f\x3d\x51\x6b\xec\xce\x94\x0e\xfd\x81\x2d\x91\x1c\x5a\x87\x07\xe3\xe5\xbe\x6b\x42\x8b\x5e\xba\x60\x05\x47\x52\xb6\x09\x2c\xae\x83\x67\x21\x65\x2b\xa4\xcf\x56\x86\xc7\x99\xe3\x40\xa4\x7a\x31\xe2\xae\xf0\xb8\x7e\x0a\x9e\x65\x7d\x4d\x03\xd1\x36\xb0\x85\xde\x97\x38\xff\x62\x33\xdc\x15\x85\x2e\x5c\x2d\x26\x7a\x59\xf4\xf7\xe5\xe5\xe7\x15\x8b\x1c\xe9\x8c\x94\xdf\x62\x92\x6f\xb0\x8a\x93\xaa\x35\xec\xad\x9e\xc5\xc2\x37\x60\x57\x1a\xf1\x6f\xd3\xd2\xe3\xfc\x2c\x23\x35\xfc\x36\x6e\xb1\xc2\x7c\x9e\x92\x0a\x79\x0e\xf6\x75\x32\xc7\x00\xaf\x66\xe7\xf4\x8f\x67\xfd\xa7\xe4\xf9\x94\x39\xfb\x66\x6c\xdd\xf4\x4e\xa7\x38\x9b\xa8\xec\xeb\xa8\x9c\xda\x46\xfc\xd5\x69\x0b\x7f\xcb\x46\x75\x73\x91\xa0\x0f\xe2\x3d\x00\x00\xff\xff\x08\x4a\xda\xa3\xbe\x01\x00\x00"),
+ },
+ "/src/syscall": &vfsgen۰DirInfo{
+ name: "syscall",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 557615283, time.UTC),
+ },
+ "/src/syscall/syscall.go": &vfsgen۰CompressedFileInfo{
+ name: "syscall.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 1346,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x94\x41\x6f\xf3\x36\x0c\x86\xcf\xd6\xaf\x60\x8d\x01\xb1\xf1\xb9\x76\x7b\x0d\x90\x4b\x8b\xa1\xe8\x69\x05\xda\x61\x87\xae\x07\xd9\xa6\x1d\xa6\x0a\x65\x48\x74\x96\x6e\xc8\x7f\x1f\x64\x39\x6d\x92\x02\x1b\xf0\xdd\x0c\x8b\xa4\xf8\xf2\x79\xc5\xaa\x82\x1f\xf5\x48\xa6\x85\x8d\x57\x6a\xd0\xcd\xbb\xee\x11\xfc\x87\x6f\xb4\x31\x4a\xd1\x76\xb0\x4e\x20\x53\x49\x3a\xb2\xd7\x1d\xa6\x4a\x25\x69\x4f\xb2\x1e\xeb\xb2\xb1\xdb\xaa\xb7\xc3\x1a\xdd\xc6\x7f\x7d\x6c\x7c\xaa\x72\xa5\x76\xda\xc1\x5f\xda\x31\x71\xff\xe4\x88\x05\x5b\x58\x41\xa7\x8d\xc7\xe9\xc8\x10\xe3\xdd\xd8\x75\xe8\xe0\xf5\xad\xfe\x10\x54\xaa\x1b\xb9\x01\x62\x92\x2c\x87\x7f\x54\xb2\xf1\xe5\x83\xb1\xb5\x36\xe5\x33\x4a\x96\xfe\xd2\x99\xd1\xaf\xef\x2d\x7b\x6b\x30\x2d\x60\xe3\xcb\x47\x16\x74\xac\xcd\x6f\xf5\x06\x1b\xc9\x42\x7e\x4c\x4d\xa8\x03\x83\x9c\x7d\x5d\x92\xc3\xd5\x0a\x6e\xa6\xb3\x93\xc2\x0f\xa1\x70\x33\x97\xcc\xcb\x7b\x6d\x4c\x96\x1a\xdb\xa7\x05\x78\x71\xc4\xfd\x69\x85\x3c\xe4\x9e\xb4\xbd\x02\x26\xa3\x92\xe4\xa0\x92\x43\x9e\xab\xc3\x2c\x60\x08\x62\xff\x88\xc2\x63\x37\xd4\xc1\xd5\xc5\x24\x42\x1f\xff\xd3\x06\x3a\x67\x5d\x5a\x40\x3a\xa7\x2e\x03\x14\xc1\x2d\x04\x30\x1e\xd8\x0a\xe8\x9d\x26\xa3\x6b\x83\x05\x78\x44\x58\x8b\x0c\x7e\x59\x55\xff\x49\xa7\x36\xb6\xae\xb6\xda\x0b\xba\xaa\xb5\x4d\x35\x93\xf6\xe5\xb6\x4d\x73\x15\xc4\x7c\x83\x26\x6e\xc4\x73\x79\x2f\x76\xe6\x90\xd5\x33\xbd\x49\x68\x6f\x9f\xce\x4e\x61\xb9\x82\x0b\x95\x97\x21\xe1\x4e\xea\xe0\x5b\xe6\xd5\x94\xf9\x3b\xb7\xd8\x11\xcf\x03\xbb\x0c\x2a\x1f\x79\x67\xdf\x31\xfb\xee\x84\x7a\x82\xe5\x50\x46\xc7\x41\x93\x3a\xe7\xa6\x87\x01\xb9\x3d\x61\x5b\x40\x5d\x96\x65\xae\x92\xce\xba\xe8\x9f\xd0\x3a\x71\x8b\xfb\xbb\x0f\xc1\xb3\xc8\xc5\x9f\xbc\xc8\xa3\xc5\x08\x56\x2b\xb8\xbe\x8d\xae\xaa\x1d\xea\xf7\x68\x87\x9f\x74\xd8\xeb\x92\xde\xf2\x1c\xaa\x0a\x5a\xcb\x0b\x81\xd1\x63\x1c\xb7\xe1\x02\x3c\x71\x83\x40\x02\xad\xc5\x48\x1f\xf7\x51\x33\xfd\x8d\xb0\x1d\x8d\x50\xe0\x00\xcd\x5a\x3b\xdd\x08\x3a\xaf\x2e\xdc\x7a\x72\x11\xfd\xb8\x5d\xbe\x85\xc1\x1c\xa9\x8e\x1e\xb3\x01\xe2\x0b\x2f\x9f\x6c\x20\xef\x26\xa4\x55\x05\x6c\xaf\xed\xf0\x19\xf9\xeb\x9e\x24\x6b\x6c\x8b\x40\x2c\x53\xc8\x73\x74\x50\x86\x7b\x92\x17\xa7\x87\x02\x46\x62\x19\xc4\x4d\x61\x79\x01\x37\x05\xdc\x4c\xef\xa3\xaa\xbe\x66\x0a\xe4\xa1\xb1\x03\x61\x0b\x9d\xb3\x5b\x08\xcd\x7b\x38\xee\x1f\xb1\xa0\x77\x96\x5a\x88\xfb\x87\xb8\x0f\xd2\xb3\x38\x04\x59\x23\x38\xd4\xe6\xb8\xa5\x3e\xb3\xc2\x68\x78\x21\x79\x79\x5c\x25\x47\x7e\x7e\x76\x69\x01\x0d\x44\xb7\x12\x4b\xe8\x3d\xf0\xa6\x02\xea\x80\xdb\x69\x0e\x9b\xef\xb8\x3f\xea\x00\xb7\x89\x6c\xa3\x93\x80\xe6\xd7\xae\x8e\x3f\xae\x6f\xd5\x41\xfd\x1b\x00\x00\xff\xff\xa9\xfc\xcd\x86\x42\x05\x00\x00"),
+ },
+ "/src/syscall/syscall_linux.go": &vfsgen۰FileInfo{
+ name: "syscall_linux.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x73\x79\x73\x63\x61\x6c\x6c\x0a\x0a\x63\x6f\x6e\x73\x74\x20\x65\x78\x69\x74\x54\x72\x61\x70\x20\x3d\x20\x53\x59\x53\x5f\x45\x58\x49\x54\x5f\x47\x52\x4f\x55\x50\x0a"),
+ },
+ "/src/syscall/syscall_nonlinux.go": &vfsgen۰FileInfo{
+ name: "syscall_nonlinux.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x2c\x21\x6c\x69\x6e\x75\x78\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x73\x79\x73\x63\x61\x6c\x6c\x0a\x0a\x63\x6f\x6e\x73\x74\x20\x65\x78\x69\x74\x54\x72\x61\x70\x20\x3d\x20\x53\x59\x53\x5f\x45\x58\x49\x54\x0a"),
+ },
+ "/src/syscall/syscall_unix.go": &vfsgen۰CompressedFileInfo{
+ name: "syscall_unix.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 557861706, time.UTC),
+ uncompressedSize: 3334,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xe4\x57\xdf\x6f\xdb\x36\x10\x7e\x16\xff\x8a\x2b\x31\x14\x54\xcd\xc9\x3f\xb6\x15\xc3\x32\x3f\x64\x99\x17\x18\xc8\x92\xa2\x4e\xd6\x0d\x45\x11\xd0\xd6\xc9\xa1\x2d\x93\x1e\x49\x39\x35\x5a\xff\xef\x03\x29\x2a\x76\x6c\x3f\x2c\xc8\x50\x0c\xe8\x9b\xa1\xfb\xee\xee\xe3\x77\xc7\xe3\xb9\xdd\x86\xd6\xb8\x92\x65\x0e\x33\xcb\x5f\xdc\x4b\x95\xeb\x7b\x4b\xc8\x52\x4c\xe6\x62\x8a\x60\xd7\x76\x22\xca\x92\x10\xb9\x58\x6a\xe3\x80\x91\x84\x9a\x4a\x39\xb9\x40\x4a\x12\x5a\x29\x2b\x0a\xa4\x84\x24\x74\x2a\xdd\x5d\x35\xce\x26\x7a\xd1\x9e\xea\xe5\x1d\x9a\x99\xdd\xfe\x98\x59\x4a\x52\x42\x8a\x4a\x4d\x20\xba\xdf\xa2\x5a\x59\x96\xc2\xfb\x0f\xd6\x19\xa9\xa6\xf0\x89\x24\x4b\xa3\x27\x68\x2d\xfc\xd4\x87\x99\xcd\xce\x4b\x3d\x16\x65\x76\x8e\x8e\xd1\x68\xa1\x29\x49\x64\x01\x0d\xae\x1f\x70\x37\x2a\xc7\x42\x2a\xcc\x7d\x88\xc4\xa0\xab\x8c\x02\x25\x4b\x92\x6c\x48\x32\xb3\x03\xb5\xf2\x01\xa3\x4f\x1d\x0e\xd5\xca\x87\x42\xb5\x9a\xe3\xfa\x58\xbe\xab\xf1\x0c\x27\x8e\xa6\xd9\x99\x28\x4b\x46\x3d\x8a\x72\x08\xc1\x6a\xbf\xe0\xb4\x10\x73\x64\xcd\x01\x38\xc4\x70\xd9\x05\xaa\xa9\xbb\x63\x69\x4a\x92\x42\x1b\x90\x1e\xda\x39\x01\x09\x3f\x1f\x40\x4e\x40\xb6\x5a\x81\xf7\x1c\xd7\x1e\xd7\x00\x86\x2a\xc7\x8f\x4c\xa6\xd9\x28\x04\x67\x29\x49\x42\xda\xf7\xf2\x03\xf4\xc1\x83\x5b\x40\xfb\x14\x5a\x35\xa9\xc0\x7a\x8e\xeb\x5d\xfc\x86\x34\x62\x78\x47\xb2\x89\xfa\x5b\x74\xa8\x56\xb7\x13\x36\xe7\xb0\x82\x9a\x7b\xfa\xdf\xaa\x1f\x72\x1f\x0a\x9e\x8d\x3c\x49\x0e\xab\xf4\x81\x4c\xa5\xb6\x74\xbe\x2c\x97\x5f\xb1\x44\x87\x6c\x1e\xb8\xac\x84\x69\x5a\xfd\x77\x9d\x57\x25\xc2\xab\x99\xcd\xea\x26\x08\x46\x51\x1a\x14\xf9\xfa\xda\x48\xcc\xaf\xf5\x85\x16\x39\xf4\xa1\x10\xa5\xc5\x60\x5e\x48\x55\xd9\x2b\x85\xd0\x87\x6f\xbb\x8d\xce\x75\x3c\xa6\xc4\x02\x1f\x8e\xb6\x0d\xeb\x29\xe6\x58\xa0\x01\x8f\x66\x69\xa4\x3c\xd1\x2b\x34\xa1\xda\xed\x36\x6c\x7b\x19\x64\x01\xd1\x88\x39\x49\x36\xac\x3e\xfe\x63\xce\xfd\x7e\x80\xfa\x40\xb2\x38\x46\xd9\x5b\x1e\x5d\x10\xaf\x4d\x72\xf4\x6c\xce\x54\x18\x08\xfd\x5d\x49\x83\x47\xea\x10\x2d\xbe\x0e\x49\x20\x57\x03\x8f\x15\x22\x59\x0a\x25\x27\x8c\x06\xac\xcf\xb8\x47\xbb\x71\xce\x86\x6a\xa5\xe7\xc8\x68\xb4\xd3\x47\x4d\xfc\xc8\x29\x70\xf0\xca\x6e\x5b\x69\x14\xf5\x76\x46\x2c\x39\x88\x2e\x07\xd1\xe3\x20\xbe\x83\x4a\x2a\xb7\x74\x26\x05\x66\xba\x1c\x4c\xaf\xf9\xc0\x01\x8d\x81\x81\x31\x4a\x07\xf5\x65\x01\x85\x3f\x68\x53\x38\x3a\x6a\x68\x9c\x40\x01\x2f\xb6\xe2\x1a\x8f\x2a\x1a\xb6\xfb\xf9\xd2\xed\x10\x8a\x89\x98\x89\xd7\xb9\x93\x66\x43\xe5\x58\x9a\xf2\x03\x53\x77\x6b\x0a\x8c\x1e\x0c\xbd\xc6\x10\xb4\x90\x05\xf8\x7c\x5e\xe6\xd1\x5f\xa3\xdb\x77\x6f\x87\xd7\x03\x78\xf9\x12\x98\xe8\xfa\x6f\x5d\xf8\xfc\x19\xea\x9f\xbd\xba\xa3\x84\x31\x62\x1d\xcb\x37\x54\x0e\x8d\x12\x65\xdd\x80\x4c\xf4\x3c\x55\x5b\xca\x09\xee\x0c\xb3\xf1\xda\x21\x87\xe0\xb6\x3b\xc8\x92\x43\xff\xe0\x59\x5f\x6a\xfa\x4d\x70\xa0\xd1\xd1\xe3\x97\x46\x2a\x77\xad\xcf\xb4\xb2\xba\xc4\x08\x3e\x94\x66\x2f\x11\x87\x0e\x87\xce\xfe\x51\xf1\xa3\x74\xd7\xfe\x77\x50\xbf\x7e\x3f\xb2\x73\xed\x3f\xc7\x41\x17\xb2\xbd\x13\x46\xc5\xd9\xb7\x97\xa5\xb9\x9f\x75\xfc\xc1\xe9\xd9\xd9\x60\xb4\xdf\x38\xaf\x0f\x2a\xc9\x41\x7c\xcf\x41\xfc\xc0\x41\xbc\x7e\x76\x17\xbd\x7e\x62\x1b\xed\x26\xff\x22\x2d\xf5\xa2\x0f\xbd\x4e\x0f\x3e\x41\xbb\x0d\x73\x34\x2a\xd3\xd6\x60\x89\xc2\x22\x68\x05\x57\x23\xf8\x93\xc3\x9d\x58\x2e\x51\x59\x90\x0a\xa4\x92\x0e\x74\x01\x54\x5b\x0a\x71\x5d\x68\xca\xbe\x53\x88\xcd\xd3\x6a\xf1\x56\xdc\x7f\x15\xf7\xf8\x39\xfd\x6a\x1e\x34\xba\xd4\x03\x63\xb4\xf9\xf7\x52\xfd\x8f\xf4\x79\xaa\x0c\x47\x5a\xe4\x6b\xbd\xb1\xcf\x69\x9e\x5f\xd6\x0e\xdf\x38\xf3\x9b\xd1\x8b\xb8\x29\xda\x87\xe5\x84\xbd\xaa\x87\x3f\xfa\xa6\x0a\xd2\xec\xbe\x1e\xbb\x8f\xff\x8d\x54\xee\xc7\xd3\x30\xf2\xd3\xec\x12\xef\x59\x89\x8a\xd9\x14\x5a\xd0\x6d\x96\x5e\x0e\x63\xef\x68\x84\x9a\x22\xd4\xcf\x8a\x47\xc4\xe5\x64\xec\xc7\x7a\x67\x7f\x21\xe1\x30\x18\x5e\xfe\x71\x7a\xd1\x2c\x26\xe1\x6d\x18\xa1\x8b\xcb\x30\x87\x71\x2d\xc0\x9e\xa1\x4e\xce\xa1\xb3\xd5\xa2\x3e\x4a\xca\xea\x3f\x28\xd9\x1b\x2d\xfd\xdb\x15\x5f\x9b\x9b\xf0\x91\xa5\x5e\x67\xbf\x06\x6d\xc8\x3f\x01\x00\x00\xff\xff\x66\x56\x55\xf5\x06\x0d\x00\x00"),
+ },
+ "/src/syscall/syscall_windows.go": &vfsgen۰CompressedFileInfo{
+ name: "syscall_windows.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 2363,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x95\x5f\x6f\xdb\x36\x10\xc0\x9f\xa3\x4f\x71\xf0\xc3\x40\x7a\x5c\x1c\xb9\x4b\x96\x14\xf0\x43\x10\xbb\xe9\x00\x77\x29\x12\x17\x05\x56\x14\xc5\x49\x3c\xcb\x6c\x29\x52\x20\x29\xa3\x4e\x9a\xef\x3e\x50\x7f\x6c\x67\x49\x81\x0d\x1d\x82\xbd\x48\xe4\xdd\xf1\xee\x77\x7f\x44\x8d\x46\xf0\x73\x56\x2b\x2d\xe1\xb3\x4f\x92\x0a\xf3\x2f\x58\x10\xf8\x8d\xcf\x51\xeb\x24\x51\x65\x65\x5d\x80\x81\xab\x4d\x50\x25\x0d\x92\x64\x8d\x0e\x4a\x65\x6a\x7f\x65\x08\x26\xf0\x4b\x9a\x24\xcb\xda\xe4\x70\xd3\x1e\x61\xc1\x61\x25\xc0\xa0\x2b\xbc\x00\x4c\x05\xe0\x58\x00\xbe\x80\x5a\x99\x50\x05\xc7\x81\xb9\x54\x80\x1b\xf7\x02\x01\xe4\x1c\xcc\x9c\x33\x96\xc3\x5d\x72\x50\x39\x65\xc2\x7b\x74\x46\x99\x82\xf1\xe4\xc0\x51\xa8\x9d\xe9\xad\x59\x1f\x9a\x0b\x38\x12\x30\x3b\xbf\xb8\x98\xdd\x24\xf7\x0f\x19\x4e\xbe\x07\x21\x00\x7f\x15\x80\xc7\x02\xf0\xe4\x39\x81\xce\xfe\x09\x90\x00\xfc\x4d\x00\x9e\x0a\xc0\xb3\xe7\x84\x4b\xc7\xff\x96\x2e\xda\x1c\xc5\x47\xb4\x4c\xc7\xcf\x0a\x7b\xfc\x83\xb0\xf1\x11\x6d\xd3\x68\x9c\x1e\x3f\x0b\xbb\xb6\x28\xb5\xca\x1c\xba\x0d\x5b\x2a\x4d\x06\x4b\x82\x61\x3c\x9a\x9e\x70\x60\x2b\x34\x52\xd3\x8f\x07\xfe\x5b\xd4\x82\x42\xe5\x6c\x8e\x52\x3a\xf2\xfe\x51\x94\xa8\xdb\x81\x9c\x72\x60\x51\xf2\x9f\x53\x30\x09\xc3\x39\xde\x6e\xa6\xf3\x39\x87\xb9\x45\xc9\x78\x74\x6d\x5d\xf4\xda\x79\xf9\x69\x3a\x9f\xcf\xa2\xec\xee\x8d\x2f\x5e\xc2\xc0\x6f\x7c\xa0\x12\x62\xbf\x3d\x18\x1b\x00\xd7\xa8\x34\x66\x9a\x04\x78\x22\x58\x85\x50\xf9\x97\xa3\x51\xa1\xc2\xaa\xce\x0e\x73\x5b\x8e\x0a\x5b\xad\xc8\x7d\xf6\xbb\x45\xa6\x6d\x36\x2a\xd1\x07\x72\x23\x69\xf3\x51\x77\xa5\xf9\xc3\x52\x0e\xee\x77\x78\x55\x8b\xf7\xd6\xd9\x9c\xc3\x2b\x65\xfe\x67\x7c\x05\x85\x9b\x20\x5f\x37\xbd\x63\x2b\x50\x26\x70\x60\x4b\x09\xad\xa4\x69\x8d\x5a\xc2\x0a\x26\x13\xb8\x59\x4c\x3f\x5d\xbd\x5b\xbc\x7d\xb7\xf8\xf4\xfa\xfc\x8f\xe9\x7c\x16\x95\x7d\x0a\x69\x72\x70\xff\xd0\x74\x76\x7d\x7d\x75\xfd\x84\xe5\xb8\xb1\xec\x36\x47\x5b\x90\x4b\x0a\x17\xd6\x78\xab\xe9\x8d\x95\xc4\xf2\x76\xdd\x71\x08\x28\xad\xec\x26\xe9\xc5\x98\x03\x8b\xc3\xd3\x54\x91\xef\x95\x71\x5a\x97\xe5\xa6\xad\xe3\x2e\xc1\xf7\x4e\x05\x7a\xa5\x62\x76\xed\x80\xf6\x1e\xb3\x7a\x09\x1f\x3e\x66\x9b\x40\x02\xa4\x35\x5b\xef\x02\xec\x9a\x9c\xc6\xaa\x22\x09\xc3\xab\xed\xfa\x51\xd4\x98\x6c\xeb\x72\x32\x81\x14\xbe\x7d\xdb\xdb\x8e\x9b\x8c\x9b\xa1\x5e\xd8\x2e\x2f\x96\xd5\x4b\x9e\x1c\x1c\x0c\x9b\x68\x13\x68\xc3\x31\x4d\xa6\xd1\xf0\x5d\x89\x8c\xd2\x4d\x91\xbe\xf3\x51\x44\x75\x9f\xde\xec\xab\x0a\x71\xb6\xe2\x17\x48\x5f\x55\xc8\x63\x9d\xfa\x32\xc5\xd2\xb4\xff\xd5\xc3\x4b\x1b\xb5\x8c\x3f\xac\x77\x59\xa2\x91\x73\x65\x88\x71\x60\x79\x29\x77\x97\xc6\xb6\xaa\xdb\x03\x7b\xd6\x0b\x7b\xee\x8a\xf5\xfe\x01\x01\xe8\x8a\x1c\x86\x7d\x7f\xd0\x15\x6b\x18\x7e\x38\x4d\xcf\xc6\x1f\xbb\x57\x6f\xf8\x64\xeb\x8c\xd2\xe2\xe9\xfe\x5d\x52\x20\xb3\x66\x5f\x68\x03\x3e\x38\x65\x0a\x0e\x6c\x8d\xba\xa6\x6e\x2b\x60\x69\x6b\x23\x21\xb3\x56\xef\x7b\x1c\x0c\x04\x2c\x51\x7b\xda\xf7\xb4\x50\x25\xfd\x69\x0d\xfd\x6e\x96\xd6\x95\x18\x94\x35\x2c\xdc\x2a\x18\x46\xc5\xad\x35\xa4\x76\x8a\x78\x63\xe7\xd0\xcf\xc4\x93\xd4\x47\x8f\x99\xc3\xa6\xa2\x3d\x61\x84\xac\xf3\x70\xb7\xbd\x0e\xf6\x95\x1c\x9a\x17\xe3\x5d\x2a\x0f\xe8\x93\xfb\xe4\xaf\x00\x00\x00\xff\xff\x4f\x7e\x0c\x93\x3b\x09\x00\x00"),
+ },
+ "/src/testing": &vfsgen۰DirInfo{
+ name: "testing",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 558121153, time.UTC),
+ },
+ "/src/testing/example.go": &vfsgen۰CompressedFileInfo{
+ name: "example.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 1424,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x54\x5d\x6b\xf3\x36\x14\xbe\x96\x7e\xc5\xa9\x20\x45\x5a\x5d\x85\xdd\x06\x7c\x51\xb6\x06\x0a\xa5\x2b\xcd\x7a\x57\x18\xaa\x73\xec\x6a\xb5\x25\x23\xc9\x49\xc7\x9a\xff\x3e\x74\xec\x7c\x8e\xf7\xe6\xbd\x09\x91\x2c\x3d\xe7\xf9\x38\x47\xf3\x39\xdc\xbc\x0f\xb6\x5d\xc3\xdf\x91\xf3\xde\x54\x9f\xa6\x41\x48\x18\x93\x75\x0d\xe7\xb6\xeb\x7d\x48\x20\x39\x13\x75\x97\x04\x67\xc2\xc7\xfc\x1b\x53\xb0\xae\xa1\xbf\xc9\x76\x28\xb8\xe2\xbc\x1e\x5c\x05\x61\x70\xf7\x5f\xa6\xeb\x5b\x94\xd8\xc0\x83\x4b\x18\x9c\x69\xa7\x2d\x05\xd2\x7f\xc2\xbb\xf7\xad\x82\x7f\x39\xb3\x35\xfc\x52\x7d\x98\x94\xfe\xc9\x2b\x56\x77\x49\x3f\x07\xeb\x52\x2d\x45\x59\x96\xf0\xf2\xfa\x04\x00\xb3\xf8\xe6\x44\x01\xd8\xe8\x27\xd3\xa1\xe2\x6c\xc7\x39\x9b\xcf\xe1\x37\xd3\xa7\x21\x20\xc4\xb4\xf6\x43\xd2\x9c\x8d\x7f\x60\x51\x82\x8f\x7a\x45\x0b\xce\xb6\x05\x60\x08\x79\x33\x61\xd7\x2f\x6d\x8b\x52\x68\x01\x37\x7b\x3c\xb8\x01\xa1\x27\x08\xa1\x88\x52\x3e\x7f\x55\x82\xb3\xed\x81\xd5\xb2\xcf\xb4\x5a\x27\x47\x64\x0c\x81\x60\x15\x67\xcc\x47\x7d\xff\x65\x93\xfc\x95\x98\xb1\x43\x69\x28\x61\xcb\x33\x29\x13\x88\x53\x76\x49\x3f\xf9\xad\x54\x9c\xf9\x4f\x28\x21\x85\x01\x27\x25\x2d\x1a\x07\x43\x0f\xd6\x81\x81\x35\xd6\x18\x02\xae\xa1\x32\x6d\x0b\xd1\xc3\x16\xa1\x32\x0e\x02\x56\x7e\x83\x01\x6c\x0d\xe9\x03\x01\x47\x47\xa1\x37\xce\x56\x51\x73\x46\xf7\x20\x67\x20\xc9\x5c\xb6\x8e\x89\x84\xd7\x5d\xfa\x7d\x08\x26\x59\xef\xe4\x91\x85\x5e\x0d\xef\x92\xd8\x29\xc5\x39\x1b\x79\xf8\x88\x50\xdb\x16\x0b\x08\x18\x93\x3f\xb8\x5b\x40\x83\x09\xfc\x90\x7a\x72\x9a\x6d\x35\x9d\x95\x93\x01\x07\xc5\x71\x72\x9d\xd1\x9d\x80\x66\x9d\x1d\xbf\x1f\x03\xd8\x2f\xe5\x96\x9c\x97\x2a\xdf\xfe\x0b\x28\xae\x17\xec\xfc\xe6\xfc\x8b\xad\xcf\x00\x4e\x12\x39\x89\xa4\x3e\x4d\x44\x4c\x5d\xbb\xa0\x8b\xd6\x35\x13\x1f\x92\xb4\x80\xd9\x86\x1a\xe9\x04\x34\x97\x39\x0b\x90\x7a\x8b\x6d\x4c\x80\xda\xd8\x16\xc6\x26\xe7\x8c\xe1\x5e\x01\x45\x40\xb2\x1b\x4f\xb1\x4e\x73\xa0\xff\x0c\xb6\x5b\xf5\xa6\x42\xe9\x87\x94\xbf\x6f\x8d\xfb\xc1\x01\x6c\xf4\x1f\xe4\xe4\xa4\x12\x1b\xfd\xea\x7c\x58\x63\x0e\x9d\xf4\xd9\x1a\xa2\x0f\xe9\xd1\x3a\x8c\xb2\xf1\x49\x65\xf5\xc7\x9d\x0c\xad\xe0\xfa\x9a\x3a\xb5\x3c\xf1\x85\x11\x6b\x4a\x5c\xaf\x26\x7f\x44\xe3\xd3\xe2\xcd\xe5\x29\x22\x4a\x72\xd8\xd7\x52\xd3\xb6\x28\x80\xe2\x3a\xe3\x95\x7b\x99\xed\x00\xdb\x88\x07\x4e\x59\xf2\x55\x09\x04\xf3\x73\xd5\x8f\x15\x1b\x9f\x0a\x42\x3a\x16\x1b\xdd\x20\x90\xab\x12\x84\x80\xef\xef\xcb\x59\x3c\x7b\x22\x6e\x6f\x6f\x61\x79\xf7\xf0\xb8\x80\x59\x04\x39\x8b\x2a\x83\x1f\x5f\x8a\x02\xf2\x00\x14\x04\x38\x06\x9d\xa7\xae\x36\x6d\xc4\xa3\xb4\x8b\x17\xe8\x7f\xf8\xcf\x77\xab\xd5\x09\xfe\x25\xba\x3a\xf2\xbe\x64\x4a\x73\x29\xa7\x47\x62\xc7\xd9\x4e\xaa\x71\xda\x5f\x06\xb7\x1f\x5e\xcd\x19\x36\x7a\x99\xfb\x29\x60\x1a\x82\xe3\x3b\xfe\x5f\x00\x00\x00\xff\xff\x6d\xa8\x39\x72\x90\x05\x00\x00"),
+ },
+ "/src/testing/ioutil.go": &vfsgen۰CompressedFileInfo{
+ name: "ioutil.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ uncompressedSize: 1163,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x53\x61\x6f\x23\x35\x10\xfd\x6c\xff\x8a\x21\x12\xc8\xbe\x8d\x36\xbb\x69\x2f\x52\x7b\x04\xe9\xc8\x05\x74\x52\x29\x28\x6d\x05\x12\x42\x95\xb3\x3b\x2e\x43\x37\xf6\xca\xf6\x96\x44\xd0\xff\x8e\x6c\x6f\xb7\x94\x4f\x7c\x48\x76\x3c\x9e\x7d\xf3\xe6\xcd\xdb\xc5\x02\x8a\xfd\x40\x5d\x0b\x7f\x78\xce\x7b\xd5\x3c\xaa\x07\x84\x80\x3e\x90\x79\xe0\x9c\x0e\xbd\x75\x01\x04\x67\xb3\xfd\x29\xa0\x9f\x71\x36\x23\x1b\xff\x6d\x8a\x7d\x70\x8d\x35\x4f\x29\x3c\x99\x26\x3e\x03\x1d\x70\xc6\x25\xe7\x4f\xca\x81\x53\xa6\x85\x81\x4c\x38\x5b\x4e\xe7\xc3\x00\xb1\xb6\xfc\x61\x08\x78\xe4\x5c\x0f\xa6\x01\x87\x1e\xb1\x15\x72\xac\x85\xbf\x38\x73\x18\x06\x67\xc6\x84\x88\xa8\xe5\xb5\xfd\x53\xc8\xf2\xce\xd0\xf1\x5a\x19\x2b\x24\x14\x40\x26\xac\xce\x85\xf5\xe5\xf7\x18\x7a\x6a\x85\x94\x92\x3f\x8f\xa0\x06\x8f\xe1\x66\xd0\x9a\x8e\x42\x82\x0f\x8e\xcc\x43\x02\x4e\x1c\xca\x2b\xdb\x3c\x0a\xc9\x99\x83\xcb\x75\xe2\xc5\x19\x69\x70\xb0\x5e\x43\x15\xcb\x98\x83\xf5\xc4\x8b\xb3\x67\x9e\x13\xef\xea\xd5\xea\xfc\xfd\xf2\x3d\x14\x50\x57\xf5\xd9\x45\x75\xbe\x5c\x9e\xc1\x62\x01\x8d\x35\x3e\x28\x13\x3c\x68\x67\x0f\x70\x3d\x1c\xd0\x51\xa3\x3a\xd8\x61\x43\x3d\xfa\xdc\x38\x42\x4c\x14\xee\x4c\xf7\x42\x22\x0f\x3b\xca\x59\x7e\x0e\x56\x09\x32\x41\xd4\x78\x01\x05\xb8\x2f\x6b\xbc\x90\xf2\xd7\xfa\xf2\xb7\x38\xdc\x62\x01\x1f\x21\x4e\x18\xc8\x1a\xd5\x41\x63\xfb\x13\x58\x0d\x64\x87\x40\x5d\x79\x8b\x87\xfe\x3b\xea\x70\x0e\xc1\x82\x7a\xb2\xd4\x02\x1e\x83\x53\x90\x97\xe9\xcb\xac\x4e\x18\xcb\x44\xef\x50\xd3\x71\x14\x48\x82\xd0\xf0\xce\xfa\x32\x23\xa0\x73\xf1\x67\x9d\x8c\x92\xb4\x94\xc4\xb2\x3e\xf5\xf8\x44\x4e\x48\xce\x99\x69\xac\xd1\x1d\x35\x21\xde\x55\x9c\x69\xeb\x80\x52\xfc\x01\x08\xbe\x86\xba\xaa\xaa\x18\x16\x45\x92\xd5\xa8\x03\xc6\xdb\x08\x56\x8c\x5d\xe3\x02\x7f\x52\xe1\xf7\x1b\xec\x95\x53\x21\xb6\x2b\x60\xe4\x55\xbc\xd9\x23\x67\x4c\x67\x5a\x89\xc7\x8f\x3d\x9a\x34\x44\x44\x9d\xa7\xcc\xfd\xee\xd3\xcf\xbb\xbf\x53\xb4\xd9\x6d\x3f\xde\x6e\x73\xbc\xfd\x65\x73\x35\x87\x6a\x55\x55\x11\x83\x74\xac\xfd\xec\xb7\x47\xf2\x41\xa0\xcb\xf3\xa5\xfc\x34\x4e\x51\x7c\x78\x3d\xc0\x37\x50\x67\x5b\xb0\xff\x1a\x68\xcc\xbc\x71\xcb\x6b\xd5\xeb\x8e\x59\xf4\x10\x63\x8d\x35\x81\xcc\x80\x3c\x9f\xf7\x0e\xd5\x63\xb6\x57\xf2\xc0\xe4\x5e\x87\xaa\x4d\xa3\x69\xea\x30\x89\x36\x6d\x28\x07\xf3\x7f\x6d\x66\xd4\xe4\x72\x12\x65\x7a\x4b\x26\x5b\xc7\xcb\x2f\xd6\x60\xa8\xcb\xd6\xce\x76\x9b\xcd\xd2\x6b\xa9\x7b\x8b\x1a\x1d\xe8\x72\xd3\x59\x8f\x91\x6e\xfc\x5c\xf7\x83\x86\xf4\xdd\x97\xdf\x0e\x5a\xa3\xe3\xec\xfe\x45\x7c\xb2\xe5\xc6\xf6\x27\xf1\xd5\x7e\xd0\x73\xd0\xff\xb7\xcd\x98\xda\x0f\xba\xbc\xc9\xab\x97\xf3\x58\xcf\x9f\xf9\x3f\x01\x00\x00\xff\xff\x2f\x92\x73\x9b\x8b\x04\x00\x00"),
+ },
+ "/src/testing/testing.go": &vfsgen۰CompressedFileInfo{
+ name: "testing.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 558360921, time.UTC),
+ uncompressedSize: 642,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x91\x4f\x6f\xd3\x40\x10\xc5\xcf\xde\x4f\xf1\xc8\x85\x16\x2c\xfb\x1e\x01\x17\x50\xf9\x23\x44\x0f\x6d\xcf\x68\x63\x8f\xe3\xc1\xeb\x59\xb3\x33\x4b\x04\x55\xbe\x3b\xda\xa4\x11\x21\xea\x79\xe7\xf7\x7b\x6f\x66\xdb\x16\xaf\x37\x99\x43\x8f\x1f\xea\xdc\xe2\xbb\xc9\x6f\x09\x46\x6a\x2c\x5b\xe7\x78\x5e\x62\x32\xac\x52\x16\xe3\x99\x56\xce\xb5\x2d\xee\x47\x42\x5e\xd4\x12\xf9\x19\x9d\x0f\x81\xd2\x37\x3f\x13\xbc\xf4\x18\x92\x9f\xe9\x6e\xe2\x05\x89\xc2\x6f\x44\xc1\x13\xda\xbc\x3f\x0c\x6a\x5d\x0c\x65\x72\xf1\xc2\x1d\x78\x80\x8d\x94\x08\x3e\x11\xfe\x50\x8a\x4f\x42\xc5\x10\xb3\xf4\x0d\x3e\xc5\x1d\xfd\xa2\x54\x5f\x7a\x8a\x86\x15\x12\x0d\x3c\x2f\x81\x66\x12\xa3\x1e\x43\x4c\xf8\x18\x97\x91\xd2\x97\x3b\x78\x83\x8d\xac\x28\x5c\x0d\x8d\xd8\x11\x3a\x2f\x2f\x0d\x59\xa9\x08\x6c\xf4\x67\xb8\x37\x8e\xd2\xe0\x41\xa9\x74\x52\x82\x5a\xde\x28\x58\xd4\xc8\xf7\x8d\x1b\xb2\x74\x67\xfb\x5e\x69\x59\x93\xc5\xae\xa1\x96\x58\xb6\x78\x74\x55\xdb\xe2\xe1\x99\xd3\x24\xfa\x99\x39\x91\xc2\xa3\x58\x4a\x90\x0f\x97\x2b\x35\x07\xfc\xfe\xf6\xc3\xed\x1a\x9f\x4f\xa5\xca\x85\x96\xa8\xca\x9b\x40\x8d\xab\x12\x59\x4e\x82\xd5\x9b\x2c\x93\xc4\x9d\xbc\x5b\xb9\xbd\x3b\x36\xbb\x7a\xd5\xc5\x79\x8e\x72\xfd\xef\x13\xce\x2a\x9e\xb2\x6e\xca\x5b\x69\xfa\xbd\xc6\xc0\x81\x6a\x04\x16\xaa\x11\x27\xac\xdf\x5e\x34\x3a\xe0\xd7\xae\xe2\x01\x2f\xe2\x54\xa0\x53\xfe\x7f\xb6\xc7\xbd\xab\xf6\xee\xf9\x27\x57\x55\x37\x1c\x68\x7d\xcc\x72\x55\xf5\x95\x85\xd6\xc7\xcc\x42\xed\xdd\xdf\x00\x00\x00\xff\xff\x1b\x9f\xb2\xfc\x82\x02\x00\x00"),
+ },
+ "/src/text": &vfsgen۰DirInfo{
+ name: "text",
+ modTime: time.Date(2018, 4, 20, 9, 17, 51, 715639756, time.UTC),
+ },
+ "/src/text/template": &vfsgen۰DirInfo{
+ name: "template",
+ modTime: time.Date(2018, 4, 20, 10, 35, 24, 780257322, time.UTC),
+ },
+ "/src/text/template/template.go": &vfsgen۰FileInfo{
+ name: "template.go",
+ modTime: time.Date(2017, 10, 12, 19, 45, 13, 0, time.UTC),
+ content: []byte("\x2f\x2f\x20\x2b\x62\x75\x69\x6c\x64\x20\x6a\x73\x0a\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x0a\x0a\x63\x6f\x6e\x73\x74\x20\x6d\x61\x78\x45\x78\x65\x63\x44\x65\x70\x74\x68\x20\x3d\x20\x33\x30\x30\x30\x0a"),
+ },
+ "/src/time": &vfsgen۰DirInfo{
+ name: "time",
+ modTime: time.Date(2018, 4, 20, 9, 16, 37, 116861599, time.UTC),
+ },
+ "/src/time/time.go": &vfsgen۰CompressedFileInfo{
+ name: "time.go",
+ modTime: time.Date(2018, 2, 27, 18, 42, 13, 0, time.UTC),
+ uncompressedSize: 2155,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x55\xdf\x6f\xdb\x36\x10\x7e\x26\xff\x8a\x9b\xb0\x21\x64\xa3\x48\xf9\x51\x64\x58\x10\x0f\xd8\x92\x35\x08\xd0\xd4\xc0\x92\xbe\xac\x28\x06\x9a\x3a\xd9\x74\x64\x52\x20\xa9\x38\x8e\xeb\xff\x7d\x20\x29\x2b\x76\xbb\x15\x98\x9e\xc4\xe3\xf1\xee\xfb\x3e\x1e\xef\xca\x12\x0e\x27\x9d\x6a\x2a\x98\x3b\x4a\x5b\x21\x1f\xc5\x14\xc1\xab\x05\x52\xaa\x16\xad\xb1\x1e\x18\x25\x99\xed\x74\xb0\x65\x94\x92\x6c\xaa\xfc\xac\x9b\x14\xd2\x2c\xca\xa9\x69\x67\x68\xe7\xee\xf5\x67\xee\x32\xca\x29\x2d\x4b\xb8\x13\x8f\x08\xae\xb3\x29\x5a\xf1\x51\xab\x67\xa8\x3b\x2d\x41\xe8\x2a\x99\x1e\xd4\x02\xc1\x79\xdb\x49\x0f\xca\x83\x45\xdf\x59\xed\x40\x58\x04\xd1\x2c\xc5\xca\x81\xd2\xb2\xe9\x2a\xac\x60\xa9\xfc\x0c\xfc\x4c\x39\xd8\x42\x64\x15\xba\x56\x79\x84\xeb\xab\x3f\x78\x1e\x12\x4e\x50\x8a\xce\x21\xf8\x19\xae\x0e\x2c\x82\x46\x0c\x47\x6b\x63\x41\x69\x8f\x56\x8b\x46\xbd\x08\xaf\x8c\x2e\xf1\x79\x6f\x0d\xa6\x7e\x45\x54\x5e\x0b\x8f\x05\xdc\x23\x82\x72\xae\x43\x98\x79\xdf\xba\x8b\xb2\xfc\x2e\xef\xe8\xea\xca\xd3\x9f\x7f\x29\x68\x64\xa9\xb4\xf2\x8c\xc3\x9a\x92\xb2\x04\xf1\x64\x54\x05\x15\x8a\x0a\xa4\xa9\x10\xb0\x51\x0b\xa5\x63\x6e\x4a\x9e\x84\x85\xbf\x21\x8a\x31\x82\x20\x13\x3b\xce\xe1\x98\xd3\x0d\xa5\x7e\xd5\x22\xf4\xda\x07\x07\xbb\x95\x6b\x4d\x89\x82\xf4\x29\xed\xcf\x4e\x29\x59\xce\x50\xf7\xcb\xf3\xb7\x94\xb4\x68\x95\xa9\x86\x65\xdd\x3b\x07\x68\x2c\xaa\x51\x0b\x89\xeb\x4d\x0e\x9d\xd2\xbe\xf5\x96\x53\x22\xec\x74\x1b\x70\xbb\x4d\x49\xc8\x6c\x3a\x0f\x6f\xe6\xae\x18\x4f\xe6\x28\x3d\x25\x42\x7a\xf5\x84\x00\x13\x63\x9a\x80\x72\xe0\xfb\xde\x48\xd1\x24\xd2\x15\x5c\x8c\x60\xee\x8a\x9b\xc6\x4c\x44\x53\xdc\xa0\x67\x59\x10\x36\xe3\xc5\x07\x5c\x32\x4e\x89\x0b\x1e\x55\x71\xef\xad\xd2\xd3\x60\x50\xc1\xa0\x74\x85\xcf\xbf\xaf\x3c\x32\x97\xc3\x01\x3b\xe0\x94\xcc\xbf\xb5\xf3\x60\x57\x35\x28\x18\x8d\xe0\xe8\x04\xbe\x7c\x81\x79\xff\xbb\xa6\x84\x34\x01\xc7\x7b\x23\x0b\x2d\xa2\xa8\xd9\xc7\x87\xab\x8c\x12\x92\x2a\x8c\x92\x0d\xfd\xc6\xc5\x7d\x52\x87\x27\x70\x01\xf3\xcf\x3b\x7b\x2f\x46\x87\xbd\x4f\x9f\xc3\xcf\x7a\xbd\x77\x26\x87\xaa\xb8\x12\x4d\xc3\xb2\x29\xfa\x70\x37\xc1\x67\x5c\xd7\x0e\x7d\xc6\x8b\x5b\x1d\x2e\xff\x0d\x1c\x9d\x1f\xe7\x50\x8b\xc6\xe1\x66\x33\x48\xd5\x5f\xe8\x07\xa1\x0d\xe3\xe9\x86\x02\xec\x84\xee\x7b\xa2\xed\x27\x4c\x69\xce\xdf\xc6\x44\x31\x0a\xbb\x53\x4d\xa3\x1c\x4a\xa3\x2b\x3e\xa4\xd3\x66\xc9\x38\x30\x87\x32\x79\xe5\xa0\xfb\xff\xb3\xd3\x1c\x16\x46\x9b\x64\x8f\xf7\xa6\x83\xd8\x7b\x00\x07\x60\x1a\xca\x3e\xcd\x7d\xca\x90\xa7\x18\x4c\xc3\x4f\xfb\x1b\x3c\x07\x3d\xa4\xbf\x6f\x10\x5b\x56\xc1\x75\x67\x63\xc1\xc7\x34\x32\xa4\x59\x88\x47\x64\x72\x26\x74\x5f\xd5\xeb\x4d\xb8\xed\x81\x7e\x22\xfb\xa3\x4b\x6c\x4d\xe7\xb3\x3c\x88\x73\xdb\xbf\xe5\x54\x8d\x2c\x56\x34\x87\x35\xc8\xc6\x38\x64\x92\xc3\x26\x01\x63\x55\xb9\x2b\x07\xa7\xe4\xf2\x48\x0e\xa8\x9c\x17\x36\xc6\xb5\xcc\xc3\x9b\xdd\x27\x16\xf1\xf9\xa2\x2f\xf2\x11\x78\xdb\x21\x25\x95\xaa\xeb\x80\x99\xf9\x22\xbe\xb4\xa3\x7d\x91\xf8\xa0\xcd\xde\x15\x84\x1a\x8d\x27\x7f\x85\x93\xcb\xcb\xb3\x93\x50\x9f\x50\x96\xb0\x10\x7e\x56\xdc\x89\xe7\xdb\xf4\x76\x77\x0b\x73\x7b\xe2\x12\x8e\x63\x2d\xc7\xc5\x08\x8e\xe3\xa6\x2f\xb6\xef\x71\xf7\x71\xfd\x3f\xa1\x28\xd9\x65\x17\x6b\x93\x92\x90\xd6\x17\x7d\xd3\xf8\x61\xd4\xe7\x26\x3d\xd9\xc3\xd1\xb0\x19\xac\xbb\xda\x71\x4a\x02\x30\x32\x35\xe0\x8b\x9a\xf9\x42\xd8\x69\xec\x5e\x24\x5c\x43\x00\x7f\x78\xc2\x77\x54\x37\xed\x7f\x88\x1e\x9a\x49\x48\xfa\x35\x2d\xd9\xa0\xb0\xaf\xbc\x06\x05\x38\x25\x4b\xe1\x7e\x4b\x3c\x2e\x02\xc0\xc4\x89\xfe\x0b\xbb\xbe\x80\x07\xff\x01\x4f\x6d\xac\xc4\xbf\x54\xfb\x4e\x35\xf8\xce\xd8\x07\x74\x3e\x34\xa3\x17\xd5\x8e\x75\xb3\x8a\x98\x82\x62\x1b\x4a\x43\x93\x0e\x2f\xfc\xde\x74\x56\xa2\x8b\x5d\xc1\xc5\xd6\x15\x5e\x6e\x62\x52\xdc\x8c\xff\x1c\x8f\x1f\x18\x87\x43\xc8\xca\x46\x4d\xca\x60\x2d\xc3\x31\xa5\x6b\x53\xbc\xa8\x36\xcb\x43\xb0\xb2\x7c\xed\x67\xa0\x1c\x48\xd3\xaa\x30\xa9\xac\x59\x40\x0a\xfa\x3a\xe7\xbc\xe9\xa7\x47\x9a\xc6\x4a\x4f\xc3\xac\x64\x4e\x69\x19\x47\x1d\x58\x14\x4d\x9c\x5e\xc3\x91\xca\xa0\xd3\x07\x9e\x0f\x93\x68\x68\x9d\x7d\xf4\x1c\x24\x4c\x56\x1e\x63\xf3\xd9\x6f\x3d\x5f\x15\x8d\xdb\xf6\x9c\x18\x64\x5c\xa7\xca\xda\xed\x4f\xa9\x7f\x67\x5b\xbf\xc0\xe1\x6a\x26\xec\x95\xa9\x30\xcb\x41\xf2\xbe\x17\xd2\x0d\xfd\x27\x00\x00\xff\xff\xbc\xb4\x65\x1c\x6b\x08\x00\x00"),
+ },
+ "/src/unicode": &vfsgen۰DirInfo{
+ name: "unicode",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 558751983, time.UTC),
+ },
+ "/src/unicode/unicode.go": &vfsgen۰CompressedFileInfo{
+ name: "unicode.go",
+ modTime: time.Date(2018, 8, 25, 22, 2, 53, 559085211, time.UTC),
+ uncompressedSize: 658,
+
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x91\x41\x8f\xd3\x30\x10\x85\xcf\xf6\xaf\x78\xa7\x28\x51\xba\x64\xcb\x71\xd5\x72\x29\x12\x08\xb1\x97\x72\xac\x0a\xf2\x3a\x93\xc6\xe0\xd8\xd6\xc4\x91\x40\xdb\xfe\x77\x64\x27\x0d\xcb\xcd\x9e\x79\xf3\x66\xe6\x9b\xa6\x41\xfd\x32\x19\xdb\xe2\xe7\x28\x65\x50\xfa\x97\xba\x10\x26\x67\xb4\x6f\x49\xca\x6e\x72\x1a\xd1\x97\x3f\xb4\x1a\x09\xc6\xc5\x0d\x18\x3c\x39\xda\x20\x45\x8e\xca\x5d\x08\xa7\xf3\xe1\xfe\xae\x50\x0e\x2a\x04\x6a\x8f\x93\xa3\x45\xd8\xf9\xc9\xb5\xcf\x2a\x04\xe3\x2e\x78\xf1\xde\x56\x78\x95\xc2\x74\x98\x4d\x77\x78\xc4\xf5\x8a\x67\xf5\xfb\x90\xbf\xfb\x25\xfe\x2a\x85\x60\x8a\x13\x3b\x1c\x29\x58\xa5\x69\x20\x17\x0f\xbd\xe2\x0d\x3a\x65\x47\x92\xe2\x26\x85\xf5\x78\xda\xe3\x51\x8a\xde\xa4\x87\x25\x57\xae\x83\x55\x52\x74\x9e\x61\x3d\x76\xe8\x4d\x36\x1c\xb2\xc8\xa3\x46\xd9\x9b\x07\xeb\xab\xe6\xbd\x14\x42\x73\x0a\x17\x6b\xe1\x69\x38\xa3\x69\x10\x88\x3b\xcf\x83\x72\x9a\xa0\xd9\x44\xa3\x95\x45\x72\xfc\xe4\x43\x4f\xfc\xe5\xdb\x13\x2e\x14\xa1\xda\x96\x69\x1c\xd1\x13\x27\x44\x63\x24\xd5\xc2\x77\xd0\x3e\xfc\x49\x2b\xc7\x9e\xb0\x02\x92\x22\x6d\x9e\xc0\x94\x9a\xdf\x7d\xf5\x55\x5a\x98\x51\x14\xe0\xfc\x5a\x12\x9f\x4d\x86\x24\x44\x4b\x36\xaa\x34\xdd\x3d\xf3\x31\x05\x4e\x19\xd1\xb9\x4a\x0a\xd3\x61\x16\x7d\x48\x0c\x33\xf7\x5c\x79\x87\xf7\xb6\x57\x8d\xb2\xe4\x87\x37\x91\xaa\xf8\xbe\xc5\x75\xd6\x64\xcf\x62\x5b\x55\x1b\x44\x9e\xd2\xa4\x09\xf0\x3f\x1f\xd4\x73\xa3\x35\x7d\x5b\x96\xc1\xee\xbf\x26\xb9\x7b\x6f\xb0\xc7\x90\x44\x20\xbb\x5c\x33\x1d\x6b\x8f\x01\x35\xb6\x73\xf5\x4d\xae\xe6\xf7\x9b\xde\xe4\xdf\x00\x00\x00\xff\xff\x20\xe3\x22\xd1\x92\x02\x00\x00"),
+ },
+ }
+ fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src"].(os.FileInfo),
+ }
+ fs["/src"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/bytes"].(os.FileInfo),
+ fs["/src/crypto"].(os.FileInfo),
+ fs["/src/database"].(os.FileInfo),
+ fs["/src/debug"].(os.FileInfo),
+ fs["/src/encoding"].(os.FileInfo),
+ fs["/src/fmt"].(os.FileInfo),
+ fs["/src/go"].(os.FileInfo),
+ fs["/src/internal"].(os.FileInfo),
+ fs["/src/io"].(os.FileInfo),
+ fs["/src/math"].(os.FileInfo),
+ fs["/src/net"].(os.FileInfo),
+ fs["/src/os"].(os.FileInfo),
+ fs["/src/reflect"].(os.FileInfo),
+ fs["/src/regexp"].(os.FileInfo),
+ fs["/src/runtime"].(os.FileInfo),
+ fs["/src/strings"].(os.FileInfo),
+ fs["/src/sync"].(os.FileInfo),
+ fs["/src/syscall"].(os.FileInfo),
+ fs["/src/testing"].(os.FileInfo),
+ fs["/src/text"].(os.FileInfo),
+ fs["/src/time"].(os.FileInfo),
+ fs["/src/unicode"].(os.FileInfo),
+ }
+ fs["/src/bytes"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/bytes/bytes.go"].(os.FileInfo),
+ fs["/src/bytes/bytes_test.go"].(os.FileInfo),
+ }
+ fs["/src/crypto"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/crypto/internal"].(os.FileInfo),
+ fs["/src/crypto/rand"].(os.FileInfo),
+ fs["/src/crypto/x509"].(os.FileInfo),
+ }
+ fs["/src/crypto/internal"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/crypto/internal/subtle"].(os.FileInfo),
+ }
+ fs["/src/crypto/internal/subtle"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/crypto/internal/subtle/aliasing.go"].(os.FileInfo),
+ }
+ fs["/src/crypto/rand"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/crypto/rand/rand.go"].(os.FileInfo),
+ }
+ fs["/src/crypto/x509"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/crypto/x509/x509.go"].(os.FileInfo),
+ fs["/src/crypto/x509/x509_test.go"].(os.FileInfo),
+ }
+ fs["/src/database"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/database/sql"].(os.FileInfo),
+ }
+ fs["/src/database/sql"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/database/sql/driver"].(os.FileInfo),
+ }
+ fs["/src/database/sql/driver"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/database/sql/driver/driver_test.go"].(os.FileInfo),
+ }
+ fs["/src/debug"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/debug/elf"].(os.FileInfo),
+ }
+ fs["/src/debug/elf"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/debug/elf/elf_test.go"].(os.FileInfo),
+ }
+ fs["/src/encoding"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/encoding/gob"].(os.FileInfo),
+ fs["/src/encoding/json"].(os.FileInfo),
+ }
+ fs["/src/encoding/gob"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/encoding/gob/gob_test.go"].(os.FileInfo),
+ }
+ fs["/src/encoding/json"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/encoding/json/stream_test.go"].(os.FileInfo),
+ }
+ fs["/src/fmt"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/fmt/fmt_test.go"].(os.FileInfo),
+ }
+ fs["/src/go"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/go/token"].(os.FileInfo),
+ }
+ fs["/src/go/token"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/go/token/token_test.go"].(os.FileInfo),
+ }
+ fs["/src/internal"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/internal/cpu"].(os.FileInfo),
+ fs["/src/internal/poll"].(os.FileInfo),
+ fs["/src/internal/syscall"].(os.FileInfo),
+ fs["/src/internal/testenv"].(os.FileInfo),
+ }
+ fs["/src/internal/cpu"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/internal/cpu/cpu_js.go"].(os.FileInfo),
+ }
+ fs["/src/internal/poll"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/internal/poll/fd_poll_js.go"].(os.FileInfo),
+ }
+ fs["/src/internal/syscall"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/internal/syscall/unix"].(os.FileInfo),
+ }
+ fs["/src/internal/syscall/unix"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/internal/syscall/unix/unix_js.go"].(os.FileInfo),
+ }
+ fs["/src/internal/testenv"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/internal/testenv/testenv.go"].(os.FileInfo),
+ }
+ fs["/src/io"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/io/io_test.go"].(os.FileInfo),
+ }
+ fs["/src/math"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/math/big"].(os.FileInfo),
+ fs["/src/math/math.go"].(os.FileInfo),
+ fs["/src/math/math_test.go"].(os.FileInfo),
+ fs["/src/math/rand"].(os.FileInfo),
+ }
+ fs["/src/math/big"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/math/big/big.go"].(os.FileInfo),
+ fs["/src/math/big/big_test.go"].(os.FileInfo),
+ }
+ fs["/src/math/rand"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/math/rand/rand_test.go"].(os.FileInfo),
+ }
+ fs["/src/net"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/net/http"].(os.FileInfo),
+ fs["/src/net/net.go"].(os.FileInfo),
+ }
+ fs["/src/net/http"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/net/http/cookiejar"].(os.FileInfo),
+ fs["/src/net/http/fetch.go"].(os.FileInfo),
+ fs["/src/net/http/http.go"].(os.FileInfo),
+ }
+ fs["/src/net/http/cookiejar"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/net/http/cookiejar/example_test.go"].(os.FileInfo),
+ }
+ fs["/src/os"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/os/os.go"].(os.FileInfo),
+ fs["/src/os/signal"].(os.FileInfo),
+ }
+ fs["/src/os/signal"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/os/signal/signal.go"].(os.FileInfo),
+ }
+ fs["/src/reflect"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/reflect/example_test.go"].(os.FileInfo),
+ fs["/src/reflect/reflect.go"].(os.FileInfo),
+ fs["/src/reflect/reflect_go111.go"].(os.FileInfo),
+ fs["/src/reflect/reflect_go1111.go"].(os.FileInfo),
+ fs["/src/reflect/reflect_test.go"].(os.FileInfo),
+ fs["/src/reflect/swapper.go"].(os.FileInfo),
+ }
+ fs["/src/regexp"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/regexp/regexp_test.go"].(os.FileInfo),
+ }
+ fs["/src/runtime"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/runtime/debug"].(os.FileInfo),
+ fs["/src/runtime/pprof"].(os.FileInfo),
+ fs["/src/runtime/runtime.go"].(os.FileInfo),
+ }
+ fs["/src/runtime/debug"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/runtime/debug/debug.go"].(os.FileInfo),
+ }
+ fs["/src/runtime/pprof"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/runtime/pprof/pprof.go"].(os.FileInfo),
+ }
+ fs["/src/strings"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/strings/strings.go"].(os.FileInfo),
+ fs["/src/strings/strings_test.go"].(os.FileInfo),
+ }
+ fs["/src/sync"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/sync/atomic"].(os.FileInfo),
+ fs["/src/sync/cond.go"].(os.FileInfo),
+ fs["/src/sync/export_test.go"].(os.FileInfo),
+ fs["/src/sync/pool.go"].(os.FileInfo),
+ fs["/src/sync/sync.go"].(os.FileInfo),
+ fs["/src/sync/sync_test.go"].(os.FileInfo),
+ fs["/src/sync/waitgroup.go"].(os.FileInfo),
+ }
+ fs["/src/sync/atomic"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/sync/atomic/atomic.go"].(os.FileInfo),
+ fs["/src/sync/atomic/atomic_test.go"].(os.FileInfo),
+ }
+ fs["/src/syscall"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/syscall/syscall.go"].(os.FileInfo),
+ fs["/src/syscall/syscall_linux.go"].(os.FileInfo),
+ fs["/src/syscall/syscall_nonlinux.go"].(os.FileInfo),
+ fs["/src/syscall/syscall_unix.go"].(os.FileInfo),
+ fs["/src/syscall/syscall_windows.go"].(os.FileInfo),
+ }
+ fs["/src/testing"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/testing/example.go"].(os.FileInfo),
+ fs["/src/testing/ioutil.go"].(os.FileInfo),
+ fs["/src/testing/testing.go"].(os.FileInfo),
+ }
+ fs["/src/text"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/text/template"].(os.FileInfo),
+ }
+ fs["/src/text/template"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/text/template/template.go"].(os.FileInfo),
+ }
+ fs["/src/time"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/time/time.go"].(os.FileInfo),
+ }
+ fs["/src/unicode"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
+ fs["/src/unicode/unicode.go"].(os.FileInfo),
+ }
+
+ return fs
+}()
+
+type vfsgen۰FS map[string]interface{}
+
+func (fs vfsgen۰FS) Open(path string) (http.File, error) {
+ path = pathpkg.Clean("/" + path)
+ f, ok := fs[path]
+ if !ok {
+ return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
+ }
+
+ switch f := f.(type) {
+ case *vfsgen۰CompressedFileInfo:
+ gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent))
+ if err != nil {
+ // This should never happen because we generate the gzip bytes such that they are always valid.
+ panic("unexpected error reading own gzip compressed bytes: " + err.Error())
+ }
+ return &vfsgen۰CompressedFile{
+ vfsgen۰CompressedFileInfo: f,
+ gr: gr,
+ }, nil
+ case *vfsgen۰FileInfo:
+ return &vfsgen۰File{
+ vfsgen۰FileInfo: f,
+ Reader: bytes.NewReader(f.content),
+ }, nil
+ case *vfsgen۰DirInfo:
+ return &vfsgen۰Dir{
+ vfsgen۰DirInfo: f,
+ }, nil
+ default:
+ // This should never happen because we generate only the above types.
+ panic(fmt.Sprintf("unexpected type %T", f))
+ }
+}
+
+// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file.
+type vfsgen۰CompressedFileInfo struct {
+ name string
+ modTime time.Time
+ compressedContent []byte
+ uncompressedSize int64
+}
+
+func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) {
+ return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
+}
+func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil }
+
+func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte {
+ return f.compressedContent
+}
+
+func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name }
+func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize }
+func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 }
+func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime }
+func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false }
+func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil }
+
+// vfsgen۰CompressedFile is an opened compressedFile instance.
+type vfsgen۰CompressedFile struct {
+ *vfsgen۰CompressedFileInfo
+ gr *gzip.Reader
+ grPos int64 // Actual gr uncompressed position.
+ seekPos int64 // Seek uncompressed position.
+}
+
+func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
+ if f.grPos > f.seekPos {
+ // Rewind to beginning.
+ err = f.gr.Reset(bytes.NewReader(f.compressedContent))
+ if err != nil {
+ return 0, err
+ }
+ f.grPos = 0
+ }
+ if f.grPos < f.seekPos {
+ // Fast-forward.
+ _, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
+ if err != nil {
+ return 0, err
+ }
+ f.grPos = f.seekPos
+ }
+ n, err = f.gr.Read(p)
+ f.grPos += int64(n)
+ f.seekPos = f.grPos
+ return n, err
+}
+func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) {
+ switch whence {
+ case io.SeekStart:
+ f.seekPos = 0 + offset
+ case io.SeekCurrent:
+ f.seekPos += offset
+ case io.SeekEnd:
+ f.seekPos = f.uncompressedSize + offset
+ default:
+ panic(fmt.Errorf("invalid whence value: %v", whence))
+ }
+ return f.seekPos, nil
+}
+func (f *vfsgen۰CompressedFile) Close() error {
+ return f.gr.Close()
+}
+
+// vfsgen۰FileInfo is a static definition of an uncompressed file (because it's not worth gzip compressing).
+type vfsgen۰FileInfo struct {
+ name string
+ modTime time.Time
+ content []byte
+}
+
+func (f *vfsgen۰FileInfo) Readdir(count int) ([]os.FileInfo, error) {
+ return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
+}
+func (f *vfsgen۰FileInfo) Stat() (os.FileInfo, error) { return f, nil }
+
+func (f *vfsgen۰FileInfo) NotWorthGzipCompressing() {}
+
+func (f *vfsgen۰FileInfo) Name() string { return f.name }
+func (f *vfsgen۰FileInfo) Size() int64 { return int64(len(f.content)) }
+func (f *vfsgen۰FileInfo) Mode() os.FileMode { return 0444 }
+func (f *vfsgen۰FileInfo) ModTime() time.Time { return f.modTime }
+func (f *vfsgen۰FileInfo) IsDir() bool { return false }
+func (f *vfsgen۰FileInfo) Sys() interface{} { return nil }
+
+// vfsgen۰File is an opened file instance.
+type vfsgen۰File struct {
+ *vfsgen۰FileInfo
+ *bytes.Reader
+}
+
+func (f *vfsgen۰File) Close() error {
+ return nil
+}
+
+// vfsgen۰DirInfo is a static definition of a directory.
+type vfsgen۰DirInfo struct {
+ name string
+ modTime time.Time
+ entries []os.FileInfo
+}
+
+func (d *vfsgen۰DirInfo) Read([]byte) (int, error) {
+ return 0, fmt.Errorf("cannot Read from directory %s", d.name)
+}
+func (d *vfsgen۰DirInfo) Close() error { return nil }
+func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil }
+
+func (d *vfsgen۰DirInfo) Name() string { return d.name }
+func (d *vfsgen۰DirInfo) Size() int64 { return 0 }
+func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
+func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime }
+func (d *vfsgen۰DirInfo) IsDir() bool { return true }
+func (d *vfsgen۰DirInfo) Sys() interface{} { return nil }
+
+// vfsgen۰Dir is an opened dir instance.
+type vfsgen۰Dir struct {
+ *vfsgen۰DirInfo
+ pos int // Position within entries for Seek and Readdir.
+}
+
+func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) {
+ if offset == 0 && whence == io.SeekStart {
+ d.pos = 0
+ return 0, nil
+ }
+ return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
+}
+
+func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) {
+ if d.pos >= len(d.entries) && count > 0 {
+ return nil, io.EOF
+ }
+ if count <= 0 || count > len(d.entries)-d.pos {
+ count = len(d.entries) - d.pos
+ }
+ e := d.entries[d.pos : d.pos+count]
+ d.pos += count
+ return e, nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/bytes/bytes.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/bytes/bytes.go
new file mode 100644
index 00000000000..2bf919efd7f
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/bytes/bytes.go
@@ -0,0 +1,43 @@
+// +build js
+
+package bytes
+
+func IndexByte(s []byte, c byte) int {
+ for i, b := range s {
+ if b == c {
+ return i
+ }
+ }
+ return -1
+}
+
+func Equal(a, b []byte) bool {
+ if len(a) != len(b) {
+ return false
+ }
+ for i, c := range a {
+ if c != b[i] {
+ return false
+ }
+ }
+ return true
+}
+
+func Compare(a, b []byte) int {
+ for i, ca := range a {
+ if i >= len(b) {
+ return 1
+ }
+ cb := b[i]
+ if ca < cb {
+ return -1
+ }
+ if ca > cb {
+ return 1
+ }
+ }
+ if len(a) < len(b) {
+ return -1
+ }
+ return 0
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/internal/subtle/aliasing.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/internal/subtle/aliasing.go
new file mode 100644
index 00000000000..50cc9712dc7
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/internal/subtle/aliasing.go
@@ -0,0 +1,15 @@
+// +build js
+
+package subtle
+
+import "github.com/gopherjs/gopherjs/js"
+
+// AnyOverlap reports whether x and y share memory at any (not necessarily
+// corresponding) index. The memory beyond the slice length is ignored.
+func AnyOverlap(x, y []byte) bool {
+ // GopherJS: We can't rely on pointer arithmetic, so use GopherJS slice internals.
+ return len(x) > 0 && len(y) > 0 &&
+ js.InternalObject(x).Get("$array") == js.InternalObject(y).Get("$array") &&
+ js.InternalObject(x).Get("$offset").Int() <= js.InternalObject(y).Get("$offset").Int()+len(y)-1 &&
+ js.InternalObject(y).Get("$offset").Int() <= js.InternalObject(x).Get("$offset").Int()+len(x)-1
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/rand/rand.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/rand/rand.go
new file mode 100644
index 00000000000..0e63a76e101
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/rand/rand.go
@@ -0,0 +1,49 @@
+// +build js
+
+package rand
+
+import (
+ "errors"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func init() {
+ Reader = &rngReader{}
+}
+
+type rngReader struct{}
+
+func (r *rngReader) Read(b []byte) (n int, err error) {
+ array := js.InternalObject(b).Get("$array")
+ offset := js.InternalObject(b).Get("$offset").Int()
+
+ // browser
+ crypto := js.Global.Get("crypto")
+ if crypto == js.Undefined {
+ crypto = js.Global.Get("msCrypto")
+ }
+ if crypto != js.Undefined {
+ if crypto.Get("getRandomValues") != js.Undefined {
+ n = len(b)
+ if n > 65536 {
+ // Avoid QuotaExceededError thrown by getRandomValues
+ // when length is more than 65536, as specified in
+ // http://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues
+ n = 65536
+ }
+ crypto.Call("getRandomValues", array.Call("subarray", offset, offset+n))
+ return n, nil
+ }
+ }
+
+ // Node.js
+ if require := js.Global.Get("require"); require != js.Undefined {
+ if randomBytes := require.Invoke("crypto").Get("randomBytes"); randomBytes != js.Undefined {
+ array.Call("set", randomBytes.Invoke(len(b)), offset)
+ return len(b), nil
+ }
+ }
+
+ return 0, errors.New("crypto/rand not available in this environment")
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/x509/x509.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/x509/x509.go
new file mode 100644
index 00000000000..a0391f751be
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/crypto/x509/x509.go
@@ -0,0 +1,9 @@
+// +build js
+
+package x509
+
+import "errors"
+
+func loadSystemRoots() (*CertPool, error) {
+ return nil, errors.New("crypto/x509: system root pool is not available in GopherJS")
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/cpu/cpu_js.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/cpu/cpu_js.go
new file mode 100644
index 00000000000..9eb1dc440b7
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/cpu/cpu_js.go
@@ -0,0 +1,5 @@
+// +build js
+
+package cpu
+
+const CacheLineSize = 0
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/poll/fd_poll_js.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/poll/fd_poll_js.go
new file mode 100644
index 00000000000..5690f9fe839
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/poll/fd_poll_js.go
@@ -0,0 +1,88 @@
+// +build js
+
+package poll
+
+import "time"
+
+// pollDesc is a no-op implementation of an I/O poller for GOARCH=js.
+//
+// Its implementation is based on NaCL in gc compiler (see GOROOT/src/internal/poll/fd_poll_nacl.go),
+// but it does even less.
+type pollDesc struct {
+ closing bool
+}
+
+func (pd *pollDesc) init(fd *FD) error { return nil }
+
+func (pd *pollDesc) close() {}
+
+func (pd *pollDesc) evict() { pd.closing = true }
+
+func (pd *pollDesc) prepare(mode int, isFile bool) error {
+ if pd.closing {
+ return errClosing(isFile)
+ }
+ return nil
+}
+
+func (pd *pollDesc) prepareRead(isFile bool) error { return pd.prepare('r', isFile) }
+
+func (pd *pollDesc) prepareWrite(isFile bool) error { return pd.prepare('w', isFile) }
+
+func (pd *pollDesc) wait(mode int, isFile bool) error {
+ if pd.closing {
+ return errClosing(isFile)
+ }
+ return ErrTimeout
+}
+
+func (pd *pollDesc) waitRead(isFile bool) error { return pd.wait('r', isFile) }
+
+func (pd *pollDesc) waitWrite(isFile bool) error { return pd.wait('w', isFile) }
+
+func (*pollDesc) waitCanceled(mode int) {}
+
+func (*pollDesc) pollable() bool { return true }
+
+func (*FD) SetDeadline(t time.Time) error { return nil }
+
+func (*FD) SetReadDeadline(t time.Time) error { return nil }
+
+func (*FD) SetWriteDeadline(t time.Time) error { return nil }
+
+// PollDescriptor returns the descriptor being used by the poller,
+// or ^uintptr(0) if there isn't one. This is only used for testing.
+func PollDescriptor() uintptr {
+ return ^uintptr(0)
+}
+
+// Copy of sync.runtime_Semacquire.
+func runtime_Semacquire(s *uint32) {
+ if *s == 0 {
+ ch := make(chan bool)
+ semWaiters[s] = append(semWaiters[s], ch)
+ <-ch
+ }
+ *s--
+}
+
+// Copy of sync.runtime_Semrelease.
+func runtime_Semrelease(s *uint32) {
+ *s++
+
+ w := semWaiters[s]
+ if len(w) == 0 {
+ return
+ }
+
+ ch := w[0]
+ w = w[1:]
+ semWaiters[s] = w
+ if len(w) == 0 {
+ delete(semWaiters, s)
+ }
+
+ ch <- true
+}
+
+var semWaiters = make(map[*uint32][]chan bool)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/syscall/unix/unix_js.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/syscall/unix/unix_js.go
new file mode 100644
index 00000000000..b6ffdec7673
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/syscall/unix/unix_js.go
@@ -0,0 +1,9 @@
+// +build js
+
+package unix
+
+const randomTrap = 0
+
+func IsNonblock(fd int) (nonblocking bool, err error) {
+ return false, nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/testenv/testenv.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/testenv/testenv.go
new file mode 100644
index 00000000000..481414e08a7
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/internal/testenv/testenv.go
@@ -0,0 +1,26 @@
+// +build js
+
+package testenv
+
+import (
+ "runtime"
+ "strings"
+)
+
+// HasExec reports whether the current system can start new processes
+// using os.StartProcess or (more commonly) exec.Command.
+func HasExec() bool {
+ switch runtime.GOOS {
+ case "nacl":
+ return false
+ case "darwin":
+ if strings.HasPrefix(runtime.GOARCH, "arm") {
+ return false
+ }
+ }
+ switch runtime.GOARCH {
+ case "js":
+ return false
+ }
+ return true
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/big/big.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/big/big.go
new file mode 100644
index 00000000000..83374757087
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/big/big.go
@@ -0,0 +1,7 @@
+// +build js
+
+package big
+
+// TODO: This is a workaround for https://github.com/gopherjs/gopherjs/issues/652.
+// Remove after that issue is resolved.
+type Word uintptr
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/math.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/math.go
new file mode 100644
index 00000000000..a35bd8d68cc
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/math/math.go
@@ -0,0 +1,255 @@
+// +build js
+
+package math
+
+import (
+ "github.com/gopherjs/gopherjs/js"
+)
+
+var math = js.Global.Get("Math")
+var zero float64 = 0
+var posInf = 1 / zero
+var negInf = -1 / zero
+var nan = 0 / zero
+
+func Acos(x float64) float64 {
+ return math.Call("acos", x).Float()
+}
+
+func Acosh(x float64) float64 {
+ return math.Call("acosh", x).Float()
+}
+
+func Asin(x float64) float64 {
+ return math.Call("asin", x).Float()
+}
+
+func Asinh(x float64) float64 {
+ return math.Call("asinh", x).Float()
+}
+
+func Atan(x float64) float64 {
+ return math.Call("atan", x).Float()
+}
+
+func Atanh(x float64) float64 {
+ return math.Call("atanh", x).Float()
+}
+
+func Atan2(y, x float64) float64 {
+ return math.Call("atan2", y, x).Float()
+}
+
+func Cbrt(x float64) float64 {
+ return math.Call("cbrt", x).Float()
+}
+
+func Ceil(x float64) float64 {
+ return math.Call("ceil", x).Float()
+}
+
+func Copysign(x, y float64) float64 {
+ if (x < 0 || 1/x == negInf) != (y < 0 || 1/y == negInf) {
+ return -x
+ }
+ return x
+}
+
+func Cos(x float64) float64 {
+ return math.Call("cos", x).Float()
+}
+
+func Cosh(x float64) float64 {
+ return math.Call("cosh", x).Float()
+}
+
+func Erf(x float64) float64 {
+ return erf(x)
+}
+
+func Erfc(x float64) float64 {
+ return erfc(x)
+}
+
+func Exp(x float64) float64 {
+ return math.Call("exp", x).Float()
+}
+
+func Exp2(x float64) float64 {
+ return math.Call("pow", 2, x).Float()
+}
+
+func Expm1(x float64) float64 {
+ return expm1(x)
+}
+
+func Floor(x float64) float64 {
+ return math.Call("floor", x).Float()
+}
+
+func Frexp(f float64) (frac float64, exp int) {
+ return frexp(f)
+}
+
+func Hypot(p, q float64) float64 {
+ return hypot(p, q)
+}
+
+func Inf(sign int) float64 {
+ switch {
+ case sign >= 0:
+ return posInf
+ default:
+ return negInf
+ }
+}
+
+func IsInf(f float64, sign int) bool {
+ if f == posInf {
+ return sign >= 0
+ }
+ if f == negInf {
+ return sign <= 0
+ }
+ return false
+}
+
+func IsNaN(f float64) (is bool) {
+ return f != f
+}
+
+func Ldexp(frac float64, exp int) float64 {
+ if -1024 < exp && exp < 1024 { // Use Math.pow for small exp values where it's viable. For performance.
+ if frac == 0 {
+ return frac
+ }
+ return frac * math.Call("pow", 2, exp).Float()
+ }
+ return ldexp(frac, exp)
+}
+
+func Log(x float64) float64 {
+ if x != x { // workaround for optimizer bug in V8, remove at some point
+ return nan
+ }
+ return math.Call("log", x).Float()
+}
+
+func Log10(x float64) float64 {
+ return log10(x)
+}
+
+func Log1p(x float64) float64 {
+ return log1p(x)
+}
+
+func Log2(x float64) float64 {
+ return log2(x)
+}
+
+func Max(x, y float64) float64 {
+ return max(x, y)
+}
+
+func Min(x, y float64) float64 {
+ return min(x, y)
+}
+
+func Mod(x, y float64) float64 {
+ return js.Global.Call("$mod", x, y).Float()
+}
+
+func Modf(f float64) (float64, float64) {
+ if f == posInf || f == negInf {
+ return f, nan
+ }
+ if 1/f == negInf {
+ return f, f
+ }
+ frac := Mod(f, 1)
+ return f - frac, frac
+}
+
+func NaN() float64 {
+ return nan
+}
+
+func Pow(x, y float64) float64 {
+ if x == 1 || (x == -1 && (y == posInf || y == negInf)) {
+ return 1
+ }
+ return math.Call("pow", x, y).Float()
+}
+
+func Remainder(x, y float64) float64 {
+ return remainder(x, y)
+}
+
+func Signbit(x float64) bool {
+ return x < 0 || 1/x == negInf
+}
+
+func Sin(x float64) float64 {
+ return math.Call("sin", x).Float()
+}
+
+func Sinh(x float64) float64 {
+ return math.Call("sinh", x).Float()
+}
+
+func Sincos(x float64) (sin, cos float64) {
+ return Sin(x), Cos(x)
+}
+
+func Sqrt(x float64) float64 {
+ return math.Call("sqrt", x).Float()
+}
+
+func Tan(x float64) float64 {
+ return math.Call("tan", x).Float()
+}
+
+func Tanh(x float64) float64 {
+ return math.Call("tanh", x).Float()
+}
+
+func Trunc(x float64) float64 {
+ if x == posInf || x == negInf || x != x || 1/x == negInf {
+ return x
+ }
+ return float64(int(x))
+}
+
+var buf struct {
+ uint32array [2]uint32
+ float32array [2]float32
+ float64array [1]float64
+}
+
+func init() {
+ ab := js.Global.Get("ArrayBuffer").New(8)
+ js.InternalObject(buf).Set("uint32array", js.Global.Get("Uint32Array").New(ab))
+ js.InternalObject(buf).Set("float32array", js.Global.Get("Float32Array").New(ab))
+ js.InternalObject(buf).Set("float64array", js.Global.Get("Float64Array").New(ab))
+}
+
+func Float32bits(f float32) uint32 {
+ buf.float32array[0] = f
+ return buf.uint32array[0]
+}
+
+func Float32frombits(b uint32) float32 {
+ buf.uint32array[0] = b
+ return buf.float32array[0]
+}
+
+func Float64bits(f float64) uint64 {
+ buf.float64array[0] = f
+ return uint64(buf.uint32array[1])<<32 + uint64(buf.uint32array[0])
+}
+
+func Float64frombits(b uint64) float64 {
+ buf.uint32array[0] = uint32(b)
+ buf.uint32array[1] = uint32(b >> 32)
+ return buf.float64array[0]
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/fetch.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/fetch.go
new file mode 100644
index 00000000000..f9123d09063
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/fetch.go
@@ -0,0 +1,134 @@
+// +build js
+
+package http
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "strconv"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+// streamReader implements an io.ReadCloser wrapper for ReadableStream of https://fetch.spec.whatwg.org/.
+type streamReader struct {
+ pending []byte
+ stream *js.Object
+}
+
+func (r *streamReader) Read(p []byte) (n int, err error) {
+ if len(r.pending) == 0 {
+ var (
+ bCh = make(chan []byte)
+ errCh = make(chan error)
+ )
+ r.stream.Call("read").Call("then",
+ func(result *js.Object) {
+ if result.Get("done").Bool() {
+ errCh <- io.EOF
+ return
+ }
+ bCh <- result.Get("value").Interface().([]byte)
+ },
+ func(reason *js.Object) {
+ // Assumes it's a DOMException.
+ errCh <- errors.New(reason.Get("message").String())
+ },
+ )
+ select {
+ case b := <-bCh:
+ r.pending = b
+ case err := <-errCh:
+ return 0, err
+ }
+ }
+ n = copy(p, r.pending)
+ r.pending = r.pending[n:]
+ return n, nil
+}
+
+func (r *streamReader) Close() error {
+ // This ignores any error returned from cancel method. So far, I did not encounter any concrete
+ // situation where reporting the error is meaningful. Most users ignore error from resp.Body.Close().
+ // If there's a need to report error here, it can be implemented and tested when that need comes up.
+ r.stream.Call("cancel")
+ return nil
+}
+
+// fetchTransport is a RoundTripper that is implemented using Fetch API. It supports streaming
+// response bodies.
+type fetchTransport struct{}
+
+func (t *fetchTransport) RoundTrip(req *Request) (*Response, error) {
+ headers := js.Global.Get("Headers").New()
+ for key, values := range req.Header {
+ for _, value := range values {
+ headers.Call("append", key, value)
+ }
+ }
+ opt := map[string]interface{}{
+ "method": req.Method,
+ "headers": headers,
+ "credentials": "same-origin",
+ }
+ if req.Body != nil {
+ // TODO: Find out if request body can be streamed into the fetch request rather than in advance here.
+ // See BufferSource at https://fetch.spec.whatwg.org/#body-mixin.
+ body, err := ioutil.ReadAll(req.Body)
+ if err != nil {
+ req.Body.Close() // RoundTrip must always close the body, including on errors.
+ return nil, err
+ }
+ req.Body.Close()
+ opt["body"] = body
+ }
+ respPromise := js.Global.Call("fetch", req.URL.String(), opt)
+
+ var (
+ respCh = make(chan *Response)
+ errCh = make(chan error)
+ )
+ respPromise.Call("then",
+ func(result *js.Object) {
+ header := Header{}
+ result.Get("headers").Call("forEach", func(value, key *js.Object) {
+ ck := CanonicalHeaderKey(key.String())
+ header[ck] = append(header[ck], value.String())
+ })
+
+ contentLength := int64(-1)
+ if cl, err := strconv.ParseInt(header.Get("Content-Length"), 10, 64); err == nil {
+ contentLength = cl
+ }
+
+ select {
+ case respCh <- &Response{
+ Status: result.Get("status").String() + " " + StatusText(result.Get("status").Int()),
+ StatusCode: result.Get("status").Int(),
+ Header: header,
+ ContentLength: contentLength,
+ Body: &streamReader{stream: result.Get("body").Call("getReader")},
+ Request: req,
+ }:
+ case <-req.Context().Done():
+ }
+ },
+ func(reason *js.Object) {
+ select {
+ case errCh <- fmt.Errorf("net/http: fetch() failed: %s", reason.String()):
+ case <-req.Context().Done():
+ }
+ },
+ )
+ select {
+ case <-req.Context().Done():
+ // TODO: Abort request if possible using Fetch API.
+ return nil, errors.New("net/http: request canceled")
+ case resp := <-respCh:
+ return resp, nil
+ case err := <-errCh:
+ return nil, err
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/http.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/http.go
new file mode 100644
index 00000000000..105f728319a
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/http/http.go
@@ -0,0 +1,113 @@
+// +build js
+
+package http
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "io/ioutil"
+ "net/textproto"
+ "strconv"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+var DefaultTransport = func() RoundTripper {
+ switch {
+ case js.Global.Get("fetch") != js.Undefined && js.Global.Get("ReadableStream") != js.Undefined: // ReadableStream is used as a check for support of streaming response bodies, see https://fetch.spec.whatwg.org/#streams.
+ return &fetchTransport{}
+ case js.Global.Get("XMLHttpRequest") != js.Undefined:
+ return &XHRTransport{}
+ default:
+ return noTransport{}
+ }
+}()
+
+// noTransport is used when neither Fetch API nor XMLHttpRequest API are available. It always fails.
+type noTransport struct{}
+
+func (noTransport) RoundTrip(req *Request) (*Response, error) {
+ return nil, errors.New("net/http: neither of Fetch nor XMLHttpRequest APIs is available")
+}
+
+type XHRTransport struct {
+ inflight map[*Request]*js.Object
+}
+
+func (t *XHRTransport) RoundTrip(req *Request) (*Response, error) {
+ xhr := js.Global.Get("XMLHttpRequest").New()
+
+ if t.inflight == nil {
+ t.inflight = map[*Request]*js.Object{}
+ }
+ t.inflight[req] = xhr
+ defer delete(t.inflight, req)
+
+ respCh := make(chan *Response)
+ errCh := make(chan error)
+
+ xhr.Set("onload", func() {
+ header, _ := textproto.NewReader(bufio.NewReader(bytes.NewReader([]byte(xhr.Call("getAllResponseHeaders").String() + "\n")))).ReadMIMEHeader()
+ body := js.Global.Get("Uint8Array").New(xhr.Get("response")).Interface().([]byte)
+
+ contentLength := int64(-1)
+ switch req.Method {
+ case "HEAD":
+ if l, err := strconv.ParseInt(header.Get("Content-Length"), 10, 64); err == nil {
+ contentLength = l
+ }
+ default:
+ contentLength = int64(len(body))
+ }
+
+ respCh <- &Response{
+ Status: xhr.Get("status").String() + " " + xhr.Get("statusText").String(),
+ StatusCode: xhr.Get("status").Int(),
+ Header: Header(header),
+ ContentLength: contentLength,
+ Body: ioutil.NopCloser(bytes.NewReader(body)),
+ Request: req,
+ }
+ })
+
+ xhr.Set("onerror", func(e *js.Object) {
+ errCh <- errors.New("net/http: XMLHttpRequest failed")
+ })
+
+ xhr.Set("onabort", func(e *js.Object) {
+ errCh <- errors.New("net/http: request canceled")
+ })
+
+ xhr.Call("open", req.Method, req.URL.String())
+ xhr.Set("responseType", "arraybuffer") // has to be after "open" until https://bugzilla.mozilla.org/show_bug.cgi?id=1110761 is resolved
+ for key, values := range req.Header {
+ for _, value := range values {
+ xhr.Call("setRequestHeader", key, value)
+ }
+ }
+ if req.Body == nil {
+ xhr.Call("send")
+ } else {
+ body, err := ioutil.ReadAll(req.Body)
+ if err != nil {
+ req.Body.Close() // RoundTrip must always close the body, including on errors.
+ return nil, err
+ }
+ req.Body.Close()
+ xhr.Call("send", body)
+ }
+
+ select {
+ case resp := <-respCh:
+ return resp, nil
+ case err := <-errCh:
+ return nil, err
+ }
+}
+
+func (t *XHRTransport) CancelRequest(req *Request) {
+ if xhr, ok := t.inflight[req]; ok {
+ xhr.Call("abort")
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/net.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/net.go
new file mode 100644
index 00000000000..10e1161bd66
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/net/net.go
@@ -0,0 +1,65 @@
+// +build js
+
+package net
+
+import (
+ "errors"
+ "syscall"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func Listen(net, laddr string) (Listener, error) {
+ panic(errors.New("network access is not supported by GopherJS"))
+}
+
+func (d *Dialer) Dial(network, address string) (Conn, error) {
+ panic(errors.New("network access is not supported by GopherJS"))
+}
+
+func sysInit() {
+}
+
+func probeIPv4Stack() bool {
+ return false
+}
+
+func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) {
+ return false, false
+}
+
+func probeWindowsIPStack() (supportsVistaIP bool) {
+ return false
+}
+
+func maxListenerBacklog() int {
+ return syscall.SOMAXCONN
+}
+
+// Copy of strings.IndexByte.
+func byteIndex(s string, c byte) int {
+ return js.InternalObject(s).Call("indexOf", js.Global.Get("String").Call("fromCharCode", c)).Int()
+}
+
+// Copy of bytes.Equal.
+func bytesEqual(x, y []byte) bool {
+ if len(x) != len(y) {
+ return false
+ }
+ for i, b := range x {
+ if b != y[i] {
+ return false
+ }
+ }
+ return true
+}
+
+// Copy of bytes.IndexByte.
+func bytesIndexByte(s []byte, c byte) int {
+ for i, b := range s {
+ if b == c {
+ return i
+ }
+ }
+ return -1
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/os.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/os.go
new file mode 100644
index 00000000000..96f36d28b52
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/os.go
@@ -0,0 +1,32 @@
+// +build js
+
+package os
+
+import (
+ "errors"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func runtime_args() []string { // not called on Windows
+ return Args
+}
+
+func init() {
+ if process := js.Global.Get("process"); process != js.Undefined {
+ argv := process.Get("argv")
+ Args = make([]string, argv.Length()-1)
+ for i := 0; i < argv.Length()-1; i++ {
+ Args[i] = argv.Index(i + 1).String()
+ }
+ }
+ if len(Args) == 0 {
+ Args = []string{"?"}
+ }
+}
+
+func runtime_beforeExit() {}
+
+func executable() (string, error) {
+ return "", errors.New("Executable not implemented for GOARCH=js")
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/signal/signal.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/signal/signal.go
new file mode 100644
index 00000000000..a560f8ec803
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/os/signal/signal.go
@@ -0,0 +1,12 @@
+// +build js
+
+package signal
+
+// Package signal is not implemented for GOARCH=js.
+
+func signal_disable(uint32) {}
+func signal_enable(uint32) {}
+func signal_ignore(uint32) {}
+func signal_recv() uint32 { return 0 }
+
+func loop() {}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect.go
new file mode 100644
index 00000000000..811822ac9fe
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect.go
@@ -0,0 +1,1371 @@
+// +build js
+
+package reflect
+
+import (
+ "errors"
+ "strconv"
+ "unsafe"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+var initialized = false
+
+func init() {
+ // avoid dead code elimination
+ used := func(i interface{}) {}
+ used(rtype{})
+ used(uncommonType{})
+ used(method{})
+ used(arrayType{})
+ used(chanType{})
+ used(funcType{})
+ used(interfaceType{})
+ used(mapType{})
+ used(ptrType{})
+ used(sliceType{})
+ used(structType{})
+ used(imethod{})
+ used(structField{})
+
+ initialized = true
+ uint8Type = TypeOf(uint8(0)).(*rtype) // set for real
+}
+
+func jsType(typ Type) *js.Object {
+ return js.InternalObject(typ).Get("jsType")
+}
+
+func reflectType(typ *js.Object) *rtype {
+ if typ.Get("reflectType") == js.Undefined {
+ rt := &rtype{
+ size: uintptr(typ.Get("size").Int()),
+ kind: uint8(typ.Get("kind").Int()),
+ str: newNameOff(newName(internalStr(typ.Get("string")), "", typ.Get("exported").Bool())),
+ }
+ js.InternalObject(rt).Set("jsType", typ)
+ typ.Set("reflectType", js.InternalObject(rt))
+
+ methodSet := js.Global.Call("$methodSet", typ)
+ if methodSet.Length() != 0 || typ.Get("named").Bool() {
+ rt.tflag |= tflagUncommon
+ if typ.Get("named").Bool() {
+ rt.tflag |= tflagNamed
+ }
+ var reflectMethods []method
+ for i := 0; i < methodSet.Length(); i++ { // Exported methods first.
+ m := methodSet.Index(i)
+ exported := internalStr(m.Get("pkg")) == ""
+ if !exported {
+ continue
+ }
+ reflectMethods = append(reflectMethods, method{
+ name: newNameOff(newName(internalStr(m.Get("name")), "", exported)),
+ mtyp: newTypeOff(reflectType(m.Get("typ"))),
+ })
+ }
+ xcount := uint16(len(reflectMethods))
+ for i := 0; i < methodSet.Length(); i++ { // Unexported methods second.
+ m := methodSet.Index(i)
+ exported := internalStr(m.Get("pkg")) == ""
+ if exported {
+ continue
+ }
+ reflectMethods = append(reflectMethods, method{
+ name: newNameOff(newName(internalStr(m.Get("name")), "", exported)),
+ mtyp: newTypeOff(reflectType(m.Get("typ"))),
+ })
+ }
+ ut := &uncommonType{
+ pkgPath: newNameOff(newName(internalStr(typ.Get("pkg")), "", false)),
+ mcount: uint16(methodSet.Length()),
+ xcount: xcount,
+ _methods: reflectMethods,
+ }
+ uncommonTypeMap[rt] = ut
+ js.InternalObject(ut).Set("jsType", typ)
+ }
+
+ switch rt.Kind() {
+ case Array:
+ setKindType(rt, &arrayType{
+ elem: reflectType(typ.Get("elem")),
+ len: uintptr(typ.Get("len").Int()),
+ })
+ case Chan:
+ dir := BothDir
+ if typ.Get("sendOnly").Bool() {
+ dir = SendDir
+ }
+ if typ.Get("recvOnly").Bool() {
+ dir = RecvDir
+ }
+ setKindType(rt, &chanType{
+ elem: reflectType(typ.Get("elem")),
+ dir: uintptr(dir),
+ })
+ case Func:
+ params := typ.Get("params")
+ in := make([]*rtype, params.Length())
+ for i := range in {
+ in[i] = reflectType(params.Index(i))
+ }
+ results := typ.Get("results")
+ out := make([]*rtype, results.Length())
+ for i := range out {
+ out[i] = reflectType(results.Index(i))
+ }
+ outCount := uint16(results.Length())
+ if typ.Get("variadic").Bool() {
+ outCount |= 1 << 15
+ }
+ setKindType(rt, &funcType{
+ rtype: *rt,
+ inCount: uint16(params.Length()),
+ outCount: outCount,
+ _in: in,
+ _out: out,
+ })
+ case Interface:
+ methods := typ.Get("methods")
+ imethods := make([]imethod, methods.Length())
+ for i := range imethods {
+ m := methods.Index(i)
+ imethods[i] = imethod{
+ name: newNameOff(newName(internalStr(m.Get("name")), "", internalStr(m.Get("pkg")) == "")),
+ typ: newTypeOff(reflectType(m.Get("typ"))),
+ }
+ }
+ setKindType(rt, &interfaceType{
+ rtype: *rt,
+ pkgPath: newName(internalStr(typ.Get("pkg")), "", false),
+ methods: imethods,
+ })
+ case Map:
+ setKindType(rt, &mapType{
+ key: reflectType(typ.Get("key")),
+ elem: reflectType(typ.Get("elem")),
+ })
+ case Ptr:
+ setKindType(rt, &ptrType{
+ elem: reflectType(typ.Get("elem")),
+ })
+ case Slice:
+ setKindType(rt, &sliceType{
+ elem: reflectType(typ.Get("elem")),
+ })
+ case Struct:
+ fields := typ.Get("fields")
+ reflectFields := make([]structField, fields.Length())
+ for i := range reflectFields {
+ f := fields.Index(i)
+ offsetEmbed := uintptr(i) << 1
+ if f.Get("embedded").Bool() {
+ offsetEmbed |= 1
+ }
+ reflectFields[i] = structField{
+ name: newName(internalStr(f.Get("name")), internalStr(f.Get("tag")), f.Get("exported").Bool()),
+ typ: reflectType(f.Get("typ")),
+ offsetEmbed: offsetEmbed,
+ }
+ }
+ setKindType(rt, &structType{
+ rtype: *rt,
+ pkgPath: newName(internalStr(typ.Get("pkgPath")), "", false),
+ fields: reflectFields,
+ })
+ }
+ }
+
+ return (*rtype)(unsafe.Pointer(typ.Get("reflectType").Unsafe()))
+}
+
+func setKindType(rt *rtype, kindType interface{}) {
+ js.InternalObject(rt).Set("kindType", js.InternalObject(kindType))
+ js.InternalObject(kindType).Set("rtype", js.InternalObject(rt))
+}
+
+type uncommonType struct {
+ pkgPath nameOff
+ mcount uint16
+ xcount uint16
+ moff uint32
+
+ _methods []method
+}
+
+func (t *uncommonType) methods() []method {
+ return t._methods
+}
+
+func (t *uncommonType) exportedMethods() []method {
+ return t._methods[:t.xcount:t.xcount]
+}
+
+var uncommonTypeMap = make(map[*rtype]*uncommonType)
+
+func (t *rtype) uncommon() *uncommonType {
+ return uncommonTypeMap[t]
+}
+
+type funcType struct {
+ rtype `reflect:"func"`
+ inCount uint16
+ outCount uint16
+
+ _in []*rtype
+ _out []*rtype
+}
+
+func (t *funcType) in() []*rtype {
+ return t._in
+}
+
+func (t *funcType) out() []*rtype {
+ return t._out
+}
+
+type name struct {
+ bytes *byte
+}
+
+type nameData struct {
+ name string
+ tag string
+ exported bool
+}
+
+var nameMap = make(map[*byte]*nameData)
+
+func (n name) name() (s string) { return nameMap[n.bytes].name }
+func (n name) tag() (s string) { return nameMap[n.bytes].tag }
+func (n name) pkgPath() string { return "" }
+func (n name) isExported() bool { return nameMap[n.bytes].exported }
+
+func newName(n, tag string, exported bool) name {
+ b := new(byte)
+ nameMap[b] = &nameData{
+ name: n,
+ tag: tag,
+ exported: exported,
+ }
+ return name{
+ bytes: b,
+ }
+}
+
+var nameOffList []name
+
+func (t *rtype) nameOff(off nameOff) name {
+ return nameOffList[int(off)]
+}
+
+func newNameOff(n name) nameOff {
+ i := len(nameOffList)
+ nameOffList = append(nameOffList, n)
+ return nameOff(i)
+}
+
+var typeOffList []*rtype
+
+func (t *rtype) typeOff(off typeOff) *rtype {
+ return typeOffList[int(off)]
+}
+
+func newTypeOff(t *rtype) typeOff {
+ i := len(typeOffList)
+ typeOffList = append(typeOffList, t)
+ return typeOff(i)
+}
+
+func internalStr(strObj *js.Object) string {
+ var c struct{ str string }
+ js.InternalObject(c).Set("str", strObj) // get string without internalizing
+ return c.str
+}
+
+func isWrapped(typ Type) bool {
+ return jsType(typ).Get("wrapped").Bool()
+}
+
+func copyStruct(dst, src *js.Object, typ Type) {
+ fields := jsType(typ).Get("fields")
+ for i := 0; i < fields.Length(); i++ {
+ prop := fields.Index(i).Get("prop").String()
+ dst.Set(prop, src.Get(prop))
+ }
+}
+
+func makeValue(t Type, v *js.Object, fl flag) Value {
+ rt := t.common()
+ if t.Kind() == Array || t.Kind() == Struct || t.Kind() == Ptr {
+ return Value{rt, unsafe.Pointer(v.Unsafe()), fl | flag(t.Kind())}
+ }
+ return Value{rt, unsafe.Pointer(js.Global.Call("$newDataPointer", v, jsType(rt.ptrTo())).Unsafe()), fl | flag(t.Kind()) | flagIndir}
+}
+
+func MakeSlice(typ Type, len, cap int) Value {
+ if typ.Kind() != Slice {
+ panic("reflect.MakeSlice of non-slice type")
+ }
+ if len < 0 {
+ panic("reflect.MakeSlice: negative len")
+ }
+ if cap < 0 {
+ panic("reflect.MakeSlice: negative cap")
+ }
+ if len > cap {
+ panic("reflect.MakeSlice: len > cap")
+ }
+
+ return makeValue(typ, js.Global.Call("$makeSlice", jsType(typ), len, cap, js.InternalObject(func() *js.Object { return jsType(typ.Elem()).Call("zero") })), 0)
+}
+
+func TypeOf(i interface{}) Type {
+ if !initialized { // avoid error of uint8Type
+ return &rtype{}
+ }
+ if i == nil {
+ return nil
+ }
+ return reflectType(js.InternalObject(i).Get("constructor"))
+}
+
+func ValueOf(i interface{}) Value {
+ if i == nil {
+ return Value{}
+ }
+ return makeValue(reflectType(js.InternalObject(i).Get("constructor")), js.InternalObject(i).Get("$val"), 0)
+}
+
+func ArrayOf(count int, elem Type) Type {
+ return reflectType(js.Global.Call("$arrayType", jsType(elem), count))
+}
+
+func ChanOf(dir ChanDir, t Type) Type {
+ return reflectType(js.Global.Call("$chanType", jsType(t), dir == SendDir, dir == RecvDir))
+}
+
+func FuncOf(in, out []Type, variadic bool) Type {
+ if variadic && (len(in) == 0 || in[len(in)-1].Kind() != Slice) {
+ panic("reflect.FuncOf: last arg of variadic func must be slice")
+ }
+
+ jsIn := make([]*js.Object, len(in))
+ for i, v := range in {
+ jsIn[i] = jsType(v)
+ }
+ jsOut := make([]*js.Object, len(out))
+ for i, v := range out {
+ jsOut[i] = jsType(v)
+ }
+ return reflectType(js.Global.Call("$funcType", jsIn, jsOut, variadic))
+}
+
+func MapOf(key, elem Type) Type {
+ switch key.Kind() {
+ case Func, Map, Slice:
+ panic("reflect.MapOf: invalid key type " + key.String())
+ }
+
+ return reflectType(js.Global.Call("$mapType", jsType(key), jsType(elem)))
+}
+
+func (t *rtype) ptrTo() *rtype {
+ return reflectType(js.Global.Call("$ptrType", jsType(t)))
+}
+
+func SliceOf(t Type) Type {
+ return reflectType(js.Global.Call("$sliceType", jsType(t)))
+}
+
+// func StructOf(fields []StructField) Type {
+// jsFields := make([]*js.Object, len(fields))
+// fset := map[string]struct{}{}
+// for i, f := range fields {
+// if f.Type == nil {
+// panic("reflect.StructOf: field " + strconv.Itoa(i) + " has no type")
+// }
+
+// name := f.Name
+// if name == "" {
+// // Embedded field
+// if f.Type.Kind() == Ptr {
+// // Embedded ** and *interface{} are illegal
+// elem := f.Type.Elem()
+// if k := elem.Kind(); k == Ptr || k == Interface {
+// panic("reflect.StructOf: illegal anonymous field type " + f.Type.String())
+// }
+// name = elem.String()
+// } else {
+// name = f.Type.String()
+// }
+// }
+
+// if _, dup := fset[name]; dup {
+// panic("reflect.StructOf: duplicate field " + name)
+// }
+// fset[name] = struct{}{}
+
+// jsf := js.Global.Get("Object").New()
+// jsf.Set("prop", name)
+// jsf.Set("name", name)
+// jsf.Set("exported", true)
+// jsf.Set("typ", jsType(f.Type))
+// jsf.Set("tag", f.Tag)
+// jsFields[i] = jsf
+// }
+// return reflectType(js.Global.Call("$structType", "", jsFields))
+// }
+
+func Zero(typ Type) Value {
+ return makeValue(typ, jsType(typ).Call("zero"), 0)
+}
+
+func unsafe_New(typ *rtype) unsafe.Pointer {
+ switch typ.Kind() {
+ case Struct:
+ return unsafe.Pointer(jsType(typ).Get("ptr").New().Unsafe())
+ case Array:
+ return unsafe.Pointer(jsType(typ).Call("zero").Unsafe())
+ default:
+ return unsafe.Pointer(js.Global.Call("$newDataPointer", jsType(typ).Call("zero"), jsType(typ.ptrTo())).Unsafe())
+ }
+}
+
+func makeInt(f flag, bits uint64, t Type) Value {
+ typ := t.common()
+ ptr := unsafe_New(typ)
+ switch typ.Kind() {
+ case Int8:
+ *(*int8)(ptr) = int8(bits)
+ case Int16:
+ *(*int16)(ptr) = int16(bits)
+ case Int, Int32:
+ *(*int32)(ptr) = int32(bits)
+ case Int64:
+ *(*int64)(ptr) = int64(bits)
+ case Uint8:
+ *(*uint8)(ptr) = uint8(bits)
+ case Uint16:
+ *(*uint16)(ptr) = uint16(bits)
+ case Uint, Uint32, Uintptr:
+ *(*uint32)(ptr) = uint32(bits)
+ case Uint64:
+ *(*uint64)(ptr) = uint64(bits)
+ }
+ return Value{typ, ptr, f | flagIndir | flag(typ.Kind())}
+}
+
+func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
+ if typ.Kind() != Func {
+ panic("reflect: call of MakeFunc with non-Func type")
+ }
+
+ t := typ.common()
+ ftyp := (*funcType)(unsafe.Pointer(t))
+
+ fv := js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
+ args := make([]Value, ftyp.NumIn())
+ for i := range args {
+ argType := ftyp.In(i).common()
+ args[i] = makeValue(argType, arguments[i], 0)
+ }
+ resultsSlice := fn(args)
+ switch ftyp.NumOut() {
+ case 0:
+ return nil
+ case 1:
+ return resultsSlice[0].object()
+ default:
+ results := js.Global.Get("Array").New(ftyp.NumOut())
+ for i, r := range resultsSlice {
+ results.SetIndex(i, r.object())
+ }
+ return results
+ }
+ })
+
+ return Value{t, unsafe.Pointer(fv.Unsafe()), flag(Func)}
+}
+
+func typedmemmove(t *rtype, dst, src unsafe.Pointer) {
+ js.InternalObject(dst).Call("$set", js.InternalObject(src).Call("$get"))
+}
+
+func loadScalar(p unsafe.Pointer, n uintptr) uintptr {
+ return js.InternalObject(p).Call("$get").Unsafe()
+}
+
+func makechan(typ *rtype, size int) (ch unsafe.Pointer) {
+ ctyp := (*chanType)(unsafe.Pointer(typ))
+ return unsafe.Pointer(js.Global.Get("$Chan").New(jsType(ctyp.elem), size).Unsafe())
+}
+
+func makemap(t *rtype, cap int) (m unsafe.Pointer) {
+ return unsafe.Pointer(js.Global.Get("Object").New().Unsafe())
+}
+
+func keyFor(t *rtype, key unsafe.Pointer) (*js.Object, string) {
+ kv := js.InternalObject(key)
+ if kv.Get("$get") != js.Undefined {
+ kv = kv.Call("$get")
+ }
+ k := jsType(t.Key()).Call("keyFor", kv).String()
+ return kv, k
+}
+
+func mapaccess(t *rtype, m, key unsafe.Pointer) unsafe.Pointer {
+ _, k := keyFor(t, key)
+ entry := js.InternalObject(m).Get(k)
+ if entry == js.Undefined {
+ return nil
+ }
+ return unsafe.Pointer(js.Global.Call("$newDataPointer", entry.Get("v"), jsType(PtrTo(t.Elem()))).Unsafe())
+}
+
+func mapassign(t *rtype, m, key, val unsafe.Pointer) {
+ kv, k := keyFor(t, key)
+ jsVal := js.InternalObject(val).Call("$get")
+ et := t.Elem()
+ if et.Kind() == Struct {
+ newVal := jsType(et).Call("zero")
+ copyStruct(newVal, jsVal, et)
+ jsVal = newVal
+ }
+ entry := js.Global.Get("Object").New()
+ entry.Set("k", kv)
+ entry.Set("v", jsVal)
+ js.InternalObject(m).Set(k, entry)
+}
+
+func mapdelete(t *rtype, m unsafe.Pointer, key unsafe.Pointer) {
+ _, k := keyFor(t, key)
+ js.InternalObject(m).Delete(k)
+}
+
+type mapIter struct {
+ t Type
+ m *js.Object
+ keys *js.Object
+ i int
+}
+
+func mapiterinit(t *rtype, m unsafe.Pointer) *byte {
+ return (*byte)(unsafe.Pointer(&mapIter{t, js.InternalObject(m), js.Global.Call("$keys", js.InternalObject(m)), 0}))
+}
+
+func mapiterkey(it *byte) unsafe.Pointer {
+ iter := (*mapIter)(unsafe.Pointer(it))
+ k := iter.keys.Index(iter.i)
+ return unsafe.Pointer(js.Global.Call("$newDataPointer", iter.m.Get(k.String()).Get("k"), jsType(PtrTo(iter.t.Key()))).Unsafe())
+}
+
+func mapiternext(it *byte) {
+ iter := (*mapIter)(unsafe.Pointer(it))
+ iter.i++
+}
+
+func maplen(m unsafe.Pointer) int {
+ return js.Global.Call("$keys", js.InternalObject(m)).Length()
+}
+
+func cvtDirect(v Value, typ Type) Value {
+ var srcVal = v.object()
+ if srcVal == jsType(v.typ).Get("nil") {
+ return makeValue(typ, jsType(typ).Get("nil"), v.flag)
+ }
+
+ var val *js.Object
+ switch k := typ.Kind(); k {
+ case Slice:
+ slice := jsType(typ).New(srcVal.Get("$array"))
+ slice.Set("$offset", srcVal.Get("$offset"))
+ slice.Set("$length", srcVal.Get("$length"))
+ slice.Set("$capacity", srcVal.Get("$capacity"))
+ val = js.Global.Call("$newDataPointer", slice, jsType(PtrTo(typ)))
+ case Ptr:
+ if typ.Elem().Kind() == Struct {
+ if typ.Elem() == v.typ.Elem() {
+ val = srcVal
+ break
+ }
+ val = jsType(typ).New()
+ copyStruct(val, srcVal, typ.Elem())
+ break
+ }
+ val = jsType(typ).New(srcVal.Get("$get"), srcVal.Get("$set"))
+ case Struct:
+ val = jsType(typ).Get("ptr").New()
+ copyStruct(val, srcVal, typ)
+ case Array, Bool, Chan, Func, Interface, Map, String:
+ val = js.InternalObject(v.ptr)
+ default:
+ panic(&ValueError{"reflect.Convert", k})
+ }
+ return Value{typ.common(), unsafe.Pointer(val.Unsafe()), v.flag.ro() | v.flag&flagIndir | flag(typ.Kind())}
+}
+
+func Copy(dst, src Value) int {
+ dk := dst.kind()
+ if dk != Array && dk != Slice {
+ panic(&ValueError{"reflect.Copy", dk})
+ }
+ if dk == Array {
+ dst.mustBeAssignable()
+ }
+ dst.mustBeExported()
+
+ sk := src.kind()
+ var stringCopy bool
+ if sk != Array && sk != Slice {
+ stringCopy = sk == String && dst.typ.Elem().Kind() == Uint8
+ if !stringCopy {
+ panic(&ValueError{"reflect.Copy", sk})
+ }
+ }
+ src.mustBeExported()
+
+ if !stringCopy {
+ typesMustMatch("reflect.Copy", dst.typ.Elem(), src.typ.Elem())
+ }
+
+ dstVal := dst.object()
+ if dk == Array {
+ dstVal = jsType(SliceOf(dst.typ.Elem())).New(dstVal)
+ }
+
+ srcVal := src.object()
+ if sk == Array {
+ srcVal = jsType(SliceOf(src.typ.Elem())).New(srcVal)
+ }
+
+ if stringCopy {
+ return js.Global.Call("$copyString", dstVal, srcVal).Int()
+ }
+ return js.Global.Call("$copySlice", dstVal, srcVal).Int()
+}
+
+func valueInterface(v Value, safe bool) interface{} {
+ if v.flag == 0 {
+ panic(&ValueError{"reflect.Value.Interface", 0})
+ }
+ if safe && v.flag&flagRO != 0 {
+ panic("reflect.Value.Interface: cannot return value obtained from unexported field or method")
+ }
+ if v.flag&flagMethod != 0 {
+ v = makeMethodValue("Interface", v)
+ }
+
+ if isWrapped(v.typ) {
+ return interface{}(unsafe.Pointer(jsType(v.typ).New(v.object()).Unsafe()))
+ }
+ return interface{}(unsafe.Pointer(v.object().Unsafe()))
+}
+
+func ifaceE2I(t *rtype, src interface{}, dst unsafe.Pointer) {
+ js.InternalObject(dst).Call("$set", js.InternalObject(src))
+}
+
+func methodName() string {
+ return "?FIXME?"
+}
+
+func makeMethodValue(op string, v Value) Value {
+ if v.flag&flagMethod == 0 {
+ panic("reflect: internal error: invalid use of makePartialFunc")
+ }
+
+ _, _, fn := methodReceiver(op, v, int(v.flag)>>flagMethodShift)
+ rcvr := v.object()
+ if isWrapped(v.typ) {
+ rcvr = jsType(v.typ).New(rcvr)
+ }
+ fv := js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
+ return js.InternalObject(fn).Call("apply", rcvr, arguments)
+ })
+ return Value{v.Type().common(), unsafe.Pointer(fv.Unsafe()), v.flag.ro() | flag(Func)}
+}
+
+func (t *rtype) pointers() bool {
+ switch t.Kind() {
+ case Ptr, Map, Chan, Func, Struct, Array:
+ return true
+ default:
+ return false
+ }
+}
+
+func (t *rtype) Comparable() bool {
+ switch t.Kind() {
+ case Func, Slice, Map:
+ return false
+ case Array:
+ return t.Elem().Comparable()
+ case Struct:
+ for i := 0; i < t.NumField(); i++ {
+ if !t.Field(i).Type.Comparable() {
+ return false
+ }
+ }
+ }
+ return true
+}
+
+func (t *rtype) Method(i int) (m Method) {
+ if t.Kind() == Interface {
+ tt := (*interfaceType)(unsafe.Pointer(t))
+ return tt.Method(i)
+ }
+ methods := t.exportedMethods()
+ if i < 0 || i >= len(methods) {
+ panic("reflect: Method index out of range")
+ }
+ p := methods[i]
+ pname := t.nameOff(p.name)
+ m.Name = pname.name()
+ fl := flag(Func)
+ mtyp := t.typeOff(p.mtyp)
+ ft := (*funcType)(unsafe.Pointer(mtyp))
+ in := make([]Type, 0, 1+len(ft.in()))
+ in = append(in, t)
+ for _, arg := range ft.in() {
+ in = append(in, arg)
+ }
+ out := make([]Type, 0, len(ft.out()))
+ for _, ret := range ft.out() {
+ out = append(out, ret)
+ }
+ mt := FuncOf(in, out, ft.IsVariadic())
+ m.Type = mt
+ prop := js.Global.Call("$methodSet", js.InternalObject(t).Get("jsType")).Index(i).Get("prop").String()
+ fn := js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
+ rcvr := arguments[0]
+ return rcvr.Get(prop).Call("apply", rcvr, arguments[1:])
+ })
+ m.Func = Value{mt.(*rtype), unsafe.Pointer(fn.Unsafe()), fl}
+
+ m.Index = i
+ return m
+}
+
+func (v Value) object() *js.Object {
+ if v.typ.Kind() == Array || v.typ.Kind() == Struct {
+ return js.InternalObject(v.ptr)
+ }
+ if v.flag&flagIndir != 0 {
+ val := js.InternalObject(v.ptr).Call("$get")
+ if val != js.Global.Get("$ifaceNil") && val.Get("constructor") != jsType(v.typ) {
+ switch v.typ.Kind() {
+ case Uint64, Int64:
+ val = jsType(v.typ).New(val.Get("$high"), val.Get("$low"))
+ case Complex64, Complex128:
+ val = jsType(v.typ).New(val.Get("$real"), val.Get("$imag"))
+ case Slice:
+ if val == val.Get("constructor").Get("nil") {
+ val = jsType(v.typ).Get("nil")
+ break
+ }
+ newVal := jsType(v.typ).New(val.Get("$array"))
+ newVal.Set("$offset", val.Get("$offset"))
+ newVal.Set("$length", val.Get("$length"))
+ newVal.Set("$capacity", val.Get("$capacity"))
+ val = newVal
+ }
+ }
+ return js.InternalObject(val.Unsafe())
+ }
+ return js.InternalObject(v.ptr)
+}
+
+func (v Value) assignTo(context string, dst *rtype, target unsafe.Pointer) Value {
+ if v.flag&flagMethod != 0 {
+ v = makeMethodValue(context, v)
+ }
+
+ switch {
+ case directlyAssignable(dst, v.typ):
+ // Overwrite type so that they match.
+ // Same memory layout, so no harm done.
+ fl := v.flag&(flagAddr|flagIndir) | v.flag.ro()
+ fl |= flag(dst.Kind())
+ return Value{dst, v.ptr, fl}
+
+ case implements(dst, v.typ):
+ if target == nil {
+ target = unsafe_New(dst)
+ }
+ // GopherJS: Skip the v.Kind() == Interface && v.IsNil() if statement
+ // from upstream. ifaceE2I below does not panic, and it needs
+ // to run, given its custom implementation.
+ x := valueInterface(v, false)
+ if dst.NumMethod() == 0 {
+ *(*interface{})(target) = x
+ } else {
+ ifaceE2I(dst, x, target)
+ }
+ return Value{dst, target, flagIndir | flag(Interface)}
+ }
+
+ // Failed.
+ panic(context + ": value of type " + v.typ.String() + " is not assignable to type " + dst.String())
+}
+
+var callHelper = js.Global.Get("$call").Interface().(func(...interface{}) *js.Object)
+
+func (v Value) Cap() int {
+ k := v.kind()
+ switch k {
+ case Array:
+ return v.typ.Len()
+ case Chan, Slice:
+ return v.object().Get("$capacity").Int()
+ }
+ panic(&ValueError{"reflect.Value.Cap", k})
+}
+
+var jsObjectPtr = reflectType(js.Global.Get("$jsObjectPtr"))
+
+func wrapJsObject(typ Type, val *js.Object) *js.Object {
+ if typ == jsObjectPtr {
+ return jsType(jsObjectPtr).New(val)
+ }
+ return val
+}
+
+func unwrapJsObject(typ Type, val *js.Object) *js.Object {
+ if typ == jsObjectPtr {
+ return val.Get("object")
+ }
+ return val
+}
+
+func (v Value) Elem() Value {
+ switch k := v.kind(); k {
+ case Interface:
+ val := v.object()
+ if val == js.Global.Get("$ifaceNil") {
+ return Value{}
+ }
+ typ := reflectType(val.Get("constructor"))
+ return makeValue(typ, val.Get("$val"), v.flag.ro())
+
+ case Ptr:
+ if v.IsNil() {
+ return Value{}
+ }
+ val := v.object()
+ tt := (*ptrType)(unsafe.Pointer(v.typ))
+ fl := v.flag&flagRO | flagIndir | flagAddr
+ fl |= flag(tt.elem.Kind())
+ return Value{tt.elem, unsafe.Pointer(wrapJsObject(tt.elem, val).Unsafe()), fl}
+
+ default:
+ panic(&ValueError{"reflect.Value.Elem", k})
+ }
+}
+
+func (v Value) Field(i int) Value {
+ if v.kind() != Struct {
+ panic(&ValueError{"reflect.Value.Field", v.kind()})
+ }
+ tt := (*structType)(unsafe.Pointer(v.typ))
+ if uint(i) >= uint(len(tt.fields)) {
+ panic("reflect: Field index out of range")
+ }
+
+ prop := jsType(v.typ).Get("fields").Index(i).Get("prop").String()
+ field := &tt.fields[i]
+ typ := field.typ
+
+ fl := v.flag&(flagStickyRO|flagIndir|flagAddr) | flag(typ.Kind())
+ if !field.name.isExported() {
+ if field.embedded() {
+ fl |= flagEmbedRO
+ } else {
+ fl |= flagStickyRO
+ }
+ }
+
+ if tag := tt.fields[i].name.tag(); tag != "" && i != 0 {
+ if jsTag := getJsTag(tag); jsTag != "" {
+ for {
+ v = v.Field(0)
+ if v.typ == jsObjectPtr {
+ o := v.object().Get("object")
+ return Value{typ, unsafe.Pointer(jsType(PtrTo(typ)).New(
+ js.InternalObject(func() *js.Object { return js.Global.Call("$internalize", o.Get(jsTag), jsType(typ)) }),
+ js.InternalObject(func(x *js.Object) { o.Set(jsTag, js.Global.Call("$externalize", x, jsType(typ))) }),
+ ).Unsafe()), fl}
+ }
+ if v.typ.Kind() == Ptr {
+ v = v.Elem()
+ }
+ }
+ }
+ }
+
+ s := js.InternalObject(v.ptr)
+ if fl&flagIndir != 0 && typ.Kind() != Array && typ.Kind() != Struct {
+ return Value{typ, unsafe.Pointer(jsType(PtrTo(typ)).New(
+ js.InternalObject(func() *js.Object { return wrapJsObject(typ, s.Get(prop)) }),
+ js.InternalObject(func(x *js.Object) { s.Set(prop, unwrapJsObject(typ, x)) }),
+ ).Unsafe()), fl}
+ }
+ return makeValue(typ, wrapJsObject(typ, s.Get(prop)), fl)
+}
+
+func getJsTag(tag string) string {
+ for tag != "" {
+ // skip leading space
+ i := 0
+ for i < len(tag) && tag[i] == ' ' {
+ i++
+ }
+ tag = tag[i:]
+ if tag == "" {
+ break
+ }
+
+ // scan to colon.
+ // a space or a quote is a syntax error
+ i = 0
+ for i < len(tag) && tag[i] != ' ' && tag[i] != ':' && tag[i] != '"' {
+ i++
+ }
+ if i+1 >= len(tag) || tag[i] != ':' || tag[i+1] != '"' {
+ break
+ }
+ name := string(tag[:i])
+ tag = tag[i+1:]
+
+ // scan quoted string to find value
+ i = 1
+ for i < len(tag) && tag[i] != '"' {
+ if tag[i] == '\\' {
+ i++
+ }
+ i++
+ }
+ if i >= len(tag) {
+ break
+ }
+ qvalue := string(tag[:i+1])
+ tag = tag[i+1:]
+
+ if name == "js" {
+ value, _ := strconv.Unquote(qvalue)
+ return value
+ }
+ }
+ return ""
+}
+
+func (v Value) Index(i int) Value {
+ switch k := v.kind(); k {
+ case Array:
+ tt := (*arrayType)(unsafe.Pointer(v.typ))
+ if i < 0 || i > int(tt.len) {
+ panic("reflect: array index out of range")
+ }
+ typ := tt.elem
+ fl := v.flag&(flagIndir|flagAddr) | v.flag.ro() | flag(typ.Kind())
+
+ a := js.InternalObject(v.ptr)
+ if fl&flagIndir != 0 && typ.Kind() != Array && typ.Kind() != Struct {
+ return Value{typ, unsafe.Pointer(jsType(PtrTo(typ)).New(
+ js.InternalObject(func() *js.Object { return wrapJsObject(typ, a.Index(i)) }),
+ js.InternalObject(func(x *js.Object) { a.SetIndex(i, unwrapJsObject(typ, x)) }),
+ ).Unsafe()), fl}
+ }
+ return makeValue(typ, wrapJsObject(typ, a.Index(i)), fl)
+
+ case Slice:
+ s := v.object()
+ if i < 0 || i >= s.Get("$length").Int() {
+ panic("reflect: slice index out of range")
+ }
+ tt := (*sliceType)(unsafe.Pointer(v.typ))
+ typ := tt.elem
+ fl := flagAddr | flagIndir | v.flag.ro() | flag(typ.Kind())
+
+ i += s.Get("$offset").Int()
+ a := s.Get("$array")
+ if fl&flagIndir != 0 && typ.Kind() != Array && typ.Kind() != Struct {
+ return Value{typ, unsafe.Pointer(jsType(PtrTo(typ)).New(
+ js.InternalObject(func() *js.Object { return wrapJsObject(typ, a.Index(i)) }),
+ js.InternalObject(func(x *js.Object) { a.SetIndex(i, unwrapJsObject(typ, x)) }),
+ ).Unsafe()), fl}
+ }
+ return makeValue(typ, wrapJsObject(typ, a.Index(i)), fl)
+
+ case String:
+ str := *(*string)(v.ptr)
+ if i < 0 || i >= len(str) {
+ panic("reflect: string index out of range")
+ }
+ fl := v.flag.ro() | flag(Uint8) | flagIndir
+ c := str[i]
+ return Value{uint8Type, unsafe.Pointer(&c), fl}
+
+ default:
+ panic(&ValueError{"reflect.Value.Index", k})
+ }
+}
+
+func (v Value) InterfaceData() [2]uintptr {
+ panic(errors.New("InterfaceData is not supported by GopherJS"))
+}
+
+func (v Value) IsNil() bool {
+ switch k := v.kind(); k {
+ case Ptr, Slice:
+ return v.object() == jsType(v.typ).Get("nil")
+ case Chan:
+ return v.object() == js.Global.Get("$chanNil")
+ case Func:
+ return v.object() == js.Global.Get("$throwNilPointerError")
+ case Map:
+ return v.object() == js.InternalObject(false)
+ case Interface:
+ return v.object() == js.Global.Get("$ifaceNil")
+ default:
+ panic(&ValueError{"reflect.Value.IsNil", k})
+ }
+}
+
+func (v Value) Len() int {
+ switch k := v.kind(); k {
+ case Array, String:
+ return v.object().Length()
+ case Slice:
+ return v.object().Get("$length").Int()
+ case Chan:
+ return v.object().Get("$buffer").Get("length").Int()
+ case Map:
+ return js.Global.Call("$keys", v.object()).Length()
+ default:
+ panic(&ValueError{"reflect.Value.Len", k})
+ }
+}
+
+func (v Value) Pointer() uintptr {
+ switch k := v.kind(); k {
+ case Chan, Map, Ptr, UnsafePointer:
+ if v.IsNil() {
+ return 0
+ }
+ return v.object().Unsafe()
+ case Func:
+ if v.IsNil() {
+ return 0
+ }
+ return 1
+ case Slice:
+ if v.IsNil() {
+ return 0
+ }
+ return v.object().Get("$array").Unsafe()
+ default:
+ panic(&ValueError{"reflect.Value.Pointer", k})
+ }
+}
+
+func (v Value) Set(x Value) {
+ v.mustBeAssignable()
+ x.mustBeExported()
+ x = x.assignTo("reflect.Set", v.typ, nil)
+ if v.flag&flagIndir != 0 {
+ switch v.typ.Kind() {
+ case Array:
+ jsType(v.typ).Call("copy", js.InternalObject(v.ptr), js.InternalObject(x.ptr))
+ case Interface:
+ js.InternalObject(v.ptr).Call("$set", js.InternalObject(valueInterface(x, false)))
+ case Struct:
+ copyStruct(js.InternalObject(v.ptr), js.InternalObject(x.ptr), v.typ)
+ default:
+ js.InternalObject(v.ptr).Call("$set", x.object())
+ }
+ return
+ }
+ v.ptr = x.ptr
+}
+
+func (v Value) SetBytes(x []byte) {
+ v.mustBeAssignable()
+ v.mustBe(Slice)
+ if v.typ.Elem().Kind() != Uint8 {
+ panic("reflect.Value.SetBytes of non-byte slice")
+ }
+ slice := js.InternalObject(x)
+ if v.typ.Name() != "" || v.typ.Elem().Name() != "" {
+ typedSlice := jsType(v.typ).New(slice.Get("$array"))
+ typedSlice.Set("$offset", slice.Get("$offset"))
+ typedSlice.Set("$length", slice.Get("$length"))
+ typedSlice.Set("$capacity", slice.Get("$capacity"))
+ slice = typedSlice
+ }
+ js.InternalObject(v.ptr).Call("$set", slice)
+}
+
+func (v Value) SetCap(n int) {
+ v.mustBeAssignable()
+ v.mustBe(Slice)
+ s := js.InternalObject(v.ptr).Call("$get")
+ if n < s.Get("$length").Int() || n > s.Get("$capacity").Int() {
+ panic("reflect: slice capacity out of range in SetCap")
+ }
+ newSlice := jsType(v.typ).New(s.Get("$array"))
+ newSlice.Set("$offset", s.Get("$offset"))
+ newSlice.Set("$length", s.Get("$length"))
+ newSlice.Set("$capacity", n)
+ js.InternalObject(v.ptr).Call("$set", newSlice)
+}
+
+func (v Value) SetLen(n int) {
+ v.mustBeAssignable()
+ v.mustBe(Slice)
+ s := js.InternalObject(v.ptr).Call("$get")
+ if n < 0 || n > s.Get("$capacity").Int() {
+ panic("reflect: slice length out of range in SetLen")
+ }
+ newSlice := jsType(v.typ).New(s.Get("$array"))
+ newSlice.Set("$offset", s.Get("$offset"))
+ newSlice.Set("$length", n)
+ newSlice.Set("$capacity", s.Get("$capacity"))
+ js.InternalObject(v.ptr).Call("$set", newSlice)
+}
+
+func (v Value) Slice(i, j int) Value {
+ var (
+ cap int
+ typ Type
+ s *js.Object
+ )
+ switch kind := v.kind(); kind {
+ case Array:
+ if v.flag&flagAddr == 0 {
+ panic("reflect.Value.Slice: slice of unaddressable array")
+ }
+ tt := (*arrayType)(unsafe.Pointer(v.typ))
+ cap = int(tt.len)
+ typ = SliceOf(tt.elem)
+ s = jsType(typ).New(v.object())
+
+ case Slice:
+ typ = v.typ
+ s = v.object()
+ cap = s.Get("$capacity").Int()
+
+ case String:
+ str := *(*string)(v.ptr)
+ if i < 0 || j < i || j > len(str) {
+ panic("reflect.Value.Slice: string slice index out of bounds")
+ }
+ return ValueOf(str[i:j])
+
+ default:
+ panic(&ValueError{"reflect.Value.Slice", kind})
+ }
+
+ if i < 0 || j < i || j > cap {
+ panic("reflect.Value.Slice: slice index out of bounds")
+ }
+
+ return makeValue(typ, js.Global.Call("$subslice", s, i, j), v.flag.ro())
+}
+
+func (v Value) Slice3(i, j, k int) Value {
+ var (
+ cap int
+ typ Type
+ s *js.Object
+ )
+ switch kind := v.kind(); kind {
+ case Array:
+ if v.flag&flagAddr == 0 {
+ panic("reflect.Value.Slice: slice of unaddressable array")
+ }
+ tt := (*arrayType)(unsafe.Pointer(v.typ))
+ cap = int(tt.len)
+ typ = SliceOf(tt.elem)
+ s = jsType(typ).New(v.object())
+
+ case Slice:
+ typ = v.typ
+ s = v.object()
+ cap = s.Get("$capacity").Int()
+
+ default:
+ panic(&ValueError{"reflect.Value.Slice3", kind})
+ }
+
+ if i < 0 || j < i || k < j || k > cap {
+ panic("reflect.Value.Slice3: slice index out of bounds")
+ }
+
+ return makeValue(typ, js.Global.Call("$subslice", s, i, j, k), v.flag.ro())
+}
+
+func (v Value) Close() {
+ v.mustBe(Chan)
+ v.mustBeExported()
+ js.Global.Call("$close", v.object())
+}
+
+var selectHelper = js.Global.Get("$select").Interface().(func(...interface{}) *js.Object)
+
+func chanrecv(ch unsafe.Pointer, nb bool, val unsafe.Pointer) (selected, received bool) {
+ comms := [][]*js.Object{{js.InternalObject(ch)}}
+ if nb {
+ comms = append(comms, []*js.Object{})
+ }
+ selectRes := selectHelper(comms)
+ if nb && selectRes.Index(0).Int() == 1 {
+ return false, false
+ }
+ recvRes := selectRes.Index(1)
+ js.InternalObject(val).Call("$set", recvRes.Index(0))
+ return true, recvRes.Index(1).Bool()
+}
+
+func chansend(ch unsafe.Pointer, val unsafe.Pointer, nb bool) bool {
+ comms := [][]*js.Object{{js.InternalObject(ch), js.InternalObject(val).Call("$get")}}
+ if nb {
+ comms = append(comms, []*js.Object{})
+ }
+ selectRes := selectHelper(comms)
+ if nb && selectRes.Index(0).Int() == 1 {
+ return false
+ }
+ return true
+}
+
+func rselect(rselects []runtimeSelect) (chosen int, recvOK bool) {
+ comms := make([][]*js.Object, len(rselects))
+ for i, s := range rselects {
+ switch SelectDir(s.dir) {
+ case SelectDefault:
+ comms[i] = []*js.Object{}
+ case SelectRecv:
+ ch := js.Global.Get("$chanNil")
+ if js.InternalObject(s.ch) != js.InternalObject(0) {
+ ch = js.InternalObject(s.ch)
+ }
+ comms[i] = []*js.Object{ch}
+ case SelectSend:
+ ch := js.Global.Get("$chanNil")
+ var val *js.Object
+ if js.InternalObject(s.ch) != js.InternalObject(0) {
+ ch = js.InternalObject(s.ch)
+ val = js.InternalObject(s.val).Call("$get")
+ }
+ comms[i] = []*js.Object{ch, val}
+ }
+ }
+ selectRes := selectHelper(comms)
+ c := selectRes.Index(0).Int()
+ if SelectDir(rselects[c].dir) == SelectRecv {
+ recvRes := selectRes.Index(1)
+ js.InternalObject(rselects[c].val).Call("$set", recvRes.Index(0))
+ return c, recvRes.Index(1).Bool()
+ }
+ return c, false
+}
+
+func DeepEqual(a1, a2 interface{}) bool {
+ i1 := js.InternalObject(a1)
+ i2 := js.InternalObject(a2)
+ if i1 == i2 {
+ return true
+ }
+ if i1 == nil || i2 == nil || i1.Get("constructor") != i2.Get("constructor") {
+ return false
+ }
+ return deepValueEqualJs(ValueOf(a1), ValueOf(a2), nil)
+}
+
+func deepValueEqualJs(v1, v2 Value, visited [][2]unsafe.Pointer) bool {
+ if !v1.IsValid() || !v2.IsValid() {
+ return !v1.IsValid() && !v2.IsValid()
+ }
+ if v1.Type() != v2.Type() {
+ return false
+ }
+ if v1.Type() == jsObjectPtr {
+ return unwrapJsObject(jsObjectPtr, v1.object()) == unwrapJsObject(jsObjectPtr, v2.object())
+ }
+
+ switch v1.Kind() {
+ case Array, Map, Slice, Struct:
+ for _, entry := range visited {
+ if v1.ptr == entry[0] && v2.ptr == entry[1] {
+ return true
+ }
+ }
+ visited = append(visited, [2]unsafe.Pointer{v1.ptr, v2.ptr})
+ }
+
+ switch v1.Kind() {
+ case Array, Slice:
+ if v1.Kind() == Slice {
+ if v1.IsNil() != v2.IsNil() {
+ return false
+ }
+ if v1.object() == v2.object() {
+ return true
+ }
+ }
+ var n = v1.Len()
+ if n != v2.Len() {
+ return false
+ }
+ for i := 0; i < n; i++ {
+ if !deepValueEqualJs(v1.Index(i), v2.Index(i), visited) {
+ return false
+ }
+ }
+ return true
+ case Interface:
+ if v1.IsNil() || v2.IsNil() {
+ return v1.IsNil() && v2.IsNil()
+ }
+ return deepValueEqualJs(v1.Elem(), v2.Elem(), visited)
+ case Ptr:
+ return deepValueEqualJs(v1.Elem(), v2.Elem(), visited)
+ case Struct:
+ var n = v1.NumField()
+ for i := 0; i < n; i++ {
+ if !deepValueEqualJs(v1.Field(i), v2.Field(i), visited) {
+ return false
+ }
+ }
+ return true
+ case Map:
+ if v1.IsNil() != v2.IsNil() {
+ return false
+ }
+ if v1.object() == v2.object() {
+ return true
+ }
+ var keys = v1.MapKeys()
+ if len(keys) != v2.Len() {
+ return false
+ }
+ for _, k := range keys {
+ val1 := v1.MapIndex(k)
+ val2 := v2.MapIndex(k)
+ if !val1.IsValid() || !val2.IsValid() || !deepValueEqualJs(val1, val2, visited) {
+ return false
+ }
+ }
+ return true
+ case Func:
+ return v1.IsNil() && v2.IsNil()
+ case UnsafePointer:
+ return v1.object() == v2.object()
+ }
+
+ return js.Global.Call("$interfaceIsEqual", js.InternalObject(valueInterface(v1, false)), js.InternalObject(valueInterface(v2, false))).Bool()
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go111.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go111.go
new file mode 100644
index 00000000000..5f184415540
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go111.go
@@ -0,0 +1,142 @@
+// +build js
+// +build !go1.11.1
+
+package reflect
+
+import (
+ "unsafe"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func methodReceiver(op string, v Value, i int) (_, t *rtype, fn unsafe.Pointer) {
+ var prop string
+ if v.typ.Kind() == Interface {
+ tt := (*interfaceType)(unsafe.Pointer(v.typ))
+ if i < 0 || i >= len(tt.methods) {
+ panic("reflect: internal error: invalid method index")
+ }
+ m := &tt.methods[i]
+ if !tt.nameOff(m.name).isExported() {
+ panic("reflect: " + op + " of unexported method")
+ }
+ t = tt.typeOff(m.typ)
+ prop = tt.nameOff(m.name).name()
+ } else {
+ ms := v.typ.exportedMethods()
+ if uint(i) >= uint(len(ms)) {
+ panic("reflect: internal error: invalid method index")
+ }
+ m := ms[i]
+ if !v.typ.nameOff(m.name).isExported() {
+ panic("reflect: " + op + " of unexported method")
+ }
+ t = v.typ.typeOff(m.mtyp)
+ prop = js.Global.Call("$methodSet", jsType(v.typ)).Index(i).Get("prop").String()
+ }
+ rcvr := v.object()
+ if isWrapped(v.typ) {
+ rcvr = jsType(v.typ).New(rcvr)
+ }
+ fn = unsafe.Pointer(rcvr.Get(prop).Unsafe())
+ return
+}
+
+func (v Value) call(op string, in []Value) []Value {
+ var (
+ t *rtype
+ fn unsafe.Pointer
+ rcvr *js.Object
+ )
+ if v.flag&flagMethod != 0 {
+ _, t, fn = methodReceiver(op, v, int(v.flag)>>flagMethodShift)
+ rcvr = v.object()
+ if isWrapped(v.typ) {
+ rcvr = jsType(v.typ).New(rcvr)
+ }
+ } else {
+ t = v.typ
+ fn = unsafe.Pointer(v.object().Unsafe())
+ rcvr = js.Undefined
+ }
+
+ if fn == nil {
+ panic("reflect.Value.Call: call of nil function")
+ }
+
+ isSlice := op == "CallSlice"
+ n := t.NumIn()
+ if isSlice {
+ if !t.IsVariadic() {
+ panic("reflect: CallSlice of non-variadic function")
+ }
+ if len(in) < n {
+ panic("reflect: CallSlice with too few input arguments")
+ }
+ if len(in) > n {
+ panic("reflect: CallSlice with too many input arguments")
+ }
+ } else {
+ if t.IsVariadic() {
+ n--
+ }
+ if len(in) < n {
+ panic("reflect: Call with too few input arguments")
+ }
+ if !t.IsVariadic() && len(in) > n {
+ panic("reflect: Call with too many input arguments")
+ }
+ }
+ for _, x := range in {
+ if x.Kind() == Invalid {
+ panic("reflect: " + op + " using zero Value argument")
+ }
+ }
+ for i := 0; i < n; i++ {
+ if xt, targ := in[i].Type(), t.In(i); !xt.AssignableTo(targ) {
+ panic("reflect: " + op + " using " + xt.String() + " as type " + targ.String())
+ }
+ }
+ if !isSlice && t.IsVariadic() {
+ // prepare slice for remaining values
+ m := len(in) - n
+ slice := MakeSlice(t.In(n), m, m)
+ elem := t.In(n).Elem()
+ for i := 0; i < m; i++ {
+ x := in[n+i]
+ if xt := x.Type(); !xt.AssignableTo(elem) {
+ panic("reflect: cannot use " + xt.String() + " as type " + elem.String() + " in " + op)
+ }
+ slice.Index(i).Set(x)
+ }
+ origIn := in
+ in = make([]Value, n+1)
+ copy(in[:n], origIn)
+ in[n] = slice
+ }
+
+ nin := len(in)
+ if nin != t.NumIn() {
+ panic("reflect.Value.Call: wrong argument count")
+ }
+ nout := t.NumOut()
+
+ argsArray := js.Global.Get("Array").New(t.NumIn())
+ for i, arg := range in {
+ argsArray.SetIndex(i, unwrapJsObject(t.In(i), arg.assignTo("reflect.Value.Call", t.In(i).common(), nil).object()))
+ }
+ results := callHelper(js.InternalObject(fn), rcvr, argsArray)
+
+ switch nout {
+ case 0:
+ return nil
+ case 1:
+ return []Value{makeValue(t.Out(0), wrapJsObject(t.Out(0), results), 0)}
+ default:
+ ret := make([]Value, nout)
+ for i := range ret {
+ ret[i] = makeValue(t.Out(i), wrapJsObject(t.Out(i), results.Index(i)), 0)
+ }
+ return ret
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go1111.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go1111.go
new file mode 100644
index 00000000000..927df955faa
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/reflect_go1111.go
@@ -0,0 +1,142 @@
+// +build js
+// +build go1.11.1
+
+package reflect
+
+import (
+ "unsafe"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func methodReceiver(op string, v Value, i int) (_ *rtype, t *funcType, fn unsafe.Pointer) {
+ var prop string
+ if v.typ.Kind() == Interface {
+ tt := (*interfaceType)(unsafe.Pointer(v.typ))
+ if i < 0 || i >= len(tt.methods) {
+ panic("reflect: internal error: invalid method index")
+ }
+ m := &tt.methods[i]
+ if !tt.nameOff(m.name).isExported() {
+ panic("reflect: " + op + " of unexported method")
+ }
+ t = (*funcType)(unsafe.Pointer(tt.typeOff(m.typ)))
+ prop = tt.nameOff(m.name).name()
+ } else {
+ ms := v.typ.exportedMethods()
+ if uint(i) >= uint(len(ms)) {
+ panic("reflect: internal error: invalid method index")
+ }
+ m := ms[i]
+ if !v.typ.nameOff(m.name).isExported() {
+ panic("reflect: " + op + " of unexported method")
+ }
+ t = (*funcType)(unsafe.Pointer(v.typ.typeOff(m.mtyp)))
+ prop = js.Global.Call("$methodSet", jsType(v.typ)).Index(i).Get("prop").String()
+ }
+ rcvr := v.object()
+ if isWrapped(v.typ) {
+ rcvr = jsType(v.typ).New(rcvr)
+ }
+ fn = unsafe.Pointer(rcvr.Get(prop).Unsafe())
+ return
+}
+
+func (v Value) call(op string, in []Value) []Value {
+ var (
+ t *funcType
+ fn unsafe.Pointer
+ rcvr *js.Object
+ )
+ if v.flag&flagMethod != 0 {
+ _, t, fn = methodReceiver(op, v, int(v.flag)>>flagMethodShift)
+ rcvr = v.object()
+ if isWrapped(v.typ) {
+ rcvr = jsType(v.typ).New(rcvr)
+ }
+ } else {
+ t = (*funcType)(unsafe.Pointer(v.typ))
+ fn = unsafe.Pointer(v.object().Unsafe())
+ rcvr = js.Undefined
+ }
+
+ if fn == nil {
+ panic("reflect.Value.Call: call of nil function")
+ }
+
+ isSlice := op == "CallSlice"
+ n := t.NumIn()
+ if isSlice {
+ if !t.IsVariadic() {
+ panic("reflect: CallSlice of non-variadic function")
+ }
+ if len(in) < n {
+ panic("reflect: CallSlice with too few input arguments")
+ }
+ if len(in) > n {
+ panic("reflect: CallSlice with too many input arguments")
+ }
+ } else {
+ if t.IsVariadic() {
+ n--
+ }
+ if len(in) < n {
+ panic("reflect: Call with too few input arguments")
+ }
+ if !t.IsVariadic() && len(in) > n {
+ panic("reflect: Call with too many input arguments")
+ }
+ }
+ for _, x := range in {
+ if x.Kind() == Invalid {
+ panic("reflect: " + op + " using zero Value argument")
+ }
+ }
+ for i := 0; i < n; i++ {
+ if xt, targ := in[i].Type(), t.In(i); !xt.AssignableTo(targ) {
+ panic("reflect: " + op + " using " + xt.String() + " as type " + targ.String())
+ }
+ }
+ if !isSlice && t.IsVariadic() {
+ // prepare slice for remaining values
+ m := len(in) - n
+ slice := MakeSlice(t.In(n), m, m)
+ elem := t.In(n).Elem()
+ for i := 0; i < m; i++ {
+ x := in[n+i]
+ if xt := x.Type(); !xt.AssignableTo(elem) {
+ panic("reflect: cannot use " + xt.String() + " as type " + elem.String() + " in " + op)
+ }
+ slice.Index(i).Set(x)
+ }
+ origIn := in
+ in = make([]Value, n+1)
+ copy(in[:n], origIn)
+ in[n] = slice
+ }
+
+ nin := len(in)
+ if nin != t.NumIn() {
+ panic("reflect.Value.Call: wrong argument count")
+ }
+ nout := t.NumOut()
+
+ argsArray := js.Global.Get("Array").New(t.NumIn())
+ for i, arg := range in {
+ argsArray.SetIndex(i, unwrapJsObject(t.In(i), arg.assignTo("reflect.Value.Call", t.In(i).common(), nil).object()))
+ }
+ results := callHelper(js.InternalObject(fn), rcvr, argsArray)
+
+ switch nout {
+ case 0:
+ return nil
+ case 1:
+ return []Value{makeValue(t.Out(0), wrapJsObject(t.Out(0), results), 0)}
+ default:
+ ret := make([]Value, nout)
+ for i := range ret {
+ ret[i] = makeValue(t.Out(i), wrapJsObject(t.Out(i), results.Index(i)), 0)
+ }
+ return ret
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/swapper.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/swapper.go
new file mode 100644
index 00000000000..a94f7961e54
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/reflect/swapper.go
@@ -0,0 +1,36 @@
+// +build js
+
+package reflect
+
+import "github.com/gopherjs/gopherjs/js"
+
+func Swapper(slice interface{}) func(i, j int) {
+ v := ValueOf(slice)
+ if v.Kind() != Slice {
+ panic(&ValueError{Method: "Swapper", Kind: v.Kind()})
+ }
+ // Fast path for slices of size 0 and 1. Nothing to swap.
+ vLen := uint(v.Len())
+ switch vLen {
+ case 0:
+ return func(i, j int) { panic("reflect: slice index out of range") }
+ case 1:
+ return func(i, j int) {
+ if i != 0 || j != 0 {
+ panic("reflect: slice index out of range")
+ }
+ }
+ }
+ a := js.InternalObject(slice).Get("$array")
+ off := js.InternalObject(slice).Get("$offset").Int()
+ return func(i, j int) {
+ if uint(i) >= vLen || uint(j) >= vLen {
+ panic("reflect: slice index out of range")
+ }
+ i += off
+ j += off
+ tmp := a.Index(i)
+ a.SetIndex(i, a.Index(j))
+ a.SetIndex(j, tmp)
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/debug/debug.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/debug/debug.go
new file mode 100644
index 00000000000..6597dcc4575
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/debug/debug.go
@@ -0,0 +1,14 @@
+// +build js
+
+package debug
+
+func setGCPercent(int32) int32 {
+ // Not implemented. Return initial setting.
+ return 100
+}
+
+func setMaxStack(bytes int) int {
+ // Not implemented. Return initial setting.
+ // The initial setting is 1 GB on 64-bit systems, 250 MB on 32-bit systems.
+ return 250000000
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/pprof/pprof.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/pprof/pprof.go
new file mode 100644
index 00000000000..8af83a9071b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/pprof/pprof.go
@@ -0,0 +1,49 @@
+// +build js
+
+package pprof
+
+import (
+ "io"
+ "sync"
+)
+
+type Profile struct {
+ name string
+ mu sync.Mutex
+ m map[interface{}][]uintptr
+ count func() int
+ write func(io.Writer, int) error
+}
+
+func (p *Profile) WriteTo(w io.Writer, debug int) error {
+ return nil
+}
+
+func (p *Profile) Count() int {
+ return 0
+}
+
+func (p *Profile) Name() string {
+ return ""
+}
+
+func (p *Profile) Add(value interface{}, skip int) {
+}
+
+func (p *Profile) Remove(value interface{}) {
+}
+
+func StartCPUProfile(w io.Writer) error {
+ return nil
+}
+
+func StopCPUProfile() {
+}
+
+func WriteHeapProfile(w io.Writer) error {
+ return nil
+}
+
+func Lookup(name string) *Profile {
+ return nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/runtime.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/runtime.go
new file mode 100644
index 00000000000..4e4fb62c627
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/runtime/runtime.go
@@ -0,0 +1,234 @@
+// +build js
+
+package runtime
+
+import (
+ "runtime/internal/sys"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+const GOOS = sys.GOOS
+const GOARCH = "js"
+const Compiler = "gopherjs"
+
+// fake for error.go
+type eface struct {
+ _type *_type
+}
+type _type struct {
+ str string
+}
+
+func (t *_type) string() string {
+ return t.str
+}
+func (t *_type) pkgpath() string {
+ return ""
+}
+
+func init() {
+ jsPkg := js.Global.Get("$packages").Get("github.com/gopherjs/gopherjs/js")
+ js.Global.Set("$jsObjectPtr", jsPkg.Get("Object").Get("ptr"))
+ js.Global.Set("$jsErrorPtr", jsPkg.Get("Error").Get("ptr"))
+ js.Global.Set("$throwRuntimeError", js.InternalObject(throw))
+ // avoid dead code elimination
+ var e error
+ e = &TypeAssertionError{}
+ _ = e
+}
+
+func GOROOT() string {
+ process := js.Global.Get("process")
+ if process == js.Undefined {
+ return "/"
+ }
+ goroot := process.Get("env").Get("GOROOT")
+ if goroot != js.Undefined {
+ return goroot.String()
+ }
+ // sys.DefaultGoroot is now gone, can't use it as fallback anymore.
+ // TODO: See if a better solution is needed.
+ return "/usr/local/go"
+}
+
+func Breakpoint() {
+ js.Debugger()
+}
+
+func Caller(skip int) (pc uintptr, file string, line int, ok bool) {
+ info := js.Global.Get("Error").New().Get("stack").Call("split", "\n").Index(skip + 2)
+ if info == js.Undefined {
+ return 0, "", 0, false
+ }
+ parts := info.Call("substring", info.Call("indexOf", "(").Int()+1, info.Call("indexOf", ")").Int()).Call("split", ":")
+ return 0, parts.Index(0).String(), parts.Index(1).Int(), true
+}
+
+func Callers(skip int, pc []uintptr) int {
+ return 0
+}
+
+// CallersFrames is not implemented for GOARCH=js.
+// TODO: Implement if possible.
+func CallersFrames(callers []uintptr) *Frames { return &Frames{} }
+
+type Frames struct{}
+
+func (ci *Frames) Next() (frame Frame, more bool) { return }
+
+type Frame struct {
+ PC uintptr
+ Func *Func
+ Function string
+ File string
+ Line int
+ Entry uintptr
+}
+
+func GC() {
+}
+
+func Goexit() {
+ js.Global.Get("$curGoroutine").Set("exit", true)
+ js.Global.Call("$throw", nil)
+}
+
+func GOMAXPROCS(n int) int {
+ return 1
+}
+
+func Gosched() {
+ c := make(chan struct{})
+ js.Global.Call("$setTimeout", js.InternalObject(func() { close(c) }), 0)
+ <-c
+}
+
+func NumCPU() int {
+ return 1
+}
+
+func NumGoroutine() int {
+ return js.Global.Get("$totalGoroutines").Int()
+}
+
+type MemStats struct {
+ // General statistics.
+ Alloc uint64 // bytes allocated and still in use
+ TotalAlloc uint64 // bytes allocated (even if freed)
+ Sys uint64 // bytes obtained from system (sum of XxxSys below)
+ Lookups uint64 // number of pointer lookups
+ Mallocs uint64 // number of mallocs
+ Frees uint64 // number of frees
+
+ // Main allocation heap statistics.
+ HeapAlloc uint64 // bytes allocated and still in use
+ HeapSys uint64 // bytes obtained from system
+ HeapIdle uint64 // bytes in idle spans
+ HeapInuse uint64 // bytes in non-idle span
+ HeapReleased uint64 // bytes released to the OS
+ HeapObjects uint64 // total number of allocated objects
+
+ // Low-level fixed-size structure allocator statistics.
+ // Inuse is bytes used now.
+ // Sys is bytes obtained from system.
+ StackInuse uint64 // bytes used by stack allocator
+ StackSys uint64
+ MSpanInuse uint64 // mspan structures
+ MSpanSys uint64
+ MCacheInuse uint64 // mcache structures
+ MCacheSys uint64
+ BuckHashSys uint64 // profiling bucket hash table
+ GCSys uint64 // GC metadata
+ OtherSys uint64 // other system allocations
+
+ // Garbage collector statistics.
+ NextGC uint64 // next collection will happen when HeapAlloc ≥ this amount
+ LastGC uint64 // end time of last collection (nanoseconds since 1970)
+ PauseTotalNs uint64
+ PauseNs [256]uint64 // circular buffer of recent GC pause durations, most recent at [(NumGC+255)%256]
+ PauseEnd [256]uint64 // circular buffer of recent GC pause end times
+ NumGC uint32
+ GCCPUFraction float64 // fraction of CPU time used by GC
+ EnableGC bool
+ DebugGC bool
+
+ // Per-size allocation statistics.
+ // 61 is NumSizeClasses in the C code.
+ BySize [61]struct {
+ Size uint32
+ Mallocs uint64
+ Frees uint64
+ }
+}
+
+func ReadMemStats(m *MemStats) {
+}
+
+func SetFinalizer(x, f interface{}) {
+}
+
+type Func struct {
+ opaque struct{} // unexported field to disallow conversions
+}
+
+func (_ *Func) Entry() uintptr { return 0 }
+func (_ *Func) FileLine(pc uintptr) (file string, line int) { return "", 0 }
+func (_ *Func) Name() string { return "" }
+
+func FuncForPC(pc uintptr) *Func {
+ return nil
+}
+
+var MemProfileRate int = 512 * 1024
+
+func SetBlockProfileRate(rate int) {
+}
+
+func SetMutexProfileFraction(rate int) int {
+ // TODO: Investigate this. If it's possible to implement, consider doing so, otherwise remove this comment.
+ return 0
+}
+
+func Stack(buf []byte, all bool) int {
+ s := js.Global.Get("Error").New().Get("stack")
+ if s == js.Undefined {
+ return 0
+ }
+ return copy(buf, s.Call("substr", s.Call("indexOf", "\n").Int()+1).String())
+}
+
+func LockOSThread() {}
+
+func UnlockOSThread() {}
+
+func Version() string {
+ return sys.TheVersion
+}
+
+func StartTrace() error { return nil }
+func StopTrace() {}
+func ReadTrace() []byte
+
+// We fake a cgo environment to catch errors. Therefor we have to implement this and always return 0
+func NumCgoCall() int64 {
+ return 0
+}
+
+func efaceOf(ep *interface{}) *eface {
+ panic("efaceOf: not supported")
+}
+
+func KeepAlive(interface{}) {}
+
+func throw(s string) {
+ panic(errorString(s))
+}
+
+// These are used by panicwrap. Not implemented for GOARCH=js.
+// TODO: Implement if possible.
+func getcallerpc() uintptr { return 0 }
+func findfunc(pc uintptr) funcInfo { return funcInfo{} }
+func funcname(f funcInfo) string { return "" }
+
+type funcInfo struct{}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/strings/strings.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/strings/strings.go
new file mode 100644
index 00000000000..09b1bb59748
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/strings/strings.go
@@ -0,0 +1,67 @@
+// +build js
+
+package strings
+
+import (
+ "unicode/utf8"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func IndexByte(s string, c byte) int {
+ return js.InternalObject(s).Call("indexOf", js.Global.Get("String").Call("fromCharCode", c)).Int()
+}
+
+func Index(s, sep string) int {
+ return js.InternalObject(s).Call("indexOf", js.InternalObject(sep)).Int()
+}
+
+func LastIndex(s, sep string) int {
+ return js.InternalObject(s).Call("lastIndexOf", js.InternalObject(sep)).Int()
+}
+
+func Count(s, sep string) int {
+ n := 0
+ // special cases
+ switch {
+ case len(sep) == 0:
+ return utf8.RuneCountInString(s) + 1
+ case len(sep) > len(s):
+ return 0
+ case len(sep) == len(s):
+ if sep == s {
+ return 1
+ }
+ return 0
+ }
+
+ for {
+ pos := Index(s, sep)
+ if pos == -1 {
+ break
+ }
+ n++
+ s = s[pos+len(sep):]
+ }
+ return n
+}
+
+func (b *Builder) String() string {
+ // Upstream Builder.String relies on package unsafe. We can't do that.
+ // TODO: It's possible that the entire strings.Builder API can be implemented
+ // more efficiently for GOARCH=js specifically (avoid using []byte, instead
+ // use a String directly; or some JavaScript string builder API if one exists).
+ // But this is more work, defer doing it until there's a need shown via profiling,
+ // and there are benchmarks available (see https://github.com/golang/go/issues/18990#issuecomment-352068533).
+ return string(b.buf)
+}
+
+func (b *Builder) copyCheck() {
+ if b.addr == nil {
+ // Upstream copyCheck uses noescape, which performs unsafe.Pointer manipulation.
+ // We can't do that, so skip it. See https://github.com/golang/go/commit/484586c81a0196e42ac52f651bc56017ca454280.
+ b.addr = b
+ } else if b.addr != b {
+ panic("strings: illegal use of non-zero Builder copied by value")
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/atomic/atomic.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/atomic/atomic.go
new file mode 100644
index 00000000000..6360171211c
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/atomic/atomic.go
@@ -0,0 +1,185 @@
+// +build js
+
+package atomic
+
+import (
+ "unsafe"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func SwapInt32(addr *int32, new int32) int32 {
+ old := *addr
+ *addr = new
+ return old
+}
+
+func SwapInt64(addr *int64, new int64) int64 {
+ old := *addr
+ *addr = new
+ return old
+}
+
+func SwapUint32(addr *uint32, new uint32) uint32 {
+ old := *addr
+ *addr = new
+ return old
+}
+
+func SwapUint64(addr *uint64, new uint64) uint64 {
+ old := *addr
+ *addr = new
+ return old
+}
+
+func SwapUintptr(addr *uintptr, new uintptr) uintptr {
+ old := *addr
+ *addr = new
+ return old
+}
+
+func SwapPointer(addr *unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer {
+ old := *addr
+ *addr = new
+ return old
+}
+
+func CompareAndSwapInt32(addr *int32, old, new int32) bool {
+ if *addr == old {
+ *addr = new
+ return true
+ }
+ return false
+}
+
+func CompareAndSwapInt64(addr *int64, old, new int64) bool {
+ if *addr == old {
+ *addr = new
+ return true
+ }
+ return false
+}
+
+func CompareAndSwapUint32(addr *uint32, old, new uint32) bool {
+ if *addr == old {
+ *addr = new
+ return true
+ }
+ return false
+}
+
+func CompareAndSwapUint64(addr *uint64, old, new uint64) bool {
+ if *addr == old {
+ *addr = new
+ return true
+ }
+ return false
+}
+
+func CompareAndSwapUintptr(addr *uintptr, old, new uintptr) bool {
+ if *addr == old {
+ *addr = new
+ return true
+ }
+ return false
+}
+
+func CompareAndSwapPointer(addr *unsafe.Pointer, old, new unsafe.Pointer) bool {
+ if *addr == old {
+ *addr = new
+ return true
+ }
+ return false
+}
+
+func AddInt32(addr *int32, delta int32) int32 {
+ new := *addr + delta
+ *addr = new
+ return new
+}
+
+func AddUint32(addr *uint32, delta uint32) uint32 {
+ new := *addr + delta
+ *addr = new
+ return new
+}
+
+func AddInt64(addr *int64, delta int64) int64 {
+ new := *addr + delta
+ *addr = new
+ return new
+}
+
+func AddUint64(addr *uint64, delta uint64) uint64 {
+ new := *addr + delta
+ *addr = new
+ return new
+}
+
+func AddUintptr(addr *uintptr, delta uintptr) uintptr {
+ new := *addr + delta
+ *addr = new
+ return new
+}
+
+func LoadInt32(addr *int32) int32 {
+ return *addr
+}
+
+func LoadInt64(addr *int64) int64 {
+ return *addr
+}
+
+func LoadUint32(addr *uint32) uint32 {
+ return *addr
+}
+
+func LoadUint64(addr *uint64) uint64 {
+ return *addr
+}
+
+func LoadUintptr(addr *uintptr) uintptr {
+ return *addr
+}
+
+func LoadPointer(addr *unsafe.Pointer) unsafe.Pointer {
+ return *addr
+}
+
+func StoreInt32(addr *int32, val int32) {
+ *addr = val
+}
+
+func StoreInt64(addr *int64, val int64) {
+ *addr = val
+}
+
+func StoreUint32(addr *uint32, val uint32) {
+ *addr = val
+}
+
+func StoreUint64(addr *uint64, val uint64) {
+ *addr = val
+}
+
+func StoreUintptr(addr *uintptr, val uintptr) {
+ *addr = val
+}
+
+func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) {
+ *addr = val
+}
+
+func (v *Value) Load() (x interface{}) {
+ return v.v
+}
+
+func (v *Value) Store(x interface{}) {
+ if x == nil {
+ panic("sync/atomic: store of nil value into Value")
+ }
+ if v.v != nil && js.InternalObject(x).Get("constructor") != js.InternalObject(v.v).Get("constructor") {
+ panic("sync/atomic: store of inconsistently typed value into Value")
+ }
+ v.v = x
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/cond.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/cond.go
new file mode 100644
index 00000000000..829dac2ef7d
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/cond.go
@@ -0,0 +1,41 @@
+// +build js
+
+package sync
+
+type Cond struct {
+ // fields used by vanilla implementation
+ noCopy noCopy
+ L Locker
+ notify notifyList
+ checker copyChecker
+
+ // fields used by new implementation
+ n int
+ ch chan bool
+}
+
+func (c *Cond) Wait() {
+ c.n++
+ if c.ch == nil {
+ c.ch = make(chan bool)
+ }
+ c.L.Unlock()
+ <-c.ch
+ c.L.Lock()
+}
+
+func (c *Cond) Signal() {
+ if c.n == 0 {
+ return
+ }
+ c.n--
+ c.ch <- true
+}
+
+func (c *Cond) Broadcast() {
+ n := c.n
+ c.n = 0
+ for i := 0; i < n; i++ {
+ c.ch <- true
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/pool.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/pool.go
new file mode 100644
index 00000000000..629010d9e5b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/pool.go
@@ -0,0 +1,35 @@
+// +build js
+
+package sync
+
+import "unsafe"
+
+type Pool struct {
+ local unsafe.Pointer
+ localSize uintptr
+
+ store []interface{}
+ New func() interface{}
+}
+
+func (p *Pool) Get() interface{} {
+ if len(p.store) == 0 {
+ if p.New != nil {
+ return p.New()
+ }
+ return nil
+ }
+ x := p.store[len(p.store)-1]
+ p.store = p.store[:len(p.store)-1]
+ return x
+}
+
+func (p *Pool) Put(x interface{}) {
+ if x == nil {
+ return
+ }
+ p.store = append(p.store, x)
+}
+
+func runtime_registerPoolCleanup(cleanup func()) {
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/sync.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/sync.go
new file mode 100644
index 00000000000..2ae46e0a642
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/sync.go
@@ -0,0 +1,80 @@
+// +build js
+
+package sync
+
+import "github.com/gopherjs/gopherjs/js"
+
+var semWaiters = make(map[*uint32][]chan bool)
+
+// semAwoken tracks the number of waiters awoken by runtime_Semrelease (`ch <- true`)
+// that have not yet acquired the semaphore (`<-ch` in runtime_SemacquireMutex).
+//
+// This prevents a new call to runtime_SemacquireMutex to wrongly acquire the semaphore
+// in between (because runtime_Semrelease has already incremented the semaphore while
+// all the pending calls to runtime_SemacquireMutex have not yet received from the channel
+// and thus decremented the semaphore).
+//
+// See https://github.com/gopherjs/gopherjs/issues/736.
+var semAwoken = make(map[*uint32]uint32)
+
+func runtime_Semacquire(s *uint32) {
+ runtime_SemacquireMutex(s, false)
+}
+
+// SemacquireMutex is like Semacquire, but for profiling contended Mutexes.
+// Mutex profiling is not supported, so just use the same implementation as runtime_Semacquire.
+// TODO: Investigate this. If it's possible to implement, consider doing so, otherwise remove this comment.
+func runtime_SemacquireMutex(s *uint32, lifo bool) {
+ if (*s - semAwoken[s]) == 0 {
+ ch := make(chan bool)
+ if lifo {
+ semWaiters[s] = append([]chan bool{ch}, semWaiters[s]...)
+ } else {
+ semWaiters[s] = append(semWaiters[s], ch)
+ }
+ <-ch
+ semAwoken[s] -= 1
+ if semAwoken[s] == 0 {
+ delete(semAwoken, s)
+ }
+ }
+ *s--
+}
+
+func runtime_Semrelease(s *uint32, handoff bool) {
+ // TODO: Use handoff if needed/possible.
+ *s++
+
+ w := semWaiters[s]
+ if len(w) == 0 {
+ return
+ }
+
+ ch := w[0]
+ w = w[1:]
+ semWaiters[s] = w
+ if len(w) == 0 {
+ delete(semWaiters, s)
+ }
+
+ semAwoken[s] += 1
+
+ ch <- true
+}
+
+func runtime_notifyListCheck(size uintptr) {}
+
+func runtime_canSpin(i int) bool {
+ return false
+}
+
+// Copy of time.runtimeNano.
+func runtime_nanotime() int64 {
+ const millisecond = 1000000
+ return js.Global.Get("Date").New().Call("getTime").Int64() * millisecond
+}
+
+// Implemented in runtime.
+func throw(s string) {
+ js.Global.Call("$throwRuntimeError", s)
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/waitgroup.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/waitgroup.go
new file mode 100644
index 00000000000..0d4873d6778
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/sync/waitgroup.go
@@ -0,0 +1,30 @@
+// +build js
+
+package sync
+
+type WaitGroup struct {
+ counter int
+ ch chan struct{}
+
+ state1 [3]uint32
+}
+
+func (wg *WaitGroup) Add(delta int) {
+ wg.counter += delta
+ if wg.counter < 0 {
+ panic("sync: negative WaitGroup counter")
+ }
+ if wg.counter > 0 && wg.ch == nil {
+ wg.ch = make(chan struct{})
+ }
+ if wg.counter == 0 && wg.ch != nil {
+ close(wg.ch)
+ wg.ch = nil
+ }
+}
+
+func (wg *WaitGroup) Wait() {
+ if wg.counter > 0 {
+ <-wg.ch
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall.go
new file mode 100644
index 00000000000..44c67ec9b80
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall.go
@@ -0,0 +1,64 @@
+// +build js
+
+package syscall
+
+import (
+ "unsafe"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+var warningPrinted = false
+var lineBuffer []byte
+
+func init() {
+ js.Global.Set("$flushConsole", js.InternalObject(func() {
+ if len(lineBuffer) != 0 {
+ js.Global.Get("console").Call("log", string(lineBuffer))
+ lineBuffer = nil
+ }
+ }))
+}
+
+func printWarning() {
+ if !warningPrinted {
+ js.Global.Get("console").Call("error", "warning: system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md")
+ }
+ warningPrinted = true
+}
+
+func printToConsole(b []byte) {
+ goPrintToConsole := js.Global.Get("goPrintToConsole")
+ if goPrintToConsole != js.Undefined {
+ goPrintToConsole.Invoke(js.InternalObject(b))
+ return
+ }
+
+ lineBuffer = append(lineBuffer, b...)
+ for {
+ i := indexByte(lineBuffer, '\n')
+ if i == -1 {
+ break
+ }
+ js.Global.Get("console").Call("log", string(lineBuffer[:i])) // don't use println, since it does not externalize multibyte characters
+ lineBuffer = lineBuffer[i+1:]
+ }
+}
+
+func use(p unsafe.Pointer) {
+ // no-op
+}
+
+func Exit(code int) {
+ Syscall(exitTrap, uintptr(code), 0, 0)
+}
+
+// indexByte is copied from bytes package to avoid importing it (since the real syscall package doesn't).
+func indexByte(s []byte, c byte) int {
+ for i, b := range s {
+ if b == c {
+ return i
+ }
+ }
+ return -1
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_linux.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_linux.go
new file mode 100644
index 00000000000..41024b62c72
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_linux.go
@@ -0,0 +1,5 @@
+// +build js
+
+package syscall
+
+const exitTrap = SYS_EXIT_GROUP
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_nonlinux.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_nonlinux.go
new file mode 100644
index 00000000000..5b79fcfd06b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_nonlinux.go
@@ -0,0 +1,5 @@
+// +build js,!linux
+
+package syscall
+
+const exitTrap = SYS_EXIT
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_unix.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_unix.go
new file mode 100644
index 00000000000..715ada4748a
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_unix.go
@@ -0,0 +1,133 @@
+// +build js,!windows
+
+package syscall
+
+import (
+ "runtime"
+ "unsafe"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+func runtime_envs() []string {
+ process := js.Global.Get("process")
+ if process == js.Undefined {
+ return nil
+ }
+ jsEnv := process.Get("env")
+ envkeys := js.Global.Get("Object").Call("keys", jsEnv)
+ envs := make([]string, envkeys.Length())
+ for i := 0; i < envkeys.Length(); i++ {
+ key := envkeys.Index(i).String()
+ envs[i] = key + "=" + jsEnv.Get(key).String()
+ }
+ return envs
+}
+
+func setenv_c(k, v string) {
+ process := js.Global.Get("process")
+ if process == js.Undefined {
+ return
+ }
+ process.Get("env").Set(k, v)
+}
+
+func unsetenv_c(k string) {
+ process := js.Global.Get("process")
+ if process == js.Undefined {
+ return
+ }
+ process.Get("env").Delete(k)
+}
+
+var syscallModule *js.Object
+var alreadyTriedToLoad = false
+var minusOne = -1
+
+func syscall(name string) *js.Object {
+ defer func() {
+ recover()
+ // return nil if recovered
+ }()
+ if syscallModule == nil {
+ if alreadyTriedToLoad {
+ return nil
+ }
+ alreadyTriedToLoad = true
+ require := js.Global.Get("require")
+ if require == js.Undefined {
+ panic("")
+ }
+ syscallModule = require.Invoke("syscall")
+ }
+ return syscallModule.Get(name)
+}
+
+func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+ if f := syscall("Syscall"); f != nil {
+ r := f.Invoke(trap, a1, a2, a3)
+ return uintptr(r.Index(0).Int()), uintptr(r.Index(1).Int()), Errno(r.Index(2).Int())
+ }
+ if trap == SYS_WRITE && (a1 == 1 || a1 == 2) {
+ array := js.InternalObject(a2)
+ slice := make([]byte, array.Length())
+ js.InternalObject(slice).Set("$array", array)
+ printToConsole(slice)
+ return uintptr(array.Length()), 0, 0
+ }
+ if trap == exitTrap {
+ runtime.Goexit()
+ }
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
+ if f := syscall("Syscall6"); f != nil {
+ r := f.Invoke(trap, a1, a2, a3, a4, a5, a6)
+ return uintptr(r.Index(0).Int()), uintptr(r.Index(1).Int()), Errno(r.Index(2).Int())
+ }
+ if trap != 202 { // kern.osrelease on OS X, happens in init of "os" package
+ printWarning()
+ }
+ return uintptr(minusOne), 0, EACCES
+}
+
+func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+ if f := syscall("Syscall"); f != nil {
+ r := f.Invoke(trap, a1, a2, a3)
+ return uintptr(r.Index(0).Int()), uintptr(r.Index(1).Int()), Errno(r.Index(2).Int())
+ }
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
+ if f := syscall("Syscall"); f != nil {
+ r := f.Invoke(trap, a1, a2, a3)
+ return uintptr(r.Index(0).Int()), uintptr(r.Index(1).Int())
+ }
+ printWarning()
+ return uintptr(minusOne), 0
+}
+
+func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
+ if f := syscall("Syscall6"); f != nil {
+ r := f.Invoke(trap, a1, a2, a3, a4, a5, a6)
+ return uintptr(r.Index(0).Int()), uintptr(r.Index(1).Int()), Errno(r.Index(2).Int())
+ }
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func BytePtrFromString(s string) (*byte, error) {
+ array := js.Global.Get("Uint8Array").New(len(s) + 1)
+ for i, b := range []byte(s) {
+ if b == 0 {
+ return nil, EINVAL
+ }
+ array.SetIndex(i, b)
+ }
+ array.SetIndex(len(s), 0)
+ return (*byte)(unsafe.Pointer(array.Unsafe())), nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_windows.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_windows.go
new file mode 100644
index 00000000000..016be8e545f
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/syscall/syscall_windows.go
@@ -0,0 +1,100 @@
+// +build js
+
+package syscall
+
+import "runtime"
+
+var minusOne = -1
+
+func Syscall(trap, nargs, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func Syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func Syscall9(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func Syscall12(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 uintptr) (r1, r2 uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func Syscall15(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2 uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), 0, EACCES
+}
+
+func loadlibrary(filename *uint16) (handle uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), EACCES
+}
+
+func getprocaddress(handle uintptr, procname *uint8) (proc uintptr, err Errno) {
+ printWarning()
+ return uintptr(minusOne), EACCES
+}
+
+func (d *LazyDLL) Load() error {
+ return &DLLError{Msg: "system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md"}
+}
+
+func (p *LazyProc) Find() error {
+ return &DLLError{Msg: "system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md"}
+}
+
+func getStdHandle(h int) (fd Handle) {
+ if h == STD_OUTPUT_HANDLE {
+ return 1
+ }
+ if h == STD_ERROR_HANDLE {
+ return 2
+ }
+ return 0
+}
+
+func GetConsoleMode(console Handle, mode *uint32) (err error) {
+ return DummyError{}
+}
+
+func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
+ if handle == 1 || handle == 2 {
+ printToConsole(buf)
+ *done = uint32(len(buf))
+ return nil
+ }
+ printWarning()
+ return nil
+}
+
+func ExitProcess(exitcode uint32) {
+ runtime.Goexit()
+}
+
+func GetCommandLine() (cmd *uint16) {
+ return
+}
+
+func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
+ return nil, DummyError{}
+}
+
+func Getenv(key string) (value string, found bool) {
+ return "", false
+}
+
+func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
+ return 0, DummyError{}
+}
+
+type DummyError struct{}
+
+func (e DummyError) Error() string {
+ return ""
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/example.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/example.go
new file mode 100644
index 00000000000..b44af132833
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/example.go
@@ -0,0 +1,70 @@
+// +build js
+
+package testing
+
+import (
+ "fmt"
+ "os"
+ "strings"
+ "time"
+)
+
+func runExample(eg InternalExample) (ok bool) {
+ if *chatty {
+ fmt.Printf("=== RUN %s\n", eg.Name)
+ }
+
+ // Capture stdout.
+ stdout := os.Stdout
+ w, err := tempFile("." + eg.Name + ".stdout.")
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+ os.Stdout = w
+
+ start := time.Now()
+ ok = true
+
+ // Clean up in a deferred call so we can recover if the example panics.
+ defer func() {
+ dstr := fmtDuration(time.Now().Sub(start))
+
+ // Close file, restore stdout, get output.
+ w.Close()
+ os.Stdout = stdout
+ out, readFileErr := readFile(w.Name())
+ _ = os.Remove(w.Name())
+ if readFileErr != nil {
+ fmt.Fprintf(os.Stderr, "testing: reading stdout file: %v\n", readFileErr)
+ os.Exit(1)
+ }
+
+ var fail string
+ err := recover()
+ got := strings.TrimSpace(out)
+ want := strings.TrimSpace(eg.Output)
+ if eg.Unordered {
+ if sortLines(got) != sortLines(want) && err == nil {
+ fail = fmt.Sprintf("got:\n%s\nwant (unordered):\n%s\n", out, eg.Output)
+ }
+ } else {
+ if got != want && err == nil {
+ fail = fmt.Sprintf("got:\n%s\nwant:\n%s\n", got, want)
+ }
+ }
+ if fail != "" || err != nil {
+ fmt.Printf("--- FAIL: %s (%s)\n%s", eg.Name, dstr, fail)
+ ok = false
+ } else if *chatty {
+ fmt.Printf("--- PASS: %s (%s)\n", eg.Name, dstr)
+ }
+ if err != nil {
+ panic(err)
+ }
+ }()
+
+ // Run example.
+ eg.F()
+ return
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/ioutil.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/ioutil.go
new file mode 100644
index 00000000000..a1527f9cc78
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/ioutil.go
@@ -0,0 +1,66 @@
+// +build js
+
+package testing
+
+import (
+ "bytes"
+ "io"
+ "os"
+ "strconv"
+ "sync"
+ "time"
+)
+
+var rand uint32
+var randmu sync.Mutex
+
+func reseed() uint32 {
+ return uint32(time.Now().UnixNano() + int64(os.Getpid()))
+}
+
+func nextSuffix() string {
+ randmu.Lock()
+ r := rand
+ if r == 0 {
+ r = reseed()
+ }
+ r = r*1664525 + 1013904223 // constants from Numerical Recipes
+ rand = r
+ randmu.Unlock()
+ return strconv.Itoa(int(1e9 + r%1e9))[1:]
+}
+
+// A functional copy of ioutil.TempFile, to avoid extra imports.
+func tempFile(prefix string) (f *os.File, err error) {
+ dir := os.TempDir()
+
+ nconflict := 0
+ for i := 0; i < 10000; i++ {
+ name := dir + string(os.PathSeparator) + prefix + nextSuffix()
+ f, err = os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
+ if os.IsExist(err) {
+ if nconflict++; nconflict > 10 {
+ randmu.Lock()
+ rand = reseed()
+ randmu.Unlock()
+ }
+ continue
+ }
+ break
+ }
+ return
+}
+
+func readFile(filename string) (string, error) {
+ f, err := os.Open(filename)
+ if err != nil {
+ return "", err
+ }
+ defer f.Close()
+ var buf bytes.Buffer
+ _, err = io.Copy(&buf, f)
+ if err != nil {
+ return "", err
+ }
+ return buf.String(), nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/testing.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/testing.go
new file mode 100644
index 00000000000..392f1f87c74
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/testing/testing.go
@@ -0,0 +1,26 @@
+// +build js
+
+package testing
+
+import "runtime"
+
+// The upstream callerName and frameSkip rely on runtime.Callers,
+// and panic if there are zero callers found. However, runtime.Callers
+// is not implemented for GopherJS at this time, so we can't use
+// that implementation. Use these stubs instead.
+func callerName(skip int) string {
+ // Upstream callerName requires a functional runtime.Callers.
+ // TODO: Implement if possible.
+ return "<unknown>"
+}
+
+func (*common) frameSkip(skip int) runtime.Frame {
+ _, file, line, ok := runtime.Caller(skip)
+ if !ok {
+ return runtime.Frame{}
+ }
+ return runtime.Frame{
+ File: file,
+ Line: line,
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/time/time.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/time/time.go
new file mode 100644
index 00000000000..e8988977502
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/time/time.go
@@ -0,0 +1,92 @@
+// +build js
+
+package time
+
+import (
+ "runtime"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+// Make sure time.Unix func and time.Time struct it returns are always included with this package (despite DCE),
+// because they're needed for internalization/externalization of time.Time/Date. See issue https://github.com/gopherjs/gopherjs/issues/279.
+func init() {
+ // avoid dead code elimination
+ var _ Time = Unix(0, 0)
+}
+
+type runtimeTimer struct {
+ i int32
+ when int64
+ period int64
+ f func(interface{}, uintptr)
+ arg interface{}
+ timeout *js.Object
+ active bool
+}
+
+func initLocal() {
+ d := js.Global.Get("Date").New()
+ s := d.String()
+ i := indexByte(s, '(')
+ j := indexByte(s, ')')
+ if i == -1 || j == -1 {
+ localLoc.name = "UTC"
+ return
+ }
+ localLoc.name = s[i+1 : j]
+ localLoc.zone = []zone{{localLoc.name, d.Call("getTimezoneOffset").Int() * -60, false}}
+}
+
+func runtimeNano() int64 {
+ return js.Global.Get("Date").New().Call("getTime").Int64() * int64(Millisecond)
+}
+
+func now() (sec int64, nsec int32, mono int64) {
+ n := runtimeNano()
+ return n / int64(Second), int32(n % int64(Second)), n
+}
+
+func Sleep(d Duration) {
+ c := make(chan struct{})
+ js.Global.Call("$setTimeout", js.InternalObject(func() { close(c) }), int(d/Millisecond))
+ <-c
+}
+
+func startTimer(t *runtimeTimer) {
+ t.active = true
+ diff := (t.when - runtimeNano()) / int64(Millisecond)
+ if diff > 1<<31-1 { // math.MaxInt32
+ return
+ }
+ if diff < 0 {
+ diff = 0
+ }
+ t.timeout = js.Global.Call("$setTimeout", js.InternalObject(func() {
+ t.active = false
+ if t.period != 0 {
+ t.when += t.period
+ startTimer(t)
+ }
+ go t.f(t.arg, 0)
+ }), diff+1)
+}
+
+func stopTimer(t *runtimeTimer) bool {
+ js.Global.Call("clearTimeout", t.timeout)
+ wasActive := t.active
+ t.active = false
+ return wasActive
+}
+
+func forceZipFileForTesting(zipOnly bool) {
+}
+
+var zoneSources = []string{
+ runtime.GOROOT() + "/lib/time/zoneinfo.zip",
+}
+
+// indexByte is copied from strings package to avoid importing it (since the real time package doesn't).
+func indexByte(s string, c byte) int {
+ return js.InternalObject(s).Call("indexOf", js.Global.Get("String").Call("fromCharCode", c)).Int()
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/unicode/unicode.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/unicode/unicode.go
new file mode 100644
index 00000000000..e9231765140
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/natives/src/unicode/unicode.go
@@ -0,0 +1,28 @@
+// +build js
+
+package unicode
+
+func to(_case int, r rune, caseRange []CaseRange) (mappedRune rune, foundMapping bool) {
+ if _case < 0 || MaxCase <= _case {
+ return ReplacementChar, false
+ }
+ lo := 0
+ hi := len(caseRange)
+ for lo < hi {
+ m := lo + (hi-lo)/2
+ cr := &caseRange[m] // performance critical for GopherJS: get address here instead of copying the CaseRange
+ if rune(cr.Lo) <= r && r <= rune(cr.Hi) {
+ delta := rune(cr.Delta[_case])
+ if delta > MaxRune {
+ return rune(cr.Lo) + ((r-rune(cr.Lo))&^1 | rune(_case&1)), true
+ }
+ return r + delta, true
+ }
+ if r < rune(cr.Lo) {
+ hi = m
+ } else {
+ lo = m + 1
+ }
+ }
+ return r, false
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/package.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/package.go
new file mode 100644
index 00000000000..f841b145b4b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/package.go
@@ -0,0 +1,809 @@
+package compiler
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "go/ast"
+ "go/constant"
+ "go/token"
+ "go/types"
+ "sort"
+ "strings"
+
+ "github.com/gopherjs/gopherjs/compiler/analysis"
+ "github.com/neelance/astrewrite"
+ "golang.org/x/tools/go/gcexportdata"
+ "golang.org/x/tools/go/types/typeutil"
+)
+
+type pkgContext struct {
+ *analysis.Info
+ additionalSelections map[*ast.SelectorExpr]selection
+
+ typeNames []*types.TypeName
+ pkgVars map[string]string
+ objectNames map[types.Object]string
+ varPtrNames map[*types.Var]string
+ anonTypes []*types.TypeName
+ anonTypeMap typeutil.Map
+ escapingVars map[*types.Var]bool
+ indentation int
+ dependencies map[types.Object]bool
+ minify bool
+ fileSet *token.FileSet
+ errList ErrorList
+}
+
+func (p *pkgContext) SelectionOf(e *ast.SelectorExpr) (selection, bool) {
+ if sel, ok := p.Selections[e]; ok {
+ return sel, true
+ }
+ if sel, ok := p.additionalSelections[e]; ok {
+ return sel, true
+ }
+ return nil, false
+}
+
+type selection interface {
+ Kind() types.SelectionKind
+ Recv() types.Type
+ Index() []int
+ Obj() types.Object
+ Type() types.Type
+}
+
+type fakeSelection struct {
+ kind types.SelectionKind
+ recv types.Type
+ index []int
+ obj types.Object
+ typ types.Type
+}
+
+func (sel *fakeSelection) Kind() types.SelectionKind { return sel.kind }
+func (sel *fakeSelection) Recv() types.Type { return sel.recv }
+func (sel *fakeSelection) Index() []int { return sel.index }
+func (sel *fakeSelection) Obj() types.Object { return sel.obj }
+func (sel *fakeSelection) Type() types.Type { return sel.typ }
+
+type funcContext struct {
+ *analysis.FuncInfo
+ p *pkgContext
+ parent *funcContext
+ sig *types.Signature
+ allVars map[string]int
+ localVars []string
+ resultNames []ast.Expr
+ flowDatas map[*types.Label]*flowData
+ caseCounter int
+ labelCases map[*types.Label]int
+ output []byte
+ delayedOutput []byte
+ posAvailable bool
+ pos token.Pos
+}
+
+type flowData struct {
+ postStmt func()
+ beginCase int
+ endCase int
+}
+
+type ImportContext struct {
+ Packages map[string]*types.Package
+ Import func(string) (*Archive, error)
+}
+
+// packageImporter implements go/types.Importer interface.
+type packageImporter struct {
+ importContext *ImportContext
+ importError *error // A pointer to importError in Compile.
+}
+
+func (pi packageImporter) Import(path string) (*types.Package, error) {
+ if path == "unsafe" {
+ return types.Unsafe, nil
+ }
+
+ a, err := pi.importContext.Import(path)
+ if err != nil {
+ if *pi.importError == nil {
+ // If import failed, show first error of import only (https://github.com/gopherjs/gopherjs/issues/119).
+ *pi.importError = err
+ }
+ return nil, err
+ }
+
+ return pi.importContext.Packages[a.ImportPath], nil
+}
+
+func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, importContext *ImportContext, minify bool) (*Archive, error) {
+ typesInfo := &types.Info{
+ Types: make(map[ast.Expr]types.TypeAndValue),
+ Defs: make(map[*ast.Ident]types.Object),
+ Uses: make(map[*ast.Ident]types.Object),
+ Implicits: make(map[ast.Node]types.Object),
+ Selections: make(map[*ast.SelectorExpr]*types.Selection),
+ Scopes: make(map[ast.Node]*types.Scope),
+ }
+
+ var importError error
+ var errList ErrorList
+ var previousErr error
+ config := &types.Config{
+ Importer: packageImporter{
+ importContext: importContext,
+ importError: &importError,
+ },
+ Sizes: sizes32,
+ Error: func(err error) {
+ if previousErr != nil && previousErr.Error() == err.Error() {
+ return
+ }
+ errList = append(errList, err)
+ previousErr = err
+ },
+ }
+ typesPkg, err := config.Check(importPath, fileSet, files, typesInfo)
+ if importError != nil {
+ return nil, importError
+ }
+ if errList != nil {
+ if len(errList) > 10 {
+ pos := token.NoPos
+ if last, ok := errList[9].(types.Error); ok {
+ pos = last.Pos
+ }
+ errList = append(errList[:10], types.Error{Fset: fileSet, Pos: pos, Msg: "too many errors"})
+ }
+ return nil, errList
+ }
+ if err != nil {
+ return nil, err
+ }
+ importContext.Packages[importPath] = typesPkg
+
+ exportData := new(bytes.Buffer)
+ if err := gcexportdata.Write(exportData, nil, typesPkg); err != nil {
+ return nil, fmt.Errorf("failed to write export data: %v", err)
+ }
+ encodedFileSet := new(bytes.Buffer)
+ if err := fileSet.Write(json.NewEncoder(encodedFileSet).Encode); err != nil {
+ return nil, err
+ }
+
+ simplifiedFiles := make([]*ast.File, len(files))
+ for i, file := range files {
+ simplifiedFiles[i] = astrewrite.Simplify(file, typesInfo, false)
+ }
+
+ isBlocking := func(f *types.Func) bool {
+ archive, err := importContext.Import(f.Pkg().Path())
+ if err != nil {
+ panic(err)
+ }
+ fullName := f.FullName()
+ for _, d := range archive.Declarations {
+ if string(d.FullName) == fullName {
+ return d.Blocking
+ }
+ }
+ panic(fullName)
+ }
+ pkgInfo := analysis.AnalyzePkg(simplifiedFiles, fileSet, typesInfo, typesPkg, isBlocking)
+ c := &funcContext{
+ FuncInfo: pkgInfo.InitFuncInfo,
+ p: &pkgContext{
+ Info: pkgInfo,
+ additionalSelections: make(map[*ast.SelectorExpr]selection),
+
+ pkgVars: make(map[string]string),
+ objectNames: make(map[types.Object]string),
+ varPtrNames: make(map[*types.Var]string),
+ escapingVars: make(map[*types.Var]bool),
+ indentation: 1,
+ dependencies: make(map[types.Object]bool),
+ minify: minify,
+ fileSet: fileSet,
+ },
+ allVars: make(map[string]int),
+ flowDatas: map[*types.Label]*flowData{nil: {}},
+ caseCounter: 1,
+ labelCases: make(map[*types.Label]int),
+ }
+ for name := range reservedKeywords {
+ c.allVars[name] = 1
+ }
+
+ // imports
+ var importDecls []*Decl
+ var importedPaths []string
+ for _, importedPkg := range typesPkg.Imports() {
+ if importedPkg == types.Unsafe {
+ // Prior to Go 1.9, unsafe import was excluded by Imports() method,
+ // but now we do it here to maintain previous behavior.
+ continue
+ }
+ c.p.pkgVars[importedPkg.Path()] = c.newVariableWithLevel(importedPkg.Name(), true)
+ importedPaths = append(importedPaths, importedPkg.Path())
+ }
+ sort.Strings(importedPaths)
+ for _, impPath := range importedPaths {
+ id := c.newIdent(fmt.Sprintf(`%s.$init`, c.p.pkgVars[impPath]), types.NewSignature(nil, nil, nil, false))
+ call := &ast.CallExpr{Fun: id}
+ c.Blocking[call] = true
+ c.Flattened[call] = true
+ importDecls = append(importDecls, &Decl{
+ Vars: []string{c.p.pkgVars[impPath]},
+ DeclCode: []byte(fmt.Sprintf("\t%s = $packages[\"%s\"];\n", c.p.pkgVars[impPath], impPath)),
+ InitCode: c.CatchOutput(1, func() { c.translateStmt(&ast.ExprStmt{X: call}, nil) }),
+ })
+ }
+
+ var functions []*ast.FuncDecl
+ var vars []*types.Var
+ for _, file := range simplifiedFiles {
+ for _, decl := range file.Decls {
+ switch d := decl.(type) {
+ case *ast.FuncDecl:
+ sig := c.p.Defs[d.Name].(*types.Func).Type().(*types.Signature)
+ var recvType types.Type
+ if sig.Recv() != nil {
+ recvType = sig.Recv().Type()
+ if ptr, isPtr := recvType.(*types.Pointer); isPtr {
+ recvType = ptr.Elem()
+ }
+ }
+ if sig.Recv() == nil {
+ c.objectName(c.p.Defs[d.Name].(*types.Func)) // register toplevel name
+ }
+ if !isBlank(d.Name) {
+ functions = append(functions, d)
+ }
+ case *ast.GenDecl:
+ switch d.Tok {
+ case token.TYPE:
+ for _, spec := range d.Specs {
+ o := c.p.Defs[spec.(*ast.TypeSpec).Name].(*types.TypeName)
+ c.p.typeNames = append(c.p.typeNames, o)
+ c.objectName(o) // register toplevel name
+ }
+ case token.VAR:
+ for _, spec := range d.Specs {
+ for _, name := range spec.(*ast.ValueSpec).Names {
+ if !isBlank(name) {
+ o := c.p.Defs[name].(*types.Var)
+ vars = append(vars, o)
+ c.objectName(o) // register toplevel name
+ }
+ }
+ }
+ case token.CONST:
+ // skip, constants are inlined
+ }
+ }
+ }
+ }
+
+ collectDependencies := func(f func()) []string {
+ c.p.dependencies = make(map[types.Object]bool)
+ f()
+ var deps []string
+ for o := range c.p.dependencies {
+ qualifiedName := o.Pkg().Path() + "." + o.Name()
+ if f, ok := o.(*types.Func); ok && f.Type().(*types.Signature).Recv() != nil {
+ deps = append(deps, qualifiedName+"~")
+ continue
+ }
+ deps = append(deps, qualifiedName)
+ }
+ sort.Strings(deps)
+ return deps
+ }
+
+ // variables
+ var varDecls []*Decl
+ varsWithInit := make(map[*types.Var]bool)
+ for _, init := range c.p.InitOrder {
+ for _, o := range init.Lhs {
+ varsWithInit[o] = true
+ }
+ }
+ for _, o := range vars {
+ var d Decl
+ if !o.Exported() {
+ d.Vars = []string{c.objectName(o)}
+ }
+ if c.p.HasPointer[o] && !o.Exported() {
+ d.Vars = append(d.Vars, c.varPtrName(o))
+ }
+ if _, ok := varsWithInit[o]; !ok {
+ d.DceDeps = collectDependencies(func() {
+ d.InitCode = []byte(fmt.Sprintf("\t\t%s = %s;\n", c.objectName(o), c.translateExpr(c.zeroValue(o.Type())).String()))
+ })
+ }
+ d.DceObjectFilter = o.Name()
+ varDecls = append(varDecls, &d)
+ }
+ for _, init := range c.p.InitOrder {
+ lhs := make([]ast.Expr, len(init.Lhs))
+ for i, o := range init.Lhs {
+ ident := ast.NewIdent(o.Name())
+ c.p.Defs[ident] = o
+ lhs[i] = c.setType(ident, o.Type())
+ varsWithInit[o] = true
+ }
+ var d Decl
+ d.DceDeps = collectDependencies(func() {
+ c.localVars = nil
+ d.InitCode = c.CatchOutput(1, func() {
+ c.translateStmt(&ast.AssignStmt{
+ Lhs: lhs,
+ Tok: token.DEFINE,
+ Rhs: []ast.Expr{init.Rhs},
+ }, nil)
+ })
+ d.Vars = append(d.Vars, c.localVars...)
+ })
+ if len(init.Lhs) == 1 {
+ if !analysis.HasSideEffect(init.Rhs, c.p.Info.Info) {
+ d.DceObjectFilter = init.Lhs[0].Name()
+ }
+ }
+ varDecls = append(varDecls, &d)
+ }
+
+ // functions
+ var funcDecls []*Decl
+ var mainFunc *types.Func
+ for _, fun := range functions {
+ o := c.p.Defs[fun.Name].(*types.Func)
+ funcInfo := c.p.FuncDeclInfos[o]
+ d := Decl{
+ FullName: o.FullName(),
+ Blocking: len(funcInfo.Blocking) != 0,
+ }
+ if fun.Recv == nil {
+ d.Vars = []string{c.objectName(o)}
+ d.DceObjectFilter = o.Name()
+ switch o.Name() {
+ case "main":
+ mainFunc = o
+ d.DceObjectFilter = ""
+ case "init":
+ d.InitCode = c.CatchOutput(1, func() {
+ id := c.newIdent("", types.NewSignature(nil, nil, nil, false))
+ c.p.Uses[id] = o
+ call := &ast.CallExpr{Fun: id}
+ if len(c.p.FuncDeclInfos[o].Blocking) != 0 {
+ c.Blocking[call] = true
+ }
+ c.translateStmt(&ast.ExprStmt{X: call}, nil)
+ })
+ d.DceObjectFilter = ""
+ }
+ }
+ if fun.Recv != nil {
+ recvType := o.Type().(*types.Signature).Recv().Type()
+ ptr, isPointer := recvType.(*types.Pointer)
+ namedRecvType, _ := recvType.(*types.Named)
+ if isPointer {
+ namedRecvType = ptr.Elem().(*types.Named)
+ }
+ d.DceObjectFilter = namedRecvType.Obj().Name()
+ if !fun.Name.IsExported() {
+ d.DceMethodFilter = o.Name() + "~"
+ }
+ }
+
+ d.DceDeps = collectDependencies(func() {
+ d.DeclCode = c.translateToplevelFunction(fun, funcInfo)
+ })
+ funcDecls = append(funcDecls, &d)
+ }
+ if typesPkg.Name() == "main" {
+ if mainFunc == nil {
+ return nil, fmt.Errorf("missing main function")
+ }
+ id := c.newIdent("", types.NewSignature(nil, nil, nil, false))
+ c.p.Uses[id] = mainFunc
+ call := &ast.CallExpr{Fun: id}
+ ifStmt := &ast.IfStmt{
+ Cond: c.newIdent("$pkg === $mainPkg", types.Typ[types.Bool]),
+ Body: &ast.BlockStmt{
+ List: []ast.Stmt{
+ &ast.ExprStmt{X: call},
+ &ast.AssignStmt{
+ Lhs: []ast.Expr{c.newIdent("$mainFinished", types.Typ[types.Bool])},
+ Tok: token.ASSIGN,
+ Rhs: []ast.Expr{c.newConst(types.Typ[types.Bool], constant.MakeBool(true))},
+ },
+ },
+ },
+ }
+ if len(c.p.FuncDeclInfos[mainFunc].Blocking) != 0 {
+ c.Blocking[call] = true
+ c.Flattened[ifStmt] = true
+ }
+ funcDecls = append(funcDecls, &Decl{
+ InitCode: c.CatchOutput(1, func() {
+ c.translateStmt(ifStmt, nil)
+ }),
+ })
+ }
+
+ // named types
+ var typeDecls []*Decl
+ for _, o := range c.p.typeNames {
+ if o.IsAlias() {
+ continue
+ }
+ typeName := c.objectName(o)
+ d := Decl{
+ Vars: []string{typeName},
+ DceObjectFilter: o.Name(),
+ }
+ d.DceDeps = collectDependencies(func() {
+ d.DeclCode = c.CatchOutput(0, func() {
+ typeName := c.objectName(o)
+ lhs := typeName
+ if isPkgLevel(o) {
+ lhs += " = $pkg." + encodeIdent(o.Name())
+ }
+ size := int64(0)
+ constructor := "null"
+ switch t := o.Type().Underlying().(type) {
+ case *types.Struct:
+ params := make([]string, t.NumFields())
+ for i := 0; i < t.NumFields(); i++ {
+ params[i] = fieldName(t, i) + "_"
+ }
+ constructor = fmt.Sprintf("function(%s) {\n\t\tthis.$val = this;\n\t\tif (arguments.length === 0) {\n", strings.Join(params, ", "))
+ for i := 0; i < t.NumFields(); i++ {
+ constructor += fmt.Sprintf("\t\t\tthis.%s = %s;\n", fieldName(t, i), c.translateExpr(c.zeroValue(t.Field(i).Type())).String())
+ }
+ constructor += "\t\t\treturn;\n\t\t}\n"
+ for i := 0; i < t.NumFields(); i++ {
+ constructor += fmt.Sprintf("\t\tthis.%[1]s = %[1]s_;\n", fieldName(t, i))
+ }
+ constructor += "\t}"
+ case *types.Basic, *types.Array, *types.Slice, *types.Chan, *types.Signature, *types.Interface, *types.Pointer, *types.Map:
+ size = sizes32.Sizeof(t)
+ }
+ c.Printf(`%s = $newType(%d, %s, "%s.%s", %t, "%s", %t, %s);`, lhs, size, typeKind(o.Type()), o.Pkg().Name(), o.Name(), o.Name() != "", o.Pkg().Path(), o.Exported(), constructor)
+ })
+ d.MethodListCode = c.CatchOutput(0, func() {
+ named := o.Type().(*types.Named)
+ if _, ok := named.Underlying().(*types.Interface); ok {
+ return
+ }
+ var methods []string
+ var ptrMethods []string
+ for i := 0; i < named.NumMethods(); i++ {
+ method := named.Method(i)
+ name := method.Name()
+ if reservedKeywords[name] {
+ name += "$"
+ }
+ pkgPath := ""
+ if !method.Exported() {
+ pkgPath = method.Pkg().Path()
+ }
+ t := method.Type().(*types.Signature)
+ entry := fmt.Sprintf(`{prop: "%s", name: %s, pkg: "%s", typ: $funcType(%s)}`, name, encodeString(method.Name()), pkgPath, c.initArgs(t))
+ if _, isPtr := t.Recv().Type().(*types.Pointer); isPtr {
+ ptrMethods = append(ptrMethods, entry)
+ continue
+ }
+ methods = append(methods, entry)
+ }
+ if len(methods) > 0 {
+ c.Printf("%s.methods = [%s];", c.typeName(named), strings.Join(methods, ", "))
+ }
+ if len(ptrMethods) > 0 {
+ c.Printf("%s.methods = [%s];", c.typeName(types.NewPointer(named)), strings.Join(ptrMethods, ", "))
+ }
+ })
+ switch t := o.Type().Underlying().(type) {
+ case *types.Array, *types.Chan, *types.Interface, *types.Map, *types.Pointer, *types.Slice, *types.Signature, *types.Struct:
+ d.TypeInitCode = c.CatchOutput(0, func() {
+ c.Printf("%s.init(%s);", c.objectName(o), c.initArgs(t))
+ })
+ }
+ })
+ typeDecls = append(typeDecls, &d)
+ }
+
+ // anonymous types
+ for _, t := range c.p.anonTypes {
+ d := Decl{
+ Vars: []string{t.Name()},
+ DceObjectFilter: t.Name(),
+ }
+ d.DceDeps = collectDependencies(func() {
+ d.DeclCode = []byte(fmt.Sprintf("\t%s = $%sType(%s);\n", t.Name(), strings.ToLower(typeKind(t.Type())[5:]), c.initArgs(t.Type())))
+ })
+ typeDecls = append(typeDecls, &d)
+ }
+
+ var allDecls []*Decl
+ for _, d := range append(append(append(importDecls, typeDecls...), varDecls...), funcDecls...) {
+ d.DeclCode = removeWhitespace(d.DeclCode, minify)
+ d.MethodListCode = removeWhitespace(d.MethodListCode, minify)
+ d.TypeInitCode = removeWhitespace(d.TypeInitCode, minify)
+ d.InitCode = removeWhitespace(d.InitCode, minify)
+ allDecls = append(allDecls, d)
+ }
+
+ if len(c.p.errList) != 0 {
+ return nil, c.p.errList
+ }
+
+ return &Archive{
+ ImportPath: importPath,
+ Name: typesPkg.Name(),
+ Imports: importedPaths,
+ ExportData: exportData.Bytes(),
+ Declarations: allDecls,
+ FileSet: encodedFileSet.Bytes(),
+ Minified: minify,
+ }, nil
+}
+
+func (c *funcContext) initArgs(ty types.Type) string {
+ switch t := ty.(type) {
+ case *types.Array:
+ return fmt.Sprintf("%s, %d", c.typeName(t.Elem()), t.Len())
+ case *types.Chan:
+ return fmt.Sprintf("%s, %t, %t", c.typeName(t.Elem()), t.Dir()&types.SendOnly != 0, t.Dir()&types.RecvOnly != 0)
+ case *types.Interface:
+ methods := make([]string, t.NumMethods())
+ for i := range methods {
+ method := t.Method(i)
+ pkgPath := ""
+ if !method.Exported() {
+ pkgPath = method.Pkg().Path()
+ }
+ methods[i] = fmt.Sprintf(`{prop: "%s", name: "%s", pkg: "%s", typ: $funcType(%s)}`, method.Name(), method.Name(), pkgPath, c.initArgs(method.Type()))
+ }
+ return fmt.Sprintf("[%s]", strings.Join(methods, ", "))
+ case *types.Map:
+ return fmt.Sprintf("%s, %s", c.typeName(t.Key()), c.typeName(t.Elem()))
+ case *types.Pointer:
+ return fmt.Sprintf("%s", c.typeName(t.Elem()))
+ case *types.Slice:
+ return fmt.Sprintf("%s", c.typeName(t.Elem()))
+ case *types.Signature:
+ params := make([]string, t.Params().Len())
+ for i := range params {
+ params[i] = c.typeName(t.Params().At(i).Type())
+ }
+ results := make([]string, t.Results().Len())
+ for i := range results {
+ results[i] = c.typeName(t.Results().At(i).Type())
+ }
+ return fmt.Sprintf("[%s], [%s], %t", strings.Join(params, ", "), strings.Join(results, ", "), t.Variadic())
+ case *types.Struct:
+ pkgPath := ""
+ fields := make([]string, t.NumFields())
+ for i := range fields {
+ field := t.Field(i)
+ if !field.Exported() {
+ pkgPath = field.Pkg().Path()
+ }
+ fields[i] = fmt.Sprintf(`{prop: "%s", name: %s, embedded: %t, exported: %t, typ: %s, tag: %s}`, fieldName(t, i), encodeString(field.Name()), field.Anonymous(), field.Exported(), c.typeName(field.Type()), encodeString(t.Tag(i)))
+ }
+ return fmt.Sprintf(`"%s", [%s]`, pkgPath, strings.Join(fields, ", "))
+ default:
+ panic("invalid type")
+ }
+}
+
+func (c *funcContext) translateToplevelFunction(fun *ast.FuncDecl, info *analysis.FuncInfo) []byte {
+ o := c.p.Defs[fun.Name].(*types.Func)
+ sig := o.Type().(*types.Signature)
+ var recv *ast.Ident
+ if fun.Recv != nil && fun.Recv.List[0].Names != nil {
+ recv = fun.Recv.List[0].Names[0]
+ }
+
+ var joinedParams string
+ primaryFunction := func(funcRef string) []byte {
+ if fun.Body == nil {
+ return []byte(fmt.Sprintf("\t%s = function() {\n\t\t$throwRuntimeError(\"native function not implemented: %s\");\n\t};\n", funcRef, o.FullName()))
+ }
+
+ params, fun := translateFunction(fun.Type, recv, fun.Body, c, sig, info, funcRef)
+ joinedParams = strings.Join(params, ", ")
+ return []byte(fmt.Sprintf("\t%s = %s;\n", funcRef, fun))
+ }
+
+ code := bytes.NewBuffer(nil)
+
+ if fun.Recv == nil {
+ funcRef := c.objectName(o)
+ code.Write(primaryFunction(funcRef))
+ if fun.Name.IsExported() {
+ fmt.Fprintf(code, "\t$pkg.%s = %s;\n", encodeIdent(fun.Name.Name), funcRef)
+ }
+ return code.Bytes()
+ }
+
+ recvType := sig.Recv().Type()
+ ptr, isPointer := recvType.(*types.Pointer)
+ namedRecvType, _ := recvType.(*types.Named)
+ if isPointer {
+ namedRecvType = ptr.Elem().(*types.Named)
+ }
+ typeName := c.objectName(namedRecvType.Obj())
+ funName := fun.Name.Name
+ if reservedKeywords[funName] {
+ funName += "$"
+ }
+
+ if _, isStruct := namedRecvType.Underlying().(*types.Struct); isStruct {
+ code.Write(primaryFunction(typeName + ".ptr.prototype." + funName))
+ fmt.Fprintf(code, "\t%s.prototype.%s = function(%s) { return this.$val.%s(%s); };\n", typeName, funName, joinedParams, funName, joinedParams)
+ return code.Bytes()
+ }
+
+ if isPointer {
+ if _, isArray := ptr.Elem().Underlying().(*types.Array); isArray {
+ code.Write(primaryFunction(typeName + ".prototype." + funName))
+ fmt.Fprintf(code, "\t$ptrType(%s).prototype.%s = function(%s) { return (new %s(this.$get())).%s(%s); };\n", typeName, funName, joinedParams, typeName, funName, joinedParams)
+ return code.Bytes()
+ }
+ return primaryFunction(fmt.Sprintf("$ptrType(%s).prototype.%s", typeName, funName))
+ }
+
+ value := "this.$get()"
+ if isWrapped(recvType) {
+ value = fmt.Sprintf("new %s(%s)", typeName, value)
+ }
+ code.Write(primaryFunction(typeName + ".prototype." + funName))
+ fmt.Fprintf(code, "\t$ptrType(%s).prototype.%s = function(%s) { return %s.%s(%s); };\n", typeName, funName, joinedParams, value, funName, joinedParams)
+ return code.Bytes()
+}
+
+func translateFunction(typ *ast.FuncType, recv *ast.Ident, body *ast.BlockStmt, outerContext *funcContext, sig *types.Signature, info *analysis.FuncInfo, funcRef string) ([]string, string) {
+ if info == nil {
+ panic("nil info")
+ }
+
+ c := &funcContext{
+ FuncInfo: info,
+ p: outerContext.p,
+ parent: outerContext,
+ sig: sig,
+ allVars: make(map[string]int, len(outerContext.allVars)),
+ localVars: []string{},
+ flowDatas: map[*types.Label]*flowData{nil: {}},
+ caseCounter: 1,
+ labelCases: make(map[*types.Label]int),
+ }
+ for k, v := range outerContext.allVars {
+ c.allVars[k] = v
+ }
+ prevEV := c.p.escapingVars
+
+ var params []string
+ for _, param := range typ.Params.List {
+ if len(param.Names) == 0 {
+ params = append(params, c.newVariable("param"))
+ continue
+ }
+ for _, ident := range param.Names {
+ if isBlank(ident) {
+ params = append(params, c.newVariable("param"))
+ continue
+ }
+ params = append(params, c.objectName(c.p.Defs[ident]))
+ }
+ }
+
+ bodyOutput := string(c.CatchOutput(1, func() {
+ if len(c.Blocking) != 0 {
+ c.p.Scopes[body] = c.p.Scopes[typ]
+ c.handleEscapingVars(body)
+ }
+
+ if c.sig != nil && c.sig.Results().Len() != 0 && c.sig.Results().At(0).Name() != "" {
+ c.resultNames = make([]ast.Expr, c.sig.Results().Len())
+ for i := 0; i < c.sig.Results().Len(); i++ {
+ result := c.sig.Results().At(i)
+ c.Printf("%s = %s;", c.objectName(result), c.translateExpr(c.zeroValue(result.Type())).String())
+ id := ast.NewIdent("")
+ c.p.Uses[id] = result
+ c.resultNames[i] = c.setType(id, result.Type())
+ }
+ }
+
+ if recv != nil && !isBlank(recv) {
+ this := "this"
+ if isWrapped(c.p.TypeOf(recv)) {
+ this = "this.$val"
+ }
+ c.Printf("%s = %s;", c.translateExpr(recv), this)
+ }
+
+ c.translateStmtList(body.List)
+ if len(c.Flattened) != 0 && !endsWithReturn(body.List) {
+ c.translateStmt(&ast.ReturnStmt{}, nil)
+ }
+ }))
+
+ sort.Strings(c.localVars)
+
+ var prefix, suffix, functionName string
+
+ if len(c.Flattened) != 0 {
+ c.localVars = append(c.localVars, "$s")
+ prefix = prefix + " $s = 0;"
+ }
+
+ if c.HasDefer {
+ c.localVars = append(c.localVars, "$deferred")
+ suffix = " }" + suffix
+ if len(c.Blocking) != 0 {
+ suffix = " }" + suffix
+ }
+ }
+
+ if len(c.Blocking) != 0 {
+ c.localVars = append(c.localVars, "$r")
+ if funcRef == "" {
+ funcRef = "$b"
+ functionName = " $b"
+ }
+ var stores, loads string
+ for _, v := range c.localVars {
+ loads += fmt.Sprintf("%s = $f.%s; ", v, v)
+ stores += fmt.Sprintf("$f.%s = %s; ", v, v)
+ }
+ prefix = prefix + " var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; " + loads + "}"
+ suffix = " if ($f === undefined) { $f = { $blk: " + funcRef + " }; } " + stores + "return $f;" + suffix
+ }
+
+ if c.HasDefer {
+ prefix = prefix + " var $err = null; try {"
+ deferSuffix := " } catch(err) { $err = err;"
+ if len(c.Blocking) != 0 {
+ deferSuffix += " $s = -1;"
+ }
+ if c.resultNames == nil && c.sig.Results().Len() > 0 {
+ deferSuffix += fmt.Sprintf(" return%s;", c.translateResults(nil))
+ }
+ deferSuffix += " } finally { $callDeferred($deferred, $err);"
+ if c.resultNames != nil {
+ deferSuffix += fmt.Sprintf(" if (!$curGoroutine.asleep) { return %s; }", c.translateResults(c.resultNames))
+ }
+ if len(c.Blocking) != 0 {
+ deferSuffix += " if($curGoroutine.asleep) {"
+ }
+ suffix = deferSuffix + suffix
+ }
+
+ if len(c.Flattened) != 0 {
+ prefix = prefix + " s: while (true) { switch ($s) { case 0:"
+ suffix = " } return; }" + suffix
+ }
+
+ if c.HasDefer {
+ prefix = prefix + " $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);"
+ }
+
+ if prefix != "" {
+ bodyOutput = strings.Repeat("\t", c.p.indentation+1) + "/* */" + prefix + "\n" + bodyOutput
+ }
+ if suffix != "" {
+ bodyOutput = bodyOutput + strings.Repeat("\t", c.p.indentation+1) + "/* */" + suffix + "\n"
+ }
+ if len(c.localVars) != 0 {
+ bodyOutput = fmt.Sprintf("%svar %s;\n", strings.Repeat("\t", c.p.indentation+1), strings.Join(c.localVars, ", ")) + bodyOutput
+ }
+
+ c.p.escapingVars = prevEV
+
+ return params, fmt.Sprintf("function%s(%s) {\n%s%s}", functionName, strings.Join(params, ", "), bodyOutput, strings.Repeat("\t", c.p.indentation))
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/genmin.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/genmin.go
new file mode 100644
index 00000000000..739dbf21655
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/genmin.go
@@ -0,0 +1,63 @@
+// +build ignore
+
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "go/build"
+ "io/ioutil"
+ "log"
+ "os/exec"
+ "path/filepath"
+ "strings"
+
+ "github.com/gopherjs/gopherjs/compiler/prelude"
+)
+
+func main() {
+ if err := run(); err != nil {
+ log.Fatalln(err)
+ }
+}
+
+func run() error {
+ bpkg, err := build.Import("github.com/gopherjs/gopherjs", "", build.FindOnly)
+ if err != nil {
+ return fmt.Errorf("failed to locate path for github.com/gopherjs/gopherjs: %v", err)
+ }
+
+ preludeDir := filepath.Join(bpkg.Dir, "compiler", "prelude")
+
+ args := []string{
+ filepath.Join(bpkg.Dir, "node_modules", ".bin", "uglifyjs"),
+ "--config-file",
+ filepath.Join(preludeDir, "uglifyjs_options.json"),
+ }
+
+ stderr := new(bytes.Buffer)
+ cmd := exec.Command(args[0], args[1:]...)
+ cmd.Stdin = strings.NewReader(prelude.Prelude)
+ cmd.Stderr = stderr
+
+ out, err := cmd.Output()
+ if err != nil {
+ return fmt.Errorf("failed to run %v: %v\n%s", strings.Join(args, " "), err, stderr.String())
+ }
+
+ fn := "prelude_min.go"
+
+ outStr := fmt.Sprintf(`// Code generated by genmin; DO NOT EDIT.
+
+package prelude
+
+// Minified is an uglifyjs-minified version of Prelude.
+const Minified = %q
+`, out)
+
+ if err := ioutil.WriteFile(fn, []byte(outStr), 0644); err != nil {
+ return fmt.Errorf("failed to write to %v: %v", fn, err)
+ }
+
+ return nil
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/goroutines.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/goroutines.go
new file mode 100644
index 00000000000..d9780b65d95
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/goroutines.go
@@ -0,0 +1,358 @@
+package prelude
+
+const goroutines = `
+var $stackDepthOffset = 0;
+var $getStackDepth = function() {
+ var err = new Error();
+ if (err.stack === undefined) {
+ return undefined;
+ }
+ return $stackDepthOffset + err.stack.split("\n").length;
+};
+
+var $panicStackDepth = null, $panicValue;
+var $callDeferred = function(deferred, jsErr, fromPanic) {
+ if (!fromPanic && deferred !== null && deferred.index >= $curGoroutine.deferStack.length) {
+ throw jsErr;
+ }
+ if (jsErr !== null) {
+ var newErr = null;
+ try {
+ $curGoroutine.deferStack.push(deferred);
+ $panic(new $jsErrorPtr(jsErr));
+ } catch (err) {
+ newErr = err;
+ }
+ $curGoroutine.deferStack.pop();
+ $callDeferred(deferred, newErr);
+ return;
+ }
+ if ($curGoroutine.asleep) {
+ return;
+ }
+
+ $stackDepthOffset--;
+ var outerPanicStackDepth = $panicStackDepth;
+ var outerPanicValue = $panicValue;
+
+ var localPanicValue = $curGoroutine.panicStack.pop();
+ if (localPanicValue !== undefined) {
+ $panicStackDepth = $getStackDepth();
+ $panicValue = localPanicValue;
+ }
+
+ try {
+ while (true) {
+ if (deferred === null) {
+ deferred = $curGoroutine.deferStack[$curGoroutine.deferStack.length - 1];
+ if (deferred === undefined) {
+ /* The panic reached the top of the stack. Clear it and throw it as a JavaScript error. */
+ $panicStackDepth = null;
+ if (localPanicValue.Object instanceof Error) {
+ throw localPanicValue.Object;
+ }
+ var msg;
+ if (localPanicValue.constructor === $String) {
+ msg = localPanicValue.$val;
+ } else if (localPanicValue.Error !== undefined) {
+ msg = localPanicValue.Error();
+ } else if (localPanicValue.String !== undefined) {
+ msg = localPanicValue.String();
+ } else {
+ msg = localPanicValue;
+ }
+ throw new Error(msg);
+ }
+ }
+ var call = deferred.pop();
+ if (call === undefined) {
+ $curGoroutine.deferStack.pop();
+ if (localPanicValue !== undefined) {
+ deferred = null;
+ continue;
+ }
+ return;
+ }
+ var r = call[0].apply(call[2], call[1]);
+ if (r && r.$blk !== undefined) {
+ deferred.push([r.$blk, [], r]);
+ if (fromPanic) {
+ throw null;
+ }
+ return;
+ }
+
+ if (localPanicValue !== undefined && $panicStackDepth === null) {
+ throw null; /* error was recovered */
+ }
+ }
+ } finally {
+ if (localPanicValue !== undefined) {
+ if ($panicStackDepth !== null) {
+ $curGoroutine.panicStack.push(localPanicValue);
+ }
+ $panicStackDepth = outerPanicStackDepth;
+ $panicValue = outerPanicValue;
+ }
+ $stackDepthOffset++;
+ }
+};
+
+var $panic = function(value) {
+ $curGoroutine.panicStack.push(value);
+ $callDeferred(null, null, true);
+};
+var $recover = function() {
+ if ($panicStackDepth === null || ($panicStackDepth !== undefined && $panicStackDepth !== $getStackDepth() - 2)) {
+ return $ifaceNil;
+ }
+ $panicStackDepth = null;
+ return $panicValue;
+};
+var $throw = function(err) { throw err; };
+
+var $noGoroutine = { asleep: false, exit: false, deferStack: [], panicStack: [] };
+var $curGoroutine = $noGoroutine, $totalGoroutines = 0, $awakeGoroutines = 0, $checkForDeadlock = true;
+var $mainFinished = false;
+var $go = function(fun, args) {
+ $totalGoroutines++;
+ $awakeGoroutines++;
+ var $goroutine = function() {
+ try {
+ $curGoroutine = $goroutine;
+ var r = fun.apply(undefined, args);
+ if (r && r.$blk !== undefined) {
+ fun = function() { return r.$blk(); };
+ args = [];
+ return;
+ }
+ $goroutine.exit = true;
+ } catch (err) {
+ if (!$goroutine.exit) {
+ throw err;
+ }
+ } finally {
+ $curGoroutine = $noGoroutine;
+ if ($goroutine.exit) { /* also set by runtime.Goexit() */
+ $totalGoroutines--;
+ $goroutine.asleep = true;
+ }
+ if ($goroutine.asleep) {
+ $awakeGoroutines--;
+ if (!$mainFinished && $awakeGoroutines === 0 && $checkForDeadlock) {
+ console.error("fatal error: all goroutines are asleep - deadlock!");
+ if ($global.process !== undefined) {
+ $global.process.exit(2);
+ }
+ }
+ }
+ }
+ };
+ $goroutine.asleep = false;
+ $goroutine.exit = false;
+ $goroutine.deferStack = [];
+ $goroutine.panicStack = [];
+ $schedule($goroutine);
+};
+
+var $scheduled = [];
+var $runScheduled = function() {
+ try {
+ var r;
+ while ((r = $scheduled.shift()) !== undefined) {
+ r();
+ }
+ } finally {
+ if ($scheduled.length > 0) {
+ setTimeout($runScheduled, 0);
+ }
+ }
+};
+
+var $schedule = function(goroutine) {
+ if (goroutine.asleep) {
+ goroutine.asleep = false;
+ $awakeGoroutines++;
+ }
+ $scheduled.push(goroutine);
+ if ($curGoroutine === $noGoroutine) {
+ $runScheduled();
+ }
+};
+
+var $setTimeout = function(f, t) {
+ $awakeGoroutines++;
+ return setTimeout(function() {
+ $awakeGoroutines--;
+ f();
+ }, t);
+};
+
+var $block = function() {
+ if ($curGoroutine === $noGoroutine) {
+ $throwRuntimeError("cannot block in JavaScript callback, fix by wrapping code in goroutine");
+ }
+ $curGoroutine.asleep = true;
+};
+
+var $send = function(chan, value) {
+ if (chan.$closed) {
+ $throwRuntimeError("send on closed channel");
+ }
+ var queuedRecv = chan.$recvQueue.shift();
+ if (queuedRecv !== undefined) {
+ queuedRecv([value, true]);
+ return;
+ }
+ if (chan.$buffer.length < chan.$capacity) {
+ chan.$buffer.push(value);
+ return;
+ }
+
+ var thisGoroutine = $curGoroutine;
+ var closedDuringSend;
+ chan.$sendQueue.push(function(closed) {
+ closedDuringSend = closed;
+ $schedule(thisGoroutine);
+ return value;
+ });
+ $block();
+ return {
+ $blk: function() {
+ if (closedDuringSend) {
+ $throwRuntimeError("send on closed channel");
+ }
+ }
+ };
+};
+var $recv = function(chan) {
+ var queuedSend = chan.$sendQueue.shift();
+ if (queuedSend !== undefined) {
+ chan.$buffer.push(queuedSend(false));
+ }
+ var bufferedValue = chan.$buffer.shift();
+ if (bufferedValue !== undefined) {
+ return [bufferedValue, true];
+ }
+ if (chan.$closed) {
+ return [chan.$elem.zero(), false];
+ }
+
+ var thisGoroutine = $curGoroutine;
+ var f = { $blk: function() { return this.value; } };
+ var queueEntry = function(v) {
+ f.value = v;
+ $schedule(thisGoroutine);
+ };
+ chan.$recvQueue.push(queueEntry);
+ $block();
+ return f;
+};
+var $close = function(chan) {
+ if (chan.$closed) {
+ $throwRuntimeError("close of closed channel");
+ }
+ chan.$closed = true;
+ while (true) {
+ var queuedSend = chan.$sendQueue.shift();
+ if (queuedSend === undefined) {
+ break;
+ }
+ queuedSend(true); /* will panic */
+ }
+ while (true) {
+ var queuedRecv = chan.$recvQueue.shift();
+ if (queuedRecv === undefined) {
+ break;
+ }
+ queuedRecv([chan.$elem.zero(), false]);
+ }
+};
+var $select = function(comms) {
+ var ready = [];
+ var selection = -1;
+ for (var i = 0; i < comms.length; i++) {
+ var comm = comms[i];
+ var chan = comm[0];
+ switch (comm.length) {
+ case 0: /* default */
+ selection = i;
+ break;
+ case 1: /* recv */
+ if (chan.$sendQueue.length !== 0 || chan.$buffer.length !== 0 || chan.$closed) {
+ ready.push(i);
+ }
+ break;
+ case 2: /* send */
+ if (chan.$closed) {
+ $throwRuntimeError("send on closed channel");
+ }
+ if (chan.$recvQueue.length !== 0 || chan.$buffer.length < chan.$capacity) {
+ ready.push(i);
+ }
+ break;
+ }
+ }
+
+ if (ready.length !== 0) {
+ selection = ready[Math.floor(Math.random() * ready.length)];
+ }
+ if (selection !== -1) {
+ var comm = comms[selection];
+ switch (comm.length) {
+ case 0: /* default */
+ return [selection];
+ case 1: /* recv */
+ return [selection, $recv(comm[0])];
+ case 2: /* send */
+ $send(comm[0], comm[1]);
+ return [selection];
+ }
+ }
+
+ var entries = [];
+ var thisGoroutine = $curGoroutine;
+ var f = { $blk: function() { return this.selection; } };
+ var removeFromQueues = function() {
+ for (var i = 0; i < entries.length; i++) {
+ var entry = entries[i];
+ var queue = entry[0];
+ var index = queue.indexOf(entry[1]);
+ if (index !== -1) {
+ queue.splice(index, 1);
+ }
+ }
+ };
+ for (var i = 0; i < comms.length; i++) {
+ (function(i) {
+ var comm = comms[i];
+ switch (comm.length) {
+ case 1: /* recv */
+ var queueEntry = function(value) {
+ f.selection = [i, value];
+ removeFromQueues();
+ $schedule(thisGoroutine);
+ };
+ entries.push([comm[0].$recvQueue, queueEntry]);
+ comm[0].$recvQueue.push(queueEntry);
+ break;
+ case 2: /* send */
+ var queueEntry = function() {
+ if (comm[0].$closed) {
+ $throwRuntimeError("send on closed channel");
+ }
+ f.selection = [i];
+ removeFromQueues();
+ $schedule(thisGoroutine);
+ return comm[1];
+ };
+ entries.push([comm[0].$sendQueue, queueEntry]);
+ comm[0].$sendQueue.push(queueEntry);
+ break;
+ }
+ })(i);
+ }
+ $block();
+ return f;
+};
+`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/jsmapping.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/jsmapping.go
new file mode 100644
index 00000000000..dc29cba6bc4
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/jsmapping.go
@@ -0,0 +1,379 @@
+package prelude
+
+const jsmapping = `
+var $jsObjectPtr, $jsErrorPtr;
+
+var $needsExternalization = function(t) {
+ switch (t.kind) {
+ case $kindBool:
+ case $kindInt:
+ case $kindInt8:
+ case $kindInt16:
+ case $kindInt32:
+ case $kindUint:
+ case $kindUint8:
+ case $kindUint16:
+ case $kindUint32:
+ case $kindUintptr:
+ case $kindFloat32:
+ case $kindFloat64:
+ return false;
+ default:
+ return t !== $jsObjectPtr;
+ }
+};
+
+var $externalize = function(v, t) {
+ if (t === $jsObjectPtr) {
+ return v;
+ }
+ switch (t.kind) {
+ case $kindBool:
+ case $kindInt:
+ case $kindInt8:
+ case $kindInt16:
+ case $kindInt32:
+ case $kindUint:
+ case $kindUint8:
+ case $kindUint16:
+ case $kindUint32:
+ case $kindUintptr:
+ case $kindFloat32:
+ case $kindFloat64:
+ return v;
+ case $kindInt64:
+ case $kindUint64:
+ return $flatten64(v);
+ case $kindArray:
+ if ($needsExternalization(t.elem)) {
+ return $mapArray(v, function(e) { return $externalize(e, t.elem); });
+ }
+ return v;
+ case $kindFunc:
+ return $externalizeFunction(v, t, false);
+ case $kindInterface:
+ if (v === $ifaceNil) {
+ return null;
+ }
+ if (v.constructor === $jsObjectPtr) {
+ return v.$val.object;
+ }
+ return $externalize(v.$val, v.constructor);
+ case $kindMap:
+ var m = {};
+ var keys = $keys(v);
+ for (var i = 0; i < keys.length; i++) {
+ var entry = v[keys[i]];
+ m[$externalize(entry.k, t.key)] = $externalize(entry.v, t.elem);
+ }
+ return m;
+ case $kindPtr:
+ if (v === t.nil) {
+ return null;
+ }
+ return $externalize(v.$get(), t.elem);
+ case $kindSlice:
+ if ($needsExternalization(t.elem)) {
+ return $mapArray($sliceToArray(v), function(e) { return $externalize(e, t.elem); });
+ }
+ return $sliceToArray(v);
+ case $kindString:
+ if ($isASCII(v)) {
+ return v;
+ }
+ var s = "", r;
+ for (var i = 0; i < v.length; i += r[1]) {
+ r = $decodeRune(v, i);
+ var c = r[0];
+ if (c > 0xFFFF) {
+ var h = Math.floor((c - 0x10000) / 0x400) + 0xD800;
+ var l = (c - 0x10000) % 0x400 + 0xDC00;
+ s += String.fromCharCode(h, l);
+ continue;
+ }
+ s += String.fromCharCode(c);
+ }
+ return s;
+ case $kindStruct:
+ var timePkg = $packages["time"];
+ if (timePkg !== undefined && v.constructor === timePkg.Time.ptr) {
+ var milli = $div64(v.UnixNano(), new $Int64(0, 1000000));
+ return new Date($flatten64(milli));
+ }
+
+ var noJsObject = {};
+ var searchJsObject = function(v, t) {
+ if (t === $jsObjectPtr) {
+ return v;
+ }
+ switch (t.kind) {
+ case $kindPtr:
+ if (v === t.nil) {
+ return noJsObject;
+ }
+ return searchJsObject(v.$get(), t.elem);
+ case $kindStruct:
+ var f = t.fields[0];
+ return searchJsObject(v[f.prop], f.typ);
+ case $kindInterface:
+ return searchJsObject(v.$val, v.constructor);
+ default:
+ return noJsObject;
+ }
+ };
+ var o = searchJsObject(v, t);
+ if (o !== noJsObject) {
+ return o;
+ }
+
+ o = {};
+ for (var i = 0; i < t.fields.length; i++) {
+ var f = t.fields[i];
+ if (!f.exported) {
+ continue;
+ }
+ o[f.name] = $externalize(v[f.prop], f.typ);
+ }
+ return o;
+ }
+ $throwRuntimeError("cannot externalize " + t.string);
+};
+
+var $externalizeFunction = function(v, t, passThis) {
+ if (v === $throwNilPointerError) {
+ return null;
+ }
+ if (v.$externalizeWrapper === undefined) {
+ $checkForDeadlock = false;
+ v.$externalizeWrapper = function() {
+ var args = [];
+ for (var i = 0; i < t.params.length; i++) {
+ if (t.variadic && i === t.params.length - 1) {
+ var vt = t.params[i].elem, varargs = [];
+ for (var j = i; j < arguments.length; j++) {
+ varargs.push($internalize(arguments[j], vt));
+ }
+ args.push(new (t.params[i])(varargs));
+ break;
+ }
+ args.push($internalize(arguments[i], t.params[i]));
+ }
+ var result = v.apply(passThis ? this : undefined, args);
+ switch (t.results.length) {
+ case 0:
+ return;
+ case 1:
+ return $externalize(result, t.results[0]);
+ default:
+ for (var i = 0; i < t.results.length; i++) {
+ result[i] = $externalize(result[i], t.results[i]);
+ }
+ return result;
+ }
+ };
+ }
+ return v.$externalizeWrapper;
+};
+
+var $internalize = function(v, t, recv) {
+ if (t === $jsObjectPtr) {
+ return v;
+ }
+ if (t === $jsObjectPtr.elem) {
+ $throwRuntimeError("cannot internalize js.Object, use *js.Object instead");
+ }
+ if (v && v.__internal_object__ !== undefined) {
+ return $assertType(v.__internal_object__, t, false);
+ }
+ var timePkg = $packages["time"];
+ if (timePkg !== undefined && t === timePkg.Time) {
+ if (!(v !== null && v !== undefined && v.constructor === Date)) {
+ $throwRuntimeError("cannot internalize time.Time from " + typeof v + ", must be Date");
+ }
+ return timePkg.Unix(new $Int64(0, 0), new $Int64(0, v.getTime() * 1000000));
+ }
+ switch (t.kind) {
+ case $kindBool:
+ return !!v;
+ case $kindInt:
+ return parseInt(v);
+ case $kindInt8:
+ return parseInt(v) << 24 >> 24;
+ case $kindInt16:
+ return parseInt(v) << 16 >> 16;
+ case $kindInt32:
+ return parseInt(v) >> 0;
+ case $kindUint:
+ return parseInt(v);
+ case $kindUint8:
+ return parseInt(v) << 24 >>> 24;
+ case $kindUint16:
+ return parseInt(v) << 16 >>> 16;
+ case $kindUint32:
+ case $kindUintptr:
+ return parseInt(v) >>> 0;
+ case $kindInt64:
+ case $kindUint64:
+ return new t(0, v);
+ case $kindFloat32:
+ case $kindFloat64:
+ return parseFloat(v);
+ case $kindArray:
+ if (v.length !== t.len) {
+ $throwRuntimeError("got array with wrong size from JavaScript native");
+ }
+ return $mapArray(v, function(e) { return $internalize(e, t.elem); });
+ case $kindFunc:
+ return function() {
+ var args = [];
+ for (var i = 0; i < t.params.length; i++) {
+ if (t.variadic && i === t.params.length - 1) {
+ var vt = t.params[i].elem, varargs = arguments[i];
+ for (var j = 0; j < varargs.$length; j++) {
+ args.push($externalize(varargs.$array[varargs.$offset + j], vt));
+ }
+ break;
+ }
+ args.push($externalize(arguments[i], t.params[i]));
+ }
+ var result = v.apply(recv, args);
+ switch (t.results.length) {
+ case 0:
+ return;
+ case 1:
+ return $internalize(result, t.results[0]);
+ default:
+ for (var i = 0; i < t.results.length; i++) {
+ result[i] = $internalize(result[i], t.results[i]);
+ }
+ return result;
+ }
+ };
+ case $kindInterface:
+ if (t.methods.length !== 0) {
+ $throwRuntimeError("cannot internalize " + t.string);
+ }
+ if (v === null) {
+ return $ifaceNil;
+ }
+ if (v === undefined) {
+ return new $jsObjectPtr(undefined);
+ }
+ switch (v.constructor) {
+ case Int8Array:
+ return new ($sliceType($Int8))(v);
+ case Int16Array:
+ return new ($sliceType($Int16))(v);
+ case Int32Array:
+ return new ($sliceType($Int))(v);
+ case Uint8Array:
+ return new ($sliceType($Uint8))(v);
+ case Uint16Array:
+ return new ($sliceType($Uint16))(v);
+ case Uint32Array:
+ return new ($sliceType($Uint))(v);
+ case Float32Array:
+ return new ($sliceType($Float32))(v);
+ case Float64Array:
+ return new ($sliceType($Float64))(v);
+ case Array:
+ return $internalize(v, $sliceType($emptyInterface));
+ case Boolean:
+ return new $Bool(!!v);
+ case Date:
+ if (timePkg === undefined) {
+ /* time package is not present, internalize as &js.Object{Date} so it can be externalized into original Date. */
+ return new $jsObjectPtr(v);
+ }
+ return new timePkg.Time($internalize(v, timePkg.Time));
+ case Function:
+ var funcType = $funcType([$sliceType($emptyInterface)], [$jsObjectPtr], true);
+ return new funcType($internalize(v, funcType));
+ case Number:
+ return new $Float64(parseFloat(v));
+ case String:
+ return new $String($internalize(v, $String));
+ default:
+ if ($global.Node && v instanceof $global.Node) {
+ return new $jsObjectPtr(v);
+ }
+ var mapType = $mapType($String, $emptyInterface);
+ return new mapType($internalize(v, mapType));
+ }
+ case $kindMap:
+ var m = {};
+ var keys = $keys(v);
+ for (var i = 0; i < keys.length; i++) {
+ var k = $internalize(keys[i], t.key);
+ m[t.key.keyFor(k)] = { k: k, v: $internalize(v[keys[i]], t.elem) };
+ }
+ return m;
+ case $kindPtr:
+ if (t.elem.kind === $kindStruct) {
+ return $internalize(v, t.elem);
+ }
+ case $kindSlice:
+ return new t($mapArray(v, function(e) { return $internalize(e, t.elem); }));
+ case $kindString:
+ v = String(v);
+ if ($isASCII(v)) {
+ return v;
+ }
+ var s = "";
+ var i = 0;
+ while (i < v.length) {
+ var h = v.charCodeAt(i);
+ if (0xD800 <= h && h <= 0xDBFF) {
+ var l = v.charCodeAt(i + 1);
+ var c = (h - 0xD800) * 0x400 + l - 0xDC00 + 0x10000;
+ s += $encodeRune(c);
+ i += 2;
+ continue;
+ }
+ s += $encodeRune(h);
+ i++;
+ }
+ return s;
+ case $kindStruct:
+ var noJsObject = {};
+ var searchJsObject = function(t) {
+ if (t === $jsObjectPtr) {
+ return v;
+ }
+ if (t === $jsObjectPtr.elem) {
+ $throwRuntimeError("cannot internalize js.Object, use *js.Object instead");
+ }
+ switch (t.kind) {
+ case $kindPtr:
+ return searchJsObject(t.elem);
+ case $kindStruct:
+ var f = t.fields[0];
+ var o = searchJsObject(f.typ);
+ if (o !== noJsObject) {
+ var n = new t.ptr();
+ n[f.prop] = o;
+ return n;
+ }
+ return noJsObject;
+ default:
+ return noJsObject;
+ }
+ };
+ var o = searchJsObject(t);
+ if (o !== noJsObject) {
+ return o;
+ }
+ }
+ $throwRuntimeError("cannot internalize " + t.string);
+};
+
+/* $isASCII reports whether string s contains only ASCII characters. */
+var $isASCII = function(s) {
+ for (var i = 0; i < s.length; i++) {
+ if (s.charCodeAt(i) >= 128) {
+ return false;
+ }
+ }
+ return true;
+};
+`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/numeric.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/numeric.go
new file mode 100644
index 00000000000..063d09f46e2
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/numeric.go
@@ -0,0 +1,196 @@
+package prelude
+
+const numeric = `
+var $min = Math.min;
+var $mod = function(x, y) { return x % y; };
+var $parseInt = parseInt;
+var $parseFloat = function(f) {
+ if (f !== undefined && f !== null && f.constructor === Number) {
+ return f;
+ }
+ return parseFloat(f);
+};
+
+var $froundBuf = new Float32Array(1);
+var $fround = Math.fround || function(f) {
+ $froundBuf[0] = f;
+ return $froundBuf[0];
+};
+
+var $imul = Math.imul || function(a, b) {
+ var ah = (a >>> 16) & 0xffff;
+ var al = a & 0xffff;
+ var bh = (b >>> 16) & 0xffff;
+ var bl = b & 0xffff;
+ return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) >> 0);
+};
+
+var $floatKey = function(f) {
+ if (f !== f) {
+ $idCounter++;
+ return "NaN$" + $idCounter;
+ }
+ return String(f);
+};
+
+var $flatten64 = function(x) {
+ return x.$high * 4294967296 + x.$low;
+};
+
+var $shiftLeft64 = function(x, y) {
+ if (y === 0) {
+ return x;
+ }
+ if (y < 32) {
+ return new x.constructor(x.$high << y | x.$low >>> (32 - y), (x.$low << y) >>> 0);
+ }
+ if (y < 64) {
+ return new x.constructor(x.$low << (y - 32), 0);
+ }
+ return new x.constructor(0, 0);
+};
+
+var $shiftRightInt64 = function(x, y) {
+ if (y === 0) {
+ return x;
+ }
+ if (y < 32) {
+ return new x.constructor(x.$high >> y, (x.$low >>> y | x.$high << (32 - y)) >>> 0);
+ }
+ if (y < 64) {
+ return new x.constructor(x.$high >> 31, (x.$high >> (y - 32)) >>> 0);
+ }
+ if (x.$high < 0) {
+ return new x.constructor(-1, 4294967295);
+ }
+ return new x.constructor(0, 0);
+};
+
+var $shiftRightUint64 = function(x, y) {
+ if (y === 0) {
+ return x;
+ }
+ if (y < 32) {
+ return new x.constructor(x.$high >>> y, (x.$low >>> y | x.$high << (32 - y)) >>> 0);
+ }
+ if (y < 64) {
+ return new x.constructor(0, x.$high >>> (y - 32));
+ }
+ return new x.constructor(0, 0);
+};
+
+var $mul64 = function(x, y) {
+ var high = 0, low = 0;
+ if ((y.$low & 1) !== 0) {
+ high = x.$high;
+ low = x.$low;
+ }
+ for (var i = 1; i < 32; i++) {
+ if ((y.$low & 1<<i) !== 0) {
+ high += x.$high << i | x.$low >>> (32 - i);
+ low += (x.$low << i) >>> 0;
+ }
+ }
+ for (var i = 0; i < 32; i++) {
+ if ((y.$high & 1<<i) !== 0) {
+ high += x.$low << i;
+ }
+ }
+ return new x.constructor(high, low);
+};
+
+var $div64 = function(x, y, returnRemainder) {
+ if (y.$high === 0 && y.$low === 0) {
+ $throwRuntimeError("integer divide by zero");
+ }
+
+ var s = 1;
+ var rs = 1;
+
+ var xHigh = x.$high;
+ var xLow = x.$low;
+ if (xHigh < 0) {
+ s = -1;
+ rs = -1;
+ xHigh = -xHigh;
+ if (xLow !== 0) {
+ xHigh--;
+ xLow = 4294967296 - xLow;
+ }
+ }
+
+ var yHigh = y.$high;
+ var yLow = y.$low;
+ if (y.$high < 0) {
+ s *= -1;
+ yHigh = -yHigh;
+ if (yLow !== 0) {
+ yHigh--;
+ yLow = 4294967296 - yLow;
+ }
+ }
+
+ var high = 0, low = 0, n = 0;
+ while (yHigh < 2147483648 && ((xHigh > yHigh) || (xHigh === yHigh && xLow > yLow))) {
+ yHigh = (yHigh << 1 | yLow >>> 31) >>> 0;
+ yLow = (yLow << 1) >>> 0;
+ n++;
+ }
+ for (var i = 0; i <= n; i++) {
+ high = high << 1 | low >>> 31;
+ low = (low << 1) >>> 0;
+ if ((xHigh > yHigh) || (xHigh === yHigh && xLow >= yLow)) {
+ xHigh = xHigh - yHigh;
+ xLow = xLow - yLow;
+ if (xLow < 0) {
+ xHigh--;
+ xLow += 4294967296;
+ }
+ low++;
+ if (low === 4294967296) {
+ high++;
+ low = 0;
+ }
+ }
+ yLow = (yLow >>> 1 | yHigh << (32 - 1)) >>> 0;
+ yHigh = yHigh >>> 1;
+ }
+
+ if (returnRemainder) {
+ return new x.constructor(xHigh * rs, xLow * rs);
+ }
+ return new x.constructor(high * s, low * s);
+};
+
+var $divComplex = function(n, d) {
+ var ninf = n.$real === Infinity || n.$real === -Infinity || n.$imag === Infinity || n.$imag === -Infinity;
+ var dinf = d.$real === Infinity || d.$real === -Infinity || d.$imag === Infinity || d.$imag === -Infinity;
+ var nnan = !ninf && (n.$real !== n.$real || n.$imag !== n.$imag);
+ var dnan = !dinf && (d.$real !== d.$real || d.$imag !== d.$imag);
+ if(nnan || dnan) {
+ return new n.constructor(NaN, NaN);
+ }
+ if (ninf && !dinf) {
+ return new n.constructor(Infinity, Infinity);
+ }
+ if (!ninf && dinf) {
+ return new n.constructor(0, 0);
+ }
+ if (d.$real === 0 && d.$imag === 0) {
+ if (n.$real === 0 && n.$imag === 0) {
+ return new n.constructor(NaN, NaN);
+ }
+ return new n.constructor(Infinity, Infinity);
+ }
+ var a = Math.abs(d.$real);
+ var b = Math.abs(d.$imag);
+ if (a <= b) {
+ var ratio = d.$real / d.$imag;
+ var denom = d.$real * ratio + d.$imag;
+ return new n.constructor((n.$real * ratio + n.$imag) / denom, (n.$imag * ratio - n.$real) / denom);
+ }
+ var ratio = d.$imag / d.$real;
+ var denom = d.$imag * ratio + d.$real;
+ return new n.constructor((n.$imag * ratio + n.$real) / denom, (n.$imag - n.$real * ratio) / denom);
+};
+`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude.go
new file mode 100644
index 00000000000..c27601e8854
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude.go
@@ -0,0 +1,425 @@
+package prelude
+
+//go:generate go run genmin.go
+
+// Prelude is the GopherJS JavaScript interop layer.
+const Prelude = prelude + numeric + types + goroutines + jsmapping
+
+const prelude = `Error.stackTraceLimit = Infinity;
+
+var $global, $module;
+if (typeof window !== "undefined") { /* web page */
+ $global = window;
+} else if (typeof self !== "undefined") { /* web worker */
+ $global = self;
+} else if (typeof global !== "undefined") { /* Node.js */
+ $global = global;
+ $global.require = require;
+} else { /* others (e.g. Nashorn) */
+ $global = this;
+}
+
+if ($global === undefined || $global.Array === undefined) {
+ throw new Error("no global object found");
+}
+if (typeof module !== "undefined") {
+ $module = module;
+}
+
+var $packages = {}, $idCounter = 0;
+var $keys = function(m) { return m ? Object.keys(m) : []; };
+var $flushConsole = function() {};
+var $throwRuntimeError; /* set by package "runtime" */
+var $throwNilPointerError = function() { $throwRuntimeError("invalid memory address or nil pointer dereference"); };
+var $call = function(fn, rcvr, args) { return fn.apply(rcvr, args); };
+var $makeFunc = function(fn) { return function() { return $externalize(fn(this, new ($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(arguments, []))), $emptyInterface); }; };
+var $unused = function(v) {};
+
+var $mapArray = function(array, f) {
+ var newArray = new array.constructor(array.length);
+ for (var i = 0; i < array.length; i++) {
+ newArray[i] = f(array[i]);
+ }
+ return newArray;
+};
+
+var $methodVal = function(recv, name) {
+ var vals = recv.$methodVals || {};
+ recv.$methodVals = vals; /* noop for primitives */
+ var f = vals[name];
+ if (f !== undefined) {
+ return f;
+ }
+ var method = recv[name];
+ f = function() {
+ $stackDepthOffset--;
+ try {
+ return method.apply(recv, arguments);
+ } finally {
+ $stackDepthOffset++;
+ }
+ };
+ vals[name] = f;
+ return f;
+};
+
+var $methodExpr = function(typ, name) {
+ var method = typ.prototype[name];
+ if (method.$expr === undefined) {
+ method.$expr = function() {
+ $stackDepthOffset--;
+ try {
+ if (typ.wrapped) {
+ arguments[0] = new typ(arguments[0]);
+ }
+ return Function.call.apply(method, arguments);
+ } finally {
+ $stackDepthOffset++;
+ }
+ };
+ }
+ return method.$expr;
+};
+
+var $ifaceMethodExprs = {};
+var $ifaceMethodExpr = function(name) {
+ var expr = $ifaceMethodExprs["$" + name];
+ if (expr === undefined) {
+ expr = $ifaceMethodExprs["$" + name] = function() {
+ $stackDepthOffset--;
+ try {
+ return Function.call.apply(arguments[0][name], arguments);
+ } finally {
+ $stackDepthOffset++;
+ }
+ };
+ }
+ return expr;
+};
+
+var $subslice = function(slice, low, high, max) {
+ if (high === undefined) {
+ high = slice.$length;
+ }
+ if (max === undefined) {
+ max = slice.$capacity;
+ }
+ if (low < 0 || high < low || max < high || high > slice.$capacity || max > slice.$capacity) {
+ $throwRuntimeError("slice bounds out of range");
+ }
+ if (slice === slice.constructor.nil) {
+ return slice;
+ }
+ var s = new slice.constructor(slice.$array);
+ s.$offset = slice.$offset + low;
+ s.$length = high - low;
+ s.$capacity = max - low;
+ return s;
+};
+
+var $substring = function(str, low, high) {
+ if (low < 0 || high < low || high > str.length) {
+ $throwRuntimeError("slice bounds out of range");
+ }
+ return str.substring(low, high);
+};
+
+var $sliceToArray = function(slice) {
+ if (slice.$array.constructor !== Array) {
+ return slice.$array.subarray(slice.$offset, slice.$offset + slice.$length);
+ }
+ return slice.$array.slice(slice.$offset, slice.$offset + slice.$length);
+};
+
+var $decodeRune = function(str, pos) {
+ var c0 = str.charCodeAt(pos);
+
+ if (c0 < 0x80) {
+ return [c0, 1];
+ }
+
+ if (c0 !== c0 || c0 < 0xC0) {
+ return [0xFFFD, 1];
+ }
+
+ var c1 = str.charCodeAt(pos + 1);
+ if (c1 !== c1 || c1 < 0x80 || 0xC0 <= c1) {
+ return [0xFFFD, 1];
+ }
+
+ if (c0 < 0xE0) {
+ var r = (c0 & 0x1F) << 6 | (c1 & 0x3F);
+ if (r <= 0x7F) {
+ return [0xFFFD, 1];
+ }
+ return [r, 2];
+ }
+
+ var c2 = str.charCodeAt(pos + 2);
+ if (c2 !== c2 || c2 < 0x80 || 0xC0 <= c2) {
+ return [0xFFFD, 1];
+ }
+
+ if (c0 < 0xF0) {
+ var r = (c0 & 0x0F) << 12 | (c1 & 0x3F) << 6 | (c2 & 0x3F);
+ if (r <= 0x7FF) {
+ return [0xFFFD, 1];
+ }
+ if (0xD800 <= r && r <= 0xDFFF) {
+ return [0xFFFD, 1];
+ }
+ return [r, 3];
+ }
+
+ var c3 = str.charCodeAt(pos + 3);
+ if (c3 !== c3 || c3 < 0x80 || 0xC0 <= c3) {
+ return [0xFFFD, 1];
+ }
+
+ if (c0 < 0xF8) {
+ var r = (c0 & 0x07) << 18 | (c1 & 0x3F) << 12 | (c2 & 0x3F) << 6 | (c3 & 0x3F);
+ if (r <= 0xFFFF || 0x10FFFF < r) {
+ return [0xFFFD, 1];
+ }
+ return [r, 4];
+ }
+
+ return [0xFFFD, 1];
+};
+
+var $encodeRune = function(r) {
+ if (r < 0 || r > 0x10FFFF || (0xD800 <= r && r <= 0xDFFF)) {
+ r = 0xFFFD;
+ }
+ if (r <= 0x7F) {
+ return String.fromCharCode(r);
+ }
+ if (r <= 0x7FF) {
+ return String.fromCharCode(0xC0 | r >> 6, 0x80 | (r & 0x3F));
+ }
+ if (r <= 0xFFFF) {
+ return String.fromCharCode(0xE0 | r >> 12, 0x80 | (r >> 6 & 0x3F), 0x80 | (r & 0x3F));
+ }
+ return String.fromCharCode(0xF0 | r >> 18, 0x80 | (r >> 12 & 0x3F), 0x80 | (r >> 6 & 0x3F), 0x80 | (r & 0x3F));
+};
+
+var $stringToBytes = function(str) {
+ var array = new Uint8Array(str.length);
+ for (var i = 0; i < str.length; i++) {
+ array[i] = str.charCodeAt(i);
+ }
+ return array;
+};
+
+var $bytesToString = function(slice) {
+ if (slice.$length === 0) {
+ return "";
+ }
+ var str = "";
+ for (var i = 0; i < slice.$length; i += 10000) {
+ str += String.fromCharCode.apply(undefined, slice.$array.subarray(slice.$offset + i, slice.$offset + Math.min(slice.$length, i + 10000)));
+ }
+ return str;
+};
+
+var $stringToRunes = function(str) {
+ var array = new Int32Array(str.length);
+ var rune, j = 0;
+ for (var i = 0; i < str.length; i += rune[1], j++) {
+ rune = $decodeRune(str, i);
+ array[j] = rune[0];
+ }
+ return array.subarray(0, j);
+};
+
+var $runesToString = function(slice) {
+ if (slice.$length === 0) {
+ return "";
+ }
+ var str = "";
+ for (var i = 0; i < slice.$length; i++) {
+ str += $encodeRune(slice.$array[slice.$offset + i]);
+ }
+ return str;
+};
+
+var $copyString = function(dst, src) {
+ var n = Math.min(src.length, dst.$length);
+ for (var i = 0; i < n; i++) {
+ dst.$array[dst.$offset + i] = src.charCodeAt(i);
+ }
+ return n;
+};
+
+var $copySlice = function(dst, src) {
+ var n = Math.min(src.$length, dst.$length);
+ $copyArray(dst.$array, src.$array, dst.$offset, src.$offset, n, dst.constructor.elem);
+ return n;
+};
+
+var $copyArray = function(dst, src, dstOffset, srcOffset, n, elem) {
+ if (n === 0 || (dst === src && dstOffset === srcOffset)) {
+ return;
+ }
+
+ if (src.subarray) {
+ dst.set(src.subarray(srcOffset, srcOffset + n), dstOffset);
+ return;
+ }
+
+ switch (elem.kind) {
+ case $kindArray:
+ case $kindStruct:
+ if (dst === src && dstOffset > srcOffset) {
+ for (var i = n - 1; i >= 0; i--) {
+ elem.copy(dst[dstOffset + i], src[srcOffset + i]);
+ }
+ return;
+ }
+ for (var i = 0; i < n; i++) {
+ elem.copy(dst[dstOffset + i], src[srcOffset + i]);
+ }
+ return;
+ }
+
+ if (dst === src && dstOffset > srcOffset) {
+ for (var i = n - 1; i >= 0; i--) {
+ dst[dstOffset + i] = src[srcOffset + i];
+ }
+ return;
+ }
+ for (var i = 0; i < n; i++) {
+ dst[dstOffset + i] = src[srcOffset + i];
+ }
+};
+
+var $clone = function(src, type) {
+ var clone = type.zero();
+ type.copy(clone, src);
+ return clone;
+};
+
+var $pointerOfStructConversion = function(obj, type) {
+ if(obj.$proxies === undefined) {
+ obj.$proxies = {};
+ obj.$proxies[obj.constructor.string] = obj;
+ }
+ var proxy = obj.$proxies[type.string];
+ if (proxy === undefined) {
+ var properties = {};
+ for (var i = 0; i < type.elem.fields.length; i++) {
+ (function(fieldProp) {
+ properties[fieldProp] = {
+ get: function() { return obj[fieldProp]; },
+ set: function(value) { obj[fieldProp] = value; }
+ };
+ })(type.elem.fields[i].prop);
+ }
+ proxy = Object.create(type.prototype, properties);
+ proxy.$val = proxy;
+ obj.$proxies[type.string] = proxy;
+ proxy.$proxies = obj.$proxies;
+ }
+ return proxy;
+};
+
+var $append = function(slice) {
+ return $internalAppend(slice, arguments, 1, arguments.length - 1);
+};
+
+var $appendSlice = function(slice, toAppend) {
+ if (toAppend.constructor === String) {
+ var bytes = $stringToBytes(toAppend);
+ return $internalAppend(slice, bytes, 0, bytes.length);
+ }
+ return $internalAppend(slice, toAppend.$array, toAppend.$offset, toAppend.$length);
+};
+
+var $internalAppend = function(slice, array, offset, length) {
+ if (length === 0) {
+ return slice;
+ }
+
+ var newArray = slice.$array;
+ var newOffset = slice.$offset;
+ var newLength = slice.$length + length;
+ var newCapacity = slice.$capacity;
+
+ if (newLength > newCapacity) {
+ newOffset = 0;
+ newCapacity = Math.max(newLength, slice.$capacity < 1024 ? slice.$capacity * 2 : Math.floor(slice.$capacity * 5 / 4));
+
+ if (slice.$array.constructor === Array) {
+ newArray = slice.$array.slice(slice.$offset, slice.$offset + slice.$length);
+ newArray.length = newCapacity;
+ var zero = slice.constructor.elem.zero;
+ for (var i = slice.$length; i < newCapacity; i++) {
+ newArray[i] = zero();
+ }
+ } else {
+ newArray = new slice.$array.constructor(newCapacity);
+ newArray.set(slice.$array.subarray(slice.$offset, slice.$offset + slice.$length));
+ }
+ }
+
+ $copyArray(newArray, array, newOffset + slice.$length, offset, length, slice.constructor.elem);
+
+ var newSlice = new slice.constructor(newArray);
+ newSlice.$offset = newOffset;
+ newSlice.$length = newLength;
+ newSlice.$capacity = newCapacity;
+ return newSlice;
+};
+
+var $equal = function(a, b, type) {
+ if (type === $jsObjectPtr) {
+ return a === b;
+ }
+ switch (type.kind) {
+ case $kindComplex64:
+ case $kindComplex128:
+ return a.$real === b.$real && a.$imag === b.$imag;
+ case $kindInt64:
+ case $kindUint64:
+ return a.$high === b.$high && a.$low === b.$low;
+ case $kindArray:
+ if (a.length !== b.length) {
+ return false;
+ }
+ for (var i = 0; i < a.length; i++) {
+ if (!$equal(a[i], b[i], type.elem)) {
+ return false;
+ }
+ }
+ return true;
+ case $kindStruct:
+ for (var i = 0; i < type.fields.length; i++) {
+ var f = type.fields[i];
+ if (!$equal(a[f.prop], b[f.prop], f.typ)) {
+ return false;
+ }
+ }
+ return true;
+ case $kindInterface:
+ return $interfaceIsEqual(a, b);
+ default:
+ return a === b;
+ }
+};
+
+var $interfaceIsEqual = function(a, b) {
+ if (a === $ifaceNil || b === $ifaceNil) {
+ return a === b;
+ }
+ if (a.constructor !== b.constructor) {
+ return false;
+ }
+ if (a.constructor === $jsObjectPtr) {
+ return a.object === b.object;
+ }
+ if (!a.constructor.comparable) {
+ $throwRuntimeError("comparing uncomparable type " + a.constructor.string);
+ }
+ return $equal(a.$val, b.$val, a.constructor);
+};
+`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude_min.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude_min.go
new file mode 100644
index 00000000000..0918ffa0bf0
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/prelude_min.go
@@ -0,0 +1,6 @@
+// Code generated by genmin; DO NOT EDIT.
+
+package prelude
+
+// Minified is an uglifyjs-minified version of Prelude.
+const Minified = "var $global,$module;if(Error.stackTraceLimit=1/0,\"undefined\"!=typeof window?$global=window:\"undefined\"!=typeof self?$global=self:\"undefined\"!=typeof global?($global=global).require=require:$global=this,void 0===$global||void 0===$global.Array)throw new Error(\"no global object found\");\"undefined\"!=typeof module&&($module=module);var $throwRuntimeError,$packages={},$idCounter=0,$keys=function(e){return e?Object.keys(e):[]},$flushConsole=function(){},$throwNilPointerError=function(){$throwRuntimeError(\"invalid memory address or nil pointer dereference\")},$call=function(e,n,r){return e.apply(n,r)},$makeFunc=function(e){return function(){return $externalize(e(this,new($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(arguments,[]))),$emptyInterface)}},$unused=function(e){},$mapArray=function(e,n){for(var r=new e.constructor(e.length),t=0;t<e.length;t++)r[t]=n(e[t]);return r},$methodVal=function(e,n){var r=e.$methodVals||{};e.$methodVals=r;var t=r[n];if(void 0!==t)return t;var i=e[n];return t=function(){$stackDepthOffset--;try{return i.apply(e,arguments)}finally{$stackDepthOffset++}},r[n]=t,t},$methodExpr=function(e,n){var r=e.prototype[n];return void 0===r.$expr&&(r.$expr=function(){$stackDepthOffset--;try{return e.wrapped&&(arguments[0]=new e(arguments[0])),Function.call.apply(r,arguments)}finally{$stackDepthOffset++}}),r.$expr},$ifaceMethodExprs={},$ifaceMethodExpr=function(e){var n=$ifaceMethodExprs[\"$\"+e];return void 0===n&&(n=$ifaceMethodExprs[\"$\"+e]=function(){$stackDepthOffset--;try{return Function.call.apply(arguments[0][e],arguments)}finally{$stackDepthOffset++}}),n},$subslice=function(e,n,r,t){if(void 0===r&&(r=e.$length),void 0===t&&(t=e.$capacity),(n<0||r<n||t<r||r>e.$capacity||t>e.$capacity)&&$throwRuntimeError(\"slice bounds out of range\"),e===e.constructor.nil)return e;var i=new e.constructor(e.$array);return i.$offset=e.$offset+n,i.$length=r-n,i.$capacity=t-n,i},$substring=function(e,n,r){return(n<0||r<n||r>e.length)&&$throwRuntimeError(\"slice bounds out of range\"),e.substring(n,r)},$sliceToArray=function(e){return e.$array.constructor!==Array?e.$array.subarray(e.$offset,e.$offset+e.$length):e.$array.slice(e.$offset,e.$offset+e.$length)},$decodeRune=function(e,n){var r=e.charCodeAt(n);if(r<128)return[r,1];if(r!=r||r<192)return[65533,1];var t=e.charCodeAt(n+1);if(t!=t||t<128||192<=t)return[65533,1];if(r<224)return(a=(31&r)<<6|63&t)<=127?[65533,1]:[a,2];var i=e.charCodeAt(n+2);if(i!=i||i<128||192<=i)return[65533,1];if(r<240)return(a=(15&r)<<12|(63&t)<<6|63&i)<=2047?[65533,1]:55296<=a&&a<=57343?[65533,1]:[a,3];var a,o=e.charCodeAt(n+3);return o!=o||o<128||192<=o?[65533,1]:r<248?(a=(7&r)<<18|(63&t)<<12|(63&i)<<6|63&o)<=65535||1114111<a?[65533,1]:[a,4]:[65533,1]},$encodeRune=function(e){return(e<0||e>1114111||55296<=e&&e<=57343)&&(e=65533),e<=127?String.fromCharCode(e):e<=2047?String.fromCharCode(192|e>>6,128|63&e):e<=65535?String.fromCharCode(224|e>>12,128|e>>6&63,128|63&e):String.fromCharCode(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e)},$stringToBytes=function(e){for(var n=new Uint8Array(e.length),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n},$bytesToString=function(e){if(0===e.$length)return\"\";for(var n=\"\",r=0;r<e.$length;r+=1e4)n+=String.fromCharCode.apply(void 0,e.$array.subarray(e.$offset+r,e.$offset+Math.min(e.$length,r+1e4)));return n},$stringToRunes=function(e){for(var n,r=new Int32Array(e.length),t=0,i=0;i<e.length;i+=n[1],t++)n=$decodeRune(e,i),r[t]=n[0];return r.subarray(0,t)},$runesToString=function(e){if(0===e.$length)return\"\";for(var n=\"\",r=0;r<e.$length;r++)n+=$encodeRune(e.$array[e.$offset+r]);return n},$copyString=function(e,n){for(var r=Math.min(n.length,e.$length),t=0;t<r;t++)e.$array[e.$offset+t]=n.charCodeAt(t);return r},$copySlice=function(e,n){var r=Math.min(n.$length,e.$length);return $copyArray(e.$array,n.$array,e.$offset,n.$offset,r,e.constructor.elem),r},$copyArray=function(e,n,r,t,i,a){if(0!==i&&(e!==n||r!==t))if(n.subarray)e.set(n.subarray(t,t+i),r);else{switch(a.kind){case $kindArray:case $kindStruct:if(e===n&&r>t){for(var o=i-1;o>=0;o--)a.copy(e[r+o],n[t+o]);return}for(o=0;o<i;o++)a.copy(e[r+o],n[t+o]);return}if(e===n&&r>t)for(o=i-1;o>=0;o--)e[r+o]=n[t+o];else for(o=0;o<i;o++)e[r+o]=n[t+o]}},$clone=function(e,n){var r=n.zero();return n.copy(r,e),r},$pointerOfStructConversion=function(e,n){void 0===e.$proxies&&(e.$proxies={},e.$proxies[e.constructor.string]=e);var r=e.$proxies[n.string];if(void 0===r){for(var t={},i=0;i<n.elem.fields.length;i++)!function(n){t[n]={get:function(){return e[n]},set:function(r){e[n]=r}}}(n.elem.fields[i].prop);(r=Object.create(n.prototype,t)).$val=r,e.$proxies[n.string]=r,r.$proxies=e.$proxies}return r},$append=function(e){return $internalAppend(e,arguments,1,arguments.length-1)},$appendSlice=function(e,n){if(n.constructor===String){var r=$stringToBytes(n);return $internalAppend(e,r,0,r.length)}return $internalAppend(e,n.$array,n.$offset,n.$length)},$internalAppend=function(e,n,r,t){if(0===t)return e;var i=e.$array,a=e.$offset,o=e.$length+t,$=e.$capacity;if(o>$)if(a=0,$=Math.max(o,e.$capacity<1024?2*e.$capacity:Math.floor(5*e.$capacity/4)),e.$array.constructor===Array){(i=e.$array.slice(e.$offset,e.$offset+e.$length)).length=$;for(var c=e.constructor.elem.zero,u=e.$length;u<$;u++)i[u]=c()}else(i=new e.$array.constructor($)).set(e.$array.subarray(e.$offset,e.$offset+e.$length));$copyArray(i,n,a+e.$length,r,t,e.constructor.elem);var l=new e.constructor(i);return l.$offset=a,l.$length=o,l.$capacity=$,l},$equal=function(e,n,r){if(r===$jsObjectPtr)return e===n;switch(r.kind){case $kindComplex64:case $kindComplex128:return e.$real===n.$real&&e.$imag===n.$imag;case $kindInt64:case $kindUint64:return e.$high===n.$high&&e.$low===n.$low;case $kindArray:if(e.length!==n.length)return!1;for(var t=0;t<e.length;t++)if(!$equal(e[t],n[t],r.elem))return!1;return!0;case $kindStruct:for(t=0;t<r.fields.length;t++){var i=r.fields[t];if(!$equal(e[i.prop],n[i.prop],i.typ))return!1}return!0;case $kindInterface:return $interfaceIsEqual(e,n);default:return e===n}},$interfaceIsEqual=function(e,n){return e===$ifaceNil||n===$ifaceNil?e===n:e.constructor===n.constructor&&(e.constructor===$jsObjectPtr?e.object===n.object:(e.constructor.comparable||$throwRuntimeError(\"comparing uncomparable type \"+e.constructor.string),$equal(e.$val,n.$val,e.constructor)))},$min=Math.min,$mod=function(e,n){return e%n},$parseInt=parseInt,$parseFloat=function(e){return void 0!==e&&null!==e&&e.constructor===Number?e:parseFloat(e)},$froundBuf=new Float32Array(1),$fround=Math.fround||function(e){return $froundBuf[0]=e,$froundBuf[0]},$imul=Math.imul||function(e,n){var r=65535&e,t=65535&n;return r*t+((e>>>16&65535)*t+r*(n>>>16&65535)<<16>>>0)>>0},$floatKey=function(e){return e!=e?\"NaN$\"+ ++$idCounter:String(e)},$flatten64=function(e){return 4294967296*e.$high+e.$low},$shiftLeft64=function(e,n){return 0===n?e:n<32?new e.constructor(e.$high<<n|e.$low>>>32-n,e.$low<<n>>>0):n<64?new e.constructor(e.$low<<n-32,0):new e.constructor(0,0)},$shiftRightInt64=function(e,n){return 0===n?e:n<32?new e.constructor(e.$high>>n,(e.$low>>>n|e.$high<<32-n)>>>0):n<64?new e.constructor(e.$high>>31,e.$high>>n-32>>>0):e.$high<0?new e.constructor(-1,4294967295):new e.constructor(0,0)},$shiftRightUint64=function(e,n){return 0===n?e:n<32?new e.constructor(e.$high>>>n,(e.$low>>>n|e.$high<<32-n)>>>0):n<64?new e.constructor(0,e.$high>>>n-32):new e.constructor(0,0)},$mul64=function(e,n){var r=0,t=0;0!=(1&n.$low)&&(r=e.$high,t=e.$low);for(var i=1;i<32;i++)0!=(n.$low&1<<i)&&(r+=e.$high<<i|e.$low>>>32-i,t+=e.$low<<i>>>0);for(i=0;i<32;i++)0!=(n.$high&1<<i)&&(r+=e.$low<<i);return new e.constructor(r,t)},$div64=function(e,n,r){0===n.$high&&0===n.$low&&$throwRuntimeError(\"integer divide by zero\");var t=1,i=1,a=e.$high,o=e.$low;a<0&&(t=-1,i=-1,a=-a,0!==o&&(a--,o=4294967296-o));var $=n.$high,c=n.$low;n.$high<0&&(t*=-1,$=-$,0!==c&&($--,c=4294967296-c));for(var u=0,l=0,s=0;$<2147483648&&(a>$||a===$&&o>c);)$=($<<1|c>>>31)>>>0,c=c<<1>>>0,s++;for(var f=0;f<=s;f++)u=u<<1|l>>>31,l=l<<1>>>0,(a>$||a===$&&o>=c)&&(a-=$,(o-=c)<0&&(a--,o+=4294967296),4294967296===++l&&(u++,l=0)),c=(c>>>1|$<<31)>>>0,$>>>=1;return r?new e.constructor(a*i,o*i):new e.constructor(u*t,l*t)},$divComplex=function(e,n){var r=e.$real===1/0||e.$real===-1/0||e.$imag===1/0||e.$imag===-1/0,t=n.$real===1/0||n.$real===-1/0||n.$imag===1/0||n.$imag===-1/0,i=!r&&(e.$real!=e.$real||e.$imag!=e.$imag),a=!t&&(n.$real!=n.$real||n.$imag!=n.$imag);if(i||a)return new e.constructor(NaN,NaN);if(r&&!t)return new e.constructor(1/0,1/0);if(!r&&t)return new e.constructor(0,0);if(0===n.$real&&0===n.$imag)return 0===e.$real&&0===e.$imag?new e.constructor(NaN,NaN):new e.constructor(1/0,1/0);if(Math.abs(n.$real)<=Math.abs(n.$imag)){var o=n.$real/n.$imag,$=n.$real*o+n.$imag;return new e.constructor((e.$real*o+e.$imag)/$,(e.$imag*o-e.$real)/$)}o=n.$imag/n.$real,$=n.$imag*o+n.$real;return new e.constructor((e.$imag*o+e.$real)/$,(e.$imag-e.$real*o)/$)},$kindBool=1,$kindInt=2,$kindInt8=3,$kindInt16=4,$kindInt32=5,$kindInt64=6,$kindUint=7,$kindUint8=8,$kindUint16=9,$kindUint32=10,$kindUint64=11,$kindUintptr=12,$kindFloat32=13,$kindFloat64=14,$kindComplex64=15,$kindComplex128=16,$kindArray=17,$kindChan=18,$kindFunc=19,$kindInterface=20,$kindMap=21,$kindPtr=22,$kindSlice=23,$kindString=24,$kindStruct=25,$kindUnsafePointer=26,$methodSynthesizers=[],$addMethodSynthesizer=function(e){null!==$methodSynthesizers?$methodSynthesizers.push(e):e()},$synthesizeMethods=function(){$methodSynthesizers.forEach(function(e){e()}),$methodSynthesizers=null},$ifaceKeyFor=function(e){if(e===$ifaceNil)return\"nil\";var n=e.constructor;return n.string+\"$\"+n.keyFor(e.$val)},$identity=function(e){return e},$typeIDCounter=0,$idKey=function(e){return void 0===e.$id&&($idCounter++,e.$id=$idCounter),String(e.$id)},$newType=function(e,n,r,t,i,a,o){var $;switch(n){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindUnsafePointer:($=function(e){this.$val=e}).wrapped=!0,$.keyFor=$identity;break;case $kindString:($=function(e){this.$val=e}).wrapped=!0,$.keyFor=function(e){return\"$\"+e};break;case $kindFloat32:case $kindFloat64:($=function(e){this.$val=e}).wrapped=!0,$.keyFor=function(e){return $floatKey(e)};break;case $kindInt64:($=function(e,n){this.$high=e+Math.floor(Math.ceil(n)/4294967296)>>0,this.$low=n>>>0,this.$val=this}).keyFor=function(e){return e.$high+\"$\"+e.$low};break;case $kindUint64:($=function(e,n){this.$high=e+Math.floor(Math.ceil(n)/4294967296)>>>0,this.$low=n>>>0,this.$val=this}).keyFor=function(e){return e.$high+\"$\"+e.$low};break;case $kindComplex64:($=function(e,n){this.$real=$fround(e),this.$imag=$fround(n),this.$val=this}).keyFor=function(e){return e.$real+\"$\"+e.$imag};break;case $kindComplex128:($=function(e,n){this.$real=e,this.$imag=n,this.$val=this}).keyFor=function(e){return e.$real+\"$\"+e.$imag};break;case $kindArray:($=function(e){this.$val=e}).wrapped=!0,$.ptr=$newType(4,$kindPtr,\"*\"+r,!1,\"\",!1,function(e){this.$get=function(){return e},this.$set=function(e){$.copy(this,e)},this.$val=e}),$.init=function(e,n){$.elem=e,$.len=n,$.comparable=e.comparable,$.keyFor=function(n){return Array.prototype.join.call($mapArray(n,function(n){return String(e.keyFor(n)).replace(/\\\\/g,\"\\\\\\\\\").replace(/\\$/g,\"\\\\$\")}),\"$\")},$.copy=function(n,r){$copyArray(n,r,0,0,r.length,e)},$.ptr.init($),Object.defineProperty($.ptr.nil,\"nilCheck\",{get:$throwNilPointerError})};break;case $kindChan:($=function(e){this.$val=e}).wrapped=!0,$.keyFor=$idKey,$.init=function(e,n,r){$.elem=e,$.sendOnly=n,$.recvOnly=r};break;case $kindFunc:($=function(e){this.$val=e}).wrapped=!0,$.init=function(e,n,r){$.params=e,$.results=n,$.variadic=r,$.comparable=!1};break;case $kindInterface:($={implementedBy:{},missingMethodFor:{}}).keyFor=$ifaceKeyFor,$.init=function(e){$.methods=e,e.forEach(function(e){$ifaceNil[e.prop]=$throwNilPointerError})};break;case $kindMap:($=function(e){this.$val=e}).wrapped=!0,$.init=function(e,n){$.key=e,$.elem=n,$.comparable=!1};break;case $kindPtr:($=o||function(e,n,r){this.$get=e,this.$set=n,this.$target=r,this.$val=this}).keyFor=$idKey,$.init=function(e){$.elem=e,$.wrapped=e.kind===$kindArray,$.nil=new $($throwNilPointerError,$throwNilPointerError)};break;case $kindSlice:($=function(e){e.constructor!==$.nativeArray&&(e=new $.nativeArray(e)),this.$array=e,this.$offset=0,this.$length=e.length,this.$capacity=e.length,this.$val=this}).init=function(e){$.elem=e,$.comparable=!1,$.nativeArray=$nativeArray(e.kind),$.nil=new $([])};break;case $kindStruct:($=function(e){this.$val=e}).wrapped=!0,$.ptr=$newType(4,$kindPtr,\"*\"+r,!1,i,a,o),$.ptr.elem=$,$.ptr.prototype.$get=function(){return this},$.ptr.prototype.$set=function(e){$.copy(this,e)},$.init=function(e,n){$.pkgPath=e,$.fields=n,n.forEach(function(e){e.typ.comparable||($.comparable=!1)}),$.keyFor=function(e){var r=e.$val;return $mapArray(n,function(e){return String(e.typ.keyFor(r[e.prop])).replace(/\\\\/g,\"\\\\\\\\\").replace(/\\$/g,\"\\\\$\")}).join(\"$\")},$.copy=function(e,r){for(var t=0;t<n.length;t++){var i=n[t];switch(i.typ.kind){case $kindArray:case $kindStruct:i.typ.copy(e[i.prop],r[i.prop]);continue;default:e[i.prop]=r[i.prop];continue}}};var r={};n.forEach(function(e){r[e.prop]={get:$throwNilPointerError,set:$throwNilPointerError}}),$.ptr.nil=Object.create(o.prototype,r),$.ptr.nil.$val=$.ptr.nil,$addMethodSynthesizer(function(){var e=function(e,n,r){void 0===e.prototype[n.prop]&&(e.prototype[n.prop]=function(){var e=this.$val[r.prop];return r.typ===$jsObjectPtr&&(e=new $jsObjectPtr(e)),void 0===e.$val&&(e=new r.typ(e)),e[n.prop].apply(e,arguments)})};n.forEach(function(n){n.embedded&&($methodSet(n.typ).forEach(function(r){e($,r,n),e($.ptr,r,n)}),$methodSet($ptrType(n.typ)).forEach(function(r){e($.ptr,r,n)}))})})};break;default:$panic(new $String(\"invalid kind: \"+n))}switch(n){case $kindBool:case $kindMap:$.zero=function(){return!1};break;case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindUnsafePointer:case $kindFloat32:case $kindFloat64:$.zero=function(){return 0};break;case $kindString:$.zero=function(){return\"\"};break;case $kindInt64:case $kindUint64:case $kindComplex64:case $kindComplex128:var c=new $(0,0);$.zero=function(){return c};break;case $kindPtr:case $kindSlice:$.zero=function(){return $.nil};break;case $kindChan:$.zero=function(){return $chanNil};break;case $kindFunc:$.zero=function(){return $throwNilPointerError};break;case $kindInterface:$.zero=function(){return $ifaceNil};break;case $kindArray:$.zero=function(){var e=$nativeArray($.elem.kind);if(e!==Array)return new e($.len);for(var n=new Array($.len),r=0;r<$.len;r++)n[r]=$.elem.zero();return n};break;case $kindStruct:$.zero=function(){return new $.ptr};break;default:$panic(new $String(\"invalid kind: \"+n))}return $.id=$typeIDCounter,$typeIDCounter++,$.size=e,$.kind=n,$.string=r,$.named=t,$.pkg=i,$.exported=a,$.methods=[],$.methodSetCache=null,$.comparable=!0,$},$methodSet=function(e){if(null!==e.methodSetCache)return e.methodSetCache;var n={},r=e.kind===$kindPtr;if(r&&e.elem.kind===$kindInterface)return e.methodSetCache=[],[];for(var t=[{typ:r?e.elem:e,indirect:r}],i={};t.length>0;){var a=[],o=[];t.forEach(function(e){if(!i[e.typ.string])switch(i[e.typ.string]=!0,e.typ.named&&(o=o.concat(e.typ.methods),e.indirect&&(o=o.concat($ptrType(e.typ).methods))),e.typ.kind){case $kindStruct:e.typ.fields.forEach(function(n){if(n.embedded){var r=n.typ,t=r.kind===$kindPtr;a.push({typ:t?r.elem:r,indirect:e.indirect||t})}});break;case $kindInterface:o=o.concat(e.typ.methods)}}),o.forEach(function(e){void 0===n[e.name]&&(n[e.name]=e)}),t=a}return e.methodSetCache=[],Object.keys(n).sort().forEach(function(r){e.methodSetCache.push(n[r])}),e.methodSetCache},$Bool=$newType(1,$kindBool,\"bool\",!0,\"\",!1,null),$Int=$newType(4,$kindInt,\"int\",!0,\"\",!1,null),$Int8=$newType(1,$kindInt8,\"int8\",!0,\"\",!1,null),$Int16=$newType(2,$kindInt16,\"int16\",!0,\"\",!1,null),$Int32=$newType(4,$kindInt32,\"int32\",!0,\"\",!1,null),$Int64=$newType(8,$kindInt64,\"int64\",!0,\"\",!1,null),$Uint=$newType(4,$kindUint,\"uint\",!0,\"\",!1,null),$Uint8=$newType(1,$kindUint8,\"uint8\",!0,\"\",!1,null),$Uint16=$newType(2,$kindUint16,\"uint16\",!0,\"\",!1,null),$Uint32=$newType(4,$kindUint32,\"uint32\",!0,\"\",!1,null),$Uint64=$newType(8,$kindUint64,\"uint64\",!0,\"\",!1,null),$Uintptr=$newType(4,$kindUintptr,\"uintptr\",!0,\"\",!1,null),$Float32=$newType(4,$kindFloat32,\"float32\",!0,\"\",!1,null),$Float64=$newType(8,$kindFloat64,\"float64\",!0,\"\",!1,null),$Complex64=$newType(8,$kindComplex64,\"complex64\",!0,\"\",!1,null),$Complex128=$newType(16,$kindComplex128,\"complex128\",!0,\"\",!1,null),$String=$newType(8,$kindString,\"string\",!0,\"\",!1,null),$UnsafePointer=$newType(4,$kindUnsafePointer,\"unsafe.Pointer\",!0,\"\",!1,null),$nativeArray=function(e){switch(e){case $kindInt:return Int32Array;case $kindInt8:return Int8Array;case $kindInt16:return Int16Array;case $kindInt32:return Int32Array;case $kindUint:return Uint32Array;case $kindUint8:return Uint8Array;case $kindUint16:return Uint16Array;case $kindUint32:case $kindUintptr:return Uint32Array;case $kindFloat32:return Float32Array;case $kindFloat64:return Float64Array;default:return Array}},$toNativeArray=function(e,n){var r=$nativeArray(e);return r===Array?n:new r(n)},$arrayTypes={},$arrayType=function(e,n){var r=e.id+\"$\"+n,t=$arrayTypes[r];return void 0===t&&(t=$newType(12,$kindArray,\"[\"+n+\"]\"+e.string,!1,\"\",!1,null),$arrayTypes[r]=t,t.init(e,n)),t},$chanType=function(e,n,r){var t=(r?\"<-\":\"\")+\"chan\"+(n?\"<- \":\" \")+e.string,i=n?\"SendChan\":r?\"RecvChan\":\"Chan\",a=e[i];return void 0===a&&(a=$newType(4,$kindChan,t,!1,\"\",!1,null),e[i]=a,a.init(e,n,r)),a},$Chan=function(e,n){(n<0||n>2147483647)&&$throwRuntimeError(\"makechan: size out of range\"),this.$elem=e,this.$capacity=n,this.$buffer=[],this.$sendQueue=[],this.$recvQueue=[],this.$closed=!1},$chanNil=new $Chan(null,0);$chanNil.$sendQueue=$chanNil.$recvQueue={length:0,push:function(){},shift:function(){},indexOf:function(){return-1}};var $funcTypes={},$funcType=function(e,n,r){var t=$mapArray(e,function(e){return e.id}).join(\",\")+\"$\"+$mapArray(n,function(e){return e.id}).join(\",\")+\"$\"+r,i=$funcTypes[t];if(void 0===i){var a=$mapArray(e,function(e){return e.string});r&&(a[a.length-1]=\"...\"+a[a.length-1].substr(2));var o=\"func(\"+a.join(\", \")+\")\";1===n.length?o+=\" \"+n[0].string:n.length>1&&(o+=\" (\"+$mapArray(n,function(e){return e.string}).join(\", \")+\")\"),i=$newType(4,$kindFunc,o,!1,\"\",!1,null),$funcTypes[t]=i,i.init(e,n,r)}return i},$interfaceTypes={},$interfaceType=function(e){var n=$mapArray(e,function(e){return e.pkg+\",\"+e.name+\",\"+e.typ.id}).join(\"$\"),r=$interfaceTypes[n];if(void 0===r){var t=\"interface {}\";0!==e.length&&(t=\"interface { \"+$mapArray(e,function(e){return(\"\"!==e.pkg?e.pkg+\".\":\"\")+e.name+e.typ.string.substr(4)}).join(\"; \")+\" }\"),r=$newType(8,$kindInterface,t,!1,\"\",!1,null),$interfaceTypes[n]=r,r.init(e)}return r},$emptyInterface=$interfaceType([]),$ifaceNil={},$error=$newType(8,$kindInterface,\"error\",!0,\"\",!1,null);$error.init([{prop:\"Error\",name:\"Error\",pkg:\"\",typ:$funcType([],[$String],!1)}]);var $panicValue,$jsObjectPtr,$jsErrorPtr,$mapTypes={},$mapType=function(e,n){var r=e.id+\"$\"+n.id,t=$mapTypes[r];return void 0===t&&(t=$newType(4,$kindMap,\"map[\"+e.string+\"]\"+n.string,!1,\"\",!1,null),$mapTypes[r]=t,t.init(e,n)),t},$makeMap=function(e,n){for(var r={},t=0;t<n.length;t++){var i=n[t];r[e(i.k)]=i}return r},$ptrType=function(e){var n=e.ptr;return void 0===n&&(n=$newType(4,$kindPtr,\"*\"+e.string,!1,\"\",e.exported,null),e.ptr=n,n.init(e)),n},$newDataPointer=function(e,n){return n.elem.kind===$kindStruct?e:new n(function(){return e},function(n){e=n})},$indexPtr=function(e,n,r){return e.$ptr=e.$ptr||{},e.$ptr[n]||(e.$ptr[n]=new r(function(){return e[n]},function(r){e[n]=r}))},$sliceType=function(e){var n=e.slice;return void 0===n&&(n=$newType(12,$kindSlice,\"[]\"+e.string,!1,\"\",!1,null),e.slice=n,n.init(e)),n},$makeSlice=function(e,n,r){r=r||n,(n<0||n>2147483647)&&$throwRuntimeError(\"makeslice: len out of range\"),(r<0||r<n||r>2147483647)&&$throwRuntimeError(\"makeslice: cap out of range\");var t=new e.nativeArray(r);if(e.nativeArray===Array)for(var i=0;i<r;i++)t[i]=e.elem.zero();var a=new e(t);return a.$length=n,a},$structTypes={},$structType=function(e,n){var r=$mapArray(n,function(e){return e.name+\",\"+e.typ.id+\",\"+e.tag}).join(\"$\"),t=$structTypes[r];if(void 0===t){var i=\"struct { \"+$mapArray(n,function(e){return e.name+\" \"+e.typ.string+(\"\"!==e.tag?' \"'+e.tag.replace(/\\\\/g,\"\\\\\\\\\").replace(/\"/g,'\\\\\"')+'\"':\"\")}).join(\"; \")+\" }\";0===n.length&&(i=\"struct {}\"),t=$newType(0,$kindStruct,i,!1,\"\",!1,function(){this.$val=this;for(var e=0;e<n.length;e++){var r=n[e],t=arguments[e];this[r.prop]=void 0!==t?t:r.typ.zero()}}),$structTypes[r]=t,t.init(e,n)}return t},$assertType=function(e,n,r){var t,i=n.kind===$kindInterface,a=\"\";if(e===$ifaceNil)t=!1;else if(i){var o=e.constructor.string;if(void 0===(t=n.implementedBy[o])){t=!0;for(var $=$methodSet(e.constructor),c=n.methods,u=0;u<c.length;u++){for(var l=c[u],s=!1,f=0;f<$.length;f++){var d=$[f];if(d.name===l.name&&d.pkg===l.pkg&&d.typ===l.typ){s=!0;break}}if(!s){t=!1,n.missingMethodFor[o]=l.name;break}}n.implementedBy[o]=t}t||(a=n.missingMethodFor[o])}else t=e.constructor===n;if(!t){if(r)return[n.zero(),!1];$panic(new $packages.runtime.TypeAssertionError.ptr($packages.runtime._type.ptr.nil,e===$ifaceNil?$packages.runtime._type.ptr.nil:new $packages.runtime._type.ptr(e.constructor.string),new $packages.runtime._type.ptr(n.string),a))}return i||(e=e.$val),n===$jsObjectPtr&&(e=e.object),r?[e,!0]:e},$stackDepthOffset=0,$getStackDepth=function(){var e=new Error;if(void 0!==e.stack)return $stackDepthOffset+e.stack.split(\"\\n\").length},$panicStackDepth=null,$callDeferred=function(e,n,r){if(!r&&null!==e&&e.index>=$curGoroutine.deferStack.length)throw n;if(null!==n){var t=null;try{$curGoroutine.deferStack.push(e),$panic(new $jsErrorPtr(n))}catch(e){t=e}return $curGoroutine.deferStack.pop(),void $callDeferred(e,t)}if(!$curGoroutine.asleep){$stackDepthOffset--;var i=$panicStackDepth,a=$panicValue,o=$curGoroutine.panicStack.pop();void 0!==o&&($panicStackDepth=$getStackDepth(),$panicValue=o);try{for(;;){if(null===e&&void 0===(e=$curGoroutine.deferStack[$curGoroutine.deferStack.length-1])){if($panicStackDepth=null,o.Object instanceof Error)throw o.Object;var $;throw $=o.constructor===$String?o.$val:void 0!==o.Error?o.Error():void 0!==o.String?o.String():o,new Error($)}var c=e.pop();if(void 0===c){if($curGoroutine.deferStack.pop(),void 0!==o){e=null;continue}return}var u=c[0].apply(c[2],c[1]);if(u&&void 0!==u.$blk){if(e.push([u.$blk,[],u]),r)throw null;return}if(void 0!==o&&null===$panicStackDepth)throw null}}finally{void 0!==o&&(null!==$panicStackDepth&&$curGoroutine.panicStack.push(o),$panicStackDepth=i,$panicValue=a),$stackDepthOffset++}}},$panic=function(e){$curGoroutine.panicStack.push(e),$callDeferred(null,null,!0)},$recover=function(){return null===$panicStackDepth||void 0!==$panicStackDepth&&$panicStackDepth!==$getStackDepth()-2?$ifaceNil:($panicStackDepth=null,$panicValue)},$throw=function(e){throw e},$noGoroutine={asleep:!1,exit:!1,deferStack:[],panicStack:[]},$curGoroutine=$noGoroutine,$totalGoroutines=0,$awakeGoroutines=0,$checkForDeadlock=!0,$mainFinished=!1,$go=function(e,n){$totalGoroutines++,$awakeGoroutines++;var r=function(){try{$curGoroutine=r;var t=e.apply(void 0,n);if(t&&void 0!==t.$blk)return e=function(){return t.$blk()},void(n=[]);r.exit=!0}catch(e){if(!r.exit)throw e}finally{$curGoroutine=$noGoroutine,r.exit&&($totalGoroutines--,r.asleep=!0),r.asleep&&($awakeGoroutines--,!$mainFinished&&0===$awakeGoroutines&&$checkForDeadlock&&(console.error(\"fatal error: all goroutines are asleep - deadlock!\"),void 0!==$global.process&&$global.process.exit(2)))}};r.asleep=!1,r.exit=!1,r.deferStack=[],r.panicStack=[],$schedule(r)},$scheduled=[],$runScheduled=function(){try{for(var e;void 0!==(e=$scheduled.shift());)e()}finally{$scheduled.length>0&&setTimeout($runScheduled,0)}},$schedule=function(e){e.asleep&&(e.asleep=!1,$awakeGoroutines++),$scheduled.push(e),$curGoroutine===$noGoroutine&&$runScheduled()},$setTimeout=function(e,n){return $awakeGoroutines++,setTimeout(function(){$awakeGoroutines--,e()},n)},$block=function(){$curGoroutine===$noGoroutine&&$throwRuntimeError(\"cannot block in JavaScript callback, fix by wrapping code in goroutine\"),$curGoroutine.asleep=!0},$send=function(e,n){e.$closed&&$throwRuntimeError(\"send on closed channel\");var r=e.$recvQueue.shift();if(void 0===r){if(!(e.$buffer.length<e.$capacity)){var t,i=$curGoroutine;return e.$sendQueue.push(function(e){return t=e,$schedule(i),n}),$block(),{$blk:function(){t&&$throwRuntimeError(\"send on closed channel\")}}}e.$buffer.push(n)}else r([n,!0])},$recv=function(e){var n=e.$sendQueue.shift();void 0!==n&&e.$buffer.push(n(!1));var r=e.$buffer.shift();if(void 0!==r)return[r,!0];if(e.$closed)return[e.$elem.zero(),!1];var t=$curGoroutine,i={$blk:function(){return this.value}};return e.$recvQueue.push(function(e){i.value=e,$schedule(t)}),$block(),i},$close=function(e){for(e.$closed&&$throwRuntimeError(\"close of closed channel\"),e.$closed=!0;;){var n=e.$sendQueue.shift();if(void 0===n)break;n(!0)}for(;;){var r=e.$recvQueue.shift();if(void 0===r)break;r([e.$elem.zero(),!1])}},$select=function(e){for(var n=[],r=-1,t=0;t<e.length;t++){var i,a=(i=e[t])[0];switch(i.length){case 0:r=t;break;case 1:(0!==a.$sendQueue.length||0!==a.$buffer.length||a.$closed)&&n.push(t);break;case 2:a.$closed&&$throwRuntimeError(\"send on closed channel\"),(0!==a.$recvQueue.length||a.$buffer.length<a.$capacity)&&n.push(t)}}if(0!==n.length&&(r=n[Math.floor(Math.random()*n.length)]),-1!==r)switch((i=e[r]).length){case 0:return[r];case 1:return[r,$recv(i[0])];case 2:return $send(i[0],i[1]),[r]}var o=[],$=$curGoroutine,c={$blk:function(){return this.selection}},u=function(){for(var e=0;e<o.length;e++){var n=o[e],r=n[0],t=r.indexOf(n[1]);-1!==t&&r.splice(t,1)}};for(t=0;t<e.length;t++)!function(n){var r=e[n];switch(r.length){case 1:var t=function(e){c.selection=[n,e],u(),$schedule($)};o.push([r[0].$recvQueue,t]),r[0].$recvQueue.push(t);break;case 2:t=function(){return r[0].$closed&&$throwRuntimeError(\"send on closed channel\"),c.selection=[n],u(),$schedule($),r[1]};o.push([r[0].$sendQueue,t]),r[0].$sendQueue.push(t)}}(t);return $block(),c},$needsExternalization=function(e){switch(e.kind){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindFloat32:case $kindFloat64:return!1;default:return e!==$jsObjectPtr}},$externalize=function(e,n){if(n===$jsObjectPtr)return e;switch(n.kind){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindFloat32:case $kindFloat64:return e;case $kindInt64:case $kindUint64:return $flatten64(e);case $kindArray:return $needsExternalization(n.elem)?$mapArray(e,function(e){return $externalize(e,n.elem)}):e;case $kindFunc:return $externalizeFunction(e,n,!1);case $kindInterface:return e===$ifaceNil?null:e.constructor===$jsObjectPtr?e.$val.object:$externalize(e.$val,e.constructor);case $kindMap:for(var r={},t=$keys(e),i=0;i<t.length;i++){var a=e[t[i]];r[$externalize(a.k,n.key)]=$externalize(a.v,n.elem)}return r;case $kindPtr:return e===n.nil?null:$externalize(e.$get(),n.elem);case $kindSlice:return $needsExternalization(n.elem)?$mapArray($sliceToArray(e),function(e){return $externalize(e,n.elem)}):$sliceToArray(e);case $kindString:if($isASCII(e))return e;var o,$=\"\";for(i=0;i<e.length;i+=o[1]){var c=(o=$decodeRune(e,i))[0];if(c>65535){var u=Math.floor((c-65536)/1024)+55296,l=(c-65536)%1024+56320;$+=String.fromCharCode(u,l)}else $+=String.fromCharCode(c)}return $;case $kindStruct:var s=$packages.time;if(void 0!==s&&e.constructor===s.Time.ptr){var f=$div64(e.UnixNano(),new $Int64(0,1e6));return new Date($flatten64(f))}var d={},p=function(e,n){if(n===$jsObjectPtr)return e;switch(n.kind){case $kindPtr:return e===n.nil?d:p(e.$get(),n.elem);case $kindStruct:var r=n.fields[0];return p(e[r.prop],r.typ);case $kindInterface:return p(e.$val,e.constructor);default:return d}},h=p(e,n);if(h!==d)return h;h={};for(i=0;i<n.fields.length;i++){var k=n.fields[i];k.exported&&(h[k.name]=$externalize(e[k.prop],k.typ))}return h}$throwRuntimeError(\"cannot externalize \"+n.string)},$externalizeFunction=function(e,n,r){return e===$throwNilPointerError?null:(void 0===e.$externalizeWrapper&&($checkForDeadlock=!1,e.$externalizeWrapper=function(){for(var t=[],i=0;i<n.params.length;i++){if(n.variadic&&i===n.params.length-1){for(var a=n.params[i].elem,o=[],$=i;$<arguments.length;$++)o.push($internalize(arguments[$],a));t.push(new n.params[i](o));break}t.push($internalize(arguments[i],n.params[i]))}var c=e.apply(r?this:void 0,t);switch(n.results.length){case 0:return;case 1:return $externalize(c,n.results[0]);default:for(i=0;i<n.results.length;i++)c[i]=$externalize(c[i],n.results[i]);return c}}),e.$externalizeWrapper)},$internalize=function(e,n,r){if(n===$jsObjectPtr)return e;if(n===$jsObjectPtr.elem&&$throwRuntimeError(\"cannot internalize js.Object, use *js.Object instead\"),e&&void 0!==e.__internal_object__)return $assertType(e.__internal_object__,n,!1);var t=$packages.time;if(void 0!==t&&n===t.Time)return null!==e&&void 0!==e&&e.constructor===Date||$throwRuntimeError(\"cannot internalize time.Time from \"+typeof e+\", must be Date\"),t.Unix(new $Int64(0,0),new $Int64(0,1e6*e.getTime()));switch(n.kind){case $kindBool:return!!e;case $kindInt:return parseInt(e);case $kindInt8:return parseInt(e)<<24>>24;case $kindInt16:return parseInt(e)<<16>>16;case $kindInt32:return parseInt(e)>>0;case $kindUint:return parseInt(e);case $kindUint8:return parseInt(e)<<24>>>24;case $kindUint16:return parseInt(e)<<16>>>16;case $kindUint32:case $kindUintptr:return parseInt(e)>>>0;case $kindInt64:case $kindUint64:return new n(0,e);case $kindFloat32:case $kindFloat64:return parseFloat(e);case $kindArray:return e.length!==n.len&&$throwRuntimeError(\"got array with wrong size from JavaScript native\"),$mapArray(e,function(e){return $internalize(e,n.elem)});case $kindFunc:return function(){for(var t=[],i=0;i<n.params.length;i++){if(n.variadic&&i===n.params.length-1){for(var a=n.params[i].elem,o=arguments[i],$=0;$<o.$length;$++)t.push($externalize(o.$array[o.$offset+$],a));break}t.push($externalize(arguments[i],n.params[i]))}var c=e.apply(r,t);switch(n.results.length){case 0:return;case 1:return $internalize(c,n.results[0]);default:for(i=0;i<n.results.length;i++)c[i]=$internalize(c[i],n.results[i]);return c}};case $kindInterface:if(0!==n.methods.length&&$throwRuntimeError(\"cannot internalize \"+n.string),null===e)return $ifaceNil;if(void 0===e)return new $jsObjectPtr(void 0);switch(e.constructor){case Int8Array:return new($sliceType($Int8))(e);case Int16Array:return new($sliceType($Int16))(e);case Int32Array:return new($sliceType($Int))(e);case Uint8Array:return new($sliceType($Uint8))(e);case Uint16Array:return new($sliceType($Uint16))(e);case Uint32Array:return new($sliceType($Uint))(e);case Float32Array:return new($sliceType($Float32))(e);case Float64Array:return new($sliceType($Float64))(e);case Array:return $internalize(e,$sliceType($emptyInterface));case Boolean:return new $Bool(!!e);case Date:return void 0===t?new $jsObjectPtr(e):new t.Time($internalize(e,t.Time));case Function:var i=$funcType([$sliceType($emptyInterface)],[$jsObjectPtr],!0);return new i($internalize(e,i));case Number:return new $Float64(parseFloat(e));case String:return new $String($internalize(e,$String));default:if($global.Node&&e instanceof $global.Node)return new $jsObjectPtr(e);var a=$mapType($String,$emptyInterface);return new a($internalize(e,a))}case $kindMap:for(var o={},$=$keys(e),c=0;c<$.length;c++){var u=$internalize($[c],n.key);o[n.key.keyFor(u)]={k:u,v:$internalize(e[$[c]],n.elem)}}return o;case $kindPtr:if(n.elem.kind===$kindStruct)return $internalize(e,n.elem);case $kindSlice:return new n($mapArray(e,function(e){return $internalize(e,n.elem)}));case $kindString:if(e=String(e),$isASCII(e))return e;var l=\"\";for(c=0;c<e.length;){var s=e.charCodeAt(c);if(55296<=s&&s<=56319){var f=e.charCodeAt(c+1);l+=$encodeRune(1024*(s-55296)+f-56320+65536),c+=2}else l+=$encodeRune(s),c++}return l;case $kindStruct:var d={},p=function(n){if(n===$jsObjectPtr)return e;switch(n===$jsObjectPtr.elem&&$throwRuntimeError(\"cannot internalize js.Object, use *js.Object instead\"),n.kind){case $kindPtr:return p(n.elem);case $kindStruct:var r=n.fields[0],t=p(r.typ);if(t!==d){var i=new n.ptr;return i[r.prop]=t,i}return d;default:return d}},h=p(n);if(h!==d)return h}$throwRuntimeError(\"cannot internalize \"+n.string)},$isASCII=function(e){for(var n=0;n<e.length;n++)if(e.charCodeAt(n)>=128)return!1;return!0};\n"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/types.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/types.go
new file mode 100644
index 00000000000..0d37509ba66
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/prelude/types.go
@@ -0,0 +1,747 @@
+package prelude
+
+const types = `
+var $kindBool = 1;
+var $kindInt = 2;
+var $kindInt8 = 3;
+var $kindInt16 = 4;
+var $kindInt32 = 5;
+var $kindInt64 = 6;
+var $kindUint = 7;
+var $kindUint8 = 8;
+var $kindUint16 = 9;
+var $kindUint32 = 10;
+var $kindUint64 = 11;
+var $kindUintptr = 12;
+var $kindFloat32 = 13;
+var $kindFloat64 = 14;
+var $kindComplex64 = 15;
+var $kindComplex128 = 16;
+var $kindArray = 17;
+var $kindChan = 18;
+var $kindFunc = 19;
+var $kindInterface = 20;
+var $kindMap = 21;
+var $kindPtr = 22;
+var $kindSlice = 23;
+var $kindString = 24;
+var $kindStruct = 25;
+var $kindUnsafePointer = 26;
+
+var $methodSynthesizers = [];
+var $addMethodSynthesizer = function(f) {
+ if ($methodSynthesizers === null) {
+ f();
+ return;
+ }
+ $methodSynthesizers.push(f);
+};
+var $synthesizeMethods = function() {
+ $methodSynthesizers.forEach(function(f) { f(); });
+ $methodSynthesizers = null;
+};
+
+var $ifaceKeyFor = function(x) {
+ if (x === $ifaceNil) {
+ return 'nil';
+ }
+ var c = x.constructor;
+ return c.string + '$' + c.keyFor(x.$val);
+};
+
+var $identity = function(x) { return x; };
+
+var $typeIDCounter = 0;
+
+var $idKey = function(x) {
+ if (x.$id === undefined) {
+ $idCounter++;
+ x.$id = $idCounter;
+ }
+ return String(x.$id);
+};
+
+var $newType = function(size, kind, string, named, pkg, exported, constructor) {
+ var typ;
+ switch(kind) {
+ case $kindBool:
+ case $kindInt:
+ case $kindInt8:
+ case $kindInt16:
+ case $kindInt32:
+ case $kindUint:
+ case $kindUint8:
+ case $kindUint16:
+ case $kindUint32:
+ case $kindUintptr:
+ case $kindUnsafePointer:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.keyFor = $identity;
+ break;
+
+ case $kindString:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.keyFor = function(x) { return "$" + x; };
+ break;
+
+ case $kindFloat32:
+ case $kindFloat64:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.keyFor = function(x) { return $floatKey(x); };
+ break;
+
+ case $kindInt64:
+ typ = function(high, low) {
+ this.$high = (high + Math.floor(Math.ceil(low) / 4294967296)) >> 0;
+ this.$low = low >>> 0;
+ this.$val = this;
+ };
+ typ.keyFor = function(x) { return x.$high + "$" + x.$low; };
+ break;
+
+ case $kindUint64:
+ typ = function(high, low) {
+ this.$high = (high + Math.floor(Math.ceil(low) / 4294967296)) >>> 0;
+ this.$low = low >>> 0;
+ this.$val = this;
+ };
+ typ.keyFor = function(x) { return x.$high + "$" + x.$low; };
+ break;
+
+ case $kindComplex64:
+ typ = function(real, imag) {
+ this.$real = $fround(real);
+ this.$imag = $fround(imag);
+ this.$val = this;
+ };
+ typ.keyFor = function(x) { return x.$real + "$" + x.$imag; };
+ break;
+
+ case $kindComplex128:
+ typ = function(real, imag) {
+ this.$real = real;
+ this.$imag = imag;
+ this.$val = this;
+ };
+ typ.keyFor = function(x) { return x.$real + "$" + x.$imag; };
+ break;
+
+ case $kindArray:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.ptr = $newType(4, $kindPtr, "*" + string, false, "", false, function(array) {
+ this.$get = function() { return array; };
+ this.$set = function(v) { typ.copy(this, v); };
+ this.$val = array;
+ });
+ typ.init = function(elem, len) {
+ typ.elem = elem;
+ typ.len = len;
+ typ.comparable = elem.comparable;
+ typ.keyFor = function(x) {
+ return Array.prototype.join.call($mapArray(x, function(e) {
+ return String(elem.keyFor(e)).replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
+ }), "$");
+ };
+ typ.copy = function(dst, src) {
+ $copyArray(dst, src, 0, 0, src.length, elem);
+ };
+ typ.ptr.init(typ);
+ Object.defineProperty(typ.ptr.nil, "nilCheck", { get: $throwNilPointerError });
+ };
+ break;
+
+ case $kindChan:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.keyFor = $idKey;
+ typ.init = function(elem, sendOnly, recvOnly) {
+ typ.elem = elem;
+ typ.sendOnly = sendOnly;
+ typ.recvOnly = recvOnly;
+ };
+ break;
+
+ case $kindFunc:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.init = function(params, results, variadic) {
+ typ.params = params;
+ typ.results = results;
+ typ.variadic = variadic;
+ typ.comparable = false;
+ };
+ break;
+
+ case $kindInterface:
+ typ = { implementedBy: {}, missingMethodFor: {} };
+ typ.keyFor = $ifaceKeyFor;
+ typ.init = function(methods) {
+ typ.methods = methods;
+ methods.forEach(function(m) {
+ $ifaceNil[m.prop] = $throwNilPointerError;
+ });
+ };
+ break;
+
+ case $kindMap:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.init = function(key, elem) {
+ typ.key = key;
+ typ.elem = elem;
+ typ.comparable = false;
+ };
+ break;
+
+ case $kindPtr:
+ typ = constructor || function(getter, setter, target) {
+ this.$get = getter;
+ this.$set = setter;
+ this.$target = target;
+ this.$val = this;
+ };
+ typ.keyFor = $idKey;
+ typ.init = function(elem) {
+ typ.elem = elem;
+ typ.wrapped = (elem.kind === $kindArray);
+ typ.nil = new typ($throwNilPointerError, $throwNilPointerError);
+ };
+ break;
+
+ case $kindSlice:
+ typ = function(array) {
+ if (array.constructor !== typ.nativeArray) {
+ array = new typ.nativeArray(array);
+ }
+ this.$array = array;
+ this.$offset = 0;
+ this.$length = array.length;
+ this.$capacity = array.length;
+ this.$val = this;
+ };
+ typ.init = function(elem) {
+ typ.elem = elem;
+ typ.comparable = false;
+ typ.nativeArray = $nativeArray(elem.kind);
+ typ.nil = new typ([]);
+ };
+ break;
+
+ case $kindStruct:
+ typ = function(v) { this.$val = v; };
+ typ.wrapped = true;
+ typ.ptr = $newType(4, $kindPtr, "*" + string, false, pkg, exported, constructor);
+ typ.ptr.elem = typ;
+ typ.ptr.prototype.$get = function() { return this; };
+ typ.ptr.prototype.$set = function(v) { typ.copy(this, v); };
+ typ.init = function(pkgPath, fields) {
+ typ.pkgPath = pkgPath;
+ typ.fields = fields;
+ fields.forEach(function(f) {
+ if (!f.typ.comparable) {
+ typ.comparable = false;
+ }
+ });
+ typ.keyFor = function(x) {
+ var val = x.$val;
+ return $mapArray(fields, function(f) {
+ return String(f.typ.keyFor(val[f.prop])).replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
+ }).join("$");
+ };
+ typ.copy = function(dst, src) {
+ for (var i = 0; i < fields.length; i++) {
+ var f = fields[i];
+ switch (f.typ.kind) {
+ case $kindArray:
+ case $kindStruct:
+ f.typ.copy(dst[f.prop], src[f.prop]);
+ continue;
+ default:
+ dst[f.prop] = src[f.prop];
+ continue;
+ }
+ }
+ };
+ /* nil value */
+ var properties = {};
+ fields.forEach(function(f) {
+ properties[f.prop] = { get: $throwNilPointerError, set: $throwNilPointerError };
+ });
+ typ.ptr.nil = Object.create(constructor.prototype, properties);
+ typ.ptr.nil.$val = typ.ptr.nil;
+ /* methods for embedded fields */
+ $addMethodSynthesizer(function() {
+ var synthesizeMethod = function(target, m, f) {
+ if (target.prototype[m.prop] !== undefined) { return; }
+ target.prototype[m.prop] = function() {
+ var v = this.$val[f.prop];
+ if (f.typ === $jsObjectPtr) {
+ v = new $jsObjectPtr(v);
+ }
+ if (v.$val === undefined) {
+ v = new f.typ(v);
+ }
+ return v[m.prop].apply(v, arguments);
+ };
+ };
+ fields.forEach(function(f) {
+ if (f.embedded) {
+ $methodSet(f.typ).forEach(function(m) {
+ synthesizeMethod(typ, m, f);
+ synthesizeMethod(typ.ptr, m, f);
+ });
+ $methodSet($ptrType(f.typ)).forEach(function(m) {
+ synthesizeMethod(typ.ptr, m, f);
+ });
+ }
+ });
+ });
+ };
+ break;
+
+ default:
+ $panic(new $String("invalid kind: " + kind));
+ }
+
+ switch (kind) {
+ case $kindBool:
+ case $kindMap:
+ typ.zero = function() { return false; };
+ break;
+
+ case $kindInt:
+ case $kindInt8:
+ case $kindInt16:
+ case $kindInt32:
+ case $kindUint:
+ case $kindUint8 :
+ case $kindUint16:
+ case $kindUint32:
+ case $kindUintptr:
+ case $kindUnsafePointer:
+ case $kindFloat32:
+ case $kindFloat64:
+ typ.zero = function() { return 0; };
+ break;
+
+ case $kindString:
+ typ.zero = function() { return ""; };
+ break;
+
+ case $kindInt64:
+ case $kindUint64:
+ case $kindComplex64:
+ case $kindComplex128:
+ var zero = new typ(0, 0);
+ typ.zero = function() { return zero; };
+ break;
+
+ case $kindPtr:
+ case $kindSlice:
+ typ.zero = function() { return typ.nil; };
+ break;
+
+ case $kindChan:
+ typ.zero = function() { return $chanNil; };
+ break;
+
+ case $kindFunc:
+ typ.zero = function() { return $throwNilPointerError; };
+ break;
+
+ case $kindInterface:
+ typ.zero = function() { return $ifaceNil; };
+ break;
+
+ case $kindArray:
+ typ.zero = function() {
+ var arrayClass = $nativeArray(typ.elem.kind);
+ if (arrayClass !== Array) {
+ return new arrayClass(typ.len);
+ }
+ var array = new Array(typ.len);
+ for (var i = 0; i < typ.len; i++) {
+ array[i] = typ.elem.zero();
+ }
+ return array;
+ };
+ break;
+
+ case $kindStruct:
+ typ.zero = function() { return new typ.ptr(); };
+ break;
+
+ default:
+ $panic(new $String("invalid kind: " + kind));
+ }
+
+ typ.id = $typeIDCounter;
+ $typeIDCounter++;
+ typ.size = size;
+ typ.kind = kind;
+ typ.string = string;
+ typ.named = named;
+ typ.pkg = pkg;
+ typ.exported = exported;
+ typ.methods = [];
+ typ.methodSetCache = null;
+ typ.comparable = true;
+ return typ;
+};
+
+var $methodSet = function(typ) {
+ if (typ.methodSetCache !== null) {
+ return typ.methodSetCache;
+ }
+ var base = {};
+
+ var isPtr = (typ.kind === $kindPtr);
+ if (isPtr && typ.elem.kind === $kindInterface) {
+ typ.methodSetCache = [];
+ return [];
+ }
+
+ var current = [{typ: isPtr ? typ.elem : typ, indirect: isPtr}];
+
+ var seen = {};
+
+ while (current.length > 0) {
+ var next = [];
+ var mset = [];
+
+ current.forEach(function(e) {
+ if (seen[e.typ.string]) {
+ return;
+ }
+ seen[e.typ.string] = true;
+
+ if (e.typ.named) {
+ mset = mset.concat(e.typ.methods);
+ if (e.indirect) {
+ mset = mset.concat($ptrType(e.typ).methods);
+ }
+ }
+
+ switch (e.typ.kind) {
+ case $kindStruct:
+ e.typ.fields.forEach(function(f) {
+ if (f.embedded) {
+ var fTyp = f.typ;
+ var fIsPtr = (fTyp.kind === $kindPtr);
+ next.push({typ: fIsPtr ? fTyp.elem : fTyp, indirect: e.indirect || fIsPtr});
+ }
+ });
+ break;
+
+ case $kindInterface:
+ mset = mset.concat(e.typ.methods);
+ break;
+ }
+ });
+
+ mset.forEach(function(m) {
+ if (base[m.name] === undefined) {
+ base[m.name] = m;
+ }
+ });
+
+ current = next;
+ }
+
+ typ.methodSetCache = [];
+ Object.keys(base).sort().forEach(function(name) {
+ typ.methodSetCache.push(base[name]);
+ });
+ return typ.methodSetCache;
+};
+
+var $Bool = $newType( 1, $kindBool, "bool", true, "", false, null);
+var $Int = $newType( 4, $kindInt, "int", true, "", false, null);
+var $Int8 = $newType( 1, $kindInt8, "int8", true, "", false, null);
+var $Int16 = $newType( 2, $kindInt16, "int16", true, "", false, null);
+var $Int32 = $newType( 4, $kindInt32, "int32", true, "", false, null);
+var $Int64 = $newType( 8, $kindInt64, "int64", true, "", false, null);
+var $Uint = $newType( 4, $kindUint, "uint", true, "", false, null);
+var $Uint8 = $newType( 1, $kindUint8, "uint8", true, "", false, null);
+var $Uint16 = $newType( 2, $kindUint16, "uint16", true, "", false, null);
+var $Uint32 = $newType( 4, $kindUint32, "uint32", true, "", false, null);
+var $Uint64 = $newType( 8, $kindUint64, "uint64", true, "", false, null);
+var $Uintptr = $newType( 4, $kindUintptr, "uintptr", true, "", false, null);
+var $Float32 = $newType( 4, $kindFloat32, "float32", true, "", false, null);
+var $Float64 = $newType( 8, $kindFloat64, "float64", true, "", false, null);
+var $Complex64 = $newType( 8, $kindComplex64, "complex64", true, "", false, null);
+var $Complex128 = $newType(16, $kindComplex128, "complex128", true, "", false, null);
+var $String = $newType( 8, $kindString, "string", true, "", false, null);
+var $UnsafePointer = $newType( 4, $kindUnsafePointer, "unsafe.Pointer", true, "", false, null);
+
+var $nativeArray = function(elemKind) {
+ switch (elemKind) {
+ case $kindInt:
+ return Int32Array;
+ case $kindInt8:
+ return Int8Array;
+ case $kindInt16:
+ return Int16Array;
+ case $kindInt32:
+ return Int32Array;
+ case $kindUint:
+ return Uint32Array;
+ case $kindUint8:
+ return Uint8Array;
+ case $kindUint16:
+ return Uint16Array;
+ case $kindUint32:
+ return Uint32Array;
+ case $kindUintptr:
+ return Uint32Array;
+ case $kindFloat32:
+ return Float32Array;
+ case $kindFloat64:
+ return Float64Array;
+ default:
+ return Array;
+ }
+};
+var $toNativeArray = function(elemKind, array) {
+ var nativeArray = $nativeArray(elemKind);
+ if (nativeArray === Array) {
+ return array;
+ }
+ return new nativeArray(array);
+};
+var $arrayTypes = {};
+var $arrayType = function(elem, len) {
+ var typeKey = elem.id + "$" + len;
+ var typ = $arrayTypes[typeKey];
+ if (typ === undefined) {
+ typ = $newType(12, $kindArray, "[" + len + "]" + elem.string, false, "", false, null);
+ $arrayTypes[typeKey] = typ;
+ typ.init(elem, len);
+ }
+ return typ;
+};
+
+var $chanType = function(elem, sendOnly, recvOnly) {
+ var string = (recvOnly ? "<-" : "") + "chan" + (sendOnly ? "<- " : " ") + elem.string;
+ var field = sendOnly ? "SendChan" : (recvOnly ? "RecvChan" : "Chan");
+ var typ = elem[field];
+ if (typ === undefined) {
+ typ = $newType(4, $kindChan, string, false, "", false, null);
+ elem[field] = typ;
+ typ.init(elem, sendOnly, recvOnly);
+ }
+ return typ;
+};
+var $Chan = function(elem, capacity) {
+ if (capacity < 0 || capacity > 2147483647) {
+ $throwRuntimeError("makechan: size out of range");
+ }
+ this.$elem = elem;
+ this.$capacity = capacity;
+ this.$buffer = [];
+ this.$sendQueue = [];
+ this.$recvQueue = [];
+ this.$closed = false;
+};
+var $chanNil = new $Chan(null, 0);
+$chanNil.$sendQueue = $chanNil.$recvQueue = { length: 0, push: function() {}, shift: function() { return undefined; }, indexOf: function() { return -1; } };
+
+var $funcTypes = {};
+var $funcType = function(params, results, variadic) {
+ var typeKey = $mapArray(params, function(p) { return p.id; }).join(",") + "$" + $mapArray(results, function(r) { return r.id; }).join(",") + "$" + variadic;
+ var typ = $funcTypes[typeKey];
+ if (typ === undefined) {
+ var paramTypes = $mapArray(params, function(p) { return p.string; });
+ if (variadic) {
+ paramTypes[paramTypes.length - 1] = "..." + paramTypes[paramTypes.length - 1].substr(2);
+ }
+ var string = "func(" + paramTypes.join(", ") + ")";
+ if (results.length === 1) {
+ string += " " + results[0].string;
+ } else if (results.length > 1) {
+ string += " (" + $mapArray(results, function(r) { return r.string; }).join(", ") + ")";
+ }
+ typ = $newType(4, $kindFunc, string, false, "", false, null);
+ $funcTypes[typeKey] = typ;
+ typ.init(params, results, variadic);
+ }
+ return typ;
+};
+
+var $interfaceTypes = {};
+var $interfaceType = function(methods) {
+ var typeKey = $mapArray(methods, function(m) { return m.pkg + "," + m.name + "," + m.typ.id; }).join("$");
+ var typ = $interfaceTypes[typeKey];
+ if (typ === undefined) {
+ var string = "interface {}";
+ if (methods.length !== 0) {
+ string = "interface { " + $mapArray(methods, function(m) {
+ return (m.pkg !== "" ? m.pkg + "." : "") + m.name + m.typ.string.substr(4);
+ }).join("; ") + " }";
+ }
+ typ = $newType(8, $kindInterface, string, false, "", false, null);
+ $interfaceTypes[typeKey] = typ;
+ typ.init(methods);
+ }
+ return typ;
+};
+var $emptyInterface = $interfaceType([]);
+var $ifaceNil = {};
+var $error = $newType(8, $kindInterface, "error", true, "", false, null);
+$error.init([{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}]);
+
+var $mapTypes = {};
+var $mapType = function(key, elem) {
+ var typeKey = key.id + "$" + elem.id;
+ var typ = $mapTypes[typeKey];
+ if (typ === undefined) {
+ typ = $newType(4, $kindMap, "map[" + key.string + "]" + elem.string, false, "", false, null);
+ $mapTypes[typeKey] = typ;
+ typ.init(key, elem);
+ }
+ return typ;
+};
+var $makeMap = function(keyForFunc, entries) {
+ var m = {};
+ for (var i = 0; i < entries.length; i++) {
+ var e = entries[i];
+ m[keyForFunc(e.k)] = e;
+ }
+ return m;
+};
+
+var $ptrType = function(elem) {
+ var typ = elem.ptr;
+ if (typ === undefined) {
+ typ = $newType(4, $kindPtr, "*" + elem.string, false, "", elem.exported, null);
+ elem.ptr = typ;
+ typ.init(elem);
+ }
+ return typ;
+};
+
+var $newDataPointer = function(data, constructor) {
+ if (constructor.elem.kind === $kindStruct) {
+ return data;
+ }
+ return new constructor(function() { return data; }, function(v) { data = v; });
+};
+
+var $indexPtr = function(array, index, constructor) {
+ array.$ptr = array.$ptr || {};
+ return array.$ptr[index] || (array.$ptr[index] = new constructor(function() { return array[index]; }, function(v) { array[index] = v; }));
+};
+
+var $sliceType = function(elem) {
+ var typ = elem.slice;
+ if (typ === undefined) {
+ typ = $newType(12, $kindSlice, "[]" + elem.string, false, "", false, null);
+ elem.slice = typ;
+ typ.init(elem);
+ }
+ return typ;
+};
+var $makeSlice = function(typ, length, capacity) {
+ capacity = capacity || length;
+ if (length < 0 || length > 2147483647) {
+ $throwRuntimeError("makeslice: len out of range");
+ }
+ if (capacity < 0 || capacity < length || capacity > 2147483647) {
+ $throwRuntimeError("makeslice: cap out of range");
+ }
+ var array = new typ.nativeArray(capacity);
+ if (typ.nativeArray === Array) {
+ for (var i = 0; i < capacity; i++) {
+ array[i] = typ.elem.zero();
+ }
+ }
+ var slice = new typ(array);
+ slice.$length = length;
+ return slice;
+};
+
+var $structTypes = {};
+var $structType = function(pkgPath, fields) {
+ var typeKey = $mapArray(fields, function(f) { return f.name + "," + f.typ.id + "," + f.tag; }).join("$");
+ var typ = $structTypes[typeKey];
+ if (typ === undefined) {
+ var string = "struct { " + $mapArray(fields, function(f) {
+ return f.name + " " + f.typ.string + (f.tag !== "" ? (" \"" + f.tag.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"") : "");
+ }).join("; ") + " }";
+ if (fields.length === 0) {
+ string = "struct {}";
+ }
+ typ = $newType(0, $kindStruct, string, false, "", false, function() {
+ this.$val = this;
+ for (var i = 0; i < fields.length; i++) {
+ var f = fields[i];
+ var arg = arguments[i];
+ this[f.prop] = arg !== undefined ? arg : f.typ.zero();
+ }
+ });
+ $structTypes[typeKey] = typ;
+ typ.init(pkgPath, fields);
+ }
+ return typ;
+};
+
+var $assertType = function(value, type, returnTuple) {
+ var isInterface = (type.kind === $kindInterface), ok, missingMethod = "";
+ if (value === $ifaceNil) {
+ ok = false;
+ } else if (!isInterface) {
+ ok = value.constructor === type;
+ } else {
+ var valueTypeString = value.constructor.string;
+ ok = type.implementedBy[valueTypeString];
+ if (ok === undefined) {
+ ok = true;
+ var valueMethodSet = $methodSet(value.constructor);
+ var interfaceMethods = type.methods;
+ for (var i = 0; i < interfaceMethods.length; i++) {
+ var tm = interfaceMethods[i];
+ var found = false;
+ for (var j = 0; j < valueMethodSet.length; j++) {
+ var vm = valueMethodSet[j];
+ if (vm.name === tm.name && vm.pkg === tm.pkg && vm.typ === tm.typ) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ ok = false;
+ type.missingMethodFor[valueTypeString] = tm.name;
+ break;
+ }
+ }
+ type.implementedBy[valueTypeString] = ok;
+ }
+ if (!ok) {
+ missingMethod = type.missingMethodFor[valueTypeString];
+ }
+ }
+
+ if (!ok) {
+ if (returnTuple) {
+ return [type.zero(), false];
+ }
+ $panic(new $packages["runtime"].TypeAssertionError.ptr(
+ $packages["runtime"]._type.ptr.nil,
+ (value === $ifaceNil ? $packages["runtime"]._type.ptr.nil : new $packages["runtime"]._type.ptr(value.constructor.string)),
+ new $packages["runtime"]._type.ptr(type.string),
+ missingMethod));
+ }
+
+ if (!isInterface) {
+ value = value.$val;
+ }
+ if (type === $jsObjectPtr) {
+ value = value.object;
+ }
+ return returnTuple ? [value, true] : value;
+};
+`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/statements.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/statements.go
new file mode 100644
index 00000000000..b8339623590
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/statements.go
@@ -0,0 +1,786 @@
+package compiler
+
+import (
+ "fmt"
+ "go/ast"
+ "go/constant"
+ "go/token"
+ "go/types"
+ "strings"
+
+ "github.com/gopherjs/gopherjs/compiler/analysis"
+ "github.com/gopherjs/gopherjs/compiler/astutil"
+ "github.com/gopherjs/gopherjs/compiler/filter"
+ "github.com/gopherjs/gopherjs/compiler/typesutil"
+)
+
+func (c *funcContext) translateStmtList(stmts []ast.Stmt) {
+ for _, stmt := range stmts {
+ c.translateStmt(stmt, nil)
+ }
+ c.SetPos(token.NoPos)
+}
+
+func (c *funcContext) translateStmt(stmt ast.Stmt, label *types.Label) {
+ c.SetPos(stmt.Pos())
+
+ stmt = filter.IncDecStmt(stmt, c.p.Info.Info)
+ stmt = filter.Assign(stmt, c.p.Info.Info, c.p.Info.Pkg)
+
+ switch s := stmt.(type) {
+ case *ast.BlockStmt:
+ c.translateStmtList(s.List)
+
+ case *ast.IfStmt:
+ var caseClauses []*ast.CaseClause
+ ifStmt := s
+ for {
+ if ifStmt.Init != nil {
+ panic("simplification error")
+ }
+ caseClauses = append(caseClauses, &ast.CaseClause{List: []ast.Expr{ifStmt.Cond}, Body: ifStmt.Body.List})
+ elseStmt, ok := ifStmt.Else.(*ast.IfStmt)
+ if !ok {
+ break
+ }
+ ifStmt = elseStmt
+ }
+ var defaultClause *ast.CaseClause
+ if block, ok := ifStmt.Else.(*ast.BlockStmt); ok {
+ defaultClause = &ast.CaseClause{Body: block.List}
+ }
+ c.translateBranchingStmt(caseClauses, defaultClause, false, c.translateExpr, nil, c.Flattened[s])
+
+ case *ast.SwitchStmt:
+ if s.Init != nil || s.Tag != nil || len(s.Body.List) != 1 {
+ panic("simplification error")
+ }
+ clause := s.Body.List[0].(*ast.CaseClause)
+ if len(clause.List) != 0 {
+ panic("simplification error")
+ }
+
+ prevFlowData := c.flowDatas[nil]
+ data := &flowData{
+ postStmt: prevFlowData.postStmt, // for "continue" of outer loop
+ beginCase: prevFlowData.beginCase, // same
+ }
+ c.flowDatas[nil] = data
+ c.flowDatas[label] = data
+ defer func() {
+ delete(c.flowDatas, label)
+ c.flowDatas[nil] = prevFlowData
+ }()
+
+ if c.Flattened[s] {
+ data.endCase = c.caseCounter
+ c.caseCounter++
+
+ c.Indent(func() {
+ c.translateStmtList(clause.Body)
+ })
+ c.Printf("case %d:", data.endCase)
+ return
+ }
+
+ if label != nil || analysis.HasBreak(clause) {
+ if label != nil {
+ c.Printf("%s:", label.Name())
+ }
+ c.Printf("switch (0) { default:")
+ c.Indent(func() {
+ c.translateStmtList(clause.Body)
+ })
+ c.Printf("}")
+ return
+ }
+
+ c.translateStmtList(clause.Body)
+
+ case *ast.TypeSwitchStmt:
+ if s.Init != nil {
+ c.translateStmt(s.Init, nil)
+ }
+ refVar := c.newVariable("_ref")
+ var expr ast.Expr
+ switch a := s.Assign.(type) {
+ case *ast.AssignStmt:
+ expr = a.Rhs[0].(*ast.TypeAssertExpr).X
+ case *ast.ExprStmt:
+ expr = a.X.(*ast.TypeAssertExpr).X
+ }
+ c.Printf("%s = %s;", refVar, c.translateExpr(expr))
+ translateCond := func(cond ast.Expr) *expression {
+ if types.Identical(c.p.TypeOf(cond), types.Typ[types.UntypedNil]) {
+ return c.formatExpr("%s === $ifaceNil", refVar)
+ }
+ return c.formatExpr("$assertType(%s, %s, true)[1]", refVar, c.typeName(c.p.TypeOf(cond)))
+ }
+ var caseClauses []*ast.CaseClause
+ var defaultClause *ast.CaseClause
+ for _, cc := range s.Body.List {
+ clause := cc.(*ast.CaseClause)
+ var bodyPrefix []ast.Stmt
+ if implicit := c.p.Implicits[clause]; implicit != nil {
+ value := refVar
+ if typesutil.IsJsObject(implicit.Type().Underlying()) {
+ value += ".$val.object"
+ } else if _, ok := implicit.Type().Underlying().(*types.Interface); !ok {
+ value += ".$val"
+ }
+ bodyPrefix = []ast.Stmt{&ast.AssignStmt{
+ Lhs: []ast.Expr{c.newIdent(c.objectName(implicit), implicit.Type())},
+ Tok: token.DEFINE,
+ Rhs: []ast.Expr{c.newIdent(value, implicit.Type())},
+ }}
+ }
+ c := &ast.CaseClause{
+ List: clause.List,
+ Body: append(bodyPrefix, clause.Body...),
+ }
+ if len(c.List) == 0 {
+ defaultClause = c
+ continue
+ }
+ caseClauses = append(caseClauses, c)
+ }
+ c.translateBranchingStmt(caseClauses, defaultClause, true, translateCond, label, c.Flattened[s])
+
+ case *ast.ForStmt:
+ if s.Init != nil {
+ c.translateStmt(s.Init, nil)
+ }
+ cond := func() string {
+ if s.Cond == nil {
+ return "true"
+ }
+ return c.translateExpr(s.Cond).String()
+ }
+ c.translateLoopingStmt(cond, s.Body, nil, func() {
+ if s.Post != nil {
+ c.translateStmt(s.Post, nil)
+ }
+ }, label, c.Flattened[s])
+
+ case *ast.RangeStmt:
+ refVar := c.newVariable("_ref")
+ c.Printf("%s = %s;", refVar, c.translateExpr(s.X))
+
+ switch t := c.p.TypeOf(s.X).Underlying().(type) {
+ case *types.Basic:
+ iVar := c.newVariable("_i")
+ c.Printf("%s = 0;", iVar)
+ runeVar := c.newVariable("_rune")
+ c.translateLoopingStmt(func() string { return iVar + " < " + refVar + ".length" }, s.Body, func() {
+ c.Printf("%s = $decodeRune(%s, %s);", runeVar, refVar, iVar)
+ if !isBlank(s.Key) {
+ c.Printf("%s", c.translateAssign(s.Key, c.newIdent(iVar, types.Typ[types.Int]), s.Tok == token.DEFINE))
+ }
+ if !isBlank(s.Value) {
+ c.Printf("%s", c.translateAssign(s.Value, c.newIdent(runeVar+"[0]", types.Typ[types.Rune]), s.Tok == token.DEFINE))
+ }
+ }, func() {
+ c.Printf("%s += %s[1];", iVar, runeVar)
+ }, label, c.Flattened[s])
+
+ case *types.Map:
+ iVar := c.newVariable("_i")
+ c.Printf("%s = 0;", iVar)
+ keysVar := c.newVariable("_keys")
+ c.Printf("%s = $keys(%s);", keysVar, refVar)
+ c.translateLoopingStmt(func() string { return iVar + " < " + keysVar + ".length" }, s.Body, func() {
+ entryVar := c.newVariable("_entry")
+ c.Printf("%s = %s[%s[%s]];", entryVar, refVar, keysVar, iVar)
+ c.translateStmt(&ast.IfStmt{
+ Cond: c.newIdent(entryVar+" === undefined", types.Typ[types.Bool]),
+ Body: &ast.BlockStmt{List: []ast.Stmt{&ast.BranchStmt{Tok: token.CONTINUE}}},
+ }, nil)
+ if !isBlank(s.Key) {
+ c.Printf("%s", c.translateAssign(s.Key, c.newIdent(entryVar+".k", t.Key()), s.Tok == token.DEFINE))
+ }
+ if !isBlank(s.Value) {
+ c.Printf("%s", c.translateAssign(s.Value, c.newIdent(entryVar+".v", t.Elem()), s.Tok == token.DEFINE))
+ }
+ }, func() {
+ c.Printf("%s++;", iVar)
+ }, label, c.Flattened[s])
+
+ case *types.Array, *types.Pointer, *types.Slice:
+ var length string
+ var elemType types.Type
+ switch t2 := t.(type) {
+ case *types.Array:
+ length = fmt.Sprintf("%d", t2.Len())
+ elemType = t2.Elem()
+ case *types.Pointer:
+ length = fmt.Sprintf("%d", t2.Elem().Underlying().(*types.Array).Len())
+ elemType = t2.Elem().Underlying().(*types.Array).Elem()
+ case *types.Slice:
+ length = refVar + ".$length"
+ elemType = t2.Elem()
+ }
+ iVar := c.newVariable("_i")
+ c.Printf("%s = 0;", iVar)
+ c.translateLoopingStmt(func() string { return iVar + " < " + length }, s.Body, func() {
+ if !isBlank(s.Key) {
+ c.Printf("%s", c.translateAssign(s.Key, c.newIdent(iVar, types.Typ[types.Int]), s.Tok == token.DEFINE))
+ }
+ if !isBlank(s.Value) {
+ c.Printf("%s", c.translateAssign(s.Value, c.setType(&ast.IndexExpr{
+ X: c.newIdent(refVar, t),
+ Index: c.newIdent(iVar, types.Typ[types.Int]),
+ }, elemType), s.Tok == token.DEFINE))
+ }
+ }, func() {
+ c.Printf("%s++;", iVar)
+ }, label, c.Flattened[s])
+
+ case *types.Chan:
+ okVar := c.newIdent(c.newVariable("_ok"), types.Typ[types.Bool])
+ key := s.Key
+ tok := s.Tok
+ if key == nil {
+ key = ast.NewIdent("_")
+ tok = token.ASSIGN
+ }
+ forStmt := &ast.ForStmt{
+ Body: &ast.BlockStmt{
+ List: []ast.Stmt{
+ &ast.AssignStmt{
+ Lhs: []ast.Expr{
+ key,
+ okVar,
+ },
+ Rhs: []ast.Expr{
+ c.setType(&ast.UnaryExpr{X: c.newIdent(refVar, t), Op: token.ARROW}, types.NewTuple(types.NewVar(0, nil, "", t.Elem()), types.NewVar(0, nil, "", types.Typ[types.Bool]))),
+ },
+ Tok: tok,
+ },
+ &ast.IfStmt{
+ Cond: &ast.UnaryExpr{X: okVar, Op: token.NOT},
+ Body: &ast.BlockStmt{List: []ast.Stmt{&ast.BranchStmt{Tok: token.BREAK}}},
+ },
+ s.Body,
+ },
+ },
+ }
+ c.Flattened[forStmt] = true
+ c.translateStmt(forStmt, label)
+
+ default:
+ panic("")
+ }
+
+ case *ast.BranchStmt:
+ normalLabel := ""
+ blockingLabel := ""
+ data := c.flowDatas[nil]
+ if s.Label != nil {
+ normalLabel = " " + s.Label.Name
+ blockingLabel = " s" // use explicit label "s", because surrounding loop may not be flattened
+ data = c.flowDatas[c.p.Uses[s.Label].(*types.Label)]
+ }
+ switch s.Tok {
+ case token.BREAK:
+ c.PrintCond(data.endCase == 0, fmt.Sprintf("break%s;", normalLabel), fmt.Sprintf("$s = %d; continue%s;", data.endCase, blockingLabel))
+ case token.CONTINUE:
+ data.postStmt()
+ c.PrintCond(data.beginCase == 0, fmt.Sprintf("continue%s;", normalLabel), fmt.Sprintf("$s = %d; continue%s;", data.beginCase, blockingLabel))
+ case token.GOTO:
+ c.PrintCond(false, "goto "+s.Label.Name, fmt.Sprintf("$s = %d; continue;", c.labelCase(c.p.Uses[s.Label].(*types.Label))))
+ case token.FALLTHROUGH:
+ // handled in CaseClause
+ default:
+ panic("Unhandled branch statment: " + s.Tok.String())
+ }
+
+ case *ast.ReturnStmt:
+ results := s.Results
+ if c.resultNames != nil {
+ if len(s.Results) != 0 {
+ c.translateStmt(&ast.AssignStmt{
+ Lhs: c.resultNames,
+ Tok: token.ASSIGN,
+ Rhs: s.Results,
+ }, nil)
+ }
+ results = c.resultNames
+ }
+ rVal := c.translateResults(results)
+ if len(c.Flattened) != 0 {
+ c.Printf("$s = -1; return%s;", rVal)
+ return
+ }
+ c.Printf("return%s;", rVal)
+
+ case *ast.DeferStmt:
+ isBuiltin := false
+ isJs := false
+ switch fun := s.Call.Fun.(type) {
+ case *ast.Ident:
+ var builtin *types.Builtin
+ builtin, isBuiltin = c.p.Uses[fun].(*types.Builtin)
+ if isBuiltin && builtin.Name() == "recover" {
+ c.Printf("$deferred.push([$recover, []]);")
+ return
+ }
+ case *ast.SelectorExpr:
+ isJs = typesutil.IsJsPackage(c.p.Uses[fun.Sel].Pkg())
+ }
+ sig := c.p.TypeOf(s.Call.Fun).Underlying().(*types.Signature)
+ args := c.translateArgs(sig, s.Call.Args, s.Call.Ellipsis.IsValid())
+ if isBuiltin || isJs {
+ vars := make([]string, len(s.Call.Args))
+ callArgs := make([]ast.Expr, len(s.Call.Args))
+ for i, arg := range s.Call.Args {
+ v := c.newVariable("_arg")
+ vars[i] = v
+ callArgs[i] = c.newIdent(v, c.p.TypeOf(arg))
+ }
+ call := c.translateExpr(&ast.CallExpr{
+ Fun: s.Call.Fun,
+ Args: callArgs,
+ Ellipsis: s.Call.Ellipsis,
+ })
+ c.Printf("$deferred.push([function(%s) { %s; }, [%s]]);", strings.Join(vars, ", "), call, strings.Join(args, ", "))
+ return
+ }
+ c.Printf("$deferred.push([%s, [%s]]);", c.translateExpr(s.Call.Fun), strings.Join(args, ", "))
+
+ case *ast.AssignStmt:
+ if s.Tok != token.ASSIGN && s.Tok != token.DEFINE {
+ panic(s.Tok)
+ }
+
+ switch {
+ case len(s.Lhs) == 1 && len(s.Rhs) == 1:
+ lhs := astutil.RemoveParens(s.Lhs[0])
+ if isBlank(lhs) {
+ c.Printf("$unused(%s);", c.translateExpr(s.Rhs[0]))
+ return
+ }
+ c.Printf("%s", c.translateAssign(lhs, s.Rhs[0], s.Tok == token.DEFINE))
+
+ case len(s.Lhs) > 1 && len(s.Rhs) == 1:
+ tupleVar := c.newVariable("_tuple")
+ c.Printf("%s = %s;", tupleVar, c.translateExpr(s.Rhs[0]))
+ tuple := c.p.TypeOf(s.Rhs[0]).(*types.Tuple)
+ for i, lhs := range s.Lhs {
+ lhs = astutil.RemoveParens(lhs)
+ if !isBlank(lhs) {
+ c.Printf("%s", c.translateAssign(lhs, c.newIdent(fmt.Sprintf("%s[%d]", tupleVar, i), tuple.At(i).Type()), s.Tok == token.DEFINE))
+ }
+ }
+ case len(s.Lhs) == len(s.Rhs):
+ tmpVars := make([]string, len(s.Rhs))
+ for i, rhs := range s.Rhs {
+ tmpVars[i] = c.newVariable("_tmp")
+ if isBlank(astutil.RemoveParens(s.Lhs[i])) {
+ c.Printf("$unused(%s);", c.translateExpr(rhs))
+ continue
+ }
+ c.Printf("%s", c.translateAssign(c.newIdent(tmpVars[i], c.p.TypeOf(s.Lhs[i])), rhs, true))
+ }
+ for i, lhs := range s.Lhs {
+ lhs = astutil.RemoveParens(lhs)
+ if !isBlank(lhs) {
+ c.Printf("%s", c.translateAssign(lhs, c.newIdent(tmpVars[i], c.p.TypeOf(lhs)), s.Tok == token.DEFINE))
+ }
+ }
+
+ default:
+ panic("Invalid arity of AssignStmt.")
+
+ }
+
+ case *ast.DeclStmt:
+ decl := s.Decl.(*ast.GenDecl)
+ switch decl.Tok {
+ case token.VAR:
+ for _, spec := range s.Decl.(*ast.GenDecl).Specs {
+ valueSpec := spec.(*ast.ValueSpec)
+ lhs := make([]ast.Expr, len(valueSpec.Names))
+ for i, name := range valueSpec.Names {
+ lhs[i] = name
+ }
+ rhs := valueSpec.Values
+ if len(rhs) == 0 {
+ rhs = make([]ast.Expr, len(lhs))
+ for i, e := range lhs {
+ rhs[i] = c.zeroValue(c.p.TypeOf(e))
+ }
+ }
+ c.translateStmt(&ast.AssignStmt{
+ Lhs: lhs,
+ Tok: token.DEFINE,
+ Rhs: rhs,
+ }, nil)
+ }
+ case token.TYPE:
+ for _, spec := range decl.Specs {
+ o := c.p.Defs[spec.(*ast.TypeSpec).Name].(*types.TypeName)
+ c.p.typeNames = append(c.p.typeNames, o)
+ c.p.objectNames[o] = c.newVariableWithLevel(o.Name(), true)
+ c.p.dependencies[o] = true
+ }
+ case token.CONST:
+ // skip, constants are inlined
+ }
+
+ case *ast.ExprStmt:
+ expr := c.translateExpr(s.X)
+ if expr != nil && expr.String() != "" {
+ c.Printf("%s;", expr)
+ }
+
+ case *ast.LabeledStmt:
+ label := c.p.Defs[s.Label].(*types.Label)
+ if c.GotoLabel[label] {
+ c.PrintCond(false, s.Label.Name+":", fmt.Sprintf("case %d:", c.labelCase(label)))
+ }
+ c.translateStmt(s.Stmt, label)
+
+ case *ast.GoStmt:
+ c.Printf("$go(%s, [%s]);", c.translateExpr(s.Call.Fun), strings.Join(c.translateArgs(c.p.TypeOf(s.Call.Fun).Underlying().(*types.Signature), s.Call.Args, s.Call.Ellipsis.IsValid()), ", "))
+
+ case *ast.SendStmt:
+ chanType := c.p.TypeOf(s.Chan).Underlying().(*types.Chan)
+ call := &ast.CallExpr{
+ Fun: c.newIdent("$send", types.NewSignature(nil, types.NewTuple(types.NewVar(0, nil, "", chanType), types.NewVar(0, nil, "", chanType.Elem())), nil, false)),
+ Args: []ast.Expr{s.Chan, c.newIdent(c.translateImplicitConversionWithCloning(s.Value, chanType.Elem()).String(), chanType.Elem())},
+ }
+ c.Blocking[call] = true
+ c.translateStmt(&ast.ExprStmt{X: call}, label)
+
+ case *ast.SelectStmt:
+ selectionVar := c.newVariable("_selection")
+ var channels []string
+ var caseClauses []*ast.CaseClause
+ flattened := false
+ hasDefault := false
+ for i, cc := range s.Body.List {
+ clause := cc.(*ast.CommClause)
+ switch comm := clause.Comm.(type) {
+ case nil:
+ channels = append(channels, "[]")
+ hasDefault = true
+ case *ast.ExprStmt:
+ channels = append(channels, c.formatExpr("[%e]", astutil.RemoveParens(comm.X).(*ast.UnaryExpr).X).String())
+ case *ast.AssignStmt:
+ channels = append(channels, c.formatExpr("[%e]", astutil.RemoveParens(comm.Rhs[0]).(*ast.UnaryExpr).X).String())
+ case *ast.SendStmt:
+ chanType := c.p.TypeOf(comm.Chan).Underlying().(*types.Chan)
+ channels = append(channels, c.formatExpr("[%e, %s]", comm.Chan, c.translateImplicitConversionWithCloning(comm.Value, chanType.Elem())).String())
+ default:
+ panic(fmt.Sprintf("unhandled: %T", comm))
+ }
+
+ indexLit := &ast.BasicLit{Kind: token.INT}
+ c.p.Types[indexLit] = types.TypeAndValue{Type: types.Typ[types.Int], Value: constant.MakeInt64(int64(i))}
+
+ var bodyPrefix []ast.Stmt
+ if assign, ok := clause.Comm.(*ast.AssignStmt); ok {
+ switch rhsType := c.p.TypeOf(assign.Rhs[0]).(type) {
+ case *types.Tuple:
+ bodyPrefix = []ast.Stmt{&ast.AssignStmt{Lhs: assign.Lhs, Rhs: []ast.Expr{c.newIdent(selectionVar+"[1]", rhsType)}, Tok: assign.Tok}}
+ default:
+ bodyPrefix = []ast.Stmt{&ast.AssignStmt{Lhs: assign.Lhs, Rhs: []ast.Expr{c.newIdent(selectionVar+"[1][0]", rhsType)}, Tok: assign.Tok}}
+ }
+ }
+
+ caseClauses = append(caseClauses, &ast.CaseClause{
+ List: []ast.Expr{indexLit},
+ Body: append(bodyPrefix, clause.Body...),
+ })
+
+ flattened = flattened || c.Flattened[clause]
+ }
+
+ selectCall := c.setType(&ast.CallExpr{
+ Fun: c.newIdent("$select", types.NewSignature(nil, types.NewTuple(types.NewVar(0, nil, "", types.NewInterface(nil, nil))), types.NewTuple(types.NewVar(0, nil, "", types.Typ[types.Int])), false)),
+ Args: []ast.Expr{c.newIdent(fmt.Sprintf("[%s]", strings.Join(channels, ", ")), types.NewInterface(nil, nil))},
+ }, types.Typ[types.Int])
+ c.Blocking[selectCall] = !hasDefault
+ c.Printf("%s = %s;", selectionVar, c.translateExpr(selectCall))
+
+ if len(caseClauses) != 0 {
+ translateCond := func(cond ast.Expr) *expression {
+ return c.formatExpr("%s[0] === %e", selectionVar, cond)
+ }
+ c.translateBranchingStmt(caseClauses, nil, true, translateCond, label, flattened)
+ }
+
+ case *ast.EmptyStmt:
+ // skip
+
+ default:
+ panic(fmt.Sprintf("Unhandled statement: %T\n", s))
+
+ }
+}
+
+func (c *funcContext) translateBranchingStmt(caseClauses []*ast.CaseClause, defaultClause *ast.CaseClause, canBreak bool, translateCond func(ast.Expr) *expression, label *types.Label, flatten bool) {
+ var caseOffset, defaultCase, endCase int
+ if flatten {
+ caseOffset = c.caseCounter
+ defaultCase = caseOffset + len(caseClauses)
+ endCase = defaultCase
+ if defaultClause != nil {
+ endCase++
+ }
+ c.caseCounter = endCase + 1
+ }
+
+ hasBreak := false
+ if canBreak {
+ prevFlowData := c.flowDatas[nil]
+ data := &flowData{
+ postStmt: prevFlowData.postStmt, // for "continue" of outer loop
+ beginCase: prevFlowData.beginCase, // same
+ endCase: endCase,
+ }
+ c.flowDatas[nil] = data
+ c.flowDatas[label] = data
+ defer func() {
+ delete(c.flowDatas, label)
+ c.flowDatas[nil] = prevFlowData
+ }()
+
+ for _, child := range caseClauses {
+ if analysis.HasBreak(child) {
+ hasBreak = true
+ break
+ }
+ }
+ if defaultClause != nil && analysis.HasBreak(defaultClause) {
+ hasBreak = true
+ }
+ }
+
+ if label != nil && !flatten {
+ c.Printf("%s:", label.Name())
+ }
+
+ condStrs := make([]string, len(caseClauses))
+ for i, clause := range caseClauses {
+ conds := make([]string, len(clause.List))
+ for j, cond := range clause.List {
+ conds[j] = translateCond(cond).String()
+ }
+ condStrs[i] = strings.Join(conds, " || ")
+ if flatten {
+ c.Printf("/* */ if (%s) { $s = %d; continue; }", condStrs[i], caseOffset+i)
+ }
+ }
+
+ if flatten {
+ c.Printf("/* */ $s = %d; continue;", defaultCase)
+ }
+
+ prefix := ""
+ suffix := ""
+ if label != nil || hasBreak {
+ prefix = "switch (0) { default: "
+ suffix = " }"
+ }
+
+ for i, clause := range caseClauses {
+ c.SetPos(clause.Pos())
+ c.PrintCond(!flatten, fmt.Sprintf("%sif (%s) {", prefix, condStrs[i]), fmt.Sprintf("case %d:", caseOffset+i))
+ c.Indent(func() {
+ c.translateStmtList(clause.Body)
+ if flatten && (i < len(caseClauses)-1 || defaultClause != nil) && !endsWithReturn(clause.Body) {
+ c.Printf("$s = %d; continue;", endCase)
+ }
+ })
+ prefix = "} else "
+ }
+
+ if defaultClause != nil {
+ c.PrintCond(!flatten, prefix+"{", fmt.Sprintf("case %d:", caseOffset+len(caseClauses)))
+ c.Indent(func() {
+ c.translateStmtList(defaultClause.Body)
+ })
+ }
+
+ c.PrintCond(!flatten, "}"+suffix, fmt.Sprintf("case %d:", endCase))
+}
+
+func (c *funcContext) translateLoopingStmt(cond func() string, body *ast.BlockStmt, bodyPrefix, post func(), label *types.Label, flatten bool) {
+ prevFlowData := c.flowDatas[nil]
+ data := &flowData{
+ postStmt: post,
+ }
+ if flatten {
+ data.beginCase = c.caseCounter
+ data.endCase = c.caseCounter + 1
+ c.caseCounter += 2
+ }
+ c.flowDatas[nil] = data
+ c.flowDatas[label] = data
+ defer func() {
+ delete(c.flowDatas, label)
+ c.flowDatas[nil] = prevFlowData
+ }()
+
+ if !flatten && label != nil {
+ c.Printf("%s:", label.Name())
+ }
+ c.PrintCond(!flatten, "while (true) {", fmt.Sprintf("case %d:", data.beginCase))
+ c.Indent(func() {
+ condStr := cond()
+ if condStr != "true" {
+ c.PrintCond(!flatten, fmt.Sprintf("if (!(%s)) { break; }", condStr), fmt.Sprintf("if(!(%s)) { $s = %d; continue; }", condStr, data.endCase))
+ }
+
+ prevEV := c.p.escapingVars
+ c.handleEscapingVars(body)
+
+ if bodyPrefix != nil {
+ bodyPrefix()
+ }
+ c.translateStmtList(body.List)
+ isTerminated := false
+ if len(body.List) != 0 {
+ switch body.List[len(body.List)-1].(type) {
+ case *ast.ReturnStmt, *ast.BranchStmt:
+ isTerminated = true
+ }
+ }
+ if !isTerminated {
+ post()
+ }
+
+ c.p.escapingVars = prevEV
+ })
+ c.PrintCond(!flatten, "}", fmt.Sprintf("$s = %d; continue; case %d:", data.beginCase, data.endCase))
+}
+
+func (c *funcContext) translateAssign(lhs, rhs ast.Expr, define bool) string {
+ lhs = astutil.RemoveParens(lhs)
+ if isBlank(lhs) {
+ panic("translateAssign with blank lhs")
+ }
+
+ if l, ok := lhs.(*ast.IndexExpr); ok {
+ if t, ok := c.p.TypeOf(l.X).Underlying().(*types.Map); ok {
+ if typesutil.IsJsObject(c.p.TypeOf(l.Index)) {
+ c.p.errList = append(c.p.errList, types.Error{Fset: c.p.fileSet, Pos: l.Index.Pos(), Msg: "cannot use js.Object as map key"})
+ }
+ keyVar := c.newVariable("_key")
+ return fmt.Sprintf(`%s = %s; (%s || $throwRuntimeError("assignment to entry in nil map"))[%s.keyFor(%s)] = { k: %s, v: %s };`, keyVar, c.translateImplicitConversionWithCloning(l.Index, t.Key()), c.translateExpr(l.X), c.typeName(t.Key()), keyVar, keyVar, c.translateImplicitConversionWithCloning(rhs, t.Elem()))
+ }
+ }
+
+ lhsType := c.p.TypeOf(lhs)
+ rhsExpr := c.translateImplicitConversion(rhs, lhsType)
+ if _, ok := rhs.(*ast.CompositeLit); ok && define {
+ return fmt.Sprintf("%s = %s;", c.translateExpr(lhs), rhsExpr) // skip $copy
+ }
+
+ isReflectValue := false
+ if named, ok := lhsType.(*types.Named); ok && named.Obj().Pkg() != nil && named.Obj().Pkg().Path() == "reflect" && named.Obj().Name() == "Value" {
+ isReflectValue = true
+ }
+ if !isReflectValue { // this is a performance hack, but it is safe since reflect.Value has no exported fields and the reflect package does not violate this assumption
+ switch lhsType.Underlying().(type) {
+ case *types.Array, *types.Struct:
+ if define {
+ return fmt.Sprintf("%s = $clone(%s, %s);", c.translateExpr(lhs), rhsExpr, c.typeName(lhsType))
+ }
+ return fmt.Sprintf("%s.copy(%s, %s);", c.typeName(lhsType), c.translateExpr(lhs), rhsExpr)
+ }
+ }
+
+ switch l := lhs.(type) {
+ case *ast.Ident:
+ return fmt.Sprintf("%s = %s;", c.objectName(c.p.ObjectOf(l)), rhsExpr)
+ case *ast.SelectorExpr:
+ sel, ok := c.p.SelectionOf(l)
+ if !ok {
+ // qualified identifier
+ return fmt.Sprintf("%s = %s;", c.objectName(c.p.Uses[l.Sel]), rhsExpr)
+ }
+ fields, jsTag := c.translateSelection(sel, l.Pos())
+ if jsTag != "" {
+ return fmt.Sprintf("%s.%s%s = %s;", c.translateExpr(l.X), strings.Join(fields, "."), formatJSStructTagVal(jsTag), c.externalize(rhsExpr.String(), sel.Type()))
+ }
+ return fmt.Sprintf("%s.%s = %s;", c.translateExpr(l.X), strings.Join(fields, "."), rhsExpr)
+ case *ast.StarExpr:
+ return fmt.Sprintf("%s.$set(%s);", c.translateExpr(l.X), rhsExpr)
+ case *ast.IndexExpr:
+ switch t := c.p.TypeOf(l.X).Underlying().(type) {
+ case *types.Array, *types.Pointer:
+ pattern := rangeCheck("%1e[%2f] = %3s", c.p.Types[l.Index].Value != nil, true)
+ if _, ok := t.(*types.Pointer); ok { // check pointer for nil (attribute getter causes a panic)
+ pattern = `%1e.nilCheck, ` + pattern
+ }
+ return c.formatExpr(pattern, l.X, l.Index, rhsExpr).String() + ";"
+ case *types.Slice:
+ return c.formatExpr(rangeCheck("%1e.$array[%1e.$offset + %2f] = %3s", c.p.Types[l.Index].Value != nil, false), l.X, l.Index, rhsExpr).String() + ";"
+ default:
+ panic(fmt.Sprintf("Unhandled lhs type: %T\n", t))
+ }
+ default:
+ panic(fmt.Sprintf("Unhandled lhs type: %T\n", l))
+ }
+}
+
+func (c *funcContext) translateResults(results []ast.Expr) string {
+ tuple := c.sig.Results()
+ switch tuple.Len() {
+ case 0:
+ return ""
+ case 1:
+ result := c.zeroValue(tuple.At(0).Type())
+ if results != nil {
+ result = results[0]
+ }
+ v := c.translateImplicitConversion(result, tuple.At(0).Type())
+ c.delayedOutput = nil
+ return " " + v.String()
+ default:
+ if len(results) == 1 {
+ resultTuple := c.p.TypeOf(results[0]).(*types.Tuple)
+
+ if resultTuple.Len() != tuple.Len() {
+ panic("invalid tuple return assignment")
+ }
+
+ resultExpr := c.translateExpr(results[0]).String()
+
+ if types.Identical(resultTuple, tuple) {
+ return " " + resultExpr
+ }
+
+ tmpVar := c.newVariable("_returncast")
+ c.Printf("%s = %s;", tmpVar, resultExpr)
+
+ // Not all the return types matched, map everything out for implicit casting
+ results = make([]ast.Expr, resultTuple.Len())
+ for i := range results {
+ results[i] = c.newIdent(fmt.Sprintf("%s[%d]", tmpVar, i), resultTuple.At(i).Type())
+ }
+ }
+ values := make([]string, tuple.Len())
+ for i := range values {
+ result := c.zeroValue(tuple.At(i).Type())
+ if results != nil {
+ result = results[i]
+ }
+ values[i] = c.translateImplicitConversion(result, tuple.At(i).Type()).String()
+ }
+ c.delayedOutput = nil
+ return " [" + strings.Join(values, ", ") + "]"
+ }
+}
+
+func (c *funcContext) labelCase(label *types.Label) int {
+ labelCase, ok := c.labelCases[label]
+ if !ok {
+ labelCase = c.caseCounter
+ c.caseCounter++
+ c.labelCases[label] = labelCase
+ }
+ return labelCase
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/typesutil/typesutil.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/typesutil/typesutil.go
new file mode 100644
index 00000000000..600925b8148
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/typesutil/typesutil.go
@@ -0,0 +1,16 @@
+package typesutil
+
+import "go/types"
+
+func IsJsPackage(pkg *types.Package) bool {
+ return pkg != nil && pkg.Path() == "github.com/gopherjs/gopherjs/js"
+}
+
+func IsJsObject(t types.Type) bool {
+ ptr, isPtr := t.(*types.Pointer)
+ if !isPtr {
+ return false
+ }
+ named, isNamed := ptr.Elem().(*types.Named)
+ return isNamed && IsJsPackage(named.Obj().Pkg()) && named.Obj().Name() == "Object"
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/utils.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/utils.go
new file mode 100644
index 00000000000..d5452e0a634
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/utils.go
@@ -0,0 +1,673 @@
+package compiler
+
+import (
+ "bytes"
+ "encoding/binary"
+ "fmt"
+ "go/ast"
+ "go/constant"
+ "go/token"
+ "go/types"
+ "net/url"
+ "sort"
+ "strconv"
+ "strings"
+ "text/template"
+ "unicode"
+
+ "github.com/gopherjs/gopherjs/compiler/analysis"
+ "github.com/gopherjs/gopherjs/compiler/typesutil"
+)
+
+func (c *funcContext) Write(b []byte) (int, error) {
+ c.writePos()
+ c.output = append(c.output, b...)
+ return len(b), nil
+}
+
+func (c *funcContext) Printf(format string, values ...interface{}) {
+ c.Write([]byte(strings.Repeat("\t", c.p.indentation)))
+ fmt.Fprintf(c, format, values...)
+ c.Write([]byte{'\n'})
+ c.Write(c.delayedOutput)
+ c.delayedOutput = nil
+}
+
+func (c *funcContext) PrintCond(cond bool, onTrue, onFalse string) {
+ if !cond {
+ c.Printf("/* %s */ %s", strings.Replace(onTrue, "*/", "<star>/", -1), onFalse)
+ return
+ }
+ c.Printf("%s", onTrue)
+}
+
+func (c *funcContext) SetPos(pos token.Pos) {
+ c.posAvailable = true
+ c.pos = pos
+}
+
+func (c *funcContext) writePos() {
+ if c.posAvailable {
+ c.posAvailable = false
+ c.Write([]byte{'\b'})
+ binary.Write(c, binary.BigEndian, uint32(c.pos))
+ }
+}
+
+func (c *funcContext) Indent(f func()) {
+ c.p.indentation++
+ f()
+ c.p.indentation--
+}
+
+func (c *funcContext) CatchOutput(indent int, f func()) []byte {
+ origoutput := c.output
+ c.output = nil
+ c.p.indentation += indent
+ f()
+ c.writePos()
+ catched := c.output
+ c.output = origoutput
+ c.p.indentation -= indent
+ return catched
+}
+
+func (c *funcContext) Delayed(f func()) {
+ c.delayedOutput = c.CatchOutput(0, f)
+}
+
+func (c *funcContext) translateArgs(sig *types.Signature, argExprs []ast.Expr, ellipsis bool) []string {
+ if len(argExprs) == 1 {
+ if tuple, isTuple := c.p.TypeOf(argExprs[0]).(*types.Tuple); isTuple {
+ tupleVar := c.newVariable("_tuple")
+ c.Printf("%s = %s;", tupleVar, c.translateExpr(argExprs[0]))
+ argExprs = make([]ast.Expr, tuple.Len())
+ for i := range argExprs {
+ argExprs[i] = c.newIdent(c.formatExpr("%s[%d]", tupleVar, i).String(), tuple.At(i).Type())
+ }
+ }
+ }
+
+ paramsLen := sig.Params().Len()
+
+ var varargType *types.Slice
+ if sig.Variadic() && !ellipsis {
+ varargType = sig.Params().At(paramsLen - 1).Type().(*types.Slice)
+ }
+
+ preserveOrder := false
+ for i := 1; i < len(argExprs); i++ {
+ preserveOrder = preserveOrder || c.Blocking[argExprs[i]]
+ }
+
+ args := make([]string, len(argExprs))
+ for i, argExpr := range argExprs {
+ var argType types.Type
+ switch {
+ case varargType != nil && i >= paramsLen-1:
+ argType = varargType.Elem()
+ default:
+ argType = sig.Params().At(i).Type()
+ }
+
+ arg := c.translateImplicitConversionWithCloning(argExpr, argType).String()
+
+ if preserveOrder && c.p.Types[argExpr].Value == nil {
+ argVar := c.newVariable("_arg")
+ c.Printf("%s = %s;", argVar, arg)
+ arg = argVar
+ }
+
+ args[i] = arg
+ }
+
+ if varargType != nil {
+ return append(args[:paramsLen-1], fmt.Sprintf("new %s([%s])", c.typeName(varargType), strings.Join(args[paramsLen-1:], ", ")))
+ }
+ return args
+}
+
+func (c *funcContext) translateSelection(sel selection, pos token.Pos) ([]string, string) {
+ var fields []string
+ t := sel.Recv()
+ for _, index := range sel.Index() {
+ if ptr, isPtr := t.(*types.Pointer); isPtr {
+ t = ptr.Elem()
+ }
+ s := t.Underlying().(*types.Struct)
+ if jsTag := getJsTag(s.Tag(index)); jsTag != "" {
+ jsFieldName := s.Field(index).Name()
+ for {
+ fields = append(fields, fieldName(s, 0))
+ ft := s.Field(0).Type()
+ if typesutil.IsJsObject(ft) {
+ return fields, jsTag
+ }
+ ft = ft.Underlying()
+ if ptr, ok := ft.(*types.Pointer); ok {
+ ft = ptr.Elem().Underlying()
+ }
+ var ok bool
+ s, ok = ft.(*types.Struct)
+ if !ok || s.NumFields() == 0 {
+ c.p.errList = append(c.p.errList, types.Error{Fset: c.p.fileSet, Pos: pos, Msg: fmt.Sprintf("could not find field with type *js.Object for 'js' tag of field '%s'", jsFieldName), Soft: true})
+ return nil, ""
+ }
+ }
+ }
+ fields = append(fields, fieldName(s, index))
+ t = s.Field(index).Type()
+ }
+ return fields, ""
+}
+
+var nilObj = types.Universe.Lookup("nil")
+
+func (c *funcContext) zeroValue(ty types.Type) ast.Expr {
+ switch t := ty.Underlying().(type) {
+ case *types.Basic:
+ switch {
+ case isBoolean(t):
+ return c.newConst(ty, constant.MakeBool(false))
+ case isNumeric(t):
+ return c.newConst(ty, constant.MakeInt64(0))
+ case isString(t):
+ return c.newConst(ty, constant.MakeString(""))
+ case t.Kind() == types.UnsafePointer:
+ // fall through to "nil"
+ case t.Kind() == types.UntypedNil:
+ panic("Zero value for untyped nil.")
+ default:
+ panic(fmt.Sprintf("Unhandled basic type: %v\n", t))
+ }
+ case *types.Array, *types.Struct:
+ return c.setType(&ast.CompositeLit{}, ty)
+ case *types.Chan, *types.Interface, *types.Map, *types.Signature, *types.Slice, *types.Pointer:
+ // fall through to "nil"
+ default:
+ panic(fmt.Sprintf("Unhandled type: %T\n", t))
+ }
+ id := c.newIdent("nil", ty)
+ c.p.Uses[id] = nilObj
+ return id
+}
+
+func (c *funcContext) newConst(t types.Type, value constant.Value) ast.Expr {
+ id := &ast.Ident{}
+ c.p.Types[id] = types.TypeAndValue{Type: t, Value: value}
+ return id
+}
+
+func (c *funcContext) newVariable(name string) string {
+ return c.newVariableWithLevel(name, false)
+}
+
+func (c *funcContext) newVariableWithLevel(name string, pkgLevel bool) string {
+ if name == "" {
+ panic("newVariable: empty name")
+ }
+ name = encodeIdent(name)
+ if c.p.minify {
+ i := 0
+ for {
+ offset := int('a')
+ if pkgLevel {
+ offset = int('A')
+ }
+ j := i
+ name = ""
+ for {
+ name = string(offset+(j%26)) + name
+ j = j/26 - 1
+ if j == -1 {
+ break
+ }
+ }
+ if c.allVars[name] == 0 {
+ break
+ }
+ i++
+ }
+ }
+ n := c.allVars[name]
+ c.allVars[name] = n + 1
+ varName := name
+ if n > 0 {
+ varName = fmt.Sprintf("%s$%d", name, n)
+ }
+
+ if pkgLevel {
+ for c2 := c.parent; c2 != nil; c2 = c2.parent {
+ c2.allVars[name] = n + 1
+ }
+ return varName
+ }
+
+ c.localVars = append(c.localVars, varName)
+ return varName
+}
+
+func (c *funcContext) newIdent(name string, t types.Type) *ast.Ident {
+ ident := ast.NewIdent(name)
+ c.setType(ident, t)
+ obj := types.NewVar(0, c.p.Pkg, name, t)
+ c.p.Uses[ident] = obj
+ c.p.objectNames[obj] = name
+ return ident
+}
+
+func (c *funcContext) setType(e ast.Expr, t types.Type) ast.Expr {
+ c.p.Types[e] = types.TypeAndValue{Type: t}
+ return e
+}
+
+func (c *funcContext) pkgVar(pkg *types.Package) string {
+ if pkg == c.p.Pkg {
+ return "$pkg"
+ }
+
+ pkgVar, found := c.p.pkgVars[pkg.Path()]
+ if !found {
+ pkgVar = fmt.Sprintf(`$packages["%s"]`, pkg.Path())
+ }
+ return pkgVar
+}
+
+func isVarOrConst(o types.Object) bool {
+ switch o.(type) {
+ case *types.Var, *types.Const:
+ return true
+ }
+ return false
+}
+
+func isPkgLevel(o types.Object) bool {
+ return o.Parent() != nil && o.Parent().Parent() == types.Universe
+}
+
+func (c *funcContext) objectName(o types.Object) string {
+ if isPkgLevel(o) {
+ c.p.dependencies[o] = true
+
+ if o.Pkg() != c.p.Pkg || (isVarOrConst(o) && o.Exported()) {
+ return c.pkgVar(o.Pkg()) + "." + o.Name()
+ }
+ }
+
+ name, ok := c.p.objectNames[o]
+ if !ok {
+ name = c.newVariableWithLevel(o.Name(), isPkgLevel(o))
+ c.p.objectNames[o] = name
+ }
+
+ if v, ok := o.(*types.Var); ok && c.p.escapingVars[v] {
+ return name + "[0]"
+ }
+ return name
+}
+
+func (c *funcContext) varPtrName(o *types.Var) string {
+ if isPkgLevel(o) && o.Exported() {
+ return c.pkgVar(o.Pkg()) + "." + o.Name() + "$ptr"
+ }
+
+ name, ok := c.p.varPtrNames[o]
+ if !ok {
+ name = c.newVariableWithLevel(o.Name()+"$ptr", isPkgLevel(o))
+ c.p.varPtrNames[o] = name
+ }
+ return name
+}
+
+func (c *funcContext) typeName(ty types.Type) string {
+ switch t := ty.(type) {
+ case *types.Basic:
+ return "$" + toJavaScriptType(t)
+ case *types.Named:
+ if t.Obj().Name() == "error" {
+ return "$error"
+ }
+ return c.objectName(t.Obj())
+ case *types.Interface:
+ if t.Empty() {
+ return "$emptyInterface"
+ }
+ }
+
+ anonType, ok := c.p.anonTypeMap.At(ty).(*types.TypeName)
+ if !ok {
+ c.initArgs(ty) // cause all embedded types to be registered
+ varName := c.newVariableWithLevel(strings.ToLower(typeKind(ty)[5:])+"Type", true)
+ anonType = types.NewTypeName(token.NoPos, c.p.Pkg, varName, ty) // fake types.TypeName
+ c.p.anonTypes = append(c.p.anonTypes, anonType)
+ c.p.anonTypeMap.Set(ty, anonType)
+ }
+ c.p.dependencies[anonType] = true
+ return anonType.Name()
+}
+
+func (c *funcContext) externalize(s string, t types.Type) string {
+ if typesutil.IsJsObject(t) {
+ return s
+ }
+ switch u := t.Underlying().(type) {
+ case *types.Basic:
+ if isNumeric(u) && !is64Bit(u) && !isComplex(u) {
+ return s
+ }
+ if u.Kind() == types.UntypedNil {
+ return "null"
+ }
+ }
+ return fmt.Sprintf("$externalize(%s, %s)", s, c.typeName(t))
+}
+
+func (c *funcContext) handleEscapingVars(n ast.Node) {
+ newEscapingVars := make(map[*types.Var]bool)
+ for escaping := range c.p.escapingVars {
+ newEscapingVars[escaping] = true
+ }
+ c.p.escapingVars = newEscapingVars
+
+ var names []string
+ objs := analysis.EscapingObjects(n, c.p.Info.Info)
+ sort.Slice(objs, func(i, j int) bool {
+ if objs[i].Name() == objs[j].Name() {
+ return objs[i].Pos() < objs[j].Pos()
+ }
+ return objs[i].Name() < objs[j].Name()
+ })
+ for _, obj := range objs {
+ names = append(names, c.objectName(obj))
+ c.p.escapingVars[obj] = true
+ }
+ sort.Strings(names)
+ for _, name := range names {
+ c.Printf("%s = [%s];", name, name)
+ }
+}
+
+func fieldName(t *types.Struct, i int) string {
+ name := t.Field(i).Name()
+ if name == "_" || reservedKeywords[name] {
+ return fmt.Sprintf("%s$%d", name, i)
+ }
+ return name
+}
+
+func typeKind(ty types.Type) string {
+ switch t := ty.Underlying().(type) {
+ case *types.Basic:
+ return "$kind" + toJavaScriptType(t)
+ case *types.Array:
+ return "$kindArray"
+ case *types.Chan:
+ return "$kindChan"
+ case *types.Interface:
+ return "$kindInterface"
+ case *types.Map:
+ return "$kindMap"
+ case *types.Signature:
+ return "$kindFunc"
+ case *types.Slice:
+ return "$kindSlice"
+ case *types.Struct:
+ return "$kindStruct"
+ case *types.Pointer:
+ return "$kindPtr"
+ default:
+ panic(fmt.Sprintf("Unhandled type: %T\n", t))
+ }
+}
+
+func toJavaScriptType(t *types.Basic) string {
+ switch t.Kind() {
+ case types.UntypedInt:
+ return "Int"
+ case types.Byte:
+ return "Uint8"
+ case types.Rune:
+ return "Int32"
+ case types.UnsafePointer:
+ return "UnsafePointer"
+ default:
+ name := t.String()
+ return strings.ToUpper(name[:1]) + name[1:]
+ }
+}
+
+func is64Bit(t *types.Basic) bool {
+ return t.Kind() == types.Int64 || t.Kind() == types.Uint64
+}
+
+func isBoolean(t *types.Basic) bool {
+ return t.Info()&types.IsBoolean != 0
+}
+
+func isComplex(t *types.Basic) bool {
+ return t.Info()&types.IsComplex != 0
+}
+
+func isFloat(t *types.Basic) bool {
+ return t.Info()&types.IsFloat != 0
+}
+
+func isInteger(t *types.Basic) bool {
+ return t.Info()&types.IsInteger != 0
+}
+
+func isNumeric(t *types.Basic) bool {
+ return t.Info()&types.IsNumeric != 0
+}
+
+func isString(t *types.Basic) bool {
+ return t.Info()&types.IsString != 0
+}
+
+func isUnsigned(t *types.Basic) bool {
+ return t.Info()&types.IsUnsigned != 0
+}
+
+func isBlank(expr ast.Expr) bool {
+ if expr == nil {
+ return true
+ }
+ if id, isIdent := expr.(*ast.Ident); isIdent {
+ return id.Name == "_"
+ }
+ return false
+}
+
+func isWrapped(ty types.Type) bool {
+ switch t := ty.Underlying().(type) {
+ case *types.Basic:
+ return !is64Bit(t) && !isComplex(t) && t.Kind() != types.UntypedNil
+ case *types.Array, *types.Chan, *types.Map, *types.Signature:
+ return true
+ case *types.Pointer:
+ _, isArray := t.Elem().Underlying().(*types.Array)
+ return isArray
+ }
+ return false
+}
+
+func encodeString(s string) string {
+ buffer := bytes.NewBuffer(nil)
+ for _, r := range []byte(s) {
+ switch r {
+ case '\b':
+ buffer.WriteString(`\b`)
+ case '\f':
+ buffer.WriteString(`\f`)
+ case '\n':
+ buffer.WriteString(`\n`)
+ case '\r':
+ buffer.WriteString(`\r`)
+ case '\t':
+ buffer.WriteString(`\t`)
+ case '\v':
+ buffer.WriteString(`\v`)
+ case '"':
+ buffer.WriteString(`\"`)
+ case '\\':
+ buffer.WriteString(`\\`)
+ default:
+ if r < 0x20 || r > 0x7E {
+ fmt.Fprintf(buffer, `\x%02X`, r)
+ continue
+ }
+ buffer.WriteByte(r)
+ }
+ }
+ return `"` + buffer.String() + `"`
+}
+
+func getJsTag(tag string) string {
+ for tag != "" {
+ // skip leading space
+ i := 0
+ for i < len(tag) && tag[i] == ' ' {
+ i++
+ }
+ tag = tag[i:]
+ if tag == "" {
+ break
+ }
+
+ // scan to colon.
+ // a space or a quote is a syntax error
+ i = 0
+ for i < len(tag) && tag[i] != ' ' && tag[i] != ':' && tag[i] != '"' {
+ i++
+ }
+ if i+1 >= len(tag) || tag[i] != ':' || tag[i+1] != '"' {
+ break
+ }
+ name := string(tag[:i])
+ tag = tag[i+1:]
+
+ // scan quoted string to find value
+ i = 1
+ for i < len(tag) && tag[i] != '"' {
+ if tag[i] == '\\' {
+ i++
+ }
+ i++
+ }
+ if i >= len(tag) {
+ break
+ }
+ qvalue := string(tag[:i+1])
+ tag = tag[i+1:]
+
+ if name == "js" {
+ value, _ := strconv.Unquote(qvalue)
+ return value
+ }
+ }
+ return ""
+}
+
+func needsSpace(c byte) bool {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || c == '$'
+}
+
+func removeWhitespace(b []byte, minify bool) []byte {
+ if !minify {
+ return b
+ }
+
+ var out []byte
+ var previous byte
+ for len(b) > 0 {
+ switch b[0] {
+ case '\b':
+ out = append(out, b[:5]...)
+ b = b[5:]
+ continue
+ case ' ', '\t', '\n':
+ if (!needsSpace(previous) || !needsSpace(b[1])) && !(previous == '-' && b[1] == '-') {
+ b = b[1:]
+ continue
+ }
+ case '"':
+ out = append(out, '"')
+ b = b[1:]
+ for {
+ i := bytes.IndexAny(b, "\"\\")
+ out = append(out, b[:i]...)
+ b = b[i:]
+ if b[0] == '"' {
+ break
+ }
+ // backslash
+ out = append(out, b[:2]...)
+ b = b[2:]
+ }
+ case '/':
+ if b[1] == '*' {
+ i := bytes.Index(b[2:], []byte("*/"))
+ b = b[i+4:]
+ continue
+ }
+ }
+ out = append(out, b[0])
+ previous = b[0]
+ b = b[1:]
+ }
+ return out
+}
+
+func rangeCheck(pattern string, constantIndex, array bool) string {
+ if constantIndex && array {
+ return pattern
+ }
+ lengthProp := "$length"
+ if array {
+ lengthProp = "length"
+ }
+ check := "%2f >= %1e." + lengthProp
+ if !constantIndex {
+ check = "(%2f < 0 || " + check + ")"
+ }
+ return "(" + check + ` ? ($throwRuntimeError("index out of range"), undefined) : ` + pattern + ")"
+}
+
+func endsWithReturn(stmts []ast.Stmt) bool {
+ if len(stmts) > 0 {
+ if _, ok := stmts[len(stmts)-1].(*ast.ReturnStmt); ok {
+ return true
+ }
+ }
+ return false
+}
+
+func encodeIdent(name string) string {
+ return strings.Replace(url.QueryEscape(name), "%", "$", -1)
+}
+
+// formatJSStructTagVal returns JavaScript code for accessing an object's property
+// identified by jsTag. It prefers the dot notation over the bracket notation when
+// possible, since the dot notation produces slightly smaller output.
+//
+// For example:
+//
+// "my_name" -> ".my_name"
+// "my name" -> `["my name"]`
+//
+// For more information about JavaScript property accessors and identifiers, see
+// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors and
+// https://developer.mozilla.org/en-US/docs/Glossary/Identifier.
+//
+func formatJSStructTagVal(jsTag string) string {
+ for i, r := range jsTag {
+ ok := unicode.IsLetter(r) || (i != 0 && unicode.IsNumber(r)) || r == '$' || r == '_'
+ if !ok {
+ // Saw an invalid JavaScript identifier character,
+ // so use bracket notation.
+ return `["` + template.JSEscapeString(jsTag) + `"]`
+ }
+ }
+ // Safe to use dot notation without any escaping.
+ return "." + jsTag
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/version_check.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/version_check.go
new file mode 100644
index 00000000000..73672bde494
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/compiler/version_check.go
@@ -0,0 +1,9 @@
+// +build go1.11
+// +build !go1.12
+
+package compiler
+
+const ___GOPHERJS_REQUIRES_GO_VERSION_1_11___ = true
+
+// Version is the GopherJS compiler version string.
+const Version = "1.11-2"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/packages.md b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/packages.md
new file mode 100644
index 00000000000..c86c36f321b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/packages.md
@@ -0,0 +1,157 @@
+# Supported Packages
+
+On each commit, Circle CI automatically compiles all supported packages with GopherJS and runs their tests:
+
+[![Circle CI](https://circleci.com/gh/gopherjs/gopherjs.svg?style=svg)](https://circleci.com/gh/gopherjs/gopherjs)
+
+Name | Supported | Comment
+------------------ | ------------ | ----------------------------------------------------------------------------------
+archive | |
+-- tar | ✅ yes |
+-- zip | ✅ yes |
+bufio | ✅ yes |
+builtin | ✅ yes |
+bytes | ✅ yes |
+compress | |
+-- bzip2 | ✅ yes |
+-- flate | ✅ yes |
+-- gzip | ✅ yes |
+-- lzw | ✅ yes |
+-- zlib | ✅ yes |
+container | |
+-- heap | ✅ yes |
+-- list | ✅ yes |
+-- ring | ✅ yes |
+crypto | |
+-- aes | ✅ yes |
+-- cipher | ✅ yes |
+-- des | ✅ yes |
+-- dsa | ✅ yes |
+-- ecdsa | ✅ yes |
+-- elliptic | ✅ yes |
+-- hmac | ✅ yes |
+-- md5 | ✅ yes |
+-- rand | ✅ yes |
+-- rc4 | ✅ yes |
+-- rsa | ✅ yes |
+-- sha1 | ✅ yes |
+-- sha256 | ✅ yes |
+-- sha512 | ✅ yes |
+-- subtle | ✅ yes |
+-- tls | ❌ no |
+-- x509 | ✅ yes |
+-- -- pkix | ✅ yes |
+database | |
+-- sql | ✅ yes |
+-- -- driver | ✅ yes |
+debug | |
+-- dwarf | ✅ yes |
+-- elf | ✅ yes |
+-- gosym | ☑️ partially | on binaries generated by gc
+-- macho | ✅ yes |
+-- pe | ✅ yes |
+encoding | |
+-- ascii85 | ✅ yes |
+-- asn1 | ✅ yes |
+-- base32 | ✅ yes |
+-- base64 | ✅ yes |
+-- binary | ✅ yes |
+-- csv | ✅ yes |
+-- gob | ✅ yes |
+-- hex | ✅ yes |
+-- json | ✅ yes |
+-- pem | ✅ yes |
+-- xml | ✅ yes |
+errors | ✅ yes |
+expvar | ✅ yes |
+flag | ✅ yes |
+fmt | ✅ yes |
+go | |
+-- ast | ✅ yes |
+-- build | ❌ no |
+-- constant | ✅ yes |
+-- doc | ✅ yes |
+-- format | ✅ yes |
+-- importer | ❌ no |
+-- parser | ✅ yes |
+-- printer | ✅ yes |
+-- scanner | ✅ yes |
+-- token | ✅ yes |
+-- types | ❌ no |
+hash | |
+-- adler32 | ✅ yes |
+-- crc32 | ✅ yes |
+-- crc64 | ✅ yes |
+-- fnv | ✅ yes |
+html | ✅ yes |
+-- template | ✅ yes |
+image | ✅ yes |
+-- color | ✅ yes |
+-- -- palette | ✅ yes |
+-- draw | ✅ yes |
+-- gif | ✅ yes |
+-- jpeg | ✅ yes |
+-- png | ✅ yes |
+index | |
+-- suffixarray | ✅ yes |
+io | ✅ yes |
+-- ioutil | ✅ yes |
+log | ✅ yes |
+-- syslog | ❌ no |
+math | ✅ yes |
+-- big | ✅ yes |
+-- bits | ✅ yes |
+-- cmplx | ✅ yes |
+-- rand | ✅ yes |
+mime | ✅ yes |
+-- multipart | ✅ yes |
+-- quotedprintable | ✅ yes |
+net | ❌ no |
+-- http | ☑️ partially | client only, emulated via Fetch/XMLHttpRequest APIs;<br>node.js requires polyfill
+-- -- cgi | ❌ no |
+-- -- cookiejar | ✅ yes |
+-- -- fcgi | ✅ yes |
+-- -- httptest | ☑️ partially |
+-- -- httputil | ☑️ partially |
+-- -- pprof | ❌ no |
+-- mail | ✅ yes |
+-- rpc | ☑️ partially | data structures only (no net)
+-- -- jsonrpc | ✅ yes |
+-- smtp | ☑️ partially | data structures only (no net)
+-- textproto | ✅ yes |
+-- url | ✅ yes |
+os | ☑️ partially | node.js only
+-- exec | ☑️ partially | node.js only
+-- signal | ☑️ partially | node.js only
+-- user | ☑️ partially | node.js only
+path | ✅ yes |
+-- filepath | ✅ yes |
+plugin | ❌ no |
+reflect | ✅ yes | except StructOf (pending)
+regexp | ✅ yes |
+-- syntax | ✅ yes |
+runtime | ☑️ partially | SetMutexProfileFraction, SetFinalizer, ReadMemStats, Callers, CallersFrames unsupported
+-- cgo | ❌ no |
+-- debug | ❌ no |
+-- pprof | ❌ no |
+-- race | ❌ no |
+-- trace | ❌ no |
+sort | ✅ yes |
+strconv | ✅ yes |
+strings | ✅ yes |
+sync | ✅ yes |
+-- atomic | ✅ yes |
+syscall | ☑️ partially | node.js only
+testing | ☑️ partially | AllocsPerRun unsupported
+-- iotest | ✅ yes |
+-- quick | ✅ yes |
+text | |
+-- scanner | ✅ yes |
+-- tabwriter | ✅ yes |
+-- template | ✅ yes |
+-- -- parse | ✅ yes |
+time | ✅ yes | UTC and Local only (see [issue](https://github.com/gopherjs/gopherjs/issues/64))
+unicode | ✅ yes |
+-- utf16 | ✅ yes |
+-- utf8 | ✅ yes |
+unsafe | ❌ no |
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/syscalls.md b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/syscalls.md
new file mode 100644
index 00000000000..59366267ee6
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/doc/syscalls.md
@@ -0,0 +1,34 @@
+System Calls
+------------
+
+System calls are the bridge between your application and your operating system. They are used whenever you access something outside of your application's memory, for example when you write to the console, when you read or write files or when you access the network. In Go, system calls are mostly used by the `os` package, hence the name. When using GopherJS you need to consider if system calls are available or not.
+
+### Output redirection to console
+
+If system calls are not available in your environment (see below), then a special redirection of `os.Stdout` and `os.Stderr` is applied. It buffers a line until it is terminated by a line break and then prints it via JavaScript's `console.log` to your browser's JavaScript console or your system console. That way, `fmt.Println` etc. work as expected, even if system calls are not available.
+
+### In Browser
+
+The JavaScript environment of a web browser is completely isolated from your operating system to protect your machine. You don't want any web page to read or write files on your disk without your consent. That is why system calls are not and will never be available when running your code in a web browser.
+
+### Node.js on Linux and macOS
+
+GopherJS has support for system calls on Linux and macOS. Before running your code with Node.js, you need to install the system calls module. The module is compatible with Node.js version 10.0.0 (or newer). If you want to use an older version you can opt to not install the module, but then system calls are not available.
+
+Compile and install the module with:
+
+```
+cd $GOPATH/src/github.com/gopherjs/gopherjs/node-syscall/
+npm install --global node-gyp
+node-gyp rebuild
+mkdir -p ~/.node_libraries/
+cp build/Release/syscall.node ~/.node_libraries/syscall.node
+```
+
+### Node.js on Windows
+
+When running your code with Node.js on Windows, it is theoretically possible to use system calls. To do so, you would need a special Node.js module that provides direct access to system calls. However, since the interface is quite different from the one used on Linux and macOS, the system calls module included in GopherJS currently does not support Windows. Sorry. Get in contact if you feel like you want to change this situation.
+
+### Caveats
+
+Note that even with syscalls enabled in Node.js, some programs may not behave as expected due to the fact that the current implementation blocks other goroutines during a syscall, which can lead to a deadlock in some situations. This is not considered a bug, as it is considered sufficient for most test cases (which is all Node.js should be used for). Get in contact if you feel like you want to change this situation.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil.go
new file mode 100644
index 00000000000..c3631f2b2cc
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil.go
@@ -0,0 +1,13 @@
+// +build !windows
+
+// Package sysutil contains system-specific utilities.
+package sysutil
+
+import "golang.org/x/sys/unix"
+
+// RlimitStack reports the current stack size limit in bytes.
+func RlimitStack() (cur uint64, err error) {
+ var r unix.Rlimit
+ err = unix.Getrlimit(unix.RLIMIT_STACK, &r)
+ return uint64(r.Cur), err // Type conversion because Cur is one of uint64, int64 depending on unix flavor.
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil_windows.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil_windows.go
new file mode 100644
index 00000000000..5e959b2bf23
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/internal/sysutil/sysutil_windows.go
@@ -0,0 +1,7 @@
+package sysutil
+
+import "errors"
+
+func RlimitStack() (uint64, error) {
+ return 0, errors.New("RlimitStack is not implemented on Windows")
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/js/js.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/js/js.go
new file mode 100644
index 00000000000..3fbf1d88c60
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/js/js.go
@@ -0,0 +1,168 @@
+// Package js provides functions for interacting with native JavaScript APIs. Calls to these functions are treated specially by GopherJS and translated directly to their corresponding JavaScript syntax.
+//
+// Use MakeWrapper to expose methods to JavaScript. When passing values directly, the following type conversions are performed:
+//
+// | Go type | JavaScript type | Conversions back to interface{} |
+// | --------------------- | --------------------- | ------------------------------- |
+// | bool | Boolean | bool |
+// | integers and floats | Number | float64 |
+// | string | String | string |
+// | []int8 | Int8Array | []int8 |
+// | []int16 | Int16Array | []int16 |
+// | []int32, []int | Int32Array | []int |
+// | []uint8 | Uint8Array | []uint8 |
+// | []uint16 | Uint16Array | []uint16 |
+// | []uint32, []uint | Uint32Array | []uint |
+// | []float32 | Float32Array | []float32 |
+// | []float64 | Float64Array | []float64 |
+// | all other slices | Array | []interface{} |
+// | arrays | see slice type | see slice type |
+// | functions | Function | func(...interface{}) *js.Object |
+// | time.Time | Date | time.Time |
+// | - | instanceof Node | *js.Object |
+// | maps, structs | instanceof Object | map[string]interface{} |
+//
+// Additionally, for a struct containing a *js.Object field, only the content of the field will be passed to JavaScript and vice versa.
+package js
+
+// Object is a container for a native JavaScript object. Calls to its methods are treated specially by GopherJS and translated directly to their JavaScript syntax. A nil pointer to Object is equal to JavaScript's "null". Object can not be used as a map key.
+type Object struct{ object *Object }
+
+// Get returns the object's property with the given key.
+func (o *Object) Get(key string) *Object { return o.object.Get(key) }
+
+// Set assigns the value to the object's property with the given key.
+func (o *Object) Set(key string, value interface{}) { o.object.Set(key, value) }
+
+// Delete removes the object's property with the given key.
+func (o *Object) Delete(key string) { o.object.Delete(key) }
+
+// Length returns the object's "length" property, converted to int.
+func (o *Object) Length() int { return o.object.Length() }
+
+// Index returns the i'th element of an array.
+func (o *Object) Index(i int) *Object { return o.object.Index(i) }
+
+// SetIndex sets the i'th element of an array.
+func (o *Object) SetIndex(i int, value interface{}) { o.object.SetIndex(i, value) }
+
+// Call calls the object's method with the given name.
+func (o *Object) Call(name string, args ...interface{}) *Object { return o.object.Call(name, args...) }
+
+// Invoke calls the object itself. This will fail if it is not a function.
+func (o *Object) Invoke(args ...interface{}) *Object { return o.object.Invoke(args...) }
+
+// New creates a new instance of this type object. This will fail if it not a function (constructor).
+func (o *Object) New(args ...interface{}) *Object { return o.object.New(args...) }
+
+// Bool returns the object converted to bool according to JavaScript type conversions.
+func (o *Object) Bool() bool { return o.object.Bool() }
+
+// String returns the object converted to string according to JavaScript type conversions.
+func (o *Object) String() string { return o.object.String() }
+
+// Int returns the object converted to int according to JavaScript type conversions (parseInt).
+func (o *Object) Int() int { return o.object.Int() }
+
+// Int64 returns the object converted to int64 according to JavaScript type conversions (parseInt).
+func (o *Object) Int64() int64 { return o.object.Int64() }
+
+// Uint64 returns the object converted to uint64 according to JavaScript type conversions (parseInt).
+func (o *Object) Uint64() uint64 { return o.object.Uint64() }
+
+// Float returns the object converted to float64 according to JavaScript type conversions (parseFloat).
+func (o *Object) Float() float64 { return o.object.Float() }
+
+// Interface returns the object converted to interface{}. See table in package comment for details.
+func (o *Object) Interface() interface{} { return o.object.Interface() }
+
+// Unsafe returns the object as an uintptr, which can be converted via unsafe.Pointer. Not intended for public use.
+func (o *Object) Unsafe() uintptr { return o.object.Unsafe() }
+
+// Error encapsulates JavaScript errors. Those are turned into a Go panic and may be recovered, giving an *Error that holds the JavaScript error object.
+type Error struct {
+ *Object
+}
+
+// Error returns the message of the encapsulated JavaScript error object.
+func (err *Error) Error() string {
+ return "JavaScript error: " + err.Get("message").String()
+}
+
+// Stack returns the stack property of the encapsulated JavaScript error object.
+func (err *Error) Stack() string {
+ return err.Get("stack").String()
+}
+
+// Global gives JavaScript's global object ("window" for browsers and "GLOBAL" for Node.js).
+var Global *Object
+
+// Module gives the value of the "module" variable set by Node.js. Hint: Set a module export with 'js.Module.Get("exports").Set("exportName", ...)'.
+var Module *Object
+
+// Undefined gives the JavaScript value "undefined".
+var Undefined *Object
+
+// Debugger gets compiled to JavaScript's "debugger;" statement.
+func Debugger() {}
+
+// InternalObject returns the internal JavaScript object that represents i. Not intended for public use.
+func InternalObject(i interface{}) *Object {
+ return nil
+}
+
+// MakeFunc wraps a function and gives access to the values of JavaScript's "this" and "arguments" keywords.
+func MakeFunc(fn func(this *Object, arguments []*Object) interface{}) *Object {
+ return Global.Call("$makeFunc", InternalObject(fn))
+}
+
+// Keys returns the keys of the given JavaScript object.
+func Keys(o *Object) []string {
+ if o == nil || o == Undefined {
+ return nil
+ }
+ a := Global.Get("Object").Call("keys", o)
+ s := make([]string, a.Length())
+ for i := 0; i < a.Length(); i++ {
+ s[i] = a.Index(i).String()
+ }
+ return s
+}
+
+// MakeWrapper creates a JavaScript object which has wrappers for the exported methods of i. Use explicit getter and setter methods to expose struct fields to JavaScript.
+func MakeWrapper(i interface{}) *Object {
+ v := InternalObject(i)
+ o := Global.Get("Object").New()
+ o.Set("__internal_object__", v)
+ methods := v.Get("constructor").Get("methods")
+ for i := 0; i < methods.Length(); i++ {
+ m := methods.Index(i)
+ if m.Get("pkg").String() != "" { // not exported
+ continue
+ }
+ o.Set(m.Get("name").String(), func(args ...*Object) *Object {
+ return Global.Call("$externalizeFunction", v.Get(m.Get("prop").String()), m.Get("typ"), true).Call("apply", v, args)
+ })
+ }
+ return o
+}
+
+// NewArrayBuffer creates a JavaScript ArrayBuffer from a byte slice.
+func NewArrayBuffer(b []byte) *Object {
+ slice := InternalObject(b)
+ offset := slice.Get("$offset").Int()
+ length := slice.Get("$length").Int()
+ return slice.Get("$array").Get("buffer").Call("slice", offset, offset+length)
+}
+
+// M is a simple map type. It is intended as a shorthand for JavaScript objects (before conversion).
+type M map[string]interface{}
+
+// S is a simple slice type. It is intended as a shorthand for JavaScript arrays (before conversion).
+type S []interface{}
+
+func init() {
+ // avoid dead code elimination
+ e := Error{}
+ _ = e
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/binding.gyp b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/binding.gyp
new file mode 100644
index 00000000000..9f3211d128c
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/binding.gyp
@@ -0,0 +1,8 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'syscall',
+ 'sources': [ 'syscall.cc' ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/syscall.cc b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/syscall.cc
new file mode 100644
index 00000000000..7d432d9e686
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/node-syscall/syscall.cc
@@ -0,0 +1,98 @@
+#include <cstdlib>
+#include <node.h>
+#include <v8.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <errno.h>
+
+using namespace v8;
+
+#if NODE_MAJOR_VERSION == 0
+#define ARRAY_BUFFER_DATA_OFFSET 23
+#else
+#define ARRAY_BUFFER_DATA_OFFSET 31
+#endif
+
+intptr_t toNative(Local<Value> value) {
+ if (value.IsEmpty()) {
+ return 0;
+ }
+ if (value->IsArrayBufferView()) {
+ Local<ArrayBufferView> view = Local<ArrayBufferView>::Cast(value);
+ return *reinterpret_cast<intptr_t*>(*reinterpret_cast<char**>(*view->Buffer()) + ARRAY_BUFFER_DATA_OFFSET) + view->ByteOffset(); // ugly hack, because of https://codereview.chromium.org/25221002
+ }
+ if (value->IsArray()) {
+ Local<Array> array = Local<Array>::Cast(value);
+ intptr_t* native = reinterpret_cast<intptr_t*>(malloc(array->Length() * sizeof(intptr_t))); // TODO memory leak
+ for (uint32_t i = 0; i < array->Length(); i++) {
+ native[i] = toNative(array->Get(i));
+ }
+ return reinterpret_cast<intptr_t>(native);
+ }
+ return static_cast<intptr_t>(static_cast<int32_t>(value->ToInteger()->Value()));
+}
+
+void Syscall(const FunctionCallbackInfo<Value>& info) {
+ int trap = info[0]->ToInteger()->Value();
+ int r1 = 0, r2 = 0;
+ switch (trap) {
+ case SYS_fork:
+ r1 = fork();
+ break;
+ case SYS_pipe:
+ int fd[2];
+ r1 = pipe(fd);
+ if (r1 == 0) {
+ r1 = fd[0];
+ r2 = fd[1];
+ }
+ break;
+ default:
+ r1 = syscall(
+ trap,
+ toNative(info[1]),
+ toNative(info[2]),
+ toNative(info[3])
+ );
+ break;
+ }
+ int err = 0;
+ if (r1 < 0) {
+ err = errno;
+ }
+ Isolate* isolate = info.GetIsolate();
+ Local<Array> res = Array::New(isolate, 3);
+ res->Set(0, Integer::New(isolate, r1));
+ res->Set(1, Integer::New(isolate, r2));
+ res->Set(2, Integer::New(isolate, err));
+ info.GetReturnValue().Set(res);
+}
+
+void Syscall6(const FunctionCallbackInfo<Value>& info) {
+ int r = syscall(
+ info[0]->ToInteger()->Value(),
+ toNative(info[1]),
+ toNative(info[2]),
+ toNative(info[3]),
+ toNative(info[4]),
+ toNative(info[5]),
+ toNative(info[6])
+ );
+ int err = 0;
+ if (r < 0) {
+ err = errno;
+ }
+ Isolate* isolate = info.GetIsolate();
+ Local<Array> res = Array::New(isolate, 3);
+ res->Set(0, Integer::New(isolate, r));
+ res->Set(1, Integer::New(isolate, 0));
+ res->Set(2, Integer::New(isolate, err));
+ info.GetReturnValue().Set(res);
+}
+
+void init(Handle<Object> target) {
+ NODE_SET_METHOD(target, "Syscall", Syscall);
+ NODE_SET_METHOD(target, "Syscall6", Syscall6);
+}
+
+NODE_MODULE(syscall, init);
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/map.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/map.go
new file mode 100644
index 00000000000..6cd845a273b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/map.go
@@ -0,0 +1,67 @@
+package nosync
+
+// Map is a concurrent map with amortized-constant-time loads, stores, and deletes.
+// It is safe for multiple goroutines to call a Map's methods concurrently.
+//
+// The zero Map is valid and empty.
+//
+// A Map must not be copied after first use.
+type Map struct {
+ m map[interface{}]interface{}
+}
+
+// Load returns the value stored in the map for a key, or nil if no
+// value is present.
+// The ok result indicates whether value was found in the map.
+func (m *Map) Load(key interface{}) (value interface{}, ok bool) {
+ value, ok = m.m[key]
+ return value, ok
+}
+
+// Store sets the value for a key.
+func (m *Map) Store(key, value interface{}) {
+ if m.m == nil {
+ m.m = make(map[interface{}]interface{})
+ }
+ m.m[key] = value
+}
+
+// LoadOrStore returns the existing value for the key if present.
+// Otherwise, it stores and returns the given value.
+// The loaded result is true if the value was loaded, false if stored.
+func (m *Map) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) {
+ if value, ok := m.m[key]; ok {
+ return value, true
+ }
+ if m.m == nil {
+ m.m = make(map[interface{}]interface{})
+ }
+ m.m[key] = value
+ return value, false
+}
+
+// Delete deletes the value for a key.
+func (m *Map) Delete(key interface{}) {
+ if m.m == nil {
+ return
+ }
+ delete(m.m, key)
+}
+
+// Range calls f sequentially for each key and value present in the map.
+// If f returns false, range stops the iteration.
+//
+// Range does not necessarily correspond to any consistent snapshot of the Map's
+// contents: no key will be visited more than once, but if the value for any key
+// is stored or deleted concurrently, Range may reflect any mapping for that key
+// from any point during the Range call.
+//
+// Range may be O(N) with the number of elements in the map even if f returns
+// false after a constant number of calls.
+func (m *Map) Range(f func(key, value interface{}) bool) {
+ for k, v := range m.m {
+ if !f(k, v) {
+ break
+ }
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/mutex.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/mutex.go
new file mode 100644
index 00000000000..03f20dc40f6
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/mutex.go
@@ -0,0 +1,85 @@
+package nosync
+
+// Mutex is a dummy which is non-blocking.
+type Mutex struct {
+ locked bool
+}
+
+// Lock locks m. It is a run-time error if m is already locked.
+func (m *Mutex) Lock() {
+ if m.locked {
+ panic("nosync: mutex is already locked")
+ }
+ m.locked = true
+}
+
+// Unlock unlocks m. It is a run-time error if m is not locked.
+func (m *Mutex) Unlock() {
+ if !m.locked {
+ panic("nosync: unlock of unlocked mutex")
+ }
+ m.locked = false
+}
+
+// RWMutex is a dummy which is non-blocking.
+type RWMutex struct {
+ writeLocked bool
+ readLockCounter int
+}
+
+// Lock locks m for writing. It is a run-time error if rw is already locked for reading or writing.
+func (rw *RWMutex) Lock() {
+ if rw.readLockCounter != 0 || rw.writeLocked {
+ panic("nosync: mutex is already locked")
+ }
+ rw.writeLocked = true
+}
+
+// Unlock unlocks rw for writing. It is a run-time error if rw is not locked for writing.
+func (rw *RWMutex) Unlock() {
+ if !rw.writeLocked {
+ panic("nosync: unlock of unlocked mutex")
+ }
+ rw.writeLocked = false
+}
+
+// RLock locks m for reading. It is a run-time error if rw is already locked for reading or writing.
+func (rw *RWMutex) RLock() {
+ if rw.writeLocked {
+ panic("nosync: mutex is already locked")
+ }
+ rw.readLockCounter++
+}
+
+// RUnlock undoes a single RLock call; it does not affect other simultaneous readers. It is a run-time error if rw is not locked for reading.
+func (rw *RWMutex) RUnlock() {
+ if rw.readLockCounter == 0 {
+ panic("nosync: unlock of unlocked mutex")
+ }
+ rw.readLockCounter--
+}
+
+// WaitGroup is a dummy which is non-blocking.
+type WaitGroup struct {
+ counter int
+}
+
+// Add adds delta, which may be negative, to the WaitGroup If the counter goes negative, Add panics.
+func (wg *WaitGroup) Add(delta int) {
+ wg.counter += delta
+ if wg.counter < 0 {
+ panic("sync: negative WaitGroup counter")
+ }
+}
+
+// Done decrements the WaitGroup counter.
+func (wg *WaitGroup) Done() {
+ wg.Add(-1)
+}
+
+// Wait panics if the WaitGroup counter is not zero.
+func (wg *WaitGroup) Wait() {
+ if wg.counter != 0 {
+ panic("sync: WaitGroup counter not zero")
+ }
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/once.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/once.go
new file mode 100644
index 00000000000..f4cb6954000
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/once.go
@@ -0,0 +1,39 @@
+package nosync
+
+// Once is an object that will perform exactly one action.
+type Once struct {
+ doing bool
+ done bool
+}
+
+// Do calls the function f if and only if Do is being called for the
+// first time for this instance of Once. In other words, given
+// var once Once
+// if once.Do(f) is called multiple times, only the first call will invoke f,
+// even if f has a different value in each invocation. A new instance of
+// Once is required for each function to execute.
+//
+// Do is intended for initialization that must be run exactly once. Since f
+// is niladic, it may be necessary to use a function literal to capture the
+// arguments to a function to be invoked by Do:
+// config.once.Do(func() { config.init(filename) })
+//
+// If f causes Do to be called, it will panic.
+//
+// If f panics, Do considers it to have returned; future calls of Do return
+// without calling f.
+//
+func (o *Once) Do(f func()) {
+ if o.done {
+ return
+ }
+ if o.doing {
+ panic("nosync: Do called within f")
+ }
+ o.doing = true
+ defer func() {
+ o.doing = false
+ o.done = true
+ }()
+ f()
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/pool.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/pool.go
new file mode 100644
index 00000000000..3d448e0fc7a
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/nosync/pool.go
@@ -0,0 +1,63 @@
+package nosync
+
+// A Pool is a set of temporary objects that may be individually saved and
+// retrieved.
+//
+// Any item stored in the Pool may be removed automatically at any time without
+// notification. If the Pool holds the only reference when this happens, the
+// item might be deallocated.
+//
+// A Pool is safe for use by multiple goroutines simultaneously.
+//
+// Pool's purpose is to cache allocated but unused items for later reuse,
+// relieving pressure on the garbage collector. That is, it makes it easy to
+// build efficient, thread-safe free lists. However, it is not suitable for all
+// free lists.
+//
+// An appropriate use of a Pool is to manage a group of temporary items
+// silently shared among and potentially reused by concurrent independent
+// clients of a package. Pool provides a way to amortize allocation overhead
+// across many clients.
+//
+// An example of good use of a Pool is in the fmt package, which maintains a
+// dynamically-sized store of temporary output buffers. The store scales under
+// load (when many goroutines are actively printing) and shrinks when
+// quiescent.
+//
+// On the other hand, a free list maintained as part of a short-lived object is
+// not a suitable use for a Pool, since the overhead does not amortize well in
+// that scenario. It is more efficient to have such objects implement their own
+// free list.
+//
+type Pool struct {
+ store []interface{}
+ New func() interface{}
+}
+
+// Get selects an arbitrary item from the Pool, removes it from the
+// Pool, and returns it to the caller.
+// Get may choose to ignore the pool and treat it as empty.
+// Callers should not assume any relation between values passed to Put and
+// the values returned by Get.
+//
+// If Get would otherwise return nil and p.New is non-nil, Get returns
+// the result of calling p.New.
+func (p *Pool) Get() interface{} {
+ if len(p.store) == 0 {
+ if p.New != nil {
+ return p.New()
+ }
+ return nil
+ }
+ x := p.store[len(p.store)-1]
+ p.store = p.store[:len(p.store)-1]
+ return x
+}
+
+// Put adds x to the pool.
+func (p *Pool) Put(x interface{}) {
+ if x == nil {
+ return
+ }
+ p.store = append(p.store, x)
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/doc.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/doc.go
new file mode 100644
index 00000000000..e33eea8879f
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/doc.go
@@ -0,0 +1,2 @@
+// Package tests contains tests for GopherJS.
+package tests
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/gopherjsvendored_test.sh b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/gopherjsvendored_test.sh
new file mode 100755
index 00000000000..a9ef4105f9f
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/gopherjsvendored_test.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Don't run this file directly. It's executed as part of TestGopherJSCanBeVendored.
+
+set -e
+
+tmp=$(mktemp -d "${TMPDIR:-/tmp}/gopherjsvendored_test.XXXXXXXXXX")
+
+cleanup() {
+ rm -rf "$tmp"
+ exit
+}
+
+trap cleanup EXIT HUP INT TERM
+
+# copyGoPackage copies Go package with import path $1 to directory $2.
+# The target directory is created if it doesn't exist.
+copyGoPackage() {
+ mkdir -p "$2"
+ pkgDir=$(go list -f '{{.Dir}}' "$1")
+ # Copy all files (not directories), other than ones that start with "." or "_".
+ for f in $(find -H "$pkgDir" -maxdepth 1 -name "[^._]*" -type f); do
+ cp "$f" "$2"
+ done
+}
+
+# Make a hello project that will vendor GopherJS.
+mkdir -p "$tmp/src/example.org/hello"
+echo 'package main
+
+import "github.com/gopherjs/gopherjs/js"
+
+func main() {
+ js.Global.Get("console").Call("log", "hello using js pkg")
+}' > "$tmp/src/example.org/hello/main.go"
+
+# Vendor GopherJS and its dependencies into hello project.
+for pkg in $(go list -f '{{if not .Goroot}}{{.ImportPath}}{{end}}' $(go list -f '{{.ImportPath}} {{join .Deps " "}}' github.com/gopherjs/gopherjs)); do
+ copyGoPackage "$pkg" "$tmp/src/example.org/hello/vendor/$pkg"
+done
+
+# Make $tmp our GOPATH workspace.
+export GOPATH="$tmp"
+
+# Build the vendored copy of GopherJS.
+go install example.org/hello/vendor/github.com/gopherjs/gopherjs
+
+# Use it to build and run the hello command.
+(cd "$GOPATH/src/example.org/hello" && "$GOPATH/bin/gopherjs" run main.go)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/main/main.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/main/main.go
new file mode 100644
index 00000000000..f1f39609e58
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/main/main.go
@@ -0,0 +1,7 @@
+package main
+
+var mainDidRun = false
+
+func main() {
+ mainDidRun = true
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/otherpkg/otherpkg.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/otherpkg/otherpkg.go
new file mode 100644
index 00000000000..2b413e5f14a
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/otherpkg/otherpkg.go
@@ -0,0 +1,3 @@
+package otherpkg
+
+var Test float32
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/run.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/run.go
new file mode 100644
index 00000000000..19554d1e929
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/run.go
@@ -0,0 +1,1218 @@
+// +build ignore
+
+// skip
+
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Run runs tests in the test directory.
+//
+// To run manually with summary, verbose output, and full stack traces of of known failures:
+//
+// go run run.go -summary -v -show_known_fails
+//
+// TODO(bradfitz): docs of some sort, once we figure out how we're changing
+// headers of files
+package main
+
+import (
+ "bytes"
+ "errors"
+ "flag"
+ "fmt"
+ "hash/fnv"
+ "io"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path"
+ "path/filepath"
+ "regexp"
+ "runtime"
+ "sort"
+ "strconv"
+ "strings"
+ "time"
+ "unicode"
+)
+
+// -----------------------------------------------------------------------------
+// GOPHERJS: Known test fails for GopherJS compiler.
+//
+// TODO: Reduce these to zero or as close as possible.
+//
+var knownFails = map[string]failReason{
+ "fixedbugs/bug114.go": {desc: "fixedbugs/bug114.go:15:27: B32 (untyped int constant 4294967295) overflows int"},
+ "fixedbugs/bug242.go": {desc: "bad map check 13 false false Error: fail"},
+ "fixedbugs/bug260.go": {desc: "maybe unsupportedFeature, pointer arithm"},
+ "fixedbugs/bug262.go": {desc: "Error: fail"},
+ "fixedbugs/bug273.go": {desc: "BUG: didn't crash: badcap1"},
+ "fixedbugs/bug328.go": {desc: "incorrect output"},
+ "fixedbugs/bug347.go": {desc: "BUG: bug347: cannot find caller"},
+ "fixedbugs/bug348.go": {desc: "BUG: bug348: cannot find caller"},
+ "fixedbugs/bug352.go": {desc: "BUG: bug352 struct{}"},
+ "fixedbugs/bug409.go": {desc: "1 2 3 4"},
+ "fixedbugs/bug433.go": {desc: "Error: [object Object]"},
+ "fixedbugs/issue10353.go": {desc: "incorrect output"},
+ "fixedbugs/issue11656.go": {desc: "Error: Native function not implemented: runtime/debug.setPanicOnFault"},
+ "fixedbugs/issue4085b.go": {desc: "Error: got panic JavaScript error: Invalid typed array length, want len out of range"},
+ "fixedbugs/issue4316.go": {desc: "Error: runtime error: invalid memory address or nil pointer dereference"},
+ "fixedbugs/issue4388.go": {desc: "Error: expected <autogenerated>:1 have anonymous function:0"},
+ "fixedbugs/issue4562.go": {desc: "Error: cannot find issue4562.go on stack"},
+ "fixedbugs/issue4620.go": {desc: "map[0:1 1:2], Error: m[i] != 2"},
+ "fixedbugs/issue5856.go": {category: requiresSourceMapSupport},
+ "fixedbugs/issue6899.go": {desc: "incorrect output -0"},
+ "fixedbugs/issue7550.go": {desc: "FATAL ERROR: invalid table size Allocation failed - process out of memory"},
+ "fixedbugs/issue7690.go": {desc: "Error: runtime error: slice bounds out of range"},
+ "fixedbugs/issue8047.go": {desc: "null"},
+ "fixedbugs/issue8047b.go": {desc: "Error: [object Object]"},
+
+ // Failing due to use of os/exec.Command, which is unsupported. Now skipped via !nacl build tag.
+ /*"fixedbugs/bug248.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/bug302.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/bug345.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/bug369.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/bug429_run.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/issue9862_run.go": {desc: "os/exec.Command unsupported"},*/
+ "fixedbugs/issue10607.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/issue13268.go": {desc: "os/exec.Command unsupported"},
+ "fixedbugs/issue14636.go": {desc: "os/exec.Command unsupported"},
+
+ // These are new tests in Go 1.7.
+ "fixedbugs/issue14646.go": {category: unsureIfGopherJSSupportsThisFeature, desc: "tests runtime.Caller behavior in a deferred func in SSA backend... does GopherJS even support runtime.Caller?"},
+ "fixedbugs/issue15039.go": {desc: "valid bug but deal with after Go 1.7 support is out? it's likely not a regression"},
+ "fixedbugs/issue15281.go": {desc: "also looks valid but deal with after Go 1.7 support is out? it's likely not a regression"},
+ "fixedbugs/issue15975.go": {desc: "also looks valid but deal with after Go 1.7 support is out?"},
+
+ // These are new tests in Go 1.8.
+ "fixedbugs/issue15528.go": {category: usesUnsupportedPackage, desc: `imports "unsafe" package and gets: Error: reflect: call of reflect.Value.IsNil on unsafe.Pointer Value`}, // See https://github.com/golang/go/commit/dfc56a4cd313c9c5de37f4fadb14912286edc42f for relevant commit.
+ "fixedbugs/issue17381.go": {category: unsureIfGopherJSSupportsThisFeature, desc: "tests runtime.{Callers,FuncForPC} behavior in a deferred func with garbage on stack... does GopherJS even support runtime.{Callers,FuncForPC}?"},
+ "fixedbugs/issue18149.go": {desc: "//line directives with filenames are not correctly parsed, see https://github.com/gopherjs/gopherjs/issues/553."},
+
+ // These are new tests in Go 1.9.
+ "fixedbugs/issue19182.go": {category: neverTerminates, desc: "needs GOMAXPROCS=2"},
+ "fixedbugs/issue19040.go": {desc: `panicwrap error text:
+ "runtime error: invalid memory address or nil pointer dereference"
+ want:
+ "value method main.T.F called using nil *T pointer"`},
+ "fixedbugs/issue19246.go": {desc: "expected nil pointer dereference panic"}, // Issue https://golang.org/issues/19246: Failed to evaluate some zero-sized values when converting them to interfaces.
+
+ // These are new tests in Go 1.10.
+ "fixedbugs/issue21879.go": {desc: "incorrect output related to runtime.Callers, runtime.CallersFrames, etc."},
+ "fixedbugs/issue21887.go": {desc: "incorrect output (although within spec, not worth fixing) for println(^uint64(0)). got: { '$high': 4294967295, '$low': 4294967295, '$val': [Circular] } want: 18446744073709551615"},
+ "fixedbugs/issue22083.go": {category: requiresSourceMapSupport}, // Technically, added in Go 1.9.2.
+ "fixedbugs/issue22660.go": {category: notApplicable, desc: "test of gc compiler, uses os/exec.Command"},
+ "fixedbugs/issue23305.go": {desc: "GopherJS fails to compile println(0xffffffff), maybe because 32-bit arch"},
+
+ // These are new tests in Go 1.11.
+ "fixedbugs/issue21221.go": {category: usesUnsupportedPackage, desc: "uses unsafe package and compares nil pointers"},
+ "fixedbugs/issue22662.go": {desc: "line directives not fully working. Error: got /private/var/folders/b8/66r1c5856mqds1mrf2tjtq8w0000gn/T:1; want ??:1"},
+ "fixedbugs/issue22662b.go": {category: usesUnsupportedPackage, desc: "os/exec.Command unsupported"},
+ "fixedbugs/issue23188.go": {desc: "incorrect order of evaluation of index operations"},
+ "fixedbugs/issue24547.go": {desc: "incorrect computing method sets with shadowed methods"},
+}
+
+type failCategory uint8
+
+const (
+ other failCategory = iota
+ neverTerminates // Test never terminates (so avoid starting it).
+ usesUnsupportedPackage // Test fails because it imports an unsupported package, e.g., "unsafe".
+ requiresSourceMapSupport // Test fails without source map support (as configured in CI), because it tries to check filename/line number via runtime.Caller.
+ compilerPanic
+ unsureIfGopherJSSupportsThisFeature
+ notApplicable // Test that doesn't need to run under GopherJS; it doesn't apply to the Go language in a general way.
+)
+
+type failReason struct {
+ category failCategory
+ desc string
+}
+
+// -----------------------------------------------------------------------------
+
+var (
+ verbose = flag.Bool("v", false, "verbose. if set, parallelism is set to 1.")
+ numParallel = flag.Int("n", runtime.NumCPU(), "number of parallel tests to run")
+ summary = flag.Bool("summary", false, "show summary of results")
+ showSkips = flag.Bool("show_skips", false, "show skipped tests")
+ showKnownFails = flag.Bool("show_known_fails", false, "show full error output of known fails")
+ updateErrors = flag.Bool("update_errors", false, "update error messages in test file based on compiler output")
+ runoutputLimit = flag.Int("l", defaultRunOutputLimit(), "number of parallel runoutput tests to run")
+
+ shard = flag.Int("shard", 0, "shard index to run. Only applicable if -shards is non-zero.")
+ shards = flag.Int("shards", 0, "number of shards. If 0, all tests are run. This is used by the continuous build.")
+)
+
+var (
+ goos, goarch string
+
+ // dirs are the directories to look for *.go files in.
+ // TODO(bradfitz): just use all directories?
+ dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs"}
+
+ // ratec controls the max number of tests running at a time.
+ ratec chan bool
+
+ // toRun is the channel of tests to run.
+ // It is nil until the first test is started.
+ toRun chan *test
+
+ // rungatec controls the max number of runoutput tests
+ // executed in parallel as they can each consume a lot of memory.
+ rungatec chan bool
+)
+
+// maxTests is an upper bound on the total number of tests.
+// It is used as a channel buffer size to make sure sends don't block.
+const maxTests = 5000
+
+func main() {
+ flag.Parse()
+
+ // GOPHERJS.
+ err := os.Chdir(filepath.Join(runtime.GOROOT(), "test"))
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ goos = getenv("GOOS", runtime.GOOS)
+ //goarch = getenv("GOARCH", runtime.GOARCH)
+ // GOPHERJS.
+ goarch = getenv("GOARCH", "js") // We're running this script natively, but the tests are executed with js architecture.
+
+ if *verbose {
+ fmt.Printf("goos: %q, goarch: %q\n", goos, goarch)
+ }
+
+ findExecCmd()
+
+ // Disable parallelism if printing or if using a simulator.
+ if *verbose || len(findExecCmd()) > 0 {
+ *numParallel = 1
+ }
+
+ ratec = make(chan bool, *numParallel)
+ rungatec = make(chan bool, *runoutputLimit)
+
+ var tests []*test
+ if flag.NArg() > 0 {
+ for _, arg := range flag.Args() {
+ if arg == "-" || arg == "--" {
+ // Permit running:
+ // $ go run run.go - env.go
+ // $ go run run.go -- env.go
+ // $ go run run.go - ./fixedbugs
+ // $ go run run.go -- ./fixedbugs
+ continue
+ }
+ if fi, err := os.Stat(arg); err == nil && fi.IsDir() {
+ for _, baseGoFile := range goFiles(arg) {
+ tests = append(tests, startTest(arg, baseGoFile))
+ }
+ } else if strings.HasSuffix(arg, ".go") {
+ dir, file := filepath.Split(arg)
+ tests = append(tests, startTest(dir, file))
+ } else {
+ log.Fatalf("can't yet deal with non-directory and non-go file %q", arg)
+ }
+ }
+ } else {
+ for _, dir := range dirs {
+ for _, baseGoFile := range goFiles(dir) {
+ tests = append(tests, startTest(dir, baseGoFile))
+ }
+ }
+ }
+
+ failed := false
+ resCount := map[string]int{}
+ for _, test := range tests {
+ <-test.donec
+ // GOPHERJS.
+ if test.action == "skip" && !*showSkips {
+ continue
+ }
+ status := "ok "
+ errStr := ""
+ // GOPHERJS.
+ if _, ok := knownFails[filepath.ToSlash(test.goFileName())]; ok && test.err != nil {
+ errStr = test.err.Error()
+ test.err = nil
+ status = "knfl" // knfl means known failure. Expect test to fail.
+ } else if ok && test.err == nil {
+ // unok means unexpected okay. Test was expected to fail, but it unexpectedly succeeded.
+ // If this is not an accident, it should be removed from knownFails map.
+ status = "unok"
+ }
+ if _, isSkip := test.err.(skipError); isSkip {
+ test.err = nil
+ errStr = "unexpected skip for " + path.Join(test.dir, test.gofile) + ": " + errStr
+ status = "FAIL"
+ }
+ if test.err != nil {
+ status = "FAIL"
+ errStr = test.err.Error()
+ }
+ if status == "FAIL" {
+ failed = true
+ }
+ // GOPHERJS.
+ if status == "unok" {
+ failed = true
+ }
+ resCount[status]++
+ if status == "skip" && !*verbose && !*showSkips {
+ continue
+ }
+ dt := fmt.Sprintf("%.3fs", test.dt.Seconds())
+ if status == "FAIL" {
+ fmt.Printf("# go run run.go -- %s\n%s\nFAIL\t%s\t%s\n",
+ path.Join(test.dir, test.gofile),
+ errStr, test.goFileName(), dt)
+ continue
+ }
+ // GOPHERJS.
+ if status == "knfl" && *showKnownFails {
+ fmt.Printf("# go run run.go -show_known_fails -- %s\n%s\nknfl\t%s\t%s\n",
+ path.Join(test.dir, test.gofile),
+ errStr, test.goFileName(), dt)
+ continue
+ }
+ if !*verbose && status != "unok" {
+ continue
+ }
+ fmt.Printf("%s\t%s\t%s\n", status, test.goFileName(), dt)
+ }
+
+ if *summary {
+ for k, v := range resCount {
+ fmt.Printf("%5d %s\n", v, k)
+ }
+ }
+
+ if failed {
+ os.Exit(1)
+ }
+}
+
+func toolPath(name string) string {
+ p := filepath.Join(os.Getenv("GOROOT"), "bin", "tool", name)
+ if _, err := os.Stat(p); err != nil {
+ log.Fatalf("didn't find binary at %s", p)
+ }
+ return p
+}
+
+func shardMatch(name string) bool {
+ if *shards == 0 {
+ return true
+ }
+ h := fnv.New32()
+ io.WriteString(h, name)
+ return int(h.Sum32()%uint32(*shards)) == *shard
+}
+
+func goFiles(dir string) []string {
+ f, err := os.Open(dir)
+ check(err)
+ dirnames, err := f.Readdirnames(-1)
+ check(err)
+ names := []string{}
+ for _, name := range dirnames {
+ if !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") && shardMatch(name) {
+ names = append(names, name)
+ }
+ }
+ sort.Strings(names)
+ return names
+}
+
+type runCmd func(...string) ([]byte, error)
+
+func compileFile(runcmd runCmd, longname string) (out []byte, err error) {
+ return runcmd("go", "tool", "compile", "-e", longname)
+}
+
+func compileInDir(runcmd runCmd, dir string, names ...string) (out []byte, err error) {
+ cmd := []string{"go", "tool", "compile", "-e", "-D", ".", "-I", "."}
+ for _, name := range names {
+ cmd = append(cmd, filepath.Join(dir, name))
+ }
+ return runcmd(cmd...)
+}
+
+func linkFile(runcmd runCmd, goname string) (err error) {
+ pfile := strings.Replace(goname, ".go", ".o", -1)
+ _, err = runcmd("go", "tool", "link", "-w", "-o", "a.exe", "-L", ".", pfile)
+ return
+}
+
+// skipError describes why a test was skipped.
+type skipError string
+
+func (s skipError) Error() string { return string(s) }
+
+func check(err error) {
+ if err != nil {
+ log.Fatal(err)
+ }
+}
+
+// test holds the state of a test.
+type test struct {
+ dir, gofile string
+ donec chan bool // closed when done
+ dt time.Duration
+
+ src string
+ action string // "compile", "build", etc.
+
+ tempDir string
+ err error
+}
+
+// startTest
+func startTest(dir, gofile string) *test {
+ t := &test{
+ dir: dir,
+ gofile: gofile,
+ donec: make(chan bool, 1),
+ }
+ if toRun == nil {
+ toRun = make(chan *test, maxTests)
+ go runTests()
+ }
+ select {
+ case toRun <- t:
+ default:
+ panic("toRun buffer size (maxTests) is too small")
+ }
+ return t
+}
+
+// runTests runs tests in parallel, but respecting the order they
+// were enqueued on the toRun channel.
+func runTests() {
+ for {
+ ratec <- true
+ t := <-toRun
+ go func() {
+ t.run()
+ <-ratec
+ }()
+ }
+}
+
+var cwd, _ = os.Getwd()
+
+func (t *test) goFileName() string {
+ return filepath.Join(t.dir, t.gofile)
+}
+
+func (t *test) goDirName() string {
+ return filepath.Join(t.dir, strings.Replace(t.gofile, ".go", ".dir", -1))
+}
+
+func goDirFiles(longdir string) (filter []os.FileInfo, err error) {
+ files, dirErr := ioutil.ReadDir(longdir)
+ if dirErr != nil {
+ return nil, dirErr
+ }
+ for _, gofile := range files {
+ if filepath.Ext(gofile.Name()) == ".go" {
+ filter = append(filter, gofile)
+ }
+ }
+ return
+}
+
+var packageRE = regexp.MustCompile(`(?m)^package (\w+)`)
+
+func goDirPackages(longdir string) ([][]string, error) {
+ files, err := goDirFiles(longdir)
+ if err != nil {
+ return nil, err
+ }
+ var pkgs [][]string
+ m := make(map[string]int)
+ for _, file := range files {
+ name := file.Name()
+ data, err := ioutil.ReadFile(filepath.Join(longdir, name))
+ if err != nil {
+ return nil, err
+ }
+ pkgname := packageRE.FindStringSubmatch(string(data))
+ if pkgname == nil {
+ return nil, fmt.Errorf("cannot find package name in %s", name)
+ }
+ i, ok := m[pkgname[1]]
+ if !ok {
+ i = len(pkgs)
+ pkgs = append(pkgs, nil)
+ m[pkgname[1]] = i
+ }
+ pkgs[i] = append(pkgs[i], name)
+ }
+ return pkgs, nil
+}
+
+type context struct {
+ GOOS string
+ GOARCH string
+}
+
+// shouldTest looks for build tags in a source file and returns
+// whether the file should be used according to the tags.
+func shouldTest(src string, goos, goarch string) (ok bool, whyNot string) {
+ // Custom rule, treat js as equivalent to nacl.
+ if goarch == "js" {
+ goarch = "nacl"
+ }
+
+ for _, line := range strings.Split(src, "\n") {
+ line = strings.TrimSpace(line)
+ if strings.HasPrefix(line, "//") {
+ line = line[2:]
+ } else {
+ continue
+ }
+ line = strings.TrimSpace(line)
+ if len(line) == 0 || line[0] != '+' {
+ continue
+ }
+ ctxt := &context{
+ GOOS: goos,
+ GOARCH: goarch,
+ }
+ words := strings.Fields(line)
+ if words[0] == "+build" {
+ ok := false
+ for _, word := range words[1:] {
+ if ctxt.match(word) {
+ ok = true
+ break
+ }
+ }
+ if !ok {
+ // no matching tag found.
+ return false, line
+ }
+ }
+ }
+ // no build tags
+ return true, ""
+}
+
+func (ctxt *context) match(name string) bool {
+ if name == "" {
+ return false
+ }
+ if i := strings.Index(name, ","); i >= 0 {
+ // comma-separated list
+ return ctxt.match(name[:i]) && ctxt.match(name[i+1:])
+ }
+ if strings.HasPrefix(name, "!!") { // bad syntax, reject always
+ return false
+ }
+ if strings.HasPrefix(name, "!") { // negation
+ return len(name) > 1 && !ctxt.match(name[1:])
+ }
+
+ // Tags must be letters, digits, underscores or dots.
+ // Unlike in Go identifiers, all digits are fine (e.g., "386").
+ for _, c := range name {
+ if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' {
+ return false
+ }
+ }
+
+ if name == ctxt.GOOS || name == ctxt.GOARCH {
+ return true
+ }
+
+ return false
+}
+
+func init() { checkShouldTest() }
+
+// run runs a test.
+func (t *test) run() {
+ start := time.Now()
+ defer func() {
+ t.dt = time.Since(start)
+ close(t.donec)
+ }()
+
+ // GOPHERJS: Some tests may never terminate once started. Avoid starting them.
+ if kf, ok := knownFails[filepath.ToSlash(t.goFileName())]; ok && kf.category == neverTerminates {
+ t.err = skipError("skipping because it doesn't terminate")
+ return
+ }
+
+ srcBytes, err := ioutil.ReadFile(t.goFileName())
+ if err != nil {
+ t.err = err
+ return
+ }
+ t.src = string(srcBytes)
+ if t.src[0] == '\n' {
+ t.err = skipError("starts with newline")
+ return
+ }
+
+ // Execution recipe stops at first blank line.
+ pos := strings.Index(t.src, "\n\n")
+ if pos == -1 {
+ t.err = errors.New("double newline not found")
+ return
+ }
+ action := t.src[:pos]
+ if nl := strings.Index(action, "\n"); nl >= 0 && strings.Contains(action[:nl], "+build") {
+ // skip first line
+ action = action[nl+1:]
+ }
+ if strings.HasPrefix(action, "//") {
+ action = action[2:]
+ }
+
+ // Check for build constraints only up to the actual code.
+ pkgPos := strings.Index(t.src, "\npackage")
+ if pkgPos == -1 {
+ pkgPos = pos // some files are intentionally malformed
+ }
+ if ok, why := shouldTest(t.src[:pkgPos], goos, goarch); !ok {
+ t.action = "skip"
+ if *showSkips {
+ fmt.Printf("%-20s %-20s: %s\n", t.action, t.goFileName(), why)
+ }
+ return
+ }
+
+ var args, flags []string
+ wantError := false
+ f := strings.Fields(action)
+ if len(f) > 0 {
+ action = f[0]
+ args = f[1:]
+ }
+
+ // GOPHERJS: For now, only run with "run", "cmpout" actions, in "fixedbugs" dir. Skip all others.
+ switch action {
+ case "run", "cmpout":
+ if filepath.Clean(t.dir) != "fixedbugs" {
+ action = "skip"
+ }
+ default:
+ action = "skip"
+ }
+
+ switch action {
+ case "rundircmpout":
+ action = "rundir"
+ t.action = "rundir"
+ case "cmpout":
+ action = "run" // the run case already looks for <dir>/<test>.out files
+ fallthrough
+ case "compile", "compiledir", "build", "run", "runoutput", "rundir":
+ t.action = action
+ case "errorcheck", "errorcheckdir", "errorcheckoutput":
+ t.action = action
+ wantError = true
+ for len(args) > 0 && strings.HasPrefix(args[0], "-") {
+ if args[0] == "-0" {
+ wantError = false
+ } else {
+ flags = append(flags, args[0])
+ }
+ args = args[1:]
+ }
+ case "skip":
+ t.action = "skip"
+ return
+ default:
+ t.err = skipError("skipped; unknown pattern: " + action)
+ t.action = "??"
+ return
+ }
+
+ t.makeTempDir()
+ defer os.RemoveAll(t.tempDir)
+
+ err = ioutil.WriteFile(filepath.Join(t.tempDir, t.gofile), srcBytes, 0644)
+ check(err)
+
+ // A few tests (of things like the environment) require these to be set.
+ if os.Getenv("GOOS") == "" {
+ os.Setenv("GOOS", runtime.GOOS)
+ }
+ if os.Getenv("GOARCH") == "" {
+ os.Setenv("GOARCH", runtime.GOARCH)
+ }
+
+ useTmp := true
+ runcmd := func(args ...string) ([]byte, error) {
+ cmd := exec.Command(args[0], args[1:]...)
+ var buf bytes.Buffer
+ cmd.Stdout = &buf
+ cmd.Stderr = &buf
+ if useTmp {
+ cmd.Dir = t.tempDir
+ cmd.Env = envForDir(cmd.Dir)
+ }
+ err := cmd.Run()
+ if err != nil {
+ err = fmt.Errorf("%s\n%s", err, buf.Bytes())
+ }
+ return buf.Bytes(), err
+ }
+
+ long := filepath.Join(cwd, t.goFileName())
+ switch action {
+ default:
+ t.err = fmt.Errorf("unimplemented action %q", action)
+
+ case "errorcheck":
+ cmdline := []string{"go", "tool", "compile", "-e", "-o", "a.o"}
+ cmdline = append(cmdline, flags...)
+ cmdline = append(cmdline, long)
+ out, err := runcmd(cmdline...)
+ if wantError {
+ if err == nil {
+ t.err = fmt.Errorf("compilation succeeded unexpectedly\n%s", out)
+ return
+ }
+ } else {
+ if err != nil {
+ t.err = err
+ return
+ }
+ }
+ if *updateErrors {
+ t.updateErrors(string(out), long)
+ }
+ t.err = t.errorCheck(string(out), long, t.gofile)
+ return
+
+ case "compile":
+ _, t.err = compileFile(runcmd, long)
+
+ case "compiledir":
+ // Compile all files in the directory in lexicographic order.
+ longdir := filepath.Join(cwd, t.goDirName())
+ pkgs, err := goDirPackages(longdir)
+ if err != nil {
+ t.err = err
+ return
+ }
+ for _, gofiles := range pkgs {
+ _, t.err = compileInDir(runcmd, longdir, gofiles...)
+ if t.err != nil {
+ return
+ }
+ }
+
+ case "errorcheckdir":
+ // errorcheck all files in lexicographic order
+ // useful for finding importing errors
+ longdir := filepath.Join(cwd, t.goDirName())
+ pkgs, err := goDirPackages(longdir)
+ if err != nil {
+ t.err = err
+ return
+ }
+ for i, gofiles := range pkgs {
+ out, err := compileInDir(runcmd, longdir, gofiles...)
+ if i == len(pkgs)-1 {
+ if wantError && err == nil {
+ t.err = fmt.Errorf("compilation succeeded unexpectedly\n%s", out)
+ return
+ } else if !wantError && err != nil {
+ t.err = err
+ return
+ }
+ } else if err != nil {
+ t.err = err
+ return
+ }
+ var fullshort []string
+ for _, name := range gofiles {
+ fullshort = append(fullshort, filepath.Join(longdir, name), name)
+ }
+ t.err = t.errorCheck(string(out), fullshort...)
+ if t.err != nil {
+ break
+ }
+ }
+
+ case "rundir":
+ // Compile all files in the directory in lexicographic order.
+ // then link as if the last file is the main package and run it
+ longdir := filepath.Join(cwd, t.goDirName())
+ pkgs, err := goDirPackages(longdir)
+ if err != nil {
+ t.err = err
+ return
+ }
+ for i, gofiles := range pkgs {
+ _, err := compileInDir(runcmd, longdir, gofiles...)
+ if err != nil {
+ t.err = err
+ return
+ }
+ if i == len(pkgs)-1 {
+ err = linkFile(runcmd, gofiles[0])
+ if err != nil {
+ t.err = err
+ return
+ }
+ var cmd []string
+ cmd = append(cmd, findExecCmd()...)
+ cmd = append(cmd, filepath.Join(t.tempDir, "a.exe"))
+ cmd = append(cmd, args...)
+ out, err := runcmd(cmd...)
+ if err != nil {
+ t.err = err
+ return
+ }
+ if strings.Replace(string(out), "\r\n", "\n", -1) != t.expectedOutput() {
+ t.err = fmt.Errorf("incorrect output\n%s", out)
+ }
+ }
+ }
+
+ case "build":
+ _, err := runcmd("go", "build", "-o", "a.exe", long)
+ if err != nil {
+ t.err = err
+ }
+
+ case "run":
+ useTmp = false
+ // GOPHERJS.
+ out, err := runcmd(append([]string{"gopherjs", "run", "-q", t.goFileName()}, args...)...)
+ if err != nil {
+ t.err = err
+ return
+ }
+ if strings.Replace(string(out), "\r\n", "\n", -1) != t.expectedOutput() {
+ t.err = fmt.Errorf("incorrect output\n%s", out)
+ }
+
+ case "runoutput":
+ rungatec <- true
+ defer func() {
+ <-rungatec
+ }()
+ useTmp = false
+ out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
+ if err != nil {
+ t.err = err
+ return
+ }
+ tfile := filepath.Join(t.tempDir, "tmp__.go")
+ if err := ioutil.WriteFile(tfile, out, 0666); err != nil {
+ t.err = fmt.Errorf("write tempfile:%s", err)
+ return
+ }
+ out, err = runcmd("go", "run", tfile)
+ if err != nil {
+ t.err = err
+ return
+ }
+ if string(out) != t.expectedOutput() {
+ t.err = fmt.Errorf("incorrect output\n%s", out)
+ }
+
+ case "errorcheckoutput":
+ useTmp = false
+ out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
+ if err != nil {
+ t.err = err
+ return
+ }
+ tfile := filepath.Join(t.tempDir, "tmp__.go")
+ err = ioutil.WriteFile(tfile, out, 0666)
+ if err != nil {
+ t.err = fmt.Errorf("write tempfile:%s", err)
+ return
+ }
+ cmdline := []string{"go", "tool", "compile", "-e", "-o", "a.o"}
+ cmdline = append(cmdline, flags...)
+ cmdline = append(cmdline, tfile)
+ out, err = runcmd(cmdline...)
+ if wantError {
+ if err == nil {
+ t.err = fmt.Errorf("compilation succeeded unexpectedly\n%s", out)
+ return
+ }
+ } else {
+ if err != nil {
+ t.err = err
+ return
+ }
+ }
+ t.err = t.errorCheck(string(out), tfile, "tmp__.go")
+ return
+ }
+}
+
+var execCmd []string
+
+func findExecCmd() []string {
+ if execCmd != nil {
+ return execCmd
+ }
+ execCmd = []string{} // avoid work the second time
+ if goos == runtime.GOOS && goarch == runtime.GOARCH {
+ return execCmd
+ }
+ path, err := exec.LookPath(fmt.Sprintf("go_%s_%s_exec", goos, goarch))
+ if err == nil {
+ execCmd = []string{path}
+ }
+ return execCmd
+}
+
+func (t *test) String() string {
+ return filepath.Join(t.dir, t.gofile)
+}
+
+func (t *test) makeTempDir() {
+ var err error
+ t.tempDir, err = ioutil.TempDir("", "")
+ check(err)
+}
+
+func (t *test) expectedOutput() string {
+ filename := filepath.Join(t.dir, t.gofile)
+ filename = filename[:len(filename)-len(".go")]
+ filename += ".out"
+ b, _ := ioutil.ReadFile(filename)
+ return string(b)
+}
+
+func splitOutput(out string) []string {
+ // gc error messages continue onto additional lines with leading tabs.
+ // Split the output at the beginning of each line that doesn't begin with a tab.
+ // <autogenerated> lines are impossible to match so those are filtered out.
+ var res []string
+ for _, line := range strings.Split(out, "\n") {
+ if strings.HasSuffix(line, "\r") { // remove '\r', output by compiler on windows
+ line = line[:len(line)-1]
+ }
+ if strings.HasPrefix(line, "\t") {
+ res[len(res)-1] += "\n" + line
+ } else if strings.HasPrefix(line, "go tool") || strings.HasPrefix(line, "<autogenerated>") {
+ continue
+ } else if strings.TrimSpace(line) != "" {
+ res = append(res, line)
+ }
+ }
+ return res
+}
+
+func (t *test) errorCheck(outStr string, fullshort ...string) (err error) {
+ defer func() {
+ if *verbose && err != nil {
+ log.Printf("%s gc output:\n%s", t, outStr)
+ }
+ }()
+ var errs []error
+ out := splitOutput(outStr)
+
+ // Cut directory name.
+ for i := range out {
+ for j := 0; j < len(fullshort); j += 2 {
+ full, short := fullshort[j], fullshort[j+1]
+ out[i] = strings.Replace(out[i], full, short, -1)
+ }
+ }
+
+ var want []wantedError
+ for j := 0; j < len(fullshort); j += 2 {
+ full, short := fullshort[j], fullshort[j+1]
+ want = append(want, t.wantedErrors(full, short)...)
+ }
+
+ for _, we := range want {
+ var errmsgs []string
+ errmsgs, out = partitionStrings(we.prefix, out)
+ if len(errmsgs) == 0 {
+ errs = append(errs, fmt.Errorf("%s:%d: missing error %q", we.file, we.lineNum, we.reStr))
+ continue
+ }
+ matched := false
+ n := len(out)
+ for _, errmsg := range errmsgs {
+ if we.re.MatchString(errmsg) {
+ matched = true
+ } else {
+ out = append(out, errmsg)
+ }
+ }
+ if !matched {
+ errs = append(errs, fmt.Errorf("%s:%d: no match for %#q in:\n\t%s", we.file, we.lineNum, we.reStr, strings.Join(out[n:], "\n\t")))
+ continue
+ }
+ }
+
+ if len(out) > 0 {
+ errs = append(errs, fmt.Errorf("Unmatched Errors:"))
+ for _, errLine := range out {
+ errs = append(errs, fmt.Errorf("%s", errLine))
+ }
+ }
+
+ if len(errs) == 0 {
+ return nil
+ }
+ if len(errs) == 1 {
+ return errs[0]
+ }
+ var buf bytes.Buffer
+ fmt.Fprintf(&buf, "\n")
+ for _, err := range errs {
+ fmt.Fprintf(&buf, "%s\n", err.Error())
+ }
+ return errors.New(buf.String())
+}
+
+func (t *test) updateErrors(out string, file string) {
+ // Read in source file.
+ src, err := ioutil.ReadFile(file)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ return
+ }
+ lines := strings.Split(string(src), "\n")
+ // Remove old errors.
+ for i, ln := range lines {
+ pos := strings.Index(ln, " // ERROR ")
+ if pos >= 0 {
+ lines[i] = ln[:pos]
+ }
+ }
+ // Parse new errors.
+ errors := make(map[int]map[string]bool)
+ tmpRe := regexp.MustCompile(`autotmp_[0-9]+`)
+ for _, errStr := range splitOutput(out) {
+ colon1 := strings.Index(errStr, ":")
+ if colon1 < 0 || errStr[:colon1] != file {
+ continue
+ }
+ colon2 := strings.Index(errStr[colon1+1:], ":")
+ if colon2 < 0 {
+ continue
+ }
+ colon2 += colon1 + 1
+ line, err := strconv.Atoi(errStr[colon1+1 : colon2])
+ line--
+ if err != nil || line < 0 || line >= len(lines) {
+ continue
+ }
+ msg := errStr[colon2+2:]
+ for _, r := range []string{`\`, `*`, `+`, `[`, `]`, `(`, `)`} {
+ msg = strings.Replace(msg, r, `\`+r, -1)
+ }
+ msg = strings.Replace(msg, `"`, `.`, -1)
+ msg = tmpRe.ReplaceAllLiteralString(msg, `autotmp_[0-9]+`)
+ if errors[line] == nil {
+ errors[line] = make(map[string]bool)
+ }
+ errors[line][msg] = true
+ }
+ // Add new errors.
+ for line, errs := range errors {
+ var sorted []string
+ for e := range errs {
+ sorted = append(sorted, e)
+ }
+ sort.Strings(sorted)
+ lines[line] += " // ERROR"
+ for _, e := range sorted {
+ lines[line] += fmt.Sprintf(` "%s$"`, e)
+ }
+ }
+ // Write new file.
+ err = ioutil.WriteFile(file, []byte(strings.Join(lines, "\n")), 0640)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ return
+ }
+ // Polish.
+ exec.Command("go", "fmt", file).CombinedOutput()
+}
+
+// matchPrefix reports whether s is of the form ^(.*/)?prefix(:|[),
+// That is, it needs the file name prefix followed by a : or a [,
+// and possibly preceded by a directory name.
+func matchPrefix(s, prefix string) bool {
+ i := strings.Index(s, ":")
+ if i < 0 {
+ return false
+ }
+ j := strings.LastIndex(s[:i], "/")
+ s = s[j+1:]
+ if len(s) <= len(prefix) || s[:len(prefix)] != prefix {
+ return false
+ }
+ switch s[len(prefix)] {
+ case '[', ':':
+ return true
+ }
+ return false
+}
+
+func partitionStrings(prefix string, strs []string) (matched, unmatched []string) {
+ for _, s := range strs {
+ if matchPrefix(s, prefix) {
+ matched = append(matched, s)
+ } else {
+ unmatched = append(unmatched, s)
+ }
+ }
+ return
+}
+
+type wantedError struct {
+ reStr string
+ re *regexp.Regexp
+ lineNum int
+ file string
+ prefix string
+}
+
+var (
+ errRx = regexp.MustCompile(`// (?:GC_)?ERROR (.*)`)
+ errQuotesRx = regexp.MustCompile(`"([^"]*)"`)
+ lineRx = regexp.MustCompile(`LINE(([+-])([0-9]+))?`)
+)
+
+func (t *test) wantedErrors(file, short string) (errs []wantedError) {
+ cache := make(map[string]*regexp.Regexp)
+
+ src, _ := ioutil.ReadFile(file)
+ for i, line := range strings.Split(string(src), "\n") {
+ lineNum := i + 1
+ if strings.Contains(line, "////") {
+ // double comment disables ERROR
+ continue
+ }
+ m := errRx.FindStringSubmatch(line)
+ if m == nil {
+ continue
+ }
+ all := m[1]
+ mm := errQuotesRx.FindAllStringSubmatch(all, -1)
+ if mm == nil {
+ log.Fatalf("%s:%d: invalid errchk line: %s", t.goFileName(), lineNum, line)
+ }
+ for _, m := range mm {
+ rx := lineRx.ReplaceAllStringFunc(m[1], func(m string) string {
+ n := lineNum
+ if strings.HasPrefix(m, "LINE+") {
+ delta, _ := strconv.Atoi(m[5:])
+ n += delta
+ } else if strings.HasPrefix(m, "LINE-") {
+ delta, _ := strconv.Atoi(m[5:])
+ n -= delta
+ }
+ return fmt.Sprintf("%s:%d", short, n)
+ })
+ re := cache[rx]
+ if re == nil {
+ var err error
+ re, err = regexp.Compile(rx)
+ if err != nil {
+ log.Fatalf("%s:%d: invalid regexp \"%s\" in ERROR line: %v", t.goFileName(), lineNum, rx, err)
+ }
+ cache[rx] = re
+ }
+ prefix := fmt.Sprintf("%s:%d", short, lineNum)
+ errs = append(errs, wantedError{
+ reStr: rx,
+ re: re,
+ prefix: prefix,
+ lineNum: lineNum,
+ file: short,
+ })
+ }
+ }
+
+ return
+}
+
+// defaultRunOutputLimit returns the number of runoutput tests that
+// can be executed in parallel.
+func defaultRunOutputLimit() int {
+ const maxArmCPU = 2
+
+ cpu := runtime.NumCPU()
+ if runtime.GOARCH == "arm" && cpu > maxArmCPU {
+ cpu = maxArmCPU
+ }
+ return cpu
+}
+
+// checkShouldTest runs sanity checks on the shouldTest function.
+func checkShouldTest() {
+ assert := func(ok bool, _ string) {
+ if !ok {
+ panic("fail")
+ }
+ }
+ assertNot := func(ok bool, _ string) { assert(!ok, "") }
+
+ // Simple tests.
+ assert(shouldTest("// +build linux", "linux", "arm"))
+ assert(shouldTest("// +build !windows", "linux", "arm"))
+ assertNot(shouldTest("// +build !windows", "windows", "amd64"))
+
+ // A file with no build tags will always be tested.
+ assert(shouldTest("// This is a test.", "os", "arch"))
+
+ // Build tags separated by a space are OR-ed together.
+ assertNot(shouldTest("// +build arm 386", "linux", "amd64"))
+
+ // Build tags separated by a comma are AND-ed together.
+ assertNot(shouldTest("// +build !windows,!plan9", "windows", "amd64"))
+ assertNot(shouldTest("// +build !windows,!plan9", "plan9", "386"))
+
+ // Build tags on multiple lines are AND-ed together.
+ assert(shouldTest("// +build !windows\n// +build amd64", "linux", "amd64"))
+ assertNot(shouldTest("// +build !windows\n// +build amd64", "windows", "amd64"))
+
+ // Test that (!a OR !b) matches anything.
+ assert(shouldTest("// +build !windows !plan9", "windows", "amd64"))
+
+ // GOPHERJS: Custom rule, test that don't run on nacl should also not run on js.
+ assertNot(shouldTest("// +build !nacl,!plan9,!windows", "darwin", "js"))
+}
+
+// envForDir returns a copy of the environment
+// suitable for running in the given directory.
+// The environment is the current process's environment
+// but with an updated $PWD, so that an os.Getwd in the
+// child will be faster.
+func envForDir(dir string) []string {
+ env := os.Environ()
+ for i, kv := range env {
+ if strings.HasPrefix(kv, "PWD=") {
+ env[i] = "PWD=" + dir
+ return env
+ }
+ }
+ env = append(env, "PWD="+dir)
+ return env
+}
+
+func getenv(key, def string) string {
+ value := os.Getenv(key)
+ if value != "" {
+ return value
+ }
+ return def
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/testdata/time_inexternalization.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/testdata/time_inexternalization.go
new file mode 100644
index 00000000000..fe7c064f8c2
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tests/testdata/time_inexternalization.go
@@ -0,0 +1,19 @@
+package main
+
+import (
+ "time"
+
+ "github.com/gopherjs/gopherjs/js"
+)
+
+var _ = time.Sleep // Force "time" package to be imported but let time.Time and time.Unix be DCEed since they're not used.
+
+func main() {
+ // Excercise externalization of Go struct (with its special handling of time.Time).
+ js.Global.Get("console").Call("log", struct{ S string }{"externalization ok"})
+
+ // Excercise internalization of JavaScript Date object (with its special handling of time.Time).
+ date := js.Global.Get("Date").New("2015-08-29T20:56:00.869Z").Interface()
+ js.Global.Set("myDate", date)
+ js.Global.Get("console").Call("log", js.Global.Get("myDate").Call("toUTCString"))
+}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tool.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tool.go
new file mode 100644
index 00000000000..4c580a1395b
--- /dev/null
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/gopherjs/gopherjs/tool.go
@@ -0,0 +1,963 @@
+package main
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/doc"
+ "go/parser"
+ "go/scanner"
+ "go/token"
+ "go/types"
+ "io"
+ "io/ioutil"
+ "net"
+ "net/http"
+ "os"
+ "os/exec"
+ "path"
+ "path/filepath"
+ "runtime"
+ "sort"
+ "strconv"
+ "strings"
+ "syscall"
+ "text/template"
+ "time"
+ "unicode"
+ "unicode/utf8"
+
+ gbuild "github.com/gopherjs/gopherjs/build"
+ "github.com/gopherjs/gopherjs/compiler"
+ "github.com/gopherjs/gopherjs/internal/sysutil"
+ "github.com/kisielk/gotool"
+ "github.com/neelance/sourcemap"
+ "github.com/spf13/cobra"
+ "github.com/spf13/pflag"
+ "golang.org/x/crypto/ssh/terminal"
+ "golang.org/x/tools/go/buildutil"
+)
+
+var currentDirectory string
+
+func init() {
+ var err error
+ currentDirectory, err = os.Getwd()
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+ currentDirectory, err = filepath.EvalSymlinks(currentDirectory)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+ gopaths := filepath.SplitList(build.Default.GOPATH)
+ if len(gopaths) == 0 {
+ fmt.Fprintf(os.Stderr, "$GOPATH not set. For more details see: go help gopath\n")
+ os.Exit(1)
+ }
+}
+
+func main() {
+ var (
+ options = &gbuild.Options{CreateMapFile: true}
+ pkgObj string
+ tags string
+ )
+
+ flagVerbose := pflag.NewFlagSet("", 0)
+ flagVerbose.BoolVarP(&options.Verbose, "verbose", "v", false, "print the names of packages as they are compiled")
+ flagQuiet := pflag.NewFlagSet("", 0)
+ flagQuiet.BoolVarP(&options.Quiet, "quiet", "q", false, "suppress non-fatal warnings")
+
+ compilerFlags := pflag.NewFlagSet("", 0)
+ compilerFlags.BoolVarP(&options.Minify, "minify", "m", false, "minify generated code")
+ compilerFlags.BoolVar(&options.Color, "color", terminal.IsTerminal(int(os.Stderr.Fd())) && os.Getenv("TERM") != "dumb", "colored output")
+ compilerFlags.StringVar(&tags, "tags", "", "a list of build tags to consider satisfied during the build")
+ compilerFlags.BoolVar(&options.MapToLocalDisk, "localmap", false, "use local paths for sourcemap")
+
+ flagWatch := pflag.NewFlagSet("", 0)
+ flagWatch.BoolVarP(&options.Watch, "watch", "w", false, "watch for changes to the source files")
+
+ cmdBuild := &cobra.Command{
+ Use: "build [packages]",
+ Short: "compile packages and dependencies",
+ }
+ cmdBuild.Flags().StringVarP(&pkgObj, "output", "o", "", "output file")
+ cmdBuild.Flags().AddFlagSet(flagVerbose)
+ cmdBuild.Flags().AddFlagSet(flagQuiet)
+ cmdBuild.Flags().AddFlagSet(compilerFlags)
+ cmdBuild.Flags().AddFlagSet(flagWatch)
+ cmdBuild.Run = func(cmd *cobra.Command, args []string) {
+ options.BuildTags = strings.Fields(tags)
+ for {
+ s := gbuild.NewSession(options)
+
+ err := func() error {
+ // Handle "gopherjs build [files]" ad-hoc package mode.
+ if len(args) > 0 && (strings.HasSuffix(args[0], ".go") || strings.HasSuffix(args[0], ".inc.js")) {
+ for _, arg := range args {
+ if !strings.HasSuffix(arg, ".go") && !strings.HasSuffix(arg, ".inc.js") {
+ return fmt.Errorf("named files must be .go or .inc.js files")
+ }
+ }
+ if pkgObj == "" {
+ basename := filepath.Base(args[0])
+ pkgObj = basename[:len(basename)-3] + ".js"
+ }
+ names := make([]string, len(args))
+ for i, name := range args {
+ name = filepath.ToSlash(name)
+ names[i] = name
+ if s.Watcher != nil {
+ s.Watcher.Add(name)
+ }
+ }
+ err := s.BuildFiles(args, pkgObj, currentDirectory)
+ return err
+ }
+
+ // Expand import path patterns.
+ patternContext := gbuild.NewBuildContext("", options.BuildTags)
+ pkgs := (&gotool.Context{BuildContext: *patternContext}).ImportPaths(args)
+
+ for _, pkgPath := range pkgs {
+ if s.Watcher != nil {
+ pkg, err := gbuild.NewBuildContext(s.InstallSuffix(), options.BuildTags).Import(pkgPath, "", build.FindOnly)
+ if err != nil {
+ return err
+ }
+ s.Watcher.Add(pkg.Dir)
+ }
+ pkg, err := gbuild.Import(pkgPath, 0, s.InstallSuffix(), options.BuildTags)
+ if err != nil {
+ return err
+ }
+ archive, err := s.BuildPackage(pkg)
+ if err != nil {
+ return err
+ }
+ if len(pkgs) == 1 { // Only consider writing output if single package specified.
+ if pkgObj == "" {
+ pkgObj = filepath.Base(pkg.Dir) + ".js"
+ }
+ if pkg.IsCommand() && !pkg.UpToDate {
+ if err := s.WriteCommandPackage(archive, pkgObj); err != nil {
+ return err
+ }
+ }
+ }
+ }
+ return nil
+ }()
+ exitCode := handleError(err, options, nil)
+
+ if s.Watcher == nil {
+ os.Exit(exitCode)
+ }
+ s.WaitForChange()
+ }
+ }
+
+ cmdInstall := &cobra.Command{
+ Use: "install [packages]",
+ Short: "compile and install packages and dependencies",
+ }
+ cmdInstall.Flags().AddFlagSet(flagVerbose)
+ cmdInstall.Flags().AddFlagSet(flagQuiet)
+ cmdInstall.Flags().AddFlagSet(compilerFlags)
+ cmdInstall.Flags().AddFlagSet(flagWatch)
+ cmdInstall.Run = func(cmd *cobra.Command, args []string) {
+ options.BuildTags = strings.Fields(tags)
+ for {
+ s := gbuild.NewSession(options)
+
+ err := func() error {
+ // Expand import path patterns.
+ patternContext := gbuild.NewBuildContext("", options.BuildTags)
+ pkgs := (&gotool.Context{BuildContext: *patternContext}).ImportPaths(args)
+
+ if cmd.Name() == "get" {
+ goGet := exec.Command("go", append([]string{"get", "-d", "-tags=js"}, pkgs...)...)
+ goGet.Stdout = os.Stdout
+ goGet.Stderr = os.Stderr
+ if err := goGet.Run(); err != nil {
+ return err
+ }
+ }
+ for _, pkgPath := range pkgs {
+ pkg, err := gbuild.Import(pkgPath, 0, s.InstallSuffix(), options.BuildTags)
+ if s.Watcher != nil && pkg != nil { // add watch even on error
+ s.Watcher.Add(pkg.Dir)
+ }
+ if err != nil {
+ return err
+ }
+
+ archive, err := s.BuildPackage(pkg)
+ if err != nil {
+ return err
+ }
+
+ if pkg.IsCommand() && !pkg.UpToDate {
+ if err := s.WriteCommandPackage(archive, pkg.PkgObj); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+ }()
+ exitCode := handleError(err, options, nil)
+
+ if s.Watcher == nil {
+ os.Exit(exitCode)
+ }
+ s.WaitForChange()
+ }
+ }
+
+ cmdDoc := &cobra.Command{
+ Use: "doc [arguments]",
+ Short: "display documentation for the requested, package, method or symbol",
+ }
+ cmdDoc.Run = func(cmd *cobra.Command, args []string) {
+ goDoc := exec.Command("go", append([]string{"doc"}, args...)...)
+ goDoc.Stdout = os.Stdout
+ goDoc.Stderr = os.Stderr
+ goDoc.Env = append(os.Environ(), "GOARCH=js")
+ err := goDoc.Run()
+ exitCode := handleError(err, options, nil)
+ os.Exit(exitCode)
+ }
+
+ cmdGet := &cobra.Command{
+ Use: "get [packages]",
+ Short: "download and install packages and dependencies",
+ }
+ cmdGet.Flags().AddFlagSet(flagVerbose)
+ cmdGet.Flags().AddFlagSet(flagQuiet)
+ cmdGet.Flags().AddFlagSet(compilerFlags)
+ cmdGet.Run = cmdInstall.Run
+
+ cmdRun := &cobra.Command{
+ Use: "run [gofiles...] [arguments...]",
+ Short: "compile and run Go program",
+ }
+ cmdRun.Flags().AddFlagSet(flagVerbose)
+ cmdRun.Flags().AddFlagSet(flagQuiet)
+ cmdRun.Flags().AddFlagSet(compilerFlags)
+ cmdRun.Run = func(cmd *cobra.Command, args []string) {
+ err := func() error {
+ lastSourceArg := 0
+ for {
+ if lastSourceArg == len(args) || !(strings.HasSuffix(args[lastSourceArg], ".go") || strings.HasSuffix(args[lastSourceArg], ".inc.js")) {
+ break
+ }
+ lastSourceArg++
+ }
+ if lastSourceArg == 0 {
+ return fmt.Errorf("gopherjs run: no go files listed")
+ }
+
+ tempfile, err := ioutil.TempFile(currentDirectory, filepath.Base(args[0])+".")
+ if err != nil && strings.HasPrefix(currentDirectory, runtime.GOROOT()) {
+ tempfile, err = ioutil.TempFile("", filepath.Base(args[0])+".")
+ }
+ if err != nil {
+ return err
+ }
+ defer func() {
+ tempfile.Close()
+ os.Remove(tempfile.Name())
+ os.Remove(tempfile.Name() + ".map")
+ }()
+ s := gbuild.NewSession(options)
+ if err := s.BuildFiles(args[:lastSourceArg], tempfile.Name(), currentDirectory); err != nil {
+ return err
+ }
+ if err := runNode(tempfile.Name(), args[lastSourceArg:], "", options.Quiet); err != nil {
+ return err
+ }
+ return nil
+ }()
+ exitCode := handleError(err, options, nil)
+
+ os.Exit(exitCode)
+ }
+
+ cmdTest := &cobra.Command{
+ Use: "test [packages]",
+ Short: "test packages",
+ }
+ bench := cmdTest.Flags().String("bench", "", "Run benchmarks matching the regular expression. By default, no benchmarks run. To run all benchmarks, use '--bench=.'.")
+ benchtime := cmdTest.Flags().String("benchtime", "", "Run enough iterations of each benchmark to take t, specified as a time.Duration (for example, -benchtime 1h30s). The default is 1 second (1s).")
+ count := cmdTest.Flags().String("count", "", "Run each test and benchmark n times (default 1). Examples are always run once.")
+ run := cmdTest.Flags().String("run", "", "Run only those tests and examples matching the regular expression.")
+ short := cmdTest.Flags().Bool("short", false, "Tell long-running tests to shorten their run time.")
+ verbose := cmdTest.Flags().BoolP("verbose", "v", false, "Log all tests as they are run. Also print all text from Log and Logf calls even if the test succeeds.")
+ compileOnly := cmdTest.Flags().BoolP("compileonly", "c", false, "Compile the test binary to pkg.test.js but do not run it (where pkg is the last element of the package's import path). The file name can be changed with the -o flag.")
+ outputFilename := cmdTest.Flags().StringP("output", "o", "", "Compile the test binary to the named file. The test still runs (unless -c is specified).")
+ cmdTest.Flags().AddFlagSet(compilerFlags)
+ cmdTest.Run = func(cmd *cobra.Command, args []string) {
+ options.BuildTags = strings.Fields(tags)
+ err := func() error {
+ // Expand import path patterns.
+ patternContext := gbuild.NewBuildContext("", options.BuildTags)
+ args = (&gotool.Context{BuildContext: *patternContext}).ImportPaths(args)
+
+ if *compileOnly && len(args) > 1 {
+ return errors.New("cannot use -c flag with multiple packages")
+ }
+ if *outputFilename != "" && len(args) > 1 {
+ return errors.New("cannot use -o flag with multiple packages")
+ }
+
+ pkgs := make([]*gbuild.PackageData, len(args))
+ for i, pkgPath := range args {
+ var err error
+ pkgs[i], err = gbuild.Import(pkgPath, 0, "", options.BuildTags)
+ if err != nil {
+ return err
+ }
+ }
+
+ var exitErr error
+ for _, pkg := range pkgs {
+ if len(pkg.TestGoFiles) == 0 && len(pkg.XTestGoFiles) == 0 {
+ fmt.Printf("? \t%s\t[no test files]\n", pkg.ImportPath)
+ continue
+ }
+ s := gbuild.NewSession(options)
+
+ tests := &testFuncs{BuildContext: s.BuildContext(), Package: pkg.Package}
+ collectTests := func(testPkg *gbuild.PackageData, testPkgName string, needVar *bool) error {
+ if testPkgName == "_test" {
+ for _, file := range pkg.TestGoFiles {
+ if err := tests.load(pkg.Package.Dir, file, testPkgName, &tests.ImportTest, &tests.NeedTest); err != nil {
+ return err
+ }
+ }
+ } else {
+ for _, file := range pkg.XTestGoFiles {
+ if err := tests.load(pkg.Package.Dir, file, "_xtest", &tests.ImportXtest, &tests.NeedXtest); err != nil {
+ return err
+ }
+ }
+ }
+ _, err := s.BuildPackage(testPkg)
+ return err
+ }
+
+ if err := collectTests(&gbuild.PackageData{
+ Package: &build.Package{
+ ImportPath: pkg.ImportPath,
+ Dir: pkg.Dir,
+ GoFiles: append(pkg.GoFiles, pkg.TestGoFiles...),
+ Imports: append(pkg.Imports, pkg.TestImports...),
+ },
+ IsTest: true,
+ JSFiles: pkg.JSFiles,
+ }, "_test", &tests.NeedTest); err != nil {
+ return err
+ }
+
+ if err := collectTests(&gbuild.PackageData{
+ Package: &build.Package{
+ ImportPath: pkg.ImportPath + "_test",
+ Dir: pkg.Dir,
+ GoFiles: pkg.XTestGoFiles,
+ Imports: pkg.XTestImports,
+ },
+ IsTest: true,
+ }, "_xtest", &tests.NeedXtest); err != nil {
+ return err
+ }
+
+ buf := new(bytes.Buffer)
+ if err := testmainTmpl.Execute(buf, tests); err != nil {
+ return err
+ }
+
+ fset := token.NewFileSet()
+ mainFile, err := parser.ParseFile(fset, "_testmain.go", buf, 0)
+ if err != nil {
+ return err
+ }
+
+ importContext := &compiler.ImportContext{
+ Packages: s.Types,
+ Import: func(path string) (*compiler.Archive, error) {
+ if path == pkg.ImportPath || path == pkg.ImportPath+"_test" {
+ return s.Archives[path], nil
+ }
+ return s.BuildImportPath(path)
+ },
+ }
+ mainPkgArchive, err := compiler.Compile("main", []*ast.File{mainFile}, fset, importContext, options.Minify)
+ if err != nil {
+ return err
+ }
+
+ if *compileOnly && *outputFilename == "" {
+ *outputFilename = pkg.Package.Name + "_test.js"
+ }
+
+ var outfile *os.File
+ if *outputFilename != "" {
+ outfile, err = os.Create(*outputFilename)
+ if err != nil {
+ return err
+ }
+ } else {
+ outfile, err = ioutil.TempFile(currentDirectory, "test.")
+ if err != nil {
+ return err
+ }
+ }
+ defer func() {
+ outfile.Close()
+ if *outputFilename == "" {
+ os.Remove(outfile.Name())
+ os.Remove(outfile.Name() + ".map")
+ }
+ }()
+
+ if err := s.WriteCommandPackage(mainPkgArchive, outfile.Name()); err != nil {
+ return err
+ }
+
+ if *compileOnly {
+ continue
+ }
+
+ var args []string
+ if *bench != "" {
+ args = append(args, "-test.bench", *bench)
+ }
+ if *benchtime != "" {
+ args = append(args, "-test.benchtime", *benchtime)
+ }
+ if *count != "" {
+ args = append(args, "-test.count", *count)
+ }
+ if *run != "" {
+ args = append(args, "-test.run", *run)
+ }
+ if *short {
+ args = append(args, "-test.short")
+ }
+ if *verbose {
+ args = append(args, "-test.v")
+ }
+ status := "ok "
+ start := time.Now()
+ if err := runNode(outfile.Name(), args, runTestDir(pkg), options.Quiet); err != nil {
+ if _, ok := err.(*exec.ExitError); !ok {
+ return err
+ }
+ exitErr = err
+ status = "FAIL"
+ }
+ fmt.Printf("%s\t%s\t%.3fs\n", status, pkg.ImportPath, time.Since(start).Seconds())
+ }
+ return exitErr
+ }()
+ exitCode := handleError(err, options, nil)
+
+ os.Exit(exitCode)
+ }
+
+ cmdServe := &cobra.Command{
+ Use: "serve [root]",
+ Short: "compile on-the-fly and serve",
+ }
+ cmdServe.Flags().AddFlagSet(flagVerbose)
+ cmdServe.Flags().AddFlagSet(flagQuiet)
+ cmdServe.Flags().AddFlagSet(compilerFlags)
+ var addr string
+ cmdServe.Flags().StringVarP(&addr, "http", "", ":8080", "HTTP bind address to serve")
+ cmdServe.Run = func(cmd *cobra.Command, args []string) {
+ options.BuildTags = strings.Fields(tags)
+ dirs := append(filepath.SplitList(build.Default.GOPATH), build.Default.GOROOT)
+ var root string
+
+ if len(args) > 1 {
+ cmdServe.HelpFunc()(cmd, args)
+ os.Exit(1)
+ }
+
+ if len(args) == 1 {
+ root = args[0]
+ }
+
+ sourceFiles := http.FileServer(serveCommandFileSystem{
+ serveRoot: root,
+ options: options,
+ dirs: dirs,
+ sourceMaps: make(map[string][]byte),
+ })
+
+ ln, err := net.Listen("tcp", addr)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+ if tcpAddr := ln.Addr().(*net.TCPAddr); tcpAddr.IP.Equal(net.IPv4zero) || tcpAddr.IP.Equal(net.IPv6zero) { // Any available addresses.
+ fmt.Printf("serving at http://localhost:%d and on port %d of any available addresses\n", tcpAddr.Port, tcpAddr.Port)
+ } else { // Specific address.
+ fmt.Printf("serving at http://%s\n", tcpAddr)
+ }
+ fmt.Fprintln(os.Stderr, http.Serve(tcpKeepAliveListener{ln.(*net.TCPListener)}, sourceFiles))
+ }
+
+ cmdVersion := &cobra.Command{
+ Use: "version",
+ Short: "print GopherJS compiler version",
+ }
+ cmdVersion.Run = func(cmd *cobra.Command, args []string) {
+ if len(args) > 0 {
+ cmdServe.HelpFunc()(cmd, args)
+ os.Exit(1)
+ }
+
+ fmt.Printf("GopherJS %s\n", compiler.Version)
+ }
+
+ rootCmd := &cobra.Command{
+ Use: "gopherjs",
+ Long: "GopherJS is a tool for compiling Go source code to JavaScript.",
+ }
+ rootCmd.AddCommand(cmdBuild, cmdGet, cmdInstall, cmdRun, cmdTest, cmdServe, cmdVersion, cmdDoc)
+ err := rootCmd.Execute()
+ if err != nil {
+ os.Exit(2)
+ }
+}
+
+// tcpKeepAliveListener sets TCP keep-alive timeouts on accepted
+// connections. It's used by ListenAndServe and ListenAndServeTLS so
+// dead TCP connections (e.g. closing laptop mid-download) eventually
+// go away.
+type tcpKeepAliveListener struct {
+ *net.TCPListener
+}
+
+func (ln tcpKeepAliveListener) Accept() (c net.Conn, err error) {
+ tc, err := ln.AcceptTCP()
+ if err != nil {
+ return
+ }
+ tc.SetKeepAlive(true)
+ tc.SetKeepAlivePeriod(3 * time.Minute)
+ return tc, nil
+}
+
+type serveCommandFileSystem struct {
+ serveRoot string
+ options *gbuild.Options
+ dirs []string
+ sourceMaps map[string][]byte
+}
+
+func (fs serveCommandFileSystem) Open(requestName string) (http.File, error) {
+ name := path.Join(fs.serveRoot, requestName[1:]) // requestName[0] == '/'
+
+ dir, file := path.Split(name)
+ base := path.Base(dir) // base is parent folder name, which becomes the output file name.
+
+ isPkg := file == base+".js"
+ isMap := file == base+".js.map"
+ isIndex := file == "index.html"
+
+ if isPkg || isMap || isIndex {
+ // If we're going to be serving our special files, make sure there's a Go command in this folder.
+ s := gbuild.NewSession(fs.options)
+ pkg, err := gbuild.Import(path.Dir(name), 0, s.InstallSuffix(), fs.options.BuildTags)
+ if err != nil || pkg.Name != "main" {
+ isPkg = false
+ isMap = false
+ isIndex = false
+ }
+
+ switch {
+ case isPkg:
+ buf := new(bytes.Buffer)
+ browserErrors := new(bytes.Buffer)
+ err := func() error {
+ archive, err := s.BuildPackage(pkg)
+ if err != nil {
+ return err
+ }
+
+ sourceMapFilter := &compiler.SourceMapFilter{Writer: buf}
+ m := &sourcemap.Map{File: base + ".js"}
+ sourceMapFilter.MappingCallback = gbuild.NewMappingCallback(m, fs.options.GOROOT, fs.options.GOPATH, fs.options.MapToLocalDisk)
+
+ deps, err := compiler.ImportDependencies(archive, s.BuildImportPath)
+ if err != nil {
+ return err
+ }
+ if err := compiler.WriteProgramCode(deps, sourceMapFilter); err != nil {
+ return err
+ }
+
+ mapBuf := new(bytes.Buffer)
+ m.WriteTo(mapBuf)
+ buf.WriteString("//# sourceMappingURL=" + base + ".js.map\n")
+ fs.sourceMaps[name+".map"] = mapBuf.Bytes()
+
+ return nil
+ }()
+ handleError(err, fs.options, browserErrors)
+ if err != nil {
+ buf = browserErrors
+ }
+ return newFakeFile(base+".js", buf.Bytes()), nil
+
+ case isMap:
+ if content, ok := fs.sourceMaps[name]; ok {
+ return newFakeFile(base+".js.map", content), nil
+ }
+ }
+ }
+
+ for _, d := range fs.dirs {
+ dir := http.Dir(filepath.Join(d, "src"))
+
+ f, err := dir.Open(name)
+ if err == nil {
+ return f, nil
+ }
+
+ // source maps are served outside of serveRoot
+ f, err = dir.Open(requestName)
+ if err == nil {
+ return f, nil
+ }
+ }
+
+ if isIndex {
+ // If there was no index.html file in any dirs, supply our own.
+ return newFakeFile("index.html", []byte(`<html><head><meta charset="utf-8"><script src="`+base+`.js"></script></head><body></body></html>`)), nil
+ }
+
+ return nil, os.ErrNotExist
+}
+
+type fakeFile struct {
+ name string
+ size int
+ io.ReadSeeker
+}
+
+func newFakeFile(name string, content []byte) *fakeFile {
+ return &fakeFile{name: name, size: len(content), ReadSeeker: bytes.NewReader(content)}
+}
+
+func (f *fakeFile) Close() error {
+ return nil
+}
+
+func (f *fakeFile) Readdir(count int) ([]os.FileInfo, error) {
+ return nil, os.ErrInvalid
+}
+
+func (f *fakeFile) Stat() (os.FileInfo, error) {
+ return f, nil
+}
+
+func (f *fakeFile) Name() string {
+ return f.name
+}
+
+func (f *fakeFile) Size() int64 {
+ return int64(f.size)
+}
+
+func (f *fakeFile) Mode() os.FileMode {
+ return 0
+}
+
+func (f *fakeFile) ModTime() time.Time {
+ return time.Time{}
+}
+
+func (f *fakeFile) IsDir() bool {
+ return false
+}
+
+func (f *fakeFile) Sys() interface{} {
+ return nil
+}
+
+// handleError handles err and returns an appropriate exit code.
+// If browserErrors is non-nil, errors are written for presentation in browser.
+func handleError(err error, options *gbuild.Options, browserErrors *bytes.Buffer) int {
+ switch err := err.(type) {
+ case nil:
+ return 0
+ case compiler.ErrorList:
+ for _, entry := range err {
+ printError(entry, options, browserErrors)
+ }
+ return 1
+ case *exec.ExitError:
+ return err.Sys().(syscall.WaitStatus).ExitStatus()
+ default:
+ printError(err, options, browserErrors)
+ return 1
+ }
+}
+
+// printError prints err to Stderr with options. If browserErrors is non-nil, errors are also written for presentation in browser.
+func printError(err error, options *gbuild.Options, browserErrors *bytes.Buffer) {
+ e := sprintError(err)
+ options.PrintError("%s\n", e)
+ if browserErrors != nil {
+ fmt.Fprintln(browserErrors, `console.error("`+template.JSEscapeString(e)+`");`)
+ }
+}
+
+// sprintError returns an annotated error string without trailing newline.
+func sprintError(err error) string {
+ makeRel := func(name string) string {
+ if relname, err := filepath.Rel(currentDirectory, name); err == nil {
+ return relname
+ }
+ return name
+ }
+
+ switch e := err.(type) {
+ case *scanner.Error:
+ return fmt.Sprintf("%s:%d:%d: %s", makeRel(e.Pos.Filename), e.Pos.Line, e.Pos.Column, e.Msg)
+ case types.Error:
+ pos := e.Fset.Position(e.Pos)
+ return fmt.Sprintf("%s:%d:%d: %s", makeRel(pos.Filename), pos.Line, pos.Column, e.Msg)
+ default:
+ return fmt.Sprintf("%s", e)
+ }
+}
+
+// runNode runs script with args using Node.js in directory dir.
+// If dir is empty string, current directory is used.
+func runNode(script string, args []string, dir string, quiet bool) error {
+ var allArgs []string
+ if b, _ := strconv.ParseBool(os.Getenv("SOURCE_MAP_SUPPORT")); os.Getenv("SOURCE_MAP_SUPPORT") == "" || b {
+ allArgs = []string{"--require", "source-map-support/register"}
+ if err := exec.Command("node", "--require", "source-map-support/register", "--eval", "").Run(); err != nil {
+ if !quiet {
+ fmt.Fprintln(os.Stderr, "gopherjs: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.")
+ }
+ allArgs = []string{}
+ }
+ }
+
+ if runtime.GOOS != "windows" {
+ // We've seen issues with stack space limits causing
+ // recursion-heavy standard library tests to fail (e.g., see
+ // https://github.com/gopherjs/gopherjs/pull/669#issuecomment-319319483).
+ //
+ // There are two separate limits in non-Windows environments:
+ //
+ // - OS process limit
+ // - Node.js (V8) limit
+ //
+ // GopherJS fetches the current OS process limit, and sets the
+ // Node.js limit to the same value. So both limits are kept in sync
+ // and can be controlled by setting OS process limit. E.g.:
+ //
+ // ulimit -s 10000 && gopherjs test
+ //
+ cur, err := sysutil.RlimitStack()
+ if err != nil {
+ return fmt.Errorf("failed to get stack size limit: %v", err)
+ }
+ allArgs = append(allArgs, fmt.Sprintf("--stack_size=%v", cur/1000)) // Convert from bytes to KB.
+ }
+
+ allArgs = append(allArgs, script)
+ allArgs = append(allArgs, args...)
+
+ node := exec.Command("node", allArgs...)
+ node.Dir = dir
+ node.Stdin = os.Stdin
+ node.Stdout = os.Stdout
+ node.Stderr = os.Stderr
+ err := node.Run()
+ if _, ok := err.(*exec.ExitError); err != nil && !ok {
+ err = fmt.Errorf("could not run Node.js: %s", err.Error())
+ }
+ return err
+}
+
+// runTestDir returns the directory for Node.js to use when running tests for package p.
+// Empty string means current directory.
+func runTestDir(p *gbuild.PackageData) string {
+ if p.IsVirtual {
+ // The package is virtual and doesn't have a physical directory. Use current directory.
+ return ""
+ }
+ // Run tests in the package directory.
+ return p.Dir
+}
+
+type testFuncs struct {
+ BuildContext *build.Context
+ Tests []testFunc
+ Benchmarks []testFunc
+ Examples []testFunc
+ TestMain *testFunc
+ Package *build.Package
+ ImportTest bool
+ NeedTest bool
+ ImportXtest bool
+ NeedXtest bool
+}
+
+type testFunc struct {
+ Package string // imported package name (_test or _xtest)
+ Name string // function name
+ Output string // output, for examples
+ Unordered bool // output is allowed to be unordered.
+}
+
+var testFileSet = token.NewFileSet()
+
+func (t *testFuncs) load(dir, file, pkg string, doImport, seen *bool) error {
+ f, err := buildutil.ParseFile(testFileSet, t.BuildContext, nil, dir, file, parser.ParseComments)
+ if err != nil {
+ return err
+ }
+ for _, d := range f.Decls {
+ n, ok := d.(*ast.FuncDecl)
+ if !ok {
+ continue
+ }
+ if n.Recv != nil {
+ continue
+ }
+ name := n.Name.String()
+ switch {
+ case isTestMain(n):
+ if t.TestMain != nil {
+ return errors.New("multiple definitions of TestMain")
+ }
+ t.TestMain = &testFunc{pkg, name, "", false}
+ *doImport, *seen = true, true
+ case isTest(name, "Test"):
+ t.Tests = append(t.Tests, testFunc{pkg, name, "", false})
+ *doImport, *seen = true, true
+ case isTest(name, "Benchmark"):
+ t.Benchmarks = append(t.Benchmarks, testFunc{pkg, name, "", false})
+ *doImport, *seen = true, true
+ }
+ }
+ ex := doc.Examples(f)
+ sort.Sort(byOrder(ex))
+ for _, e := range ex {
+ *doImport = true // import test file whether executed or not
+ if e.Output == "" && !e.EmptyOutput {
+ // Don't run examples with no output.
+ continue
+ }
+ t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output, e.Unordered})
+ *seen = true
+ }
+
+ return nil
+}
+
+type byOrder []*doc.Example
+
+func (x byOrder) Len() int { return len(x) }
+func (x byOrder) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+func (x byOrder) Less(i, j int) bool { return x[i].Order < x[j].Order }
+
+// isTestMain tells whether fn is a TestMain(m *testing.M) function.
+func isTestMain(fn *ast.FuncDecl) bool {
+ if fn.Name.String() != "TestMain" ||
+ fn.Type.Results != nil && len(fn.Type.Results.List) > 0 ||
+ fn.Type.Params == nil ||
+ len(fn.Type.Params.List) != 1 ||
+ len(fn.Type.Params.List[0].Names) > 1 {
+ return false
+ }
+ ptr, ok := fn.Type.Params.List[0].Type.(*ast.StarExpr)
+ if !ok {
+ return false
+ }
+ // We can't easily check that the type is *testing.M
+ // because we don't know how testing has been imported,
+ // but at least check that it's *M or *something.M.
+ if name, ok := ptr.X.(*ast.Ident); ok && name.Name == "M" {
+ return true
+ }
+ if sel, ok := ptr.X.(*ast.SelectorExpr); ok && sel.Sel.Name == "M" {
+ return true
+ }
+ return false
+}
+
+// isTest tells whether name looks like a test (or benchmark, according to prefix).
+// It is a Test (say) if there is a character after Test that is not a lower-case letter.
+// We don't want TesticularCancer.
+func isTest(name, prefix string) bool {
+ if !strings.HasPrefix(name, prefix) {
+ return false
+ }
+ if len(name) == len(prefix) { // "Test" is ok
+ return true
+ }
+ rune, _ := utf8.DecodeRuneInString(name[len(prefix):])
+ return !unicode.IsLower(rune)
+}
+
+var testmainTmpl = template.Must(template.New("main").Parse(`
+package main
+
+import (
+{{if not .TestMain}}
+ "os"
+{{end}}
+ "testing"
+ "testing/internal/testdeps"
+
+{{if .ImportTest}}
+ {{if .NeedTest}}_test{{else}}_{{end}} {{.Package.ImportPath | printf "%q"}}
+{{end}}
+{{if .ImportXtest}}
+ {{if .NeedXtest}}_xtest{{else}}_{{end}} {{.Package.ImportPath | printf "%s_test" | printf "%q"}}
+{{end}}
+)
+
+var tests = []testing.InternalTest{
+{{range .Tests}}
+ {"{{.Name}}", {{.Package}}.{{.Name}}},
+{{end}}
+}
+
+var benchmarks = []testing.InternalBenchmark{
+{{range .Benchmarks}}
+ {"{{.Name}}", {{.Package}}.{{.Name}}},
+{{end}}
+}
+
+var examples = []testing.InternalExample{
+{{range .Examples}}
+ {"{{.Name}}", {{.Package}}.{{.Name}}, {{.Output | printf "%q"}}, {{.Unordered}}},
+{{end}}
+}
+
+func main() {
+ m := testing.MainStart(testdeps.TestDeps{}, tests, benchmarks, examples)
+{{with .TestMain}}
+ {{.Package}}.{{.Name}}(m)
+{{else}}
+ os.Exit(m.Run())
+{{end}}
+}
+
+`))
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/.gitignore b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/.gitignore
deleted file mode 100644
index dd8fc7468f4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.6
-6.out
-_obj/
-_test/
-_testmain.go
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/LICENSE b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/LICENSE
deleted file mode 100644
index d6456956733..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/README.md b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/README.md
deleted file mode 100644
index 8f36612218f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-[![GoDoc](https://godoc.org/github.com/jacobsa/oglematchers?status.svg)](https://godoc.org/github.com/jacobsa/oglematchers)
-
-`oglematchers` is a package for the Go programming language containing a set of
-matchers, useful in a testing or mocking framework, inspired by and mostly
-compatible with [Google Test][googletest] for C++ and
-[Google JS Test][google-js-test]. The package is used by the
-[ogletest][ogletest] testing framework and [oglemock][oglemock] mocking
-framework, which may be more directly useful to you, but can be generically used
-elsewhere as well.
-
-A "matcher" is simply an object with a `Matches` method defining a set of golang
-values matched by the matcher, and a `Description` method describing that set.
-For example, here are some matchers:
-
-```go
-// Numbers
-Equals(17.13)
-LessThan(19)
-
-// Strings
-Equals("taco")
-HasSubstr("burrito")
-MatchesRegex("t.*o")
-
-// Combining matchers
-AnyOf(LessThan(17), GreaterThan(19))
-```
-
-There are lots more; see [here][reference] for a reference. You can also add
-your own simply by implementing the `oglematchers.Matcher` interface.
-
-
-Installation
-------------
-
-First, make sure you have installed Go 1.0.2 or newer. See
-[here][golang-install] for instructions.
-
-Use the following command to install `oglematchers` and keep it up to date:
-
- go get -u github.com/jacobsa/oglematchers
-
-
-Documentation
--------------
-
-See [here][reference] for documentation. Alternatively, you can install the
-package and then use `godoc`:
-
- godoc github.com/jacobsa/oglematchers
-
-
-[reference]: http://godoc.org/github.com/jacobsa/oglematchers
-[golang-install]: http://golang.org/doc/install.html
-[googletest]: http://code.google.com/p/googletest/
-[google-js-test]: http://code.google.com/p/google-js-test/
-[ogletest]: http://github.com/jacobsa/ogletest
-[oglemock]: http://github.com/jacobsa/oglemock
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of.go
deleted file mode 100644
index d93a9740443..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "strings"
-)
-
-// AllOf accepts a set of matchers S and returns a matcher that follows the
-// algorithm below when considering a candidate c:
-//
-// 1. Return true if for every Matcher m in S, m matches c.
-//
-// 2. Otherwise, if there is a matcher m in S such that m returns a fatal
-// error for c, return that matcher's error message.
-//
-// 3. Otherwise, return false with the error from some wrapped matcher.
-//
-// This is akin to a logical AND operation for matchers.
-func AllOf(matchers ...Matcher) Matcher {
- return &allOfMatcher{matchers}
-}
-
-type allOfMatcher struct {
- wrappedMatchers []Matcher
-}
-
-func (m *allOfMatcher) Description() string {
- // Special case: the empty set.
- if len(m.wrappedMatchers) == 0 {
- return "is anything"
- }
-
- // Join the descriptions for the wrapped matchers.
- wrappedDescs := make([]string, len(m.wrappedMatchers))
- for i, wrappedMatcher := range m.wrappedMatchers {
- wrappedDescs[i] = wrappedMatcher.Description()
- }
-
- return strings.Join(wrappedDescs, ", and ")
-}
-
-func (m *allOfMatcher) Matches(c interface{}) (err error) {
- for _, wrappedMatcher := range m.wrappedMatchers {
- if wrappedErr := wrappedMatcher.Matches(c); wrappedErr != nil {
- err = wrappedErr
-
- // If the error is fatal, return immediately with this error.
- _, ok := wrappedErr.(*FatalError)
- if ok {
- return
- }
- }
- }
-
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of_test.go
deleted file mode 100644
index f07306f10ad..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/all_of_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "errors"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type allOfFakeMatcher struct {
- desc string
- err error
-}
-
-func (m *allOfFakeMatcher) Matches(c interface{}) error {
- return m.err
-}
-
-func (m *allOfFakeMatcher) Description() string {
- return m.desc
-}
-
-type AllOfTest struct {
-}
-
-func init() { RegisterTestSuite(&AllOfTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *AllOfTest) DescriptionWithEmptySet() {
- m := AllOf()
- ExpectEq("is anything", m.Description())
-}
-
-func (t *AllOfTest) DescriptionWithOneMatcher() {
- m := AllOf(&allOfFakeMatcher{"taco", errors.New("")})
- ExpectEq("taco", m.Description())
-}
-
-func (t *AllOfTest) DescriptionWithMultipleMatchers() {
- m := AllOf(
- &allOfFakeMatcher{"taco", errors.New("")},
- &allOfFakeMatcher{"burrito", errors.New("")},
- &allOfFakeMatcher{"enchilada", errors.New("")})
-
- ExpectEq("taco, and burrito, and enchilada", m.Description())
-}
-
-func (t *AllOfTest) EmptySet() {
- m := AllOf()
- err := m.Matches(17)
-
- ExpectEq(nil, err)
-}
-
-func (t *AllOfTest) OneMatcherReturnsFatalErrorAndSomeOthersFail() {
- m := AllOf(
- &allOfFakeMatcher{"", errors.New("")},
- &allOfFakeMatcher{"", NewFatalError("taco")},
- &allOfFakeMatcher{"", errors.New("")},
- &allOfFakeMatcher{"", nil})
-
- err := m.Matches(17)
-
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *AllOfTest) OneMatcherReturnsNonFatalAndOthersSayTrue() {
- m := AllOf(
- &allOfFakeMatcher{"", nil},
- &allOfFakeMatcher{"", errors.New("taco")},
- &allOfFakeMatcher{"", nil})
-
- err := m.Matches(17)
-
- ExpectFalse(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *AllOfTest) AllMatchersSayTrue() {
- m := AllOf(
- &allOfFakeMatcher{"", nil},
- &allOfFakeMatcher{"", nil},
- &allOfFakeMatcher{"", nil})
-
- err := m.Matches(17)
-
- ExpectEq(nil, err)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any.go
deleted file mode 100644
index f6991ec1020..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-// Any returns a matcher that matches any value.
-func Any() Matcher {
- return &anyMatcher{}
-}
-
-type anyMatcher struct {
-}
-
-func (m *anyMatcher) Description() string {
- return "is anything"
-}
-
-func (m *anyMatcher) Matches(c interface{}) error {
- return nil
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of.go
deleted file mode 100644
index 2918b51f21a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strings"
-)
-
-// AnyOf accepts a set of values S and returns a matcher that follows the
-// algorithm below when considering a candidate c:
-//
-// 1. If there exists a value m in S such that m implements the Matcher
-// interface and m matches c, return true.
-//
-// 2. Otherwise, if there exists a value v in S such that v does not implement
-// the Matcher interface and the matcher Equals(v) matches c, return true.
-//
-// 3. Otherwise, if there is a value m in S such that m implements the Matcher
-// interface and m returns a fatal error for c, return that fatal error.
-//
-// 4. Otherwise, return false.
-//
-// This is akin to a logical OR operation for matchers, with non-matchers x
-// being treated as Equals(x).
-func AnyOf(vals ...interface{}) Matcher {
- // Get ahold of a type variable for the Matcher interface.
- var dummy *Matcher
- matcherType := reflect.TypeOf(dummy).Elem()
-
- // Create a matcher for each value, or use the value itself if it's already a
- // matcher.
- wrapped := make([]Matcher, len(vals))
- for i, v := range vals {
- t := reflect.TypeOf(v)
- if t != nil && t.Implements(matcherType) {
- wrapped[i] = v.(Matcher)
- } else {
- wrapped[i] = Equals(v)
- }
- }
-
- return &anyOfMatcher{wrapped}
-}
-
-type anyOfMatcher struct {
- wrapped []Matcher
-}
-
-func (m *anyOfMatcher) Description() string {
- wrappedDescs := make([]string, len(m.wrapped))
- for i, matcher := range m.wrapped {
- wrappedDescs[i] = matcher.Description()
- }
-
- return fmt.Sprintf("or(%s)", strings.Join(wrappedDescs, ", "))
-}
-
-func (m *anyOfMatcher) Matches(c interface{}) (err error) {
- err = errors.New("")
-
- // Try each matcher in turn.
- for _, matcher := range m.wrapped {
- wrappedErr := matcher.Matches(c)
-
- // Return immediately if there's a match.
- if wrappedErr == nil {
- err = nil
- return
- }
-
- // Note the fatal error, if any.
- if _, isFatal := wrappedErr.(*FatalError); isFatal {
- err = wrappedErr
- }
- }
-
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of_test.go
deleted file mode 100644
index b0f85efc4a3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_of_test.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
-
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type fakeAnyOfMatcher struct {
- desc string
- err error
-}
-
-func (m *fakeAnyOfMatcher) Matches(c interface{}) error {
- return m.err
-}
-
-func (m *fakeAnyOfMatcher) Description() string {
- return m.desc
-}
-
-type AnyOfTest struct {
-}
-
-func init() { RegisterTestSuite(&AnyOfTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *AnyOfTest) EmptySet() {
- matcher := AnyOf()
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *AnyOfTest) OneTrue() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", NewFatalError("foo")},
- 17,
- &fakeAnyOfMatcher{"", errors.New("foo")},
- &fakeAnyOfMatcher{"", nil},
- &fakeAnyOfMatcher{"", errors.New("foo")},
- )
-
- err := matcher.Matches(0)
- ExpectEq(nil, err)
-}
-
-func (t *AnyOfTest) OneEqual() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", NewFatalError("foo")},
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 13,
- "taco",
- 19,
- &fakeAnyOfMatcher{"", errors.New("foo")},
- )
-
- err := matcher.Matches("taco")
- ExpectEq(nil, err)
-}
-
-func (t *AnyOfTest) OneFatal() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 17,
- &fakeAnyOfMatcher{"", NewFatalError("taco")},
- &fakeAnyOfMatcher{"", errors.New("foo")},
- )
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *AnyOfTest) OneNil() {
- var err error
- matcher := AnyOf(
- 13,
- nil,
- 19,
- )
-
- // No match
- err = matcher.Matches(14)
- ExpectNe(nil, err)
-
- // Match
- err = matcher.Matches(nil)
- ExpectEq(nil, err)
-}
-
-func (t *AnyOfTest) AllFalseAndNotEqual() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 17,
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 19,
- )
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *AnyOfTest) DescriptionForEmptySet() {
- matcher := AnyOf()
- ExpectEq("or()", matcher.Description())
-}
-
-func (t *AnyOfTest) DescriptionForNonEmptySet() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"taco", nil},
- "burrito",
- &fakeAnyOfMatcher{"enchilada", nil},
- )
-
- ExpectEq("or(taco, burrito, enchilada)", matcher.Description())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_test.go
deleted file mode 100644
index 7b6f6075868..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/any_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type AnyTest struct {
-}
-
-func init() { RegisterTestSuite(&AnyTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *AnyTest) Description() {
- m := Any()
- ExpectEq("is anything", m.Description())
-}
-
-func (t *AnyTest) Matches() {
- var err error
- m := Any()
-
- err = m.Matches(nil)
- ExpectEq(nil, err)
-
- err = m.Matches(17)
- ExpectEq(nil, err)
-
- err = m.Matches("taco")
- ExpectEq(nil, err)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains.go
deleted file mode 100644
index 2f326dbc5d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// Return a matcher that matches arrays slices with at least one element that
-// matches the supplied argument. If the argument x is not itself a Matcher,
-// this is equivalent to Contains(Equals(x)).
-func Contains(x interface{}) Matcher {
- var result containsMatcher
- var ok bool
-
- if result.elementMatcher, ok = x.(Matcher); !ok {
- result.elementMatcher = Equals(x)
- }
-
- return &result
-}
-
-type containsMatcher struct {
- elementMatcher Matcher
-}
-
-func (m *containsMatcher) Description() string {
- return fmt.Sprintf("contains: %s", m.elementMatcher.Description())
-}
-
-func (m *containsMatcher) Matches(candidate interface{}) error {
- // The candidate must be a slice or an array.
- v := reflect.ValueOf(candidate)
- if v.Kind() != reflect.Slice && v.Kind() != reflect.Array {
- return NewFatalError("which is not a slice or array")
- }
-
- // Check each element.
- for i := 0; i < v.Len(); i++ {
- elem := v.Index(i)
- if matchErr := m.elementMatcher.Matches(elem.Interface()); matchErr == nil {
- return nil
- }
- }
-
- return fmt.Errorf("")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains_test.go
deleted file mode 100644
index 34625fcaa5f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/contains_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type ContainsTest struct {}
-func init() { RegisterTestSuite(&ContainsTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *ContainsTest) WrongTypeCandidates() {
- m := Contains("")
- ExpectEq("contains: ", m.Description())
-
- var err error
-
- // Nil candidate
- err = m.Matches(nil)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // String candidate
- err = m.Matches("")
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // Map candidate
- err = m.Matches(make(map[string]string))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-}
-
-func (t *ContainsTest) NilArgument() {
- m := Contains(nil)
- ExpectEq("contains: is nil", m.Description())
-
- var c interface{}
- var err error
-
- // Empty array of pointers
- c = [...]*int{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Empty slice of pointers
- c = []*int{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-empty array of integers
- c = [...]int{17, 0, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-empty slice of integers
- c = []int{17, 0, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching array of pointers
- c = [...]*int{new(int), new(int)}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of pointers
- c = []*int{new(int), new(int)}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of pointers
- c = [...]*int{new(int), nil, new(int)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of pointers
- c = []*int{new(int), nil, new(int)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of pointers from matching array
- someArray := [...]*int{new(int), nil, new(int)}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *ContainsTest) StringArgument() {
- m := Contains("taco")
- ExpectEq("contains: taco", m.Description())
-
- var c interface{}
- var err error
-
- // Non-matching array of strings
- c = [...]string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of strings
- c = []string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of strings
- c = [...]string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of strings
- c = []string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of strings from matching array
- someArray := [...]string{"burrito", "taco", "enchilada"}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *ContainsTest) IntegerArgument() {
- m := Contains(int(17))
- ExpectEq("contains: 17", m.Description())
-
- var c interface{}
- var err error
-
- // Non-matching array of integers
- c = [...]int{13, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of integers
- c = []int{13, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of integers
- c = [...]int{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of integers
- c = []int{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of integers from matching array
- someArray := [...]int{13, 17, 19}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching array of floats
- c = [...]float32{13, 17.5, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of floats
- c = []float32{13, 17.5, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of floats
- c = [...]float32{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of floats
- c = []float32{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-}
-
-func (t *ContainsTest) MatcherArgument() {
- m := Contains(HasSubstr("ac"))
- ExpectEq("contains: has substring \"ac\"", m.Description())
-
- var c interface{}
- var err error
-
- // Non-matching array of strings
- c = [...]string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of strings
- c = []string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of strings
- c = [...]string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of strings
- c = []string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of strings from matching array
- someArray := [...]string{"burrito", "taco", "enchilada"}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals.go
deleted file mode 100644
index 1d91baef32e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "bytes"
- "errors"
- "fmt"
- "reflect"
-)
-
-var byteSliceType reflect.Type = reflect.TypeOf([]byte{})
-
-// DeepEquals returns a matcher that matches based on 'deep equality', as
-// defined by the reflect package. This matcher requires that values have
-// identical types to x.
-func DeepEquals(x interface{}) Matcher {
- return &deepEqualsMatcher{x}
-}
-
-type deepEqualsMatcher struct {
- x interface{}
-}
-
-func (m *deepEqualsMatcher) Description() string {
- xDesc := fmt.Sprintf("%v", m.x)
- xValue := reflect.ValueOf(m.x)
-
- // Special case: fmt.Sprintf presents nil slices as "[]", but
- // reflect.DeepEqual makes a distinction between nil and empty slices. Make
- // this less confusing.
- if xValue.Kind() == reflect.Slice && xValue.IsNil() {
- xDesc = "<nil slice>"
- }
-
- return fmt.Sprintf("deep equals: %s", xDesc)
-}
-
-func (m *deepEqualsMatcher) Matches(c interface{}) error {
- // Make sure the types match.
- ct := reflect.TypeOf(c)
- xt := reflect.TypeOf(m.x)
-
- if ct != xt {
- return NewFatalError(fmt.Sprintf("which is of type %v", ct))
- }
-
- // Special case: handle byte slices more efficiently.
- cValue := reflect.ValueOf(c)
- xValue := reflect.ValueOf(m.x)
-
- if ct == byteSliceType && !cValue.IsNil() && !xValue.IsNil() {
- xBytes := m.x.([]byte)
- cBytes := c.([]byte)
-
- if bytes.Equal(cBytes, xBytes) {
- return nil
- }
-
- return errors.New("")
- }
-
- // Defer to the reflect package.
- if reflect.DeepEqual(m.x, c) {
- return nil
- }
-
- // Special case: if the comparison failed because c is the nil slice, given
- // an indication of this (since its value is printed as "[]").
- if cValue.Kind() == reflect.Slice && cValue.IsNil() {
- return errors.New("which is nil")
- }
-
- return errors.New("")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals_test.go
deleted file mode 100644
index 9fedfd77017..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/deep_equals_test.go
+++ /dev/null
@@ -1,343 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "bytes"
- "testing"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type DeepEqualsTest struct {}
-func init() { RegisterTestSuite(&DeepEqualsTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithScalarValue() {
- var x int = 17
- m := DeepEquals(x)
-
- var err error
-
- // Nil candidate.
- err = m.Matches(nil)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("<nil>")))
-
- // Int alias candidate.
- type intAlias int
- err = m.Matches(intAlias(x))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("intAlias")))
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Byte slice candidate.
- err = m.Matches([]byte{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint8")))
-
- // Other slice candidate.
- err = m.Matches([]uint16{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint16")))
-
- // Unsigned int candidate.
- err = m.Matches(uint(17))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("uint")))
-}
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithByteSliceValue() {
- x := []byte{}
- m := DeepEquals(x)
-
- var err error
-
- // Nil candidate.
- err = m.Matches(nil)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("<nil>")))
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Slice candidate with wrong value type.
- err = m.Matches([]uint16{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint16")))
-}
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithOtherSliceValue() {
- x := []uint16{}
- m := DeepEquals(x)
-
- var err error
-
- // Nil candidate.
- err = m.Matches(nil)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("<nil>")))
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Byte slice candidate with wrong value type.
- err = m.Matches([]byte{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint8")))
-
- // Other slice candidate with wrong value type.
- err = m.Matches([]uint32{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint32")))
-}
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithNilLiteralValue() {
- m := DeepEquals(nil)
-
- var err error
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Nil byte slice candidate.
- err = m.Matches([]byte(nil))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint8")))
-
- // Nil other slice candidate.
- err = m.Matches([]uint16(nil))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint16")))
-}
-
-func (t *DeepEqualsTest) NilLiteralValue() {
- m := DeepEquals(nil)
- ExpectEq("deep equals: <nil>", m.Description())
-
- var c interface{}
- var err error
-
- // Nil literal candidate.
- c = nil
- err = m.Matches(c)
- ExpectEq(nil, err)
-}
-
-func (t *DeepEqualsTest) IntValue() {
- m := DeepEquals(int(17))
- ExpectEq("deep equals: 17", m.Description())
-
- var c interface{}
- var err error
-
- // Matching int.
- c = int(17)
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching int.
- c = int(18)
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) ByteSliceValue() {
- x := []byte{17, 19}
- m := DeepEquals(x)
- ExpectEq("deep equals: [17 19]", m.Description())
-
- var c []byte
- var err error
-
- // Matching.
- c = make([]byte, len(x))
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Nil slice.
- c = []byte(nil)
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("which is nil")))
-
- // Prefix.
- AssertGt(len(x), 1)
- c = make([]byte, len(x)-1)
- AssertEq(len(x)-1, copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Suffix.
- c = make([]byte, len(x)+1)
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) OtherSliceValue() {
- x := []uint16{17, 19}
- m := DeepEquals(x)
- ExpectEq("deep equals: [17 19]", m.Description())
-
- var c []uint16
- var err error
-
- // Matching.
- c = make([]uint16, len(x))
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Nil slice.
- c = []uint16(nil)
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("which is nil")))
-
- // Prefix.
- AssertGt(len(x), 1)
- c = make([]uint16, len(x)-1)
- AssertEq(len(x)-1, copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Suffix.
- c = make([]uint16, len(x)+1)
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) NilByteSliceValue() {
- x := []byte(nil)
- m := DeepEquals(x)
- ExpectEq("deep equals: <nil slice>", m.Description())
-
- var c []byte
- var err error
-
- // Nil slice.
- c = []byte(nil)
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-nil slice.
- c = []byte{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) NilOtherSliceValue() {
- x := []uint16(nil)
- m := DeepEquals(x)
- ExpectEq("deep equals: <nil slice>", m.Description())
-
- var c []uint16
- var err error
-
- // Nil slice.
- c = []uint16(nil)
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-nil slice.
- c = []uint16{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Benchmarks
-////////////////////////////////////////////////////////////////////////
-
-func benchmarkWithSize(b *testing.B, size int) {
- b.StopTimer()
- buf := bytes.Repeat([]byte{0x01}, size)
- bufCopy := make([]byte, size)
- copy(bufCopy, buf)
-
- matcher := DeepEquals(buf)
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- matcher.Matches(bufCopy)
- }
-
- b.SetBytes(int64(size))
-}
-
-func BenchmarkShortByteSlice(b *testing.B) {
- benchmarkWithSize(b, 256)
-}
-
-func BenchmarkLongByteSlice(b *testing.B) {
- benchmarkWithSize(b, 1<<24)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are.go
deleted file mode 100644
index 2941847c705..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strings"
-)
-
-// Given a list of arguments M, ElementsAre returns a matcher that matches
-// arrays and slices A where all of the following hold:
-//
-// * A is the same length as M.
-//
-// * For each i < len(A) where M[i] is a matcher, A[i] matches M[i].
-//
-// * For each i < len(A) where M[i] is not a matcher, A[i] matches
-// Equals(M[i]).
-//
-func ElementsAre(M ...interface{}) Matcher {
- // Copy over matchers, or convert to Equals(x) for non-matcher x.
- subMatchers := make([]Matcher, len(M))
- for i, x := range M {
- if matcher, ok := x.(Matcher); ok {
- subMatchers[i] = matcher
- continue
- }
-
- subMatchers[i] = Equals(x)
- }
-
- return &elementsAreMatcher{subMatchers}
-}
-
-type elementsAreMatcher struct {
- subMatchers []Matcher
-}
-
-func (m *elementsAreMatcher) Description() string {
- subDescs := make([]string, len(m.subMatchers))
- for i, sm := range m.subMatchers {
- subDescs[i] = sm.Description()
- }
-
- return fmt.Sprintf("elements are: [%s]", strings.Join(subDescs, ", "))
-}
-
-func (m *elementsAreMatcher) Matches(candidates interface{}) error {
- // The candidate must be a slice or an array.
- v := reflect.ValueOf(candidates)
- if v.Kind() != reflect.Slice && v.Kind() != reflect.Array {
- return NewFatalError("which is not a slice or array")
- }
-
- // The length must be correct.
- if v.Len() != len(m.subMatchers) {
- return errors.New(fmt.Sprintf("which is of length %d", v.Len()))
- }
-
- // Check each element.
- for i, subMatcher := range m.subMatchers {
- c := v.Index(i)
- if matchErr := subMatcher.Matches(c.Interface()); matchErr != nil {
- // Return an errors indicating which element doesn't match. If the
- // matcher error was fatal, make this one fatal too.
- err := errors.New(fmt.Sprintf("whose element %d doesn't match", i))
- if _, isFatal := matchErr.(*FatalError); isFatal {
- err = NewFatalError(err.Error())
- }
-
- return err
- }
- }
-
- return nil
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are_test.go
deleted file mode 100644
index 56e0f375d85..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/elements_are_test.go
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type ElementsAreTest struct {
-}
-
-func init() { RegisterTestSuite(&ElementsAreTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *ElementsAreTest) EmptySet() {
- m := ElementsAre()
- ExpectEq("elements are: []", m.Description())
-
- var c []interface{}
- var err error
-
- // No candidates.
- c = []interface{}{}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // One candidate.
- c = []interface{}{17}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 1")))
-}
-
-func (t *ElementsAreTest) OneMatcher() {
- m := ElementsAre(LessThan(17))
- ExpectEq("elements are: [less than 17]", m.Description())
-
- var c []interface{}
- var err error
-
- // No candidates.
- c = []interface{}{}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 0")))
-
- // Matching candidate.
- c = []interface{}{16}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching candidate.
- c = []interface{}{19}
- err = m.Matches(c)
- ExpectNe(nil, err)
-
- // Two candidates.
- c = []interface{}{17, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 2")))
-}
-
-func (t *ElementsAreTest) OneValue() {
- m := ElementsAre(17)
- ExpectEq("elements are: [17]", m.Description())
-
- var c []interface{}
- var err error
-
- // No candidates.
- c = []interface{}{}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 0")))
-
- // Matching int.
- c = []interface{}{int(17)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching float.
- c = []interface{}{float32(17)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching candidate.
- c = []interface{}{19}
- err = m.Matches(c)
- ExpectNe(nil, err)
-
- // Two candidates.
- c = []interface{}{17, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 2")))
-}
-
-func (t *ElementsAreTest) MultipleElements() {
- m := ElementsAre("taco", LessThan(17))
- ExpectEq("elements are: [taco, less than 17]", m.Description())
-
- var c []interface{}
- var err error
-
- // One candidate.
- c = []interface{}{17}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 1")))
-
- // Both matching.
- c = []interface{}{"taco", 16}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // First non-matching.
- c = []interface{}{"burrito", 16}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("whose element 0 doesn't match")))
-
- // Second non-matching.
- c = []interface{}{"taco", 17}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("whose element 1 doesn't match")))
-
- // Three candidates.
- c = []interface{}{"taco", 17, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 3")))
-}
-
-func (t *ElementsAreTest) ArrayCandidates() {
- m := ElementsAre("taco", LessThan(17))
-
- var err error
-
- // One candidate.
- err = m.Matches([1]interface{}{"taco"})
- ExpectThat(err, Error(HasSubstr("length 1")))
-
- // Both matching.
- err = m.Matches([2]interface{}{"taco", 16})
- ExpectEq(nil, err)
-
- // First non-matching.
- err = m.Matches([2]interface{}{"burrito", 16})
- ExpectThat(err, Error(Equals("whose element 0 doesn't match")))
-}
-
-func (t *ElementsAreTest) WrongTypeCandidate() {
- m := ElementsAre("taco")
-
- var err error
-
- // String candidate.
- err = m.Matches("taco")
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // Map candidate.
- err = m.Matches(map[string]string{})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // Nil candidate.
- err = m.Matches(nil)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-}
-
-func (t *ElementsAreTest) PropagatesFatality() {
- m := ElementsAre(LessThan(17))
- ExpectEq("elements are: [less than 17]", m.Description())
-
- var c []interface{}
- var err error
-
- // Non-fatal error.
- c = []interface{}{19}
- err = m.Matches(c)
- AssertNe(nil, err)
- ExpectFalse(isFatal(err))
-
- // Fatal error.
- c = []interface{}{"taco"}
- err = m.Matches(c)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals.go
deleted file mode 100644
index 26280c5a6eb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals.go
+++ /dev/null
@@ -1,557 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
-)
-
-// Equals(x) returns a matcher that matches values v such that v and x are
-// equivalent. This includes the case when the comparison v == x using Go's
-// built-in comparison operator is legal (except for structs, which this
-// matcher does not support), but for convenience the following rules also
-// apply:
-//
-// * Type checking is done based on underlying types rather than actual
-// types, so that e.g. two aliases for string can be compared:
-//
-// type stringAlias1 string
-// type stringAlias2 string
-//
-// a := "taco"
-// b := stringAlias1("taco")
-// c := stringAlias2("taco")
-//
-// ExpectTrue(a == b) // Legal, passes
-// ExpectTrue(b == c) // Illegal, doesn't compile
-//
-// ExpectThat(a, Equals(b)) // Passes
-// ExpectThat(b, Equals(c)) // Passes
-//
-// * Values of numeric type are treated as if they were abstract numbers, and
-// compared accordingly. Therefore Equals(17) will match int(17),
-// int16(17), uint(17), float32(17), complex64(17), and so on.
-//
-// If you want a stricter matcher that contains no such cleverness, see
-// IdenticalTo instead.
-//
-// Arrays are supported by this matcher, but do not participate in the
-// exceptions above. Two arrays compared with this matcher must have identical
-// types, and their element type must itself be comparable according to Go's ==
-// operator.
-func Equals(x interface{}) Matcher {
- v := reflect.ValueOf(x)
-
- // This matcher doesn't support structs.
- if v.Kind() == reflect.Struct {
- panic(fmt.Sprintf("oglematchers.Equals: unsupported kind %v", v.Kind()))
- }
-
- // The == operator is not defined for non-nil slices.
- if v.Kind() == reflect.Slice && v.Pointer() != uintptr(0) {
- panic(fmt.Sprintf("oglematchers.Equals: non-nil slice"))
- }
-
- return &equalsMatcher{v}
-}
-
-type equalsMatcher struct {
- expectedValue reflect.Value
-}
-
-////////////////////////////////////////////////////////////////////////
-// Numeric types
-////////////////////////////////////////////////////////////////////////
-
-func isSignedInteger(v reflect.Value) bool {
- k := v.Kind()
- return k >= reflect.Int && k <= reflect.Int64
-}
-
-func isUnsignedInteger(v reflect.Value) bool {
- k := v.Kind()
- return k >= reflect.Uint && k <= reflect.Uint64
-}
-
-func isInteger(v reflect.Value) bool {
- return isSignedInteger(v) || isUnsignedInteger(v)
-}
-
-func isFloat(v reflect.Value) bool {
- k := v.Kind()
- return k == reflect.Float32 || k == reflect.Float64
-}
-
-func isComplex(v reflect.Value) bool {
- k := v.Kind()
- return k == reflect.Complex64 || k == reflect.Complex128
-}
-
-func checkAgainstInt64(e int64, c reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(c):
- if c.Int() == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- u := c.Uint()
- if u <= math.MaxInt64 && int64(u) == e {
- err = nil
- }
-
- // Turn around the various floating point types so that the checkAgainst*
- // functions for them can deal with precision issues.
- case isFloat(c), isComplex(c):
- return Equals(c.Interface()).Matches(e)
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstUint64(e uint64, c reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(c):
- i := c.Int()
- if i >= 0 && uint64(i) == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- if c.Uint() == e {
- err = nil
- }
-
- // Turn around the various floating point types so that the checkAgainst*
- // functions for them can deal with precision issues.
- case isFloat(c), isComplex(c):
- return Equals(c.Interface()).Matches(e)
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstFloat32(e float32, c reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(c):
- if float32(c.Int()) == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- if float32(c.Uint()) == e {
- err = nil
- }
-
- case isFloat(c):
- // Compare using float32 to avoid a false sense of precision; otherwise
- // e.g. Equals(float32(0.1)) won't match float32(0.1).
- if float32(c.Float()) == e {
- err = nil
- }
-
- case isComplex(c):
- comp := c.Complex()
- rl := real(comp)
- im := imag(comp)
-
- // Compare using float32 to avoid a false sense of precision; otherwise
- // e.g. Equals(float32(0.1)) won't match (0.1 + 0i).
- if im == 0 && float32(rl) == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstFloat64(e float64, c reflect.Value) (err error) {
- err = errors.New("")
-
- ck := c.Kind()
-
- switch {
- case isSignedInteger(c):
- if float64(c.Int()) == e {
- err = nil
- }
-
- case isUnsignedInteger(c):
- if float64(c.Uint()) == e {
- err = nil
- }
-
- // If the actual value is lower precision, turn the comparison around so we
- // apply the low-precision rules. Otherwise, e.g. Equals(0.1) may not match
- // float32(0.1).
- case ck == reflect.Float32 || ck == reflect.Complex64:
- return Equals(c.Interface()).Matches(e)
-
- // Otherwise, compare with double precision.
- case isFloat(c):
- if c.Float() == e {
- err = nil
- }
-
- case isComplex(c):
- comp := c.Complex()
- rl := real(comp)
- im := imag(comp)
-
- if im == 0 && rl == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstComplex64(e complex64, c reflect.Value) (err error) {
- err = errors.New("")
- realPart := real(e)
- imaginaryPart := imag(e)
-
- switch {
- case isInteger(c) || isFloat(c):
- // If we have no imaginary part, then we should just compare against the
- // real part. Otherwise, we can't be equal.
- if imaginaryPart != 0 {
- return
- }
-
- return checkAgainstFloat32(realPart, c)
-
- case isComplex(c):
- // Compare using complex64 to avoid a false sense of precision; otherwise
- // e.g. Equals(0.1 + 0i) won't match float32(0.1).
- if complex64(c.Complex()) == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-func checkAgainstComplex128(e complex128, c reflect.Value) (err error) {
- err = errors.New("")
- realPart := real(e)
- imaginaryPart := imag(e)
-
- switch {
- case isInteger(c) || isFloat(c):
- // If we have no imaginary part, then we should just compare against the
- // real part. Otherwise, we can't be equal.
- if imaginaryPart != 0 {
- return
- }
-
- return checkAgainstFloat64(realPart, c)
-
- case isComplex(c):
- if c.Complex() == e {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not numeric")
- }
-
- return
-}
-
-////////////////////////////////////////////////////////////////////////
-// Other types
-////////////////////////////////////////////////////////////////////////
-
-func checkAgainstBool(e bool, c reflect.Value) (err error) {
- if c.Kind() != reflect.Bool {
- err = NewFatalError("which is not a bool")
- return
- }
-
- err = errors.New("")
- if c.Bool() == e {
- err = nil
- }
- return
-}
-
-func checkAgainstUintptr(e uintptr, c reflect.Value) (err error) {
- if c.Kind() != reflect.Uintptr {
- err = NewFatalError("which is not a uintptr")
- return
- }
-
- err = errors.New("")
- if uintptr(c.Uint()) == e {
- err = nil
- }
- return
-}
-
-func checkAgainstChan(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "chan int".
- typeStr := fmt.Sprintf("%s %s", e.Type().ChanDir(), e.Type().Elem())
-
- // Make sure c is a chan of the correct type.
- if c.Kind() != reflect.Chan ||
- c.Type().ChanDir() != e.Type().ChanDir() ||
- c.Type().Elem() != e.Type().Elem() {
- err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr))
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstFunc(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a function.
- if c.Kind() != reflect.Func {
- err = NewFatalError("which is not a function")
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstMap(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a map.
- if c.Kind() != reflect.Map {
- err = NewFatalError("which is not a map")
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstPtr(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "*int".
- typeStr := fmt.Sprintf("*%v", e.Type().Elem())
-
- // Make sure c is a pointer of the correct type.
- if c.Kind() != reflect.Ptr ||
- c.Type().Elem() != e.Type().Elem() {
- err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr))
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstSlice(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "[]int".
- typeStr := fmt.Sprintf("[]%v", e.Type().Elem())
-
- // Make sure c is a slice of the correct type.
- if c.Kind() != reflect.Slice ||
- c.Type().Elem() != e.Type().Elem() {
- err = NewFatalError(fmt.Sprintf("which is not a %s", typeStr))
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkAgainstString(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a string.
- if c.Kind() != reflect.String {
- err = NewFatalError("which is not a string")
- return
- }
-
- err = errors.New("")
- if c.String() == e.String() {
- err = nil
- }
- return
-}
-
-func checkAgainstArray(e reflect.Value, c reflect.Value) (err error) {
- // Create a description of e's type, e.g. "[2]int".
- typeStr := fmt.Sprintf("%v", e.Type())
-
- // Make sure c is the correct type.
- if c.Type() != e.Type() {
- err = NewFatalError(fmt.Sprintf("which is not %s", typeStr))
- return
- }
-
- // Check for equality.
- if e.Interface() != c.Interface() {
- err = errors.New("")
- return
- }
-
- return
-}
-
-func checkAgainstUnsafePointer(e reflect.Value, c reflect.Value) (err error) {
- // Make sure c is a pointer.
- if c.Kind() != reflect.UnsafePointer {
- err = NewFatalError("which is not a unsafe.Pointer")
- return
- }
-
- err = errors.New("")
- if c.Pointer() == e.Pointer() {
- err = nil
- }
- return
-}
-
-func checkForNil(c reflect.Value) (err error) {
- err = errors.New("")
-
- // Make sure it is legal to call IsNil.
- switch c.Kind() {
- case reflect.Invalid:
- case reflect.Chan:
- case reflect.Func:
- case reflect.Interface:
- case reflect.Map:
- case reflect.Ptr:
- case reflect.Slice:
-
- default:
- err = NewFatalError("which cannot be compared to nil")
- return
- }
-
- // Ask whether the value is nil. Handle a nil literal (kind Invalid)
- // specially, since it's not legal to call IsNil there.
- if c.Kind() == reflect.Invalid || c.IsNil() {
- err = nil
- }
- return
-}
-
-////////////////////////////////////////////////////////////////////////
-// Public implementation
-////////////////////////////////////////////////////////////////////////
-
-func (m *equalsMatcher) Matches(candidate interface{}) error {
- e := m.expectedValue
- c := reflect.ValueOf(candidate)
- ek := e.Kind()
-
- switch {
- case ek == reflect.Bool:
- return checkAgainstBool(e.Bool(), c)
-
- case isSignedInteger(e):
- return checkAgainstInt64(e.Int(), c)
-
- case isUnsignedInteger(e):
- return checkAgainstUint64(e.Uint(), c)
-
- case ek == reflect.Uintptr:
- return checkAgainstUintptr(uintptr(e.Uint()), c)
-
- case ek == reflect.Float32:
- return checkAgainstFloat32(float32(e.Float()), c)
-
- case ek == reflect.Float64:
- return checkAgainstFloat64(e.Float(), c)
-
- case ek == reflect.Complex64:
- return checkAgainstComplex64(complex64(e.Complex()), c)
-
- case ek == reflect.Complex128:
- return checkAgainstComplex128(complex128(e.Complex()), c)
-
- case ek == reflect.Chan:
- return checkAgainstChan(e, c)
-
- case ek == reflect.Func:
- return checkAgainstFunc(e, c)
-
- case ek == reflect.Map:
- return checkAgainstMap(e, c)
-
- case ek == reflect.Ptr:
- return checkAgainstPtr(e, c)
-
- case ek == reflect.Slice:
- return checkAgainstSlice(e, c)
-
- case ek == reflect.String:
- return checkAgainstString(e, c)
-
- case ek == reflect.Array:
- return checkAgainstArray(e, c)
-
- case ek == reflect.UnsafePointer:
- return checkAgainstUnsafePointer(e, c)
-
- case ek == reflect.Invalid:
- return checkForNil(c)
- }
-
- panic(fmt.Sprintf("equalsMatcher.Matches: unexpected kind: %v", ek))
-}
-
-func (m *equalsMatcher) Description() string {
- // Special case: handle nil.
- if !m.expectedValue.IsValid() {
- return "is nil"
- }
-
- return fmt.Sprintf("%v", m.expectedValue.Interface())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals_test.go
deleted file mode 100644
index 6fdbd9b6cb7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/equals_test.go
+++ /dev/null
@@ -1,3843 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "fmt"
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "math"
- "unsafe"
-)
-
-var someInt int = -17
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type EqualsTest struct {
-}
-
-func init() { RegisterTestSuite(&EqualsTest{}) }
-
-type equalsTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *EqualsTest) checkTestCases(matcher Matcher, cases []equalsTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
- ExpectEq(
- c.expectedResult,
- (err == nil),
- "Result for case %d: %v (Error: %v)", i, c, err)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(c.shouldBeFatal, isFatal, "Fatality for case %d: %v", i, c)
-
- ExpectThat(err, Error(Equals(c.expectedError)), "Case %d: %v", i, c)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// nil
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) EqualsNil() {
- matcher := Equals(nil)
- ExpectEq("is nil", matcher.Description())
-
- cases := []equalsTestCase{
- // Legal types
- equalsTestCase{nil, true, false, ""},
- equalsTestCase{chan int(nil), true, false, ""},
- equalsTestCase{(func())(nil), true, false, ""},
- equalsTestCase{interface{}(nil), true, false, ""},
- equalsTestCase{map[int]int(nil), true, false, ""},
- equalsTestCase{(*int)(nil), true, false, ""},
- equalsTestCase{[]int(nil), true, false, ""},
-
- equalsTestCase{make(chan int), false, false, ""},
- equalsTestCase{func() {}, false, false, ""},
- equalsTestCase{map[int]int{}, false, false, ""},
- equalsTestCase{&someInt, false, false, ""},
- equalsTestCase{[]int{}, false, false, ""},
-
- // Illegal types
- equalsTestCase{17, false, true, "which cannot be compared to nil"},
- equalsTestCase{int8(17), false, true, "which cannot be compared to nil"},
- equalsTestCase{uintptr(17), false, true, "which cannot be compared to nil"},
- equalsTestCase{[...]int{}, false, true, "which cannot be compared to nil"},
- equalsTestCase{"taco", false, true, "which cannot be compared to nil"},
- equalsTestCase{equalsTestCase{}, false, true, "which cannot be compared to nil"},
- equalsTestCase{unsafe.Pointer(&someInt), false, true, "which cannot be compared to nil"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegerLiteral() {
- // -2^30
- matcher := Equals(-1073741824)
- ExpectEq("-1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegerLiteral() {
- // 2^30
- matcher := Equals(1073741824)
- ExpectEq("1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(uint(1073741824)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Floating point literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralFloatingPointLiteral() {
- // -2^30
- matcher := Equals(-1073741824.0)
- ExpectEq("-1.073741824e+09", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
- equalsTestCase{interface{}(float64(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralFloatingPointLiteral() {
- // 2^30
- matcher := Equals(1073741824.0)
- ExpectEq("1.073741824e+09", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(float64(1073741824)), true, false, ""},
-
- // Values that would be 1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{uint(1073741823), false, false, ""},
- equalsTestCase{uint32(1073741823), false, false, ""},
- equalsTestCase{uint64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonIntegralFloatingPointLiteral() {
- matcher := Equals(17.1)
- ExpectEq("17.1", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 17.1.
- equalsTestCase{17.1, true, false, ""},
- equalsTestCase{17.1, true, false, ""},
- equalsTestCase{17.1 + 0i, true, false, ""},
- equalsTestCase{float32(17.1), true, false, ""},
- equalsTestCase{float64(17.1), true, false, ""},
- equalsTestCase{complex64(17.1), true, false, ""},
- equalsTestCase{complex128(17.1), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{17, false, false, ""},
- equalsTestCase{17.2, false, false, ""},
- equalsTestCase{18, false, false, ""},
- equalsTestCase{int(17), false, false, ""},
- equalsTestCase{int(18), false, false, ""},
- equalsTestCase{int32(17), false, false, ""},
- equalsTestCase{int64(17), false, false, ""},
- equalsTestCase{uint(17), false, false, ""},
- equalsTestCase{uint32(17), false, false, ""},
- equalsTestCase{uint64(17), false, false, ""},
- equalsTestCase{complex128(17.1 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// bool
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) False() {
- matcher := Equals(false)
- ExpectEq("false", matcher.Description())
-
- cases := []equalsTestCase{
- // bools
- equalsTestCase{false, true, false, ""},
- equalsTestCase{bool(false), true, false, ""},
-
- equalsTestCase{true, false, false, ""},
- equalsTestCase{bool(true), false, false, ""},
-
- // Other types.
- equalsTestCase{int(0), false, true, "which is not a bool"},
- equalsTestCase{int8(0), false, true, "which is not a bool"},
- equalsTestCase{int16(0), false, true, "which is not a bool"},
- equalsTestCase{int32(0), false, true, "which is not a bool"},
- equalsTestCase{int64(0), false, true, "which is not a bool"},
- equalsTestCase{uint(0), false, true, "which is not a bool"},
- equalsTestCase{uint8(0), false, true, "which is not a bool"},
- equalsTestCase{uint16(0), false, true, "which is not a bool"},
- equalsTestCase{uint32(0), false, true, "which is not a bool"},
- equalsTestCase{uint64(0), false, true, "which is not a bool"},
- equalsTestCase{uintptr(0), false, true, "which is not a bool"},
- equalsTestCase{[...]int{}, false, true, "which is not a bool"},
- equalsTestCase{make(chan int), false, true, "which is not a bool"},
- equalsTestCase{func() {}, false, true, "which is not a bool"},
- equalsTestCase{map[int]int{}, false, true, "which is not a bool"},
- equalsTestCase{&someInt, false, true, "which is not a bool"},
- equalsTestCase{[]int{}, false, true, "which is not a bool"},
- equalsTestCase{"taco", false, true, "which is not a bool"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a bool"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) True() {
- matcher := Equals(true)
- ExpectEq("true", matcher.Description())
-
- cases := []equalsTestCase{
- // bools
- equalsTestCase{true, true, false, ""},
- equalsTestCase{bool(true), true, false, ""},
-
- equalsTestCase{false, false, false, ""},
- equalsTestCase{bool(false), false, false, ""},
-
- // Other types.
- equalsTestCase{int(1), false, true, "which is not a bool"},
- equalsTestCase{int8(1), false, true, "which is not a bool"},
- equalsTestCase{int16(1), false, true, "which is not a bool"},
- equalsTestCase{int32(1), false, true, "which is not a bool"},
- equalsTestCase{int64(1), false, true, "which is not a bool"},
- equalsTestCase{uint(1), false, true, "which is not a bool"},
- equalsTestCase{uint8(1), false, true, "which is not a bool"},
- equalsTestCase{uint16(1), false, true, "which is not a bool"},
- equalsTestCase{uint32(1), false, true, "which is not a bool"},
- equalsTestCase{uint64(1), false, true, "which is not a bool"},
- equalsTestCase{uintptr(1), false, true, "which is not a bool"},
- equalsTestCase{[...]int{}, false, true, "which is not a bool"},
- equalsTestCase{make(chan int), false, true, "which is not a bool"},
- equalsTestCase{func() {}, false, true, "which is not a bool"},
- equalsTestCase{map[int]int{}, false, true, "which is not a bool"},
- equalsTestCase{&someInt, false, true, "which is not a bool"},
- equalsTestCase{[]int{}, false, true, "which is not a bool"},
- equalsTestCase{"taco", false, true, "which is not a bool"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a bool"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt() {
- // -2^30
- matcher := Equals(int(-1073741824))
- ExpectEq("-1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt() {
- // 2^30
- matcher := Equals(int(1073741824))
- ExpectEq("1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(uint(1073741824)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int8
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt8() {
- matcher := Equals(int8(-17))
- ExpectEq("-17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -17.
- equalsTestCase{-17, true, false, ""},
- equalsTestCase{-17.0, true, false, ""},
- equalsTestCase{-17 + 0i, true, false, ""},
- equalsTestCase{int(-17), true, false, ""},
- equalsTestCase{int8(-17), true, false, ""},
- equalsTestCase{int16(-17), true, false, ""},
- equalsTestCase{int32(-17), true, false, ""},
- equalsTestCase{int64(-17), true, false, ""},
- equalsTestCase{float32(-17), true, false, ""},
- equalsTestCase{float64(-17), true, false, ""},
- equalsTestCase{complex64(-17), true, false, ""},
- equalsTestCase{complex128(-17), true, false, ""},
- equalsTestCase{interface{}(int(-17)), true, false, ""},
-
- // Values that would be -17 in two's complement.
- equalsTestCase{uint((1 << 32) - 17), false, false, ""},
- equalsTestCase{uint8((1 << 8) - 17), false, false, ""},
- equalsTestCase{uint16((1 << 16) - 17), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 17), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 17), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-16), false, false, ""},
- equalsTestCase{int8(-16), false, false, ""},
- equalsTestCase{int16(-16), false, false, ""},
- equalsTestCase{int32(-16), false, false, ""},
- equalsTestCase{int64(-16), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float32(-17.1), false, false, ""},
- equalsTestCase{float32(-16.9), false, false, ""},
- equalsTestCase{complex64(-16), false, false, ""},
- equalsTestCase{complex64(-17 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr((1 << 32) - 17), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{-17}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{-17}, false, true, "which is not numeric"},
- equalsTestCase{"-17", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroInt8() {
- matcher := Equals(int8(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 0.
- equalsTestCase{0, true, false, ""},
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(int(0)), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1), false, false, ""},
- equalsTestCase{int8(1), false, false, ""},
- equalsTestCase{int16(1), false, false, ""},
- equalsTestCase{int32(1), false, false, ""},
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{float32(-0.1), false, false, ""},
- equalsTestCase{float32(0.1), false, false, ""},
- equalsTestCase{complex64(1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{0}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{0}, false, true, "which is not numeric"},
- equalsTestCase{"0", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt8() {
- matcher := Equals(int8(17))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 17.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(17), true, false, ""},
- equalsTestCase{int8(17), true, false, ""},
- equalsTestCase{int16(17), true, false, ""},
- equalsTestCase{int32(17), true, false, ""},
- equalsTestCase{int64(17), true, false, ""},
- equalsTestCase{float32(17), true, false, ""},
- equalsTestCase{float64(17), true, false, ""},
- equalsTestCase{complex64(17), true, false, ""},
- equalsTestCase{complex128(17), true, false, ""},
- equalsTestCase{interface{}(int(17)), true, false, ""},
- equalsTestCase{uint(17), true, false, ""},
- equalsTestCase{uint8(17), true, false, ""},
- equalsTestCase{uint16(17), true, false, ""},
- equalsTestCase{uint32(17), true, false, ""},
- equalsTestCase{uint64(17), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(16), false, false, ""},
- equalsTestCase{int8(16), false, false, ""},
- equalsTestCase{int16(16), false, false, ""},
- equalsTestCase{int32(16), false, false, ""},
- equalsTestCase{int64(16), false, false, ""},
- equalsTestCase{float32(16.9), false, false, ""},
- equalsTestCase{float32(17.1), false, false, ""},
- equalsTestCase{complex64(16), false, false, ""},
- equalsTestCase{complex64(17 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(17), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{17}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{17}, false, true, "which is not numeric"},
- equalsTestCase{"17", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int16
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt16() {
- matcher := Equals(int16(-32766))
- ExpectEq("-32766", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -32766.
- equalsTestCase{-32766, true, false, ""},
- equalsTestCase{-32766.0, true, false, ""},
- equalsTestCase{-32766 + 0i, true, false, ""},
- equalsTestCase{int(-32766), true, false, ""},
- equalsTestCase{int16(-32766), true, false, ""},
- equalsTestCase{int32(-32766), true, false, ""},
- equalsTestCase{int64(-32766), true, false, ""},
- equalsTestCase{float32(-32766), true, false, ""},
- equalsTestCase{float64(-32766), true, false, ""},
- equalsTestCase{complex64(-32766), true, false, ""},
- equalsTestCase{complex128(-32766), true, false, ""},
- equalsTestCase{interface{}(int(-32766)), true, false, ""},
-
- // Values that would be -32766 in two's complement.
- equalsTestCase{uint((1 << 32) - 32766), false, false, ""},
- equalsTestCase{uint16((1 << 16) - 32766), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 32766), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 32766), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-16), false, false, ""},
- equalsTestCase{int8(-16), false, false, ""},
- equalsTestCase{int16(-16), false, false, ""},
- equalsTestCase{int32(-16), false, false, ""},
- equalsTestCase{int64(-16), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float32(-32766.1), false, false, ""},
- equalsTestCase{float32(-32765.9), false, false, ""},
- equalsTestCase{complex64(-32766.1), false, false, ""},
- equalsTestCase{complex64(-32766 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr((1 << 32) - 32766), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{-32766}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{-32766}, false, true, "which is not numeric"},
- equalsTestCase{"-32766", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroInt16() {
- matcher := Equals(int16(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 0.
- equalsTestCase{0, true, false, ""},
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(int(0)), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1), false, false, ""},
- equalsTestCase{int8(1), false, false, ""},
- equalsTestCase{int16(1), false, false, ""},
- equalsTestCase{int32(1), false, false, ""},
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{float32(-0.1), false, false, ""},
- equalsTestCase{float32(0.1), false, false, ""},
- equalsTestCase{complex64(1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{0}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{0}, false, true, "which is not numeric"},
- equalsTestCase{"0", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt16() {
- matcher := Equals(int16(32765))
- ExpectEq("32765", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32765.
- equalsTestCase{32765, true, false, ""},
- equalsTestCase{32765.0, true, false, ""},
- equalsTestCase{32765 + 0i, true, false, ""},
- equalsTestCase{int(32765), true, false, ""},
- equalsTestCase{int16(32765), true, false, ""},
- equalsTestCase{int32(32765), true, false, ""},
- equalsTestCase{int64(32765), true, false, ""},
- equalsTestCase{float32(32765), true, false, ""},
- equalsTestCase{float64(32765), true, false, ""},
- equalsTestCase{complex64(32765), true, false, ""},
- equalsTestCase{complex128(32765), true, false, ""},
- equalsTestCase{interface{}(int(32765)), true, false, ""},
- equalsTestCase{uint(32765), true, false, ""},
- equalsTestCase{uint16(32765), true, false, ""},
- equalsTestCase{uint32(32765), true, false, ""},
- equalsTestCase{uint64(32765), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(32764), false, false, ""},
- equalsTestCase{int16(32764), false, false, ""},
- equalsTestCase{int32(32764), false, false, ""},
- equalsTestCase{int64(32764), false, false, ""},
- equalsTestCase{float32(32764.9), false, false, ""},
- equalsTestCase{float32(32765.1), false, false, ""},
- equalsTestCase{complex64(32765.9), false, false, ""},
- equalsTestCase{complex64(32765 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(32765), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{32765}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{32765}, false, true, "which is not numeric"},
- equalsTestCase{"32765", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int32
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt32() {
- // -2^30
- matcher := Equals(int32(-1073741824))
- ExpectEq("-1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt32() {
- // 2^30
- matcher := Equals(int32(1073741824))
- ExpectEq("1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(uint(1073741824)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt64() {
- // -2^40
- matcher := Equals(int64(-1099511627776))
- ExpectEq("-1099511627776", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1099511627776.
- equalsTestCase{-1099511627776.0, true, false, ""},
- equalsTestCase{-1099511627776 + 0i, true, false, ""},
- equalsTestCase{int64(-1099511627776), true, false, ""},
- equalsTestCase{float32(-1099511627776), true, false, ""},
- equalsTestCase{float64(-1099511627776), true, false, ""},
- equalsTestCase{complex64(-1099511627776), true, false, ""},
- equalsTestCase{complex128(-1099511627776), true, false, ""},
- equalsTestCase{interface{}(int64(-1099511627776)), true, false, ""},
-
- // Values that would be -1099511627776 in two's complement.
- equalsTestCase{uint64((1 << 64) - 1099511627776), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int64(-1099511627775), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1099511627776.1), false, false, ""},
- equalsTestCase{float64(-1099511627775.9), false, false, ""},
- equalsTestCase{complex128(-1099511627775), false, false, ""},
- equalsTestCase{complex128(-1099511627776 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt64() {
- // 2^40
- matcher := Equals(int64(1099511627776))
- ExpectEq("1099511627776", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1099511627776.
- equalsTestCase{1099511627776.0, true, false, ""},
- equalsTestCase{1099511627776 + 0i, true, false, ""},
- equalsTestCase{int64(1099511627776), true, false, ""},
- equalsTestCase{uint64(1099511627776), true, false, ""},
- equalsTestCase{float32(1099511627776), true, false, ""},
- equalsTestCase{float64(1099511627776), true, false, ""},
- equalsTestCase{complex64(1099511627776), true, false, ""},
- equalsTestCase{complex128(1099511627776), true, false, ""},
- equalsTestCase{interface{}(int64(1099511627776)), true, false, ""},
- equalsTestCase{interface{}(uint64(1099511627776)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1099511627775), false, false, ""},
- equalsTestCase{uint64(1099511627775), false, false, ""},
- equalsTestCase{float64(1099511627776.1), false, false, ""},
- equalsTestCase{float64(1099511627775.9), false, false, ""},
- equalsTestCase{complex128(1099511627775), false, false, ""},
- equalsTestCase{complex128(1099511627776 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(int64(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(int64(kTwoTo54 + 1))
- ExpectEq("18014398509481985", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint() {
- const kExpected = 17
- matcher := Equals(uint(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint() {
- const kExpected = (1 << 16) + 17
- matcher := Equals(uint(kExpected))
- ExpectEq("65553", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{65553, true, false, ""},
- equalsTestCase{65553.0, true, false, ""},
- equalsTestCase{65553 + 0i, true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int16(17), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(17), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) UintNotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(uint(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint8
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint8() {
- const kExpected = 17
- matcher := Equals(uint8(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint16
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint16() {
- const kExpected = 17
- matcher := Equals(uint16(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint16() {
- const kExpected = (1 << 8) + 17
- matcher := Equals(uint16(kExpected))
- ExpectEq("273", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{273, true, false, ""},
- equalsTestCase{273.0, true, false, ""},
- equalsTestCase{273 + 0i, true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int8(17), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(17), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint32
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint32() {
- const kExpected = 17
- matcher := Equals(uint32(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint32() {
- const kExpected = (1 << 16) + 17
- matcher := Equals(uint32(kExpected))
- ExpectEq("65553", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{65553, true, false, ""},
- equalsTestCase{65553.0, true, false, ""},
- equalsTestCase{65553 + 0i, true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int16(17), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(17), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Uint32NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(uint32(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint64() {
- const kExpected = 17
- matcher := Equals(uint64(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint64() {
- const kExpected = (1 << 32) + 17
- matcher := Equals(uint64(kExpected))
- ExpectEq("4294967313", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{4294967313.0, true, false, ""},
- equalsTestCase{4294967313 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int(17), false, false, ""},
- equalsTestCase{int32(17), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(17), false, false, ""},
- equalsTestCase{uint32(17), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(uint64(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(uint64(kTwoTo54 + 1))
- ExpectEq("18014398509481985", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uintptr
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilUintptr() {
- var ptr1 uintptr
- var ptr2 uintptr
-
- matcher := Equals(ptr1)
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // uintptrs
- equalsTestCase{ptr1, true, false, ""},
- equalsTestCase{ptr2, true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
- equalsTestCase{uintptr(17), false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a uintptr"},
- equalsTestCase{bool(false), false, true, "which is not a uintptr"},
- equalsTestCase{int(0), false, true, "which is not a uintptr"},
- equalsTestCase{int8(0), false, true, "which is not a uintptr"},
- equalsTestCase{int16(0), false, true, "which is not a uintptr"},
- equalsTestCase{int32(0), false, true, "which is not a uintptr"},
- equalsTestCase{int64(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint8(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint16(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint32(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint64(0), false, true, "which is not a uintptr"},
- equalsTestCase{true, false, true, "which is not a uintptr"},
- equalsTestCase{[...]int{}, false, true, "which is not a uintptr"},
- equalsTestCase{make(chan int), false, true, "which is not a uintptr"},
- equalsTestCase{func() {}, false, true, "which is not a uintptr"},
- equalsTestCase{map[int]int{}, false, true, "which is not a uintptr"},
- equalsTestCase{&someInt, false, true, "which is not a uintptr"},
- equalsTestCase{[]int{}, false, true, "which is not a uintptr"},
- equalsTestCase{"taco", false, true, "which is not a uintptr"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a uintptr"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilUintptr() {
- matcher := Equals(uintptr(17))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // uintptrs
- equalsTestCase{uintptr(17), true, false, ""},
- equalsTestCase{uintptr(16), false, false, ""},
- equalsTestCase{uintptr(0), false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a uintptr"},
- equalsTestCase{bool(false), false, true, "which is not a uintptr"},
- equalsTestCase{int(0), false, true, "which is not a uintptr"},
- equalsTestCase{int8(0), false, true, "which is not a uintptr"},
- equalsTestCase{int16(0), false, true, "which is not a uintptr"},
- equalsTestCase{int32(0), false, true, "which is not a uintptr"},
- equalsTestCase{int64(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint8(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint16(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint32(0), false, true, "which is not a uintptr"},
- equalsTestCase{uint64(0), false, true, "which is not a uintptr"},
- equalsTestCase{true, false, true, "which is not a uintptr"},
- equalsTestCase{[...]int{}, false, true, "which is not a uintptr"},
- equalsTestCase{make(chan int), false, true, "which is not a uintptr"},
- equalsTestCase{func() {}, false, true, "which is not a uintptr"},
- equalsTestCase{map[int]int{}, false, true, "which is not a uintptr"},
- equalsTestCase{&someInt, false, true, "which is not a uintptr"},
- equalsTestCase{[]int{}, false, true, "which is not a uintptr"},
- equalsTestCase{"taco", false, true, "which is not a uintptr"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a uintptr"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// float32
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralFloat32() {
- matcher := Equals(float32(-32769))
- ExpectEq("-32769", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -32769.
- equalsTestCase{-32769.0, true, false, ""},
- equalsTestCase{-32769 + 0i, true, false, ""},
- equalsTestCase{int32(-32769), true, false, ""},
- equalsTestCase{int64(-32769), true, false, ""},
- equalsTestCase{float32(-32769), true, false, ""},
- equalsTestCase{float64(-32769), true, false, ""},
- equalsTestCase{complex64(-32769), true, false, ""},
- equalsTestCase{complex128(-32769), true, false, ""},
- equalsTestCase{interface{}(float32(-32769)), true, false, ""},
- equalsTestCase{interface{}(int64(-32769)), true, false, ""},
-
- // Values that would be -32769 in two's complement.
- equalsTestCase{uint64((1 << 64) - 32769), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(-32770), false, false, ""},
- equalsTestCase{float32(-32769.1), false, false, ""},
- equalsTestCase{float32(-32768.9), false, false, ""},
- equalsTestCase{float64(-32769.1), false, false, ""},
- equalsTestCase{float64(-32768.9), false, false, ""},
- equalsTestCase{complex128(-32768), false, false, ""},
- equalsTestCase{complex128(-32769 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralFloat32() {
- matcher := Equals(float32(-32769.1))
- ExpectEq("-32769.1", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -32769.1.
- equalsTestCase{-32769.1, true, false, ""},
- equalsTestCase{-32769.1 + 0i, true, false, ""},
- equalsTestCase{float32(-32769.1), true, false, ""},
- equalsTestCase{float64(-32769.1), true, false, ""},
- equalsTestCase{complex64(-32769.1), true, false, ""},
- equalsTestCase{complex128(-32769.1), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int32(-32769), false, false, ""},
- equalsTestCase{int32(-32770), false, false, ""},
- equalsTestCase{int64(-32769), false, false, ""},
- equalsTestCase{int64(-32770), false, false, ""},
- equalsTestCase{float32(-32769.2), false, false, ""},
- equalsTestCase{float32(-32769.0), false, false, ""},
- equalsTestCase{float64(-32769.2), false, false, ""},
- equalsTestCase{complex128(-32769.1 + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeFloat32() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(float32(kExpected))
- ExpectEq("-3.689349e+19", matcher.Description())
-
- floatExpected := float32(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroFloat32() {
- matcher := Equals(float32(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralFloat32() {
- matcher := Equals(float32(32769))
- ExpectEq("32769", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{32769.0, true, false, ""},
- equalsTestCase{32769 + 0i, true, false, ""},
- equalsTestCase{int(32769), true, false, ""},
- equalsTestCase{int32(32769), true, false, ""},
- equalsTestCase{int64(32769), true, false, ""},
- equalsTestCase{uint(32769), true, false, ""},
- equalsTestCase{uint32(32769), true, false, ""},
- equalsTestCase{uint64(32769), true, false, ""},
- equalsTestCase{float32(32769), true, false, ""},
- equalsTestCase{float64(32769), true, false, ""},
- equalsTestCase{complex64(32769), true, false, ""},
- equalsTestCase{complex128(32769), true, false, ""},
- equalsTestCase{interface{}(float32(32769)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(32770), false, false, ""},
- equalsTestCase{uint64(32770), false, false, ""},
- equalsTestCase{float32(32769.1), false, false, ""},
- equalsTestCase{float32(32768.9), false, false, ""},
- equalsTestCase{float64(32769.1), false, false, ""},
- equalsTestCase{float64(32768.9), false, false, ""},
- equalsTestCase{complex128(32768), false, false, ""},
- equalsTestCase{complex128(32769 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralFloat32() {
- matcher := Equals(float32(32769.1))
- ExpectEq("32769.1", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.1.
- equalsTestCase{32769.1, true, false, ""},
- equalsTestCase{32769.1 + 0i, true, false, ""},
- equalsTestCase{float32(32769.1), true, false, ""},
- equalsTestCase{float64(32769.1), true, false, ""},
- equalsTestCase{complex64(32769.1), true, false, ""},
- equalsTestCase{complex128(32769.1), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int32(32769), false, false, ""},
- equalsTestCase{int32(32770), false, false, ""},
- equalsTestCase{uint64(32769), false, false, ""},
- equalsTestCase{uint64(32770), false, false, ""},
- equalsTestCase{float32(32769.2), false, false, ""},
- equalsTestCase{float32(32769.0), false, false, ""},
- equalsTestCase{float64(32769.2), false, false, ""},
- equalsTestCase{complex128(32769.1 + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveFloat32() {
- const kExpected = 1 << 65
- matcher := Equals(float32(kExpected))
- ExpectEq("3.689349e+19", matcher.Description())
-
- floatExpected := float32(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(float32(kTwoTo25 + 1))
- ExpectEq("3.3554432e+07", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// float64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralFloat64() {
- const kExpected = -(1 << 50)
- matcher := Equals(float64(kExpected))
- ExpectEq("-1.125899906842624e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{-1125899906842624.0, true, false, ""},
- equalsTestCase{-1125899906842624.0 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Values that would be kExpected in two's complement.
- equalsTestCase{uint64((1 << 64) + kExpected), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralFloat64() {
- const kTwoTo50 = 1 << 50
- const kExpected = -kTwoTo50 - 0.25
-
- matcher := Equals(float64(kExpected))
- ExpectEq("-1.1258999068426242e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(-kTwoTo50), false, false, ""},
- equalsTestCase{int64(-kTwoTo50 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeFloat64() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(float64(kExpected))
- ExpectEq("-3.6893488147419103e+19", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroFloat64() {
- matcher := Equals(float64(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralFloat64() {
- const kExpected = 1 << 50
- matcher := Equals(float64(kExpected))
- ExpectEq("1.125899906842624e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{1125899906842624.0, true, false, ""},
- equalsTestCase{1125899906842624.0 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralFloat64() {
- const kTwoTo50 = 1 << 50
- const kExpected = kTwoTo50 + 0.25
- matcher := Equals(float64(kExpected))
- ExpectEq("1.1258999068426242e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kTwoTo50), false, false, ""},
- equalsTestCase{int64(kTwoTo50 - 1), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveFloat64() {
- const kExpected = 1 << 65
- matcher := Equals(float64(kExpected))
- ExpectEq("3.6893488147419103e+19", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(float64(kTwoTo54 + 1))
- ExpectEq("1.8014398509481984e+16", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// complex64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralComplex64() {
- const kExpected = -32769
- matcher := Equals(complex64(kExpected))
- ExpectEq("(-32769+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{-32769.0, true, false, ""},
- equalsTestCase{-32769.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Values that would be kExpected in two's complement.
- equalsTestCase{uint32((1 << 32) + kExpected), false, false, ""},
- equalsTestCase{uint64((1 << 64) + kExpected), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralComplex64() {
- const kTwoTo20 = 1 << 20
- const kExpected = -kTwoTo20 - 0.25
-
- matcher := Equals(complex64(kExpected))
- ExpectEq("(-1.0485762e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(-kTwoTo20), false, false, ""},
- equalsTestCase{int(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int32(-kTwoTo20), false, false, ""},
- equalsTestCase{int32(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int64(-kTwoTo20), false, false, ""},
- equalsTestCase{int64(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeComplex64() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(complex64(kExpected))
- ExpectEq("(-3.689349e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroComplex64() {
- matcher := Equals(complex64(0))
- ExpectEq("(0+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{float64(1), false, false, ""},
- equalsTestCase{float64(-1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralComplex64() {
- const kExpected = 1 << 20
- matcher := Equals(complex64(kExpected))
- ExpectEq("(1.048576e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{1048576.0, true, false, ""},
- equalsTestCase{1048576.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralComplex64() {
- const kTwoTo20 = 1 << 20
- const kExpected = kTwoTo20 + 0.25
- matcher := Equals(complex64(kExpected))
- ExpectEq("(1.0485762e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kTwoTo20), false, false, ""},
- equalsTestCase{int64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{uint64(kTwoTo20), false, false, ""},
- equalsTestCase{uint64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected - 1i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected - 1i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveComplex64() {
- const kExpected = 1 << 65
- matcher := Equals(complex64(kExpected))
- ExpectEq("(3.689349e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex64AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(complex64(kTwoTo25 + 1))
- ExpectEq("(3.3554432e+07+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex64WithNonZeroImaginaryPart() {
- const kRealPart = 17
- const kImagPart = 0.25i
- const kExpected = kRealPart + kImagPart
- matcher := Equals(complex64(kExpected))
- ExpectEq("(17+0.25i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kRealPart + kImagPart, true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kRealPart), false, false, ""},
- equalsTestCase{int8(kRealPart), false, false, ""},
- equalsTestCase{int16(kRealPart), false, false, ""},
- equalsTestCase{int32(kRealPart), false, false, ""},
- equalsTestCase{int64(kRealPart), false, false, ""},
- equalsTestCase{uint(kRealPart), false, false, ""},
- equalsTestCase{uint8(kRealPart), false, false, ""},
- equalsTestCase{uint16(kRealPart), false, false, ""},
- equalsTestCase{uint32(kRealPart), false, false, ""},
- equalsTestCase{uint64(kRealPart), false, false, ""},
- equalsTestCase{float32(kRealPart), false, false, ""},
- equalsTestCase{float64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5i), false, false, ""},
- equalsTestCase{complex128(kRealPart), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// complex128
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralComplex128() {
- const kExpected = -32769
- matcher := Equals(complex128(kExpected))
- ExpectEq("(-32769+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{-32769.0, true, false, ""},
- equalsTestCase{-32769.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Values that would be kExpected in two's complement.
- equalsTestCase{uint32((1 << 32) + kExpected), false, false, ""},
- equalsTestCase{uint64((1 << 64) + kExpected), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralComplex128() {
- const kTwoTo20 = 1 << 20
- const kExpected = -kTwoTo20 - 0.25
-
- matcher := Equals(complex128(kExpected))
- ExpectEq("(-1.04857625e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(-kTwoTo20), false, false, ""},
- equalsTestCase{int(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int32(-kTwoTo20), false, false, ""},
- equalsTestCase{int32(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int64(-kTwoTo20), false, false, ""},
- equalsTestCase{int64(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeComplex128() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(complex128(kExpected))
- ExpectEq("(-3.6893488147419103e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroComplex128() {
- matcher := Equals(complex128(0))
- ExpectEq("(0+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{float64(1), false, false, ""},
- equalsTestCase{float64(-1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralComplex128() {
- const kExpected = 1 << 20
- matcher := Equals(complex128(kExpected))
- ExpectEq("(1.048576e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{1048576.0, true, false, ""},
- equalsTestCase{1048576.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{uintptr(0), false, true, "which is not numeric"},
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralComplex128() {
- const kTwoTo20 = 1 << 20
- const kExpected = kTwoTo20 + 0.25
- matcher := Equals(complex128(kExpected))
- ExpectEq("(1.04857625e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kTwoTo20), false, false, ""},
- equalsTestCase{int64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{uint64(kTwoTo20), false, false, ""},
- equalsTestCase{uint64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected - 1i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected - 1i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveComplex128() {
- const kExpected = 1 << 65
- matcher := Equals(complex128(kExpected))
- ExpectEq("(3.6893488147419103e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex128AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(complex128(kTwoTo54 + 1))
- ExpectEq("(1.8014398509481984e+16+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex128WithNonZeroImaginaryPart() {
- const kRealPart = 17
- const kImagPart = 0.25i
- const kExpected = kRealPart + kImagPart
- matcher := Equals(complex128(kExpected))
- ExpectEq("(17+0.25i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kRealPart + kImagPart, true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kRealPart), false, false, ""},
- equalsTestCase{int8(kRealPart), false, false, ""},
- equalsTestCase{int16(kRealPart), false, false, ""},
- equalsTestCase{int32(kRealPart), false, false, ""},
- equalsTestCase{int64(kRealPart), false, false, ""},
- equalsTestCase{uint(kRealPart), false, false, ""},
- equalsTestCase{uint8(kRealPart), false, false, ""},
- equalsTestCase{uint16(kRealPart), false, false, ""},
- equalsTestCase{uint32(kRealPart), false, false, ""},
- equalsTestCase{uint64(kRealPart), false, false, ""},
- equalsTestCase{float32(kRealPart), false, false, ""},
- equalsTestCase{float64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5i), false, false, ""},
- equalsTestCase{complex128(kRealPart), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Arrays
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) ArrayOfComparableType() {
- expected := [3]uint{17, 19, 23}
-
- matcher := Equals(expected)
- ExpectEq("[17 19 23]", matcher.Description())
-
- // To defeat constant de-duping by the compiler.
- makeArray := func(i, j, k uint) [3]uint { return [3]uint{ i, j, k} }
-
- type arrayAlias [3]uint
- type uintAlias uint
-
- cases := []equalsTestCase{
- // Correct types, equal.
- equalsTestCase{expected, true, false, ""},
- equalsTestCase{[3]uint{17, 19, 23}, true, false, ""},
- equalsTestCase{makeArray(17, 19, 23), true, false, ""},
-
- // Correct types, not equal.
- equalsTestCase{[3]uint{0, 0, 0}, false, false, ""},
- equalsTestCase{[3]uint{18, 19, 23}, false, false, ""},
- equalsTestCase{[3]uint{17, 20, 23}, false, false, ""},
- equalsTestCase{[3]uint{17, 19, 22}, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not [3]uint"},
- equalsTestCase{bool(false), false, true, "which is not [3]uint"},
- equalsTestCase{int(0), false, true, "which is not [3]uint"},
- equalsTestCase{int8(0), false, true, "which is not [3]uint"},
- equalsTestCase{int16(0), false, true, "which is not [3]uint"},
- equalsTestCase{int32(0), false, true, "which is not [3]uint"},
- equalsTestCase{int64(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint8(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint16(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint32(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint64(0), false, true, "which is not [3]uint"},
- equalsTestCase{true, false, true, "which is not [3]uint"},
- equalsTestCase{[...]int{}, false, true, "which is not [3]uint"},
- equalsTestCase{func() {}, false, true, "which is not [3]uint"},
- equalsTestCase{map[int]int{}, false, true, "which is not [3]uint"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not [3]uint"},
- equalsTestCase{[2]uint{17, 19}, false, true, "which is not [3]uint"},
- equalsTestCase{[4]uint{17, 19, 23, 0}, false, true, "which is not [3]uint"},
- equalsTestCase{arrayAlias{17, 19, 23}, false, true, "which is not [3]uint"},
- equalsTestCase{[3]uintAlias{17, 19, 23}, false, true, "which is not [3]uint"},
- equalsTestCase{[3]int32{17, 19, 23}, false, true, "which is not [3]uint"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ArrayOfNonComparableType() {
- type nonComparableArray [2]map[string]string
- f := func() {
- ExpectEq(nonComparableArray{}, nonComparableArray{})
- }
-
- ExpectThat(f, Panics(MatchesRegexp("uncomparable.*nonComparableArray")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// chan
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilChan() {
- var nilChan1 chan int
- var nilChan2 chan int
- var nilChan3 chan uint
- var nonNilChan1 chan int = make(chan int)
- var nonNilChan2 chan uint = make(chan uint)
-
- matcher := Equals(nilChan1)
- ExpectEq("<nil>", matcher.Description())
-
- cases := []equalsTestCase{
- // int channels
- equalsTestCase{nilChan1, true, false, ""},
- equalsTestCase{nilChan2, true, false, ""},
- equalsTestCase{nonNilChan1, false, false, ""},
-
- // uint channels
- equalsTestCase{nilChan3, false, true, "which is not a chan int"},
- equalsTestCase{nonNilChan2, false, true, "which is not a chan int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a chan int"},
- equalsTestCase{bool(false), false, true, "which is not a chan int"},
- equalsTestCase{int(0), false, true, "which is not a chan int"},
- equalsTestCase{int8(0), false, true, "which is not a chan int"},
- equalsTestCase{int16(0), false, true, "which is not a chan int"},
- equalsTestCase{int32(0), false, true, "which is not a chan int"},
- equalsTestCase{int64(0), false, true, "which is not a chan int"},
- equalsTestCase{uint(0), false, true, "which is not a chan int"},
- equalsTestCase{uint8(0), false, true, "which is not a chan int"},
- equalsTestCase{uint16(0), false, true, "which is not a chan int"},
- equalsTestCase{uint32(0), false, true, "which is not a chan int"},
- equalsTestCase{uint64(0), false, true, "which is not a chan int"},
- equalsTestCase{true, false, true, "which is not a chan int"},
- equalsTestCase{[...]int{}, false, true, "which is not a chan int"},
- equalsTestCase{func() {}, false, true, "which is not a chan int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a chan int"},
- equalsTestCase{&someInt, false, true, "which is not a chan int"},
- equalsTestCase{[]int{}, false, true, "which is not a chan int"},
- equalsTestCase{"taco", false, true, "which is not a chan int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a chan int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilChan() {
- var nilChan1 chan int
- var nilChan2 chan uint
- var nonNilChan1 chan int = make(chan int)
- var nonNilChan2 chan int = make(chan int)
- var nonNilChan3 chan uint = make(chan uint)
-
- matcher := Equals(nonNilChan1)
- ExpectEq(fmt.Sprintf("%v", nonNilChan1), matcher.Description())
-
- cases := []equalsTestCase{
- // int channels
- equalsTestCase{nonNilChan1, true, false, ""},
- equalsTestCase{nonNilChan2, false, false, ""},
- equalsTestCase{nilChan1, false, false, ""},
-
- // uint channels
- equalsTestCase{nilChan2, false, true, "which is not a chan int"},
- equalsTestCase{nonNilChan3, false, true, "which is not a chan int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a chan int"},
- equalsTestCase{bool(false), false, true, "which is not a chan int"},
- equalsTestCase{int(0), false, true, "which is not a chan int"},
- equalsTestCase{int8(0), false, true, "which is not a chan int"},
- equalsTestCase{int16(0), false, true, "which is not a chan int"},
- equalsTestCase{int32(0), false, true, "which is not a chan int"},
- equalsTestCase{int64(0), false, true, "which is not a chan int"},
- equalsTestCase{uint(0), false, true, "which is not a chan int"},
- equalsTestCase{uint8(0), false, true, "which is not a chan int"},
- equalsTestCase{uint16(0), false, true, "which is not a chan int"},
- equalsTestCase{uint32(0), false, true, "which is not a chan int"},
- equalsTestCase{uint64(0), false, true, "which is not a chan int"},
- equalsTestCase{true, false, true, "which is not a chan int"},
- equalsTestCase{[...]int{}, false, true, "which is not a chan int"},
- equalsTestCase{func() {}, false, true, "which is not a chan int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a chan int"},
- equalsTestCase{&someInt, false, true, "which is not a chan int"},
- equalsTestCase{[]int{}, false, true, "which is not a chan int"},
- equalsTestCase{"taco", false, true, "which is not a chan int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a chan int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ChanDirection() {
- var chan1 chan<- int
- var chan2 <-chan int
- var chan3 chan int
-
- matcher := Equals(chan1)
- ExpectEq(fmt.Sprintf("%v", chan1), matcher.Description())
-
- cases := []equalsTestCase{
- equalsTestCase{chan1, true, false, ""},
- equalsTestCase{chan2, false, true, "which is not a chan<- int"},
- equalsTestCase{chan3, false, true, "which is not a chan<- int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// func
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) Functions() {
- func1 := func() {}
- func2 := func() {}
- func3 := func(x int) {}
-
- matcher := Equals(func1)
- ExpectEq(fmt.Sprintf("%v", func1), matcher.Description())
-
- cases := []equalsTestCase{
- // Functions.
- equalsTestCase{func1, true, false, ""},
- equalsTestCase{func2, false, false, ""},
- equalsTestCase{func3, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a function"},
- equalsTestCase{bool(false), false, true, "which is not a function"},
- equalsTestCase{int(0), false, true, "which is not a function"},
- equalsTestCase{int8(0), false, true, "which is not a function"},
- equalsTestCase{int16(0), false, true, "which is not a function"},
- equalsTestCase{int32(0), false, true, "which is not a function"},
- equalsTestCase{int64(0), false, true, "which is not a function"},
- equalsTestCase{uint(0), false, true, "which is not a function"},
- equalsTestCase{uint8(0), false, true, "which is not a function"},
- equalsTestCase{uint16(0), false, true, "which is not a function"},
- equalsTestCase{uint32(0), false, true, "which is not a function"},
- equalsTestCase{uint64(0), false, true, "which is not a function"},
- equalsTestCase{true, false, true, "which is not a function"},
- equalsTestCase{[...]int{}, false, true, "which is not a function"},
- equalsTestCase{map[int]int{}, false, true, "which is not a function"},
- equalsTestCase{&someInt, false, true, "which is not a function"},
- equalsTestCase{[]int{}, false, true, "which is not a function"},
- equalsTestCase{"taco", false, true, "which is not a function"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a function"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// map
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilMap() {
- var nilMap1 map[int]int
- var nilMap2 map[int]int
- var nilMap3 map[int]uint
- var nonNilMap1 map[int]int = make(map[int]int)
- var nonNilMap2 map[int]uint = make(map[int]uint)
-
- matcher := Equals(nilMap1)
- ExpectEq("map[]", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilMap1, true, false, ""},
- equalsTestCase{nilMap2, true, false, ""},
- equalsTestCase{nilMap3, true, false, ""},
- equalsTestCase{nonNilMap1, false, false, ""},
- equalsTestCase{nonNilMap2, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a map"},
- equalsTestCase{bool(false), false, true, "which is not a map"},
- equalsTestCase{int(0), false, true, "which is not a map"},
- equalsTestCase{int8(0), false, true, "which is not a map"},
- equalsTestCase{int16(0), false, true, "which is not a map"},
- equalsTestCase{int32(0), false, true, "which is not a map"},
- equalsTestCase{int64(0), false, true, "which is not a map"},
- equalsTestCase{uint(0), false, true, "which is not a map"},
- equalsTestCase{uint8(0), false, true, "which is not a map"},
- equalsTestCase{uint16(0), false, true, "which is not a map"},
- equalsTestCase{uint32(0), false, true, "which is not a map"},
- equalsTestCase{uint64(0), false, true, "which is not a map"},
- equalsTestCase{true, false, true, "which is not a map"},
- equalsTestCase{[...]int{}, false, true, "which is not a map"},
- equalsTestCase{func() {}, false, true, "which is not a map"},
- equalsTestCase{&someInt, false, true, "which is not a map"},
- equalsTestCase{[]int{}, false, true, "which is not a map"},
- equalsTestCase{"taco", false, true, "which is not a map"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a map"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilMap() {
- var nilMap1 map[int]int
- var nilMap2 map[int]uint
- var nonNilMap1 map[int]int = make(map[int]int)
- var nonNilMap2 map[int]int = make(map[int]int)
- var nonNilMap3 map[int]uint = make(map[int]uint)
-
- matcher := Equals(nonNilMap1)
- ExpectEq("map[]", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nonNilMap1, true, false, ""},
- equalsTestCase{nonNilMap2, false, false, ""},
- equalsTestCase{nonNilMap3, false, false, ""},
- equalsTestCase{nilMap1, false, false, ""},
- equalsTestCase{nilMap2, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a map"},
- equalsTestCase{bool(false), false, true, "which is not a map"},
- equalsTestCase{int(0), false, true, "which is not a map"},
- equalsTestCase{int8(0), false, true, "which is not a map"},
- equalsTestCase{int16(0), false, true, "which is not a map"},
- equalsTestCase{int32(0), false, true, "which is not a map"},
- equalsTestCase{int64(0), false, true, "which is not a map"},
- equalsTestCase{uint(0), false, true, "which is not a map"},
- equalsTestCase{uint8(0), false, true, "which is not a map"},
- equalsTestCase{uint16(0), false, true, "which is not a map"},
- equalsTestCase{uint32(0), false, true, "which is not a map"},
- equalsTestCase{uint64(0), false, true, "which is not a map"},
- equalsTestCase{true, false, true, "which is not a map"},
- equalsTestCase{[...]int{}, false, true, "which is not a map"},
- equalsTestCase{func() {}, false, true, "which is not a map"},
- equalsTestCase{&someInt, false, true, "which is not a map"},
- equalsTestCase{[]int{}, false, true, "which is not a map"},
- equalsTestCase{"taco", false, true, "which is not a map"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a map"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Pointers
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilPointer() {
- var someInt int = 17
- var someUint uint = 17
-
- var nilInt1 *int
- var nilInt2 *int
- var nilUint *uint
- var nonNilInt *int = &someInt
- var nonNilUint *uint = &someUint
-
- matcher := Equals(nilInt1)
- ExpectEq("<nil>", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilInt1, true, false, ""},
- equalsTestCase{nilInt2, true, false, ""},
- equalsTestCase{nonNilInt, false, false, ""},
-
- // Incorrect type.
- equalsTestCase{nilUint, false, true, "which is not a *int"},
- equalsTestCase{nonNilUint, false, true, "which is not a *int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a *int"},
- equalsTestCase{bool(false), false, true, "which is not a *int"},
- equalsTestCase{int(0), false, true, "which is not a *int"},
- equalsTestCase{int8(0), false, true, "which is not a *int"},
- equalsTestCase{int16(0), false, true, "which is not a *int"},
- equalsTestCase{int32(0), false, true, "which is not a *int"},
- equalsTestCase{int64(0), false, true, "which is not a *int"},
- equalsTestCase{uint(0), false, true, "which is not a *int"},
- equalsTestCase{uint8(0), false, true, "which is not a *int"},
- equalsTestCase{uint16(0), false, true, "which is not a *int"},
- equalsTestCase{uint32(0), false, true, "which is not a *int"},
- equalsTestCase{uint64(0), false, true, "which is not a *int"},
- equalsTestCase{true, false, true, "which is not a *int"},
- equalsTestCase{[...]int{}, false, true, "which is not a *int"},
- equalsTestCase{func() {}, false, true, "which is not a *int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a *int"},
- equalsTestCase{[]int{}, false, true, "which is not a *int"},
- equalsTestCase{"taco", false, true, "which is not a *int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a *int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilPointer() {
- var someInt int = 17
- var someOtherInt int = 17
- var someUint uint = 17
-
- var nilInt *int
- var nilUint *uint
- var nonNilInt1 *int = &someInt
- var nonNilInt2 *int = &someOtherInt
- var nonNilUint *uint = &someUint
-
- matcher := Equals(nonNilInt1)
- ExpectEq(fmt.Sprintf("%v", nonNilInt1), matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nonNilInt1, true, false, ""},
- equalsTestCase{nonNilInt2, false, false, ""},
- equalsTestCase{nilInt, false, false, ""},
-
- // Incorrect type.
- equalsTestCase{nilUint, false, true, "which is not a *int"},
- equalsTestCase{nonNilUint, false, true, "which is not a *int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a *int"},
- equalsTestCase{bool(false), false, true, "which is not a *int"},
- equalsTestCase{int(0), false, true, "which is not a *int"},
- equalsTestCase{int8(0), false, true, "which is not a *int"},
- equalsTestCase{int16(0), false, true, "which is not a *int"},
- equalsTestCase{int32(0), false, true, "which is not a *int"},
- equalsTestCase{int64(0), false, true, "which is not a *int"},
- equalsTestCase{uint(0), false, true, "which is not a *int"},
- equalsTestCase{uint8(0), false, true, "which is not a *int"},
- equalsTestCase{uint16(0), false, true, "which is not a *int"},
- equalsTestCase{uint32(0), false, true, "which is not a *int"},
- equalsTestCase{uint64(0), false, true, "which is not a *int"},
- equalsTestCase{true, false, true, "which is not a *int"},
- equalsTestCase{[...]int{}, false, true, "which is not a *int"},
- equalsTestCase{func() {}, false, true, "which is not a *int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a *int"},
- equalsTestCase{[]int{}, false, true, "which is not a *int"},
- equalsTestCase{"taco", false, true, "which is not a *int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a *int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Slices
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilSlice() {
- var nilInt1 []int
- var nilInt2 []int
- var nilUint []uint
-
- var nonNilInt []int = make([]int, 0)
- var nonNilUint []uint = make([]uint, 0)
-
- matcher := Equals(nilInt1)
- ExpectEq("[]", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilInt1, true, false, ""},
- equalsTestCase{nilInt2, true, false, ""},
- equalsTestCase{nonNilInt, false, false, ""},
-
- // Incorrect type.
- equalsTestCase{nilUint, false, true, "which is not a []int"},
- equalsTestCase{nonNilUint, false, true, "which is not a []int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a []int"},
- equalsTestCase{bool(false), false, true, "which is not a []int"},
- equalsTestCase{int(0), false, true, "which is not a []int"},
- equalsTestCase{int8(0), false, true, "which is not a []int"},
- equalsTestCase{int16(0), false, true, "which is not a []int"},
- equalsTestCase{int32(0), false, true, "which is not a []int"},
- equalsTestCase{int64(0), false, true, "which is not a []int"},
- equalsTestCase{uint(0), false, true, "which is not a []int"},
- equalsTestCase{uint8(0), false, true, "which is not a []int"},
- equalsTestCase{uint16(0), false, true, "which is not a []int"},
- equalsTestCase{uint32(0), false, true, "which is not a []int"},
- equalsTestCase{uint64(0), false, true, "which is not a []int"},
- equalsTestCase{true, false, true, "which is not a []int"},
- equalsTestCase{[...]int{}, false, true, "which is not a []int"},
- equalsTestCase{func() {}, false, true, "which is not a []int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a []int"},
- equalsTestCase{"taco", false, true, "which is not a []int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a []int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilSlice() {
- nonNil := make([]int, 0)
- f := func() { Equals(nonNil) }
- ExpectThat(f, Panics(HasSubstr("non-nil slice")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// string
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) String() {
- partial := "taco"
- expected := fmt.Sprintf("%s%d", partial, 1)
-
- matcher := Equals(expected)
- ExpectEq("taco1", matcher.Description())
-
- type stringAlias string
-
- cases := []equalsTestCase{
- // Correct types.
- equalsTestCase{"taco1", true, false, ""},
- equalsTestCase{"taco" + "1", true, false, ""},
- equalsTestCase{expected, true, false, ""},
- equalsTestCase{stringAlias("taco1"), true, false, ""},
-
- equalsTestCase{"", false, false, ""},
- equalsTestCase{"taco", false, false, ""},
- equalsTestCase{"taco1\x00", false, false, ""},
- equalsTestCase{"taco2", false, false, ""},
- equalsTestCase{stringAlias("taco2"), false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a string"},
- equalsTestCase{bool(false), false, true, "which is not a string"},
- equalsTestCase{int(0), false, true, "which is not a string"},
- equalsTestCase{int8(0), false, true, "which is not a string"},
- equalsTestCase{int16(0), false, true, "which is not a string"},
- equalsTestCase{int32(0), false, true, "which is not a string"},
- equalsTestCase{int64(0), false, true, "which is not a string"},
- equalsTestCase{uint(0), false, true, "which is not a string"},
- equalsTestCase{uint8(0), false, true, "which is not a string"},
- equalsTestCase{uint16(0), false, true, "which is not a string"},
- equalsTestCase{uint32(0), false, true, "which is not a string"},
- equalsTestCase{uint64(0), false, true, "which is not a string"},
- equalsTestCase{true, false, true, "which is not a string"},
- equalsTestCase{[...]int{}, false, true, "which is not a string"},
- equalsTestCase{func() {}, false, true, "which is not a string"},
- equalsTestCase{map[int]int{}, false, true, "which is not a string"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a string"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) StringAlias() {
- type stringAlias string
-
- matcher := Equals(stringAlias("taco"))
- ExpectEq("taco", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct types.
- equalsTestCase{stringAlias("taco"), true, false, ""},
- equalsTestCase{"taco", true, false, ""},
-
- equalsTestCase{"burrito", false, false, ""},
- equalsTestCase{stringAlias("burrito"), false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a string"},
- equalsTestCase{bool(false), false, true, "which is not a string"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// struct
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) Struct() {
- type someStruct struct{ foo uint }
- f := func() { Equals(someStruct{17}) }
- ExpectThat(f, Panics(HasSubstr("unsupported kind struct")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// unsafe.Pointer
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilUnsafePointer() {
- someInt := int(17)
-
- var nilPtr1 unsafe.Pointer
- var nilPtr2 unsafe.Pointer
- var nonNilPtr unsafe.Pointer = unsafe.Pointer(&someInt)
-
- matcher := Equals(nilPtr1)
- ExpectEq("<nil>", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilPtr1, true, false, ""},
- equalsTestCase{nilPtr2, true, false, ""},
- equalsTestCase{nonNilPtr, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{bool(false), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uintptr(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{true, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[...]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{make(chan int), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{func() {}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{map[int]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{&someInt, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{"taco", false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a unsafe.Pointer"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilUnsafePointer() {
- someInt := int(17)
- someOtherInt := int(17)
-
- var nilPtr unsafe.Pointer
- var nonNilPtr1 unsafe.Pointer = unsafe.Pointer(&someInt)
- var nonNilPtr2 unsafe.Pointer = unsafe.Pointer(&someOtherInt)
-
- matcher := Equals(nonNilPtr1)
- ExpectEq(fmt.Sprintf("%v", nonNilPtr1), matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nonNilPtr1, true, false, ""},
- equalsTestCase{nonNilPtr2, false, false, ""},
- equalsTestCase{nilPtr, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{bool(false), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uintptr(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{true, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[...]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{make(chan int), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{func() {}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{map[int]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{&someInt, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{"taco", false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a unsafe.Pointer"},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error.go
deleted file mode 100644
index 8a078e36d86..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-// Error returns a matcher that matches non-nil values implementing the
-// built-in error interface for whom the return value of Error() matches the
-// supplied matcher.
-//
-// For example:
-//
-// err := errors.New("taco burrito")
-//
-// Error(Equals("taco burrito")) // matches err
-// Error(HasSubstr("taco")) // matches err
-// Error(HasSubstr("enchilada")) // doesn't match err
-//
-func Error(m Matcher) Matcher {
- return &errorMatcher{m}
-}
-
-type errorMatcher struct {
- wrappedMatcher Matcher
-}
-
-func (m *errorMatcher) Description() string {
- return "error " + m.wrappedMatcher.Description()
-}
-
-func (m *errorMatcher) Matches(c interface{}) error {
- // Make sure that c is an error.
- e, ok := c.(error)
- if !ok {
- return NewFatalError("which is not an error")
- }
-
- // Pass on the error text to the wrapped matcher.
- return m.wrappedMatcher.Matches(e.Error())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error_test.go
deleted file mode 100644
index 42f226d95ed..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/error_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type ErrorTest struct {
- matcherCalled bool
- suppliedCandidate interface{}
- wrappedError error
-
- matcher Matcher
-}
-
-func init() { RegisterTestSuite(&ErrorTest{}) }
-
-func (t *ErrorTest) SetUp(i *TestInfo) {
- wrapped := &fakeMatcher{
- func(c interface{}) error {
- t.matcherCalled = true
- t.suppliedCandidate = c
- return t.wrappedError
- },
- "is foo",
- }
-
- t.matcher = Error(wrapped)
-}
-
-func isFatal(err error) bool {
- _, isFatal := err.(*FatalError)
- return isFatal
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *ErrorTest) Description() {
- ExpectThat(t.matcher.Description(), Equals("error is foo"))
-}
-
-func (t *ErrorTest) CandidateIsNil() {
- err := t.matcher.Matches(nil)
-
- ExpectThat(t.matcherCalled, Equals(false))
- ExpectThat(err.Error(), Equals("which is not an error"))
- ExpectTrue(isFatal(err))
-}
-
-func (t *ErrorTest) CandidateIsString() {
- err := t.matcher.Matches("taco")
-
- ExpectThat(t.matcherCalled, Equals(false))
- ExpectThat(err.Error(), Equals("which is not an error"))
- ExpectTrue(isFatal(err))
-}
-
-func (t *ErrorTest) CallsWrappedMatcher() {
- candidate := errors.New("taco")
- t.matcher.Matches(candidate)
-
- ExpectThat(t.matcherCalled, Equals(true))
- ExpectThat(t.suppliedCandidate, Equals("taco"))
-}
-
-func (t *ErrorTest) ReturnsWrappedMatcherResult() {
- t.wrappedError = errors.New("burrito")
- err := t.matcher.Matches(errors.New(""))
- ExpectThat(err, Equals(t.wrappedError))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal.go
deleted file mode 100644
index 4b9d103a381..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// GreaterOrEqual returns a matcher that matches integer, floating point, or
-// strings values v such that v >= x. Comparison is not defined between numeric
-// and string types, but is defined between all integer and floating point
-// types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// GreaterOrEqual will panic.
-func GreaterOrEqual(x interface{}) Matcher {
- desc := fmt.Sprintf("greater than or equal to %v", x)
-
- // Special case: make it clear that strings are strings.
- if reflect.TypeOf(x).Kind() == reflect.String {
- desc = fmt.Sprintf("greater than or equal to \"%s\"", x)
- }
-
- return transformDescription(Not(LessThan(x)), desc)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal_test.go
deleted file mode 100644
index 639f0e0acf9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_or_equal_test.go
+++ /dev/null
@@ -1,1059 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "math"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type GreaterOrEqualTest struct {
-}
-
-func init() { RegisterTestSuite(&GreaterOrEqualTest{}) }
-
-type geTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *GreaterOrEqualTest) checkTestCases(matcher Matcher, cases []geTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) IntegerCandidateBadTypes() {
- matcher := GreaterOrEqual(int(-150))
-
- cases := []geTestCase{
- geTestCase{true, false, true, "which is not comparable"},
- geTestCase{uintptr(17), false, true, "which is not comparable"},
- geTestCase{complex64(-151), false, true, "which is not comparable"},
- geTestCase{complex128(-151), false, true, "which is not comparable"},
- geTestCase{[...]int{-151}, false, true, "which is not comparable"},
- geTestCase{make(chan int), false, true, "which is not comparable"},
- geTestCase{func() {}, false, true, "which is not comparable"},
- geTestCase{map[int]int{}, false, true, "which is not comparable"},
- geTestCase{&geTestCase{}, false, true, "which is not comparable"},
- geTestCase{make([]int, 0), false, true, "which is not comparable"},
- geTestCase{"-151", false, true, "which is not comparable"},
- geTestCase{geTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) FloatCandidateBadTypes() {
- matcher := GreaterOrEqual(float32(-150))
-
- cases := []geTestCase{
- geTestCase{true, false, true, "which is not comparable"},
- geTestCase{uintptr(17), false, true, "which is not comparable"},
- geTestCase{complex64(-151), false, true, "which is not comparable"},
- geTestCase{complex128(-151), false, true, "which is not comparable"},
- geTestCase{[...]int{-151}, false, true, "which is not comparable"},
- geTestCase{make(chan int), false, true, "which is not comparable"},
- geTestCase{func() {}, false, true, "which is not comparable"},
- geTestCase{map[int]int{}, false, true, "which is not comparable"},
- geTestCase{&geTestCase{}, false, true, "which is not comparable"},
- geTestCase{make([]int, 0), false, true, "which is not comparable"},
- geTestCase{"-151", false, true, "which is not comparable"},
- geTestCase{geTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) StringCandidateBadTypes() {
- matcher := GreaterOrEqual("17")
-
- cases := []geTestCase{
- geTestCase{true, false, true, "which is not comparable"},
- geTestCase{int(0), false, true, "which is not comparable"},
- geTestCase{int8(0), false, true, "which is not comparable"},
- geTestCase{int16(0), false, true, "which is not comparable"},
- geTestCase{int32(0), false, true, "which is not comparable"},
- geTestCase{int64(0), false, true, "which is not comparable"},
- geTestCase{uint(0), false, true, "which is not comparable"},
- geTestCase{uint8(0), false, true, "which is not comparable"},
- geTestCase{uint16(0), false, true, "which is not comparable"},
- geTestCase{uint32(0), false, true, "which is not comparable"},
- geTestCase{uint64(0), false, true, "which is not comparable"},
- geTestCase{uintptr(17), false, true, "which is not comparable"},
- geTestCase{float32(0), false, true, "which is not comparable"},
- geTestCase{float64(0), false, true, "which is not comparable"},
- geTestCase{complex64(-151), false, true, "which is not comparable"},
- geTestCase{complex128(-151), false, true, "which is not comparable"},
- geTestCase{[...]int{-151}, false, true, "which is not comparable"},
- geTestCase{make(chan int), false, true, "which is not comparable"},
- geTestCase{func() {}, false, true, "which is not comparable"},
- geTestCase{map[int]int{}, false, true, "which is not comparable"},
- geTestCase{&geTestCase{}, false, true, "which is not comparable"},
- geTestCase{make([]int, 0), false, true, "which is not comparable"},
- geTestCase{geTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- GreaterOrEqual(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) NegativeIntegerLiteral() {
- matcher := GreaterOrEqual(-150)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-(1 << 30), false, false, ""},
- geTestCase{-151, false, false, ""},
- geTestCase{-150, true, false, ""},
- geTestCase{0, true, false, ""},
- geTestCase{17, true, false, ""},
-
- geTestCase{int(-(1 << 30)), false, false, ""},
- geTestCase{int(-151), false, false, ""},
- geTestCase{int(-150), true, false, ""},
- geTestCase{int(0), true, false, ""},
- geTestCase{int(17), true, false, ""},
-
- geTestCase{int8(-127), true, false, ""},
- geTestCase{int8(0), true, false, ""},
- geTestCase{int8(17), true, false, ""},
-
- geTestCase{int16(-(1 << 14)), false, false, ""},
- geTestCase{int16(-151), false, false, ""},
- geTestCase{int16(-150), true, false, ""},
- geTestCase{int16(0), true, false, ""},
- geTestCase{int16(17), true, false, ""},
-
- geTestCase{int32(-(1 << 30)), false, false, ""},
- geTestCase{int32(-151), false, false, ""},
- geTestCase{int32(-150), true, false, ""},
- geTestCase{int32(0), true, false, ""},
- geTestCase{int32(17), true, false, ""},
-
- geTestCase{int64(-(1 << 30)), false, false, ""},
- geTestCase{int64(-151), false, false, ""},
- geTestCase{int64(-150), true, false, ""},
- geTestCase{int64(0), true, false, ""},
- geTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint((1 << 32) - 151), true, false, ""},
- geTestCase{uint(0), true, false, ""},
- geTestCase{uint(17), true, false, ""},
-
- geTestCase{uint8(0), true, false, ""},
- geTestCase{uint8(17), true, false, ""},
- geTestCase{uint8(253), true, false, ""},
-
- geTestCase{uint16((1 << 16) - 151), true, false, ""},
- geTestCase{uint16(0), true, false, ""},
- geTestCase{uint16(17), true, false, ""},
-
- geTestCase{uint32((1 << 32) - 151), true, false, ""},
- geTestCase{uint32(0), true, false, ""},
- geTestCase{uint32(17), true, false, ""},
-
- geTestCase{uint64((1 << 64) - 151), true, false, ""},
- geTestCase{uint64(0), true, false, ""},
- geTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-(1 << 30)), false, false, ""},
- geTestCase{float32(-151), false, false, ""},
- geTestCase{float32(-150.1), false, false, ""},
- geTestCase{float32(-150), true, false, ""},
- geTestCase{float32(-149.9), true, false, ""},
- geTestCase{float32(0), true, false, ""},
- geTestCase{float32(17), true, false, ""},
- geTestCase{float32(160), true, false, ""},
-
- geTestCase{float64(-(1 << 30)), false, false, ""},
- geTestCase{float64(-151), false, false, ""},
- geTestCase{float64(-150.1), false, false, ""},
- geTestCase{float64(-150), true, false, ""},
- geTestCase{float64(-149.9), true, false, ""},
- geTestCase{float64(0), true, false, ""},
- geTestCase{float64(17), true, false, ""},
- geTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) ZeroIntegerLiteral() {
- matcher := GreaterOrEqual(0)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-(1 << 30), false, false, ""},
- geTestCase{-1, false, false, ""},
- geTestCase{0, true, false, ""},
- geTestCase{1, true, false, ""},
- geTestCase{17, true, false, ""},
- geTestCase{(1 << 30), true, false, ""},
-
- geTestCase{int(-(1 << 30)), false, false, ""},
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(0), true, false, ""},
- geTestCase{int(1), true, false, ""},
- geTestCase{int(17), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(0), true, false, ""},
- geTestCase{int8(1), true, false, ""},
-
- geTestCase{int16(-(1 << 14)), false, false, ""},
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), true, false, ""},
- geTestCase{int16(1), true, false, ""},
- geTestCase{int16(17), true, false, ""},
-
- geTestCase{int32(-(1 << 30)), false, false, ""},
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(0), true, false, ""},
- geTestCase{int32(1), true, false, ""},
- geTestCase{int32(17), true, false, ""},
-
- geTestCase{int64(-(1 << 30)), false, false, ""},
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(0), true, false, ""},
- geTestCase{int64(1), true, false, ""},
- geTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint((1 << 32) - 1), true, false, ""},
- geTestCase{uint(0), true, false, ""},
- geTestCase{uint(17), true, false, ""},
-
- geTestCase{uint8(0), true, false, ""},
- geTestCase{uint8(17), true, false, ""},
- geTestCase{uint8(253), true, false, ""},
-
- geTestCase{uint16((1 << 16) - 1), true, false, ""},
- geTestCase{uint16(0), true, false, ""},
- geTestCase{uint16(17), true, false, ""},
-
- geTestCase{uint32((1 << 32) - 1), true, false, ""},
- geTestCase{uint32(0), true, false, ""},
- geTestCase{uint32(17), true, false, ""},
-
- geTestCase{uint64((1 << 64) - 1), true, false, ""},
- geTestCase{uint64(0), true, false, ""},
- geTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-(1 << 30)), false, false, ""},
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(-0.1), false, false, ""},
- geTestCase{float32(-0.0), true, false, ""},
- geTestCase{float32(0), true, false, ""},
- geTestCase{float32(0.1), true, false, ""},
- geTestCase{float32(17), true, false, ""},
- geTestCase{float32(160), true, false, ""},
-
- geTestCase{float64(-(1 << 30)), false, false, ""},
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(-0.1), false, false, ""},
- geTestCase{float64(-0), true, false, ""},
- geTestCase{float64(0), true, false, ""},
- geTestCase{float64(17), true, false, ""},
- geTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) PositiveIntegerLiteral() {
- matcher := GreaterOrEqual(150)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{149, false, false, ""},
- geTestCase{150, true, false, ""},
- geTestCase{151, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(149), false, false, ""},
- geTestCase{int(150), true, false, ""},
- geTestCase{int(151), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(0), false, false, ""},
- geTestCase{int8(17), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(149), false, false, ""},
- geTestCase{int16(150), true, false, ""},
- geTestCase{int16(151), true, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(149), false, false, ""},
- geTestCase{int32(150), true, false, ""},
- geTestCase{int32(151), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(149), false, false, ""},
- geTestCase{int64(150), true, false, ""},
- geTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(149), false, false, ""},
- geTestCase{uint(150), true, false, ""},
- geTestCase{uint(151), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(127), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(149), false, false, ""},
- geTestCase{uint16(150), true, false, ""},
- geTestCase{uint16(151), true, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(149), false, false, ""},
- geTestCase{uint32(150), true, false, ""},
- geTestCase{uint32(151), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(149), false, false, ""},
- geTestCase{uint64(150), true, false, ""},
- geTestCase{uint64(151), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(149), false, false, ""},
- geTestCase{float32(149.9), false, false, ""},
- geTestCase{float32(150), true, false, ""},
- geTestCase{float32(150.1), true, false, ""},
- geTestCase{float32(151), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(149), false, false, ""},
- geTestCase{float64(149.9), false, false, ""},
- geTestCase{float64(150), true, false, ""},
- geTestCase{float64(150.1), true, false, ""},
- geTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) NegativeFloatLiteral() {
- matcher := GreaterOrEqual(-150.1)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-(1 << 30), false, false, ""},
- geTestCase{-151, false, false, ""},
- geTestCase{-150, true, false, ""},
- geTestCase{0, true, false, ""},
- geTestCase{17, true, false, ""},
-
- geTestCase{int(-(1 << 30)), false, false, ""},
- geTestCase{int(-151), false, false, ""},
- geTestCase{int(-150), true, false, ""},
- geTestCase{int(0), true, false, ""},
- geTestCase{int(17), true, false, ""},
-
- geTestCase{int8(-127), true, false, ""},
- geTestCase{int8(0), true, false, ""},
- geTestCase{int8(17), true, false, ""},
-
- geTestCase{int16(-(1 << 14)), false, false, ""},
- geTestCase{int16(-151), false, false, ""},
- geTestCase{int16(-150), true, false, ""},
- geTestCase{int16(0), true, false, ""},
- geTestCase{int16(17), true, false, ""},
-
- geTestCase{int32(-(1 << 30)), false, false, ""},
- geTestCase{int32(-151), false, false, ""},
- geTestCase{int32(-150), true, false, ""},
- geTestCase{int32(0), true, false, ""},
- geTestCase{int32(17), true, false, ""},
-
- geTestCase{int64(-(1 << 30)), false, false, ""},
- geTestCase{int64(-151), false, false, ""},
- geTestCase{int64(-150), true, false, ""},
- geTestCase{int64(0), true, false, ""},
- geTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint((1 << 32) - 151), true, false, ""},
- geTestCase{uint(0), true, false, ""},
- geTestCase{uint(17), true, false, ""},
-
- geTestCase{uint8(0), true, false, ""},
- geTestCase{uint8(17), true, false, ""},
- geTestCase{uint8(253), true, false, ""},
-
- geTestCase{uint16((1 << 16) - 151), true, false, ""},
- geTestCase{uint16(0), true, false, ""},
- geTestCase{uint16(17), true, false, ""},
-
- geTestCase{uint32((1 << 32) - 151), true, false, ""},
- geTestCase{uint32(0), true, false, ""},
- geTestCase{uint32(17), true, false, ""},
-
- geTestCase{uint64((1 << 64) - 151), true, false, ""},
- geTestCase{uint64(0), true, false, ""},
- geTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-(1 << 30)), false, false, ""},
- geTestCase{float32(-151), false, false, ""},
- geTestCase{float32(-150.2), false, false, ""},
- geTestCase{float32(-150.1), true, false, ""},
- geTestCase{float32(-150), true, false, ""},
- geTestCase{float32(0), true, false, ""},
- geTestCase{float32(17), true, false, ""},
- geTestCase{float32(160), true, false, ""},
-
- geTestCase{float64(-(1 << 30)), false, false, ""},
- geTestCase{float64(-151), false, false, ""},
- geTestCase{float64(-150.2), false, false, ""},
- geTestCase{float64(-150.1), true, false, ""},
- geTestCase{float64(-150), true, false, ""},
- geTestCase{float64(0), true, false, ""},
- geTestCase{float64(17), true, false, ""},
- geTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) PositiveFloatLiteral() {
- matcher := GreaterOrEqual(149.9)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{149, false, false, ""},
- geTestCase{150, true, false, ""},
- geTestCase{151, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(149), false, false, ""},
- geTestCase{int(150), true, false, ""},
- geTestCase{int(151), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(0), false, false, ""},
- geTestCase{int8(17), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(149), false, false, ""},
- geTestCase{int16(150), true, false, ""},
- geTestCase{int16(151), true, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(149), false, false, ""},
- geTestCase{int32(150), true, false, ""},
- geTestCase{int32(151), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(149), false, false, ""},
- geTestCase{int64(150), true, false, ""},
- geTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(149), false, false, ""},
- geTestCase{uint(150), true, false, ""},
- geTestCase{uint(151), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(127), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(149), false, false, ""},
- geTestCase{uint16(150), true, false, ""},
- geTestCase{uint16(151), true, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(149), false, false, ""},
- geTestCase{uint32(150), true, false, ""},
- geTestCase{uint32(151), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(149), false, false, ""},
- geTestCase{uint64(150), true, false, ""},
- geTestCase{uint64(151), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(149), false, false, ""},
- geTestCase{float32(149.8), false, false, ""},
- geTestCase{float32(149.9), true, false, ""},
- geTestCase{float32(150), true, false, ""},
- geTestCase{float32(151), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(149), false, false, ""},
- geTestCase{float64(149.8), false, false, ""},
- geTestCase{float64(149.9), true, false, ""},
- geTestCase{float64(150), true, false, ""},
- geTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterOrEqual(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{kTwoTo25 + 0, false, false, ""},
- geTestCase{kTwoTo25 + 1, true, false, ""},
- geTestCase{kTwoTo25 + 2, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(kTwoTo25 + 0), false, false, ""},
- geTestCase{int(kTwoTo25 + 1), true, false, ""},
- geTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(kTwoTo25 + 0), false, false, ""},
- geTestCase{int32(kTwoTo25 + 1), true, false, ""},
- geTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo25 + 0), false, false, ""},
- geTestCase{int64(kTwoTo25 + 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(kTwoTo25 - 2), false, false, ""},
- geTestCase{float32(kTwoTo25 - 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 0), true, false, ""},
- geTestCase{float32(kTwoTo25 + 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 2), true, false, ""},
- geTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo25 - 2), false, false, ""},
- geTestCase{float64(kTwoTo25 - 1), false, false, ""},
- geTestCase{float64(kTwoTo25 + 0), false, false, ""},
- geTestCase{float64(kTwoTo25 + 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 2), true, false, ""},
- geTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterOrEqual(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{1 << 30, false, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(math.MaxInt32), false, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(math.MaxInt32), false, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo54 - 1), false, false, ""},
- geTestCase{int64(kTwoTo54 + 0), false, false, ""},
- geTestCase{int64(kTwoTo54 + 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(math.MaxUint32), false, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(math.MaxUint32), false, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo54 - 2), false, false, ""},
- geTestCase{float64(kTwoTo54 - 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 0), true, false, ""},
- geTestCase{float64(kTwoTo54 + 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 2), true, false, ""},
- geTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterOrEqual(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{kTwoTo25 + 0, false, false, ""},
- geTestCase{kTwoTo25 + 1, true, false, ""},
- geTestCase{kTwoTo25 + 2, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(kTwoTo25 + 0), false, false, ""},
- geTestCase{int(kTwoTo25 + 1), true, false, ""},
- geTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(kTwoTo25 + 0), false, false, ""},
- geTestCase{int32(kTwoTo25 + 1), true, false, ""},
- geTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo25 + 0), false, false, ""},
- geTestCase{int64(kTwoTo25 + 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(kTwoTo25 - 2), false, false, ""},
- geTestCase{float32(kTwoTo25 - 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 0), true, false, ""},
- geTestCase{float32(kTwoTo25 + 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 2), true, false, ""},
- geTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo25 - 2), false, false, ""},
- geTestCase{float64(kTwoTo25 - 1), false, false, ""},
- geTestCase{float64(kTwoTo25 + 0), false, false, ""},
- geTestCase{float64(kTwoTo25 + 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 2), true, false, ""},
- geTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterOrEqual(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{1 << 30, false, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(math.MaxInt32), false, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(math.MaxInt32), false, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo54 - 1), false, false, ""},
- geTestCase{int64(kTwoTo54 + 0), false, false, ""},
- geTestCase{int64(kTwoTo54 + 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(math.MaxUint32), false, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(math.MaxUint32), false, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo54 - 2), false, false, ""},
- geTestCase{float64(kTwoTo54 - 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 0), true, false, ""},
- geTestCase{float64(kTwoTo54 + 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 2), true, false, ""},
- geTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterOrEqual(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo25 - 2), false, false, ""},
- geTestCase{int64(kTwoTo25 - 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 0), true, false, ""},
- geTestCase{int64(kTwoTo25 + 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 2), true, false, ""},
- geTestCase{int64(kTwoTo25 + 3), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- geTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 3), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(kTwoTo25 - 2), false, false, ""},
- geTestCase{float32(kTwoTo25 - 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 0), true, false, ""},
- geTestCase{float32(kTwoTo25 + 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 2), true, false, ""},
- geTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo25 - 2), false, false, ""},
- geTestCase{float64(kTwoTo25 - 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 0), true, false, ""},
- geTestCase{float64(kTwoTo25 + 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 2), true, false, ""},
- geTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterOrEqual(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo54 - 2), false, false, ""},
- geTestCase{int64(kTwoTo54 - 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 0), true, false, ""},
- geTestCase{int64(kTwoTo54 + 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 2), true, false, ""},
- geTestCase{int64(kTwoTo54 + 3), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 3), true, false, ""},
-
- // Floating point.
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo54 - 2), false, false, ""},
- geTestCase{float64(kTwoTo54 - 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 0), true, false, ""},
- geTestCase{float64(kTwoTo54 + 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 2), true, false, ""},
- geTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) EmptyString() {
- matcher := GreaterOrEqual("")
- desc := matcher.Description()
- expectedDesc := "greater than or equal to \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- geTestCase{"", true, false, ""},
- geTestCase{"\x00", true, false, ""},
- geTestCase{"a", true, false, ""},
- geTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) SingleNullByte() {
- matcher := GreaterOrEqual("\x00")
- desc := matcher.Description()
- expectedDesc := "greater than or equal to \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- geTestCase{"", false, false, ""},
- geTestCase{"\x00", true, false, ""},
- geTestCase{"a", true, false, ""},
- geTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) LongerString() {
- matcher := GreaterOrEqual("foo\x00")
- desc := matcher.Description()
- expectedDesc := "greater than or equal to \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- geTestCase{"", false, false, ""},
- geTestCase{"\x00", false, false, ""},
- geTestCase{"bar", false, false, ""},
- geTestCase{"foo", false, false, ""},
- geTestCase{"foo\x00", true, false, ""},
- geTestCase{"fooa", true, false, ""},
- geTestCase{"qux", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than.go
deleted file mode 100644
index 3eef32178f8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// GreaterThan returns a matcher that matches integer, floating point, or
-// strings values v such that v > x. Comparison is not defined between numeric
-// and string types, but is defined between all integer and floating point
-// types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// GreaterThan will panic.
-func GreaterThan(x interface{}) Matcher {
- desc := fmt.Sprintf("greater than %v", x)
-
- // Special case: make it clear that strings are strings.
- if reflect.TypeOf(x).Kind() == reflect.String {
- desc = fmt.Sprintf("greater than \"%s\"", x)
- }
-
- return transformDescription(Not(LessOrEqual(x)), desc)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than_test.go
deleted file mode 100644
index 784692525cb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/greater_than_test.go
+++ /dev/null
@@ -1,1079 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "math"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type GreaterThanTest struct {
-}
-
-func init() { RegisterTestSuite(&GreaterThanTest{}) }
-
-type gtTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *GreaterThanTest) checkTestCases(matcher Matcher, cases []gtTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) IntegerCandidateBadTypes() {
- matcher := GreaterThan(int(-150))
-
- cases := []gtTestCase{
- gtTestCase{true, false, true, "which is not comparable"},
- gtTestCase{uintptr(17), false, true, "which is not comparable"},
- gtTestCase{complex64(-151), false, true, "which is not comparable"},
- gtTestCase{complex128(-151), false, true, "which is not comparable"},
- gtTestCase{[...]int{-151}, false, true, "which is not comparable"},
- gtTestCase{make(chan int), false, true, "which is not comparable"},
- gtTestCase{func() {}, false, true, "which is not comparable"},
- gtTestCase{map[int]int{}, false, true, "which is not comparable"},
- gtTestCase{&gtTestCase{}, false, true, "which is not comparable"},
- gtTestCase{make([]int, 0), false, true, "which is not comparable"},
- gtTestCase{"-151", false, true, "which is not comparable"},
- gtTestCase{gtTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) FloatCandidateBadTypes() {
- matcher := GreaterThan(float32(-150))
-
- cases := []gtTestCase{
- gtTestCase{true, false, true, "which is not comparable"},
- gtTestCase{uintptr(17), false, true, "which is not comparable"},
- gtTestCase{complex64(-151), false, true, "which is not comparable"},
- gtTestCase{complex128(-151), false, true, "which is not comparable"},
- gtTestCase{[...]int{-151}, false, true, "which is not comparable"},
- gtTestCase{make(chan int), false, true, "which is not comparable"},
- gtTestCase{func() {}, false, true, "which is not comparable"},
- gtTestCase{map[int]int{}, false, true, "which is not comparable"},
- gtTestCase{&gtTestCase{}, false, true, "which is not comparable"},
- gtTestCase{make([]int, 0), false, true, "which is not comparable"},
- gtTestCase{"-151", false, true, "which is not comparable"},
- gtTestCase{gtTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) StringCandidateBadTypes() {
- matcher := GreaterThan("17")
-
- cases := []gtTestCase{
- gtTestCase{true, false, true, "which is not comparable"},
- gtTestCase{int(0), false, true, "which is not comparable"},
- gtTestCase{int8(0), false, true, "which is not comparable"},
- gtTestCase{int16(0), false, true, "which is not comparable"},
- gtTestCase{int32(0), false, true, "which is not comparable"},
- gtTestCase{int64(0), false, true, "which is not comparable"},
- gtTestCase{uint(0), false, true, "which is not comparable"},
- gtTestCase{uint8(0), false, true, "which is not comparable"},
- gtTestCase{uint16(0), false, true, "which is not comparable"},
- gtTestCase{uint32(0), false, true, "which is not comparable"},
- gtTestCase{uint64(0), false, true, "which is not comparable"},
- gtTestCase{uintptr(17), false, true, "which is not comparable"},
- gtTestCase{float32(0), false, true, "which is not comparable"},
- gtTestCase{float64(0), false, true, "which is not comparable"},
- gtTestCase{complex64(-151), false, true, "which is not comparable"},
- gtTestCase{complex128(-151), false, true, "which is not comparable"},
- gtTestCase{[...]int{-151}, false, true, "which is not comparable"},
- gtTestCase{make(chan int), false, true, "which is not comparable"},
- gtTestCase{func() {}, false, true, "which is not comparable"},
- gtTestCase{map[int]int{}, false, true, "which is not comparable"},
- gtTestCase{&gtTestCase{}, false, true, "which is not comparable"},
- gtTestCase{make([]int, 0), false, true, "which is not comparable"},
- gtTestCase{gtTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- GreaterThan(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) NegativeIntegerLiteral() {
- matcher := GreaterThan(-150)
- desc := matcher.Description()
- expectedDesc := "greater than -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-(1 << 30), false, false, ""},
- gtTestCase{-151, false, false, ""},
- gtTestCase{-150, false, false, ""},
- gtTestCase{-149, true, false, ""},
- gtTestCase{0, true, false, ""},
- gtTestCase{17, true, false, ""},
-
- gtTestCase{int(-(1 << 30)), false, false, ""},
- gtTestCase{int(-151), false, false, ""},
- gtTestCase{int(-150), false, false, ""},
- gtTestCase{int(-149), true, false, ""},
- gtTestCase{int(0), true, false, ""},
- gtTestCase{int(17), true, false, ""},
-
- gtTestCase{int8(-127), true, false, ""},
- gtTestCase{int8(0), true, false, ""},
- gtTestCase{int8(17), true, false, ""},
-
- gtTestCase{int16(-(1 << 14)), false, false, ""},
- gtTestCase{int16(-151), false, false, ""},
- gtTestCase{int16(-150), false, false, ""},
- gtTestCase{int16(-149), true, false, ""},
- gtTestCase{int16(0), true, false, ""},
- gtTestCase{int16(17), true, false, ""},
-
- gtTestCase{int32(-(1 << 30)), false, false, ""},
- gtTestCase{int32(-151), false, false, ""},
- gtTestCase{int32(-150), false, false, ""},
- gtTestCase{int32(-149), true, false, ""},
- gtTestCase{int32(0), true, false, ""},
- gtTestCase{int32(17), true, false, ""},
-
- gtTestCase{int64(-(1 << 30)), false, false, ""},
- gtTestCase{int64(-151), false, false, ""},
- gtTestCase{int64(-150), false, false, ""},
- gtTestCase{int64(-149), true, false, ""},
- gtTestCase{int64(0), true, false, ""},
- gtTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint((1 << 32) - 151), true, false, ""},
- gtTestCase{uint(0), true, false, ""},
- gtTestCase{uint(17), true, false, ""},
-
- gtTestCase{uint8(0), true, false, ""},
- gtTestCase{uint8(17), true, false, ""},
- gtTestCase{uint8(253), true, false, ""},
-
- gtTestCase{uint16((1 << 16) - 151), true, false, ""},
- gtTestCase{uint16(0), true, false, ""},
- gtTestCase{uint16(17), true, false, ""},
-
- gtTestCase{uint32((1 << 32) - 151), true, false, ""},
- gtTestCase{uint32(0), true, false, ""},
- gtTestCase{uint32(17), true, false, ""},
-
- gtTestCase{uint64((1 << 64) - 151), true, false, ""},
- gtTestCase{uint64(0), true, false, ""},
- gtTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-(1 << 30)), false, false, ""},
- gtTestCase{float32(-151), false, false, ""},
- gtTestCase{float32(-150.1), false, false, ""},
- gtTestCase{float32(-150), false, false, ""},
- gtTestCase{float32(-149.9), true, false, ""},
- gtTestCase{float32(0), true, false, ""},
- gtTestCase{float32(17), true, false, ""},
- gtTestCase{float32(160), true, false, ""},
-
- gtTestCase{float64(-(1 << 30)), false, false, ""},
- gtTestCase{float64(-151), false, false, ""},
- gtTestCase{float64(-150.1), false, false, ""},
- gtTestCase{float64(-150), false, false, ""},
- gtTestCase{float64(-149.9), true, false, ""},
- gtTestCase{float64(0), true, false, ""},
- gtTestCase{float64(17), true, false, ""},
- gtTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) ZeroIntegerLiteral() {
- matcher := GreaterThan(0)
- desc := matcher.Description()
- expectedDesc := "greater than 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-(1 << 30), false, false, ""},
- gtTestCase{-1, false, false, ""},
- gtTestCase{0, false, false, ""},
- gtTestCase{1, true, false, ""},
- gtTestCase{17, true, false, ""},
- gtTestCase{(1 << 30), true, false, ""},
-
- gtTestCase{int(-(1 << 30)), false, false, ""},
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(0), false, false, ""},
- gtTestCase{int(1), true, false, ""},
- gtTestCase{int(17), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(0), false, false, ""},
- gtTestCase{int8(1), true, false, ""},
-
- gtTestCase{int16(-(1 << 14)), false, false, ""},
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(1), true, false, ""},
- gtTestCase{int16(17), true, false, ""},
-
- gtTestCase{int32(-(1 << 30)), false, false, ""},
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(0), false, false, ""},
- gtTestCase{int32(1), true, false, ""},
- gtTestCase{int32(17), true, false, ""},
-
- gtTestCase{int64(-(1 << 30)), false, false, ""},
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(0), false, false, ""},
- gtTestCase{int64(1), true, false, ""},
- gtTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint((1 << 32) - 1), true, false, ""},
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(1), true, false, ""},
- gtTestCase{uint(17), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(1), true, false, ""},
- gtTestCase{uint8(17), true, false, ""},
- gtTestCase{uint8(253), true, false, ""},
-
- gtTestCase{uint16((1 << 16) - 1), true, false, ""},
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(1), true, false, ""},
- gtTestCase{uint16(17), true, false, ""},
-
- gtTestCase{uint32((1 << 32) - 1), true, false, ""},
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(1), true, false, ""},
- gtTestCase{uint32(17), true, false, ""},
-
- gtTestCase{uint64((1 << 64) - 1), true, false, ""},
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(1), true, false, ""},
- gtTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-(1 << 30)), false, false, ""},
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(-0.1), false, false, ""},
- gtTestCase{float32(-0.0), false, false, ""},
- gtTestCase{float32(0), false, false, ""},
- gtTestCase{float32(0.1), true, false, ""},
- gtTestCase{float32(17), true, false, ""},
- gtTestCase{float32(160), true, false, ""},
-
- gtTestCase{float64(-(1 << 30)), false, false, ""},
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(-0.1), false, false, ""},
- gtTestCase{float64(-0), false, false, ""},
- gtTestCase{float64(0), false, false, ""},
- gtTestCase{float64(0.1), true, false, ""},
- gtTestCase{float64(17), true, false, ""},
- gtTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) PositiveIntegerLiteral() {
- matcher := GreaterThan(150)
- desc := matcher.Description()
- expectedDesc := "greater than 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{149, false, false, ""},
- gtTestCase{150, false, false, ""},
- gtTestCase{151, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(149), false, false, ""},
- gtTestCase{int(150), false, false, ""},
- gtTestCase{int(151), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(0), false, false, ""},
- gtTestCase{int8(17), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(149), false, false, ""},
- gtTestCase{int16(150), false, false, ""},
- gtTestCase{int16(151), true, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(149), false, false, ""},
- gtTestCase{int32(150), false, false, ""},
- gtTestCase{int32(151), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(149), false, false, ""},
- gtTestCase{int64(150), false, false, ""},
- gtTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(149), false, false, ""},
- gtTestCase{uint(150), false, false, ""},
- gtTestCase{uint(151), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(127), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(149), false, false, ""},
- gtTestCase{uint16(150), false, false, ""},
- gtTestCase{uint16(151), true, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(149), false, false, ""},
- gtTestCase{uint32(150), false, false, ""},
- gtTestCase{uint32(151), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(149), false, false, ""},
- gtTestCase{uint64(150), false, false, ""},
- gtTestCase{uint64(151), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(149), false, false, ""},
- gtTestCase{float32(149.9), false, false, ""},
- gtTestCase{float32(150), false, false, ""},
- gtTestCase{float32(150.1), true, false, ""},
- gtTestCase{float32(151), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(149), false, false, ""},
- gtTestCase{float64(149.9), false, false, ""},
- gtTestCase{float64(150), false, false, ""},
- gtTestCase{float64(150.1), true, false, ""},
- gtTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) NegativeFloatLiteral() {
- matcher := GreaterThan(-150.1)
- desc := matcher.Description()
- expectedDesc := "greater than -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-(1 << 30), false, false, ""},
- gtTestCase{-151, false, false, ""},
- gtTestCase{-150.1, false, false, ""},
- gtTestCase{-150, true, false, ""},
- gtTestCase{-149, true, false, ""},
- gtTestCase{0, true, false, ""},
- gtTestCase{17, true, false, ""},
-
- gtTestCase{int(-(1 << 30)), false, false, ""},
- gtTestCase{int(-151), false, false, ""},
- gtTestCase{int(-150), true, false, ""},
- gtTestCase{int(-149), true, false, ""},
- gtTestCase{int(0), true, false, ""},
- gtTestCase{int(17), true, false, ""},
-
- gtTestCase{int8(-127), true, false, ""},
- gtTestCase{int8(0), true, false, ""},
- gtTestCase{int8(17), true, false, ""},
-
- gtTestCase{int16(-(1 << 14)), false, false, ""},
- gtTestCase{int16(-151), false, false, ""},
- gtTestCase{int16(-150), true, false, ""},
- gtTestCase{int16(-149), true, false, ""},
- gtTestCase{int16(0), true, false, ""},
- gtTestCase{int16(17), true, false, ""},
-
- gtTestCase{int32(-(1 << 30)), false, false, ""},
- gtTestCase{int32(-151), false, false, ""},
- gtTestCase{int32(-150), true, false, ""},
- gtTestCase{int32(-149), true, false, ""},
- gtTestCase{int32(0), true, false, ""},
- gtTestCase{int32(17), true, false, ""},
-
- gtTestCase{int64(-(1 << 30)), false, false, ""},
- gtTestCase{int64(-151), false, false, ""},
- gtTestCase{int64(-150), true, false, ""},
- gtTestCase{int64(-149), true, false, ""},
- gtTestCase{int64(0), true, false, ""},
- gtTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint((1 << 32) - 151), true, false, ""},
- gtTestCase{uint(0), true, false, ""},
- gtTestCase{uint(17), true, false, ""},
-
- gtTestCase{uint8(0), true, false, ""},
- gtTestCase{uint8(17), true, false, ""},
- gtTestCase{uint8(253), true, false, ""},
-
- gtTestCase{uint16((1 << 16) - 151), true, false, ""},
- gtTestCase{uint16(0), true, false, ""},
- gtTestCase{uint16(17), true, false, ""},
-
- gtTestCase{uint32((1 << 32) - 151), true, false, ""},
- gtTestCase{uint32(0), true, false, ""},
- gtTestCase{uint32(17), true, false, ""},
-
- gtTestCase{uint64((1 << 64) - 151), true, false, ""},
- gtTestCase{uint64(0), true, false, ""},
- gtTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-(1 << 30)), false, false, ""},
- gtTestCase{float32(-151), false, false, ""},
- gtTestCase{float32(-150.2), false, false, ""},
- gtTestCase{float32(-150.1), false, false, ""},
- gtTestCase{float32(-150), true, false, ""},
- gtTestCase{float32(0), true, false, ""},
- gtTestCase{float32(17), true, false, ""},
- gtTestCase{float32(160), true, false, ""},
-
- gtTestCase{float64(-(1 << 30)), false, false, ""},
- gtTestCase{float64(-151), false, false, ""},
- gtTestCase{float64(-150.2), false, false, ""},
- gtTestCase{float64(-150.1), false, false, ""},
- gtTestCase{float64(-150), true, false, ""},
- gtTestCase{float64(0), true, false, ""},
- gtTestCase{float64(17), true, false, ""},
- gtTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) PositiveFloatLiteral() {
- matcher := GreaterThan(149.9)
- desc := matcher.Description()
- expectedDesc := "greater than 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{149, false, false, ""},
- gtTestCase{149.9, false, false, ""},
- gtTestCase{150, true, false, ""},
- gtTestCase{151, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(149), false, false, ""},
- gtTestCase{int(150), true, false, ""},
- gtTestCase{int(151), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(0), false, false, ""},
- gtTestCase{int8(17), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(149), false, false, ""},
- gtTestCase{int16(150), true, false, ""},
- gtTestCase{int16(151), true, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(149), false, false, ""},
- gtTestCase{int32(150), true, false, ""},
- gtTestCase{int32(151), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(149), false, false, ""},
- gtTestCase{int64(150), true, false, ""},
- gtTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(149), false, false, ""},
- gtTestCase{uint(150), true, false, ""},
- gtTestCase{uint(151), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(127), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(149), false, false, ""},
- gtTestCase{uint16(150), true, false, ""},
- gtTestCase{uint16(151), true, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(149), false, false, ""},
- gtTestCase{uint32(150), true, false, ""},
- gtTestCase{uint32(151), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(149), false, false, ""},
- gtTestCase{uint64(150), true, false, ""},
- gtTestCase{uint64(151), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(149), false, false, ""},
- gtTestCase{float32(149.8), false, false, ""},
- gtTestCase{float32(149.9), false, false, ""},
- gtTestCase{float32(150), true, false, ""},
- gtTestCase{float32(151), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(149), false, false, ""},
- gtTestCase{float64(149.8), false, false, ""},
- gtTestCase{float64(149.9), false, false, ""},
- gtTestCase{float64(150), true, false, ""},
- gtTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterThan(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{kTwoTo25 + 0, false, false, ""},
- gtTestCase{kTwoTo25 + 1, false, false, ""},
- gtTestCase{kTwoTo25 + 2, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 2), true, false, ""},
- gtTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterThan(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{1 << 30, false, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(math.MaxInt32), false, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(math.MaxInt32), false, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterThan(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{kTwoTo25 + 0, false, false, ""},
- gtTestCase{kTwoTo25 + 1, false, false, ""},
- gtTestCase{kTwoTo25 + 2, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 2), true, false, ""},
- gtTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterThan(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{1 << 30, false, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(math.MaxInt32), false, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(math.MaxInt32), false, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterThan(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{int64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 2), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 3), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{uint64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 2), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 3), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterThan(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 3), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 3), true, false, ""},
-
- // Floating point.
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) EmptyString() {
- matcher := GreaterThan("")
- desc := matcher.Description()
- expectedDesc := "greater than \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- gtTestCase{"", false, false, ""},
- gtTestCase{"\x00", true, false, ""},
- gtTestCase{"a", true, false, ""},
- gtTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) SingleNullByte() {
- matcher := GreaterThan("\x00")
- desc := matcher.Description()
- expectedDesc := "greater than \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- gtTestCase{"", false, false, ""},
- gtTestCase{"\x00", false, false, ""},
- gtTestCase{"\x00\x00", true, false, ""},
- gtTestCase{"a", true, false, ""},
- gtTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) LongerString() {
- matcher := GreaterThan("foo\x00")
- desc := matcher.Description()
- expectedDesc := "greater than \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- gtTestCase{"", false, false, ""},
- gtTestCase{"\x00", false, false, ""},
- gtTestCase{"bar", false, false, ""},
- gtTestCase{"foo", false, false, ""},
- gtTestCase{"foo\x00", false, false, ""},
- gtTestCase{"foo\x00\x00", true, false, ""},
- gtTestCase{"fooa", true, false, ""},
- gtTestCase{"qux", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as.go
deleted file mode 100644
index 3b286f73218..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// HasSameTypeAs returns a matcher that matches values with exactly the same
-// type as the supplied prototype.
-func HasSameTypeAs(p interface{}) Matcher {
- expected := reflect.TypeOf(p)
- pred := func(c interface{}) error {
- actual := reflect.TypeOf(c)
- if actual != expected {
- return fmt.Errorf("which has type %v", actual)
- }
-
- return nil
- }
-
- return NewMatcher(pred, fmt.Sprintf("has type %v", expected))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as_test.go
deleted file mode 100644
index 2030d5f9b1a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_same_type_as_test.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "io"
- "testing"
-
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-func TestHasSameTypeAs(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Boilerplate
-////////////////////////////////////////////////////////////////////////
-
-type HasSameTypeAsTest struct {
-}
-
-func init() { RegisterTestSuite(&HasSameTypeAsTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *HasSameTypeAsTest) CandidateIsLiteralNil() {
- matcher := HasSameTypeAs(nil)
- var err error
-
- // Description
- ExpectEq("has type <nil>", matcher.Description())
-
- // Literal nil
- err = matcher.Matches(nil)
- ExpectEq(nil, err)
-
- // nil in interface variable
- var r io.Reader
- err = matcher.Matches(r)
- ExpectEq(nil, err)
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-
- // string
- err = matcher.Matches("")
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type string")))
-
- // nil map
- var m map[string]string
- err = matcher.Matches(m)
-
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type map[string]string")))
-
- // Non-nil map
- m = make(map[string]string)
- err = matcher.Matches(m)
-
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type map[string]string")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsNilMap() {
- var m map[string]string
- matcher := HasSameTypeAs(m)
- var err error
-
- // Description
- ExpectEq("has type map[string]string", matcher.Description())
-
- // nil map
- m = nil
- err = matcher.Matches(m)
- ExpectEq(nil, err)
-
- // Non-nil map
- m = make(map[string]string)
- err = matcher.Matches(m)
- ExpectEq(nil, err)
-
- // Literal nil
- err = matcher.Matches(nil)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type <nil>")))
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-
- // string
- err = matcher.Matches("")
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type string")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsNilInInterfaceVariable() {
- var r io.Reader
- matcher := HasSameTypeAs(r)
- var err error
-
- // Description
- ExpectEq("has type <nil>", matcher.Description())
-
- // nil in interface variable
- r = nil
- err = matcher.Matches(r)
- ExpectEq(nil, err)
-
- // Literal nil
- err = matcher.Matches(nil)
- ExpectEq(nil, err)
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsString() {
- matcher := HasSameTypeAs("")
- var err error
-
- // Description
- ExpectEq("has type string", matcher.Description())
-
- // string
- err = matcher.Matches("taco")
- ExpectEq(nil, err)
-
- // string alias
- type Foo string
- err = matcher.Matches(Foo("taco"))
- ExpectThat(err, Error(MatchesRegexp("which has type .*Foo")))
-
- // Literal nil
- err = matcher.Matches(nil)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type <nil>")))
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsStringAlias() {
- type Foo string
- matcher := HasSameTypeAs(Foo(""))
- var err error
-
- // Description
- ExpectThat(matcher.Description(), MatchesRegexp("has type .*Foo"))
-
- // string alias
- err = matcher.Matches(Foo("taco"))
- ExpectEq(nil, err)
-
- // string
- err = matcher.Matches("taco")
- ExpectThat(err, Error(Equals("which has type string")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr.go
deleted file mode 100644
index bf5bd6ae6d3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
- "strings"
-)
-
-// HasSubstr returns a matcher that matches strings containing s as a
-// substring.
-func HasSubstr(s string) Matcher {
- return NewMatcher(
- func(c interface{}) error { return hasSubstr(s, c) },
- fmt.Sprintf("has substring \"%s\"", s))
-}
-
-func hasSubstr(needle string, c interface{}) error {
- v := reflect.ValueOf(c)
- if v.Kind() != reflect.String {
- return NewFatalError("which is not a string")
- }
-
- // Perform the substring search.
- haystack := v.String()
- if strings.Contains(haystack, needle) {
- return nil
- }
-
- return errors.New("")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr_test.go
deleted file mode 100644
index e36dcd8f03f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/has_substr_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type HasSubstrTest struct {
-
-}
-
-func init() { RegisterTestSuite(&HasSubstrTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *HasSubstrTest) Description() {
- matcher := HasSubstr("taco")
- ExpectThat(matcher.Description(), Equals("has substring \"taco\""))
-}
-
-func (t *HasSubstrTest) CandidateIsNil() {
- matcher := HasSubstr("")
- err := matcher.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a string")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateIsInteger() {
- matcher := HasSubstr("")
- err := matcher.Matches(17)
-
- ExpectThat(err, Error(Equals("which is not a string")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateIsByteSlice() {
- matcher := HasSubstr("")
- err := matcher.Matches([]byte{17})
-
- ExpectThat(err, Error(Equals("which is not a string")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateDoesntHaveSubstring() {
- matcher := HasSubstr("taco")
- err := matcher.Matches("tac")
-
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateEqualsArg() {
- matcher := HasSubstr("taco")
- err := matcher.Matches("taco")
-
- ExpectThat(err, Equals(nil))
-}
-
-func (t *HasSubstrTest) CandidateHasProperSubstring() {
- matcher := HasSubstr("taco")
- err := matcher.Matches("burritos and tacos")
-
- ExpectThat(err, Equals(nil))
-}
-
-func (t *HasSubstrTest) EmptyStringIsAlwaysSubString() {
- matcher := HasSubstr("")
- err := matcher.Matches("asdf")
-
- ExpectThat(err, Equals(nil))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to.go
deleted file mode 100644
index ae6460ed966..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to.go
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
-)
-
-// Is the type comparable according to the definition here?
-//
-// http://weekly.golang.org/doc/go_spec.html#Comparison_operators
-//
-func isComparable(t reflect.Type) bool {
- switch t.Kind() {
- case reflect.Array:
- return isComparable(t.Elem())
-
- case reflect.Struct:
- for i := 0; i < t.NumField(); i++ {
- if !isComparable(t.Field(i).Type) {
- return false
- }
- }
-
- return true
-
- case reflect.Slice, reflect.Map, reflect.Func:
- return false
- }
-
- return true
-}
-
-// Should the supplied type be allowed as an argument to IdenticalTo?
-func isLegalForIdenticalTo(t reflect.Type) (bool, error) {
- // Allow the zero type.
- if t == nil {
- return true, nil
- }
-
- // Reference types are always okay; we compare pointers.
- switch t.Kind() {
- case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan:
- return true, nil
- }
-
- // Reject other non-comparable types.
- if !isComparable(t) {
- return false, errors.New(fmt.Sprintf("%v is not comparable", t))
- }
-
- return true, nil
-}
-
-// IdenticalTo(x) returns a matcher that matches values v with type identical
-// to x such that:
-//
-// 1. If v and x are of a reference type (slice, map, function, channel), then
-// they are either both nil or are references to the same object.
-//
-// 2. Otherwise, if v and x are not of a reference type but have a valid type,
-// then v == x.
-//
-// If v and x are both the invalid type (which results from the predeclared nil
-// value, or from nil interface variables), then the matcher is satisfied.
-//
-// This function will panic if x is of a value type that is not comparable. For
-// example, x cannot be an array of functions.
-func IdenticalTo(x interface{}) Matcher {
- t := reflect.TypeOf(x)
-
- // Reject illegal arguments.
- if ok, err := isLegalForIdenticalTo(t); !ok {
- panic("IdenticalTo: " + err.Error())
- }
-
- return &identicalToMatcher{x}
-}
-
-type identicalToMatcher struct {
- x interface{}
-}
-
-func (m *identicalToMatcher) Description() string {
- t := reflect.TypeOf(m.x)
- return fmt.Sprintf("identical to <%v> %v", t, m.x)
-}
-
-func (m *identicalToMatcher) Matches(c interface{}) error {
- // Make sure the candidate's type is correct.
- t := reflect.TypeOf(m.x)
- if ct := reflect.TypeOf(c); t != ct {
- return NewFatalError(fmt.Sprintf("which is of type %v", ct))
- }
-
- // Special case: two values of the invalid type are always identical.
- if t == nil {
- return nil
- }
-
- // Handle reference types.
- switch t.Kind() {
- case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan:
- xv := reflect.ValueOf(m.x)
- cv := reflect.ValueOf(c)
- if xv.Pointer() == cv.Pointer() {
- return nil
- }
-
- return errors.New("which is not an identical reference")
- }
-
- // Are the values equal?
- if m.x == c {
- return nil
- }
-
- return errors.New("")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to_test.go
deleted file mode 100644
index 3e68652b641..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/identical_to_test.go
+++ /dev/null
@@ -1,849 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "fmt"
- "io"
- "unsafe"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type IdenticalToTest struct {
-}
-
-func init() { RegisterTestSuite(&IdenticalToTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *IdenticalToTest) TypesNotIdentical() {
- var m Matcher
- var err error
-
- type intAlias int
-
- // Type alias expected value
- m = IdenticalTo(intAlias(17))
- err = m.Matches(int(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int")))
-
- // Type alias candidate
- m = IdenticalTo(int(17))
- err = m.Matches(intAlias(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.intAlias")))
-
- // int and uint
- m = IdenticalTo(int(17))
- err = m.Matches(uint(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type uint")))
-}
-
-func (t *IdenticalToTest) PredeclaredNilIdentifier() {
- var m Matcher
- var err error
-
- // Nil literal
- m = IdenticalTo(nil)
- err = m.Matches(nil)
- ExpectEq(nil, err)
-
- // Zero interface var (which is the same as above since IdenticalTo takes an
- // interface{} as an arg)
- var nilReader io.Reader
- var nilWriter io.Writer
-
- m = IdenticalTo(nilReader)
- err = m.Matches(nilWriter)
- ExpectEq(nil, err)
-
- // Typed nil value.
- m = IdenticalTo(nil)
- err = m.Matches((chan int)(nil))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type chan int")))
-
- // Non-nil value.
- m = IdenticalTo(nil)
- err = m.Matches("taco")
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type string")))
-}
-
-func (t *IdenticalToTest) Slices() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo(([]int)(nil))
- ExpectEq("identical to <[]int> []", m.Description())
-
- err = m.Matches(([]int)(nil))
- ExpectEq(nil, err)
-
- err = m.Matches([]int{})
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := make([]int, 1)
- o2 := make([]int, 1)
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <[]int> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Maps() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo((map[int]int)(nil))
- ExpectEq("identical to <map[int]int> map[]", m.Description())
-
- err = m.Matches((map[int]int)(nil))
- ExpectEq(nil, err)
-
- err = m.Matches(map[int]int{})
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := map[int]int{}
- o2 := map[int]int{}
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <map[int]int> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Functions() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo((func())(nil))
- ExpectEq("identical to <func()> <nil>", m.Description())
-
- err = m.Matches((func())(nil))
- ExpectEq(nil, err)
-
- err = m.Matches(func(){})
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := func() {}
- o2 := func() {}
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <func()> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Channels() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo((chan int)(nil))
- ExpectEq("identical to <chan int> <nil>", m.Description())
-
- err = m.Matches((chan int)(nil))
- ExpectEq(nil, err)
-
- err = m.Matches(make(chan int))
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := make(chan int)
- o2 := make(chan int)
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <chan int> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Bools() {
- var m Matcher
- var err error
-
- // false
- m = IdenticalTo(false)
- ExpectEq("identical to <bool> false", m.Description())
-
- err = m.Matches(false)
- ExpectEq(nil, err)
-
- err = m.Matches(true)
- ExpectThat(err, Error(Equals("")))
-
- // true
- m = IdenticalTo(true)
- ExpectEq("identical to <bool> true", m.Description())
-
- err = m.Matches(false)
- ExpectThat(err, Error(Equals("")))
-
- err = m.Matches(true)
- ExpectEq(nil, err)
-}
-
-func (t *IdenticalToTest) Ints() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int(17))
- ExpectEq("identical to <int> 17", m.Description())
-
- // Identical value
- err = m.Matches(int(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Int8s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int8(17))
- ExpectEq("identical to <int8> 17", m.Description())
-
- // Identical value
- err = m.Matches(int8(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int8
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Int16s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int16(17))
- ExpectEq("identical to <int16> 17", m.Description())
-
- // Identical value
- err = m.Matches(int16(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int16
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Int32s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int32(17))
- ExpectEq("identical to <int32> 17", m.Description())
-
- // Identical value
- err = m.Matches(int32(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int32
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int16(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int16")))
-}
-
-func (t *IdenticalToTest) Int64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int64(17))
- ExpectEq("identical to <int64> 17", m.Description())
-
- // Identical value
- err = m.Matches(int64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uints() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint(17))
- ExpectEq("identical to <uint> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint8s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint8(17))
- ExpectEq("identical to <uint8> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint8(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint8
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint16s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint16(17))
- ExpectEq("identical to <uint16> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint16(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint16
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint32s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint32(17))
- ExpectEq("identical to <uint32> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint32(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint32
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint64(17))
- ExpectEq("identical to <uint64> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uintptrs() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uintptr(17))
- ExpectEq("identical to <uintptr> 17", m.Description())
-
- // Identical value
- err = m.Matches(uintptr(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uintptr
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Float32s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(float32(17))
- ExpectEq("identical to <float32> 17", m.Description())
-
- // Identical value
- err = m.Matches(float32(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType float32
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Float64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(float64(17))
- ExpectEq("identical to <float64> 17", m.Description())
-
- // Identical value
- err = m.Matches(float64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType float64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Complex64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(complex64(17))
- ExpectEq("identical to <complex64> (17+0i)", m.Description())
-
- // Identical value
- err = m.Matches(complex64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType complex64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Complex128s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(complex128(17))
- ExpectEq("identical to <complex128> (17+0i)", m.Description())
-
- // Identical value
- err = m.Matches(complex128(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType complex128
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) EmptyComparableArrays() {
- var m Matcher
- var err error
-
- m = IdenticalTo([0]int{})
- ExpectEq("identical to <[0]int> []", m.Description())
-
- // Identical value
- err = m.Matches([0]int{})
- ExpectEq(nil, err)
-
- // Length too long
- err = m.Matches([1]int{17})
- ExpectThat(err, Error(Equals("which is of type [1]int")))
-
- // Element type alias
- type myType int
- err = m.Matches([0]myType{})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [0]oglematchers_test.myType")))
-
- // Completely wrong element type
- err = m.Matches([0]int32{})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [0]int32")))
-}
-
-func (t *IdenticalToTest) NonEmptyComparableArrays() {
- var m Matcher
- var err error
-
- m = IdenticalTo([2]int{17, 19})
- ExpectEq("identical to <[2]int> [17 19]", m.Description())
-
- // Identical value
- err = m.Matches([2]int{17, 19})
- ExpectEq(nil, err)
-
- // Length too short
- err = m.Matches([1]int{17})
- ExpectThat(err, Error(Equals("which is of type [1]int")))
-
- // Length too long
- err = m.Matches([3]int{17, 19, 23})
- ExpectThat(err, Error(Equals("which is of type [3]int")))
-
- // First element different
- err = m.Matches([2]int{13, 19})
- ExpectThat(err, Error(Equals("")))
-
- // Second element different
- err = m.Matches([2]int{17, 23})
- ExpectThat(err, Error(Equals("")))
-
- // Element type alias
- type myType int
- err = m.Matches([2]myType{17, 19})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [2]oglematchers_test.myType")))
-
- // Completely wrong element type
- err = m.Matches([2]int32{17, 19})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [2]int32")))
-}
-
-func (t *IdenticalToTest) NonEmptyArraysOfComparableArrays() {
- var m Matcher
- var err error
-
- x := [2][2]int{
- [2]int{17, 19},
- [2]int{23, 29},
- }
- m = IdenticalTo(x)
- ExpectEq("identical to <[2][2]int> [[17 19] [23 29]]", m.Description())
-
- // Identical value
- err = m.Matches([2][2]int{[2]int{17, 19}, [2]int{23, 29}})
- ExpectEq(nil, err)
-
- // Outer length too short
- err = m.Matches([1][2]int{[2]int{17, 19}})
- ExpectThat(err, Error(Equals("which is of type [1][2]int")))
-
- // Inner length too short
- err = m.Matches([2][1]int{[1]int{17}, [1]int{23}})
- ExpectThat(err, Error(Equals("which is of type [2][1]int")))
-
- // First element different
- err = m.Matches([2][2]int{[2]int{13, 19}, [2]int{23, 29}})
- ExpectThat(err, Error(Equals("")))
-
- // Element type alias
- type myType int
- err = m.Matches([2][2]myType{[2]myType{17, 19}, [2]myType{23, 29}})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [2][2]oglematchers_test.myType")))
-}
-
-func (t *IdenticalToTest) NonComparableArrays() {
- x := [0]func(){}
- f := func() { IdenticalTo(x) }
- ExpectThat(f, Panics(HasSubstr("is not comparable")))
-}
-
-func (t *IdenticalToTest) ArraysOfNonComparableArrays() {
- x := [0][0]func(){}
- f := func() { IdenticalTo(x) }
- ExpectThat(f, Panics(HasSubstr("is not comparable")))
-}
-
-func (t *IdenticalToTest) Strings() {
- var m Matcher
- var err error
-
- m = IdenticalTo("taco")
- ExpectEq("identical to <string> taco", m.Description())
-
- // Identical value
- err = m.Matches("ta" + "co")
- ExpectEq(nil, err)
-
- // Type alias
- type myType string
- err = m.Matches(myType("taco"))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) ComparableStructs() {
- var m Matcher
- var err error
-
- type subStruct struct {
- i int
- }
-
- type myStruct struct {
- u uint
- s subStruct
- }
-
- x := myStruct{17, subStruct{19}}
- m = IdenticalTo(x)
- ExpectEq("identical to <oglematchers_test.myStruct> {17 {19}}", m.Description())
-
- // Identical value
- err = m.Matches(myStruct{17, subStruct{19}})
- ExpectEq(nil, err)
-
- // Wrong outer field
- err = m.Matches(myStruct{13, subStruct{19}})
- ExpectThat(err, Error(Equals("")))
-
- // Wrong inner field
- err = m.Matches(myStruct{17, subStruct{23}})
- ExpectThat(err, Error(Equals("")))
-
- // Type alias
- type myType myStruct
- err = m.Matches(myType{17, subStruct{19}})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) NonComparableStructs() {
- type subStruct struct {
- s []int
- }
-
- type myStruct struct {
- u uint
- s subStruct
- }
-
- x := myStruct{17, subStruct{[]int{19}}}
- f := func() { IdenticalTo(x) }
- ExpectThat(f, Panics(AllOf(HasSubstr("IdenticalTo"), HasSubstr("comparable"))))
-}
-
-func (t *IdenticalToTest) NilUnsafePointer() {
- var m Matcher
- var err error
-
- x := unsafe.Pointer(nil)
- m = IdenticalTo(x)
- ExpectEq(fmt.Sprintf("identical to <unsafe.Pointer> %v", x), m.Description())
-
- // Identical value
- err = m.Matches(unsafe.Pointer(nil))
- ExpectEq(nil, err)
-
- // Wrong value
- j := 17
- err = m.Matches(unsafe.Pointer(&j))
- ExpectThat(err, Error(Equals("")))
-
- // Type alias
- type myType unsafe.Pointer
- err = m.Matches(myType(unsafe.Pointer(nil)))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) NonNilUnsafePointer() {
- var m Matcher
- var err error
-
- i := 17
- x := unsafe.Pointer(&i)
- m = IdenticalTo(x)
- ExpectEq(fmt.Sprintf("identical to <unsafe.Pointer> %v", x), m.Description())
-
- // Identical value
- err = m.Matches(unsafe.Pointer(&i))
- ExpectEq(nil, err)
-
- // Nil value
- err = m.Matches(unsafe.Pointer(nil))
- ExpectThat(err, Error(Equals("")))
-
- // Wrong value
- j := 17
- err = m.Matches(unsafe.Pointer(&j))
- ExpectThat(err, Error(Equals("")))
-
- // Type alias
- type myType unsafe.Pointer
- err = m.Matches(myType(unsafe.Pointer(&i)))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) IntAlias() {
- var m Matcher
- var err error
-
- type intAlias int
-
- m = IdenticalTo(intAlias(17))
- ExpectEq("identical to <oglematchers_test.intAlias> 17", m.Description())
-
- // Identical value
- err = m.Matches(intAlias(17))
- ExpectEq(nil, err)
-
- // Int
- err = m.Matches(int(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal.go
deleted file mode 100644
index 8402cdeaf09..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "fmt"
- "reflect"
-)
-
-// LessOrEqual returns a matcher that matches integer, floating point, or
-// strings values v such that v <= x. Comparison is not defined between numeric
-// and string types, but is defined between all integer and floating point
-// types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// LessOrEqual will panic.
-func LessOrEqual(x interface{}) Matcher {
- desc := fmt.Sprintf("less than or equal to %v", x)
-
- // Special case: make it clear that strings are strings.
- if reflect.TypeOf(x).Kind() == reflect.String {
- desc = fmt.Sprintf("less than or equal to \"%s\"", x)
- }
-
- // Put LessThan last so that its error messages will be used in the event of
- // failure.
- return transformDescription(AnyOf(Equals(x), LessThan(x)), desc)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal_test.go
deleted file mode 100644
index bdb4a8866fb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_or_equal_test.go
+++ /dev/null
@@ -1,1079 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "math"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type LessOrEqualTest struct {
-}
-
-func init() { RegisterTestSuite(&LessOrEqualTest{}) }
-
-type leTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *LessOrEqualTest) checkTestCases(matcher Matcher, cases []leTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) IntegerCandidateBadTypes() {
- matcher := LessOrEqual(int(-150))
-
- cases := []leTestCase{
- leTestCase{true, false, true, "which is not comparable"},
- leTestCase{uintptr(17), false, true, "which is not comparable"},
- leTestCase{complex64(-151), false, true, "which is not comparable"},
- leTestCase{complex128(-151), false, true, "which is not comparable"},
- leTestCase{[...]int{-151}, false, true, "which is not comparable"},
- leTestCase{make(chan int), false, true, "which is not comparable"},
- leTestCase{func() {}, false, true, "which is not comparable"},
- leTestCase{map[int]int{}, false, true, "which is not comparable"},
- leTestCase{&leTestCase{}, false, true, "which is not comparable"},
- leTestCase{make([]int, 0), false, true, "which is not comparable"},
- leTestCase{"-151", false, true, "which is not comparable"},
- leTestCase{leTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) FloatCandidateBadTypes() {
- matcher := LessOrEqual(float32(-150))
-
- cases := []leTestCase{
- leTestCase{true, false, true, "which is not comparable"},
- leTestCase{uintptr(17), false, true, "which is not comparable"},
- leTestCase{complex64(-151), false, true, "which is not comparable"},
- leTestCase{complex128(-151), false, true, "which is not comparable"},
- leTestCase{[...]int{-151}, false, true, "which is not comparable"},
- leTestCase{make(chan int), false, true, "which is not comparable"},
- leTestCase{func() {}, false, true, "which is not comparable"},
- leTestCase{map[int]int{}, false, true, "which is not comparable"},
- leTestCase{&leTestCase{}, false, true, "which is not comparable"},
- leTestCase{make([]int, 0), false, true, "which is not comparable"},
- leTestCase{"-151", false, true, "which is not comparable"},
- leTestCase{leTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) StringCandidateBadTypes() {
- matcher := LessOrEqual("17")
-
- cases := []leTestCase{
- leTestCase{true, false, true, "which is not comparable"},
- leTestCase{int(0), false, true, "which is not comparable"},
- leTestCase{int8(0), false, true, "which is not comparable"},
- leTestCase{int16(0), false, true, "which is not comparable"},
- leTestCase{int32(0), false, true, "which is not comparable"},
- leTestCase{int64(0), false, true, "which is not comparable"},
- leTestCase{uint(0), false, true, "which is not comparable"},
- leTestCase{uint8(0), false, true, "which is not comparable"},
- leTestCase{uint16(0), false, true, "which is not comparable"},
- leTestCase{uint32(0), false, true, "which is not comparable"},
- leTestCase{uint64(0), false, true, "which is not comparable"},
- leTestCase{uintptr(17), false, true, "which is not comparable"},
- leTestCase{float32(0), false, true, "which is not comparable"},
- leTestCase{float64(0), false, true, "which is not comparable"},
- leTestCase{complex64(-151), false, true, "which is not comparable"},
- leTestCase{complex128(-151), false, true, "which is not comparable"},
- leTestCase{[...]int{-151}, false, true, "which is not comparable"},
- leTestCase{make(chan int), false, true, "which is not comparable"},
- leTestCase{func() {}, false, true, "which is not comparable"},
- leTestCase{map[int]int{}, false, true, "which is not comparable"},
- leTestCase{&leTestCase{}, false, true, "which is not comparable"},
- leTestCase{make([]int, 0), false, true, "which is not comparable"},
- leTestCase{leTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- LessOrEqual(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) NegativeIntegerLiteral() {
- matcher := LessOrEqual(-150)
- desc := matcher.Description()
- expectedDesc := "less than or equal to -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-(1 << 30), true, false, ""},
- leTestCase{-151, true, false, ""},
- leTestCase{-150, true, false, ""},
- leTestCase{-149, false, false, ""},
- leTestCase{0, false, false, ""},
- leTestCase{17, false, false, ""},
-
- leTestCase{int(-(1 << 30)), true, false, ""},
- leTestCase{int(-151), true, false, ""},
- leTestCase{int(-150), true, false, ""},
- leTestCase{int(-149), false, false, ""},
- leTestCase{int(0), false, false, ""},
- leTestCase{int(17), false, false, ""},
-
- leTestCase{int8(-127), false, false, ""},
- leTestCase{int8(0), false, false, ""},
- leTestCase{int8(17), false, false, ""},
-
- leTestCase{int16(-(1 << 14)), true, false, ""},
- leTestCase{int16(-151), true, false, ""},
- leTestCase{int16(-150), true, false, ""},
- leTestCase{int16(-149), false, false, ""},
- leTestCase{int16(0), false, false, ""},
- leTestCase{int16(17), false, false, ""},
-
- leTestCase{int32(-(1 << 30)), true, false, ""},
- leTestCase{int32(-151), true, false, ""},
- leTestCase{int32(-150), true, false, ""},
- leTestCase{int32(-149), false, false, ""},
- leTestCase{int32(0), false, false, ""},
- leTestCase{int32(17), false, false, ""},
-
- leTestCase{int64(-(1 << 30)), true, false, ""},
- leTestCase{int64(-151), true, false, ""},
- leTestCase{int64(-150), true, false, ""},
- leTestCase{int64(-149), false, false, ""},
- leTestCase{int64(0), false, false, ""},
- leTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint((1 << 32) - 151), false, false, ""},
- leTestCase{uint(0), false, false, ""},
- leTestCase{uint(17), false, false, ""},
-
- leTestCase{uint8(0), false, false, ""},
- leTestCase{uint8(17), false, false, ""},
- leTestCase{uint8(253), false, false, ""},
-
- leTestCase{uint16((1 << 16) - 151), false, false, ""},
- leTestCase{uint16(0), false, false, ""},
- leTestCase{uint16(17), false, false, ""},
-
- leTestCase{uint32((1 << 32) - 151), false, false, ""},
- leTestCase{uint32(0), false, false, ""},
- leTestCase{uint32(17), false, false, ""},
-
- leTestCase{uint64((1 << 64) - 151), false, false, ""},
- leTestCase{uint64(0), false, false, ""},
- leTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-(1 << 30)), true, false, ""},
- leTestCase{float32(-151), true, false, ""},
- leTestCase{float32(-150.1), true, false, ""},
- leTestCase{float32(-150), true, false, ""},
- leTestCase{float32(-149.9), false, false, ""},
- leTestCase{float32(0), false, false, ""},
- leTestCase{float32(17), false, false, ""},
- leTestCase{float32(160), false, false, ""},
-
- leTestCase{float64(-(1 << 30)), true, false, ""},
- leTestCase{float64(-151), true, false, ""},
- leTestCase{float64(-150.1), true, false, ""},
- leTestCase{float64(-150), true, false, ""},
- leTestCase{float64(-149.9), false, false, ""},
- leTestCase{float64(0), false, false, ""},
- leTestCase{float64(17), false, false, ""},
- leTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) ZeroIntegerLiteral() {
- matcher := LessOrEqual(0)
- desc := matcher.Description()
- expectedDesc := "less than or equal to 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-(1 << 30), true, false, ""},
- leTestCase{-1, true, false, ""},
- leTestCase{0, true, false, ""},
- leTestCase{1, false, false, ""},
- leTestCase{17, false, false, ""},
- leTestCase{(1 << 30), false, false, ""},
-
- leTestCase{int(-(1 << 30)), true, false, ""},
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(0), true, false, ""},
- leTestCase{int(1), false, false, ""},
- leTestCase{int(17), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(0), true, false, ""},
- leTestCase{int8(1), false, false, ""},
-
- leTestCase{int16(-(1 << 14)), true, false, ""},
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(1), false, false, ""},
- leTestCase{int16(17), false, false, ""},
-
- leTestCase{int32(-(1 << 30)), true, false, ""},
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(0), true, false, ""},
- leTestCase{int32(1), false, false, ""},
- leTestCase{int32(17), false, false, ""},
-
- leTestCase{int64(-(1 << 30)), true, false, ""},
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(0), true, false, ""},
- leTestCase{int64(1), false, false, ""},
- leTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint((1 << 32) - 1), false, false, ""},
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(1), false, false, ""},
- leTestCase{uint(17), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(1), false, false, ""},
- leTestCase{uint8(17), false, false, ""},
- leTestCase{uint8(253), false, false, ""},
-
- leTestCase{uint16((1 << 16) - 1), false, false, ""},
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(1), false, false, ""},
- leTestCase{uint16(17), false, false, ""},
-
- leTestCase{uint32((1 << 32) - 1), false, false, ""},
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(1), false, false, ""},
- leTestCase{uint32(17), false, false, ""},
-
- leTestCase{uint64((1 << 64) - 1), false, false, ""},
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(1), false, false, ""},
- leTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-(1 << 30)), true, false, ""},
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(-0.1), true, false, ""},
- leTestCase{float32(-0.0), true, false, ""},
- leTestCase{float32(0), true, false, ""},
- leTestCase{float32(0.1), false, false, ""},
- leTestCase{float32(17), false, false, ""},
- leTestCase{float32(160), false, false, ""},
-
- leTestCase{float64(-(1 << 30)), true, false, ""},
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(-0.1), true, false, ""},
- leTestCase{float64(-0), true, false, ""},
- leTestCase{float64(0), true, false, ""},
- leTestCase{float64(0.1), false, false, ""},
- leTestCase{float64(17), false, false, ""},
- leTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) PositiveIntegerLiteral() {
- matcher := LessOrEqual(150)
- desc := matcher.Description()
- expectedDesc := "less than or equal to 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{149, true, false, ""},
- leTestCase{150, true, false, ""},
- leTestCase{151, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(149), true, false, ""},
- leTestCase{int(150), true, false, ""},
- leTestCase{int(151), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(0), true, false, ""},
- leTestCase{int8(17), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(149), true, false, ""},
- leTestCase{int16(150), true, false, ""},
- leTestCase{int16(151), false, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(149), true, false, ""},
- leTestCase{int32(150), true, false, ""},
- leTestCase{int32(151), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(149), true, false, ""},
- leTestCase{int64(150), true, false, ""},
- leTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(149), true, false, ""},
- leTestCase{uint(150), true, false, ""},
- leTestCase{uint(151), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(127), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(149), true, false, ""},
- leTestCase{uint16(150), true, false, ""},
- leTestCase{uint16(151), false, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(149), true, false, ""},
- leTestCase{uint32(150), true, false, ""},
- leTestCase{uint32(151), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(149), true, false, ""},
- leTestCase{uint64(150), true, false, ""},
- leTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(149), true, false, ""},
- leTestCase{float32(149.9), true, false, ""},
- leTestCase{float32(150), true, false, ""},
- leTestCase{float32(150.1), false, false, ""},
- leTestCase{float32(151), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(149), true, false, ""},
- leTestCase{float64(149.9), true, false, ""},
- leTestCase{float64(150), true, false, ""},
- leTestCase{float64(150.1), false, false, ""},
- leTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) NegativeFloatLiteral() {
- matcher := LessOrEqual(-150.1)
- desc := matcher.Description()
- expectedDesc := "less than or equal to -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-(1 << 30), true, false, ""},
- leTestCase{-151, true, false, ""},
- leTestCase{-150.1, true, false, ""},
- leTestCase{-150, false, false, ""},
- leTestCase{-149, false, false, ""},
- leTestCase{0, false, false, ""},
- leTestCase{17, false, false, ""},
-
- leTestCase{int(-(1 << 30)), true, false, ""},
- leTestCase{int(-151), true, false, ""},
- leTestCase{int(-150), false, false, ""},
- leTestCase{int(-149), false, false, ""},
- leTestCase{int(0), false, false, ""},
- leTestCase{int(17), false, false, ""},
-
- leTestCase{int8(-127), false, false, ""},
- leTestCase{int8(0), false, false, ""},
- leTestCase{int8(17), false, false, ""},
-
- leTestCase{int16(-(1 << 14)), true, false, ""},
- leTestCase{int16(-151), true, false, ""},
- leTestCase{int16(-150), false, false, ""},
- leTestCase{int16(-149), false, false, ""},
- leTestCase{int16(0), false, false, ""},
- leTestCase{int16(17), false, false, ""},
-
- leTestCase{int32(-(1 << 30)), true, false, ""},
- leTestCase{int32(-151), true, false, ""},
- leTestCase{int32(-150), false, false, ""},
- leTestCase{int32(-149), false, false, ""},
- leTestCase{int32(0), false, false, ""},
- leTestCase{int32(17), false, false, ""},
-
- leTestCase{int64(-(1 << 30)), true, false, ""},
- leTestCase{int64(-151), true, false, ""},
- leTestCase{int64(-150), false, false, ""},
- leTestCase{int64(-149), false, false, ""},
- leTestCase{int64(0), false, false, ""},
- leTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint((1 << 32) - 151), false, false, ""},
- leTestCase{uint(0), false, false, ""},
- leTestCase{uint(17), false, false, ""},
-
- leTestCase{uint8(0), false, false, ""},
- leTestCase{uint8(17), false, false, ""},
- leTestCase{uint8(253), false, false, ""},
-
- leTestCase{uint16((1 << 16) - 151), false, false, ""},
- leTestCase{uint16(0), false, false, ""},
- leTestCase{uint16(17), false, false, ""},
-
- leTestCase{uint32((1 << 32) - 151), false, false, ""},
- leTestCase{uint32(0), false, false, ""},
- leTestCase{uint32(17), false, false, ""},
-
- leTestCase{uint64((1 << 64) - 151), false, false, ""},
- leTestCase{uint64(0), false, false, ""},
- leTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-(1 << 30)), true, false, ""},
- leTestCase{float32(-151), true, false, ""},
- leTestCase{float32(-150.2), true, false, ""},
- leTestCase{float32(-150.1), true, false, ""},
- leTestCase{float32(-150), false, false, ""},
- leTestCase{float32(0), false, false, ""},
- leTestCase{float32(17), false, false, ""},
- leTestCase{float32(160), false, false, ""},
-
- leTestCase{float64(-(1 << 30)), true, false, ""},
- leTestCase{float64(-151), true, false, ""},
- leTestCase{float64(-150.2), true, false, ""},
- leTestCase{float64(-150.1), true, false, ""},
- leTestCase{float64(-150), false, false, ""},
- leTestCase{float64(0), false, false, ""},
- leTestCase{float64(17), false, false, ""},
- leTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) PositiveFloatLiteral() {
- matcher := LessOrEqual(149.9)
- desc := matcher.Description()
- expectedDesc := "less than or equal to 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{149, true, false, ""},
- leTestCase{149.9, true, false, ""},
- leTestCase{150, false, false, ""},
- leTestCase{151, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(149), true, false, ""},
- leTestCase{int(150), false, false, ""},
- leTestCase{int(151), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(0), true, false, ""},
- leTestCase{int8(17), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(149), true, false, ""},
- leTestCase{int16(150), false, false, ""},
- leTestCase{int16(151), false, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(149), true, false, ""},
- leTestCase{int32(150), false, false, ""},
- leTestCase{int32(151), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(149), true, false, ""},
- leTestCase{int64(150), false, false, ""},
- leTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(149), true, false, ""},
- leTestCase{uint(150), false, false, ""},
- leTestCase{uint(151), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(127), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(149), true, false, ""},
- leTestCase{uint16(150), false, false, ""},
- leTestCase{uint16(151), false, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(149), true, false, ""},
- leTestCase{uint32(150), false, false, ""},
- leTestCase{uint32(151), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(149), true, false, ""},
- leTestCase{uint64(150), false, false, ""},
- leTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(149), true, false, ""},
- leTestCase{float32(149.8), true, false, ""},
- leTestCase{float32(149.9), true, false, ""},
- leTestCase{float32(150), false, false, ""},
- leTestCase{float32(151), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(149), true, false, ""},
- leTestCase{float64(149.8), true, false, ""},
- leTestCase{float64(149.9), true, false, ""},
- leTestCase{float64(150), false, false, ""},
- leTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessOrEqual(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{kTwoTo25 + 0, true, false, ""},
- leTestCase{kTwoTo25 + 1, true, false, ""},
- leTestCase{kTwoTo25 + 2, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(kTwoTo25 + 0), true, false, ""},
- leTestCase{int(kTwoTo25 + 1), true, false, ""},
- leTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 0), true, false, ""},
- leTestCase{int32(kTwoTo25 + 1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 0), true, false, ""},
- leTestCase{int64(kTwoTo25 + 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(kTwoTo25 - 2), true, false, ""},
- leTestCase{float32(kTwoTo25 - 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 0), true, false, ""},
- leTestCase{float32(kTwoTo25 + 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 2), true, false, ""},
- leTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo25 - 2), true, false, ""},
- leTestCase{float64(kTwoTo25 - 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 0), true, false, ""},
- leTestCase{float64(kTwoTo25 + 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 2), false, false, ""},
- leTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessOrEqual(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{1 << 30, true, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(math.MaxInt32), true, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(math.MaxInt32), true, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo54 - 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 0), true, false, ""},
- leTestCase{int64(kTwoTo54 + 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(math.MaxUint32), true, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(math.MaxUint32), true, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo54 - 2), true, false, ""},
- leTestCase{float64(kTwoTo54 - 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 0), true, false, ""},
- leTestCase{float64(kTwoTo54 + 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 2), true, false, ""},
- leTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessOrEqual(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{kTwoTo25 + 0, true, false, ""},
- leTestCase{kTwoTo25 + 1, true, false, ""},
- leTestCase{kTwoTo25 + 2, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(kTwoTo25 + 0), true, false, ""},
- leTestCase{int(kTwoTo25 + 1), true, false, ""},
- leTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 0), true, false, ""},
- leTestCase{int32(kTwoTo25 + 1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 0), true, false, ""},
- leTestCase{int64(kTwoTo25 + 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(kTwoTo25 - 2), true, false, ""},
- leTestCase{float32(kTwoTo25 - 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 0), true, false, ""},
- leTestCase{float32(kTwoTo25 + 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 2), true, false, ""},
- leTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo25 - 2), true, false, ""},
- leTestCase{float64(kTwoTo25 - 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 0), true, false, ""},
- leTestCase{float64(kTwoTo25 + 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 2), false, false, ""},
- leTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessOrEqual(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{1 << 30, true, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(math.MaxInt32), true, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(math.MaxInt32), true, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo54 - 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 0), true, false, ""},
- leTestCase{int64(kTwoTo54 + 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(math.MaxUint32), true, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(math.MaxUint32), true, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo54 - 2), true, false, ""},
- leTestCase{float64(kTwoTo54 - 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 0), true, false, ""},
- leTestCase{float64(kTwoTo54 + 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 2), true, false, ""},
- leTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessOrEqual(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo25 - 2), true, false, ""},
- leTestCase{int64(kTwoTo25 - 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 0), true, false, ""},
- leTestCase{int64(kTwoTo25 + 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 2), true, false, ""},
- leTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo25 - 2), true, false, ""},
- leTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(kTwoTo25 - 2), true, false, ""},
- leTestCase{float32(kTwoTo25 - 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 0), true, false, ""},
- leTestCase{float32(kTwoTo25 + 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 2), true, false, ""},
- leTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo25 - 2), true, false, ""},
- leTestCase{float64(kTwoTo25 - 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 0), true, false, ""},
- leTestCase{float64(kTwoTo25 + 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 2), true, false, ""},
- leTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessOrEqual(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo54 - 2), true, false, ""},
- leTestCase{int64(kTwoTo54 - 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 0), true, false, ""},
- leTestCase{int64(kTwoTo54 + 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 2), true, false, ""},
- leTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 2), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Floating point.
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo54 - 2), true, false, ""},
- leTestCase{float64(kTwoTo54 - 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 0), true, false, ""},
- leTestCase{float64(kTwoTo54 + 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 2), true, false, ""},
- leTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) EmptyString() {
- matcher := LessOrEqual("")
- desc := matcher.Description()
- expectedDesc := "less than or equal to \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- leTestCase{"", true, false, ""},
- leTestCase{"\x00", false, false, ""},
- leTestCase{"a", false, false, ""},
- leTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) SingleNullByte() {
- matcher := LessOrEqual("\x00")
- desc := matcher.Description()
- expectedDesc := "less than or equal to \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- leTestCase{"", true, false, ""},
- leTestCase{"\x00", true, false, ""},
- leTestCase{"\x00\x00", false, false, ""},
- leTestCase{"a", false, false, ""},
- leTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) LongerString() {
- matcher := LessOrEqual("foo\x00")
- desc := matcher.Description()
- expectedDesc := "less than or equal to \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- leTestCase{"", true, false, ""},
- leTestCase{"\x00", true, false, ""},
- leTestCase{"bar", true, false, ""},
- leTestCase{"foo", true, false, ""},
- leTestCase{"foo\x00", true, false, ""},
- leTestCase{"foo\x00\x00", false, false, ""},
- leTestCase{"fooa", false, false, ""},
- leTestCase{"qux", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than.go
deleted file mode 100644
index 8258e45d99d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
-)
-
-// LessThan returns a matcher that matches integer, floating point, or strings
-// values v such that v < x. Comparison is not defined between numeric and
-// string types, but is defined between all integer and floating point types.
-//
-// x must itself be an integer, floating point, or string type; otherwise,
-// LessThan will panic.
-func LessThan(x interface{}) Matcher {
- v := reflect.ValueOf(x)
- kind := v.Kind()
-
- switch {
- case isInteger(v):
- case isFloat(v):
- case kind == reflect.String:
-
- default:
- panic(fmt.Sprintf("LessThan: unexpected kind %v", kind))
- }
-
- return &lessThanMatcher{v}
-}
-
-type lessThanMatcher struct {
- limit reflect.Value
-}
-
-func (m *lessThanMatcher) Description() string {
- // Special case: make it clear that strings are strings.
- if m.limit.Kind() == reflect.String {
- return fmt.Sprintf("less than \"%s\"", m.limit.String())
- }
-
- return fmt.Sprintf("less than %v", m.limit.Interface())
-}
-
-func compareIntegers(v1, v2 reflect.Value) (err error) {
- err = errors.New("")
-
- switch {
- case isSignedInteger(v1) && isSignedInteger(v2):
- if v1.Int() < v2.Int() {
- err = nil
- }
- return
-
- case isSignedInteger(v1) && isUnsignedInteger(v2):
- if v1.Int() < 0 || uint64(v1.Int()) < v2.Uint() {
- err = nil
- }
- return
-
- case isUnsignedInteger(v1) && isSignedInteger(v2):
- if v1.Uint() <= math.MaxInt64 && int64(v1.Uint()) < v2.Int() {
- err = nil
- }
- return
-
- case isUnsignedInteger(v1) && isUnsignedInteger(v2):
- if v1.Uint() < v2.Uint() {
- err = nil
- }
- return
- }
-
- panic(fmt.Sprintf("compareIntegers: %v %v", v1, v2))
-}
-
-func getFloat(v reflect.Value) float64 {
- switch {
- case isSignedInteger(v):
- return float64(v.Int())
-
- case isUnsignedInteger(v):
- return float64(v.Uint())
-
- case isFloat(v):
- return v.Float()
- }
-
- panic(fmt.Sprintf("getFloat: %v", v))
-}
-
-func (m *lessThanMatcher) Matches(c interface{}) (err error) {
- v1 := reflect.ValueOf(c)
- v2 := m.limit
-
- err = errors.New("")
-
- // Handle strings as a special case.
- if v1.Kind() == reflect.String && v2.Kind() == reflect.String {
- if v1.String() < v2.String() {
- err = nil
- }
- return
- }
-
- // If we get here, we require that we are dealing with integers or floats.
- v1Legal := isInteger(v1) || isFloat(v1)
- v2Legal := isInteger(v2) || isFloat(v2)
- if !v1Legal || !v2Legal {
- err = NewFatalError("which is not comparable")
- return
- }
-
- // Handle the various comparison cases.
- switch {
- // Both integers
- case isInteger(v1) && isInteger(v2):
- return compareIntegers(v1, v2)
-
- // At least one float32
- case v1.Kind() == reflect.Float32 || v2.Kind() == reflect.Float32:
- if float32(getFloat(v1)) < float32(getFloat(v2)) {
- err = nil
- }
- return
-
- // At least one float64
- case v1.Kind() == reflect.Float64 || v2.Kind() == reflect.Float64:
- if getFloat(v1) < getFloat(v2) {
- err = nil
- }
- return
- }
-
- // We shouldn't get here.
- panic(fmt.Sprintf("lessThanMatcher.Matches: Shouldn't get here: %v %v", v1, v2))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than_test.go
deleted file mode 100644
index 6ee6e9f2e63..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/less_than_test.go
+++ /dev/null
@@ -1,1059 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "math"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type LessThanTest struct {
-}
-
-func init() { RegisterTestSuite(&LessThanTest{}) }
-
-type ltTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *LessThanTest) checkTestCases(matcher Matcher, cases []ltTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) IntegerCandidateBadTypes() {
- matcher := LessThan(int(-150))
-
- cases := []ltTestCase{
- ltTestCase{true, false, true, "which is not comparable"},
- ltTestCase{uintptr(17), false, true, "which is not comparable"},
- ltTestCase{complex64(-151), false, true, "which is not comparable"},
- ltTestCase{complex128(-151), false, true, "which is not comparable"},
- ltTestCase{[...]int{-151}, false, true, "which is not comparable"},
- ltTestCase{make(chan int), false, true, "which is not comparable"},
- ltTestCase{func() {}, false, true, "which is not comparable"},
- ltTestCase{map[int]int{}, false, true, "which is not comparable"},
- ltTestCase{&ltTestCase{}, false, true, "which is not comparable"},
- ltTestCase{make([]int, 0), false, true, "which is not comparable"},
- ltTestCase{"-151", false, true, "which is not comparable"},
- ltTestCase{ltTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) FloatCandidateBadTypes() {
- matcher := LessThan(float32(-150))
-
- cases := []ltTestCase{
- ltTestCase{true, false, true, "which is not comparable"},
- ltTestCase{uintptr(17), false, true, "which is not comparable"},
- ltTestCase{complex64(-151), false, true, "which is not comparable"},
- ltTestCase{complex128(-151), false, true, "which is not comparable"},
- ltTestCase{[...]int{-151}, false, true, "which is not comparable"},
- ltTestCase{make(chan int), false, true, "which is not comparable"},
- ltTestCase{func() {}, false, true, "which is not comparable"},
- ltTestCase{map[int]int{}, false, true, "which is not comparable"},
- ltTestCase{&ltTestCase{}, false, true, "which is not comparable"},
- ltTestCase{make([]int, 0), false, true, "which is not comparable"},
- ltTestCase{"-151", false, true, "which is not comparable"},
- ltTestCase{ltTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) StringCandidateBadTypes() {
- matcher := LessThan("17")
-
- cases := []ltTestCase{
- ltTestCase{true, false, true, "which is not comparable"},
- ltTestCase{int(0), false, true, "which is not comparable"},
- ltTestCase{int8(0), false, true, "which is not comparable"},
- ltTestCase{int16(0), false, true, "which is not comparable"},
- ltTestCase{int32(0), false, true, "which is not comparable"},
- ltTestCase{int64(0), false, true, "which is not comparable"},
- ltTestCase{uint(0), false, true, "which is not comparable"},
- ltTestCase{uint8(0), false, true, "which is not comparable"},
- ltTestCase{uint16(0), false, true, "which is not comparable"},
- ltTestCase{uint32(0), false, true, "which is not comparable"},
- ltTestCase{uint64(0), false, true, "which is not comparable"},
- ltTestCase{uintptr(17), false, true, "which is not comparable"},
- ltTestCase{float32(0), false, true, "which is not comparable"},
- ltTestCase{float64(0), false, true, "which is not comparable"},
- ltTestCase{complex64(-151), false, true, "which is not comparable"},
- ltTestCase{complex128(-151), false, true, "which is not comparable"},
- ltTestCase{[...]int{-151}, false, true, "which is not comparable"},
- ltTestCase{make(chan int), false, true, "which is not comparable"},
- ltTestCase{func() {}, false, true, "which is not comparable"},
- ltTestCase{map[int]int{}, false, true, "which is not comparable"},
- ltTestCase{&ltTestCase{}, false, true, "which is not comparable"},
- ltTestCase{make([]int, 0), false, true, "which is not comparable"},
- ltTestCase{ltTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- LessThan(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) NegativeIntegerLiteral() {
- matcher := LessThan(-150)
- desc := matcher.Description()
- expectedDesc := "less than -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-(1 << 30), true, false, ""},
- ltTestCase{-151, true, false, ""},
- ltTestCase{-150, false, false, ""},
- ltTestCase{0, false, false, ""},
- ltTestCase{17, false, false, ""},
-
- ltTestCase{int(-(1 << 30)), true, false, ""},
- ltTestCase{int(-151), true, false, ""},
- ltTestCase{int(-150), false, false, ""},
- ltTestCase{int(0), false, false, ""},
- ltTestCase{int(17), false, false, ""},
-
- ltTestCase{int8(-127), false, false, ""},
- ltTestCase{int8(0), false, false, ""},
- ltTestCase{int8(17), false, false, ""},
-
- ltTestCase{int16(-(1 << 14)), true, false, ""},
- ltTestCase{int16(-151), true, false, ""},
- ltTestCase{int16(-150), false, false, ""},
- ltTestCase{int16(0), false, false, ""},
- ltTestCase{int16(17), false, false, ""},
-
- ltTestCase{int32(-(1 << 30)), true, false, ""},
- ltTestCase{int32(-151), true, false, ""},
- ltTestCase{int32(-150), false, false, ""},
- ltTestCase{int32(0), false, false, ""},
- ltTestCase{int32(17), false, false, ""},
-
- ltTestCase{int64(-(1 << 30)), true, false, ""},
- ltTestCase{int64(-151), true, false, ""},
- ltTestCase{int64(-150), false, false, ""},
- ltTestCase{int64(0), false, false, ""},
- ltTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint((1 << 32) - 151), false, false, ""},
- ltTestCase{uint(0), false, false, ""},
- ltTestCase{uint(17), false, false, ""},
-
- ltTestCase{uint8(0), false, false, ""},
- ltTestCase{uint8(17), false, false, ""},
- ltTestCase{uint8(253), false, false, ""},
-
- ltTestCase{uint16((1 << 16) - 151), false, false, ""},
- ltTestCase{uint16(0), false, false, ""},
- ltTestCase{uint16(17), false, false, ""},
-
- ltTestCase{uint32((1 << 32) - 151), false, false, ""},
- ltTestCase{uint32(0), false, false, ""},
- ltTestCase{uint32(17), false, false, ""},
-
- ltTestCase{uint64((1 << 64) - 151), false, false, ""},
- ltTestCase{uint64(0), false, false, ""},
- ltTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-(1 << 30)), true, false, ""},
- ltTestCase{float32(-151), true, false, ""},
- ltTestCase{float32(-150.1), true, false, ""},
- ltTestCase{float32(-150), false, false, ""},
- ltTestCase{float32(-149.9), false, false, ""},
- ltTestCase{float32(0), false, false, ""},
- ltTestCase{float32(17), false, false, ""},
- ltTestCase{float32(160), false, false, ""},
-
- ltTestCase{float64(-(1 << 30)), true, false, ""},
- ltTestCase{float64(-151), true, false, ""},
- ltTestCase{float64(-150.1), true, false, ""},
- ltTestCase{float64(-150), false, false, ""},
- ltTestCase{float64(-149.9), false, false, ""},
- ltTestCase{float64(0), false, false, ""},
- ltTestCase{float64(17), false, false, ""},
- ltTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) ZeroIntegerLiteral() {
- matcher := LessThan(0)
- desc := matcher.Description()
- expectedDesc := "less than 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-(1 << 30), true, false, ""},
- ltTestCase{-1, true, false, ""},
- ltTestCase{0, false, false, ""},
- ltTestCase{1, false, false, ""},
- ltTestCase{17, false, false, ""},
- ltTestCase{(1 << 30), false, false, ""},
-
- ltTestCase{int(-(1 << 30)), true, false, ""},
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(0), false, false, ""},
- ltTestCase{int(1), false, false, ""},
- ltTestCase{int(17), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(0), false, false, ""},
- ltTestCase{int8(1), false, false, ""},
-
- ltTestCase{int16(-(1 << 14)), true, false, ""},
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), false, false, ""},
- ltTestCase{int16(1), false, false, ""},
- ltTestCase{int16(17), false, false, ""},
-
- ltTestCase{int32(-(1 << 30)), true, false, ""},
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(0), false, false, ""},
- ltTestCase{int32(1), false, false, ""},
- ltTestCase{int32(17), false, false, ""},
-
- ltTestCase{int64(-(1 << 30)), true, false, ""},
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(0), false, false, ""},
- ltTestCase{int64(1), false, false, ""},
- ltTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint((1 << 32) - 1), false, false, ""},
- ltTestCase{uint(0), false, false, ""},
- ltTestCase{uint(17), false, false, ""},
-
- ltTestCase{uint8(0), false, false, ""},
- ltTestCase{uint8(17), false, false, ""},
- ltTestCase{uint8(253), false, false, ""},
-
- ltTestCase{uint16((1 << 16) - 1), false, false, ""},
- ltTestCase{uint16(0), false, false, ""},
- ltTestCase{uint16(17), false, false, ""},
-
- ltTestCase{uint32((1 << 32) - 1), false, false, ""},
- ltTestCase{uint32(0), false, false, ""},
- ltTestCase{uint32(17), false, false, ""},
-
- ltTestCase{uint64((1 << 64) - 1), false, false, ""},
- ltTestCase{uint64(0), false, false, ""},
- ltTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-(1 << 30)), true, false, ""},
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(-0.1), true, false, ""},
- ltTestCase{float32(-0.0), false, false, ""},
- ltTestCase{float32(0), false, false, ""},
- ltTestCase{float32(0.1), false, false, ""},
- ltTestCase{float32(17), false, false, ""},
- ltTestCase{float32(160), false, false, ""},
-
- ltTestCase{float64(-(1 << 30)), true, false, ""},
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(-0.1), true, false, ""},
- ltTestCase{float64(-0), false, false, ""},
- ltTestCase{float64(0), false, false, ""},
- ltTestCase{float64(17), false, false, ""},
- ltTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) PositiveIntegerLiteral() {
- matcher := LessThan(150)
- desc := matcher.Description()
- expectedDesc := "less than 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{149, true, false, ""},
- ltTestCase{150, false, false, ""},
- ltTestCase{151, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(149), true, false, ""},
- ltTestCase{int(150), false, false, ""},
- ltTestCase{int(151), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(0), true, false, ""},
- ltTestCase{int8(17), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(149), true, false, ""},
- ltTestCase{int16(150), false, false, ""},
- ltTestCase{int16(151), false, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(149), true, false, ""},
- ltTestCase{int32(150), false, false, ""},
- ltTestCase{int32(151), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(149), true, false, ""},
- ltTestCase{int64(150), false, false, ""},
- ltTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(149), true, false, ""},
- ltTestCase{uint(150), false, false, ""},
- ltTestCase{uint(151), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(127), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(149), true, false, ""},
- ltTestCase{uint16(150), false, false, ""},
- ltTestCase{uint16(151), false, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(149), true, false, ""},
- ltTestCase{uint32(150), false, false, ""},
- ltTestCase{uint32(151), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(149), true, false, ""},
- ltTestCase{uint64(150), false, false, ""},
- ltTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(149), true, false, ""},
- ltTestCase{float32(149.9), true, false, ""},
- ltTestCase{float32(150), false, false, ""},
- ltTestCase{float32(150.1), false, false, ""},
- ltTestCase{float32(151), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(149), true, false, ""},
- ltTestCase{float64(149.9), true, false, ""},
- ltTestCase{float64(150), false, false, ""},
- ltTestCase{float64(150.1), false, false, ""},
- ltTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) NegativeFloatLiteral() {
- matcher := LessThan(-150.1)
- desc := matcher.Description()
- expectedDesc := "less than -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-(1 << 30), true, false, ""},
- ltTestCase{-151, true, false, ""},
- ltTestCase{-150, false, false, ""},
- ltTestCase{0, false, false, ""},
- ltTestCase{17, false, false, ""},
-
- ltTestCase{int(-(1 << 30)), true, false, ""},
- ltTestCase{int(-151), true, false, ""},
- ltTestCase{int(-150), false, false, ""},
- ltTestCase{int(0), false, false, ""},
- ltTestCase{int(17), false, false, ""},
-
- ltTestCase{int8(-127), false, false, ""},
- ltTestCase{int8(0), false, false, ""},
- ltTestCase{int8(17), false, false, ""},
-
- ltTestCase{int16(-(1 << 14)), true, false, ""},
- ltTestCase{int16(-151), true, false, ""},
- ltTestCase{int16(-150), false, false, ""},
- ltTestCase{int16(0), false, false, ""},
- ltTestCase{int16(17), false, false, ""},
-
- ltTestCase{int32(-(1 << 30)), true, false, ""},
- ltTestCase{int32(-151), true, false, ""},
- ltTestCase{int32(-150), false, false, ""},
- ltTestCase{int32(0), false, false, ""},
- ltTestCase{int32(17), false, false, ""},
-
- ltTestCase{int64(-(1 << 30)), true, false, ""},
- ltTestCase{int64(-151), true, false, ""},
- ltTestCase{int64(-150), false, false, ""},
- ltTestCase{int64(0), false, false, ""},
- ltTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint((1 << 32) - 151), false, false, ""},
- ltTestCase{uint(0), false, false, ""},
- ltTestCase{uint(17), false, false, ""},
-
- ltTestCase{uint8(0), false, false, ""},
- ltTestCase{uint8(17), false, false, ""},
- ltTestCase{uint8(253), false, false, ""},
-
- ltTestCase{uint16((1 << 16) - 151), false, false, ""},
- ltTestCase{uint16(0), false, false, ""},
- ltTestCase{uint16(17), false, false, ""},
-
- ltTestCase{uint32((1 << 32) - 151), false, false, ""},
- ltTestCase{uint32(0), false, false, ""},
- ltTestCase{uint32(17), false, false, ""},
-
- ltTestCase{uint64((1 << 64) - 151), false, false, ""},
- ltTestCase{uint64(0), false, false, ""},
- ltTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-(1 << 30)), true, false, ""},
- ltTestCase{float32(-151), true, false, ""},
- ltTestCase{float32(-150.2), true, false, ""},
- ltTestCase{float32(-150.1), false, false, ""},
- ltTestCase{float32(-150), false, false, ""},
- ltTestCase{float32(0), false, false, ""},
- ltTestCase{float32(17), false, false, ""},
- ltTestCase{float32(160), false, false, ""},
-
- ltTestCase{float64(-(1 << 30)), true, false, ""},
- ltTestCase{float64(-151), true, false, ""},
- ltTestCase{float64(-150.2), true, false, ""},
- ltTestCase{float64(-150.1), false, false, ""},
- ltTestCase{float64(-150), false, false, ""},
- ltTestCase{float64(0), false, false, ""},
- ltTestCase{float64(17), false, false, ""},
- ltTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) PositiveFloatLiteral() {
- matcher := LessThan(149.9)
- desc := matcher.Description()
- expectedDesc := "less than 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{149, true, false, ""},
- ltTestCase{150, false, false, ""},
- ltTestCase{151, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(149), true, false, ""},
- ltTestCase{int(150), false, false, ""},
- ltTestCase{int(151), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(0), true, false, ""},
- ltTestCase{int8(17), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(149), true, false, ""},
- ltTestCase{int16(150), false, false, ""},
- ltTestCase{int16(151), false, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(149), true, false, ""},
- ltTestCase{int32(150), false, false, ""},
- ltTestCase{int32(151), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(149), true, false, ""},
- ltTestCase{int64(150), false, false, ""},
- ltTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(149), true, false, ""},
- ltTestCase{uint(150), false, false, ""},
- ltTestCase{uint(151), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(127), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(149), true, false, ""},
- ltTestCase{uint16(150), false, false, ""},
- ltTestCase{uint16(151), false, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(149), true, false, ""},
- ltTestCase{uint32(150), false, false, ""},
- ltTestCase{uint32(151), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(149), true, false, ""},
- ltTestCase{uint64(150), false, false, ""},
- ltTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(149), true, false, ""},
- ltTestCase{float32(149.8), true, false, ""},
- ltTestCase{float32(149.9), false, false, ""},
- ltTestCase{float32(150), false, false, ""},
- ltTestCase{float32(151), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(149), true, false, ""},
- ltTestCase{float64(149.8), true, false, ""},
- ltTestCase{float64(149.9), false, false, ""},
- ltTestCase{float64(150), false, false, ""},
- ltTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessThan(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{kTwoTo25 + 0, true, false, ""},
- ltTestCase{kTwoTo25 + 1, false, false, ""},
- ltTestCase{kTwoTo25 + 2, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 1), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessThan(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{1 << 30, true, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(math.MaxInt32), true, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(math.MaxInt32), true, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessThan(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{kTwoTo25 + 0, true, false, ""},
- ltTestCase{kTwoTo25 + 1, false, false, ""},
- ltTestCase{kTwoTo25 + 2, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 1), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessThan(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{1 << 30, true, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(math.MaxInt32), true, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(math.MaxInt32), true, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessThan(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{int64(kTwoTo25 - 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 0), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{uint64(kTwoTo25 - 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessThan(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Floating point.
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) EmptyString() {
- matcher := LessThan("")
- desc := matcher.Description()
- expectedDesc := "less than \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- ltTestCase{"", false, false, ""},
- ltTestCase{"\x00", false, false, ""},
- ltTestCase{"a", false, false, ""},
- ltTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) SingleNullByte() {
- matcher := LessThan("\x00")
- desc := matcher.Description()
- expectedDesc := "less than \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- ltTestCase{"", true, false, ""},
- ltTestCase{"\x00", false, false, ""},
- ltTestCase{"a", false, false, ""},
- ltTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) LongerString() {
- matcher := LessThan("foo\x00")
- desc := matcher.Description()
- expectedDesc := "less than \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- ltTestCase{"", true, false, ""},
- ltTestCase{"\x00", true, false, ""},
- ltTestCase{"bar", true, false, ""},
- ltTestCase{"foo", true, false, ""},
- ltTestCase{"foo\x00", false, false, ""},
- ltTestCase{"fooa", false, false, ""},
- ltTestCase{"qux", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matcher.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matcher.go
deleted file mode 100644
index 8cf1cbbc963..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matcher.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package oglematchers provides a set of matchers useful in a testing or
-// mocking framework. These matchers are inspired by and mostly compatible with
-// Google Test for C++ and Google JS Test.
-//
-// This package is used by github.com/jacobsa/ogletest and
-// github.com/jacobsa/oglemock, which may be more directly useful if you're not
-// writing your own testing package or defining your own matchers.
-package oglematchers
-
-// A Matcher is some predicate implicitly defining a set of values that it
-// matches. For example, GreaterThan(17) matches all numeric values greater
-// than 17, and HasSubstr("taco") matches all strings with the substring
-// "taco".
-//
-// Matchers are typically exposed to tests via constructor functions like
-// HasSubstr. In order to implement such a function you can either define your
-// own matcher type or use NewMatcher.
-type Matcher interface {
- // Check whether the supplied value belongs to the the set defined by the
- // matcher. Return a non-nil error if and only if it does not.
- //
- // The error describes why the value doesn't match. The error text is a
- // relative clause that is suitable for being placed after the value. For
- // example, a predicate that matches strings with a particular substring may,
- // when presented with a numerical value, return the following error text:
- //
- // "which is not a string"
- //
- // Then the failure message may look like:
- //
- // Expected: has substring "taco"
- // Actual: 17, which is not a string
- //
- // If the error is self-apparent based on the description of the matcher, the
- // error text may be empty (but the error still non-nil). For example:
- //
- // Expected: 17
- // Actual: 19
- //
- // If you are implementing a new matcher, see also the documentation on
- // FatalError.
- Matches(candidate interface{}) error
-
- // Description returns a string describing the property that values matching
- // this matcher have, as a verb phrase where the subject is the value. For
- // example, "is greather than 17" or "has substring "taco"".
- Description() string
-}
-
-// FatalError is an implementation of the error interface that may be returned
-// from matchers, indicating the error should be propagated. Returning a
-// *FatalError indicates that the matcher doesn't process values of the
-// supplied type, or otherwise doesn't know how to handle the value.
-//
-// For example, if GreaterThan(17) returned false for the value "taco" without
-// a fatal error, then Not(GreaterThan(17)) would return true. This is
-// technically correct, but is surprising and may mask failures where the wrong
-// sort of matcher is accidentally used. Instead, GreaterThan(17) can return a
-// fatal error, which will be propagated by Not().
-type FatalError struct {
- errorText string
-}
-
-// NewFatalError creates a FatalError struct with the supplied error text.
-func NewFatalError(s string) *FatalError {
- return &FatalError{s}
-}
-
-func (e *FatalError) Error() string {
- return e.errorText
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp.go
deleted file mode 100644
index 1ed63f30c4e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
- "regexp"
-)
-
-// MatchesRegexp returns a matcher that matches strings and byte slices whose
-// contents match the supplied regular expression. The semantics are those of
-// regexp.Match. In particular, that means the match is not implicitly anchored
-// to the ends of the string: MatchesRegexp("bar") will match "foo bar baz".
-func MatchesRegexp(pattern string) Matcher {
- re, err := regexp.Compile(pattern)
- if err != nil {
- panic("MatchesRegexp: " + err.Error())
- }
-
- return &matchesRegexpMatcher{re}
-}
-
-type matchesRegexpMatcher struct {
- re *regexp.Regexp
-}
-
-func (m *matchesRegexpMatcher) Description() string {
- return fmt.Sprintf("matches regexp \"%s\"", m.re.String())
-}
-
-func (m *matchesRegexpMatcher) Matches(c interface{}) (err error) {
- v := reflect.ValueOf(c)
- isString := v.Kind() == reflect.String
- isByteSlice := v.Kind() == reflect.Slice && v.Elem().Kind() == reflect.Uint8
-
- err = errors.New("")
-
- switch {
- case isString:
- if m.re.MatchString(v.String()) {
- err = nil
- }
-
- case isByteSlice:
- if m.re.Match(v.Bytes()) {
- err = nil
- }
-
- default:
- err = NewFatalError("which is not a string or []byte")
- }
-
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp_test.go
deleted file mode 100644
index 7b69ce80105..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/matches_regexp_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type MatchesRegexpTest struct {
-}
-
-func init() { RegisterTestSuite(&MatchesRegexpTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *MatchesRegexpTest) Description() {
- m := MatchesRegexp("foo.*bar")
- ExpectEq("matches regexp \"foo.*bar\"", m.Description())
-}
-
-func (t *MatchesRegexpTest) InvalidRegexp() {
- ExpectThat(
- func() { MatchesRegexp("(foo") },
- Panics(HasSubstr("missing closing )")))
-}
-
-func (t *MatchesRegexpTest) CandidateIsNil() {
- m := MatchesRegexp("")
- err := m.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a string or []byte")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *MatchesRegexpTest) CandidateIsInteger() {
- m := MatchesRegexp("")
- err := m.Matches(17)
-
- ExpectThat(err, Error(Equals("which is not a string or []byte")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *MatchesRegexpTest) NonMatchingCandidates() {
- m := MatchesRegexp("fo[op]\\s+x")
- var err error
-
- err = m.Matches("fon x")
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-
- err = m.Matches("fopx")
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-
- err = m.Matches("fop ")
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *MatchesRegexpTest) MatchingCandidates() {
- m := MatchesRegexp("fo[op]\\s+x")
- var err error
-
- err = m.Matches("foo x")
- ExpectEq(nil, err)
-
- err = m.Matches("fop x")
- ExpectEq(nil, err)
-
- err = m.Matches("blah blah foo x blah blah")
- ExpectEq(nil, err)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/new_matcher.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/new_matcher.go
deleted file mode 100644
index c9d8398ee63..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/new_matcher.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-// Create a matcher with the given description and predicate function, which
-// will be invoked to handle calls to Matchers.
-//
-// Using this constructor may be a convenience over defining your own type that
-// implements Matcher if you do not need any logic in your Description method.
-func NewMatcher(
- predicate func(interface{}) error,
- description string) Matcher {
- return &predicateMatcher{
- predicate: predicate,
- description: description,
- }
-}
-
-type predicateMatcher struct {
- predicate func(interface{}) error
- description string
-}
-
-func (pm *predicateMatcher) Matches(c interface{}) error {
- return pm.predicate(c)
-}
-
-func (pm *predicateMatcher) Description() string {
- return pm.description
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not.go
deleted file mode 100644
index 623789fe28a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
-)
-
-// Not returns a matcher that inverts the set of values matched by the wrapped
-// matcher. It does not transform the result for values for which the wrapped
-// matcher returns a fatal error.
-func Not(m Matcher) Matcher {
- return &notMatcher{m}
-}
-
-type notMatcher struct {
- wrapped Matcher
-}
-
-func (m *notMatcher) Matches(c interface{}) (err error) {
- err = m.wrapped.Matches(c)
-
- // Did the wrapped matcher say yes?
- if err == nil {
- return errors.New("")
- }
-
- // Did the wrapped matcher return a fatal error?
- if _, isFatal := err.(*FatalError); isFatal {
- return err
- }
-
- // The wrapped matcher returned a non-fatal error.
- return nil
-}
-
-func (m *notMatcher) Description() string {
- return fmt.Sprintf("not(%s)", m.wrapped.Description())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not_test.go
deleted file mode 100644
index d5a12967524..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/not_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "testing"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type fakeMatcher struct {
- matchFunc func(interface{}) error
- description string
-}
-
-func (m *fakeMatcher) Matches(c interface{}) error {
- return m.matchFunc(c)
-}
-
-func (m *fakeMatcher) Description() string {
- return m.description
-}
-
-type NotTest struct {
-
-}
-
-func init() { RegisterTestSuite(&NotTest{}) }
-func TestOgletest(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *NotTest) CallsWrapped() {
- var suppliedCandidate interface{}
- matchFunc := func(c interface{}) error {
- suppliedCandidate = c
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- matcher.Matches(17)
- ExpectThat(suppliedCandidate, Equals(17))
-}
-
-func (t *NotTest) WrappedReturnsTrue() {
- matchFunc := func(c interface{}) error {
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *NotTest) WrappedReturnsNonFatalError() {
- matchFunc := func(c interface{}) error {
- return errors.New("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- err := matcher.Matches(0)
- ExpectEq(nil, err)
-}
-
-func (t *NotTest) WrappedReturnsFatalError() {
- matchFunc := func(c interface{}) error {
- return NewFatalError("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *NotTest) Description() {
- wrapped := &fakeMatcher{nil, "taco"}
- matcher := Not(wrapped)
-
- ExpectEq("not(taco)", matcher.Description())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics.go
deleted file mode 100644
index d2cfc97869b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
-)
-
-// Panics matches zero-arg functions which, when invoked, panic with an error
-// that matches the supplied matcher.
-//
-// NOTE(jacobsa): This matcher cannot detect the case where the function panics
-// using panic(nil), by design of the language. See here for more info:
-//
-// http://goo.gl/9aIQL
-//
-func Panics(m Matcher) Matcher {
- return &panicsMatcher{m}
-}
-
-type panicsMatcher struct {
- wrappedMatcher Matcher
-}
-
-func (m *panicsMatcher) Description() string {
- return "panics with: " + m.wrappedMatcher.Description()
-}
-
-func (m *panicsMatcher) Matches(c interface{}) (err error) {
- // Make sure c is a zero-arg function.
- v := reflect.ValueOf(c)
- if v.Kind() != reflect.Func || v.Type().NumIn() != 0 {
- err = NewFatalError("which is not a zero-arg function")
- return
- }
-
- // Call the function and check its panic error.
- defer func() {
- if e := recover(); e != nil {
- err = m.wrappedMatcher.Matches(e)
-
- // Set a clearer error message if the matcher said no.
- if err != nil {
- wrappedClause := ""
- if err.Error() != "" {
- wrappedClause = ", " + err.Error()
- }
-
- err = errors.New(fmt.Sprintf("which panicked with: %v%s", e, wrappedClause))
- }
- }
- }()
-
- v.Call([]reflect.Value{})
-
- // If we get here, the function didn't panic.
- err = errors.New("which didn't panic")
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics_test.go
deleted file mode 100644
index a2b494f3232..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/panics_test.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type PanicsTest struct {
- matcherCalled bool
- suppliedCandidate interface{}
- wrappedError error
-
- matcher Matcher
-}
-
-func init() { RegisterTestSuite(&PanicsTest{}) }
-
-func (t *PanicsTest) SetUp(i *TestInfo) {
- wrapped := &fakeMatcher{
- func(c interface{}) error {
- t.matcherCalled = true
- t.suppliedCandidate = c
- return t.wrappedError
- },
- "foo",
- }
-
- t.matcher = Panics(wrapped)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *PanicsTest) Description() {
- ExpectThat(t.matcher.Description(), Equals("panics with: foo"))
-}
-
-func (t *PanicsTest) CandidateIsNil() {
- err := t.matcher.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a zero-arg function")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PanicsTest) CandidateIsString() {
- err := t.matcher.Matches("taco")
-
- ExpectThat(err, Error(Equals("which is not a zero-arg function")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PanicsTest) CandidateTakesArgs() {
- err := t.matcher.Matches(func(i int) string { return "" })
-
- ExpectThat(err, Error(Equals("which is not a zero-arg function")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PanicsTest) CallsFunction() {
- callCount := 0
- t.matcher.Matches(func() string {
- callCount++
- return ""
- })
-
- ExpectThat(callCount, Equals(1))
-}
-
-func (t *PanicsTest) FunctionDoesntPanic() {
- err := t.matcher.Matches(func() {})
-
- ExpectThat(err, Error(Equals("which didn't panic")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) CallsWrappedMatcher() {
- expectedErr := 17
- t.wrappedError = errors.New("")
- t.matcher.Matches(func() { panic(expectedErr) })
-
- ExpectThat(t.suppliedCandidate, Equals(expectedErr))
-}
-
-func (t *PanicsTest) WrappedReturnsTrue() {
- err := t.matcher.Matches(func() { panic("") })
-
- ExpectEq(nil, err)
-}
-
-func (t *PanicsTest) WrappedReturnsFatalErrorWithoutText() {
- t.wrappedError = NewFatalError("")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) WrappedReturnsFatalErrorWithText() {
- t.wrappedError = NewFatalError("which blah")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17, which blah")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) WrappedReturnsNonFatalErrorWithoutText() {
- t.wrappedError = errors.New("")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) WrappedReturnsNonFatalErrorWithText() {
- t.wrappedError = errors.New("which blah")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17, which blah")))
- ExpectFalse(isFatal(err))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee.go
deleted file mode 100644
index c5383f2402f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-import (
- "errors"
- "fmt"
- "reflect"
-)
-
-// Return a matcher that matches non-nil pointers whose pointee matches the
-// wrapped matcher.
-func Pointee(m Matcher) Matcher {
- return &pointeeMatcher{m}
-}
-
-type pointeeMatcher struct {
- wrapped Matcher
-}
-
-func (m *pointeeMatcher) Matches(c interface{}) (err error) {
- // Make sure the candidate is of the appropriate type.
- cv := reflect.ValueOf(c)
- if !cv.IsValid() || cv.Kind() != reflect.Ptr {
- return NewFatalError("which is not a pointer")
- }
-
- // Make sure the candidate is non-nil.
- if cv.IsNil() {
- return NewFatalError("")
- }
-
- // Defer to the wrapped matcher. Fix up empty errors so that failure messages
- // are more helpful than just printing a pointer for "Actual".
- pointee := cv.Elem().Interface()
- err = m.wrapped.Matches(pointee)
- if err != nil && err.Error() == "" {
- s := fmt.Sprintf("whose pointee is %v", pointee)
-
- if _, ok := err.(*FatalError); ok {
- err = NewFatalError(s)
- } else {
- err = errors.New(s)
- }
- }
-
- return err
-}
-
-func (m *pointeeMatcher) Description() string {
- return fmt.Sprintf("pointee(%s)", m.wrapped.Description())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee_test.go
deleted file mode 100644
index 58a8381c640..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/pointee_test.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/jacobsa/oglematchers"
- . "github.com/jacobsa/ogletest"
- "testing"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type PointeeTest struct {}
-func init() { RegisterTestSuite(&PointeeTest{}) }
-
-func TestPointee(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *PointeeTest) Description() {
- wrapped := &fakeMatcher{nil, "taco"}
- matcher := Pointee(wrapped)
-
- ExpectEq("pointee(taco)", matcher.Description())
-}
-
-func (t *PointeeTest) CandidateIsNotAPointer() {
- matcher := Pointee(HasSubstr(""))
- err := matcher.Matches([]byte{})
-
- ExpectThat(err, Error(Equals("which is not a pointer")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PointeeTest) CandidateIsANilLiteral() {
- matcher := Pointee(HasSubstr(""))
- err := matcher.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a pointer")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PointeeTest) CandidateIsANilPointer() {
- matcher := Pointee(HasSubstr(""))
- err := matcher.Matches((*int)(nil))
-
- ExpectThat(err, Error(Equals("")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PointeeTest) CallsWrapped() {
- var suppliedCandidate interface{}
- matchFunc := func(c interface{}) error {
- suppliedCandidate = c
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- someSlice := []byte{}
- matcher.Matches(&someSlice)
- ExpectThat(suppliedCandidate, IdenticalTo(someSlice))
-}
-
-func (t *PointeeTest) WrappedReturnsOkay() {
- matchFunc := func(c interface{}) error {
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- err := matcher.Matches(new(int))
- ExpectEq(nil, err)
-}
-
-func (t *PointeeTest) WrappedReturnsNonFatalNonEmptyError() {
- matchFunc := func(c interface{}) error {
- return errors.New("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectFalse(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *PointeeTest) WrappedReturnsNonFatalEmptyError() {
- matchFunc := func(c interface{}) error {
- return errors.New("")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectFalse(isFatal(err))
- ExpectThat(err, Error(HasSubstr("whose pointee")))
- ExpectThat(err, Error(HasSubstr("17")))
-}
-
-func (t *PointeeTest) WrappedReturnsFatalNonEmptyError() {
- matchFunc := func(c interface{}) error {
- return NewFatalError("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *PointeeTest) WrappedReturnsFatalEmptyError() {
- matchFunc := func(c interface{}) error {
- return NewFatalError("")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("whose pointee")))
- ExpectThat(err, Error(HasSubstr("17")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/transform_description.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/transform_description.go
deleted file mode 100644
index f79d0c03db1..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jacobsa/oglematchers/transform_description.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers
-
-// transformDescription returns a matcher that is equivalent to the supplied
-// one, except that it has the supplied description instead of the one attached
-// to the existing matcher.
-func transformDescription(m Matcher, newDesc string) Matcher {
- return &transformDescriptionMatcher{newDesc, m}
-}
-
-type transformDescriptionMatcher struct {
- desc string
- wrappedMatcher Matcher
-}
-
-func (m *transformDescriptionMatcher) Description() string {
- return m.desc
-}
-
-func (m *transformDescriptionMatcher) Matches(c interface{}) error {
- return m.wrappedMatcher.Matches(c)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/arg_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/arg_test.go
deleted file mode 100644
index 117e90ec698..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/arg_test.go
+++ /dev/null
@@ -1,133 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestPositional(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Positional struct {
- Command int
- Filename string
- Rest []string
- } `positional-args:"yes" required:"yes"`
- }{}
-
- p := NewParser(&opts, Default)
- ret, err := p.ParseArgs([]string{"10", "arg_test.go", "a", "b"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- if opts.Positional.Command != 10 {
- t.Fatalf("Expected opts.Positional.Command to be 10, but got %v", opts.Positional.Command)
- }
-
- if opts.Positional.Filename != "arg_test.go" {
- t.Fatalf("Expected opts.Positional.Filename to be \"arg_test.go\", but got %v", opts.Positional.Filename)
- }
-
- assertStringArray(t, opts.Positional.Rest, []string{"a", "b"})
- assertStringArray(t, ret, []string{})
-}
-
-func TestPositionalRequired(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Positional struct {
- Command int
- Filename string
- Rest []string
- } `positional-args:"yes" required:"yes"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{"10"})
-
- assertError(t, err, ErrRequired, "the required argument `Filename` was not provided")
-}
-
-func TestPositionalRequiredRest1Fail(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Positional struct {
- Rest []string `required:"yes"`
- } `positional-args:"yes"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{})
-
- assertError(t, err, ErrRequired, "the required argument `Rest (at least 1 argument)` was not provided")
-}
-
-func TestPositionalRequiredRest1Pass(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Positional struct {
- Rest []string `required:"yes"`
- } `positional-args:"yes"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{"rest1"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- if len(opts.Positional.Rest) != 1 {
- t.Fatalf("Expected 1 positional rest argument")
- }
-
- assertString(t, opts.Positional.Rest[0], "rest1")
-}
-
-func TestPositionalRequiredRest2Fail(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Positional struct {
- Rest []string `required:"2"`
- } `positional-args:"yes"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{"rest1"})
-
- assertError(t, err, ErrRequired, "the required argument `Rest (at least 2 arguments, but got only 1)` was not provided")
-}
-
-func TestPositionalRequiredRest2Pass(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Positional struct {
- Rest []string `required:"2"`
- } `positional-args:"yes"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{"rest1", "rest2", "rest3"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- if len(opts.Positional.Rest) != 3 {
- t.Fatalf("Expected 3 positional rest argument")
- }
-
- assertString(t, opts.Positional.Rest[0], "rest1")
- assertString(t, opts.Positional.Rest[1], "rest2")
- assertString(t, opts.Positional.Rest[2], "rest3")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/assert_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/assert_test.go
deleted file mode 100644
index 8e06636b66d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/assert_test.go
+++ /dev/null
@@ -1,177 +0,0 @@
-package flags
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "os/exec"
- "path"
- "runtime"
- "testing"
-)
-
-func assertCallerInfo() (string, int) {
- ptr := make([]uintptr, 15)
- n := runtime.Callers(1, ptr)
-
- if n == 0 {
- return "", 0
- }
-
- mef := runtime.FuncForPC(ptr[0])
- mefile, meline := mef.FileLine(ptr[0])
-
- for i := 2; i < n; i++ {
- f := runtime.FuncForPC(ptr[i])
- file, line := f.FileLine(ptr[i])
-
- if file != mefile {
- return file, line
- }
- }
-
- return mefile, meline
-}
-
-func assertErrorf(t *testing.T, format string, args ...interface{}) {
- msg := fmt.Sprintf(format, args...)
-
- file, line := assertCallerInfo()
-
- t.Errorf("%s:%d: %s", path.Base(file), line, msg)
-}
-
-func assertFatalf(t *testing.T, format string, args ...interface{}) {
- msg := fmt.Sprintf(format, args...)
-
- file, line := assertCallerInfo()
-
- t.Fatalf("%s:%d: %s", path.Base(file), line, msg)
-}
-
-func assertString(t *testing.T, a string, b string) {
- if a != b {
- assertErrorf(t, "Expected %#v, but got %#v", b, a)
- }
-}
-
-func assertStringArray(t *testing.T, a []string, b []string) {
- if len(a) != len(b) {
- assertErrorf(t, "Expected %#v, but got %#v", b, a)
- return
- }
-
- for i, v := range a {
- if b[i] != v {
- assertErrorf(t, "Expected %#v, but got %#v", b, a)
- return
- }
- }
-}
-
-func assertBoolArray(t *testing.T, a []bool, b []bool) {
- if len(a) != len(b) {
- assertErrorf(t, "Expected %#v, but got %#v", b, a)
- return
- }
-
- for i, v := range a {
- if b[i] != v {
- assertErrorf(t, "Expected %#v, but got %#v", b, a)
- return
- }
- }
-}
-
-func assertParserSuccess(t *testing.T, data interface{}, args ...string) (*Parser, []string) {
- parser := NewParser(data, Default&^PrintErrors)
- ret, err := parser.ParseArgs(args)
-
- if err != nil {
- t.Fatalf("Unexpected parse error: %s", err)
- return nil, nil
- }
-
- return parser, ret
-}
-
-func assertParseSuccess(t *testing.T, data interface{}, args ...string) []string {
- _, ret := assertParserSuccess(t, data, args...)
- return ret
-}
-
-func assertError(t *testing.T, err error, typ ErrorType, msg string) {
- if err == nil {
- assertFatalf(t, "Expected error: %s", msg)
- return
- }
-
- if e, ok := err.(*Error); !ok {
- assertFatalf(t, "Expected Error type, but got %#v", err)
- } else {
- if e.Type != typ {
- assertErrorf(t, "Expected error type {%s}, but got {%s}", typ, e.Type)
- }
-
- if e.Message != msg {
- assertErrorf(t, "Expected error message %#v, but got %#v", msg, e.Message)
- }
- }
-}
-
-func assertParseFail(t *testing.T, typ ErrorType, msg string, data interface{}, args ...string) []string {
- parser := NewParser(data, Default&^PrintErrors)
- ret, err := parser.ParseArgs(args)
-
- assertError(t, err, typ, msg)
- return ret
-}
-
-func diff(a, b string) (string, error) {
- atmp, err := ioutil.TempFile("", "help-diff")
-
- if err != nil {
- return "", err
- }
-
- btmp, err := ioutil.TempFile("", "help-diff")
-
- if err != nil {
- return "", err
- }
-
- if _, err := io.WriteString(atmp, a); err != nil {
- return "", err
- }
-
- if _, err := io.WriteString(btmp, b); err != nil {
- return "", err
- }
-
- ret, err := exec.Command("diff", "-u", "-d", "--label", "got", atmp.Name(), "--label", "expected", btmp.Name()).Output()
-
- os.Remove(atmp.Name())
- os.Remove(btmp.Name())
-
- if err.Error() == "exit status 1" {
- return string(ret), nil
- }
-
- return string(ret), err
-}
-
-func assertDiff(t *testing.T, actual, expected, msg string) {
- if actual == expected {
- return
- }
-
- ret, err := diff(actual, expected)
-
- if err != nil {
- assertErrorf(t, "Unexpected diff error: %s", err)
- assertErrorf(t, "Unexpected %s, expected:\n\n%s\n\nbut got\n\n%s", msg, expected, actual)
- } else {
- assertErrorf(t, "Unexpected %s:\n\n%s", msg, ret)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/command_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/command_test.go
deleted file mode 100644
index 72d397d2c7c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/command_test.go
+++ /dev/null
@@ -1,544 +0,0 @@
-package flags
-
-import (
- "fmt"
- "testing"
-)
-
-func TestCommandInline(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- G bool `short:"g"`
- } `command:"cmd"`
- }{}
-
- p, ret := assertParserSuccess(t, &opts, "-v", "cmd", "-g")
-
- assertStringArray(t, ret, []string{})
-
- if p.Active == nil {
- t.Errorf("Expected active command")
- }
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Command.G {
- t.Errorf("Expected Command.G to be true")
- }
-
- if p.Command.Find("cmd") != p.Active {
- t.Errorf("Expected to find command `cmd' to be active")
- }
-}
-
-func TestCommandInlineMulti(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- C1 struct {
- } `command:"c1"`
-
- C2 struct {
- G bool `short:"g"`
- } `command:"c2"`
- }{}
-
- p, ret := assertParserSuccess(t, &opts, "-v", "c2", "-g")
-
- assertStringArray(t, ret, []string{})
-
- if p.Active == nil {
- t.Errorf("Expected active command")
- }
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.C2.G {
- t.Errorf("Expected C2.G to be true")
- }
-
- if p.Command.Find("c1") == nil {
- t.Errorf("Expected to find command `c1'")
- }
-
- if c2 := p.Command.Find("c2"); c2 == nil {
- t.Errorf("Expected to find command `c2'")
- } else if c2 != p.Active {
- t.Errorf("Expected to find command `c2' to be active")
- }
-}
-
-func TestCommandFlagOrder1(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- G bool `short:"g"`
- } `command:"cmd"`
- }{}
-
- assertParseFail(t, ErrUnknownFlag, "unknown flag `g'", &opts, "-v", "-g", "cmd")
-}
-
-func TestCommandFlagOrder2(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- G bool `short:"g"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "cmd", "-v", "-g")
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Command.G {
- t.Errorf("Expected Command.G to be true")
- }
-}
-
-func TestCommandFlagOrderSub(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- G bool `short:"g"`
-
- SubCommand struct {
- B bool `short:"b"`
- } `command:"sub"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "cmd", "sub", "-v", "-g", "-b")
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Command.G {
- t.Errorf("Expected Command.G to be true")
- }
-
- if !opts.Command.SubCommand.B {
- t.Errorf("Expected Command.SubCommand.B to be true")
- }
-}
-
-func TestCommandFlagOverride1(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- Value bool `short:"v"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "-v", "cmd")
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if opts.Command.Value {
- t.Errorf("Expected Command.Value to be false")
- }
-}
-
-func TestCommandFlagOverride2(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- Value bool `short:"v"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "cmd", "-v")
-
- if opts.Value {
- t.Errorf("Expected Value to be false")
- }
-
- if !opts.Command.Value {
- t.Errorf("Expected Command.Value to be true")
- }
-}
-
-func TestCommandFlagOverrideSub(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- Value bool `short:"v"`
-
- SubCommand struct {
- Value bool `short:"v"`
- } `command:"sub"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "cmd", "sub", "-v")
-
- if opts.Value {
- t.Errorf("Expected Value to be false")
- }
-
- if opts.Command.Value {
- t.Errorf("Expected Command.Value to be false")
- }
-
- if !opts.Command.SubCommand.Value {
- t.Errorf("Expected Command.Value to be true")
- }
-}
-
-func TestCommandFlagOverrideSub2(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- Value bool `short:"v"`
-
- SubCommand struct {
- G bool `short:"g"`
- } `command:"sub"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "cmd", "sub", "-v")
-
- if opts.Value {
- t.Errorf("Expected Value to be false")
- }
-
- if !opts.Command.Value {
- t.Errorf("Expected Command.Value to be true")
- }
-}
-
-func TestCommandEstimate(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Cmd1 struct {
- } `command:"remove"`
-
- Cmd2 struct {
- } `command:"add"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{})
-
- assertError(t, err, ErrCommandRequired, "Please specify one command of: add or remove")
-}
-
-func TestCommandEstimate2(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Cmd1 struct {
- } `command:"remove"`
-
- Cmd2 struct {
- } `command:"add"`
- }{}
-
- p := NewParser(&opts, None)
- _, err := p.ParseArgs([]string{"rmive"})
-
- assertError(t, err, ErrUnknownCommand, "Unknown command `rmive', did you mean `remove'?")
-}
-
-type testCommand struct {
- G bool `short:"g"`
- Executed bool
- EArgs []string
-}
-
-func (c *testCommand) Execute(args []string) error {
- c.Executed = true
- c.EArgs = args
-
- return nil
-}
-
-func TestCommandExecute(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command testCommand `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "-v", "cmd", "-g", "a", "b")
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Command.Executed {
- t.Errorf("Did not execute command")
- }
-
- if !opts.Command.G {
- t.Errorf("Expected Command.C to be true")
- }
-
- assertStringArray(t, opts.Command.EArgs, []string{"a", "b"})
-}
-
-func TestCommandClosest(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Cmd1 struct {
- } `command:"remove"`
-
- Cmd2 struct {
- } `command:"add"`
- }{}
-
- args := assertParseFail(t, ErrUnknownCommand, "Unknown command `addd', did you mean `add'?", &opts, "-v", "addd")
-
- assertStringArray(t, args, []string{"addd"})
-}
-
-func TestCommandAdd(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
- }{}
-
- var cmd = struct {
- G bool `short:"g"`
- }{}
-
- p := NewParser(&opts, Default)
- c, err := p.AddCommand("cmd", "", "", &cmd)
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- ret, err := p.ParseArgs([]string{"-v", "cmd", "-g", "rest"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- assertStringArray(t, ret, []string{"rest"})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !cmd.G {
- t.Errorf("Expected Command.G to be true")
- }
-
- if p.Command.Find("cmd") != c {
- t.Errorf("Expected to find command `cmd'")
- }
-
- if p.Commands()[0] != c {
- t.Errorf("Expected command %#v, but got %#v", c, p.Commands()[0])
- }
-
- if c.Options()[0].ShortName != 'g' {
- t.Errorf("Expected short name `g' but got %v", c.Options()[0].ShortName)
- }
-}
-
-func TestCommandNestedInline(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Command struct {
- G bool `short:"g"`
-
- Nested struct {
- N string `long:"n"`
- } `command:"nested"`
- } `command:"cmd"`
- }{}
-
- p, ret := assertParserSuccess(t, &opts, "-v", "cmd", "-g", "nested", "--n", "n", "rest")
-
- assertStringArray(t, ret, []string{"rest"})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Command.G {
- t.Errorf("Expected Command.G to be true")
- }
-
- assertString(t, opts.Command.Nested.N, "n")
-
- if c := p.Command.Find("cmd"); c == nil {
- t.Errorf("Expected to find command `cmd'")
- } else {
- if c != p.Active {
- t.Errorf("Expected `cmd' to be the active parser command")
- }
-
- if nested := c.Find("nested"); nested == nil {
- t.Errorf("Expected to find command `nested'")
- } else if nested != c.Active {
- t.Errorf("Expected to find command `nested' to be the active `cmd' command")
- }
- }
-}
-
-func TestRequiredOnCommand(t *testing.T) {
- var opts = struct {
- Value bool `short:"v" required:"true"`
-
- Command struct {
- G bool `short:"g"`
- } `command:"cmd"`
- }{}
-
- assertParseFail(t, ErrRequired, fmt.Sprintf("the required flag `%cv' was not specified", defaultShortOptDelimiter), &opts, "cmd")
-}
-
-func TestRequiredAllOnCommand(t *testing.T) {
- var opts = struct {
- Value bool `short:"v" required:"true"`
- Missing bool `long:"missing" required:"true"`
-
- Command struct {
- G bool `short:"g"`
- } `command:"cmd"`
- }{}
-
- assertParseFail(t, ErrRequired, fmt.Sprintf("the required flags `%smissing' and `%cv' were not specified", defaultLongOptDelimiter, defaultShortOptDelimiter), &opts, "cmd")
-}
-
-func TestDefaultOnCommand(t *testing.T) {
- var opts = struct {
- Command struct {
- G bool `short:"g" default:"true"`
- } `command:"cmd"`
- }{}
-
- assertParseSuccess(t, &opts, "cmd")
-
- if !opts.Command.G {
- t.Errorf("Expected G to be true")
- }
-}
-
-func TestSubcommandsOptional(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Cmd1 struct {
- } `command:"remove"`
-
- Cmd2 struct {
- } `command:"add"`
- }{}
-
- p := NewParser(&opts, None)
- p.SubcommandsOptional = true
-
- _, err := p.ParseArgs([]string{"-v"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestCommandAlias(t *testing.T) {
- var opts = struct {
- Command struct {
- G bool `short:"g" default:"true"`
- } `command:"cmd" alias:"cm"`
- }{}
-
- assertParseSuccess(t, &opts, "cm")
-
- if !opts.Command.G {
- t.Errorf("Expected G to be true")
- }
-}
-
-func TestSubCommandFindOptionByLongFlag(t *testing.T) {
- var opts struct {
- Testing bool `long:"testing" description:"Testing"`
- }
-
- var cmd struct {
- Other bool `long:"other" description:"Other"`
- }
-
- p := NewParser(&opts, Default)
- c, _ := p.AddCommand("command", "Short", "Long", &cmd)
-
- opt := c.FindOptionByLongName("other")
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- assertString(t, opt.LongName, "other")
-
- opt = c.FindOptionByLongName("testing")
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- assertString(t, opt.LongName, "testing")
-}
-
-func TestSubCommandFindOptionByShortFlag(t *testing.T) {
- var opts struct {
- Testing bool `short:"t" description:"Testing"`
- }
-
- var cmd struct {
- Other bool `short:"o" description:"Other"`
- }
-
- p := NewParser(&opts, Default)
- c, _ := p.AddCommand("command", "Short", "Long", &cmd)
-
- opt := c.FindOptionByShortName('o')
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- if opt.ShortName != 'o' {
- t.Errorf("Expected 'o', but got %v", opt.ShortName)
- }
-
- opt = c.FindOptionByShortName('t')
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- if opt.ShortName != 't' {
- t.Errorf("Expected 'o', but got %v", opt.ShortName)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/completion_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/completion_test.go
deleted file mode 100644
index f440fd70fe5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/completion_test.go
+++ /dev/null
@@ -1,294 +0,0 @@
-package flags
-
-import (
- "bytes"
- "io"
- "os"
- "path"
- "path/filepath"
- "reflect"
- "runtime"
- "strings"
- "testing"
-)
-
-type TestComplete struct {
-}
-
-func (t *TestComplete) Complete(match string) []Completion {
- options := []string{
- "hello world",
- "hello universe",
- "hello multiverse",
- }
-
- ret := make([]Completion, 0, len(options))
-
- for _, o := range options {
- if strings.HasPrefix(o, match) {
- ret = append(ret, Completion{
- Item: o,
- })
- }
- }
-
- return ret
-}
-
-var completionTestOptions struct {
- Verbose bool `short:"v" long:"verbose" description:"Verbose messages"`
- Debug bool `short:"d" long:"debug" description:"Enable debug"`
- Version bool `long:"version" description:"Show version"`
- Required bool `long:"required" required:"true" description:"This is required"`
-
- AddCommand struct {
- Positional struct {
- Filename Filename
- } `positional-args:"yes"`
- } `command:"add" description:"add an item"`
-
- AddMultiCommand struct {
- Positional struct {
- Filename []Filename
- } `positional-args:"yes"`
- } `command:"add-multi" description:"add multiple items"`
-
- RemoveCommand struct {
- Other bool `short:"o"`
- File Filename `short:"f" long:"filename"`
- } `command:"rm" description:"remove an item"`
-
- RenameCommand struct {
- Completed TestComplete `short:"c" long:"completed"`
- } `command:"rename" description:"rename an item"`
-}
-
-type completionTest struct {
- Args []string
- Completed []string
- ShowDescriptions bool
-}
-
-var completionTests []completionTest
-
-func init() {
- _, sourcefile, _, _ := runtime.Caller(0)
- completionTestSourcedir := filepath.Join(filepath.SplitList(path.Dir(sourcefile))...)
-
- completionTestFilename := []string{filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion_test.go")}
-
- completionTests = []completionTest{
- {
- // Short names
- []string{"-"},
- []string{"-d", "-v"},
- false,
- },
-
- {
- // Short names concatenated
- []string{"-dv"},
- []string{"-dv"},
- false,
- },
-
- {
- // Long names
- []string{"--"},
- []string{"--debug", "--required", "--verbose", "--version"},
- false,
- },
-
- {
- // Long names with descriptions
- []string{"--"},
- []string{
- "--debug # Enable debug",
- "--required # This is required",
- "--verbose # Verbose messages",
- "--version # Show version",
- },
- true,
- },
-
- {
- // Long names partial
- []string{"--ver"},
- []string{"--verbose", "--version"},
- false,
- },
-
- {
- // Commands
- []string{""},
- []string{"add", "add-multi", "rename", "rm"},
- false,
- },
-
- {
- // Commands with descriptions
- []string{""},
- []string{
- "add # add an item",
- "add-multi # add multiple items",
- "rename # rename an item",
- "rm # remove an item",
- },
- true,
- },
-
- {
- // Commands partial
- []string{"r"},
- []string{"rename", "rm"},
- false,
- },
-
- {
- // Positional filename
- []string{"add", filepath.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
-
- {
- // Multiple positional filename (1 arg)
- []string{"add-multi", filepath.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
- {
- // Multiple positional filename (2 args)
- []string{"add-multi", filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
- {
- // Multiple positional filename (3 args)
- []string{"add-multi", filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion.go"), filepath.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
-
- {
- // Flag filename
- []string{"rm", "-f", path.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
-
- {
- // Flag short concat last filename
- []string{"rm", "-of", path.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
-
- {
- // Flag concat filename
- []string{"rm", "-f" + path.Join(completionTestSourcedir, "completion")},
- []string{"-f" + completionTestFilename[0], "-f" + completionTestFilename[1]},
- false,
- },
-
- {
- // Flag equal concat filename
- []string{"rm", "-f=" + path.Join(completionTestSourcedir, "completion")},
- []string{"-f=" + completionTestFilename[0], "-f=" + completionTestFilename[1]},
- false,
- },
-
- {
- // Flag concat long filename
- []string{"rm", "--filename=" + path.Join(completionTestSourcedir, "completion")},
- []string{"--filename=" + completionTestFilename[0], "--filename=" + completionTestFilename[1]},
- false,
- },
-
- {
- // Flag long filename
- []string{"rm", "--filename", path.Join(completionTestSourcedir, "completion")},
- completionTestFilename,
- false,
- },
-
- {
- // Custom completed
- []string{"rename", "-c", "hello un"},
- []string{"hello universe"},
- false,
- },
- }
-}
-
-func TestCompletion(t *testing.T) {
- p := NewParser(&completionTestOptions, Default)
- c := &completion{parser: p}
-
- for _, test := range completionTests {
- if test.ShowDescriptions {
- continue
- }
-
- ret := c.complete(test.Args)
- items := make([]string, len(ret))
-
- for i, v := range ret {
- items[i] = v.Item
- }
-
- if !reflect.DeepEqual(items, test.Completed) {
- t.Errorf("Args: %#v, %#v\n Expected: %#v\n Got: %#v", test.Args, test.ShowDescriptions, test.Completed, items)
- }
- }
-}
-
-func TestParserCompletion(t *testing.T) {
- for _, test := range completionTests {
- if test.ShowDescriptions {
- os.Setenv("GO_FLAGS_COMPLETION", "verbose")
- } else {
- os.Setenv("GO_FLAGS_COMPLETION", "1")
- }
-
- tmp := os.Stdout
-
- r, w, _ := os.Pipe()
- os.Stdout = w
-
- out := make(chan string)
-
- go func() {
- var buf bytes.Buffer
-
- io.Copy(&buf, r)
-
- out <- buf.String()
- }()
-
- p := NewParser(&completionTestOptions, None)
-
- p.CompletionHandler = func(items []Completion) {
- comp := &completion{parser: p}
- comp.print(items, test.ShowDescriptions)
- }
-
- _, err := p.ParseArgs(test.Args)
-
- w.Close()
-
- os.Stdout = tmp
-
- if err != nil {
- t.Fatalf("Unexpected error: %s", err)
- }
-
- got := strings.Split(strings.Trim(<-out, "\n"), "\n")
-
- if !reflect.DeepEqual(got, test.Completed) {
- t.Errorf("Expected: %#v\nGot: %#v", test.Completed, got)
- }
- }
-
- os.Setenv("GO_FLAGS_COMPLETION", "")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/convert_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/convert_test.go
deleted file mode 100644
index ef131dc8d1e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/convert_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package flags
-
-import (
- "testing"
- "time"
-)
-
-func expectConvert(t *testing.T, o *Option, expected string) {
- s, err := convertToString(o.value, o.tag)
-
- if err != nil {
- t.Errorf("Unexpected error: %v", err)
- return
- }
-
- assertString(t, s, expected)
-}
-
-func TestConvertToString(t *testing.T) {
- d, _ := time.ParseDuration("1h2m4s")
-
- var opts = struct {
- String string `long:"string"`
-
- Int int `long:"int"`
- Int8 int8 `long:"int8"`
- Int16 int16 `long:"int16"`
- Int32 int32 `long:"int32"`
- Int64 int64 `long:"int64"`
-
- Uint uint `long:"uint"`
- Uint8 uint8 `long:"uint8"`
- Uint16 uint16 `long:"uint16"`
- Uint32 uint32 `long:"uint32"`
- Uint64 uint64 `long:"uint64"`
-
- Float32 float32 `long:"float32"`
- Float64 float64 `long:"float64"`
-
- Duration time.Duration `long:"duration"`
-
- Bool bool `long:"bool"`
-
- IntSlice []int `long:"int-slice"`
- IntFloatMap map[int]float64 `long:"int-float-map"`
-
- PtrBool *bool `long:"ptr-bool"`
- Interface interface{} `long:"interface"`
-
- Int32Base int32 `long:"int32-base" base:"16"`
- Uint32Base uint32 `long:"uint32-base" base:"16"`
- }{
- "string",
-
- -2,
- -1,
- 0,
- 1,
- 2,
-
- 1,
- 2,
- 3,
- 4,
- 5,
-
- 1.2,
- -3.4,
-
- d,
- true,
-
- []int{-3, 4, -2},
- map[int]float64{-2: 4.5},
-
- new(bool),
- float32(5.2),
-
- -5823,
- 4232,
- }
-
- p := NewNamedParser("test", Default)
- grp, _ := p.AddGroup("test group", "", &opts)
-
- expects := []string{
- "string",
- "-2",
- "-1",
- "0",
- "1",
- "2",
-
- "1",
- "2",
- "3",
- "4",
- "5",
-
- "1.2",
- "-3.4",
-
- "1h2m4s",
- "true",
-
- "[-3, 4, -2]",
- "{-2:4.5}",
-
- "false",
- "5.2",
-
- "-16bf",
- "1088",
- }
-
- for i, v := range grp.Options() {
- expectConvert(t, v, expects[i])
- }
-}
-
-func TestConvertToStringInvalidIntBase(t *testing.T) {
- var opts = struct {
- Int int `long:"int" base:"no"`
- }{
- 2,
- }
-
- p := NewNamedParser("test", Default)
- grp, _ := p.AddGroup("test group", "", &opts)
- o := grp.Options()[0]
-
- _, err := convertToString(o.value, o.tag)
-
- if err != nil {
- err = newErrorf(ErrMarshal, "%v", err)
- }
-
- assertError(t, err, ErrMarshal, "strconv.ParseInt: parsing \"no\": invalid syntax")
-}
-
-func TestConvertToStringInvalidUintBase(t *testing.T) {
- var opts = struct {
- Uint uint `long:"uint" base:"no"`
- }{
- 2,
- }
-
- p := NewNamedParser("test", Default)
- grp, _ := p.AddGroup("test group", "", &opts)
- o := grp.Options()[0]
-
- _, err := convertToString(o.value, o.tag)
-
- if err != nil {
- err = newErrorf(ErrMarshal, "%v", err)
- }
-
- assertError(t, err, ErrMarshal, "strconv.ParseInt: parsing \"no\": invalid syntax")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/example_test.go
deleted file mode 100644
index f7be2bb14f2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/example_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Example of use of the flags package.
-package flags
-
-import (
- "fmt"
- "os/exec"
-)
-
-func Example() {
- var opts struct {
- // Slice of bool will append 'true' each time the option
- // is encountered (can be set multiple times, like -vvv)
- Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
-
- // Example of automatic marshalling to desired type (uint)
- Offset uint `long:"offset" description:"Offset"`
-
- // Example of a callback, called each time the option is found.
- Call func(string) `short:"c" description:"Call phone number"`
-
- // Example of a required flag
- Name string `short:"n" long:"name" description:"A name" required:"true"`
-
- // Example of a value name
- File string `short:"f" long:"file" description:"A file" value-name:"FILE"`
-
- // Example of a pointer
- Ptr *int `short:"p" description:"A pointer to an integer"`
-
- // Example of a slice of strings
- StringSlice []string `short:"s" description:"A slice of strings"`
-
- // Example of a slice of pointers
- PtrSlice []*string `long:"ptrslice" description:"A slice of pointers to string"`
-
- // Example of a map
- IntMap map[string]int `long:"intmap" description:"A map from string to int"`
-
- // Example of a filename (useful for completion)
- Filename Filename `long:"filename" description:"A filename"`
-
- // Example of positional arguments
- Args struct {
- Id string
- Num int
- Rest []string
- } `positional-args:"yes" required:"yes"`
- }
-
- // Callback which will invoke callto:<argument> to call a number.
- // Note that this works just on OS X (and probably only with
- // Skype) but it shows the idea.
- opts.Call = func(num string) {
- cmd := exec.Command("open", "callto:"+num)
- cmd.Start()
- cmd.Process.Release()
- }
-
- // Make some fake arguments to parse.
- args := []string{
- "-vv",
- "--offset=5",
- "-n", "Me",
- "-p", "3",
- "-s", "hello",
- "-s", "world",
- "--ptrslice", "hello",
- "--ptrslice", "world",
- "--intmap", "a:1",
- "--intmap", "b:5",
- "--filename", "hello.go",
- "id",
- "10",
- "remaining1",
- "remaining2",
- }
-
- // Parse flags from `args'. Note that here we use flags.ParseArgs for
- // the sake of making a working example. Normally, you would simply use
- // flags.Parse(&opts) which uses os.Args
- _, err := ParseArgs(&opts, args)
-
- if err != nil {
- panic(err)
- }
-
- fmt.Printf("Verbosity: %v\n", opts.Verbose)
- fmt.Printf("Offset: %d\n", opts.Offset)
- fmt.Printf("Name: %s\n", opts.Name)
- fmt.Printf("Ptr: %d\n", *opts.Ptr)
- fmt.Printf("StringSlice: %v\n", opts.StringSlice)
- fmt.Printf("PtrSlice: [%v %v]\n", *opts.PtrSlice[0], *opts.PtrSlice[1])
- fmt.Printf("IntMap: [a:%v b:%v]\n", opts.IntMap["a"], opts.IntMap["b"])
- fmt.Printf("Filename: %v\n", opts.Filename)
- fmt.Printf("Args.Id: %s\n", opts.Args.Id)
- fmt.Printf("Args.Num: %d\n", opts.Args.Num)
- fmt.Printf("Args.Rest: %v\n", opts.Args.Rest)
-
- // Output: Verbosity: [true true]
- // Offset: 5
- // Name: Me
- // Ptr: 3
- // StringSlice: [hello world]
- // PtrSlice: [hello world]
- // IntMap: [a:1 b:5]
- // Filename: hello.go
- // Args.Id: id
- // Args.Num: 10
- // Args.Rest: [remaining1 remaining2]
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/group_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/group_test.go
deleted file mode 100644
index 18cd6c17394..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/group_test.go
+++ /dev/null
@@ -1,255 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestGroupInline(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Group struct {
- G bool `short:"g"`
- } `group:"Grouped Options"`
- }{}
-
- p, ret := assertParserSuccess(t, &opts, "-v", "-g")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Group.G {
- t.Errorf("Expected Group.G to be true")
- }
-
- if p.Command.Group.Find("Grouped Options") == nil {
- t.Errorf("Expected to find group `Grouped Options'")
- }
-}
-
-func TestGroupAdd(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
- }{}
-
- var grp = struct {
- G bool `short:"g"`
- }{}
-
- p := NewParser(&opts, Default)
- g, err := p.AddGroup("Grouped Options", "", &grp)
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- ret, err := p.ParseArgs([]string{"-v", "-g", "rest"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- assertStringArray(t, ret, []string{"rest"})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !grp.G {
- t.Errorf("Expected Group.G to be true")
- }
-
- if p.Command.Group.Find("Grouped Options") != g {
- t.Errorf("Expected to find group `Grouped Options'")
- }
-
- if p.Groups()[1] != g {
- t.Errorf("Expected group %#v, but got %#v", g, p.Groups()[0])
- }
-
- if g.Options()[0].ShortName != 'g' {
- t.Errorf("Expected short name `g' but got %v", g.Options()[0].ShortName)
- }
-}
-
-func TestGroupNestedInline(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
-
- Group struct {
- G bool `short:"g"`
-
- Nested struct {
- N string `long:"n"`
- } `group:"Nested Options"`
- } `group:"Grouped Options"`
- }{}
-
- p, ret := assertParserSuccess(t, &opts, "-v", "-g", "--n", "n", "rest")
-
- assertStringArray(t, ret, []string{"rest"})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- if !opts.Group.G {
- t.Errorf("Expected Group.G to be true")
- }
-
- assertString(t, opts.Group.Nested.N, "n")
-
- if p.Command.Group.Find("Grouped Options") == nil {
- t.Errorf("Expected to find group `Grouped Options'")
- }
-
- if p.Command.Group.Find("Nested Options") == nil {
- t.Errorf("Expected to find group `Nested Options'")
- }
-}
-
-func TestGroupNestedInlineNamespace(t *testing.T) {
- var opts = struct {
- Opt string `long:"opt"`
-
- Group struct {
- Opt string `long:"opt"`
- Group struct {
- Opt string `long:"opt"`
- } `group:"Subsubgroup" namespace:"sap"`
- } `group:"Subgroup" namespace:"sip"`
- }{}
-
- p, ret := assertParserSuccess(t, &opts, "--opt", "a", "--sip.opt", "b", "--sip.sap.opt", "c", "rest")
-
- assertStringArray(t, ret, []string{"rest"})
-
- assertString(t, opts.Opt, "a")
- assertString(t, opts.Group.Opt, "b")
- assertString(t, opts.Group.Group.Opt, "c")
-
- for _, name := range []string{"Subgroup", "Subsubgroup"} {
- if p.Command.Group.Find(name) == nil {
- t.Errorf("Expected to find group '%s'", name)
- }
- }
-}
-
-func TestDuplicateShortFlags(t *testing.T) {
- var opts struct {
- Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
- Variables []string `short:"v" long:"variable" description:"Set a variable value."`
- }
-
- args := []string{
- "--verbose",
- "-v", "123",
- "-v", "456",
- }
-
- _, err := ParseArgs(&opts, args)
-
- if err == nil {
- t.Errorf("Expected an error with type ErrDuplicatedFlag")
- } else {
- err2 := err.(*Error)
- if err2.Type != ErrDuplicatedFlag {
- t.Errorf("Expected an error with type ErrDuplicatedFlag")
- }
- }
-}
-
-func TestDuplicateLongFlags(t *testing.T) {
- var opts struct {
- Test1 []bool `short:"a" long:"testing" description:"Test 1"`
- Test2 []string `short:"b" long:"testing" description:"Test 2."`
- }
-
- args := []string{
- "--testing",
- }
-
- _, err := ParseArgs(&opts, args)
-
- if err == nil {
- t.Errorf("Expected an error with type ErrDuplicatedFlag")
- } else {
- err2 := err.(*Error)
- if err2.Type != ErrDuplicatedFlag {
- t.Errorf("Expected an error with type ErrDuplicatedFlag")
- }
- }
-}
-
-func TestFindOptionByLongFlag(t *testing.T) {
- var opts struct {
- Testing bool `long:"testing" description:"Testing"`
- }
-
- p := NewParser(&opts, Default)
- opt := p.FindOptionByLongName("testing")
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- assertString(t, opt.LongName, "testing")
-}
-
-func TestFindOptionByShortFlag(t *testing.T) {
- var opts struct {
- Testing bool `short:"t" description:"Testing"`
- }
-
- p := NewParser(&opts, Default)
- opt := p.FindOptionByShortName('t')
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- if opt.ShortName != 't' {
- t.Errorf("Expected 't', but got %v", opt.ShortName)
- }
-}
-
-func TestFindOptionByLongFlagInSubGroup(t *testing.T) {
- var opts struct {
- Group struct {
- Testing bool `long:"testing" description:"Testing"`
- } `group:"sub-group"`
- }
-
- p := NewParser(&opts, Default)
- opt := p.FindOptionByLongName("testing")
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- assertString(t, opt.LongName, "testing")
-}
-
-func TestFindOptionByShortFlagInSubGroup(t *testing.T) {
- var opts struct {
- Group struct {
- Testing bool `short:"t" description:"Testing"`
- } `group:"sub-group"`
- }
-
- p := NewParser(&opts, Default)
- opt := p.FindOptionByShortName('t')
-
- if opt == nil {
- t.Errorf("Expected option, but found none")
- }
-
- if opt.ShortName != 't' {
- t.Errorf("Expected 't', but got %v", opt.ShortName)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/help_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/help_test.go
deleted file mode 100644
index 33d21bf86df..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/help_test.go
+++ /dev/null
@@ -1,460 +0,0 @@
-package flags
-
-import (
- "bytes"
- "fmt"
- "os"
- "runtime"
- "testing"
- "time"
-)
-
-type helpOptions struct {
- Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information" ini-name:"verbose"`
- Call func(string) `short:"c" description:"Call phone number" ini-name:"call"`
- PtrSlice []*string `long:"ptrslice" description:"A slice of pointers to string"`
- EmptyDescription bool `long:"empty-description"`
-
- Default string `long:"default" default:"Some\nvalue" description:"Test default value"`
- DefaultArray []string `long:"default-array" default:"Some value" default:"Other\tvalue" description:"Test default array value"`
- DefaultMap map[string]string `long:"default-map" default:"some:value" default:"another:value" description:"Testdefault map value"`
- EnvDefault1 string `long:"env-default1" default:"Some value" env:"ENV_DEFAULT" description:"Test env-default1 value"`
- EnvDefault2 string `long:"env-default2" env:"ENV_DEFAULT" description:"Test env-default2 value"`
- OptionWithArgName string `long:"opt-with-arg-name" value-name:"something" description:"Option with named argument"`
- OptionWithChoices string `long:"opt-with-choices" value-name:"choice" choice:"dog" choice:"cat" description:"Option with choices"`
- Hidden string `long:"hidden" description:"Hidden option" hidden:"yes"`
-
- OnlyIni string `ini-name:"only-ini" description:"Option only available in ini"`
-
- Other struct {
- StringSlice []string `short:"s" default:"some" default:"value" description:"A slice of strings"`
- IntMap map[string]int `long:"intmap" default:"a:1" description:"A map from string to int" ini-name:"int-map"`
- } `group:"Other Options"`
-
- HiddenGroup struct {
- InsideHiddenGroup string `long:"inside-hidden-group" description:"Inside hidden group"`
- } `group:"Hidden group" hidden:"yes"`
-
- Group struct {
- Opt string `long:"opt" description:"This is a subgroup option"`
- HiddenInsideGroup string `long:"hidden-inside-group" description:"Hidden inside group" hidden:"yes"`
-
- Group struct {
- Opt string `long:"opt" description:"This is a subsubgroup option"`
- } `group:"Subsubgroup" namespace:"sap"`
- } `group:"Subgroup" namespace:"sip"`
-
- Command struct {
- ExtraVerbose []bool `long:"extra-verbose" description:"Use for extra verbosity"`
- } `command:"command" alias:"cm" alias:"cmd" description:"A command"`
-
- HiddenCommand struct {
- ExtraVerbose []bool `long:"extra-verbose" description:"Use for extra verbosity"`
- } `command:"hidden-command" description:"A hidden command" hidden:"yes"`
-
- Args struct {
- Filename string `positional-arg-name:"filename" description:"A filename"`
- Number int `positional-arg-name:"num" description:"A number"`
- } `positional-args:"yes"`
-}
-
-func TestHelp(t *testing.T) {
- oldEnv := EnvSnapshot()
- defer oldEnv.Restore()
- os.Setenv("ENV_DEFAULT", "env-def")
-
- var opts helpOptions
- p := NewNamedParser("TestHelp", HelpFlag)
- p.AddGroup("Application Options", "The application options", &opts)
-
- _, err := p.ParseArgs([]string{"--help"})
-
- if err == nil {
- t.Fatalf("Expected help error")
- }
-
- if e, ok := err.(*Error); !ok {
- t.Fatalf("Expected flags.Error, but got %T", err)
- } else {
- if e.Type != ErrHelp {
- t.Errorf("Expected flags.ErrHelp type, but got %s", e.Type)
- }
-
- var expected string
-
- if runtime.GOOS == "windows" {
- expected = `Usage:
- TestHelp [OPTIONS] [filename] [num] <command>
-
-Application Options:
- /v, /verbose Show verbose debug information
- /c: Call phone number
- /ptrslice: A slice of pointers to string
- /empty-description
- /default: Test default value (default:
- "Some\nvalue")
- /default-array: Test default array value (default:
- Some value, "Other\tvalue")
- /default-map: Testdefault map value (default:
- some:value, another:value)
- /env-default1: Test env-default1 value (default:
- Some value) [%ENV_DEFAULT%]
- /env-default2: Test env-default2 value
- [%ENV_DEFAULT%]
- /opt-with-arg-name:something Option with named argument
- /opt-with-choices:choice[dog|cat] Option with choices
-
-Other Options:
- /s: A slice of strings (default: some,
- value)
- /intmap: A map from string to int (default:
- a:1)
-
-Subgroup:
- /sip.opt: This is a subgroup option
-
-Subsubgroup:
- /sip.sap.opt: This is a subsubgroup option
-
-Help Options:
- /? Show this help message
- /h, /help Show this help message
-
-Arguments:
- filename: A filename
- num: A number
-
-Available commands:
- command A command (aliases: cm, cmd)
-`
- } else {
- expected = `Usage:
- TestHelp [OPTIONS] [filename] [num] <command>
-
-Application Options:
- -v, --verbose Show verbose debug information
- -c= Call phone number
- --ptrslice= A slice of pointers to string
- --empty-description
- --default= Test default value (default:
- "Some\nvalue")
- --default-array= Test default array value (default:
- Some value, "Other\tvalue")
- --default-map= Testdefault map value (default:
- some:value, another:value)
- --env-default1= Test env-default1 value (default:
- Some value) [$ENV_DEFAULT]
- --env-default2= Test env-default2 value
- [$ENV_DEFAULT]
- --opt-with-arg-name=something Option with named argument
- --opt-with-choices=choice[dog|cat] Option with choices
-
-Other Options:
- -s= A slice of strings (default: some,
- value)
- --intmap= A map from string to int (default:
- a:1)
-
-Subgroup:
- --sip.opt= This is a subgroup option
-
-Subsubgroup:
- --sip.sap.opt= This is a subsubgroup option
-
-Help Options:
- -h, --help Show this help message
-
-Arguments:
- filename: A filename
- num: A number
-
-Available commands:
- command A command (aliases: cm, cmd)
-`
- }
-
- assertDiff(t, e.Message, expected, "help message")
- }
-}
-
-func TestMan(t *testing.T) {
- oldEnv := EnvSnapshot()
- defer oldEnv.Restore()
- os.Setenv("ENV_DEFAULT", "env-def")
-
- var opts helpOptions
- p := NewNamedParser("TestMan", HelpFlag)
- p.ShortDescription = "Test manpage generation"
- p.LongDescription = "This is a somewhat `longer' description of what this does"
- p.AddGroup("Application Options", "The application options", &opts)
-
- p.Commands()[0].LongDescription = "Longer `command' description"
-
- var buf bytes.Buffer
- p.WriteManPage(&buf)
-
- got := buf.String()
-
- tt := time.Now()
-
- var envDefaultName string
-
- if runtime.GOOS == "windows" {
- envDefaultName = "%ENV_DEFAULT%"
- } else {
- envDefaultName = "$ENV_DEFAULT"
- }
-
- expected := fmt.Sprintf(`.TH TestMan 1 "%s"
-.SH NAME
-TestMan \- Test manpage generation
-.SH SYNOPSIS
-\fBTestMan\fP [OPTIONS]
-.SH DESCRIPTION
-This is a somewhat \fBlonger\fP description of what this does
-.SH OPTIONS
-.TP
-\fB\fB\-v\fR, \fB\-\-verbose\fR\fP
-Show verbose debug information
-.TP
-\fB\fB\-c\fR\fP
-Call phone number
-.TP
-\fB\fB\-\-ptrslice\fR\fP
-A slice of pointers to string
-.TP
-\fB\fB\-\-empty-description\fR\fP
-.TP
-\fB\fB\-\-default\fR <default: \fI"Some\\nvalue"\fR>\fP
-Test default value
-.TP
-\fB\fB\-\-default-array\fR <default: \fI"Some value", "Other\\tvalue"\fR>\fP
-Test default array value
-.TP
-\fB\fB\-\-default-map\fR <default: \fI"some:value", "another:value"\fR>\fP
-Testdefault map value
-.TP
-\fB\fB\-\-env-default1\fR <default: \fI"Some value"\fR>\fP
-Test env-default1 value
-.TP
-\fB\fB\-\-env-default2\fR <default: \fI%s\fR>\fP
-Test env-default2 value
-.TP
-\fB\fB\-\-opt-with-arg-name\fR \fIsomething\fR\fP
-Option with named argument
-.TP
-\fB\fB\-\-opt-with-choices\fR \fIchoice\fR\fP
-Option with choices
-.TP
-\fB\fB\-s\fR <default: \fI"some", "value"\fR>\fP
-A slice of strings
-.TP
-\fB\fB\-\-intmap\fR <default: \fI"a:1"\fR>\fP
-A map from string to int
-.TP
-\fB\fB\-\-sip.opt\fR\fP
-This is a subgroup option
-.TP
-\fB\fB\-\-sip.sap.opt\fR\fP
-This is a subsubgroup option
-.SH COMMANDS
-.SS command
-A command
-
-Longer \fBcommand\fP description
-
-\fBUsage\fP: TestMan [OPTIONS] command [command-OPTIONS]
-.TP
-
-\fBAliases\fP: cm, cmd
-
-.TP
-\fB\fB\-\-extra-verbose\fR\fP
-Use for extra verbosity
-`, tt.Format("2 January 2006"), envDefaultName)
-
- assertDiff(t, got, expected, "man page")
-}
-
-type helpCommandNoOptions struct {
- Command struct {
- } `command:"command" description:"A command"`
-}
-
-func TestHelpCommand(t *testing.T) {
- oldEnv := EnvSnapshot()
- defer oldEnv.Restore()
- os.Setenv("ENV_DEFAULT", "env-def")
-
- var opts helpCommandNoOptions
- p := NewNamedParser("TestHelpCommand", HelpFlag)
- p.AddGroup("Application Options", "The application options", &opts)
-
- _, err := p.ParseArgs([]string{"command", "--help"})
-
- if err == nil {
- t.Fatalf("Expected help error")
- }
-
- if e, ok := err.(*Error); !ok {
- t.Fatalf("Expected flags.Error, but got %T", err)
- } else {
- if e.Type != ErrHelp {
- t.Errorf("Expected flags.ErrHelp type, but got %s", e.Type)
- }
-
- var expected string
-
- if runtime.GOOS == "windows" {
- expected = `Usage:
- TestHelpCommand [OPTIONS] command
-
-Help Options:
- /? Show this help message
- /h, /help Show this help message
-`
- } else {
- expected = `Usage:
- TestHelpCommand [OPTIONS] command
-
-Help Options:
- -h, --help Show this help message
-`
- }
-
- assertDiff(t, e.Message, expected, "help message")
- }
-}
-
-func TestHelpDefaults(t *testing.T) {
- var expected string
-
- if runtime.GOOS == "windows" {
- expected = `Usage:
- TestHelpDefaults [OPTIONS]
-
-Application Options:
- /with-default: With default (default: default-value)
- /without-default: Without default
- /with-programmatic-default: With programmatic default (default:
- default-value)
-
-Help Options:
- /? Show this help message
- /h, /help Show this help message
-`
- } else {
- expected = `Usage:
- TestHelpDefaults [OPTIONS]
-
-Application Options:
- --with-default= With default (default: default-value)
- --without-default= Without default
- --with-programmatic-default= With programmatic default (default:
- default-value)
-
-Help Options:
- -h, --help Show this help message
-`
- }
-
- tests := []struct {
- Args []string
- Output string
- }{
- {
- Args: []string{"-h"},
- Output: expected,
- },
- {
- Args: []string{"--with-default", "other-value", "--with-programmatic-default", "other-value", "-h"},
- Output: expected,
- },
- }
-
- for _, test := range tests {
- var opts struct {
- WithDefault string `long:"with-default" default:"default-value" description:"With default"`
- WithoutDefault string `long:"without-default" description:"Without default"`
- WithProgrammaticDefault string `long:"with-programmatic-default" description:"With programmatic default"`
- }
-
- opts.WithProgrammaticDefault = "default-value"
-
- p := NewNamedParser("TestHelpDefaults", HelpFlag)
- p.AddGroup("Application Options", "The application options", &opts)
-
- _, err := p.ParseArgs(test.Args)
-
- if err == nil {
- t.Fatalf("Expected help error")
- }
-
- if e, ok := err.(*Error); !ok {
- t.Fatalf("Expected flags.Error, but got %T", err)
- } else {
- if e.Type != ErrHelp {
- t.Errorf("Expected flags.ErrHelp type, but got %s", e.Type)
- }
-
- assertDiff(t, e.Message, test.Output, "help message")
- }
- }
-}
-
-func TestHelpRestArgs(t *testing.T) {
- opts := struct {
- Verbose bool `short:"v"`
- }{}
-
- p := NewNamedParser("TestHelpDefaults", HelpFlag)
- p.AddGroup("Application Options", "The application options", &opts)
-
- retargs, err := p.ParseArgs([]string{"-h", "-v", "rest"})
-
- if err == nil {
- t.Fatalf("Expected help error")
- }
-
- assertStringArray(t, retargs, []string{"-v", "rest"})
-}
-
-func TestWrapText(t *testing.T) {
- s := "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
-
- got := wrapText(s, 60, " ")
- expected := `Lorem ipsum dolor sit amet, consectetur adipisicing elit,
- sed do eiusmod tempor incididunt ut labore et dolore magna
- aliqua. Ut enim ad minim veniam, quis nostrud exercitation
- ullamco laboris nisi ut aliquip ex ea commodo consequat.
- Duis aute irure dolor in reprehenderit in voluptate velit
- esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
- occaecat cupidatat non proident, sunt in culpa qui officia
- deserunt mollit anim id est laborum.`
-
- assertDiff(t, got, expected, "wrapped text")
-}
-
-func TestWrapParagraph(t *testing.T) {
- s := "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n\n"
- s += "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\n"
- s += "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\n\n"
- s += "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n"
-
- got := wrapText(s, 60, " ")
- expected := `Lorem ipsum dolor sit amet, consectetur adipisicing elit,
- sed do eiusmod tempor incididunt ut labore et dolore magna
- aliqua.
-
- Ut enim ad minim veniam, quis nostrud exercitation ullamco
- laboris nisi ut aliquip ex ea commodo consequat.
-
- Duis aute irure dolor in reprehenderit in voluptate velit
- esse cillum dolore eu fugiat nulla pariatur.
-
- Excepteur sint occaecat cupidatat non proident, sunt in
- culpa qui officia deserunt mollit anim id est laborum.
-`
-
- assertDiff(t, got, expected, "wrapped paragraph")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/ini_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/ini_test.go
deleted file mode 100644
index dd7fe331209..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/ini_test.go
+++ /dev/null
@@ -1,950 +0,0 @@
-package flags
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "reflect"
- "strings"
- "testing"
-)
-
-func TestWriteIni(t *testing.T) {
- oldEnv := EnvSnapshot()
- defer oldEnv.Restore()
- os.Setenv("ENV_DEFAULT", "env-def")
-
- var tests = []struct {
- args []string
- options IniOptions
- expected string
- }{
- {
- []string{"-vv", "--intmap=a:2", "--intmap", "b:3", "filename", "0", "command"},
- IniDefault,
- `[Application Options]
-; Show verbose debug information
-verbose = true
-verbose = true
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-[Other Options]
-; A map from string to int
-int-map = a:2
-int-map = b:3
-
-`,
- },
- {
- []string{"-vv", "--intmap=a:2", "--intmap", "b:3", "filename", "0", "command"},
- IniDefault | IniIncludeDefaults,
- `[Application Options]
-; Show verbose debug information
-verbose = true
-verbose = true
-
-; A slice of pointers to string
-; PtrSlice =
-
-EmptyDescription = false
-
-; Test default value
-Default = "Some\nvalue"
-
-; Test default array value
-DefaultArray = Some value
-DefaultArray = "Other\tvalue"
-
-; Testdefault map value
-DefaultMap = another:value
-DefaultMap = some:value
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-; Option with named argument
-OptionWithArgName =
-
-; Option with choices
-OptionWithChoices =
-
-; Option only available in ini
-only-ini =
-
-[Other Options]
-; A slice of strings
-StringSlice = some
-StringSlice = value
-
-; A map from string to int
-int-map = a:2
-int-map = b:3
-
-[Subgroup]
-; This is a subgroup option
-Opt =
-
-[Subsubgroup]
-; This is a subsubgroup option
-Opt =
-
-[command]
-; Use for extra verbosity
-; ExtraVerbose =
-
-`,
- },
- {
- []string{"filename", "0", "command"},
- IniDefault | IniIncludeDefaults | IniCommentDefaults,
- `[Application Options]
-; Show verbose debug information
-; verbose =
-
-; A slice of pointers to string
-; PtrSlice =
-
-; EmptyDescription = false
-
-; Test default value
-; Default = "Some\nvalue"
-
-; Test default array value
-; DefaultArray = Some value
-; DefaultArray = "Other\tvalue"
-
-; Testdefault map value
-; DefaultMap = another:value
-; DefaultMap = some:value
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-; Option with named argument
-; OptionWithArgName =
-
-; Option with choices
-; OptionWithChoices =
-
-; Option only available in ini
-; only-ini =
-
-[Other Options]
-; A slice of strings
-; StringSlice = some
-; StringSlice = value
-
-; A map from string to int
-; int-map = a:1
-
-[Subgroup]
-; This is a subgroup option
-; Opt =
-
-[Subsubgroup]
-; This is a subsubgroup option
-; Opt =
-
-[command]
-; Use for extra verbosity
-; ExtraVerbose =
-
-`,
- },
- {
- []string{"--default=New value", "--default-array=New value", "--default-map=new:value", "filename", "0", "command"},
- IniDefault | IniIncludeDefaults | IniCommentDefaults,
- `[Application Options]
-; Show verbose debug information
-; verbose =
-
-; A slice of pointers to string
-; PtrSlice =
-
-; EmptyDescription = false
-
-; Test default value
-Default = New value
-
-; Test default array value
-DefaultArray = New value
-
-; Testdefault map value
-DefaultMap = new:value
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-; Option with named argument
-; OptionWithArgName =
-
-; Option with choices
-; OptionWithChoices =
-
-; Option only available in ini
-; only-ini =
-
-[Other Options]
-; A slice of strings
-; StringSlice = some
-; StringSlice = value
-
-; A map from string to int
-; int-map = a:1
-
-[Subgroup]
-; This is a subgroup option
-; Opt =
-
-[Subsubgroup]
-; This is a subsubgroup option
-; Opt =
-
-[command]
-; Use for extra verbosity
-; ExtraVerbose =
-
-`,
- },
- }
-
- for _, test := range tests {
- var opts helpOptions
-
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- _, err := p.ParseArgs(test.args)
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- }
-
- inip := NewIniParser(p)
-
- var b bytes.Buffer
- inip.Write(&b, test.options)
-
- got := b.String()
- expected := test.expected
-
- msg := fmt.Sprintf("with arguments %+v and ini options %b", test.args, test.options)
- assertDiff(t, got, expected, msg)
- }
-}
-
-func TestReadIni_flagEquivalent(t *testing.T) {
- type options struct {
- Opt1 bool `long:"opt1"`
-
- Group1 struct {
- Opt2 bool `long:"opt2"`
- } `group:"group1"`
-
- Group2 struct {
- Opt3 bool `long:"opt3"`
- } `group:"group2" namespace:"ns1"`
-
- Cmd1 struct {
- Opt4 bool `long:"opt4"`
- Opt5 bool `long:"foo.opt5"`
-
- Group1 struct {
- Opt6 bool `long:"opt6"`
- Opt7 bool `long:"foo.opt7"`
- } `group:"group1"`
-
- Group2 struct {
- Opt8 bool `long:"opt8"`
- } `group:"group2" namespace:"ns1"`
- } `command:"cmd1"`
- }
-
- a := `
-opt1=true
-
-[group1]
-opt2=true
-
-[group2]
-ns1.opt3=true
-
-[cmd1]
-opt4=true
-foo.opt5=true
-
-[cmd1.group1]
-opt6=true
-foo.opt7=true
-
-[cmd1.group2]
-ns1.opt8=true
-`
- b := `
-opt1=true
-opt2=true
-ns1.opt3=true
-
-[cmd1]
-opt4=true
-foo.opt5=true
-opt6=true
-foo.opt7=true
-ns1.opt8=true
-`
-
- parse := func(readIni string) (opts options, writeIni string) {
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- inip := NewIniParser(p)
- err := inip.Parse(strings.NewReader(readIni))
-
- if err != nil {
- t.Fatalf("Unexpected error: %s\n\nFile:\n%s", err, readIni)
- }
-
- var b bytes.Buffer
- inip.Write(&b, Default)
-
- return opts, b.String()
- }
-
- aOpt, aIni := parse(a)
- bOpt, bIni := parse(b)
-
- assertDiff(t, aIni, bIni, "")
- if !reflect.DeepEqual(aOpt, bOpt) {
- t.Errorf("not equal")
- }
-}
-
-func TestReadIni(t *testing.T) {
- var opts helpOptions
-
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- inip := NewIniParser(p)
-
- inic := `
-; Show verbose debug information
-verbose = true
-verbose = true
-
-DefaultMap = another:"value\n1"
-DefaultMap = some:value 2
-
-[Application Options]
-; A slice of pointers to string
-; PtrSlice =
-
-; Test default value
-Default = "New\nvalue"
-
-; Test env-default1 value
-EnvDefault1 = New value
-
-[Other Options]
-# A slice of strings
-StringSlice = "some\nvalue"
-StringSlice = another value
-
-; A map from string to int
-int-map = a:2
-int-map = b:3
-
-`
-
- b := strings.NewReader(inic)
- err := inip.Parse(b)
-
- if err != nil {
- t.Fatalf("Unexpected error: %s", err)
- }
-
- assertBoolArray(t, opts.Verbose, []bool{true, true})
-
- if v := map[string]string{"another": "value\n1", "some": "value 2"}; !reflect.DeepEqual(opts.DefaultMap, v) {
- t.Fatalf("Expected %#v for DefaultMap but got %#v", v, opts.DefaultMap)
- }
-
- assertString(t, opts.Default, "New\nvalue")
-
- assertString(t, opts.EnvDefault1, "New value")
-
- assertStringArray(t, opts.Other.StringSlice, []string{"some\nvalue", "another value"})
-
- if v, ok := opts.Other.IntMap["a"]; !ok {
- t.Errorf("Expected \"a\" in Other.IntMap")
- } else if v != 2 {
- t.Errorf("Expected Other.IntMap[\"a\"] = 2, but got %v", v)
- }
-
- if v, ok := opts.Other.IntMap["b"]; !ok {
- t.Errorf("Expected \"b\" in Other.IntMap")
- } else if v != 3 {
- t.Errorf("Expected Other.IntMap[\"b\"] = 3, but got %v", v)
- }
-}
-
-func TestReadAndWriteIni(t *testing.T) {
- var tests = []struct {
- options IniOptions
- read string
- write string
- }{
- {
- IniIncludeComments,
- `[Application Options]
-; Show verbose debug information
-verbose = true
-verbose = true
-
-; Test default value
-Default = "quote me"
-
-; Test default array value
-DefaultArray = 1
-DefaultArray = "2"
-DefaultArray = 3
-
-; Testdefault map value
-; DefaultMap =
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-[Other Options]
-; A slice of strings
-; StringSlice =
-
-; A map from string to int
-int-map = a:2
-int-map = b:"3"
-
-`,
- `[Application Options]
-; Show verbose debug information
-verbose = true
-verbose = true
-
-; Test default value
-Default = "quote me"
-
-; Test default array value
-DefaultArray = 1
-DefaultArray = 2
-DefaultArray = 3
-
-; Testdefault map value
-; DefaultMap =
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-[Other Options]
-; A slice of strings
-; StringSlice =
-
-; A map from string to int
-int-map = a:2
-int-map = b:3
-
-`,
- },
- {
- IniIncludeComments,
- `[Application Options]
-; Show verbose debug information
-verbose = true
-verbose = true
-
-; Test default value
-Default = "quote me"
-
-; Test default array value
-DefaultArray = "1"
-DefaultArray = "2"
-DefaultArray = "3"
-
-; Testdefault map value
-; DefaultMap =
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-[Other Options]
-; A slice of strings
-; StringSlice =
-
-; A map from string to int
-int-map = a:"2"
-int-map = b:"3"
-
-`,
- `[Application Options]
-; Show verbose debug information
-verbose = true
-verbose = true
-
-; Test default value
-Default = "quote me"
-
-; Test default array value
-DefaultArray = "1"
-DefaultArray = "2"
-DefaultArray = "3"
-
-; Testdefault map value
-; DefaultMap =
-
-; Test env-default1 value
-EnvDefault1 = env-def
-
-; Test env-default2 value
-EnvDefault2 = env-def
-
-[Other Options]
-; A slice of strings
-; StringSlice =
-
-; A map from string to int
-int-map = a:"2"
-int-map = b:"3"
-
-`,
- },
- }
-
- for _, test := range tests {
- var opts helpOptions
-
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- inip := NewIniParser(p)
-
- read := strings.NewReader(test.read)
- err := inip.Parse(read)
- if err != nil {
- t.Fatalf("Unexpected error: %s", err)
- }
-
- var write bytes.Buffer
- inip.Write(&write, test.options)
-
- got := write.String()
-
- msg := fmt.Sprintf("with ini options %b", test.options)
- assertDiff(t, got, test.write, msg)
- }
-}
-
-func TestReadIniWrongQuoting(t *testing.T) {
- var tests = []struct {
- iniFile string
- lineNumber uint
- }{
- {
- iniFile: `Default = "New\nvalue`,
- lineNumber: 1,
- },
- {
- iniFile: `StringSlice = "New\nvalue`,
- lineNumber: 1,
- },
- {
- iniFile: `StringSlice = "New\nvalue"
- StringSlice = "Second\nvalue`,
- lineNumber: 2,
- },
- {
- iniFile: `DefaultMap = some:"value`,
- lineNumber: 1,
- },
- {
- iniFile: `DefaultMap = some:value
- DefaultMap = another:"value`,
- lineNumber: 2,
- },
- }
-
- for _, test := range tests {
- var opts helpOptions
-
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- inip := NewIniParser(p)
-
- inic := test.iniFile
-
- b := strings.NewReader(inic)
- err := inip.Parse(b)
-
- if err == nil {
- t.Fatalf("Expect error")
- }
-
- iniError := err.(*IniError)
-
- if iniError.LineNumber != test.lineNumber {
- t.Fatalf("Expect error on line %d", test.lineNumber)
- }
- }
-}
-
-func TestIniCommands(t *testing.T) {
- var opts struct {
- Value string `short:"v" long:"value"`
-
- Add struct {
- Name int `short:"n" long:"name" ini-name:"AliasName"`
-
- Other struct {
- O string `short:"o" long:"other"`
- } `group:"Other Options"`
- } `command:"add"`
- }
-
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- inip := NewIniParser(p)
-
- inic := `[Application Options]
-value = some value
-
-[add]
-AliasName = 5
-
-[add.Other Options]
-other = subgroup
-
-`
-
- b := strings.NewReader(inic)
- err := inip.Parse(b)
-
- if err != nil {
- t.Fatalf("Unexpected error: %s", err)
- }
-
- assertString(t, opts.Value, "some value")
-
- if opts.Add.Name != 5 {
- t.Errorf("Expected opts.Add.Name to be 5, but got %v", opts.Add.Name)
- }
-
- assertString(t, opts.Add.Other.O, "subgroup")
-
- // Test writing it back
- buf := &bytes.Buffer{}
-
- inip.Write(buf, IniDefault)
-
- assertDiff(t, buf.String(), inic, "ini contents")
-}
-
-func TestIniNoIni(t *testing.T) {
- var opts struct {
- NoValue string `short:"n" long:"novalue" no-ini:"yes"`
- Value string `short:"v" long:"value"`
- }
-
- p := NewNamedParser("TestIni", Default)
- p.AddGroup("Application Options", "The application options", &opts)
-
- inip := NewIniParser(p)
-
- // read INI
- inic := `[Application Options]
-novalue = some value
-value = some other value
-`
-
- b := strings.NewReader(inic)
- err := inip.Parse(b)
-
- if err == nil {
- t.Fatalf("Expected error")
- }
-
- iniError := err.(*IniError)
-
- if v := uint(2); iniError.LineNumber != v {
- t.Errorf("Expected opts.Add.Name to be %d, but got %d", v, iniError.LineNumber)
- }
-
- if v := "unknown option: novalue"; iniError.Message != v {
- t.Errorf("Expected opts.Add.Name to be %s, but got %s", v, iniError.Message)
- }
-
- // write INI
- opts.NoValue = "some value"
- opts.Value = "some other value"
-
- file, err := ioutil.TempFile("", "")
- if err != nil {
- t.Fatalf("Cannot create temporary file: %s", err)
- }
- defer os.Remove(file.Name())
-
- err = inip.WriteFile(file.Name(), IniIncludeDefaults)
- if err != nil {
- t.Fatalf("Could not write ini file: %s", err)
- }
-
- found, err := ioutil.ReadFile(file.Name())
- if err != nil {
- t.Fatalf("Could not read written ini file: %s", err)
- }
-
- expected := "[Application Options]\nValue = some other value\n\n"
-
- assertDiff(t, string(found), expected, "ini content")
-}
-
-func TestIniParse(t *testing.T) {
- file, err := ioutil.TempFile("", "")
- if err != nil {
- t.Fatalf("Cannot create temporary file: %s", err)
- }
- defer os.Remove(file.Name())
-
- _, err = file.WriteString("value = 123")
- if err != nil {
- t.Fatalf("Cannot write to temporary file: %s", err)
- }
-
- file.Close()
-
- var opts struct {
- Value int `long:"value"`
- }
-
- err = IniParse(file.Name(), &opts)
- if err != nil {
- t.Fatalf("Could not parse ini: %s", err)
- }
-
- if opts.Value != 123 {
- t.Fatalf("Expected Value to be \"123\" but was \"%d\"", opts.Value)
- }
-}
-
-func TestIniCliOverrides(t *testing.T) {
- file, err := ioutil.TempFile("", "")
-
- if err != nil {
- t.Fatalf("Cannot create temporary file: %s", err)
- }
-
- defer os.Remove(file.Name())
-
- _, err = file.WriteString("values = 123\n")
- _, err = file.WriteString("values = 456\n")
-
- if err != nil {
- t.Fatalf("Cannot write to temporary file: %s", err)
- }
-
- file.Close()
-
- var opts struct {
- Values []int `long:"values"`
- }
-
- p := NewParser(&opts, Default)
- err = NewIniParser(p).ParseFile(file.Name())
-
- if err != nil {
- t.Fatalf("Could not parse ini: %s", err)
- }
-
- _, err = p.ParseArgs([]string{"--values", "111", "--values", "222"})
-
- if err != nil {
- t.Fatalf("Failed to parse arguments: %s", err)
- }
-
- if len(opts.Values) != 2 {
- t.Fatalf("Expected Values to contain two elements, but got %d", len(opts.Values))
- }
-
- if opts.Values[0] != 111 {
- t.Fatalf("Expected Values[0] to be 111, but got '%d'", opts.Values[0])
- }
-
- if opts.Values[1] != 222 {
- t.Fatalf("Expected Values[0] to be 222, but got '%d'", opts.Values[1])
- }
-}
-
-func TestIniOverrides(t *testing.T) {
- file, err := ioutil.TempFile("", "")
-
- if err != nil {
- t.Fatalf("Cannot create temporary file: %s", err)
- }
-
- defer os.Remove(file.Name())
-
- _, err = file.WriteString("value-with-default = \"ini-value\"\n")
- _, err = file.WriteString("value-with-default-override-cli = \"ini-value\"\n")
-
- if err != nil {
- t.Fatalf("Cannot write to temporary file: %s", err)
- }
-
- file.Close()
-
- var opts struct {
- ValueWithDefault string `long:"value-with-default" default:"value"`
- ValueWithDefaultOverrideCli string `long:"value-with-default-override-cli" default:"value"`
- }
-
- p := NewParser(&opts, Default)
- err = NewIniParser(p).ParseFile(file.Name())
-
- if err != nil {
- t.Fatalf("Could not parse ini: %s", err)
- }
-
- _, err = p.ParseArgs([]string{"--value-with-default-override-cli", "cli-value"})
-
- if err != nil {
- t.Fatalf("Failed to parse arguments: %s", err)
- }
-
- assertString(t, opts.ValueWithDefault, "ini-value")
- assertString(t, opts.ValueWithDefaultOverrideCli, "cli-value")
-}
-
-func TestWriteFile(t *testing.T) {
- file, err := ioutil.TempFile("", "")
- if err != nil {
- t.Fatalf("Cannot create temporary file: %s", err)
- }
- defer os.Remove(file.Name())
-
- var opts struct {
- Value int `long:"value"`
- }
-
- opts.Value = 123
-
- p := NewParser(&opts, Default)
- ini := NewIniParser(p)
-
- err = ini.WriteFile(file.Name(), IniIncludeDefaults)
- if err != nil {
- t.Fatalf("Could not write ini file: %s", err)
- }
-
- found, err := ioutil.ReadFile(file.Name())
- if err != nil {
- t.Fatalf("Could not read written ini file: %s", err)
- }
-
- expected := "[Application Options]\nValue = 123\n\n"
-
- assertDiff(t, string(found), expected, "ini content")
-}
-
-func TestOverwriteRequiredOptions(t *testing.T) {
- var tests = []struct {
- args []string
- expected []string
- }{
- {
- args: []string{"--value", "from CLI"},
- expected: []string{
- "from CLI",
- "from default",
- },
- },
- {
- args: []string{"--value", "from CLI", "--default", "from CLI"},
- expected: []string{
- "from CLI",
- "from CLI",
- },
- },
- {
- args: []string{"--config", "no file name"},
- expected: []string{
- "from INI",
- "from INI",
- },
- },
- {
- args: []string{"--value", "from CLI before", "--default", "from CLI before", "--config", "no file name"},
- expected: []string{
- "from INI",
- "from INI",
- },
- },
- {
- args: []string{"--value", "from CLI before", "--default", "from CLI before", "--config", "no file name", "--value", "from CLI after", "--default", "from CLI after"},
- expected: []string{
- "from CLI after",
- "from CLI after",
- },
- },
- }
-
- for _, test := range tests {
- var opts struct {
- Config func(s string) error `long:"config" no-ini:"true"`
- Value string `long:"value" required:"true"`
- Default string `long:"default" required:"true" default:"from default"`
- }
-
- p := NewParser(&opts, Default)
-
- opts.Config = func(s string) error {
- ini := NewIniParser(p)
-
- return ini.Parse(bytes.NewBufferString("value = from INI\ndefault = from INI"))
- }
-
- _, err := p.ParseArgs(test.args)
- if err != nil {
- t.Fatalf("Unexpected error %s with args %+v", err, test.args)
- }
-
- if opts.Value != test.expected[0] {
- t.Fatalf("Expected Value to be \"%s\" but was \"%s\" with args %+v", test.expected[0], opts.Value, test.args)
- }
-
- if opts.Default != test.expected[1] {
- t.Fatalf("Expected Default to be \"%s\" but was \"%s\" with args %+v", test.expected[1], opts.Default, test.args)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/long_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/long_test.go
deleted file mode 100644
index 02fc8c70129..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/long_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestLong(t *testing.T) {
- var opts = struct {
- Value bool `long:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "--value")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestLongArg(t *testing.T) {
- var opts = struct {
- Value string `long:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "--value", "value")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestLongArgEqual(t *testing.T) {
- var opts = struct {
- Value string `long:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "--value=value")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestLongDefault(t *testing.T) {
- var opts = struct {
- Value string `long:"value" default:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts)
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestLongOptional(t *testing.T) {
- var opts = struct {
- Value string `long:"value" optional:"yes" optional-value:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "--value")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestLongOptionalArg(t *testing.T) {
- var opts = struct {
- Value string `long:"value" optional:"yes" optional-value:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "--value", "no")
-
- assertStringArray(t, ret, []string{"no"})
- assertString(t, opts.Value, "value")
-}
-
-func TestLongOptionalArgEqual(t *testing.T) {
- var opts = struct {
- Value string `long:"value" optional:"yes" optional-value:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "--value=value", "no")
-
- assertStringArray(t, ret, []string{"no"})
- assertString(t, opts.Value, "value")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/marshal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/marshal_test.go
deleted file mode 100644
index 59c9ccefb96..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/marshal_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package flags
-
-import (
- "fmt"
- "testing"
-)
-
-type marshalled bool
-
-func (m *marshalled) UnmarshalFlag(value string) error {
- if value == "yes" {
- *m = true
- } else if value == "no" {
- *m = false
- } else {
- return fmt.Errorf("`%s' is not a valid value, please specify `yes' or `no'", value)
- }
-
- return nil
-}
-
-func (m marshalled) MarshalFlag() (string, error) {
- if m {
- return "yes", nil
- }
-
- return "no", nil
-}
-
-type marshalledError bool
-
-func (m marshalledError) MarshalFlag() (string, error) {
- return "", newErrorf(ErrMarshal, "Failed to marshal")
-}
-
-func TestUnmarshal(t *testing.T) {
- var opts = struct {
- Value marshalled `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v=yes")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestUnmarshalDefault(t *testing.T) {
- var opts = struct {
- Value marshalled `short:"v" default:"yes"`
- }{}
-
- ret := assertParseSuccess(t, &opts)
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestUnmarshalOptional(t *testing.T) {
- var opts = struct {
- Value marshalled `short:"v" optional:"yes" optional-value:"yes"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestUnmarshalError(t *testing.T) {
- var opts = struct {
- Value marshalled `short:"v"`
- }{}
-
- assertParseFail(t, ErrMarshal, fmt.Sprintf("invalid argument for flag `%cv' (expected flags.marshalled): `invalid' is not a valid value, please specify `yes' or `no'", defaultShortOptDelimiter), &opts, "-vinvalid")
-}
-
-func TestMarshalError(t *testing.T) {
- var opts = struct {
- Value marshalledError `short:"v"`
- }{}
-
- p := NewParser(&opts, Default)
- o := p.Command.Groups()[0].Options()[0]
-
- _, err := convertToString(o.value, o.tag)
-
- assertError(t, err, ErrMarshal, "Failed to marshal")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/options_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/options_test.go
deleted file mode 100644
index b0fe9f4565c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/options_test.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestPassDoubleDash(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
- }{}
-
- p := NewParser(&opts, PassDoubleDash)
- ret, err := p.ParseArgs([]string{"-v", "--", "-v", "-g"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- assertStringArray(t, ret, []string{"-v", "-g"})
-}
-
-func TestPassAfterNonOption(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
- }{}
-
- p := NewParser(&opts, PassAfterNonOption)
- ret, err := p.ParseArgs([]string{"-v", "arg", "-v", "-g"})
-
- if err != nil {
- t.Fatalf("Unexpected error: %v", err)
- return
- }
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-
- assertStringArray(t, ret, []string{"arg", "-v", "-g"})
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/parser_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/parser_test.go
deleted file mode 100644
index b57dbee9a25..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/parser_test.go
+++ /dev/null
@@ -1,487 +0,0 @@
-package flags
-
-import (
- "fmt"
- "os"
- "reflect"
- "strconv"
- "strings"
- "testing"
- "time"
-)
-
-type defaultOptions struct {
- Int int `long:"i"`
- IntDefault int `long:"id" default:"1"`
-
- Float64 float64 `long:"f"`
- Float64Default float64 `long:"fd" default:"-3.14"`
-
- NumericFlag bool `short:"3" default:"false"`
-
- String string `long:"str"`
- StringDefault string `long:"strd" default:"abc"`
- StringNotUnquoted string `long:"strnot" unquote:"false"`
-
- Time time.Duration `long:"t"`
- TimeDefault time.Duration `long:"td" default:"1m"`
-
- Map map[string]int `long:"m"`
- MapDefault map[string]int `long:"md" default:"a:1"`
-
- Slice []int `long:"s"`
- SliceDefault []int `long:"sd" default:"1" default:"2"`
-}
-
-func TestDefaults(t *testing.T) {
- var tests = []struct {
- msg string
- args []string
- expected defaultOptions
- }{
- {
- msg: "no arguments, expecting default values",
- args: []string{},
- expected: defaultOptions{
- Int: 0,
- IntDefault: 1,
-
- Float64: 0.0,
- Float64Default: -3.14,
-
- NumericFlag: false,
-
- String: "",
- StringDefault: "abc",
-
- Time: 0,
- TimeDefault: time.Minute,
-
- Map: map[string]int{},
- MapDefault: map[string]int{"a": 1},
-
- Slice: []int{},
- SliceDefault: []int{1, 2},
- },
- },
- {
- msg: "non-zero value arguments, expecting overwritten arguments",
- args: []string{"--i=3", "--id=3", "--f=-2.71", "--fd=2.71", "-3", "--str=def", "--strd=def", "--t=3ms", "--td=3ms", "--m=c:3", "--md=c:3", "--s=3", "--sd=3"},
- expected: defaultOptions{
- Int: 3,
- IntDefault: 3,
-
- Float64: -2.71,
- Float64Default: 2.71,
-
- NumericFlag: true,
-
- String: "def",
- StringDefault: "def",
-
- Time: 3 * time.Millisecond,
- TimeDefault: 3 * time.Millisecond,
-
- Map: map[string]int{"c": 3},
- MapDefault: map[string]int{"c": 3},
-
- Slice: []int{3},
- SliceDefault: []int{3},
- },
- },
- {
- msg: "zero value arguments, expecting overwritten arguments",
- args: []string{"--i=0", "--id=0", "--f=0", "--fd=0", "--str", "", "--strd=\"\"", "--t=0ms", "--td=0s", "--m=:0", "--md=:0", "--s=0", "--sd=0"},
- expected: defaultOptions{
- Int: 0,
- IntDefault: 0,
-
- Float64: 0,
- Float64Default: 0,
-
- String: "",
- StringDefault: "",
-
- Time: 0,
- TimeDefault: 0,
-
- Map: map[string]int{"": 0},
- MapDefault: map[string]int{"": 0},
-
- Slice: []int{0},
- SliceDefault: []int{0},
- },
- },
- }
-
- for _, test := range tests {
- var opts defaultOptions
-
- _, err := ParseArgs(&opts, test.args)
- if err != nil {
- t.Fatalf("%s:\nUnexpected error: %v", test.msg, err)
- }
-
- if opts.Slice == nil {
- opts.Slice = []int{}
- }
-
- if !reflect.DeepEqual(opts, test.expected) {
- t.Errorf("%s:\nUnexpected options with arguments %+v\nexpected\n%+v\nbut got\n%+v\n", test.msg, test.args, test.expected, opts)
- }
- }
-}
-
-func TestUnquoting(t *testing.T) {
- var tests = []struct {
- arg string
- err error
- value string
- }{
- {
- arg: "\"abc",
- err: strconv.ErrSyntax,
- value: "",
- },
- {
- arg: "\"\"abc\"",
- err: strconv.ErrSyntax,
- value: "",
- },
- {
- arg: "\"abc\"",
- err: nil,
- value: "abc",
- },
- {
- arg: "\"\\\"abc\\\"\"",
- err: nil,
- value: "\"abc\"",
- },
- {
- arg: "\"\\\"abc\"",
- err: nil,
- value: "\"abc",
- },
- }
-
- for _, test := range tests {
- var opts defaultOptions
-
- for _, delimiter := range []bool{false, true} {
- p := NewParser(&opts, None)
-
- var err error
- if delimiter {
- _, err = p.ParseArgs([]string{"--str=" + test.arg, "--strnot=" + test.arg})
- } else {
- _, err = p.ParseArgs([]string{"--str", test.arg, "--strnot", test.arg})
- }
-
- if test.err == nil {
- if err != nil {
- t.Fatalf("Expected no error but got: %v", err)
- }
-
- if test.value != opts.String {
- t.Fatalf("Expected String to be %q but got %q", test.value, opts.String)
- }
- if q := strconv.Quote(test.value); q != opts.StringNotUnquoted {
- t.Fatalf("Expected StringDefault to be %q but got %q", q, opts.StringNotUnquoted)
- }
- } else {
- if err == nil {
- t.Fatalf("Expected error")
- } else if e, ok := err.(*Error); ok {
- if strings.HasPrefix(e.Message, test.err.Error()) {
- t.Fatalf("Expected error message to end with %q but got %v", test.err.Error(), e.Message)
- }
- }
- }
- }
- }
-}
-
-// envRestorer keeps a copy of a set of env variables and can restore the env from them
-type envRestorer struct {
- env map[string]string
-}
-
-func (r *envRestorer) Restore() {
- os.Clearenv()
- for k, v := range r.env {
- os.Setenv(k, v)
- }
-}
-
-// EnvSnapshot returns a snapshot of the currently set env variables
-func EnvSnapshot() *envRestorer {
- r := envRestorer{make(map[string]string)}
- for _, kv := range os.Environ() {
- parts := strings.SplitN(kv, "=", 2)
- if len(parts) != 2 {
- panic("got a weird env variable: " + kv)
- }
- r.env[parts[0]] = parts[1]
- }
- return &r
-}
-
-type envDefaultOptions struct {
- Int int `long:"i" default:"1" env:"TEST_I"`
- Time time.Duration `long:"t" default:"1m" env:"TEST_T"`
- Map map[string]int `long:"m" default:"a:1" env:"TEST_M" env-delim:";"`
- Slice []int `long:"s" default:"1" default:"2" env:"TEST_S" env-delim:","`
-}
-
-func TestEnvDefaults(t *testing.T) {
- var tests = []struct {
- msg string
- args []string
- expected envDefaultOptions
- env map[string]string
- }{
- {
- msg: "no arguments, no env, expecting default values",
- args: []string{},
- expected: envDefaultOptions{
- Int: 1,
- Time: time.Minute,
- Map: map[string]int{"a": 1},
- Slice: []int{1, 2},
- },
- },
- {
- msg: "no arguments, env defaults, expecting env default values",
- args: []string{},
- expected: envDefaultOptions{
- Int: 2,
- Time: 2 * time.Minute,
- Map: map[string]int{"a": 2, "b": 3},
- Slice: []int{4, 5, 6},
- },
- env: map[string]string{
- "TEST_I": "2",
- "TEST_T": "2m",
- "TEST_M": "a:2;b:3",
- "TEST_S": "4,5,6",
- },
- },
- {
- msg: "non-zero value arguments, expecting overwritten arguments",
- args: []string{"--i=3", "--t=3ms", "--m=c:3", "--s=3"},
- expected: envDefaultOptions{
- Int: 3,
- Time: 3 * time.Millisecond,
- Map: map[string]int{"c": 3},
- Slice: []int{3},
- },
- env: map[string]string{
- "TEST_I": "2",
- "TEST_T": "2m",
- "TEST_M": "a:2;b:3",
- "TEST_S": "4,5,6",
- },
- },
- {
- msg: "zero value arguments, expecting overwritten arguments",
- args: []string{"--i=0", "--t=0ms", "--m=:0", "--s=0"},
- expected: envDefaultOptions{
- Int: 0,
- Time: 0,
- Map: map[string]int{"": 0},
- Slice: []int{0},
- },
- env: map[string]string{
- "TEST_I": "2",
- "TEST_T": "2m",
- "TEST_M": "a:2;b:3",
- "TEST_S": "4,5,6",
- },
- },
- }
-
- oldEnv := EnvSnapshot()
- defer oldEnv.Restore()
-
- for _, test := range tests {
- var opts envDefaultOptions
- oldEnv.Restore()
- for envKey, envValue := range test.env {
- os.Setenv(envKey, envValue)
- }
- _, err := ParseArgs(&opts, test.args)
- if err != nil {
- t.Fatalf("%s:\nUnexpected error: %v", test.msg, err)
- }
-
- if opts.Slice == nil {
- opts.Slice = []int{}
- }
-
- if !reflect.DeepEqual(opts, test.expected) {
- t.Errorf("%s:\nUnexpected options with arguments %+v\nexpected\n%+v\nbut got\n%+v\n", test.msg, test.args, test.expected, opts)
- }
- }
-}
-
-func TestOptionAsArgument(t *testing.T) {
- var tests = []struct {
- args []string
- expectError bool
- errType ErrorType
- errMsg string
- rest []string
- }{
- {
- // short option must not be accepted as argument
- args: []string{"--string-slice", "foobar", "--string-slice", "-o"},
- expectError: true,
- errType: ErrExpectedArgument,
- errMsg: "expected argument for flag `" + defaultLongOptDelimiter + "string-slice', but got option `-o'",
- },
- {
- // long option must not be accepted as argument
- args: []string{"--string-slice", "foobar", "--string-slice", "--other-option"},
- expectError: true,
- errType: ErrExpectedArgument,
- errMsg: "expected argument for flag `" + defaultLongOptDelimiter + "string-slice', but got option `--other-option'",
- },
- {
- // long option must not be accepted as argument
- args: []string{"--string-slice", "--"},
- expectError: true,
- errType: ErrExpectedArgument,
- errMsg: "expected argument for flag `" + defaultLongOptDelimiter + "string-slice', but got double dash `--'",
- },
- {
- // quoted and appended option should be accepted as argument (even if it looks like an option)
- args: []string{"--string-slice", "foobar", "--string-slice=\"--other-option\""},
- },
- {
- // Accept any single character arguments including '-'
- args: []string{"--string-slice", "-"},
- },
- {
- // Do not accept arguments which start with '-' even if the next character is a digit
- args: []string{"--string-slice", "-3.14"},
- expectError: true,
- errType: ErrExpectedArgument,
- errMsg: "expected argument for flag `" + defaultLongOptDelimiter + "string-slice', but got option `-3.14'",
- },
- {
- // Do not accept arguments which start with '-' if the next character is not a digit
- args: []string{"--string-slice", "-character"},
- expectError: true,
- errType: ErrExpectedArgument,
- errMsg: "expected argument for flag `" + defaultLongOptDelimiter + "string-slice', but got option `-character'",
- },
- {
- args: []string{"-o", "-", "-"},
- rest: []string{"-", "-"},
- },
- }
- var opts struct {
- StringSlice []string `long:"string-slice"`
- OtherOption bool `long:"other-option" short:"o"`
- }
-
- for _, test := range tests {
- if test.expectError {
- assertParseFail(t, test.errType, test.errMsg, &opts, test.args...)
- } else {
- args := assertParseSuccess(t, &opts, test.args...)
-
- assertStringArray(t, args, test.rest)
- }
- }
-}
-
-func TestUnknownFlagHandler(t *testing.T) {
-
- var opts struct {
- Flag1 string `long:"flag1"`
- Flag2 string `long:"flag2"`
- }
-
- p := NewParser(&opts, None)
-
- var unknownFlag1 string
- var unknownFlag2 bool
- var unknownFlag3 string
-
- // Set up a callback to intercept unknown options during parsing
- p.UnknownOptionHandler = func(option string, arg SplitArgument, args []string) ([]string, error) {
- if option == "unknownFlag1" {
- if argValue, ok := arg.Value(); ok {
- unknownFlag1 = argValue
- return args, nil
- }
- // consume a value from remaining args list
- unknownFlag1 = args[0]
- return args[1:], nil
- } else if option == "unknownFlag2" {
- // treat this one as a bool switch, don't consume any args
- unknownFlag2 = true
- return args, nil
- } else if option == "unknownFlag3" {
- if argValue, ok := arg.Value(); ok {
- unknownFlag3 = argValue
- return args, nil
- }
- // consume a value from remaining args list
- unknownFlag3 = args[0]
- return args[1:], nil
- }
-
- return args, fmt.Errorf("Unknown flag: %v", option)
- }
-
- // Parse args containing some unknown flags, verify that
- // our callback can handle all of them
- _, err := p.ParseArgs([]string{"--flag1=stuff", "--unknownFlag1", "blah", "--unknownFlag2", "--unknownFlag3=baz", "--flag2=foo"})
-
- if err != nil {
- assertErrorf(t, "Parser returned unexpected error %v", err)
- }
-
- assertString(t, opts.Flag1, "stuff")
- assertString(t, opts.Flag2, "foo")
- assertString(t, unknownFlag1, "blah")
- assertString(t, unknownFlag3, "baz")
-
- if !unknownFlag2 {
- assertErrorf(t, "Flag should have been set by unknown handler, but had value: %v", unknownFlag2)
- }
-
- // Parse args with unknown flags that callback doesn't handle, verify it returns error
- _, err = p.ParseArgs([]string{"--flag1=stuff", "--unknownFlagX", "blah", "--flag2=foo"})
-
- if err == nil {
- assertErrorf(t, "Parser should have returned error, but returned nil")
- }
-}
-
-func TestChoices(t *testing.T) {
- var opts struct {
- Choice string `long:"choose" choice:"v1" choice:"v2"`
- }
-
- assertParseFail(t, ErrInvalidChoice, "Invalid value `invalid' for option `"+defaultLongOptDelimiter+"choose'. Allowed values are: v1 or v2", &opts, "--choose", "invalid")
- assertParseSuccess(t, &opts, "--choose", "v2")
- assertString(t, opts.Choice, "v2")
-}
-
-func TestEmbedded(t *testing.T) {
- type embedded struct {
- V bool `short:"v"`
- }
- var opts struct {
- embedded
- }
-
- assertParseSuccess(t, &opts, "-v")
- if !opts.V {
- t.Errorf("Expected V to be true")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/pointer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/pointer_test.go
deleted file mode 100644
index e17445f696c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/pointer_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestPointerBool(t *testing.T) {
- var opts = struct {
- Value *bool `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v")
-
- assertStringArray(t, ret, []string{})
-
- if !*opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestPointerString(t *testing.T) {
- var opts = struct {
- Value *string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v", "value")
-
- assertStringArray(t, ret, []string{})
- assertString(t, *opts.Value, "value")
-}
-
-func TestPointerSlice(t *testing.T) {
- var opts = struct {
- Value *[]string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v", "value1", "-v", "value2")
-
- assertStringArray(t, ret, []string{})
- assertStringArray(t, *opts.Value, []string{"value1", "value2"})
-}
-
-func TestPointerMap(t *testing.T) {
- var opts = struct {
- Value *map[string]int `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v", "k1:2", "-v", "k2:-5")
-
- assertStringArray(t, ret, []string{})
-
- if v, ok := (*opts.Value)["k1"]; !ok {
- t.Errorf("Expected key \"k1\" to exist")
- } else if v != 2 {
- t.Errorf("Expected \"k1\" to be 2, but got %#v", v)
- }
-
- if v, ok := (*opts.Value)["k2"]; !ok {
- t.Errorf("Expected key \"k2\" to exist")
- } else if v != -5 {
- t.Errorf("Expected \"k2\" to be -5, but got %#v", v)
- }
-}
-
-type PointerGroup struct {
- Value bool `short:"v"`
-}
-
-func TestPointerGroup(t *testing.T) {
- var opts = struct {
- Group *PointerGroup `group:"Group Options"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Group.Value {
- t.Errorf("Expected Group.Value to be true")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/short_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/short_test.go
deleted file mode 100644
index 95712c16238..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/short_test.go
+++ /dev/null
@@ -1,194 +0,0 @@
-package flags
-
-import (
- "fmt"
- "testing"
-)
-
-func TestShort(t *testing.T) {
- var opts = struct {
- Value bool `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.Value {
- t.Errorf("Expected Value to be true")
- }
-}
-
-func TestShortTooLong(t *testing.T) {
- var opts = struct {
- Value bool `short:"vv"`
- }{}
-
- assertParseFail(t, ErrShortNameTooLong, "short names can only be 1 character long, not `vv'", &opts)
-}
-
-func TestShortRequired(t *testing.T) {
- var opts = struct {
- Value bool `short:"v" required:"true"`
- }{}
-
- assertParseFail(t, ErrRequired, fmt.Sprintf("the required flag `%cv' was not specified", defaultShortOptDelimiter), &opts)
-}
-
-func TestShortMultiConcat(t *testing.T) {
- var opts = struct {
- V bool `short:"v"`
- O bool `short:"o"`
- F bool `short:"f"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-vo", "-f")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.V {
- t.Errorf("Expected V to be true")
- }
-
- if !opts.O {
- t.Errorf("Expected O to be true")
- }
-
- if !opts.F {
- t.Errorf("Expected F to be true")
- }
-}
-
-func TestShortMultiRequiredConcat(t *testing.T) {
- var opts = struct {
- V bool `short:"v" required:"true"`
- O bool `short:"o" required:"true"`
- F bool `short:"f" required:"true"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-vo", "-f")
-
- assertStringArray(t, ret, []string{})
-
- if !opts.V {
- t.Errorf("Expected V to be true")
- }
-
- if !opts.O {
- t.Errorf("Expected O to be true")
- }
-
- if !opts.F {
- t.Errorf("Expected F to be true")
- }
-}
-
-func TestShortMultiSlice(t *testing.T) {
- var opts = struct {
- Values []bool `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v", "-v")
-
- assertStringArray(t, ret, []string{})
- assertBoolArray(t, opts.Values, []bool{true, true})
-}
-
-func TestShortMultiSliceConcat(t *testing.T) {
- var opts = struct {
- Values []bool `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-vvv")
-
- assertStringArray(t, ret, []string{})
- assertBoolArray(t, opts.Values, []bool{true, true, true})
-}
-
-func TestShortWithEqualArg(t *testing.T) {
- var opts = struct {
- Value string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v=value")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestShortWithArg(t *testing.T) {
- var opts = struct {
- Value string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-vvalue")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestShortArg(t *testing.T) {
- var opts = struct {
- Value string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-v", "value")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "value")
-}
-
-func TestShortMultiWithEqualArg(t *testing.T) {
- var opts = struct {
- F []bool `short:"f"`
- Value string `short:"v"`
- }{}
-
- assertParseFail(t, ErrExpectedArgument, fmt.Sprintf("expected argument for flag `%cv'", defaultShortOptDelimiter), &opts, "-ffv=value")
-}
-
-func TestShortMultiArg(t *testing.T) {
- var opts = struct {
- F []bool `short:"f"`
- Value string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-ffv", "value")
-
- assertStringArray(t, ret, []string{})
- assertBoolArray(t, opts.F, []bool{true, true})
- assertString(t, opts.Value, "value")
-}
-
-func TestShortMultiArgConcatFail(t *testing.T) {
- var opts = struct {
- F []bool `short:"f"`
- Value string `short:"v"`
- }{}
-
- assertParseFail(t, ErrExpectedArgument, fmt.Sprintf("expected argument for flag `%cv'", defaultShortOptDelimiter), &opts, "-ffvvalue")
-}
-
-func TestShortMultiArgConcat(t *testing.T) {
- var opts = struct {
- F []bool `short:"f"`
- Value string `short:"v"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-vff")
-
- assertStringArray(t, ret, []string{})
- assertString(t, opts.Value, "ff")
-}
-
-func TestShortOptional(t *testing.T) {
- var opts = struct {
- F []bool `short:"f"`
- Value string `short:"v" optional:"yes" optional-value:"value"`
- }{}
-
- ret := assertParseSuccess(t, &opts, "-fv", "f")
-
- assertStringArray(t, ret, []string{"f"})
- assertString(t, opts.Value, "value")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/tag_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/tag_test.go
deleted file mode 100644
index 9daa7401b91..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/tag_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestTagMissingColon(t *testing.T) {
- var opts = struct {
- Value bool `short`
- }{}
-
- assertParseFail(t, ErrTag, "expected `:' after key name, but got end of tag (in `short`)", &opts, "")
-}
-
-func TestTagMissingValue(t *testing.T) {
- var opts = struct {
- Value bool `short:`
- }{}
-
- assertParseFail(t, ErrTag, "expected `\"' to start tag value at end of tag (in `short:`)", &opts, "")
-}
-
-func TestTagMissingQuote(t *testing.T) {
- var opts = struct {
- Value bool `short:"v`
- }{}
-
- assertParseFail(t, ErrTag, "expected end of tag value `\"' at end of tag (in `short:\"v`)", &opts, "")
-}
-
-func TestTagNewline(t *testing.T) {
- var opts = struct {
- Value bool `long:"verbose" description:"verbose
-something"`
- }{}
-
- assertParseFail(t, ErrTag, "unexpected newline in tag value `description' (in `long:\"verbose\" description:\"verbose\nsomething\"`)", &opts, "")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/unknown_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/unknown_test.go
deleted file mode 100644
index 858be45885e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jessevdk/go-flags/unknown_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package flags
-
-import (
- "testing"
-)
-
-func TestUnknownFlags(t *testing.T) {
- var opts = struct {
- Verbose []bool `short:"v" long:"verbose" description:"Verbose output"`
- }{}
-
- args := []string{
- "-f",
- }
-
- p := NewParser(&opts, 0)
- args, err := p.ParseArgs(args)
-
- if err == nil {
- t.Fatal("Expected error for unknown argument")
- }
-}
-
-func TestIgnoreUnknownFlags(t *testing.T) {
- var opts = struct {
- Verbose []bool `short:"v" long:"verbose" description:"Verbose output"`
- }{}
-
- args := []string{
- "hello",
- "world",
- "-v",
- "--foo=bar",
- "--verbose",
- "-f",
- }
-
- p := NewParser(&opts, IgnoreUnknown)
- args, err := p.ParseArgs(args)
-
- if err != nil {
- t.Fatal(err)
- }
-
- exargs := []string{
- "hello",
- "world",
- "--foo=bar",
- "-f",
- }
-
- issame := (len(args) == len(exargs))
-
- if issame {
- for i := 0; i < len(args); i++ {
- if args[i] != exargs[i] {
- issame = false
- break
- }
- }
- }
-
- if !issame {
- t.Fatalf("Expected %v but got %v", exargs, args)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jtolds/gls/context_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jtolds/gls/context_test.go
deleted file mode 100644
index ae5bde4aede..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/jtolds/gls/context_test.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package gls
-
-import (
- "fmt"
- "sync"
- "testing"
-)
-
-func TestContexts(t *testing.T) {
- mgr1 := NewContextManager()
- mgr2 := NewContextManager()
-
- CheckVal := func(mgr *ContextManager, key, exp_val string) {
- val, ok := mgr.GetValue(key)
- if len(exp_val) == 0 {
- if ok {
- t.Fatalf("expected no value for key %s, got %s", key, val)
- }
- return
- }
- if !ok {
- t.Fatalf("expected value %s for key %s, got no value",
- exp_val, key)
- }
- if exp_val != val {
- t.Fatalf("expected value %s for key %s, got %s", exp_val, key,
- val)
- }
-
- }
-
- Check := func(exp_m1v1, exp_m1v2, exp_m2v1, exp_m2v2 string) {
- CheckVal(mgr1, "key1", exp_m1v1)
- CheckVal(mgr1, "key2", exp_m1v2)
- CheckVal(mgr2, "key1", exp_m2v1)
- CheckVal(mgr2, "key2", exp_m2v2)
- }
-
- Check("", "", "", "")
- mgr2.SetValues(Values{"key1": "val1c"}, func() {
- Check("", "", "val1c", "")
- mgr1.SetValues(Values{"key1": "val1a"}, func() {
- Check("val1a", "", "val1c", "")
- mgr1.SetValues(Values{"key2": "val1b"}, func() {
- Check("val1a", "val1b", "val1c", "")
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- defer wg.Done()
- Check("", "", "", "")
- }()
- Go(func() {
- defer wg.Done()
- Check("val1a", "val1b", "val1c", "")
- })
- wg.Wait()
- })
- })
- })
-}
-
-func ExampleContextManager_SetValues() {
- var (
- mgr = NewContextManager()
- request_id_key = GenSym()
- )
-
- MyLog := func() {
- if request_id, ok := mgr.GetValue(request_id_key); ok {
- fmt.Println("My request id is:", request_id)
- } else {
- fmt.Println("No request id found")
- }
- }
-
- mgr.SetValues(Values{request_id_key: "12345"}, func() {
- MyLog()
- })
- MyLog()
-
- // Output: My request id is: 12345
- // No request id found
-}
-
-func ExampleGo() {
- var (
- mgr = NewContextManager()
- request_id_key = GenSym()
- )
-
- MyLog := func() {
- if request_id, ok := mgr.GetValue(request_id_key); ok {
- fmt.Println("My request id is:", request_id)
- } else {
- fmt.Println("No request id found")
- }
- }
-
- mgr.SetValues(Values{request_id_key: "12345"}, func() {
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- defer wg.Done()
- MyLog()
- }()
- wg.Wait()
- wg.Add(1)
- Go(func() {
- defer wg.Done()
- MyLog()
- })
- wg.Wait()
- })
-
- // Output: No request id found
- // My request id is: 12345
-}
-
-func BenchmarkGetValue(b *testing.B) {
- mgr := NewContextManager()
- mgr.SetValues(Values{"test_key": "test_val"}, func() {
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- val, ok := mgr.GetValue("test_key")
- if !ok || val != "test_val" {
- b.FailNow()
- }
- }
- })
-}
-
-func BenchmarkSetValues(b *testing.B) {
- mgr := NewContextManager()
- for i := 0; i < b.N/2; i++ {
- mgr.SetValues(Values{"test_key": "test_val"}, func() {
- mgr.SetValues(Values{"test_key2": "test_val2"}, func() {})
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mattn/go-runewidth/runewidth_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mattn/go-runewidth/runewidth_test.go
deleted file mode 100644
index f9431282c76..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/mattn/go-runewidth/runewidth_test.go
+++ /dev/null
@@ -1,229 +0,0 @@
-package runewidth
-
-import (
- "testing"
-)
-
-var runewidthtests = []struct {
- in rune
- out int
-}{
- {'世', 2},
- {'界', 2},
- {'セ', 1},
- {'カ', 1},
- {'イ', 1},
- {'☆', 2}, // double width in ambiguous
- {'\x00', 0},
- {'\x01', 1},
- {'\u0300', 0},
-}
-
-func TestRuneWidth(t *testing.T) {
- c := NewCondition()
- c.EastAsianWidth = true
- for _, tt := range runewidthtests {
- if out := c.RuneWidth(tt.in); out != tt.out {
- t.Errorf("Width(%q) = %q, want %q", tt.in, out, tt.out)
- }
- }
-}
-
-var isambiguouswidthtests = []struct {
- in rune
- out bool
-}{
- {'世', false},
- {'■', true},
- {'界', false},
- {'○', true},
- {'㈱', false},
- {'①', true},
- {'②', true},
- {'③', true},
- {'④', true},
- {'⑤', true},
- {'⑥', true},
- {'⑦', true},
- {'⑧', true},
- {'⑨', true},
- {'⑩', true},
- {'⑪', true},
- {'⑫', true},
- {'⑬', true},
- {'⑭', true},
- {'⑮', true},
- {'⑯', true},
- {'⑰', true},
- {'⑱', true},
- {'⑲', true},
- {'⑳', true},
- {'☆', true},
-}
-
-func TestIsAmbiguousWidth(t *testing.T) {
- for _, tt := range isambiguouswidthtests {
- if out := IsAmbiguousWidth(tt.in); out != tt.out {
- t.Errorf("IsAmbiguousWidth(%q) = %q, want %q", tt.in, out, tt.out)
- }
- }
-}
-
-var stringwidthtests = []struct {
- in string
- out int
-}{
- {"■㈱の世界①", 12},
- {"スター☆", 8},
-}
-
-func TestStringWidth(t *testing.T) {
- c := NewCondition()
- c.EastAsianWidth = true
- for _, tt := range stringwidthtests {
- if out := c.StringWidth(tt.in); out != tt.out {
- t.Errorf("StringWidth(%q) = %q, want %q", tt.in, out, tt.out)
- }
- }
-}
-
-func TestStringWidthInvalid(t *testing.T) {
- s := "こんにちわ\x00世界"
- if out := StringWidth(s); out != 14 {
- t.Errorf("StringWidth(%q) = %q, want %q", s, out, 14)
- }
-}
-
-func TestTruncateSmaller(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := Truncate(s, 10, "..."); out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestTruncate(t *testing.T) {
- s := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおお..."
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 79 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 79, width)
- }
-}
-
-func TestTruncateFit(t *testing.T) {
- s := "aあいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "aあいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおお..."
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 80 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 80, width)
- }
-}
-
-func TestTruncateJustFit(t *testing.T) {
- s := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 80 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 80, width)
- }
-}
-
-func TestWrap(t *testing.T) {
- s := `東京特許許可局局長はよく柿喰う客だ/東京特許許可局局長はよく柿喰う客だ
-123456789012345678901234567890
-
-END`
- expected := `東京特許許可局局長はよく柿喰う
-客だ/東京特許許可局局長はよく
-柿喰う客だ
-123456789012345678901234567890
-
-END`
-
- if out := Wrap(s, 30); out != expected {
- t.Errorf("Wrap(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestTruncateNoNeeded(t *testing.T) {
- s := "あいうえおあい"
- expected := "あいうえおあい"
-
- if out := Truncate(s, 80, "..."); out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
-}
-
-var isneutralwidthtests = []struct {
- in rune
- out bool
-}{
- {'→', false},
- {'┊', false},
- {'┈', false},
- {'~', false},
- {'└', false},
- {'⣀', true},
- {'⣀', true},
-}
-
-func TestIsNeutralWidth(t *testing.T) {
- for _, tt := range isneutralwidthtests {
- if out := IsNeutralWidth(tt.in); out != tt.out {
- t.Errorf("IsNeutralWidth(%q) = %q, want %q", tt.in, out, tt.out)
- }
- }
-}
-
-func TestFillLeft(t *testing.T) {
- s := "あxいうえお"
- expected := " あxいうえお"
-
- if out := FillLeft(s, 15); out != expected {
- t.Errorf("FillLeft(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillLeftFit(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := FillLeft(s, 10); out != expected {
- t.Errorf("FillLeft(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillRight(t *testing.T) {
- s := "あxいうえお"
- expected := "あxいうえお "
-
- if out := FillRight(s, 15); out != expected {
- t.Errorf("FillRight(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillRightFit(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := FillRight(s, 10); out != expected {
- t.Errorf("FillRight(%q) = %q, want %q", s, out, expected)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/cache_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/cache_test.go
deleted file mode 100644
index 6e81693fb04..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/cache_test.go
+++ /dev/null
@@ -1,1678 +0,0 @@
-package cache
-
-import (
- "bytes"
- "io/ioutil"
- "runtime"
- "strconv"
- "sync"
- "testing"
- "time"
-)
-
-type TestStruct struct {
- Num int
- Children []*TestStruct
-}
-
-func TestCache(t *testing.T) {
- tc := New(DefaultExpiration, 0)
-
- a, found := tc.Get("a")
- if found || a != nil {
- t.Error("Getting A found value that shouldn't exist:", a)
- }
-
- b, found := tc.Get("b")
- if found || b != nil {
- t.Error("Getting B found value that shouldn't exist:", b)
- }
-
- c, found := tc.Get("c")
- if found || c != nil {
- t.Error("Getting C found value that shouldn't exist:", c)
- }
-
- tc.Set("a", 1, DefaultExpiration)
- tc.Set("b", "b", DefaultExpiration)
- tc.Set("c", 3.5, DefaultExpiration)
-
- x, found := tc.Get("a")
- if !found {
- t.Error("a was not found while getting a2")
- }
- if x == nil {
- t.Error("x for a is nil")
- } else if a2 := x.(int); a2+2 != 3 {
- t.Error("a2 (which should be 1) plus 2 does not equal 3; value:", a2)
- }
-
- x, found = tc.Get("b")
- if !found {
- t.Error("b was not found while getting b2")
- }
- if x == nil {
- t.Error("x for b is nil")
- } else if b2 := x.(string); b2+"B" != "bB" {
- t.Error("b2 (which should be b) plus B does not equal bB; value:", b2)
- }
-
- x, found = tc.Get("c")
- if !found {
- t.Error("c was not found while getting c2")
- }
- if x == nil {
- t.Error("x for c is nil")
- } else if c2 := x.(float64); c2+1.2 != 4.7 {
- t.Error("c2 (which should be 3.5) plus 1.2 does not equal 4.7; value:", c2)
- }
-}
-
-func TestCacheTimes(t *testing.T) {
- var found bool
-
- tc := New(50*time.Millisecond, 1*time.Millisecond)
- tc.Set("a", 1, DefaultExpiration)
- tc.Set("b", 2, NoExpiration)
- tc.Set("c", 3, 20*time.Millisecond)
- tc.Set("d", 4, 70*time.Millisecond)
-
- <-time.After(25 * time.Millisecond)
- _, found = tc.Get("c")
- if found {
- t.Error("Found c when it should have been automatically deleted")
- }
-
- <-time.After(30 * time.Millisecond)
- _, found = tc.Get("a")
- if found {
- t.Error("Found a when it should have been automatically deleted")
- }
-
- _, found = tc.Get("b")
- if !found {
- t.Error("Did not find b even though it was set to never expire")
- }
-
- _, found = tc.Get("d")
- if !found {
- t.Error("Did not find d even though it was set to expire later than the default")
- }
-
- <-time.After(20 * time.Millisecond)
- _, found = tc.Get("d")
- if found {
- t.Error("Found d when it should have been automatically deleted (later than the default)")
- }
-}
-
-func TestNewFrom(t *testing.T) {
- m := map[string]Item{
- "a": Item{
- Object: 1,
- Expiration: 0,
- },
- "b": Item{
- Object: 2,
- Expiration: 0,
- },
- }
- tc := NewFrom(DefaultExpiration, 0, m)
- a, found := tc.Get("a")
- if !found {
- t.Fatal("Did not find a")
- }
- if a.(int) != 1 {
- t.Fatal("a is not 1")
- }
- b, found := tc.Get("b")
- if !found {
- t.Fatal("Did not find b")
- }
- if b.(int) != 2 {
- t.Fatal("b is not 2")
- }
-}
-
-func TestStorePointerToStruct(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("foo", &TestStruct{Num: 1}, DefaultExpiration)
- x, found := tc.Get("foo")
- if !found {
- t.Fatal("*TestStruct was not found for foo")
- }
- foo := x.(*TestStruct)
- foo.Num++
-
- y, found := tc.Get("foo")
- if !found {
- t.Fatal("*TestStruct was not found for foo (second time)")
- }
- bar := y.(*TestStruct)
- if bar.Num != 2 {
- t.Fatal("TestStruct.Num is not 2")
- }
-}
-
-func TestIncrementWithInt(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint", 1, DefaultExpiration)
- err := tc.Increment("tint", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tint")
- if !found {
- t.Error("tint was not found")
- }
- if x.(int) != 3 {
- t.Error("tint is not 3:", x)
- }
-}
-
-func TestIncrementWithInt8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint8", int8(1), DefaultExpiration)
- err := tc.Increment("tint8", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tint8")
- if !found {
- t.Error("tint8 was not found")
- }
- if x.(int8) != 3 {
- t.Error("tint8 is not 3:", x)
- }
-}
-
-func TestIncrementWithInt16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint16", int16(1), DefaultExpiration)
- err := tc.Increment("tint16", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tint16")
- if !found {
- t.Error("tint16 was not found")
- }
- if x.(int16) != 3 {
- t.Error("tint16 is not 3:", x)
- }
-}
-
-func TestIncrementWithInt32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint32", int32(1), DefaultExpiration)
- err := tc.Increment("tint32", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tint32")
- if !found {
- t.Error("tint32 was not found")
- }
- if x.(int32) != 3 {
- t.Error("tint32 is not 3:", x)
- }
-}
-
-func TestIncrementWithInt64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint64", int64(1), DefaultExpiration)
- err := tc.Increment("tint64", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tint64")
- if !found {
- t.Error("tint64 was not found")
- }
- if x.(int64) != 3 {
- t.Error("tint64 is not 3:", x)
- }
-}
-
-func TestIncrementWithUint(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint", uint(1), DefaultExpiration)
- err := tc.Increment("tuint", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tuint")
- if !found {
- t.Error("tuint was not found")
- }
- if x.(uint) != 3 {
- t.Error("tuint is not 3:", x)
- }
-}
-
-func TestIncrementWithUintptr(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuintptr", uintptr(1), DefaultExpiration)
- err := tc.Increment("tuintptr", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
-
- x, found := tc.Get("tuintptr")
- if !found {
- t.Error("tuintptr was not found")
- }
- if x.(uintptr) != 3 {
- t.Error("tuintptr is not 3:", x)
- }
-}
-
-func TestIncrementWithUint8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint8", uint8(1), DefaultExpiration)
- err := tc.Increment("tuint8", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tuint8")
- if !found {
- t.Error("tuint8 was not found")
- }
- if x.(uint8) != 3 {
- t.Error("tuint8 is not 3:", x)
- }
-}
-
-func TestIncrementWithUint16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint16", uint16(1), DefaultExpiration)
- err := tc.Increment("tuint16", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
-
- x, found := tc.Get("tuint16")
- if !found {
- t.Error("tuint16 was not found")
- }
- if x.(uint16) != 3 {
- t.Error("tuint16 is not 3:", x)
- }
-}
-
-func TestIncrementWithUint32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint32", uint32(1), DefaultExpiration)
- err := tc.Increment("tuint32", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("tuint32")
- if !found {
- t.Error("tuint32 was not found")
- }
- if x.(uint32) != 3 {
- t.Error("tuint32 is not 3:", x)
- }
-}
-
-func TestIncrementWithUint64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint64", uint64(1), DefaultExpiration)
- err := tc.Increment("tuint64", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
-
- x, found := tc.Get("tuint64")
- if !found {
- t.Error("tuint64 was not found")
- }
- if x.(uint64) != 3 {
- t.Error("tuint64 is not 3:", x)
- }
-}
-
-func TestIncrementWithFloat32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float32", float32(1.5), DefaultExpiration)
- err := tc.Increment("float32", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("float32")
- if !found {
- t.Error("float32 was not found")
- }
- if x.(float32) != 3.5 {
- t.Error("float32 is not 3.5:", x)
- }
-}
-
-func TestIncrementWithFloat64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float64", float64(1.5), DefaultExpiration)
- err := tc.Increment("float64", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- x, found := tc.Get("float64")
- if !found {
- t.Error("float64 was not found")
- }
- if x.(float64) != 3.5 {
- t.Error("float64 is not 3.5:", x)
- }
-}
-
-func TestIncrementFloatWithFloat32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float32", float32(1.5), DefaultExpiration)
- err := tc.IncrementFloat("float32", 2)
- if err != nil {
- t.Error("Error incrementfloating:", err)
- }
- x, found := tc.Get("float32")
- if !found {
- t.Error("float32 was not found")
- }
- if x.(float32) != 3.5 {
- t.Error("float32 is not 3.5:", x)
- }
-}
-
-func TestIncrementFloatWithFloat64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float64", float64(1.5), DefaultExpiration)
- err := tc.IncrementFloat("float64", 2)
- if err != nil {
- t.Error("Error incrementfloating:", err)
- }
- x, found := tc.Get("float64")
- if !found {
- t.Error("float64 was not found")
- }
- if x.(float64) != 3.5 {
- t.Error("float64 is not 3.5:", x)
- }
-}
-
-func TestDecrementWithInt(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int", int(5), DefaultExpiration)
- err := tc.Decrement("int", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("int")
- if !found {
- t.Error("int was not found")
- }
- if x.(int) != 3 {
- t.Error("int is not 3:", x)
- }
-}
-
-func TestDecrementWithInt8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int8", int8(5), DefaultExpiration)
- err := tc.Decrement("int8", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("int8")
- if !found {
- t.Error("int8 was not found")
- }
- if x.(int8) != 3 {
- t.Error("int8 is not 3:", x)
- }
-}
-
-func TestDecrementWithInt16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int16", int16(5), DefaultExpiration)
- err := tc.Decrement("int16", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("int16")
- if !found {
- t.Error("int16 was not found")
- }
- if x.(int16) != 3 {
- t.Error("int16 is not 3:", x)
- }
-}
-
-func TestDecrementWithInt32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int32", int32(5), DefaultExpiration)
- err := tc.Decrement("int32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("int32")
- if !found {
- t.Error("int32 was not found")
- }
- if x.(int32) != 3 {
- t.Error("int32 is not 3:", x)
- }
-}
-
-func TestDecrementWithInt64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int64", int64(5), DefaultExpiration)
- err := tc.Decrement("int64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("int64")
- if !found {
- t.Error("int64 was not found")
- }
- if x.(int64) != 3 {
- t.Error("int64 is not 3:", x)
- }
-}
-
-func TestDecrementWithUint(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint", uint(5), DefaultExpiration)
- err := tc.Decrement("uint", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("uint")
- if !found {
- t.Error("uint was not found")
- }
- if x.(uint) != 3 {
- t.Error("uint is not 3:", x)
- }
-}
-
-func TestDecrementWithUintptr(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uintptr", uintptr(5), DefaultExpiration)
- err := tc.Decrement("uintptr", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("uintptr")
- if !found {
- t.Error("uintptr was not found")
- }
- if x.(uintptr) != 3 {
- t.Error("uintptr is not 3:", x)
- }
-}
-
-func TestDecrementWithUint8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint8", uint8(5), DefaultExpiration)
- err := tc.Decrement("uint8", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("uint8")
- if !found {
- t.Error("uint8 was not found")
- }
- if x.(uint8) != 3 {
- t.Error("uint8 is not 3:", x)
- }
-}
-
-func TestDecrementWithUint16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint16", uint16(5), DefaultExpiration)
- err := tc.Decrement("uint16", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("uint16")
- if !found {
- t.Error("uint16 was not found")
- }
- if x.(uint16) != 3 {
- t.Error("uint16 is not 3:", x)
- }
-}
-
-func TestDecrementWithUint32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint32", uint32(5), DefaultExpiration)
- err := tc.Decrement("uint32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("uint32")
- if !found {
- t.Error("uint32 was not found")
- }
- if x.(uint32) != 3 {
- t.Error("uint32 is not 3:", x)
- }
-}
-
-func TestDecrementWithUint64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint64", uint64(5), DefaultExpiration)
- err := tc.Decrement("uint64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("uint64")
- if !found {
- t.Error("uint64 was not found")
- }
- if x.(uint64) != 3 {
- t.Error("uint64 is not 3:", x)
- }
-}
-
-func TestDecrementWithFloat32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float32", float32(5.5), DefaultExpiration)
- err := tc.Decrement("float32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("float32")
- if !found {
- t.Error("float32 was not found")
- }
- if x.(float32) != 3.5 {
- t.Error("float32 is not 3:", x)
- }
-}
-
-func TestDecrementWithFloat64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float64", float64(5.5), DefaultExpiration)
- err := tc.Decrement("float64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("float64")
- if !found {
- t.Error("float64 was not found")
- }
- if x.(float64) != 3.5 {
- t.Error("float64 is not 3:", x)
- }
-}
-
-func TestDecrementFloatWithFloat32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float32", float32(5.5), DefaultExpiration)
- err := tc.DecrementFloat("float32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("float32")
- if !found {
- t.Error("float32 was not found")
- }
- if x.(float32) != 3.5 {
- t.Error("float32 is not 3:", x)
- }
-}
-
-func TestDecrementFloatWithFloat64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float64", float64(5.5), DefaultExpiration)
- err := tc.DecrementFloat("float64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- x, found := tc.Get("float64")
- if !found {
- t.Error("float64 was not found")
- }
- if x.(float64) != 3.5 {
- t.Error("float64 is not 3:", x)
- }
-}
-
-func TestIncrementInt(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint", 1, DefaultExpiration)
- n, err := tc.IncrementInt("tint", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tint")
- if !found {
- t.Error("tint was not found")
- }
- if x.(int) != 3 {
- t.Error("tint is not 3:", x)
- }
-}
-
-func TestIncrementInt8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint8", int8(1), DefaultExpiration)
- n, err := tc.IncrementInt8("tint8", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tint8")
- if !found {
- t.Error("tint8 was not found")
- }
- if x.(int8) != 3 {
- t.Error("tint8 is not 3:", x)
- }
-}
-
-func TestIncrementInt16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint16", int16(1), DefaultExpiration)
- n, err := tc.IncrementInt16("tint16", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tint16")
- if !found {
- t.Error("tint16 was not found")
- }
- if x.(int16) != 3 {
- t.Error("tint16 is not 3:", x)
- }
-}
-
-func TestIncrementInt32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint32", int32(1), DefaultExpiration)
- n, err := tc.IncrementInt32("tint32", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tint32")
- if !found {
- t.Error("tint32 was not found")
- }
- if x.(int32) != 3 {
- t.Error("tint32 is not 3:", x)
- }
-}
-
-func TestIncrementInt64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tint64", int64(1), DefaultExpiration)
- n, err := tc.IncrementInt64("tint64", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tint64")
- if !found {
- t.Error("tint64 was not found")
- }
- if x.(int64) != 3 {
- t.Error("tint64 is not 3:", x)
- }
-}
-
-func TestIncrementUint(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint", uint(1), DefaultExpiration)
- n, err := tc.IncrementUint("tuint", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tuint")
- if !found {
- t.Error("tuint was not found")
- }
- if x.(uint) != 3 {
- t.Error("tuint is not 3:", x)
- }
-}
-
-func TestIncrementUintptr(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuintptr", uintptr(1), DefaultExpiration)
- n, err := tc.IncrementUintptr("tuintptr", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tuintptr")
- if !found {
- t.Error("tuintptr was not found")
- }
- if x.(uintptr) != 3 {
- t.Error("tuintptr is not 3:", x)
- }
-}
-
-func TestIncrementUint8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint8", uint8(1), DefaultExpiration)
- n, err := tc.IncrementUint8("tuint8", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tuint8")
- if !found {
- t.Error("tuint8 was not found")
- }
- if x.(uint8) != 3 {
- t.Error("tuint8 is not 3:", x)
- }
-}
-
-func TestIncrementUint16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint16", uint16(1), DefaultExpiration)
- n, err := tc.IncrementUint16("tuint16", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tuint16")
- if !found {
- t.Error("tuint16 was not found")
- }
- if x.(uint16) != 3 {
- t.Error("tuint16 is not 3:", x)
- }
-}
-
-func TestIncrementUint32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint32", uint32(1), DefaultExpiration)
- n, err := tc.IncrementUint32("tuint32", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tuint32")
- if !found {
- t.Error("tuint32 was not found")
- }
- if x.(uint32) != 3 {
- t.Error("tuint32 is not 3:", x)
- }
-}
-
-func TestIncrementUint64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("tuint64", uint64(1), DefaultExpiration)
- n, err := tc.IncrementUint64("tuint64", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("tuint64")
- if !found {
- t.Error("tuint64 was not found")
- }
- if x.(uint64) != 3 {
- t.Error("tuint64 is not 3:", x)
- }
-}
-
-func TestIncrementFloat32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float32", float32(1.5), DefaultExpiration)
- n, err := tc.IncrementFloat32("float32", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3.5 {
- t.Error("Returned number is not 3.5:", n)
- }
- x, found := tc.Get("float32")
- if !found {
- t.Error("float32 was not found")
- }
- if x.(float32) != 3.5 {
- t.Error("float32 is not 3.5:", x)
- }
-}
-
-func TestIncrementFloat64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float64", float64(1.5), DefaultExpiration)
- n, err := tc.IncrementFloat64("float64", 2)
- if err != nil {
- t.Error("Error incrementing:", err)
- }
- if n != 3.5 {
- t.Error("Returned number is not 3.5:", n)
- }
- x, found := tc.Get("float64")
- if !found {
- t.Error("float64 was not found")
- }
- if x.(float64) != 3.5 {
- t.Error("float64 is not 3.5:", x)
- }
-}
-
-func TestDecrementInt8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int8", int8(5), DefaultExpiration)
- n, err := tc.DecrementInt8("int8", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("int8")
- if !found {
- t.Error("int8 was not found")
- }
- if x.(int8) != 3 {
- t.Error("int8 is not 3:", x)
- }
-}
-
-func TestDecrementInt16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int16", int16(5), DefaultExpiration)
- n, err := tc.DecrementInt16("int16", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("int16")
- if !found {
- t.Error("int16 was not found")
- }
- if x.(int16) != 3 {
- t.Error("int16 is not 3:", x)
- }
-}
-
-func TestDecrementInt32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int32", int32(5), DefaultExpiration)
- n, err := tc.DecrementInt32("int32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("int32")
- if !found {
- t.Error("int32 was not found")
- }
- if x.(int32) != 3 {
- t.Error("int32 is not 3:", x)
- }
-}
-
-func TestDecrementInt64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int64", int64(5), DefaultExpiration)
- n, err := tc.DecrementInt64("int64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("int64")
- if !found {
- t.Error("int64 was not found")
- }
- if x.(int64) != 3 {
- t.Error("int64 is not 3:", x)
- }
-}
-
-func TestDecrementUint(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint", uint(5), DefaultExpiration)
- n, err := tc.DecrementUint("uint", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("uint")
- if !found {
- t.Error("uint was not found")
- }
- if x.(uint) != 3 {
- t.Error("uint is not 3:", x)
- }
-}
-
-func TestDecrementUintptr(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uintptr", uintptr(5), DefaultExpiration)
- n, err := tc.DecrementUintptr("uintptr", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("uintptr")
- if !found {
- t.Error("uintptr was not found")
- }
- if x.(uintptr) != 3 {
- t.Error("uintptr is not 3:", x)
- }
-}
-
-func TestDecrementUint8(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint8", uint8(5), DefaultExpiration)
- n, err := tc.DecrementUint8("uint8", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("uint8")
- if !found {
- t.Error("uint8 was not found")
- }
- if x.(uint8) != 3 {
- t.Error("uint8 is not 3:", x)
- }
-}
-
-func TestDecrementUint16(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint16", uint16(5), DefaultExpiration)
- n, err := tc.DecrementUint16("uint16", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("uint16")
- if !found {
- t.Error("uint16 was not found")
- }
- if x.(uint16) != 3 {
- t.Error("uint16 is not 3:", x)
- }
-}
-
-func TestDecrementUint32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint32", uint32(5), DefaultExpiration)
- n, err := tc.DecrementUint32("uint32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("uint32")
- if !found {
- t.Error("uint32 was not found")
- }
- if x.(uint32) != 3 {
- t.Error("uint32 is not 3:", x)
- }
-}
-
-func TestDecrementUint64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint64", uint64(5), DefaultExpiration)
- n, err := tc.DecrementUint64("uint64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("uint64")
- if !found {
- t.Error("uint64 was not found")
- }
- if x.(uint64) != 3 {
- t.Error("uint64 is not 3:", x)
- }
-}
-
-func TestDecrementFloat32(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float32", float32(5), DefaultExpiration)
- n, err := tc.DecrementFloat32("float32", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("float32")
- if !found {
- t.Error("float32 was not found")
- }
- if x.(float32) != 3 {
- t.Error("float32 is not 3:", x)
- }
-}
-
-func TestDecrementFloat64(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("float64", float64(5), DefaultExpiration)
- n, err := tc.DecrementFloat64("float64", 2)
- if err != nil {
- t.Error("Error decrementing:", err)
- }
- if n != 3 {
- t.Error("Returned number is not 3:", n)
- }
- x, found := tc.Get("float64")
- if !found {
- t.Error("float64 was not found")
- }
- if x.(float64) != 3 {
- t.Error("float64 is not 3:", x)
- }
-}
-
-func TestAdd(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- err := tc.Add("foo", "bar", DefaultExpiration)
- if err != nil {
- t.Error("Couldn't add foo even though it shouldn't exist")
- }
- err = tc.Add("foo", "baz", DefaultExpiration)
- if err == nil {
- t.Error("Successfully added another foo when it should have returned an error")
- }
-}
-
-func TestReplace(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- err := tc.Replace("foo", "bar", DefaultExpiration)
- if err == nil {
- t.Error("Replaced foo when it shouldn't exist")
- }
- tc.Set("foo", "bar", DefaultExpiration)
- err = tc.Replace("foo", "bar", DefaultExpiration)
- if err != nil {
- t.Error("Couldn't replace existing key foo")
- }
-}
-
-func TestDelete(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("foo", "bar", DefaultExpiration)
- tc.Delete("foo")
- x, found := tc.Get("foo")
- if found {
- t.Error("foo was found, but it should have been deleted")
- }
- if x != nil {
- t.Error("x is not nil:", x)
- }
-}
-
-func TestItemCount(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("foo", "1", DefaultExpiration)
- tc.Set("bar", "2", DefaultExpiration)
- tc.Set("baz", "3", DefaultExpiration)
- if n := tc.ItemCount(); n != 3 {
- t.Errorf("Item count is not 3: %d", n)
- }
-}
-
-func TestFlush(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("foo", "bar", DefaultExpiration)
- tc.Set("baz", "yes", DefaultExpiration)
- tc.Flush()
- x, found := tc.Get("foo")
- if found {
- t.Error("foo was found, but it should have been deleted")
- }
- if x != nil {
- t.Error("x is not nil:", x)
- }
- x, found = tc.Get("baz")
- if found {
- t.Error("baz was found, but it should have been deleted")
- }
- if x != nil {
- t.Error("x is not nil:", x)
- }
-}
-
-func TestIncrementOverflowInt(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("int8", int8(127), DefaultExpiration)
- err := tc.Increment("int8", 1)
- if err != nil {
- t.Error("Error incrementing int8:", err)
- }
- x, _ := tc.Get("int8")
- int8 := x.(int8)
- if int8 != -128 {
- t.Error("int8 did not overflow as expected; value:", int8)
- }
-
-}
-
-func TestIncrementOverflowUint(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint8", uint8(255), DefaultExpiration)
- err := tc.Increment("uint8", 1)
- if err != nil {
- t.Error("Error incrementing int8:", err)
- }
- x, _ := tc.Get("uint8")
- uint8 := x.(uint8)
- if uint8 != 0 {
- t.Error("uint8 did not overflow as expected; value:", uint8)
- }
-}
-
-func TestDecrementUnderflowUint(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("uint8", uint8(0), DefaultExpiration)
- err := tc.Decrement("uint8", 1)
- if err != nil {
- t.Error("Error decrementing int8:", err)
- }
- x, _ := tc.Get("uint8")
- uint8 := x.(uint8)
- if uint8 != 255 {
- t.Error("uint8 did not underflow as expected; value:", uint8)
- }
-}
-
-func TestOnEvicted(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Set("foo", 3, DefaultExpiration)
- if tc.onEvicted != nil {
- t.Fatal("tc.onEvicted is not nil")
- }
- works := false
- tc.OnEvicted(func(k string, v interface{}) {
- if k == "foo" && v.(int) == 3 {
- works = true
- }
- tc.Set("bar", 4, DefaultExpiration)
- })
- tc.Delete("foo")
- x, _ := tc.Get("bar")
- if !works {
- t.Error("works bool not true")
- }
- if x.(int) != 4 {
- t.Error("bar was not 4")
- }
-}
-
-func TestCacheSerialization(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- testFillAndSerialize(t, tc)
-
- // Check if gob.Register behaves properly even after multiple gob.Register
- // on c.Items (many of which will be the same type)
- testFillAndSerialize(t, tc)
-}
-
-func testFillAndSerialize(t *testing.T, tc *Cache) {
- tc.Set("a", "a", DefaultExpiration)
- tc.Set("b", "b", DefaultExpiration)
- tc.Set("c", "c", DefaultExpiration)
- tc.Set("expired", "foo", 1*time.Millisecond)
- tc.Set("*struct", &TestStruct{Num: 1}, DefaultExpiration)
- tc.Set("[]struct", []TestStruct{
- {Num: 2},
- {Num: 3},
- }, DefaultExpiration)
- tc.Set("[]*struct", []*TestStruct{
- &TestStruct{Num: 4},
- &TestStruct{Num: 5},
- }, DefaultExpiration)
- tc.Set("structception", &TestStruct{
- Num: 42,
- Children: []*TestStruct{
- &TestStruct{Num: 6174},
- &TestStruct{Num: 4716},
- },
- }, DefaultExpiration)
-
- fp := &bytes.Buffer{}
- err := tc.Save(fp)
- if err != nil {
- t.Fatal("Couldn't save cache to fp:", err)
- }
-
- oc := New(DefaultExpiration, 0)
- err = oc.Load(fp)
- if err != nil {
- t.Fatal("Couldn't load cache from fp:", err)
- }
-
- a, found := oc.Get("a")
- if !found {
- t.Error("a was not found")
- }
- if a.(string) != "a" {
- t.Error("a is not a")
- }
-
- b, found := oc.Get("b")
- if !found {
- t.Error("b was not found")
- }
- if b.(string) != "b" {
- t.Error("b is not b")
- }
-
- c, found := oc.Get("c")
- if !found {
- t.Error("c was not found")
- }
- if c.(string) != "c" {
- t.Error("c is not c")
- }
-
- <-time.After(5 * time.Millisecond)
- _, found = oc.Get("expired")
- if found {
- t.Error("expired was found")
- }
-
- s1, found := oc.Get("*struct")
- if !found {
- t.Error("*struct was not found")
- }
- if s1.(*TestStruct).Num != 1 {
- t.Error("*struct.Num is not 1")
- }
-
- s2, found := oc.Get("[]struct")
- if !found {
- t.Error("[]struct was not found")
- }
- s2r := s2.([]TestStruct)
- if len(s2r) != 2 {
- t.Error("Length of s2r is not 2")
- }
- if s2r[0].Num != 2 {
- t.Error("s2r[0].Num is not 2")
- }
- if s2r[1].Num != 3 {
- t.Error("s2r[1].Num is not 3")
- }
-
- s3, found := oc.get("[]*struct")
- if !found {
- t.Error("[]*struct was not found")
- }
- s3r := s3.([]*TestStruct)
- if len(s3r) != 2 {
- t.Error("Length of s3r is not 2")
- }
- if s3r[0].Num != 4 {
- t.Error("s3r[0].Num is not 4")
- }
- if s3r[1].Num != 5 {
- t.Error("s3r[1].Num is not 5")
- }
-
- s4, found := oc.get("structception")
- if !found {
- t.Error("structception was not found")
- }
- s4r := s4.(*TestStruct)
- if len(s4r.Children) != 2 {
- t.Error("Length of s4r.Children is not 2")
- }
- if s4r.Children[0].Num != 6174 {
- t.Error("s4r.Children[0].Num is not 6174")
- }
- if s4r.Children[1].Num != 4716 {
- t.Error("s4r.Children[1].Num is not 4716")
- }
-}
-
-func TestFileSerialization(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- tc.Add("a", "a", DefaultExpiration)
- tc.Add("b", "b", DefaultExpiration)
- f, err := ioutil.TempFile("", "go-cache-cache.dat")
- if err != nil {
- t.Fatal("Couldn't create cache file:", err)
- }
- fname := f.Name()
- f.Close()
- tc.SaveFile(fname)
-
- oc := New(DefaultExpiration, 0)
- oc.Add("a", "aa", 0) // this should not be overwritten
- err = oc.LoadFile(fname)
- if err != nil {
- t.Error(err)
- }
- a, found := oc.Get("a")
- if !found {
- t.Error("a was not found")
- }
- astr := a.(string)
- if astr != "aa" {
- if astr == "a" {
- t.Error("a was overwritten")
- } else {
- t.Error("a is not aa")
- }
- }
- b, found := oc.Get("b")
- if !found {
- t.Error("b was not found")
- }
- if b.(string) != "b" {
- t.Error("b is not b")
- }
-}
-
-func TestSerializeUnserializable(t *testing.T) {
- tc := New(DefaultExpiration, 0)
- ch := make(chan bool, 1)
- ch <- true
- tc.Set("chan", ch, DefaultExpiration)
- fp := &bytes.Buffer{}
- err := tc.Save(fp) // this should fail gracefully
- if err.Error() != "gob NewTypeObject can't handle type: chan bool" {
- t.Error("Error from Save was not gob NewTypeObject can't handle type chan bool:", err)
- }
-}
-
-func BenchmarkCacheGetExpiring(b *testing.B) {
- benchmarkCacheGet(b, 5*time.Minute)
-}
-
-func BenchmarkCacheGetNotExpiring(b *testing.B) {
- benchmarkCacheGet(b, NoExpiration)
-}
-
-func benchmarkCacheGet(b *testing.B, exp time.Duration) {
- b.StopTimer()
- tc := New(exp, 0)
- tc.Set("foo", "bar", DefaultExpiration)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.Get("foo")
- }
-}
-
-func BenchmarkRWMutexMapGet(b *testing.B) {
- b.StopTimer()
- m := map[string]string{
- "foo": "bar",
- }
- mu := sync.RWMutex{}
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- mu.RLock()
- _, _ = m["foo"]
- mu.RUnlock()
- }
-}
-
-func BenchmarkRWMutexInterfaceMapGetStruct(b *testing.B) {
- b.StopTimer()
- s := struct{name string}{name: "foo"}
- m := map[interface{}]string{
- s: "bar",
- }
- mu := sync.RWMutex{}
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- mu.RLock()
- _, _ = m[s]
- mu.RUnlock()
- }
-}
-
-func BenchmarkRWMutexInterfaceMapGetString(b *testing.B) {
- b.StopTimer()
- m := map[interface{}]string{
- "foo": "bar",
- }
- mu := sync.RWMutex{}
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- mu.RLock()
- _, _ = m["foo"]
- mu.RUnlock()
- }
-}
-
-func BenchmarkCacheGetConcurrentExpiring(b *testing.B) {
- benchmarkCacheGetConcurrent(b, 5*time.Minute)
-}
-
-func BenchmarkCacheGetConcurrentNotExpiring(b *testing.B) {
- benchmarkCacheGetConcurrent(b, NoExpiration)
-}
-
-func benchmarkCacheGetConcurrent(b *testing.B, exp time.Duration) {
- b.StopTimer()
- tc := New(exp, 0)
- tc.Set("foo", "bar", DefaultExpiration)
- wg := new(sync.WaitGroup)
- workers := runtime.NumCPU()
- each := b.N / workers
- wg.Add(workers)
- b.StartTimer()
- for i := 0; i < workers; i++ {
- go func() {
- for j := 0; j < each; j++ {
- tc.Get("foo")
- }
- wg.Done()
- }()
- }
- wg.Wait()
-}
-
-func BenchmarkRWMutexMapGetConcurrent(b *testing.B) {
- b.StopTimer()
- m := map[string]string{
- "foo": "bar",
- }
- mu := sync.RWMutex{}
- wg := new(sync.WaitGroup)
- workers := runtime.NumCPU()
- each := b.N / workers
- wg.Add(workers)
- b.StartTimer()
- for i := 0; i < workers; i++ {
- go func() {
- for j := 0; j < each; j++ {
- mu.RLock()
- _, _ = m["foo"]
- mu.RUnlock()
- }
- wg.Done()
- }()
- }
- wg.Wait()
-}
-
-func BenchmarkCacheGetManyConcurrentExpiring(b *testing.B) {
- benchmarkCacheGetManyConcurrent(b, 5*time.Minute)
-}
-
-func BenchmarkCacheGetManyConcurrentNotExpiring(b *testing.B) {
- benchmarkCacheGetManyConcurrent(b, NoExpiration)
-}
-
-func benchmarkCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
- // This is the same as BenchmarkCacheGetConcurrent, but its result
- // can be compared against BenchmarkShardedCacheGetManyConcurrent
- // in sharded_test.go.
- b.StopTimer()
- n := 10000
- tc := New(exp, 0)
- keys := make([]string, n)
- for i := 0; i < n; i++ {
- k := "foo" + strconv.Itoa(n)
- keys[i] = k
- tc.Set(k, "bar", DefaultExpiration)
- }
- each := b.N / n
- wg := new(sync.WaitGroup)
- wg.Add(n)
- for _, v := range keys {
- go func() {
- for j := 0; j < each; j++ {
- tc.Get(v)
- }
- wg.Done()
- }()
- }
- b.StartTimer()
- wg.Wait()
-}
-
-func BenchmarkCacheSetExpiring(b *testing.B) {
- benchmarkCacheSet(b, 5*time.Minute)
-}
-
-func BenchmarkCacheSetNotExpiring(b *testing.B) {
- benchmarkCacheSet(b, NoExpiration)
-}
-
-func benchmarkCacheSet(b *testing.B, exp time.Duration) {
- b.StopTimer()
- tc := New(exp, 0)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.Set("foo", "bar", DefaultExpiration)
- }
-}
-
-func BenchmarkRWMutexMapSet(b *testing.B) {
- b.StopTimer()
- m := map[string]string{}
- mu := sync.RWMutex{}
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- mu.Lock()
- m["foo"] = "bar"
- mu.Unlock()
- }
-}
-
-func BenchmarkCacheSetDelete(b *testing.B) {
- b.StopTimer()
- tc := New(DefaultExpiration, 0)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.Set("foo", "bar", DefaultExpiration)
- tc.Delete("foo")
- }
-}
-
-func BenchmarkRWMutexMapSetDelete(b *testing.B) {
- b.StopTimer()
- m := map[string]string{}
- mu := sync.RWMutex{}
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- mu.Lock()
- m["foo"] = "bar"
- mu.Unlock()
- mu.Lock()
- delete(m, "foo")
- mu.Unlock()
- }
-}
-
-func BenchmarkCacheSetDeleteSingleLock(b *testing.B) {
- b.StopTimer()
- tc := New(DefaultExpiration, 0)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.mu.Lock()
- tc.set("foo", "bar", DefaultExpiration)
- tc.delete("foo")
- tc.mu.Unlock()
- }
-}
-
-func BenchmarkRWMutexMapSetDeleteSingleLock(b *testing.B) {
- b.StopTimer()
- m := map[string]string{}
- mu := sync.RWMutex{}
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- mu.Lock()
- m["foo"] = "bar"
- delete(m, "foo")
- mu.Unlock()
- }
-}
-
-func BenchmarkIncrementInt(b *testing.B) {
- b.StopTimer()
- tc := New(DefaultExpiration, 0)
- tc.Set("foo", 0, DefaultExpiration)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.IncrementInt("foo", 1)
- }
-}
-
-func BenchmarkDeleteExpiredLoop(b *testing.B) {
- b.StopTimer()
- tc := New(5*time.Minute, 0)
- tc.mu.Lock()
- for i := 0; i < 100000; i++ {
- tc.set(strconv.Itoa(i), "bar", DefaultExpiration)
- }
- tc.mu.Unlock()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.DeleteExpired()
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/sharded_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/sharded_test.go
deleted file mode 100644
index aef8597ef24..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/patrickmn/go-cache/sharded_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package cache
-
-import (
- "strconv"
- "sync"
- "testing"
- "time"
-)
-
-// func TestDjb33(t *testing.T) {
-// }
-
-var shardedKeys = []string{
- "f",
- "fo",
- "foo",
- "barf",
- "barfo",
- "foobar",
- "bazbarf",
- "bazbarfo",
- "bazbarfoo",
- "foobarbazq",
- "foobarbazqu",
- "foobarbazquu",
- "foobarbazquux",
-}
-
-func TestShardedCache(t *testing.T) {
- tc := unexportedNewSharded(DefaultExpiration, 0, 13)
- for _, v := range shardedKeys {
- tc.Set(v, "value", DefaultExpiration)
- }
-}
-
-func BenchmarkShardedCacheGetExpiring(b *testing.B) {
- benchmarkShardedCacheGet(b, 5*time.Minute)
-}
-
-func BenchmarkShardedCacheGetNotExpiring(b *testing.B) {
- benchmarkShardedCacheGet(b, NoExpiration)
-}
-
-func benchmarkShardedCacheGet(b *testing.B, exp time.Duration) {
- b.StopTimer()
- tc := unexportedNewSharded(exp, 0, 10)
- tc.Set("foobarba", "zquux", DefaultExpiration)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- tc.Get("foobarba")
- }
-}
-
-func BenchmarkShardedCacheGetManyConcurrentExpiring(b *testing.B) {
- benchmarkShardedCacheGetManyConcurrent(b, 5*time.Minute)
-}
-
-func BenchmarkShardedCacheGetManyConcurrentNotExpiring(b *testing.B) {
- benchmarkShardedCacheGetManyConcurrent(b, NoExpiration)
-}
-
-func benchmarkShardedCacheGetManyConcurrent(b *testing.B, exp time.Duration) {
- b.StopTimer()
- n := 10000
- tsc := unexportedNewSharded(exp, 0, 20)
- keys := make([]string, n)
- for i := 0; i < n; i++ {
- k := "foo" + strconv.Itoa(n)
- keys[i] = k
- tsc.Set(k, "bar", DefaultExpiration)
- }
- each := b.N / n
- wg := new(sync.WaitGroup)
- wg.Add(n)
- for _, v := range keys {
- go func() {
- for j := 0; j < each; j++ {
- tsc.Get(v)
- }
- wg.Done()
- }()
- }
- b.StartTimer()
- wg.Wait()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/collections_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/collections_test.go
deleted file mode 100644
index 6c7948f3c7a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/collections_test.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-func TestShouldContainKey(t *testing.T) {
- fail(t, so(map[int]int{}, ShouldContainKey), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(map[int]int{}, ShouldContainKey, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(Thing1{}, ShouldContainKey, 1), "You must provide a valid map type (was assertions.Thing1)!")
- fail(t, so(nil, ShouldContainKey, 1), "You must provide a valid map type (was <nil>)!")
- fail(t, so(map[int]int{1: 41}, ShouldContainKey, 2), "Expected the map[int]int to contain the key: [2] (but it didn't)!")
-
- pass(t, so(map[int]int{1: 41}, ShouldContainKey, 1))
- pass(t, so(map[int]int{1: 41, 2: 42, 3: 43}, ShouldContainKey, 2))
-}
-
-func TestShouldNotContainKey(t *testing.T) {
- fail(t, so(map[int]int{}, ShouldNotContainKey), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(map[int]int{}, ShouldNotContainKey, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(Thing1{}, ShouldNotContainKey, 1), "You must provide a valid map type (was assertions.Thing1)!")
- fail(t, so(nil, ShouldNotContainKey, 1), "You must provide a valid map type (was <nil>)!")
- fail(t, so(map[int]int{1: 41}, ShouldNotContainKey, 1), "Expected the map[int]int NOT to contain the key: [1] (but it did)!")
- pass(t, so(map[int]int{1: 41}, ShouldNotContainKey, 2))
-}
-
-func TestShouldContain(t *testing.T) {
- fail(t, so([]int{}, ShouldContain), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so([]int{}, ShouldContain, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(Thing1{}, ShouldContain, 1), "You must provide a valid container (was assertions.Thing1)!")
- fail(t, so(nil, ShouldContain, 1), "You must provide a valid container (was <nil>)!")
- fail(t, so([]int{1}, ShouldContain, 2), "Expected the container ([]int) to contain: '2' (but it didn't)!")
-
- pass(t, so([]int{1}, ShouldContain, 1))
- pass(t, so([]int{1, 2, 3}, ShouldContain, 2))
-}
-
-func TestShouldNotContain(t *testing.T) {
- fail(t, so([]int{}, ShouldNotContain), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so([]int{}, ShouldNotContain, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(Thing1{}, ShouldNotContain, 1), "You must provide a valid container (was assertions.Thing1)!")
- fail(t, so(nil, ShouldNotContain, 1), "You must provide a valid container (was <nil>)!")
-
- fail(t, so([]int{1}, ShouldNotContain, 1), "Expected the container ([]int) NOT to contain: '1' (but it did)!")
- fail(t, so([]int{1, 2, 3}, ShouldNotContain, 2), "Expected the container ([]int) NOT to contain: '2' (but it did)!")
-
- pass(t, so([]int{1}, ShouldNotContain, 2))
-}
-
-func TestShouldBeIn(t *testing.T) {
- fail(t, so(4, ShouldBeIn), needNonEmptyCollection)
-
- container := []int{1, 2, 3, 4}
- pass(t, so(4, ShouldBeIn, container))
- pass(t, so(4, ShouldBeIn, 1, 2, 3, 4))
-
- fail(t, so(4, ShouldBeIn, 1, 2, 3), "Expected '4' to be in the container ([]interface {}), but it wasn't!")
- fail(t, so(4, ShouldBeIn, []int{1, 2, 3}), "Expected '4' to be in the container ([]int), but it wasn't!")
-}
-
-func TestShouldNotBeIn(t *testing.T) {
- fail(t, so(4, ShouldNotBeIn), needNonEmptyCollection)
-
- container := []int{1, 2, 3, 4}
- pass(t, so(42, ShouldNotBeIn, container))
- pass(t, so(42, ShouldNotBeIn, 1, 2, 3, 4))
-
- fail(t, so(2, ShouldNotBeIn, 1, 2, 3), "Expected '2' NOT to be in the container ([]interface {}), but it was!")
- fail(t, so(2, ShouldNotBeIn, []int{1, 2, 3}), "Expected '2' NOT to be in the container ([]int), but it was!")
-}
-
-func TestShouldBeEmpty(t *testing.T) {
- fail(t, so(1, ShouldBeEmpty, 2, 3), "This assertion requires exactly 0 comparison values (you provided 2).")
-
- pass(t, so([]int{}, ShouldBeEmpty)) // empty slice
- pass(t, so([]interface{}{}, ShouldBeEmpty)) // empty slice
- pass(t, so(map[string]int{}, ShouldBeEmpty)) // empty map
- pass(t, so("", ShouldBeEmpty)) // empty string
- pass(t, so(&[]int{}, ShouldBeEmpty)) // pointer to empty slice
- pass(t, so(&[0]int{}, ShouldBeEmpty)) // pointer to empty array
- pass(t, so(nil, ShouldBeEmpty)) // nil
- pass(t, so(make(chan string), ShouldBeEmpty)) // empty channel
-
- fail(t, so([]int{1}, ShouldBeEmpty), "Expected [1] to be empty (but it wasn't)!") // non-empty slice
- fail(t, so([]interface{}{1}, ShouldBeEmpty), "Expected [1] to be empty (but it wasn't)!") // non-empty slice
- fail(t, so(map[string]int{"hi": 0}, ShouldBeEmpty), "Expected map[hi:0] to be empty (but it wasn't)!") // non-empty map
- fail(t, so("hi", ShouldBeEmpty), "Expected hi to be empty (but it wasn't)!") // non-empty string
- fail(t, so(&[]int{1}, ShouldBeEmpty), "Expected &[1] to be empty (but it wasn't)!") // pointer to non-empty slice
- fail(t, so(&[1]int{1}, ShouldBeEmpty), "Expected &[1] to be empty (but it wasn't)!") // pointer to non-empty array
- c := make(chan int, 1) // non-empty channel
- go func() { c <- 1 }()
- time.Sleep(time.Millisecond)
- fail(t, so(c, ShouldBeEmpty), fmt.Sprintf("Expected %+v to be empty (but it wasn't)!", c))
-}
-
-func TestShouldNotBeEmpty(t *testing.T) {
- fail(t, so(1, ShouldNotBeEmpty, 2, 3), "This assertion requires exactly 0 comparison values (you provided 2).")
-
- fail(t, so([]int{}, ShouldNotBeEmpty), "Expected [] to NOT be empty (but it was)!") // empty slice
- fail(t, so([]interface{}{}, ShouldNotBeEmpty), "Expected [] to NOT be empty (but it was)!") // empty slice
- fail(t, so(map[string]int{}, ShouldNotBeEmpty), "Expected map[] to NOT be empty (but it was)!") // empty map
- fail(t, so("", ShouldNotBeEmpty), "Expected to NOT be empty (but it was)!") // empty string
- fail(t, so(&[]int{}, ShouldNotBeEmpty), "Expected &[] to NOT be empty (but it was)!") // pointer to empty slice
- fail(t, so(&[0]int{}, ShouldNotBeEmpty), "Expected &[] to NOT be empty (but it was)!") // pointer to empty array
- fail(t, so(nil, ShouldNotBeEmpty), "Expected <nil> to NOT be empty (but it was)!") // nil
- c := make(chan int, 0) // non-empty channel
- fail(t, so(c, ShouldNotBeEmpty), fmt.Sprintf("Expected %+v to NOT be empty (but it was)!", c)) // empty channel
-
- pass(t, so([]int{1}, ShouldNotBeEmpty)) // non-empty slice
- pass(t, so([]interface{}{1}, ShouldNotBeEmpty)) // non-empty slice
- pass(t, so(map[string]int{"hi": 0}, ShouldNotBeEmpty)) // non-empty map
- pass(t, so("hi", ShouldNotBeEmpty)) // non-empty string
- pass(t, so(&[]int{1}, ShouldNotBeEmpty)) // pointer to non-empty slice
- pass(t, so(&[1]int{1}, ShouldNotBeEmpty)) // pointer to non-empty array
- c = make(chan int, 1)
- go func() { c <- 1 }()
- time.Sleep(time.Millisecond)
- pass(t, so(c, ShouldNotBeEmpty))
-}
-
-func TestShouldHaveLength(t *testing.T) {
- fail(t, so(1, ShouldHaveLength, 2), "You must provide a valid container (was int)!")
- fail(t, so(nil, ShouldHaveLength, 1), "You must provide a valid container (was <nil>)!")
- fail(t, so("hi", ShouldHaveLength, float64(1.0)), "You must provide a valid integer (was float64)!")
- fail(t, so([]string{}, ShouldHaveLength), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so([]string{}, ShouldHaveLength, 1, 2), "This assertion requires exactly 1 comparison values (you provided 2).")
- fail(t, so([]string{}, ShouldHaveLength, -10), "You must provide a valid positive integer (was -10)!")
-
- fail(t, so([]int{}, ShouldHaveLength, 1), "Expected [] (length: 0) to have length equal to '1', but it wasn't!") // empty slice
- fail(t, so([]interface{}{}, ShouldHaveLength, 1), "Expected [] (length: 0) to have length equal to '1', but it wasn't!") // empty slice
- fail(t, so(map[string]int{}, ShouldHaveLength, 1), "Expected map[] (length: 0) to have length equal to '1', but it wasn't!") // empty map
- fail(t, so("", ShouldHaveLength, 1), "Expected (length: 0) to have length equal to '1', but it wasn't!") // empty string
- fail(t, so(&[]int{}, ShouldHaveLength, 1), "Expected &[] (length: 0) to have length equal to '1', but it wasn't!") // pointer to empty slice
- fail(t, so(&[0]int{}, ShouldHaveLength, 1), "Expected &[] (length: 0) to have length equal to '1', but it wasn't!") // pointer to empty array
- c := make(chan int, 0) // non-empty channel
- fail(t, so(c, ShouldHaveLength, 1), fmt.Sprintf("Expected %+v (length: 0) to have length equal to '1', but it wasn't!", c))
- c = make(chan int) // empty channel
- fail(t, so(c, ShouldHaveLength, 1), fmt.Sprintf("Expected %+v (length: 0) to have length equal to '1', but it wasn't!", c))
-
- pass(t, so([]int{1}, ShouldHaveLength, 1)) // non-empty slice
- pass(t, so([]interface{}{1}, ShouldHaveLength, 1)) // non-empty slice
- pass(t, so(map[string]int{"hi": 0}, ShouldHaveLength, 1)) // non-empty map
- pass(t, so("hi", ShouldHaveLength, 2)) // non-empty string
- pass(t, so(&[]int{1}, ShouldHaveLength, 1)) // pointer to non-empty slice
- pass(t, so(&[1]int{1}, ShouldHaveLength, 1)) // pointer to non-empty array
- c = make(chan int, 1)
- go func() { c <- 1 }()
- time.Sleep(time.Millisecond)
- pass(t, so(c, ShouldHaveLength, 1))
-
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/doc_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/doc_test.go
deleted file mode 100644
index 041faaffcb2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/doc_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package assertions
-
-import (
- "bytes"
- "fmt"
- "testing"
-)
-
-func TestPassingAssertion(t *testing.T) {
- fake := &FakeT{buffer: new(bytes.Buffer)}
- assertion := New(fake)
- passed := assertion.So(1, ShouldEqual, 1)
-
- if !passed {
- t.Error("Assertion failed when it should have passed.")
- }
- if fake.buffer.Len() > 0 {
- t.Error("Unexpected error message was printed.")
- }
-}
-
-func TestFailingAssertion(t *testing.T) {
- fake := &FakeT{buffer: new(bytes.Buffer)}
- assertion := New(fake)
- passed := assertion.So(1, ShouldEqual, 2)
-
- if passed {
- t.Error("Assertion passed when it should have failed.")
- }
- if fake.buffer.Len() == 0 {
- t.Error("Expected error message not printed.")
- }
-}
-
-func TestFailingGroupsOfAssertions(t *testing.T) {
- fake := &FakeT{buffer: new(bytes.Buffer)}
- assertion1 := New(fake)
- assertion2 := New(fake)
-
- assertion1.So(1, ShouldEqual, 2) // fail
- assertion2.So(1, ShouldEqual, 1) // pass
-
- if !assertion1.Failed() {
- t.Error("Expected the first assertion to have been marked as failed.")
- }
- if assertion2.Failed() {
- t.Error("Expected the second assertion to NOT have been marked as failed.")
- }
-}
-
-type FakeT struct {
- buffer *bytes.Buffer
-}
-
-func (this *FakeT) Error(args ...interface{}) {
- fmt.Fprint(this.buffer, args...)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/equality_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/equality_test.go
deleted file mode 100644
index 5050e4b1619..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/equality_test.go
+++ /dev/null
@@ -1,269 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestShouldEqual(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so(1, ShouldEqual), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldEqual, 1, 2), "This assertion requires exactly 1 comparison values (you provided 2).")
- fail(t, so(1, ShouldEqual, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- pass(t, so(1, ShouldEqual, 1))
- fail(t, so(1, ShouldEqual, 2), "2|1|Expected: '2' Actual: '1' (Should be equal)")
- fail(t, so(1, ShouldEqual, "1"), "1|1|Expected: '1' (string) Actual: '1' (int) (Should be equal, type mismatch)")
-
- pass(t, so(true, ShouldEqual, true))
- fail(t, so(true, ShouldEqual, false), "false|true|Expected: 'false' Actual: 'true' (Should be equal)")
-
- pass(t, so("hi", ShouldEqual, "hi"))
- fail(t, so("hi", ShouldEqual, "bye"), "bye|hi|Expected: 'bye' Actual: 'hi' (Should be equal)")
-
- pass(t, so(42, ShouldEqual, uint(42)))
-
- fail(t, so(Thing1{"hi"}, ShouldEqual, Thing1{}), "{}|{hi}|Expected: '{}' Actual: '{hi}' (Should be equal)")
- fail(t, so(Thing1{"hi"}, ShouldEqual, Thing1{"hi"}), "{hi}|{hi}|Expected: '{hi}' Actual: '{hi}' (Should be equal)")
- fail(t, so(&Thing1{"hi"}, ShouldEqual, &Thing1{"hi"}), "&{hi}|&{hi}|Expected: '&{hi}' Actual: '&{hi}' (Should be equal)")
-
- fail(t, so(Thing1{}, ShouldEqual, Thing2{}), "{}|{}|Expected: '{}' Actual: '{}' (Should be equal)")
-}
-
-func TestShouldNotEqual(t *testing.T) {
- fail(t, so(1, ShouldNotEqual), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldNotEqual, 1, 2), "This assertion requires exactly 1 comparison values (you provided 2).")
- fail(t, so(1, ShouldNotEqual, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- pass(t, so(1, ShouldNotEqual, 2))
- pass(t, so(1, ShouldNotEqual, "1"))
- fail(t, so(1, ShouldNotEqual, 1), "Expected '1' to NOT equal '1' (but it did)!")
-
- pass(t, so(true, ShouldNotEqual, false))
- fail(t, so(true, ShouldNotEqual, true), "Expected 'true' to NOT equal 'true' (but it did)!")
-
- pass(t, so("hi", ShouldNotEqual, "bye"))
- fail(t, so("hi", ShouldNotEqual, "hi"), "Expected 'hi' to NOT equal 'hi' (but it did)!")
-
- pass(t, so(&Thing1{"hi"}, ShouldNotEqual, &Thing1{"hi"}))
- pass(t, so(Thing1{"hi"}, ShouldNotEqual, Thing1{"hi"}))
- pass(t, so(Thing1{}, ShouldNotEqual, Thing1{}))
- pass(t, so(Thing1{}, ShouldNotEqual, Thing2{}))
-}
-
-func TestShouldAlmostEqual(t *testing.T) {
- fail(t, so(1, ShouldAlmostEqual), "This assertion requires exactly one comparison value and an optional delta (you provided neither)")
- fail(t, so(1, ShouldAlmostEqual, 1, 2, 3), "This assertion requires exactly one comparison value and an optional delta (you provided more values)")
-
- // with the default delta
- pass(t, so(1, ShouldAlmostEqual, .99999999999999))
- pass(t, so(1.3612499999999996, ShouldAlmostEqual, 1.36125))
- pass(t, so(0.7285312499999999, ShouldAlmostEqual, 0.72853125))
- fail(t, so(1, ShouldAlmostEqual, .99), "Expected '1' to almost equal '0.99' (but it didn't)!")
-
- // with a different delta
- pass(t, so(100.0, ShouldAlmostEqual, 110.0, 10.0))
- fail(t, so(100.0, ShouldAlmostEqual, 111.0, 10.5), "Expected '100' to almost equal '111' (but it didn't)!")
-
- // ints should work
- pass(t, so(100, ShouldAlmostEqual, 100.0))
- fail(t, so(100, ShouldAlmostEqual, 99.0), "Expected '100' to almost equal '99' (but it didn't)!")
-
- // float32 should work
- pass(t, so(float64(100.0), ShouldAlmostEqual, float32(100.0)))
- fail(t, so(float32(100.0), ShouldAlmostEqual, 99.0, float32(0.1)), "Expected '100' to almost equal '99' (but it didn't)!")
-}
-
-func TestShouldNotAlmostEqual(t *testing.T) {
- fail(t, so(1, ShouldNotAlmostEqual), "This assertion requires exactly one comparison value and an optional delta (you provided neither)")
- fail(t, so(1, ShouldNotAlmostEqual, 1, 2, 3), "This assertion requires exactly one comparison value and an optional delta (you provided more values)")
-
- // with the default delta
- fail(t, so(1, ShouldNotAlmostEqual, .99999999999999), "Expected '1' to NOT almost equal '0.99999999999999' (but it did)!")
- fail(t, so(1.3612499999999996, ShouldNotAlmostEqual, 1.36125), "Expected '1.3612499999999996' to NOT almost equal '1.36125' (but it did)!")
- pass(t, so(1, ShouldNotAlmostEqual, .99))
-
- // with a different delta
- fail(t, so(100.0, ShouldNotAlmostEqual, 110.0, 10.0), "Expected '100' to NOT almost equal '110' (but it did)!")
- pass(t, so(100.0, ShouldNotAlmostEqual, 111.0, 10.5))
-
- // ints should work
- fail(t, so(100, ShouldNotAlmostEqual, 100.0), "Expected '100' to NOT almost equal '100' (but it did)!")
- pass(t, so(100, ShouldNotAlmostEqual, 99.0))
-
- // float32 should work
- fail(t, so(float64(100.0), ShouldNotAlmostEqual, float32(100.0)), "Expected '100' to NOT almost equal '100' (but it did)!")
- pass(t, so(float32(100.0), ShouldNotAlmostEqual, 99.0, float32(0.1)))
-}
-
-func TestShouldResemble(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so(Thing1{"hi"}, ShouldResemble), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(Thing1{"hi"}, ShouldResemble, Thing1{"hi"}, Thing1{"hi"}), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(Thing1{"hi"}, ShouldResemble, Thing1{"hi"}))
- fail(t, so(Thing1{"hi"}, ShouldResemble, Thing1{"bye"}), `{bye}|{hi}|Expected: '"assertions.Thing1{a:\"bye\"}"' Actual: '"assertions.Thing1{a:\"hi\"}"' (Should resemble)!`)
-
- var (
- a []int
- b []int = []int{}
- )
-
- fail(t, so(a, ShouldResemble, b), `[]|[]|Expected: '"[]int{}"' Actual: '"[]int(nil)"' (Should resemble)!`)
- fail(t, so(2, ShouldResemble, 1), `1|2|Expected: '"1"' Actual: '"2"' (Should resemble)!`)
-
- fail(t, so(StringStringMapAlias{"hi": "bye"}, ShouldResemble, map[string]string{"hi": "bye"}),
- `map[hi:bye]|map[hi:bye]|Expected: '"map[string]string{\"hi\":\"bye\"}"' Actual: '"assertions.StringStringMapAlias{\"hi\":\"bye\"}"' (Should resemble)!`)
- fail(t, so(StringSliceAlias{"hi", "bye"}, ShouldResemble, []string{"hi", "bye"}),
- `[hi bye]|[hi bye]|Expected: '"[]string{\"hi\", \"bye\"}"' Actual: '"assertions.StringSliceAlias{\"hi\", \"bye\"}"' (Should resemble)!`)
-
- // some types come out looking the same when represented with "%#v" so we show type mismatch info:
- fail(t, so(StringAlias("hi"), ShouldResemble, "hi"), `hi|hi|Expected: '"\"hi\""' Actual: '"assertions.StringAlias(\"hi\")"' (Should resemble)!`)
- fail(t, so(IntAlias(42), ShouldResemble, 42), `42|42|Expected: '"42"' Actual: '"assertions.IntAlias(42)"' (Should resemble)!`)
-}
-
-func TestShouldNotResemble(t *testing.T) {
- fail(t, so(Thing1{"hi"}, ShouldNotResemble), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(Thing1{"hi"}, ShouldNotResemble, Thing1{"hi"}, Thing1{"hi"}), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(Thing1{"hi"}, ShouldNotResemble, Thing1{"bye"}))
- fail(t, so(Thing1{"hi"}, ShouldNotResemble, Thing1{"hi"}),
- `Expected '"assertions.Thing1{a:\"hi\"}"' to NOT resemble '"assertions.Thing1{a:\"hi\"}"' (but it did)!`)
-
- pass(t, so(map[string]string{"hi": "bye"}, ShouldResemble, map[string]string{"hi": "bye"}))
- pass(t, so(IntAlias(42), ShouldNotResemble, 42))
-
- pass(t, so(StringSliceAlias{"hi", "bye"}, ShouldNotResemble, []string{"hi", "bye"}))
-}
-
-func TestShouldPointTo(t *testing.T) {
- serializer = newFakeSerializer()
-
- t1 := &Thing1{}
- t2 := t1
- t3 := &Thing1{}
-
- pointer1 := reflect.ValueOf(t1).Pointer()
- pointer3 := reflect.ValueOf(t3).Pointer()
-
- fail(t, so(t1, ShouldPointTo), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(t1, ShouldPointTo, t2, t3), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(t1, ShouldPointTo, t2))
- fail(t, so(t1, ShouldPointTo, t3), fmt.Sprintf(
- "%v|%v|Expected '&{a:}' (address: '%v') and '&{a:}' (address: '%v') to be the same address (but their weren't)!",
- pointer3, pointer1, pointer1, pointer3))
-
- t4 := Thing1{}
- t5 := t4
-
- fail(t, so(t4, ShouldPointTo, t5), "Both arguments should be pointers (the first was not)!")
- fail(t, so(&t4, ShouldPointTo, t5), "Both arguments should be pointers (the second was not)!")
- fail(t, so(nil, ShouldPointTo, nil), "Both arguments should be pointers (the first was nil)!")
- fail(t, so(&t4, ShouldPointTo, nil), "Both arguments should be pointers (the second was nil)!")
-}
-
-func TestShouldNotPointTo(t *testing.T) {
- t1 := &Thing1{}
- t2 := t1
- t3 := &Thing1{}
-
- pointer1 := reflect.ValueOf(t1).Pointer()
-
- fail(t, so(t1, ShouldNotPointTo), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(t1, ShouldNotPointTo, t2, t3), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(t1, ShouldNotPointTo, t3))
- fail(t, so(t1, ShouldNotPointTo, t2), fmt.Sprintf("Expected '&{a:}' and '&{a:}' to be different references (but they matched: '%v')!", pointer1))
-
- t4 := Thing1{}
- t5 := t4
-
- fail(t, so(t4, ShouldNotPointTo, t5), "Both arguments should be pointers (the first was not)!")
- fail(t, so(&t4, ShouldNotPointTo, t5), "Both arguments should be pointers (the second was not)!")
- fail(t, so(nil, ShouldNotPointTo, nil), "Both arguments should be pointers (the first was nil)!")
- fail(t, so(&t4, ShouldNotPointTo, nil), "Both arguments should be pointers (the second was nil)!")
-}
-
-func TestShouldBeNil(t *testing.T) {
- fail(t, so(nil, ShouldBeNil, nil, nil, nil), "This assertion requires exactly 0 comparison values (you provided 3).")
- fail(t, so(nil, ShouldBeNil, nil), "This assertion requires exactly 0 comparison values (you provided 1).")
-
- pass(t, so(nil, ShouldBeNil))
- fail(t, so(1, ShouldBeNil), "Expected: nil Actual: '1'")
-
- var thing Thinger
- pass(t, so(thing, ShouldBeNil))
- thing = &Thing{}
- fail(t, so(thing, ShouldBeNil), "Expected: nil Actual: '&{}'")
-
- var thingOne *Thing1
- pass(t, so(thingOne, ShouldBeNil))
-
- var nilSlice []int = nil
- pass(t, so(nilSlice, ShouldBeNil))
-
- var nilMap map[string]string = nil
- pass(t, so(nilMap, ShouldBeNil))
-
- var nilChannel chan int = nil
- pass(t, so(nilChannel, ShouldBeNil))
-
- var nilFunc func() = nil
- pass(t, so(nilFunc, ShouldBeNil))
-
- var nilInterface interface{} = nil
- pass(t, so(nilInterface, ShouldBeNil))
-}
-
-func TestShouldNotBeNil(t *testing.T) {
- fail(t, so(nil, ShouldNotBeNil, nil, nil, nil), "This assertion requires exactly 0 comparison values (you provided 3).")
- fail(t, so(nil, ShouldNotBeNil, nil), "This assertion requires exactly 0 comparison values (you provided 1).")
-
- fail(t, so(nil, ShouldNotBeNil), "Expected '<nil>' to NOT be nil (but it was)!")
- pass(t, so(1, ShouldNotBeNil))
-
- var thing Thinger
- fail(t, so(thing, ShouldNotBeNil), "Expected '<nil>' to NOT be nil (but it was)!")
- thing = &Thing{}
- pass(t, so(thing, ShouldNotBeNil))
-}
-
-func TestShouldBeTrue(t *testing.T) {
- fail(t, so(true, ShouldBeTrue, 1, 2, 3), "This assertion requires exactly 0 comparison values (you provided 3).")
- fail(t, so(true, ShouldBeTrue, 1), "This assertion requires exactly 0 comparison values (you provided 1).")
-
- fail(t, so(false, ShouldBeTrue), "Expected: true Actual: false")
- fail(t, so(1, ShouldBeTrue), "Expected: true Actual: 1")
- pass(t, so(true, ShouldBeTrue))
-}
-
-func TestShouldBeFalse(t *testing.T) {
- fail(t, so(false, ShouldBeFalse, 1, 2, 3), "This assertion requires exactly 0 comparison values (you provided 3).")
- fail(t, so(false, ShouldBeFalse, 1), "This assertion requires exactly 0 comparison values (you provided 1).")
-
- fail(t, so(true, ShouldBeFalse), "Expected: false Actual: true")
- fail(t, so(1, ShouldBeFalse), "Expected: false Actual: 1")
- pass(t, so(false, ShouldBeFalse))
-}
-
-func TestShouldBeZeroValue(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so(0, ShouldBeZeroValue, 1, 2, 3), "This assertion requires exactly 0 comparison values (you provided 3).")
- fail(t, so(false, ShouldBeZeroValue, true), "This assertion requires exactly 0 comparison values (you provided 1).")
-
- fail(t, so(1, ShouldBeZeroValue), "0|1|'1' should have been the zero value") //"Expected: (zero value) Actual: 1")
- fail(t, so(true, ShouldBeZeroValue), "false|true|'true' should have been the zero value") //"Expected: (zero value) Actual: true")
- fail(t, so("123", ShouldBeZeroValue), "|123|'123' should have been the zero value") //"Expected: (zero value) Actual: 123")
- fail(t, so(" ", ShouldBeZeroValue), "| |' ' should have been the zero value") //"Expected: (zero value) Actual: ")
- fail(t, so([]string{"Nonempty"}, ShouldBeZeroValue), "[]|[Nonempty]|'[Nonempty]' should have been the zero value") //"Expected: (zero value) Actual: [Nonempty]")
- fail(t, so(struct{ a string }{a: "asdf"}, ShouldBeZeroValue), "{}|{asdf}|'{a:asdf}' should have been the zero value")
- pass(t, so(0, ShouldBeZeroValue))
- pass(t, so(false, ShouldBeZeroValue))
- pass(t, so("", ShouldBeZeroValue))
- pass(t, so(struct{}{}, ShouldBeZeroValue))
-} \ No newline at end of file
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_test.go
deleted file mode 100644
index 1737cb702ae..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/go-render/render/render_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright 2015 Google Inc. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package render
-
-import (
- "bytes"
- "fmt"
- "regexp"
- "runtime"
- "testing"
-)
-
-func init() {
- // For testing purposes, pointers will render as "PTR" so that they are
- // deterministic.
- renderPointer = func(buf *bytes.Buffer, p uintptr) {
- buf.WriteString("PTR")
- }
-}
-
-func assertRendersLike(t *testing.T, name string, v interface{}, exp string) {
- act := Render(v)
- if act != exp {
- _, _, line, _ := runtime.Caller(1)
- t.Errorf("On line #%d, [%s] did not match expectations:\nExpected: %s\nActual : %s\n", line, name, exp, act)
- }
-}
-
-func TestRenderList(t *testing.T) {
- t.Parallel()
-
- // Note that we make some of the fields exportable. This is to avoid a fun case
- // where the first reflect.Value has a read-only bit set, but follow-on values
- // do not, so recursion tests are off by one.
- type testStruct struct {
- Name string
- I interface{}
-
- m string
- }
-
- type myStringSlice []string
- type myStringMap map[string]string
- type myIntType int
- type myStringType string
-
- s0 := "string0"
- s0P := &s0
- mit := myIntType(42)
- stringer := fmt.Stringer(nil)
-
- for i, tc := range []struct {
- a interface{}
- s string
- }{
- {nil, `nil`},
- {make(chan int), `(chan int)(PTR)`},
- {&stringer, `(*fmt.Stringer)(nil)`},
- {123, `123`},
- {"hello", `"hello"`},
- {(*testStruct)(nil), `(*render.testStruct)(nil)`},
- {(**testStruct)(nil), `(**render.testStruct)(nil)`},
- {[]***testStruct(nil), `[]***render.testStruct(nil)`},
- {testStruct{Name: "foo", I: &testStruct{Name: "baz"}},
- `render.testStruct{Name:"foo", I:(*render.testStruct){Name:"baz", I:interface{}(nil), m:""}, m:""}`},
- {[]byte(nil), `[]uint8(nil)`},
- {[]byte{}, `[]uint8{}`},
- {map[string]string(nil), `map[string]string(nil)`},
- {[]*testStruct{
- {Name: "foo"},
- {Name: "bar"},
- }, `[]*render.testStruct{(*render.testStruct){Name:"foo", I:interface{}(nil), m:""}, ` +
- `(*render.testStruct){Name:"bar", I:interface{}(nil), m:""}}`},
- {myStringSlice{"foo", "bar"}, `render.myStringSlice{"foo", "bar"}`},
- {myStringMap{"foo": "bar"}, `render.myStringMap{"foo":"bar"}`},
- {myIntType(12), `render.myIntType(12)`},
- {&mit, `(*render.myIntType)(42)`},
- {myStringType("foo"), `render.myStringType("foo")`},
- {struct {
- a int
- b string
- }{123, "foo"}, `struct { a int; b string }{a:123, b:"foo"}`},
- {[]string{"foo", "foo", "bar", "baz", "qux", "qux"},
- `[]string{"foo", "foo", "bar", "baz", "qux", "qux"}`},
- {[...]int{1, 2, 3}, `[3]int{1, 2, 3}`},
- {map[string]bool{
- "foo": true,
- "bar": false,
- }, `map[string]bool{"bar":false, "foo":true}`},
- {map[int]string{1: "foo", 2: "bar"}, `map[int]string{1:"foo", 2:"bar"}`},
- {uint32(1337), `1337`},
- {3.14, `3.14`},
- {complex(3, 0.14), `(3+0.14i)`},
- {&s0, `(*string)("string0")`},
- {&s0P, `(**string)("string0")`},
- {[]interface{}{nil, 1, 2, nil}, `[]interface{}{interface{}(nil), 1, 2, interface{}(nil)}`},
- } {
- assertRendersLike(t, fmt.Sprintf("Input #%d", i), tc.a, tc.s)
- }
-}
-
-func TestRenderRecursiveStruct(t *testing.T) {
- type testStruct struct {
- Name string
- I interface{}
- }
-
- s := &testStruct{
- Name: "recursive",
- }
- s.I = s
-
- assertRendersLike(t, "Recursive struct", s,
- `(*render.testStruct){Name:"recursive", I:<REC(*render.testStruct)>}`)
-}
-
-func TestRenderRecursiveArray(t *testing.T) {
- a := [2]interface{}{}
- a[0] = &a
- a[1] = &a
-
- assertRendersLike(t, "Recursive array", &a,
- `(*[2]interface{}){<REC(*[2]interface{})>, <REC(*[2]interface{})>}`)
-}
-
-func TestRenderRecursiveMap(t *testing.T) {
- m := map[string]interface{}{}
- foo := "foo"
- m["foo"] = m
- m["bar"] = [](*string){&foo, &foo}
- v := []map[string]interface{}{m, m}
-
- assertRendersLike(t, "Recursive map", v,
- `[]map[string]interface{}{map[string]interface{}{`+
- `"bar":[]*string{(*string)("foo"), (*string)("foo")}, `+
- `"foo":<REC(map[string]interface{})>}, `+
- `map[string]interface{}{`+
- `"bar":[]*string{(*string)("foo"), (*string)("foo")}, `+
- `"foo":<REC(map[string]interface{})>}}`)
-}
-
-func ExampleInReadme() {
- type customType int
- type testStruct struct {
- S string
- V *map[string]int
- I interface{}
- }
-
- a := testStruct{
- S: "hello",
- V: &map[string]int{"foo": 0, "bar": 1},
- I: customType(42),
- }
-
- fmt.Println("Render test:")
- fmt.Printf("fmt.Printf: %s\n", sanitizePointer(fmt.Sprintf("%#v", a)))
- fmt.Printf("render.Render: %s\n", Render(a))
- // Output: Render test:
- // fmt.Printf: render.testStruct{S:"hello", V:(*map[string]int)(0x600dd065), I:42}
- // render.Render: render.testStruct{S:"hello", V:(*map[string]int){"bar":1, "foo":0}, I:render.customType(42)}
-}
-
-var pointerRE = regexp.MustCompile(`\(0x[a-f0-9]+\)`)
-
-func sanitizePointer(s string) string {
- return pointerRE.ReplaceAllString(s, "(0x600dd065)")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of_test.go
deleted file mode 100644
index 0f9d198fcbe..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/all_of_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "errors"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type allOfFakeMatcher struct {
- desc string
- err error
-}
-
-func (m *allOfFakeMatcher) Matches(c interface{}) error {
- return m.err
-}
-
-func (m *allOfFakeMatcher) Description() string {
- return m.desc
-}
-
-type AllOfTest struct {
-}
-
-func init() { RegisterTestSuite(&AllOfTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *AllOfTest) DescriptionWithEmptySet() {
- m := AllOf()
- ExpectEq("is anything", m.Description())
-}
-
-func (t *AllOfTest) DescriptionWithOneMatcher() {
- m := AllOf(&allOfFakeMatcher{"taco", errors.New("")})
- ExpectEq("taco", m.Description())
-}
-
-func (t *AllOfTest) DescriptionWithMultipleMatchers() {
- m := AllOf(
- &allOfFakeMatcher{"taco", errors.New("")},
- &allOfFakeMatcher{"burrito", errors.New("")},
- &allOfFakeMatcher{"enchilada", errors.New("")})
-
- ExpectEq("taco, and burrito, and enchilada", m.Description())
-}
-
-func (t *AllOfTest) EmptySet() {
- m := AllOf()
- err := m.Matches(17)
-
- ExpectEq(nil, err)
-}
-
-func (t *AllOfTest) OneMatcherReturnsFatalErrorAndSomeOthersFail() {
- m := AllOf(
- &allOfFakeMatcher{"", errors.New("")},
- &allOfFakeMatcher{"", NewFatalError("taco")},
- &allOfFakeMatcher{"", errors.New("")},
- &allOfFakeMatcher{"", nil})
-
- err := m.Matches(17)
-
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *AllOfTest) OneMatcherReturnsNonFatalAndOthersSayTrue() {
- m := AllOf(
- &allOfFakeMatcher{"", nil},
- &allOfFakeMatcher{"", errors.New("taco")},
- &allOfFakeMatcher{"", nil})
-
- err := m.Matches(17)
-
- ExpectFalse(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *AllOfTest) AllMatchersSayTrue() {
- m := AllOf(
- &allOfFakeMatcher{"", nil},
- &allOfFakeMatcher{"", nil},
- &allOfFakeMatcher{"", nil})
-
- err := m.Matches(17)
-
- ExpectEq(nil, err)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of_test.go
deleted file mode 100644
index f0b5025406f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_of_test.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type fakeAnyOfMatcher struct {
- desc string
- err error
-}
-
-func (m *fakeAnyOfMatcher) Matches(c interface{}) error {
- return m.err
-}
-
-func (m *fakeAnyOfMatcher) Description() string {
- return m.desc
-}
-
-type AnyOfTest struct {
-}
-
-func init() { RegisterTestSuite(&AnyOfTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *AnyOfTest) EmptySet() {
- matcher := AnyOf()
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *AnyOfTest) OneTrue() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", NewFatalError("foo")},
- 17,
- &fakeAnyOfMatcher{"", errors.New("foo")},
- &fakeAnyOfMatcher{"", nil},
- &fakeAnyOfMatcher{"", errors.New("foo")},
- )
-
- err := matcher.Matches(0)
- ExpectEq(nil, err)
-}
-
-func (t *AnyOfTest) OneEqual() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", NewFatalError("foo")},
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 13,
- "taco",
- 19,
- &fakeAnyOfMatcher{"", errors.New("foo")},
- )
-
- err := matcher.Matches("taco")
- ExpectEq(nil, err)
-}
-
-func (t *AnyOfTest) OneFatal() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 17,
- &fakeAnyOfMatcher{"", NewFatalError("taco")},
- &fakeAnyOfMatcher{"", errors.New("foo")},
- )
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *AnyOfTest) OneNil() {
- var err error
- matcher := AnyOf(
- 13,
- nil,
- 19,
- )
-
- // No match
- err = matcher.Matches(14)
- ExpectNe(nil, err)
-
- // Match
- err = matcher.Matches(nil)
- ExpectEq(nil, err)
-}
-
-func (t *AnyOfTest) AllFalseAndNotEqual() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 17,
- &fakeAnyOfMatcher{"", errors.New("foo")},
- 19,
- )
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *AnyOfTest) DescriptionForEmptySet() {
- matcher := AnyOf()
- ExpectEq("or()", matcher.Description())
-}
-
-func (t *AnyOfTest) DescriptionForNonEmptySet() {
- matcher := AnyOf(
- &fakeAnyOfMatcher{"taco", nil},
- "burrito",
- &fakeAnyOfMatcher{"enchilada", nil},
- )
-
- ExpectEq("or(taco, burrito, enchilada)", matcher.Description())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_test.go
deleted file mode 100644
index 410cc12825e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/any_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type AnyTest struct {
-}
-
-func init() { RegisterTestSuite(&AnyTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *AnyTest) Description() {
- m := Any()
- ExpectEq("is anything", m.Description())
-}
-
-func (t *AnyTest) Matches() {
- var err error
- m := Any()
-
- err = m.Matches(nil)
- ExpectEq(nil, err)
-
- err = m.Matches(17)
- ExpectEq(nil, err)
-
- err = m.Matches("taco")
- ExpectEq(nil, err)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains_test.go
deleted file mode 100644
index dfc981c1488..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/contains_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type ContainsTest struct {}
-func init() { RegisterTestSuite(&ContainsTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *ContainsTest) WrongTypeCandidates() {
- m := Contains("")
- ExpectEq("contains: ", m.Description())
-
- var err error
-
- // Nil candidate
- err = m.Matches(nil)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // String candidate
- err = m.Matches("")
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // Map candidate
- err = m.Matches(make(map[string]string))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-}
-
-func (t *ContainsTest) NilArgument() {
- m := Contains(nil)
- ExpectEq("contains: is nil", m.Description())
-
- var c interface{}
- var err error
-
- // Empty array of pointers
- c = [...]*int{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Empty slice of pointers
- c = []*int{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-empty array of integers
- c = [...]int{17, 0, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-empty slice of integers
- c = []int{17, 0, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching array of pointers
- c = [...]*int{new(int), new(int)}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of pointers
- c = []*int{new(int), new(int)}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of pointers
- c = [...]*int{new(int), nil, new(int)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of pointers
- c = []*int{new(int), nil, new(int)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of pointers from matching array
- someArray := [...]*int{new(int), nil, new(int)}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *ContainsTest) StringArgument() {
- m := Contains("taco")
- ExpectEq("contains: taco", m.Description())
-
- var c interface{}
- var err error
-
- // Non-matching array of strings
- c = [...]string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of strings
- c = []string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of strings
- c = [...]string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of strings
- c = []string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of strings from matching array
- someArray := [...]string{"burrito", "taco", "enchilada"}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *ContainsTest) IntegerArgument() {
- m := Contains(int(17))
- ExpectEq("contains: 17", m.Description())
-
- var c interface{}
- var err error
-
- // Non-matching array of integers
- c = [...]int{13, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of integers
- c = []int{13, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of integers
- c = [...]int{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of integers
- c = []int{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of integers from matching array
- someArray := [...]int{13, 17, 19}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching array of floats
- c = [...]float32{13, 17.5, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of floats
- c = []float32{13, 17.5, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of floats
- c = [...]float32{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of floats
- c = []float32{13, 17, 19}
- err = m.Matches(c)
- ExpectEq(nil, err)
-}
-
-func (t *ContainsTest) MatcherArgument() {
- m := Contains(HasSubstr("ac"))
- ExpectEq("contains: has substring \"ac\"", m.Description())
-
- var c interface{}
- var err error
-
- // Non-matching array of strings
- c = [...]string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Non-matching slice of strings
- c = []string{"burrito", "enchilada"}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Matching array of strings
- c = [...]string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching slice of strings
- c = []string{"burrito", "taco", "enchilada"}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching slice of strings from matching array
- someArray := [...]string{"burrito", "taco", "enchilada"}
- c = someArray[0:1]
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals_test.go
deleted file mode 100644
index a28113aaa6b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/deep_equals_test.go
+++ /dev/null
@@ -1,343 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "bytes"
- "testing"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type DeepEqualsTest struct {}
-func init() { RegisterTestSuite(&DeepEqualsTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithScalarValue() {
- var x int = 17
- m := DeepEquals(x)
-
- var err error
-
- // Nil candidate.
- err = m.Matches(nil)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("<nil>")))
-
- // Int alias candidate.
- type intAlias int
- err = m.Matches(intAlias(x))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("intAlias")))
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Byte slice candidate.
- err = m.Matches([]byte{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint8")))
-
- // Other slice candidate.
- err = m.Matches([]uint16{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint16")))
-
- // Unsigned int candidate.
- err = m.Matches(uint(17))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("uint")))
-}
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithByteSliceValue() {
- x := []byte{}
- m := DeepEquals(x)
-
- var err error
-
- // Nil candidate.
- err = m.Matches(nil)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("<nil>")))
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Slice candidate with wrong value type.
- err = m.Matches([]uint16{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint16")))
-}
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithOtherSliceValue() {
- x := []uint16{}
- m := DeepEquals(x)
-
- var err error
-
- // Nil candidate.
- err = m.Matches(nil)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("<nil>")))
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Byte slice candidate with wrong value type.
- err = m.Matches([]byte{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint8")))
-
- // Other slice candidate with wrong value type.
- err = m.Matches([]uint32{})
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint32")))
-}
-
-func (t *DeepEqualsTest) WrongTypeCandidateWithNilLiteralValue() {
- m := DeepEquals(nil)
-
- var err error
-
- // String candidate.
- err = m.Matches("taco")
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("string")))
-
- // Nil byte slice candidate.
- err = m.Matches([]byte(nil))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint8")))
-
- // Nil other slice candidate.
- err = m.Matches([]uint16(nil))
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("type")))
- ExpectThat(err, Error(HasSubstr("[]uint16")))
-}
-
-func (t *DeepEqualsTest) NilLiteralValue() {
- m := DeepEquals(nil)
- ExpectEq("deep equals: <nil>", m.Description())
-
- var c interface{}
- var err error
-
- // Nil literal candidate.
- c = nil
- err = m.Matches(c)
- ExpectEq(nil, err)
-}
-
-func (t *DeepEqualsTest) IntValue() {
- m := DeepEquals(int(17))
- ExpectEq("deep equals: 17", m.Description())
-
- var c interface{}
- var err error
-
- // Matching int.
- c = int(17)
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching int.
- c = int(18)
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) ByteSliceValue() {
- x := []byte{17, 19}
- m := DeepEquals(x)
- ExpectEq("deep equals: [17 19]", m.Description())
-
- var c []byte
- var err error
-
- // Matching.
- c = make([]byte, len(x))
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Nil slice.
- c = []byte(nil)
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("which is nil")))
-
- // Prefix.
- AssertGt(len(x), 1)
- c = make([]byte, len(x)-1)
- AssertEq(len(x)-1, copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Suffix.
- c = make([]byte, len(x)+1)
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) OtherSliceValue() {
- x := []uint16{17, 19}
- m := DeepEquals(x)
- ExpectEq("deep equals: [17 19]", m.Description())
-
- var c []uint16
- var err error
-
- // Matching.
- c = make([]uint16, len(x))
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Nil slice.
- c = []uint16(nil)
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("which is nil")))
-
- // Prefix.
- AssertGt(len(x), 1)
- c = make([]uint16, len(x)-1)
- AssertEq(len(x)-1, copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-
- // Suffix.
- c = make([]uint16, len(x)+1)
- AssertEq(len(x), copy(c, x))
-
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) NilByteSliceValue() {
- x := []byte(nil)
- m := DeepEquals(x)
- ExpectEq("deep equals: <nil slice>", m.Description())
-
- var c []byte
- var err error
-
- // Nil slice.
- c = []byte(nil)
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-nil slice.
- c = []byte{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *DeepEqualsTest) NilOtherSliceValue() {
- x := []uint16(nil)
- m := DeepEquals(x)
- ExpectEq("deep equals: <nil slice>", m.Description())
-
- var c []uint16
- var err error
-
- // Nil slice.
- c = []uint16(nil)
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-nil slice.
- c = []uint16{}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Benchmarks
-////////////////////////////////////////////////////////////////////////
-
-func benchmarkWithSize(b *testing.B, size int) {
- b.StopTimer()
- buf := bytes.Repeat([]byte{0x01}, size)
- bufCopy := make([]byte, size)
- copy(bufCopy, buf)
-
- matcher := DeepEquals(buf)
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- matcher.Matches(bufCopy)
- }
-
- b.SetBytes(int64(size))
-}
-
-func BenchmarkShortByteSlice(b *testing.B) {
- benchmarkWithSize(b, 256)
-}
-
-func BenchmarkLongByteSlice(b *testing.B) {
- benchmarkWithSize(b, 1<<24)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are_test.go
deleted file mode 100644
index 172584fa140..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/elements_are_test.go
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type ElementsAreTest struct {
-}
-
-func init() { RegisterTestSuite(&ElementsAreTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *ElementsAreTest) EmptySet() {
- m := ElementsAre()
- ExpectEq("elements are: []", m.Description())
-
- var c []interface{}
- var err error
-
- // No candidates.
- c = []interface{}{}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // One candidate.
- c = []interface{}{17}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 1")))
-}
-
-func (t *ElementsAreTest) OneMatcher() {
- m := ElementsAre(LessThan(17))
- ExpectEq("elements are: [less than 17]", m.Description())
-
- var c []interface{}
- var err error
-
- // No candidates.
- c = []interface{}{}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 0")))
-
- // Matching candidate.
- c = []interface{}{16}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching candidate.
- c = []interface{}{19}
- err = m.Matches(c)
- ExpectNe(nil, err)
-
- // Two candidates.
- c = []interface{}{17, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 2")))
-}
-
-func (t *ElementsAreTest) OneValue() {
- m := ElementsAre(17)
- ExpectEq("elements are: [17]", m.Description())
-
- var c []interface{}
- var err error
-
- // No candidates.
- c = []interface{}{}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 0")))
-
- // Matching int.
- c = []interface{}{int(17)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Matching float.
- c = []interface{}{float32(17)}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // Non-matching candidate.
- c = []interface{}{19}
- err = m.Matches(c)
- ExpectNe(nil, err)
-
- // Two candidates.
- c = []interface{}{17, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 2")))
-}
-
-func (t *ElementsAreTest) MultipleElements() {
- m := ElementsAre("taco", LessThan(17))
- ExpectEq("elements are: [taco, less than 17]", m.Description())
-
- var c []interface{}
- var err error
-
- // One candidate.
- c = []interface{}{17}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 1")))
-
- // Both matching.
- c = []interface{}{"taco", 16}
- err = m.Matches(c)
- ExpectEq(nil, err)
-
- // First non-matching.
- c = []interface{}{"burrito", 16}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("whose element 0 doesn't match")))
-
- // Second non-matching.
- c = []interface{}{"taco", 17}
- err = m.Matches(c)
- ExpectThat(err, Error(Equals("whose element 1 doesn't match")))
-
- // Three candidates.
- c = []interface{}{"taco", 17, 19}
- err = m.Matches(c)
- ExpectThat(err, Error(HasSubstr("length 3")))
-}
-
-func (t *ElementsAreTest) ArrayCandidates() {
- m := ElementsAre("taco", LessThan(17))
-
- var err error
-
- // One candidate.
- err = m.Matches([1]interface{}{"taco"})
- ExpectThat(err, Error(HasSubstr("length 1")))
-
- // Both matching.
- err = m.Matches([2]interface{}{"taco", 16})
- ExpectEq(nil, err)
-
- // First non-matching.
- err = m.Matches([2]interface{}{"burrito", 16})
- ExpectThat(err, Error(Equals("whose element 0 doesn't match")))
-}
-
-func (t *ElementsAreTest) WrongTypeCandidate() {
- m := ElementsAre("taco")
-
- var err error
-
- // String candidate.
- err = m.Matches("taco")
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // Map candidate.
- err = m.Matches(map[string]string{})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-
- // Nil candidate.
- err = m.Matches(nil)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("array")))
- ExpectThat(err, Error(HasSubstr("slice")))
-}
-
-func (t *ElementsAreTest) PropagatesFatality() {
- m := ElementsAre(LessThan(17))
- ExpectEq("elements are: [less than 17]", m.Description())
-
- var c []interface{}
- var err error
-
- // Non-fatal error.
- c = []interface{}{19}
- err = m.Matches(c)
- AssertNe(nil, err)
- ExpectFalse(isFatal(err))
-
- // Fatal error.
- c = []interface{}{"taco"}
- err = m.Matches(c)
- AssertNe(nil, err)
- ExpectTrue(isFatal(err))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals_test.go
deleted file mode 100644
index 6ac5df27329..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/equals_test.go
+++ /dev/null
@@ -1,3864 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "fmt"
- "math"
- "unsafe"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-var someInt int = -17
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type EqualsTest struct {
-}
-
-func init() { RegisterTestSuite(&EqualsTest{}) }
-
-type equalsTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *EqualsTest) checkTestCases(matcher Matcher, cases []equalsTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
- ExpectEq(
- c.expectedResult,
- (err == nil),
- "Result for case %d: %v (Error: %v)", i, c, err)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(c.shouldBeFatal, isFatal, "Fatality for case %d: %v", i, c)
-
- ExpectThat(err, Error(Equals(c.expectedError)), "Case %d: %v", i, c)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// nil
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) EqualsNil() {
- matcher := Equals(nil)
- ExpectEq("is nil", matcher.Description())
-
- cases := []equalsTestCase{
- // Legal types
- equalsTestCase{nil, true, false, ""},
- equalsTestCase{chan int(nil), true, false, ""},
- equalsTestCase{(func())(nil), true, false, ""},
- equalsTestCase{interface{}(nil), true, false, ""},
- equalsTestCase{map[int]int(nil), true, false, ""},
- equalsTestCase{(*int)(nil), true, false, ""},
- equalsTestCase{[]int(nil), true, false, ""},
-
- equalsTestCase{make(chan int), false, false, ""},
- equalsTestCase{func() {}, false, false, ""},
- equalsTestCase{map[int]int{}, false, false, ""},
- equalsTestCase{&someInt, false, false, ""},
- equalsTestCase{[]int{}, false, false, ""},
-
- // Illegal types
- equalsTestCase{17, false, true, "which cannot be compared to nil"},
- equalsTestCase{int8(17), false, true, "which cannot be compared to nil"},
- equalsTestCase{uintptr(17), false, true, "which cannot be compared to nil"},
- equalsTestCase{[...]int{}, false, true, "which cannot be compared to nil"},
- equalsTestCase{"taco", false, true, "which cannot be compared to nil"},
- equalsTestCase{equalsTestCase{}, false, true, "which cannot be compared to nil"},
- equalsTestCase{unsafe.Pointer(&someInt), false, true, "which cannot be compared to nil"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegerLiteral() {
- // -2^30
- matcher := Equals(-1073741824)
- ExpectEq("-1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegerLiteral() {
- // 2^30
- matcher := Equals(1073741824)
- ExpectEq("1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{uintptr(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(uint(1073741824)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Floating point literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralFloatingPointLiteral() {
- // -2^30
- matcher := Equals(-1073741824.0)
- ExpectEq("-1.073741824e+09", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
- equalsTestCase{interface{}(float64(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralFloatingPointLiteral() {
- // 2^30
- matcher := Equals(1073741824.0)
- ExpectEq("1.073741824e+09", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(float64(1073741824)), true, false, ""},
-
- // Values that would be 1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{uint(1073741823), false, false, ""},
- equalsTestCase{uint32(1073741823), false, false, ""},
- equalsTestCase{uint64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonIntegralFloatingPointLiteral() {
- matcher := Equals(17.1)
- ExpectEq("17.1", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 17.1.
- equalsTestCase{17.1, true, false, ""},
- equalsTestCase{17.1, true, false, ""},
- equalsTestCase{17.1 + 0i, true, false, ""},
- equalsTestCase{float32(17.1), true, false, ""},
- equalsTestCase{float64(17.1), true, false, ""},
- equalsTestCase{complex64(17.1), true, false, ""},
- equalsTestCase{complex128(17.1), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{17, false, false, ""},
- equalsTestCase{17.2, false, false, ""},
- equalsTestCase{18, false, false, ""},
- equalsTestCase{int(17), false, false, ""},
- equalsTestCase{int(18), false, false, ""},
- equalsTestCase{int32(17), false, false, ""},
- equalsTestCase{int64(17), false, false, ""},
- equalsTestCase{uint(17), false, false, ""},
- equalsTestCase{uint32(17), false, false, ""},
- equalsTestCase{uint64(17), false, false, ""},
- equalsTestCase{uintptr(17), false, false, ""},
- equalsTestCase{complex128(17.1 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// bool
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) False() {
- matcher := Equals(false)
- ExpectEq("false", matcher.Description())
-
- cases := []equalsTestCase{
- // bools
- equalsTestCase{false, true, false, ""},
- equalsTestCase{bool(false), true, false, ""},
-
- equalsTestCase{true, false, false, ""},
- equalsTestCase{bool(true), false, false, ""},
-
- // Other types.
- equalsTestCase{int(0), false, true, "which is not a bool"},
- equalsTestCase{int8(0), false, true, "which is not a bool"},
- equalsTestCase{int16(0), false, true, "which is not a bool"},
- equalsTestCase{int32(0), false, true, "which is not a bool"},
- equalsTestCase{int64(0), false, true, "which is not a bool"},
- equalsTestCase{uint(0), false, true, "which is not a bool"},
- equalsTestCase{uint8(0), false, true, "which is not a bool"},
- equalsTestCase{uint16(0), false, true, "which is not a bool"},
- equalsTestCase{uint32(0), false, true, "which is not a bool"},
- equalsTestCase{uint64(0), false, true, "which is not a bool"},
- equalsTestCase{uintptr(0), false, true, "which is not a bool"},
- equalsTestCase{[...]int{}, false, true, "which is not a bool"},
- equalsTestCase{make(chan int), false, true, "which is not a bool"},
- equalsTestCase{func() {}, false, true, "which is not a bool"},
- equalsTestCase{map[int]int{}, false, true, "which is not a bool"},
- equalsTestCase{&someInt, false, true, "which is not a bool"},
- equalsTestCase{[]int{}, false, true, "which is not a bool"},
- equalsTestCase{"taco", false, true, "which is not a bool"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a bool"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) True() {
- matcher := Equals(true)
- ExpectEq("true", matcher.Description())
-
- cases := []equalsTestCase{
- // bools
- equalsTestCase{true, true, false, ""},
- equalsTestCase{bool(true), true, false, ""},
-
- equalsTestCase{false, false, false, ""},
- equalsTestCase{bool(false), false, false, ""},
-
- // Other types.
- equalsTestCase{int(1), false, true, "which is not a bool"},
- equalsTestCase{int8(1), false, true, "which is not a bool"},
- equalsTestCase{int16(1), false, true, "which is not a bool"},
- equalsTestCase{int32(1), false, true, "which is not a bool"},
- equalsTestCase{int64(1), false, true, "which is not a bool"},
- equalsTestCase{uint(1), false, true, "which is not a bool"},
- equalsTestCase{uint8(1), false, true, "which is not a bool"},
- equalsTestCase{uint16(1), false, true, "which is not a bool"},
- equalsTestCase{uint32(1), false, true, "which is not a bool"},
- equalsTestCase{uint64(1), false, true, "which is not a bool"},
- equalsTestCase{uintptr(1), false, true, "which is not a bool"},
- equalsTestCase{[...]int{}, false, true, "which is not a bool"},
- equalsTestCase{make(chan int), false, true, "which is not a bool"},
- equalsTestCase{func() {}, false, true, "which is not a bool"},
- equalsTestCase{map[int]int{}, false, true, "which is not a bool"},
- equalsTestCase{&someInt, false, true, "which is not a bool"},
- equalsTestCase{[]int{}, false, true, "which is not a bool"},
- equalsTestCase{"taco", false, true, "which is not a bool"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a bool"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt() {
- // -2^30
- matcher := Equals(int(-1073741824))
- ExpectEq("-1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt() {
- // 2^30
- matcher := Equals(int(1073741824))
- ExpectEq("1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{uintptr(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(uint(1073741824)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int8
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt8() {
- matcher := Equals(int8(-17))
- ExpectEq("-17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -17.
- equalsTestCase{-17, true, false, ""},
- equalsTestCase{-17.0, true, false, ""},
- equalsTestCase{-17 + 0i, true, false, ""},
- equalsTestCase{int(-17), true, false, ""},
- equalsTestCase{int8(-17), true, false, ""},
- equalsTestCase{int16(-17), true, false, ""},
- equalsTestCase{int32(-17), true, false, ""},
- equalsTestCase{int64(-17), true, false, ""},
- equalsTestCase{float32(-17), true, false, ""},
- equalsTestCase{float64(-17), true, false, ""},
- equalsTestCase{complex64(-17), true, false, ""},
- equalsTestCase{complex128(-17), true, false, ""},
- equalsTestCase{interface{}(int(-17)), true, false, ""},
-
- // Values that would be -17 in two's complement.
- equalsTestCase{uint((1 << 32) - 17), false, false, ""},
- equalsTestCase{uint8((1 << 8) - 17), false, false, ""},
- equalsTestCase{uint16((1 << 16) - 17), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 17), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 17), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 17), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-16), false, false, ""},
- equalsTestCase{int8(-16), false, false, ""},
- equalsTestCase{int16(-16), false, false, ""},
- equalsTestCase{int32(-16), false, false, ""},
- equalsTestCase{int64(-16), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float32(-17.1), false, false, ""},
- equalsTestCase{float32(-16.9), false, false, ""},
- equalsTestCase{complex64(-16), false, false, ""},
- equalsTestCase{complex64(-17 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{-17}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{-17}, false, true, "which is not numeric"},
- equalsTestCase{"-17", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroInt8() {
- matcher := Equals(int8(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 0.
- equalsTestCase{0, true, false, ""},
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(int(0)), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1), false, false, ""},
- equalsTestCase{int8(1), false, false, ""},
- equalsTestCase{int16(1), false, false, ""},
- equalsTestCase{int32(1), false, false, ""},
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{float32(-0.1), false, false, ""},
- equalsTestCase{float32(0.1), false, false, ""},
- equalsTestCase{complex64(1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{0}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{0}, false, true, "which is not numeric"},
- equalsTestCase{"0", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt8() {
- matcher := Equals(int8(17))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 17.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(17), true, false, ""},
- equalsTestCase{int8(17), true, false, ""},
- equalsTestCase{int16(17), true, false, ""},
- equalsTestCase{int32(17), true, false, ""},
- equalsTestCase{int64(17), true, false, ""},
- equalsTestCase{float32(17), true, false, ""},
- equalsTestCase{float64(17), true, false, ""},
- equalsTestCase{complex64(17), true, false, ""},
- equalsTestCase{complex128(17), true, false, ""},
- equalsTestCase{interface{}(int(17)), true, false, ""},
- equalsTestCase{uint(17), true, false, ""},
- equalsTestCase{uint8(17), true, false, ""},
- equalsTestCase{uint16(17), true, false, ""},
- equalsTestCase{uint32(17), true, false, ""},
- equalsTestCase{uint64(17), true, false, ""},
- equalsTestCase{uintptr(17), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(16), false, false, ""},
- equalsTestCase{int8(16), false, false, ""},
- equalsTestCase{int16(16), false, false, ""},
- equalsTestCase{int32(16), false, false, ""},
- equalsTestCase{int64(16), false, false, ""},
- equalsTestCase{float32(16.9), false, false, ""},
- equalsTestCase{float32(17.1), false, false, ""},
- equalsTestCase{complex64(16), false, false, ""},
- equalsTestCase{complex64(17 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{17}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{17}, false, true, "which is not numeric"},
- equalsTestCase{"17", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int16
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt16() {
- matcher := Equals(int16(-32766))
- ExpectEq("-32766", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -32766.
- equalsTestCase{-32766, true, false, ""},
- equalsTestCase{-32766.0, true, false, ""},
- equalsTestCase{-32766 + 0i, true, false, ""},
- equalsTestCase{int(-32766), true, false, ""},
- equalsTestCase{int16(-32766), true, false, ""},
- equalsTestCase{int32(-32766), true, false, ""},
- equalsTestCase{int64(-32766), true, false, ""},
- equalsTestCase{float32(-32766), true, false, ""},
- equalsTestCase{float64(-32766), true, false, ""},
- equalsTestCase{complex64(-32766), true, false, ""},
- equalsTestCase{complex128(-32766), true, false, ""},
- equalsTestCase{interface{}(int(-32766)), true, false, ""},
-
- // Values that would be -32766 in two's complement.
- equalsTestCase{uint((1 << 32) - 32766), false, false, ""},
- equalsTestCase{uint16((1 << 16) - 32766), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 32766), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 32766), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 32766), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-16), false, false, ""},
- equalsTestCase{int8(-16), false, false, ""},
- equalsTestCase{int16(-16), false, false, ""},
- equalsTestCase{int32(-16), false, false, ""},
- equalsTestCase{int64(-16), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float32(-32766.1), false, false, ""},
- equalsTestCase{float32(-32765.9), false, false, ""},
- equalsTestCase{complex64(-32766.1), false, false, ""},
- equalsTestCase{complex64(-32766 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{-32766}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{-32766}, false, true, "which is not numeric"},
- equalsTestCase{"-32766", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroInt16() {
- matcher := Equals(int16(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 0.
- equalsTestCase{0, true, false, ""},
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(int(0)), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1), false, false, ""},
- equalsTestCase{int8(1), false, false, ""},
- equalsTestCase{int16(1), false, false, ""},
- equalsTestCase{int32(1), false, false, ""},
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{float32(-0.1), false, false, ""},
- equalsTestCase{float32(0.1), false, false, ""},
- equalsTestCase{complex64(1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{0}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{0}, false, true, "which is not numeric"},
- equalsTestCase{"0", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt16() {
- matcher := Equals(int16(32765))
- ExpectEq("32765", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32765.
- equalsTestCase{32765, true, false, ""},
- equalsTestCase{32765.0, true, false, ""},
- equalsTestCase{32765 + 0i, true, false, ""},
- equalsTestCase{int(32765), true, false, ""},
- equalsTestCase{int16(32765), true, false, ""},
- equalsTestCase{int32(32765), true, false, ""},
- equalsTestCase{int64(32765), true, false, ""},
- equalsTestCase{float32(32765), true, false, ""},
- equalsTestCase{float64(32765), true, false, ""},
- equalsTestCase{complex64(32765), true, false, ""},
- equalsTestCase{complex128(32765), true, false, ""},
- equalsTestCase{interface{}(int(32765)), true, false, ""},
- equalsTestCase{uint(32765), true, false, ""},
- equalsTestCase{uint16(32765), true, false, ""},
- equalsTestCase{uint32(32765), true, false, ""},
- equalsTestCase{uint64(32765), true, false, ""},
- equalsTestCase{uintptr(32765), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(32764), false, false, ""},
- equalsTestCase{int16(32764), false, false, ""},
- equalsTestCase{int32(32764), false, false, ""},
- equalsTestCase{int64(32764), false, false, ""},
- equalsTestCase{float32(32764.9), false, false, ""},
- equalsTestCase{float32(32765.1), false, false, ""},
- equalsTestCase{complex64(32765.9), false, false, ""},
- equalsTestCase{complex64(32765 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{32765}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{32765}, false, true, "which is not numeric"},
- equalsTestCase{"32765", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int32
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt32() {
- // -2^30
- matcher := Equals(int32(-1073741824))
- ExpectEq("-1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1073741824.
- equalsTestCase{-1073741824, true, false, ""},
- equalsTestCase{-1073741824.0, true, false, ""},
- equalsTestCase{-1073741824 + 0i, true, false, ""},
- equalsTestCase{int(-1073741824), true, false, ""},
- equalsTestCase{int32(-1073741824), true, false, ""},
- equalsTestCase{int64(-1073741824), true, false, ""},
- equalsTestCase{float32(-1073741824), true, false, ""},
- equalsTestCase{float64(-1073741824), true, false, ""},
- equalsTestCase{complex64(-1073741824), true, false, ""},
- equalsTestCase{complex128(-1073741824), true, false, ""},
- equalsTestCase{interface{}(int(-1073741824)), true, false, ""},
-
- // Values that would be -1073741824 in two's complement.
- equalsTestCase{uint((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint32((1 << 32) - 1073741824), false, false, ""},
- equalsTestCase{uint64((1 << 64) - 1073741824), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 1073741824), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int(-1073741823), false, false, ""},
- equalsTestCase{int32(-1073741823), false, false, ""},
- equalsTestCase{int64(-1073741823), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1073741824.1), false, false, ""},
- equalsTestCase{float64(-1073741823.9), false, false, ""},
- equalsTestCase{complex128(-1073741823), false, false, ""},
- equalsTestCase{complex128(-1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt32() {
- // 2^30
- matcher := Equals(int32(1073741824))
- ExpectEq("1073741824", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1073741824.
- equalsTestCase{1073741824, true, false, ""},
- equalsTestCase{1073741824.0, true, false, ""},
- equalsTestCase{1073741824 + 0i, true, false, ""},
- equalsTestCase{int(1073741824), true, false, ""},
- equalsTestCase{uint(1073741824), true, false, ""},
- equalsTestCase{int32(1073741824), true, false, ""},
- equalsTestCase{int64(1073741824), true, false, ""},
- equalsTestCase{uint32(1073741824), true, false, ""},
- equalsTestCase{uint64(1073741824), true, false, ""},
- equalsTestCase{uintptr(1073741824), true, false, ""},
- equalsTestCase{float32(1073741824), true, false, ""},
- equalsTestCase{float64(1073741824), true, false, ""},
- equalsTestCase{complex64(1073741824), true, false, ""},
- equalsTestCase{complex128(1073741824), true, false, ""},
- equalsTestCase{interface{}(int(1073741824)), true, false, ""},
- equalsTestCase{interface{}(uint(1073741824)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(1073741823), false, false, ""},
- equalsTestCase{int32(1073741823), false, false, ""},
- equalsTestCase{int64(1073741823), false, false, ""},
- equalsTestCase{float64(1073741824.1), false, false, ""},
- equalsTestCase{float64(1073741823.9), false, false, ""},
- equalsTestCase{complex128(1073741823), false, false, ""},
- equalsTestCase{complex128(1073741824 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// int64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeInt64() {
- // -2^40
- matcher := Equals(int64(-1099511627776))
- ExpectEq("-1099511627776", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -1099511627776.
- equalsTestCase{-1099511627776.0, true, false, ""},
- equalsTestCase{-1099511627776 + 0i, true, false, ""},
- equalsTestCase{int64(-1099511627776), true, false, ""},
- equalsTestCase{float32(-1099511627776), true, false, ""},
- equalsTestCase{float64(-1099511627776), true, false, ""},
- equalsTestCase{complex64(-1099511627776), true, false, ""},
- equalsTestCase{complex128(-1099511627776), true, false, ""},
- equalsTestCase{interface{}(int64(-1099511627776)), true, false, ""},
-
- // Values that would be -1099511627776 in two's complement.
- equalsTestCase{uint64((1 << 64) - 1099511627776), false, false, ""},
-
- // Non-equal values of signed integer type.
- equalsTestCase{int64(-1099511627775), false, false, ""},
-
- // Non-equal values of other numeric types.
- equalsTestCase{float64(-1099511627776.1), false, false, ""},
- equalsTestCase{float64(-1099511627775.9), false, false, ""},
- equalsTestCase{complex128(-1099511627775), false, false, ""},
- equalsTestCase{complex128(-1099511627776 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveInt64() {
- // 2^40
- matcher := Equals(int64(1099511627776))
- ExpectEq("1099511627776", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 1099511627776.
- equalsTestCase{1099511627776.0, true, false, ""},
- equalsTestCase{1099511627776 + 0i, true, false, ""},
- equalsTestCase{int64(1099511627776), true, false, ""},
- equalsTestCase{uint64(1099511627776), true, false, ""},
- equalsTestCase{uintptr(1099511627776), true, false, ""},
- equalsTestCase{float32(1099511627776), true, false, ""},
- equalsTestCase{float64(1099511627776), true, false, ""},
- equalsTestCase{complex64(1099511627776), true, false, ""},
- equalsTestCase{complex128(1099511627776), true, false, ""},
- equalsTestCase{interface{}(int64(1099511627776)), true, false, ""},
- equalsTestCase{interface{}(uint64(1099511627776)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1099511627775), false, false, ""},
- equalsTestCase{uint64(1099511627775), false, false, ""},
- equalsTestCase{float64(1099511627776.1), false, false, ""},
- equalsTestCase{float64(1099511627775.9), false, false, ""},
- equalsTestCase{complex128(1099511627775), false, false, ""},
- equalsTestCase{complex128(1099511627776 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(int64(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(int64(kTwoTo54 + 1))
- ExpectEq("18014398509481985", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint() {
- const kExpected = 17
- matcher := Equals(uint(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint() {
- const kExpected = (1 << 16) + 17
- matcher := Equals(uint(kExpected))
- ExpectEq("65553", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{65553, true, false, ""},
- equalsTestCase{65553.0, true, false, ""},
- equalsTestCase{65553 + 0i, true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int16(17), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(17), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) UintNotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(uint(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint8
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint8() {
- const kExpected = 17
- matcher := Equals(uint8(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint16
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint16() {
- const kExpected = 17
- matcher := Equals(uint16(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint16() {
- const kExpected = (1 << 8) + 17
- matcher := Equals(uint16(kExpected))
- ExpectEq("273", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{273, true, false, ""},
- equalsTestCase{273.0, true, false, ""},
- equalsTestCase{273 + 0i, true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int8(17), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(17), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint32
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint32() {
- const kExpected = 17
- matcher := Equals(uint32(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint32() {
- const kExpected = (1 << 16) + 17
- matcher := Equals(uint32(kExpected))
- ExpectEq("65553", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{65553, true, false, ""},
- equalsTestCase{65553.0, true, false, ""},
- equalsTestCase{65553 + 0i, true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int16(17), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(17), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Uint32NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(uint32(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uint64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUint64() {
- const kExpected = 17
- matcher := Equals(uint64(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUint64() {
- const kExpected = (1 << 32) + 17
- matcher := Equals(uint64(kExpected))
- ExpectEq("4294967313", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{4294967313.0, true, false, ""},
- equalsTestCase{4294967313 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int(17), false, false, ""},
- equalsTestCase{int32(17), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(17), false, false, ""},
- equalsTestCase{uint32(17), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(uint64(kTwoTo25 + 1))
- ExpectEq("33554433", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 + 0), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(uint64(kTwoTo54 + 1))
- ExpectEq("18014398509481985", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// uintptr
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) SmallUintptr() {
- const kExpected = 17
- matcher := Equals(uintptr(kExpected))
- ExpectEq("17", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{17, true, false, ""},
- equalsTestCase{17.0, true, false, ""},
- equalsTestCase{17 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int8(kExpected), true, false, ""},
- equalsTestCase{int16(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint8(kExpected), true, false, ""},
- equalsTestCase{uint16(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{kExpected + 1, false, false, ""},
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int8(kExpected + 1), false, false, ""},
- equalsTestCase{int16(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint8(kExpected + 1), false, false, ""},
- equalsTestCase{uint16(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeUintptr() {
- const kExpected = (1 << 32) + 17
- matcher := Equals(uintptr(kExpected))
- ExpectEq("4294967313", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{4294967313.0, true, false, ""},
- equalsTestCase{4294967313 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric types.
- equalsTestCase{int(17), false, false, ""},
- equalsTestCase{int32(17), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(17), false, false, ""},
- equalsTestCase{uint32(17), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected + 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 1), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// float32
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralFloat32() {
- matcher := Equals(float32(-32769))
- ExpectEq("-32769", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -32769.
- equalsTestCase{-32769.0, true, false, ""},
- equalsTestCase{-32769 + 0i, true, false, ""},
- equalsTestCase{int32(-32769), true, false, ""},
- equalsTestCase{int64(-32769), true, false, ""},
- equalsTestCase{float32(-32769), true, false, ""},
- equalsTestCase{float64(-32769), true, false, ""},
- equalsTestCase{complex64(-32769), true, false, ""},
- equalsTestCase{complex128(-32769), true, false, ""},
- equalsTestCase{interface{}(float32(-32769)), true, false, ""},
- equalsTestCase{interface{}(int64(-32769)), true, false, ""},
-
- // Values that would be -32769 in two's complement.
- equalsTestCase{uint64((1 << 64) - 32769), false, false, ""},
- equalsTestCase{uintptr((1 << 64) - 32769), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(-32770), false, false, ""},
- equalsTestCase{float32(-32769.1), false, false, ""},
- equalsTestCase{float32(-32768.9), false, false, ""},
- equalsTestCase{float64(-32769.1), false, false, ""},
- equalsTestCase{float64(-32768.9), false, false, ""},
- equalsTestCase{complex128(-32768), false, false, ""},
- equalsTestCase{complex128(-32769 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralFloat32() {
- matcher := Equals(float32(-32769.1))
- ExpectEq("-32769.1", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of -32769.1.
- equalsTestCase{-32769.1, true, false, ""},
- equalsTestCase{-32769.1 + 0i, true, false, ""},
- equalsTestCase{float32(-32769.1), true, false, ""},
- equalsTestCase{float64(-32769.1), true, false, ""},
- equalsTestCase{complex64(-32769.1), true, false, ""},
- equalsTestCase{complex128(-32769.1), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int32(-32769), false, false, ""},
- equalsTestCase{int32(-32770), false, false, ""},
- equalsTestCase{int64(-32769), false, false, ""},
- equalsTestCase{int64(-32770), false, false, ""},
- equalsTestCase{float32(-32769.2), false, false, ""},
- equalsTestCase{float32(-32769.0), false, false, ""},
- equalsTestCase{float64(-32769.2), false, false, ""},
- equalsTestCase{complex128(-32769.1 + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeFloat32() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(float32(kExpected))
- ExpectEq("-3.689349e+19", matcher.Description())
-
- floatExpected := float32(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroFloat32() {
- matcher := Equals(float32(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralFloat32() {
- matcher := Equals(float32(32769))
- ExpectEq("32769", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{32769.0, true, false, ""},
- equalsTestCase{32769 + 0i, true, false, ""},
- equalsTestCase{int(32769), true, false, ""},
- equalsTestCase{int32(32769), true, false, ""},
- equalsTestCase{int64(32769), true, false, ""},
- equalsTestCase{uint(32769), true, false, ""},
- equalsTestCase{uint32(32769), true, false, ""},
- equalsTestCase{uint64(32769), true, false, ""},
- equalsTestCase{uintptr(32769), true, false, ""},
- equalsTestCase{float32(32769), true, false, ""},
- equalsTestCase{float64(32769), true, false, ""},
- equalsTestCase{complex64(32769), true, false, ""},
- equalsTestCase{complex128(32769), true, false, ""},
- equalsTestCase{interface{}(float32(32769)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(32770), false, false, ""},
- equalsTestCase{uint64(32770), false, false, ""},
- equalsTestCase{float32(32769.1), false, false, ""},
- equalsTestCase{float32(32768.9), false, false, ""},
- equalsTestCase{float64(32769.1), false, false, ""},
- equalsTestCase{float64(32768.9), false, false, ""},
- equalsTestCase{complex128(32768), false, false, ""},
- equalsTestCase{complex128(32769 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralFloat32() {
- matcher := Equals(float32(32769.1))
- ExpectEq("32769.1", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.1.
- equalsTestCase{32769.1, true, false, ""},
- equalsTestCase{32769.1 + 0i, true, false, ""},
- equalsTestCase{float32(32769.1), true, false, ""},
- equalsTestCase{float64(32769.1), true, false, ""},
- equalsTestCase{complex64(32769.1), true, false, ""},
- equalsTestCase{complex128(32769.1), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int32(32769), false, false, ""},
- equalsTestCase{int32(32770), false, false, ""},
- equalsTestCase{uint64(32769), false, false, ""},
- equalsTestCase{uint64(32770), false, false, ""},
- equalsTestCase{float32(32769.2), false, false, ""},
- equalsTestCase{float32(32769.0), false, false, ""},
- equalsTestCase{float64(32769.2), false, false, ""},
- equalsTestCase{complex128(32769.1 + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveFloat32() {
- const kExpected = 1 << 65
- matcher := Equals(float32(kExpected))
- ExpectEq("3.689349e+19", matcher.Description())
-
- floatExpected := float32(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(float32(kTwoTo25 + 1))
- ExpectEq("3.3554432e+07", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// float64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralFloat64() {
- const kExpected = -(1 << 50)
- matcher := Equals(float64(kExpected))
- ExpectEq("-1.125899906842624e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{-1125899906842624.0, true, false, ""},
- equalsTestCase{-1125899906842624.0 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Values that would be kExpected in two's complement.
- equalsTestCase{uint64((1 << 64) + kExpected), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralFloat64() {
- const kTwoTo50 = 1 << 50
- const kExpected = -kTwoTo50 - 0.25
-
- matcher := Equals(float64(kExpected))
- ExpectEq("-1.1258999068426242e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(-kTwoTo50), false, false, ""},
- equalsTestCase{int64(-kTwoTo50 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeFloat64() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(float64(kExpected))
- ExpectEq("-3.6893488147419103e+19", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroFloat64() {
- matcher := Equals(float64(0))
- ExpectEq("0", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralFloat64() {
- const kExpected = 1 << 50
- matcher := Equals(float64(kExpected))
- ExpectEq("1.125899906842624e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{1125899906842624.0, true, false, ""},
- equalsTestCase{1125899906842624.0 + 0i, true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralFloat64() {
- const kTwoTo50 = 1 << 50
- const kExpected = kTwoTo50 + 0.25
- matcher := Equals(float64(kExpected))
- ExpectEq("1.1258999068426242e+15", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kTwoTo50), false, false, ""},
- equalsTestCase{int64(kTwoTo50 - 1), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveFloat64() {
- const kExpected = 1 << 65
- matcher := Equals(float64(kExpected))
- ExpectEq("3.6893488147419103e+19", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(float64(kTwoTo54 + 1))
- ExpectEq("1.8014398509481984e+16", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// complex64
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralComplex64() {
- const kExpected = -32769
- matcher := Equals(complex64(kExpected))
- ExpectEq("(-32769+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{-32769.0, true, false, ""},
- equalsTestCase{-32769.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Values that would be kExpected in two's complement.
- equalsTestCase{uint32((1 << 32) + kExpected), false, false, ""},
- equalsTestCase{uint64((1 << 64) + kExpected), false, false, ""},
- equalsTestCase{uintptr((1 << 64) + kExpected), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralComplex64() {
- const kTwoTo20 = 1 << 20
- const kExpected = -kTwoTo20 - 0.25
-
- matcher := Equals(complex64(kExpected))
- ExpectEq("(-1.0485762e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(-kTwoTo20), false, false, ""},
- equalsTestCase{int(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int32(-kTwoTo20), false, false, ""},
- equalsTestCase{int32(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int64(-kTwoTo20), false, false, ""},
- equalsTestCase{int64(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeComplex64() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(complex64(kExpected))
- ExpectEq("(-3.689349e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroComplex64() {
- matcher := Equals(complex64(0))
- ExpectEq("(0+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{float64(1), false, false, ""},
- equalsTestCase{float64(-1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralComplex64() {
- const kExpected = 1 << 20
- matcher := Equals(complex64(kExpected))
- ExpectEq("(1.048576e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{1048576.0, true, false, ""},
- equalsTestCase{1048576.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralComplex64() {
- const kTwoTo20 = 1 << 20
- const kExpected = kTwoTo20 + 0.25
- matcher := Equals(complex64(kExpected))
- ExpectEq("(1.0485762e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kTwoTo20), false, false, ""},
- equalsTestCase{int64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{uint64(kTwoTo20), false, false, ""},
- equalsTestCase{uint64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected - 1i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected - 1i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveComplex64() {
- const kExpected = 1 << 65
- matcher := Equals(complex64(kExpected))
- ExpectEq("(3.689349e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex64AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := Equals(complex64(kTwoTo25 + 1))
- ExpectEq("(3.3554432e+07+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Single-precision floating point.
- equalsTestCase{float32(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float32(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex64(kTwoTo25 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo25 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo25 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo25 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex64WithNonZeroImaginaryPart() {
- const kRealPart = 17
- const kImagPart = 0.25i
- const kExpected = kRealPart + kImagPart
- matcher := Equals(complex64(kExpected))
- ExpectEq("(17+0.25i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kRealPart + kImagPart, true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kRealPart), false, false, ""},
- equalsTestCase{int8(kRealPart), false, false, ""},
- equalsTestCase{int16(kRealPart), false, false, ""},
- equalsTestCase{int32(kRealPart), false, false, ""},
- equalsTestCase{int64(kRealPart), false, false, ""},
- equalsTestCase{uint(kRealPart), false, false, ""},
- equalsTestCase{uint8(kRealPart), false, false, ""},
- equalsTestCase{uint16(kRealPart), false, false, ""},
- equalsTestCase{uint32(kRealPart), false, false, ""},
- equalsTestCase{uint64(kRealPart), false, false, ""},
- equalsTestCase{float32(kRealPart), false, false, ""},
- equalsTestCase{float64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5i), false, false, ""},
- equalsTestCase{complex128(kRealPart), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// complex128
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NegativeIntegralComplex128() {
- const kExpected = -32769
- matcher := Equals(complex128(kExpected))
- ExpectEq("(-32769+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{-32769.0, true, false, ""},
- equalsTestCase{-32769.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Values that would be kExpected in two's complement.
- equalsTestCase{uint32((1 << 32) + kExpected), false, false, ""},
- equalsTestCase{uint64((1 << 64) + kExpected), false, false, ""},
- equalsTestCase{uintptr((1 << 64) + kExpected), false, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NegativeNonIntegralComplex128() {
- const kTwoTo20 = 1 << 20
- const kExpected = -kTwoTo20 - 0.25
-
- matcher := Equals(complex128(kExpected))
- ExpectEq("(-1.04857625e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(-kTwoTo20), false, false, ""},
- equalsTestCase{int(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int32(-kTwoTo20), false, false, ""},
- equalsTestCase{int32(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{int64(-kTwoTo20), false, false, ""},
- equalsTestCase{int64(-kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected - 0.75), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargeNegativeComplex128() {
- const kExpected = -1 * (1 << 65)
- matcher := Equals(complex128(kExpected))
- ExpectEq("(-3.6893488147419103e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := int64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex64(kExpected + 2i), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ZeroComplex128() {
- matcher := Equals(complex128(0))
- ExpectEq("(0+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of zero.
- equalsTestCase{0.0, true, false, ""},
- equalsTestCase{0 + 0i, true, false, ""},
- equalsTestCase{int(0), true, false, ""},
- equalsTestCase{int8(0), true, false, ""},
- equalsTestCase{int16(0), true, false, ""},
- equalsTestCase{int32(0), true, false, ""},
- equalsTestCase{int64(0), true, false, ""},
- equalsTestCase{uint(0), true, false, ""},
- equalsTestCase{uint8(0), true, false, ""},
- equalsTestCase{uint16(0), true, false, ""},
- equalsTestCase{uint32(0), true, false, ""},
- equalsTestCase{uint64(0), true, false, ""},
- equalsTestCase{uintptr(0), true, false, ""},
- equalsTestCase{float32(0), true, false, ""},
- equalsTestCase{float64(0), true, false, ""},
- equalsTestCase{complex64(0), true, false, ""},
- equalsTestCase{complex128(0), true, false, ""},
- equalsTestCase{interface{}(float32(0)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(1), false, false, ""},
- equalsTestCase{int64(-1), false, false, ""},
- equalsTestCase{float32(1), false, false, ""},
- equalsTestCase{float32(-1), false, false, ""},
- equalsTestCase{float64(1), false, false, ""},
- equalsTestCase{float64(-1), false, false, ""},
- equalsTestCase{complex64(0 + 2i), false, false, ""},
- equalsTestCase{complex128(0 + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveIntegralComplex128() {
- const kExpected = 1 << 20
- matcher := Equals(complex128(kExpected))
- ExpectEq("(1.048576e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of 32769.
- equalsTestCase{1048576.0, true, false, ""},
- equalsTestCase{1048576.0 + 0i, true, false, ""},
- equalsTestCase{int(kExpected), true, false, ""},
- equalsTestCase{int32(kExpected), true, false, ""},
- equalsTestCase{int64(kExpected), true, false, ""},
- equalsTestCase{uint(kExpected), true, false, ""},
- equalsTestCase{uint32(kExpected), true, false, ""},
- equalsTestCase{uint64(kExpected), true, false, ""},
- equalsTestCase{uintptr(kExpected), true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
- equalsTestCase{interface{}(float64(kExpected)), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kExpected + 1), false, false, ""},
- equalsTestCase{int32(kExpected + 1), false, false, ""},
- equalsTestCase{int64(kExpected + 1), false, false, ""},
- equalsTestCase{uint(kExpected + 1), false, false, ""},
- equalsTestCase{uint32(kExpected + 1), false, false, ""},
- equalsTestCase{uint64(kExpected + 1), false, false, ""},
- equalsTestCase{uintptr(kExpected + 1), false, false, ""},
- equalsTestCase{float32(kExpected - (1 << 30)), false, false, ""},
- equalsTestCase{float32(kExpected + (1 << 30)), false, false, ""},
- equalsTestCase{float64(kExpected - 0.5), false, false, ""},
- equalsTestCase{float64(kExpected + 0.5), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
-
- // Non-numeric types.
- equalsTestCase{true, false, true, "which is not numeric"},
- equalsTestCase{[...]int{}, false, true, "which is not numeric"},
- equalsTestCase{make(chan int), false, true, "which is not numeric"},
- equalsTestCase{func() {}, false, true, "which is not numeric"},
- equalsTestCase{map[int]int{}, false, true, "which is not numeric"},
- equalsTestCase{&someInt, false, true, "which is not numeric"},
- equalsTestCase{[]int{}, false, true, "which is not numeric"},
- equalsTestCase{"taco", false, true, "which is not numeric"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not numeric"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) PositiveNonIntegralComplex128() {
- const kTwoTo20 = 1 << 20
- const kExpected = kTwoTo20 + 0.25
- matcher := Equals(complex128(kExpected))
- ExpectEq("(1.04857625e+06+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int64(kTwoTo20), false, false, ""},
- equalsTestCase{int64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{uint64(kTwoTo20), false, false, ""},
- equalsTestCase{uint64(kTwoTo20 - 1), false, false, ""},
- equalsTestCase{float32(kExpected - 1), false, false, ""},
- equalsTestCase{float32(kExpected + 1), false, false, ""},
- equalsTestCase{float64(kExpected - 0.25), false, false, ""},
- equalsTestCase{float64(kExpected + 0.25), false, false, ""},
- equalsTestCase{complex64(kExpected - 1), false, false, ""},
- equalsTestCase{complex64(kExpected - 1i), false, false, ""},
- equalsTestCase{complex128(kExpected - 1), false, false, ""},
- equalsTestCase{complex128(kExpected - 1i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) LargePositiveComplex128() {
- const kExpected = 1 << 65
- matcher := Equals(complex128(kExpected))
- ExpectEq("(3.6893488147419103e+19+0i)", matcher.Description())
-
- floatExpected := float64(kExpected)
- castedInt := uint64(floatExpected)
-
- cases := []equalsTestCase{
- // Equal values of numeric type.
- equalsTestCase{kExpected + 0i, true, false, ""},
- equalsTestCase{float32(kExpected), true, false, ""},
- equalsTestCase{float64(kExpected), true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{castedInt, false, false, ""},
- equalsTestCase{int64(0), false, false, ""},
- equalsTestCase{int64(math.MinInt64), false, false, ""},
- equalsTestCase{int64(math.MaxInt64), false, false, ""},
- equalsTestCase{uint64(0), false, false, ""},
- equalsTestCase{uint64(math.MaxUint64), false, false, ""},
- equalsTestCase{float32(kExpected / 2), false, false, ""},
- equalsTestCase{float64(kExpected / 2), false, false, ""},
- equalsTestCase{complex128(kExpected + 2i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex128AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := Equals(complex128(kTwoTo54 + 1))
- ExpectEq("(1.8014398509481984e+16+0i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Integers.
- equalsTestCase{int64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{int64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Double-precision floating point.
- equalsTestCase{float64(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{float64(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{float64(kTwoTo54 + 3), false, false, ""},
-
- equalsTestCase{complex128(kTwoTo54 - 2), false, false, ""},
- equalsTestCase{complex128(kTwoTo54 - 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 0), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 1), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 2), true, false, ""},
- equalsTestCase{complex128(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) Complex128WithNonZeroImaginaryPart() {
- const kRealPart = 17
- const kImagPart = 0.25i
- const kExpected = kRealPart + kImagPart
- matcher := Equals(complex128(kExpected))
- ExpectEq("(17+0.25i)", matcher.Description())
-
- cases := []equalsTestCase{
- // Various types of the expected value.
- equalsTestCase{kExpected, true, false, ""},
- equalsTestCase{kRealPart + kImagPart, true, false, ""},
- equalsTestCase{complex64(kExpected), true, false, ""},
- equalsTestCase{complex128(kExpected), true, false, ""},
-
- // Non-equal values of numeric type.
- equalsTestCase{int(kRealPart), false, false, ""},
- equalsTestCase{int8(kRealPart), false, false, ""},
- equalsTestCase{int16(kRealPart), false, false, ""},
- equalsTestCase{int32(kRealPart), false, false, ""},
- equalsTestCase{int64(kRealPart), false, false, ""},
- equalsTestCase{uint(kRealPart), false, false, ""},
- equalsTestCase{uint8(kRealPart), false, false, ""},
- equalsTestCase{uint16(kRealPart), false, false, ""},
- equalsTestCase{uint32(kRealPart), false, false, ""},
- equalsTestCase{uint64(kRealPart), false, false, ""},
- equalsTestCase{float32(kRealPart), false, false, ""},
- equalsTestCase{float64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex64(kRealPart + kImagPart + 0.5i), false, false, ""},
- equalsTestCase{complex128(kRealPart), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5), false, false, ""},
- equalsTestCase{complex128(kRealPart + kImagPart + 0.5i), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Arrays
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) ArrayOfComparableType() {
- expected := [3]uint{17, 19, 23}
-
- matcher := Equals(expected)
- ExpectEq("[17 19 23]", matcher.Description())
-
- // To defeat constant de-duping by the compiler.
- makeArray := func(i, j, k uint) [3]uint { return [3]uint{i, j, k} }
-
- type arrayAlias [3]uint
- type uintAlias uint
-
- cases := []equalsTestCase{
- // Correct types, equal.
- equalsTestCase{expected, true, false, ""},
- equalsTestCase{[3]uint{17, 19, 23}, true, false, ""},
- equalsTestCase{makeArray(17, 19, 23), true, false, ""},
-
- // Correct types, not equal.
- equalsTestCase{[3]uint{0, 0, 0}, false, false, ""},
- equalsTestCase{[3]uint{18, 19, 23}, false, false, ""},
- equalsTestCase{[3]uint{17, 20, 23}, false, false, ""},
- equalsTestCase{[3]uint{17, 19, 22}, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not [3]uint"},
- equalsTestCase{bool(false), false, true, "which is not [3]uint"},
- equalsTestCase{int(0), false, true, "which is not [3]uint"},
- equalsTestCase{int8(0), false, true, "which is not [3]uint"},
- equalsTestCase{int16(0), false, true, "which is not [3]uint"},
- equalsTestCase{int32(0), false, true, "which is not [3]uint"},
- equalsTestCase{int64(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint8(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint16(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint32(0), false, true, "which is not [3]uint"},
- equalsTestCase{uint64(0), false, true, "which is not [3]uint"},
- equalsTestCase{true, false, true, "which is not [3]uint"},
- equalsTestCase{[...]int{}, false, true, "which is not [3]uint"},
- equalsTestCase{func() {}, false, true, "which is not [3]uint"},
- equalsTestCase{map[int]int{}, false, true, "which is not [3]uint"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not [3]uint"},
- equalsTestCase{[2]uint{17, 19}, false, true, "which is not [3]uint"},
- equalsTestCase{[4]uint{17, 19, 23, 0}, false, true, "which is not [3]uint"},
- equalsTestCase{arrayAlias{17, 19, 23}, false, true, "which is not [3]uint"},
- equalsTestCase{[3]uintAlias{17, 19, 23}, false, true, "which is not [3]uint"},
- equalsTestCase{[3]int32{17, 19, 23}, false, true, "which is not [3]uint"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ArrayOfNonComparableType() {
- type nonComparableArray [2]map[string]string
- f := func() {
- ExpectEq(nonComparableArray{}, nonComparableArray{})
- }
-
- ExpectThat(f, Panics(MatchesRegexp("uncomparable.*nonComparableArray")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// chan
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilChan() {
- var nilChan1 chan int
- var nilChan2 chan int
- var nilChan3 chan uint
- var nonNilChan1 chan int = make(chan int)
- var nonNilChan2 chan uint = make(chan uint)
-
- matcher := Equals(nilChan1)
- ExpectEq("<nil>", matcher.Description())
-
- cases := []equalsTestCase{
- // int channels
- equalsTestCase{nilChan1, true, false, ""},
- equalsTestCase{nilChan2, true, false, ""},
- equalsTestCase{nonNilChan1, false, false, ""},
-
- // uint channels
- equalsTestCase{nilChan3, false, true, "which is not a chan int"},
- equalsTestCase{nonNilChan2, false, true, "which is not a chan int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a chan int"},
- equalsTestCase{bool(false), false, true, "which is not a chan int"},
- equalsTestCase{int(0), false, true, "which is not a chan int"},
- equalsTestCase{int8(0), false, true, "which is not a chan int"},
- equalsTestCase{int16(0), false, true, "which is not a chan int"},
- equalsTestCase{int32(0), false, true, "which is not a chan int"},
- equalsTestCase{int64(0), false, true, "which is not a chan int"},
- equalsTestCase{uint(0), false, true, "which is not a chan int"},
- equalsTestCase{uint8(0), false, true, "which is not a chan int"},
- equalsTestCase{uint16(0), false, true, "which is not a chan int"},
- equalsTestCase{uint32(0), false, true, "which is not a chan int"},
- equalsTestCase{uint64(0), false, true, "which is not a chan int"},
- equalsTestCase{true, false, true, "which is not a chan int"},
- equalsTestCase{[...]int{}, false, true, "which is not a chan int"},
- equalsTestCase{func() {}, false, true, "which is not a chan int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a chan int"},
- equalsTestCase{&someInt, false, true, "which is not a chan int"},
- equalsTestCase{[]int{}, false, true, "which is not a chan int"},
- equalsTestCase{"taco", false, true, "which is not a chan int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a chan int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilChan() {
- var nilChan1 chan int
- var nilChan2 chan uint
- var nonNilChan1 chan int = make(chan int)
- var nonNilChan2 chan int = make(chan int)
- var nonNilChan3 chan uint = make(chan uint)
-
- matcher := Equals(nonNilChan1)
- ExpectEq(fmt.Sprintf("%v", nonNilChan1), matcher.Description())
-
- cases := []equalsTestCase{
- // int channels
- equalsTestCase{nonNilChan1, true, false, ""},
- equalsTestCase{nonNilChan2, false, false, ""},
- equalsTestCase{nilChan1, false, false, ""},
-
- // uint channels
- equalsTestCase{nilChan2, false, true, "which is not a chan int"},
- equalsTestCase{nonNilChan3, false, true, "which is not a chan int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a chan int"},
- equalsTestCase{bool(false), false, true, "which is not a chan int"},
- equalsTestCase{int(0), false, true, "which is not a chan int"},
- equalsTestCase{int8(0), false, true, "which is not a chan int"},
- equalsTestCase{int16(0), false, true, "which is not a chan int"},
- equalsTestCase{int32(0), false, true, "which is not a chan int"},
- equalsTestCase{int64(0), false, true, "which is not a chan int"},
- equalsTestCase{uint(0), false, true, "which is not a chan int"},
- equalsTestCase{uint8(0), false, true, "which is not a chan int"},
- equalsTestCase{uint16(0), false, true, "which is not a chan int"},
- equalsTestCase{uint32(0), false, true, "which is not a chan int"},
- equalsTestCase{uint64(0), false, true, "which is not a chan int"},
- equalsTestCase{true, false, true, "which is not a chan int"},
- equalsTestCase{[...]int{}, false, true, "which is not a chan int"},
- equalsTestCase{func() {}, false, true, "which is not a chan int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a chan int"},
- equalsTestCase{&someInt, false, true, "which is not a chan int"},
- equalsTestCase{[]int{}, false, true, "which is not a chan int"},
- equalsTestCase{"taco", false, true, "which is not a chan int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a chan int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) ChanDirection() {
- var chan1 chan<- int
- var chan2 <-chan int
- var chan3 chan int
-
- matcher := Equals(chan1)
- ExpectEq(fmt.Sprintf("%v", chan1), matcher.Description())
-
- cases := []equalsTestCase{
- equalsTestCase{chan1, true, false, ""},
- equalsTestCase{chan2, false, true, "which is not a chan<- int"},
- equalsTestCase{chan3, false, true, "which is not a chan<- int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// func
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) Functions() {
- func1 := func() {}
- func2 := func() {}
- func3 := func(x int) {}
-
- matcher := Equals(func1)
- ExpectEq(fmt.Sprintf("%v", func1), matcher.Description())
-
- cases := []equalsTestCase{
- // Functions.
- equalsTestCase{func1, true, false, ""},
- equalsTestCase{func2, false, false, ""},
- equalsTestCase{func3, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a function"},
- equalsTestCase{bool(false), false, true, "which is not a function"},
- equalsTestCase{int(0), false, true, "which is not a function"},
- equalsTestCase{int8(0), false, true, "which is not a function"},
- equalsTestCase{int16(0), false, true, "which is not a function"},
- equalsTestCase{int32(0), false, true, "which is not a function"},
- equalsTestCase{int64(0), false, true, "which is not a function"},
- equalsTestCase{uint(0), false, true, "which is not a function"},
- equalsTestCase{uint8(0), false, true, "which is not a function"},
- equalsTestCase{uint16(0), false, true, "which is not a function"},
- equalsTestCase{uint32(0), false, true, "which is not a function"},
- equalsTestCase{uint64(0), false, true, "which is not a function"},
- equalsTestCase{true, false, true, "which is not a function"},
- equalsTestCase{[...]int{}, false, true, "which is not a function"},
- equalsTestCase{map[int]int{}, false, true, "which is not a function"},
- equalsTestCase{&someInt, false, true, "which is not a function"},
- equalsTestCase{[]int{}, false, true, "which is not a function"},
- equalsTestCase{"taco", false, true, "which is not a function"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a function"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// map
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilMap() {
- var nilMap1 map[int]int
- var nilMap2 map[int]int
- var nilMap3 map[int]uint
- var nonNilMap1 map[int]int = make(map[int]int)
- var nonNilMap2 map[int]uint = make(map[int]uint)
-
- matcher := Equals(nilMap1)
- ExpectEq("map[]", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilMap1, true, false, ""},
- equalsTestCase{nilMap2, true, false, ""},
- equalsTestCase{nilMap3, true, false, ""},
- equalsTestCase{nonNilMap1, false, false, ""},
- equalsTestCase{nonNilMap2, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a map"},
- equalsTestCase{bool(false), false, true, "which is not a map"},
- equalsTestCase{int(0), false, true, "which is not a map"},
- equalsTestCase{int8(0), false, true, "which is not a map"},
- equalsTestCase{int16(0), false, true, "which is not a map"},
- equalsTestCase{int32(0), false, true, "which is not a map"},
- equalsTestCase{int64(0), false, true, "which is not a map"},
- equalsTestCase{uint(0), false, true, "which is not a map"},
- equalsTestCase{uint8(0), false, true, "which is not a map"},
- equalsTestCase{uint16(0), false, true, "which is not a map"},
- equalsTestCase{uint32(0), false, true, "which is not a map"},
- equalsTestCase{uint64(0), false, true, "which is not a map"},
- equalsTestCase{true, false, true, "which is not a map"},
- equalsTestCase{[...]int{}, false, true, "which is not a map"},
- equalsTestCase{func() {}, false, true, "which is not a map"},
- equalsTestCase{&someInt, false, true, "which is not a map"},
- equalsTestCase{[]int{}, false, true, "which is not a map"},
- equalsTestCase{"taco", false, true, "which is not a map"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a map"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilMap() {
- var nilMap1 map[int]int
- var nilMap2 map[int]uint
- var nonNilMap1 map[int]int = make(map[int]int)
- var nonNilMap2 map[int]int = make(map[int]int)
- var nonNilMap3 map[int]uint = make(map[int]uint)
-
- matcher := Equals(nonNilMap1)
- ExpectEq("map[]", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nonNilMap1, true, false, ""},
- equalsTestCase{nonNilMap2, false, false, ""},
- equalsTestCase{nonNilMap3, false, false, ""},
- equalsTestCase{nilMap1, false, false, ""},
- equalsTestCase{nilMap2, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a map"},
- equalsTestCase{bool(false), false, true, "which is not a map"},
- equalsTestCase{int(0), false, true, "which is not a map"},
- equalsTestCase{int8(0), false, true, "which is not a map"},
- equalsTestCase{int16(0), false, true, "which is not a map"},
- equalsTestCase{int32(0), false, true, "which is not a map"},
- equalsTestCase{int64(0), false, true, "which is not a map"},
- equalsTestCase{uint(0), false, true, "which is not a map"},
- equalsTestCase{uint8(0), false, true, "which is not a map"},
- equalsTestCase{uint16(0), false, true, "which is not a map"},
- equalsTestCase{uint32(0), false, true, "which is not a map"},
- equalsTestCase{uint64(0), false, true, "which is not a map"},
- equalsTestCase{true, false, true, "which is not a map"},
- equalsTestCase{[...]int{}, false, true, "which is not a map"},
- equalsTestCase{func() {}, false, true, "which is not a map"},
- equalsTestCase{&someInt, false, true, "which is not a map"},
- equalsTestCase{[]int{}, false, true, "which is not a map"},
- equalsTestCase{"taco", false, true, "which is not a map"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a map"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Pointers
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilPointer() {
- var someInt int = 17
- var someUint uint = 17
-
- var nilInt1 *int
- var nilInt2 *int
- var nilUint *uint
- var nonNilInt *int = &someInt
- var nonNilUint *uint = &someUint
-
- matcher := Equals(nilInt1)
- ExpectEq("<nil>", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilInt1, true, false, ""},
- equalsTestCase{nilInt2, true, false, ""},
- equalsTestCase{nonNilInt, false, false, ""},
-
- // Incorrect type.
- equalsTestCase{nilUint, false, true, "which is not a *int"},
- equalsTestCase{nonNilUint, false, true, "which is not a *int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a *int"},
- equalsTestCase{bool(false), false, true, "which is not a *int"},
- equalsTestCase{int(0), false, true, "which is not a *int"},
- equalsTestCase{int8(0), false, true, "which is not a *int"},
- equalsTestCase{int16(0), false, true, "which is not a *int"},
- equalsTestCase{int32(0), false, true, "which is not a *int"},
- equalsTestCase{int64(0), false, true, "which is not a *int"},
- equalsTestCase{uint(0), false, true, "which is not a *int"},
- equalsTestCase{uint8(0), false, true, "which is not a *int"},
- equalsTestCase{uint16(0), false, true, "which is not a *int"},
- equalsTestCase{uint32(0), false, true, "which is not a *int"},
- equalsTestCase{uint64(0), false, true, "which is not a *int"},
- equalsTestCase{true, false, true, "which is not a *int"},
- equalsTestCase{[...]int{}, false, true, "which is not a *int"},
- equalsTestCase{func() {}, false, true, "which is not a *int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a *int"},
- equalsTestCase{[]int{}, false, true, "which is not a *int"},
- equalsTestCase{"taco", false, true, "which is not a *int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a *int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilPointer() {
- var someInt int = 17
- var someOtherInt int = 17
- var someUint uint = 17
-
- var nilInt *int
- var nilUint *uint
- var nonNilInt1 *int = &someInt
- var nonNilInt2 *int = &someOtherInt
- var nonNilUint *uint = &someUint
-
- matcher := Equals(nonNilInt1)
- ExpectEq(fmt.Sprintf("%v", nonNilInt1), matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nonNilInt1, true, false, ""},
- equalsTestCase{nonNilInt2, false, false, ""},
- equalsTestCase{nilInt, false, false, ""},
-
- // Incorrect type.
- equalsTestCase{nilUint, false, true, "which is not a *int"},
- equalsTestCase{nonNilUint, false, true, "which is not a *int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a *int"},
- equalsTestCase{bool(false), false, true, "which is not a *int"},
- equalsTestCase{int(0), false, true, "which is not a *int"},
- equalsTestCase{int8(0), false, true, "which is not a *int"},
- equalsTestCase{int16(0), false, true, "which is not a *int"},
- equalsTestCase{int32(0), false, true, "which is not a *int"},
- equalsTestCase{int64(0), false, true, "which is not a *int"},
- equalsTestCase{uint(0), false, true, "which is not a *int"},
- equalsTestCase{uint8(0), false, true, "which is not a *int"},
- equalsTestCase{uint16(0), false, true, "which is not a *int"},
- equalsTestCase{uint32(0), false, true, "which is not a *int"},
- equalsTestCase{uint64(0), false, true, "which is not a *int"},
- equalsTestCase{true, false, true, "which is not a *int"},
- equalsTestCase{[...]int{}, false, true, "which is not a *int"},
- equalsTestCase{func() {}, false, true, "which is not a *int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a *int"},
- equalsTestCase{[]int{}, false, true, "which is not a *int"},
- equalsTestCase{"taco", false, true, "which is not a *int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a *int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Slices
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilSlice() {
- var nilInt1 []int
- var nilInt2 []int
- var nilUint []uint
-
- var nonNilInt []int = make([]int, 0)
- var nonNilUint []uint = make([]uint, 0)
-
- matcher := Equals(nilInt1)
- ExpectEq("[]", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilInt1, true, false, ""},
- equalsTestCase{nilInt2, true, false, ""},
- equalsTestCase{nonNilInt, false, false, ""},
-
- // Incorrect type.
- equalsTestCase{nilUint, false, true, "which is not a []int"},
- equalsTestCase{nonNilUint, false, true, "which is not a []int"},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a []int"},
- equalsTestCase{bool(false), false, true, "which is not a []int"},
- equalsTestCase{int(0), false, true, "which is not a []int"},
- equalsTestCase{int8(0), false, true, "which is not a []int"},
- equalsTestCase{int16(0), false, true, "which is not a []int"},
- equalsTestCase{int32(0), false, true, "which is not a []int"},
- equalsTestCase{int64(0), false, true, "which is not a []int"},
- equalsTestCase{uint(0), false, true, "which is not a []int"},
- equalsTestCase{uint8(0), false, true, "which is not a []int"},
- equalsTestCase{uint16(0), false, true, "which is not a []int"},
- equalsTestCase{uint32(0), false, true, "which is not a []int"},
- equalsTestCase{uint64(0), false, true, "which is not a []int"},
- equalsTestCase{true, false, true, "which is not a []int"},
- equalsTestCase{[...]int{}, false, true, "which is not a []int"},
- equalsTestCase{func() {}, false, true, "which is not a []int"},
- equalsTestCase{map[int]int{}, false, true, "which is not a []int"},
- equalsTestCase{"taco", false, true, "which is not a []int"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a []int"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilSlice() {
- nonNil := make([]int, 0)
- f := func() { Equals(nonNil) }
- ExpectThat(f, Panics(HasSubstr("non-nil slice")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// string
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) String() {
- partial := "taco"
- expected := fmt.Sprintf("%s%d", partial, 1)
-
- matcher := Equals(expected)
- ExpectEq("taco1", matcher.Description())
-
- type stringAlias string
-
- cases := []equalsTestCase{
- // Correct types.
- equalsTestCase{"taco1", true, false, ""},
- equalsTestCase{"taco" + "1", true, false, ""},
- equalsTestCase{expected, true, false, ""},
- equalsTestCase{stringAlias("taco1"), true, false, ""},
-
- equalsTestCase{"", false, false, ""},
- equalsTestCase{"taco", false, false, ""},
- equalsTestCase{"taco1\x00", false, false, ""},
- equalsTestCase{"taco2", false, false, ""},
- equalsTestCase{stringAlias("taco2"), false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a string"},
- equalsTestCase{bool(false), false, true, "which is not a string"},
- equalsTestCase{int(0), false, true, "which is not a string"},
- equalsTestCase{int8(0), false, true, "which is not a string"},
- equalsTestCase{int16(0), false, true, "which is not a string"},
- equalsTestCase{int32(0), false, true, "which is not a string"},
- equalsTestCase{int64(0), false, true, "which is not a string"},
- equalsTestCase{uint(0), false, true, "which is not a string"},
- equalsTestCase{uint8(0), false, true, "which is not a string"},
- equalsTestCase{uint16(0), false, true, "which is not a string"},
- equalsTestCase{uint32(0), false, true, "which is not a string"},
- equalsTestCase{uint64(0), false, true, "which is not a string"},
- equalsTestCase{true, false, true, "which is not a string"},
- equalsTestCase{[...]int{}, false, true, "which is not a string"},
- equalsTestCase{func() {}, false, true, "which is not a string"},
- equalsTestCase{map[int]int{}, false, true, "which is not a string"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a string"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) StringAlias() {
- type stringAlias string
-
- matcher := Equals(stringAlias("taco"))
- ExpectEq("taco", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct types.
- equalsTestCase{stringAlias("taco"), true, false, ""},
- equalsTestCase{"taco", true, false, ""},
-
- equalsTestCase{"burrito", false, false, ""},
- equalsTestCase{stringAlias("burrito"), false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a string"},
- equalsTestCase{bool(false), false, true, "which is not a string"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// struct
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) Struct() {
- type someStruct struct{ foo uint }
- f := func() { Equals(someStruct{17}) }
- ExpectThat(f, Panics(HasSubstr("unsupported kind struct")))
-}
-
-////////////////////////////////////////////////////////////////////////
-// unsafe.Pointer
-////////////////////////////////////////////////////////////////////////
-
-func (t *EqualsTest) NilUnsafePointer() {
- someInt := int(17)
-
- var nilPtr1 unsafe.Pointer
- var nilPtr2 unsafe.Pointer
- var nonNilPtr unsafe.Pointer = unsafe.Pointer(&someInt)
-
- matcher := Equals(nilPtr1)
- ExpectEq("<nil>", matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nilPtr1, true, false, ""},
- equalsTestCase{nilPtr2, true, false, ""},
- equalsTestCase{nonNilPtr, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{bool(false), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{true, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[...]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{make(chan int), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{func() {}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{map[int]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{&someInt, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{"taco", false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a unsafe.Pointer"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *EqualsTest) NonNilUnsafePointer() {
- someInt := int(17)
- someOtherInt := int(17)
-
- var nilPtr unsafe.Pointer
- var nonNilPtr1 unsafe.Pointer = unsafe.Pointer(&someInt)
- var nonNilPtr2 unsafe.Pointer = unsafe.Pointer(&someOtherInt)
-
- matcher := Equals(nonNilPtr1)
- ExpectEq(fmt.Sprintf("%v", nonNilPtr1), matcher.Description())
-
- cases := []equalsTestCase{
- // Correct type.
- equalsTestCase{nonNilPtr1, true, false, ""},
- equalsTestCase{nonNilPtr2, false, false, ""},
- equalsTestCase{nilPtr, false, false, ""},
-
- // Other types.
- equalsTestCase{0, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{bool(false), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{int64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint8(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint16(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint32(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{uint64(0), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{true, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[...]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{make(chan int), false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{func() {}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{map[int]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{&someInt, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{[]int{}, false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{"taco", false, true, "which is not a unsafe.Pointer"},
- equalsTestCase{equalsTestCase{}, false, true, "which is not a unsafe.Pointer"},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/error_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/error_test.go
deleted file mode 100644
index f92167cad1d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/error_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type ErrorTest struct {
- matcherCalled bool
- suppliedCandidate interface{}
- wrappedError error
-
- matcher Matcher
-}
-
-func init() { RegisterTestSuite(&ErrorTest{}) }
-
-func (t *ErrorTest) SetUp(i *TestInfo) {
- wrapped := &fakeMatcher{
- func(c interface{}) error {
- t.matcherCalled = true
- t.suppliedCandidate = c
- return t.wrappedError
- },
- "is foo",
- }
-
- t.matcher = Error(wrapped)
-}
-
-func isFatal(err error) bool {
- _, isFatal := err.(*FatalError)
- return isFatal
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *ErrorTest) Description() {
- ExpectThat(t.matcher.Description(), Equals("error is foo"))
-}
-
-func (t *ErrorTest) CandidateIsNil() {
- err := t.matcher.Matches(nil)
-
- ExpectThat(t.matcherCalled, Equals(false))
- ExpectThat(err.Error(), Equals("which is not an error"))
- ExpectTrue(isFatal(err))
-}
-
-func (t *ErrorTest) CandidateIsString() {
- err := t.matcher.Matches("taco")
-
- ExpectThat(t.matcherCalled, Equals(false))
- ExpectThat(err.Error(), Equals("which is not an error"))
- ExpectTrue(isFatal(err))
-}
-
-func (t *ErrorTest) CallsWrappedMatcher() {
- candidate := errors.New("taco")
- t.matcher.Matches(candidate)
-
- ExpectThat(t.matcherCalled, Equals(true))
- ExpectThat(t.suppliedCandidate, Equals("taco"))
-}
-
-func (t *ErrorTest) ReturnsWrappedMatcherResult() {
- t.wrappedError = errors.New("burrito")
- err := t.matcher.Matches(errors.New(""))
- ExpectThat(err, Equals(t.wrappedError))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal_test.go
deleted file mode 100644
index f5e29d1ce59..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_or_equal_test.go
+++ /dev/null
@@ -1,1101 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "math"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type GreaterOrEqualTest struct {
-}
-
-func init() { RegisterTestSuite(&GreaterOrEqualTest{}) }
-
-type geTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *GreaterOrEqualTest) checkTestCases(matcher Matcher, cases []geTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) IntegerCandidateBadTypes() {
- matcher := GreaterOrEqual(int(-150))
-
- cases := []geTestCase{
- geTestCase{true, false, true, "which is not comparable"},
- geTestCase{complex64(-151), false, true, "which is not comparable"},
- geTestCase{complex128(-151), false, true, "which is not comparable"},
- geTestCase{[...]int{-151}, false, true, "which is not comparable"},
- geTestCase{make(chan int), false, true, "which is not comparable"},
- geTestCase{func() {}, false, true, "which is not comparable"},
- geTestCase{map[int]int{}, false, true, "which is not comparable"},
- geTestCase{&geTestCase{}, false, true, "which is not comparable"},
- geTestCase{make([]int, 0), false, true, "which is not comparable"},
- geTestCase{"-151", false, true, "which is not comparable"},
- geTestCase{geTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) FloatCandidateBadTypes() {
- matcher := GreaterOrEqual(float32(-150))
-
- cases := []geTestCase{
- geTestCase{true, false, true, "which is not comparable"},
- geTestCase{complex64(-151), false, true, "which is not comparable"},
- geTestCase{complex128(-151), false, true, "which is not comparable"},
- geTestCase{[...]int{-151}, false, true, "which is not comparable"},
- geTestCase{make(chan int), false, true, "which is not comparable"},
- geTestCase{func() {}, false, true, "which is not comparable"},
- geTestCase{map[int]int{}, false, true, "which is not comparable"},
- geTestCase{&geTestCase{}, false, true, "which is not comparable"},
- geTestCase{make([]int, 0), false, true, "which is not comparable"},
- geTestCase{"-151", false, true, "which is not comparable"},
- geTestCase{geTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) StringCandidateBadTypes() {
- matcher := GreaterOrEqual("17")
-
- cases := []geTestCase{
- geTestCase{true, false, true, "which is not comparable"},
- geTestCase{int(0), false, true, "which is not comparable"},
- geTestCase{int8(0), false, true, "which is not comparable"},
- geTestCase{int16(0), false, true, "which is not comparable"},
- geTestCase{int32(0), false, true, "which is not comparable"},
- geTestCase{int64(0), false, true, "which is not comparable"},
- geTestCase{uint(0), false, true, "which is not comparable"},
- geTestCase{uint8(0), false, true, "which is not comparable"},
- geTestCase{uint16(0), false, true, "which is not comparable"},
- geTestCase{uint32(0), false, true, "which is not comparable"},
- geTestCase{uint64(0), false, true, "which is not comparable"},
- geTestCase{float32(0), false, true, "which is not comparable"},
- geTestCase{float64(0), false, true, "which is not comparable"},
- geTestCase{complex64(-151), false, true, "which is not comparable"},
- geTestCase{complex128(-151), false, true, "which is not comparable"},
- geTestCase{[...]int{-151}, false, true, "which is not comparable"},
- geTestCase{make(chan int), false, true, "which is not comparable"},
- geTestCase{func() {}, false, true, "which is not comparable"},
- geTestCase{map[int]int{}, false, true, "which is not comparable"},
- geTestCase{&geTestCase{}, false, true, "which is not comparable"},
- geTestCase{make([]int, 0), false, true, "which is not comparable"},
- geTestCase{geTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- GreaterOrEqual(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) NegativeIntegerLiteral() {
- matcher := GreaterOrEqual(-150)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-(1 << 30), false, false, ""},
- geTestCase{-151, false, false, ""},
- geTestCase{-150, true, false, ""},
- geTestCase{0, true, false, ""},
- geTestCase{17, true, false, ""},
-
- geTestCase{int(-(1 << 30)), false, false, ""},
- geTestCase{int(-151), false, false, ""},
- geTestCase{int(-150), true, false, ""},
- geTestCase{int(0), true, false, ""},
- geTestCase{int(17), true, false, ""},
-
- geTestCase{int8(-127), true, false, ""},
- geTestCase{int8(0), true, false, ""},
- geTestCase{int8(17), true, false, ""},
-
- geTestCase{int16(-(1 << 14)), false, false, ""},
- geTestCase{int16(-151), false, false, ""},
- geTestCase{int16(-150), true, false, ""},
- geTestCase{int16(0), true, false, ""},
- geTestCase{int16(17), true, false, ""},
-
- geTestCase{int32(-(1 << 30)), false, false, ""},
- geTestCase{int32(-151), false, false, ""},
- geTestCase{int32(-150), true, false, ""},
- geTestCase{int32(0), true, false, ""},
- geTestCase{int32(17), true, false, ""},
-
- geTestCase{int64(-(1 << 30)), false, false, ""},
- geTestCase{int64(-151), false, false, ""},
- geTestCase{int64(-150), true, false, ""},
- geTestCase{int64(0), true, false, ""},
- geTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint((1 << 32) - 151), true, false, ""},
- geTestCase{uint(0), true, false, ""},
- geTestCase{uint(17), true, false, ""},
-
- geTestCase{uint8(0), true, false, ""},
- geTestCase{uint8(17), true, false, ""},
- geTestCase{uint8(253), true, false, ""},
-
- geTestCase{uint16((1 << 16) - 151), true, false, ""},
- geTestCase{uint16(0), true, false, ""},
- geTestCase{uint16(17), true, false, ""},
-
- geTestCase{uint32((1 << 32) - 151), true, false, ""},
- geTestCase{uint32(0), true, false, ""},
- geTestCase{uint32(17), true, false, ""},
-
- geTestCase{uint64((1 << 64) - 151), true, false, ""},
- geTestCase{uint64(0), true, false, ""},
- geTestCase{uint64(17), true, false, ""},
-
- geTestCase{uintptr((1 << 64) - 151), true, false, ""},
- geTestCase{uintptr(0), true, false, ""},
- geTestCase{uintptr(17), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-(1 << 30)), false, false, ""},
- geTestCase{float32(-151), false, false, ""},
- geTestCase{float32(-150.1), false, false, ""},
- geTestCase{float32(-150), true, false, ""},
- geTestCase{float32(-149.9), true, false, ""},
- geTestCase{float32(0), true, false, ""},
- geTestCase{float32(17), true, false, ""},
- geTestCase{float32(160), true, false, ""},
-
- geTestCase{float64(-(1 << 30)), false, false, ""},
- geTestCase{float64(-151), false, false, ""},
- geTestCase{float64(-150.1), false, false, ""},
- geTestCase{float64(-150), true, false, ""},
- geTestCase{float64(-149.9), true, false, ""},
- geTestCase{float64(0), true, false, ""},
- geTestCase{float64(17), true, false, ""},
- geTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) ZeroIntegerLiteral() {
- matcher := GreaterOrEqual(0)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-(1 << 30), false, false, ""},
- geTestCase{-1, false, false, ""},
- geTestCase{0, true, false, ""},
- geTestCase{1, true, false, ""},
- geTestCase{17, true, false, ""},
- geTestCase{(1 << 30), true, false, ""},
-
- geTestCase{int(-(1 << 30)), false, false, ""},
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(0), true, false, ""},
- geTestCase{int(1), true, false, ""},
- geTestCase{int(17), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(0), true, false, ""},
- geTestCase{int8(1), true, false, ""},
-
- geTestCase{int16(-(1 << 14)), false, false, ""},
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), true, false, ""},
- geTestCase{int16(1), true, false, ""},
- geTestCase{int16(17), true, false, ""},
-
- geTestCase{int32(-(1 << 30)), false, false, ""},
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(0), true, false, ""},
- geTestCase{int32(1), true, false, ""},
- geTestCase{int32(17), true, false, ""},
-
- geTestCase{int64(-(1 << 30)), false, false, ""},
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(0), true, false, ""},
- geTestCase{int64(1), true, false, ""},
- geTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint((1 << 32) - 1), true, false, ""},
- geTestCase{uint(0), true, false, ""},
- geTestCase{uint(17), true, false, ""},
-
- geTestCase{uint8(0), true, false, ""},
- geTestCase{uint8(17), true, false, ""},
- geTestCase{uint8(253), true, false, ""},
-
- geTestCase{uint16((1 << 16) - 1), true, false, ""},
- geTestCase{uint16(0), true, false, ""},
- geTestCase{uint16(17), true, false, ""},
-
- geTestCase{uint32((1 << 32) - 1), true, false, ""},
- geTestCase{uint32(0), true, false, ""},
- geTestCase{uint32(17), true, false, ""},
-
- geTestCase{uint64((1 << 64) - 1), true, false, ""},
- geTestCase{uint64(0), true, false, ""},
- geTestCase{uint64(17), true, false, ""},
-
- geTestCase{uintptr((1 << 64) - 1), true, false, ""},
- geTestCase{uintptr(0), true, false, ""},
- geTestCase{uintptr(17), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-(1 << 30)), false, false, ""},
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(-0.1), false, false, ""},
- geTestCase{float32(-0.0), true, false, ""},
- geTestCase{float32(0), true, false, ""},
- geTestCase{float32(0.1), true, false, ""},
- geTestCase{float32(17), true, false, ""},
- geTestCase{float32(160), true, false, ""},
-
- geTestCase{float64(-(1 << 30)), false, false, ""},
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(-0.1), false, false, ""},
- geTestCase{float64(-0), true, false, ""},
- geTestCase{float64(0), true, false, ""},
- geTestCase{float64(17), true, false, ""},
- geTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) PositiveIntegerLiteral() {
- matcher := GreaterOrEqual(150)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{149, false, false, ""},
- geTestCase{150, true, false, ""},
- geTestCase{151, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(149), false, false, ""},
- geTestCase{int(150), true, false, ""},
- geTestCase{int(151), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(0), false, false, ""},
- geTestCase{int8(17), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(149), false, false, ""},
- geTestCase{int16(150), true, false, ""},
- geTestCase{int16(151), true, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(149), false, false, ""},
- geTestCase{int32(150), true, false, ""},
- geTestCase{int32(151), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(149), false, false, ""},
- geTestCase{int64(150), true, false, ""},
- geTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(149), false, false, ""},
- geTestCase{uint(150), true, false, ""},
- geTestCase{uint(151), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(127), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(149), false, false, ""},
- geTestCase{uint16(150), true, false, ""},
- geTestCase{uint16(151), true, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(149), false, false, ""},
- geTestCase{uint32(150), true, false, ""},
- geTestCase{uint32(151), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(149), false, false, ""},
- geTestCase{uint64(150), true, false, ""},
- geTestCase{uint64(151), true, false, ""},
-
- geTestCase{uintptr(0), false, false, ""},
- geTestCase{uintptr(149), false, false, ""},
- geTestCase{uintptr(150), true, false, ""},
- geTestCase{uintptr(151), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(149), false, false, ""},
- geTestCase{float32(149.9), false, false, ""},
- geTestCase{float32(150), true, false, ""},
- geTestCase{float32(150.1), true, false, ""},
- geTestCase{float32(151), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(149), false, false, ""},
- geTestCase{float64(149.9), false, false, ""},
- geTestCase{float64(150), true, false, ""},
- geTestCase{float64(150.1), true, false, ""},
- geTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) NegativeFloatLiteral() {
- matcher := GreaterOrEqual(-150.1)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-(1 << 30), false, false, ""},
- geTestCase{-151, false, false, ""},
- geTestCase{-150, true, false, ""},
- geTestCase{0, true, false, ""},
- geTestCase{17, true, false, ""},
-
- geTestCase{int(-(1 << 30)), false, false, ""},
- geTestCase{int(-151), false, false, ""},
- geTestCase{int(-150), true, false, ""},
- geTestCase{int(0), true, false, ""},
- geTestCase{int(17), true, false, ""},
-
- geTestCase{int8(-127), true, false, ""},
- geTestCase{int8(0), true, false, ""},
- geTestCase{int8(17), true, false, ""},
-
- geTestCase{int16(-(1 << 14)), false, false, ""},
- geTestCase{int16(-151), false, false, ""},
- geTestCase{int16(-150), true, false, ""},
- geTestCase{int16(0), true, false, ""},
- geTestCase{int16(17), true, false, ""},
-
- geTestCase{int32(-(1 << 30)), false, false, ""},
- geTestCase{int32(-151), false, false, ""},
- geTestCase{int32(-150), true, false, ""},
- geTestCase{int32(0), true, false, ""},
- geTestCase{int32(17), true, false, ""},
-
- geTestCase{int64(-(1 << 30)), false, false, ""},
- geTestCase{int64(-151), false, false, ""},
- geTestCase{int64(-150), true, false, ""},
- geTestCase{int64(0), true, false, ""},
- geTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint((1 << 32) - 151), true, false, ""},
- geTestCase{uint(0), true, false, ""},
- geTestCase{uint(17), true, false, ""},
-
- geTestCase{uint8(0), true, false, ""},
- geTestCase{uint8(17), true, false, ""},
- geTestCase{uint8(253), true, false, ""},
-
- geTestCase{uint16((1 << 16) - 151), true, false, ""},
- geTestCase{uint16(0), true, false, ""},
- geTestCase{uint16(17), true, false, ""},
-
- geTestCase{uint32((1 << 32) - 151), true, false, ""},
- geTestCase{uint32(0), true, false, ""},
- geTestCase{uint32(17), true, false, ""},
-
- geTestCase{uint64((1 << 64) - 151), true, false, ""},
- geTestCase{uint64(0), true, false, ""},
- geTestCase{uint64(17), true, false, ""},
-
- geTestCase{uintptr((1 << 64) - 151), true, false, ""},
- geTestCase{uintptr(0), true, false, ""},
- geTestCase{uintptr(17), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-(1 << 30)), false, false, ""},
- geTestCase{float32(-151), false, false, ""},
- geTestCase{float32(-150.2), false, false, ""},
- geTestCase{float32(-150.1), true, false, ""},
- geTestCase{float32(-150), true, false, ""},
- geTestCase{float32(0), true, false, ""},
- geTestCase{float32(17), true, false, ""},
- geTestCase{float32(160), true, false, ""},
-
- geTestCase{float64(-(1 << 30)), false, false, ""},
- geTestCase{float64(-151), false, false, ""},
- geTestCase{float64(-150.2), false, false, ""},
- geTestCase{float64(-150.1), true, false, ""},
- geTestCase{float64(-150), true, false, ""},
- geTestCase{float64(0), true, false, ""},
- geTestCase{float64(17), true, false, ""},
- geTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) PositiveFloatLiteral() {
- matcher := GreaterOrEqual(149.9)
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{149, false, false, ""},
- geTestCase{150, true, false, ""},
- geTestCase{151, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(149), false, false, ""},
- geTestCase{int(150), true, false, ""},
- geTestCase{int(151), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(0), false, false, ""},
- geTestCase{int8(17), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(149), false, false, ""},
- geTestCase{int16(150), true, false, ""},
- geTestCase{int16(151), true, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(149), false, false, ""},
- geTestCase{int32(150), true, false, ""},
- geTestCase{int32(151), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(149), false, false, ""},
- geTestCase{int64(150), true, false, ""},
- geTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(149), false, false, ""},
- geTestCase{uint(150), true, false, ""},
- geTestCase{uint(151), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(127), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(149), false, false, ""},
- geTestCase{uint16(150), true, false, ""},
- geTestCase{uint16(151), true, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(149), false, false, ""},
- geTestCase{uint32(150), true, false, ""},
- geTestCase{uint32(151), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(149), false, false, ""},
- geTestCase{uint64(150), true, false, ""},
- geTestCase{uint64(151), true, false, ""},
-
- geTestCase{uintptr(0), false, false, ""},
- geTestCase{uintptr(149), false, false, ""},
- geTestCase{uintptr(150), true, false, ""},
- geTestCase{uintptr(151), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(149), false, false, ""},
- geTestCase{float32(149.8), false, false, ""},
- geTestCase{float32(149.9), true, false, ""},
- geTestCase{float32(150), true, false, ""},
- geTestCase{float32(151), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(149), false, false, ""},
- geTestCase{float64(149.8), false, false, ""},
- geTestCase{float64(149.9), true, false, ""},
- geTestCase{float64(150), true, false, ""},
- geTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterOrEqual(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{kTwoTo25 + 0, false, false, ""},
- geTestCase{kTwoTo25 + 1, true, false, ""},
- geTestCase{kTwoTo25 + 2, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(kTwoTo25 + 0), false, false, ""},
- geTestCase{int(kTwoTo25 + 1), true, false, ""},
- geTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(kTwoTo25 + 0), false, false, ""},
- geTestCase{int32(kTwoTo25 + 1), true, false, ""},
- geTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo25 + 0), false, false, ""},
- geTestCase{int64(kTwoTo25 + 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uintptr(0), false, false, ""},
- geTestCase{uintptr(kTwoTo25 + 0), false, false, ""},
- geTestCase{uintptr(kTwoTo25 + 1), true, false, ""},
- geTestCase{uintptr(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(kTwoTo25 - 2), false, false, ""},
- geTestCase{float32(kTwoTo25 - 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 0), true, false, ""},
- geTestCase{float32(kTwoTo25 + 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 2), true, false, ""},
- geTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo25 - 2), false, false, ""},
- geTestCase{float64(kTwoTo25 - 1), false, false, ""},
- geTestCase{float64(kTwoTo25 + 0), false, false, ""},
- geTestCase{float64(kTwoTo25 + 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 2), true, false, ""},
- geTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterOrEqual(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{1 << 30, false, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(math.MaxInt32), false, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(math.MaxInt32), false, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo54 - 1), false, false, ""},
- geTestCase{int64(kTwoTo54 + 0), false, false, ""},
- geTestCase{int64(kTwoTo54 + 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(math.MaxUint32), false, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(math.MaxUint32), false, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- geTestCase{uintptr(0), false, false, ""},
- geTestCase{uintptr(kTwoTo54 - 1), false, false, ""},
- geTestCase{uintptr(kTwoTo54 + 0), false, false, ""},
- geTestCase{uintptr(kTwoTo54 + 1), true, false, ""},
- geTestCase{uintptr(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo54 - 2), false, false, ""},
- geTestCase{float64(kTwoTo54 - 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 0), true, false, ""},
- geTestCase{float64(kTwoTo54 + 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 2), true, false, ""},
- geTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterOrEqual(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{kTwoTo25 + 0, false, false, ""},
- geTestCase{kTwoTo25 + 1, true, false, ""},
- geTestCase{kTwoTo25 + 2, true, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(kTwoTo25 + 0), false, false, ""},
- geTestCase{int(kTwoTo25 + 1), true, false, ""},
- geTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(kTwoTo25 + 0), false, false, ""},
- geTestCase{int32(kTwoTo25 + 1), true, false, ""},
- geTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo25 + 0), false, false, ""},
- geTestCase{int64(kTwoTo25 + 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- geTestCase{uintptr(0), false, false, ""},
- geTestCase{uintptr(kTwoTo25 + 0), false, false, ""},
- geTestCase{uintptr(kTwoTo25 + 1), true, false, ""},
- geTestCase{uintptr(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(kTwoTo25 - 2), false, false, ""},
- geTestCase{float32(kTwoTo25 - 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 0), true, false, ""},
- geTestCase{float32(kTwoTo25 + 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 2), true, false, ""},
- geTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo25 - 2), false, false, ""},
- geTestCase{float64(kTwoTo25 - 1), false, false, ""},
- geTestCase{float64(kTwoTo25 + 0), false, false, ""},
- geTestCase{float64(kTwoTo25 + 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 2), true, false, ""},
- geTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterOrEqual(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{-1, false, false, ""},
- geTestCase{1 << 30, false, false, ""},
-
- geTestCase{int(-1), false, false, ""},
- geTestCase{int(math.MaxInt32), false, false, ""},
-
- geTestCase{int8(-1), false, false, ""},
- geTestCase{int8(127), false, false, ""},
-
- geTestCase{int16(-1), false, false, ""},
- geTestCase{int16(0), false, false, ""},
- geTestCase{int16(32767), false, false, ""},
-
- geTestCase{int32(-1), false, false, ""},
- geTestCase{int32(math.MaxInt32), false, false, ""},
-
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo54 - 1), false, false, ""},
- geTestCase{int64(kTwoTo54 + 0), false, false, ""},
- geTestCase{int64(kTwoTo54 + 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint(0), false, false, ""},
- geTestCase{uint(math.MaxUint32), false, false, ""},
-
- geTestCase{uint8(0), false, false, ""},
- geTestCase{uint8(255), false, false, ""},
-
- geTestCase{uint16(0), false, false, ""},
- geTestCase{uint16(65535), false, false, ""},
-
- geTestCase{uint32(0), false, false, ""},
- geTestCase{uint32(math.MaxUint32), false, false, ""},
-
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- geTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- geTestCase{uintptr(0), false, false, ""},
- geTestCase{uintptr(kTwoTo54 - 1), false, false, ""},
- geTestCase{uintptr(kTwoTo54 + 0), false, false, ""},
- geTestCase{uintptr(kTwoTo54 + 1), true, false, ""},
- geTestCase{uintptr(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo54 - 2), false, false, ""},
- geTestCase{float64(kTwoTo54 - 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 0), true, false, ""},
- geTestCase{float64(kTwoTo54 + 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 2), true, false, ""},
- geTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterOrEqual(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo25 - 2), false, false, ""},
- geTestCase{int64(kTwoTo25 - 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 0), true, false, ""},
- geTestCase{int64(kTwoTo25 + 1), true, false, ""},
- geTestCase{int64(kTwoTo25 + 2), true, false, ""},
- geTestCase{int64(kTwoTo25 + 3), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- geTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- geTestCase{uint64(kTwoTo25 + 3), true, false, ""},
-
- // Floating point.
- geTestCase{float32(-1), false, false, ""},
- geTestCase{float32(kTwoTo25 - 2), false, false, ""},
- geTestCase{float32(kTwoTo25 - 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 0), true, false, ""},
- geTestCase{float32(kTwoTo25 + 1), true, false, ""},
- geTestCase{float32(kTwoTo25 + 2), true, false, ""},
- geTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo25 - 2), false, false, ""},
- geTestCase{float64(kTwoTo25 - 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 0), true, false, ""},
- geTestCase{float64(kTwoTo25 + 1), true, false, ""},
- geTestCase{float64(kTwoTo25 + 2), true, false, ""},
- geTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterOrEqual(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than or equal to 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- // Signed integers.
- geTestCase{int64(-1), false, false, ""},
- geTestCase{int64(kTwoTo54 - 2), false, false, ""},
- geTestCase{int64(kTwoTo54 - 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 0), true, false, ""},
- geTestCase{int64(kTwoTo54 + 1), true, false, ""},
- geTestCase{int64(kTwoTo54 + 2), true, false, ""},
- geTestCase{int64(kTwoTo54 + 3), true, false, ""},
-
- // Unsigned integers.
- geTestCase{uint64(0), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- geTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- geTestCase{uint64(kTwoTo54 + 3), true, false, ""},
-
- // Floating point.
- geTestCase{float64(-1), false, false, ""},
- geTestCase{float64(kTwoTo54 - 2), false, false, ""},
- geTestCase{float64(kTwoTo54 - 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 0), true, false, ""},
- geTestCase{float64(kTwoTo54 + 1), true, false, ""},
- geTestCase{float64(kTwoTo54 + 2), true, false, ""},
- geTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterOrEqualTest) EmptyString() {
- matcher := GreaterOrEqual("")
- desc := matcher.Description()
- expectedDesc := "greater than or equal to \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- geTestCase{"", true, false, ""},
- geTestCase{"\x00", true, false, ""},
- geTestCase{"a", true, false, ""},
- geTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) SingleNullByte() {
- matcher := GreaterOrEqual("\x00")
- desc := matcher.Description()
- expectedDesc := "greater than or equal to \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- geTestCase{"", false, false, ""},
- geTestCase{"\x00", true, false, ""},
- geTestCase{"a", true, false, ""},
- geTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterOrEqualTest) LongerString() {
- matcher := GreaterOrEqual("foo\x00")
- desc := matcher.Description()
- expectedDesc := "greater than or equal to \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []geTestCase{
- geTestCase{"", false, false, ""},
- geTestCase{"\x00", false, false, ""},
- geTestCase{"bar", false, false, ""},
- geTestCase{"foo", false, false, ""},
- geTestCase{"foo\x00", true, false, ""},
- geTestCase{"fooa", true, false, ""},
- geTestCase{"qux", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than_test.go
deleted file mode 100644
index bf70fe56633..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/greater_than_test.go
+++ /dev/null
@@ -1,1077 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "math"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type GreaterThanTest struct {
-}
-
-func init() { RegisterTestSuite(&GreaterThanTest{}) }
-
-type gtTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *GreaterThanTest) checkTestCases(matcher Matcher, cases []gtTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) IntegerCandidateBadTypes() {
- matcher := GreaterThan(int(-150))
-
- cases := []gtTestCase{
- gtTestCase{true, false, true, "which is not comparable"},
- gtTestCase{complex64(-151), false, true, "which is not comparable"},
- gtTestCase{complex128(-151), false, true, "which is not comparable"},
- gtTestCase{[...]int{-151}, false, true, "which is not comparable"},
- gtTestCase{make(chan int), false, true, "which is not comparable"},
- gtTestCase{func() {}, false, true, "which is not comparable"},
- gtTestCase{map[int]int{}, false, true, "which is not comparable"},
- gtTestCase{&gtTestCase{}, false, true, "which is not comparable"},
- gtTestCase{make([]int, 0), false, true, "which is not comparable"},
- gtTestCase{"-151", false, true, "which is not comparable"},
- gtTestCase{gtTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) FloatCandidateBadTypes() {
- matcher := GreaterThan(float32(-150))
-
- cases := []gtTestCase{
- gtTestCase{true, false, true, "which is not comparable"},
- gtTestCase{complex64(-151), false, true, "which is not comparable"},
- gtTestCase{complex128(-151), false, true, "which is not comparable"},
- gtTestCase{[...]int{-151}, false, true, "which is not comparable"},
- gtTestCase{make(chan int), false, true, "which is not comparable"},
- gtTestCase{func() {}, false, true, "which is not comparable"},
- gtTestCase{map[int]int{}, false, true, "which is not comparable"},
- gtTestCase{&gtTestCase{}, false, true, "which is not comparable"},
- gtTestCase{make([]int, 0), false, true, "which is not comparable"},
- gtTestCase{"-151", false, true, "which is not comparable"},
- gtTestCase{gtTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) StringCandidateBadTypes() {
- matcher := GreaterThan("17")
-
- cases := []gtTestCase{
- gtTestCase{true, false, true, "which is not comparable"},
- gtTestCase{int(0), false, true, "which is not comparable"},
- gtTestCase{int8(0), false, true, "which is not comparable"},
- gtTestCase{int16(0), false, true, "which is not comparable"},
- gtTestCase{int32(0), false, true, "which is not comparable"},
- gtTestCase{int64(0), false, true, "which is not comparable"},
- gtTestCase{uint(0), false, true, "which is not comparable"},
- gtTestCase{uint8(0), false, true, "which is not comparable"},
- gtTestCase{uint16(0), false, true, "which is not comparable"},
- gtTestCase{uint32(0), false, true, "which is not comparable"},
- gtTestCase{uint64(0), false, true, "which is not comparable"},
- gtTestCase{float32(0), false, true, "which is not comparable"},
- gtTestCase{float64(0), false, true, "which is not comparable"},
- gtTestCase{complex64(-151), false, true, "which is not comparable"},
- gtTestCase{complex128(-151), false, true, "which is not comparable"},
- gtTestCase{[...]int{-151}, false, true, "which is not comparable"},
- gtTestCase{make(chan int), false, true, "which is not comparable"},
- gtTestCase{func() {}, false, true, "which is not comparable"},
- gtTestCase{map[int]int{}, false, true, "which is not comparable"},
- gtTestCase{&gtTestCase{}, false, true, "which is not comparable"},
- gtTestCase{make([]int, 0), false, true, "which is not comparable"},
- gtTestCase{gtTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- GreaterThan(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) NegativeIntegerLiteral() {
- matcher := GreaterThan(-150)
- desc := matcher.Description()
- expectedDesc := "greater than -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-(1 << 30), false, false, ""},
- gtTestCase{-151, false, false, ""},
- gtTestCase{-150, false, false, ""},
- gtTestCase{-149, true, false, ""},
- gtTestCase{0, true, false, ""},
- gtTestCase{17, true, false, ""},
-
- gtTestCase{int(-(1 << 30)), false, false, ""},
- gtTestCase{int(-151), false, false, ""},
- gtTestCase{int(-150), false, false, ""},
- gtTestCase{int(-149), true, false, ""},
- gtTestCase{int(0), true, false, ""},
- gtTestCase{int(17), true, false, ""},
-
- gtTestCase{int8(-127), true, false, ""},
- gtTestCase{int8(0), true, false, ""},
- gtTestCase{int8(17), true, false, ""},
-
- gtTestCase{int16(-(1 << 14)), false, false, ""},
- gtTestCase{int16(-151), false, false, ""},
- gtTestCase{int16(-150), false, false, ""},
- gtTestCase{int16(-149), true, false, ""},
- gtTestCase{int16(0), true, false, ""},
- gtTestCase{int16(17), true, false, ""},
-
- gtTestCase{int32(-(1 << 30)), false, false, ""},
- gtTestCase{int32(-151), false, false, ""},
- gtTestCase{int32(-150), false, false, ""},
- gtTestCase{int32(-149), true, false, ""},
- gtTestCase{int32(0), true, false, ""},
- gtTestCase{int32(17), true, false, ""},
-
- gtTestCase{int64(-(1 << 30)), false, false, ""},
- gtTestCase{int64(-151), false, false, ""},
- gtTestCase{int64(-150), false, false, ""},
- gtTestCase{int64(-149), true, false, ""},
- gtTestCase{int64(0), true, false, ""},
- gtTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint((1 << 32) - 151), true, false, ""},
- gtTestCase{uint(0), true, false, ""},
- gtTestCase{uint(17), true, false, ""},
-
- gtTestCase{uint8(0), true, false, ""},
- gtTestCase{uint8(17), true, false, ""},
- gtTestCase{uint8(253), true, false, ""},
-
- gtTestCase{uint16((1 << 16) - 151), true, false, ""},
- gtTestCase{uint16(0), true, false, ""},
- gtTestCase{uint16(17), true, false, ""},
-
- gtTestCase{uint32((1 << 32) - 151), true, false, ""},
- gtTestCase{uint32(0), true, false, ""},
- gtTestCase{uint32(17), true, false, ""},
-
- gtTestCase{uint64((1 << 64) - 151), true, false, ""},
- gtTestCase{uint64(0), true, false, ""},
- gtTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-(1 << 30)), false, false, ""},
- gtTestCase{float32(-151), false, false, ""},
- gtTestCase{float32(-150.1), false, false, ""},
- gtTestCase{float32(-150), false, false, ""},
- gtTestCase{float32(-149.9), true, false, ""},
- gtTestCase{float32(0), true, false, ""},
- gtTestCase{float32(17), true, false, ""},
- gtTestCase{float32(160), true, false, ""},
-
- gtTestCase{float64(-(1 << 30)), false, false, ""},
- gtTestCase{float64(-151), false, false, ""},
- gtTestCase{float64(-150.1), false, false, ""},
- gtTestCase{float64(-150), false, false, ""},
- gtTestCase{float64(-149.9), true, false, ""},
- gtTestCase{float64(0), true, false, ""},
- gtTestCase{float64(17), true, false, ""},
- gtTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) ZeroIntegerLiteral() {
- matcher := GreaterThan(0)
- desc := matcher.Description()
- expectedDesc := "greater than 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-(1 << 30), false, false, ""},
- gtTestCase{-1, false, false, ""},
- gtTestCase{0, false, false, ""},
- gtTestCase{1, true, false, ""},
- gtTestCase{17, true, false, ""},
- gtTestCase{(1 << 30), true, false, ""},
-
- gtTestCase{int(-(1 << 30)), false, false, ""},
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(0), false, false, ""},
- gtTestCase{int(1), true, false, ""},
- gtTestCase{int(17), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(0), false, false, ""},
- gtTestCase{int8(1), true, false, ""},
-
- gtTestCase{int16(-(1 << 14)), false, false, ""},
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(1), true, false, ""},
- gtTestCase{int16(17), true, false, ""},
-
- gtTestCase{int32(-(1 << 30)), false, false, ""},
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(0), false, false, ""},
- gtTestCase{int32(1), true, false, ""},
- gtTestCase{int32(17), true, false, ""},
-
- gtTestCase{int64(-(1 << 30)), false, false, ""},
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(0), false, false, ""},
- gtTestCase{int64(1), true, false, ""},
- gtTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint((1 << 32) - 1), true, false, ""},
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(1), true, false, ""},
- gtTestCase{uint(17), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(1), true, false, ""},
- gtTestCase{uint8(17), true, false, ""},
- gtTestCase{uint8(253), true, false, ""},
-
- gtTestCase{uint16((1 << 16) - 1), true, false, ""},
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(1), true, false, ""},
- gtTestCase{uint16(17), true, false, ""},
-
- gtTestCase{uint32((1 << 32) - 1), true, false, ""},
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(1), true, false, ""},
- gtTestCase{uint32(17), true, false, ""},
-
- gtTestCase{uint64((1 << 64) - 1), true, false, ""},
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(1), true, false, ""},
- gtTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-(1 << 30)), false, false, ""},
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(-0.1), false, false, ""},
- gtTestCase{float32(-0.0), false, false, ""},
- gtTestCase{float32(0), false, false, ""},
- gtTestCase{float32(0.1), true, false, ""},
- gtTestCase{float32(17), true, false, ""},
- gtTestCase{float32(160), true, false, ""},
-
- gtTestCase{float64(-(1 << 30)), false, false, ""},
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(-0.1), false, false, ""},
- gtTestCase{float64(-0), false, false, ""},
- gtTestCase{float64(0), false, false, ""},
- gtTestCase{float64(0.1), true, false, ""},
- gtTestCase{float64(17), true, false, ""},
- gtTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) PositiveIntegerLiteral() {
- matcher := GreaterThan(150)
- desc := matcher.Description()
- expectedDesc := "greater than 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{149, false, false, ""},
- gtTestCase{150, false, false, ""},
- gtTestCase{151, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(149), false, false, ""},
- gtTestCase{int(150), false, false, ""},
- gtTestCase{int(151), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(0), false, false, ""},
- gtTestCase{int8(17), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(149), false, false, ""},
- gtTestCase{int16(150), false, false, ""},
- gtTestCase{int16(151), true, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(149), false, false, ""},
- gtTestCase{int32(150), false, false, ""},
- gtTestCase{int32(151), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(149), false, false, ""},
- gtTestCase{int64(150), false, false, ""},
- gtTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(149), false, false, ""},
- gtTestCase{uint(150), false, false, ""},
- gtTestCase{uint(151), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(127), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(149), false, false, ""},
- gtTestCase{uint16(150), false, false, ""},
- gtTestCase{uint16(151), true, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(149), false, false, ""},
- gtTestCase{uint32(150), false, false, ""},
- gtTestCase{uint32(151), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(149), false, false, ""},
- gtTestCase{uint64(150), false, false, ""},
- gtTestCase{uint64(151), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(149), false, false, ""},
- gtTestCase{float32(149.9), false, false, ""},
- gtTestCase{float32(150), false, false, ""},
- gtTestCase{float32(150.1), true, false, ""},
- gtTestCase{float32(151), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(149), false, false, ""},
- gtTestCase{float64(149.9), false, false, ""},
- gtTestCase{float64(150), false, false, ""},
- gtTestCase{float64(150.1), true, false, ""},
- gtTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) NegativeFloatLiteral() {
- matcher := GreaterThan(-150.1)
- desc := matcher.Description()
- expectedDesc := "greater than -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-(1 << 30), false, false, ""},
- gtTestCase{-151, false, false, ""},
- gtTestCase{-150.1, false, false, ""},
- gtTestCase{-150, true, false, ""},
- gtTestCase{-149, true, false, ""},
- gtTestCase{0, true, false, ""},
- gtTestCase{17, true, false, ""},
-
- gtTestCase{int(-(1 << 30)), false, false, ""},
- gtTestCase{int(-151), false, false, ""},
- gtTestCase{int(-150), true, false, ""},
- gtTestCase{int(-149), true, false, ""},
- gtTestCase{int(0), true, false, ""},
- gtTestCase{int(17), true, false, ""},
-
- gtTestCase{int8(-127), true, false, ""},
- gtTestCase{int8(0), true, false, ""},
- gtTestCase{int8(17), true, false, ""},
-
- gtTestCase{int16(-(1 << 14)), false, false, ""},
- gtTestCase{int16(-151), false, false, ""},
- gtTestCase{int16(-150), true, false, ""},
- gtTestCase{int16(-149), true, false, ""},
- gtTestCase{int16(0), true, false, ""},
- gtTestCase{int16(17), true, false, ""},
-
- gtTestCase{int32(-(1 << 30)), false, false, ""},
- gtTestCase{int32(-151), false, false, ""},
- gtTestCase{int32(-150), true, false, ""},
- gtTestCase{int32(-149), true, false, ""},
- gtTestCase{int32(0), true, false, ""},
- gtTestCase{int32(17), true, false, ""},
-
- gtTestCase{int64(-(1 << 30)), false, false, ""},
- gtTestCase{int64(-151), false, false, ""},
- gtTestCase{int64(-150), true, false, ""},
- gtTestCase{int64(-149), true, false, ""},
- gtTestCase{int64(0), true, false, ""},
- gtTestCase{int64(17), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint((1 << 32) - 151), true, false, ""},
- gtTestCase{uint(0), true, false, ""},
- gtTestCase{uint(17), true, false, ""},
-
- gtTestCase{uint8(0), true, false, ""},
- gtTestCase{uint8(17), true, false, ""},
- gtTestCase{uint8(253), true, false, ""},
-
- gtTestCase{uint16((1 << 16) - 151), true, false, ""},
- gtTestCase{uint16(0), true, false, ""},
- gtTestCase{uint16(17), true, false, ""},
-
- gtTestCase{uint32((1 << 32) - 151), true, false, ""},
- gtTestCase{uint32(0), true, false, ""},
- gtTestCase{uint32(17), true, false, ""},
-
- gtTestCase{uint64((1 << 64) - 151), true, false, ""},
- gtTestCase{uint64(0), true, false, ""},
- gtTestCase{uint64(17), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-(1 << 30)), false, false, ""},
- gtTestCase{float32(-151), false, false, ""},
- gtTestCase{float32(-150.2), false, false, ""},
- gtTestCase{float32(-150.1), false, false, ""},
- gtTestCase{float32(-150), true, false, ""},
- gtTestCase{float32(0), true, false, ""},
- gtTestCase{float32(17), true, false, ""},
- gtTestCase{float32(160), true, false, ""},
-
- gtTestCase{float64(-(1 << 30)), false, false, ""},
- gtTestCase{float64(-151), false, false, ""},
- gtTestCase{float64(-150.2), false, false, ""},
- gtTestCase{float64(-150.1), false, false, ""},
- gtTestCase{float64(-150), true, false, ""},
- gtTestCase{float64(0), true, false, ""},
- gtTestCase{float64(17), true, false, ""},
- gtTestCase{float64(160), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) PositiveFloatLiteral() {
- matcher := GreaterThan(149.9)
- desc := matcher.Description()
- expectedDesc := "greater than 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{149, false, false, ""},
- gtTestCase{149.9, false, false, ""},
- gtTestCase{150, true, false, ""},
- gtTestCase{151, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(149), false, false, ""},
- gtTestCase{int(150), true, false, ""},
- gtTestCase{int(151), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(0), false, false, ""},
- gtTestCase{int8(17), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(149), false, false, ""},
- gtTestCase{int16(150), true, false, ""},
- gtTestCase{int16(151), true, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(149), false, false, ""},
- gtTestCase{int32(150), true, false, ""},
- gtTestCase{int32(151), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(149), false, false, ""},
- gtTestCase{int64(150), true, false, ""},
- gtTestCase{int64(151), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(149), false, false, ""},
- gtTestCase{uint(150), true, false, ""},
- gtTestCase{uint(151), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(127), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(149), false, false, ""},
- gtTestCase{uint16(150), true, false, ""},
- gtTestCase{uint16(151), true, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(149), false, false, ""},
- gtTestCase{uint32(150), true, false, ""},
- gtTestCase{uint32(151), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(149), false, false, ""},
- gtTestCase{uint64(150), true, false, ""},
- gtTestCase{uint64(151), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(149), false, false, ""},
- gtTestCase{float32(149.8), false, false, ""},
- gtTestCase{float32(149.9), false, false, ""},
- gtTestCase{float32(150), true, false, ""},
- gtTestCase{float32(151), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(149), false, false, ""},
- gtTestCase{float64(149.8), false, false, ""},
- gtTestCase{float64(149.9), false, false, ""},
- gtTestCase{float64(150), true, false, ""},
- gtTestCase{float64(151), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterThan(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{kTwoTo25 + 0, false, false, ""},
- gtTestCase{kTwoTo25 + 1, false, false, ""},
- gtTestCase{kTwoTo25 + 2, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 2), true, false, ""},
- gtTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterThan(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{1 << 30, false, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(math.MaxInt32), false, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(math.MaxInt32), false, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterThan(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{kTwoTo25 + 0, false, false, ""},
- gtTestCase{kTwoTo25 + 1, false, false, ""},
- gtTestCase{kTwoTo25 + 2, true, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint32(kTwoTo25 + 2), true, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 2), true, false, ""},
- gtTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterThan(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{-1, false, false, ""},
- gtTestCase{1 << 30, false, false, ""},
-
- gtTestCase{int(-1), false, false, ""},
- gtTestCase{int(math.MaxInt32), false, false, ""},
-
- gtTestCase{int8(-1), false, false, ""},
- gtTestCase{int8(127), false, false, ""},
-
- gtTestCase{int16(-1), false, false, ""},
- gtTestCase{int16(0), false, false, ""},
- gtTestCase{int16(32767), false, false, ""},
-
- gtTestCase{int32(-1), false, false, ""},
- gtTestCase{int32(math.MaxInt32), false, false, ""},
-
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 2), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint(0), false, false, ""},
- gtTestCase{uint(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint8(0), false, false, ""},
- gtTestCase{uint8(255), false, false, ""},
-
- gtTestCase{uint16(0), false, false, ""},
- gtTestCase{uint16(65535), false, false, ""},
-
- gtTestCase{uint32(0), false, false, ""},
- gtTestCase{uint32(math.MaxUint32), false, false, ""},
-
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 2), true, false, ""},
-
- // Floating point.
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := GreaterThan(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{int64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 2), false, false, ""},
- gtTestCase{int64(kTwoTo25 + 3), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{uint64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 2), false, false, ""},
- gtTestCase{uint64(kTwoTo25 + 3), true, false, ""},
-
- // Floating point.
- gtTestCase{float32(-1), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float32(kTwoTo25 + 3), true, false, ""},
-
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo25 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := GreaterThan(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "greater than 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- // Signed integers.
- gtTestCase{int64(-1), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{int64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{int64(kTwoTo54 + 3), true, false, ""},
-
- // Unsigned integers.
- gtTestCase{uint64(0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{uint64(kTwoTo54 + 3), true, false, ""},
-
- // Floating point.
- gtTestCase{float64(-1), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 - 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 0), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 1), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 2), false, false, ""},
- gtTestCase{float64(kTwoTo54 + 3), true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *GreaterThanTest) EmptyString() {
- matcher := GreaterThan("")
- desc := matcher.Description()
- expectedDesc := "greater than \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- gtTestCase{"", false, false, ""},
- gtTestCase{"\x00", true, false, ""},
- gtTestCase{"a", true, false, ""},
- gtTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) SingleNullByte() {
- matcher := GreaterThan("\x00")
- desc := matcher.Description()
- expectedDesc := "greater than \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- gtTestCase{"", false, false, ""},
- gtTestCase{"\x00", false, false, ""},
- gtTestCase{"\x00\x00", true, false, ""},
- gtTestCase{"a", true, false, ""},
- gtTestCase{"foo", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *GreaterThanTest) LongerString() {
- matcher := GreaterThan("foo\x00")
- desc := matcher.Description()
- expectedDesc := "greater than \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []gtTestCase{
- gtTestCase{"", false, false, ""},
- gtTestCase{"\x00", false, false, ""},
- gtTestCase{"bar", false, false, ""},
- gtTestCase{"foo", false, false, ""},
- gtTestCase{"foo\x00", false, false, ""},
- gtTestCase{"foo\x00\x00", true, false, ""},
- gtTestCase{"fooa", true, false, ""},
- gtTestCase{"qux", true, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as_test.go
deleted file mode 100644
index a4a3e308aa3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_same_type_as_test.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "io"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-func TestHasSameTypeAs(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Boilerplate
-////////////////////////////////////////////////////////////////////////
-
-type HasSameTypeAsTest struct {
-}
-
-func init() { RegisterTestSuite(&HasSameTypeAsTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *HasSameTypeAsTest) CandidateIsLiteralNil() {
- matcher := HasSameTypeAs(nil)
- var err error
-
- // Description
- ExpectEq("has type <nil>", matcher.Description())
-
- // Literal nil
- err = matcher.Matches(nil)
- ExpectEq(nil, err)
-
- // nil in interface variable
- var r io.Reader
- err = matcher.Matches(r)
- ExpectEq(nil, err)
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-
- // string
- err = matcher.Matches("")
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type string")))
-
- // nil map
- var m map[string]string
- err = matcher.Matches(m)
-
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type map[string]string")))
-
- // Non-nil map
- m = make(map[string]string)
- err = matcher.Matches(m)
-
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type map[string]string")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsNilMap() {
- var m map[string]string
- matcher := HasSameTypeAs(m)
- var err error
-
- // Description
- ExpectEq("has type map[string]string", matcher.Description())
-
- // nil map
- m = nil
- err = matcher.Matches(m)
- ExpectEq(nil, err)
-
- // Non-nil map
- m = make(map[string]string)
- err = matcher.Matches(m)
- ExpectEq(nil, err)
-
- // Literal nil
- err = matcher.Matches(nil)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type <nil>")))
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-
- // string
- err = matcher.Matches("")
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type string")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsNilInInterfaceVariable() {
- var r io.Reader
- matcher := HasSameTypeAs(r)
- var err error
-
- // Description
- ExpectEq("has type <nil>", matcher.Description())
-
- // nil in interface variable
- r = nil
- err = matcher.Matches(r)
- ExpectEq(nil, err)
-
- // Literal nil
- err = matcher.Matches(nil)
- ExpectEq(nil, err)
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsString() {
- matcher := HasSameTypeAs("")
- var err error
-
- // Description
- ExpectEq("has type string", matcher.Description())
-
- // string
- err = matcher.Matches("taco")
- ExpectEq(nil, err)
-
- // string alias
- type Foo string
- err = matcher.Matches(Foo("taco"))
- ExpectThat(err, Error(MatchesRegexp("which has type .*Foo")))
-
- // Literal nil
- err = matcher.Matches(nil)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type <nil>")))
-
- // int
- err = matcher.Matches(17)
- AssertNe(nil, err)
- ExpectThat(err, Error(Equals("which has type int")))
-}
-
-func (t *HasSameTypeAsTest) CandidateIsStringAlias() {
- type Foo string
- matcher := HasSameTypeAs(Foo(""))
- var err error
-
- // Description
- ExpectThat(matcher.Description(), MatchesRegexp("has type .*Foo"))
-
- // string alias
- err = matcher.Matches(Foo("taco"))
- ExpectEq(nil, err)
-
- // string
- err = matcher.Matches("taco")
- ExpectThat(err, Error(Equals("which has type string")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr_test.go
deleted file mode 100644
index 6fc913a2490..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/has_substr_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type HasSubstrTest struct {
-
-}
-
-func init() { RegisterTestSuite(&HasSubstrTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *HasSubstrTest) Description() {
- matcher := HasSubstr("taco")
- ExpectThat(matcher.Description(), Equals("has substring \"taco\""))
-}
-
-func (t *HasSubstrTest) CandidateIsNil() {
- matcher := HasSubstr("")
- err := matcher.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a string")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateIsInteger() {
- matcher := HasSubstr("")
- err := matcher.Matches(17)
-
- ExpectThat(err, Error(Equals("which is not a string")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateIsByteSlice() {
- matcher := HasSubstr("")
- err := matcher.Matches([]byte{17})
-
- ExpectThat(err, Error(Equals("which is not a string")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateDoesntHaveSubstring() {
- matcher := HasSubstr("taco")
- err := matcher.Matches("tac")
-
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *HasSubstrTest) CandidateEqualsArg() {
- matcher := HasSubstr("taco")
- err := matcher.Matches("taco")
-
- ExpectThat(err, Equals(nil))
-}
-
-func (t *HasSubstrTest) CandidateHasProperSubstring() {
- matcher := HasSubstr("taco")
- err := matcher.Matches("burritos and tacos")
-
- ExpectThat(err, Equals(nil))
-}
-
-func (t *HasSubstrTest) EmptyStringIsAlwaysSubString() {
- matcher := HasSubstr("")
- err := matcher.Matches("asdf")
-
- ExpectThat(err, Equals(nil))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to_test.go
deleted file mode 100644
index cc03b214ad6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/identical_to_test.go
+++ /dev/null
@@ -1,849 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "fmt"
- "io"
- "unsafe"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type IdenticalToTest struct {
-}
-
-func init() { RegisterTestSuite(&IdenticalToTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *IdenticalToTest) TypesNotIdentical() {
- var m Matcher
- var err error
-
- type intAlias int
-
- // Type alias expected value
- m = IdenticalTo(intAlias(17))
- err = m.Matches(int(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int")))
-
- // Type alias candidate
- m = IdenticalTo(int(17))
- err = m.Matches(intAlias(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.intAlias")))
-
- // int and uint
- m = IdenticalTo(int(17))
- err = m.Matches(uint(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type uint")))
-}
-
-func (t *IdenticalToTest) PredeclaredNilIdentifier() {
- var m Matcher
- var err error
-
- // Nil literal
- m = IdenticalTo(nil)
- err = m.Matches(nil)
- ExpectEq(nil, err)
-
- // Zero interface var (which is the same as above since IdenticalTo takes an
- // interface{} as an arg)
- var nilReader io.Reader
- var nilWriter io.Writer
-
- m = IdenticalTo(nilReader)
- err = m.Matches(nilWriter)
- ExpectEq(nil, err)
-
- // Typed nil value.
- m = IdenticalTo(nil)
- err = m.Matches((chan int)(nil))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type chan int")))
-
- // Non-nil value.
- m = IdenticalTo(nil)
- err = m.Matches("taco")
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type string")))
-}
-
-func (t *IdenticalToTest) Slices() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo(([]int)(nil))
- ExpectEq("identical to <[]int> []", m.Description())
-
- err = m.Matches(([]int)(nil))
- ExpectEq(nil, err)
-
- err = m.Matches([]int{})
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := make([]int, 1)
- o2 := make([]int, 1)
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <[]int> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Maps() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo((map[int]int)(nil))
- ExpectEq("identical to <map[int]int> map[]", m.Description())
-
- err = m.Matches((map[int]int)(nil))
- ExpectEq(nil, err)
-
- err = m.Matches(map[int]int{})
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := map[int]int{}
- o2 := map[int]int{}
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <map[int]int> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Functions() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo((func())(nil))
- ExpectEq("identical to <func()> <nil>", m.Description())
-
- err = m.Matches((func())(nil))
- ExpectEq(nil, err)
-
- err = m.Matches(func(){})
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := func() {}
- o2 := func() {}
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <func()> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Channels() {
- var m Matcher
- var err error
-
- // Nil expected value
- m = IdenticalTo((chan int)(nil))
- ExpectEq("identical to <chan int> <nil>", m.Description())
-
- err = m.Matches((chan int)(nil))
- ExpectEq(nil, err)
-
- err = m.Matches(make(chan int))
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-
- // Non-nil expected value
- o1 := make(chan int)
- o2 := make(chan int)
- m = IdenticalTo(o1)
- ExpectEq(fmt.Sprintf("identical to <chan int> %v", o1), m.Description())
-
- err = m.Matches(o1)
- ExpectEq(nil, err)
-
- err = m.Matches(o2)
- ExpectThat(err, Error(Equals("which is not an identical reference")))
-}
-
-func (t *IdenticalToTest) Bools() {
- var m Matcher
- var err error
-
- // false
- m = IdenticalTo(false)
- ExpectEq("identical to <bool> false", m.Description())
-
- err = m.Matches(false)
- ExpectEq(nil, err)
-
- err = m.Matches(true)
- ExpectThat(err, Error(Equals("")))
-
- // true
- m = IdenticalTo(true)
- ExpectEq("identical to <bool> true", m.Description())
-
- err = m.Matches(false)
- ExpectThat(err, Error(Equals("")))
-
- err = m.Matches(true)
- ExpectEq(nil, err)
-}
-
-func (t *IdenticalToTest) Ints() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int(17))
- ExpectEq("identical to <int> 17", m.Description())
-
- // Identical value
- err = m.Matches(int(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Int8s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int8(17))
- ExpectEq("identical to <int8> 17", m.Description())
-
- // Identical value
- err = m.Matches(int8(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int8
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Int16s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int16(17))
- ExpectEq("identical to <int16> 17", m.Description())
-
- // Identical value
- err = m.Matches(int16(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int16
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Int32s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int32(17))
- ExpectEq("identical to <int32> 17", m.Description())
-
- // Identical value
- err = m.Matches(int32(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int32
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int16(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int16")))
-}
-
-func (t *IdenticalToTest) Int64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(int64(17))
- ExpectEq("identical to <int64> 17", m.Description())
-
- // Identical value
- err = m.Matches(int64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType int64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uints() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint(17))
- ExpectEq("identical to <uint> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint8s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint8(17))
- ExpectEq("identical to <uint8> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint8(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint8
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint16s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint16(17))
- ExpectEq("identical to <uint16> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint16(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint16
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint32s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint32(17))
- ExpectEq("identical to <uint32> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint32(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint32
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uint64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uint64(17))
- ExpectEq("identical to <uint64> 17", m.Description())
-
- // Identical value
- err = m.Matches(uint64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uint64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Uintptrs() {
- var m Matcher
- var err error
-
- m = IdenticalTo(uintptr(17))
- ExpectEq("identical to <uintptr> 17", m.Description())
-
- // Identical value
- err = m.Matches(uintptr(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType uintptr
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Float32s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(float32(17))
- ExpectEq("identical to <float32> 17", m.Description())
-
- // Identical value
- err = m.Matches(float32(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType float32
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Float64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(float64(17))
- ExpectEq("identical to <float64> 17", m.Description())
-
- // Identical value
- err = m.Matches(float64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType float64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Complex64s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(complex64(17))
- ExpectEq("identical to <complex64> (17+0i)", m.Description())
-
- // Identical value
- err = m.Matches(complex64(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType complex64
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) Complex128s() {
- var m Matcher
- var err error
-
- m = IdenticalTo(complex128(17))
- ExpectEq("identical to <complex128> (17+0i)", m.Description())
-
- // Identical value
- err = m.Matches(complex128(17))
- ExpectEq(nil, err)
-
- // Type alias
- type myType complex128
- err = m.Matches(myType(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) EmptyComparableArrays() {
- var m Matcher
- var err error
-
- m = IdenticalTo([0]int{})
- ExpectEq("identical to <[0]int> []", m.Description())
-
- // Identical value
- err = m.Matches([0]int{})
- ExpectEq(nil, err)
-
- // Length too long
- err = m.Matches([1]int{17})
- ExpectThat(err, Error(Equals("which is of type [1]int")))
-
- // Element type alias
- type myType int
- err = m.Matches([0]myType{})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [0]oglematchers_test.myType")))
-
- // Completely wrong element type
- err = m.Matches([0]int32{})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [0]int32")))
-}
-
-func (t *IdenticalToTest) NonEmptyComparableArrays() {
- var m Matcher
- var err error
-
- m = IdenticalTo([2]int{17, 19})
- ExpectEq("identical to <[2]int> [17 19]", m.Description())
-
- // Identical value
- err = m.Matches([2]int{17, 19})
- ExpectEq(nil, err)
-
- // Length too short
- err = m.Matches([1]int{17})
- ExpectThat(err, Error(Equals("which is of type [1]int")))
-
- // Length too long
- err = m.Matches([3]int{17, 19, 23})
- ExpectThat(err, Error(Equals("which is of type [3]int")))
-
- // First element different
- err = m.Matches([2]int{13, 19})
- ExpectThat(err, Error(Equals("")))
-
- // Second element different
- err = m.Matches([2]int{17, 23})
- ExpectThat(err, Error(Equals("")))
-
- // Element type alias
- type myType int
- err = m.Matches([2]myType{17, 19})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [2]oglematchers_test.myType")))
-
- // Completely wrong element type
- err = m.Matches([2]int32{17, 19})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [2]int32")))
-}
-
-func (t *IdenticalToTest) NonEmptyArraysOfComparableArrays() {
- var m Matcher
- var err error
-
- x := [2][2]int{
- [2]int{17, 19},
- [2]int{23, 29},
- }
- m = IdenticalTo(x)
- ExpectEq("identical to <[2][2]int> [[17 19] [23 29]]", m.Description())
-
- // Identical value
- err = m.Matches([2][2]int{[2]int{17, 19}, [2]int{23, 29}})
- ExpectEq(nil, err)
-
- // Outer length too short
- err = m.Matches([1][2]int{[2]int{17, 19}})
- ExpectThat(err, Error(Equals("which is of type [1][2]int")))
-
- // Inner length too short
- err = m.Matches([2][1]int{[1]int{17}, [1]int{23}})
- ExpectThat(err, Error(Equals("which is of type [2][1]int")))
-
- // First element different
- err = m.Matches([2][2]int{[2]int{13, 19}, [2]int{23, 29}})
- ExpectThat(err, Error(Equals("")))
-
- // Element type alias
- type myType int
- err = m.Matches([2][2]myType{[2]myType{17, 19}, [2]myType{23, 29}})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type [2][2]oglematchers_test.myType")))
-}
-
-func (t *IdenticalToTest) NonComparableArrays() {
- x := [0]func(){}
- f := func() { IdenticalTo(x) }
- ExpectThat(f, Panics(HasSubstr("is not comparable")))
-}
-
-func (t *IdenticalToTest) ArraysOfNonComparableArrays() {
- x := [0][0]func(){}
- f := func() { IdenticalTo(x) }
- ExpectThat(f, Panics(HasSubstr("is not comparable")))
-}
-
-func (t *IdenticalToTest) Strings() {
- var m Matcher
- var err error
-
- m = IdenticalTo("taco")
- ExpectEq("identical to <string> taco", m.Description())
-
- // Identical value
- err = m.Matches("ta" + "co")
- ExpectEq(nil, err)
-
- // Type alias
- type myType string
- err = m.Matches(myType("taco"))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) ComparableStructs() {
- var m Matcher
- var err error
-
- type subStruct struct {
- i int
- }
-
- type myStruct struct {
- u uint
- s subStruct
- }
-
- x := myStruct{17, subStruct{19}}
- m = IdenticalTo(x)
- ExpectEq("identical to <oglematchers_test.myStruct> {17 {19}}", m.Description())
-
- // Identical value
- err = m.Matches(myStruct{17, subStruct{19}})
- ExpectEq(nil, err)
-
- // Wrong outer field
- err = m.Matches(myStruct{13, subStruct{19}})
- ExpectThat(err, Error(Equals("")))
-
- // Wrong inner field
- err = m.Matches(myStruct{17, subStruct{23}})
- ExpectThat(err, Error(Equals("")))
-
- // Type alias
- type myType myStruct
- err = m.Matches(myType{17, subStruct{19}})
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) NonComparableStructs() {
- type subStruct struct {
- s []int
- }
-
- type myStruct struct {
- u uint
- s subStruct
- }
-
- x := myStruct{17, subStruct{[]int{19}}}
- f := func() { IdenticalTo(x) }
- ExpectThat(f, Panics(AllOf(HasSubstr("IdenticalTo"), HasSubstr("comparable"))))
-}
-
-func (t *IdenticalToTest) NilUnsafePointer() {
- var m Matcher
- var err error
-
- x := unsafe.Pointer(nil)
- m = IdenticalTo(x)
- ExpectEq(fmt.Sprintf("identical to <unsafe.Pointer> %v", x), m.Description())
-
- // Identical value
- err = m.Matches(unsafe.Pointer(nil))
- ExpectEq(nil, err)
-
- // Wrong value
- j := 17
- err = m.Matches(unsafe.Pointer(&j))
- ExpectThat(err, Error(Equals("")))
-
- // Type alias
- type myType unsafe.Pointer
- err = m.Matches(myType(unsafe.Pointer(nil)))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) NonNilUnsafePointer() {
- var m Matcher
- var err error
-
- i := 17
- x := unsafe.Pointer(&i)
- m = IdenticalTo(x)
- ExpectEq(fmt.Sprintf("identical to <unsafe.Pointer> %v", x), m.Description())
-
- // Identical value
- err = m.Matches(unsafe.Pointer(&i))
- ExpectEq(nil, err)
-
- // Nil value
- err = m.Matches(unsafe.Pointer(nil))
- ExpectThat(err, Error(Equals("")))
-
- // Wrong value
- j := 17
- err = m.Matches(unsafe.Pointer(&j))
- ExpectThat(err, Error(Equals("")))
-
- // Type alias
- type myType unsafe.Pointer
- err = m.Matches(myType(unsafe.Pointer(&i)))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type oglematchers_test.myType")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
-
-func (t *IdenticalToTest) IntAlias() {
- var m Matcher
- var err error
-
- type intAlias int
-
- m = IdenticalTo(intAlias(17))
- ExpectEq("identical to <oglematchers_test.intAlias> 17", m.Description())
-
- // Identical value
- err = m.Matches(intAlias(17))
- ExpectEq(nil, err)
-
- // Int
- err = m.Matches(int(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int")))
-
- // Completely wrong type
- err = m.Matches(int32(17))
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("which is of type int32")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal_test.go
deleted file mode 100644
index a1a2ae7d60e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_or_equal_test.go
+++ /dev/null
@@ -1,1077 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "math"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type LessOrEqualTest struct {
-}
-
-func init() { RegisterTestSuite(&LessOrEqualTest{}) }
-
-type leTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *LessOrEqualTest) checkTestCases(matcher Matcher, cases []leTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) IntegerCandidateBadTypes() {
- matcher := LessOrEqual(int(-150))
-
- cases := []leTestCase{
- leTestCase{true, false, true, "which is not comparable"},
- leTestCase{complex64(-151), false, true, "which is not comparable"},
- leTestCase{complex128(-151), false, true, "which is not comparable"},
- leTestCase{[...]int{-151}, false, true, "which is not comparable"},
- leTestCase{make(chan int), false, true, "which is not comparable"},
- leTestCase{func() {}, false, true, "which is not comparable"},
- leTestCase{map[int]int{}, false, true, "which is not comparable"},
- leTestCase{&leTestCase{}, false, true, "which is not comparable"},
- leTestCase{make([]int, 0), false, true, "which is not comparable"},
- leTestCase{"-151", false, true, "which is not comparable"},
- leTestCase{leTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) FloatCandidateBadTypes() {
- matcher := LessOrEqual(float32(-150))
-
- cases := []leTestCase{
- leTestCase{true, false, true, "which is not comparable"},
- leTestCase{complex64(-151), false, true, "which is not comparable"},
- leTestCase{complex128(-151), false, true, "which is not comparable"},
- leTestCase{[...]int{-151}, false, true, "which is not comparable"},
- leTestCase{make(chan int), false, true, "which is not comparable"},
- leTestCase{func() {}, false, true, "which is not comparable"},
- leTestCase{map[int]int{}, false, true, "which is not comparable"},
- leTestCase{&leTestCase{}, false, true, "which is not comparable"},
- leTestCase{make([]int, 0), false, true, "which is not comparable"},
- leTestCase{"-151", false, true, "which is not comparable"},
- leTestCase{leTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) StringCandidateBadTypes() {
- matcher := LessOrEqual("17")
-
- cases := []leTestCase{
- leTestCase{true, false, true, "which is not comparable"},
- leTestCase{int(0), false, true, "which is not comparable"},
- leTestCase{int8(0), false, true, "which is not comparable"},
- leTestCase{int16(0), false, true, "which is not comparable"},
- leTestCase{int32(0), false, true, "which is not comparable"},
- leTestCase{int64(0), false, true, "which is not comparable"},
- leTestCase{uint(0), false, true, "which is not comparable"},
- leTestCase{uint8(0), false, true, "which is not comparable"},
- leTestCase{uint16(0), false, true, "which is not comparable"},
- leTestCase{uint32(0), false, true, "which is not comparable"},
- leTestCase{uint64(0), false, true, "which is not comparable"},
- leTestCase{float32(0), false, true, "which is not comparable"},
- leTestCase{float64(0), false, true, "which is not comparable"},
- leTestCase{complex64(-151), false, true, "which is not comparable"},
- leTestCase{complex128(-151), false, true, "which is not comparable"},
- leTestCase{[...]int{-151}, false, true, "which is not comparable"},
- leTestCase{make(chan int), false, true, "which is not comparable"},
- leTestCase{func() {}, false, true, "which is not comparable"},
- leTestCase{map[int]int{}, false, true, "which is not comparable"},
- leTestCase{&leTestCase{}, false, true, "which is not comparable"},
- leTestCase{make([]int, 0), false, true, "which is not comparable"},
- leTestCase{leTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- LessOrEqual(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) NegativeIntegerLiteral() {
- matcher := LessOrEqual(-150)
- desc := matcher.Description()
- expectedDesc := "less than or equal to -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-(1 << 30), true, false, ""},
- leTestCase{-151, true, false, ""},
- leTestCase{-150, true, false, ""},
- leTestCase{-149, false, false, ""},
- leTestCase{0, false, false, ""},
- leTestCase{17, false, false, ""},
-
- leTestCase{int(-(1 << 30)), true, false, ""},
- leTestCase{int(-151), true, false, ""},
- leTestCase{int(-150), true, false, ""},
- leTestCase{int(-149), false, false, ""},
- leTestCase{int(0), false, false, ""},
- leTestCase{int(17), false, false, ""},
-
- leTestCase{int8(-127), false, false, ""},
- leTestCase{int8(0), false, false, ""},
- leTestCase{int8(17), false, false, ""},
-
- leTestCase{int16(-(1 << 14)), true, false, ""},
- leTestCase{int16(-151), true, false, ""},
- leTestCase{int16(-150), true, false, ""},
- leTestCase{int16(-149), false, false, ""},
- leTestCase{int16(0), false, false, ""},
- leTestCase{int16(17), false, false, ""},
-
- leTestCase{int32(-(1 << 30)), true, false, ""},
- leTestCase{int32(-151), true, false, ""},
- leTestCase{int32(-150), true, false, ""},
- leTestCase{int32(-149), false, false, ""},
- leTestCase{int32(0), false, false, ""},
- leTestCase{int32(17), false, false, ""},
-
- leTestCase{int64(-(1 << 30)), true, false, ""},
- leTestCase{int64(-151), true, false, ""},
- leTestCase{int64(-150), true, false, ""},
- leTestCase{int64(-149), false, false, ""},
- leTestCase{int64(0), false, false, ""},
- leTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint((1 << 32) - 151), false, false, ""},
- leTestCase{uint(0), false, false, ""},
- leTestCase{uint(17), false, false, ""},
-
- leTestCase{uint8(0), false, false, ""},
- leTestCase{uint8(17), false, false, ""},
- leTestCase{uint8(253), false, false, ""},
-
- leTestCase{uint16((1 << 16) - 151), false, false, ""},
- leTestCase{uint16(0), false, false, ""},
- leTestCase{uint16(17), false, false, ""},
-
- leTestCase{uint32((1 << 32) - 151), false, false, ""},
- leTestCase{uint32(0), false, false, ""},
- leTestCase{uint32(17), false, false, ""},
-
- leTestCase{uint64((1 << 64) - 151), false, false, ""},
- leTestCase{uint64(0), false, false, ""},
- leTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-(1 << 30)), true, false, ""},
- leTestCase{float32(-151), true, false, ""},
- leTestCase{float32(-150.1), true, false, ""},
- leTestCase{float32(-150), true, false, ""},
- leTestCase{float32(-149.9), false, false, ""},
- leTestCase{float32(0), false, false, ""},
- leTestCase{float32(17), false, false, ""},
- leTestCase{float32(160), false, false, ""},
-
- leTestCase{float64(-(1 << 30)), true, false, ""},
- leTestCase{float64(-151), true, false, ""},
- leTestCase{float64(-150.1), true, false, ""},
- leTestCase{float64(-150), true, false, ""},
- leTestCase{float64(-149.9), false, false, ""},
- leTestCase{float64(0), false, false, ""},
- leTestCase{float64(17), false, false, ""},
- leTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) ZeroIntegerLiteral() {
- matcher := LessOrEqual(0)
- desc := matcher.Description()
- expectedDesc := "less than or equal to 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-(1 << 30), true, false, ""},
- leTestCase{-1, true, false, ""},
- leTestCase{0, true, false, ""},
- leTestCase{1, false, false, ""},
- leTestCase{17, false, false, ""},
- leTestCase{(1 << 30), false, false, ""},
-
- leTestCase{int(-(1 << 30)), true, false, ""},
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(0), true, false, ""},
- leTestCase{int(1), false, false, ""},
- leTestCase{int(17), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(0), true, false, ""},
- leTestCase{int8(1), false, false, ""},
-
- leTestCase{int16(-(1 << 14)), true, false, ""},
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(1), false, false, ""},
- leTestCase{int16(17), false, false, ""},
-
- leTestCase{int32(-(1 << 30)), true, false, ""},
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(0), true, false, ""},
- leTestCase{int32(1), false, false, ""},
- leTestCase{int32(17), false, false, ""},
-
- leTestCase{int64(-(1 << 30)), true, false, ""},
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(0), true, false, ""},
- leTestCase{int64(1), false, false, ""},
- leTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint((1 << 32) - 1), false, false, ""},
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(1), false, false, ""},
- leTestCase{uint(17), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(1), false, false, ""},
- leTestCase{uint8(17), false, false, ""},
- leTestCase{uint8(253), false, false, ""},
-
- leTestCase{uint16((1 << 16) - 1), false, false, ""},
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(1), false, false, ""},
- leTestCase{uint16(17), false, false, ""},
-
- leTestCase{uint32((1 << 32) - 1), false, false, ""},
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(1), false, false, ""},
- leTestCase{uint32(17), false, false, ""},
-
- leTestCase{uint64((1 << 64) - 1), false, false, ""},
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(1), false, false, ""},
- leTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-(1 << 30)), true, false, ""},
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(-0.1), true, false, ""},
- leTestCase{float32(-0.0), true, false, ""},
- leTestCase{float32(0), true, false, ""},
- leTestCase{float32(0.1), false, false, ""},
- leTestCase{float32(17), false, false, ""},
- leTestCase{float32(160), false, false, ""},
-
- leTestCase{float64(-(1 << 30)), true, false, ""},
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(-0.1), true, false, ""},
- leTestCase{float64(-0), true, false, ""},
- leTestCase{float64(0), true, false, ""},
- leTestCase{float64(0.1), false, false, ""},
- leTestCase{float64(17), false, false, ""},
- leTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) PositiveIntegerLiteral() {
- matcher := LessOrEqual(150)
- desc := matcher.Description()
- expectedDesc := "less than or equal to 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{149, true, false, ""},
- leTestCase{150, true, false, ""},
- leTestCase{151, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(149), true, false, ""},
- leTestCase{int(150), true, false, ""},
- leTestCase{int(151), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(0), true, false, ""},
- leTestCase{int8(17), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(149), true, false, ""},
- leTestCase{int16(150), true, false, ""},
- leTestCase{int16(151), false, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(149), true, false, ""},
- leTestCase{int32(150), true, false, ""},
- leTestCase{int32(151), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(149), true, false, ""},
- leTestCase{int64(150), true, false, ""},
- leTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(149), true, false, ""},
- leTestCase{uint(150), true, false, ""},
- leTestCase{uint(151), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(127), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(149), true, false, ""},
- leTestCase{uint16(150), true, false, ""},
- leTestCase{uint16(151), false, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(149), true, false, ""},
- leTestCase{uint32(150), true, false, ""},
- leTestCase{uint32(151), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(149), true, false, ""},
- leTestCase{uint64(150), true, false, ""},
- leTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(149), true, false, ""},
- leTestCase{float32(149.9), true, false, ""},
- leTestCase{float32(150), true, false, ""},
- leTestCase{float32(150.1), false, false, ""},
- leTestCase{float32(151), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(149), true, false, ""},
- leTestCase{float64(149.9), true, false, ""},
- leTestCase{float64(150), true, false, ""},
- leTestCase{float64(150.1), false, false, ""},
- leTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) NegativeFloatLiteral() {
- matcher := LessOrEqual(-150.1)
- desc := matcher.Description()
- expectedDesc := "less than or equal to -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-(1 << 30), true, false, ""},
- leTestCase{-151, true, false, ""},
- leTestCase{-150.1, true, false, ""},
- leTestCase{-150, false, false, ""},
- leTestCase{-149, false, false, ""},
- leTestCase{0, false, false, ""},
- leTestCase{17, false, false, ""},
-
- leTestCase{int(-(1 << 30)), true, false, ""},
- leTestCase{int(-151), true, false, ""},
- leTestCase{int(-150), false, false, ""},
- leTestCase{int(-149), false, false, ""},
- leTestCase{int(0), false, false, ""},
- leTestCase{int(17), false, false, ""},
-
- leTestCase{int8(-127), false, false, ""},
- leTestCase{int8(0), false, false, ""},
- leTestCase{int8(17), false, false, ""},
-
- leTestCase{int16(-(1 << 14)), true, false, ""},
- leTestCase{int16(-151), true, false, ""},
- leTestCase{int16(-150), false, false, ""},
- leTestCase{int16(-149), false, false, ""},
- leTestCase{int16(0), false, false, ""},
- leTestCase{int16(17), false, false, ""},
-
- leTestCase{int32(-(1 << 30)), true, false, ""},
- leTestCase{int32(-151), true, false, ""},
- leTestCase{int32(-150), false, false, ""},
- leTestCase{int32(-149), false, false, ""},
- leTestCase{int32(0), false, false, ""},
- leTestCase{int32(17), false, false, ""},
-
- leTestCase{int64(-(1 << 30)), true, false, ""},
- leTestCase{int64(-151), true, false, ""},
- leTestCase{int64(-150), false, false, ""},
- leTestCase{int64(-149), false, false, ""},
- leTestCase{int64(0), false, false, ""},
- leTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint((1 << 32) - 151), false, false, ""},
- leTestCase{uint(0), false, false, ""},
- leTestCase{uint(17), false, false, ""},
-
- leTestCase{uint8(0), false, false, ""},
- leTestCase{uint8(17), false, false, ""},
- leTestCase{uint8(253), false, false, ""},
-
- leTestCase{uint16((1 << 16) - 151), false, false, ""},
- leTestCase{uint16(0), false, false, ""},
- leTestCase{uint16(17), false, false, ""},
-
- leTestCase{uint32((1 << 32) - 151), false, false, ""},
- leTestCase{uint32(0), false, false, ""},
- leTestCase{uint32(17), false, false, ""},
-
- leTestCase{uint64((1 << 64) - 151), false, false, ""},
- leTestCase{uint64(0), false, false, ""},
- leTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-(1 << 30)), true, false, ""},
- leTestCase{float32(-151), true, false, ""},
- leTestCase{float32(-150.2), true, false, ""},
- leTestCase{float32(-150.1), true, false, ""},
- leTestCase{float32(-150), false, false, ""},
- leTestCase{float32(0), false, false, ""},
- leTestCase{float32(17), false, false, ""},
- leTestCase{float32(160), false, false, ""},
-
- leTestCase{float64(-(1 << 30)), true, false, ""},
- leTestCase{float64(-151), true, false, ""},
- leTestCase{float64(-150.2), true, false, ""},
- leTestCase{float64(-150.1), true, false, ""},
- leTestCase{float64(-150), false, false, ""},
- leTestCase{float64(0), false, false, ""},
- leTestCase{float64(17), false, false, ""},
- leTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) PositiveFloatLiteral() {
- matcher := LessOrEqual(149.9)
- desc := matcher.Description()
- expectedDesc := "less than or equal to 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{149, true, false, ""},
- leTestCase{149.9, true, false, ""},
- leTestCase{150, false, false, ""},
- leTestCase{151, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(149), true, false, ""},
- leTestCase{int(150), false, false, ""},
- leTestCase{int(151), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(0), true, false, ""},
- leTestCase{int8(17), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(149), true, false, ""},
- leTestCase{int16(150), false, false, ""},
- leTestCase{int16(151), false, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(149), true, false, ""},
- leTestCase{int32(150), false, false, ""},
- leTestCase{int32(151), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(149), true, false, ""},
- leTestCase{int64(150), false, false, ""},
- leTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(149), true, false, ""},
- leTestCase{uint(150), false, false, ""},
- leTestCase{uint(151), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(127), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(149), true, false, ""},
- leTestCase{uint16(150), false, false, ""},
- leTestCase{uint16(151), false, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(149), true, false, ""},
- leTestCase{uint32(150), false, false, ""},
- leTestCase{uint32(151), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(149), true, false, ""},
- leTestCase{uint64(150), false, false, ""},
- leTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(149), true, false, ""},
- leTestCase{float32(149.8), true, false, ""},
- leTestCase{float32(149.9), true, false, ""},
- leTestCase{float32(150), false, false, ""},
- leTestCase{float32(151), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(149), true, false, ""},
- leTestCase{float64(149.8), true, false, ""},
- leTestCase{float64(149.9), true, false, ""},
- leTestCase{float64(150), false, false, ""},
- leTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessOrEqual(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{kTwoTo25 + 0, true, false, ""},
- leTestCase{kTwoTo25 + 1, true, false, ""},
- leTestCase{kTwoTo25 + 2, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(kTwoTo25 + 0), true, false, ""},
- leTestCase{int(kTwoTo25 + 1), true, false, ""},
- leTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 0), true, false, ""},
- leTestCase{int32(kTwoTo25 + 1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 0), true, false, ""},
- leTestCase{int64(kTwoTo25 + 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(kTwoTo25 - 2), true, false, ""},
- leTestCase{float32(kTwoTo25 - 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 0), true, false, ""},
- leTestCase{float32(kTwoTo25 + 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 2), true, false, ""},
- leTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo25 - 2), true, false, ""},
- leTestCase{float64(kTwoTo25 - 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 0), true, false, ""},
- leTestCase{float64(kTwoTo25 + 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 2), false, false, ""},
- leTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessOrEqual(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{1 << 30, true, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(math.MaxInt32), true, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(math.MaxInt32), true, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo54 - 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 0), true, false, ""},
- leTestCase{int64(kTwoTo54 + 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(math.MaxUint32), true, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(math.MaxUint32), true, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo54 - 2), true, false, ""},
- leTestCase{float64(kTwoTo54 - 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 0), true, false, ""},
- leTestCase{float64(kTwoTo54 + 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 2), true, false, ""},
- leTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessOrEqual(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{kTwoTo25 + 0, true, false, ""},
- leTestCase{kTwoTo25 + 1, true, false, ""},
- leTestCase{kTwoTo25 + 2, false, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(kTwoTo25 + 0), true, false, ""},
- leTestCase{int(kTwoTo25 + 1), true, false, ""},
- leTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 0), true, false, ""},
- leTestCase{int32(kTwoTo25 + 1), true, false, ""},
- leTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 0), true, false, ""},
- leTestCase{int64(kTwoTo25 + 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(kTwoTo25 - 2), true, false, ""},
- leTestCase{float32(kTwoTo25 - 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 0), true, false, ""},
- leTestCase{float32(kTwoTo25 + 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 2), true, false, ""},
- leTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo25 - 2), true, false, ""},
- leTestCase{float64(kTwoTo25 - 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 0), true, false, ""},
- leTestCase{float64(kTwoTo25 + 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 2), false, false, ""},
- leTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessOrEqual(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{-1, true, false, ""},
- leTestCase{1 << 30, true, false, ""},
-
- leTestCase{int(-1), true, false, ""},
- leTestCase{int(math.MaxInt32), true, false, ""},
-
- leTestCase{int8(-1), true, false, ""},
- leTestCase{int8(127), true, false, ""},
-
- leTestCase{int16(-1), true, false, ""},
- leTestCase{int16(0), true, false, ""},
- leTestCase{int16(32767), true, false, ""},
-
- leTestCase{int32(-1), true, false, ""},
- leTestCase{int32(math.MaxInt32), true, false, ""},
-
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo54 - 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 0), true, false, ""},
- leTestCase{int64(kTwoTo54 + 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint(0), true, false, ""},
- leTestCase{uint(math.MaxUint32), true, false, ""},
-
- leTestCase{uint8(0), true, false, ""},
- leTestCase{uint8(255), true, false, ""},
-
- leTestCase{uint16(0), true, false, ""},
- leTestCase{uint16(65535), true, false, ""},
-
- leTestCase{uint32(0), true, false, ""},
- leTestCase{uint32(math.MaxUint32), true, false, ""},
-
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo54 - 2), true, false, ""},
- leTestCase{float64(kTwoTo54 - 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 0), true, false, ""},
- leTestCase{float64(kTwoTo54 + 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 2), true, false, ""},
- leTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessOrEqual(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo25 - 2), true, false, ""},
- leTestCase{int64(kTwoTo25 - 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 0), true, false, ""},
- leTestCase{int64(kTwoTo25 + 1), true, false, ""},
- leTestCase{int64(kTwoTo25 + 2), true, false, ""},
- leTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo25 - 2), true, false, ""},
- leTestCase{uint64(kTwoTo25 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 2), true, false, ""},
- leTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Floating point.
- leTestCase{float32(-1), true, false, ""},
- leTestCase{float32(kTwoTo25 - 2), true, false, ""},
- leTestCase{float32(kTwoTo25 - 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 0), true, false, ""},
- leTestCase{float32(kTwoTo25 + 1), true, false, ""},
- leTestCase{float32(kTwoTo25 + 2), true, false, ""},
- leTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo25 - 2), true, false, ""},
- leTestCase{float64(kTwoTo25 - 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 0), true, false, ""},
- leTestCase{float64(kTwoTo25 + 1), true, false, ""},
- leTestCase{float64(kTwoTo25 + 2), true, false, ""},
- leTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessOrEqual(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than or equal to 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- // Signed integers.
- leTestCase{int64(-1), true, false, ""},
- leTestCase{int64(kTwoTo54 - 2), true, false, ""},
- leTestCase{int64(kTwoTo54 - 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 0), true, false, ""},
- leTestCase{int64(kTwoTo54 + 1), true, false, ""},
- leTestCase{int64(kTwoTo54 + 2), true, false, ""},
- leTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- // Unsigned integers.
- leTestCase{uint64(0), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 2), true, false, ""},
- leTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 1), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 2), true, false, ""},
- leTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Floating point.
- leTestCase{float64(-1), true, false, ""},
- leTestCase{float64(kTwoTo54 - 2), true, false, ""},
- leTestCase{float64(kTwoTo54 - 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 0), true, false, ""},
- leTestCase{float64(kTwoTo54 + 1), true, false, ""},
- leTestCase{float64(kTwoTo54 + 2), true, false, ""},
- leTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessOrEqualTest) EmptyString() {
- matcher := LessOrEqual("")
- desc := matcher.Description()
- expectedDesc := "less than or equal to \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- leTestCase{"", true, false, ""},
- leTestCase{"\x00", false, false, ""},
- leTestCase{"a", false, false, ""},
- leTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) SingleNullByte() {
- matcher := LessOrEqual("\x00")
- desc := matcher.Description()
- expectedDesc := "less than or equal to \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- leTestCase{"", true, false, ""},
- leTestCase{"\x00", true, false, ""},
- leTestCase{"\x00\x00", false, false, ""},
- leTestCase{"a", false, false, ""},
- leTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessOrEqualTest) LongerString() {
- matcher := LessOrEqual("foo\x00")
- desc := matcher.Description()
- expectedDesc := "less than or equal to \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []leTestCase{
- leTestCase{"", true, false, ""},
- leTestCase{"\x00", true, false, ""},
- leTestCase{"bar", true, false, ""},
- leTestCase{"foo", true, false, ""},
- leTestCase{"foo\x00", true, false, ""},
- leTestCase{"foo\x00\x00", false, false, ""},
- leTestCase{"fooa", false, false, ""},
- leTestCase{"qux", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than_test.go
deleted file mode 100644
index 59f5b7f56bd..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/less_than_test.go
+++ /dev/null
@@ -1,1057 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "math"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type LessThanTest struct {
-}
-
-func init() { RegisterTestSuite(&LessThanTest{}) }
-
-type ltTestCase struct {
- candidate interface{}
- expectedResult bool
- shouldBeFatal bool
- expectedError string
-}
-
-func (t *LessThanTest) checkTestCases(matcher Matcher, cases []ltTestCase) {
- for i, c := range cases {
- err := matcher.Matches(c.candidate)
-
- ExpectThat(
- (err == nil),
- Equals(c.expectedResult),
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- if err == nil {
- continue
- }
-
- _, isFatal := err.(*FatalError)
- ExpectEq(
- c.shouldBeFatal,
- isFatal,
- "Case %d (candidate %v)",
- i,
- c.candidate)
-
- ExpectThat(
- err,
- Error(Equals(c.expectedError)),
- "Case %d (candidate %v)",
- i,
- c.candidate)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) IntegerCandidateBadTypes() {
- matcher := LessThan(int(-150))
-
- cases := []ltTestCase{
- ltTestCase{true, false, true, "which is not comparable"},
- ltTestCase{complex64(-151), false, true, "which is not comparable"},
- ltTestCase{complex128(-151), false, true, "which is not comparable"},
- ltTestCase{[...]int{-151}, false, true, "which is not comparable"},
- ltTestCase{make(chan int), false, true, "which is not comparable"},
- ltTestCase{func() {}, false, true, "which is not comparable"},
- ltTestCase{map[int]int{}, false, true, "which is not comparable"},
- ltTestCase{&ltTestCase{}, false, true, "which is not comparable"},
- ltTestCase{make([]int, 0), false, true, "which is not comparable"},
- ltTestCase{"-151", false, true, "which is not comparable"},
- ltTestCase{ltTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) FloatCandidateBadTypes() {
- matcher := LessThan(float32(-150))
-
- cases := []ltTestCase{
- ltTestCase{true, false, true, "which is not comparable"},
- ltTestCase{complex64(-151), false, true, "which is not comparable"},
- ltTestCase{complex128(-151), false, true, "which is not comparable"},
- ltTestCase{[...]int{-151}, false, true, "which is not comparable"},
- ltTestCase{make(chan int), false, true, "which is not comparable"},
- ltTestCase{func() {}, false, true, "which is not comparable"},
- ltTestCase{map[int]int{}, false, true, "which is not comparable"},
- ltTestCase{&ltTestCase{}, false, true, "which is not comparable"},
- ltTestCase{make([]int, 0), false, true, "which is not comparable"},
- ltTestCase{"-151", false, true, "which is not comparable"},
- ltTestCase{ltTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) StringCandidateBadTypes() {
- matcher := LessThan("17")
-
- cases := []ltTestCase{
- ltTestCase{true, false, true, "which is not comparable"},
- ltTestCase{int(0), false, true, "which is not comparable"},
- ltTestCase{int8(0), false, true, "which is not comparable"},
- ltTestCase{int16(0), false, true, "which is not comparable"},
- ltTestCase{int32(0), false, true, "which is not comparable"},
- ltTestCase{int64(0), false, true, "which is not comparable"},
- ltTestCase{uint(0), false, true, "which is not comparable"},
- ltTestCase{uint8(0), false, true, "which is not comparable"},
- ltTestCase{uint16(0), false, true, "which is not comparable"},
- ltTestCase{uint32(0), false, true, "which is not comparable"},
- ltTestCase{uint64(0), false, true, "which is not comparable"},
- ltTestCase{float32(0), false, true, "which is not comparable"},
- ltTestCase{float64(0), false, true, "which is not comparable"},
- ltTestCase{complex64(-151), false, true, "which is not comparable"},
- ltTestCase{complex128(-151), false, true, "which is not comparable"},
- ltTestCase{[...]int{-151}, false, true, "which is not comparable"},
- ltTestCase{make(chan int), false, true, "which is not comparable"},
- ltTestCase{func() {}, false, true, "which is not comparable"},
- ltTestCase{map[int]int{}, false, true, "which is not comparable"},
- ltTestCase{&ltTestCase{}, false, true, "which is not comparable"},
- ltTestCase{make([]int, 0), false, true, "which is not comparable"},
- ltTestCase{ltTestCase{}, false, true, "which is not comparable"},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) BadArgument() {
- panicked := false
-
- defer func() {
- ExpectThat(panicked, Equals(true))
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- LessThan(complex128(0))
-}
-
-////////////////////////////////////////////////////////////////////////
-// Integer literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) NegativeIntegerLiteral() {
- matcher := LessThan(-150)
- desc := matcher.Description()
- expectedDesc := "less than -150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-(1 << 30), true, false, ""},
- ltTestCase{-151, true, false, ""},
- ltTestCase{-150, false, false, ""},
- ltTestCase{0, false, false, ""},
- ltTestCase{17, false, false, ""},
-
- ltTestCase{int(-(1 << 30)), true, false, ""},
- ltTestCase{int(-151), true, false, ""},
- ltTestCase{int(-150), false, false, ""},
- ltTestCase{int(0), false, false, ""},
- ltTestCase{int(17), false, false, ""},
-
- ltTestCase{int8(-127), false, false, ""},
- ltTestCase{int8(0), false, false, ""},
- ltTestCase{int8(17), false, false, ""},
-
- ltTestCase{int16(-(1 << 14)), true, false, ""},
- ltTestCase{int16(-151), true, false, ""},
- ltTestCase{int16(-150), false, false, ""},
- ltTestCase{int16(0), false, false, ""},
- ltTestCase{int16(17), false, false, ""},
-
- ltTestCase{int32(-(1 << 30)), true, false, ""},
- ltTestCase{int32(-151), true, false, ""},
- ltTestCase{int32(-150), false, false, ""},
- ltTestCase{int32(0), false, false, ""},
- ltTestCase{int32(17), false, false, ""},
-
- ltTestCase{int64(-(1 << 30)), true, false, ""},
- ltTestCase{int64(-151), true, false, ""},
- ltTestCase{int64(-150), false, false, ""},
- ltTestCase{int64(0), false, false, ""},
- ltTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint((1 << 32) - 151), false, false, ""},
- ltTestCase{uint(0), false, false, ""},
- ltTestCase{uint(17), false, false, ""},
-
- ltTestCase{uint8(0), false, false, ""},
- ltTestCase{uint8(17), false, false, ""},
- ltTestCase{uint8(253), false, false, ""},
-
- ltTestCase{uint16((1 << 16) - 151), false, false, ""},
- ltTestCase{uint16(0), false, false, ""},
- ltTestCase{uint16(17), false, false, ""},
-
- ltTestCase{uint32((1 << 32) - 151), false, false, ""},
- ltTestCase{uint32(0), false, false, ""},
- ltTestCase{uint32(17), false, false, ""},
-
- ltTestCase{uint64((1 << 64) - 151), false, false, ""},
- ltTestCase{uint64(0), false, false, ""},
- ltTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-(1 << 30)), true, false, ""},
- ltTestCase{float32(-151), true, false, ""},
- ltTestCase{float32(-150.1), true, false, ""},
- ltTestCase{float32(-150), false, false, ""},
- ltTestCase{float32(-149.9), false, false, ""},
- ltTestCase{float32(0), false, false, ""},
- ltTestCase{float32(17), false, false, ""},
- ltTestCase{float32(160), false, false, ""},
-
- ltTestCase{float64(-(1 << 30)), true, false, ""},
- ltTestCase{float64(-151), true, false, ""},
- ltTestCase{float64(-150.1), true, false, ""},
- ltTestCase{float64(-150), false, false, ""},
- ltTestCase{float64(-149.9), false, false, ""},
- ltTestCase{float64(0), false, false, ""},
- ltTestCase{float64(17), false, false, ""},
- ltTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) ZeroIntegerLiteral() {
- matcher := LessThan(0)
- desc := matcher.Description()
- expectedDesc := "less than 0"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-(1 << 30), true, false, ""},
- ltTestCase{-1, true, false, ""},
- ltTestCase{0, false, false, ""},
- ltTestCase{1, false, false, ""},
- ltTestCase{17, false, false, ""},
- ltTestCase{(1 << 30), false, false, ""},
-
- ltTestCase{int(-(1 << 30)), true, false, ""},
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(0), false, false, ""},
- ltTestCase{int(1), false, false, ""},
- ltTestCase{int(17), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(0), false, false, ""},
- ltTestCase{int8(1), false, false, ""},
-
- ltTestCase{int16(-(1 << 14)), true, false, ""},
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), false, false, ""},
- ltTestCase{int16(1), false, false, ""},
- ltTestCase{int16(17), false, false, ""},
-
- ltTestCase{int32(-(1 << 30)), true, false, ""},
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(0), false, false, ""},
- ltTestCase{int32(1), false, false, ""},
- ltTestCase{int32(17), false, false, ""},
-
- ltTestCase{int64(-(1 << 30)), true, false, ""},
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(0), false, false, ""},
- ltTestCase{int64(1), false, false, ""},
- ltTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint((1 << 32) - 1), false, false, ""},
- ltTestCase{uint(0), false, false, ""},
- ltTestCase{uint(17), false, false, ""},
-
- ltTestCase{uint8(0), false, false, ""},
- ltTestCase{uint8(17), false, false, ""},
- ltTestCase{uint8(253), false, false, ""},
-
- ltTestCase{uint16((1 << 16) - 1), false, false, ""},
- ltTestCase{uint16(0), false, false, ""},
- ltTestCase{uint16(17), false, false, ""},
-
- ltTestCase{uint32((1 << 32) - 1), false, false, ""},
- ltTestCase{uint32(0), false, false, ""},
- ltTestCase{uint32(17), false, false, ""},
-
- ltTestCase{uint64((1 << 64) - 1), false, false, ""},
- ltTestCase{uint64(0), false, false, ""},
- ltTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-(1 << 30)), true, false, ""},
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(-0.1), true, false, ""},
- ltTestCase{float32(-0.0), false, false, ""},
- ltTestCase{float32(0), false, false, ""},
- ltTestCase{float32(0.1), false, false, ""},
- ltTestCase{float32(17), false, false, ""},
- ltTestCase{float32(160), false, false, ""},
-
- ltTestCase{float64(-(1 << 30)), true, false, ""},
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(-0.1), true, false, ""},
- ltTestCase{float64(-0), false, false, ""},
- ltTestCase{float64(0), false, false, ""},
- ltTestCase{float64(17), false, false, ""},
- ltTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) PositiveIntegerLiteral() {
- matcher := LessThan(150)
- desc := matcher.Description()
- expectedDesc := "less than 150"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{149, true, false, ""},
- ltTestCase{150, false, false, ""},
- ltTestCase{151, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(149), true, false, ""},
- ltTestCase{int(150), false, false, ""},
- ltTestCase{int(151), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(0), true, false, ""},
- ltTestCase{int8(17), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(149), true, false, ""},
- ltTestCase{int16(150), false, false, ""},
- ltTestCase{int16(151), false, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(149), true, false, ""},
- ltTestCase{int32(150), false, false, ""},
- ltTestCase{int32(151), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(149), true, false, ""},
- ltTestCase{int64(150), false, false, ""},
- ltTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(149), true, false, ""},
- ltTestCase{uint(150), false, false, ""},
- ltTestCase{uint(151), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(127), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(149), true, false, ""},
- ltTestCase{uint16(150), false, false, ""},
- ltTestCase{uint16(151), false, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(149), true, false, ""},
- ltTestCase{uint32(150), false, false, ""},
- ltTestCase{uint32(151), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(149), true, false, ""},
- ltTestCase{uint64(150), false, false, ""},
- ltTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(149), true, false, ""},
- ltTestCase{float32(149.9), true, false, ""},
- ltTestCase{float32(150), false, false, ""},
- ltTestCase{float32(150.1), false, false, ""},
- ltTestCase{float32(151), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(149), true, false, ""},
- ltTestCase{float64(149.9), true, false, ""},
- ltTestCase{float64(150), false, false, ""},
- ltTestCase{float64(150.1), false, false, ""},
- ltTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Float literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) NegativeFloatLiteral() {
- matcher := LessThan(-150.1)
- desc := matcher.Description()
- expectedDesc := "less than -150.1"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-(1 << 30), true, false, ""},
- ltTestCase{-151, true, false, ""},
- ltTestCase{-150, false, false, ""},
- ltTestCase{0, false, false, ""},
- ltTestCase{17, false, false, ""},
-
- ltTestCase{int(-(1 << 30)), true, false, ""},
- ltTestCase{int(-151), true, false, ""},
- ltTestCase{int(-150), false, false, ""},
- ltTestCase{int(0), false, false, ""},
- ltTestCase{int(17), false, false, ""},
-
- ltTestCase{int8(-127), false, false, ""},
- ltTestCase{int8(0), false, false, ""},
- ltTestCase{int8(17), false, false, ""},
-
- ltTestCase{int16(-(1 << 14)), true, false, ""},
- ltTestCase{int16(-151), true, false, ""},
- ltTestCase{int16(-150), false, false, ""},
- ltTestCase{int16(0), false, false, ""},
- ltTestCase{int16(17), false, false, ""},
-
- ltTestCase{int32(-(1 << 30)), true, false, ""},
- ltTestCase{int32(-151), true, false, ""},
- ltTestCase{int32(-150), false, false, ""},
- ltTestCase{int32(0), false, false, ""},
- ltTestCase{int32(17), false, false, ""},
-
- ltTestCase{int64(-(1 << 30)), true, false, ""},
- ltTestCase{int64(-151), true, false, ""},
- ltTestCase{int64(-150), false, false, ""},
- ltTestCase{int64(0), false, false, ""},
- ltTestCase{int64(17), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint((1 << 32) - 151), false, false, ""},
- ltTestCase{uint(0), false, false, ""},
- ltTestCase{uint(17), false, false, ""},
-
- ltTestCase{uint8(0), false, false, ""},
- ltTestCase{uint8(17), false, false, ""},
- ltTestCase{uint8(253), false, false, ""},
-
- ltTestCase{uint16((1 << 16) - 151), false, false, ""},
- ltTestCase{uint16(0), false, false, ""},
- ltTestCase{uint16(17), false, false, ""},
-
- ltTestCase{uint32((1 << 32) - 151), false, false, ""},
- ltTestCase{uint32(0), false, false, ""},
- ltTestCase{uint32(17), false, false, ""},
-
- ltTestCase{uint64((1 << 64) - 151), false, false, ""},
- ltTestCase{uint64(0), false, false, ""},
- ltTestCase{uint64(17), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-(1 << 30)), true, false, ""},
- ltTestCase{float32(-151), true, false, ""},
- ltTestCase{float32(-150.2), true, false, ""},
- ltTestCase{float32(-150.1), false, false, ""},
- ltTestCase{float32(-150), false, false, ""},
- ltTestCase{float32(0), false, false, ""},
- ltTestCase{float32(17), false, false, ""},
- ltTestCase{float32(160), false, false, ""},
-
- ltTestCase{float64(-(1 << 30)), true, false, ""},
- ltTestCase{float64(-151), true, false, ""},
- ltTestCase{float64(-150.2), true, false, ""},
- ltTestCase{float64(-150.1), false, false, ""},
- ltTestCase{float64(-150), false, false, ""},
- ltTestCase{float64(0), false, false, ""},
- ltTestCase{float64(17), false, false, ""},
- ltTestCase{float64(160), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) PositiveFloatLiteral() {
- matcher := LessThan(149.9)
- desc := matcher.Description()
- expectedDesc := "less than 149.9"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{149, true, false, ""},
- ltTestCase{150, false, false, ""},
- ltTestCase{151, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(149), true, false, ""},
- ltTestCase{int(150), false, false, ""},
- ltTestCase{int(151), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(0), true, false, ""},
- ltTestCase{int8(17), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(149), true, false, ""},
- ltTestCase{int16(150), false, false, ""},
- ltTestCase{int16(151), false, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(149), true, false, ""},
- ltTestCase{int32(150), false, false, ""},
- ltTestCase{int32(151), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(149), true, false, ""},
- ltTestCase{int64(150), false, false, ""},
- ltTestCase{int64(151), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(149), true, false, ""},
- ltTestCase{uint(150), false, false, ""},
- ltTestCase{uint(151), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(127), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(149), true, false, ""},
- ltTestCase{uint16(150), false, false, ""},
- ltTestCase{uint16(151), false, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(149), true, false, ""},
- ltTestCase{uint32(150), false, false, ""},
- ltTestCase{uint32(151), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(149), true, false, ""},
- ltTestCase{uint64(150), false, false, ""},
- ltTestCase{uint64(151), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(149), true, false, ""},
- ltTestCase{float32(149.8), true, false, ""},
- ltTestCase{float32(149.9), false, false, ""},
- ltTestCase{float32(150), false, false, ""},
- ltTestCase{float32(151), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(149), true, false, ""},
- ltTestCase{float64(149.8), true, false, ""},
- ltTestCase{float64(149.9), false, false, ""},
- ltTestCase{float64(150), false, false, ""},
- ltTestCase{float64(151), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Subtle cases
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) Int64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessThan(int64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{kTwoTo25 + 0, true, false, ""},
- ltTestCase{kTwoTo25 + 1, false, false, ""},
- ltTestCase{kTwoTo25 + 2, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 1), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Int64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessThan(int64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{1 << 30, true, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(math.MaxInt32), true, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(math.MaxInt32), true, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Uint64NotExactlyRepresentableBySinglePrecision() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessThan(uint64(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 33554433"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{kTwoTo25 + 0, true, false, ""},
- ltTestCase{kTwoTo25 + 1, false, false, ""},
- ltTestCase{kTwoTo25 + 2, false, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint32(kTwoTo25 + 2), false, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 1), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 0), true, false, ""},
- ltTestCase{float64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Uint64NotExactlyRepresentableByDoublePrecision() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessThan(uint64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 18014398509481985"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{-1, true, false, ""},
- ltTestCase{1 << 30, true, false, ""},
-
- ltTestCase{int(-1), true, false, ""},
- ltTestCase{int(math.MaxInt32), true, false, ""},
-
- ltTestCase{int8(-1), true, false, ""},
- ltTestCase{int8(127), true, false, ""},
-
- ltTestCase{int16(-1), true, false, ""},
- ltTestCase{int16(0), true, false, ""},
- ltTestCase{int16(32767), true, false, ""},
-
- ltTestCase{int32(-1), true, false, ""},
- ltTestCase{int32(math.MaxInt32), true, false, ""},
-
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{int64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 2), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint(0), true, false, ""},
- ltTestCase{uint(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint8(0), true, false, ""},
- ltTestCase{uint8(255), true, false, ""},
-
- ltTestCase{uint16(0), true, false, ""},
- ltTestCase{uint16(65535), true, false, ""},
-
- ltTestCase{uint32(0), true, false, ""},
- ltTestCase{uint32(math.MaxUint32), true, false, ""},
-
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 1), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 2), false, false, ""},
-
- // Floating point.
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Float32AboveExactIntegerRange() {
- // Single-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^25-1, 2^25+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo25 = 1 << 25
- matcher := LessThan(float32(kTwoTo25 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 3.3554432e+07"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{int64(kTwoTo25 - 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 0), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{int64(kTwoTo25 + 3), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{uint64(kTwoTo25 - 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 0), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{uint64(kTwoTo25 + 3), false, false, ""},
-
- // Floating point.
- ltTestCase{float32(-1), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float32(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float32(kTwoTo25 + 3), false, false, ""},
-
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo25 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo25 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) Float64AboveExactIntegerRange() {
- // Double-precision floats don't have enough bits to represent the integers
- // near this one distinctly, so [2^54-1, 2^54+2] all receive the same value
- // and should be treated as equivalent when floats are in the mix.
- const kTwoTo54 = 1 << 54
- matcher := LessThan(float64(kTwoTo54 + 1))
-
- desc := matcher.Description()
- expectedDesc := "less than 1.8014398509481984e+16"
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- // Signed integers.
- ltTestCase{int64(-1), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{int64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{int64(kTwoTo54 + 3), false, false, ""},
-
- // Unsigned integers.
- ltTestCase{uint64(0), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{uint64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{uint64(kTwoTo54 + 3), false, false, ""},
-
- // Floating point.
- ltTestCase{float64(-1), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 2), true, false, ""},
- ltTestCase{float64(kTwoTo54 - 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 0), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 1), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 2), false, false, ""},
- ltTestCase{float64(kTwoTo54 + 3), false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-////////////////////////////////////////////////////////////////////////
-// String literals
-////////////////////////////////////////////////////////////////////////
-
-func (t *LessThanTest) EmptyString() {
- matcher := LessThan("")
- desc := matcher.Description()
- expectedDesc := "less than \"\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- ltTestCase{"", false, false, ""},
- ltTestCase{"\x00", false, false, ""},
- ltTestCase{"a", false, false, ""},
- ltTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) SingleNullByte() {
- matcher := LessThan("\x00")
- desc := matcher.Description()
- expectedDesc := "less than \"\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- ltTestCase{"", true, false, ""},
- ltTestCase{"\x00", false, false, ""},
- ltTestCase{"a", false, false, ""},
- ltTestCase{"foo", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
-
-func (t *LessThanTest) LongerString() {
- matcher := LessThan("foo\x00")
- desc := matcher.Description()
- expectedDesc := "less than \"foo\x00\""
-
- ExpectThat(desc, Equals(expectedDesc))
-
- cases := []ltTestCase{
- ltTestCase{"", true, false, ""},
- ltTestCase{"\x00", true, false, ""},
- ltTestCase{"bar", true, false, ""},
- ltTestCase{"foo", true, false, ""},
- ltTestCase{"foo\x00", false, false, ""},
- ltTestCase{"fooa", false, false, ""},
- ltTestCase{"qux", false, false, ""},
- }
-
- t.checkTestCases(matcher, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp_test.go
deleted file mode 100644
index 031c6cb3eff..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/matches_regexp_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type MatchesRegexpTest struct {
-}
-
-func init() { RegisterTestSuite(&MatchesRegexpTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *MatchesRegexpTest) Description() {
- m := MatchesRegexp("foo.*bar")
- ExpectEq("matches regexp \"foo.*bar\"", m.Description())
-}
-
-func (t *MatchesRegexpTest) InvalidRegexp() {
- ExpectThat(
- func() { MatchesRegexp("(foo") },
- Panics(HasSubstr("missing closing )")))
-}
-
-func (t *MatchesRegexpTest) CandidateIsNil() {
- m := MatchesRegexp("")
- err := m.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a string or []byte")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *MatchesRegexpTest) CandidateIsInteger() {
- m := MatchesRegexp("")
- err := m.Matches(17)
-
- ExpectThat(err, Error(Equals("which is not a string or []byte")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *MatchesRegexpTest) NonMatchingCandidates() {
- m := MatchesRegexp("fo[op]\\s+x")
- var err error
-
- err = m.Matches("fon x")
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-
- err = m.Matches("fopx")
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-
- err = m.Matches("fop ")
- ExpectThat(err, Error(Equals("")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *MatchesRegexpTest) MatchingCandidates() {
- m := MatchesRegexp("fo[op]\\s+x")
- var err error
-
- err = m.Matches("foo x")
- ExpectEq(nil, err)
-
- err = m.Matches("fop x")
- ExpectEq(nil, err)
-
- err = m.Matches("blah blah foo x blah blah")
- ExpectEq(nil, err)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/not_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/not_test.go
deleted file mode 100644
index 9c65b85ef87..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/not_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "testing"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type fakeMatcher struct {
- matchFunc func(interface{}) error
- description string
-}
-
-func (m *fakeMatcher) Matches(c interface{}) error {
- return m.matchFunc(c)
-}
-
-func (m *fakeMatcher) Description() string {
- return m.description
-}
-
-type NotTest struct {
-
-}
-
-func init() { RegisterTestSuite(&NotTest{}) }
-func TestOgletest(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *NotTest) CallsWrapped() {
- var suppliedCandidate interface{}
- matchFunc := func(c interface{}) error {
- suppliedCandidate = c
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- matcher.Matches(17)
- ExpectThat(suppliedCandidate, Equals(17))
-}
-
-func (t *NotTest) WrappedReturnsTrue() {
- matchFunc := func(c interface{}) error {
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("")))
-}
-
-func (t *NotTest) WrappedReturnsNonFatalError() {
- matchFunc := func(c interface{}) error {
- return errors.New("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- err := matcher.Matches(0)
- ExpectEq(nil, err)
-}
-
-func (t *NotTest) WrappedReturnsFatalError() {
- matchFunc := func(c interface{}) error {
- return NewFatalError("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Not(wrapped)
-
- err := matcher.Matches(0)
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *NotTest) Description() {
- wrapped := &fakeMatcher{nil, "taco"}
- matcher := Not(wrapped)
-
- ExpectEq("not(taco)", matcher.Description())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/panics_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/panics_test.go
deleted file mode 100644
index fbb66bf31e2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/panics_test.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type PanicsTest struct {
- matcherCalled bool
- suppliedCandidate interface{}
- wrappedError error
-
- matcher Matcher
-}
-
-func init() { RegisterTestSuite(&PanicsTest{}) }
-
-func (t *PanicsTest) SetUp(i *TestInfo) {
- wrapped := &fakeMatcher{
- func(c interface{}) error {
- t.matcherCalled = true
- t.suppliedCandidate = c
- return t.wrappedError
- },
- "foo",
- }
-
- t.matcher = Panics(wrapped)
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *PanicsTest) Description() {
- ExpectThat(t.matcher.Description(), Equals("panics with: foo"))
-}
-
-func (t *PanicsTest) CandidateIsNil() {
- err := t.matcher.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a zero-arg function")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PanicsTest) CandidateIsString() {
- err := t.matcher.Matches("taco")
-
- ExpectThat(err, Error(Equals("which is not a zero-arg function")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PanicsTest) CandidateTakesArgs() {
- err := t.matcher.Matches(func(i int) string { return "" })
-
- ExpectThat(err, Error(Equals("which is not a zero-arg function")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PanicsTest) CallsFunction() {
- callCount := 0
- t.matcher.Matches(func() string {
- callCount++
- return ""
- })
-
- ExpectThat(callCount, Equals(1))
-}
-
-func (t *PanicsTest) FunctionDoesntPanic() {
- err := t.matcher.Matches(func() {})
-
- ExpectThat(err, Error(Equals("which didn't panic")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) CallsWrappedMatcher() {
- expectedErr := 17
- t.wrappedError = errors.New("")
- t.matcher.Matches(func() { panic(expectedErr) })
-
- ExpectThat(t.suppliedCandidate, Equals(expectedErr))
-}
-
-func (t *PanicsTest) WrappedReturnsTrue() {
- err := t.matcher.Matches(func() { panic("") })
-
- ExpectEq(nil, err)
-}
-
-func (t *PanicsTest) WrappedReturnsFatalErrorWithoutText() {
- t.wrappedError = NewFatalError("")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) WrappedReturnsFatalErrorWithText() {
- t.wrappedError = NewFatalError("which blah")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17, which blah")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) WrappedReturnsNonFatalErrorWithoutText() {
- t.wrappedError = errors.New("")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17")))
- ExpectFalse(isFatal(err))
-}
-
-func (t *PanicsTest) WrappedReturnsNonFatalErrorWithText() {
- t.wrappedError = errors.New("which blah")
- err := t.matcher.Matches(func() { panic(17) })
-
- ExpectThat(err, Error(Equals("which panicked with: 17, which blah")))
- ExpectFalse(isFatal(err))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee_test.go
deleted file mode 100644
index 3bb72a702be..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglematchers/pointee_test.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglematchers_test
-
-import (
- "errors"
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "testing"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type PointeeTest struct {}
-func init() { RegisterTestSuite(&PointeeTest{}) }
-
-func TestPointee(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *PointeeTest) Description() {
- wrapped := &fakeMatcher{nil, "taco"}
- matcher := Pointee(wrapped)
-
- ExpectEq("pointee(taco)", matcher.Description())
-}
-
-func (t *PointeeTest) CandidateIsNotAPointer() {
- matcher := Pointee(HasSubstr(""))
- err := matcher.Matches([]byte{})
-
- ExpectThat(err, Error(Equals("which is not a pointer")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PointeeTest) CandidateIsANilLiteral() {
- matcher := Pointee(HasSubstr(""))
- err := matcher.Matches(nil)
-
- ExpectThat(err, Error(Equals("which is not a pointer")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PointeeTest) CandidateIsANilPointer() {
- matcher := Pointee(HasSubstr(""))
- err := matcher.Matches((*int)(nil))
-
- ExpectThat(err, Error(Equals("")))
- ExpectTrue(isFatal(err))
-}
-
-func (t *PointeeTest) CallsWrapped() {
- var suppliedCandidate interface{}
- matchFunc := func(c interface{}) error {
- suppliedCandidate = c
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- someSlice := []byte{}
- matcher.Matches(&someSlice)
- ExpectThat(suppliedCandidate, IdenticalTo(someSlice))
-}
-
-func (t *PointeeTest) WrappedReturnsOkay() {
- matchFunc := func(c interface{}) error {
- return nil
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- err := matcher.Matches(new(int))
- ExpectEq(nil, err)
-}
-
-func (t *PointeeTest) WrappedReturnsNonFatalNonEmptyError() {
- matchFunc := func(c interface{}) error {
- return errors.New("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectFalse(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *PointeeTest) WrappedReturnsNonFatalEmptyError() {
- matchFunc := func(c interface{}) error {
- return errors.New("")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectFalse(isFatal(err))
- ExpectThat(err, Error(HasSubstr("whose pointee")))
- ExpectThat(err, Error(HasSubstr("17")))
-}
-
-func (t *PointeeTest) WrappedReturnsFatalNonEmptyError() {
- matchFunc := func(c interface{}) error {
- return NewFatalError("taco")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(Equals("taco")))
-}
-
-func (t *PointeeTest) WrappedReturnsFatalEmptyError() {
- matchFunc := func(c interface{}) error {
- return NewFatalError("")
- }
-
- wrapped := &fakeMatcher{matchFunc, ""}
- matcher := Pointee(wrapped)
-
- i := 17
- err := matcher.Matches(&i)
- ExpectTrue(isFatal(err))
- ExpectThat(err, Error(HasSubstr("whose pointee")))
- ExpectThat(err, Error(HasSubstr("17")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/controller_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/controller_test.go
deleted file mode 100644
index 0ff5e5c41bb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/controller_test.go
+++ /dev/null
@@ -1,1249 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/oglemock"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "reflect"
-)
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-type errorReport struct {
- fileName string
- lineNumber int
- err error
-}
-
-type fakeErrorReporter struct {
- errors []errorReport
- fatalErrors []errorReport
-}
-
-func (r *fakeErrorReporter) ReportError(fileName string, lineNumber int, err error) {
- report := errorReport{fileName, lineNumber, err}
- r.errors = append(r.errors, report)
-}
-
-func (r *fakeErrorReporter) ReportFatalError(fileName string, lineNumber int, err error) {
- report := errorReport{fileName, lineNumber, err}
- r.fatalErrors = append(r.fatalErrors, report)
-}
-
-type trivialMockObject struct {
- id uintptr
- desc string
-}
-
-func (o *trivialMockObject) Oglemock_Id() uintptr {
- return o.id
-}
-
-func (o *trivialMockObject) Oglemock_Description() string {
- return o.desc
-}
-
-// Method being mocked
-func (o *trivialMockObject) StringToInt(s string) int {
- return 0
-}
-
-// Method being mocked
-func (o *trivialMockObject) TwoIntsToString(i, j int) string {
- return ""
-}
-
-type ControllerTest struct {
- reporter fakeErrorReporter
- controller Controller
-
- mock1 MockObject
- mock2 MockObject
-}
-
-func (t *ControllerTest) SetUp(c *TestInfo) {
- t.reporter.errors = make([]errorReport, 0)
- t.reporter.fatalErrors = make([]errorReport, 0)
- t.controller = NewController(&t.reporter)
-
- t.mock1 = &trivialMockObject{17, "taco"}
- t.mock2 = &trivialMockObject{19, "burrito"}
-}
-
-func init() { RegisterTestSuite(&ControllerTest{}) }
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *ControllerTest) FinishWithoutAnyEvents() {
- t.controller.Finish()
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) HandleCallForUnknownObject() {
- p := []byte{255}
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "taco.go",
- 112,
- []interface{}{p})
-
- // The error should be reported immediately.
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("taco.go", t.reporter.errors[0].fileName)
- ExpectEq(112, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unexpected")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("[255]")))
-
- // Finish should change nothing.
- t.controller.Finish()
-
- ExpectEq(1, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ExpectCallForUnknownMethod() {
- ExpectEq(
- nil,
- t.controller.ExpectCall(t.mock1, "Frobnicate", "burrito.go", 117))
-
- // A fatal error should be reported immediately.
- AssertEq(0, len(t.reporter.errors))
- AssertEq(1, len(t.reporter.fatalErrors))
-
- report := t.reporter.fatalErrors[0]
- ExpectEq("burrito.go", report.fileName)
- ExpectEq(117, report.lineNumber)
- ExpectThat(report.err, Error(HasSubstr("Unknown method")))
- ExpectThat(report.err, Error(HasSubstr("Frobnicate")))
-}
-
-func (t *ControllerTest) PartialExpectationGivenWrongNumberOfArgs() {
- ExpectEq(
- nil,
- t.controller.ExpectCall(t.mock1, "TwoIntsToString", "burrito.go", 117)(
- 17, 19, 23))
-
- // A fatal error should be reported immediately.
- AssertEq(0, len(t.reporter.errors))
- AssertEq(1, len(t.reporter.fatalErrors))
-
- report := t.reporter.fatalErrors[0]
- ExpectEq("burrito.go", report.fileName)
- ExpectEq(117, report.lineNumber)
- ExpectThat(report.err, Error(HasSubstr("TwoIntsToString")))
- ExpectThat(report.err, Error(HasSubstr("arguments")))
- ExpectThat(report.err, Error(HasSubstr("expected 2")))
- ExpectThat(report.err, Error(HasSubstr("got 3")))
-}
-
-func (t *ControllerTest) PartialExpectationCalledTwice() {
- partial := t.controller.ExpectCall(t.mock1, "StringToInt", "burrito.go", 117)
- AssertNe(nil, partial("taco"))
- ExpectEq(nil, partial("taco"))
-
- // A fatal error should be reported immediately.
- AssertEq(0, len(t.reporter.errors))
- AssertEq(1, len(t.reporter.fatalErrors))
-
- report := t.reporter.fatalErrors[0]
- ExpectEq("burrito.go", report.fileName)
- ExpectEq(117, report.lineNumber)
- ExpectThat(report.err, Error(HasSubstr("called more than once")))
-}
-
-func (t *ControllerTest) HandleMethodCallForUnknownMethod() {
- ExpectEq(
- nil,
- t.controller.HandleMethodCall(
- t.mock1,
- "Frobnicate",
- "burrito.go",
- 117,
- []interface{}{}))
-
- // A fatal error should be reported immediately.
- AssertEq(0, len(t.reporter.errors))
- AssertEq(1, len(t.reporter.fatalErrors))
-
- report := t.reporter.fatalErrors[0]
- ExpectEq("burrito.go", report.fileName)
- ExpectEq(117, report.lineNumber)
- ExpectThat(report.err, Error(HasSubstr("Unknown method")))
- ExpectThat(report.err, Error(HasSubstr("Frobnicate")))
-}
-
-func (t *ControllerTest) HandleMethodCallGivenWrongNumberOfArgs() {
- t.controller.ExpectCall(t.mock1, "TwoIntsToString", "", 0)(17, 19)
-
- ExpectEq(
- nil,
- t.controller.HandleMethodCall(
- t.mock1,
- "TwoIntsToString",
- "burrito.go",
- 117,
- []interface{}{17, 19, 23}))
-
- // A fatal error should be reported immediately.
- AssertEq(0, len(t.reporter.errors))
- AssertEq(1, len(t.reporter.fatalErrors))
-
- report := t.reporter.fatalErrors[0]
- ExpectEq("burrito.go", report.fileName)
- ExpectEq(117, report.lineNumber)
- ExpectThat(report.err, Error(HasSubstr("arguments")))
- ExpectThat(report.err, Error(HasSubstr("expected 2")))
- ExpectThat(report.err, Error(HasSubstr("got 3")))
-}
-
-func (t *ControllerTest) ExpectThenNonMatchingCall() {
- // Expectation -- set up a fallback action to make it optional.
- partial := t.controller.ExpectCall(
- t.mock1,
- "TwoIntsToString",
- "burrito.go",
- 117)
-
- exp := partial(LessThan(10), Equals(2))
- exp.WillRepeatedly(Return(""))
-
- // Call
- t.controller.HandleMethodCall(
- t.mock1,
- "TwoIntsToString",
- "taco.go",
- 112,
- []interface{}{8, 1})
-
- // The error should be reported immediately.
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("taco.go", t.reporter.errors[0].fileName)
- ExpectEq(112, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unexpected")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("TwoIntsToString")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("[8 1]")))
-
- // Finish should change nothing.
- t.controller.Finish()
-
- ExpectEq(1, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ExplicitCardinalityNotSatisfied() {
- // Expectation -- set up an explicit cardinality of three.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.Times(3)
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // The error should not yet be reported.
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-
- // Finish should cause the error to be reported.
- t.controller.Finish()
-
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unsatisfied")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at least 3 times")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 2 times")))
-}
-
-func (t *ControllerTest) ImplicitOneTimeActionCountNotSatisfied() {
- // Expectation -- add three one-time actions.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
- exp.WillOnce(Return(1))
- exp.WillOnce(Return(2))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // The error should not yet be reported.
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-
- // Finish should cause the error to be reported.
- t.controller.Finish()
-
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unsatisfied")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at least 3 times")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 2 times")))
-}
-
-func (t *ControllerTest) ImplicitOneTimeActionLowerBoundNotSatisfied() {
- // Expectation -- add three one-time actions and a fallback.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
- exp.WillOnce(Return(1))
- exp.WillOnce(Return(2))
- exp.WillRepeatedly(Return(3))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // The error should not yet be reported.
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-
- // Finish should cause the error to be reported.
- t.controller.Finish()
-
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unsatisfied")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at least 3 times")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 2 times")))
-}
-
-func (t *ControllerTest) ImplicitCardinalityOfOneNotSatisfied() {
- // Expectation -- add no actions.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- partial(HasSubstr(""))
-
- // Don't call.
-
- // The error should not yet be reported.
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-
- // Finish should cause the error to be reported.
- t.controller.Finish()
-
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unsatisfied")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at least 1 time")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 0 times")))
-}
-
-func (t *ControllerTest) ExplicitCardinalityOverrun() {
- // Expectation -- call times(2).
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.Times(2)
-
- // Call three times.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // The error should be reported immediately.
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unexpected")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at most 2 times")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 3 times")))
-
- // Finish should change nothing.
- t.controller.Finish()
-
- ExpectEq(1, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ImplicitOneTimeActionCountOverrun() {
- // Expectation -- add a one-time action.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // The error should be reported immediately.
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unexpected")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at most 1 time")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 2 times")))
-
- // Finish should change nothing.
- t.controller.Finish()
-
- ExpectEq(1, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ImplicitCardinalityOfOneOverrun() {
- // Expectation -- don't add any actions.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- partial(HasSubstr(""))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // The error should be reported immediately.
- AssertEq(1, len(t.reporter.errors))
- AssertEq(0, len(t.reporter.fatalErrors))
-
- ExpectEq("burrito.go", t.reporter.errors[0].fileName)
- ExpectEq(117, t.reporter.errors[0].lineNumber)
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("Unexpected")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("StringToInt")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("at most 1 time")))
- ExpectThat(t.reporter.errors[0].err, Error(HasSubstr("called 2 times")))
-
- // Finish should change nothing.
- t.controller.Finish()
-
- ExpectEq(1, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ExplicitCardinalitySatisfied() {
- // Expectation -- set up an explicit cardinality of two.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.Times(2)
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ImplicitOneTimeActionCountSatisfied() {
- // Expectation -- set up two one-time actions.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
- exp.WillOnce(Return(1))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ImplicitOneTimeActionLowerBoundJustSatisfied() {
- // Expectation -- set up two one-time actions and a fallback.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
- exp.WillOnce(Return(1))
- exp.WillRepeatedly(Return(2))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ImplicitOneTimeActionLowerBoundMoreThanSatisfied() {
- // Expectation -- set up two one-time actions and a fallback.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
- exp.WillOnce(Return(1))
- exp.WillRepeatedly(Return(2))
-
- // Call four times.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) FallbackActionConfiguredWithZeroCalls() {
- // Expectation -- set up a fallback action.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillRepeatedly(Return(0))
-
- // Don't call.
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) FallbackActionConfiguredWithMultipleCalls() {
- // Expectation -- set up a fallback action.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillRepeatedly(Return(0))
-
- // Call twice.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) ImplicitCardinalityOfOneSatisfied() {
- // Expectation -- don't add actions.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- partial(HasSubstr(""))
-
- // Call once.
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- // There should be no errors.
- t.controller.Finish()
-
- ExpectEq(0, len(t.reporter.errors))
- ExpectEq(0, len(t.reporter.fatalErrors))
-}
-
-func (t *ControllerTest) InvokesOneTimeActions() {
- var res []interface{}
-
- // Expectation -- set up two one-time actions.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- suppliedArg := ""
- expectedReturn := 17
-
- f := func(s string) int {
- suppliedArg = s
- return expectedReturn
- }
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Invoke(f))
- exp.WillOnce(Return(1))
-
- AssertThat(t.reporter.fatalErrors, ElementsAre())
-
- // Call 0
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{"taco"})
-
- ExpectEq("taco", suppliedArg)
- ExpectThat(res, ElementsAre(IdenticalTo(expectedReturn)))
-
- // Call 1
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(1))
-}
-
-func (t *ControllerTest) InvokesFallbackActionAfterOneTimeActions() {
- var res []interface{}
-
- // Expectation -- set up two one-time actions and a fallback.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(0))
- exp.WillOnce(Return(1))
- exp.WillRepeatedly(Return(2))
-
- // Call 0
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(0))
-
- // Call 1
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(1))
-
- // Call 2
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(2))
-
- // Call 3
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(2))
-}
-
-func (t *ControllerTest) InvokesFallbackActionWithoutOneTimeActions() {
- var res []interface{}
-
- // Expectation -- set up only a fallback action.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillRepeatedly(Return(2))
-
- // Call 0
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(2))
-
- // Call 1
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(2))
-
- // Call 2
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(2))
-}
-
-func (t *ControllerTest) ImplicitActionReturnsZeroInts() {
- var res []interface{}
-
- // Expectation -- set up a cardinality of two.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.Times(2)
-
- // Call 0
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(reflect.TypeOf(res[0]), Equals(reflect.TypeOf(int(0))))
- ExpectThat(res[0], Equals(0))
-
- // Call 1
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(reflect.TypeOf(res[0]), Equals(reflect.TypeOf(int(0))))
- ExpectThat(res[0], Equals(0))
-}
-
-func (t *ControllerTest) ImplicitActionReturnsEmptyStrings() {
- var res []interface{}
-
- // Expectation -- set up a cardinality of two.
- partial := t.controller.ExpectCall(
- t.mock1,
- "TwoIntsToString",
- "burrito.go",
- 117)
-
- exp := partial(LessThan(100), LessThan(100))
- exp.Times(2)
-
- // Call 0
- res = t.controller.HandleMethodCall(
- t.mock1,
- "TwoIntsToString",
- "",
- 0,
- []interface{}{0, 0})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(""))
-
- // Call 1
- res = t.controller.HandleMethodCall(
- t.mock1,
- "TwoIntsToString",
- "",
- 0,
- []interface{}{0, 0})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(""))
-}
-
-func (t *ControllerTest) ExpectationsAreMatchedLastToFirst() {
- var res []interface{}
-
- // General expectation
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillRepeatedly(Return(17))
-
- // More specific expectation
- partial = t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp = partial(Equals("taco"))
- exp.WillRepeatedly(Return(19))
-
- // Call -- the second expectation should match.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{"taco"})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(19))
-
- // Call -- the first expectation should match because the second doesn't.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{"burrito"})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(17))
-}
-
-func (t *ControllerTest) ExpectationsAreSegregatedByMockObject() {
- var res []interface{}
-
- // Expectation for mock1 -- return 17.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillRepeatedly(Return(17))
-
- // Expectation for mock2 -- return 19.
- partial = t.controller.ExpectCall(
- t.mock2,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp = partial(HasSubstr(""))
- exp.WillRepeatedly(Return(19))
-
- // Call mock1.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(17))
-
- // Call mock2.
- res = t.controller.HandleMethodCall(
- t.mock2,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(19))
-}
-
-func (t *ControllerTest) ExpectationsAreSegregatedByMethodName() {
- var res []interface{}
-
- // Expectation for StringToInt
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillRepeatedly(Return(17))
-
- // Expectation for TwoIntsToString
- partial = t.controller.ExpectCall(
- t.mock1,
- "TwoIntsToString",
- "burrito.go",
- 117)
-
- exp = partial(1, 2)
- exp.WillRepeatedly(Return("taco"))
-
- // Call StringToInt.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals(17))
-
- // Call TwoIntsToString.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "TwoIntsToString",
- "",
- 0,
- []interface{}{1, 2})
-
- ExpectThat(len(res), Equals(1))
- ExpectThat(res[0], Equals("taco"))
-}
-
-func (t *ControllerTest) ActionCallsAgainMatchingDifferentExpectation() {
- var res []interface{}
-
- // Expectation for StringToInt
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.WillOnce(Return(17))
-
- // Expectation for TwoIntsToString -- pretend we call StringToInt.
- partial = t.controller.ExpectCall(
- t.mock1,
- "TwoIntsToString",
- "burrito.go",
- 117)
-
- exp = partial(1, 2)
- exp.WillOnce(Invoke(func(int, int) string {
- t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "taco.go",
- 112,
- []interface{}{""})
-
- return "queso"
- }))
-
- // Call TwoIntsToString.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "TwoIntsToString",
- "",
- 0,
- []interface{}{1, 2})
-
- AssertThat(res, ElementsAre("queso"))
-
- // Finish. Everything should be satisfied.
- t.controller.Finish()
-
- ExpectThat(t.reporter.errors, ElementsAre())
- ExpectThat(t.reporter.fatalErrors, ElementsAre())
-}
-
-func (t *ControllerTest) ActionCallsAgainMatchingSameExpectation() {
- var res []interface{}
-
- // Expectation for StringToInt -- should be called twice. The first time it
- // should call itself.
- partial := t.controller.ExpectCall(
- t.mock1,
- "StringToInt",
- "burrito.go",
- 117)
-
- exp := partial(HasSubstr(""))
- exp.Times(2)
- exp.WillOnce(Invoke(func(string) int {
- subCallRes := t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "taco.go",
- 112,
- []interface{}{""})
-
- return subCallRes[0].(int) + 19
- }))
-
- exp.WillOnce(Return(17))
-
- // Call.
- res = t.controller.HandleMethodCall(
- t.mock1,
- "StringToInt",
- "",
- 0,
- []interface{}{""})
-
- AssertThat(res, ElementsAre(17+19))
-
- // Finish. Everything should be satisfied.
- t.controller.Finish()
-
- ExpectThat(t.reporter.errors, ElementsAre())
- ExpectThat(t.reporter.fatalErrors, ElementsAre())
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/createmock/createmock_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/createmock/createmock_test.go
deleted file mode 100644
index ddfc07a3e8d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/createmock/createmock_test.go
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
- "bytes"
- "flag"
- "fmt"
- "go/build"
- "io/ioutil"
- "os"
- "os/exec"
- "path"
- "syscall"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-var dumpNew = flag.Bool("dump_new", false, "Dump new golden files.")
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-var tempDir string
-var createmockPath string
-
-type CreateMockTest struct {
-}
-
-func TestOgletest(t *testing.T) { RunTests(t) }
-func init() { RegisterTestSuite(&CreateMockTest{}) }
-
-func (t *CreateMockTest) SetUpTestSuite() {
- // Create a temporary file to hold the built createmock binary.
- tempDir, err := ioutil.TempDir("", "createmock-")
- if err != nil {
- panic("Creating temporary directory: " + err.Error())
- }
-
- createmockPath = path.Join(tempDir, "createmock")
-
- // Build the createmock tool so that it can be used in the tests below.
- cmd := exec.Command("go", "build", "-o", createmockPath, "github.com/smartystreets/assertions/internal/oglemock/createmock")
- if output, err := cmd.CombinedOutput(); err != nil {
- panic(fmt.Sprintf("Error building createmock: %v\n\n%s", err, output))
- }
-}
-
-func (t *CreateMockTest) TearDownTestSuite() {
- // Delete the createmock binary we built above.
- os.RemoveAll(tempDir)
- tempDir = ""
- createmockPath = ""
-}
-
-func (t *CreateMockTest) runGoldenTest(
- caseName string,
- expectedReturnCode int,
- createmockArgs ...string) {
- // Run createmock.
- cmd := exec.Command(createmockPath, createmockArgs...)
- output, err := cmd.CombinedOutput()
-
- // Make sure the process actually exited.
- exitError, ok := err.(*exec.ExitError)
- if err != nil && (!ok || !exitError.Exited()) {
- panic("exec.Command.CombinedOutput: " + err.Error())
- }
-
- // Extract a return code.
- var actualReturnCode int
- if exitError != nil {
- actualReturnCode = exitError.Sys().(syscall.WaitStatus).ExitStatus()
- }
-
- // Make sure the return code is correct.
- ExpectEq(expectedReturnCode, actualReturnCode)
-
- // Read the golden file.
- goldenPath := path.Join("testdata", "golden."+caseName)
- goldenData := readFileOrDie(goldenPath)
-
- // Compare the two.
- identical := (string(output) == string(goldenData))
- ExpectTrue(identical, "Output doesn't match for case '%s'.", caseName)
-
- // Write out a new golden file if requested.
- if !identical && *dumpNew {
- writeContentsToFileOrDie(output, goldenPath)
- }
-}
-
-// Ensure that when createmock is run with the supplied args, it produces
-// output that can be compiled.
-func (t *CreateMockTest) runCompilationTest(createmockArgs ...string) {
- // Create a temporary directory inside of $GOPATH to hold generated code.
- buildPkg, err := build.Import("github.com/smartystreets/assertions/internal/oglemock", "", build.FindOnly)
- AssertEq(nil, err)
-
- tmpDir, err := ioutil.TempDir(buildPkg.SrcRoot, "tmp-createmock_test-")
- AssertEq(nil, err)
- defer os.RemoveAll(tmpDir)
-
- // Create a file to hold the mock code.
- codeFile, err := os.Create(path.Join(tmpDir, "mock.go"))
- AssertEq(nil, err)
-
- // Run createmock and save its output to the file created above.
- stdErrBuf := new(bytes.Buffer)
-
- cmd := exec.Command(createmockPath, createmockArgs...)
- cmd.Stdout = codeFile
- cmd.Stderr = stdErrBuf
-
- err = cmd.Run()
- AssertEq(nil, err, "createmock stderr output:\n\n%s", stdErrBuf.String())
- codeFile.Close()
-
- // Run 'go build' in the directory and make sure it exits with return code
- // zero.
- cmd = exec.Command("go", "build")
- cmd.Dir = tmpDir
- output, err := cmd.CombinedOutput()
-
- ExpectEq(nil, err, "go build output:\n\n%s", output)
-}
-
-func writeContentsToFileOrDie(contents []byte, path string) {
- if err := ioutil.WriteFile(path, contents, 0600); err != nil {
- panic("ioutil.WriteFile: " + err.Error())
- }
-}
-
-func readFileOrDie(path string) []byte {
- contents, err := ioutil.ReadFile(path)
- if err != nil {
- panic("ioutil.ReadFile: " + err.Error())
- }
-
- return contents
-}
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *CreateMockTest) NoPackage() {
- t.runGoldenTest(
- "no_package",
- 1)
-}
-
-func (t *CreateMockTest) NoInterfaces() {
- t.runGoldenTest(
- "no_interfaces",
- 1,
- "io")
-}
-
-func (t *CreateMockTest) UnknownPackage() {
- t.runGoldenTest(
- "unknown_package",
- 1,
- "foo/bar",
- "Reader")
-}
-
-func (t *CreateMockTest) UnknownInterface() {
- t.runGoldenTest(
- "unknown_interface",
- 1,
- "io",
- "Frobnicator")
-}
-
-func (t *CreateMockTest) GCSBucket() {
- t.runGoldenTest(
- "gcs_bucket",
- 0,
- "github.com/smartystreets/assertions/internal/oglemock/createmock/testdata/gcs",
- "Bucket")
-}
-
-func (t *CreateMockTest) GCSBucket_SamePackage() {
- t.runGoldenTest(
- "gcs_bucket_same_package",
- 0,
- "--same_package",
- "github.com/smartystreets/assertions/internal/oglemock/createmock/testdata/gcs",
- "Bucket")
-}
-
-func (t *CreateMockTest) IoReaderAndWriter() {
- t.runCompilationTest(
- "io",
- "Reader",
- "Writer")
-}
-
-func (t *CreateMockTest) OsFileInfo() {
- // Note that os is also used by the code that createmock generates; there
- // should be no conflict.
- t.runCompilationTest(
- "os",
- "FileInfo")
-}
-
-func (t *CreateMockTest) ComplicatedSamplePackage() {
- t.runCompilationTest(
- "github.com/smartystreets/assertions/internal/oglemock/generate/testdata/complicated_pkg",
- "ComplicatedThing")
-}
-
-func (t *CreateMockTest) RenamedSamplePackage() {
- t.runCompilationTest(
- "github.com/smartystreets/assertions/internal/oglemock/generate/testdata/renamed_pkg",
- "SomeInterface")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/do_all_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/do_all_test.go
deleted file mode 100644
index f835b66c7c5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/do_all_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- "reflect"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- "github.com/smartystreets/assertions/internal/oglemock"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-func TestDoAll(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////
-// Boilerplate
-////////////////////////////////////////////////////////////
-
-type DoAllTest struct {
-}
-
-func init() { RegisterTestSuite(&DoAllTest{}) }
-
-////////////////////////////////////////////////////////////
-// Test functions
-////////////////////////////////////////////////////////////
-
-func (t *DoAllTest) FirstActionDoesntLikeSignature() {
- f := func(a int, b string) {}
-
- a0 := oglemock.Invoke(func() {})
- a1 := oglemock.Invoke(f)
- a2 := oglemock.Return()
-
- err := oglemock.DoAll(a0, a1, a2).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("Action 0")))
- ExpectThat(err, Error(HasSubstr("func()")))
-}
-
-func (t *DoAllTest) LastActionDoesntLikeSignature() {
- f := func(a int, b string) {}
-
- a0 := oglemock.Invoke(f)
- a1 := oglemock.Invoke(f)
- a2 := oglemock.Return(17)
-
- err := oglemock.DoAll(a0, a1, a2).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("Action 2")))
- ExpectThat(err, Error(HasSubstr("1 vals; expected 0")))
-}
-
-func (t *DoAllTest) SingleAction() {
- f := func(a int) string { return "" }
- a0 := oglemock.Return("taco")
-
- action := oglemock.DoAll(a0)
- AssertEq(nil, action.SetSignature(reflect.TypeOf(f)))
-
- rets := action.Invoke([]interface{}{17})
- ExpectThat(rets, ElementsAre("taco"))
-}
-
-func (t *DoAllTest) MultipleActions() {
- f := func(a int) string { return "" }
-
- var saved int
- a0 := oglemock.SaveArg(0, &saved)
- a1 := oglemock.Return("taco")
-
- action := oglemock.DoAll(a0, a1)
- AssertEq(nil, action.SetSignature(reflect.TypeOf(f)))
-
- rets := action.Invoke([]interface{}{17})
- ExpectEq(17, saved)
- ExpectThat(rets, ElementsAre("taco"))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/generate_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/generate_test.go
deleted file mode 100644
index 8347e4d030b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/generate_test.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package generate_test
-
-import (
- "bytes"
- "flag"
- "image"
- "io"
- "io/ioutil"
- "path"
- "reflect"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- "github.com/smartystreets/assertions/internal/oglemock/generate"
- "github.com/smartystreets/assertions/internal/oglemock/generate/testdata/complicated_pkg"
- "github.com/smartystreets/assertions/internal/oglemock/generate/testdata/renamed_pkg"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-var dumpNew = flag.Bool("dump_new", false, "Dump new golden files.")
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-type GenerateTest struct {
-}
-
-func TestOgletest(t *testing.T) { RunTests(t) }
-func init() { RegisterTestSuite(&GenerateTest{}) }
-
-func (t *GenerateTest) runGoldenTest(
- caseName string,
- outputPkgPath string,
- nilPtrs ...interface{}) {
- // Make a slice of interface types to give to GenerateMockSource.
- interfaces := make([]reflect.Type, len(nilPtrs))
- for i, ptr := range nilPtrs {
- interfaces[i] = reflect.TypeOf(ptr).Elem()
- }
-
- // Create the mock source.
- buf := new(bytes.Buffer)
- err := generate.GenerateMockSource(buf, outputPkgPath, interfaces)
- AssertEq(nil, err, "Error from GenerateMockSource: %v", err)
-
- // Read the golden file.
- goldenPath := path.Join("testdata", "golden."+caseName+".go")
- goldenData := readFileOrDie(goldenPath)
-
- // Compare the two.
- identical := (buf.String() == string(goldenData))
- ExpectTrue(identical, "Output doesn't match for case '%s'.", caseName)
-
- // Write out a new golden file if requested.
- if !identical && *dumpNew {
- writeContentsToFileOrDie(buf.Bytes(), goldenPath)
- }
-}
-
-func writeContentsToFileOrDie(contents []byte, path string) {
- if err := ioutil.WriteFile(path, contents, 0600); err != nil {
- panic("ioutil.WriteFile: " + err.Error())
- }
-}
-
-func readFileOrDie(path string) []byte {
- contents, err := ioutil.ReadFile(path)
- if err != nil {
- panic("ioutil.ReadFile: " + err.Error())
- }
-
- return contents
-}
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *GenerateTest) EmptyOutputPackagePath() {
- err := generate.GenerateMockSource(
- new(bytes.Buffer),
- "",
- []reflect.Type{
- reflect.TypeOf((*io.Reader)(nil)).Elem(),
- })
-
- ExpectThat(err, Error(HasSubstr("Package path")))
- ExpectThat(err, Error(HasSubstr("non-empty")))
-}
-
-func (t *GenerateTest) EmptySetOfInterfaces() {
- err := generate.GenerateMockSource(
- new(bytes.Buffer),
- "foo",
- []reflect.Type{})
-
- ExpectThat(err, Error(HasSubstr("interfaces")))
- ExpectThat(err, Error(HasSubstr("non-empty")))
-}
-
-func (t *GenerateTest) NonInterfaceType() {
- err := generate.GenerateMockSource(
- new(bytes.Buffer),
- "foo",
- []reflect.Type{
- reflect.TypeOf((*io.Reader)(nil)).Elem(),
- reflect.TypeOf(17),
- reflect.TypeOf((*io.Writer)(nil)).Elem(),
- })
-
- ExpectThat(err, Error(HasSubstr("Invalid type")))
-}
-
-func (t *GenerateTest) IoReaderAndWriter() {
- // Mock io.Reader and io.Writer.
- t.runGoldenTest(
- "io_reader_writer",
- "some/pkg",
- (*io.Reader)(nil),
- (*io.Writer)(nil))
-}
-
-func (t *GenerateTest) IoReaderAndWriter_SamePackage() {
- // Mock io.Reader and io.Writer.
- t.runGoldenTest(
- "io_reader_writer_same_package",
- "io",
- (*io.Reader)(nil),
- (*io.Writer)(nil))
-}
-
-func (t *GenerateTest) Image() {
- t.runGoldenTest(
- "image",
- "some/pkg",
- (*image.Image)(nil),
- (*image.PalettedImage)(nil))
-}
-
-func (t *GenerateTest) ComplicatedPackage() {
- t.runGoldenTest(
- "complicated_pkg",
- "some/pkg",
- (*complicated_pkg.ComplicatedThing)(nil))
-}
-
-func (t *GenerateTest) RenamedPackage() {
- t.runGoldenTest(
- "renamed_pkg",
- "some/pkg",
- (*tony.SomeInterface)(nil))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/type_string_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/type_string_test.go
deleted file mode 100644
index 7d13c4e177e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/generate/type_string_test.go
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package generate
-
-import (
- "io"
- "reflect"
- "testing"
- "unsafe"
-
- "github.com/smartystreets/assertions/internal/oglemock/createmock/testdata/gcs"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-func TestTypeString(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Boilerplate
-////////////////////////////////////////////////////////////////////////
-
-type TypeStringTest struct {
-}
-
-func init() { RegisterTestSuite(&TypeStringTest{}) }
-
-////////////////////////////////////////////////////////////////////////
-// Test functions
-////////////////////////////////////////////////////////////////////////
-
-func (t *TypeStringTest) TestCases() {
- const gcsPkgPath = "github.com/smartystreets/assertions/internal/oglemock/createmock/testdata/gcs"
- to := reflect.TypeOf
-
- testCases := []struct {
- t reflect.Type
- pkgPath string
- expected string
- }{
- /////////////////////////
- // Scalar types
- /////////////////////////
-
- 0: {to(true), "", "bool"},
- 1: {to(true), "some/pkg", "bool"},
- 2: {to(int(17)), "some/pkg", "int"},
- 3: {to(int32(17)), "some/pkg", "int32"},
- 4: {to(uint(17)), "some/pkg", "uint"},
- 5: {to(uint32(17)), "some/pkg", "uint32"},
- 6: {to(uintptr(17)), "some/pkg", "uintptr"},
- 7: {to(float32(17)), "some/pkg", "float32"},
- 8: {to(complex64(17)), "some/pkg", "complex64"},
-
- /////////////////////////
- // Structs
- /////////////////////////
-
- 9: {to(gcs.Object{}), "some/pkg", "gcs.Object"},
- 10: {to(gcs.Object{}), gcsPkgPath, "Object"},
-
- 11: {
- to(struct {
- a int
- b gcs.Object
- }{}),
- "some/pkg",
- "struct { a int; b gcs.Object }",
- },
-
- 12: {
- to(struct {
- a int
- b gcs.Object
- }{}),
- gcsPkgPath,
- "struct { a int; b Object }",
- },
-
- /////////////////////////
- // Pointers
- /////////////////////////
-
- 13: {to((*int)(nil)), gcsPkgPath, "*int"},
- 14: {to((*gcs.Object)(nil)), "some/pkg", "*gcs.Object"},
- 15: {to((*gcs.Object)(nil)), gcsPkgPath, "*Object"},
-
- /////////////////////////
- // Arrays
- /////////////////////////
-
- 16: {to([3]int{}), "some/pkg", "[3]int"},
- 17: {to([3]gcs.Object{}), gcsPkgPath, "[3]Object"},
-
- /////////////////////////
- // Channels
- /////////////////////////
-
- 18: {to((chan int)(nil)), "some/pkg", "chan int"},
- 19: {to((<-chan int)(nil)), "some/pkg", "<-chan int"},
- 20: {to((chan<- int)(nil)), "some/pkg", "chan<- int"},
- 21: {to((<-chan gcs.Object)(nil)), gcsPkgPath, "<-chan Object"},
-
- /////////////////////////
- // Functions
- /////////////////////////
-
- 22: {
- to(func(int, gcs.Object) {}),
- gcsPkgPath,
- "func(int, Object) ()",
- },
-
- 23: {
- to(func() (*gcs.Object, error) { return nil, nil }),
- gcsPkgPath,
- "func() (*Object, error)",
- },
-
- 24: {
- to(func(int, gcs.Object) (*gcs.Object, error) { return nil, nil }),
- gcsPkgPath,
- "func(int, Object) (*Object, error)",
- },
-
- /////////////////////////
- // Interfaces
- /////////////////////////
-
- 25: {to((*error)(nil)).Elem(), "some/pkg", "error"},
- 26: {to((*io.Reader)(nil)).Elem(), "some/pkg", "io.Reader"},
- 27: {to((*io.Reader)(nil)).Elem(), "io", "Reader"},
-
- 28: {
- to((*interface{})(nil)).Elem(),
- "some/pkg",
- "interface { }",
- },
-
- 29: {
- to((*interface {
- Foo(int)
- Bar(gcs.Object)
- })(nil)).Elem(),
- "some/pkg",
- "interface { Bar(gcs.Object) (); Foo(int) () }",
- },
-
- 30: {
- to((*interface {
- Foo(int)
- Bar(gcs.Object)
- })(nil)).Elem(),
- gcsPkgPath,
- "interface { Bar(Object) (); Foo(int) () }",
- },
-
- /////////////////////////
- // Maps
- /////////////////////////
-
- 31: {to(map[*gcs.Object]gcs.Object{}), gcsPkgPath, "map[*Object]Object"},
-
- /////////////////////////
- // Slices
- /////////////////////////
-
- 32: {to([]int{}), "some/pkg", "[]int"},
- 33: {to([]gcs.Object{}), gcsPkgPath, "[]Object"},
-
- /////////////////////////
- // Strings
- /////////////////////////
-
- 34: {to(""), gcsPkgPath, "string"},
-
- /////////////////////////
- // Unsafe pointer
- /////////////////////////
-
- 35: {to(unsafe.Pointer(nil)), gcsPkgPath, "unsafe.Pointer"},
-
- /////////////////////////
- // Other named types
- /////////////////////////
-
- 36: {to(gcs.Int(17)), "some/pkg", "gcs.Int"},
- 37: {to(gcs.Int(17)), gcsPkgPath, "Int"},
-
- 38: {to(gcs.Array{}), "some/pkg", "gcs.Array"},
- 39: {to(gcs.Array{}), gcsPkgPath, "Array"},
-
- 40: {to(gcs.Chan(nil)), "some/pkg", "gcs.Chan"},
- 41: {to(gcs.Chan(nil)), gcsPkgPath, "Chan"},
-
- 42: {to(gcs.Ptr(nil)), "some/pkg", "gcs.Ptr"},
- 43: {to(gcs.Ptr(nil)), gcsPkgPath, "Ptr"},
-
- 44: {to((*gcs.Int)(nil)), "some/pkg", "*gcs.Int"},
- 45: {to((*gcs.Int)(nil)), gcsPkgPath, "*Int"},
- }
-
- for i, tc := range testCases {
- ExpectEq(
- tc.expected,
- typeString(tc.t, tc.pkgPath),
- "Case %d: %v, %q", i, tc.t, tc.pkgPath)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/integration_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/integration_test.go
deleted file mode 100644
index e72f0cbb13b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/integration_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- "errors"
- . "github.com/smartystreets/assertions/internal/oglematchers"
- "github.com/smartystreets/assertions/internal/oglemock"
- "github.com/smartystreets/assertions/internal/oglemock/sample/mock_io"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "path"
- "runtime"
-)
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-func getLineNumber() int {
- _, _, line, _ := runtime.Caller(1)
- return line
-}
-
-type IntegrationTest struct {
- reporter fakeErrorReporter
- controller oglemock.Controller
-
- reader mock_io.MockReader
-}
-
-func init() { RegisterTestSuite(&IntegrationTest{}) }
-
-func (t *IntegrationTest) SetUp(c *TestInfo) {
- t.reporter.errors = make([]errorReport, 0)
- t.reporter.fatalErrors = make([]errorReport, 0)
- t.controller = oglemock.NewController(&t.reporter)
-
- t.reader = mock_io.NewMockReader(t.controller, "")
-}
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *IntegrationTest) UnexpectedCall() {
- t.reader.Read([]uint8{1, 2, 3})
- expectedLine := getLineNumber() - 1
-
- // An error should have been reported.
- AssertEq(1, len(t.reporter.errors), "%v", t.reporter.errors)
- AssertEq(0, len(t.reporter.fatalErrors), "%v", t.reporter.fatalErrors)
-
- r := t.reporter.errors[0]
- ExpectEq("integration_test.go", path.Base(r.fileName))
- ExpectEq(expectedLine, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("Unexpected")))
- ExpectThat(r.err, Error(HasSubstr("Read")))
- ExpectThat(r.err, Error(HasSubstr("[1 2 3]")))
-}
-
-func (t *IntegrationTest) ZeroValues() {
- // Make an unexpected call.
- n, err := t.reader.Read([]uint8{})
-
- // Check the return values.
- ExpectEq(0, n)
- ExpectEq(nil, err)
-}
-
-func (t *IntegrationTest) ExpectedCalls() {
- // Expectations
- t.controller.ExpectCall(t.reader, "Read", "", 112)(nil).
- WillOnce(oglemock.Return(17, nil)).
- WillOnce(oglemock.Return(19, nil))
-
- t.controller.ExpectCall(t.reader, "Read", "", 112)(Not(Equals(nil))).
- WillOnce(oglemock.Return(23, errors.New("taco")))
-
- // Calls
- var n int
- var err error
-
- n, err = t.reader.Read(nil)
- ExpectEq(17, n)
- ExpectEq(nil, err)
-
- n, err = t.reader.Read([]byte{})
- ExpectEq(23, n)
- ExpectThat(err, Error(Equals("taco")))
-
- n, err = t.reader.Read(nil)
- ExpectEq(19, n)
- ExpectEq(nil, err)
-
- // Errors
- AssertEq(0, len(t.reporter.errors), "%v", t.reporter.errors)
- AssertEq(0, len(t.reporter.fatalErrors), "%v", t.reporter.fatalErrors)
-}
-
-func (t *IntegrationTest) WrongTypeForReturn() {
- t.controller.ExpectCall(t.reader, "Read", "foo.go", 112)(nil).
- WillOnce(oglemock.Return(0, errors.New(""))).
- WillOnce(oglemock.Return("taco", errors.New("")))
-
- // Errors
- AssertEq(0, len(t.reporter.errors), "%v", t.reporter.errors)
- AssertEq(1, len(t.reporter.fatalErrors), "%v", t.reporter.fatalErrors)
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("foo.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("Return")))
- ExpectThat(r.err, Error(HasSubstr("arg 0")))
- ExpectThat(r.err, Error(HasSubstr("int")))
- ExpectThat(r.err, Error(HasSubstr("string")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/internal_expectation_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/internal_expectation_test.go
deleted file mode 100644
index 977fe1ac3f7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/internal_expectation_test.go
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/oglemock"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "reflect"
-)
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-var emptyReturnSig reflect.Type = reflect.TypeOf(func(i int) {})
-var float64ReturnSig reflect.Type = reflect.TypeOf(func(i int) float64 { return 17.0 })
-
-type InternalExpectationTest struct {
- reporter fakeErrorReporter
-}
-
-func init() { RegisterTestSuite(&InternalExpectationTest{}) }
-
-func (t *InternalExpectationTest) SetUp(c *TestInfo) {
- t.reporter.errors = make([]errorReport, 0)
- t.reporter.fatalErrors = make([]errorReport, 0)
-}
-
-func (t *InternalExpectationTest) makeExpectation(
- sig reflect.Type,
- args []interface{},
- fileName string,
- lineNumber int) *InternalExpectation {
- return InternalNewExpectation(&t.reporter, sig, args, fileName, lineNumber)
-}
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *InternalExpectationTest) StoresFileNameAndLineNumber() {
- args := []interface{}{}
- exp := t.makeExpectation(emptyReturnSig, args, "taco", 17)
-
- ExpectThat(exp.FileName, Equals("taco"))
- ExpectThat(exp.LineNumber, Equals(17))
-}
-
-func (t *InternalExpectationTest) NoArgs() {
- args := []interface{}{}
- exp := t.makeExpectation(emptyReturnSig, args, "", 0)
-
- ExpectThat(len(exp.ArgMatchers), Equals(0))
-}
-
-func (t *InternalExpectationTest) MixOfMatchersAndNonMatchers() {
- args := []interface{}{Equals(17), 19, Equals(23)}
- exp := t.makeExpectation(emptyReturnSig, args, "", 0)
-
- // Matcher args
- ExpectThat(len(exp.ArgMatchers), Equals(3))
- ExpectThat(exp.ArgMatchers[0], Equals(args[0]))
- ExpectThat(exp.ArgMatchers[2], Equals(args[2]))
-
- // Non-matcher arg
- var err error
- matcher1 := exp.ArgMatchers[1]
-
- err = matcher1.Matches(17)
- ExpectNe(nil, err)
-
- err = matcher1.Matches(19)
- ExpectEq(nil, err)
-
- err = matcher1.Matches(23)
- ExpectNe(nil, err)
-}
-
-func (t *InternalExpectationTest) NoTimes() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "", 0)
-
- ExpectThat(exp.ExpectedNumMatches, Equals(-1))
-}
-
-func (t *InternalExpectationTest) TimesN() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "", 0)
- exp.Times(17)
-
- ExpectThat(exp.ExpectedNumMatches, Equals(17))
-}
-
-func (t *InternalExpectationTest) NoActions() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "", 0)
-
- ExpectThat(len(exp.OneTimeActions), Equals(0))
- ExpectThat(exp.FallbackAction, Equals(nil))
-}
-
-func (t *InternalExpectationTest) WillOnce() {
- action0 := Return(17.0)
- action1 := Return(19.0)
-
- exp := t.makeExpectation(float64ReturnSig, []interface{}{}, "", 0)
- exp.WillOnce(action0).WillOnce(action1)
-
- ExpectThat(len(exp.OneTimeActions), Equals(2))
- ExpectThat(exp.OneTimeActions[0], Equals(action0))
- ExpectThat(exp.OneTimeActions[1], Equals(action1))
-}
-
-func (t *InternalExpectationTest) WillRepeatedly() {
- action := Return(17.0)
-
- exp := t.makeExpectation(float64ReturnSig, []interface{}{}, "", 0)
- exp.WillRepeatedly(action)
-
- ExpectThat(exp.FallbackAction, Equals(action))
-}
-
-func (t *InternalExpectationTest) BothKindsOfAction() {
- action0 := Return(17.0)
- action1 := Return(19.0)
- action2 := Return(23.0)
-
- exp := t.makeExpectation(float64ReturnSig, []interface{}{}, "", 0)
- exp.WillOnce(action0).WillOnce(action1).WillRepeatedly(action2)
-
- ExpectThat(len(exp.OneTimeActions), Equals(2))
- ExpectThat(exp.OneTimeActions[0], Equals(action0))
- ExpectThat(exp.OneTimeActions[1], Equals(action1))
- ExpectThat(exp.FallbackAction, Equals(action2))
-}
-
-func (t *InternalExpectationTest) TimesCalledWithHugeNumber() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "taco.go", 112)
- exp.Times(1 << 30)
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("Times")))
- ExpectThat(r.err, Error(HasSubstr("N must be at most 1000")))
-}
-
-func (t *InternalExpectationTest) TimesCalledTwice() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "taco.go", 112)
- exp.Times(17)
- exp.Times(17)
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("Times")))
- ExpectThat(r.err, Error(HasSubstr("more than once")))
-}
-
-func (t *InternalExpectationTest) TimesCalledAfterWillOnce() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "taco.go", 112)
- exp.WillOnce(Return())
- exp.Times(17)
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("Times")))
- ExpectThat(r.err, Error(HasSubstr("after WillOnce")))
-}
-
-func (t *InternalExpectationTest) TimesCalledAfterWillRepeatedly() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "taco.go", 112)
- exp.WillRepeatedly(Return())
- exp.Times(17)
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("Times")))
- ExpectThat(r.err, Error(HasSubstr("after WillRepeatedly")))
-}
-
-func (t *InternalExpectationTest) WillOnceCalledAfterWillRepeatedly() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "taco.go", 112)
- exp.WillRepeatedly(Return())
- exp.WillOnce(Return())
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("WillOnce")))
- ExpectThat(r.err, Error(HasSubstr("after WillRepeatedly")))
-}
-
-func (t *InternalExpectationTest) OneTimeActionRejectsSignature() {
- exp := t.makeExpectation(float64ReturnSig, []interface{}{}, "taco.go", 112)
- exp.WillOnce(Return("taco"))
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("arg 0")))
- ExpectThat(r.err, Error(HasSubstr("expected float64")))
- ExpectThat(r.err, Error(HasSubstr("given string")))
-}
-
-func (t *InternalExpectationTest) WillRepeatedlyCalledTwice() {
- exp := t.makeExpectation(emptyReturnSig, []interface{}{}, "taco.go", 112)
- exp.WillRepeatedly(Return())
- exp.WillRepeatedly(Return())
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("WillRepeatedly")))
- ExpectThat(r.err, Error(HasSubstr("once")))
-}
-
-func (t *InternalExpectationTest) FallbackActionRejectsSignature() {
- exp := t.makeExpectation(float64ReturnSig, []interface{}{}, "taco.go", 112)
- exp.WillRepeatedly(Return("taco"))
-
- AssertEq(1, len(t.reporter.fatalErrors))
- AssertEq(0, len(t.reporter.errors))
-
- r := t.reporter.fatalErrors[0]
- ExpectEq("taco.go", r.fileName)
- ExpectEq(112, r.lineNumber)
- ExpectThat(r.err, Error(HasSubstr("arg 0")))
- ExpectThat(r.err, Error(HasSubstr("expected float64")))
- ExpectThat(r.err, Error(HasSubstr("given string")))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/invoke_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/invoke_test.go
deleted file mode 100644
index 9e1478ba8cc..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/invoke_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- . "github.com/smartystreets/assertions/internal/oglematchers"
- "github.com/smartystreets/assertions/internal/oglemock"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "reflect"
-)
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-type InvokeTest struct {
-}
-
-func init() { RegisterTestSuite(&InvokeTest{}) }
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *InvokeTest) ArgumentIsNil() {
- f := func() { oglemock.Invoke(nil) }
- ExpectThat(f, Panics(MatchesRegexp("Invoke.*function.*<nil>")))
-}
-
-func (t *InvokeTest) ArgumentIsInt() {
- f := func() { oglemock.Invoke(17) }
- ExpectThat(f, Panics(MatchesRegexp("Invoke.*function.*int")))
-}
-
-func (t *InvokeTest) FunctionHasOneWrongInputType() {
- f := func(a int, b int32, c string) {}
- g := func(a int, b int, c string) {}
-
- err := oglemock.Invoke(f).SetSignature(reflect.TypeOf(g))
- ExpectThat(err, Error(HasSubstr("func(int, int32, string)")))
- ExpectThat(err, Error(HasSubstr("func(int, int, string)")))
-}
-
-func (t *InvokeTest) FunctionHasOneWrongOutputType() {
- f := func() (int32, string) { return 0, "" }
- g := func() (int, string) { return 0, "" }
-
- err := oglemock.Invoke(f).SetSignature(reflect.TypeOf(g))
- ExpectThat(err, Error(HasSubstr("func() (int32, string)")))
- ExpectThat(err, Error(HasSubstr("func() (int, string)")))
-}
-
-func (t *InvokeTest) CallsFunction() {
- var actualArg0, actualArg1 interface{}
-
- f := func(a uintptr, b int8) {
- actualArg0 = a
- actualArg1 = b
- }
-
- a := oglemock.Invoke(f)
-
- // Set signature.
- AssertEq(nil, a.SetSignature(reflect.TypeOf(f)))
-
- // Call the action.
- expectedArg0 := uintptr(17)
- expectedArg1 := int8(-7)
-
- a.Invoke([]interface{}{expectedArg0, expectedArg1})
-
- ExpectThat(actualArg0, IdenticalTo(expectedArg0))
- ExpectThat(actualArg1, IdenticalTo(expectedArg1))
-}
-
-func (t *InvokeTest) ReturnsFunctionResult() {
- expectedReturn0 := int16(3)
- expectedReturn1 := "taco"
-
- f := func() (int16, string) {
- return expectedReturn0, expectedReturn1
- }
-
- a := oglemock.Invoke(f)
-
- // Set signature.
- AssertEq(nil, a.SetSignature(reflect.TypeOf(f)))
-
- // Call the action.
- res := a.Invoke([]interface{}{})
-
- ExpectThat(
- res,
- ElementsAre(
- IdenticalTo(expectedReturn0),
- IdenticalTo(expectedReturn1)))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/return_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/return_test.go
deleted file mode 100644
index f1794bd764a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/return_test.go
+++ /dev/null
@@ -1,978 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- "bytes"
- . "github.com/smartystreets/assertions/internal/oglematchers"
- "github.com/smartystreets/assertions/internal/oglemock"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "io"
- "math"
- "reflect"
- "testing"
- "unsafe"
-)
-
-////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////
-
-var someInt int = 17
-
-type ReturnTest struct {
-}
-
-func init() { RegisterTestSuite(&ReturnTest{}) }
-func TestOgletest(t *testing.T) { RunTests(t) }
-
-type returnTestCase struct {
- suppliedVal interface{}
- expectedVal interface{}
- expectedSetSignatureErrorSubstring string
-}
-
-func (t *ReturnTest) runTestCases(signature reflect.Type, cases []returnTestCase) {
- for i, c := range cases {
- a := oglemock.Return(c.suppliedVal)
-
- // SetSignature
- err := a.SetSignature(signature)
- if c.expectedSetSignatureErrorSubstring == "" {
- ExpectEq(nil, err, "Test case %d: %v", i, c)
-
- if err != nil {
- continue
- }
- } else {
- ExpectThat(err, Error(HasSubstr(c.expectedSetSignatureErrorSubstring)),
- "Test case %d: %v", i, c)
- continue
- }
-
- // Invoke
- res := a.Invoke([]interface{}{})
- AssertThat(res, ElementsAre(Any()))
- ExpectThat(res[0], IdenticalTo(c.expectedVal), "Test case %d: %v", i, c)
- }
-}
-
-////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////
-
-func (t *ReturnTest) SetSignatureNotCalled() {
- a := oglemock.Return()
- f := func() { a.Invoke([]interface{}{}) }
- ExpectThat(f, Panics(MatchesRegexp("first call SetSignature")))
-}
-
-func (t *ReturnTest) NoReturnValues() {
- sig := reflect.TypeOf(func() {})
- var a oglemock.Action
- var err error
- var vals []interface{}
-
- // No values.
- a = oglemock.Return()
- err = a.SetSignature(sig)
- AssertEq(nil, err)
-
- vals = a.Invoke([]interface{}{})
- ExpectThat(vals, ElementsAre())
-
- // One value.
- a = oglemock.Return(17)
- err = a.SetSignature(sig)
- ExpectThat(err, Error(HasSubstr("given 1 val")))
- ExpectThat(err, Error(HasSubstr("expected 0")))
-
- // Two values.
- a = oglemock.Return(17, 19)
- err = a.SetSignature(sig)
- ExpectThat(err, Error(HasSubstr("given 2 vals")))
- ExpectThat(err, Error(HasSubstr("expected 0")))
-}
-
-func (t *ReturnTest) MultipleReturnValues() {
- sig := reflect.TypeOf(func() (int, string) { return 0, "" })
- var a oglemock.Action
- var err error
- var vals []interface{}
-
- // No values.
- a = oglemock.Return()
- err = a.SetSignature(sig)
- ExpectThat(err, Error(HasSubstr("given 0 vals")))
- ExpectThat(err, Error(HasSubstr("expected 2")))
-
- // One value.
- a = oglemock.Return(17)
- err = a.SetSignature(sig)
- ExpectThat(err, Error(HasSubstr("given 1 val")))
- ExpectThat(err, Error(HasSubstr("expected 2")))
-
- // Two values.
- a = oglemock.Return(17, "taco")
- err = a.SetSignature(sig)
- AssertEq(nil, err)
-
- vals = a.Invoke([]interface{}{})
- ExpectThat(vals, ElementsAre(IdenticalTo(int(17)), "taco"))
-}
-
-func (t *ReturnTest) Bool() {
- sig := reflect.TypeOf(func() bool { return false })
- cases := []returnTestCase{
- // Identical types.
- {bool(true), bool(true), ""},
- {bool(false), bool(false), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Int() {
- sig := reflect.TypeOf(func() int { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {int(math.MinInt32), int(math.MinInt32), ""},
- {int(math.MaxInt32), int(math.MaxInt32), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Int8() {
- sig := reflect.TypeOf(func() int8 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {int8(math.MinInt8), int8(math.MinInt8), ""},
- {int8(math.MaxInt8), int8(math.MaxInt8), ""},
-
- // In-range ints.
- {int(math.MinInt8), int8(math.MinInt8), ""},
- {int(math.MaxInt8), int8(math.MaxInt8), ""},
-
- // Out of range ints.
- {int(math.MinInt8 - 1), nil, "out of range"},
- {int(math.MaxInt8 + 1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Int16() {
- sig := reflect.TypeOf(func() int16 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {int16(math.MinInt16), int16(math.MinInt16), ""},
- {int16(math.MaxInt16), int16(math.MaxInt16), ""},
-
- // In-range ints.
- {int(math.MinInt16), int16(math.MinInt16), ""},
- {int(math.MaxInt16), int16(math.MaxInt16), ""},
-
- // Out of range ints.
- {int(math.MinInt16 - 1), nil, "out of range"},
- {int(math.MaxInt16 + 1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int8(1), nil, "given int8"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Int32() {
- sig := reflect.TypeOf(func() int32 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {int32(math.MinInt32), int32(math.MinInt32), ""},
- {int32(math.MaxInt32), int32(math.MaxInt32), ""},
-
- // Aliased version of type.
- {rune(17), int32(17), ""},
-
- // In-range ints.
- {int(math.MinInt32), int32(math.MinInt32), ""},
- {int(math.MaxInt32), int32(math.MaxInt32), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Rune() {
- sig := reflect.TypeOf(func() rune { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {rune(math.MinInt32), rune(math.MinInt32), ""},
- {rune(math.MaxInt32), rune(math.MaxInt32), ""},
-
- // Aliased version of type.
- {int32(17), rune(17), ""},
-
- // In-range ints.
- {int(math.MinInt32), rune(math.MinInt32), ""},
- {int(math.MaxInt32), rune(math.MaxInt32), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Int64() {
- sig := reflect.TypeOf(func() int64 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {int64(math.MinInt64), int64(math.MinInt64), ""},
- {int64(math.MaxInt64), int64(math.MaxInt64), ""},
-
- // In-range ints.
- {int(math.MinInt32), int64(math.MinInt32), ""},
- {int(math.MaxInt32), int64(math.MaxInt32), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Uint() {
- sig := reflect.TypeOf(func() uint { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {uint(0), uint(0), ""},
- {uint(math.MaxUint32), uint(math.MaxUint32), ""},
-
- // In-range ints.
- {int(0), uint(0), ""},
- {int(math.MaxInt32), uint(math.MaxInt32), ""},
-
- // Out of range ints.
- {int(-1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Uint8() {
- sig := reflect.TypeOf(func() uint8 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {uint8(0), uint8(0), ""},
- {uint8(math.MaxUint8), uint8(math.MaxUint8), ""},
-
- // Aliased version of type.
- {byte(17), uint8(17), ""},
-
- // In-range ints.
- {int(0), uint8(0), ""},
- {int(math.MaxUint8), uint8(math.MaxUint8), ""},
-
- // Out of range ints.
- {int(-1), nil, "out of range"},
- {int(math.MaxUint8 + 1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Byte() {
- sig := reflect.TypeOf(func() byte { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {byte(0), byte(0), ""},
- {byte(math.MaxUint8), byte(math.MaxUint8), ""},
-
- // Aliased version of type.
- {uint8(17), byte(17), ""},
-
- // In-range ints.
- {int(0), byte(0), ""},
- {int(math.MaxUint8), byte(math.MaxUint8), ""},
-
- // Out of range ints.
- {int(-1), nil, "out of range"},
- {int(math.MaxUint8 + 1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Uint16() {
- sig := reflect.TypeOf(func() uint16 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {uint16(0), uint16(0), ""},
- {uint16(math.MaxUint16), uint16(math.MaxUint16), ""},
-
- // In-range ints.
- {int(0), uint16(0), ""},
- {int(math.MaxUint16), uint16(math.MaxUint16), ""},
-
- // Out of range ints.
- {int(-1), nil, "out of range"},
- {int(math.MaxUint16 + 1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Uint32() {
- sig := reflect.TypeOf(func() uint32 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {uint32(0), uint32(0), ""},
- {uint32(math.MaxUint32), uint32(math.MaxUint32), ""},
-
- // In-range ints.
- {int(0), uint32(0), ""},
- {int(math.MaxInt32), uint32(math.MaxInt32), ""},
-
- // Out of range ints.
- {int(-1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Uint64() {
- sig := reflect.TypeOf(func() uint64 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {uint64(0), uint64(0), ""},
- {uint64(math.MaxUint64), uint64(math.MaxUint64), ""},
-
- // In-range ints.
- {int(0), uint64(0), ""},
- {int(math.MaxInt32), uint64(math.MaxInt32), ""},
-
- // Out of range ints.
- {int(-1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Uintptr() {
- sig := reflect.TypeOf(func() uintptr { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {uintptr(17), uintptr(17), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Float32() {
- sig := reflect.TypeOf(func() float32 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {float32(-17.5), float32(-17.5), ""},
- {float32(17.5), float32(17.5), ""},
-
- // In-range ints.
- {int(-17), float32(-17), ""},
- {int(17), float32(17), ""},
-
- // Float64s
- {float64(-17.5), float32(-17.5), ""},
- {float64(17.5), float32(17.5), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Float64() {
- sig := reflect.TypeOf(func() float64 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {float64(-17.5), float64(-17.5), ""},
- {float64(17.5), float64(17.5), ""},
-
- // In-range ints.
- {int(-17), float64(-17), ""},
- {int(17), float64(17), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float32(1), nil, "given float32"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Complex64() {
- sig := reflect.TypeOf(func() complex64 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {complex64(-17.5 - 1i), complex64(-17.5 - 1i), ""},
- {complex64(17.5 + 1i), complex64(17.5 + 1i), ""},
-
- // In-range ints.
- {int(-17), complex64(-17), ""},
- {int(17), complex64(17), ""},
-
- // Float64s
- {float64(-17.5), complex64(-17.5), ""},
- {float64(17.5), complex64(17.5), ""},
-
- // Complex128s
- {complex128(-17.5 - 1i), complex64(-17.5 - 1i), ""},
- {complex128(17.5 + 1i), complex64(17.5 + 1i), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float32(1), nil, "given float32"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Complex128() {
- sig := reflect.TypeOf(func() complex128 { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {complex128(-17.5 - 1i), complex128(-17.5 - 1i), ""},
- {complex128(17.5 + 1i), complex128(17.5 + 1i), ""},
-
- // In-range ints.
- {int(-17), complex128(-17), ""},
- {int(17), complex128(17), ""},
-
- // Float64s
- {float64(-17.5), complex128(-17.5), ""},
- {float64(17.5), complex128(17.5), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float32(1), nil, "given float32"},
- {complex64(1), nil, "given complex64"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) ArrayOfInt() {
- type namedElemType int
-
- sig := reflect.TypeOf(func() [2]int { return [2]int{0, 0} })
- cases := []returnTestCase{
- // Identical types.
- {[2]int{19, 23}, [2]int{19, 23}, ""},
-
- // Wrong length.
- {[1]int{17}, nil, "given [1]int"},
-
- // Wrong element types.
- {[2]namedElemType{19, 23}, nil, "given [2]oglemock_test.namedElemType"},
- {[2]string{"", ""}, nil, "given [2]string"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) ChanOfInt() {
- type namedElemType int
- someChan := make(chan int)
-
- sig := reflect.TypeOf(func() chan int { return nil })
- cases := []returnTestCase{
- // Identical types.
- {someChan, someChan, ""},
-
- // Nil values.
- {(interface{})(nil), (chan int)(nil), ""},
- {(chan int)(nil), (chan int)(nil), ""},
-
- // Wrong element types.
- {make(chan string), nil, "given chan string"},
- {make(chan namedElemType), nil, "given chan oglemock_test.namedElemType"},
-
- // Wrong direction
- {(<-chan int)(someChan), nil, "given <-chan int"},
- {(chan<- int)(someChan), nil, "given chan<- int"},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) SendChanOfInt() {
- type namedElemType int
-
- someChan := make(chan<- int)
- someBidirectionalChannel := make(chan int)
-
- sig := reflect.TypeOf(func() chan<- int { return nil })
- cases := []returnTestCase{
- // Identical types.
- {someChan, someChan, ""},
-
- // Nil values.
- {(interface{})(nil), (chan<- int)(nil), ""},
- {(chan int)(nil), (chan<- int)(nil), ""},
-
- // Bidirectional channel
- {someBidirectionalChannel, (chan<- int)(someBidirectionalChannel), ""},
-
- // Wrong direction
- {(<-chan int)(someBidirectionalChannel), nil, "given <-chan int"},
-
- // Wrong element types.
- {make(chan string), nil, "given chan string"},
- {make(chan namedElemType), nil, "given chan oglemock_test.namedElemType"},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) RecvChanOfInt() {
- type namedElemType int
-
- someChan := make(<-chan int)
- someBidirectionalChannel := make(chan int)
-
- sig := reflect.TypeOf(func() <-chan int { return nil })
- cases := []returnTestCase{
- // Identical types.
- {someChan, someChan, ""},
-
- // Nil values.
- {(interface{})(nil), (<-chan int)(nil), ""},
- {(chan int)(nil), (<-chan int)(nil), ""},
-
- // Bidirectional channel
- {someBidirectionalChannel, (<-chan int)(someBidirectionalChannel), ""},
-
- // Wrong direction
- {(chan<- int)(someBidirectionalChannel), nil, "given chan<- int"},
-
- // Wrong element types.
- {make(chan string), nil, "given chan string"},
- {make(chan namedElemType), nil, "given chan oglemock_test.namedElemType"},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Func() {
- someFunc := func(string) int { return 0 }
-
- sig := reflect.TypeOf(func() func(string) int { return nil })
- cases := []returnTestCase{
- // Identical types.
- {someFunc, someFunc, ""},
-
- // Nil values.
- {(interface{})(nil), (func(string) int)(nil), ""},
- {(func(string) int)(nil), (func(string) int)(nil), ""},
-
- // Wrong parameter and return types.
- {func(int) int { return 0 }, nil, "given func(int) int"},
- {func(string) string { return "" }, nil, "given func(string) string"},
-
- // Wrong types.
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {(chan int)(nil), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Interface() {
- sig := reflect.TypeOf(func() io.Reader { return nil })
-
- someBuffer := new(bytes.Buffer)
-
- cases := []returnTestCase{
- // Type that implements interface.
- {someBuffer, someBuffer, ""},
-
- // Nil value.
- {(interface{})(nil), (interface{})(nil), ""},
-
- // Non-implementing types.
- {(chan int)(nil), nil, "given chan int"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) MapFromStringToInt() {
- type namedElemType string
-
- someMap := make(map[string]int)
-
- sig := reflect.TypeOf(func() map[string]int { return nil })
- cases := []returnTestCase{
- // Identical types.
- {someMap, someMap, ""},
-
- // Nil values.
- {(interface{})(nil), (map[string]int)(nil), ""},
- {(map[string]int)(nil), (map[string]int)(nil), ""},
-
- // Wrong element types.
- {make(map[int]int), nil, "given map[int]int"},
- {make(map[namedElemType]int), nil, "given map[oglemock_test.namedElemType]int"},
- {make(map[string]string), nil, "given map[string]string"},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) PointerToString() {
- type namedElemType string
-
- someStr := ""
-
- sig := reflect.TypeOf(func() *string { return nil })
- cases := []returnTestCase{
- // Identical types.
- {(*string)(&someStr), (*string)(&someStr), ""},
-
- // Nil values.
- {(interface{})(nil), (*string)(nil), ""},
- {(*string)(nil), (*string)(nil), ""},
-
- // Wrong element types.
- {&someInt, nil, "given *int"},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {unsafe.Pointer(&someStr), nil, "given unsafe.Pointer"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) SliceOfInts() {
- type namedElemType int
-
- someSlice := make([]int, 1)
-
- sig := reflect.TypeOf(func() []int { return nil })
- cases := []returnTestCase{
- // Identical types.
- {someSlice, someSlice, ""},
-
- // Nil values.
- {(interface{})(nil), ([]int)(nil), ""},
- {([]int)(nil), ([]int)(nil), ""},
-
- // Wrong element types.
- {make([]string, 1), nil, "given []string"},
- {make([]namedElemType, 1), nil, "given []oglemock_test.namedElemType"},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) String() {
- sig := reflect.TypeOf(func() string { return "" })
- cases := []returnTestCase{
- // Identical types.
- {string(""), string(""), ""},
- {string("taco"), string("taco"), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) Struct() {
- type myStruct struct {
- a int
- }
-
- type otherStruct struct{}
-
- sig := reflect.TypeOf(func() myStruct { return myStruct{0} })
- cases := []returnTestCase{
- // Identical types.
- {myStruct{17}, myStruct{17}, ""},
-
- // Wrong field types.
- {otherStruct{}, nil, "given oglemock_test.otherStruct"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) UnsafePointer() {
- someStr := ""
-
- sig := reflect.TypeOf(func() unsafe.Pointer { return nil })
- cases := []returnTestCase{
- // Identical types.
- {unsafe.Pointer(&someStr), unsafe.Pointer(&someStr), ""},
-
- // Nil values.
- {(interface{})(nil), unsafe.Pointer(nil), ""},
- {unsafe.Pointer(nil), unsafe.Pointer(nil), ""},
-
- // Wrong types.
- {(func())(nil), nil, "given func()"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {(*string)(&someStr), nil, "given *string"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) UserDefinedNumericType() {
- type myType int16
-
- sig := reflect.TypeOf(func() myType { return 0 })
- cases := []returnTestCase{
- // Identical types.
- {myType(math.MinInt16), myType(math.MinInt16), ""},
- {myType(math.MaxInt16), myType(math.MaxInt16), ""},
-
- // In-range ints.
- {int(math.MinInt16), myType(math.MinInt16), ""},
- {int(math.MaxInt16), myType(math.MaxInt16), ""},
-
- // Out of range ints.
- {int(math.MinInt16 - 1), nil, "out of range"},
- {int(math.MaxInt16 + 1), nil, "out of range"},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int16(1), nil, "given int16"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
-
-func (t *ReturnTest) UserDefinedNonNumericType() {
- type myType string
-
- sig := reflect.TypeOf(func() myType { return "" })
- cases := []returnTestCase{
- // Identical types.
- {myType("taco"), myType("taco"), ""},
-
- // Wrong types.
- {nil, nil, "given <nil>"},
- {int(1), nil, "given int"},
- {float64(1), nil, "given float64"},
- {complex128(1), nil, "given complex128"},
- {string(""), nil, "given string"},
- {&someInt, nil, "given *int"},
- {make(chan int), nil, "given chan int"},
- }
-
- t.runTestCases(sig, cases)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/save_arg_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/save_arg_test.go
deleted file mode 100644
index 4051907e0dd..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/oglemock/save_arg_test.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2015 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package oglemock_test
-
-import (
- "io"
- "os"
- "reflect"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- "github.com/smartystreets/assertions/internal/oglemock"
- . "github.com/smartystreets/assertions/internal/ogletest"
-)
-
-func TestSaveArg(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////
-// Boilerplate
-////////////////////////////////////////////////////////////
-
-type SaveArgTest struct {
-}
-
-func init() { RegisterTestSuite(&SaveArgTest{}) }
-
-////////////////////////////////////////////////////////////
-// Test functions
-////////////////////////////////////////////////////////////
-
-func (t *SaveArgTest) FunctionHasNoArguments() {
- const index = 0
- var dst int
- f := func() (int, string) { return 0, "" }
-
- err := oglemock.SaveArg(index, &dst).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("index 0")))
- ExpectThat(err, Error(HasSubstr("Out of range")))
- ExpectThat(err, Error(HasSubstr("func() (int, string)")))
-}
-
-func (t *SaveArgTest) ArgumentIndexOutOfRange() {
- const index = 2
- var dst int
- f := func(a int, b int) {}
-
- err := oglemock.SaveArg(index, &dst).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("index 2")))
- ExpectThat(err, Error(HasSubstr("Out of range")))
- ExpectThat(err, Error(HasSubstr("func(int, int)")))
-}
-
-func (t *SaveArgTest) DestinationIsLiteralNil() {
- const index = 0
- f := func(a int, b int) {}
-
- err := oglemock.SaveArg(index, nil).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("not a pointer")))
-}
-
-func (t *SaveArgTest) DestinationIsNotAPointer() {
- const index = 0
- f := func(a int, b int) {}
-
- err := oglemock.SaveArg(index, uint(17)).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("pointer")))
- ExpectThat(err, Error(HasSubstr("uint")))
-}
-
-func (t *SaveArgTest) DestinationIsNilPointer() {
- const index = 1
- var dst *int
- f := func(a int, b int) {}
-
- err := oglemock.SaveArg(index, dst).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("pointer")))
- ExpectThat(err, Error(HasSubstr("non-nil")))
-}
-
-func (t *SaveArgTest) DestinationNotAssignableFromSource() {
- const index = 1
- var dst int
- f := func(a int, b string) {}
-
- err := oglemock.SaveArg(index, &dst).SetSignature(reflect.TypeOf(f))
- ExpectThat(err, Error(HasSubstr("int")))
- ExpectThat(err, Error(HasSubstr("assignable")))
- ExpectThat(err, Error(HasSubstr("string")))
-}
-
-func (t *SaveArgTest) ExactTypeMatch() {
- const index = 1
- var dst int
- f := func(a int, b int) {}
-
- action := oglemock.SaveArg(index, &dst)
- AssertEq(nil, action.SetSignature(reflect.TypeOf(f)))
-
- var a int = 17
- var b int = 19
- _ = action.Invoke([]interface{}{a, b})
-
- ExpectEq(19, dst)
-}
-
-func (t *SaveArgTest) AssignableTypeMatch() {
- const index = 1
- var dst io.Reader
- f := func(a int, b *os.File) {}
-
- action := oglemock.SaveArg(index, &dst)
- AssertEq(nil, action.SetSignature(reflect.TypeOf(f)))
-
- var a int = 17
- var b *os.File = os.Stdout
- _ = action.Invoke([]interface{}{a, b})
-
- ExpectEq(os.Stdout, dst)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/expect_that_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/expect_that_test.go
deleted file mode 100644
index e3e37236700..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/expect_that_test.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package ogletest
-
-import (
- "errors"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
-)
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-// Set up a new test state with empty fields.
-func setUpCurrentTest() {
- currentlyRunningTest = newTestInfo()
-}
-
-type fakeExpectThatMatcher struct {
- desc string
- err error
-}
-
-func (m *fakeExpectThatMatcher) Matches(c interface{}) error {
- return m.err
-}
-
-func (m *fakeExpectThatMatcher) Description() string {
- return m.desc
-}
-
-func assertEqInt(t *testing.T, e, c int) {
- if e != c {
- t.Fatalf("Expected %d, got %d", e, c)
- }
-}
-
-func expectEqInt(t *testing.T, e, c int) {
- if e != c {
- t.Errorf("Expected %v, got %v", e, c)
- }
-}
-
-func expectEqStr(t *testing.T, e, c string) {
- if e != c {
- t.Errorf("Expected %s, got %s", e, c)
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func TestNoCurrentTest(t *testing.T) {
- panicked := false
-
- defer func() {
- if !panicked {
- t.Errorf("Expected panic; got none.")
- }
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- currentlyRunningTest = nil
- ExpectThat(17, Equals(19))
-}
-
-func TestNoFailure(t *testing.T) {
- setUpCurrentTest()
- matcher := &fakeExpectThatMatcher{"", nil}
- ExpectThat(17, matcher)
-
- assertEqInt(t, 0, len(currentlyRunningTest.failureRecords))
-}
-
-func TestInvalidFormatString(t *testing.T) {
- panicked := false
-
- defer func() {
- if !panicked {
- t.Errorf("Expected panic; got none.")
- }
- }()
-
- defer func() {
- if r := recover(); r != nil {
- panicked = true
- }
- }()
-
- setUpCurrentTest()
- matcher := &fakeExpectThatMatcher{"", errors.New("")}
- ExpectThat(17, matcher, 19, "blah")
-}
-
-func TestNoMatchWithoutErrorText(t *testing.T) {
- setUpCurrentTest()
- matcher := &fakeExpectThatMatcher{"taco", errors.New("")}
- ExpectThat(17, matcher)
-
- assertEqInt(t, 1, len(currentlyRunningTest.failureRecords))
-
- record := currentlyRunningTest.failureRecords[0]
- expectEqStr(t, "expect_that_test.go", record.FileName)
- expectEqInt(t, 119, record.LineNumber)
- expectEqStr(t, "Expected: taco\nActual: 17", record.Error)
-}
-
-func TestNoMatchWithErrorTExt(t *testing.T) {
- setUpCurrentTest()
- matcher := &fakeExpectThatMatcher{"taco", errors.New("which is foo")}
- ExpectThat(17, matcher)
-
- assertEqInt(t, 1, len(currentlyRunningTest.failureRecords))
- record := currentlyRunningTest.failureRecords[0]
-
- expectEqStr(
- t,
- "Expected: taco\nActual: 17, which is foo",
- record.Error)
-}
-
-func TestFailureWithUserMessage(t *testing.T) {
- setUpCurrentTest()
- matcher := &fakeExpectThatMatcher{"taco", errors.New("")}
- ExpectThat(17, matcher, "Asd: %d %s", 19, "taco")
-
- assertEqInt(t, 1, len(currentlyRunningTest.failureRecords))
- record := currentlyRunningTest.failureRecords[0]
-
- expectEqStr(t, "Expected: taco\nActual: 17\nAsd: 19 taco", record.Error)
-}
-
-func TestAdditionalFailure(t *testing.T) {
- setUpCurrentTest()
- matcher := &fakeExpectThatMatcher{"", errors.New("")}
-
- // Fail twice.
- ExpectThat(17, matcher, "taco")
- ExpectThat(19, matcher, "burrito")
-
- assertEqInt(t, 2, len(currentlyRunningTest.failureRecords))
- record1 := currentlyRunningTest.failureRecords[0]
- record2 := currentlyRunningTest.failureRecords[1]
-
- expectEqStr(t, "Expected: \nActual: 17\ntaco", record1.Error)
- expectEqStr(t, "Expected: \nActual: 19\nburrito", record2.Error)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/integration_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/integration_test.go
deleted file mode 100644
index ec45184e326..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/integration_test.go
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright 2011 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package ogletest_test
-
-import (
- "errors"
- "flag"
- "fmt"
- "go/build"
- "io/ioutil"
- "os"
- "os/exec"
- "path"
- "regexp"
- "strings"
- "syscall"
- "testing"
-)
-
-const ogletestPkg = "github.com/smartystreets/assertions/internal/ogletest"
-
-var dumpNew = flag.Bool("dump_new", false, "Dump new golden files.")
-var objDir string
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-// Install the possibly locally-modified copy of ogletest, so that these
-// integration tests run using the package currently being worked on by the
-// programmer. Also install other dependencies needed by the test cases, so
-// that `go test` complaining about non-up-to-date packages doesn't make it
-// into the golden files.
-func installLocalPackages() error {
- cmd := exec.Command(
- "go",
- "install",
- ogletestPkg,
- "github.com/smartystreets/assertions/internal/oglemock",
- "github.com/smartystreets/assertions/internal/ogletest/test_cases/mock_image")
-
- output, err := cmd.CombinedOutput()
-
- if err != nil {
- return errors.New(fmt.Sprintf("%v:\n%s", err, output))
- }
-
- return nil
-}
-
-// getCaseNames looks for integration test cases as files in the test_cases
-// directory.
-func getCaseNames() ([]string, error) {
- // Open the test cases directory.
- dir, err := os.Open("test_cases")
- if err != nil {
- return nil, errors.New(fmt.Sprintf("Opening dir: %v", err))
- }
-
- // Get a list of the names in the directory.
- names, err := dir.Readdirnames(0)
- if err != nil {
- return nil, errors.New(fmt.Sprintf("Readdirnames: %v", err))
- }
-
- // Filter the names.
- result := make([]string, len(names))
- resultLen := 0
- for _, name := range names {
- // Skip golden files and hidden files.
- if strings.HasPrefix(name, "golden.") || strings.HasPrefix(name, ".") {
- continue
- }
-
- // Check for the right format.
- if !strings.HasSuffix(name, ".test.go") {
- continue
- }
-
- // Store the name minus the extension.
- result[resultLen] = name[:len(name)-8]
- resultLen++
- }
-
- return result[:resultLen], nil
-}
-
-func writeContentsToFileOrDie(contents []byte, path string) {
- if err := ioutil.WriteFile(path, contents, 0600); err != nil {
- panic("ioutil.WriteFile: " + err.Error())
- }
-}
-
-func readFileOrDie(path string) []byte {
- contents, err := ioutil.ReadFile(path)
- if err != nil {
- panic("ioutil.ReadFile: " + err.Error())
- }
-
- return contents
-}
-
-// cleanOutput transforms the supplied output so that it no longer contains
-// information that changes from run to run, making the golden tests less
-// flaky.
-func cleanOutput(o []byte, testPkg string) []byte {
- // Replace references to the last component of the test package name, which
- // contains a unique number.
- o = []byte(strings.Replace(string(o), path.Base(testPkg), "somepkg", -1))
-
- // Replace things that look like line numbers and process counters in stack
- // traces.
- stackFrameRe := regexp.MustCompile(`\t\S+\.(c|go):\d+`)
- o = stackFrameRe.ReplaceAll(o, []byte("\tsome_file.txt:0"))
-
- // Replace full paths in failure messages with fake paths.
- pathRe := regexp.MustCompile(`/\S+/(\w+\.(?:go|s):\d+)`)
- o = pathRe.ReplaceAll(o, []byte("/some/path/$1"))
-
- // Replace unstable timings in gotest fail messages.
- timingRe1 := regexp.MustCompile(`--- FAIL: .* \(\d\.\d{2}s\)`)
- o = timingRe1.ReplaceAll(o, []byte("--- FAIL: TestSomething (1.23s)"))
-
- timingRe2 := regexp.MustCompile(`FAIL.*somepkg\s*\d\.\d{2,}s`)
- o = timingRe2.ReplaceAll(o, []byte("FAIL somepkg 1.234s"))
-
- timingRe3 := regexp.MustCompile(`ok.*somepkg\s*\d\.\d{2,}s`)
- o = timingRe3.ReplaceAll(o, []byte("ok somepkg 1.234s"))
-
- timingRe4 := regexp.MustCompile(`SlowTest \([0-9.]+ms\)`)
- o = timingRe4.ReplaceAll(o, []byte("SlowTest (1234ms)"))
-
- return o
-}
-
-// Create a temporary package directory somewhere that 'go test' can find, and
-// return the directory and package name.
-func createTempPackageDir(caseName string) (dir, pkg string) {
- // Figure out where the local source code for ogletest is.
- buildPkg, err := build.Import(ogletestPkg, "", build.FindOnly)
- if err != nil {
- panic("Finding ogletest tree: " + err.Error())
- }
-
- // Create a temporary directory underneath this.
- ogletestPkgDir := buildPkg.Dir
- prefix := fmt.Sprintf("tmp-%s-", caseName)
-
- dir, err = ioutil.TempDir(ogletestPkgDir, prefix)
- if err != nil {
- panic("ioutil.TempDir: " + err.Error())
- }
-
- pkg = path.Join("github.com/smartystreets/assertions/internal/ogletest", dir[len(ogletestPkgDir):])
- return
-}
-
-// runTestCase runs the case with the supplied name (e.g. "passing"), and
-// returns its output and exit code.
-func runTestCase(name string) ([]byte, int, error) {
- // Create a temporary directory for the test files.
- testDir, testPkg := createTempPackageDir(name)
- defer os.RemoveAll(testDir)
-
- // Create the test source file.
- sourceFile := name + ".test.go"
- testContents := readFileOrDie(path.Join("test_cases", sourceFile))
- writeContentsToFileOrDie(testContents, path.Join(testDir, name+"_test.go"))
-
- // Invoke 'go test'. Use the package directory as working dir instead of
- // giving the package name as an argument so that 'go test' prints passing
- // test output. Special case: pass a test filter to the filtered case.
- cmd := exec.Command("go", "test")
- if name == "filtered" {
- cmd.Args = append(cmd.Args, "--ogletest.run=Test(Bar|Baz)")
- }
-
- cmd.Dir = testDir
- output, err := cmd.CombinedOutput()
-
- // Clean up the process's output.
- output = cleanOutput(output, testPkg)
-
- // Did the process exist with zero code?
- if err == nil {
- return output, 0, nil
- }
-
- // Make sure the process actually exited.
- exitError, ok := err.(*exec.ExitError)
- if !ok || !exitError.Exited() {
- return nil, 0, errors.New("exec.Command.Output: " + err.Error())
- }
-
- return output, exitError.Sys().(syscall.WaitStatus).ExitStatus(), nil
-}
-
-// checkGolden file checks the supplied actual output for the named test case
-// against the golden file for that case. If requested by the user, it rewrites
-// the golden file on failure.
-func checkAgainstGoldenFile(caseName string, output []byte) bool {
- goldenFile := path.Join("test_cases", "golden."+caseName+"_test")
- goldenContents := readFileOrDie(goldenFile)
-
- result := string(output) == string(goldenContents)
- if !result && *dumpNew {
- writeContentsToFileOrDie(output, goldenFile)
- }
-
- return result
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func TestGoldenFiles(t *testing.T) {
- // Ensure the local package is installed. This will prevent the test cases
- // from using the installed version, which may be out of date.
- err := installLocalPackages()
- if err != nil {
- t.Fatalf("Error installing local ogletest: %v", err)
- }
-
- // We expect there to be at least one case.
- caseNames, err := getCaseNames()
- if err != nil || len(caseNames) == 0 {
- t.Fatalf("Error getting cases: %v", err)
- }
-
- // Run each test case.
- for _, caseName := range caseNames {
- // Run the test case.
- output, exitCode, err := runTestCase(caseName)
- if err != nil {
- t.Fatalf("Running test case %s: %v", caseName, err)
- }
-
- // Check the status code. We assume all test cases fail except for the
- // passing one.
- shouldPass := (caseName == "passing" || caseName == "no_cases")
- didPass := exitCode == 0
- if shouldPass != didPass {
- t.Errorf("Bad exit code for test case %s: %d", caseName, exitCode)
- }
-
- // Check the output against the golden file.
- if !checkAgainstGoldenFile(caseName, output) {
- t.Errorf("Output for test case %s doesn't match golden file.", caseName)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/srcutil/methods_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/srcutil/methods_test.go
deleted file mode 100644
index 95c07fd4697..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/internal/ogletest/srcutil/methods_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2012 Aaron Jacobs. All Rights Reserved.
-// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package srcutil_test
-
-import (
- "fmt"
- "reflect"
- "testing"
-
- . "github.com/smartystreets/assertions/internal/oglematchers"
- . "github.com/smartystreets/assertions/internal/ogletest"
- "github.com/smartystreets/assertions/internal/ogletest/srcutil"
-)
-
-func TestRegisterMethodsTest(t *testing.T) { RunTests(t) }
-
-////////////////////////////////////////////////////////////////////////
-// Helpers
-////////////////////////////////////////////////////////////////////////
-
-type MethodsTest struct {
-}
-
-func init() { RegisterTestSuite(&MethodsTest{}) }
-
-type OneMethodType int
-
-func (x OneMethodType) Foo() {}
-
-type MultipleMethodsType int
-
-func (x MultipleMethodsType) Foo() {}
-func (x MultipleMethodsType) Bar() {}
-func (x MultipleMethodsType) Baz() {}
-
-type methodNameMatcher struct {
- expected string
-}
-
-func (m *methodNameMatcher) Description() string {
- return fmt.Sprintf("method named %s", m.expected)
-}
-
-func (m *methodNameMatcher) Matches(x interface{}) error {
- method, ok := x.(reflect.Method)
- if !ok {
- panic("Invalid argument.")
- }
-
- if method.Name != m.expected {
- return fmt.Errorf("whose name is %s", method.Name)
- }
-
- return nil
-}
-
-func NameIs(name string) Matcher {
- return &methodNameMatcher{name}
-}
-
-////////////////////////////////////////////////////////////////////////
-// Tests
-////////////////////////////////////////////////////////////////////////
-
-func (t *MethodsTest) NoMethods() {
- type foo int
-
- methods := srcutil.GetMethodsInSourceOrder(reflect.TypeOf(foo(17)))
- ExpectThat(methods, ElementsAre())
-}
-
-func (t *MethodsTest) OneMethod() {
- methods := srcutil.GetMethodsInSourceOrder(reflect.TypeOf(OneMethodType(17)))
- ExpectThat(
- methods,
- ElementsAre(
- NameIs("Foo"),
- ))
-}
-
-func (t *MethodsTest) MultipleMethods() {
- methods := srcutil.GetMethodsInSourceOrder(reflect.TypeOf(MultipleMethodsType(17)))
- ExpectThat(
- methods,
- ElementsAre(
- NameIs("Foo"),
- NameIs("Bar"),
- NameIs("Baz"),
- ))
-
- ExpectEq("Foo", methods[0].Name)
- ExpectEq("Bar", methods[1].Name)
- ExpectEq("Baz", methods[2].Name)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/panic_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/panic_test.go
deleted file mode 100644
index 15eafac4fbb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/panic_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "testing"
-)
-
-func TestShouldPanic(t *testing.T) {
- fail(t, so(func() {}, ShouldPanic, 1), "This assertion requires exactly 0 comparison values (you provided 1).")
- fail(t, so(func() {}, ShouldPanic, 1, 2, 3), "This assertion requires exactly 0 comparison values (you provided 3).")
-
- fail(t, so(1, ShouldPanic), shouldUseVoidNiladicFunction)
- fail(t, so(func(i int) {}, ShouldPanic), shouldUseVoidNiladicFunction)
- fail(t, so(func() int { panic("hi") }, ShouldPanic), shouldUseVoidNiladicFunction)
-
- fail(t, so(func() {}, ShouldPanic), shouldHavePanicked)
- pass(t, so(func() { panic("hi") }, ShouldPanic))
-}
-
-func TestShouldNotPanic(t *testing.T) {
- fail(t, so(func() {}, ShouldNotPanic, 1), "This assertion requires exactly 0 comparison values (you provided 1).")
- fail(t, so(func() {}, ShouldNotPanic, 1, 2, 3), "This assertion requires exactly 0 comparison values (you provided 3).")
-
- fail(t, so(1, ShouldNotPanic), shouldUseVoidNiladicFunction)
- fail(t, so(func(i int) {}, ShouldNotPanic), shouldUseVoidNiladicFunction)
-
- fail(t, so(func() { panic("hi") }, ShouldNotPanic), fmt.Sprintf(shouldNotHavePanicked, "hi"))
- pass(t, so(func() {}, ShouldNotPanic))
-}
-
-func TestShouldPanicWith(t *testing.T) {
- fail(t, so(func() {}, ShouldPanicWith), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(func() {}, ShouldPanicWith, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(1, ShouldPanicWith, 1), shouldUseVoidNiladicFunction)
- fail(t, so(func(i int) {}, ShouldPanicWith, "hi"), shouldUseVoidNiladicFunction)
- fail(t, so(func() {}, ShouldPanicWith, "bye"), shouldHavePanicked)
- fail(t, so(func() { panic("hi") }, ShouldPanicWith, "bye"), "bye|hi|Expected func() to panic with 'bye' (but it panicked with 'hi')!")
-
- pass(t, so(func() { panic("hi") }, ShouldPanicWith, "hi"))
-}
-
-func TestShouldNotPanicWith(t *testing.T) {
- fail(t, so(func() {}, ShouldNotPanicWith), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(func() {}, ShouldNotPanicWith, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(1, ShouldNotPanicWith, 1), shouldUseVoidNiladicFunction)
- fail(t, so(func(i int) {}, ShouldNotPanicWith, "hi"), shouldUseVoidNiladicFunction)
- fail(t, so(func() { panic("hi") }, ShouldNotPanicWith, "hi"), "Expected func() NOT to panic with 'hi' (but it did)!")
-
- pass(t, so(func() {}, ShouldNotPanicWith, "bye"))
- pass(t, so(func() { panic("hi") }, ShouldNotPanicWith, "bye"))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/quantity_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/quantity_test.go
deleted file mode 100644
index 7546e7250a8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/quantity_test.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package assertions
-
-import "testing"
-
-func TestShouldBeGreaterThan(t *testing.T) {
- fail(t, so(1, ShouldBeGreaterThan), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldBeGreaterThan, 0, 0), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(1, ShouldBeGreaterThan, 0))
- pass(t, so(1.1, ShouldBeGreaterThan, 1))
- pass(t, so(1, ShouldBeGreaterThan, uint(0)))
- pass(t, so("b", ShouldBeGreaterThan, "a"))
-
- fail(t, so(0, ShouldBeGreaterThan, 1), "Expected '0' to be greater than '1' (but it wasn't)!")
- fail(t, so(1, ShouldBeGreaterThan, 1.1), "Expected '1' to be greater than '1.1' (but it wasn't)!")
- fail(t, so(uint(0), ShouldBeGreaterThan, 1.1), "Expected '0' to be greater than '1.1' (but it wasn't)!")
- fail(t, so("a", ShouldBeGreaterThan, "b"), "Expected 'a' to be greater than 'b' (but it wasn't)!")
-}
-
-func TestShouldBeGreaterThanOrEqual(t *testing.T) {
- fail(t, so(1, ShouldBeGreaterThanOrEqualTo), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldBeGreaterThanOrEqualTo, 0, 0), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(1, ShouldBeGreaterThanOrEqualTo, 1))
- pass(t, so(1.1, ShouldBeGreaterThanOrEqualTo, 1.1))
- pass(t, so(1, ShouldBeGreaterThanOrEqualTo, uint(1)))
- pass(t, so("b", ShouldBeGreaterThanOrEqualTo, "b"))
-
- pass(t, so(1, ShouldBeGreaterThanOrEqualTo, 0))
- pass(t, so(1.1, ShouldBeGreaterThanOrEqualTo, 1))
- pass(t, so(1, ShouldBeGreaterThanOrEqualTo, uint(0)))
- pass(t, so("b", ShouldBeGreaterThanOrEqualTo, "a"))
-
- fail(t, so(0, ShouldBeGreaterThanOrEqualTo, 1), "Expected '0' to be greater than or equal to '1' (but it wasn't)!")
- fail(t, so(1, ShouldBeGreaterThanOrEqualTo, 1.1), "Expected '1' to be greater than or equal to '1.1' (but it wasn't)!")
- fail(t, so(uint(0), ShouldBeGreaterThanOrEqualTo, 1.1), "Expected '0' to be greater than or equal to '1.1' (but it wasn't)!")
- fail(t, so("a", ShouldBeGreaterThanOrEqualTo, "b"), "Expected 'a' to be greater than or equal to 'b' (but it wasn't)!")
-}
-
-func TestShouldBeLessThan(t *testing.T) {
- fail(t, so(1, ShouldBeLessThan), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldBeLessThan, 0, 0), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(0, ShouldBeLessThan, 1))
- pass(t, so(1, ShouldBeLessThan, 1.1))
- pass(t, so(uint(0), ShouldBeLessThan, 1))
- pass(t, so("a", ShouldBeLessThan, "b"))
-
- fail(t, so(1, ShouldBeLessThan, 0), "Expected '1' to be less than '0' (but it wasn't)!")
- fail(t, so(1.1, ShouldBeLessThan, 1), "Expected '1.1' to be less than '1' (but it wasn't)!")
- fail(t, so(1.1, ShouldBeLessThan, uint(0)), "Expected '1.1' to be less than '0' (but it wasn't)!")
- fail(t, so("b", ShouldBeLessThan, "a"), "Expected 'b' to be less than 'a' (but it wasn't)!")
-}
-
-func TestShouldBeLessThanOrEqualTo(t *testing.T) {
- fail(t, so(1, ShouldBeLessThanOrEqualTo), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldBeLessThanOrEqualTo, 0, 0), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so(1, ShouldBeLessThanOrEqualTo, 1))
- pass(t, so(1.1, ShouldBeLessThanOrEqualTo, 1.1))
- pass(t, so(uint(1), ShouldBeLessThanOrEqualTo, 1))
- pass(t, so("b", ShouldBeLessThanOrEqualTo, "b"))
-
- pass(t, so(0, ShouldBeLessThanOrEqualTo, 1))
- pass(t, so(1, ShouldBeLessThanOrEqualTo, 1.1))
- pass(t, so(uint(0), ShouldBeLessThanOrEqualTo, 1))
- pass(t, so("a", ShouldBeLessThanOrEqualTo, "b"))
-
- fail(t, so(1, ShouldBeLessThanOrEqualTo, 0), "Expected '1' to be less than '0' (but it wasn't)!")
- fail(t, so(1.1, ShouldBeLessThanOrEqualTo, 1), "Expected '1.1' to be less than '1' (but it wasn't)!")
- fail(t, so(1.1, ShouldBeLessThanOrEqualTo, uint(0)), "Expected '1.1' to be less than '0' (but it wasn't)!")
- fail(t, so("b", ShouldBeLessThanOrEqualTo, "a"), "Expected 'b' to be less than 'a' (but it wasn't)!")
-}
-
-func TestShouldBeBetween(t *testing.T) {
- fail(t, so(1, ShouldBeBetween), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(1, ShouldBeBetween, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(4, ShouldBeBetween, 1, 1), "The lower and upper bounds must be different values (they were both '1').")
-
- fail(t, so(7, ShouldBeBetween, 8, 12), "Expected '7' to be between '8' and '12' (but it wasn't)!")
- fail(t, so(8, ShouldBeBetween, 8, 12), "Expected '8' to be between '8' and '12' (but it wasn't)!")
- pass(t, so(9, ShouldBeBetween, 8, 12))
- pass(t, so(10, ShouldBeBetween, 8, 12))
- pass(t, so(11, ShouldBeBetween, 8, 12))
- fail(t, so(12, ShouldBeBetween, 8, 12), "Expected '12' to be between '8' and '12' (but it wasn't)!")
- fail(t, so(13, ShouldBeBetween, 8, 12), "Expected '13' to be between '8' and '12' (but it wasn't)!")
-
- pass(t, so(1, ShouldBeBetween, 2, 0))
- fail(t, so(-1, ShouldBeBetween, 2, 0), "Expected '-1' to be between '0' and '2' (but it wasn't)!")
-}
-
-func TestShouldNotBeBetween(t *testing.T) {
- fail(t, so(1, ShouldNotBeBetween), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(1, ShouldNotBeBetween, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(4, ShouldNotBeBetween, 1, 1), "The lower and upper bounds must be different values (they were both '1').")
-
- pass(t, so(7, ShouldNotBeBetween, 8, 12))
- pass(t, so(8, ShouldNotBeBetween, 8, 12))
- fail(t, so(9, ShouldNotBeBetween, 8, 12), "Expected '9' NOT to be between '8' and '12' (but it was)!")
- fail(t, so(10, ShouldNotBeBetween, 8, 12), "Expected '10' NOT to be between '8' and '12' (but it was)!")
- fail(t, so(11, ShouldNotBeBetween, 8, 12), "Expected '11' NOT to be between '8' and '12' (but it was)!")
- pass(t, so(12, ShouldNotBeBetween, 8, 12))
- pass(t, so(13, ShouldNotBeBetween, 8, 12))
-
- pass(t, so(-1, ShouldNotBeBetween, 2, 0))
- fail(t, so(1, ShouldNotBeBetween, 2, 0), "Expected '1' NOT to be between '0' and '2' (but it was)!")
-}
-
-func TestShouldBeBetweenOrEqual(t *testing.T) {
- fail(t, so(1, ShouldBeBetweenOrEqual), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(1, ShouldBeBetweenOrEqual, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(4, ShouldBeBetweenOrEqual, 1, 1), "The lower and upper bounds must be different values (they were both '1').")
-
- fail(t, so(7, ShouldBeBetweenOrEqual, 8, 12), "Expected '7' to be between '8' and '12' or equal to one of them (but it wasn't)!")
- pass(t, so(8, ShouldBeBetweenOrEqual, 8, 12))
- pass(t, so(9, ShouldBeBetweenOrEqual, 8, 12))
- pass(t, so(10, ShouldBeBetweenOrEqual, 8, 12))
- pass(t, so(11, ShouldBeBetweenOrEqual, 8, 12))
- pass(t, so(12, ShouldBeBetweenOrEqual, 8, 12))
- fail(t, so(13, ShouldBeBetweenOrEqual, 8, 12), "Expected '13' to be between '8' and '12' or equal to one of them (but it wasn't)!")
-
- pass(t, so(1, ShouldBeBetweenOrEqual, 2, 0))
- fail(t, so(-1, ShouldBeBetweenOrEqual, 2, 0), "Expected '-1' to be between '0' and '2' or equal to one of them (but it wasn't)!")
-}
-
-func TestShouldNotBeBetweenOrEqual(t *testing.T) {
- fail(t, so(1, ShouldNotBeBetweenOrEqual), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(1, ShouldNotBeBetweenOrEqual, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(4, ShouldNotBeBetweenOrEqual, 1, 1), "The lower and upper bounds must be different values (they were both '1').")
-
- pass(t, so(7, ShouldNotBeBetweenOrEqual, 8, 12))
- fail(t, so(8, ShouldNotBeBetweenOrEqual, 8, 12), "Expected '8' NOT to be between '8' and '12' or equal to one of them (but it was)!")
- fail(t, so(9, ShouldNotBeBetweenOrEqual, 8, 12), "Expected '9' NOT to be between '8' and '12' or equal to one of them (but it was)!")
- fail(t, so(10, ShouldNotBeBetweenOrEqual, 8, 12), "Expected '10' NOT to be between '8' and '12' or equal to one of them (but it was)!")
- fail(t, so(11, ShouldNotBeBetweenOrEqual, 8, 12), "Expected '11' NOT to be between '8' and '12' or equal to one of them (but it was)!")
- fail(t, so(12, ShouldNotBeBetweenOrEqual, 8, 12), "Expected '12' NOT to be between '8' and '12' or equal to one of them (but it was)!")
- pass(t, so(13, ShouldNotBeBetweenOrEqual, 8, 12))
-
- pass(t, so(-1, ShouldNotBeBetweenOrEqual, 2, 0))
- fail(t, so(1, ShouldNotBeBetweenOrEqual, 2, 0), "Expected '1' NOT to be between '0' and '2' or equal to one of them (but it was)!")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/serializer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/serializer_test.go
deleted file mode 100644
index 597b40ac183..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/serializer_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package assertions
-
-import (
- "encoding/json"
- "fmt"
- "testing"
-)
-
-func TestSerializerCreatesSerializedVersionOfAssertionResult(t *testing.T) {
- thing1 := Thing1{"Hi"}
- thing2 := Thing2{"Bye"}
- message := "Super-hip failure message."
- serializer := newSerializer()
-
- actualResult := serializer.serialize(thing1, thing2, message)
-
- expectedResult, _ := json.Marshal(FailureView{
- Message: message,
- Expected: fmt.Sprintf("%+v", thing1),
- Actual: fmt.Sprintf("%+v", thing2),
- })
-
- if actualResult != string(expectedResult) {
- t.Errorf("\nExpected: %s\nActual: %s", string(expectedResult), actualResult)
- }
-
- actualResult = serializer.serializeDetailed(thing1, thing2, message)
- expectedResult, _ = json.Marshal(FailureView{
- Message: message,
- Expected: fmt.Sprintf("%#v", thing1),
- Actual: fmt.Sprintf("%#v", thing2),
- })
- if actualResult != string(expectedResult) {
- t.Errorf("\nExpected: %s\nActual: %s", string(expectedResult), actualResult)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/strings_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/strings_test.go
deleted file mode 100644
index ad8d0c88585..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/strings_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-package assertions
-
-import "testing"
-
-func TestShouldStartWith(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so("", ShouldStartWith), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so("", ShouldStartWith, "asdf", "asdf"), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so("", ShouldStartWith, ""))
- fail(t, so("", ShouldStartWith, "x"), "x||Expected '' to start with 'x' (but it didn't)!")
- pass(t, so("abc", ShouldStartWith, "abc"))
- fail(t, so("abc", ShouldStartWith, "abcd"), "abcd|abc|Expected 'abc' to start with 'abcd' (but it didn't)!")
-
- pass(t, so("superman", ShouldStartWith, "super"))
- fail(t, so("superman", ShouldStartWith, "bat"), "bat|sup...|Expected 'superman' to start with 'bat' (but it didn't)!")
- fail(t, so("superman", ShouldStartWith, "man"), "man|sup...|Expected 'superman' to start with 'man' (but it didn't)!")
-
- fail(t, so(1, ShouldStartWith, 2), "Both arguments to this assertion must be strings (you provided int and int).")
-}
-
-func TestShouldNotStartWith(t *testing.T) {
- fail(t, so("", ShouldNotStartWith), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so("", ShouldNotStartWith, "asdf", "asdf"), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- fail(t, so("", ShouldNotStartWith, ""), "Expected '<empty>' NOT to start with '<empty>' (but it did)!")
- fail(t, so("superman", ShouldNotStartWith, "super"), "Expected 'superman' NOT to start with 'super' (but it did)!")
- pass(t, so("superman", ShouldNotStartWith, "bat"))
- pass(t, so("superman", ShouldNotStartWith, "man"))
-
- fail(t, so(1, ShouldNotStartWith, 2), "Both arguments to this assertion must be strings (you provided int and int).")
-}
-
-func TestShouldEndWith(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so("", ShouldEndWith), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so("", ShouldEndWith, "", ""), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- pass(t, so("", ShouldEndWith, ""))
- fail(t, so("", ShouldEndWith, "z"), "z||Expected '' to end with 'z' (but it didn't)!")
- pass(t, so("xyz", ShouldEndWith, "xyz"))
- fail(t, so("xyz", ShouldEndWith, "wxyz"), "wxyz|xyz|Expected 'xyz' to end with 'wxyz' (but it didn't)!")
-
- pass(t, so("superman", ShouldEndWith, "man"))
- fail(t, so("superman", ShouldEndWith, "super"), "super|...erman|Expected 'superman' to end with 'super' (but it didn't)!")
- fail(t, so("superman", ShouldEndWith, "blah"), "blah|...rman|Expected 'superman' to end with 'blah' (but it didn't)!")
-
- fail(t, so(1, ShouldEndWith, 2), "Both arguments to this assertion must be strings (you provided int and int).")
-}
-
-func TestShouldNotEndWith(t *testing.T) {
- fail(t, so("", ShouldNotEndWith), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so("", ShouldNotEndWith, "", ""), "This assertion requires exactly 1 comparison values (you provided 2).")
-
- fail(t, so("", ShouldNotEndWith, ""), "Expected '<empty>' NOT to end with '<empty>' (but it did)!")
- fail(t, so("superman", ShouldNotEndWith, "man"), "Expected 'superman' NOT to end with 'man' (but it did)!")
- pass(t, so("superman", ShouldNotEndWith, "super"))
-
- fail(t, so(1, ShouldNotEndWith, 2), "Both arguments to this assertion must be strings (you provided int and int).")
-}
-
-func TestShouldContainSubstring(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so("asdf", ShouldContainSubstring), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so("asdf", ShouldContainSubstring, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(123, ShouldContainSubstring, 23), "Both arguments to this assertion must be strings (you provided int and int).")
-
- pass(t, so("asdf", ShouldContainSubstring, "sd"))
- fail(t, so("qwer", ShouldContainSubstring, "sd"), "sd|qwer|Expected 'qwer' to contain substring 'sd' (but it didn't)!")
-}
-
-func TestShouldNotContainSubstring(t *testing.T) {
- fail(t, so("asdf", ShouldNotContainSubstring), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so("asdf", ShouldNotContainSubstring, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(123, ShouldNotContainSubstring, 23), "Both arguments to this assertion must be strings (you provided int and int).")
-
- pass(t, so("qwer", ShouldNotContainSubstring, "sd"))
- fail(t, so("asdf", ShouldNotContainSubstring, "sd"), "Expected 'asdf' NOT to contain substring 'sd' (but it did)!")
-}
-
-func TestShouldBeBlank(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so("", ShouldBeBlank, "adsf"), "This assertion requires exactly 0 comparison values (you provided 1).")
- fail(t, so(1, ShouldBeBlank), "The argument to this assertion must be a string (you provided int).")
-
- fail(t, so("asdf", ShouldBeBlank), "|asdf|Expected 'asdf' to be blank (but it wasn't)!")
- pass(t, so("", ShouldBeBlank))
-}
-
-func TestShouldNotBeBlank(t *testing.T) {
- fail(t, so("", ShouldNotBeBlank, "adsf"), "This assertion requires exactly 0 comparison values (you provided 1).")
- fail(t, so(1, ShouldNotBeBlank), "The argument to this assertion must be a string (you provided int).")
-
- fail(t, so("", ShouldNotBeBlank), "Expected value to NOT be blank (but it was)!")
- pass(t, so("asdf", ShouldNotBeBlank))
-}
-
-func TestShouldEqualWithout(t *testing.T) {
- fail(t, so("", ShouldEqualWithout, ""), "This assertion requires exactly 2 comparison values (you provided 1).")
- fail(t, so(1, ShouldEqualWithout, 2, 3), "All arguments to this assertion must be strings (you provided: [int int int]).")
-
- fail(t, so("asdf", ShouldEqualWithout, "qwer", "q"), "Expected 'asdf' to equal 'qwer' but without any 'q' (but it didn't).")
- pass(t, so("asdf", ShouldEqualWithout, "df", "as"))
-}
-
-func TestShouldEqualTrimSpace(t *testing.T) {
- fail(t, so(" asdf ", ShouldEqualTrimSpace), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldEqualTrimSpace, 2), "Both arguments to this assertion must be strings (you provided int and int).")
-
- fail(t, so("asdf", ShouldEqualTrimSpace, "qwer"), "qwer|asdf|Expected: 'qwer' Actual: 'asdf' (Should be equal)")
- pass(t, so(" asdf\t\n", ShouldEqualTrimSpace, "asdf"))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/time_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/time_test.go
deleted file mode 100644
index f9dda8f8f34..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/time_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "testing"
- "time"
-)
-
-func TestShouldHappenBefore(t *testing.T) {
- fail(t, so(0, ShouldHappenBefore), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenBefore, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenBefore, 1), shouldUseTimes)
- fail(t, so(0, ShouldHappenBefore, time.Now()), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenBefore, 0), shouldUseTimes)
-
- fail(t, so(january3, ShouldHappenBefore, january1), fmt.Sprintf("Expected '%s' to happen before '%s' (it happened '48h0m0s' after)!", pretty(january3), pretty(january1)))
- fail(t, so(january3, ShouldHappenBefore, january3), fmt.Sprintf("Expected '%s' to happen before '%s' (it happened '0' after)!", pretty(january3), pretty(january3)))
- pass(t, so(january1, ShouldHappenBefore, january3))
-}
-
-func TestShouldHappenOnOrBefore(t *testing.T) {
- fail(t, so(0, ShouldHappenOnOrBefore), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenOnOrBefore, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenOnOrBefore, 1), shouldUseTimes)
- fail(t, so(0, ShouldHappenOnOrBefore, time.Now()), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenOnOrBefore, 0), shouldUseTimes)
-
- fail(t, so(january3, ShouldHappenOnOrBefore, january1), fmt.Sprintf("Expected '%s' to happen before '%s' (it happened '48h0m0s' after)!", pretty(january3), pretty(january1)))
- pass(t, so(january3, ShouldHappenOnOrBefore, january3))
- pass(t, so(january1, ShouldHappenOnOrBefore, january3))
-}
-
-func TestShouldHappenAfter(t *testing.T) {
- fail(t, so(0, ShouldHappenAfter), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenAfter, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenAfter, 1), shouldUseTimes)
- fail(t, so(0, ShouldHappenAfter, time.Now()), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenAfter, 0), shouldUseTimes)
-
- fail(t, so(january1, ShouldHappenAfter, january2), fmt.Sprintf("Expected '%s' to happen after '%s' (it happened '24h0m0s' before)!", pretty(january1), pretty(january2)))
- fail(t, so(january1, ShouldHappenAfter, january1), fmt.Sprintf("Expected '%s' to happen after '%s' (it happened '0' before)!", pretty(january1), pretty(january1)))
- pass(t, so(january3, ShouldHappenAfter, january1))
-}
-
-func TestShouldHappenOnOrAfter(t *testing.T) {
- fail(t, so(0, ShouldHappenOnOrAfter), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenOnOrAfter, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenOnOrAfter, 1), shouldUseTimes)
- fail(t, so(0, ShouldHappenOnOrAfter, time.Now()), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenOnOrAfter, 0), shouldUseTimes)
-
- fail(t, so(january1, ShouldHappenOnOrAfter, january2), fmt.Sprintf("Expected '%s' to happen after '%s' (it happened '24h0m0s' before)!", pretty(january1), pretty(january2)))
- pass(t, so(january1, ShouldHappenOnOrAfter, january1))
- pass(t, so(january3, ShouldHappenOnOrAfter, january1))
-}
-
-func TestShouldHappenBetween(t *testing.T) {
- fail(t, so(0, ShouldHappenBetween), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenBetween, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenBetween, 1, 2), shouldUseTimes)
- fail(t, so(0, ShouldHappenBetween, time.Now(), time.Now()), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenBetween, 0, time.Now()), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenBetween, time.Now(), 9), shouldUseTimes)
-
- fail(t, so(january1, ShouldHappenBetween, january2, january4), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '24h0m0s' outside threshold)!", pretty(january1), pretty(january2), pretty(january4)))
- fail(t, so(january2, ShouldHappenBetween, january2, january4), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '0' outside threshold)!", pretty(january2), pretty(january2), pretty(january4)))
- pass(t, so(january3, ShouldHappenBetween, january2, january4))
- fail(t, so(january4, ShouldHappenBetween, january2, january4), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '0' outside threshold)!", pretty(january4), pretty(january2), pretty(january4)))
- fail(t, so(january5, ShouldHappenBetween, january2, january4), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '24h0m0s' outside threshold)!", pretty(january5), pretty(january2), pretty(january4)))
-}
-
-func TestShouldHappenOnOrBetween(t *testing.T) {
- fail(t, so(0, ShouldHappenOnOrBetween), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenOnOrBetween, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenOnOrBetween, 1, time.Now()), shouldUseTimes)
- fail(t, so(0, ShouldHappenOnOrBetween, time.Now(), 1), shouldUseTimes)
- fail(t, so(time.Now(), ShouldHappenOnOrBetween, 0, 1), shouldUseTimes)
-
- fail(t, so(january1, ShouldHappenOnOrBetween, january2, january4), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '24h0m0s' outside threshold)!", pretty(january1), pretty(january2), pretty(january4)))
- pass(t, so(january2, ShouldHappenOnOrBetween, january2, january4))
- pass(t, so(january3, ShouldHappenOnOrBetween, january2, january4))
- pass(t, so(january4, ShouldHappenOnOrBetween, january2, january4))
- fail(t, so(january5, ShouldHappenOnOrBetween, january2, january4), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '24h0m0s' outside threshold)!", pretty(january5), pretty(january2), pretty(january4)))
-}
-
-func TestShouldNotHappenOnOrBetween(t *testing.T) {
- fail(t, so(0, ShouldNotHappenOnOrBetween), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(0, ShouldNotHappenOnOrBetween, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldNotHappenOnOrBetween, 1, time.Now()), shouldUseTimes)
- fail(t, so(0, ShouldNotHappenOnOrBetween, time.Now(), 1), shouldUseTimes)
- fail(t, so(time.Now(), ShouldNotHappenOnOrBetween, 0, 1), shouldUseTimes)
-
- pass(t, so(january1, ShouldNotHappenOnOrBetween, january2, january4))
- fail(t, so(january2, ShouldNotHappenOnOrBetween, january2, january4), fmt.Sprintf("Expected '%s' to NOT happen on or between '%s' and '%s' (but it did)!", pretty(january2), pretty(january2), pretty(january4)))
- fail(t, so(january3, ShouldNotHappenOnOrBetween, january2, january4), fmt.Sprintf("Expected '%s' to NOT happen on or between '%s' and '%s' (but it did)!", pretty(january3), pretty(january2), pretty(january4)))
- fail(t, so(january4, ShouldNotHappenOnOrBetween, january2, january4), fmt.Sprintf("Expected '%s' to NOT happen on or between '%s' and '%s' (but it did)!", pretty(january4), pretty(january2), pretty(january4)))
- pass(t, so(january5, ShouldNotHappenOnOrBetween, january2, january4))
-}
-
-func TestShouldHappenWithin(t *testing.T) {
- fail(t, so(0, ShouldHappenWithin), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(0, ShouldHappenWithin, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldHappenWithin, 1, 2), shouldUseDurationAndTime)
- fail(t, so(0, ShouldHappenWithin, oneDay, time.Now()), shouldUseDurationAndTime)
- fail(t, so(time.Now(), ShouldHappenWithin, 0, time.Now()), shouldUseDurationAndTime)
-
- fail(t, so(january1, ShouldHappenWithin, oneDay, january3), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '24h0m0s' outside threshold)!", pretty(january1), pretty(january2), pretty(january4)))
- pass(t, so(january2, ShouldHappenWithin, oneDay, january3))
- pass(t, so(january3, ShouldHappenWithin, oneDay, january3))
- pass(t, so(january4, ShouldHappenWithin, oneDay, january3))
- fail(t, so(january5, ShouldHappenWithin, oneDay, january3), fmt.Sprintf("Expected '%s' to happen between '%s' and '%s' (it happened '24h0m0s' outside threshold)!", pretty(january5), pretty(january2), pretty(january4)))
-}
-
-func TestShouldNotHappenWithin(t *testing.T) {
- fail(t, so(0, ShouldNotHappenWithin), "This assertion requires exactly 2 comparison values (you provided 0).")
- fail(t, so(0, ShouldNotHappenWithin, 1, 2, 3), "This assertion requires exactly 2 comparison values (you provided 3).")
-
- fail(t, so(0, ShouldNotHappenWithin, 1, 2), shouldUseDurationAndTime)
- fail(t, so(0, ShouldNotHappenWithin, oneDay, time.Now()), shouldUseDurationAndTime)
- fail(t, so(time.Now(), ShouldNotHappenWithin, 0, time.Now()), shouldUseDurationAndTime)
-
- pass(t, so(january1, ShouldNotHappenWithin, oneDay, january3))
- fail(t, so(january2, ShouldNotHappenWithin, oneDay, january3), fmt.Sprintf("Expected '%s' to NOT happen on or between '%s' and '%s' (but it did)!", pretty(january2), pretty(january2), pretty(january4)))
- fail(t, so(january3, ShouldNotHappenWithin, oneDay, january3), fmt.Sprintf("Expected '%s' to NOT happen on or between '%s' and '%s' (but it did)!", pretty(january3), pretty(january2), pretty(january4)))
- fail(t, so(january4, ShouldNotHappenWithin, oneDay, january3), fmt.Sprintf("Expected '%s' to NOT happen on or between '%s' and '%s' (but it did)!", pretty(january4), pretty(january2), pretty(january4)))
- pass(t, so(january5, ShouldNotHappenWithin, oneDay, january3))
-}
-
-func TestShouldBeChronological(t *testing.T) {
- fail(t, so(0, ShouldBeChronological, 1, 2, 3), "This assertion requires exactly 0 comparison values (you provided 3).")
- fail(t, so(0, ShouldBeChronological), shouldUseTimeSlice)
- fail(t, so([]time.Time{january5, january1}, ShouldBeChronological),
- "The 'Time' at index [1] should have happened after the previous one (but it didn't!):\n [0]: 2013-01-05 00:00:00 +0000 UTC\n [1]: 2013-01-01 00:00:00 +0000 UTC (see, it happened before!)")
-
- pass(t, so([]time.Time{january1, january2, january3, january4, january5}, ShouldBeChronological))
-}
-
-const layout = "2006-01-02 15:04"
-
-var january1, _ = time.Parse(layout, "2013-01-01 00:00")
-var january2, _ = time.Parse(layout, "2013-01-02 00:00")
-var january3, _ = time.Parse(layout, "2013-01-03 00:00")
-var january4, _ = time.Parse(layout, "2013-01-04 00:00")
-var january5, _ = time.Parse(layout, "2013-01-05 00:00")
-
-var oneDay, _ = time.ParseDuration("24h0m0s")
-var twoDays, _ = time.ParseDuration("48h0m0s")
-
-func pretty(t time.Time) string {
- return fmt.Sprintf("%v", t)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/type_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/type_test.go
deleted file mode 100644
index 4b8d1984670..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/type_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package assertions
-
-import (
- "bytes"
- "io"
- "net/http"
- "testing"
-)
-
-func TestShouldHaveSameTypeAs(t *testing.T) {
- serializer = newFakeSerializer()
-
- fail(t, so(1, ShouldHaveSameTypeAs), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldHaveSameTypeAs, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(nil, ShouldHaveSameTypeAs, 0), "int|<nil>|Expected '<nil>' to be: 'int' (but was: '<nil>')!")
- fail(t, so(1, ShouldHaveSameTypeAs, "asdf"), "string|int|Expected '1' to be: 'string' (but was: 'int')!")
-
- pass(t, so(1, ShouldHaveSameTypeAs, 0))
- pass(t, so(nil, ShouldHaveSameTypeAs, nil))
-}
-
-func TestShouldNotHaveSameTypeAs(t *testing.T) {
- fail(t, so(1, ShouldNotHaveSameTypeAs), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(1, ShouldNotHaveSameTypeAs, 1, 2, 3), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(1, ShouldNotHaveSameTypeAs, 0), "Expected '1' to NOT be: 'int' (but it was)!")
- fail(t, so(nil, ShouldNotHaveSameTypeAs, nil), "Expected '<nil>' to NOT be: '<nil>' (but it was)!")
-
- pass(t, so(nil, ShouldNotHaveSameTypeAs, 0))
- pass(t, so(1, ShouldNotHaveSameTypeAs, "asdf"))
-}
-
-func TestShouldImplement(t *testing.T) {
- var ioReader *io.Reader = nil
- var response http.Response = http.Response{}
- var responsePtr *http.Response = new(http.Response)
- var reader = bytes.NewBufferString("")
-
- fail(t, so(reader, ShouldImplement), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(reader, ShouldImplement, ioReader, ioReader), "This assertion requires exactly 1 comparison values (you provided 2).")
- fail(t, so(reader, ShouldImplement, ioReader, ioReader, ioReader), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(reader, ShouldImplement, "foo"), shouldCompareWithInterfacePointer)
- fail(t, so(reader, ShouldImplement, 1), shouldCompareWithInterfacePointer)
- fail(t, so(reader, ShouldImplement, nil), shouldCompareWithInterfacePointer)
-
- fail(t, so(nil, ShouldImplement, ioReader), shouldNotBeNilActual)
- fail(t, so(1, ShouldImplement, ioReader), "Expected: 'io.Reader interface support'\nActual: '*int' does not implement the interface!")
-
- fail(t, so(response, ShouldImplement, ioReader), "Expected: 'io.Reader interface support'\nActual: '*http.Response' does not implement the interface!")
- fail(t, so(responsePtr, ShouldImplement, ioReader), "Expected: 'io.Reader interface support'\nActual: '*http.Response' does not implement the interface!")
- pass(t, so(reader, ShouldImplement, ioReader))
- pass(t, so(reader, ShouldImplement, (*io.Reader)(nil)))
-}
-
-func TestShouldNotImplement(t *testing.T) {
- var ioReader *io.Reader = nil
- var response http.Response = http.Response{}
- var responsePtr *http.Response = new(http.Response)
- var reader io.Reader = bytes.NewBufferString("")
-
- fail(t, so(reader, ShouldNotImplement), "This assertion requires exactly 1 comparison values (you provided 0).")
- fail(t, so(reader, ShouldNotImplement, ioReader, ioReader), "This assertion requires exactly 1 comparison values (you provided 2).")
- fail(t, so(reader, ShouldNotImplement, ioReader, ioReader, ioReader), "This assertion requires exactly 1 comparison values (you provided 3).")
-
- fail(t, so(reader, ShouldNotImplement, "foo"), shouldCompareWithInterfacePointer)
- fail(t, so(reader, ShouldNotImplement, 1), shouldCompareWithInterfacePointer)
- fail(t, so(reader, ShouldNotImplement, nil), shouldCompareWithInterfacePointer)
-
- fail(t, so(reader, ShouldNotImplement, ioReader), "Expected '*bytes.Buffer'\nto NOT implement 'io.Reader' (but it did)!")
- fail(t, so(nil, ShouldNotImplement, ioReader), shouldNotBeNilActual)
- pass(t, so(1, ShouldNotImplement, ioReader))
- pass(t, so(response, ShouldNotImplement, ioReader))
- pass(t, so(responsePtr, ShouldNotImplement, ioReader))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/utilities_for_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/utilities_for_test.go
deleted file mode 100644
index 7243ebcb937..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/assertions/utilities_for_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package assertions
-
-import (
- "fmt"
- "path"
- "runtime"
- "strings"
- "testing"
-)
-
-func pass(t *testing.T, result string) {
- if result != success {
- _, file, line, _ := runtime.Caller(1)
- base := path.Base(file)
- t.Errorf("Expectation should have passed but failed (see %s: line %d): '%s'", base, line, result)
- }
-}
-
-func fail(t *testing.T, actual string, expected string) {
- actual = format(actual)
- expected = format(expected)
-
- if actual != expected {
- if actual == "" {
- actual = "(empty)"
- }
- _, file, line, _ := runtime.Caller(1)
- base := path.Base(file)
- t.Errorf("Expectation should have failed but passed (see %s: line %d). \nExpected: %s\nActual: %s\n",
- base, line, expected, actual)
- }
-}
-func format(message string) string {
- message = strings.Replace(message, "\n", " ", -1)
- for strings.Contains(message, " ") {
- message = strings.Replace(message, " ", " ", -1)
- }
- return message
-}
-
-type Thing1 struct {
- a string
-}
-type Thing2 struct {
- a string
-}
-
-type Thinger interface {
- Hi()
-}
-
-type Thing struct{}
-
-func (self *Thing) Hi() {}
-
-type IntAlias int
-type StringAlias string
-type StringSliceAlias []string
-type StringStringMapAlias map[string]string
-
-/******** FakeSerialzier ********/
-
-type fakeSerializer struct{}
-
-func (self *fakeSerializer) serialize(expected, actual interface{}, message string) string {
- return fmt.Sprintf("%v|%v|%s", expected, actual, message)
-}
-
-func (self *fakeSerializer) serializeDetailed(expected, actual interface{}, message string) string {
- return fmt.Sprintf("%v|%v|%s", expected, actual, message)
-}
-
-func newFakeSerializer() *fakeSerializer {
- return new(fakeSerializer)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go
deleted file mode 100644
index 294e32fa17e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/focused_execution_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package convey
-
-import "testing"
-
-func TestFocusOnlyAtTopLevel(t *testing.T) {
- output := prepare()
-
- FocusConvey("hi", t, func() {
- output += "done"
- })
-
- expectEqual(t, "done", output)
-}
-
-func TestFocus(t *testing.T) {
- output := prepare()
-
- FocusConvey("hi", t, func() {
- output += "1"
-
- Convey("bye", func() {
- output += "2"
- })
- })
-
- expectEqual(t, "1", output)
-}
-
-func TestNestedFocus(t *testing.T) {
- output := prepare()
-
- FocusConvey("hi", t, func() {
- output += "1"
-
- Convey("This shouldn't run", func() {
- output += "boink!"
- })
-
- FocusConvey("This should run", func() {
- output += "2"
-
- FocusConvey("The should run too", func() {
- output += "3"
-
- })
-
- Convey("The should NOT run", func() {
- output += "blah blah blah!"
- })
- })
- })
-
- expectEqual(t, "123", output)
-}
-
-func TestForgotTopLevelFocus(t *testing.T) {
- output := prepare()
-
- Convey("1", t, func() {
- output += "1"
-
- FocusConvey("This will be run because the top-level lacks Focus", func() {
- output += "2"
- })
-
- Convey("3", func() {
- output += "3"
- })
- })
-
- expectEqual(t, "1213", output)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/gotest/doc_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/gotest/doc_test.go
deleted file mode 100644
index 1b6406be99b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/gotest/doc_test.go
+++ /dev/null
@@ -1 +0,0 @@
-package gotest
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go
deleted file mode 100644
index 7e22b3caa53..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/isolated_execution_test.go
+++ /dev/null
@@ -1,774 +0,0 @@
-package convey
-
-import (
- "strconv"
- "testing"
- "time"
-)
-
-func TestSingleScope(t *testing.T) {
- output := prepare()
-
- Convey("hi", t, func() {
- output += "done"
- })
-
- expectEqual(t, "done", output)
-}
-
-func TestSingleScopeWithMultipleConveys(t *testing.T) {
- output := prepare()
-
- Convey("1", t, func() {
- output += "1"
- })
-
- Convey("2", t, func() {
- output += "2"
- })
-
- expectEqual(t, "12", output)
-}
-
-func TestNestedScopes(t *testing.T) {
- output := prepare()
-
- Convey("a", t, func() {
- output += "a "
-
- Convey("bb", func() {
- output += "bb "
-
- Convey("ccc", func() {
- output += "ccc | "
- })
- })
- })
-
- expectEqual(t, "a bb ccc | ", output)
-}
-
-func TestNestedScopesWithIsolatedExecution(t *testing.T) {
- output := prepare()
-
- Convey("a", t, func() {
- output += "a "
-
- Convey("aa", func() {
- output += "aa "
-
- Convey("aaa", func() {
- output += "aaa | "
- })
-
- Convey("aaa1", func() {
- output += "aaa1 | "
- })
- })
-
- Convey("ab", func() {
- output += "ab "
-
- Convey("abb", func() {
- output += "abb | "
- })
- })
- })
-
- expectEqual(t, "a aa aaa | a aa aaa1 | a ab abb | ", output)
-}
-
-func TestSingleScopeWithConveyAndNestedReset(t *testing.T) {
- output := prepare()
-
- Convey("1", t, func() {
- output += "1"
-
- Reset(func() {
- output += "a"
- })
- })
-
- expectEqual(t, "1a", output)
-}
-
-func TestPanicingReset(t *testing.T) {
- output := prepare()
-
- Convey("1", t, func() {
- output += "1"
-
- Reset(func() {
- panic("nooo")
- })
-
- Convey("runs since the reset hasn't yet", func() {
- output += "a"
- })
-
- Convey("but this doesnt", func() {
- output += "nope"
- })
- })
-
- expectEqual(t, "1a", output)
-}
-
-func TestSingleScopeWithMultipleRegistrationsAndReset(t *testing.T) {
- output := prepare()
-
- Convey("reset after each nested convey", t, func() {
- Convey("first output", func() {
- output += "1"
- })
-
- Convey("second output", func() {
- output += "2"
- })
-
- Reset(func() {
- output += "a"
- })
- })
-
- expectEqual(t, "1a2a", output)
-}
-
-func TestSingleScopeWithMultipleRegistrationsAndMultipleResets(t *testing.T) {
- output := prepare()
-
- Convey("each reset is run at end of each nested convey", t, func() {
- Convey("1", func() {
- output += "1"
- })
-
- Convey("2", func() {
- output += "2"
- })
-
- Reset(func() {
- output += "a"
- })
-
- Reset(func() {
- output += "b"
- })
- })
-
- expectEqual(t, "1ab2ab", output)
-}
-
-func Test_Failure_AtHigherLevelScopePreventsChildScopesFromRunning(t *testing.T) {
- output := prepare()
-
- Convey("This step fails", t, func() {
- So(1, ShouldEqual, 2)
-
- Convey("this should NOT be executed", func() {
- output += "a"
- })
- })
-
- expectEqual(t, "", output)
-}
-
-func Test_Panic_AtHigherLevelScopePreventsChildScopesFromRunning(t *testing.T) {
- output := prepare()
-
- Convey("This step panics", t, func() {
- Convey("this happens, because the panic didn't happen yet", func() {
- output += "1"
- })
-
- output += "a"
-
- Convey("this should NOT be executed", func() {
- output += "2"
- })
-
- output += "b"
-
- panic("Hi")
-
- output += "nope"
- })
-
- expectEqual(t, "1ab", output)
-}
-
-func Test_Panic_InChildScopeDoes_NOT_PreventExecutionOfSiblingScopes(t *testing.T) {
- output := prepare()
-
- Convey("This is the parent", t, func() {
- Convey("This step panics", func() {
- panic("Hi")
- output += "1"
- })
-
- Convey("This sibling should execute", func() {
- output += "2"
- })
- })
-
- expectEqual(t, "2", output)
-}
-
-func Test_Failure_InChildScopeDoes_NOT_PreventExecutionOfSiblingScopes(t *testing.T) {
- output := prepare()
-
- Convey("This is the parent", t, func() {
- Convey("This step fails", func() {
- So(1, ShouldEqual, 2)
- output += "1"
- })
-
- Convey("This sibling should execute", func() {
- output += "2"
- })
- })
-
- expectEqual(t, "2", output)
-}
-
-func TestResetsAreAlwaysExecutedAfterScope_Panics(t *testing.T) {
- output := prepare()
-
- Convey("This is the parent", t, func() {
- Convey("This step panics", func() {
- panic("Hi")
- output += "1"
- })
-
- Convey("This sibling step does not panic", func() {
- output += "a"
-
- Reset(func() {
- output += "b"
- })
- })
-
- Reset(func() {
- output += "2"
- })
- })
-
- expectEqual(t, "2ab2", output)
-}
-
-func TestResetsAreAlwaysExecutedAfterScope_Failures(t *testing.T) {
- output := prepare()
-
- Convey("This is the parent", t, func() {
- Convey("This step fails", func() {
- So(1, ShouldEqual, 2)
- output += "1"
- })
-
- Convey("This sibling step does not fail", func() {
- output += "a"
-
- Reset(func() {
- output += "b"
- })
- })
-
- Reset(func() {
- output += "2"
- })
- })
-
- expectEqual(t, "2ab2", output)
-}
-
-func TestSkipTopLevel(t *testing.T) {
- output := prepare()
-
- SkipConvey("hi", t, func() {
- output += "This shouldn't be executed!"
- })
-
- expectEqual(t, "", output)
-}
-
-func TestSkipNestedLevel(t *testing.T) {
- output := prepare()
-
- Convey("hi", t, func() {
- output += "yes"
-
- SkipConvey("bye", func() {
- output += "no"
- })
- })
-
- expectEqual(t, "yes", output)
-}
-
-func TestSkipNestedLevelSkipsAllChildLevels(t *testing.T) {
- output := prepare()
-
- Convey("hi", t, func() {
- output += "yes"
-
- SkipConvey("bye", func() {
- output += "no"
-
- Convey("byebye", func() {
- output += "no-no"
- })
- })
- })
-
- expectEqual(t, "yes", output)
-}
-
-func TestIterativeConveys(t *testing.T) {
- output := prepare()
-
- Convey("Test", t, func() {
- for x := 0; x < 10; x++ {
- y := strconv.Itoa(x)
-
- Convey(y, func() {
- output += y
- })
- }
- })
-
- expectEqual(t, "0123456789", output)
-}
-
-func TestClosureVariables(t *testing.T) {
- output := prepare()
-
- i := 0
-
- Convey("A", t, func() {
- i = i + 1
- j := i
-
- output += "A" + strconv.Itoa(i) + " "
-
- Convey("B", func() {
- k := j
- j = j + 1
-
- output += "B" + strconv.Itoa(k) + " "
-
- Convey("C", func() {
- output += "C" + strconv.Itoa(k) + strconv.Itoa(j) + " "
- })
-
- Convey("D", func() {
- output += "D" + strconv.Itoa(k) + strconv.Itoa(j) + " "
- })
- })
-
- Convey("C", func() {
- output += "C" + strconv.Itoa(j) + " "
- })
- })
-
- output += "D" + strconv.Itoa(i) + " "
-
- expectEqual(t, "A1 B1 C12 A2 B2 D23 A3 C3 D3 ", output)
-}
-
-func TestClosureVariablesWithReset(t *testing.T) {
- output := prepare()
-
- i := 0
-
- Convey("A", t, func() {
- i = i + 1
- j := i
-
- output += "A" + strconv.Itoa(i) + " "
-
- Reset(func() {
- output += "R" + strconv.Itoa(i) + strconv.Itoa(j) + " "
- })
-
- Convey("B", func() {
- output += "B" + strconv.Itoa(j) + " "
- })
-
- Convey("C", func() {
- output += "C" + strconv.Itoa(j) + " "
- })
- })
-
- output += "D" + strconv.Itoa(i) + " "
-
- expectEqual(t, "A1 B1 R11 A2 C2 R22 D2 ", output)
-}
-
-func TestWrappedSimple(t *testing.T) {
- prepare()
- output := resetTestString{""}
-
- Convey("A", t, func() {
- func() {
- output.output += "A "
-
- Convey("B", func() {
- output.output += "B "
-
- Convey("C", func() {
- output.output += "C "
- })
-
- })
-
- Convey("D", func() {
- output.output += "D "
- })
- }()
- })
-
- expectEqual(t, "A B C A D ", output.output)
-}
-
-type resetTestString struct {
- output string
-}
-
-func addReset(o *resetTestString, f func()) func() {
- return func() {
- Reset(func() {
- o.output += "R "
- })
-
- f()
- }
-}
-
-func TestWrappedReset(t *testing.T) {
- prepare()
- output := resetTestString{""}
-
- Convey("A", t, addReset(&output, func() {
- output.output += "A "
-
- Convey("B", func() {
- output.output += "B "
- })
-
- Convey("C", func() {
- output.output += "C "
- })
- }))
-
- expectEqual(t, "A B R A C R ", output.output)
-}
-
-func TestWrappedReset2(t *testing.T) {
- prepare()
- output := resetTestString{""}
-
- Convey("A", t, func() {
- Reset(func() {
- output.output += "R "
- })
-
- func() {
- output.output += "A "
-
- Convey("B", func() {
- output.output += "B "
-
- Convey("C", func() {
- output.output += "C "
- })
- })
-
- Convey("D", func() {
- output.output += "D "
- })
- }()
- })
-
- expectEqual(t, "A B C R A D R ", output.output)
-}
-
-func TestInfiniteLoopWithTrailingFail(t *testing.T) {
- done := make(chan int)
-
- go func() {
- Convey("This fails", t, func() {
- Convey("and this is run", func() {
- So(true, ShouldEqual, true)
- })
-
- /* And this prevents the whole block to be marked as run */
- So(false, ShouldEqual, true)
- })
-
- done <- 1
- }()
-
- select {
- case <-done:
- return
- case <-time.After(1 * time.Millisecond):
- t.Fail()
- }
-}
-
-func TestOutermostResetInvokedForGrandchildren(t *testing.T) {
- output := prepare()
-
- Convey("A", t, func() {
- output += "A "
-
- Reset(func() {
- output += "rA "
- })
-
- Convey("B", func() {
- output += "B "
-
- Reset(func() {
- output += "rB "
- })
-
- Convey("C", func() {
- output += "C "
-
- Reset(func() {
- output += "rC "
- })
- })
-
- Convey("D", func() {
- output += "D "
-
- Reset(func() {
- output += "rD "
- })
- })
- })
- })
-
- expectEqual(t, "A B C rC rB rA A B D rD rB rA ", output)
-}
-
-func TestFailureOption(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureHalts, func() {
- output += "A "
- So(true, ShouldEqual, true)
- output += "B "
- So(false, ShouldEqual, true)
- output += "C "
- })
-
- expectEqual(t, "A B ", output)
-}
-
-func TestFailureOption2(t *testing.T) {
- output := prepare()
-
- Convey("A", t, func() {
- output += "A "
- So(true, ShouldEqual, true)
- output += "B "
- So(false, ShouldEqual, true)
- output += "C "
- })
-
- expectEqual(t, "A B ", output)
-}
-
-func TestFailureOption3(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureContinues, func() {
- output += "A "
- So(true, ShouldEqual, true)
- output += "B "
- So(false, ShouldEqual, true)
- output += "C "
- })
-
- expectEqual(t, "A B C ", output)
-}
-
-func TestFailureOptionInherit(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureContinues, func() {
- output += "A1 "
- So(false, ShouldEqual, true)
- output += "A2 "
-
- Convey("B", func() {
- output += "B1 "
- So(true, ShouldEqual, true)
- output += "B2 "
- So(false, ShouldEqual, true)
- output += "B3 "
- })
- })
-
- expectEqual(t, "A1 A2 B1 B2 B3 ", output)
-}
-
-func TestFailureOptionInherit2(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureHalts, func() {
- output += "A1 "
- So(false, ShouldEqual, true)
- output += "A2 "
-
- Convey("B", func() {
- output += "A1 "
- So(true, ShouldEqual, true)
- output += "A2 "
- So(false, ShouldEqual, true)
- output += "A3 "
- })
- })
-
- expectEqual(t, "A1 ", output)
-}
-
-func TestFailureOptionInherit3(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureHalts, func() {
- output += "A1 "
- So(true, ShouldEqual, true)
- output += "A2 "
-
- Convey("B", func() {
- output += "B1 "
- So(true, ShouldEqual, true)
- output += "B2 "
- So(false, ShouldEqual, true)
- output += "B3 "
- })
- })
-
- expectEqual(t, "A1 A2 B1 B2 ", output)
-}
-
-func TestFailureOptionNestedOverride(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureContinues, func() {
- output += "A "
- So(false, ShouldEqual, true)
- output += "B "
-
- Convey("C", FailureHalts, func() {
- output += "C "
- So(true, ShouldEqual, true)
- output += "D "
- So(false, ShouldEqual, true)
- output += "E "
- })
- })
-
- expectEqual(t, "A B C D ", output)
-}
-
-func TestFailureOptionNestedOverride2(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureHalts, func() {
- output += "A "
- So(true, ShouldEqual, true)
- output += "B "
-
- Convey("C", FailureContinues, func() {
- output += "C "
- So(true, ShouldEqual, true)
- output += "D "
- So(false, ShouldEqual, true)
- output += "E "
- })
- })
-
- expectEqual(t, "A B C D E ", output)
-}
-
-func TestMultipleInvocationInheritance(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureHalts, func() {
- output += "A1 "
- So(true, ShouldEqual, true)
- output += "A2 "
-
- Convey("B", FailureContinues, func() {
- output += "B1 "
- So(true, ShouldEqual, true)
- output += "B2 "
- So(false, ShouldEqual, true)
- output += "B3 "
- })
-
- Convey("C", func() {
- output += "C1 "
- So(true, ShouldEqual, true)
- output += "C2 "
- So(false, ShouldEqual, true)
- output += "C3 "
- })
- })
-
- expectEqual(t, "A1 A2 B1 B2 B3 A1 A2 C1 C2 ", output)
-}
-
-func TestMultipleInvocationInheritance2(t *testing.T) {
- output := prepare()
-
- Convey("A", t, FailureContinues, func() {
- output += "A1 "
- So(true, ShouldEqual, true)
- output += "A2 "
- So(false, ShouldEqual, true)
- output += "A3 "
-
- Convey("B", FailureHalts, func() {
- output += "B1 "
- So(true, ShouldEqual, true)
- output += "B2 "
- So(false, ShouldEqual, true)
- output += "B3 "
- })
-
- Convey("C", func() {
- output += "C1 "
- So(true, ShouldEqual, true)
- output += "C2 "
- So(false, ShouldEqual, true)
- output += "C3 "
- })
- })
-
- expectEqual(t, "A1 A2 A3 B1 B2 A1 A2 A3 C1 C2 C3 ", output)
-}
-
-func TestSetDefaultFailureMode(t *testing.T) {
- output := prepare()
-
- SetDefaultFailureMode(FailureContinues) // the default is normally FailureHalts
- defer SetDefaultFailureMode(FailureHalts)
-
- Convey("A", t, func() {
- output += "A1 "
- So(true, ShouldBeFalse)
- output += "A2 "
- })
-
- expectEqual(t, "A1 A2 ", output)
-}
-
-func prepare() string {
- testReporter = newNilReporter()
- return ""
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go
deleted file mode 100644
index a8d20d46f08..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/dot_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package reporting
-
-import (
- "errors"
- "testing"
-)
-
-func TestDotReporterAssertionPrinting(t *testing.T) {
- monochrome()
- file := newMemoryFile()
- printer := NewPrinter(file)
- reporter := NewDotReporter(printer)
-
- reporter.Report(NewSuccessReport())
- reporter.Report(NewFailureReport("failed"))
- reporter.Report(NewErrorReport(errors.New("error")))
- reporter.Report(NewSkipReport())
-
- expected := dotSuccess + dotFailure + dotError + dotSkip
-
- if file.buffer != expected {
- t.Errorf("\nExpected: '%s'\nActual: '%s'", expected, file.buffer)
- }
-}
-
-func TestDotReporterOnlyReportsAssertions(t *testing.T) {
- monochrome()
- file := newMemoryFile()
- printer := NewPrinter(file)
- reporter := NewDotReporter(printer)
-
- reporter.BeginStory(nil)
- reporter.Enter(nil)
- reporter.Exit()
- reporter.EndStory()
-
- if file.buffer != "" {
- t.Errorf("\nExpected: '(blank)'\nActual: '%s'", file.buffer)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go
deleted file mode 100644
index fda189458e5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/gotest_test.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package reporting
-
-import "testing"
-
-func TestReporterReceivesSuccessfulReport(t *testing.T) {
- reporter := NewGoTestReporter()
- test := new(fakeTest)
- reporter.BeginStory(NewStoryReport(test))
- reporter.Report(NewSuccessReport())
-
- if test.failed {
- t.Errorf("Should have have marked test as failed--the report reflected success.")
- }
-}
-
-func TestReporterReceivesFailureReport(t *testing.T) {
- reporter := NewGoTestReporter()
- test := new(fakeTest)
- reporter.BeginStory(NewStoryReport(test))
- reporter.Report(NewFailureReport("This is a failure."))
-
- if !test.failed {
- t.Errorf("Test should have been marked as failed (but it wasn't).")
- }
-}
-
-func TestReporterReceivesErrorReport(t *testing.T) {
- reporter := NewGoTestReporter()
- test := new(fakeTest)
- reporter.BeginStory(NewStoryReport(test))
- reporter.Report(NewErrorReport("This is an error."))
-
- if !test.failed {
- t.Errorf("Test should have been marked as failed (but it wasn't).")
- }
-}
-
-func TestReporterIsResetAtTheEndOfTheStory(t *testing.T) {
- defer catch(t)
- reporter := NewGoTestReporter()
- test := new(fakeTest)
- reporter.BeginStory(NewStoryReport(test))
- reporter.EndStory()
-
- reporter.Report(NewSuccessReport())
-}
-
-func TestReporterNoopMethods(t *testing.T) {
- reporter := NewGoTestReporter()
- reporter.Enter(NewScopeReport("title"))
- reporter.Exit()
-}
-
-func catch(t *testing.T) {
- if r := recover(); r != nil {
- t.Log("Getting to this point means we've passed (because we caught a panic appropriately).")
- }
-}
-
-type fakeTest struct {
- failed bool
-}
-
-func (self *fakeTest) Fail() {
- self.failed = true
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go
deleted file mode 100644
index 94202d5ac97..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/printer_test.go
+++ /dev/null
@@ -1,181 +0,0 @@
-package reporting
-
-import "testing"
-
-func TestPrint(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const expected = "Hello, World!"
-
- printer.Print(expected)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintFormat(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- template := "Hi, %s"
- name := "Ralph"
- expected := "Hi, Ralph"
-
- printer.Print(template, name)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintPreservesEncodedStrings(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const expected = "= -> %3D"
- printer.Print(expected)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintln(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const expected = "Hello, World!"
-
- printer.Println(expected)
-
- if file.buffer != expected+"\n" {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintlnFormat(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- template := "Hi, %s"
- name := "Ralph"
- expected := "Hi, Ralph\n"
-
- printer.Println(template, name)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintlnPreservesEncodedStrings(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const expected = "= -> %3D"
- printer.Println(expected)
-
- if file.buffer != expected+"\n" {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintIndented(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const message = "Hello, World!\nGoodbye, World!"
- const expected = " Hello, World!\n Goodbye, World!"
-
- printer.Indent()
- printer.Print(message)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintDedented(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const expected = "Hello, World!\nGoodbye, World!"
-
- printer.Indent()
- printer.Dedent()
- printer.Print(expected)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintlnIndented(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const message = "Hello, World!\nGoodbye, World!"
- const expected = " Hello, World!\n Goodbye, World!\n"
-
- printer.Indent()
- printer.Println(message)
-
- if file.buffer != expected {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestPrintlnDedented(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
- const expected = "Hello, World!\nGoodbye, World!"
-
- printer.Indent()
- printer.Dedent()
- printer.Println(expected)
-
- if file.buffer != expected+"\n" {
- t.Errorf("Expected '%s' to equal '%s'.", expected, file.buffer)
- }
-}
-
-func TestDedentTooFarShouldNotPanic(t *testing.T) {
- defer func() {
- if r := recover(); r != nil {
- t.Error("Should not have panicked!")
- }
- }()
- file := newMemoryFile()
- printer := NewPrinter(file)
-
- printer.Dedent()
-
- t.Log("Getting to this point without panicking means we passed.")
-}
-
-func TestInsert(t *testing.T) {
- file := newMemoryFile()
- printer := NewPrinter(file)
-
- printer.Indent()
- printer.Print("Hi")
- printer.Insert(" there")
- printer.Dedent()
-
- expected := " Hi there"
- if file.buffer != expected {
- t.Errorf("Should have written '%s' but instead wrote '%s'.", expected, file.buffer)
- }
-}
-
-////////////////// memoryFile ////////////////////
-
-type memoryFile struct {
- buffer string
-}
-
-func (self *memoryFile) Write(p []byte) (n int, err error) {
- self.buffer += string(p)
- return len(p), nil
-}
-
-func (self *memoryFile) String() string {
- return self.buffer
-}
-
-func newMemoryFile() *memoryFile {
- return new(memoryFile)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go
deleted file mode 100644
index 92f0ca35cca..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/problems_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package reporting
-
-import (
- "strings"
- "testing"
-)
-
-func TestNoopProblemReporterActions(t *testing.T) {
- file, reporter := setup()
- reporter.BeginStory(nil)
- reporter.Enter(nil)
- reporter.Exit()
- expected := ""
- actual := file.String()
- if expected != actual {
- t.Errorf("Expected: '(blank)'\nActual: '%s'", actual)
- }
-}
-
-func TestReporterPrintsFailuresAndErrorsAtTheEndOfTheStory(t *testing.T) {
- file, reporter := setup()
- reporter.Report(NewFailureReport("failed"))
- reporter.Report(NewErrorReport("error"))
- reporter.Report(NewSuccessReport())
- reporter.EndStory()
-
- result := file.String()
- if !strings.Contains(result, "Errors:\n") {
- t.Errorf("Expected errors, found none.")
- }
- if !strings.Contains(result, "Failures:\n") {
- t.Errorf("Expected failures, found none.")
- }
-
- // Each stack trace looks like: `* /path/to/file.go`, so look for `* `.
- // With go 1.4+ there is a line in some stack traces that looks like this:
- // `testing.(*M).Run(0x2082d60a0, 0x25b7c0)`
- // So we can't just look for "*" anymore.
- problemCount := strings.Count(result, "* ")
- if problemCount != 2 {
- t.Errorf("Expected one failure and one error (total of 2 '*' characters). Got %d", problemCount)
- }
-}
-
-func setup() (file *memoryFile, reporter *problem) {
- monochrome()
- file = newMemoryFile()
- printer := NewPrinter(file)
- reporter = NewProblemReporter(printer)
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go
deleted file mode 100644
index 4e5caf63b2b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting/reporter_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package reporting
-
-import (
- "runtime"
- "testing"
-)
-
-func TestEachNestedReporterReceivesTheCallFromTheContainingReporter(t *testing.T) {
- fake1 := newFakeReporter()
- fake2 := newFakeReporter()
- reporter := NewReporters(fake1, fake2)
-
- reporter.BeginStory(nil)
- assertTrue(t, fake1.begun)
- assertTrue(t, fake2.begun)
-
- reporter.Enter(NewScopeReport("scope"))
- assertTrue(t, fake1.entered)
- assertTrue(t, fake2.entered)
-
- reporter.Report(NewSuccessReport())
- assertTrue(t, fake1.reported)
- assertTrue(t, fake2.reported)
-
- reporter.Exit()
- assertTrue(t, fake1.exited)
- assertTrue(t, fake2.exited)
-
- reporter.EndStory()
- assertTrue(t, fake1.ended)
- assertTrue(t, fake2.ended)
-
- content := []byte("hi")
- written, err := reporter.Write(content)
- assertTrue(t, fake1.written)
- assertTrue(t, fake2.written)
- assertEqual(t, written, len(content))
- assertNil(t, err)
-
-}
-
-func assertTrue(t *testing.T, value bool) {
- if !value {
- _, _, line, _ := runtime.Caller(1)
- t.Errorf("Value should have been true (but was false). See line %d", line)
- }
-}
-
-func assertEqual(t *testing.T, expected, actual int) {
- if actual != expected {
- _, _, line, _ := runtime.Caller(1)
- t.Errorf("Value should have been %d (but was %d). See line %d", expected, actual, line)
- }
-}
-
-func assertNil(t *testing.T, err error) {
- if err != nil {
- _, _, line, _ := runtime.Caller(1)
- t.Errorf("Error should have been <nil> (but wasn't). See line %d", err, line)
- }
-}
-
-type fakeReporter struct {
- begun bool
- entered bool
- reported bool
- exited bool
- ended bool
- written bool
-}
-
-func newFakeReporter() *fakeReporter {
- return &fakeReporter{}
-}
-
-func (self *fakeReporter) BeginStory(story *StoryReport) {
- self.begun = true
-}
-func (self *fakeReporter) Enter(scope *ScopeReport) {
- self.entered = true
-}
-func (self *fakeReporter) Report(report *AssertionResult) {
- self.reported = true
-}
-func (self *fakeReporter) Exit() {
- self.exited = true
-}
-func (self *fakeReporter) EndStory() {
- self.ended = true
-}
-func (self *fakeReporter) Write(content []byte) (int, error) {
- self.written = true
- return len(content), nil
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go
deleted file mode 100644
index 69125c3cf44..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/reporting_hooks_test.go
+++ /dev/null
@@ -1,317 +0,0 @@
-package convey
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "path"
- "runtime"
- "strconv"
- "strings"
- "testing"
-
- "github.com/smartystreets/goconvey/convey/reporting"
-)
-
-func TestSingleScopeReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- So(1, ShouldEqual, 1)
- })
-
- expectEqual(t, "Begin|A|Success|Exit|End", myReporter.wholeStory())
-}
-
-func TestNestedScopeReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- Convey("B", func() {
- So(1, ShouldEqual, 1)
- })
- })
-
- expectEqual(t, "Begin|A|B|Success|Exit|Exit|End", myReporter.wholeStory())
-}
-
-func TestFailureReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- So(1, ShouldBeNil)
- })
-
- expectEqual(t, "Begin|A|Failure|Exit|End", myReporter.wholeStory())
-}
-
-func TestFirstFailureEndsScopeExecution(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- So(1, ShouldBeNil)
- So(nil, ShouldBeNil)
- })
-
- expectEqual(t, "Begin|A|Failure|Exit|End", myReporter.wholeStory())
-}
-
-func TestComparisonFailureDeserializedAndReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- So("hi", ShouldEqual, "bye")
- })
-
- expectEqual(t, "Begin|A|Failure(bye/hi)|Exit|End", myReporter.wholeStory())
-}
-
-func TestNestedFailureReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- Convey("B", func() {
- So(2, ShouldBeNil)
- })
- })
-
- expectEqual(t, "Begin|A|B|Failure|Exit|Exit|End", myReporter.wholeStory())
-}
-
-func TestSuccessAndFailureReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- So(nil, ShouldBeNil)
- So(1, ShouldBeNil)
- })
-
- expectEqual(t, "Begin|A|Success|Failure|Exit|End", myReporter.wholeStory())
-}
-
-func TestIncompleteActionReportedAsSkipped(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- Convey("B", nil)
- })
-
- expectEqual(t, "Begin|A|B|Skipped|Exit|Exit|End", myReporter.wholeStory())
-}
-
-func TestSkippedConveyReportedAsSkipped(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- SkipConvey("B", func() {
- So(1, ShouldEqual, 1)
- })
- })
-
- expectEqual(t, "Begin|A|B|Skipped|Exit|Exit|End", myReporter.wholeStory())
-}
-
-func TestMultipleSkipsAreReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- Convey("0", func() {
- So(nil, ShouldBeNil)
- })
-
- SkipConvey("1", func() {})
- SkipConvey("2", func() {})
-
- Convey("3", nil)
- Convey("4", nil)
-
- Convey("5", func() {
- So(nil, ShouldBeNil)
- })
- })
-
- expected := "Begin" +
- "|A|0|Success|Exit|Exit" +
- "|A|1|Skipped|Exit|Exit" +
- "|A|2|Skipped|Exit|Exit" +
- "|A|3|Skipped|Exit|Exit" +
- "|A|4|Skipped|Exit|Exit" +
- "|A|5|Success|Exit|Exit" +
- "|End"
-
- expectEqual(t, expected, myReporter.wholeStory())
-}
-
-func TestSkippedAssertionIsNotReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- SkipSo(1, ShouldEqual, 1)
- })
-
- expectEqual(t, "Begin|A|Skipped|Exit|End", myReporter.wholeStory())
-}
-
-func TestMultipleSkippedAssertionsAreNotReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- SkipSo(1, ShouldEqual, 1)
- So(1, ShouldEqual, 1)
- SkipSo(1, ShouldEqual, 1)
- })
-
- expectEqual(t, "Begin|A|Skipped|Success|Skipped|Exit|End", myReporter.wholeStory())
-}
-
-func TestErrorByManualPanicReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- panic("Gopher alert!")
- })
-
- expectEqual(t, "Begin|A|Error|Exit|End", myReporter.wholeStory())
-}
-
-func TestIterativeConveysReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- for x := 0; x < 3; x++ {
- Convey(strconv.Itoa(x), func() {
- So(x, ShouldEqual, x)
- })
- }
- })
-
- expectEqual(t, "Begin|A|0|Success|Exit|Exit|A|1|Success|Exit|Exit|A|2|Success|Exit|Exit|End", myReporter.wholeStory())
-}
-
-func TestNestedIterativeConveysReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func() {
- for x := 0; x < 3; x++ {
- Convey(strconv.Itoa(x), func() {
- for y := 0; y < 3; y++ {
- Convey("< "+strconv.Itoa(y), func() {
- So(x, ShouldBeLessThan, y)
- })
- }
- })
- }
- })
-
- expectEqual(t, ("Begin|" +
- "A|0|< 0|Failure|Exit|Exit|Exit|" +
- "A|0|< 1|Success|Exit|Exit|Exit|" +
- "A|0|< 2|Success|Exit|Exit|Exit|" +
- "A|1|< 0|Failure|Exit|Exit|Exit|" +
- "A|1|< 1|Failure|Exit|Exit|Exit|" +
- "A|1|< 2|Success|Exit|Exit|Exit|" +
- "A|2|< 0|Failure|Exit|Exit|Exit|" +
- "A|2|< 1|Failure|Exit|Exit|Exit|" +
- "A|2|< 2|Failure|Exit|Exit|Exit|" +
- "End"), myReporter.wholeStory())
-}
-
-func TestEmbeddedAssertionReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- Convey("A", test, func(c C) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- c.So(r.FormValue("msg"), ShouldEqual, "ping")
- }))
- http.DefaultClient.Get(ts.URL + "?msg=ping")
- })
-
- expectEqual(t, "Begin|A|Success|Exit|End", myReporter.wholeStory())
-}
-
-func TestEmbeddedContextHelperReported(t *testing.T) {
- myReporter, test := setupFakeReporter()
-
- helper := func(c C) http.HandlerFunc {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- c.Convey("Embedded", func() {
- So(r.FormValue("msg"), ShouldEqual, "ping")
- })
- })
- }
-
- Convey("A", test, func(c C) {
- ts := httptest.NewServer(helper(c))
- http.DefaultClient.Get(ts.URL + "?msg=ping")
- })
-
- expectEqual(t, "Begin|A|Embedded|Success|Exit|Exit|End", myReporter.wholeStory())
-}
-
-func expectEqual(t *testing.T, expected interface{}, actual interface{}) {
- if expected != actual {
- _, file, line, _ := runtime.Caller(1)
- t.Errorf("Expected '%v' to be '%v' but it wasn't. See '%s' at line %d.",
- actual, expected, path.Base(file), line)
- }
-}
-
-func setupFakeReporter() (*fakeReporter, *fakeGoTest) {
- myReporter := new(fakeReporter)
- myReporter.calls = []string{}
- testReporter = myReporter
- return myReporter, new(fakeGoTest)
-}
-
-type fakeReporter struct {
- calls []string
-}
-
-func (self *fakeReporter) BeginStory(story *reporting.StoryReport) {
- self.calls = append(self.calls, "Begin")
-}
-
-func (self *fakeReporter) Enter(scope *reporting.ScopeReport) {
- self.calls = append(self.calls, scope.Title)
-}
-
-func (self *fakeReporter) Report(report *reporting.AssertionResult) {
- if report.Error != nil {
- self.calls = append(self.calls, "Error")
- } else if report.Failure != "" {
- message := "Failure"
- if report.Expected != "" || report.Actual != "" {
- message += fmt.Sprintf("(%s/%s)", report.Expected, report.Actual)
- }
- self.calls = append(self.calls, message)
- } else if report.Skipped {
- self.calls = append(self.calls, "Skipped")
- } else {
- self.calls = append(self.calls, "Success")
- }
-}
-
-func (self *fakeReporter) Exit() {
- self.calls = append(self.calls, "Exit")
-}
-
-func (self *fakeReporter) EndStory() {
- self.calls = append(self.calls, "End")
-}
-
-func (self *fakeReporter) Write(content []byte) (int, error) {
- return len(content), nil // no-op
-}
-
-func (self *fakeReporter) wholeStory() string {
- return strings.Join(self.calls, "|")
-}
-
-////////////////////////////////
-
-type fakeGoTest struct{}
-
-func (self *fakeGoTest) Fail() {}
-func (self *fakeGoTest) Fatalf(format string, args ...interface{}) {}
-
-var test t = new(fakeGoTest)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go
deleted file mode 100644
index 84832c78d5b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/convey/story_conventions_test.go
+++ /dev/null
@@ -1,175 +0,0 @@
-package convey
-
-import (
- "reflect"
- "testing"
-)
-
-func expectPanic(t *testing.T, f string) interface{} {
- r := recover()
- if r != nil {
- if cp, ok := r.(*conveyErr); ok {
- if cp.fmt != f {
- t.Error("Incorrect panic message.")
- }
- } else {
- t.Errorf("Incorrect panic type. %s", reflect.TypeOf(r))
- }
- } else {
- t.Error("Expected panic but none occured")
- }
- return r
-}
-
-func TestMissingTopLevelGoTestReferenceCausesPanic(t *testing.T) {
- output := map[string]bool{}
-
- defer expectEqual(t, false, output["good"])
- defer expectPanic(t, missingGoTest)
-
- Convey("Hi", func() {
- output["bad"] = true // this shouldn't happen
- })
-}
-
-func TestMissingTopLevelGoTestReferenceAfterGoodExample(t *testing.T) {
- output := map[string]bool{}
-
- defer func() {
- expectEqual(t, true, output["good"])
- expectEqual(t, false, output["bad"])
- }()
- defer expectPanic(t, missingGoTest)
-
- Convey("Good example", t, func() {
- output["good"] = true
- })
-
- Convey("Bad example", func() {
- output["bad"] = true // shouldn't happen
- })
-}
-
-func TestExtraReferencePanics(t *testing.T) {
- output := map[string]bool{}
-
- defer expectEqual(t, false, output["bad"])
- defer expectPanic(t, extraGoTest)
-
- Convey("Good example", t, func() {
- Convey("Bad example - passing in *testing.T a second time!", t, func() {
- output["bad"] = true // shouldn't happen
- })
- })
-}
-
-func TestParseRegistrationMissingRequiredElements(t *testing.T) {
- defer expectPanic(t, parseError)
-
- Convey()
-}
-
-func TestParseRegistration_MissingNameString(t *testing.T) {
- defer expectPanic(t, parseError)
-
- Convey(func() {})
-}
-
-func TestParseRegistration_MissingActionFunc(t *testing.T) {
- defer expectPanic(t, parseError)
-
- Convey("Hi there", 12345)
-}
-
-func TestFailureModeNoContext(t *testing.T) {
- Convey("Foo", t, func() {
- done := make(chan int, 1)
- go func() {
- defer func() { done <- 1 }()
- defer expectPanic(t, noStackContext)
- So(len("I have no context"), ShouldBeGreaterThan, 0)
- }()
- <-done
- })
-}
-
-func TestFailureModeDuplicateSuite(t *testing.T) {
- Convey("cool", t, func() {
- defer expectPanic(t, multipleIdenticalConvey)
-
- Convey("dup", nil)
- Convey("dup", nil)
- })
-}
-
-func TestFailureModeIndeterminentSuiteNames(t *testing.T) {
- defer expectPanic(t, differentConveySituations)
-
- name := "bob"
- Convey("cool", t, func() {
- for i := 0; i < 3; i++ {
- Convey(name, func() {})
- name += "bob"
- }
- })
-}
-
-func TestFailureModeNestedIndeterminentSuiteNames(t *testing.T) {
- defer expectPanic(t, differentConveySituations)
-
- name := "bob"
- Convey("cool", t, func() {
- Convey("inner", func() {
- for i := 0; i < 3; i++ {
- Convey(name, func() {})
- name += "bob"
- }
- })
- })
-}
-
-func TestFailureModeParameterButMissing(t *testing.T) {
- defer expectPanic(t, parseError)
-
- prepare()
-
- Convey("Foobar", t, FailureHalts)
-}
-
-func TestFailureModeParameterWithAction(t *testing.T) {
- prepare()
-
- Convey("Foobar", t, FailureHalts, func() {})
-}
-
-func TestExtraConveyParameters(t *testing.T) {
- defer expectPanic(t, parseError)
-
- prepare()
-
- Convey("Foobar", t, FailureHalts, func() {}, "This is not supposed to be here")
-}
-
-func TestExtraConveyParameters2(t *testing.T) {
- defer expectPanic(t, parseError)
-
- prepare()
-
- Convey("Foobar", t, func() {}, "This is not supposed to be here")
-}
-
-func TestExtraConveyParameters3(t *testing.T) {
- defer expectPanic(t, parseError)
-
- output := prepare()
-
- Convey("A", t, func() {
- output += "A "
-
- Convey("B", func() {
- output += "B "
- }, "This is not supposed to be here")
- })
-
- expectEqual(t, "A ", output)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/doc_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/doc_test.go
deleted file mode 100644
index 06ab7d0f9a3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/doc_test.go
+++ /dev/null
@@ -1 +0,0 @@
-package main
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/assertion_examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/assertion_examples_test.go
deleted file mode 100644
index a933292a2e7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/assertion_examples_test.go
+++ /dev/null
@@ -1,125 +0,0 @@
-package examples
-
-import (
- "bytes"
- "io"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestAssertionsAreAvailableFromConveyPackage(t *testing.T) {
- SetDefaultFailureMode(FailureContinues)
- defer SetDefaultFailureMode(FailureHalts)
-
- Convey("Equality assertions should be accessible", t, func() {
- thing1a := thing{a: "asdf"}
- thing1b := thing{a: "asdf"}
- thing2 := thing{a: "qwer"}
-
- So(1, ShouldEqual, 1)
- So(1, ShouldNotEqual, 2)
- So(1, ShouldAlmostEqual, 1.000000000000001)
- So(1, ShouldNotAlmostEqual, 2, 0.5)
- So(thing1a, ShouldResemble, thing1b)
- So(thing1a, ShouldNotResemble, thing2)
- So(&thing1a, ShouldPointTo, &thing1a)
- So(&thing1a, ShouldNotPointTo, &thing1b)
- So(nil, ShouldBeNil)
- So(1, ShouldNotBeNil)
- So(true, ShouldBeTrue)
- So(false, ShouldBeFalse)
- So(0, ShouldBeZeroValue)
- })
-
- Convey("Numeric comparison assertions should be accessible", t, func() {
- So(1, ShouldBeGreaterThan, 0)
- So(1, ShouldBeGreaterThanOrEqualTo, 1)
- So(1, ShouldBeLessThan, 2)
- So(1, ShouldBeLessThanOrEqualTo, 1)
- So(1, ShouldBeBetween, 0, 2)
- So(1, ShouldNotBeBetween, 2, 4)
- So(1, ShouldBeBetweenOrEqual, 1, 2)
- So(1, ShouldNotBeBetweenOrEqual, 2, 4)
- })
-
- Convey("Container assertions should be accessible", t, func() {
- So([]int{1, 2, 3}, ShouldContain, 2)
- So([]int{1, 2, 3}, ShouldNotContain, 4)
- So(map[int]int{1: 1, 2: 2, 3: 3}, ShouldContainKey, 2)
- So(map[int]int{1: 1, 2: 2, 3: 3}, ShouldNotContainKey, 4)
- So(1, ShouldBeIn, []int{1, 2, 3})
- So(4, ShouldNotBeIn, []int{1, 2, 3})
- So([]int{}, ShouldBeEmpty)
- So([]int{1}, ShouldNotBeEmpty)
- So([]int{1, 2}, ShouldHaveLength, 2)
- })
-
- Convey("String assertions should be accessible", t, func() {
- So("asdf", ShouldStartWith, "a")
- So("asdf", ShouldNotStartWith, "z")
- So("asdf", ShouldEndWith, "df")
- So("asdf", ShouldNotEndWith, "as")
- So("", ShouldBeBlank)
- So("asdf", ShouldNotBeBlank)
- So("asdf", ShouldContainSubstring, "sd")
- So("asdf", ShouldNotContainSubstring, "af")
- })
-
- Convey("Panic recovery assertions should be accessible", t, func() {
- So(panics, ShouldPanic)
- So(func() {}, ShouldNotPanic)
- So(panics, ShouldPanicWith, "Goofy Gophers!")
- So(panics, ShouldNotPanicWith, "Guileless Gophers!")
- })
-
- Convey("Type-checking assertions should be accessible", t, func() {
-
- // NOTE: Values or pointers may be checked. If a value is passed,
- // it will be cast as a pointer to the value to avoid cases where
- // the struct being tested takes pointer receivers. Go allows values
- // or pointers to be passed as receivers on methods with a value
- // receiver, but only pointers on methods with pointer receivers.
- // See:
- // http://golang.org/doc/effective_go.html#pointers_vs_values
- // http://golang.org/doc/effective_go.html#blank_implements
- // http://blog.golang.org/laws-of-reflection
-
- So(1, ShouldHaveSameTypeAs, 0)
- So(1, ShouldNotHaveSameTypeAs, "1")
-
- So(bytes.NewBufferString(""), ShouldImplement, (*io.Reader)(nil))
- So("string", ShouldNotImplement, (*io.Reader)(nil))
- })
-
- Convey("Time assertions should be accessible", t, func() {
- january1, _ := time.Parse(timeLayout, "2013-01-01 00:00")
- january2, _ := time.Parse(timeLayout, "2013-01-02 00:00")
- january3, _ := time.Parse(timeLayout, "2013-01-03 00:00")
- january4, _ := time.Parse(timeLayout, "2013-01-04 00:00")
- january5, _ := time.Parse(timeLayout, "2013-01-05 00:00")
- oneDay, _ := time.ParseDuration("24h0m0s")
-
- So(january1, ShouldHappenBefore, january4)
- So(january1, ShouldHappenOnOrBefore, january1)
- So(january2, ShouldHappenAfter, january1)
- So(january2, ShouldHappenOnOrAfter, january2)
- So(january3, ShouldHappenBetween, january2, january5)
- So(january3, ShouldHappenOnOrBetween, january3, january5)
- So(january1, ShouldNotHappenOnOrBetween, january2, january5)
- So(january2, ShouldHappenWithin, oneDay, january3)
- So(january5, ShouldNotHappenWithin, oneDay, january1)
- So([]time.Time{january1, january2}, ShouldBeChronological)
- })
-}
-
-type thing struct {
- a string
-}
-
-func panics() {
- panic("Goofy Gophers!")
-}
-
-const timeLayout = "2006-01-02 15:04"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/bowling_game_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/bowling_game_test.go
deleted file mode 100644
index 18e997d44ae..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/bowling_game_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-
-Reference: http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata
-
-See the very first link (which happens to be the very first word of
-the first paragraph) on the page for a tutorial.
-
-*/
-
-package examples
-
-import (
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestBowlingGameScoring(t *testing.T) {
- Convey("Given a fresh score card", t, func() {
- game := NewGame()
-
- Convey("When all gutter balls are thrown", func() {
- game.rollMany(20, 0)
-
- Convey("The score should be zero", func() {
- So(game.Score(), ShouldEqual, 0)
- })
- })
-
- Convey("When all throws knock down only one pin", func() {
- game.rollMany(20, 1)
-
- Convey("The score should be 20", func() {
- So(game.Score(), ShouldEqual, 20)
- })
- })
-
- Convey("When a spare is thrown", func() {
- game.rollSpare()
- game.Roll(3)
- game.rollMany(17, 0)
-
- Convey("The score should include a spare bonus.", func() {
- So(game.Score(), ShouldEqual, 16)
- })
- })
-
- Convey("When a strike is thrown", func() {
- game.rollStrike()
- game.Roll(3)
- game.Roll(4)
- game.rollMany(16, 0)
-
- Convey("The score should include a strike bonus.", func() {
- So(game.Score(), ShouldEqual, 24)
- })
- })
-
- Convey("When all strikes are thrown", func() {
- game.rollMany(21, 10)
-
- Convey("The score should be 300.", func() {
- So(game.Score(), ShouldEqual, 300)
- })
- })
- })
-}
-
-func (self *Game) rollMany(times, pins int) {
- for x := 0; x < times; x++ {
- self.Roll(pins)
- }
-}
-func (self *Game) rollSpare() {
- self.Roll(5)
- self.Roll(5)
-}
-func (self *Game) rollStrike() {
- self.Roll(10)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/simple_example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/simple_example_test.go
deleted file mode 100644
index dadfd8136a3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/examples/simple_example_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package examples
-
-import (
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestIntegerManipulation(t *testing.T) {
- t.Parallel()
-
- Convey("Given a starting integer value", t, func() {
- x := 42
-
- Convey("When incremented", func() {
- x++
-
- Convey("The value should be greater by one", func() {
- So(x, ShouldEqual, 43)
- })
- Convey("The value should NOT be what it used to be", func() {
- So(x, ShouldNotEqual, 42)
- })
- })
- Convey("When decremented", func() {
- x--
-
- Convey("The value should be lesser by one", func() {
- So(x, ShouldEqual, 41)
- })
- Convey("The value should NOT be what it used to be", func() {
- So(x, ShouldNotEqual, 42)
- })
- })
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/OFL.txt b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/OFL.txt
index 3b859d9138f..527a9bfd8d6 100755
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/OFL.txt
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Orbitron/OFL.txt
@@ -1,93 +1,93 @@
-Copyright (c) 2009, Matt McInerney (matt@pixelspread.com),
-with Reserved Font Name Orbitron.
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-http://scripts.sil.org/OFL
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded,
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.
+Copyright (c) 2009, Matt McInerney (matt@pixelspread.com),
+with Reserved Font Name Orbitron.
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/OFL.txt b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/OFL.txt
index ff7febddcb2..22bdace3083 100755
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/OFL.txt
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/client/resources/fonts/Oswald/OFL.txt
@@ -1,92 +1,92 @@
-Copyright (c) 2011-2012, Vernon Adams (vern@newtypography.co.uk), with Reserved Font Names 'Oswald'
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-http://scripts.sil.org/OFL
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded,
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.
+Copyright (c) 2011-2012, Vernon Adams (vern@newtypography.co.uk), with Reserved Font Names 'Oswald'
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/api/server_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/api/server_test.go
deleted file mode 100644
index bd48e308015..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/api/server_test.go
+++ /dev/null
@@ -1,462 +0,0 @@
-package api
-
-import (
- "encoding/json"
- "fmt"
- "net/http"
- "net/http/httptest"
- "net/url"
- "strings"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "github.com/smartystreets/goconvey/web/server/contract"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-const initialRoot = "/root/gopath/src/github.com/smartystreets/project"
-const nonexistentRoot = "I don't exist"
-const unreadableContent = "!!error!!"
-
-func TestHTTPServer(t *testing.T) {
- // TODO: fix the skipped tests...
-
- Convey("Subject: HttpServer responds to requests appropriately", t, func() {
- fixture := newServerFixture()
-
- Convey("Before any update is recieved", func() {
- Convey("When the update is requested", func() {
- update, _ := fixture.RequestLatest()
-
- Convey("No panic should occur", func() {
- So(func() { fixture.RequestLatest() }, ShouldNotPanic)
- })
-
- Convey("The update will be empty", func() {
- So(update, ShouldResemble, new(contract.CompleteOutput))
- })
- })
- })
-
- Convey("Given an update is received", func() {
- fixture.ReceiveUpdate("", &contract.CompleteOutput{Revision: "asdf"})
-
- Convey("When the update is requested", func() {
- update, response := fixture.RequestLatest()
-
- Convey("The server returns it", func() {
- So(update, ShouldResemble, &contract.CompleteOutput{Revision: "asdf"})
- })
-
- Convey("The server returns 200", func() {
- So(response.Code, ShouldEqual, http.StatusOK)
- })
-
- Convey("The server should include important cache-related headers", func() {
- So(len(response.HeaderMap), ShouldEqual, 4)
- So(response.HeaderMap["Content-Type"][0], ShouldEqual, "application/json")
- So(response.HeaderMap["Cache-Control"][0], ShouldEqual, "no-cache, no-store, must-revalidate")
- So(response.HeaderMap["Pragma"][0], ShouldEqual, "no-cache")
- So(response.HeaderMap["Expires"][0], ShouldEqual, "0")
- })
- })
- })
-
- Convey("When the root watch is queried", func() {
- root, status := fixture.QueryRootWatch(false)
-
- SkipConvey("The server returns it", func() {
- So(root, ShouldEqual, initialRoot)
- })
-
- Convey("The server returns HTTP 200 - OK", func() {
- So(status, ShouldEqual, http.StatusOK)
- })
- })
-
- SkipConvey("When the root watch is adjusted", func() {
-
- Convey("But the request has no root parameter", func() {
- status, body := fixture.AdjustRootWatchMalformed()
-
- Convey("The server returns HTTP 400 - Bad Input", func() {
- So(status, ShouldEqual, http.StatusBadRequest)
- })
-
- Convey("The body should contain a helpful error message", func() {
- So(body, ShouldEqual, "No 'root' query string parameter included!")
- })
-
- Convey("The server should not change the existing root", func() {
- root, _ := fixture.QueryRootWatch(false)
- So(root, ShouldEqual, initialRoot)
- })
- })
-
- Convey("But the root parameter is empty", func() {
- status, body := fixture.AdjustRootWatch("")
-
- Convey("The server returns HTTP 400 - Bad Input", func() {
- So(status, ShouldEqual, http.StatusBadRequest)
- })
-
- Convey("The server should provide a helpful error message", func() {
- So(body, ShouldEqual, "You must provide a non-blank path.")
- })
-
- Convey("The server should not change the existing root", func() {
- root, _ := fixture.QueryRootWatch(false)
- So(root, ShouldEqual, initialRoot)
- })
- })
-
- Convey("And the new root exists", func() {
- status, body := fixture.AdjustRootWatch(initialRoot + "/package")
-
- Convey("The server returns HTTP 200 - OK", func() {
- So(status, ShouldEqual, http.StatusOK)
- })
-
- Convey("The body should NOT contain any error message or content", func() {
- So(body, ShouldEqual, "")
- })
-
- Convey("The server informs the watcher of the new root", func() {
- root, _ := fixture.QueryRootWatch(false)
- So(root, ShouldEqual, initialRoot+"/package")
- })
- })
-
- Convey("And the new root does NOT exist", func() {
- status, body := fixture.AdjustRootWatch(nonexistentRoot)
-
- Convey("The server returns HTTP 404 - Not Found", func() {
- So(status, ShouldEqual, http.StatusNotFound)
- })
-
- Convey("The body should contain a helpful error message", func() {
- So(body, ShouldEqual, fmt.Sprintf("Directory does not exist: '%s'", nonexistentRoot))
- })
-
- Convey("The server should not change the existing root", func() {
- root, _ := fixture.QueryRootWatch(false)
- So(root, ShouldEqual, initialRoot)
- })
- })
- })
-
- SkipConvey("When a packge is ignored", func() {
-
- Convey("But the request has no path parameter", func() {
- status, body := fixture.IgnoreMalformed()
-
- Convey("The server returns HTTP 400 - Bad Input", func() {
- So(status, ShouldEqual, http.StatusBadRequest)
- })
-
- Convey("The body should contain a helpful error message", func() {
- So(body, ShouldEqual, "No 'paths' query string parameter included!")
- })
-
- SkipConvey("The server should not ignore anything", func() {
- // So(fixture.watcher.ignored, ShouldEqual, "")
- })
- })
-
- Convey("But the request is blank", func() {
- status, body := fixture.Ignore("")
-
- Convey("The server returns HTTP 400 - Bad Input", func() {
- So(status, ShouldEqual, http.StatusBadRequest)
- })
-
- Convey("The body should contain a helpful error message", func() {
- So(body, ShouldEqual, "You must provide a non-blank path.")
- })
- })
-
- Convey("And the request is well formed", func() {
- status, _ := fixture.Ignore(initialRoot)
-
- SkipConvey("The server informs the watcher", func() {
- // So(fixture.watcher.ignored, ShouldEqual, initialRoot)
- })
- Convey("The server returns HTTP 200 - OK", func() {
- So(status, ShouldEqual, http.StatusOK)
- })
- })
- })
-
- SkipConvey("When a package is reinstated", func() {
- Convey("But the request has no path parameter", func() {
- status, body := fixture.ReinstateMalformed()
-
- Convey("The server returns HTTP 400 - Bad Input", func() {
- So(status, ShouldEqual, http.StatusBadRequest)
- })
-
- Convey("The body should contain a helpful error message", func() {
- So(body, ShouldEqual, "No 'paths' query string parameter included!")
- })
-
- SkipConvey("The server should not ignore anything", func() {
- // So(fixture.watcher.reinstated, ShouldEqual, "")
- })
- })
-
- Convey("But the request is blank", func() {
- status, body := fixture.Reinstate("")
-
- Convey("The server returns HTTP 400 - Bad Input", func() {
- So(status, ShouldEqual, http.StatusBadRequest)
- })
-
- Convey("The body should contain a helpful error message", func() {
- So(body, ShouldEqual, "You must provide a non-blank path.")
- })
- })
-
- Convey("And the request is well formed", func() {
- status, _ := fixture.Reinstate(initialRoot)
-
- SkipConvey("The server informs the watcher", func() {
- // So(fixture.watcher.reinstated, ShouldEqual, initialRoot)
- })
- Convey("The server returns HTTP 200 - OK", func() {
- So(status, ShouldEqual, http.StatusOK)
- })
- })
- })
-
- Convey("When the status of the executor is requested", func() {
- fixture.executor.status = "blah blah blah"
- statusCode, statusBody := fixture.RequestExecutorStatus()
-
- Convey("The server asks the executor its status and returns it", func() {
- So(statusBody, ShouldEqual, "blah blah blah")
- })
-
- Convey("The server returns HTTP 200 - OK", func() {
- So(statusCode, ShouldEqual, http.StatusOK)
- })
- })
-
- Convey("When a manual execution of the test packages is requested", func() {
- status := fixture.ManualExecution()
- update, _ := fixture.RequestLatest()
-
- SkipConvey("The server invokes the executor using the watcher's listing and save the result", func() {
- So(update, ShouldResemble, &contract.CompleteOutput{Revision: initialRoot})
- })
-
- Convey("The server returns HTTP 200 - OK", func() {
- So(status, ShouldEqual, http.StatusOK)
- })
- })
-
- SkipConvey("When the pause setting is toggled via the server", func() {
- paused := fixture.TogglePause()
-
- SkipConvey("The pause channel buffer should have a true value", func() {
- // var value bool
- // select {
- // case value = <-fixture.pauseUpdate:
- // default:
- // }
- // So(value, ShouldBeTrue)
- })
-
- Convey("The latest results should show that the server is paused", func() {
- fixture.ReceiveUpdate("", &contract.CompleteOutput{Revision: "asdf"})
- update, _ := fixture.RequestLatest()
-
- So(update.Paused, ShouldBeTrue)
- })
-
- Convey("The toggle handler should return its new status", func() {
- So(paused, ShouldEqual, "true")
- })
- })
- })
-}
-
-/********* Server Fixture *********/
-
-type ServerFixture struct {
- server *HTTPServer
- watcher chan messaging.WatcherCommand
- executor *FakeExecutor
- statusUpdate chan bool
-}
-
-func (self *ServerFixture) ReceiveUpdate(root string, update *contract.CompleteOutput) {
- self.server.ReceiveUpdate(root, update)
-}
-
-func (self *ServerFixture) RequestLatest() (*contract.CompleteOutput, *httptest.ResponseRecorder) {
- request, _ := http.NewRequest("GET", "http://localhost:8080/results", nil)
- response := httptest.NewRecorder()
-
- self.server.Results(response, request)
-
- decoder := json.NewDecoder(strings.NewReader(response.Body.String()))
- update := new(contract.CompleteOutput)
- decoder.Decode(update)
- return update, response
-}
-
-func (self *ServerFixture) QueryRootWatch(newclient bool) (string, int) {
- url := "http://localhost:8080/watch"
- if newclient {
- url += "?newclient=1"
- }
- request, _ := http.NewRequest("GET", url, nil)
- response := httptest.NewRecorder()
-
- self.server.Watch(response, request)
-
- return strings.TrimSpace(response.Body.String()), response.Code
-}
-
-func (self *ServerFixture) AdjustRootWatchMalformed() (status int, body string) {
- request, _ := http.NewRequest("POST", "http://localhost:8080/watch", nil)
- response := httptest.NewRecorder()
-
- self.server.Watch(response, request)
-
- status, body = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) AdjustRootWatch(newRoot string) (status int, body string) {
- escapedRoot := url.QueryEscape(newRoot)
- request, _ := http.NewRequest("POST", "http://localhost:8080/watch?root="+escapedRoot, nil)
- response := httptest.NewRecorder()
-
- self.server.Watch(response, request)
-
- status, body = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) IgnoreMalformed() (status int, body string) {
- request, _ := http.NewRequest("POST", "http://localhost:8080/ignore", nil)
- response := httptest.NewRecorder()
-
- self.server.Ignore(response, request)
-
- status, body = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) Ignore(folder string) (status int, body string) {
- escapedFolder := url.QueryEscape(folder)
- request, _ := http.NewRequest("POST", "http://localhost:8080/ignore?paths="+escapedFolder, nil)
- response := httptest.NewRecorder()
-
- self.server.Ignore(response, request)
-
- status, body = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) ReinstateMalformed() (status int, body string) {
- request, _ := http.NewRequest("POST", "http://localhost:8080/reinstate", nil)
- response := httptest.NewRecorder()
-
- self.server.Reinstate(response, request)
-
- status, body = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) Reinstate(folder string) (status int, body string) {
- escapedFolder := url.QueryEscape(folder)
- request, _ := http.NewRequest("POST", "http://localhost:8080/reinstate?paths="+escapedFolder, nil)
- response := httptest.NewRecorder()
-
- self.server.Reinstate(response, request)
-
- status, body = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) SetExecutorStatus(status string) {
- // self.executor.status = status
- // select {
- // case self.executor.statusUpdate <- make(chan string):
- // default:
- // }
-}
-
-func (self *ServerFixture) RequestExecutorStatus() (code int, status string) {
- request, _ := http.NewRequest("GET", "http://localhost:8080/status", nil)
- response := httptest.NewRecorder()
-
- self.server.Status(response, request)
-
- code, status = response.Code, strings.TrimSpace(response.Body.String())
- return
-}
-
-func (self *ServerFixture) ManualExecution() int {
- request, _ := http.NewRequest("POST", "http://localhost:8080/execute", nil)
- response := httptest.NewRecorder()
-
- self.server.Execute(response, request)
- nap, _ := time.ParseDuration("100ms")
- time.Sleep(nap)
- return response.Code
-}
-
-func (self *ServerFixture) TogglePause() string {
- request, _ := http.NewRequest("POST", "http://localhost:8080/pause", nil)
- response := httptest.NewRecorder()
-
- self.server.TogglePause(response, request)
-
- return response.Body.String()
-}
-
-func newServerFixture() *ServerFixture {
- self := new(ServerFixture)
- self.watcher = make(chan messaging.WatcherCommand)
- // self.watcher.SetRootWatch(initialRoot)
- statusUpdate := make(chan chan string)
- self.executor = newFakeExecutor("", statusUpdate)
- self.server = NewHTTPServer("initial-working-dir", self.watcher, self.executor, statusUpdate)
- return self
-}
-
-/********* Fake Executor *********/
-
-type FakeExecutor struct {
- status string
- executed bool
- statusFlag bool
- statusUpdate chan chan string
-}
-
-func (self *FakeExecutor) Status() string {
- return self.status
-}
-
-func (self *FakeExecutor) ClearStatusFlag() bool {
- hasNewStatus := self.statusFlag
- self.statusFlag = false
- return hasNewStatus
-}
-
-func (self *FakeExecutor) ExecuteTests(watched []*contract.Package) *contract.CompleteOutput {
- output := new(contract.CompleteOutput)
- output.Revision = watched[0].Path
- return output
-}
-
-func newFakeExecutor(status string, statusUpdate chan chan string) *FakeExecutor {
- self := new(FakeExecutor)
- self.status = status
- self.statusUpdate = statusUpdate
- return self
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/contract/doc_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/contract/doc_test.go
deleted file mode 100644
index 14f4d2d9c2e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/contract/doc_test.go
+++ /dev/null
@@ -1 +0,0 @@
-package contract
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/executor_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/executor_test.go
deleted file mode 100644
index d7221b0dc12..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/executor_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package executor
-
-import (
- "strings"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-func TestExecutor(t *testing.T) {
- t.Skip("BROKEN!")
-
- Convey("Subject: Execution of test packages and aggregation of parsed results", t, func() {
- fixture := newExecutorFixture()
-
- Convey("When tests packages are executed", func() {
- fixture.ExecuteTests()
-
- Convey("The result should include parsed results for each test package.",
- fixture.ResultShouldBePopulated)
- })
-
- Convey("When the executor is idle", func() {
- Convey("The status of the executor should be 'idle'", func() {
- So(fixture.executor.Status(), ShouldEqual, Idle)
- })
- })
-
- Convey("When the status is updated", func() {
- fixture.executor.setStatus(Executing)
-
- Convey("The status flag should be set to true", func() {
- So(fixture.executor.statusFlag, ShouldBeTrue)
- })
- })
-
- Convey("During test execution", func() {
- status := fixture.CaptureStatusDuringExecutionPhase()
-
- Convey("The status of the executor should be 'executing'", func() {
- So(status, ShouldEqual, Executing)
- })
- })
- })
-}
-
-type ExecutorFixture struct {
- executor *Executor
- tester *FakeTester
- parser *FakeParser
- folders []*contract.Package
- result *contract.CompleteOutput
- expected *contract.CompleteOutput
- stamp time.Time
-}
-
-func (self *ExecutorFixture) ExecuteTests() {
- self.result = self.executor.ExecuteTests(self.folders)
-}
-
-func (self *ExecutorFixture) CaptureStatusDuringExecutionPhase() string {
- nap, _ := time.ParseDuration("25ms")
- self.tester.addDelay(nap)
- return self.delayedExecution(nap)
-}
-
-func (self *ExecutorFixture) delayedExecution(nap time.Duration) string {
- go self.ExecuteTests()
- time.Sleep(nap)
- return self.executor.Status()
-}
-
-func (self *ExecutorFixture) ResultShouldBePopulated() {
- So(self.result, ShouldResemble, self.expected)
-}
-
-var (
- prefix = "/Users/blah/gopath/src/"
- packageA = "github.com/smartystreets/goconvey/a"
- packageB = "github.com/smartystreets/goconvey/b"
- resultA = &contract.PackageResult{PackageName: packageA}
- resultB = &contract.PackageResult{PackageName: packageB}
-)
-
-func newExecutorFixture() *ExecutorFixture {
- self := new(ExecutorFixture)
- self.tester = newFakeTester()
- self.parser = newFakeParser()
- self.executor = NewExecutor(self.tester, self.parser, make(chan chan string))
- self.folders = []*contract.Package{
- &contract.Package{Path: prefix + packageA, Name: packageA},
- &contract.Package{Path: prefix + packageB, Name: packageB},
- }
- self.stamp = time.Now()
- now = func() time.Time { return self.stamp }
-
- self.expected = &contract.CompleteOutput{
- Packages: []*contract.PackageResult{
- resultA,
- resultB,
- },
- Revision: self.stamp.String(),
- }
- return self
-}
-
-/******** FakeTester ********/
-
-type FakeTester struct {
- nap time.Duration
-}
-
-func (self *FakeTester) SetBatchSize(batchSize int) { panic("NOT SUPPORTED") }
-func (self *FakeTester) TestAll(folders []*contract.Package) {
- for _, p := range folders {
- p.Output = p.Path
- }
- time.Sleep(self.nap)
-}
-func (self *FakeTester) addDelay(nap time.Duration) {
- self.nap = nap
-}
-
-func newFakeTester() *FakeTester {
- self := new(FakeTester)
- zero, _ := time.ParseDuration("0")
- self.nap = zero
- return self
-}
-
-/******** FakeParser ********/
-
-type FakeParser struct {
- nap time.Duration
-}
-
-func (self *FakeParser) Parse(packages []*contract.Package) {
- time.Sleep(self.nap)
- for _, package_ := range packages {
- if package_.Name == packageA && strings.HasSuffix(package_.Output, packageA) {
- package_.Result = resultA
- }
- if package_.Name == packageB && strings.HasSuffix(package_.Output, packageB) {
- package_.Result = resultB
- }
- }
-}
-
-func (self *FakeParser) addDelay(nap time.Duration) {
- self.nap = nap
-}
-
-func newFakeParser() *FakeParser {
- self := new(FakeParser)
- zero, _ := time.ParseDuration("0")
- self.nap = zero
- return self
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/tester_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/tester_test.go
deleted file mode 100644
index d540c546d9a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/executor/tester_test.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package executor
-
-import (
- "errors"
- "fmt"
- "io/ioutil"
- "log"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-func init() {
- log.SetOutput(ioutil.Discard)
-}
-
-func TestConcurrentTester(t *testing.T) {
- t.Skip("BROKEN!")
-
- Convey("Subject: Controlled execution of test packages", t, func() {
- fixture := NewTesterFixture()
-
- Convey("Whenever tests for each package are executed", func() {
- fixture.InBatchesOf(1).RunTests()
-
- Convey("The tester should execute the tests in each active package with the correct arguments",
- fixture.ShouldHaveRecordOfExecutionCommands)
-
- Convey("There should be a test output result for each active package",
- fixture.ShouldHaveOneOutputPerInput)
-
- Convey("The output should be as expected",
- fixture.OutputShouldBeAsExpected)
- })
-
- Convey("When the tests for each package are executed synchronously", func() {
- fixture.InBatchesOf(1).RunTests()
-
- Convey("Each active package should be run synchronously and in the given order",
- fixture.TestsShouldHaveRunContiguously)
- })
-
- Convey("When the tests for each package are executed synchronously with failures", func() {
- fixture.InBatchesOf(1).SetupFailedTestSuites().RunTests()
-
- Convey("The failed test packages should not result in any panics", func() {
- So(fixture.recovered, ShouldBeNil)
- })
- })
-
- Convey("When packages are tested concurrently", func() {
- fixture.InBatchesOf(concurrentBatchSize).RunTests()
-
- Convey("Active packages should be arranged and tested in batches of the appropriate size",
- fixture.TestsShouldHaveRunInBatchesOfTwo)
- })
-
- Convey("When packages are tested concurrently with failures", func() {
- fixture.InBatchesOf(concurrentBatchSize).SetupFailedTestSuites().RunTests()
-
- Convey("The failed test packages should not result in any panics", func() {
- So(fixture.recovered, ShouldBeNil)
- })
- })
- })
-}
-
-const concurrentBatchSize = 2
-
-type TesterFixture struct {
- tester *ConcurrentTester
- shell *TimedShell
- results []string
- compilations []*ShellCommand
- executions []*ShellCommand
- packages []*contract.Package
- recovered error
-}
-
-func NewTesterFixture() *TesterFixture {
- self := new(TesterFixture)
- self.shell = NewTimedShell()
- self.tester = NewConcurrentTester(self.shell)
- self.packages = []*contract.Package{
- {Path: "a"},
- {Path: "b"},
- {Path: "c"},
- {Path: "d"},
- {Path: "e", Ignored: true},
- {Path: "f"},
- {Path: "g", HasImportCycle: true},
- }
- return self
-}
-
-func (self *TesterFixture) InBatchesOf(batchSize int) *TesterFixture {
- self.tester.SetBatchSize(batchSize)
- return self
-}
-
-func (self *TesterFixture) SetupAbnormalError(message string) *TesterFixture {
- self.shell.setTripWire(message)
- return self
-}
-
-func (self *TesterFixture) SetupFailedTestSuites() *TesterFixture {
- self.shell.setExitWithError()
- return self
-}
-
-func (self *TesterFixture) RunTests() {
- defer func() {
- if r := recover(); r != nil {
- self.recovered = r.(error)
- }
- }()
-
- self.tester.TestAll(self.packages)
- for _, p := range self.packages {
- self.results = append(self.results, p.Output)
- }
- self.executions = self.shell.Executions()
-}
-
-func (self *TesterFixture) ShouldHaveRecordOfExecutionCommands() {
- executed := []string{"a", "b", "c", "d", "f"}
- ignored := "e"
- importCycle := "g"
- actual := []string{}
- for _, pkg := range self.executions {
- actual = append(actual, pkg.Command)
- }
- So(actual, ShouldResemble, executed)
- So(actual, ShouldNotContain, ignored)
- So(actual, ShouldNotContain, importCycle)
-}
-
-func (self *TesterFixture) ShouldHaveOneOutputPerInput() {
- So(len(self.results), ShouldEqual, len(self.packages))
-}
-
-func (self *TesterFixture) OutputShouldBeAsExpected() {
- for _, p := range self.packages {
- if p.HasImportCycle {
- So(p.Output, ShouldContainSubstring, "can't load package: import cycle not allowed")
- So(p.Error.Error(), ShouldContainSubstring, "can't load package: import cycle not allowed")
- } else {
- if p.Active() {
- So(p.Output, ShouldEndWith, p.Path)
- } else {
- So(p.Output, ShouldBeBlank)
- }
- So(p.Error, ShouldBeNil)
- }
- }
-}
-
-func (self *TesterFixture) TestsShouldHaveRunContiguously() {
- self.OutputShouldBeAsExpected()
-
- So(self.shell.MaxConcurrentCommands(), ShouldEqual, 1)
-
- for i := 0; i < len(self.executions)-1; i++ {
- current := self.executions[i]
- next := self.executions[i+1]
- So(current.Started, ShouldHappenBefore, next.Started)
- So(current.Ended, ShouldHappenOnOrBefore, next.Started)
- }
-}
-
-func (self *TesterFixture) TestsShouldHaveRunInBatchesOfTwo() {
- self.OutputShouldBeAsExpected()
-
- So(self.shell.MaxConcurrentCommands(), ShouldEqual, concurrentBatchSize)
-}
-
-/**** Fakes ****/
-
-type ShellCommand struct {
- Command string
- Started time.Time
- Ended time.Time
-}
-
-type TimedShell struct {
- executions []*ShellCommand
- panicMessage string
- err error
-}
-
-func (self *TimedShell) Executions() []*ShellCommand {
- return self.executions
-}
-
-func (self *TimedShell) MaxConcurrentCommands() int {
- var concurrent int
-
- for x, current := range self.executions {
- concurrentWith_x := 1
- for y, comparison := range self.executions {
- if y == x {
- continue
- } else if concurrentWith(current, comparison) {
- concurrentWith_x++
- }
- }
- if concurrentWith_x > concurrent {
- concurrent = concurrentWith_x
- }
- }
- return concurrent
-}
-
-func concurrentWith(current, comparison *ShellCommand) bool {
- return ((comparison.Started == current.Started || comparison.Started.After(current.Started)) &&
- (comparison.Started.Before(current.Ended)))
-}
-
-func (self *TimedShell) setTripWire(message string) {
- self.panicMessage = message
-}
-
-func (self *TimedShell) setExitWithError() {
- self.err = errors.New("Simulate test failure")
-}
-
-func (self *TimedShell) GoTest(directory, packageName string, arguments, tags []string) (output string, err error) {
- if self.panicMessage != "" {
- return "", errors.New(self.panicMessage)
- }
-
- output = directory
- err = self.err
- self.executions = append(self.executions, self.composeCommand(directory))
- return
-}
-
-func (self *TimedShell) composeCommand(commandText string) *ShellCommand {
- start := time.Now()
- time.Sleep(nap)
- end := time.Now()
- return &ShellCommand{commandText, start, end}
-}
-
-func NewTimedShell() *TimedShell {
- self := new(TimedShell)
- self.executions = []*ShellCommand{}
- return self
-}
-
-var nap, _ = time.ParseDuration("10ms")
-var _ = fmt.Sprintf("fmt")
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/messaging/doc_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/messaging/doc_test.go
deleted file mode 100644
index cbb7a43f8ba..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/messaging/doc_test.go
+++ /dev/null
@@ -1 +0,0 @@
-package messaging
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/package_parser_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/package_parser_test.go
deleted file mode 100644
index 65f3f9830bf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/package_parser_test.go
+++ /dev/null
@@ -1,792 +0,0 @@
-package parser
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "log"
- "strings"
- "testing"
-
- "github.com/smartystreets/goconvey/convey/reporting"
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-func init() {
- log.SetOutput(ioutil.Discard)
-}
-
-func TestParsePackage_NoGoFiles_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expected_NoGoFiles.PackageName}
- ParsePackageResults(actual, input_NoGoFiles)
- assertEqual(t, expected_NoGoFiles, *actual)
-}
-
-func TestParsePackage_NoTestFiles_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expected_NoTestFiles.PackageName}
- ParsePackageResults(actual, input_NoTestFiles)
- assertEqual(t, expected_NoTestFiles, *actual)
-}
-
-func TestParsePacakge_NoTestFunctions_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expected_NoTestFunctions.PackageName}
- ParsePackageResults(actual, input_NoTestFunctions)
- assertEqual(t, expected_NoTestFunctions, *actual)
-}
-
-func TestParsePackage_BuildFailed_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expected_BuildFailed_InvalidPackageDeclaration.PackageName}
- ParsePackageResults(actual, input_BuildFailed_InvalidPackageDeclaration)
- assertEqual(t, expected_BuildFailed_InvalidPackageDeclaration, *actual)
-
- actual = &contract.PackageResult{PackageName: expected_BuildFailed_OtherErrors.PackageName}
- ParsePackageResults(actual, input_BuildFailed_OtherErrors)
- assertEqual(t, expected_BuildFailed_OtherErrors, *actual)
-
- actual = &contract.PackageResult{PackageName: expected_BuildFailed_ImportCycle.PackageName}
- ParsePackageResults(actual, input_BuildFailed_ImportCycle)
- assertEqual(t, expected_BuildFailed_ImportCycle, *actual)
-
- actual = &contract.PackageResult{PackageName: expected_BuildFailed_CantFindPackage.PackageName}
- ParsePackageResults(actual, input_BuildFailed_CantFindPackage)
- assertEqual(t, expected_BuildFailed_CantFindPackage, *actual)
-
- actual = &contract.PackageResult{PackageName: expected_BuildFailed_ConflictingImport.PackageName}
- ParsePackageResults(actual, input_BuildFailed_ConfictingImport)
- assertEqual(t, expected_BuildFailed_ConflictingImport, *actual)
-}
-
-func TestParsePackage_OldSchoolWithFailureOutput_ReturnsCompletePackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedOldSchool_Fails.PackageName}
- ParsePackageResults(actual, inputOldSchool_Fails)
- assertEqual(t, expectedOldSchool_Fails, *actual)
-}
-
-func TestParsePackage_OldSchoolWithSuccessOutput_ReturnsCompletePackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedOldSchool_Passes.PackageName}
- ParsePackageResults(actual, inputOldSchool_Passes)
- assertEqual(t, expectedOldSchool_Passes, *actual)
-}
-
-func TestParsePackage_OldSchoolWithPanicOutput_ReturnsCompletePackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedOldSchool_Panics.PackageName}
- ParsePackageResults(actual, inputOldSchool_Panics)
- assertEqual(t, expectedOldSchool_Panics, *actual)
-}
-
-func TestParsePackage_GoConveyOutput_ReturnsCompletePackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedGoConvey.PackageName}
- ParsePackageResults(actual, inputGoConvey)
- assertEqual(t, expectedGoConvey, *actual)
-}
-
-func TestParsePackage_ActualPackageNameDifferentThanDirectoryName_ReturnsActualPackageName(t *testing.T) {
- actual := &contract.PackageResult{PackageName: strings.Replace(expectedGoConvey.PackageName, "examples", "stuff", -1)}
- ParsePackageResults(actual, inputGoConvey)
- assertEqual(t, expectedGoConvey, *actual)
-}
-
-func TestParsePackage_GoConveyOutputMalformed_CausesPanic(t *testing.T) {
- defer func() {
- if r := recover(); r != nil {
- message := fmt.Sprintf("%v", r)
- if !strings.Contains(message, "bug report") {
- t.Errorf("Should have panicked with a request to file a bug report but we received this error instead: %s", message)
- }
- } else {
- t.Errorf("Should have panicked with a request to file a bug report but we received no error.")
- }
- }()
-
- actual := &contract.PackageResult{PackageName: expectedGoConvey.PackageName}
- ParsePackageResults(actual, inputGoConvey_Malformed)
-}
-
-func TestParsePackage_GoConveyWithRandomOutput_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedGoConvey_WithRandomOutput.PackageName}
- ParsePackageResults(actual, inputGoConvey_WithRandomOutput)
- assertEqual(t, expectedGoConvey_WithRandomOutput, *actual)
-}
-
-func TestParsePackage_OldSchoolWithSuccessAndBogusCoverage_ReturnsCompletePackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedOldSchool_PassesButCoverageIsBogus.PackageName}
- ParsePackageResults(actual, inputOldSchool_PassesButCoverageIsBogus)
- assertEqual(t, expectedOldSchool_PassesButCoverageIsBogus, *actual)
-}
-
-func TestParsePackage_NestedTests_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedNestedTests.PackageName}
- ParsePackageResults(actual, inputNestedTests)
- assertEqual(t, expectedNestedTests, *actual)
-}
-
-func TestParsePackage_WithExampleFunctions_ReturnsPackageResult(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedExampleFunctions.PackageName}
- ParsePackageResults(actual, inputExampleFunctions)
- assertEqual(t, expectedExampleFunctions, *actual)
-}
-
-func TestParsePackage_Golang15Output_ShouldNotPanic(t *testing.T) {
- actual := &contract.PackageResult{PackageName: expectedGolang15.PackageName}
- ParsePackageResults(actual, inputGolang15)
- assertEqual(t, expectedGolang15, *actual)
-}
-
-func assertEqual(t *testing.T, expected, actual interface{}) {
- a, _ := json.Marshal(expected)
- b, _ := json.Marshal(actual)
- if string(a) != string(b) {
- t.Errorf(failureTemplate, string(a), string(b))
- }
-}
-
-const failureTemplate = "Comparison failed:\n Expected: %v\n Actual: %v\n"
-
-const input_NoGoFiles = `can't load package: package github.com/smartystreets/goconvey: no buildable Go source files in /Users/matt/Work/Dev/goconvey/src/github.com/smartystreets/goconvey`
-
-var expected_NoGoFiles = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey",
- Outcome: contract.NoGoFiles,
- BuildOutput: input_NoGoFiles,
-}
-
-const input_NoTestFiles = `? pkg.smartystreets.net/liveaddress-zipapi [no test files]`
-
-var expected_NoTestFiles = contract.PackageResult{
- PackageName: "pkg.smartystreets.net/liveaddress-zipapi",
- Outcome: contract.NoTestFiles,
- BuildOutput: input_NoTestFiles,
-}
-
-const input_NoTestFunctions = `testing: warning: no tests to run
-PASS
-ok github.com/smartystreets/goconvey/scripts 0.011s`
-
-var expected_NoTestFunctions = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/scripts",
- Outcome: contract.NoTestFunctions,
- BuildOutput: input_NoTestFunctions,
-}
-
-const input_BuildFailed_InvalidPackageDeclaration = `
-can't load package: package github.com/smartystreets/goconvey/examples:
-bowling_game_test.go:9:1: expected 'package', found 'IDENT' asdf
-bowling_game_test.go:10:1: invalid package name _
-`
-
-var expected_BuildFailed_InvalidPackageDeclaration = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/examples",
- Outcome: contract.BuildFailure,
- BuildOutput: strings.TrimSpace(input_BuildFailed_InvalidPackageDeclaration),
-}
-
-const input_BuildFailed_CantFindPackage = `
-bowling_game.go:3:8: cannot find package "format" in any of:
- /usr/local/go/src/pkg/format (from $GOROOT)
- /Users/mike/work/dev/goconvey/src/format (from $GOPATH)
-FAIL github.com/smartystreets/goconvey/examples [setup failed]
-`
-
-var expected_BuildFailed_CantFindPackage = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/examples",
- Outcome: contract.BuildFailure,
- BuildOutput: strings.TrimSpace(input_BuildFailed_CantFindPackage),
-}
-
-const input_BuildFailed_ConfictingImport = `
-mutustus.go:4:2: found packages e (e.go) and err (prepend.go) in /Users/mike/src/utensils.git/e
-`
-
-var expected_BuildFailed_ConflictingImport = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/examples",
- Outcome: contract.BuildFailure,
- BuildOutput: strings.TrimSpace(input_BuildFailed_ConfictingImport),
-}
-
-const input_BuildFailed_OtherErrors = `
-# github.com/smartystreets/goconvey/examples
-./bowling_game_test.go:22: undefined: game
-./bowling_game_test.go:22: cannot assign to game
-./bowling_game_test.go:25: undefined: game
-./bowling_game_test.go:28: undefined: game
-./bowling_game_test.go:33: undefined: game
-./bowling_game_test.go:36: undefined: game
-./bowling_game_test.go:41: undefined: game
-./bowling_game_test.go:42: undefined: game
-./bowling_game_test.go:43: undefined: game
-./bowling_game_test.go:46: undefined: game
-./bowling_game_test.go:46: too many errors
-FAIL github.com/smartystreets/goconvey/examples [build failed]
-`
-
-var expected_BuildFailed_OtherErrors = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/examples",
- Outcome: contract.BuildFailure,
- BuildOutput: strings.TrimSpace(input_BuildFailed_OtherErrors),
-}
-
-const input_BuildFailed_ImportCycle = `
-# github.com/smartystreets/goconvey/t
-./t_test.go:23: import "github.com/smartystreets/goconvey/t" while compiling that package (import cycle)
-FAIL github.com/smartystreets/goconvey/t [build failed]
-`
-
-var expected_BuildFailed_ImportCycle = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/t",
- Outcome: contract.BuildFailure,
- BuildOutput: strings.TrimSpace(input_BuildFailed_ImportCycle),
-}
-
-const inputOldSchool_Passes = `
-=== RUN TestOldSchool_Passes
---- PASS: TestOldSchool_Passes (0.02 seconds)
-=== RUN TestSkippingTests
---- SKIP: TestSkippingTests (0.00 seconds)
- old_school_test.go:8: blah
-=== RUN TestOldSchool_PassesWithMessage
---- PASS: TestOldSchool_PassesWithMessage (0.05 seconds)
- old_school_test.go:10: I am a passing test.
- With a newline.
-PASS
-coverage: 100.0%% of statements in github.com/smartystreets/goconvey/convey, github.com/smartystreets/goconvey/convey/gotest, github.com/smartystreets/goconvey/convey/reporting
-ok github.com/smartystreets/goconvey/webserver/examples 0.018s
-`
-
-var expectedOldSchool_Passes = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.018,
- Coverage: 100,
- Outcome: contract.Passed,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestOldSchool_Passes",
- Elapsed: 0.02,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestOldSchool_PassesWithMessage",
- Elapsed: 0.05,
- Passed: true,
- File: "old_school_test.go",
- Line: 10,
- Message: "old_school_test.go:10: I am a passing test.\nWith a newline.",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestSkippingTests",
- Elapsed: 0,
- Passed: true,
- Skipped: true,
- File: "old_school_test.go",
- Line: 8,
- Message: "old_school_test.go:8: blah",
- Stories: []reporting.ScopeResult{},
- },
- },
-}
-
-const inputOldSchool_Fails = `
-=== RUN TestOldSchool_Passes
---- PASS: TestOldSchool_Passes (0.01 seconds)
-=== RUN TestOldSchool_PassesWithMessage
---- PASS: TestOldSchool_PassesWithMessage (0.03 seconds)
- old_school_test.go:10: I am a passing test.
- With a newline.
-=== RUN TestOldSchool_Failure
---- FAIL: TestOldSchool_Failure (0.06 seconds)
-=== RUN TestOldSchool_FailureWithReason
---- FAIL: TestOldSchool_FailureWithReason (0.11 seconds)
- old_school_test.go:18: I am a failing test.
-FAIL
-exit status 1
-FAIL github.com/smartystreets/goconvey/webserver/examples 0.017s
-`
-
-var expectedOldSchool_Fails = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Outcome: contract.Failed,
- Elapsed: 0.017,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestOldSchool_Failure",
- Elapsed: 0.06,
- Passed: false,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestOldSchool_FailureWithReason",
- Elapsed: 0.11,
- Passed: false,
- File: "old_school_test.go",
- Line: 18,
- Message: "old_school_test.go:18: I am a failing test.",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestOldSchool_Passes",
- Elapsed: 0.01,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestOldSchool_PassesWithMessage",
- Elapsed: 0.03,
- Passed: true,
- File: "old_school_test.go",
- Line: 10,
- Message: "old_school_test.go:10: I am a passing test.\nWith a newline.",
- Stories: []reporting.ScopeResult{},
- },
- },
-}
-
-const inputOldSchool_Panics = `
-=== RUN TestOldSchool_Panics
---- FAIL: TestOldSchool_Panics (0.02 seconds)
-panic: runtime error: index out of range [recovered]
- panic: runtime error: index out of range
-
-goroutine 3 [running]:
-testing.func·004()
- /usr/local/go/src/pkg/testing/testing.go:348 +0xcd
-github.com/smartystreets/goconvey/webserver/examples.TestOldSchool_Panics(0x210292000)
- /Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/something_test.go:15 +0xec
-testing.tRunner(0x210292000, 0x1b09f0)
- /usr/local/go/src/pkg/testing/testing.go:353 +0x8a
-created by testing.RunTests
- /usr/local/go/src/pkg/testing/testing.go:433 +0x86b
-
-goroutine 1 [chan receive]:
-testing.RunTests(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1, ...)
- /usr/local/go/src/pkg/testing/testing.go:434 +0x88e
-testing.Main(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1b7f60, ...)
- /usr/local/go/src/pkg/testing/testing.go:365 +0x8a
-main.main()
- github.com/smartystreets/goconvey/webserver/examples/_test/_testmain.go:43 +0x9a
-exit status 2
-FAIL github.com/smartystreets/goconvey/webserver/examples 0.014s
-`
-
-var expectedOldSchool_Panics = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.014,
- Outcome: contract.Panicked,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestOldSchool_Panics",
- Elapsed: 0.02,
- Passed: false,
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/something_test.go",
- Line: 15,
- Message: "",
- Error: strings.Replace(`panic: runtime error: index out of range [recovered]
- panic: runtime error: index out of range
-
-goroutine 3 [running]:
-testing.func·004()
- /usr/local/go/src/pkg/testing/testing.go:348 +0xcd
-github.com/smartystreets/goconvey/webserver/examples.TestOldSchool_Panics(0x210292000)
- /Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/something_test.go:15 +0xec
-testing.tRunner(0x210292000, 0x1b09f0)
- /usr/local/go/src/pkg/testing/testing.go:353 +0x8a
-created by testing.RunTests
- /usr/local/go/src/pkg/testing/testing.go:433 +0x86b
-
-goroutine 1 [chan receive]:
-testing.RunTests(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1, ...)
- /usr/local/go/src/pkg/testing/testing.go:434 +0x88e
-testing.Main(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1b7f60, ...)
- /usr/local/go/src/pkg/testing/testing.go:365 +0x8a
-main.main()
- github.com/smartystreets/goconvey/webserver/examples/_test/_testmain.go:43 +0x9a`, "\u0009", "\t", -1),
- Stories: []reporting.ScopeResult{},
- },
- },
-}
-
-const inputGoConvey_Malformed = `
-=== RUN TestPassingStory
->->->OPEN-JSON->->->
-{
- "Title": "A passing story",
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
- "Line": 11,
- "Depth": 0,
- "Assertions": [
- {
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
- "Line": 10,
- "Failure": "",
-
- ;aiwheopinen39 n3902n92m
-
- "Error": null,
- "Skipped": false,
- "StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/webserver/examples.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:10 +0xe3\ngithub.com/smartystreets/goconvey/webserver/examples.TestPassingStory(0x210314000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:11 +0xec\ntesting.tRunner(0x210314000, 0x21ab10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
- }
- ]
-},
-<-<-<-CLOSE-JSON<-<-<
---- PASS: TestPassingStory (0.01 seconds)
-PASS
-ok github.com/smartystreets/goconvey/webserver/examples 0.019s
-`
-
-const inputGoConvey = `
-=== RUN TestPassingStory
->->->OPEN-JSON->->->
-{
- "Title": "A passing story",
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
- "Line": 11,
- "Depth": 0,
- "Assertions": [
- {
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
- "Line": 10,
- "Failure": "",
- "Error": null,
- "Skipped": false,
- "StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/webserver/examples.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:10 +0xe3\ngithub.com/smartystreets/goconvey/webserver/examples.TestPassingStory(0x210314000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:11 +0xec\ntesting.tRunner(0x210314000, 0x21ab10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
- }
- ]
-},
-<-<-<-CLOSE-JSON<-<-<
---- PASS: TestPassingStory (0.01 seconds)
-PASS
-coverage: 75.5%% of statements
-ok github.com/smartystreets/goconvey/webserver/examples 0.019s
-`
-
-var expectedGoConvey = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.019,
- Outcome: contract.Passed,
- Coverage: 75.5,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestPassingStory",
- Elapsed: 0.01,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{
- reporting.ScopeResult{
- Title: "A passing story",
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
- Line: 11,
- Depth: 0,
- Assertions: []*reporting.AssertionResult{
- &reporting.AssertionResult{
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
- Line: 10,
- Failure: "",
- Error: nil,
- Skipped: false,
- StackTrace: "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/webserver/examples.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:10 +0xe3\ngithub.com/smartystreets/goconvey/webserver/examples.TestPassingStory(0x210314000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:11 +0xec\ntesting.tRunner(0x210314000, 0x21ab10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n",
- },
- },
- },
- },
- },
- },
-}
-
-const inputGoConvey_WithRandomOutput = `
-=== RUN TestPassingStory
-*** Hello, World! (1) ***
-*** Hello, World! (2) ***
-*** Hello, World! (3) ***>->->OPEN-JSON->->->
-{
- "Title": "A passing story",
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- "Line": 16,
- "Depth": 0,
- "Assertions": [
- {
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- "Line": 14,
- "Failure": "",
- "Error": null,
- "Skipped": false,
- "StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:14 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:16 +0x1b9\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
- }
- ]
-},
-<-<-<-CLOSE-JSON<-<-<
-*** Hello, World! (4)***
-*** Hello, World! (5) ***
->->->OPEN-JSON->->->
-{
- "Title": "A passing story",
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- "Line": 22,
- "Depth": 0,
- "Assertions": [
- {
- "File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- "Line": 20,
- "Failure": "",
- "Error": null,
- "Skipped": false,
- "StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·002()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:20 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:22 +0x294\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
- }
- ]
-},
-<-<-<-CLOSE-JSON<-<-<
-*** Hello, World! (6) ***
---- PASS: TestPassingStory (0.03 seconds)
-PASS
-coverage: 45.0%% of statements
-ok github.com/smartystreets/goconvey/web/server/testing 0.024s
-`
-
-var expectedGoConvey_WithRandomOutput = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/web/server/testing",
- Elapsed: 0.024,
- Outcome: contract.Passed,
- Coverage: 45.0,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestPassingStory",
- Elapsed: 0.03,
- Passed: true,
- File: "",
- Line: 0,
- Message: "*** Hello, World! (1) ***\n*** Hello, World! (2) ***\n*** Hello, World! (3) ***\n*** Hello, World! (4)***\n*** Hello, World! (5) ***\n*** Hello, World! (6) ***",
- Stories: []reporting.ScopeResult{
- reporting.ScopeResult{
- Title: "A passing story",
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- Line: 16,
- Depth: 0,
- Assertions: []*reporting.AssertionResult{
- &reporting.AssertionResult{
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- Line: 14,
- Failure: "",
- Error: nil,
- Skipped: false,
- StackTrace: "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:14 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:16 +0x1b9\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n",
- },
- },
- },
- reporting.ScopeResult{
- Title: "A passing story",
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- Line: 22,
- Depth: 0,
- Assertions: []*reporting.AssertionResult{
- &reporting.AssertionResult{
- File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
- Line: 20,
- Failure: "",
- Error: nil,
- Skipped: false,
- StackTrace: "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·002()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:20 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:22 +0x294\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n",
- },
- },
- },
- },
- },
- },
-}
-
-const inputOldSchool_PassesButCoverageIsBogus = `
-=== RUN TestOldSchool_Passes
---- PASS: TestOldSchool_Passes (0.02 seconds)
-=== RUN TestOldSchool_PassesWithMessage
---- PASS: TestOldSchool_PassesWithMessage (0.05 seconds)
- old_school_test.go:10: I am a passing test.
- With a newline.
-PASS
-coverage: bogus%% of statements
-ok github.com/smartystreets/goconvey/webserver/examples 0.018s
-`
-
-var expectedOldSchool_PassesButCoverageIsBogus = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.018,
- Coverage: -1,
- Outcome: contract.Passed,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestOldSchool_Passes",
- Elapsed: 0.02,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestOldSchool_PassesWithMessage",
- Elapsed: 0.05,
- Passed: true,
- File: "old_school_test.go",
- Line: 10,
- Message: "old_school_test.go:10: I am a passing test.\nWith a newline.",
- Stories: []reporting.ScopeResult{},
- },
- },
-}
-
-const inputNestedTests = `
-=== RUN TestNestedTests
-=== RUN TestNestedTests_Passes
---- PASS: TestNestedTests_Passes (0.02 seconds)
-=== RUN TestNestedTests_Failure
---- FAIL: TestNestedTests_Failure (0.06 seconds)
-=== RUN TestNestedTests_FailureWithReason
---- FAIL: TestNestedTests_FailureWithReason (0.11 seconds)
- nested_test.go:18: I am a failing test.
-=== RUN TestNestedTests_Skipping
---- SKIP: TestNestedTests_Skipping (0.00 seconds)
- nested_test.go:8: blah
-=== RUN TestNestedTests_PassesWithMessage
---- PASS: TestNestedTests_PassesWithMessage (0.05 seconds)
- nested_test.go:10: I am a passing test.
- With a newline.
---- FAIL: TestNestedTests (0.25 seconds)
-FAIL
-exit status 1
-FAIL github.com/smartystreets/goconvey/webserver/examples 0.018s
-`
-
-var expectedNestedTests = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.018,
- Outcome: contract.Failed,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "TestNestedTests",
- Elapsed: 0.25,
- Passed: false,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestNestedTests_Failure",
- Elapsed: 0.06,
- Passed: false,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestNestedTests_FailureWithReason",
- Elapsed: 0.11,
- Passed: false,
- File: "nested_test.go",
- Line: 18,
- Message: "nested_test.go:18: I am a failing test.",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestNestedTests_Passes",
- Elapsed: 0.02,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestNestedTests_PassesWithMessage",
- Elapsed: 0.05,
- Passed: true,
- File: "nested_test.go",
- Line: 10,
- Message: "nested_test.go:10: I am a passing test.\nWith a newline.",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "TestNestedTests_Skipping",
- Elapsed: 0.00,
- Passed: true,
- Skipped: true,
- File: "nested_test.go",
- Line: 8,
- Message: "nested_test.go:8: blah",
- Stories: []reporting.ScopeResult{},
- },
- },
-}
-
-const inputExampleFunctions = `
-=== RUN Example_Failure
---- FAIL: Example_Failure (0.11 seconds)
-got:
-actuall output
-want:
-real output
-=== RUN Example_Pass
---- PASS: Example_Pass (0.06 seconds)
-FAIL
-exit status 1
-FAIL github.com/smartystreets/goconvey/webserver/examples 0.18s
-`
-
-var expectedExampleFunctions = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.18,
- Outcome: contract.Failed,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "Example_Failure",
- Elapsed: 0.11,
- Passed: false,
- File: "",
- Line: 0,
- Message: "got:\nactuall output\nwant:\nreal output",
- Stories: []reporting.ScopeResult{},
- },
- contract.TestResult{
- TestName: "Example_Pass",
- Elapsed: 0.06,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- },
-}
-
-const inputGolang15 = `
-=== RUN Golang15
---- PASS: Golang15 (0.00s)
-PASS
-ok github.com/smartystreets/goconvey/webserver/examples 0.008s
-`
-
-var expectedGolang15 = contract.PackageResult{
- PackageName: "github.com/smartystreets/goconvey/webserver/examples",
- Elapsed: 0.008,
- Outcome: contract.Passed,
- TestResults: []contract.TestResult{
- contract.TestResult{
- TestName: "Golang15",
- Elapsed: 0.00,
- Passed: true,
- File: "",
- Line: 0,
- Message: "",
- Stories: []reporting.ScopeResult{},
- },
- },
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/parser_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/parser_test.go
deleted file mode 100644
index de695e3fd7e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/parser/parser_test.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package parser
-
-import (
- "errors"
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
- "github.com/smartystreets/goconvey/web/server/contract"
-)
-
-func TestParser(t *testing.T) {
-
- Convey("Subject: Parser parses test output for active packages", t, func() {
- packages := []*contract.Package{
- &contract.Package{Ignored: false, Output: "Active", Result: contract.NewPackageResult("asdf")},
- &contract.Package{Ignored: true, Output: "Inactive", Result: contract.NewPackageResult("qwer")},
- }
- parser := NewParser(fakeParserImplementation)
-
- Convey("When given a collection of packages", func() {
- parser.Parse(packages)
-
- Convey("The parser uses its internal parsing mechanism to parse the output of only the active packages", func() {
- So(packages[0].Result.Outcome, ShouldEqual, packages[0].Output)
- })
-
- Convey("The parser should mark inactive packages as ignored", func() {
- So(packages[1].Result.Outcome, ShouldEqual, contract.Ignored)
- })
- })
-
- Convey("When a package could not be tested (maybe it was deleted between scanning and execution?)", func() {
- packages[0].Output = ""
- packages[0].Error = errors.New("Directory does not exist")
-
- parser.Parse(packages)
-
- Convey("The package result should not be parsed and the outcome should actually resemble the problem", func() {
- So(packages[0].Result.Outcome, ShouldEqual, contract.TestRunAbortedUnexpectedly)
- })
- })
- })
-}
-
-func fakeParserImplementation(result *contract.PackageResult, rawOutput string) {
- result.Outcome = rawOutput
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_integration_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_integration_test.go
deleted file mode 100644
index 88c696dbb81..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_integration_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package system
-
-import (
- "log"
- "path/filepath"
- "runtime"
- "strings"
-
- "testing"
-)
-
-func TestShellIntegration(t *testing.T) {
- if testing.Short() {
- t.Skip("Skipping potentially long-running integration test...")
- return
- }
-
- log.SetFlags(log.LstdFlags | log.Lshortfile | log.Lmicroseconds)
-
- _, filename, _, _ := runtime.Caller(0)
- directory := filepath.Join(filepath.Dir(filename), "..", "watch", "integration_testing", "sub")
- packageName := "github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub"
-
- shell := NewShell("go", "", true, "5s")
- output, err := shell.GoTest(directory, packageName, []string{}, []string{"-short"})
-
- if !strings.Contains(output, "PASS\n") || !strings.Contains(output, "ok") {
- t.Errorf("Expected output that resembed tests passing but got this instead: [%s]", output)
- }
- if err != nil {
- t.Error("Test run resulted in the following error:", err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_test.go
deleted file mode 100644
index b115c4f356a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/system/shell_test.go
+++ /dev/null
@@ -1,217 +0,0 @@
-package system
-
-import (
- "errors"
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestShellCommandComposition(t *testing.T) {
- var (
- buildFailed = Command{Error: errors.New("BUILD FAILURE!")}
- buildSucceeded = Command{Output: "ok"}
- goConvey = Command{Output: "[fmt github.com/smartystreets/goconvey/convey net/http net/http/httptest path runtime strconv strings testing time]"}
- noGoConvey = Command{Output: "[fmt net/http net/http/httptest path runtime strconv strings testing time]"}
- errorGoConvey = Command{Output: "This is a wacky error", Error: errors.New("This happens when running goconvey outside your $GOPATH (symlinked code).")}
- noCoveragePassed = Command{Output: "PASS\nok github.com/smartystreets/goconvey/examples 0.012s"}
- coveragePassed = Command{Output: "PASS\ncoverage: 100.0% of statements\nok github.com/smartystreets/goconvey/examples 0.012s"}
- coverageFailed = Command{
- Error: errors.New("Tests bombed!"),
- Output: "--- FAIL: TestIntegerManipulation (0.00 seconds)\nFAIL\ncoverage: 100.0% of statements\nexit status 1\nFAIL github.com/smartystreets/goconvey/examples 0.013s",
- }
- coverageFailedTimeout = Command{
- Error: errors.New("Tests bombed!"),
- Output: "=== RUN SomeTest\n--- PASS: SomeTest (0.00 seconds)\n=== RUN TimeoutTest\npanic: test timed out after 5s\n\ngoroutine 27 [running]:\n",
- }
- )
-
- const (
- yesCoverage = true
- noCoverage = false
- )
-
- Convey("When attempting to run tests with coverage flags", t, func() {
- Convey("And buildSucceeded failed", func() {
- result := runWithCoverage(buildFailed, goConvey, noCoverage, "", "", "", "", "-tags=", nil)
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, buildFailed)
- })
- })
-
- Convey("And coverage is not wanted", func() {
- result := runWithCoverage(buildSucceeded, goConvey, noCoverage, "", "", "", "", "-tags=", nil)
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, buildSucceeded)
- })
- })
-
- Convey("And the package being tested usees the GoConvey DSL (`convey` package)", func() {
- result := runWithCoverage(buildSucceeded, goConvey, yesCoverage, "reportsPath", "/directory", "go", "5s", "-tags=bob", []string{"-arg1", "-arg2"})
-
- Convey("The returned command should be well formed (and include the -json flag)", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-coverprofile=reportsPath", "-tags=bob", "-covermode=set", "-timeout=5s", "-json", "-arg1", "-arg2"},
- })
- })
- })
-
- Convey("And the package being tested does NOT use the GoConvey DSL", func() {
- result := runWithCoverage(buildSucceeded, noGoConvey, yesCoverage, "reportsPath", "/directory", "go", "1s", "-tags=bob", []string{"-arg1", "-arg2"})
-
- Convey("The returned command should be well formed (and NOT include the -json flag)", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-coverprofile=reportsPath", "-tags=bob", "-covermode=set", "-timeout=1s", "-arg1", "-arg2"},
- })
- })
- })
-
- Convey("And the package being tested has been symlinked outside the $GOAPTH", func() {
- result := runWithCoverage(buildSucceeded, errorGoConvey, yesCoverage, "reportsPath", "/directory", "go", "1s", "-tags=", nil)
-
- Convey("The returned command should be the compilation command", func() {
- So(result, ShouldResemble, buildSucceeded)
- })
- })
-
- Convey("And the package being tested specifies an alternate covermode", func() {
- result := runWithCoverage(buildSucceeded, noGoConvey, yesCoverage, "reportsPath", "/directory", "go", "1s", "-tags=", []string{"-covermode=atomic"})
-
- Convey("The returned command should allow the alternate value", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-coverprofile=reportsPath", "-tags=", "-timeout=1s", "-covermode=atomic"},
- })
- })
- })
-
- Convey("And the package being tested specifies an alternate timeout", func() {
- result := runWithCoverage(buildSucceeded, noGoConvey, yesCoverage, "reportsPath", "/directory", "go", "1s", "-tags=", []string{"-timeout=5s"})
-
- Convey("The returned command should allow the alternate value", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-coverprofile=reportsPath", "-tags=", "-covermode=set", "-timeout=5s"},
- })
- })
- })
-
- })
-
- Convey("When attempting to run tests without the coverage flags", t, func() {
- Convey("And tests already succeeded with coverage", func() {
- result := runWithoutCoverage(buildSucceeded, coveragePassed, goConvey, "/directory", "go", "1s", "-tags=", []string{"-arg1", "-arg2"})
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, coveragePassed)
- })
- })
-
- Convey("And tests already failed (legitimately) with coverage", func() {
- result := runWithoutCoverage(buildSucceeded, coverageFailed, goConvey, "/directory", "go", "1s", "-tags=", []string{"-arg1", "-arg2"})
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, coverageFailed)
- })
- })
-
- Convey("And tests already failed (timeout) with coverage", func() {
- result := runWithoutCoverage(buildSucceeded, coverageFailedTimeout, goConvey, "/directory", "go", "1s", "-tags=", []string{"-arg1", "-arg2"})
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, coverageFailedTimeout)
- })
- })
-
- Convey("And the build failed earlier", func() {
- result := runWithoutCoverage(buildFailed, Command{}, goConvey, "/directory", "go", "1s", "-tags=", []string{"-arg1", "-arg2"})
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, buildFailed)
- })
- })
-
- Convey("And the goconvey dsl command failed (probably because of symlinks)", func() {
- result := runWithoutCoverage(buildSucceeded, Command{}, errorGoConvey, "", "", "", "-tags=", nil)
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, errorGoConvey)
- })
- })
-
- Convey("And the package being tested uses the GoConvey DSL (`convey` package)", func() {
- result := runWithoutCoverage(buildSucceeded, buildSucceeded, goConvey, "/directory", "go", "1s", "-tags=", []string{"-arg1", "-arg2"})
-
- Convey("Then the returned command should be well formed (and include the -json flag)", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-tags=", "-timeout=1s", "-json", "-arg1", "-arg2"},
- })
- })
- })
-
- Convey("And the package being tested does NOT use the GoConvey DSL", func() {
- result := runWithoutCoverage(buildSucceeded, noCoveragePassed, noGoConvey, "/directory", "go", "1s", "-tags=", []string{"-arg1", "-arg2"})
-
- Convey("Then the returned command should be well formed (and NOT include the -json flag)", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-tags=", "-timeout=1s", "-arg1", "-arg2"},
- })
- })
- })
-
- Convey("And the package being tested specifies an alternate timeout", func() {
- result := runWithoutCoverage(buildSucceeded, buildSucceeded, noGoConvey, "/directory", "go", "1s", "-tags=", []string{"-timeout=5s"})
-
- Convey("The returned command should allow the alternate value", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"test", "-v", "-tags=", "-timeout=5s"},
- })
- })
- })
-
- })
-
- Convey("When generating coverage reports", t, func() {
- Convey("And the previous command failed for any reason (compilation or failed tests)", func() {
- result := generateReports(buildFailed, yesCoverage, "/directory", "go", "reportData", "reportHTML")
-
- Convey("Then no action should be taken", func() {
- So(result, ShouldResemble, buildFailed)
- })
- })
-
- Convey("And coverage reports are unwanted", func() {
- result := generateReports(noCoveragePassed, noCoverage, "/directory", "go", "reportData", "reportHTML")
-
- Convey("Then no action should beg taken", func() {
- So(result, ShouldResemble, noCoveragePassed)
- })
- })
-
- Convey("And tests passed and coverage reports are wanted", func() {
- result := generateReports(coveragePassed, yesCoverage, "/directory", "go", "reportData", "reportHTML")
-
- Convey("Then the resulting command should be well-formed", func() {
- So(result, ShouldResemble, Command{
- directory: "/directory",
- executable: "go",
- arguments: []string{"tool", "cover", "-html=reportData", "-o", "reportHTML"},
- })
- })
- })
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core_test.go
deleted file mode 100644
index d0f74867acc..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/functional_core_test.go
+++ /dev/null
@@ -1,419 +0,0 @@
-package watch
-
-import (
- "fmt"
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-func TestCategorize(t *testing.T) {
- fileSystem := []*FileSystemItem{
- {
- Root: "/.hello",
- Path: "/.hello",
- Name: "hello",
- IsFolder: true,
- },
- {
- Root: "/.hello",
- Path: "/.hello/1/hello/world.txt",
- Name: "world.txt",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/1/2/3/4/5/hello/world.go",
- Name: "world.go",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/world.go",
- Name: "world.go",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/hello/world.tmpl",
- Name: "world.tmpl",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/hello/.world.go",
- Name: ".world.go",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/hello/_world.go",
- Name: ".world.go",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/hello/flymake_world.go",
- Name: "flymake_world.go",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/.hello",
- Name: ".hello",
- IsFolder: true,
- },
- {
- Root: "/.hello",
- Path: "/.hello/.hello/hello",
- Name: "hello",
- IsFolder: true,
- },
- {
- Root: "/.hello",
- Path: "/.hello/.hello/world.go",
- Name: "world.go",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/hello/hi.goconvey",
- Name: "hi.goconvey",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/hello2/.goconvey",
- Name: ".goconvey",
- IsFolder: false,
- },
- {
- Root: "/.hello",
- Path: "/.hello/_hello",
- Name: "_hello",
- IsFolder: true,
- },
- }
-
- Convey("A stream of file system items should be categorized correctly", t, func() {
- items := make(chan *FileSystemItem)
-
- go func() {
- for _, item := range fileSystem {
- items <- item
- }
- close(items)
- }()
-
- folders, profiles, goFiles := Categorize(items, "/.hello", []string{".go"})
- So(folders, ShouldResemble, fileSystem[:1])
- So(profiles, ShouldResemble, fileSystem[11:12])
- So(goFiles, ShouldResemble, fileSystem[2:4])
- })
-
- Convey("A stream of file system items should be categorized correctly", t, func() {
- items := make(chan *FileSystemItem)
-
- go func() {
- for _, item := range fileSystem {
- items <- item
- }
- close(items)
- }()
-
- folders, profiles, goFiles := Categorize(items, "/.hello", []string{".go", ".tmpl"})
- So(folders, ShouldResemble, fileSystem[:1])
- So(profiles, ShouldResemble, fileSystem[11:12])
- So(goFiles, ShouldResemble, fileSystem[2:5])
- })
-}
-
-func TestParseProfile(t *testing.T) {
- var parseProfileTestCases = []struct {
- SKIP bool
- description string
- input string
- resultIgnored bool
- resultTestTags []string
- resultTestArgs []string
- }{
- {
- SKIP: false,
- description: "Blank profile",
- input: "",
- resultIgnored: false,
- },
- {
- SKIP: false,
- description: "All lines are blank or whitespace",
- input: "\n \n \t\t\t \n \n \n",
- resultIgnored: false,
- },
- {
- SKIP: false,
- description: "Ignored package, no args included",
- input: "IGNORE\n-timeout=4s",
- resultIgnored: true,
- },
- {
- SKIP: false,
- description: "Ignore directive is commented, all args are included",
- input: "#IGNORE\n-timeout=4s\n-parallel=5",
- resultIgnored: false,
- resultTestArgs: []string{"-timeout=4s", "-parallel=5"},
- },
- {
- SKIP: false,
- description: "No ignore directive, all args are included",
- input: "-run=TestBlah\n-timeout=42s",
- resultIgnored: false,
- resultTestArgs: []string{"-run=TestBlah", "-timeout=42s"},
- },
- {
- SKIP: false,
- description: "Some args are commented, therefore ignored",
- input: "-run=TestBlah\n #-timeout=42s",
- resultIgnored: false,
- resultTestArgs: []string{"-run=TestBlah"},
- },
- {
- SKIP: false,
- description: "All args are commented, therefore all are ignored",
- input: "#-run=TestBlah\n//-timeout=42",
- resultIgnored: false,
- },
- {
- SKIP: false,
- description: "We ignore certain flags like -v and -cover and -coverprofile because they are specified by the shell",
- input: "-v\n-cover\n-coverprofile=blah.out",
- resultIgnored: false,
- },
- {
- SKIP: false,
- description: "We allow certain coverage flags like -coverpkg and -covermode",
- input: "-coverpkg=blah\n-covermode=atomic",
- resultIgnored: false,
- resultTestArgs: []string{"-coverpkg=blah", "-covermode=atomic"},
- },
- {
- SKIP: false,
- description: "We parse out -tags particularly",
- input: "-coverpkg=blah\n-covermode=atomic\n-tags=foo,bar",
- resultIgnored: false,
- resultTestTags: []string{"foo", "bar"},
- resultTestArgs: []string{"-coverpkg=blah", "-covermode=atomic"},
- },
- }
-
- for i, test := range parseProfileTestCases {
- if test.SKIP {
- SkipConvey(fmt.Sprintf("Profile Parsing, Test Case #%d: %s (SKIPPED)", i, test.description), t, nil)
- } else {
- Convey(fmt.Sprintf("Profile Parsing, Test Case #%d: %s", i, test.description), t, func() {
- ignored, testTags, testArgs := ParseProfile(test.input)
-
- So(ignored, ShouldEqual, test.resultIgnored)
- So(testTags, ShouldResemble, test.resultTestTags)
- So(testArgs, ShouldResemble, test.resultTestArgs)
- })
- }
- }
-}
-
-func TestCreateFolders(t *testing.T) {
- Convey("File system items that represent folders should be converted to folder structs correctly", t, func() {
- expected := map[string]*messaging.Folder{
- "/root/1": {Path: "/root/1", Root: "/root"},
- "/root/1/2": {Path: "/root/1/2", Root: "/root"},
- "/root/1/2/3": {Path: "/root/1/2/3", Root: "/root"},
- }
-
- inputs := []*FileSystemItem{
- {Path: "/root/1", Root: "/root", IsFolder: true},
- {Path: "/root/1/2", Root: "/root", IsFolder: true},
- {Path: "/root/1/2/3", Root: "/root", IsFolder: true},
- }
-
- actual := CreateFolders(inputs)
-
- for key, actualValue := range actual {
- So(actualValue, ShouldResemble, expected[key])
- }
- })
-}
-
-func TestLimitDepth(t *testing.T) {
- Convey("Subject: Limiting folders based on relative depth from a common root", t, func() {
-
- folders := map[string]*messaging.Folder{
- "/root/1": {
- Path: "/root/1",
- Root: "/root",
- },
- "/root/1/2": {
- Path: "/root/1/2",
- Root: "/root",
- },
- "/root/1/2/3": {
- Path: "/root/1/2/3",
- Root: "/root",
- },
- }
-
- Convey("When there is no depth limit", func() {
- LimitDepth(folders, -1)
-
- Convey("No folders should be excluded", func() {
- So(len(folders), ShouldEqual, 3)
- })
- })
-
- Convey("When there is a limit", func() {
- LimitDepth(folders, 2)
-
- Convey("The deepest folder (in this case) should be excluded", func() {
- So(len(folders), ShouldEqual, 2)
- _, exists := folders["/root/1/2/3"]
- So(exists, ShouldBeFalse)
- })
- })
- })
-}
-
-func TestAttachProfiles(t *testing.T) {
- Convey("Subject: Attaching profile information to a folder", t, func() {
- folders := map[string]*messaging.Folder{
- "/root/1": {
- Path: "/root/1",
- Root: "/root",
- },
- "/root/1/2": {
- Path: "/root/1/2",
- Root: "/root",
- },
- "/root/1/2/3": {
- Path: "/root/1/2/3",
- Root: "/root",
- },
- }
-
- profiles := []*FileSystemItem{
- {
- Path: "/root/too-shallow.goconvey",
- ProfileDisabled: true,
- ProfileArguments: []string{"1", "2"},
- },
- {
- Path: "/root/1/2/hi.goconvey",
- ProfileDisabled: true,
- ProfileArguments: []string{"1", "2"},
- },
- {
- Path: "/root/1/2/3/4/does-not-exist",
- ProfileDisabled: true,
- ProfileArguments: []string{"1", "2", "3", "4"},
- },
- }
-
- Convey("Profiles that match folders should be merged with those folders", func() {
- AttachProfiles(folders, profiles)
-
- Convey("No profiles matched the first folder, so no assignments should occur", func() {
- So(folders["/root/1"].Disabled, ShouldBeFalse)
- So(folders["/root/1"].TestArguments, ShouldBeEmpty)
- })
-
- Convey("The second folder should match the first profile", func() {
- So(folders["/root/1/2"].Disabled, ShouldBeTrue)
- So(folders["/root/1/2"].TestArguments, ShouldResemble, []string{"1", "2"})
- })
-
- Convey("No profiles match the third folder so no assignments should occur", func() {
- So(folders["/root/1/2/3"].Disabled, ShouldBeFalse)
- So(folders["/root/1/2/3"].TestArguments, ShouldBeEmpty)
- })
- })
- })
-}
-
-func TestMarkIgnored(t *testing.T) {
- Convey("Subject: folders that have been ignored should be marked as such", t, func() {
- folders := map[string]*messaging.Folder{
- "/root/1": {
- Path: "/root/1",
- Root: "/root",
- },
- "/root/1/2": {
- Path: "/root/1/2",
- Root: "/root",
- },
- "/root/1/2/3": {
- Path: "/root/1/2/3",
- Root: "/root",
- },
- }
-
- Convey("When there are no ignored folders", func() {
- ignored := map[string]struct{}{}
- MarkIgnored(folders, ignored)
-
- Convey("No folders should be marked as ignored", func() {
- So(folders["/root/1"].Ignored, ShouldBeFalse)
- So(folders["/root/1/2"].Ignored, ShouldBeFalse)
- So(folders["/root/1/2/3"].Ignored, ShouldBeFalse)
- })
- })
- Convey("When there are ignored folders", func() {
- ignored := map[string]struct{}{"1/2": {}}
- MarkIgnored(folders, ignored)
-
- Convey("The ignored folders should be marked as ignored", func() {
- So(folders["/root/1"].Ignored, ShouldBeFalse)
- So(folders["/root/1/2"].Ignored, ShouldBeTrue)
- So(folders["/root/1/2/3"].Ignored, ShouldBeFalse)
- })
- })
- })
-}
-
-func TestActiveFolders(t *testing.T) {
- Convey("Subject: Folders that are not ignored or disabled are active", t, func() {
- folders := map[string]*messaging.Folder{
- "/root/1": {
- Path: "/root/1",
- Root: "/root",
- Ignored: true,
- },
- "/root/1/2": {
- Path: "/root/1/2",
- Root: "/root",
- },
- "/root/1/2/3": {
- Path: "/root/1/2/3",
- Root: "/root",
- Disabled: true,
- },
- }
-
- active := ActiveFolders(folders)
-
- So(len(active), ShouldEqual, 1)
- So(active["/root/1/2"], ShouldResemble, folders["/root/1/2"])
- })
-}
-
-func TestSum(t *testing.T) {
- Convey("Subject: file system items within specified directores should be counted and summed", t, func() {
- folders := map[string]*messaging.Folder{
- "/root/1": {Path: "/root/1", Root: "/root", Ignored: true},
- }
- items := []*FileSystemItem{
- {Size: 1, Modified: 3, Path: "/root/1/hi.go"},
- {Size: 7, Modified: 13, Path: "/root/1/bye.go"},
- {Size: 33, Modified: 45, Path: "/root/1/2/salutations.go"}, // not counted
- }
-
- So(Sum(folders, items), ShouldEqual, 1+3+7+13)
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_test.go
deleted file mode 100644
index e26ad48c47a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-package watch
-
-import (
- "bytes"
- "io/ioutil"
- "log"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "github.com/smartystreets/goconvey/web/server/messaging"
-)
-
-func TestWatcher(t *testing.T) {
- if testing.Short() {
- t.Skip("Skipping potentially long-running integration test...")
- return
- }
-
- log.SetFlags(log.LstdFlags | log.Lshortfile | log.Lmicroseconds)
- output := new(bytes.Buffer)
- log.SetOutput(output)
- defer func() { t.Log(output.String()) }()
-
- _, filename, _, _ := runtime.Caller(0)
- originalRoot := filepath.Join(filepath.Dir(filename), "integration_testing")
- temporary, err := ioutil.TempDir("/tmp", "goconvey")
- if err != nil {
- t.Fatal(err)
- }
- root := filepath.Join(temporary, "integration_testing")
- sub := filepath.Join(root, "sub")
-
- err = CopyDir(originalRoot, root)
- if err != nil {
- t.Fatal(err)
- }
- defer func() {
- err = os.RemoveAll(temporary)
- if err != nil {
- t.Fatal(err)
- }
- }()
-
- var ( // commands
- pause = messaging.WatcherCommand{Instruction: messaging.WatcherPause}
- resume = messaging.WatcherCommand{Instruction: messaging.WatcherResume}
-
- ignore = messaging.WatcherCommand{Instruction: messaging.WatcherIgnore, Details: sub}
- reinstate = messaging.WatcherCommand{Instruction: messaging.WatcherReinstate, Details: sub}
-
- adjustToSub = messaging.WatcherCommand{Instruction: messaging.WatcherAdjustRoot, Details: sub}
- adjustToRoot = messaging.WatcherCommand{Instruction: messaging.WatcherAdjustRoot, Details: root}
-
- execute = messaging.WatcherCommand{Instruction: messaging.WatcherExecute}
-
- bogus = messaging.WatcherCommand{Instruction: 42}
-
- stop = messaging.WatcherCommand{Instruction: messaging.WatcherStop}
- )
-
- Convey("Subject: Watcher operations", t, func() {
- input := make(chan messaging.WatcherCommand)
- output := make(chan messaging.Folders)
- excludedDirs := []string{}
- watcher := NewWatcher(root, -1, time.Millisecond, input, output, ".go", excludedDirs)
-
- go watcher.Listen()
-
- Convey("Initial scan results", func() {
- go func() { input <- stop }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 1)
- })
-
- Convey("Manual execution produces additional results", func() {
- go func() {
- input <- execute
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 2)
- So(len(results[0]), ShouldEqual, 2)
- So(len(results[1]), ShouldEqual, 2)
- })
-
- Convey("Ignore and Reinstate commands are not reflected in the scan results", func() {
- go func() {
- input <- ignore
- input <- reinstate
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 1)
- So(results[0][sub].Ignored, ShouldBeFalse) // initial
- })
-
- Convey("Adjusting the root changes the number of folders in the scanned results", func() {
- go func() {
- input <- adjustToSub
- input <- adjustToRoot
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 3)
- So(len(results[0]), ShouldEqual, 2) // initial
- So(len(results[1]), ShouldEqual, 1) // root moved to sub
- So(len(results[2]), ShouldEqual, 2) // root moved back to original location
- })
-
- Convey("A bogus command does not cause any additional scanning beyond the initial scan", func() {
- go func() {
- input <- bogus
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 1) // initial scan
- })
-
- Convey("Scanning occurs as a result of a file system update", func() {
- go func() {
- time.Sleep(time.Second)
- exec.Command("touch", filepath.Join(root, "main.go")).Run()
- time.Sleep(time.Second)
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 2)
- })
-
- Convey("Scanning does not occur as a result of resuming after a pause", func() {
- go func() {
- input <- pause
- input <- resume
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 1)
- })
-
- Convey("Scanning should not occur when the watcher is paused", func() {
- go func() {
- input <- pause
- for x := 0; x < 2; x++ {
- time.Sleep(time.Millisecond * 250)
- exec.Command("touch", filepath.Join(root, "main.go")).Run()
- time.Sleep(time.Millisecond * 250)
- }
- input <- resume
- input <- stop
- }()
-
- results := []messaging.Folders{}
- for result := range output {
- results = append(results, result)
- }
-
- So(len(results), ShouldEqual, 2)
- })
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/doc_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/doc_test.go
deleted file mode 100644
index 06ab7d0f9a3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/doc_test.go
+++ /dev/null
@@ -1 +0,0 @@
-package main
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/stuff_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/stuff_test.go
deleted file mode 100644
index ea9eebd2d50..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/integration_testing/sub/stuff_test.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// This file's only purpose is to provide a realistic
-// environment from which to run integration tests
-// against the Watcher.
-package sub
-
-import (
- "fmt"
- "testing"
-)
-
-func TestStuff(t *testing.T) {
- if testing.Short() {
- return
- }
-
- fmt.Println()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/util_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/util_test.go
deleted file mode 100644
index b5ac11fa02a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/smartystreets/goconvey/web/server/watch/util_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Credits: https://gist.github.com/jaybill/2876519
-package watch
-
-import "os"
-import "io"
-import "io/ioutil"
-import "log"
-
-// Copies original source to destination destination.
-func CopyFile(source string, destination string) (err error) {
- originalFile, err := os.Open(source)
- if err != nil {
- return err
- }
- defer originalFile.Close()
- destinationFile, err := os.Create(destination)
- if err != nil {
- return err
- }
- defer destinationFile.Close()
- _, err = io.Copy(destinationFile, originalFile)
- if err == nil {
- info, err := os.Stat(source)
- if err != nil {
- err = os.Chmod(destination, info.Mode())
- }
-
- }
-
- return
-}
-
-// Recursively copies a directory tree, attempting to preserve permissions.
-// Source directory must exist, destination directory must *not* exist.
-func CopyDir(source string, destination string) (err error) {
-
- // get properties of source dir
- sourceFile, err := os.Stat(source)
- if err != nil {
- return err
- }
-
- if !sourceFile.IsDir() {
- return &CustomError{Message: "Source is not a directory"}
- }
-
- // ensure destination dir does not already exist
-
- _, err = os.Open(destination)
- if !os.IsNotExist(err) {
- return &CustomError{Message: "Destination already exists"}
- }
-
- // create destination dir
-
- err = os.MkdirAll(destination, sourceFile.Mode())
- if err != nil {
- return err
- }
-
- entries, err := ioutil.ReadDir(source)
-
- for _, entry := range entries {
-
- sourcePath := source + "/" + entry.Name()
- destinationPath := destination + "/" + entry.Name()
- if entry.IsDir() {
- err = CopyDir(sourcePath, destinationPath)
- if err != nil {
- log.Println(err)
- }
- } else {
- // perform copy
- err = CopyFile(sourcePath, destinationPath)
- if err != nil {
- log.Println(err)
- }
- }
-
- }
- return
-}
-
-// A struct for returning custom error messages
-type CustomError struct {
- Message string
-}
-
-// Returns the error message defined in Message as a string
-func (this *CustomError) Error() string {
- return this.Message
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/examples_test.go
deleted file mode 100644
index 7de1ed142d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/examples_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package stringprep_test
-
-import (
- "fmt"
-
- "github.com/xdg/stringprep"
-)
-
-func Example_customProfile() {
- customProfile := stringprep.Profile{
- Mappings: []stringprep.Mapping{
- stringprep.TableB1,
- stringprep.TableB2,
- },
- Normalize: true,
- Prohibits: []stringprep.Set{
- stringprep.TableC1_1,
- stringprep.TableC1_2,
- },
- CheckBiDi: true,
- }
-
- prepped, err := customProfile.Prepare("TrustNô1")
- if err != nil {
- panic("stringprep failed")
- }
-
- fmt.Print(prepped)
- // Output: trustnô1
-}
-
-func Example_sASLprep() {
- prepped, err := stringprep.SASLprep.Prepare("TrustNô1")
- if err != nil {
- panic("SASLprep failed")
- }
- fmt.Print(prepped)
- // Output: TrustNô1
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/map_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/map_test.go
deleted file mode 100644
index 6969c998fcb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/map_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package stringprep
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestMapping(t *testing.T) {
- mappingTests := []struct {
- label string
- table Mapping
- in rune
- exists bool
- out []rune
- }{
- // Table B1
- {label: "B1", table: TableB1, in: 0x00AD, exists: true, out: []rune{}},
- {label: "B1", table: TableB1, in: 0x0040, exists: false, out: nil},
- // Table B2
- {label: "B2", table: TableB2, in: 0x0043, exists: true, out: []rune{0x0063}},
- {label: "B2", table: TableB2, in: 0x00DF, exists: true, out: []rune{0x0073, 0x0073}},
- {label: "B2", table: TableB2, in: 0x1F56, exists: true, out: []rune{0x03C5, 0x0313, 0x0342}},
- {label: "B2", table: TableB2, in: 0x0040, exists: false, out: nil},
- // Table B3
- {label: "B3", table: TableB3, in: 0x1FF7, exists: true, out: []rune{0x03C9, 0x0342, 0x03B9}},
- {label: "B3", table: TableB3, in: 0x0040, exists: false, out: nil},
- }
-
- for _, c := range mappingTests {
- t.Run(fmt.Sprintf("%s 0x%04x", c.label, c.in), func(t *testing.T) {
- got, ok := c.table.Map(c.in)
- switch c.exists {
- case true:
- if !ok {
- t.Errorf("input '0x%04x' was not found, but should have been", c.in)
- }
- if !reflect.DeepEqual(got, c.out) {
- t.Errorf("input '0x%04x' was %v, expected %v", c.in, got, c.out)
- }
- case false:
- if ok {
- t.Errorf("input '0x%04x' was found, but should not have been", c.in)
- }
- if got != nil {
- t.Errorf("input '0x%04x' was %v, expected %v", c.in, got, c.out)
- }
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/profile_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/profile_test.go
deleted file mode 100644
index a9ee8130739..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/profile_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package stringprep
-
-import (
- "reflect"
- "strconv"
- "testing"
-)
-
-func TestProfiles(t *testing.T) {
- p1 := Profile{
- Mappings: []Mapping{TableB1, TableB2},
- Normalize: true,
- Prohibits: []Set{TableC1_1, TableC1_2, TableC6},
- CheckBiDi: true,
- }
-
- p2 := Profile{
- Mappings: []Mapping{},
- Normalize: false,
- Prohibits: []Set{},
- CheckBiDi: false,
- }
-
- profileTests := []struct {
- label string
- profile Profile
- in string
- out string
- err error
- }{
- {label: "p1: empty", profile: p1, in: "", out: "", err: nil},
- {label: "p1: ascii", profile: p1, in: "user", out: "user", err: nil},
- {label: "p1: zws", profile: p1, in: "u\u200Ber", out: "uer", err: nil},
- {label: "p1: sharp", profile: p1, in: "u\u00DFer", out: "usser", err: nil},
- {label: "p1: nfkc", profile: p1, in: "ua\u030Aer", out: "u\u00e5er", err: nil},
- {
- label: "p1: replacement",
- profile: p1,
- in: "u\uFFFDer",
- out: "",
- err: Error{Msg: errProhibited, Rune: '\uFFFD'},
- },
- {
- label: "p1: bidi ok",
- profile: p1,
- in: "\u0627\u0031\u0628",
- out: "\u0627\u0031\u0628",
- err: nil,
- },
- {
- label: "p1: bidi not ok RandAL with L",
- profile: p1,
- in: "\u0627\u0589\u0628",
- out: "",
- err: Error{Msg: errHasLCat, Rune: '\u0589'},
- },
- {
- label: "p1: bidi bad first rune",
- profile: p1,
- in: "\u0031\u0627",
- out: "",
- err: Error{Msg: errFirstRune, Rune: '\u0031'},
- },
- {
- label: "p1: bidi bad last rune",
- profile: p1,
- in: "\u0627\u0031",
- out: "",
- err: Error{Msg: errLastRune, Rune: '\u0031'},
- },
- {
- label: "p1: bidi bad chars",
- profile: p1,
- in: "\u206D",
- out: "",
- err: Error{Msg: errProhibited, Rune: '\u206D'},
- },
- {
- label: "p2: bidi not checked",
- profile: p2,
- in: "\u0627\u0031",
- out: "\u0627\u0031",
- err: nil,
- },
- {label: "p2: no nfkc", profile: p2, in: "ua\u030Aer", out: "ua\u030Aer", err: nil},
- }
-
- for _, c := range profileTests {
- t.Run(c.label, func(t *testing.T) {
- got, err := c.profile.Prepare(c.in)
- if c.err == nil {
- if got != c.out {
- t.Errorf("input '%s': got '%s', expected '%s'",
- strconv.QuoteToASCII(c.in),
- strconv.QuoteToASCII(got),
- strconv.QuoteToASCII(c.out))
- }
- } else {
- if !reflect.DeepEqual(err, c.err) {
- t.Errorf("input '%s': got error '%v', expected '%v'",
- strconv.QuoteToASCII(c.in), err, c.err)
- }
- }
-
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/saslprep_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/saslprep_test.go
deleted file mode 100644
index 92db00189da..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/saslprep_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package stringprep
-
-import (
- "reflect"
- "strconv"
- "testing"
-)
-
-func TestSASLprep(t *testing.T) {
- saslTests := []struct {
- label string
- in string
- out string
- err error
- }{
- {label: "soft hyphen", in: "I\u00ADX", out: "IX", err: nil},
- {label: "non ASCII space", in: "I\u2000X", out: "I X", err: nil},
- {label: "no transform", in: "user", out: "user", err: nil},
- {label: "case preserve", in: "USER", out: "USER", err: nil},
- {label: "8859-1 to NFKC", in: "\u00AA", out: "a", err: nil},
- {label: "NFKC", in: "\u2168", out: "IX", err: nil},
- {
- label: "prohibited",
- in: "\u0007",
- out: "",
- err: Error{Msg: errProhibited, Rune: '\u0007'},
- },
- {
- label: "bidi not ok",
- in: "\u0627\u0031",
- out: "",
- err: Error{Msg: errLastRune, Rune: '\u0031'},
- },
- }
-
- for _, c := range saslTests {
- t.Run(c.label, func(t *testing.T) {
- got, err := SASLprep.Prepare(c.in)
- t.Logf("err is '%v'", err)
- if c.err == nil {
- if got != c.out {
- t.Errorf("input '%s': got '%s', expected '%s'",
- strconv.QuoteToASCII(c.in),
- strconv.QuoteToASCII(got),
- strconv.QuoteToASCII(c.out))
- }
- } else {
- if !reflect.DeepEqual(err, c.err) {
- t.Errorf("input '%s': got error '%v', expected '%v'",
- strconv.QuoteToASCII(c.in), err, c.err)
- }
- }
-
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/set_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/set_test.go
deleted file mode 100644
index 139bdc30611..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/github.com/xdg/stringprep/set_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package stringprep
-
-import (
- "fmt"
- "testing"
-)
-
-func TestRanges(t *testing.T) {
- rangeTests := []struct {
- label string
- table Set
- in rune
- out bool
- }{
- // Table A.1
- {label: "A1", table: TableA1, in: 0x0221, out: true},
- {label: "A1", table: TableA1, in: 0x0955, out: true},
- {label: "A1", table: TableA1, in: 0x0956, out: true},
- {label: "A1", table: TableA1, in: 0x0957, out: true},
- {label: "A1", table: TableA1, in: 0x0020, out: false},
- // Table C.1.1
- {label: "C1.1", table: TableC1_1, in: 0x0020, out: true},
- {label: "C1.1", table: TableC1_1, in: 0x0040, out: false},
- // Table C.1.2
- {label: "C1.2", table: TableC1_2, in: 0x200A, out: true},
- {label: "C1.2", table: TableC1_2, in: 0x0040, out: false},
- // Table C.2.1
- {label: "C2.1", table: TableC2_1, in: 0x0000, out: true},
- {label: "C2.1", table: TableC2_1, in: 0x0010, out: true},
- {label: "C2.1", table: TableC2_1, in: 0x001F, out: true},
- {label: "C2.1", table: TableC2_1, in: 0x007F, out: true},
- {label: "C2.1", table: TableC2_1, in: 0x0040, out: false},
- // Table C.2.2
- {label: "C2.2", table: TableC2_2, in: 0x0080, out: true},
- {label: "C2.2", table: TableC2_2, in: 0x0090, out: true},
- {label: "C2.2", table: TableC2_2, in: 0x009F, out: true},
- {label: "C2.2", table: TableC2_2, in: 0x2028, out: true},
- {label: "C2.2", table: TableC2_2, in: 0xFEFF, out: true},
- {label: "C2.2", table: TableC2_2, in: 0x1D173, out: true},
- {label: "C2.2", table: TableC2_2, in: 0x1D17A, out: true},
- {label: "C2.2", table: TableC2_2, in: 0x0040, out: false},
- // Table C.3
- {label: "C3", table: TableC3, in: 0xE000, out: true},
- {label: "C3", table: TableC3, in: 0xF000, out: true},
- {label: "C3", table: TableC3, in: 0xF8FF, out: true},
- {label: "C3", table: TableC3, in: 0xF0000, out: true},
- {label: "C3", table: TableC3, in: 0xF1000, out: true},
- {label: "C3", table: TableC3, in: 0xFFFFD, out: true},
- {label: "C3", table: TableC3, in: 0x100000, out: true},
- {label: "C3", table: TableC3, in: 0x10ABCD, out: true},
- {label: "C3", table: TableC3, in: 0x10FFFD, out: true},
- {label: "C3", table: TableC3, in: 0x0040, out: false},
- // Table C.4
- {label: "C4", table: TableC4, in: 0xFDD0, out: true},
- {label: "C4", table: TableC4, in: 0xFFFF, out: true},
- {label: "C4", table: TableC4, in: 0x0040, out: false},
- // Table C.5
- {label: "C5", table: TableC5, in: 0xD801, out: true},
- {label: "C5", table: TableC5, in: 0x0040, out: false},
- // Table C.6
- {label: "C6", table: TableC6, in: 0xFFFA, out: true},
- {label: "C6", table: TableC6, in: 0x0040, out: false},
- // Table C.7
- {label: "C7", table: TableC7, in: 0x2FFB, out: true},
- {label: "C7", table: TableC7, in: 0x0040, out: false},
- // Table C.8
- {label: "C8", table: TableC8, in: 0x0341, out: true},
- {label: "C8", table: TableC8, in: 0x0040, out: false},
- // Table C.9
- {label: "C9", table: TableC9, in: 0xE0001, out: true},
- {label: "C9", table: TableC9, in: 0xE007E, out: true},
- {label: "C9", table: TableC9, in: 0x0040, out: false},
- // Table D.1
- {label: "D1", table: TableD1, in: 0x200F, out: true},
- {label: "D1", table: TableD1, in: 0x0040, out: false},
- }
-
- for _, c := range rangeTests {
- t.Run(fmt.Sprintf("%s 0x%04x", c.label, c.in), func(t *testing.T) {
- if got := c.table.Contains(c.in); got != c.out {
- t.Errorf("input '0x%04x' was %v, expected %v", c.in, got, c.out)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bcrypt/bcrypt_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bcrypt/bcrypt_test.go
deleted file mode 100644
index f08a6f5b229..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bcrypt/bcrypt_test.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bcrypt
-
-import (
- "bytes"
- "fmt"
- "testing"
-)
-
-func TestBcryptingIsEasy(t *testing.T) {
- pass := []byte("mypassword")
- hp, err := GenerateFromPassword(pass, 0)
- if err != nil {
- t.Fatalf("GenerateFromPassword error: %s", err)
- }
-
- if CompareHashAndPassword(hp, pass) != nil {
- t.Errorf("%v should hash %s correctly", hp, pass)
- }
-
- notPass := "notthepass"
- err = CompareHashAndPassword(hp, []byte(notPass))
- if err != ErrMismatchedHashAndPassword {
- t.Errorf("%v and %s should be mismatched", hp, notPass)
- }
-}
-
-func TestBcryptingIsCorrect(t *testing.T) {
- pass := []byte("allmine")
- salt := []byte("XajjQvNhvvRt5GSeFk1xFe")
- expectedHash := []byte("$2a$10$XajjQvNhvvRt5GSeFk1xFeyqRrsxkhBkUiQeg0dt.wU1qD4aFDcga")
-
- hash, err := bcrypt(pass, 10, salt)
- if err != nil {
- t.Fatalf("bcrypt blew up: %v", err)
- }
- if !bytes.HasSuffix(expectedHash, hash) {
- t.Errorf("%v should be the suffix of %v", hash, expectedHash)
- }
-
- h, err := newFromHash(expectedHash)
- if err != nil {
- t.Errorf("Unable to parse %s: %v", string(expectedHash), err)
- }
-
- // This is not the safe way to compare these hashes. We do this only for
- // testing clarity. Use bcrypt.CompareHashAndPassword()
- if err == nil && !bytes.Equal(expectedHash, h.Hash()) {
- t.Errorf("Parsed hash %v should equal %v", h.Hash(), expectedHash)
- }
-}
-
-func TestVeryShortPasswords(t *testing.T) {
- key := []byte("k")
- salt := []byte("XajjQvNhvvRt5GSeFk1xFe")
- _, err := bcrypt(key, 10, salt)
- if err != nil {
- t.Errorf("One byte key resulted in error: %s", err)
- }
-}
-
-func TestTooLongPasswordsWork(t *testing.T) {
- salt := []byte("XajjQvNhvvRt5GSeFk1xFe")
- // One byte over the usual 56 byte limit that blowfish has
- tooLongPass := []byte("012345678901234567890123456789012345678901234567890123456")
- tooLongExpected := []byte("$2a$10$XajjQvNhvvRt5GSeFk1xFe5l47dONXg781AmZtd869sO8zfsHuw7C")
- hash, err := bcrypt(tooLongPass, 10, salt)
- if err != nil {
- t.Fatalf("bcrypt blew up on long password: %v", err)
- }
- if !bytes.HasSuffix(tooLongExpected, hash) {
- t.Errorf("%v should be the suffix of %v", hash, tooLongExpected)
- }
-}
-
-type InvalidHashTest struct {
- err error
- hash []byte
-}
-
-var invalidTests = []InvalidHashTest{
- {ErrHashTooShort, []byte("$2a$10$fooo")},
- {ErrHashTooShort, []byte("$2a")},
- {HashVersionTooNewError('3'), []byte("$3a$10$sssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")},
- {InvalidHashPrefixError('%'), []byte("%2a$10$sssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")},
- {InvalidCostError(32), []byte("$2a$32$sssssssssssssssssssssshhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")},
-}
-
-func TestInvalidHashErrors(t *testing.T) {
- check := func(name string, expected, err error) {
- if err == nil {
- t.Errorf("%s: Should have returned an error", name)
- }
- if err != nil && err != expected {
- t.Errorf("%s gave err %v but should have given %v", name, err, expected)
- }
- }
- for _, iht := range invalidTests {
- _, err := newFromHash(iht.hash)
- check("newFromHash", iht.err, err)
- err = CompareHashAndPassword(iht.hash, []byte("anything"))
- check("CompareHashAndPassword", iht.err, err)
- }
-}
-
-func TestUnpaddedBase64Encoding(t *testing.T) {
- original := []byte{101, 201, 101, 75, 19, 227, 199, 20, 239, 236, 133, 32, 30, 109, 243, 30}
- encodedOriginal := []byte("XajjQvNhvvRt5GSeFk1xFe")
-
- encoded := base64Encode(original)
-
- if !bytes.Equal(encodedOriginal, encoded) {
- t.Errorf("Encoded %v should have equaled %v", encoded, encodedOriginal)
- }
-
- decoded, err := base64Decode(encodedOriginal)
- if err != nil {
- t.Fatalf("base64Decode blew up: %s", err)
- }
-
- if !bytes.Equal(decoded, original) {
- t.Errorf("Decoded %v should have equaled %v", decoded, original)
- }
-}
-
-func TestCost(t *testing.T) {
- suffix := "XajjQvNhvvRt5GSeFk1xFe5l47dONXg781AmZtd869sO8zfsHuw7C"
- for _, vers := range []string{"2a", "2"} {
- for _, cost := range []int{4, 10} {
- s := fmt.Sprintf("$%s$%02d$%s", vers, cost, suffix)
- h := []byte(s)
- actual, err := Cost(h)
- if err != nil {
- t.Errorf("Cost, error: %s", err)
- continue
- }
- if actual != cost {
- t.Errorf("Cost, expected: %d, actual: %d", cost, actual)
- }
- }
- }
- _, err := Cost([]byte("$a$a$" + suffix))
- if err == nil {
- t.Errorf("Cost, malformed but no error returned")
- }
-}
-
-func TestCostValidationInHash(t *testing.T) {
- if testing.Short() {
- return
- }
-
- pass := []byte("mypassword")
-
- for c := 0; c < MinCost; c++ {
- p, _ := newFromPassword(pass, c)
- if p.cost != DefaultCost {
- t.Errorf("newFromPassword should default costs below %d to %d, but was %d", MinCost, DefaultCost, p.cost)
- }
- }
-
- p, _ := newFromPassword(pass, 14)
- if p.cost != 14 {
- t.Errorf("newFromPassword should default cost to 14, but was %d", p.cost)
- }
-
- hp, _ := newFromHash(p.Hash())
- if p.cost != hp.cost {
- t.Errorf("newFromHash should maintain the cost at %d, but was %d", p.cost, hp.cost)
- }
-
- _, err := newFromPassword(pass, 32)
- if err == nil {
- t.Fatalf("newFromPassword: should return a cost error")
- }
- if err != InvalidCostError(32) {
- t.Errorf("newFromPassword: should return cost error, got %#v", err)
- }
-}
-
-func TestCostReturnsWithLeadingZeroes(t *testing.T) {
- hp, _ := newFromPassword([]byte("abcdefgh"), 7)
- cost := hp.Hash()[4:7]
- expected := []byte("07$")
-
- if !bytes.Equal(expected, cost) {
- t.Errorf("single digit costs in hash should have leading zeros: was %v instead of %v", cost, expected)
- }
-}
-
-func TestMinorNotRequired(t *testing.T) {
- noMinorHash := []byte("$2$10$XajjQvNhvvRt5GSeFk1xFeyqRrsxkhBkUiQeg0dt.wU1qD4aFDcga")
- h, err := newFromHash(noMinorHash)
- if err != nil {
- t.Fatalf("No minor hash blew up: %s", err)
- }
- if h.minor != 0 {
- t.Errorf("Should leave minor version at 0, but was %d", h.minor)
- }
-
- if !bytes.Equal(noMinorHash, h.Hash()) {
- t.Errorf("Should generate hash %v, but created %v", noMinorHash, h.Hash())
- }
-}
-
-func BenchmarkEqual(b *testing.B) {
- b.StopTimer()
- passwd := []byte("somepasswordyoulike")
- hash, _ := GenerateFromPassword(passwd, 10)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- CompareHashAndPassword(hash, passwd)
- }
-}
-
-func BenchmarkGeneration(b *testing.B) {
- b.StopTimer()
- passwd := []byte("mylongpassword1234")
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- GenerateFromPassword(passwd, 10)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/blowfish/blowfish_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/blowfish/blowfish_test.go
deleted file mode 100644
index 7afa1fdf3d5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/blowfish/blowfish_test.go
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package blowfish
-
-import "testing"
-
-type CryptTest struct {
- key []byte
- in []byte
- out []byte
-}
-
-// Test vector values are from http://www.schneier.com/code/vectors.txt.
-var encryptTests = []CryptTest{
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}},
- {
- []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- []byte{0x51, 0x86, 0x6F, 0xD5, 0xB8, 0x5E, 0xCB, 0x8A}},
- {
- []byte{0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
- []byte{0x7D, 0x85, 0x6F, 0x9A, 0x61, 0x30, 0x63, 0xF2}},
- {
- []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
- []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
- []byte{0x24, 0x66, 0xDD, 0x87, 0x8B, 0x96, 0x3C, 0x9D}},
-
- {
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
- []byte{0x61, 0xF9, 0xC3, 0x80, 0x22, 0x81, 0xB0, 0x96}},
- {
- []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0x7D, 0x0C, 0xC6, 0x30, 0xAF, 0xDA, 0x1E, 0xC7}},
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}},
- {
- []byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0x0A, 0xCE, 0xAB, 0x0F, 0xC6, 0xA0, 0xA2, 0x8D}},
- {
- []byte{0x7C, 0xA1, 0x10, 0x45, 0x4A, 0x1A, 0x6E, 0x57},
- []byte{0x01, 0xA1, 0xD6, 0xD0, 0x39, 0x77, 0x67, 0x42},
- []byte{0x59, 0xC6, 0x82, 0x45, 0xEB, 0x05, 0x28, 0x2B}},
- {
- []byte{0x01, 0x31, 0xD9, 0x61, 0x9D, 0xC1, 0x37, 0x6E},
- []byte{0x5C, 0xD5, 0x4C, 0xA8, 0x3D, 0xEF, 0x57, 0xDA},
- []byte{0xB1, 0xB8, 0xCC, 0x0B, 0x25, 0x0F, 0x09, 0xA0}},
- {
- []byte{0x07, 0xA1, 0x13, 0x3E, 0x4A, 0x0B, 0x26, 0x86},
- []byte{0x02, 0x48, 0xD4, 0x38, 0x06, 0xF6, 0x71, 0x72},
- []byte{0x17, 0x30, 0xE5, 0x77, 0x8B, 0xEA, 0x1D, 0xA4}},
- {
- []byte{0x38, 0x49, 0x67, 0x4C, 0x26, 0x02, 0x31, 0x9E},
- []byte{0x51, 0x45, 0x4B, 0x58, 0x2D, 0xDF, 0x44, 0x0A},
- []byte{0xA2, 0x5E, 0x78, 0x56, 0xCF, 0x26, 0x51, 0xEB}},
- {
- []byte{0x04, 0xB9, 0x15, 0xBA, 0x43, 0xFE, 0xB5, 0xB6},
- []byte{0x42, 0xFD, 0x44, 0x30, 0x59, 0x57, 0x7F, 0xA2},
- []byte{0x35, 0x38, 0x82, 0xB1, 0x09, 0xCE, 0x8F, 0x1A}},
- {
- []byte{0x01, 0x13, 0xB9, 0x70, 0xFD, 0x34, 0xF2, 0xCE},
- []byte{0x05, 0x9B, 0x5E, 0x08, 0x51, 0xCF, 0x14, 0x3A},
- []byte{0x48, 0xF4, 0xD0, 0x88, 0x4C, 0x37, 0x99, 0x18}},
- {
- []byte{0x01, 0x70, 0xF1, 0x75, 0x46, 0x8F, 0xB5, 0xE6},
- []byte{0x07, 0x56, 0xD8, 0xE0, 0x77, 0x47, 0x61, 0xD2},
- []byte{0x43, 0x21, 0x93, 0xB7, 0x89, 0x51, 0xFC, 0x98}},
- {
- []byte{0x43, 0x29, 0x7F, 0xAD, 0x38, 0xE3, 0x73, 0xFE},
- []byte{0x76, 0x25, 0x14, 0xB8, 0x29, 0xBF, 0x48, 0x6A},
- []byte{0x13, 0xF0, 0x41, 0x54, 0xD6, 0x9D, 0x1A, 0xE5}},
- {
- []byte{0x07, 0xA7, 0x13, 0x70, 0x45, 0xDA, 0x2A, 0x16},
- []byte{0x3B, 0xDD, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02},
- []byte{0x2E, 0xED, 0xDA, 0x93, 0xFF, 0xD3, 0x9C, 0x79}},
- {
- []byte{0x04, 0x68, 0x91, 0x04, 0xC2, 0xFD, 0x3B, 0x2F},
- []byte{0x26, 0x95, 0x5F, 0x68, 0x35, 0xAF, 0x60, 0x9A},
- []byte{0xD8, 0x87, 0xE0, 0x39, 0x3C, 0x2D, 0xA6, 0xE3}},
- {
- []byte{0x37, 0xD0, 0x6B, 0xB5, 0x16, 0xCB, 0x75, 0x46},
- []byte{0x16, 0x4D, 0x5E, 0x40, 0x4F, 0x27, 0x52, 0x32},
- []byte{0x5F, 0x99, 0xD0, 0x4F, 0x5B, 0x16, 0x39, 0x69}},
- {
- []byte{0x1F, 0x08, 0x26, 0x0D, 0x1A, 0xC2, 0x46, 0x5E},
- []byte{0x6B, 0x05, 0x6E, 0x18, 0x75, 0x9F, 0x5C, 0xCA},
- []byte{0x4A, 0x05, 0x7A, 0x3B, 0x24, 0xD3, 0x97, 0x7B}},
- {
- []byte{0x58, 0x40, 0x23, 0x64, 0x1A, 0xBA, 0x61, 0x76},
- []byte{0x00, 0x4B, 0xD6, 0xEF, 0x09, 0x17, 0x60, 0x62},
- []byte{0x45, 0x20, 0x31, 0xC1, 0xE4, 0xFA, 0xDA, 0x8E}},
- {
- []byte{0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xB0, 0x07},
- []byte{0x48, 0x0D, 0x39, 0x00, 0x6E, 0xE7, 0x62, 0xF2},
- []byte{0x75, 0x55, 0xAE, 0x39, 0xF5, 0x9B, 0x87, 0xBD}},
- {
- []byte{0x49, 0x79, 0x3E, 0xBC, 0x79, 0xB3, 0x25, 0x8F},
- []byte{0x43, 0x75, 0x40, 0xC8, 0x69, 0x8F, 0x3C, 0xFA},
- []byte{0x53, 0xC5, 0x5F, 0x9C, 0xB4, 0x9F, 0xC0, 0x19}},
- {
- []byte{0x4F, 0xB0, 0x5E, 0x15, 0x15, 0xAB, 0x73, 0xA7},
- []byte{0x07, 0x2D, 0x43, 0xA0, 0x77, 0x07, 0x52, 0x92},
- []byte{0x7A, 0x8E, 0x7B, 0xFA, 0x93, 0x7E, 0x89, 0xA3}},
- {
- []byte{0x49, 0xE9, 0x5D, 0x6D, 0x4C, 0xA2, 0x29, 0xBF},
- []byte{0x02, 0xFE, 0x55, 0x77, 0x81, 0x17, 0xF1, 0x2A},
- []byte{0xCF, 0x9C, 0x5D, 0x7A, 0x49, 0x86, 0xAD, 0xB5}},
- {
- []byte{0x01, 0x83, 0x10, 0xDC, 0x40, 0x9B, 0x26, 0xD6},
- []byte{0x1D, 0x9D, 0x5C, 0x50, 0x18, 0xF7, 0x28, 0xC2},
- []byte{0xD1, 0xAB, 0xB2, 0x90, 0x65, 0x8B, 0xC7, 0x78}},
- {
- []byte{0x1C, 0x58, 0x7F, 0x1C, 0x13, 0x92, 0x4F, 0xEF},
- []byte{0x30, 0x55, 0x32, 0x28, 0x6D, 0x6F, 0x29, 0x5A},
- []byte{0x55, 0xCB, 0x37, 0x74, 0xD1, 0x3E, 0xF2, 0x01}},
- {
- []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0xFA, 0x34, 0xEC, 0x48, 0x47, 0xB2, 0x68, 0xB2}},
- {
- []byte{0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E},
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0xA7, 0x90, 0x79, 0x51, 0x08, 0xEA, 0x3C, 0xAE}},
- {
- []byte{0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE},
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0xC3, 0x9E, 0x07, 0x2D, 0x9F, 0xAC, 0x63, 0x1D}},
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- []byte{0x01, 0x49, 0x33, 0xE0, 0xCD, 0xAF, 0xF6, 0xE4}},
- {
- []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0xF2, 0x1E, 0x9A, 0x77, 0xB7, 0x1C, 0x49, 0xBC}},
- {
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x24, 0x59, 0x46, 0x88, 0x57, 0x54, 0x36, 0x9A}},
- {
- []byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
- []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
- []byte{0x6B, 0x5C, 0x5A, 0x9C, 0x5D, 0x9E, 0x0A, 0x5A}},
-}
-
-func TestCipherEncrypt(t *testing.T) {
- for i, tt := range encryptTests {
- c, err := NewCipher(tt.key)
- if err != nil {
- t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err)
- continue
- }
- ct := make([]byte, len(tt.out))
- c.Encrypt(ct, tt.in)
- for j, v := range ct {
- if v != tt.out[j] {
- t.Errorf("Cipher.Encrypt, test vector #%d: cipher-text[%d] = %#x, expected %#x", i, j, v, tt.out[j])
- break
- }
- }
- }
-}
-
-func TestCipherDecrypt(t *testing.T) {
- for i, tt := range encryptTests {
- c, err := NewCipher(tt.key)
- if err != nil {
- t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err)
- continue
- }
- pt := make([]byte, len(tt.in))
- c.Decrypt(pt, tt.out)
- for j, v := range pt {
- if v != tt.in[j] {
- t.Errorf("Cipher.Decrypt, test vector #%d: plain-text[%d] = %#x, expected %#x", i, j, v, tt.in[j])
- break
- }
- }
- }
-}
-
-func TestSaltedCipherKeyLength(t *testing.T) {
- if _, err := NewSaltedCipher(nil, []byte{'a'}); err != KeySizeError(0) {
- t.Errorf("NewSaltedCipher with short key, gave error %#v, expected %#v", err, KeySizeError(0))
- }
-
- // A 57-byte key. One over the typical blowfish restriction.
- key := []byte("012345678901234567890123456789012345678901234567890123456")
- if _, err := NewSaltedCipher(key, []byte{'a'}); err != nil {
- t.Errorf("NewSaltedCipher with long key, gave error %#v", err)
- }
-}
-
-// Test vectors generated with Blowfish from OpenSSH.
-var saltedVectors = [][8]byte{
- {0x0c, 0x82, 0x3b, 0x7b, 0x8d, 0x01, 0x4b, 0x7e},
- {0xd1, 0xe1, 0x93, 0xf0, 0x70, 0xa6, 0xdb, 0x12},
- {0xfc, 0x5e, 0xba, 0xde, 0xcb, 0xf8, 0x59, 0xad},
- {0x8a, 0x0c, 0x76, 0xe7, 0xdd, 0x2c, 0xd3, 0xa8},
- {0x2c, 0xcb, 0x7b, 0xee, 0xac, 0x7b, 0x7f, 0xf8},
- {0xbb, 0xf6, 0x30, 0x6f, 0xe1, 0x5d, 0x62, 0xbf},
- {0x97, 0x1e, 0xc1, 0x3d, 0x3d, 0xe0, 0x11, 0xe9},
- {0x06, 0xd7, 0x4d, 0xb1, 0x80, 0xa3, 0xb1, 0x38},
- {0x67, 0xa1, 0xa9, 0x75, 0x0e, 0x5b, 0xc6, 0xb4},
- {0x51, 0x0f, 0x33, 0x0e, 0x4f, 0x67, 0xd2, 0x0c},
- {0xf1, 0x73, 0x7e, 0xd8, 0x44, 0xea, 0xdb, 0xe5},
- {0x14, 0x0e, 0x16, 0xce, 0x7f, 0x4a, 0x9c, 0x7b},
- {0x4b, 0xfe, 0x43, 0xfd, 0xbf, 0x36, 0x04, 0x47},
- {0xb1, 0xeb, 0x3e, 0x15, 0x36, 0xa7, 0xbb, 0xe2},
- {0x6d, 0x0b, 0x41, 0xdd, 0x00, 0x98, 0x0b, 0x19},
- {0xd3, 0xce, 0x45, 0xce, 0x1d, 0x56, 0xb7, 0xfc},
- {0xd9, 0xf0, 0xfd, 0xda, 0xc0, 0x23, 0xb7, 0x93},
- {0x4c, 0x6f, 0xa1, 0xe4, 0x0c, 0xa8, 0xca, 0x57},
- {0xe6, 0x2f, 0x28, 0xa7, 0x0c, 0x94, 0x0d, 0x08},
- {0x8f, 0xe3, 0xf0, 0xb6, 0x29, 0xe3, 0x44, 0x03},
- {0xff, 0x98, 0xdd, 0x04, 0x45, 0xb4, 0x6d, 0x1f},
- {0x9e, 0x45, 0x4d, 0x18, 0x40, 0x53, 0xdb, 0xef},
- {0xb7, 0x3b, 0xef, 0x29, 0xbe, 0xa8, 0x13, 0x71},
- {0x02, 0x54, 0x55, 0x41, 0x8e, 0x04, 0xfc, 0xad},
- {0x6a, 0x0a, 0xee, 0x7c, 0x10, 0xd9, 0x19, 0xfe},
- {0x0a, 0x22, 0xd9, 0x41, 0xcc, 0x23, 0x87, 0x13},
- {0x6e, 0xff, 0x1f, 0xff, 0x36, 0x17, 0x9c, 0xbe},
- {0x79, 0xad, 0xb7, 0x40, 0xf4, 0x9f, 0x51, 0xa6},
- {0x97, 0x81, 0x99, 0xa4, 0xde, 0x9e, 0x9f, 0xb6},
- {0x12, 0x19, 0x7a, 0x28, 0xd0, 0xdc, 0xcc, 0x92},
- {0x81, 0xda, 0x60, 0x1e, 0x0e, 0xdd, 0x65, 0x56},
- {0x7d, 0x76, 0x20, 0xb2, 0x73, 0xc9, 0x9e, 0xee},
-}
-
-func TestSaltedCipher(t *testing.T) {
- var key, salt [32]byte
- for i := range key {
- key[i] = byte(i)
- salt[i] = byte(i + 32)
- }
- for i, v := range saltedVectors {
- c, err := NewSaltedCipher(key[:], salt[:i])
- if err != nil {
- t.Fatal(err)
- }
- var buf [8]byte
- c.Encrypt(buf[:], buf[:])
- if v != buf {
- t.Errorf("%d: expected %x, got %x", i, v, buf)
- }
- }
-}
-
-func BenchmarkExpandKeyWithSalt(b *testing.B) {
- key := make([]byte, 32)
- salt := make([]byte, 16)
- c, _ := NewCipher(key)
- for i := 0; i < b.N; i++ {
- expandKeyWithSalt(key, salt, c)
- }
-}
-
-func BenchmarkExpandKey(b *testing.B) {
- key := make([]byte, 32)
- c, _ := NewCipher(key)
- for i := 0; i < b.N; i++ {
- ExpandKey(key, c)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/bn256_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/bn256_test.go
deleted file mode 100644
index 1cec3884ecd..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/bn256_test.go
+++ /dev/null
@@ -1,304 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bn256
-
-import (
- "bytes"
- "crypto/rand"
- "math/big"
- "testing"
-)
-
-func TestGFp2Invert(t *testing.T) {
- pool := new(bnPool)
-
- a := newGFp2(pool)
- a.x.SetString("23423492374", 10)
- a.y.SetString("12934872398472394827398470", 10)
-
- inv := newGFp2(pool)
- inv.Invert(a, pool)
-
- b := newGFp2(pool).Mul(inv, a, pool)
- if b.x.Int64() != 0 || b.y.Int64() != 1 {
- t.Fatalf("bad result for a^-1*a: %s %s", b.x, b.y)
- }
-
- a.Put(pool)
- b.Put(pool)
- inv.Put(pool)
-
- if c := pool.Count(); c > 0 {
- t.Errorf("Pool count non-zero: %d\n", c)
- }
-}
-
-func isZero(n *big.Int) bool {
- return new(big.Int).Mod(n, p).Int64() == 0
-}
-
-func isOne(n *big.Int) bool {
- return new(big.Int).Mod(n, p).Int64() == 1
-}
-
-func TestGFp6Invert(t *testing.T) {
- pool := new(bnPool)
-
- a := newGFp6(pool)
- a.x.x.SetString("239487238491", 10)
- a.x.y.SetString("2356249827341", 10)
- a.y.x.SetString("082659782", 10)
- a.y.y.SetString("182703523765", 10)
- a.z.x.SetString("978236549263", 10)
- a.z.y.SetString("64893242", 10)
-
- inv := newGFp6(pool)
- inv.Invert(a, pool)
-
- b := newGFp6(pool).Mul(inv, a, pool)
- if !isZero(b.x.x) ||
- !isZero(b.x.y) ||
- !isZero(b.y.x) ||
- !isZero(b.y.y) ||
- !isZero(b.z.x) ||
- !isOne(b.z.y) {
- t.Fatalf("bad result for a^-1*a: %s", b)
- }
-
- a.Put(pool)
- b.Put(pool)
- inv.Put(pool)
-
- if c := pool.Count(); c > 0 {
- t.Errorf("Pool count non-zero: %d\n", c)
- }
-}
-
-func TestGFp12Invert(t *testing.T) {
- pool := new(bnPool)
-
- a := newGFp12(pool)
- a.x.x.x.SetString("239846234862342323958623", 10)
- a.x.x.y.SetString("2359862352529835623", 10)
- a.x.y.x.SetString("928836523", 10)
- a.x.y.y.SetString("9856234", 10)
- a.x.z.x.SetString("235635286", 10)
- a.x.z.y.SetString("5628392833", 10)
- a.y.x.x.SetString("252936598265329856238956532167968", 10)
- a.y.x.y.SetString("23596239865236954178968", 10)
- a.y.y.x.SetString("95421692834", 10)
- a.y.y.y.SetString("236548", 10)
- a.y.z.x.SetString("924523", 10)
- a.y.z.y.SetString("12954623", 10)
-
- inv := newGFp12(pool)
- inv.Invert(a, pool)
-
- b := newGFp12(pool).Mul(inv, a, pool)
- if !isZero(b.x.x.x) ||
- !isZero(b.x.x.y) ||
- !isZero(b.x.y.x) ||
- !isZero(b.x.y.y) ||
- !isZero(b.x.z.x) ||
- !isZero(b.x.z.y) ||
- !isZero(b.y.x.x) ||
- !isZero(b.y.x.y) ||
- !isZero(b.y.y.x) ||
- !isZero(b.y.y.y) ||
- !isZero(b.y.z.x) ||
- !isOne(b.y.z.y) {
- t.Fatalf("bad result for a^-1*a: %s", b)
- }
-
- a.Put(pool)
- b.Put(pool)
- inv.Put(pool)
-
- if c := pool.Count(); c > 0 {
- t.Errorf("Pool count non-zero: %d\n", c)
- }
-}
-
-func TestCurveImpl(t *testing.T) {
- pool := new(bnPool)
-
- g := &curvePoint{
- pool.Get().SetInt64(1),
- pool.Get().SetInt64(-2),
- pool.Get().SetInt64(1),
- pool.Get().SetInt64(0),
- }
-
- x := pool.Get().SetInt64(32498273234)
- X := newCurvePoint(pool).Mul(g, x, pool)
-
- y := pool.Get().SetInt64(98732423523)
- Y := newCurvePoint(pool).Mul(g, y, pool)
-
- s1 := newCurvePoint(pool).Mul(X, y, pool).MakeAffine(pool)
- s2 := newCurvePoint(pool).Mul(Y, x, pool).MakeAffine(pool)
-
- if s1.x.Cmp(s2.x) != 0 ||
- s2.x.Cmp(s1.x) != 0 {
- t.Errorf("DH points don't match: (%s, %s) (%s, %s)", s1.x, s1.y, s2.x, s2.y)
- }
-
- pool.Put(x)
- X.Put(pool)
- pool.Put(y)
- Y.Put(pool)
- s1.Put(pool)
- s2.Put(pool)
- g.Put(pool)
-
- if c := pool.Count(); c > 0 {
- t.Errorf("Pool count non-zero: %d\n", c)
- }
-}
-
-func TestOrderG1(t *testing.T) {
- g := new(G1).ScalarBaseMult(Order)
- if !g.p.IsInfinity() {
- t.Error("G1 has incorrect order")
- }
-
- one := new(G1).ScalarBaseMult(new(big.Int).SetInt64(1))
- g.Add(g, one)
- g.p.MakeAffine(nil)
- if g.p.x.Cmp(one.p.x) != 0 || g.p.y.Cmp(one.p.y) != 0 {
- t.Errorf("1+0 != 1 in G1")
- }
-}
-
-func TestOrderG2(t *testing.T) {
- g := new(G2).ScalarBaseMult(Order)
- if !g.p.IsInfinity() {
- t.Error("G2 has incorrect order")
- }
-
- one := new(G2).ScalarBaseMult(new(big.Int).SetInt64(1))
- g.Add(g, one)
- g.p.MakeAffine(nil)
- if g.p.x.x.Cmp(one.p.x.x) != 0 ||
- g.p.x.y.Cmp(one.p.x.y) != 0 ||
- g.p.y.x.Cmp(one.p.y.x) != 0 ||
- g.p.y.y.Cmp(one.p.y.y) != 0 {
- t.Errorf("1+0 != 1 in G2")
- }
-}
-
-func TestOrderGT(t *testing.T) {
- gt := Pair(&G1{curveGen}, &G2{twistGen})
- g := new(GT).ScalarMult(gt, Order)
- if !g.p.IsOne() {
- t.Error("GT has incorrect order")
- }
-}
-
-func TestBilinearity(t *testing.T) {
- for i := 0; i < 2; i++ {
- a, p1, _ := RandomG1(rand.Reader)
- b, p2, _ := RandomG2(rand.Reader)
- e1 := Pair(p1, p2)
-
- e2 := Pair(&G1{curveGen}, &G2{twistGen})
- e2.ScalarMult(e2, a)
- e2.ScalarMult(e2, b)
-
- minusE2 := new(GT).Neg(e2)
- e1.Add(e1, minusE2)
-
- if !e1.p.IsOne() {
- t.Fatalf("bad pairing result: %s", e1)
- }
- }
-}
-
-func TestG1Marshal(t *testing.T) {
- g := new(G1).ScalarBaseMult(new(big.Int).SetInt64(1))
- form := g.Marshal()
- _, ok := new(G1).Unmarshal(form)
- if !ok {
- t.Fatalf("failed to unmarshal")
- }
-
- g.ScalarBaseMult(Order)
- form = g.Marshal()
- g2, ok := new(G1).Unmarshal(form)
- if !ok {
- t.Fatalf("failed to unmarshal ∞")
- }
- if !g2.p.IsInfinity() {
- t.Fatalf("∞ unmarshaled incorrectly")
- }
-}
-
-func TestG2Marshal(t *testing.T) {
- g := new(G2).ScalarBaseMult(new(big.Int).SetInt64(1))
- form := g.Marshal()
- _, ok := new(G2).Unmarshal(form)
- if !ok {
- t.Fatalf("failed to unmarshal")
- }
-
- g.ScalarBaseMult(Order)
- form = g.Marshal()
- g2, ok := new(G2).Unmarshal(form)
- if !ok {
- t.Fatalf("failed to unmarshal ∞")
- }
- if !g2.p.IsInfinity() {
- t.Fatalf("∞ unmarshaled incorrectly")
- }
-}
-
-func TestG1Identity(t *testing.T) {
- g := new(G1).ScalarBaseMult(new(big.Int).SetInt64(0))
- if !g.p.IsInfinity() {
- t.Error("failure")
- }
-}
-
-func TestG2Identity(t *testing.T) {
- g := new(G2).ScalarBaseMult(new(big.Int).SetInt64(0))
- if !g.p.IsInfinity() {
- t.Error("failure")
- }
-}
-
-func TestTripartiteDiffieHellman(t *testing.T) {
- a, _ := rand.Int(rand.Reader, Order)
- b, _ := rand.Int(rand.Reader, Order)
- c, _ := rand.Int(rand.Reader, Order)
-
- pa, _ := new(G1).Unmarshal(new(G1).ScalarBaseMult(a).Marshal())
- qa, _ := new(G2).Unmarshal(new(G2).ScalarBaseMult(a).Marshal())
- pb, _ := new(G1).Unmarshal(new(G1).ScalarBaseMult(b).Marshal())
- qb, _ := new(G2).Unmarshal(new(G2).ScalarBaseMult(b).Marshal())
- pc, _ := new(G1).Unmarshal(new(G1).ScalarBaseMult(c).Marshal())
- qc, _ := new(G2).Unmarshal(new(G2).ScalarBaseMult(c).Marshal())
-
- k1 := Pair(pb, qc)
- k1.ScalarMult(k1, a)
- k1Bytes := k1.Marshal()
-
- k2 := Pair(pc, qa)
- k2.ScalarMult(k2, b)
- k2Bytes := k2.Marshal()
-
- k3 := Pair(pa, qb)
- k3.ScalarMult(k3, c)
- k3Bytes := k3.Marshal()
-
- if !bytes.Equal(k1Bytes, k2Bytes) || !bytes.Equal(k2Bytes, k3Bytes) {
- t.Errorf("keys didn't agree")
- }
-}
-
-func BenchmarkPairing(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Pair(&G1{curveGen}, &G2{twistGen})
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/example_test.go
deleted file mode 100644
index b2d19807a25..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/bn256/example_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bn256
-
-import (
- "crypto/rand"
-)
-
-func ExamplePair() {
- // This implements the tripartite Diffie-Hellman algorithm from "A One
- // Round Protocol for Tripartite Diffie-Hellman", A. Joux.
- // http://www.springerlink.com/content/cddc57yyva0hburb/fulltext.pdf
-
- // Each of three parties, a, b and c, generate a private value.
- a, _ := rand.Int(rand.Reader, Order)
- b, _ := rand.Int(rand.Reader, Order)
- c, _ := rand.Int(rand.Reader, Order)
-
- // Then each party calculates g₁ and g₂ times their private value.
- pa := new(G1).ScalarBaseMult(a)
- qa := new(G2).ScalarBaseMult(a)
-
- pb := new(G1).ScalarBaseMult(b)
- qb := new(G2).ScalarBaseMult(b)
-
- pc := new(G1).ScalarBaseMult(c)
- qc := new(G2).ScalarBaseMult(c)
-
- // Now each party exchanges its public values with the other two and
- // all parties can calculate the shared key.
- k1 := Pair(pb, qc)
- k1.ScalarMult(k1, a)
-
- k2 := Pair(pc, qa)
- k2.ScalarMult(k2, b)
-
- k3 := Pair(pa, qb)
- k3.ScalarMult(k3, c)
-
- // k1, k2 and k3 will all be equal.
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/cast5/cast5_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/cast5/cast5_test.go
deleted file mode 100644
index 778b272a638..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/cast5/cast5_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cast5
-
-import (
- "bytes"
- "encoding/hex"
- "testing"
-)
-
-// This test vector is taken from RFC 2144, App B.1.
-// Since the other two test vectors are for reduced-round variants, we can't
-// use them.
-var basicTests = []struct {
- key, plainText, cipherText string
-}{
- {
- "0123456712345678234567893456789a",
- "0123456789abcdef",
- "238b4fe5847e44b2",
- },
-}
-
-func TestBasic(t *testing.T) {
- for i, test := range basicTests {
- key, _ := hex.DecodeString(test.key)
- plainText, _ := hex.DecodeString(test.plainText)
- expected, _ := hex.DecodeString(test.cipherText)
-
- c, err := NewCipher(key)
- if err != nil {
- t.Errorf("#%d: failed to create Cipher: %s", i, err)
- continue
- }
- var cipherText [BlockSize]byte
- c.Encrypt(cipherText[:], plainText)
- if !bytes.Equal(cipherText[:], expected) {
- t.Errorf("#%d: got:%x want:%x", i, cipherText, expected)
- }
-
- var plainTextAgain [BlockSize]byte
- c.Decrypt(plainTextAgain[:], cipherText[:])
- if !bytes.Equal(plainTextAgain[:], plainText) {
- t.Errorf("#%d: got:%x want:%x", i, plainTextAgain, plainText)
- }
- }
-}
-
-// TestFull performs the test specified in RFC 2144, App B.2.
-// However, due to the length of time taken, it's disabled here and a more
-// limited version is included, below.
-func TestFull(t *testing.T) {
- if testing.Short() {
- // This is too slow for normal testing
- return
- }
-
- a, b := iterate(1000000)
-
- const expectedA = "eea9d0a249fd3ba6b3436fb89d6dca92"
- const expectedB = "b2c95eb00c31ad7180ac05b8e83d696e"
-
- if hex.EncodeToString(a) != expectedA {
- t.Errorf("a: got:%x want:%s", a, expectedA)
- }
- if hex.EncodeToString(b) != expectedB {
- t.Errorf("b: got:%x want:%s", b, expectedB)
- }
-}
-
-func iterate(iterations int) ([]byte, []byte) {
- const initValueHex = "0123456712345678234567893456789a"
-
- initValue, _ := hex.DecodeString(initValueHex)
-
- var a, b [16]byte
- copy(a[:], initValue)
- copy(b[:], initValue)
-
- for i := 0; i < iterations; i++ {
- c, _ := NewCipher(b[:])
- c.Encrypt(a[:8], a[:8])
- c.Encrypt(a[8:], a[8:])
- c, _ = NewCipher(a[:])
- c.Encrypt(b[:8], b[:8])
- c.Encrypt(b[8:], b[8:])
- }
-
- return a[:], b[:]
-}
-
-func TestLimited(t *testing.T) {
- a, b := iterate(1000)
-
- const expectedA = "23f73b14b02a2ad7dfb9f2c35644798d"
- const expectedB = "e5bf37eff14c456a40b21ce369370a9f"
-
- if hex.EncodeToString(a) != expectedA {
- t.Errorf("a: got:%x want:%s", a, expectedA)
- }
- if hex.EncodeToString(b) != expectedB {
- t.Errorf("b: got:%x want:%s", b, expectedB)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/curve25519/curve25519_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/curve25519/curve25519_test.go
deleted file mode 100644
index 14b0ee87cdd..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/curve25519/curve25519_test.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package curve25519
-
-import (
- "fmt"
- "testing"
-)
-
-const expectedHex = "89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a"
-
-func TestBaseScalarMult(t *testing.T) {
- var a, b [32]byte
- in := &a
- out := &b
- a[0] = 1
-
- for i := 0; i < 200; i++ {
- ScalarBaseMult(out, in)
- in, out = out, in
- }
-
- result := fmt.Sprintf("%x", in[:])
- if result != expectedHex {
- t.Errorf("incorrect result: got %s, want %s", result, expectedHex)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/example_test.go
deleted file mode 100644
index df843951291..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/example_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package hkdf_test
-
-import (
- "bytes"
- "crypto/rand"
- "crypto/sha256"
- "fmt"
- "golang.org/x/crypto/hkdf"
- "io"
-)
-
-// Usage example that expands one master key into three other cryptographically
-// secure keys.
-func Example_usage() {
- // Underlying hash function to use
- hash := sha256.New
-
- // Cryptographically secure master key.
- master := []byte{0x00, 0x01, 0x02, 0x03} // i.e. NOT this.
-
- // Non secret salt, optional (can be nil)
- // Recommended: hash-length sized random
- salt := make([]byte, hash().Size())
- n, err := io.ReadFull(rand.Reader, salt)
- if n != len(salt) || err != nil {
- fmt.Println("error:", err)
- return
- }
-
- // Non secret context specific info, optional (can be nil).
- // Note, independent from the master key.
- info := []byte{0x03, 0x14, 0x15, 0x92, 0x65}
-
- // Create the key derivation function
- hkdf := hkdf.New(hash, master, salt, info)
-
- // Generate the required keys
- keys := make([][]byte, 3)
- for i := 0; i < len(keys); i++ {
- keys[i] = make([]byte, 24)
- n, err := io.ReadFull(hkdf, keys[i])
- if n != len(keys[i]) || err != nil {
- fmt.Println("error:", err)
- return
- }
- }
-
- // Keys should contain 192 bit random keys
- for i := 1; i <= len(keys); i++ {
- fmt.Printf("Key #%d: %v\n", i, !bytes.Equal(keys[i-1], make([]byte, 24)))
- }
-
- // Output:
- // Key #1: true
- // Key #2: true
- // Key #3: true
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/hkdf_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/hkdf_test.go
deleted file mode 100644
index cee659bcdb9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/hkdf/hkdf_test.go
+++ /dev/null
@@ -1,370 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-package hkdf
-
-import (
- "bytes"
- "crypto/md5"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/sha512"
- "hash"
- "io"
- "testing"
-)
-
-type hkdfTest struct {
- hash func() hash.Hash
- master []byte
- salt []byte
- info []byte
- out []byte
-}
-
-var hkdfTests = []hkdfTest{
- // Tests from RFC 5869
- {
- sha256.New,
- []byte{
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- },
- []byte{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c,
- },
- []byte{
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9,
- },
- []byte{
- 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a,
- 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a,
- 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c,
- 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf,
- 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18,
- 0x58, 0x65,
- },
- },
- {
- sha256.New,
- []byte{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- },
- []byte{
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- },
- []byte{
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
- },
- []byte{
- 0xb1, 0x1e, 0x39, 0x8d, 0xc8, 0x03, 0x27, 0xa1,
- 0xc8, 0xe7, 0xf7, 0x8c, 0x59, 0x6a, 0x49, 0x34,
- 0x4f, 0x01, 0x2e, 0xda, 0x2d, 0x4e, 0xfa, 0xd8,
- 0xa0, 0x50, 0xcc, 0x4c, 0x19, 0xaf, 0xa9, 0x7c,
- 0x59, 0x04, 0x5a, 0x99, 0xca, 0xc7, 0x82, 0x72,
- 0x71, 0xcb, 0x41, 0xc6, 0x5e, 0x59, 0x0e, 0x09,
- 0xda, 0x32, 0x75, 0x60, 0x0c, 0x2f, 0x09, 0xb8,
- 0x36, 0x77, 0x93, 0xa9, 0xac, 0xa3, 0xdb, 0x71,
- 0xcc, 0x30, 0xc5, 0x81, 0x79, 0xec, 0x3e, 0x87,
- 0xc1, 0x4c, 0x01, 0xd5, 0xc1, 0xf3, 0x43, 0x4f,
- 0x1d, 0x87,
- },
- },
- {
- sha256.New,
- []byte{
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- },
- []byte{},
- []byte{},
- []byte{
- 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f,
- 0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31,
- 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e,
- 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d,
- 0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a,
- 0x96, 0xc8,
- },
- },
- {
- sha1.New,
- []byte{
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b,
- },
- []byte{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c,
- },
- []byte{
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9,
- },
- []byte{
- 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69,
- 0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81,
- 0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15,
- 0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2,
- 0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3,
- 0xf8, 0x96,
- },
- },
- {
- sha1.New,
- []byte{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- },
- []byte{
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- },
- []byte{
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
- },
- []byte{
- 0x0b, 0xd7, 0x70, 0xa7, 0x4d, 0x11, 0x60, 0xf7,
- 0xc9, 0xf1, 0x2c, 0xd5, 0x91, 0x2a, 0x06, 0xeb,
- 0xff, 0x6a, 0xdc, 0xae, 0x89, 0x9d, 0x92, 0x19,
- 0x1f, 0xe4, 0x30, 0x56, 0x73, 0xba, 0x2f, 0xfe,
- 0x8f, 0xa3, 0xf1, 0xa4, 0xe5, 0xad, 0x79, 0xf3,
- 0xf3, 0x34, 0xb3, 0xb2, 0x02, 0xb2, 0x17, 0x3c,
- 0x48, 0x6e, 0xa3, 0x7c, 0xe3, 0xd3, 0x97, 0xed,
- 0x03, 0x4c, 0x7f, 0x9d, 0xfe, 0xb1, 0x5c, 0x5e,
- 0x92, 0x73, 0x36, 0xd0, 0x44, 0x1f, 0x4c, 0x43,
- 0x00, 0xe2, 0xcf, 0xf0, 0xd0, 0x90, 0x0b, 0x52,
- 0xd3, 0xb4,
- },
- },
- {
- sha1.New,
- []byte{
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- },
- []byte{},
- []byte{},
- []byte{
- 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61,
- 0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06,
- 0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06,
- 0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0,
- 0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3,
- 0x49, 0x18,
- },
- },
- {
- sha1.New,
- []byte{
- 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
- },
- nil,
- []byte{},
- []byte{
- 0x2c, 0x91, 0x11, 0x72, 0x04, 0xd7, 0x45, 0xf3,
- 0x50, 0x0d, 0x63, 0x6a, 0x62, 0xf6, 0x4f, 0x0a,
- 0xb3, 0xba, 0xe5, 0x48, 0xaa, 0x53, 0xd4, 0x23,
- 0xb0, 0xd1, 0xf2, 0x7e, 0xbb, 0xa6, 0xf5, 0xe5,
- 0x67, 0x3a, 0x08, 0x1d, 0x70, 0xcc, 0xe7, 0xac,
- 0xfc, 0x48,
- },
- },
-}
-
-func TestHKDF(t *testing.T) {
- for i, tt := range hkdfTests {
- hkdf := New(tt.hash, tt.master, tt.salt, tt.info)
- out := make([]byte, len(tt.out))
-
- n, err := io.ReadFull(hkdf, out)
- if n != len(tt.out) || err != nil {
- t.Errorf("test %d: not enough output bytes: %d.", i, n)
- }
-
- if !bytes.Equal(out, tt.out) {
- t.Errorf("test %d: incorrect output: have %v, need %v.", i, out, tt.out)
- }
- }
-}
-
-func TestHKDFMultiRead(t *testing.T) {
- for i, tt := range hkdfTests {
- hkdf := New(tt.hash, tt.master, tt.salt, tt.info)
- out := make([]byte, len(tt.out))
-
- for b := 0; b < len(tt.out); b++ {
- n, err := io.ReadFull(hkdf, out[b:b+1])
- if n != 1 || err != nil {
- t.Errorf("test %d.%d: not enough output bytes: have %d, need %d .", i, b, n, len(tt.out))
- }
- }
-
- if !bytes.Equal(out, tt.out) {
- t.Errorf("test %d: incorrect output: have %v, need %v.", i, out, tt.out)
- }
- }
-}
-
-func TestHKDFLimit(t *testing.T) {
- hash := sha1.New
- master := []byte{0x00, 0x01, 0x02, 0x03}
- info := []byte{}
-
- hkdf := New(hash, master, nil, info)
- limit := hash().Size() * 255
- out := make([]byte, limit)
-
- // The maximum output bytes should be extractable
- n, err := io.ReadFull(hkdf, out)
- if n != limit || err != nil {
- t.Errorf("not enough output bytes: %d, %v.", n, err)
- }
-
- // Reading one more should fail
- n, err = io.ReadFull(hkdf, make([]byte, 1))
- if n > 0 || err == nil {
- t.Errorf("key expansion overflowed: n = %d, err = %v", n, err)
- }
-}
-
-func Benchmark16ByteMD5Single(b *testing.B) {
- benchmarkHKDFSingle(md5.New, 16, b)
-}
-
-func Benchmark20ByteSHA1Single(b *testing.B) {
- benchmarkHKDFSingle(sha1.New, 20, b)
-}
-
-func Benchmark32ByteSHA256Single(b *testing.B) {
- benchmarkHKDFSingle(sha256.New, 32, b)
-}
-
-func Benchmark64ByteSHA512Single(b *testing.B) {
- benchmarkHKDFSingle(sha512.New, 64, b)
-}
-
-func Benchmark8ByteMD5Stream(b *testing.B) {
- benchmarkHKDFStream(md5.New, 8, b)
-}
-
-func Benchmark16ByteMD5Stream(b *testing.B) {
- benchmarkHKDFStream(md5.New, 16, b)
-}
-
-func Benchmark8ByteSHA1Stream(b *testing.B) {
- benchmarkHKDFStream(sha1.New, 8, b)
-}
-
-func Benchmark20ByteSHA1Stream(b *testing.B) {
- benchmarkHKDFStream(sha1.New, 20, b)
-}
-
-func Benchmark8ByteSHA256Stream(b *testing.B) {
- benchmarkHKDFStream(sha256.New, 8, b)
-}
-
-func Benchmark32ByteSHA256Stream(b *testing.B) {
- benchmarkHKDFStream(sha256.New, 32, b)
-}
-
-func Benchmark8ByteSHA512Stream(b *testing.B) {
- benchmarkHKDFStream(sha512.New, 8, b)
-}
-
-func Benchmark64ByteSHA512Stream(b *testing.B) {
- benchmarkHKDFStream(sha512.New, 64, b)
-}
-
-func benchmarkHKDFSingle(hasher func() hash.Hash, block int, b *testing.B) {
- master := []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
- salt := []byte{0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17}
- info := []byte{0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27}
- out := make([]byte, block)
-
- b.SetBytes(int64(block))
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- hkdf := New(hasher, master, salt, info)
- io.ReadFull(hkdf, out)
- }
-}
-
-func benchmarkHKDFStream(hasher func() hash.Hash, block int, b *testing.B) {
- master := []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
- salt := []byte{0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17}
- info := []byte{0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27}
- out := make([]byte, block)
-
- b.SetBytes(int64(block))
- b.ResetTimer()
-
- hkdf := New(hasher, master, salt, info)
- for i := 0; i < b.N; i++ {
- _, err := io.ReadFull(hkdf, out)
- if err != nil {
- hkdf = New(hasher, master, salt, info)
- i--
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/md4/md4_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/md4/md4_test.go
deleted file mode 100644
index b56edd7875d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/md4/md4_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package md4
-
-import (
- "fmt"
- "io"
- "testing"
-)
-
-type md4Test struct {
- out string
- in string
-}
-
-var golden = []md4Test{
- {"31d6cfe0d16ae931b73c59d7e0c089c0", ""},
- {"bde52cb31de33e46245e05fbdbd6fb24", "a"},
- {"ec388dd78999dfc7cf4632465693b6bf", "ab"},
- {"a448017aaf21d8525fc10ae87aa6729d", "abc"},
- {"41decd8f579255c5200f86a4bb3ba740", "abcd"},
- {"9803f4a34e8eb14f96adba49064a0c41", "abcde"},
- {"804e7f1c2586e50b49ac65db5b645131", "abcdef"},
- {"752f4adfe53d1da0241b5bc216d098fc", "abcdefg"},
- {"ad9daf8d49d81988590a6f0e745d15dd", "abcdefgh"},
- {"1e4e28b05464316b56402b3815ed2dfd", "abcdefghi"},
- {"dc959c6f5d6f9e04e4380777cc964b3d", "abcdefghij"},
- {"1b5701e265778898ef7de5623bbe7cc0", "Discard medicine more than two years old."},
- {"d7f087e090fe7ad4a01cb59dacc9a572", "He who has a shady past knows that nice guys finish last."},
- {"a6f8fd6df617c72837592fc3570595c9", "I wouldn't marry him with a ten foot pole."},
- {"c92a84a9526da8abc240c05d6b1a1ce0", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
- {"f6013160c4dcb00847069fee3bb09803", "The days of the digital watch are numbered. -Tom Stoppard"},
- {"2c3bb64f50b9107ed57640fe94bec09f", "Nepal premier won't resign."},
- {"45b7d8a32c7806f2f7f897332774d6e4", "For every action there is an equal and opposite government program."},
- {"b5b4f9026b175c62d7654bdc3a1cd438", "His money is twice tainted: 'taint yours and 'taint mine."},
- {"caf44e80f2c20ce19b5ba1cab766e7bd", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
- {"191fae6707f496aa54a6bce9f2ecf74d", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
- {"9ddc753e7a4ccee6081cd1b45b23a834", "size: a.out: bad magic"},
- {"8d050f55b1cadb9323474564be08a521", "The major problem is with sendmail. -Mark Horton"},
- {"ad6e2587f74c3e3cc19146f6127fa2e3", "Give me a rock, paper and scissors and I will move the world. CCFestoon"},
- {"1d616d60a5fabe85589c3f1566ca7fca", "If the enemy is within range, then so are you."},
- {"aec3326a4f496a2ced65a1963f84577f", "It's well we cannot hear the screams/That we create in others' dreams."},
- {"77b4fd762d6b9245e61c50bf6ebf118b", "You remind me of a TV show, but that's all right: I watch it anyway."},
- {"e8f48c726bae5e516f6ddb1a4fe62438", "C is as portable as Stonehedge!!"},
- {"a3a84366e7219e887423b01f9be7166e", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
- {"a6b7aa35157e984ef5d9b7f32e5fbb52", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"},
- {"75661f0545955f8f9abeeb17845f3fd6", "How can you write a big system without C++? -Paul Glick"},
-}
-
-func TestGolden(t *testing.T) {
- for i := 0; i < len(golden); i++ {
- g := golden[i]
- c := New()
- for j := 0; j < 3; j++ {
- if j < 2 {
- io.WriteString(c, g.in)
- } else {
- io.WriteString(c, g.in[0:len(g.in)/2])
- c.Sum(nil)
- io.WriteString(c, g.in[len(g.in)/2:])
- }
- s := fmt.Sprintf("%x", c.Sum(nil))
- if s != g.out {
- t.Fatalf("md4[%d](%s) = %s want %s", j, g.in, s, g.out)
- }
- c.Reset()
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/box/box_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/box/box_test.go
deleted file mode 100644
index 481ade28aec..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/box/box_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package box
-
-import (
- "bytes"
- "crypto/rand"
- "encoding/hex"
- "testing"
-
- "golang.org/x/crypto/curve25519"
-)
-
-func TestSealOpen(t *testing.T) {
- publicKey1, privateKey1, _ := GenerateKey(rand.Reader)
- publicKey2, privateKey2, _ := GenerateKey(rand.Reader)
-
- if *privateKey1 == *privateKey2 {
- t.Fatalf("private keys are equal!")
- }
- if *publicKey1 == *publicKey2 {
- t.Fatalf("public keys are equal!")
- }
- message := []byte("test message")
- var nonce [24]byte
-
- box := Seal(nil, message, &nonce, publicKey1, privateKey2)
- opened, ok := Open(nil, box, &nonce, publicKey2, privateKey1)
- if !ok {
- t.Fatalf("failed to open box")
- }
-
- if !bytes.Equal(opened, message) {
- t.Fatalf("got %x, want %x", opened, message)
- }
-
- for i := range box {
- box[i] ^= 0x40
- _, ok := Open(nil, box, &nonce, publicKey2, privateKey1)
- if ok {
- t.Fatalf("opened box with byte %d corrupted", i)
- }
- box[i] ^= 0x40
- }
-}
-
-func TestBox(t *testing.T) {
- var privateKey1, privateKey2 [32]byte
- for i := range privateKey1[:] {
- privateKey1[i] = 1
- }
- for i := range privateKey2[:] {
- privateKey2[i] = 2
- }
-
- var publicKey1 [32]byte
- curve25519.ScalarBaseMult(&publicKey1, &privateKey1)
- var message [64]byte
- for i := range message[:] {
- message[i] = 3
- }
-
- var nonce [24]byte
- for i := range nonce[:] {
- nonce[i] = 4
- }
-
- box := Seal(nil, message[:], &nonce, &publicKey1, &privateKey2)
-
- // expected was generated using the C implementation of NaCl.
- expected, _ := hex.DecodeString("78ea30b19d2341ebbdba54180f821eec265cf86312549bea8a37652a8bb94f07b78a73ed1708085e6ddd0e943bbdeb8755079a37eb31d86163ce241164a47629c0539f330b4914cd135b3855bc2a2dfc")
-
- if !bytes.Equal(box, expected) {
- t.Fatalf("box didn't match, got\n%x\n, expected\n%x", box, expected)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/secretbox/secretbox_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/secretbox/secretbox_test.go
deleted file mode 100644
index 664dc1521d3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/nacl/secretbox/secretbox_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package secretbox
-
-import (
- "bytes"
- "crypto/rand"
- "encoding/hex"
- "testing"
-)
-
-func TestSealOpen(t *testing.T) {
- var key [32]byte
- var nonce [24]byte
-
- rand.Reader.Read(key[:])
- rand.Reader.Read(nonce[:])
-
- var box, opened []byte
-
- for msgLen := 0; msgLen < 128; msgLen += 17 {
- message := make([]byte, msgLen)
- rand.Reader.Read(message)
-
- box = Seal(box[:0], message, &nonce, &key)
- var ok bool
- opened, ok = Open(opened[:0], box, &nonce, &key)
- if !ok {
- t.Errorf("%d: failed to open box", msgLen)
- continue
- }
-
- if !bytes.Equal(opened, message) {
- t.Errorf("%d: got %x, expected %x", msgLen, opened, message)
- continue
- }
- }
-
- for i := range box {
- box[i] ^= 0x20
- _, ok := Open(opened[:0], box, &nonce, &key)
- if ok {
- t.Errorf("box was opened after corrupting byte %d", i)
- }
- box[i] ^= 0x20
- }
-}
-
-func TestSecretBox(t *testing.T) {
- var key [32]byte
- var nonce [24]byte
- var message [64]byte
-
- for i := range key[:] {
- key[i] = 1
- }
- for i := range nonce[:] {
- nonce[i] = 2
- }
- for i := range message[:] {
- message[i] = 3
- }
-
- box := Seal(nil, message[:], &nonce, &key)
- // expected was generated using the C implementation of NaCl.
- expected, _ := hex.DecodeString("8442bc313f4626f1359e3b50122b6ce6fe66ddfe7d39d14e637eb4fd5b45beadab55198df6ab5368439792a23c87db70acb6156dc5ef957ac04f6276cf6093b84be77ff0849cc33e34b7254d5a8f65ad")
-
- if !bytes.Equal(box, expected) {
- t.Fatalf("box didn't match, got\n%x\n, expected\n%x", box, expected)
- }
-}
-
-func TestAppend(t *testing.T) {
- var key [32]byte
- var nonce [24]byte
- var message [8]byte
-
- out := make([]byte, 4)
- box := Seal(out, message[:], &nonce, &key)
- if !bytes.Equal(box[:4], out[:4]) {
- t.Fatalf("Seal didn't correctly append")
- }
-
- out = make([]byte, 4, 100)
- box = Seal(out, message[:], &nonce, &key)
- if !bytes.Equal(box[:4], out[:4]) {
- t.Fatalf("Seal didn't correctly append with sufficient capacity.")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ocsp/ocsp_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ocsp/ocsp_test.go
deleted file mode 100644
index 33868497381..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ocsp/ocsp_test.go
+++ /dev/null
@@ -1,584 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ocsp
-
-import (
- "bytes"
- "crypto"
- "crypto/sha1"
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/asn1"
- "encoding/hex"
- "math/big"
- "reflect"
- "testing"
- "time"
-)
-
-func TestOCSPDecode(t *testing.T) {
- responseBytes, _ := hex.DecodeString(ocspResponseHex)
- resp, err := ParseResponse(responseBytes, nil)
- if err != nil {
- t.Error(err)
- }
-
- expected := Response{
- Status: Good,
- SerialNumber: big.NewInt(0x1d0fa),
- RevocationReason: Unspecified,
- ThisUpdate: time.Date(2010, 7, 7, 15, 1, 5, 0, time.UTC),
- NextUpdate: time.Date(2010, 7, 7, 18, 35, 17, 0, time.UTC),
- }
-
- if !reflect.DeepEqual(resp.ThisUpdate, expected.ThisUpdate) {
- t.Errorf("resp.ThisUpdate: got %d, want %d", resp.ThisUpdate, expected.ThisUpdate)
- }
-
- if !reflect.DeepEqual(resp.NextUpdate, expected.NextUpdate) {
- t.Errorf("resp.NextUpdate: got %d, want %d", resp.NextUpdate, expected.NextUpdate)
- }
-
- if resp.Status != expected.Status {
- t.Errorf("resp.Status: got %d, want %d", resp.Status, expected.Status)
- }
-
- if resp.SerialNumber.Cmp(expected.SerialNumber) != 0 {
- t.Errorf("resp.SerialNumber: got %x, want %x", resp.SerialNumber, expected.SerialNumber)
- }
-
- if resp.RevocationReason != expected.RevocationReason {
- t.Errorf("resp.RevocationReason: got %d, want %d", resp.RevocationReason, expected.RevocationReason)
- }
-}
-
-func TestOCSPDecodeWithoutCert(t *testing.T) {
- responseBytes, _ := hex.DecodeString(ocspResponseWithoutCertHex)
- _, err := ParseResponse(responseBytes, nil)
- if err != nil {
- t.Error(err)
- }
-}
-
-func TestOCSPDecodeWithExtensions(t *testing.T) {
- responseBytes, _ := hex.DecodeString(ocspResponseWithCriticalExtensionHex)
- _, err := ParseResponse(responseBytes, nil)
- if err == nil {
- t.Error(err)
- }
-
- responseBytes, _ = hex.DecodeString(ocspResponseWithExtensionHex)
- response, err := ParseResponse(responseBytes, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(response.Extensions) != 1 {
- t.Errorf("len(response.Extensions): got %v, want %v", len(response.Extensions), 1)
- }
-
- extensionBytes := response.Extensions[0].Value
- expectedBytes, _ := hex.DecodeString(ocspExtensionValueHex)
- if !bytes.Equal(extensionBytes, expectedBytes) {
- t.Errorf("response.Extensions[0]: got %x, want %x", extensionBytes, expectedBytes)
- }
-}
-
-func TestOCSPSignature(t *testing.T) {
- issuerCert, _ := hex.DecodeString(startComHex)
- issuer, err := x509.ParseCertificate(issuerCert)
- if err != nil {
- t.Fatal(err)
- }
-
- response, _ := hex.DecodeString(ocspResponseHex)
- if _, err := ParseResponse(response, issuer); err != nil {
- t.Error(err)
- }
-}
-
-func TestOCSPRequest(t *testing.T) {
- leafCert, _ := hex.DecodeString(leafCertHex)
- cert, err := x509.ParseCertificate(leafCert)
- if err != nil {
- t.Fatal(err)
- }
-
- issuerCert, _ := hex.DecodeString(issuerCertHex)
- issuer, err := x509.ParseCertificate(issuerCert)
- if err != nil {
- t.Fatal(err)
- }
-
- request, err := CreateRequest(cert, issuer, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- expectedBytes, _ := hex.DecodeString(ocspRequestHex)
- if !bytes.Equal(request, expectedBytes) {
- t.Errorf("request: got %x, wanted %x", request, expectedBytes)
- }
-
- decodedRequest, err := ParseRequest(expectedBytes)
- if err != nil {
- t.Fatal(err)
- }
-
- if decodedRequest.HashAlgorithm != crypto.SHA1 {
- t.Errorf("request.HashAlgorithm: got %v, want %v", decodedRequest.HashAlgorithm, crypto.SHA1)
- }
-
- var publicKeyInfo struct {
- Algorithm pkix.AlgorithmIdentifier
- PublicKey asn1.BitString
- }
- _, err = asn1.Unmarshal(issuer.RawSubjectPublicKeyInfo, &publicKeyInfo)
- if err != nil {
- t.Fatal(err)
- }
-
- h := sha1.New()
- h.Write(publicKeyInfo.PublicKey.RightAlign())
- issuerKeyHash := h.Sum(nil)
-
- h.Reset()
- h.Write(issuer.RawSubject)
- issuerNameHash := h.Sum(nil)
-
- if got := decodedRequest.IssuerKeyHash; !bytes.Equal(got, issuerKeyHash) {
- t.Errorf("request.IssuerKeyHash: got %x, want %x", got, issuerKeyHash)
- }
-
- if got := decodedRequest.IssuerNameHash; !bytes.Equal(got, issuerNameHash) {
- t.Errorf("request.IssuerKeyHash: got %x, want %x", got, issuerNameHash)
- }
-
- if got := decodedRequest.SerialNumber; got.Cmp(cert.SerialNumber) != 0 {
- t.Errorf("request.SerialNumber: got %x, want %x", got, cert.SerialNumber)
- }
-}
-
-func TestOCSPResponse(t *testing.T) {
- leafCert, _ := hex.DecodeString(leafCertHex)
- leaf, err := x509.ParseCertificate(leafCert)
- if err != nil {
- t.Fatal(err)
- }
-
- issuerCert, _ := hex.DecodeString(issuerCertHex)
- issuer, err := x509.ParseCertificate(issuerCert)
- if err != nil {
- t.Fatal(err)
- }
-
- responderCert, _ := hex.DecodeString(responderCertHex)
- responder, err := x509.ParseCertificate(responderCert)
- if err != nil {
- t.Fatal(err)
- }
-
- responderPrivateKeyDER, _ := hex.DecodeString(responderPrivateKeyHex)
- responderPrivateKey, err := x509.ParsePKCS1PrivateKey(responderPrivateKeyDER)
- if err != nil {
- t.Fatal(err)
- }
-
- extensionBytes, _ := hex.DecodeString(ocspExtensionValueHex)
- extensions := []pkix.Extension{
- pkix.Extension{
- Id: ocspExtensionOID,
- Critical: false,
- Value: extensionBytes,
- },
- }
-
- producedAt := time.Now().Truncate(time.Minute)
- thisUpdate := time.Date(2010, 7, 7, 15, 1, 5, 0, time.UTC)
- nextUpdate := time.Date(2010, 7, 7, 18, 35, 17, 0, time.UTC)
- template := Response{
- Status: Revoked,
- SerialNumber: leaf.SerialNumber,
- ThisUpdate: thisUpdate,
- NextUpdate: nextUpdate,
- RevokedAt: thisUpdate,
- RevocationReason: KeyCompromise,
- Certificate: responder,
- ExtraExtensions: extensions,
- }
-
- responseBytes, err := CreateResponse(issuer, responder, template, responderPrivateKey)
- if err != nil {
- t.Fatal(err)
- }
-
- resp, err := ParseResponse(responseBytes, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- if !reflect.DeepEqual(resp.ThisUpdate, template.ThisUpdate) {
- t.Errorf("resp.ThisUpdate: got %d, want %d", resp.ThisUpdate, template.ThisUpdate)
- }
-
- if !reflect.DeepEqual(resp.NextUpdate, template.NextUpdate) {
- t.Errorf("resp.NextUpdate: got %d, want %d", resp.NextUpdate, template.NextUpdate)
- }
-
- if !reflect.DeepEqual(resp.RevokedAt, template.RevokedAt) {
- t.Errorf("resp.RevokedAt: got %d, want %d", resp.RevokedAt, template.RevokedAt)
- }
-
- if !reflect.DeepEqual(resp.Extensions, template.ExtraExtensions) {
- t.Errorf("resp.Extensions: got %v, want %v", resp.Extensions, template.ExtraExtensions)
- }
-
- if !resp.ProducedAt.Equal(producedAt) {
- t.Errorf("resp.ProducedAt: got %d, want %d", resp.ProducedAt, producedAt)
- }
-
- if resp.Status != template.Status {
- t.Errorf("resp.Status: got %d, want %d", resp.Status, template.Status)
- }
-
- if resp.SerialNumber.Cmp(template.SerialNumber) != 0 {
- t.Errorf("resp.SerialNumber: got %x, want %x", resp.SerialNumber, template.SerialNumber)
- }
-
- if resp.RevocationReason != template.RevocationReason {
- t.Errorf("resp.RevocationReason: got %d, want %d", resp.RevocationReason, template.RevocationReason)
- }
-}
-
-func TestErrorResponse(t *testing.T) {
- responseBytes, _ := hex.DecodeString(errorResponseHex)
- _, err := ParseResponse(responseBytes, nil)
-
- respErr, ok := err.(ResponseError)
- if !ok {
- t.Fatalf("expected ResponseError from ParseResponse but got %#v", err)
- }
- if respErr.Status != Malformed {
- t.Fatalf("expected Malformed status from ParseResponse but got %d", respErr.Status)
- }
-}
-
-// This OCSP response was taken from Thawte's public OCSP responder.
-// To recreate:
-// $ openssl s_client -tls1 -showcerts -servername www.google.com -connect www.google.com:443
-// Copy and paste the first certificate into /tmp/cert.crt and the second into
-// /tmp/intermediate.crt
-// $ openssl ocsp -issuer /tmp/intermediate.crt -cert /tmp/cert.crt -url http://ocsp.thawte.com -resp_text -respout /tmp/ocsp.der
-// Then hex encode the result:
-// $ python -c 'print file("/tmp/ocsp.der", "r").read().encode("hex")'
-
-const ocspResponseHex = "308206bc0a0100a08206b5308206b106092b0601050507300101048206a23082069e3081" +
- "c9a14e304c310b300906035504061302494c31163014060355040a130d5374617274436f" +
- "6d204c74642e312530230603550403131c5374617274436f6d20436c6173732031204f43" +
- "5350205369676e6572180f32303130303730373137333531375a30663064303c30090605" +
- "2b0e03021a050004146568874f40750f016a3475625e1f5c93e5a26d580414eb4234d098" +
- "b0ab9ff41b6b08f7cc642eef0e2c45020301d0fa8000180f323031303037303731353031" +
- "30355aa011180f32303130303730373138333531375a300d06092a864886f70d01010505" +
- "000382010100ab557ff070d1d7cebbb5f0ec91a15c3fed22eb2e1b8244f1b84545f013a4" +
- "fb46214c5e3fbfbebb8a56acc2b9db19f68fd3c3201046b3824d5ba689f99864328710cb" +
- "467195eb37d84f539e49f859316b32964dc3e47e36814ce94d6c56dd02733b1d0802f7ff" +
- "4eebdbbd2927dcf580f16cbc290f91e81b53cb365e7223f1d6e20a88ea064104875e0145" +
- "672b20fc14829d51ca122f5f5d77d3ad6c83889c55c7dc43680ba2fe3cef8b05dbcabdc0" +
- "d3e09aaf9725597f8c858c2fa38c0d6aed2e6318194420dd1a1137445d13e1c97ab47896" +
- "17a4e08925f46f867b72e3a4dc1f08cb870b2b0717f7207faa0ac512e628a029aba7457a" +
- "e63dcf3281e2162d9349a08204ba308204b6308204b23082039aa003020102020101300d" +
- "06092a864886f70d010105050030818c310b300906035504061302494c31163014060355" +
- "040a130d5374617274436f6d204c74642e312b3029060355040b13225365637572652044" +
- "69676974616c204365727469666963617465205369676e696e6731383036060355040313" +
- "2f5374617274436f6d20436c6173732031205072696d61727920496e7465726d65646961" +
- "746520536572766572204341301e170d3037313032353030323330365a170d3132313032" +
- "333030323330365a304c310b300906035504061302494c31163014060355040a130d5374" +
- "617274436f6d204c74642e312530230603550403131c5374617274436f6d20436c617373" +
- "2031204f435350205369676e657230820122300d06092a864886f70d0101010500038201" +
- "0f003082010a0282010100b9561b4c45318717178084e96e178df2255e18ed8d8ecc7c2b" +
- "7b51a6c1c2e6bf0aa3603066f132fe10ae97b50e99fa24b83fc53dd2777496387d14e1c3" +
- "a9b6a4933e2ac12413d085570a95b8147414a0bc007c7bcf222446ef7f1a156d7ea1c577" +
- "fc5f0facdfd42eb0f5974990cb2f5cefebceef4d1bdc7ae5c1075c5a99a93171f2b0845b" +
- "4ff0864e973fcfe32f9d7511ff87a3e943410c90a4493a306b6944359340a9ca96f02b66" +
- "ce67f028df2980a6aaee8d5d5d452b8b0eb93f923cc1e23fcccbdbe7ffcb114d08fa7a6a" +
- "3c404f825d1a0e715935cf623a8c7b59670014ed0622f6089a9447a7a19010f7fe58f841" +
- "29a2765ea367824d1c3bb2fda308530203010001a382015c30820158300c0603551d1301" +
- "01ff04023000300b0603551d0f0404030203a8301e0603551d250417301506082b060105" +
- "0507030906092b0601050507300105301d0603551d0e0416041445e0a36695414c5dd449" +
- "bc00e33cdcdbd2343e173081a80603551d230481a030819d8014eb4234d098b0ab9ff41b" +
- "6b08f7cc642eef0e2c45a18181a47f307d310b300906035504061302494c311630140603" +
- "55040a130d5374617274436f6d204c74642e312b3029060355040b132253656375726520" +
- "4469676974616c204365727469666963617465205369676e696e67312930270603550403" +
- "13205374617274436f6d2043657274696669636174696f6e20417574686f726974798201" +
- "0a30230603551d12041c301a8618687474703a2f2f7777772e737461727473736c2e636f" +
- "6d2f302c06096086480186f842010d041f161d5374617274436f6d205265766f63617469" +
- "6f6e20417574686f72697479300d06092a864886f70d01010505000382010100182d2215" +
- "8f0fc0291324fa8574c49bb8ff2835085adcbf7b7fc4191c397ab6951328253fffe1e5ec" +
- "2a7da0d50fca1a404e6968481366939e666c0a6209073eca57973e2fefa9ed1718e8176f" +
- "1d85527ff522c08db702e3b2b180f1cbff05d98128252cf0f450f7dd2772f4188047f19d" +
- "c85317366f94bc52d60f453a550af58e308aaab00ced33040b62bf37f5b1ab2a4f7f0f80" +
- "f763bf4d707bc8841d7ad9385ee2a4244469260b6f2bf085977af9074796048ecc2f9d48" +
- "a1d24ce16e41a9941568fec5b42771e118f16c106a54ccc339a4b02166445a167902e75e" +
- "6d8620b0825dcd18a069b90fd851d10fa8effd409deec02860d26d8d833f304b10669b42"
-
-const startComHex = "308206343082041ca003020102020118300d06092a864886f70d0101050500307d310b30" +
- "0906035504061302494c31163014060355040a130d5374617274436f6d204c74642e312b" +
- "3029060355040b1322536563757265204469676974616c20436572746966696361746520" +
- "5369676e696e6731293027060355040313205374617274436f6d20436572746966696361" +
- "74696f6e20417574686f72697479301e170d3037313032343230353431375a170d313731" +
- "3032343230353431375a30818c310b300906035504061302494c31163014060355040a13" +
- "0d5374617274436f6d204c74642e312b3029060355040b13225365637572652044696769" +
- "74616c204365727469666963617465205369676e696e67313830360603550403132f5374" +
- "617274436f6d20436c6173732031205072696d61727920496e7465726d65646961746520" +
- "53657276657220434130820122300d06092a864886f70d01010105000382010f00308201" +
- "0a0282010100b689c6acef09527807ac9263d0f44418188480561f91aee187fa3250b4d3" +
- "4706f0e6075f700e10f71dc0ce103634855a0f92ac83c6ac58523fba38e8fce7a724e240" +
- "a60876c0926e9e2a6d4d3f6e61200adb59ded27d63b33e46fefa215118d7cd30a6ed076e" +
- "3b7087b4f9faebee823c056f92f7a4dc0a301e9373fe07cad75f809d225852ae06da8b87" +
- "2369b0e42ad8ea83d2bdf371db705a280faf5a387045123f304dcd3baf17e50fcba0a95d" +
- "48aab16150cb34cd3c5cc30be810c08c9bf0030362feb26c3e720eee1c432ac9480e5739" +
- "c43121c810c12c87fe5495521f523c31129b7fe7c0a0a559d5e28f3ef0d5a8e1d77031a9" +
- "c4b3cfaf6d532f06f4a70203010001a38201ad308201a9300f0603551d130101ff040530" +
- "030101ff300e0603551d0f0101ff040403020106301d0603551d0e04160414eb4234d098" +
- "b0ab9ff41b6b08f7cc642eef0e2c45301f0603551d230418301680144e0bef1aa4405ba5" +
- "17698730ca346843d041aef2306606082b06010505070101045a3058302706082b060105" +
- "05073001861b687474703a2f2f6f6373702e737461727473736c2e636f6d2f6361302d06" +
- "082b060105050730028621687474703a2f2f7777772e737461727473736c2e636f6d2f73" +
- "667363612e637274305b0603551d1f045430523027a025a0238621687474703a2f2f7777" +
- "772e737461727473736c2e636f6d2f73667363612e63726c3027a025a023862168747470" +
- "3a2f2f63726c2e737461727473736c2e636f6d2f73667363612e63726c3081800603551d" +
- "20047930773075060b2b0601040181b5370102013066302e06082b060105050702011622" +
- "687474703a2f2f7777772e737461727473736c2e636f6d2f706f6c6963792e7064663034" +
- "06082b060105050702011628687474703a2f2f7777772e737461727473736c2e636f6d2f" +
- "696e7465726d6564696174652e706466300d06092a864886f70d01010505000382020100" +
- "2109493ea5886ee00b8b48da314d8ff75657a2e1d36257e9b556f38545753be5501f048b" +
- "e6a05a3ee700ae85d0fbff200364cbad02e1c69172f8a34dd6dee8cc3fa18aa2e37c37a7" +
- "c64f8f35d6f4d66e067bdd21d9cf56ffcb302249fe8904f385e5aaf1e71fe875904dddf9" +
- "46f74234f745580c110d84b0c6da5d3ef9019ee7e1da5595be741c7bfc4d144fac7e5547" +
- "7d7bf4a50d491e95e8f712c1ccff76a62547d0f37535be97b75816ebaa5c786fec5330af" +
- "ea044dcca902e3f0b60412f630b1113d904e5664d7dc3c435f7339ef4baf87ebf6fe6888" +
- "4472ead207c669b0c1a18bef1749d761b145485f3b2021e95bb2ccf4d7e931f50b15613b" +
- "7a94e3ebd9bc7f94ae6ae3626296a8647cb887f399327e92a252bebbf865cfc9f230fc8b" +
- "c1c2a696d75f89e15c3480f58f47072fb491bfb1a27e5f4b5ad05b9f248605515a690365" +
- "434971c5e06f94346bf61bd8a9b04c7e53eb8f48dfca33b548fa364a1a53a6330cd089cd" +
- "4915cd89313c90c072d7654b52358a461144b93d8e2865a63e799e5c084429adb035112e" +
- "214eb8d2e7103e5d8483b3c3c2e4d2c6fd094b7409ddf1b3d3193e800da20b19f038e7c5" +
- "c2afe223db61e29d5c6e2089492e236ab262c145b49faf8ba7f1223bf87de290d07a19fb" +
- "4a4ce3d27d5f4a8303ed27d6239e6b8db459a2d9ef6c8229dd75193c3f4c108defbb7527" +
- "d2ae83a7a8ce5ba7"
-
-const ocspResponseWithoutCertHex = "308201d40a0100a08201cd308201c906092b0601050507300101048201ba3082" +
- "01b630819fa2160414884451ff502a695e2d88f421bad90cf2cecbea7c180f3230313330" +
- "3631383037323434335a30743072304a300906052b0e03021a0500041448b60d38238df8" +
- "456e4ee5843ea394111802979f0414884451ff502a695e2d88f421bad90cf2cecbea7c02" +
- "1100f78b13b946fc9635d8ab49de9d2148218000180f3230313330363138303732343433" +
- "5aa011180f32303133303632323037323434335a300d06092a864886f70d010105050003" +
- "82010100103e18b3d297a5e7a6c07a4fc52ac46a15c0eba96f3be17f0ffe84de5b8c8e05" +
- "5a8f577586a849dc4abd6440eb6fedde4622451e2823c1cbf3558b4e8184959c9fe96eff" +
- "8bc5f95866c58c6d087519faabfdae37e11d9874f1bc0db292208f645dd848185e4dd38b" +
- "6a8547dfa7b74d514a8470015719064d35476b95bebb03d4d2845c5ca15202d2784878f2" +
- "0f904c24f09736f044609e9c271381713400e563023d212db422236440c6f377bbf24b2b" +
- "9e7dec8698e36a8df68b7592ad3489fb2937afb90eb85d2aa96b81c94c25057dbd4759d9" +
- "20a1a65c7f0b6427a224b3c98edd96b9b61f706099951188b0289555ad30a216fb774651" +
- "5a35fca2e054dfa8"
-
-// PKIX nonce extension
-var ocspExtensionOID = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 1, 2}
-var ocspExtensionValueHex = "0403000000"
-
-const ocspResponseWithCriticalExtensionHex = "308204fe0a0100a08204f7308204f306092b0601050507300101048204e4308204e03081" +
- "dba003020100a11b3019311730150603550403130e4f43535020526573706f6e64657218" +
- "0f32303136303130343137303130305a3081a53081a23049300906052b0e03021a050004" +
- "14c0fe0278fc99188891b3f212e9c7e1b21ab7bfc004140dfc1df0a9e0f01ce7f2b21317" +
- "7e6f8d157cd4f60210017f77deb3bcbb235d44ccc7dba62e72a116180f32303130303730" +
- "373135303130355aa0030a0101180f32303130303730373135303130355aa011180f3230" +
- "3130303730373138333531375aa1193017301506092b06010505073001020101ff040504" +
- "03000000300d06092a864886f70d01010b0500038201010031c730ca60a7a0d92d8e4010" +
- "911b469de95b4d27e89de6537552436237967694f76f701cf6b45c932bd308bca4a8d092" +
- "5c604ba94796903091d9e6c000178e72c1f0a24a277dd262835af5d17d3f9d7869606c9f" +
- "e7c8e708a41645699895beee38bfa63bb46296683761c5d1d65439b8ab868dc3017c9eeb" +
- "b70b82dbf3a31c55b457d48bb9e82b335ed49f445042eaf606b06a3e0639824924c89c63" +
- "eccddfe85e6694314138b2536f5e15e07085d0f6e26d4b2f8244bab0d70de07283ac6384" +
- "a0501fc3dea7cf0adfd4c7f34871080900e252ddc403e3f0265f2a704af905d3727504ed" +
- "28f3214a219d898a022463c78439799ca81c8cbafdbcec34ea937cd6a08202ea308202e6" +
- "308202e2308201caa003020102020101300d06092a864886f70d01010b05003019311730" +
- "150603550403130e4f43535020526573706f6e646572301e170d31353031333031353530" +
- "33335a170d3136303133303135353033335a3019311730150603550403130e4f43535020" +
- "526573706f6e64657230820122300d06092a864886f70d01010105000382010f00308201" +
- "0a0282010100e8155f2d3e6f2e8d14c62a788bd462f9f844e7a6977c83ef1099f0f6616e" +
- "c5265b56f356e62c5400f0b06a2e7945a82752c636df32a895152d6074df1701dc6ccfbc" +
- "bec75a70bd2b55ae2be7e6cad3b5fd4cd5b7790ab401a436d3f5f346074ffde8a99d5b72" +
- "3350f0a112076614b12ef79c78991b119453445acf2416ab0046b540db14c9fc0f27b898" +
- "9ad0f63aa4b8aefc91aa8a72160c36307c60fec78a93d3fddf4259902aa77e7332971c7d" +
- "285b6a04f648993c6922a3e9da9adf5f81508c3228791843e5d49f24db2f1290bafd97e6" +
- "55b1049a199f652cd603c4fafa330c390b0da78fbbc67e8fa021cbd74eb96222b12ace31" +
- "a77dcf920334dc94581b0203010001a3353033300e0603551d0f0101ff04040302078030" +
- "130603551d25040c300a06082b06010505070309300c0603551d130101ff04023000300d" +
- "06092a864886f70d01010b05000382010100718012761b5063e18f0dc44644d8e6ab8612" +
- "31c15fd5357805425d82aec1de85bf6d3e30fce205e3e3b8b795bbe52e40a439286d2288" +
- "9064f4aeeb150359b9425f1da51b3a5c939018555d13ac42c565a0603786a919328f3267" +
- "09dce52c22ad958ecb7873b9771d1148b1c4be2efe80ba868919fc9f68b6090c2f33c156" +
- "d67156e42766a50b5d51e79637b7e58af74c2a951b1e642fa7741fec982cc937de37eff5" +
- "9e2005d5939bfc031589ca143e6e8ab83f40ee08cc20a6b4a95a318352c28d18528dcaf9" +
- "66705de17afa19d6e8ae91ddf33179d16ebb6ac2c69cae8373d408ebf8c55308be6c04d9" +
- "3a25439a94299a65a709756c7a3e568be049d5c38839"
-
-const ocspResponseWithExtensionHex = "308204fb0a0100a08204f4308204f006092b0601050507300101048204e1308204dd3081" +
- "d8a003020100a11b3019311730150603550403130e4f43535020526573706f6e64657218" +
- "0f32303136303130343136353930305a3081a230819f3049300906052b0e03021a050004" +
- "14c0fe0278fc99188891b3f212e9c7e1b21ab7bfc004140dfc1df0a9e0f01ce7f2b21317" +
- "7e6f8d157cd4f60210017f77deb3bcbb235d44ccc7dba62e72a116180f32303130303730" +
- "373135303130355aa0030a0101180f32303130303730373135303130355aa011180f3230" +
- "3130303730373138333531375aa1163014301206092b0601050507300102040504030000" +
- "00300d06092a864886f70d01010b05000382010100c09a33e0b2324c852421bb83f85ac9" +
- "9113f5426012bd2d2279a8166e9241d18a33c870894250622ffc7ed0c4601b16d624f90b" +
- "779265442cdb6868cf40ab304ab4b66e7315ed02cf663b1601d1d4751772b31bc299db23" +
- "9aebac78ed6797c06ed815a7a8d18d63cfbb609cafb47ec2e89e37db255216eb09307848" +
- "d01be0a3e943653c78212b96ff524b74c9ec456b17cdfb950cc97645c577b2e09ff41dde" +
- "b03afb3adaa381cc0f7c1d95663ef22a0f72f2c45613ae8e2b2d1efc96e8463c7d1d8a1d" +
- "7e3b35df8fe73a301fc3f804b942b2b3afa337ff105fc1462b7b1c1d75eb4566c8665e59" +
- "f80393b0adbf8004ff6c3327ed34f007cb4a3348a7d55e06e3a08202ea308202e6308202" +
- "e2308201caa003020102020101300d06092a864886f70d01010b05003019311730150603" +
- "550403130e4f43535020526573706f6e646572301e170d3135303133303135353033335a" +
- "170d3136303133303135353033335a3019311730150603550403130e4f43535020526573" +
- "706f6e64657230820122300d06092a864886f70d01010105000382010f003082010a0282" +
- "010100e8155f2d3e6f2e8d14c62a788bd462f9f844e7a6977c83ef1099f0f6616ec5265b" +
- "56f356e62c5400f0b06a2e7945a82752c636df32a895152d6074df1701dc6ccfbcbec75a" +
- "70bd2b55ae2be7e6cad3b5fd4cd5b7790ab401a436d3f5f346074ffde8a99d5b723350f0" +
- "a112076614b12ef79c78991b119453445acf2416ab0046b540db14c9fc0f27b8989ad0f6" +
- "3aa4b8aefc91aa8a72160c36307c60fec78a93d3fddf4259902aa77e7332971c7d285b6a" +
- "04f648993c6922a3e9da9adf5f81508c3228791843e5d49f24db2f1290bafd97e655b104" +
- "9a199f652cd603c4fafa330c390b0da78fbbc67e8fa021cbd74eb96222b12ace31a77dcf" +
- "920334dc94581b0203010001a3353033300e0603551d0f0101ff04040302078030130603" +
- "551d25040c300a06082b06010505070309300c0603551d130101ff04023000300d06092a" +
- "864886f70d01010b05000382010100718012761b5063e18f0dc44644d8e6ab861231c15f" +
- "d5357805425d82aec1de85bf6d3e30fce205e3e3b8b795bbe52e40a439286d22889064f4" +
- "aeeb150359b9425f1da51b3a5c939018555d13ac42c565a0603786a919328f326709dce5" +
- "2c22ad958ecb7873b9771d1148b1c4be2efe80ba868919fc9f68b6090c2f33c156d67156" +
- "e42766a50b5d51e79637b7e58af74c2a951b1e642fa7741fec982cc937de37eff59e2005" +
- "d5939bfc031589ca143e6e8ab83f40ee08cc20a6b4a95a318352c28d18528dcaf966705d" +
- "e17afa19d6e8ae91ddf33179d16ebb6ac2c69cae8373d408ebf8c55308be6c04d93a2543" +
- "9a94299a65a709756c7a3e568be049d5c38839"
-
-const ocspRequestHex = "3051304f304d304b3049300906052b0e03021a05000414c0fe0278fc99188891b3f212e9" +
- "c7e1b21ab7bfc004140dfc1df0a9e0f01ce7f2b213177e6f8d157cd4f60210017f77deb3" +
- "bcbb235d44ccc7dba62e72"
-
-const leafCertHex = "308203c830820331a0030201020210017f77deb3bcbb235d44ccc7dba62e72300d06092a" +
- "864886f70d01010505003081ba311f301d060355040a1316566572695369676e20547275" +
- "7374204e6574776f726b31173015060355040b130e566572695369676e2c20496e632e31" +
- "333031060355040b132a566572695369676e20496e7465726e6174696f6e616c20536572" +
- "766572204341202d20436c617373203331493047060355040b13407777772e7665726973" +
- "69676e2e636f6d2f43505320496e636f72702e6279205265662e204c494142494c495459" +
- "204c54442e286329393720566572695369676e301e170d3132303632313030303030305a" +
- "170d3133313233313233353935395a3068310b3009060355040613025553311330110603" +
- "550408130a43616c69666f726e6961311230100603550407130950616c6f20416c746f31" +
- "173015060355040a130e46616365626f6f6b2c20496e632e311730150603550403140e2a" +
- "2e66616365626f6f6b2e636f6d30819f300d06092a864886f70d010101050003818d0030" +
- "818902818100ae94b171e2deccc1693e051063240102e0689ae83c39b6b3e74b97d48d7b" +
- "23689100b0b496ee62f0e6d356bcf4aa0f50643402f5d1766aa972835a7564723f39bbef" +
- "5290ded9bcdbf9d3d55dfad23aa03dc604c54d29cf1d4b3bdbd1a809cfae47b44c7eae17" +
- "c5109bee24a9cf4a8d911bb0fd0415ae4c3f430aa12a557e2ae10203010001a382011e30" +
- "82011a30090603551d130402300030440603551d20043d303b3039060b6086480186f845" +
- "01071703302a302806082b06010505070201161c68747470733a2f2f7777772e76657269" +
- "7369676e2e636f6d2f727061303c0603551d1f043530333031a02fa02d862b687474703a" +
- "2f2f535652496e746c2d63726c2e766572697369676e2e636f6d2f535652496e746c2e63" +
- "726c301d0603551d250416301406082b0601050507030106082b06010505070302300b06" +
- "03551d0f0404030205a0303406082b0601050507010104283026302406082b0601050507" +
- "30018618687474703a2f2f6f6373702e766572697369676e2e636f6d30270603551d1104" +
- "20301e820e2a2e66616365626f6f6b2e636f6d820c66616365626f6f6b2e636f6d300d06" +
- "092a864886f70d0101050500038181005b6c2b75f8ed30aa51aad36aba595e555141951f" +
- "81a53b447910ac1f76ff78fc2781616b58f3122afc1c87010425e9ed43df1a7ba6498060" +
- "67e2688af03db58c7df4ee03309a6afc247ccb134dc33e54c6bc1d5133a532a73273b1d7" +
- "9cadc08e7e1a83116d34523340b0305427a21742827c98916698ee7eaf8c3bdd71700817"
-
-const issuerCertHex = "30820383308202eca003020102021046fcebbab4d02f0f926098233f93078f300d06092a" +
- "864886f70d0101050500305f310b300906035504061302555331173015060355040a130e" +
- "566572695369676e2c20496e632e31373035060355040b132e436c617373203320507562" +
- "6c6963205072696d6172792043657274696669636174696f6e20417574686f7269747930" +
- "1e170d3937303431373030303030305a170d3136313032343233353935395a3081ba311f" +
- "301d060355040a1316566572695369676e205472757374204e6574776f726b3117301506" +
- "0355040b130e566572695369676e2c20496e632e31333031060355040b132a5665726953" +
- "69676e20496e7465726e6174696f6e616c20536572766572204341202d20436c61737320" +
- "3331493047060355040b13407777772e766572697369676e2e636f6d2f43505320496e63" +
- "6f72702e6279205265662e204c494142494c495459204c54442e28632939372056657269" +
- "5369676e30819f300d06092a864886f70d010101050003818d0030818902818100d88280" +
- "e8d619027d1f85183925a2652be1bfd405d3bce6363baaf04c6c5bb6e7aa3c734555b2f1" +
- "bdea9742ed9a340a15d4a95cf54025ddd907c132b2756cc4cabba3fe56277143aa63f530" +
- "3e9328e5faf1093bf3b74d4e39f75c495ab8c11dd3b28afe70309542cbfe2b518b5a3c3a" +
- "f9224f90b202a7539c4f34e7ab04b27b6f0203010001a381e33081e0300f0603551d1304" +
- "0830060101ff02010030440603551d20043d303b3039060b6086480186f8450107010130" +
- "2a302806082b06010505070201161c68747470733a2f2f7777772e766572697369676e2e" +
- "636f6d2f43505330340603551d25042d302b06082b0601050507030106082b0601050507" +
- "030206096086480186f8420401060a6086480186f845010801300b0603551d0f04040302" +
- "0106301106096086480186f842010104040302010630310603551d1f042a30283026a024" +
- "a0228620687474703a2f2f63726c2e766572697369676e2e636f6d2f706361332e63726c" +
- "300d06092a864886f70d010105050003818100408e4997968a73dd8e4def3e61b7caa062" +
- "adf40e0abb753de26ed82cc7bff4b98c369bcaa2d09c724639f6a682036511c4bcbf2da6" +
- "f5d93b0ab598fab378b91ef22b4c62d5fdb27a1ddf33fd73f9a5d82d8c2aead1fcb028b6" +
- "e94948134b838a1b487b24f738de6f4154b8ab576b06dfc7a2d4a9f6f136628088f28b75" +
- "d68071"
-
-// Key and certificate for the OCSP responder were not taken from the Thawte
-// responder, since CreateResponse requires that we have the private key.
-// Instead, they were generated randomly.
-const responderPrivateKeyHex = "308204a40201000282010100e8155f2d3e6f2e8d14c62a788bd462f9f844e7a6977c83ef" +
- "1099f0f6616ec5265b56f356e62c5400f0b06a2e7945a82752c636df32a895152d6074df" +
- "1701dc6ccfbcbec75a70bd2b55ae2be7e6cad3b5fd4cd5b7790ab401a436d3f5f346074f" +
- "fde8a99d5b723350f0a112076614b12ef79c78991b119453445acf2416ab0046b540db14" +
- "c9fc0f27b8989ad0f63aa4b8aefc91aa8a72160c36307c60fec78a93d3fddf4259902aa7" +
- "7e7332971c7d285b6a04f648993c6922a3e9da9adf5f81508c3228791843e5d49f24db2f" +
- "1290bafd97e655b1049a199f652cd603c4fafa330c390b0da78fbbc67e8fa021cbd74eb9" +
- "6222b12ace31a77dcf920334dc94581b02030100010282010100bcf0b93d7238bda329a8" +
- "72e7149f61bcb37c154330ccb3f42a85c9002c2e2bdea039d77d8581cd19bed94078794e" +
- "56293d601547fc4bf6a2f9002fe5772b92b21b254403b403585e3130cc99ccf08f0ef81a" +
- "575b38f597ba4660448b54f44bfbb97072b5a2bf043bfeca828cf7741d13698e3f38162b" +
- "679faa646b82abd9a72c5c7d722c5fc577a76d2c2daac588accad18516d1bbad10b0dfa2" +
- "05cfe246b59e28608a43942e1b71b0c80498075121de5b900d727c31c42c78cf1db5c0aa" +
- "5b491e10ea4ed5c0962aaf2ae025dd81fa4ce490d9d6b4a4465411d8e542fc88617e5695" +
- "1aa4fc8ea166f2b4d0eb89ef17f2b206bd5f1014bf8fe0e71fe62f2cccf102818100f2dc" +
- "ddf878d553286daad68bac4070a82ffec3dc4666a2750f47879eec913f91836f1d976b60" +
- "daf9356e078446dafab5bd2e489e5d64f8572ba24a4ba4f3729b5e106c4dd831cc2497a7" +
- "e6c7507df05cb64aeb1bbc81c1e340d58b5964cf39cff84ea30c29ec5d3f005ee1362698" +
- "07395037955955655292c3e85f6187fa1f9502818100f4a33c102630840705f8c778a47b" +
- "87e8da31e68809af981ac5e5999cf1551685d761cdf0d6520361b99aebd5777a940fa64d" +
- "327c09fa63746fbb3247ec73a86edf115f1fe5c83598db803881ade71c33c6e956118345" +
- "497b98b5e07bb5be75971465ec78f2f9467e1b74956ca9d4c7c3e314e742a72d8b33889c" +
- "6c093a466cef0281801d3df0d02124766dd0be98349b19eb36a508c4e679e793ba0a8bef" +
- "4d786888c1e9947078b1ea28938716677b4ad8c5052af12eb73ac194915264a913709a0b" +
- "7b9f98d4a18edd781a13d49899f91c20dbd8eb2e61d991ba19b5cdc08893f5cb9d39e5a6" +
- "0629ea16d426244673b1b3ee72bd30e41fac8395acac40077403de5efd028180050731dd" +
- "d71b1a2b96c8d538ba90bb6b62c8b1c74c03aae9a9f59d21a7a82b0d572ef06fa9c807bf" +
- "c373d6b30d809c7871df96510c577421d9860c7383fda0919ece19996b3ca13562159193" +
- "c0c246471e287f975e8e57034e5136aaf44254e2650def3d51292474c515b1588969112e" +
- "0a85cc77073e9d64d2c2fc497844284b02818100d71d63eabf416cf677401ebf965f8314" +
- "120b568a57dd3bd9116c629c40dc0c6948bab3a13cc544c31c7da40e76132ef5dd3f7534" +
- "45a635930c74326ae3df0edd1bfb1523e3aa259873ac7cf1ac31151ec8f37b528c275622" +
- "48f99b8bed59fd4da2576aa6ee20d93a684900bf907e80c66d6e2261ae15e55284b4ed9d" +
- "6bdaa059"
-
-const responderCertHex = "308202e2308201caa003020102020101300d06092a864886f70d01010b05003019311730" +
- "150603550403130e4f43535020526573706f6e646572301e170d31353031333031353530" +
- "33335a170d3136303133303135353033335a3019311730150603550403130e4f43535020" +
- "526573706f6e64657230820122300d06092a864886f70d01010105000382010f00308201" +
- "0a0282010100e8155f2d3e6f2e8d14c62a788bd462f9f844e7a6977c83ef1099f0f6616e" +
- "c5265b56f356e62c5400f0b06a2e7945a82752c636df32a895152d6074df1701dc6ccfbc" +
- "bec75a70bd2b55ae2be7e6cad3b5fd4cd5b7790ab401a436d3f5f346074ffde8a99d5b72" +
- "3350f0a112076614b12ef79c78991b119453445acf2416ab0046b540db14c9fc0f27b898" +
- "9ad0f63aa4b8aefc91aa8a72160c36307c60fec78a93d3fddf4259902aa77e7332971c7d" +
- "285b6a04f648993c6922a3e9da9adf5f81508c3228791843e5d49f24db2f1290bafd97e6" +
- "55b1049a199f652cd603c4fafa330c390b0da78fbbc67e8fa021cbd74eb96222b12ace31" +
- "a77dcf920334dc94581b0203010001a3353033300e0603551d0f0101ff04040302078030" +
- "130603551d25040c300a06082b06010505070309300c0603551d130101ff04023000300d" +
- "06092a864886f70d01010b05000382010100718012761b5063e18f0dc44644d8e6ab8612" +
- "31c15fd5357805425d82aec1de85bf6d3e30fce205e3e3b8b795bbe52e40a439286d2288" +
- "9064f4aeeb150359b9425f1da51b3a5c939018555d13ac42c565a0603786a919328f3267" +
- "09dce52c22ad958ecb7873b9771d1148b1c4be2efe80ba868919fc9f68b6090c2f33c156" +
- "d67156e42766a50b5d51e79637b7e58af74c2a951b1e642fa7741fec982cc937de37eff5" +
- "9e2005d5939bfc031589ca143e6e8ab83f40ee08cc20a6b4a95a318352c28d18528dcaf9" +
- "66705de17afa19d6e8ae91ddf33179d16ebb6ac2c69cae8373d408ebf8c55308be6c04d9" +
- "3a25439a94299a65a709756c7a3e568be049d5c38839"
-
-const errorResponseHex = "30030a0101"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/armor/armor_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/armor/armor_test.go
deleted file mode 100644
index 9334e94e96c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/armor/armor_test.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package armor
-
-import (
- "bytes"
- "hash/adler32"
- "io/ioutil"
- "testing"
-)
-
-func TestDecodeEncode(t *testing.T) {
- buf := bytes.NewBuffer([]byte(armorExample1))
- result, err := Decode(buf)
- if err != nil {
- t.Error(err)
- }
- expectedType := "PGP SIGNATURE"
- if result.Type != expectedType {
- t.Errorf("result.Type: got:%s want:%s", result.Type, expectedType)
- }
- if len(result.Header) != 1 {
- t.Errorf("len(result.Header): got:%d want:1", len(result.Header))
- }
- v, ok := result.Header["Version"]
- if !ok || v != "GnuPG v1.4.10 (GNU/Linux)" {
- t.Errorf("result.Header: got:%#v", result.Header)
- }
-
- contents, err := ioutil.ReadAll(result.Body)
- if err != nil {
- t.Error(err)
- }
-
- if adler32.Checksum(contents) != 0x27b144be {
- t.Errorf("contents: got: %x", contents)
- }
-
- buf = bytes.NewBuffer(nil)
- w, err := Encode(buf, result.Type, result.Header)
- if err != nil {
- t.Error(err)
- }
- _, err = w.Write(contents)
- if err != nil {
- t.Error(err)
- }
- w.Close()
-
- if !bytes.Equal(buf.Bytes(), []byte(armorExample1)) {
- t.Errorf("got: %s\nwant: %s", string(buf.Bytes()), armorExample1)
- }
-}
-
-func TestLongHeader(t *testing.T) {
- buf := bytes.NewBuffer([]byte(armorLongLine))
- result, err := Decode(buf)
- if err != nil {
- t.Error(err)
- return
- }
- value, ok := result.Header["Version"]
- if !ok {
- t.Errorf("missing Version header")
- }
- if value != longValueExpected {
- t.Errorf("got: %s want: %s", value, longValueExpected)
- }
-}
-
-const armorExample1 = `-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.10 (GNU/Linux)
-
-iJwEAAECAAYFAk1Fv/0ACgkQo01+GMIMMbsYTwQAiAw+QAaNfY6WBdplZ/uMAccm
-4g+81QPmTSGHnetSb6WBiY13kVzK4HQiZH8JSkmmroMLuGeJwsRTEL4wbjRyUKEt
-p1xwUZDECs234F1xiG5enc5SGlRtP7foLBz9lOsjx+LEcA4sTl5/2eZR9zyFZqWW
-TxRjs+fJCIFuo71xb1g=
-=/teI
------END PGP SIGNATURE-----`
-
-const armorLongLine = `-----BEGIN PGP SIGNATURE-----
-Version: 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz
-
-iQEcBAABAgAGBQJMtFESAAoJEKsQXJGvOPsVj40H/1WW6jaMXv4BW+1ueDSMDwM8
-kx1fLOXbVM5/Kn5LStZNt1jWWnpxdz7eq3uiqeCQjmqUoRde3YbB2EMnnwRbAhpp
-cacnAvy9ZQ78OTxUdNW1mhX5bS6q1MTEJnl+DcyigD70HG/yNNQD7sOPMdYQw0TA
-byQBwmLwmTsuZsrYqB68QyLHI+DUugn+kX6Hd2WDB62DKa2suoIUIHQQCd/ofwB3
-WfCYInXQKKOSxu2YOg2Eb4kLNhSMc1i9uKUWAH+sdgJh7NBgdoE4MaNtBFkHXRvv
-okWuf3+xA9ksp1npSY/mDvgHijmjvtpRDe6iUeqfCn8N9u9CBg8geANgaG8+QA4=
-=wfQG
------END PGP SIGNATURE-----`
-
-const longValueExpected = "0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/canonical_text_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/canonical_text_test.go
deleted file mode 100644
index 8f3ba2a8814..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/canonical_text_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package openpgp
-
-import (
- "bytes"
- "testing"
-)
-
-type recordingHash struct {
- buf *bytes.Buffer
-}
-
-func (r recordingHash) Write(b []byte) (n int, err error) {
- return r.buf.Write(b)
-}
-
-func (r recordingHash) Sum(in []byte) []byte {
- return append(in, r.buf.Bytes()...)
-}
-
-func (r recordingHash) Reset() {
- panic("shouldn't be called")
-}
-
-func (r recordingHash) Size() int {
- panic("shouldn't be called")
-}
-
-func (r recordingHash) BlockSize() int {
- panic("shouldn't be called")
-}
-
-func testCanonicalText(t *testing.T, input, expected string) {
- r := recordingHash{bytes.NewBuffer(nil)}
- c := NewCanonicalTextHash(r)
- c.Write([]byte(input))
- result := c.Sum(nil)
- if expected != string(result) {
- t.Errorf("input: %x got: %x want: %x", input, result, expected)
- }
-}
-
-func TestCanonicalText(t *testing.T) {
- testCanonicalText(t, "foo\n", "foo\r\n")
- testCanonicalText(t, "foo", "foo")
- testCanonicalText(t, "foo\r\n", "foo\r\n")
- testCanonicalText(t, "foo\r\nbar", "foo\r\nbar")
- testCanonicalText(t, "foo\r\nbar\n\n", "foo\r\nbar\r\n\r\n")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/clearsign/clearsign_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/clearsign/clearsign_test.go
deleted file mode 100644
index 406377c6712..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/clearsign/clearsign_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package clearsign
-
-import (
- "bytes"
- "golang.org/x/crypto/openpgp"
- "testing"
-)
-
-func testParse(t *testing.T, input []byte, expected, expectedPlaintext string) {
- b, rest := Decode(input)
- if b == nil {
- t.Fatal("failed to decode clearsign message")
- }
- if !bytes.Equal(rest, []byte("trailing")) {
- t.Errorf("unexpected remaining bytes returned: %s", string(rest))
- }
- if b.ArmoredSignature.Type != "PGP SIGNATURE" {
- t.Errorf("bad armor type, got:%s, want:PGP SIGNATURE", b.ArmoredSignature.Type)
- }
- if !bytes.Equal(b.Bytes, []byte(expected)) {
- t.Errorf("bad body, got:%x want:%x", b.Bytes, expected)
- }
-
- if !bytes.Equal(b.Plaintext, []byte(expectedPlaintext)) {
- t.Errorf("bad plaintext, got:%x want:%x", b.Plaintext, expectedPlaintext)
- }
-
- keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(signingKey))
- if err != nil {
- t.Errorf("failed to parse public key: %s", err)
- }
-
- if _, err := openpgp.CheckDetachedSignature(keyring, bytes.NewBuffer(b.Bytes), b.ArmoredSignature.Body); err != nil {
- t.Errorf("failed to check signature: %s", err)
- }
-}
-
-func TestParse(t *testing.T) {
- testParse(t, clearsignInput, "Hello world\r\nline 2", "Hello world\nline 2\n")
- testParse(t, clearsignInput2, "\r\n\r\n(This message has a couple of blank lines at the start and end.)\r\n\r\n", "\n\n(This message has a couple of blank lines at the start and end.)\n\n\n")
-}
-
-func TestParseWithNoNewlineAtEnd(t *testing.T) {
- input := clearsignInput
- input = input[:len(input)-len("trailing")-1]
- b, rest := Decode(input)
- if b == nil {
- t.Fatal("failed to decode clearsign message")
- }
- if len(rest) > 0 {
- t.Errorf("unexpected remaining bytes returned: %s", string(rest))
- }
-}
-
-var signingTests = []struct {
- in, signed, plaintext string
-}{
- {"", "", ""},
- {"a", "a", "a\n"},
- {"a\n", "a", "a\n"},
- {"-a\n", "-a", "-a\n"},
- {"--a\nb", "--a\r\nb", "--a\nb\n"},
- // leading whitespace
- {" a\n", " a", " a\n"},
- {" a\n", " a", " a\n"},
- // trailing whitespace (should be stripped)
- {"a \n", "a", "a\n"},
- {"a ", "a", "a\n"},
- // whitespace-only lines (should be stripped)
- {" \n", "", "\n"},
- {" ", "", "\n"},
- {"a\n \n \nb\n", "a\r\n\r\n\r\nb", "a\n\n\nb\n"},
-}
-
-func TestSigning(t *testing.T) {
- keyring, err := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(signingKey))
- if err != nil {
- t.Errorf("failed to parse public key: %s", err)
- }
-
- for i, test := range signingTests {
- var buf bytes.Buffer
-
- plaintext, err := Encode(&buf, keyring[0].PrivateKey, nil)
- if err != nil {
- t.Errorf("#%d: error from Encode: %s", i, err)
- continue
- }
- if _, err := plaintext.Write([]byte(test.in)); err != nil {
- t.Errorf("#%d: error from Write: %s", i, err)
- continue
- }
- if err := plaintext.Close(); err != nil {
- t.Fatalf("#%d: error from Close: %s", i, err)
- continue
- }
-
- b, _ := Decode(buf.Bytes())
- if b == nil {
- t.Errorf("#%d: failed to decode clearsign message", i)
- continue
- }
- if !bytes.Equal(b.Bytes, []byte(test.signed)) {
- t.Errorf("#%d: bad result, got:%x, want:%x", i, b.Bytes, test.signed)
- continue
- }
- if !bytes.Equal(b.Plaintext, []byte(test.plaintext)) {
- t.Errorf("#%d: bad result, got:%x, want:%x", i, b.Plaintext, test.plaintext)
- continue
- }
-
- if _, err := openpgp.CheckDetachedSignature(keyring, bytes.NewBuffer(b.Bytes), b.ArmoredSignature.Body); err != nil {
- t.Errorf("#%d: failed to check signature: %s", i, err)
- }
- }
-}
-
-var clearsignInput = []byte(`
-;lasjlkfdsa
-
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-Hello world
-line 2
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.10 (GNU/Linux)
-
-iJwEAQECAAYFAk8kMuEACgkQO9o98PRieSpMsAQAhmY/vwmNpflrPgmfWsYhk5O8
-pjnBUzZwqTDoDeINjZEoPDSpQAHGhjFjgaDx/Gj4fAl0dM4D0wuUEBb6QOrwflog
-2A2k9kfSOMOtk0IH/H5VuFN1Mie9L/erYXjTQIptv9t9J7NoRBMU0QOOaFU0JaO9
-MyTpno24AjIAGb+mH1U=
-=hIJ6
------END PGP SIGNATURE-----
-trailing`)
-
-var clearsignInput2 = []byte(`
-asdlfkjasdlkfjsadf
-
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
-
-
-(This message has a couple of blank lines at the start and end.)
-
-
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.11 (GNU/Linux)
-
-iJwEAQEIAAYFAlPpSREACgkQO9o98PRieSpZTAP+M8QUoCt/7Rf3YbXPcdzIL32v
-pt1I+cMNeopzfLy0u4ioEFi8s5VkwpL1AFmirvgViCwlf82inoRxzZRiW05JQ5LI
-ESEzeCoy2LIdRCQ2hcrG8pIUPzUO4TqO5D/dMbdHwNH4h5nNmGJUAEG6FpURlPm+
-qZg6BaTvOxepqOxnhVU=
-=e+C6
------END PGP SIGNATURE-----
-
-trailing`)
-
-var signingKey = `-----BEGIN PGP PRIVATE KEY BLOCK-----
-Version: GnuPG v1.4.10 (GNU/Linux)
-
-lQHYBE2rFNoBBADFwqWQIW/DSqcB4yCQqnAFTJ27qS5AnB46ccAdw3u4Greeu3Bp
-idpoHdjULy7zSKlwR1EA873dO/k/e11Ml3dlAFUinWeejWaK2ugFP6JjiieSsrKn
-vWNicdCS4HTWn0X4sjl0ZiAygw6GNhqEQ3cpLeL0g8E9hnYzJKQ0LWJa0QARAQAB
-AAP/TB81EIo2VYNmTq0pK1ZXwUpxCrvAAIG3hwKjEzHcbQznsjNvPUihZ+NZQ6+X
-0HCfPAdPkGDCLCb6NavcSW+iNnLTrdDnSI6+3BbIONqWWdRDYJhqZCkqmG6zqSfL
-IdkJgCw94taUg5BWP/AAeQrhzjChvpMQTVKQL5mnuZbUCeMCAN5qrYMP2S9iKdnk
-VANIFj7656ARKt/nf4CBzxcpHTyB8+d2CtPDKCmlJP6vL8t58Jmih+kHJMvC0dzn
-gr5f5+sCAOOe5gt9e0am7AvQWhdbHVfJU0TQJx+m2OiCJAqGTB1nvtBLHdJnfdC9
-TnXXQ6ZXibqLyBies/xeY2sCKL5qtTMCAKnX9+9d/5yQxRyrQUHt1NYhaXZnJbHx
-q4ytu0eWz+5i68IYUSK69jJ1NWPM0T6SkqpB3KCAIv68VFm9PxqG1KmhSrQIVGVz
-dCBLZXmIuAQTAQIAIgUCTasU2gIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AA
-CgkQO9o98PRieSoLhgQAkLEZex02Qt7vGhZzMwuN0R22w3VwyYyjBx+fM3JFETy1
-ut4xcLJoJfIaF5ZS38UplgakHG0FQ+b49i8dMij0aZmDqGxrew1m4kBfjXw9B/v+
-eIqpODryb6cOSwyQFH0lQkXC040pjq9YqDsO5w0WYNXYKDnzRV0p4H1pweo2VDid
-AdgETasU2gEEAN46UPeWRqKHvA99arOxee38fBt2CI08iiWyI8T3J6ivtFGixSqV
-bRcPxYO/qLpVe5l84Nb3X71GfVXlc9hyv7CD6tcowL59hg1E/DC5ydI8K8iEpUmK
-/UnHdIY5h8/kqgGxkY/T/hgp5fRQgW1ZoZxLajVlMRZ8W4tFtT0DeA+JABEBAAEA
-A/0bE1jaaZKj6ndqcw86jd+QtD1SF+Cf21CWRNeLKnUds4FRRvclzTyUMuWPkUeX
-TaNNsUOFqBsf6QQ2oHUBBK4VCHffHCW4ZEX2cd6umz7mpHW6XzN4DECEzOVksXtc
-lUC1j4UB91DC/RNQqwX1IV2QLSwssVotPMPqhOi0ZLNY7wIA3n7DWKInxYZZ4K+6
-rQ+POsz6brEoRHwr8x6XlHenq1Oki855pSa1yXIARoTrSJkBtn5oI+f8AzrnN0BN
-oyeQAwIA/7E++3HDi5aweWrViiul9cd3rcsS0dEnksPhvS0ozCJiHsq/6GFmy7J8
-QSHZPteedBnZyNp5jR+H7cIfVN3KgwH/Skq4PsuPhDq5TKK6i8Pc1WW8MA6DXTdU
-nLkX7RGmMwjC0DBf7KWAlPjFaONAX3a8ndnz//fy1q7u2l9AZwrj1qa1iJ8EGAEC
-AAkFAk2rFNoCGwwACgkQO9o98PRieSo2/QP/WTzr4ioINVsvN1akKuekmEMI3LAp
-BfHwatufxxP1U+3Si/6YIk7kuPB9Hs+pRqCXzbvPRrI8NHZBmc8qIGthishdCYad
-AHcVnXjtxrULkQFGbGvhKURLvS9WnzD/m1K2zzwxzkPTzT9/Yf06O6Mal5AdugPL
-VrM0m72/jnpKo04=
-=zNCn
------END PGP PRIVATE KEY BLOCK-----
-`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal_test.go
deleted file mode 100644
index c4f99f5c48c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/elgamal/elgamal_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package elgamal
-
-import (
- "bytes"
- "crypto/rand"
- "math/big"
- "testing"
-)
-
-// This is the 1024-bit MODP group from RFC 5114, section 2.1:
-const primeHex = "B10B8F96A080E01DDE92DE5EAE5D54EC52C99FBCFB06A3C69A6A9DCA52D23B616073E28675A23D189838EF1E2EE652C013ECB4AEA906112324975C3CD49B83BFACCBDD7D90C4BD7098488E9C219A73724EFFD6FAE5644738FAA31A4FF55BCCC0A151AF5F0DC8B4BD45BF37DF365C1A65E68CFDA76D4DA708DF1FB2BC2E4A4371"
-
-const generatorHex = "A4D1CBD5C3FD34126765A442EFB99905F8104DD258AC507FD6406CFF14266D31266FEA1E5C41564B777E690F5504F213160217B4B01B886A5E91547F9E2749F4D7FBD7D3B9A92EE1909D0D2263F80A76A6A24C087A091F531DBF0A0169B6A28AD662A4D18E73AFA32D779D5918D08BC8858F4DCEF97C2A24855E6EEB22B3B2E5"
-
-func fromHex(hex string) *big.Int {
- n, ok := new(big.Int).SetString(hex, 16)
- if !ok {
- panic("failed to parse hex number")
- }
- return n
-}
-
-func TestEncryptDecrypt(t *testing.T) {
- priv := &PrivateKey{
- PublicKey: PublicKey{
- G: fromHex(generatorHex),
- P: fromHex(primeHex),
- },
- X: fromHex("42"),
- }
- priv.Y = new(big.Int).Exp(priv.G, priv.X, priv.P)
-
- message := []byte("hello world")
- c1, c2, err := Encrypt(rand.Reader, &priv.PublicKey, message)
- if err != nil {
- t.Errorf("error encrypting: %s", err)
- }
- message2, err := Decrypt(priv, c1, c2)
- if err != nil {
- t.Errorf("error decrypting: %s", err)
- }
- if !bytes.Equal(message2, message) {
- t.Errorf("decryption failed, got: %x, want: %x", message2, message)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/keys_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/keys_test.go
deleted file mode 100644
index d5e2056bb82..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/keys_test.go
+++ /dev/null
@@ -1,370 +0,0 @@
-package openpgp
-
-import (
- "bytes"
- "strings"
- "testing"
- "time"
-
- "golang.org/x/crypto/openpgp/errors"
- "golang.org/x/crypto/openpgp/packet"
-)
-
-func TestKeyExpiry(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(expiringKeyHex))
- entity := kring[0]
-
- const timeFormat = "2006-01-02"
- time1, _ := time.Parse(timeFormat, "2013-07-01")
-
- // The expiringKeyHex key is structured as:
- //
- // pub 1024R/5E237D8C created: 2013-07-01 expires: 2013-07-31 usage: SC
- // sub 1024R/1ABB25A0 created: 2013-07-01 23:11:07 +0200 CEST expires: 2013-07-08 usage: E
- // sub 1024R/96A672F5 created: 2013-07-01 23:11:23 +0200 CEST expires: 2013-07-31 usage: E
- //
- // So this should select the newest, non-expired encryption key.
- key, _ := entity.encryptionKey(time1)
- if id := key.PublicKey.KeyIdShortString(); id != "96A672F5" {
- t.Errorf("Expected key 1ABB25A0 at time %s, but got key %s", time1.Format(timeFormat), id)
- }
-
- // Once the first encryption subkey has expired, the second should be
- // selected.
- time2, _ := time.Parse(timeFormat, "2013-07-09")
- key, _ = entity.encryptionKey(time2)
- if id := key.PublicKey.KeyIdShortString(); id != "96A672F5" {
- t.Errorf("Expected key 96A672F5 at time %s, but got key %s", time2.Format(timeFormat), id)
- }
-
- // Once all the keys have expired, nothing should be returned.
- time3, _ := time.Parse(timeFormat, "2013-08-01")
- if key, ok := entity.encryptionKey(time3); ok {
- t.Errorf("Expected no key at time %s, but got key %s", time3.Format(timeFormat), key.PublicKey.KeyIdShortString())
- }
-}
-
-func TestMissingCrossSignature(t *testing.T) {
- // This public key has a signing subkey, but the subkey does not
- // contain a cross-signature.
- keys, err := ReadArmoredKeyRing(bytes.NewBufferString(missingCrossSignatureKey))
- if len(keys) != 0 {
- t.Errorf("Accepted key with missing cross signature")
- }
- if err == nil {
- t.Fatal("Failed to detect error in keyring with missing cross signature")
- }
- structural, ok := err.(errors.StructuralError)
- if !ok {
- t.Fatalf("Unexpected class of error: %T. Wanted StructuralError", err)
- }
- const expectedMsg = "signing subkey is missing cross-signature"
- if !strings.Contains(string(structural), expectedMsg) {
- t.Fatalf("Unexpected error: %q. Expected it to contain %q", err, expectedMsg)
- }
-}
-
-func TestInvalidCrossSignature(t *testing.T) {
- // This public key has a signing subkey, and the subkey has an
- // embedded cross-signature. However, the cross-signature does
- // not correctly validate over the primary and subkey.
- keys, err := ReadArmoredKeyRing(bytes.NewBufferString(invalidCrossSignatureKey))
- if len(keys) != 0 {
- t.Errorf("Accepted key with invalid cross signature")
- }
- if err == nil {
- t.Fatal("Failed to detect error in keyring with an invalid cross signature")
- }
- structural, ok := err.(errors.StructuralError)
- if !ok {
- t.Fatalf("Unexpected class of error: %T. Wanted StructuralError", err)
- }
- const expectedMsg = "subkey signature invalid"
- if !strings.Contains(string(structural), expectedMsg) {
- t.Fatalf("Unexpected error: %q. Expected it to contain %q", err, expectedMsg)
- }
-}
-
-func TestGoodCrossSignature(t *testing.T) {
- // This public key has a signing subkey, and the subkey has an
- // embedded cross-signature which correctly validates over the
- // primary and subkey.
- keys, err := ReadArmoredKeyRing(bytes.NewBufferString(goodCrossSignatureKey))
- if err != nil {
- t.Fatal(err)
- }
- if len(keys) != 1 {
- t.Errorf("Failed to accept key with good cross signature, %d", len(keys))
- }
- if len(keys[0].Subkeys) != 1 {
- t.Errorf("Failed to accept good subkey, %d", len(keys[0].Subkeys))
- }
-}
-
-// TestExternallyRevokableKey attempts to load and parse a key with a third party revocation permission.
-func TestExternallyRevocableKey(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(subkeyUsageHex))
-
- // The 0xA42704B92866382A key can be revoked by 0xBE3893CB843D0FE70C
- // according to this signature that appears within the key:
- // :signature packet: algo 1, keyid A42704B92866382A
- // version 4, created 1396409682, md5len 0, sigclass 0x1f
- // digest algo 2, begin of digest a9 84
- // hashed subpkt 2 len 4 (sig created 2014-04-02)
- // hashed subpkt 12 len 22 (revocation key: c=80 a=1 f=CE094AA433F7040BB2DDF0BE3893CB843D0FE70C)
- // hashed subpkt 7 len 1 (not revocable)
- // subpkt 16 len 8 (issuer key ID A42704B92866382A)
- // data: [1024 bits]
-
- id := uint64(0xA42704B92866382A)
- keys := kring.KeysById(id)
- if len(keys) != 1 {
- t.Errorf("Expected to find key id %X, but got %d matches", id, len(keys))
- }
-}
-
-func TestKeyRevocation(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(revokedKeyHex))
-
- // revokedKeyHex contains these keys:
- // pub 1024R/9A34F7C0 2014-03-25 [revoked: 2014-03-25]
- // sub 1024R/1BA3CD60 2014-03-25 [revoked: 2014-03-25]
- ids := []uint64{0xA401D9F09A34F7C0, 0x5CD3BE0A1BA3CD60}
-
- for _, id := range ids {
- keys := kring.KeysById(id)
- if len(keys) != 1 {
- t.Errorf("Expected KeysById to find revoked key %X, but got %d matches", id, len(keys))
- }
- keys = kring.KeysByIdUsage(id, 0)
- if len(keys) != 0 {
- t.Errorf("Expected KeysByIdUsage to filter out revoked key %X, but got %d matches", id, len(keys))
- }
- }
-}
-
-func TestSubkeyRevocation(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(revokedSubkeyHex))
-
- // revokedSubkeyHex contains these keys:
- // pub 1024R/4EF7E4BECCDE97F0 2014-03-25
- // sub 1024R/D63636E2B96AE423 2014-03-25
- // sub 1024D/DBCE4EE19529437F 2014-03-25
- // sub 1024R/677815E371C2FD23 2014-03-25 [revoked: 2014-03-25]
- validKeys := []uint64{0x4EF7E4BECCDE97F0, 0xD63636E2B96AE423, 0xDBCE4EE19529437F}
- revokedKey := uint64(0x677815E371C2FD23)
-
- for _, id := range validKeys {
- keys := kring.KeysById(id)
- if len(keys) != 1 {
- t.Errorf("Expected KeysById to find key %X, but got %d matches", id, len(keys))
- }
- keys = kring.KeysByIdUsage(id, 0)
- if len(keys) != 1 {
- t.Errorf("Expected KeysByIdUsage to find key %X, but got %d matches", id, len(keys))
- }
- }
-
- keys := kring.KeysById(revokedKey)
- if len(keys) != 1 {
- t.Errorf("Expected KeysById to find key %X, but got %d matches", revokedKey, len(keys))
- }
-
- keys = kring.KeysByIdUsage(revokedKey, 0)
- if len(keys) != 0 {
- t.Errorf("Expected KeysByIdUsage to filter out revoked key %X, but got %d matches", revokedKey, len(keys))
- }
-}
-
-func TestKeyUsage(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(subkeyUsageHex))
-
- // subkeyUsageHex contains these keys:
- // pub 1024R/2866382A created: 2014-04-01 expires: never usage: SC
- // sub 1024R/936C9153 created: 2014-04-01 expires: never usage: E
- // sub 1024R/64D5F5BB created: 2014-04-02 expires: never usage: E
- // sub 1024D/BC0BA992 created: 2014-04-02 expires: never usage: S
- certifiers := []uint64{0xA42704B92866382A}
- signers := []uint64{0xA42704B92866382A, 0x42CE2C64BC0BA992}
- encrypters := []uint64{0x09C0C7D9936C9153, 0xC104E98664D5F5BB}
-
- for _, id := range certifiers {
- keys := kring.KeysByIdUsage(id, packet.KeyFlagCertify)
- if len(keys) == 1 {
- if keys[0].PublicKey.KeyId != id {
- t.Errorf("Expected to find certifier key id %X, but got %X", id, keys[0].PublicKey.KeyId)
- }
- } else {
- t.Errorf("Expected one match for certifier key id %X, but got %d matches", id, len(keys))
- }
- }
-
- for _, id := range signers {
- keys := kring.KeysByIdUsage(id, packet.KeyFlagSign)
- if len(keys) == 1 {
- if keys[0].PublicKey.KeyId != id {
- t.Errorf("Expected to find signing key id %X, but got %X", id, keys[0].PublicKey.KeyId)
- }
- } else {
- t.Errorf("Expected one match for signing key id %X, but got %d matches", id, len(keys))
- }
-
- // This keyring contains no encryption keys that are also good for signing.
- keys = kring.KeysByIdUsage(id, packet.KeyFlagEncryptStorage|packet.KeyFlagEncryptCommunications)
- if len(keys) != 0 {
- t.Errorf("Unexpected match for encryption key id %X", id)
- }
- }
-
- for _, id := range encrypters {
- keys := kring.KeysByIdUsage(id, packet.KeyFlagEncryptStorage|packet.KeyFlagEncryptCommunications)
- if len(keys) == 1 {
- if keys[0].PublicKey.KeyId != id {
- t.Errorf("Expected to find encryption key id %X, but got %X", id, keys[0].PublicKey.KeyId)
- }
- } else {
- t.Errorf("Expected one match for encryption key id %X, but got %d matches", id, len(keys))
- }
-
- // This keyring contains no encryption keys that are also good for signing.
- keys = kring.KeysByIdUsage(id, packet.KeyFlagSign)
- if len(keys) != 0 {
- t.Errorf("Unexpected match for signing key id %X", id)
- }
- }
-}
-
-func TestIdVerification(t *testing.T) {
- kring, err := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
- if err != nil {
- t.Fatal(err)
- }
- if err := kring[1].PrivateKey.Decrypt([]byte("passphrase")); err != nil {
- t.Fatal(err)
- }
-
- const identity = "Test Key 1 (RSA)"
- if err := kring[0].SignIdentity(identity, kring[1], nil); err != nil {
- t.Fatal(err)
- }
-
- ident, ok := kring[0].Identities[identity]
- if !ok {
- t.Fatal("identity missing from key after signing")
- }
-
- checked := false
- for _, sig := range ident.Signatures {
- if sig.IssuerKeyId == nil || *sig.IssuerKeyId != kring[1].PrimaryKey.KeyId {
- continue
- }
-
- if err := kring[1].PrimaryKey.VerifyUserIdSignature(identity, kring[0].PrimaryKey, sig); err != nil {
- t.Fatalf("error verifying new identity signature: %s", err)
- }
- checked = true
- break
- }
-
- if !checked {
- t.Fatal("didn't find identity signature in Entity")
- }
-}
-
-const expiringKeyHex = "988d0451d1ec5d010400ba3385721f2dc3f4ab096b2ee867ab77213f0a27a8538441c35d2fa225b08798a1439a66a5150e6bdc3f40f5d28d588c712394c632b6299f77db8c0d48d37903fb72ebd794d61be6aa774688839e5fdecfe06b2684cc115d240c98c66cb1ef22ae84e3aa0c2b0c28665c1e7d4d044e7f270706193f5223c8d44e0d70b7b8da830011010001b40f4578706972792074657374206b657988be041301020028050251d1ec5d021b03050900278d00060b090807030206150802090a0b0416020301021e01021780000a091072589ad75e237d8c033503fd10506d72837834eb7f994117740723adc39227104b0d326a1161871c0b415d25b4aedef946ca77ea4c05af9c22b32cf98be86ab890111fced1ee3f75e87b7cc3c00dc63bbc85dfab91c0dc2ad9de2c4d13a34659333a85c6acc1a669c5e1d6cecb0cf1e56c10e72d855ae177ddc9e766f9b2dda57ccbb75f57156438bbdb4e42b88d0451d1ec5d0104009c64906559866c5cb61578f5846a94fcee142a489c9b41e67b12bb54cfe86eb9bc8566460f9a720cb00d6526fbccfd4f552071a8e3f7744b1882d01036d811ee5a3fb91a1c568055758f43ba5d2c6a9676b012f3a1a89e47bbf624f1ad571b208f3cc6224eb378f1645dd3d47584463f9eadeacfd1ce6f813064fbfdcc4b5a53001101000188a504180102000f021b0c050251d1f06b050900093e89000a091072589ad75e237d8c20e00400ab8310a41461425b37889c4da28129b5fae6084fafbc0a47dd1adc74a264c6e9c9cc125f40462ee1433072a58384daef88c961c390ed06426a81b464a53194c4e291ddd7e2e2ba3efced01537d713bd111f48437bde2363446200995e8e0d4e528dda377fd1e8f8ede9c8e2198b393bd86852ce7457a7e3daf74d510461a5b77b88d0451d1ece8010400b3a519f83ab0010307e83bca895170acce8964a044190a2b368892f7a244758d9fc193482648acb1fb9780d28cc22d171931f38bb40279389fc9bf2110876d4f3db4fcfb13f22f7083877fe56592b3b65251312c36f83ffcb6d313c6a17f197dd471f0712aad15a8537b435a92471ba2e5b0c72a6c72536c3b567c558d7b6051001101000188a504180102000f021b0c050251d1f07b050900279091000a091072589ad75e237d8ce69e03fe286026afacf7c97ee20673864d4459a2240b5655219950643c7dba0ac384b1d4359c67805b21d98211f7b09c2a0ccf6410c8c04d4ff4a51293725d8d6570d9d8bb0e10c07d22357caeb49626df99c180be02d77d1fe8ed25e7a54481237646083a9f89a11566cd20b9e995b1487c5f9e02aeb434f3a1897cd416dd0a87861838da3e9e"
-const subkeyUsageHex = "988d04533a52bc010400d26af43085558f65b9e7dbc90cb9238015259aed5e954637adcfa2181548b2d0b60c65f1f42ec5081cbf1bc0a8aa4900acfb77070837c58f26012fbce297d70afe96e759ad63531f0037538e70dbf8e384569b9720d99d8eb39d8d0a2947233ed242436cb6ac7dfe74123354b3d0119b5c235d3dd9c9d6c004f8ffaf67ad8583001101000188b7041f010200210502533b8552170c8001ce094aa433f7040bb2ddf0be3893cb843d0fe70c020700000a0910a42704b92866382aa98404009d63d916a27543da4221c60087c33f1c44bec9998c5438018ed370cca4962876c748e94b73eb39c58eb698063f3fd6346d58dd2a11c0247934c4a9d71f24754f7468f96fb24c3e791dd2392b62f626148ad724189498cbf993db2df7c0cdc2d677c35da0f16cb16c9ce7c33b4de65a4a91b1d21a130ae9cc26067718910ef8e2b417556d627261203c756d627261407379642e65642e61753e88b80413010200220502533a52bc021b03060b090807030206150802090a0b0416020301021e01021780000a0910a42704b92866382a47840400c0c2bd04f5fca586de408b395b3c280a278259c93eaaa8b79a53b97003f8ed502a8a00446dd9947fb462677e4fcac0dac2f0701847d15130aadb6cd9e0705ea0cf5f92f129136c7be21a718d46c8e641eb7f044f2adae573e11ae423a0a9ca51324f03a8a2f34b91fa40c3cc764bee4dccadedb54c768ba0469b683ea53f1c29b88d04533a52bc01040099c92a5d6f8b744224da27bc2369127c35269b58bec179de6bbc038f749344222f85a31933224f26b70243c4e4b2d242f0c4777eaef7b5502f9dad6d8bf3aaeb471210674b74de2d7078af497d55f5cdad97c7bedfbc1b41e8065a97c9c3d344b21fc81d27723af8e374bc595da26ea242dccb6ae497be26eea57e563ed517e90011010001889f0418010200090502533a52bc021b0c000a0910a42704b92866382afa1403ff70284c2de8a043ff51d8d29772602fa98009b7861c540535f874f2c230af8caf5638151a636b21f8255003997ccd29747fdd06777bb24f9593bd7d98a3e887689bf902f999915fcc94625ae487e5d13e6616f89090ebc4fdc7eb5cad8943e4056995bb61c6af37f8043016876a958ec7ebf39c43d20d53b7f546cfa83e8d2604b88d04533b8283010400c0b529316dbdf58b4c54461e7e669dc11c09eb7f73819f178ccd4177b9182b91d138605fcf1e463262fabefa73f94a52b5e15d1904635541c7ea540f07050ce0fb51b73e6f88644cec86e91107c957a114f69554548a85295d2b70bd0b203992f76eb5d493d86d9eabcaa7ef3fc7db7e458438db3fcdb0ca1cc97c638439a9170011010001889f0418010200090502533b8283021b0c000a0910a42704b92866382adc6d0400cfff6258485a21675adb7a811c3e19ebca18851533f75a7ba317950b9997fda8d1a4c8c76505c08c04b6c2cc31dc704d33da36a21273f2b388a1a706f7c3378b66d887197a525936ed9a69acb57fe7f718133da85ec742001c5d1864e9c6c8ea1b94f1c3759cebfd93b18606066c063a63be86085b7e37bdbc65f9a915bf084bb901a204533b85cd110400aed3d2c52af2b38b5b67904b0ef73d6dd7aef86adb770e2b153cd22489654dcc91730892087bb9856ae2d9f7ed1eb48f214243fe86bfe87b349ebd7c30e630e49c07b21fdabf78b7a95c8b7f969e97e3d33f2e074c63552ba64a2ded7badc05ce0ea2be6d53485f6900c7860c7aa76560376ce963d7271b9b54638a4028b573f00a0d8854bfcdb04986141568046202192263b9b67350400aaa1049dbc7943141ef590a70dcb028d730371d92ea4863de715f7f0f16d168bd3dc266c2450457d46dcbbf0b071547e5fbee7700a820c3750b236335d8d5848adb3c0da010e998908dfd93d961480084f3aea20b247034f8988eccb5546efaa35a92d0451df3aaf1aee5aa36a4c4d462c760ecd9cebcabfbe1412b1f21450f203fd126687cd486496e971a87fd9e1a8a765fe654baa219a6871ab97768596ab05c26c1aeea8f1a2c72395a58dbc12ef9640d2b95784e974a4d2d5a9b17c25fedacfe551bda52602de8f6d2e48443f5dd1a2a2a8e6a5e70ecdb88cd6e766ad9745c7ee91d78cc55c3d06536b49c3fee6c3d0b6ff0fb2bf13a314f57c953b8f4d93bf88e70418010200090502533b85cd021b0200520910a42704b92866382a47200419110200060502533b85cd000a091042ce2c64bc0ba99214b2009e26b26852c8b13b10c35768e40e78fbbb48bd084100a0c79d9ea0844fa5853dd3c85ff3ecae6f2c9dd6c557aa04008bbbc964cd65b9b8299d4ebf31f41cc7264b8cf33a00e82c5af022331fac79efc9563a822497ba012953cefe2629f1242fcdcb911dbb2315985bab060bfd58261ace3c654bdbbe2e8ed27a46e836490145c86dc7bae15c011f7e1ffc33730109b9338cd9f483e7cef3d2f396aab5bd80efb6646d7e778270ee99d934d187dd98"
-const revokedKeyHex = "988d045331ce82010400c4fdf7b40a5477f206e6ee278eaef888ca73bf9128a9eef9f2f1ddb8b7b71a4c07cfa241f028a04edb405e4d916c61d6beabc333813dc7b484d2b3c52ee233c6a79b1eea4e9cc51596ba9cd5ac5aeb9df62d86ea051055b79d03f8a4fa9f38386f5bd17529138f3325d46801514ea9047977e0829ed728e68636802796801be10011010001889f04200102000905025331d0e3021d03000a0910a401d9f09a34f7c042aa040086631196405b7e6af71026b88e98012eab44aa9849f6ef3fa930c7c9f23deaedba9db1538830f8652fb7648ec3fcade8dbcbf9eaf428e83c6cbcc272201bfe2fbb90d41963397a7c0637a1a9d9448ce695d9790db2dc95433ad7be19eb3de72dacf1d6db82c3644c13eae2a3d072b99bb341debba012c5ce4006a7d34a1f4b94b444526567205265766f6b657220283c52656727732022424d204261726973746122204b657920262530305c303e5c29203c72656740626d626172697374612e636f2e61753e88b704130102002205025331ce82021b03060b090807030206150802090a0b0416020301021e01021780000a0910a401d9f09a34f7c0019c03f75edfbeb6a73e7225ad3cc52724e2872e04260d7daf0d693c170d8c4b243b8767bc7785763533febc62ec2600c30603c433c095453ede59ff2fcabeb84ce32e0ed9d5cf15ffcbc816202b64370d4d77c1e9077d74e94a16fb4fa2e5bec23a56d7a73cf275f91691ae1801a976fcde09e981a2f6327ac27ea1fecf3185df0d56889c04100102000605025331cfb5000a0910fe9645554e8266b64b4303fc084075396674fb6f778d302ac07cef6bc0b5d07b66b2004c44aef711cbac79617ef06d836b4957522d8772dd94bf41a2f4ac8b1ee6d70c57503f837445a74765a076d07b829b8111fc2a918423ddb817ead7ca2a613ef0bfb9c6b3562aec6c3cf3c75ef3031d81d95f6563e4cdcc9960bcb386c5d757b104fcca5fe11fc709df884604101102000605025331cfe7000a09107b15a67f0b3ddc0317f6009e360beea58f29c1d963a22b962b80788c3fa6c84e009d148cfde6b351469b8eae91187eff07ad9d08fcaab88d045331ce820104009f25e20a42b904f3fa555530fe5c46737cf7bd076c35a2a0d22b11f7e0b61a69320b768f4a80fe13980ce380d1cfc4a0cd8fbe2d2e2ef85416668b77208baa65bf973fe8e500e78cc310d7c8705cdb34328bf80e24f0385fce5845c33bc7943cf6b11b02348a23da0bf6428e57c05135f2dc6bd7c1ce325d666d5a5fd2fd5e410011010001889f04180102000905025331ce82021b0c000a0910a401d9f09a34f7c0418003fe34feafcbeaef348a800a0d908a7a6809cc7304017d820f70f0474d5e23cb17e38b67dc6dca282c6ca00961f4ec9edf2738d0f087b1d81e4871ef08e1798010863afb4eac4c44a376cb343be929c5be66a78cfd4456ae9ec6a99d97f4e1c3ff3583351db2147a65c0acef5c003fb544ab3a2e2dc4d43646f58b811a6c3a369d1f"
-const revokedSubkeyHex = "988d04533121f6010400aefc803a3e4bb1a61c86e8a86d2726c6a43e0079e9f2713f1fa017e9854c83877f4aced8e331d675c67ea83ddab80aacbfa0b9040bb12d96f5a3d6be09455e2a76546cbd21677537db941cab710216b6d24ec277ee0bd65b910f416737ed120f6b93a9d3b306245c8cfd8394606fdb462e5cf43c551438d2864506c63367fc890011010001b41d416c696365203c616c69636540626d626172697374612e636f2e61753e88bb041301020025021b03060b090807030206150802090a0b0416020301021e01021780050253312798021901000a09104ef7e4beccde97f015a803ff5448437780f63263b0df8442a995e7f76c221351a51edd06f2063d8166cf3157aada4923dfc44aa0f2a6a4da5cf83b7fe722ba8ab416c976e77c6b5682e7f1069026673bd0de56ba06fd5d7a9f177607f277d9b55ff940a638c3e68525c67517e2b3d976899b93ca267f705b3e5efad7d61220e96b618a4497eab8d04403d23f8846041011020006050253312910000a09107b15a67f0b3ddc03d96e009f50b6365d86c4be5d5e9d0ea42d5e56f5794c617700a0ab274e19c2827780016d23417ce89e0a2c0d987d889c04100102000605025331cf7a000a0910a401d9f09a34f7c0ee970400aca292f213041c9f3b3fc49148cbda9d84afee6183c8dd6c5ff2600b29482db5fecd4303797be1ee6d544a20a858080fec43412061c9a71fae4039fd58013b4ae341273e6c66ad4c7cdd9e68245bedb260562e7b166f2461a1032f2b38c0e0e5715fb3d1656979e052b55ca827a76f872b78a9fdae64bc298170bfcebedc1271b41a416c696365203c616c696365407379646973702e6f722e61753e88b804130102002205025331278b021b03060b090807030206150802090a0b0416020301021e01021780000a09104ef7e4beccde97f06a7003fa03c3af68d272ebc1fa08aa72a03b02189c26496a2833d90450801c4e42c5b5f51ad96ce2d2c9cef4b7c02a6a2fcf1412d6a2d486098eb762f5010a201819c17fd2888aec8eda20c65a3b75744de7ee5cc8ac7bfc470cbe3cb982720405a27a3c6a8c229cfe36905f881b02ed5680f6a8f05866efb9d6c5844897e631deb949ca8846041011020006050253312910000a09107b15a67f0b3ddc0347bc009f7fa35db59147469eb6f2c5aaf6428accb138b22800a0caa2f5f0874bacc5909c652a57a31beda65eddd5889c04100102000605025331cf7a000a0910a401d9f09a34f7c0316403ff46f2a5c101256627f16384d34a38fb47a6c88ba60506843e532d91614339fccae5f884a5741e7582ffaf292ba38ee10a270a05f139bde3814b6a077e8cd2db0f105ebea2a83af70d385f13b507fac2ad93ff79d84950328bb86f3074745a8b7f9b64990fb142e2a12976e27e8d09a28dc5621f957ac49091116da410ac3cbde1b88d04533121f6010400cbd785b56905e4192e2fb62a720727d43c4fa487821203cf72138b884b78b701093243e1d8c92a0248a6c0203a5a88693da34af357499abacaf4b3309c640797d03093870a323b4b6f37865f6eaa2838148a67df4735d43a90ca87942554cdf1c4a751b1e75f9fd4ce4e97e278d6c1c7ed59d33441df7d084f3f02beb68896c70011010001889f0418010200090502533121f6021b0c000a09104ef7e4beccde97f0b98b03fc0a5ccf6a372995835a2f5da33b282a7d612c0ab2a97f59cf9fff73e9110981aac2858c41399afa29624a7fd8a0add11654e3d882c0fd199e161bdad65e5e2548f7b68a437ea64293db1246e3011cbb94dc1bcdeaf0f2539bd88ff16d95547144d97cead6a8c5927660a91e6db0d16eb36b7b49a3525b54d1644e65599b032b7eb901a204533127a0110400bd3edaa09eff9809c4edc2c2a0ebe52e53c50a19c1e49ab78e6167bf61473bb08f2050d78a5cbbc6ed66aff7b42cd503f16b4a0b99fa1609681fca9b7ce2bbb1a5b3864d6cdda4d7ef7849d156d534dea30fb0efb9e4cf8959a2b2ce623905882d5430b995a15c3b9fe92906086788b891002924f94abe139b42cbbfaaabe42f00a0b65dc1a1ad27d798adbcb5b5ad02d2688c89477b03ff4eebb6f7b15a73b96a96bed201c0e5e4ea27e4c6e2dd1005b94d4b90137a5b1cf5e01c6226c070c4cc999938101578877ee76d296b9aab8246d57049caacf489e80a3f40589cade790a020b1ac146d6f7a6241184b8c7fcde680eae3188f5dcbe846d7f7bdad34f6fcfca08413e19c1d5df83fc7c7c627d493492e009c2f52a80400a2fe82de87136fd2e8845888c4431b032ba29d9a29a804277e31002a8201fb8591a3e55c7a0d0881496caf8b9fb07544a5a4879291d0dc026a0ea9e5bd88eb4aa4947bbd694b25012e208a250d65ddc6f1eea59d3aed3b4ec15fcab85e2afaa23a40ab1ef9ce3e11e1bc1c34a0e758e7aa64deb8739276df0af7d4121f834a9b88e70418010200090502533127a0021b02005209104ef7e4beccde97f047200419110200060502533127a0000a0910dbce4ee19529437fe045009c0b32f5ead48ee8a7e98fac0dea3d3e6c0e2c552500a0ad71fadc5007cfaf842d9b7db3335a8cdad15d3d1a6404009b08e2c68fe8f3b45c1bb72a4b3278cdf3012aa0f229883ad74aa1f6000bb90b18301b2f85372ca5d6b9bf478d235b733b1b197d19ccca48e9daf8e890cb64546b4ce1b178faccfff07003c172a2d4f5ebaba9f57153955f3f61a9b80a4f5cb959908f8b211b03b7026a8a82fc612bfedd3794969bcf458c4ce92be215a1176ab88d045331d144010400a5063000c5aaf34953c1aa3bfc95045b3aab9882b9a8027fecfe2142dc6b47ba8aca667399990244d513dd0504716908c17d92c65e74219e004f7b83fc125e575dd58efec3ab6dd22e3580106998523dea42ec75bf9aa111734c82df54630bebdff20fe981cfc36c76f865eb1c2fb62c9e85bc3a6e5015a361a2eb1c8431578d0011010001889f04280102000905025331d433021d03000a09104ef7e4beccde97f02e5503ff5e0630d1b65291f4882b6d40a29da4616bb5088717d469fbcc3648b8276de04a04988b1f1b9f3e18f52265c1f8b6c85861691c1a6b8a3a25a1809a0b32ad330aec5667cb4262f4450649184e8113849b05e5ad06a316ea80c001e8e71838190339a6e48bbde30647bcf245134b9a97fa875c1d83a9862cae87ffd7e2c4ce3a1b89013d04180102000905025331d144021b0200a809104ef7e4beccde97f09d2004190102000605025331d144000a0910677815e371c2fd23522203fe22ab62b8e7a151383cea3edd3a12995693911426f8ccf125e1f6426388c0010f88d9ca7da2224aee8d1c12135998640c5e1813d55a93df472faae75bef858457248db41b4505827590aeccf6f9eb646da7f980655dd3050c6897feddddaca90676dee856d66db8923477d251712bb9b3186b4d0114daf7d6b59272b53218dd1da94a03ff64006fcbe71211e5daecd9961fba66cdb6de3f914882c58ba5beddeba7dcb950c1156d7fba18c19ea880dccc800eae335deec34e3b84ac75ffa24864f782f87815cda1c0f634b3dd2fa67cea30811d21723d21d9551fa12ccbcfa62b6d3a15d01307b99925707992556d50065505b090aadb8579083a20fe65bd2a270da9b011"
-const missingCrossSignatureKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
-Charset: UTF-8
-
-mQENBFMYynYBCACVOZ3/e8Bm2b9KH9QyIlHGo/i1bnkpqsgXj8tpJ2MIUOnXMMAY
-ztW7kKFLCmgVdLIC0vSoLA4yhaLcMojznh/2CcUglZeb6Ao8Gtelr//Rd5DRfPpG
-zqcfUo+m+eO1co2Orabw0tZDfGpg5p3AYl0hmxhUyYSc/xUq93xL1UJzBFgYXY54
-QsM8dgeQgFseSk/YvdP5SMx1ev+eraUyiiUtWzWrWC1TdyRa5p4UZg6Rkoppf+WJ
-QrW6BWrhAtqATHc8ozV7uJjeONjUEq24roRc/OFZdmQQGK6yrzKnnbA6MdHhqpdo
-9kWDcXYb7pSE63Lc+OBa5X2GUVvXJLS/3nrtABEBAAG0F2ludmFsaWQtc2lnbmlu
-Zy1zdWJrZXlziQEoBBMBAgASBQJTnKB5AhsBAgsHAhUIAh4BAAoJEO3UDQUIHpI/
-dN4H/idX4FQ1LIZCnpHS/oxoWQWfpRgdKAEM0qCqjMgiipJeEwSQbqjTCynuh5/R
-JlODDz85ABR06aoF4l5ebGLQWFCYifPnJZ/Yf5OYcMGtb7dIbqxWVFL9iLMO/oDL
-ioI3dotjPui5e+2hI9pVH1UHB/bZ/GvMGo6Zg0XxLPolKQODMVjpjLAQ0YJ3spew
-RAmOGre6tIvbDsMBnm8qREt7a07cBJ6XK7xjxYaZHQBiHVxyEWDa6gyANONx8duW
-/fhQ/zDTnyVM/ik6VO0Ty9BhPpcEYLFwh5c1ilFari1ta3e6qKo6ZGa9YMk/REhu
-yBHd9nTkI+0CiQUmbckUiVjDKKe5AQ0EUxjKdgEIAJcXQeP+NmuciE99YcJoffxv
-2gVLU4ZXBNHEaP0mgaJ1+tmMD089vUQAcyGRvw8jfsNsVZQIOAuRxY94aHQhIRHR
-bUzBN28ofo/AJJtfx62C15xt6fDKRV6HXYqAiygrHIpEoRLyiN69iScUsjIJeyFL
-C8wa72e8pSL6dkHoaV1N9ZH/xmrJ+k0vsgkQaAh9CzYufncDxcwkoP+aOlGtX1gP
-WwWoIbz0JwLEMPHBWvDDXQcQPQTYQyj+LGC9U6f9VZHN25E94subM1MjuT9OhN9Y
-MLfWaaIc5WyhLFyQKW2Upofn9wSFi8ubyBnv640Dfd0rVmaWv7LNTZpoZ/GbJAMA
-EQEAAYkBHwQYAQIACQUCU5ygeQIbAgAKCRDt1A0FCB6SP0zCB/sEzaVR38vpx+OQ
-MMynCBJrakiqDmUZv9xtplY7zsHSQjpd6xGflbU2n+iX99Q+nav0ETQZifNUEd4N
-1ljDGQejcTyKD6Pkg6wBL3x9/RJye7Zszazm4+toJXZ8xJ3800+BtaPoI39akYJm
-+ijzbskvN0v/j5GOFJwQO0pPRAFtdHqRs9Kf4YanxhedB4dIUblzlIJuKsxFit6N
-lgGRblagG3Vv2eBszbxzPbJjHCgVLR3RmrVezKOsZjr/2i7X+xLWIR0uD3IN1qOW
-CXQxLBizEEmSNVNxsp7KPGTLnqO3bPtqFirxS9PJLIMPTPLNBY7ZYuPNTMqVIUWF
-4artDmrG
-=7FfJ
------END PGP PUBLIC KEY BLOCK-----`
-
-const invalidCrossSignatureKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQENBFMYynYBCACVOZ3/e8Bm2b9KH9QyIlHGo/i1bnkpqsgXj8tpJ2MIUOnXMMAY
-ztW7kKFLCmgVdLIC0vSoLA4yhaLcMojznh/2CcUglZeb6Ao8Gtelr//Rd5DRfPpG
-zqcfUo+m+eO1co2Orabw0tZDfGpg5p3AYl0hmxhUyYSc/xUq93xL1UJzBFgYXY54
-QsM8dgeQgFseSk/YvdP5SMx1ev+eraUyiiUtWzWrWC1TdyRa5p4UZg6Rkoppf+WJ
-QrW6BWrhAtqATHc8ozV7uJjeONjUEq24roRc/OFZdmQQGK6yrzKnnbA6MdHhqpdo
-9kWDcXYb7pSE63Lc+OBa5X2GUVvXJLS/3nrtABEBAAG0F2ludmFsaWQtc2lnbmlu
-Zy1zdWJrZXlziQEoBBMBAgASBQJTnKB5AhsBAgsHAhUIAh4BAAoJEO3UDQUIHpI/
-dN4H/idX4FQ1LIZCnpHS/oxoWQWfpRgdKAEM0qCqjMgiipJeEwSQbqjTCynuh5/R
-JlODDz85ABR06aoF4l5ebGLQWFCYifPnJZ/Yf5OYcMGtb7dIbqxWVFL9iLMO/oDL
-ioI3dotjPui5e+2hI9pVH1UHB/bZ/GvMGo6Zg0XxLPolKQODMVjpjLAQ0YJ3spew
-RAmOGre6tIvbDsMBnm8qREt7a07cBJ6XK7xjxYaZHQBiHVxyEWDa6gyANONx8duW
-/fhQ/zDTnyVM/ik6VO0Ty9BhPpcEYLFwh5c1ilFari1ta3e6qKo6ZGa9YMk/REhu
-yBHd9nTkI+0CiQUmbckUiVjDKKe5AQ0EUxjKdgEIAIINDqlj7X6jYKc6DjwrOkjQ
-UIRWbQQar0LwmNilehmt70g5DCL1SYm9q4LcgJJ2Nhxj0/5qqsYib50OSWMcKeEe
-iRXpXzv1ObpcQtI5ithp0gR53YPXBib80t3bUzomQ5UyZqAAHzMp3BKC54/vUrSK
-FeRaxDzNLrCeyI00+LHNUtwghAqHvdNcsIf8VRumK8oTm3RmDh0TyjASWYbrt9c8
-R1Um3zuoACOVy+mEIgIzsfHq0u7dwYwJB5+KeM7ZLx+HGIYdUYzHuUE1sLwVoELh
-+SHIGHI1HDicOjzqgajShuIjj5hZTyQySVprrsLKiXS6NEwHAP20+XjayJ/R3tEA
-EQEAAYkCPgQYAQIBKAUCU5ygeQIbAsBdIAQZAQIABgUCU5ygeQAKCRCpVlnFZmhO
-52RJB/9uD1MSa0wjY6tHOIgquZcP3bHBvHmrHNMw9HR2wRCMO91ZkhrpdS3ZHtgb
-u3/55etj0FdvDo1tb8P8FGSVtO5Vcwf5APM8sbbqoi8L951Q3i7qt847lfhu6sMl
-w0LWFvPTOLHrliZHItPRjOltS1WAWfr2jUYhsU9ytaDAJmvf9DujxEOsN5G1YJep
-54JCKVCkM/y585Zcnn+yxk/XwqoNQ0/iJUT9qRrZWvoeasxhl1PQcwihCwss44A+
-YXaAt3hbk+6LEQuZoYS73yR3WHj+42tfm7YxRGeubXfgCEz/brETEWXMh4pe0vCL
-bfWrmfSPq2rDegYcAybxRQz0lF8PAAoJEO3UDQUIHpI/exkH/0vQfdHA8g/N4T6E
-i6b1CUVBAkvtdJpCATZjWPhXmShOw62gkDw306vHPilL4SCvEEi4KzG72zkp6VsB
-DSRcpxCwT4mHue+duiy53/aRMtSJ+vDfiV1Vhq+3sWAck/yUtfDU9/u4eFaiNok1
-8/Gd7reyuZt5CiJnpdPpjCwelK21l2w7sHAnJF55ITXdOxI8oG3BRKufz0z5lyDY
-s2tXYmhhQIggdgelN8LbcMhWs/PBbtUr6uZlNJG2lW1yscD4aI529VjwJlCeo745
-U7pO4eF05VViUJ2mmfoivL3tkhoTUWhx8xs8xCUcCg8DoEoSIhxtOmoTPR22Z9BL
-6LCg2mg=
-=Dhm4
------END PGP PUBLIC KEY BLOCK-----`
-
-const goodCrossSignatureKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1
-
-mI0EVUqeVwEEAMufHRrMPWK3gyvi0O0tABCs/oON9zV9KDZlr1a1M91ShCSFwCPo
-7r80PxdWVWcj0V5h50/CJYtpN3eE/mUIgW2z1uDYQF1OzrQ8ubrksfsJvpAhENom
-lTQEppv9mV8qhcM278teb7TX0pgrUHLYF5CfPdp1L957JLLXoQR/lwLVABEBAAG0
-E2dvb2Qtc2lnbmluZy1zdWJrZXmIuAQTAQIAIgUCVUqeVwIbAwYLCQgHAwIGFQgC
-CQoLBBYCAwECHgECF4AACgkQNRjL95IRWP69XQQAlH6+eyXJN4DZTLX78KGjHrsw
-6FCvxxClEPtPUjcJy/1KCRQmtLAt9PbbA78dvgzjDeZMZqRAwdjyJhjyg/fkU2OH
-7wq4ktjUu+dLcOBb+BFMEY+YjKZhf6EJuVfxoTVr5f82XNPbYHfTho9/OABKH6kv
-X70PaKZhbwnwij8Nts65AaIEVUqftREEAJ3WxZfqAX0bTDbQPf2CMT2IVMGDfhK7
-GyubOZgDFFjwUJQvHNvsrbeGLZ0xOBumLINyPO1amIfTgJNm1iiWFWfmnHReGcDl
-y5mpYG60Mb79Whdcer7CMm3AqYh/dW4g6IB02NwZMKoUHo3PXmFLxMKXnWyJ0clw
-R0LI/Qn509yXAKDh1SO20rqrBM+EAP2c5bfI98kyNwQAi3buu94qo3RR1ZbvfxgW
-CKXDVm6N99jdZGNK7FbRifXqzJJDLcXZKLnstnC4Sd3uyfyf1uFhmDLIQRryn5m+
-LBYHfDBPN3kdm7bsZDDq9GbTHiFZUfm/tChVKXWxkhpAmHhU/tH6GGzNSMXuIWSO
-aOz3Rqq0ED4NXyNKjdF9MiwD/i83S0ZBc0LmJYt4Z10jtH2B6tYdqnAK29uQaadx
-yZCX2scE09UIm32/w7pV77CKr1Cp/4OzAXS1tmFzQ+bX7DR+Gl8t4wxr57VeEMvl
-BGw4Vjh3X8//m3xynxycQU18Q1zJ6PkiMyPw2owZ/nss3hpSRKFJsxMLhW3fKmKr
-Ey2KiOcEGAECAAkFAlVKn7UCGwIAUgkQNRjL95IRWP5HIAQZEQIABgUCVUqftQAK
-CRD98VjDN10SqkWrAKDTpEY8D8HC02E/KVC5YUI01B30wgCgurpILm20kXEDCeHp
-C5pygfXw1DJrhAP+NyPJ4um/bU1I+rXaHHJYroYJs8YSweiNcwiHDQn0Engh/mVZ
-SqLHvbKh2dL/RXymC3+rjPvQf5cup9bPxNMa6WagdYBNAfzWGtkVISeaQW+cTEp/
-MtgVijRGXR/lGLGETPg2X3Afwn9N9bLMBkBprKgbBqU7lpaoPupxT61bL70=
-=vtbN
------END PGP PUBLIC KEY BLOCK-----`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/compressed_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/compressed_test.go
deleted file mode 100644
index cb2d70bd411..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/compressed_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/hex"
- "io"
- "io/ioutil"
- "testing"
-)
-
-func TestCompressed(t *testing.T) {
- packet, err := Read(readerFromHex(compressedHex))
- if err != nil {
- t.Errorf("failed to read Compressed: %s", err)
- return
- }
-
- c, ok := packet.(*Compressed)
- if !ok {
- t.Error("didn't find Compressed packet")
- return
- }
-
- contents, err := ioutil.ReadAll(c.Body)
- if err != nil && err != io.EOF {
- t.Error(err)
- return
- }
-
- expected, _ := hex.DecodeString(compressedExpectedHex)
- if !bytes.Equal(expected, contents) {
- t.Errorf("got:%x want:%x", contents, expected)
- }
-}
-
-const compressedHex = "a3013b2d90c4e02b72e25f727e5e496a5e49b11e1700"
-const compressedExpectedHex = "cb1062004d14c8fe636f6e74656e74732e0a"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key_test.go
deleted file mode 100644
index fee14cf3cf0..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/encrypted_key_test.go
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto/rsa"
- "encoding/hex"
- "fmt"
- "math/big"
- "testing"
-)
-
-func bigFromBase10(s string) *big.Int {
- b, ok := new(big.Int).SetString(s, 10)
- if !ok {
- panic("bigFromBase10 failed")
- }
- return b
-}
-
-var encryptedKeyPub = rsa.PublicKey{
- E: 65537,
- N: bigFromBase10("115804063926007623305902631768113868327816898845124614648849934718568541074358183759250136204762053879858102352159854352727097033322663029387610959884180306668628526686121021235757016368038585212410610742029286439607686208110250133174279811431933746643015923132833417396844716207301518956640020862630546868823"),
-}
-
-var encryptedKeyRSAPriv = &rsa.PrivateKey{
- PublicKey: encryptedKeyPub,
- D: bigFromBase10("32355588668219869544751561565313228297765464314098552250409557267371233892496951383426602439009993875125222579159850054973310859166139474359774543943714622292329487391199285040721944491839695981199720170366763547754915493640685849961780092241140181198779299712578774460837139360803883139311171713302987058393"),
-}
-
-var encryptedKeyPriv = &PrivateKey{
- PublicKey: PublicKey{
- PubKeyAlgo: PubKeyAlgoRSA,
- },
- PrivateKey: encryptedKeyRSAPriv,
-}
-
-func TestDecryptingEncryptedKey(t *testing.T) {
- const encryptedKeyHex = "c18c032a67d68660df41c70104005789d0de26b6a50c985a02a13131ca829c413a35d0e6fa8d6842599252162808ac7439c72151c8c6183e76923fe3299301414d0c25a2f06a2257db3839e7df0ec964773f6e4c4ac7ff3b48c444237166dd46ba8ff443a5410dc670cb486672fdbe7c9dfafb75b4fea83af3a204fe2a7dfa86bd20122b4f3d2646cbeecb8f7be8"
- const expectedKeyHex = "d930363f7e0308c333b9618617ea728963d8df993665ae7be1092d4926fd864b"
-
- p, err := Read(readerFromHex(encryptedKeyHex))
- if err != nil {
- t.Errorf("error from Read: %s", err)
- return
- }
- ek, ok := p.(*EncryptedKey)
- if !ok {
- t.Errorf("didn't parse an EncryptedKey, got %#v", p)
- return
- }
-
- if ek.KeyId != 0x2a67d68660df41c7 || ek.Algo != PubKeyAlgoRSA {
- t.Errorf("unexpected EncryptedKey contents: %#v", ek)
- return
- }
-
- err = ek.Decrypt(encryptedKeyPriv, nil)
- if err != nil {
- t.Errorf("error from Decrypt: %s", err)
- return
- }
-
- if ek.CipherFunc != CipherAES256 {
- t.Errorf("unexpected EncryptedKey contents: %#v", ek)
- return
- }
-
- keyHex := fmt.Sprintf("%x", ek.Key)
- if keyHex != expectedKeyHex {
- t.Errorf("bad key, got %s want %x", keyHex, expectedKeyHex)
- }
-}
-
-func TestEncryptingEncryptedKey(t *testing.T) {
- key := []byte{1, 2, 3, 4}
- const expectedKeyHex = "01020304"
- const keyId = 42
-
- pub := &PublicKey{
- PublicKey: &encryptedKeyPub,
- KeyId: keyId,
- PubKeyAlgo: PubKeyAlgoRSAEncryptOnly,
- }
-
- buf := new(bytes.Buffer)
- err := SerializeEncryptedKey(buf, pub, CipherAES128, key, nil)
- if err != nil {
- t.Errorf("error writing encrypted key packet: %s", err)
- }
-
- p, err := Read(buf)
- if err != nil {
- t.Errorf("error from Read: %s", err)
- return
- }
- ek, ok := p.(*EncryptedKey)
- if !ok {
- t.Errorf("didn't parse an EncryptedKey, got %#v", p)
- return
- }
-
- if ek.KeyId != keyId || ek.Algo != PubKeyAlgoRSAEncryptOnly {
- t.Errorf("unexpected EncryptedKey contents: %#v", ek)
- return
- }
-
- err = ek.Decrypt(encryptedKeyPriv, nil)
- if err != nil {
- t.Errorf("error from Decrypt: %s", err)
- return
- }
-
- if ek.CipherFunc != CipherAES128 {
- t.Errorf("unexpected EncryptedKey contents: %#v", ek)
- return
- }
-
- keyHex := fmt.Sprintf("%x", ek.Key)
- if keyHex != expectedKeyHex {
- t.Errorf("bad key, got %s want %x", keyHex, expectedKeyHex)
- }
-}
-
-func TestSerializingEncryptedKey(t *testing.T) {
- const encryptedKeyHex = "c18c032a67d68660df41c70104005789d0de26b6a50c985a02a13131ca829c413a35d0e6fa8d6842599252162808ac7439c72151c8c6183e76923fe3299301414d0c25a2f06a2257db3839e7df0ec964773f6e4c4ac7ff3b48c444237166dd46ba8ff443a5410dc670cb486672fdbe7c9dfafb75b4fea83af3a204fe2a7dfa86bd20122b4f3d2646cbeecb8f7be8"
-
- p, err := Read(readerFromHex(encryptedKeyHex))
- if err != nil {
- t.Fatalf("error from Read: %s", err)
- }
- ek, ok := p.(*EncryptedKey)
- if !ok {
- t.Fatalf("didn't parse an EncryptedKey, got %#v", p)
- }
-
- var buf bytes.Buffer
- ek.Serialize(&buf)
-
- if bufHex := hex.EncodeToString(buf.Bytes()); bufHex != encryptedKeyHex {
- t.Fatalf("serialization of encrypted key differed from original. Original was %s, but reserialized as %s", encryptedKeyHex, bufHex)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/ocfb_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/ocfb_test.go
deleted file mode 100644
index 91022c042d4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/ocfb_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto/aes"
- "crypto/rand"
- "testing"
-)
-
-var commonKey128 = []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}
-
-func testOCFB(t *testing.T, resync OCFBResyncOption) {
- block, err := aes.NewCipher(commonKey128)
- if err != nil {
- t.Error(err)
- return
- }
-
- plaintext := []byte("this is the plaintext, which is long enough to span several blocks.")
- randData := make([]byte, block.BlockSize())
- rand.Reader.Read(randData)
- ocfb, prefix := NewOCFBEncrypter(block, randData, resync)
- ciphertext := make([]byte, len(plaintext))
- ocfb.XORKeyStream(ciphertext, plaintext)
-
- ocfbdec := NewOCFBDecrypter(block, prefix, resync)
- if ocfbdec == nil {
- t.Errorf("NewOCFBDecrypter failed (resync: %t)", resync)
- return
- }
- plaintextCopy := make([]byte, len(plaintext))
- ocfbdec.XORKeyStream(plaintextCopy, ciphertext)
-
- if !bytes.Equal(plaintextCopy, plaintext) {
- t.Errorf("got: %x, want: %x (resync: %t)", plaintextCopy, plaintext, resync)
- }
-}
-
-func TestOCFB(t *testing.T) {
- testOCFB(t, OCFBNoResync)
- testOCFB(t, OCFBResync)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/opaque_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/opaque_test.go
deleted file mode 100644
index f27bbfe090b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/opaque_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/hex"
- "io"
- "testing"
-)
-
-// Test packet.Read error handling in OpaquePacket.Parse,
-// which attempts to re-read an OpaquePacket as a supported
-// Packet type.
-func TestOpaqueParseReason(t *testing.T) {
- buf, err := hex.DecodeString(UnsupportedKeyHex)
- if err != nil {
- t.Fatal(err)
- }
- or := NewOpaqueReader(bytes.NewBuffer(buf))
- count := 0
- badPackets := 0
- var uid *UserId
- for {
- op, err := or.Next()
- if err == io.EOF {
- break
- } else if err != nil {
- t.Errorf("#%d: opaque read error: %v", count, err)
- break
- }
- // try to parse opaque packet
- p, err := op.Parse()
- switch pkt := p.(type) {
- case *UserId:
- uid = pkt
- case *OpaquePacket:
- // If an OpaquePacket can't re-parse, packet.Read
- // certainly had its reasons.
- if pkt.Reason == nil {
- t.Errorf("#%d: opaque packet, no reason", count)
- } else {
- badPackets++
- }
- }
- count++
- }
-
- const expectedBad = 3
- // Test post-conditions, make sure we actually parsed packets as expected.
- if badPackets != expectedBad {
- t.Errorf("unexpected # unparseable packets: %d (want %d)", badPackets, expectedBad)
- }
- if uid == nil {
- t.Errorf("failed to find expected UID in unsupported keyring")
- } else if uid.Id != "Armin M. Warda <warda@nephilim.ruhr.de>" {
- t.Errorf("unexpected UID: %v", uid.Id)
- }
-}
-
-// This key material has public key and signature packet versions modified to
-// an unsupported value (1), so that trying to parse the OpaquePacket to
-// a typed packet will get an error. It also contains a GnuPG trust packet.
-// (Created with: od -An -t x1 pubring.gpg | xargs | sed 's/ //g')
-const UnsupportedKeyHex = `988d012e7a18a20000010400d6ac00d92b89c1f4396c243abb9b76d2e9673ad63483291fed88e22b82e255e441c078c6abbbf7d2d195e50b62eeaa915b85b0ec20c225ce2c64c167cacb6e711daf2e45da4a8356a059b8160e3b3628ac0dd8437b31f06d53d6e8ea4214d4a26406a6b63e1001406ef23e0bb3069fac9a99a91f77dfafd5de0f188a5da5e3c9000511b42741726d696e204d2e205761726461203c7761726461406e657068696c696d2e727568722e64653e8900950105102e8936c705d1eb399e58489901013f0e03ff5a0c4f421e34fcfa388129166420c08cd76987bcdec6f01bd0271459a85cc22048820dd4e44ac2c7d23908d540f54facf1b36b0d9c20488781ce9dca856531e76e2e846826e9951338020a03a09b57aa5faa82e9267458bd76105399885ac35af7dc1cbb6aaed7c39e1039f3b5beda2c0e916bd38560509bab81235d1a0ead83b0020000`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/packet_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/packet_test.go
deleted file mode 100644
index 1dab5c3d588..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/packet_test.go
+++ /dev/null
@@ -1,255 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "golang.org/x/crypto/openpgp/errors"
- "io"
- "io/ioutil"
- "testing"
-)
-
-func TestReadFull(t *testing.T) {
- var out [4]byte
-
- b := bytes.NewBufferString("foo")
- n, err := readFull(b, out[:3])
- if n != 3 || err != nil {
- t.Errorf("full read failed n:%d err:%s", n, err)
- }
-
- b = bytes.NewBufferString("foo")
- n, err = readFull(b, out[:4])
- if n != 3 || err != io.ErrUnexpectedEOF {
- t.Errorf("partial read failed n:%d err:%s", n, err)
- }
-
- b = bytes.NewBuffer(nil)
- n, err = readFull(b, out[:3])
- if n != 0 || err != io.ErrUnexpectedEOF {
- t.Errorf("empty read failed n:%d err:%s", n, err)
- }
-}
-
-func readerFromHex(s string) io.Reader {
- data, err := hex.DecodeString(s)
- if err != nil {
- panic("readerFromHex: bad input")
- }
- return bytes.NewBuffer(data)
-}
-
-var readLengthTests = []struct {
- hexInput string
- length int64
- isPartial bool
- err error
-}{
- {"", 0, false, io.ErrUnexpectedEOF},
- {"1f", 31, false, nil},
- {"c0", 0, false, io.ErrUnexpectedEOF},
- {"c101", 256 + 1 + 192, false, nil},
- {"e0", 1, true, nil},
- {"e1", 2, true, nil},
- {"e2", 4, true, nil},
- {"ff", 0, false, io.ErrUnexpectedEOF},
- {"ff00", 0, false, io.ErrUnexpectedEOF},
- {"ff0000", 0, false, io.ErrUnexpectedEOF},
- {"ff000000", 0, false, io.ErrUnexpectedEOF},
- {"ff00000000", 0, false, nil},
- {"ff01020304", 16909060, false, nil},
-}
-
-func TestReadLength(t *testing.T) {
- for i, test := range readLengthTests {
- length, isPartial, err := readLength(readerFromHex(test.hexInput))
- if test.err != nil {
- if err != test.err {
- t.Errorf("%d: expected different error got:%s want:%s", i, err, test.err)
- }
- continue
- }
- if err != nil {
- t.Errorf("%d: unexpected error: %s", i, err)
- continue
- }
- if length != test.length || isPartial != test.isPartial {
- t.Errorf("%d: bad result got:(%d,%t) want:(%d,%t)", i, length, isPartial, test.length, test.isPartial)
- }
- }
-}
-
-var partialLengthReaderTests = []struct {
- hexInput string
- err error
- hexOutput string
-}{
- {"e0", io.ErrUnexpectedEOF, ""},
- {"e001", io.ErrUnexpectedEOF, ""},
- {"e0010102", nil, "0102"},
- {"ff00000000", nil, ""},
- {"e10102e1030400", nil, "01020304"},
- {"e101", io.ErrUnexpectedEOF, ""},
-}
-
-func TestPartialLengthReader(t *testing.T) {
- for i, test := range partialLengthReaderTests {
- r := &partialLengthReader{readerFromHex(test.hexInput), 0, true}
- out, err := ioutil.ReadAll(r)
- if test.err != nil {
- if err != test.err {
- t.Errorf("%d: expected different error got:%s want:%s", i, err, test.err)
- }
- continue
- }
- if err != nil {
- t.Errorf("%d: unexpected error: %s", i, err)
- continue
- }
-
- got := fmt.Sprintf("%x", out)
- if got != test.hexOutput {
- t.Errorf("%d: got:%s want:%s", i, test.hexOutput, got)
- }
- }
-}
-
-var readHeaderTests = []struct {
- hexInput string
- structuralError bool
- unexpectedEOF bool
- tag int
- length int64
- hexOutput string
-}{
- {"", false, false, 0, 0, ""},
- {"7f", true, false, 0, 0, ""},
-
- // Old format headers
- {"80", false, true, 0, 0, ""},
- {"8001", false, true, 0, 1, ""},
- {"800102", false, false, 0, 1, "02"},
- {"81000102", false, false, 0, 1, "02"},
- {"820000000102", false, false, 0, 1, "02"},
- {"860000000102", false, false, 1, 1, "02"},
- {"83010203", false, false, 0, -1, "010203"},
-
- // New format headers
- {"c0", false, true, 0, 0, ""},
- {"c000", false, false, 0, 0, ""},
- {"c00102", false, false, 0, 1, "02"},
- {"c0020203", false, false, 0, 2, "0203"},
- {"c00202", false, true, 0, 2, ""},
- {"c3020203", false, false, 3, 2, "0203"},
-}
-
-func TestReadHeader(t *testing.T) {
- for i, test := range readHeaderTests {
- tag, length, contents, err := readHeader(readerFromHex(test.hexInput))
- if test.structuralError {
- if _, ok := err.(errors.StructuralError); ok {
- continue
- }
- t.Errorf("%d: expected StructuralError, got:%s", i, err)
- continue
- }
- if err != nil {
- if len(test.hexInput) == 0 && err == io.EOF {
- continue
- }
- if !test.unexpectedEOF || err != io.ErrUnexpectedEOF {
- t.Errorf("%d: unexpected error from readHeader: %s", i, err)
- }
- continue
- }
- if int(tag) != test.tag || length != test.length {
- t.Errorf("%d: got:(%d,%d) want:(%d,%d)", i, int(tag), length, test.tag, test.length)
- continue
- }
-
- body, err := ioutil.ReadAll(contents)
- if err != nil {
- if !test.unexpectedEOF || err != io.ErrUnexpectedEOF {
- t.Errorf("%d: unexpected error from contents: %s", i, err)
- }
- continue
- }
- if test.unexpectedEOF {
- t.Errorf("%d: expected ErrUnexpectedEOF from contents but got no error", i)
- continue
- }
- got := fmt.Sprintf("%x", body)
- if got != test.hexOutput {
- t.Errorf("%d: got:%s want:%s", i, got, test.hexOutput)
- }
- }
-}
-
-func TestSerializeHeader(t *testing.T) {
- tag := packetTypePublicKey
- lengths := []int{0, 1, 2, 64, 192, 193, 8000, 8384, 8385, 10000}
-
- for _, length := range lengths {
- buf := bytes.NewBuffer(nil)
- serializeHeader(buf, tag, length)
- tag2, length2, _, err := readHeader(buf)
- if err != nil {
- t.Errorf("length %d, err: %s", length, err)
- }
- if tag2 != tag {
- t.Errorf("length %d, tag incorrect (got %d, want %d)", length, tag2, tag)
- }
- if int(length2) != length {
- t.Errorf("length %d, length incorrect (got %d)", length, length2)
- }
- }
-}
-
-func TestPartialLengths(t *testing.T) {
- buf := bytes.NewBuffer(nil)
- w := new(partialLengthWriter)
- w.w = noOpCloser{buf}
-
- const maxChunkSize = 64
-
- var b [maxChunkSize]byte
- var n uint8
- for l := 1; l <= maxChunkSize; l++ {
- for i := 0; i < l; i++ {
- b[i] = n
- n++
- }
- m, err := w.Write(b[:l])
- if m != l {
- t.Errorf("short write got: %d want: %d", m, l)
- }
- if err != nil {
- t.Errorf("error from write: %s", err)
- }
- }
- w.Close()
-
- want := (maxChunkSize * (maxChunkSize + 1)) / 2
- copyBuf := bytes.NewBuffer(nil)
- r := &partialLengthReader{buf, 0, true}
- m, err := io.Copy(copyBuf, r)
- if m != int64(want) {
- t.Errorf("short copy got: %d want: %d", m, want)
- }
- if err != nil {
- t.Errorf("error from copy: %s", err)
- }
-
- copyBytes := copyBuf.Bytes()
- for i := 0; i < want; i++ {
- if copyBytes[i] != uint8(i) {
- t.Errorf("bad pattern in copy at %d", i)
- break
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/private_key_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/private_key_test.go
deleted file mode 100644
index 25c8931f2ca..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/private_key_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "testing"
- "time"
-)
-
-var privateKeyTests = []struct {
- privateKeyHex string
- creationTime time.Time
-}{
- {
- privKeyRSAHex,
- time.Unix(0x4cc349a8, 0),
- },
- {
- privKeyElGamalHex,
- time.Unix(0x4df9ee1a, 0),
- },
-}
-
-func TestPrivateKeyRead(t *testing.T) {
- for i, test := range privateKeyTests {
- packet, err := Read(readerFromHex(test.privateKeyHex))
- if err != nil {
- t.Errorf("#%d: failed to parse: %s", i, err)
- continue
- }
-
- privKey := packet.(*PrivateKey)
-
- if !privKey.Encrypted {
- t.Errorf("#%d: private key isn't encrypted", i)
- continue
- }
-
- err = privKey.Decrypt([]byte("wrong password"))
- if err == nil {
- t.Errorf("#%d: decrypted with incorrect key", i)
- continue
- }
-
- err = privKey.Decrypt([]byte("testing"))
- if err != nil {
- t.Errorf("#%d: failed to decrypt: %s", i, err)
- continue
- }
-
- if !privKey.CreationTime.Equal(test.creationTime) || privKey.Encrypted {
- t.Errorf("#%d: bad result, got: %#v", i, privKey)
- }
- }
-}
-
-func TestIssue11505(t *testing.T) {
- // parsing a rsa private key with p or q == 1 used to panic due to a divide by zero
- _, _ = Read(readerFromHex("9c3004303030300100000011303030000000000000010130303030303030303030303030303030303030303030303030303030303030303030303030303030303030"))
-}
-
-// Generated with `gpg --export-secret-keys "Test Key 2"`
-const privKeyRSAHex = "9501fe044cc349a8010400b70ca0010e98c090008d45d1ee8f9113bd5861fd57b88bacb7c68658747663f1e1a3b5a98f32fda6472373c024b97359cd2efc88ff60f77751adfbf6af5e615e6a1408cfad8bf0cea30b0d5f53aa27ad59089ba9b15b7ebc2777a25d7b436144027e3bcd203909f147d0e332b240cf63d3395f5dfe0df0a6c04e8655af7eacdf0011010001fe0303024a252e7d475fd445607de39a265472aa74a9320ba2dac395faa687e9e0336aeb7e9a7397e511b5afd9dc84557c80ac0f3d4d7bfec5ae16f20d41c8c84a04552a33870b930420e230e179564f6d19bb153145e76c33ae993886c388832b0fa042ddda7f133924f3854481533e0ede31d51278c0519b29abc3bf53da673e13e3e1214b52413d179d7f66deee35cac8eacb060f78379d70ef4af8607e68131ff529439668fc39c9ce6dfef8a5ac234d234802cbfb749a26107db26406213ae5c06d4673253a3cbee1fcbae58d6ab77e38d6e2c0e7c6317c48e054edadb5a40d0d48acb44643d998139a8a66bb820be1f3f80185bc777d14b5954b60effe2448a036d565c6bc0b915fcea518acdd20ab07bc1529f561c58cd044f723109b93f6fd99f876ff891d64306b5d08f48bab59f38695e9109c4dec34013ba3153488ce070268381ba923ee1eb77125b36afcb4347ec3478c8f2735b06ef17351d872e577fa95d0c397c88c71b59629a36aec"
-
-// Generated by `gpg --export-secret-keys` followed by a manual extraction of
-// the ElGamal subkey from the packets.
-const privKeyElGamalHex = "9d0157044df9ee1a100400eb8e136a58ec39b582629cdadf830bc64e0a94ed8103ca8bb247b27b11b46d1d25297ef4bcc3071785ba0c0bedfe89eabc5287fcc0edf81ab5896c1c8e4b20d27d79813c7aede75320b33eaeeaa586edc00fd1036c10133e6ba0ff277245d0d59d04b2b3421b7244aca5f4a8d870c6f1c1fbff9e1c26699a860b9504f35ca1d700030503fd1ededd3b840795be6d9ccbe3c51ee42e2f39233c432b831ddd9c4e72b7025a819317e47bf94f9ee316d7273b05d5fcf2999c3a681f519b1234bbfa6d359b4752bd9c3f77d6b6456cde152464763414ca130f4e91d91041432f90620fec0e6d6b5116076c2985d5aeaae13be492b9b329efcaf7ee25120159a0a30cd976b42d7afe030302dae7eb80db744d4960c4df930d57e87fe81412eaace9f900e6c839817a614ddb75ba6603b9417c33ea7b6c93967dfa2bcff3fa3c74a5ce2c962db65b03aece14c96cbd0038fc"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_test.go
deleted file mode 100644
index 7ad7d91856d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_test.go
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/hex"
- "testing"
- "time"
-)
-
-var pubKeyTests = []struct {
- hexData string
- hexFingerprint string
- creationTime time.Time
- pubKeyAlgo PublicKeyAlgorithm
- keyId uint64
- keyIdString string
- keyIdShort string
-}{
- {rsaPkDataHex, rsaFingerprintHex, time.Unix(0x4d3c5c10, 0), PubKeyAlgoRSA, 0xa34d7e18c20c31bb, "A34D7E18C20C31BB", "C20C31BB"},
- {dsaPkDataHex, dsaFingerprintHex, time.Unix(0x4d432f89, 0), PubKeyAlgoDSA, 0x8e8fbe54062f19ed, "8E8FBE54062F19ED", "062F19ED"},
- {ecdsaPkDataHex, ecdsaFingerprintHex, time.Unix(0x5071c294, 0), PubKeyAlgoECDSA, 0x43fe956c542ca00b, "43FE956C542CA00B", "542CA00B"},
-}
-
-func TestPublicKeyRead(t *testing.T) {
- for i, test := range pubKeyTests {
- packet, err := Read(readerFromHex(test.hexData))
- if err != nil {
- t.Errorf("#%d: Read error: %s", i, err)
- continue
- }
- pk, ok := packet.(*PublicKey)
- if !ok {
- t.Errorf("#%d: failed to parse, got: %#v", i, packet)
- continue
- }
- if pk.PubKeyAlgo != test.pubKeyAlgo {
- t.Errorf("#%d: bad public key algorithm got:%x want:%x", i, pk.PubKeyAlgo, test.pubKeyAlgo)
- }
- if !pk.CreationTime.Equal(test.creationTime) {
- t.Errorf("#%d: bad creation time got:%v want:%v", i, pk.CreationTime, test.creationTime)
- }
- expectedFingerprint, _ := hex.DecodeString(test.hexFingerprint)
- if !bytes.Equal(expectedFingerprint, pk.Fingerprint[:]) {
- t.Errorf("#%d: bad fingerprint got:%x want:%x", i, pk.Fingerprint[:], expectedFingerprint)
- }
- if pk.KeyId != test.keyId {
- t.Errorf("#%d: bad keyid got:%x want:%x", i, pk.KeyId, test.keyId)
- }
- if g, e := pk.KeyIdString(), test.keyIdString; g != e {
- t.Errorf("#%d: bad KeyIdString got:%q want:%q", i, g, e)
- }
- if g, e := pk.KeyIdShortString(), test.keyIdShort; g != e {
- t.Errorf("#%d: bad KeyIdShortString got:%q want:%q", i, g, e)
- }
- }
-}
-
-func TestPublicKeySerialize(t *testing.T) {
- for i, test := range pubKeyTests {
- packet, err := Read(readerFromHex(test.hexData))
- if err != nil {
- t.Errorf("#%d: Read error: %s", i, err)
- continue
- }
- pk, ok := packet.(*PublicKey)
- if !ok {
- t.Errorf("#%d: failed to parse, got: %#v", i, packet)
- continue
- }
- serializeBuf := bytes.NewBuffer(nil)
- err = pk.Serialize(serializeBuf)
- if err != nil {
- t.Errorf("#%d: failed to serialize: %s", i, err)
- continue
- }
-
- packet, err = Read(serializeBuf)
- if err != nil {
- t.Errorf("#%d: Read error (from serialized data): %s", i, err)
- continue
- }
- pk, ok = packet.(*PublicKey)
- if !ok {
- t.Errorf("#%d: failed to parse serialized data, got: %#v", i, packet)
- continue
- }
- }
-}
-
-func TestEcc384Serialize(t *testing.T) {
- r := readerFromHex(ecc384PubHex)
- var w bytes.Buffer
- for i := 0; i < 2; i++ {
- // Public key
- p, err := Read(r)
- if err != nil {
- t.Error(err)
- }
- pubkey := p.(*PublicKey)
- if !bytes.Equal(pubkey.ec.oid, []byte{0x2b, 0x81, 0x04, 0x00, 0x22}) {
- t.Errorf("Unexpected pubkey OID: %x", pubkey.ec.oid)
- }
- if !bytes.Equal(pubkey.ec.p.bytes[:5], []byte{0x04, 0xf6, 0xb8, 0xc5, 0xac}) {
- t.Errorf("Unexpected pubkey P[:5]: %x", pubkey.ec.p.bytes)
- }
- if pubkey.KeyId != 0x098033880F54719F {
- t.Errorf("Unexpected pubkey ID: %x", pubkey.KeyId)
- }
- err = pubkey.Serialize(&w)
- if err != nil {
- t.Error(err)
- }
- // User ID
- p, err = Read(r)
- if err != nil {
- t.Error(err)
- }
- uid := p.(*UserId)
- if uid.Id != "ec_dsa_dh_384 <openpgp@brainhub.org>" {
- t.Error("Unexpected UID:", uid.Id)
- }
- err = uid.Serialize(&w)
- if err != nil {
- t.Error(err)
- }
- // User ID Sig
- p, err = Read(r)
- if err != nil {
- t.Error(err)
- }
- uidSig := p.(*Signature)
- err = pubkey.VerifyUserIdSignature(uid.Id, pubkey, uidSig)
- if err != nil {
- t.Error(err, ": UID")
- }
- err = uidSig.Serialize(&w)
- if err != nil {
- t.Error(err)
- }
- // Subkey
- p, err = Read(r)
- if err != nil {
- t.Error(err)
- }
- subkey := p.(*PublicKey)
- if !bytes.Equal(subkey.ec.oid, []byte{0x2b, 0x81, 0x04, 0x00, 0x22}) {
- t.Errorf("Unexpected subkey OID: %x", subkey.ec.oid)
- }
- if !bytes.Equal(subkey.ec.p.bytes[:5], []byte{0x04, 0x2f, 0xaa, 0x84, 0x02}) {
- t.Errorf("Unexpected subkey P[:5]: %x", subkey.ec.p.bytes)
- }
- if subkey.ecdh.KdfHash != 0x09 {
- t.Error("Expected KDF hash function SHA384 (0x09), got", subkey.ecdh.KdfHash)
- }
- if subkey.ecdh.KdfAlgo != 0x09 {
- t.Error("Expected KDF symmetric alg AES256 (0x09), got", subkey.ecdh.KdfAlgo)
- }
- if subkey.KeyId != 0xAA8B938F9A201946 {
- t.Errorf("Unexpected subkey ID: %x", subkey.KeyId)
- }
- err = subkey.Serialize(&w)
- if err != nil {
- t.Error(err)
- }
- // Subkey Sig
- p, err = Read(r)
- if err != nil {
- t.Error(err)
- }
- subkeySig := p.(*Signature)
- err = pubkey.VerifyKeySignature(subkey, subkeySig)
- if err != nil {
- t.Error(err)
- }
- err = subkeySig.Serialize(&w)
- if err != nil {
- t.Error(err)
- }
- // Now read back what we've written again
- r = bytes.NewBuffer(w.Bytes())
- w.Reset()
- }
-}
-
-const rsaFingerprintHex = "5fb74b1d03b1e3cb31bc2f8aa34d7e18c20c31bb"
-
-const rsaPkDataHex = "988d044d3c5c10010400b1d13382944bd5aba23a4312968b5095d14f947f600eb478e14a6fcb16b0e0cac764884909c020bc495cfcc39a935387c661507bdb236a0612fb582cac3af9b29cc2c8c70090616c41b662f4da4c1201e195472eb7f4ae1ccbcbf9940fe21d985e379a5563dde5b9a23d35f1cfaa5790da3b79db26f23695107bfaca8e7b5bcd0011010001"
-
-const dsaFingerprintHex = "eece4c094db002103714c63c8e8fbe54062f19ed"
-
-const dsaPkDataHex = "9901a2044d432f89110400cd581334f0d7a1e1bdc8b9d6d8c0baf68793632735d2bb0903224cbaa1dfbf35a60ee7a13b92643421e1eb41aa8d79bea19a115a677f6b8ba3c7818ce53a6c2a24a1608bd8b8d6e55c5090cbde09dd26e356267465ae25e69ec8bdd57c7bbb2623e4d73336f73a0a9098f7f16da2e25252130fd694c0e8070c55a812a423ae7f00a0ebf50e70c2f19c3520a551bd4b08d30f23530d3d03ff7d0bf4a53a64a09dc5e6e6e35854b7d70c882b0c60293401958b1bd9e40abec3ea05ba87cf64899299d4bd6aa7f459c201d3fbbd6c82004bdc5e8a9eb8082d12054cc90fa9d4ec251a843236a588bf49552441817436c4f43326966fe85447d4e6d0acf8fa1ef0f014730770603ad7634c3088dc52501c237328417c31c89ed70400b2f1a98b0bf42f11fefc430704bebbaa41d9f355600c3facee1e490f64208e0e094ea55e3a598a219a58500bf78ac677b670a14f4e47e9cf8eab4f368cc1ddcaa18cc59309d4cc62dd4f680e73e6cc3e1ce87a84d0925efbcb26c575c093fc42eecf45135fabf6403a25c2016e1774c0484e440a18319072c617cc97ac0a3bb0"
-
-const ecdsaFingerprintHex = "9892270b38b8980b05c8d56d43fe956c542ca00b"
-
-const ecdsaPkDataHex = "9893045071c29413052b8104002304230401f4867769cedfa52c325018896245443968e52e51d0c2df8d939949cb5b330f2921711fbee1c9b9dddb95d15cb0255e99badeddda7cc23d9ddcaacbc290969b9f24019375d61c2e4e3b36953a28d8b2bc95f78c3f1d592fb24499be348656a7b17e3963187b4361afe497bc5f9f81213f04069f8e1fb9e6a6290ae295ca1a92b894396cb4"
-
-// Source: https://sites.google.com/site/brainhub/pgpecckeys#TOC-ECC-NIST-P-384-key
-const ecc384PubHex = `99006f044d53059213052b81040022030304f6b8c5aced5b84ef9f4a209db2e4a9dfb70d28cb8c10ecd57674a9fa5a67389942b62d5e51367df4c7bfd3f8e500feecf07ed265a621a8ebbbe53e947ec78c677eba143bd1533c2b350e1c29f82313e1e1108eba063be1e64b10e6950e799c2db42465635f6473615f64685f333834203c6f70656e70677040627261696e6875622e6f72673e8900cb04101309005305024d530592301480000000002000077072656665727265642d656d61696c2d656e636f64696e67407067702e636f6d7067706d696d65040b090807021901051b03000000021602051e010000000415090a08000a0910098033880f54719fca2b0180aa37350968bd5f115afd8ce7bc7b103822152dbff06d0afcda835329510905b98cb469ba208faab87c7412b799e7b633017f58364ea480e8a1a3f253a0c5f22c446e8be9a9fce6210136ee30811abbd49139de28b5bdf8dc36d06ae748579e9ff503b90073044d53059212052b810400220303042faa84024a20b6735c4897efa5bfb41bf85b7eefeab5ca0cb9ffc8ea04a46acb25534a577694f9e25340a4ab5223a9dd1eda530c8aa2e6718db10d7e672558c7736fe09369ea5739a2a3554bf16d41faa50562f11c6d39bbd5dffb6b9a9ec9180301090989008404181309000c05024d530592051b0c000000000a0910098033880f54719f80970180eee7a6d8fcee41ee4f9289df17f9bcf9d955dca25c583b94336f3a2b2d4986dc5cf417b8d2dc86f741a9e1a6d236c0e3017d1c76575458a0cfb93ae8a2b274fcc65ceecd7a91eec83656ba13219969f06945b48c56bd04152c3a0553c5f2f4bd1267`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3_test.go
deleted file mode 100644
index e06405904b3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/public_key_v3_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/hex"
- "testing"
- "time"
-)
-
-var pubKeyV3Test = struct {
- hexFingerprint string
- creationTime time.Time
- pubKeyAlgo PublicKeyAlgorithm
- keyId uint64
- keyIdString string
- keyIdShort string
-}{
- "103BECF5BD1E837C89D19E98487767F7",
- time.Unix(779753634, 0),
- PubKeyAlgoRSA,
- 0xDE0F188A5DA5E3C9,
- "DE0F188A5DA5E3C9",
- "5DA5E3C9"}
-
-func TestPublicKeyV3Read(t *testing.T) {
- i, test := 0, pubKeyV3Test
- packet, err := Read(v3KeyReader(t))
- if err != nil {
- t.Fatalf("#%d: Read error: %s", i, err)
- }
- pk, ok := packet.(*PublicKeyV3)
- if !ok {
- t.Fatalf("#%d: failed to parse, got: %#v", i, packet)
- }
- if pk.PubKeyAlgo != test.pubKeyAlgo {
- t.Errorf("#%d: bad public key algorithm got:%x want:%x", i, pk.PubKeyAlgo, test.pubKeyAlgo)
- }
- if !pk.CreationTime.Equal(test.creationTime) {
- t.Errorf("#%d: bad creation time got:%v want:%v", i, pk.CreationTime, test.creationTime)
- }
- expectedFingerprint, _ := hex.DecodeString(test.hexFingerprint)
- if !bytes.Equal(expectedFingerprint, pk.Fingerprint[:]) {
- t.Errorf("#%d: bad fingerprint got:%x want:%x", i, pk.Fingerprint[:], expectedFingerprint)
- }
- if pk.KeyId != test.keyId {
- t.Errorf("#%d: bad keyid got:%x want:%x", i, pk.KeyId, test.keyId)
- }
- if g, e := pk.KeyIdString(), test.keyIdString; g != e {
- t.Errorf("#%d: bad KeyIdString got:%q want:%q", i, g, e)
- }
- if g, e := pk.KeyIdShortString(), test.keyIdShort; g != e {
- t.Errorf("#%d: bad KeyIdShortString got:%q want:%q", i, g, e)
- }
-}
-
-func TestPublicKeyV3Serialize(t *testing.T) {
- //for i, test := range pubKeyV3Tests {
- i := 0
- packet, err := Read(v3KeyReader(t))
- if err != nil {
- t.Fatalf("#%d: Read error: %s", i, err)
- }
- pk, ok := packet.(*PublicKeyV3)
- if !ok {
- t.Fatalf("#%d: failed to parse, got: %#v", i, packet)
- }
- var serializeBuf bytes.Buffer
- if err = pk.Serialize(&serializeBuf); err != nil {
- t.Fatalf("#%d: failed to serialize: %s", i, err)
- }
-
- if packet, err = Read(bytes.NewBuffer(serializeBuf.Bytes())); err != nil {
- t.Fatalf("#%d: Read error (from serialized data): %s", i, err)
- }
- if pk, ok = packet.(*PublicKeyV3); !ok {
- t.Fatalf("#%d: failed to parse serialized data, got: %#v", i, packet)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_test.go
deleted file mode 100644
index c1bbde8b0c3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto"
- "encoding/hex"
- "testing"
-)
-
-func TestSignatureRead(t *testing.T) {
- packet, err := Read(readerFromHex(signatureDataHex))
- if err != nil {
- t.Error(err)
- return
- }
- sig, ok := packet.(*Signature)
- if !ok || sig.SigType != SigTypeBinary || sig.PubKeyAlgo != PubKeyAlgoRSA || sig.Hash != crypto.SHA1 {
- t.Errorf("failed to parse, got: %#v", packet)
- }
-}
-
-func TestSignatureReserialize(t *testing.T) {
- packet, _ := Read(readerFromHex(signatureDataHex))
- sig := packet.(*Signature)
- out := new(bytes.Buffer)
- err := sig.Serialize(out)
- if err != nil {
- t.Errorf("error reserializing: %s", err)
- return
- }
-
- expected, _ := hex.DecodeString(signatureDataHex)
- if !bytes.Equal(expected, out.Bytes()) {
- t.Errorf("output doesn't match input (got vs expected):\n%s\n%s", hex.Dump(out.Bytes()), hex.Dump(expected))
- }
-}
-
-const signatureDataHex = "c2c05c04000102000605024cb45112000a0910ab105c91af38fb158f8d07ff5596ea368c5efe015bed6e78348c0f033c931d5f2ce5db54ce7f2a7e4b4ad64db758d65a7a71773edeab7ba2a9e0908e6a94a1175edd86c1d843279f045b021a6971a72702fcbd650efc393c5474d5b59a15f96d2eaad4c4c426797e0dcca2803ef41c6ff234d403eec38f31d610c344c06f2401c262f0993b2e66cad8a81ebc4322c723e0d4ba09fe917e8777658307ad8329adacba821420741009dfe87f007759f0982275d028a392c6ed983a0d846f890b36148c7358bdb8a516007fac760261ecd06076813831a36d0459075d1befa245ae7f7fb103d92ca759e9498fe60ef8078a39a3beda510deea251ea9f0a7f0df6ef42060f20780360686f3e400e"
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_v3_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_v3_test.go
deleted file mode 100644
index ad7b62ac193..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/signature_v3_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto"
- "encoding/hex"
- "io"
- "io/ioutil"
- "testing"
-
- "golang.org/x/crypto/openpgp/armor"
-)
-
-func TestSignatureV3Read(t *testing.T) {
- r := v3KeyReader(t)
- Read(r) // Skip public key
- Read(r) // Skip uid
- packet, err := Read(r) // Signature
- if err != nil {
- t.Error(err)
- return
- }
- sig, ok := packet.(*SignatureV3)
- if !ok || sig.SigType != SigTypeGenericCert || sig.PubKeyAlgo != PubKeyAlgoRSA || sig.Hash != crypto.MD5 {
- t.Errorf("failed to parse, got: %#v", packet)
- }
-}
-
-func TestSignatureV3Reserialize(t *testing.T) {
- r := v3KeyReader(t)
- Read(r) // Skip public key
- Read(r) // Skip uid
- packet, err := Read(r)
- if err != nil {
- t.Error(err)
- return
- }
- sig := packet.(*SignatureV3)
- out := new(bytes.Buffer)
- if err = sig.Serialize(out); err != nil {
- t.Errorf("error reserializing: %s", err)
- return
- }
- expected, err := ioutil.ReadAll(v3KeyReader(t))
- if err != nil {
- t.Error(err)
- return
- }
- expected = expected[4+141+4+39:] // See pgpdump offsets below, this is where the sig starts
- if !bytes.Equal(expected, out.Bytes()) {
- t.Errorf("output doesn't match input (got vs expected):\n%s\n%s", hex.Dump(out.Bytes()), hex.Dump(expected))
- }
-}
-
-func v3KeyReader(t *testing.T) io.Reader {
- armorBlock, err := armor.Decode(bytes.NewBufferString(keySigV3Armor))
- if err != nil {
- t.Fatalf("armor Decode failed: %v", err)
- }
- return armorBlock.Body
-}
-
-// keySigV3Armor is some V3 public key I found in an SKS dump.
-// Old: Public Key Packet(tag 6)(141 bytes)
-// Ver 4 - new
-// Public key creation time - Fri Sep 16 17:13:54 CDT 1994
-// Pub alg - unknown(pub 0)
-// Unknown public key(pub 0)
-// Old: User ID Packet(tag 13)(39 bytes)
-// User ID - Armin M. Warda <warda@nephilim.ruhr.de>
-// Old: Signature Packet(tag 2)(149 bytes)
-// Ver 4 - new
-// Sig type - unknown(05)
-// Pub alg - ElGamal Encrypt-Only(pub 16)
-// Hash alg - unknown(hash 46)
-// Hashed Sub: unknown(sub 81, critical)(1988 bytes)
-const keySigV3Armor = `-----BEGIN PGP PUBLIC KEY BLOCK-----
-Version: SKS 1.0.10
-
-mI0CLnoYogAAAQQA1qwA2SuJwfQ5bCQ6u5t20ulnOtY0gykf7YjiK4LiVeRBwHjGq7v30tGV
-5Qti7qqRW4Ww7CDCJc4sZMFnystucR2vLkXaSoNWoFm4Fg47NiisDdhDezHwbVPW6OpCFNSi
-ZAamtj4QAUBu8j4LswafrJqZqR9336/V3g8Yil2l48kABRG0J0FybWluIE0uIFdhcmRhIDx3
-YXJkYUBuZXBoaWxpbS5ydWhyLmRlPoiVAgUQLok2xwXR6zmeWEiZAQE/DgP/WgxPQh40/Po4
-gSkWZCDAjNdph7zexvAb0CcUWahcwiBIgg3U5ErCx9I5CNVA9U+s8bNrDZwgSIeBzp3KhWUx
-524uhGgm6ZUTOAIKA6CbV6pfqoLpJnRYvXYQU5mIWsNa99wcu2qu18OeEDnztb7aLA6Ra9OF
-YFCbq4EjXRoOrYM=
-=LPjs
------END PGP PUBLIC KEY BLOCK-----`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted_test.go
deleted file mode 100644
index 19538df77c9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/hex"
- "io"
- "io/ioutil"
- "testing"
-)
-
-func TestSymmetricKeyEncrypted(t *testing.T) {
- buf := readerFromHex(symmetricallyEncryptedHex)
- packet, err := Read(buf)
- if err != nil {
- t.Errorf("failed to read SymmetricKeyEncrypted: %s", err)
- return
- }
- ske, ok := packet.(*SymmetricKeyEncrypted)
- if !ok {
- t.Error("didn't find SymmetricKeyEncrypted packet")
- return
- }
- key, cipherFunc, err := ske.Decrypt([]byte("password"))
- if err != nil {
- t.Error(err)
- return
- }
-
- packet, err = Read(buf)
- if err != nil {
- t.Errorf("failed to read SymmetricallyEncrypted: %s", err)
- return
- }
- se, ok := packet.(*SymmetricallyEncrypted)
- if !ok {
- t.Error("didn't find SymmetricallyEncrypted packet")
- return
- }
- r, err := se.Decrypt(cipherFunc, key)
- if err != nil {
- t.Error(err)
- return
- }
-
- contents, err := ioutil.ReadAll(r)
- if err != nil && err != io.EOF {
- t.Error(err)
- return
- }
-
- expectedContents, _ := hex.DecodeString(symmetricallyEncryptedContentsHex)
- if !bytes.Equal(expectedContents, contents) {
- t.Errorf("bad contents got:%x want:%x", contents, expectedContents)
- }
-}
-
-const symmetricallyEncryptedHex = "8c0d04030302371a0b38d884f02060c91cf97c9973b8e58e028e9501708ccfe618fb92afef7fa2d80ddadd93cf"
-const symmetricallyEncryptedContentsHex = "cb1062004d14c4df636f6e74656e74732e0a"
-
-func TestSerializeSymmetricKeyEncrypted(t *testing.T) {
- buf := bytes.NewBuffer(nil)
- passphrase := []byte("testing")
- const cipherFunc = CipherAES128
- config := &Config{
- DefaultCipher: cipherFunc,
- }
-
- key, err := SerializeSymmetricKeyEncrypted(buf, passphrase, config)
- if err != nil {
- t.Errorf("failed to serialize: %s", err)
- return
- }
-
- p, err := Read(buf)
- if err != nil {
- t.Errorf("failed to reparse: %s", err)
- return
- }
- ske, ok := p.(*SymmetricKeyEncrypted)
- if !ok {
- t.Errorf("parsed a different packet type: %#v", p)
- return
- }
-
- if ske.CipherFunc != config.DefaultCipher {
- t.Errorf("SKE cipher function is %d (expected %d)", ske.CipherFunc, config.DefaultCipher)
- }
- parsedKey, parsedCipherFunc, err := ske.Decrypt(passphrase)
- if err != nil {
- t.Errorf("failed to decrypt reparsed SKE: %s", err)
- return
- }
- if !bytes.Equal(key, parsedKey) {
- t.Errorf("keys don't match after Decrypt: %x (original) vs %x (parsed)", key, parsedKey)
- }
- if parsedCipherFunc != cipherFunc {
- t.Errorf("cipher function doesn't match after Decrypt: %d (original) vs %d (parsed)", cipherFunc, parsedCipherFunc)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted_test.go
deleted file mode 100644
index c5c00f7b9c3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "crypto/sha1"
- "encoding/hex"
- "golang.org/x/crypto/openpgp/errors"
- "io"
- "io/ioutil"
- "testing"
-)
-
-// TestReader wraps a []byte and returns reads of a specific length.
-type testReader struct {
- data []byte
- stride int
-}
-
-func (t *testReader) Read(buf []byte) (n int, err error) {
- n = t.stride
- if n > len(t.data) {
- n = len(t.data)
- }
- if n > len(buf) {
- n = len(buf)
- }
- copy(buf, t.data)
- t.data = t.data[n:]
- if len(t.data) == 0 {
- err = io.EOF
- }
- return
-}
-
-func testMDCReader(t *testing.T) {
- mdcPlaintext, _ := hex.DecodeString(mdcPlaintextHex)
-
- for stride := 1; stride < len(mdcPlaintext)/2; stride++ {
- r := &testReader{data: mdcPlaintext, stride: stride}
- mdcReader := &seMDCReader{in: r, h: sha1.New()}
- body, err := ioutil.ReadAll(mdcReader)
- if err != nil {
- t.Errorf("stride: %d, error: %s", stride, err)
- continue
- }
- if !bytes.Equal(body, mdcPlaintext[:len(mdcPlaintext)-22]) {
- t.Errorf("stride: %d: bad contents %x", stride, body)
- continue
- }
-
- err = mdcReader.Close()
- if err != nil {
- t.Errorf("stride: %d, error on Close: %s", stride, err)
- }
- }
-
- mdcPlaintext[15] ^= 80
-
- r := &testReader{data: mdcPlaintext, stride: 2}
- mdcReader := &seMDCReader{in: r, h: sha1.New()}
- _, err := ioutil.ReadAll(mdcReader)
- if err != nil {
- t.Errorf("corruption test, error: %s", err)
- return
- }
- err = mdcReader.Close()
- if err == nil {
- t.Error("corruption: no error")
- } else if _, ok := err.(*errors.SignatureError); !ok {
- t.Errorf("corruption: expected SignatureError, got: %s", err)
- }
-}
-
-const mdcPlaintextHex = "a302789c3b2d93c4e0eb9aba22283539b3203335af44a134afb800c849cb4c4de10200aff40b45d31432c80cb384299a0655966d6939dfdeed1dddf980"
-
-func TestSerialize(t *testing.T) {
- buf := bytes.NewBuffer(nil)
- c := CipherAES128
- key := make([]byte, c.KeySize())
-
- w, err := SerializeSymmetricallyEncrypted(buf, c, key, nil)
- if err != nil {
- t.Errorf("error from SerializeSymmetricallyEncrypted: %s", err)
- return
- }
-
- contents := []byte("hello world\n")
-
- w.Write(contents)
- w.Close()
-
- p, err := Read(buf)
- if err != nil {
- t.Errorf("error from Read: %s", err)
- return
- }
-
- se, ok := p.(*SymmetricallyEncrypted)
- if !ok {
- t.Errorf("didn't read a *SymmetricallyEncrypted")
- return
- }
-
- r, err := se.Decrypt(c, key)
- if err != nil {
- t.Errorf("error from Decrypt: %s", err)
- return
- }
-
- contentsCopy := bytes.NewBuffer(nil)
- _, err = io.Copy(contentsCopy, r)
- if err != nil {
- t.Errorf("error from io.Copy: %s", err)
- return
- }
- if !bytes.Equal(contentsCopy.Bytes(), contents) {
- t.Errorf("contents not equal got: %x want: %x", contentsCopy.Bytes(), contents)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userattribute_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userattribute_test.go
deleted file mode 100644
index 13ca5143cee..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userattribute_test.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "bytes"
- "encoding/base64"
- "image/color"
- "image/jpeg"
- "testing"
-)
-
-func TestParseUserAttribute(t *testing.T) {
- r := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(userAttributePacket))
- for i := 0; i < 2; i++ {
- p, err := Read(r)
- if err != nil {
- t.Fatal(err)
- }
- uat := p.(*UserAttribute)
- imgs := uat.ImageData()
- if len(imgs) != 1 {
- t.Errorf("Unexpected number of images in user attribute packet: %d", len(imgs))
- }
- if len(imgs[0]) != 3395 {
- t.Errorf("Unexpected JPEG image size: %d", len(imgs[0]))
- }
- img, err := jpeg.Decode(bytes.NewBuffer(imgs[0]))
- if err != nil {
- t.Errorf("Error decoding JPEG image: %v", err)
- }
- // A pixel in my right eye.
- pixel := color.NRGBAModel.Convert(img.At(56, 36))
- ref := color.NRGBA{R: 157, G: 128, B: 124, A: 255}
- if pixel != ref {
- t.Errorf("Unexpected pixel color: %v", pixel)
- }
- w := bytes.NewBuffer(nil)
- err = uat.Serialize(w)
- if err != nil {
- t.Errorf("Error writing user attribute: %v", err)
- }
- r = bytes.NewBuffer(w.Bytes())
- }
-}
-
-const userAttributePacket = `
-0cyWzJQBEAABAQAAAAAAAAAAAAAAAP/Y/+AAEEpGSUYAAQIAAAEAAQAA/9sAQwAFAwQEBAMFBAQE
-BQUFBgcMCAcHBwcPCgsJDBEPEhIRDxEQExYcFxMUGhUQERghGBocHR8fHxMXIiQiHiQcHh8e/9sA
-QwEFBQUHBgcOCAgOHhQRFB4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4e
-Hh4eHh4eHh4e/8AAEQgAZABkAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYH
-CAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHw
-JDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6
-g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk
-5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIB
-AgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEX
-GBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKT
-lJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX2
-9/j5+v/aAAwDAQACEQMRAD8A5uGP06VehQ4pIox04q5EnHSvAep+hIIl4zVuMHGPWmRrUWtalaaN
-pU2oXsgSGJSxPr6ClvoitErs0Itqjc7BQOpPAFYmrfEnwjojtHNqaXEynBjtx5hH4jj9a8B8d+Od
-W8UXZjWR4LJT+7t0Jwfc+prnIdO1CWZEW2mZ3HyDactXXDB3V5s8evm1namj6r0H4weCLtxG+ova
-ueP30RA/MV6not1bX0Ed1ZzxzwyDKvGwZSPqK+Ff+ES8R8t/ZV2oHUmM10Hgbxp4m8BatEfNnWBH
-/eWshOxx9Kmpg4te49RUM1kn+8Wh9zQ4P1FaMC7l465rjPh14y0fxnoseoaXOpfaPOgJ+eI98j09
-67W19M15bi4uzPSqTU480WXkjZkAyAR61DPE6OCSOalWRRgZxjvTb598sfU4FBwx5uY4T4feIm8P
-TeJbAgc65NIM+8cX+FFeLfF3Vr3SfiNrMFrMypJMJcDPUqP8KK+kpVFyLU+ar037SXqX4hxVpMY7
-1UhPpVlT2rybKx9smWYz3NeH/EDVLzxt40j8O6bITaQybPlbKkjq39K9O8fasdH8IahfKxWQRFIy
-Ou9uB/OuE/Z/0y3j1d9TuyoZCMs5xjuea1pLli5nn46q240l13PcfhN8EvDNtpcEl/CklyVBLuMk
-mvU/Dfwo0BL/AO13FjEDD/qyV7Vn+CvGPg8zRpJrVm8ikLtEg6+1ew2dxZ3EQaJgysuQPasH7eXW
-1zzsbVhT92kk/PsYieEND+zlPs6c/wCyAPyryH4wfCPRtW0u6j+xRLOxLxSoADkDpXY+MPjJ4c0S
-9k082d3O8ZKkxw5XI96ytK+IGk+IpFjRpod+Qq3C7QT6A1E6NenaXbqRg6rlLlqS0fRnxjpd1r/w
-w8afa7GWRPKbZLGeBKmeVNfZngLxNaeKfDdprVjxHcLlkJ5Vh1H5185/tDad9h8XOsqAw3Cb0cjq
-CfX61P8AsveKf7L8T3fhe5nxa3g324YniQdh9R/KuivTdSmp9TXB1/Z1nRlsfU249QBx1pWfcwI7
-Cq6u2Ovamb9rYz16V5x7Psz5q/aJhZfibcupIElvE3H+7j+lFbXx9szP45jlUfeso8/99OKK9elL
-3EeNVopzZVharCtxVRGGMk02S5JyFOB69zWTieypnL/GksfB+0cr9oQt69awPhPpD69Y3Ky3DWth
-CWluGU4LAdq3vibGs/g68BJygVxjrwRW5+ztoRv/AAs8EeCZnO/J/hzz/Kumi4wp3kePjlOdZKPY
-ml8Mvo6WM9ppi7J0EkQYMzkb1X0wW+bJHGACa+ivg14huZPCkjXUO6SImIYOQAP6UQ2sGneHmiWF
-CYoSAAuM8etXfhBpMr+EZ3SSNRcMx6ZxWdes6ytBGSwkMNFuo7pnP614Ut9Zn1C4uLySKcwObGFA
-Qnm4+XcR71h+CfDHiKCQWuv2YWFtw+bBZQD8rcE8n2Ney+GbGGQSM6I7xvtI681rXdp8hKRRp6t3
-FYPE1VDlsY1nQjWdl+J8w/tOeDZZ/AMd/EGefTHyxxyYjwfyODXg3waRh8UtEcFh+8Jb8FNfZPxh
-Ak8J6nbPIsiyW7LnseK+Ofh99ptPHFnf2lu0y2twGcKuSEPB/Q1WHk50miq1o14TXU+xop+On61H
-NMC6Nis1LgsAcUTSt1APFcXJZn0EqmhyvxA037friTYziBV6f7Tf40Vr3k4aXLx5OMZIzRXZB2ik
-efJXbPHJJcnaD9aN2R1qoGO8/WkuLlIV+YjdjpXSonQ5lTxfiTwzqCnkeQxx9BWx+zPrQsrBFYja
-zEfrXL6lfie3khcjY6lSPUGud+G3iA6FrY0uQ/KJsA9gCa0jSvFpnBi6tpKSPu++nsIfDFxeXciR
-qIicscY4rxTwB8RUkn1axsPEf2LTYx85kTGzqCUP8VcJ47+JOs+I0Hhq1njjt/ufIeSvq1VtE+Gs
-eoaUbSHUrkHdu3WtuX5Ix81XRh7OL5jirVpV5Whdn0F8C/iX4auVn0i612T7bASoe8wjTAd89K9g
-vtSt5NMa4t5lkRhgOh3Dn6V8aaz8KZrIR3OlQ6r56LySmSxxz06Vo/CHx34h0rxBP4XvJ5AjK2RP
-nEbAEj6ZxjPrWM6fMmoswqJxqJ1VZnqHxn1NLPwveqWHmNC2BnnNcD8DfDkGi+CH1m+ijN1qMzNA
-4GSIiAMf+hVxPxU8Tapc3c0F9MGCn5GU5BX0Pau3+HmrT3XgXSIJCBHDGdgAx1NYSpezha52Yauq
-1dya2Wh2onAIwTj1p0lxxWWLkhRyCKWa5O3ORXOos9KVQluZm83j0oqi84JyWH50Vdmc7ep43d3I
-t1Z2Iz2FYdxeSTsxyRnvTdVuDNcNluM9KrKcg817NOnZGNbEXdkNckjrXGeIIprPxFFdRHAlIwem
-COtdmxrG8Q2cd/ZNExw45RvQ1bVjim+dWNzw7eaTD4mN3dndCQCo6hmI5zXpj/Ea/wBHjkh0kwRW
-xXEfl4yTxXzXZalJDL9nuWKMmRnHcV2Hh3WreCyYXW2SWQhd5P3F6n+lS43d2cTm6d7Ox9EWPxH1
-ODQxPqWpCaSU/ukUc4z3/WvKW8UhviAdaMewYZG98gj9c1ymoa8LyWOJHwkTDaVPb0qpr+q2m6Nb
-cfvNo349az9mou9iZVXNWbub3jm98/Vza2ReV7lsJg/e3dsV654UR9N0K0sZP9ZDGFbHr3rzL4P+
-H7rXfEEWr3I3W1qf3IYdW9fwqDxf4k8UeH/G95p08kscHmk25dPlZT0we9YTj7SXKjpw1aNG8mj3
-FLv5ccU959ycnmvKPDnxB82YQarGsZPAlTp+IrvIr1ZIgySKwIyCOhFYTpyg9T0qWIhVV4svzPvf
-IdhgY4orPachj81FRdmtzxqdiZmJ9aQEgdqZcPtmbJ71DJcAZ5r20kkeXJtsfPIQDwPzrG1a+S3i
-LyHAHvmp7y7HOD1rlNdm+1T7Acovf3o+J2RMpezjzMvrob67pX9o2ShZlYgg/wAWKxZLLWLZ/Ke3
-mVh14yK9M+BMC3dre2ko3LHKCB7EV7EngeGQJdQ7HyBkMKS0djgq1W3c+XtK03U522RwzsTwNiEk
-ntXoHgf4calql9El/G8UZbLfLyfr7V9FeGvh+s+0Lbxxcglu2K1NW1nwN4Gk/wBLuI57tV5jjwzE
-/QVNS+0dWYRqNvXRFv4eeCodKsY1ggVIY1G3K4z714h+1Jqul3GpwaXYeXJLbzgyyrg4b+6D+HNb
-vjz436zq9m+naHF/ZdkeGfOZXH17V4Vqt2b29K+ZuOc5bnce5zWdPBShL2lTfojSeJhy+zp/NjVz
-1Bwa6DSfFGq6fbJFDKrov8DjPFcu97ZxsUe4jVhwVJ5Bpp1mwQiLewJPXacVq6fNpYyjOUXdHoKf
-EG8VQHsInbuVcgflRXnt5fIs2FYHgcgUVi8LG+xusdW/mN7U2KgEVkTzPt60UVfQ9eHxGHrV1MGi
-iD4V25x1qvdgLAMd6KK0pbHm4x++dp8FtUubLxJ5EIjMc+A4Za+qfD8pe1JZVOBmiinW3RyRPMfi
-R8QPE638+k2l6LK0Hylbddhb6nOa80mlkcmWR2kcnlnOSaKK7qCXKcNdu5narcSrAoBxvODWJIga
-VckjDdqKKwq/EaQ0gUdbjQ6mr7QGBUcd6tPBC6gtGpOOuKKKie5qn7qIpEXd0HSiiimSf//Z`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userid_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userid_test.go
deleted file mode 100644
index 29681938938..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/packet/userid_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package packet
-
-import (
- "testing"
-)
-
-var userIdTests = []struct {
- id string
- name, comment, email string
-}{
- {"", "", "", ""},
- {"John Smith", "John Smith", "", ""},
- {"John Smith ()", "John Smith", "", ""},
- {"John Smith () <>", "John Smith", "", ""},
- {"(comment", "", "comment", ""},
- {"(comment)", "", "comment", ""},
- {"<email", "", "", "email"},
- {"<email> sdfk", "", "", "email"},
- {" John Smith ( Comment ) asdkflj < email > lksdfj", "John Smith", "Comment", "email"},
- {" John Smith < email > lksdfj", "John Smith", "", "email"},
- {"(<foo", "", "<foo", ""},
- {"René Descartes (العربي)", "René Descartes", "العربي", ""},
-}
-
-func TestParseUserId(t *testing.T) {
- for i, test := range userIdTests {
- name, comment, email := parseUserId(test.id)
- if name != test.name {
- t.Errorf("%d: name mismatch got:%s want:%s", i, name, test.name)
- }
- if comment != test.comment {
- t.Errorf("%d: comment mismatch got:%s want:%s", i, comment, test.comment)
- }
- if email != test.email {
- t.Errorf("%d: email mismatch got:%s want:%s", i, email, test.email)
- }
- }
-}
-
-var newUserIdTests = []struct {
- name, comment, email, id string
-}{
- {"foo", "", "", "foo"},
- {"", "bar", "", "(bar)"},
- {"", "", "baz", "<baz>"},
- {"foo", "bar", "", "foo (bar)"},
- {"foo", "", "baz", "foo <baz>"},
- {"", "bar", "baz", "(bar) <baz>"},
- {"foo", "bar", "baz", "foo (bar) <baz>"},
-}
-
-func TestNewUserId(t *testing.T) {
- for i, test := range newUserIdTests {
- uid := NewUserId(test.name, test.comment, test.email)
- if uid == nil {
- t.Errorf("#%d: returned nil", i)
- continue
- }
- if uid.Id != test.id {
- t.Errorf("#%d: got '%s', want '%s'", i, uid.Id, test.id)
- }
- }
-}
-
-var invalidNewUserIdTests = []struct {
- name, comment, email string
-}{
- {"foo(", "", ""},
- {"foo<", "", ""},
- {"", "bar)", ""},
- {"", "bar<", ""},
- {"", "", "baz>"},
- {"", "", "baz)"},
- {"", "", "baz\x00"},
-}
-
-func TestNewUserIdWithInvalidInput(t *testing.T) {
- for i, test := range invalidNewUserIdTests {
- if uid := NewUserId(test.name, test.comment, test.email); uid != nil {
- t.Errorf("#%d: returned non-nil value: %#v", i, uid)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/read_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/read_test.go
deleted file mode 100644
index 7524a02e56d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/read_test.go
+++ /dev/null
@@ -1,512 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package openpgp
-
-import (
- "bytes"
- _ "crypto/sha512"
- "encoding/hex"
- "io"
- "io/ioutil"
- "strings"
- "testing"
-
- "golang.org/x/crypto/openpgp/errors"
-)
-
-func readerFromHex(s string) io.Reader {
- data, err := hex.DecodeString(s)
- if err != nil {
- panic("readerFromHex: bad input")
- }
- return bytes.NewBuffer(data)
-}
-
-func TestReadKeyRing(t *testing.T) {
- kring, err := ReadKeyRing(readerFromHex(testKeys1And2Hex))
- if err != nil {
- t.Error(err)
- return
- }
- if len(kring) != 2 || uint32(kring[0].PrimaryKey.KeyId) != 0xC20C31BB || uint32(kring[1].PrimaryKey.KeyId) != 0x1E35246B {
- t.Errorf("bad keyring: %#v", kring)
- }
-}
-
-func TestRereadKeyRing(t *testing.T) {
- kring, err := ReadKeyRing(readerFromHex(testKeys1And2Hex))
- if err != nil {
- t.Errorf("error in initial parse: %s", err)
- return
- }
- out := new(bytes.Buffer)
- err = kring[0].Serialize(out)
- if err != nil {
- t.Errorf("error in serialization: %s", err)
- return
- }
- kring, err = ReadKeyRing(out)
- if err != nil {
- t.Errorf("error in second parse: %s", err)
- return
- }
-
- if len(kring) != 1 || uint32(kring[0].PrimaryKey.KeyId) != 0xC20C31BB {
- t.Errorf("bad keyring: %#v", kring)
- }
-}
-
-func TestReadPrivateKeyRing(t *testing.T) {
- kring, err := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
- if err != nil {
- t.Error(err)
- return
- }
- if len(kring) != 2 || uint32(kring[0].PrimaryKey.KeyId) != 0xC20C31BB || uint32(kring[1].PrimaryKey.KeyId) != 0x1E35246B || kring[0].PrimaryKey == nil {
- t.Errorf("bad keyring: %#v", kring)
- }
-}
-
-func TestReadDSAKey(t *testing.T) {
- kring, err := ReadKeyRing(readerFromHex(dsaTestKeyHex))
- if err != nil {
- t.Error(err)
- return
- }
- if len(kring) != 1 || uint32(kring[0].PrimaryKey.KeyId) != 0x0CCC0360 {
- t.Errorf("bad parse: %#v", kring)
- }
-}
-
-func TestDSAHashTruncatation(t *testing.T) {
- // dsaKeyWithSHA512 was generated with GnuPG and --cert-digest-algo
- // SHA512 in order to require DSA hash truncation to verify correctly.
- _, err := ReadKeyRing(readerFromHex(dsaKeyWithSHA512))
- if err != nil {
- t.Error(err)
- }
-}
-
-func TestGetKeyById(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2Hex))
-
- keys := kring.KeysById(0xa34d7e18c20c31bb)
- if len(keys) != 1 || keys[0].Entity != kring[0] {
- t.Errorf("bad result for 0xa34d7e18c20c31bb: %#v", keys)
- }
-
- keys = kring.KeysById(0xfd94408d4543314f)
- if len(keys) != 1 || keys[0].Entity != kring[0] {
- t.Errorf("bad result for 0xa34d7e18c20c31bb: %#v", keys)
- }
-}
-
-func checkSignedMessage(t *testing.T, signedHex, expected string) {
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2Hex))
-
- md, err := ReadMessage(readerFromHex(signedHex), kring, nil, nil)
- if err != nil {
- t.Error(err)
- return
- }
-
- if !md.IsSigned || md.SignedByKeyId != 0xa34d7e18c20c31bb || md.SignedBy == nil || md.IsEncrypted || md.IsSymmetricallyEncrypted || len(md.EncryptedToKeyIds) != 0 || md.IsSymmetricallyEncrypted {
- t.Errorf("bad MessageDetails: %#v", md)
- }
-
- contents, err := ioutil.ReadAll(md.UnverifiedBody)
- if err != nil {
- t.Errorf("error reading UnverifiedBody: %s", err)
- }
- if string(contents) != expected {
- t.Errorf("bad UnverifiedBody got:%s want:%s", string(contents), expected)
- }
- if md.SignatureError != nil || md.Signature == nil {
- t.Errorf("failed to validate: %s", md.SignatureError)
- }
-}
-
-func TestSignedMessage(t *testing.T) {
- checkSignedMessage(t, signedMessageHex, signedInput)
-}
-
-func TestTextSignedMessage(t *testing.T) {
- checkSignedMessage(t, signedTextMessageHex, signedTextInput)
-}
-
-// The reader should detect "compressed quines", which are compressed
-// packets that expand into themselves and cause an infinite recursive
-// parsing loop.
-// The packet in this test case comes from Taylor R. Campbell at
-// http://mumble.net/~campbell/misc/pgp-quine/
-func TestCampbellQuine(t *testing.T) {
- md, err := ReadMessage(readerFromHex(campbellQuine), nil, nil, nil)
- if md != nil {
- t.Errorf("Reading a compressed quine should not return any data: %#v", md)
- }
- structural, ok := err.(errors.StructuralError)
- if !ok {
- t.Fatalf("Unexpected class of error: %T", err)
- }
- if !strings.Contains(string(structural), "too many layers of packets") {
- t.Fatalf("Unexpected error: %s", err)
- }
-}
-
-var signedEncryptedMessageTests = []struct {
- keyRingHex string
- messageHex string
- signedByKeyId uint64
- encryptedToKeyId uint64
-}{
- {
- testKeys1And2PrivateHex,
- signedEncryptedMessageHex,
- 0xa34d7e18c20c31bb,
- 0x2a67d68660df41c7,
- },
- {
- dsaElGamalTestKeysHex,
- signedEncryptedMessage2Hex,
- 0x33af447ccd759b09,
- 0xcf6a7abcd43e3673,
- },
-}
-
-func TestSignedEncryptedMessage(t *testing.T) {
- for i, test := range signedEncryptedMessageTests {
- expected := "Signed and encrypted message\n"
- kring, _ := ReadKeyRing(readerFromHex(test.keyRingHex))
- prompt := func(keys []Key, symmetric bool) ([]byte, error) {
- if symmetric {
- t.Errorf("prompt: message was marked as symmetrically encrypted")
- return nil, errors.ErrKeyIncorrect
- }
-
- if len(keys) == 0 {
- t.Error("prompt: no keys requested")
- return nil, errors.ErrKeyIncorrect
- }
-
- err := keys[0].PrivateKey.Decrypt([]byte("passphrase"))
- if err != nil {
- t.Errorf("prompt: error decrypting key: %s", err)
- return nil, errors.ErrKeyIncorrect
- }
-
- return nil, nil
- }
-
- md, err := ReadMessage(readerFromHex(test.messageHex), kring, prompt, nil)
- if err != nil {
- t.Errorf("#%d: error reading message: %s", i, err)
- return
- }
-
- if !md.IsSigned || md.SignedByKeyId != test.signedByKeyId || md.SignedBy == nil || !md.IsEncrypted || md.IsSymmetricallyEncrypted || len(md.EncryptedToKeyIds) == 0 || md.EncryptedToKeyIds[0] != test.encryptedToKeyId {
- t.Errorf("#%d: bad MessageDetails: %#v", i, md)
- }
-
- contents, err := ioutil.ReadAll(md.UnverifiedBody)
- if err != nil {
- t.Errorf("#%d: error reading UnverifiedBody: %s", i, err)
- }
- if string(contents) != expected {
- t.Errorf("#%d: bad UnverifiedBody got:%s want:%s", i, string(contents), expected)
- }
-
- if md.SignatureError != nil || md.Signature == nil {
- t.Errorf("#%d: failed to validate: %s", i, md.SignatureError)
- }
- }
-}
-
-func TestUnspecifiedRecipient(t *testing.T) {
- expected := "Recipient unspecified\n"
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
-
- md, err := ReadMessage(readerFromHex(recipientUnspecifiedHex), kring, nil, nil)
- if err != nil {
- t.Errorf("error reading message: %s", err)
- return
- }
-
- contents, err := ioutil.ReadAll(md.UnverifiedBody)
- if err != nil {
- t.Errorf("error reading UnverifiedBody: %s", err)
- }
- if string(contents) != expected {
- t.Errorf("bad UnverifiedBody got:%s want:%s", string(contents), expected)
- }
-}
-
-func TestSymmetricallyEncrypted(t *testing.T) {
- firstTimeCalled := true
-
- prompt := func(keys []Key, symmetric bool) ([]byte, error) {
- if len(keys) != 0 {
- t.Errorf("prompt: len(keys) = %d (want 0)", len(keys))
- }
-
- if !symmetric {
- t.Errorf("symmetric is not set")
- }
-
- if firstTimeCalled {
- firstTimeCalled = false
- return []byte("wrongpassword"), nil
- }
-
- return []byte("password"), nil
- }
-
- md, err := ReadMessage(readerFromHex(symmetricallyEncryptedCompressedHex), nil, prompt, nil)
- if err != nil {
- t.Errorf("ReadMessage: %s", err)
- return
- }
-
- contents, err := ioutil.ReadAll(md.UnverifiedBody)
- if err != nil {
- t.Errorf("ReadAll: %s", err)
- }
-
- expectedCreationTime := uint32(1295992998)
- if md.LiteralData.Time != expectedCreationTime {
- t.Errorf("LiteralData.Time is %d, want %d", md.LiteralData.Time, expectedCreationTime)
- }
-
- const expected = "Symmetrically encrypted.\n"
- if string(contents) != expected {
- t.Errorf("contents got: %s want: %s", string(contents), expected)
- }
-}
-
-func testDetachedSignature(t *testing.T, kring KeyRing, signature io.Reader, sigInput, tag string, expectedSignerKeyId uint64) {
- signed := bytes.NewBufferString(sigInput)
- signer, err := CheckDetachedSignature(kring, signed, signature)
- if err != nil {
- t.Errorf("%s: signature error: %s", tag, err)
- return
- }
- if signer == nil {
- t.Errorf("%s: signer is nil", tag)
- return
- }
- if signer.PrimaryKey.KeyId != expectedSignerKeyId {
- t.Errorf("%s: wrong signer got:%x want:%x", tag, signer.PrimaryKey.KeyId, expectedSignerKeyId)
- }
-}
-
-func TestDetachedSignature(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2Hex))
- testDetachedSignature(t, kring, readerFromHex(detachedSignatureHex), signedInput, "binary", testKey1KeyId)
- testDetachedSignature(t, kring, readerFromHex(detachedSignatureTextHex), signedInput, "text", testKey1KeyId)
- testDetachedSignature(t, kring, readerFromHex(detachedSignatureV3TextHex), signedInput, "v3", testKey1KeyId)
-
- incorrectSignedInput := signedInput + "X"
- _, err := CheckDetachedSignature(kring, bytes.NewBufferString(incorrectSignedInput), readerFromHex(detachedSignatureHex))
- if err == nil {
- t.Fatal("CheckDetachedSignature returned without error for bad signature")
- }
- if err == errors.ErrUnknownIssuer {
- t.Fatal("CheckDetachedSignature returned ErrUnknownIssuer when the signer was known, but the signature invalid")
- }
-}
-
-func TestDetachedSignatureDSA(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(dsaTestKeyHex))
- testDetachedSignature(t, kring, readerFromHex(detachedSignatureDSAHex), signedInput, "binary", testKey3KeyId)
-}
-
-func TestMultipleSignaturePacketsDSA(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(dsaTestKeyHex))
- testDetachedSignature(t, kring, readerFromHex(missingHashFunctionHex+detachedSignatureDSAHex), signedInput, "binary", testKey3KeyId)
-}
-
-func testHashFunctionError(t *testing.T, signatureHex string) {
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2Hex))
- _, err := CheckDetachedSignature(kring, nil, readerFromHex(signatureHex))
- if err == nil {
- t.Fatal("Packet with bad hash type was correctly parsed")
- }
- unsupported, ok := err.(errors.UnsupportedError)
- if !ok {
- t.Fatalf("Unexpected class of error: %s", err)
- }
- if !strings.Contains(string(unsupported), "hash ") {
- t.Fatalf("Unexpected error: %s", err)
- }
-}
-
-func TestUnknownHashFunction(t *testing.T) {
- // unknownHashFunctionHex contains a signature packet with hash
- // function type 153 (which isn't a real hash function id).
- testHashFunctionError(t, unknownHashFunctionHex)
-}
-
-func TestMissingHashFunction(t *testing.T) {
- // missingHashFunctionHex contains a signature packet that uses
- // RIPEMD160, which isn't compiled in. Since that's the only signature
- // packet we don't find any suitable packets and end up with ErrUnknownIssuer
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2Hex))
- _, err := CheckDetachedSignature(kring, nil, readerFromHex(missingHashFunctionHex))
- if err == nil {
- t.Fatal("Packet with missing hash type was correctly parsed")
- }
- if err != errors.ErrUnknownIssuer {
- t.Fatalf("Unexpected class of error: %s", err)
- }
-}
-
-func TestReadingArmoredPrivateKey(t *testing.T) {
- el, err := ReadArmoredKeyRing(bytes.NewBufferString(armoredPrivateKeyBlock))
- if err != nil {
- t.Error(err)
- }
- if len(el) != 1 {
- t.Errorf("got %d entities, wanted 1\n", len(el))
- }
-}
-
-func TestReadingArmoredPublicKey(t *testing.T) {
- el, err := ReadArmoredKeyRing(bytes.NewBufferString(e2ePublicKey))
- if err != nil {
- t.Error(err)
- }
- if len(el) != 1 {
- t.Errorf("didn't get a valid entity")
- }
-}
-
-func TestNoArmoredData(t *testing.T) {
- _, err := ReadArmoredKeyRing(bytes.NewBufferString("foo"))
- if _, ok := err.(errors.InvalidArgumentError); !ok {
- t.Errorf("error was not an InvalidArgumentError: %s", err)
- }
-}
-
-func testReadMessageError(t *testing.T, messageHex string) {
- buf, err := hex.DecodeString(messageHex)
- if err != nil {
- t.Errorf("hex.DecodeString(): %v", err)
- }
-
- kr, err := ReadKeyRing(new(bytes.Buffer))
- if err != nil {
- t.Errorf("ReadKeyring(): %v", err)
- }
-
- _, err = ReadMessage(bytes.NewBuffer(buf), kr,
- func([]Key, bool) ([]byte, error) {
- return []byte("insecure"), nil
- }, nil)
-
- if err == nil {
- t.Errorf("ReadMessage(): Unexpected nil error")
- }
-}
-
-func TestIssue11503(t *testing.T) {
- testReadMessageError(t, "8c040402000aa430aa8228b9248b01fc899a91197130303030")
-}
-
-func TestIssue11504(t *testing.T) {
- testReadMessageError(t, "9303000130303030303030303030983002303030303030030000000130")
-}
-
-const testKey1KeyId = 0xA34D7E18C20C31BB
-const testKey3KeyId = 0x338934250CCC0360
-
-const signedInput = "Signed message\nline 2\nline 3\n"
-const signedTextInput = "Signed message\r\nline 2\r\nline 3\r\n"
-
-const recipientUnspecifiedHex = "848c0300000000000000000103ff62d4d578d03cf40c3da998dfe216c074fa6ddec5e31c197c9666ba292830d91d18716a80f699f9d897389a90e6d62d0238f5f07a5248073c0f24920e4bc4a30c2d17ee4e0cae7c3d4aaa4e8dced50e3010a80ee692175fa0385f62ecca4b56ee6e9980aa3ec51b61b077096ac9e800edaf161268593eedb6cc7027ff5cb32745d250010d407a6221ae22ef18469b444f2822478c4d190b24d36371a95cb40087cdd42d9399c3d06a53c0673349bfb607927f20d1e122bde1e2bf3aa6cae6edf489629bcaa0689539ae3b718914d88ededc3b"
-
-const detachedSignatureHex = "889c04000102000605024d449cd1000a0910a34d7e18c20c31bb167603ff57718d09f28a519fdc7b5a68b6a3336da04df85e38c5cd5d5bd2092fa4629848a33d85b1729402a2aab39c3ac19f9d573f773cc62c264dc924c067a79dfd8a863ae06c7c8686120760749f5fd9b1e03a64d20a7df3446ddc8f0aeadeaeba7cbaee5c1e366d65b6a0c6cc749bcb912d2f15013f812795c2e29eb7f7b77f39ce77"
-
-const detachedSignatureTextHex = "889c04010102000605024d449d21000a0910a34d7e18c20c31bbc8c60400a24fbef7342603a41cb1165767bd18985d015fb72fe05db42db36cfb2f1d455967f1e491194fbf6cf88146222b23bf6ffbd50d17598d976a0417d3192ff9cc0034fd00f287b02e90418bbefe609484b09231e4e7a5f3562e199bf39909ab5276c4d37382fe088f6b5c3426fc1052865da8b3ab158672d58b6264b10823dc4b39"
-
-const detachedSignatureV3TextHex = "8900950305005255c25ca34d7e18c20c31bb0102bb3f04009f6589ef8a028d6e54f6eaf25432e590d31c3a41f4710897585e10c31e5e332c7f9f409af8512adceaff24d0da1474ab07aa7bce4f674610b010fccc5b579ae5eb00a127f272fb799f988ab8e4574c141da6dbfecfef7e6b2c478d9a3d2551ba741f260ee22bec762812f0053e05380bfdd55ad0f22d8cdf71b233fe51ae8a24"
-
-const detachedSignatureDSAHex = "884604001102000605024d6c4eac000a0910338934250ccc0360f18d00a087d743d6405ed7b87755476629600b8b694a39e900a0abff8126f46faf1547c1743c37b21b4ea15b8f83"
-
-const testKeys1And2Hex = "988d044d3c5c10010400b1d13382944bd5aba23a4312968b5095d14f947f600eb478e14a6fcb16b0e0cac764884909c020bc495cfcc39a935387c661507bdb236a0612fb582cac3af9b29cc2c8c70090616c41b662f4da4c1201e195472eb7f4ae1ccbcbf9940fe21d985e379a5563dde5b9a23d35f1cfaa5790da3b79db26f23695107bfaca8e7b5bcd0011010001b41054657374204b6579203120285253412988b804130102002205024d3c5c10021b03060b090807030206150802090a0b0416020301021e01021780000a0910a34d7e18c20c31bbb5b304009cc45fe610b641a2c146331be94dade0a396e73ca725e1b25c21708d9cab46ecca5ccebc23055879df8f99eea39b377962a400f2ebdc36a7c99c333d74aeba346315137c3ff9d0a09b0273299090343048afb8107cf94cbd1400e3026f0ccac7ecebbc4d78588eb3e478fe2754d3ca664bcf3eac96ca4a6b0c8d7df5102f60f6b0020003b88d044d3c5c10010400b201df61d67487301f11879d514f4248ade90c8f68c7af1284c161098de4c28c2850f1ec7b8e30f959793e571542ffc6532189409cb51c3d30dad78c4ad5165eda18b20d9826d8707d0f742e2ab492103a85bbd9ddf4f5720f6de7064feb0d39ee002219765bb07bcfb8b877f47abe270ddeda4f676108cecb6b9bb2ad484a4f0011010001889f04180102000905024d3c5c10021b0c000a0910a34d7e18c20c31bb1a03040085c8d62e16d05dc4e9dad64953c8a2eed8b6c12f92b1575eeaa6dcf7be9473dd5b24b37b6dffbb4e7c99ed1bd3cb11634be19b3e6e207bed7505c7ca111ccf47cb323bf1f8851eb6360e8034cbff8dd149993c959de89f8f77f38e7e98b8e3076323aa719328e2b408db5ec0d03936efd57422ba04f925cdc7b4c1af7590e40ab0020003988d044d3c5c33010400b488c3e5f83f4d561f317817538d9d0397981e9aef1321ca68ebfae1cf8b7d388e19f4b5a24a82e2fbbf1c6c26557a6c5845307a03d815756f564ac7325b02bc83e87d5480a8fae848f07cb891f2d51ce7df83dcafdc12324517c86d472cc0ee10d47a68fd1d9ae49a6c19bbd36d82af597a0d88cc9c49de9df4e696fc1f0b5d0011010001b42754657374204b6579203220285253412c20656e637279707465642070726976617465206b65792988b804130102002205024d3c5c33021b03060b090807030206150802090a0b0416020301021e01021780000a0910d4984f961e35246b98940400908a73b6a6169f700434f076c6c79015a49bee37130eaf23aaa3cfa9ce60bfe4acaa7bc95f1146ada5867e0079babb38804891f4f0b8ebca57a86b249dee786161a755b7a342e68ccf3f78ed6440a93a6626beb9a37aa66afcd4f888790cb4bb46d94a4ae3eb3d7d3e6b00f6bfec940303e89ec5b32a1eaaacce66497d539328b0020003b88d044d3c5c33010400a4e913f9442abcc7f1804ccab27d2f787ffa592077ca935a8bb23165bd8d57576acac647cc596b2c3f814518cc8c82953c7a4478f32e0cf645630a5ba38d9618ef2bc3add69d459ae3dece5cab778938d988239f8c5ae437807075e06c828019959c644ff05ef6a5a1dab72227c98e3a040b0cf219026640698d7a13d8538a570011010001889f04180102000905024d3c5c33021b0c000a0910d4984f961e35246b26c703ff7ee29ef53bc1ae1ead533c408fa136db508434e233d6e62be621e031e5940bbd4c08142aed0f82217e7c3e1ec8de574bc06ccf3c36633be41ad78a9eacd209f861cae7b064100758545cc9dd83db71806dc1cfd5fb9ae5c7474bba0c19c44034ae61bae5eca379383339dece94ff56ff7aa44a582f3e5c38f45763af577c0934b0020003"
-
-const testKeys1And2PrivateHex = "9501d8044d3c5c10010400b1d13382944bd5aba23a4312968b5095d14f947f600eb478e14a6fcb16b0e0cac764884909c020bc495cfcc39a935387c661507bdb236a0612fb582cac3af9b29cc2c8c70090616c41b662f4da4c1201e195472eb7f4ae1ccbcbf9940fe21d985e379a5563dde5b9a23d35f1cfaa5790da3b79db26f23695107bfaca8e7b5bcd00110100010003ff4d91393b9a8e3430b14d6209df42f98dc927425b881f1209f319220841273a802a97c7bdb8b3a7740b3ab5866c4d1d308ad0d3a79bd1e883aacf1ac92dfe720285d10d08752a7efe3c609b1d00f17f2805b217be53999a7da7e493bfc3e9618fd17018991b8128aea70a05dbce30e4fbe626aa45775fa255dd9177aabf4df7cf0200c1ded12566e4bc2bb590455e5becfb2e2c9796482270a943343a7835de41080582c2be3caf5981aa838140e97afa40ad652a0b544f83eb1833b0957dce26e47b0200eacd6046741e9ce2ec5beb6fb5e6335457844fb09477f83b050a96be7da043e17f3a9523567ed40e7a521f818813a8b8a72209f1442844843ccc7eb9805442570200bdafe0438d97ac36e773c7162028d65844c4d463e2420aa2228c6e50dc2743c3d6c72d0d782a5173fe7be2169c8a9f4ef8a7cf3e37165e8c61b89c346cdc6c1799d2b41054657374204b6579203120285253412988b804130102002205024d3c5c10021b03060b090807030206150802090a0b0416020301021e01021780000a0910a34d7e18c20c31bbb5b304009cc45fe610b641a2c146331be94dade0a396e73ca725e1b25c21708d9cab46ecca5ccebc23055879df8f99eea39b377962a400f2ebdc36a7c99c333d74aeba346315137c3ff9d0a09b0273299090343048afb8107cf94cbd1400e3026f0ccac7ecebbc4d78588eb3e478fe2754d3ca664bcf3eac96ca4a6b0c8d7df5102f60f6b00200009d01d8044d3c5c10010400b201df61d67487301f11879d514f4248ade90c8f68c7af1284c161098de4c28c2850f1ec7b8e30f959793e571542ffc6532189409cb51c3d30dad78c4ad5165eda18b20d9826d8707d0f742e2ab492103a85bbd9ddf4f5720f6de7064feb0d39ee002219765bb07bcfb8b877f47abe270ddeda4f676108cecb6b9bb2ad484a4f00110100010003fd17a7490c22a79c59281fb7b20f5e6553ec0c1637ae382e8adaea295f50241037f8997cf42c1ce26417e015091451b15424b2c59eb8d4161b0975630408e394d3b00f88d4b4e18e2cc85e8251d4753a27c639c83f5ad4a571c4f19d7cd460b9b73c25ade730c99df09637bd173d8e3e981ac64432078263bb6dc30d3e974150dd0200d0ee05be3d4604d2146fb0457f31ba17c057560785aa804e8ca5530a7cd81d3440d0f4ba6851efcfd3954b7e68908fc0ba47f7ac37bf559c6c168b70d3a7c8cd0200da1c677c4bce06a068070f2b3733b0a714e88d62aa3f9a26c6f5216d48d5c2b5624144f3807c0df30be66b3268eeeca4df1fbded58faf49fc95dc3c35f134f8b01fd1396b6c0fc1b6c4f0eb8f5e44b8eace1e6073e20d0b8bc5385f86f1cf3f050f66af789f3ef1fc107b7f4421e19e0349c730c68f0a226981f4e889054fdb4dc149e8e889f04180102000905024d3c5c10021b0c000a0910a34d7e18c20c31bb1a03040085c8d62e16d05dc4e9dad64953c8a2eed8b6c12f92b1575eeaa6dcf7be9473dd5b24b37b6dffbb4e7c99ed1bd3cb11634be19b3e6e207bed7505c7ca111ccf47cb323bf1f8851eb6360e8034cbff8dd149993c959de89f8f77f38e7e98b8e3076323aa719328e2b408db5ec0d03936efd57422ba04f925cdc7b4c1af7590e40ab00200009501fe044d3c5c33010400b488c3e5f83f4d561f317817538d9d0397981e9aef1321ca68ebfae1cf8b7d388e19f4b5a24a82e2fbbf1c6c26557a6c5845307a03d815756f564ac7325b02bc83e87d5480a8fae848f07cb891f2d51ce7df83dcafdc12324517c86d472cc0ee10d47a68fd1d9ae49a6c19bbd36d82af597a0d88cc9c49de9df4e696fc1f0b5d0011010001fe030302e9030f3c783e14856063f16938530e148bc57a7aa3f3e4f90df9dceccdc779bc0835e1ad3d006e4a8d7b36d08b8e0de5a0d947254ecfbd22037e6572b426bcfdc517796b224b0036ff90bc574b5509bede85512f2eefb520fb4b02aa523ba739bff424a6fe81c5041f253f8d757e69a503d3563a104d0d49e9e890b9d0c26f96b55b743883b472caa7050c4acfd4a21f875bdf1258d88bd61224d303dc9df77f743137d51e6d5246b88c406780528fd9a3e15bab5452e5b93970d9dcc79f48b38651b9f15bfbcf6da452837e9cc70683d1bdca94507870f743e4ad902005812488dd342f836e72869afd00ce1850eea4cfa53ce10e3608e13d3c149394ee3cbd0e23d018fcbcb6e2ec5a1a22972d1d462ca05355d0d290dd2751e550d5efb38c6c89686344df64852bf4ff86638708f644e8ec6bd4af9b50d8541cb91891a431326ab2e332faa7ae86cfb6e0540aa63160c1e5cdd5a4add518b303fff0a20117c6bc77f7cfbaf36b04c865c6c2b42754657374204b6579203220285253412c20656e637279707465642070726976617465206b65792988b804130102002205024d3c5c33021b03060b090807030206150802090a0b0416020301021e01021780000a0910d4984f961e35246b98940400908a73b6a6169f700434f076c6c79015a49bee37130eaf23aaa3cfa9ce60bfe4acaa7bc95f1146ada5867e0079babb38804891f4f0b8ebca57a86b249dee786161a755b7a342e68ccf3f78ed6440a93a6626beb9a37aa66afcd4f888790cb4bb46d94a4ae3eb3d7d3e6b00f6bfec940303e89ec5b32a1eaaacce66497d539328b00200009d01fe044d3c5c33010400a4e913f9442abcc7f1804ccab27d2f787ffa592077ca935a8bb23165bd8d57576acac647cc596b2c3f814518cc8c82953c7a4478f32e0cf645630a5ba38d9618ef2bc3add69d459ae3dece5cab778938d988239f8c5ae437807075e06c828019959c644ff05ef6a5a1dab72227c98e3a040b0cf219026640698d7a13d8538a570011010001fe030302e9030f3c783e148560f936097339ae381d63116efcf802ff8b1c9360767db5219cc987375702a4123fd8657d3e22700f23f95020d1b261eda5257e9a72f9a918e8ef22dd5b3323ae03bbc1923dd224db988cadc16acc04b120a9f8b7e84da9716c53e0334d7b66586ddb9014df604b41be1e960dcfcbc96f4ed150a1a0dd070b9eb14276b9b6be413a769a75b519a53d3ecc0c220e85cd91ca354d57e7344517e64b43b6e29823cbd87eae26e2b2e78e6dedfbb76e3e9f77bcb844f9a8932eb3db2c3f9e44316e6f5d60e9e2a56e46b72abe6b06dc9a31cc63f10023d1f5e12d2a3ee93b675c96f504af0001220991c88db759e231b3320dcedf814dcf723fd9857e3d72d66a0f2af26950b915abdf56c1596f46a325bf17ad4810d3535fb02a259b247ac3dbd4cc3ecf9c51b6c07cebb009c1506fba0a89321ec8683e3fd009a6e551d50243e2d5092fefb3321083a4bad91320dc624bd6b5dddf93553e3d53924c05bfebec1fb4bd47e89a1a889f04180102000905024d3c5c33021b0c000a0910d4984f961e35246b26c703ff7ee29ef53bc1ae1ead533c408fa136db508434e233d6e62be621e031e5940bbd4c08142aed0f82217e7c3e1ec8de574bc06ccf3c36633be41ad78a9eacd209f861cae7b064100758545cc9dd83db71806dc1cfd5fb9ae5c7474bba0c19c44034ae61bae5eca379383339dece94ff56ff7aa44a582f3e5c38f45763af577c0934b0020000"
-
-const dsaElGamalTestKeysHex = "9501e1044dfcb16a110400aa3e5c1a1f43dd28c2ffae8abf5cfce555ee874134d8ba0a0f7b868ce2214beddc74e5e1e21ded354a95d18acdaf69e5e342371a71fbb9093162e0c5f3427de413a7f2c157d83f5cd2f9d791256dc4f6f0e13f13c3302af27f2384075ab3021dff7a050e14854bbde0a1094174855fc02f0bae8e00a340d94a1f22b32e48485700a0cec672ac21258fb95f61de2ce1af74b2c4fa3e6703ff698edc9be22c02ae4d916e4fa223f819d46582c0516235848a77b577ea49018dcd5e9e15cff9dbb4663a1ae6dd7580fa40946d40c05f72814b0f88481207e6c0832c3bded4853ebba0a7e3bd8e8c66df33d5a537cd4acf946d1080e7a3dcea679cb2b11a72a33a2b6a9dc85f466ad2ddf4c3db6283fa645343286971e3dd700703fc0c4e290d45767f370831a90187e74e9972aae5bff488eeff7d620af0362bfb95c1a6c3413ab5d15a2e4139e5d07a54d72583914661ed6a87cce810be28a0aa8879a2dd39e52fb6fe800f4f181ac7e328f740cde3d09a05cecf9483e4cca4253e60d4429ffd679d9996a520012aad119878c941e3cf151459873bdfc2a9563472fe0303027a728f9feb3b864260a1babe83925ce794710cfd642ee4ae0e5b9d74cee49e9c67b6cd0ea5dfbb582132195a121356a1513e1bca73e5b80c58c7ccb4164453412f456c47616d616c2054657374204b65792031886204131102002205024dfcb16a021b03060b090807030206150802090a0b0416020301021e01021780000a091033af447ccd759b09fadd00a0b8fd6f5a790bad7e9f2dbb7632046dc4493588db009c087c6a9ba9f7f49fab221587a74788c00db4889ab00200009d0157044dfcb16a1004008dec3f9291205255ccff8c532318133a6840739dd68b03ba942676f9038612071447bf07d00d559c5c0875724ea16a4c774f80d8338b55fca691a0522e530e604215b467bbc9ccfd483a1da99d7bc2648b4318fdbd27766fc8bfad3fddb37c62b8ae7ccfe9577e9b8d1e77c1d417ed2c2ef02d52f4da11600d85d3229607943700030503ff506c94c87c8cab778e963b76cf63770f0a79bf48fb49d3b4e52234620fc9f7657f9f8d56c96a2b7c7826ae6b57ebb2221a3fe154b03b6637cea7e6d98e3e45d87cf8dc432f723d3d71f89c5192ac8d7290684d2c25ce55846a80c9a7823f6acd9bb29fa6cd71f20bc90eccfca20451d0c976e460e672b000df49466408d527affe0303027a728f9feb3b864260abd761730327bca2aaa4ea0525c175e92bf240682a0e83b226f97ecb2e935b62c9a133858ce31b271fa8eb41f6a1b3cd72a63025ce1a75ee4180dcc284884904181102000905024dfcb16a021b0c000a091033af447ccd759b09dd0b009e3c3e7296092c81bee5a19929462caaf2fff3ae26009e218c437a2340e7ea628149af1ec98ec091a43992b00200009501e1044dfcb1be1104009f61faa61aa43df75d128cbe53de528c4aec49ce9360c992e70c77072ad5623de0a3a6212771b66b39a30dad6781799e92608316900518ec01184a85d872365b7d2ba4bacfb5882ea3c2473d3750dc6178cc1cf82147fb58caa28b28e9f12f6d1efcb0534abed644156c91cca4ab78834268495160b2400bc422beb37d237c2300a0cac94911b6d493bda1e1fbc6feeca7cb7421d34b03fe22cec6ccb39675bb7b94a335c2b7be888fd3906a1125f33301d8aa6ec6ee6878f46f73961c8d57a3e9544d8ef2a2cbfd4d52da665b1266928cfe4cb347a58c412815f3b2d2369dec04b41ac9a71cc9547426d5ab941cccf3b18575637ccfb42df1a802df3cfe0a999f9e7109331170e3a221991bf868543960f8c816c28097e503fe319db10fb98049f3a57d7c80c420da66d56f3644371631fad3f0ff4040a19a4fedc2d07727a1b27576f75a4d28c47d8246f27071e12d7a8de62aad216ddbae6aa02efd6b8a3e2818cda48526549791ab277e447b3a36c57cefe9b592f5eab73959743fcc8e83cbefec03a329b55018b53eec196765ae40ef9e20521a603c551efe0303020950d53a146bf9c66034d00c23130cce95576a2ff78016ca471276e8227fb30b1ffbd92e61804fb0c3eff9e30b1a826ee8f3e4730b4d86273ca977b4164453412f456c47616d616c2054657374204b65792032886204131102002205024dfcb1be021b03060b090807030206150802090a0b0416020301021e01021780000a0910a86bf526325b21b22bd9009e34511620415c974750a20df5cb56b182f3b48e6600a0a9466cb1a1305a84953445f77d461593f1d42bc1b00200009d0157044dfcb1be1004009565a951da1ee87119d600c077198f1c1bceb0f7aa54552489298e41ff788fa8f0d43a69871f0f6f77ebdfb14a4260cf9fbeb65d5844b4272a1904dd95136d06c3da745dc46327dd44a0f16f60135914368c8039a34033862261806bb2c5ce1152e2840254697872c85441ccb7321431d75a747a4bfb1d2c66362b51ce76311700030503fc0ea76601c196768070b7365a200e6ddb09307f262d5f39eec467b5f5784e22abdf1aa49226f59ab37cb49969d8f5230ea65caf56015abda62604544ed526c5c522bf92bed178a078789f6c807b6d34885688024a5bed9e9f8c58d11d4b82487b44c5f470c5606806a0443b79cadb45e0f897a561a53f724e5349b9267c75ca17fe0303020950d53a146bf9c660bc5f4ce8f072465e2d2466434320c1e712272fafc20e342fe7608101580fa1a1a367e60486a7cd1246b7ef5586cf5e10b32762b710a30144f12dd17dd4884904181102000905024dfcb1be021b0c000a0910a86bf526325b21b2904c00a0b2b66b4b39ccffda1d10f3ea8d58f827e30a8b8e009f4255b2d8112a184e40cde43a34e8655ca7809370b0020000"
-
-const signedMessageHex = "a3019bc0cbccc0c4b8d8b74ee2108fe16ec6d3ca490cbe362d3f8333d3f352531472538b8b13d353b97232f352158c20943157c71c16064626063656269052062e4e01987e9b6fccff4b7df3a34c534b23e679cbec3bc0f8f6e64dfb4b55fe3f8efa9ce110ddb5cd79faf1d753c51aecfa669f7e7aa043436596cccc3359cb7dd6bbe9ecaa69e5989d9e57209571edc0b2fa7f57b9b79a64ee6e99ce1371395fee92fec2796f7b15a77c386ff668ee27f6d38f0baa6c438b561657377bf6acff3c5947befd7bf4c196252f1d6e5c524d0300"
-
-const signedTextMessageHex = "a3019bc0cbccc8c4b8d8b74ee2108fe16ec6d36a250cbece0c178233d3f352531472538b8b13d35379b97232f352158ca0b4312f57c71c1646462606365626906a062e4e019811591798ff99bf8afee860b0d8a8c2a85c3387e3bcf0bb3b17987f2bbcfab2aa526d930cbfd3d98757184df3995c9f3e7790e36e3e9779f06089d4c64e9e47dd6202cb6e9bc73c5d11bb59fbaf89d22d8dc7cf199ddf17af96e77c5f65f9bbed56f427bd8db7af37f6c9984bf9385efaf5f184f986fb3e6adb0ecfe35bbf92d16a7aa2a344fb0bc52fb7624f0200"
-
-const signedEncryptedMessageHex = "848c032a67d68660df41c70103ff5789d0de26b6a50c985a02a13131ca829c413a35d0e6fa8d6842599252162808ac7439c72151c8c6183e76923fe3299301414d0c25a2f06a2257db3839e7df0ec964773f6e4c4ac7ff3b48c444237166dd46ba8ff443a5410dc670cb486672fdbe7c9dfafb75b4fea83af3a204fe2a7dfa86bd20122b4f3d2646cbeecb8f7be8d2c03b018bd210b1d3791e1aba74b0f1034e122ab72e760492c192383cf5e20b5628bd043272d63df9b923f147eb6091cd897553204832aba48fec54aa447547bb16305a1024713b90e77fd0065f1918271947549205af3c74891af22ee0b56cd29bfec6d6e351901cd4ab3ece7c486f1e32a792d4e474aed98ee84b3f591c7dff37b64e0ecd68fd036d517e412dcadf85840ce184ad7921ad446c4ee28db80447aea1ca8d4f574db4d4e37688158ddd19e14ee2eab4873d46947d65d14a23e788d912cf9a19624ca7352469b72a83866b7c23cb5ace3deab3c7018061b0ba0f39ed2befe27163e5083cf9b8271e3e3d52cc7ad6e2a3bd81d4c3d7022f8d"
-
-const signedEncryptedMessage2Hex = "85010e03cf6a7abcd43e36731003fb057f5495b79db367e277cdbe4ab90d924ddee0c0381494112ff8c1238fb0184af35d1731573b01bc4c55ecacd2aafbe2003d36310487d1ecc9ac994f3fada7f9f7f5c3a64248ab7782906c82c6ff1303b69a84d9a9529c31ecafbcdb9ba87e05439897d87e8a2a3dec55e14df19bba7f7bd316291c002ae2efd24f83f9e3441203fc081c0c23dc3092a454ca8a082b27f631abf73aca341686982e8fbda7e0e7d863941d68f3de4a755c2964407f4b5e0477b3196b8c93d551dd23c8beef7d0f03fbb1b6066f78907faf4bf1677d8fcec72651124080e0b7feae6b476e72ab207d38d90b958759fdedfc3c6c35717c9dbfc979b3cfbbff0a76d24a5e57056bb88acbd2a901ef64bc6e4db02adc05b6250ff378de81dca18c1910ab257dff1b9771b85bb9bbe0a69f5989e6d1710a35e6dfcceb7d8fb5ccea8db3932b3d9ff3fe0d327597c68b3622aec8e3716c83a6c93f497543b459b58ba504ed6bcaa747d37d2ca746fe49ae0a6ce4a8b694234e941b5159ff8bd34b9023da2814076163b86f40eed7c9472f81b551452d5ab87004a373c0172ec87ea6ce42ccfa7dbdad66b745496c4873d8019e8c28d6b3"
-
-const symmetricallyEncryptedCompressedHex = "8c0d04030302eb4a03808145d0d260c92f714339e13de5a79881216431925bf67ee2898ea61815f07894cd0703c50d0a76ef64d482196f47a8bc729af9b80bb6"
-
-const dsaTestKeyHex = "9901a2044d6c49de110400cb5ce438cf9250907ac2ba5bf6547931270b89f7c4b53d9d09f4d0213a5ef2ec1f26806d3d259960f872a4a102ef1581ea3f6d6882d15134f21ef6a84de933cc34c47cc9106efe3bd84c6aec12e78523661e29bc1a61f0aab17fa58a627fd5fd33f5149153fbe8cd70edf3d963bc287ef875270ff14b5bfdd1bca4483793923b00a0fe46d76cb6e4cbdc568435cd5480af3266d610d303fe33ae8273f30a96d4d34f42fa28ce1112d425b2e3bf7ea553d526e2db6b9255e9dc7419045ce817214d1a0056dbc8d5289956a4b1b69f20f1105124096e6a438f41f2e2495923b0f34b70642607d45559595c7fe94d7fa85fc41bf7d68c1fd509ebeaa5f315f6059a446b9369c277597e4f474a9591535354c7e7f4fd98a08aa60400b130c24ff20bdfbf683313f5daebf1c9b34b3bdadfc77f2ddd72ee1fb17e56c473664bc21d66467655dd74b9005e3a2bacce446f1920cd7017231ae447b67036c9b431b8179deacd5120262d894c26bc015bffe3d827ba7087ad9b700d2ca1f6d16cc1786581e5dd065f293c31209300f9b0afcc3f7c08dd26d0a22d87580b4db41054657374204b65792033202844534129886204131102002205024d6c49de021b03060b090807030206150802090a0b0416020301021e01021780000a0910338934250ccc03607e0400a0bdb9193e8a6b96fc2dfc108ae848914b504481f100a09c4dc148cb693293a67af24dd40d2b13a9e36794"
-
-const dsaTestKeyPrivateHex = "9501bb044d6c49de110400cb5ce438cf9250907ac2ba5bf6547931270b89f7c4b53d9d09f4d0213a5ef2ec1f26806d3d259960f872a4a102ef1581ea3f6d6882d15134f21ef6a84de933cc34c47cc9106efe3bd84c6aec12e78523661e29bc1a61f0aab17fa58a627fd5fd33f5149153fbe8cd70edf3d963bc287ef875270ff14b5bfdd1bca4483793923b00a0fe46d76cb6e4cbdc568435cd5480af3266d610d303fe33ae8273f30a96d4d34f42fa28ce1112d425b2e3bf7ea553d526e2db6b9255e9dc7419045ce817214d1a0056dbc8d5289956a4b1b69f20f1105124096e6a438f41f2e2495923b0f34b70642607d45559595c7fe94d7fa85fc41bf7d68c1fd509ebeaa5f315f6059a446b9369c277597e4f474a9591535354c7e7f4fd98a08aa60400b130c24ff20bdfbf683313f5daebf1c9b34b3bdadfc77f2ddd72ee1fb17e56c473664bc21d66467655dd74b9005e3a2bacce446f1920cd7017231ae447b67036c9b431b8179deacd5120262d894c26bc015bffe3d827ba7087ad9b700d2ca1f6d16cc1786581e5dd065f293c31209300f9b0afcc3f7c08dd26d0a22d87580b4d00009f592e0619d823953577d4503061706843317e4fee083db41054657374204b65792033202844534129886204131102002205024d6c49de021b03060b090807030206150802090a0b0416020301021e01021780000a0910338934250ccc03607e0400a0bdb9193e8a6b96fc2dfc108ae848914b504481f100a09c4dc148cb693293a67af24dd40d2b13a9e36794"
-
-const armoredPrivateKeyBlock = `-----BEGIN PGP PRIVATE KEY BLOCK-----
-Version: GnuPG v1.4.10 (GNU/Linux)
-
-lQHYBE2rFNoBBADFwqWQIW/DSqcB4yCQqnAFTJ27qS5AnB46ccAdw3u4Greeu3Bp
-idpoHdjULy7zSKlwR1EA873dO/k/e11Ml3dlAFUinWeejWaK2ugFP6JjiieSsrKn
-vWNicdCS4HTWn0X4sjl0ZiAygw6GNhqEQ3cpLeL0g8E9hnYzJKQ0LWJa0QARAQAB
-AAP/TB81EIo2VYNmTq0pK1ZXwUpxCrvAAIG3hwKjEzHcbQznsjNvPUihZ+NZQ6+X
-0HCfPAdPkGDCLCb6NavcSW+iNnLTrdDnSI6+3BbIONqWWdRDYJhqZCkqmG6zqSfL
-IdkJgCw94taUg5BWP/AAeQrhzjChvpMQTVKQL5mnuZbUCeMCAN5qrYMP2S9iKdnk
-VANIFj7656ARKt/nf4CBzxcpHTyB8+d2CtPDKCmlJP6vL8t58Jmih+kHJMvC0dzn
-gr5f5+sCAOOe5gt9e0am7AvQWhdbHVfJU0TQJx+m2OiCJAqGTB1nvtBLHdJnfdC9
-TnXXQ6ZXibqLyBies/xeY2sCKL5qtTMCAKnX9+9d/5yQxRyrQUHt1NYhaXZnJbHx
-q4ytu0eWz+5i68IYUSK69jJ1NWPM0T6SkqpB3KCAIv68VFm9PxqG1KmhSrQIVGVz
-dCBLZXmIuAQTAQIAIgUCTasU2gIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AA
-CgkQO9o98PRieSoLhgQAkLEZex02Qt7vGhZzMwuN0R22w3VwyYyjBx+fM3JFETy1
-ut4xcLJoJfIaF5ZS38UplgakHG0FQ+b49i8dMij0aZmDqGxrew1m4kBfjXw9B/v+
-eIqpODryb6cOSwyQFH0lQkXC040pjq9YqDsO5w0WYNXYKDnzRV0p4H1pweo2VDid
-AdgETasU2gEEAN46UPeWRqKHvA99arOxee38fBt2CI08iiWyI8T3J6ivtFGixSqV
-bRcPxYO/qLpVe5l84Nb3X71GfVXlc9hyv7CD6tcowL59hg1E/DC5ydI8K8iEpUmK
-/UnHdIY5h8/kqgGxkY/T/hgp5fRQgW1ZoZxLajVlMRZ8W4tFtT0DeA+JABEBAAEA
-A/0bE1jaaZKj6ndqcw86jd+QtD1SF+Cf21CWRNeLKnUds4FRRvclzTyUMuWPkUeX
-TaNNsUOFqBsf6QQ2oHUBBK4VCHffHCW4ZEX2cd6umz7mpHW6XzN4DECEzOVksXtc
-lUC1j4UB91DC/RNQqwX1IV2QLSwssVotPMPqhOi0ZLNY7wIA3n7DWKInxYZZ4K+6
-rQ+POsz6brEoRHwr8x6XlHenq1Oki855pSa1yXIARoTrSJkBtn5oI+f8AzrnN0BN
-oyeQAwIA/7E++3HDi5aweWrViiul9cd3rcsS0dEnksPhvS0ozCJiHsq/6GFmy7J8
-QSHZPteedBnZyNp5jR+H7cIfVN3KgwH/Skq4PsuPhDq5TKK6i8Pc1WW8MA6DXTdU
-nLkX7RGmMwjC0DBf7KWAlPjFaONAX3a8ndnz//fy1q7u2l9AZwrj1qa1iJ8EGAEC
-AAkFAk2rFNoCGwwACgkQO9o98PRieSo2/QP/WTzr4ioINVsvN1akKuekmEMI3LAp
-BfHwatufxxP1U+3Si/6YIk7kuPB9Hs+pRqCXzbvPRrI8NHZBmc8qIGthishdCYad
-AHcVnXjtxrULkQFGbGvhKURLvS9WnzD/m1K2zzwxzkPTzT9/Yf06O6Mal5AdugPL
-VrM0m72/jnpKo04=
-=zNCn
------END PGP PRIVATE KEY BLOCK-----`
-
-const e2ePublicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
-Charset: UTF-8
-
-xv8AAABSBAAAAAATCCqGSM49AwEHAgME1LRoXSpOxtHXDUdmuvzchyg6005qIBJ4
-sfaSxX7QgH9RV2ONUhC+WiayCNADq+UMzuR/vunSr4aQffXvuGnR383/AAAAFDxk
-Z2lsQHlhaG9vLWluYy5jb20+wv8AAACGBBATCAA4/wAAAAWCVGvAG/8AAAACiwn/
-AAAACZC2VkQCOjdvYf8AAAAFlQgJCgv/AAAAA5YBAv8AAAACngEAAE1BAP0X8veD
-24IjmI5/C6ZAfVNXxgZZFhTAACFX75jUA3oD6AEAzoSwKf1aqH6oq62qhCN/pekX
-+WAsVMBhNwzLpqtCRjLO/wAAAFYEAAAAABIIKoZIzj0DAQcCAwT50ain7vXiIRv8
-B1DO3x3cE/aattZ5sHNixJzRCXi2vQIA5QmOxZ6b5jjUekNbdHG3SZi1a2Ak5mfX
-fRxC/5VGAwEIB8L/AAAAZQQYEwgAGP8AAAAFglRrwBz/AAAACZC2VkQCOjdvYQAA
-FJAA9isX3xtGyMLYwp2F3nXm7QEdY5bq5VUcD/RJlj792VwA/1wH0pCzVLl4Q9F9
-ex7En5r7rHR5xwX82Msc+Rq9dSyO
-=7MrZ
------END PGP PUBLIC KEY BLOCK-----`
-
-const dsaKeyWithSHA512 = `9901a2044f04b07f110400db244efecc7316553ee08d179972aab87bb1214de7692593fcf5b6feb1c80fba268722dd464748539b85b81d574cd2d7ad0ca2444de4d849b8756bad7768c486c83a824f9bba4af773d11742bdfb4ac3b89ef8cc9452d4aad31a37e4b630d33927bff68e879284a1672659b8b298222fc68f370f3e24dccacc4a862442b9438b00a0ea444a24088dc23e26df7daf8f43cba3bffc4fe703fe3d6cd7fdca199d54ed8ae501c30e3ec7871ea9cdd4cf63cfe6fc82281d70a5b8bb493f922cd99fba5f088935596af087c8d818d5ec4d0b9afa7f070b3d7c1dd32a84fca08d8280b4890c8da1dde334de8e3cad8450eed2a4a4fcc2db7b8e5528b869a74a7f0189e11ef097ef1253582348de072bb07a9fa8ab838e993cef0ee203ff49298723e2d1f549b00559f886cd417a41692ce58d0ac1307dc71d85a8af21b0cf6eaa14baf2922d3a70389bedf17cc514ba0febbd107675a372fe84b90162a9e88b14d4b1c6be855b96b33fb198c46f058568817780435b6936167ebb3724b680f32bf27382ada2e37a879b3d9de2abe0c3f399350afd1ad438883f4791e2e3b4184453412068617368207472756e636174696f6e207465737488620413110a002205024f04b07f021b03060b090807030206150802090a0b0416020301021e01021780000a0910ef20e0cefca131581318009e2bf3bf047a44d75a9bacd00161ee04d435522397009a03a60d51bd8a568c6c021c8d7cf1be8d990d6417b0020003`
-
-const unknownHashFunctionHex = `8a00000040040001990006050253863c24000a09103b4fe6acc0b21f32ffff01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101`
-
-const missingHashFunctionHex = `8a00000040040001030006050253863c24000a09103b4fe6acc0b21f32ffff0101010101010101010101010101010101010101010101010101010101010101010101010101`
-
-const campbellQuine = `a0b001000300fcffa0b001000d00f2ff000300fcffa0b001000d00f2ff8270a01c00000500faff8270a01c00000500faff000500faff001400ebff8270a01c00000500faff000500faff001400ebff428821c400001400ebff428821c400001400ebff428821c400001400ebff428821c400001400ebff428821c400000000ffff000000ffff000b00f4ff428821c400000000ffff000000ffff000b00f4ff0233214c40000100feff000233214c40000100feff0000`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/s2k/s2k_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/s2k/s2k_test.go
deleted file mode 100644
index 183d26056b1..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/s2k/s2k_test.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package s2k
-
-import (
- "bytes"
- "crypto"
- _ "crypto/md5"
- "crypto/rand"
- "crypto/sha1"
- _ "crypto/sha256"
- _ "crypto/sha512"
- "encoding/hex"
- "testing"
-
- _ "golang.org/x/crypto/ripemd160"
-)
-
-var saltedTests = []struct {
- in, out string
-}{
- {"hello", "10295ac1"},
- {"world", "ac587a5e"},
- {"foo", "4dda8077"},
- {"bar", "bd8aac6b9ea9cae04eae6a91c6133b58b5d9a61c14f355516ed9370456"},
- {"x", "f1d3f289"},
- {"xxxxxxxxxxxxxxxxxxxxxxx", "e00d7b45"},
-}
-
-func TestSalted(t *testing.T) {
- h := sha1.New()
- salt := [4]byte{1, 2, 3, 4}
-
- for i, test := range saltedTests {
- expected, _ := hex.DecodeString(test.out)
- out := make([]byte, len(expected))
- Salted(out, h, []byte(test.in), salt[:])
- if !bytes.Equal(expected, out) {
- t.Errorf("#%d, got: %x want: %x", i, out, expected)
- }
- }
-}
-
-var iteratedTests = []struct {
- in, out string
-}{
- {"hello", "83126105"},
- {"world", "6fa317f9"},
- {"foo", "8fbc35b9"},
- {"bar", "2af5a99b54f093789fd657f19bd245af7604d0f6ae06f66602a46a08ae"},
- {"x", "5a684dfe"},
- {"xxxxxxxxxxxxxxxxxxxxxxx", "18955174"},
-}
-
-func TestIterated(t *testing.T) {
- h := sha1.New()
- salt := [4]byte{4, 3, 2, 1}
-
- for i, test := range iteratedTests {
- expected, _ := hex.DecodeString(test.out)
- out := make([]byte, len(expected))
- Iterated(out, h, []byte(test.in), salt[:], 31)
- if !bytes.Equal(expected, out) {
- t.Errorf("#%d, got: %x want: %x", i, out, expected)
- }
- }
-}
-
-var parseTests = []struct {
- spec, in, out string
-}{
- /* Simple with SHA1 */
- {"0002", "hello", "aaf4c61d"},
- /* Salted with SHA1 */
- {"01020102030405060708", "hello", "f4f7d67e"},
- /* Iterated with SHA1 */
- {"03020102030405060708f1", "hello", "f2a57b7c"},
-}
-
-func TestParse(t *testing.T) {
- for i, test := range parseTests {
- spec, _ := hex.DecodeString(test.spec)
- buf := bytes.NewBuffer(spec)
- f, err := Parse(buf)
- if err != nil {
- t.Errorf("%d: Parse returned error: %s", i, err)
- continue
- }
-
- expected, _ := hex.DecodeString(test.out)
- out := make([]byte, len(expected))
- f(out, []byte(test.in))
- if !bytes.Equal(out, expected) {
- t.Errorf("%d: output got: %x want: %x", i, out, expected)
- }
- if testing.Short() {
- break
- }
- }
-}
-
-func TestSerialize(t *testing.T) {
- hashes := []crypto.Hash{crypto.MD5, crypto.SHA1, crypto.RIPEMD160,
- crypto.SHA256, crypto.SHA384, crypto.SHA512, crypto.SHA224}
- testCounts := []int{-1, 0, 1024, 65536, 4063232, 65011712}
- for _, h := range hashes {
- for _, c := range testCounts {
- testSerializeConfig(t, &Config{Hash: h, S2KCount: c})
- }
- }
-}
-
-func testSerializeConfig(t *testing.T, c *Config) {
- t.Logf("Running testSerializeConfig() with config: %+v", c)
-
- buf := bytes.NewBuffer(nil)
- key := make([]byte, 16)
- passphrase := []byte("testing")
- err := Serialize(buf, key, rand.Reader, passphrase, c)
- if err != nil {
- t.Errorf("failed to serialize: %s", err)
- return
- }
-
- f, err := Parse(buf)
- if err != nil {
- t.Errorf("failed to reparse: %s", err)
- return
- }
- key2 := make([]byte, len(key))
- f(key2, passphrase)
- if !bytes.Equal(key2, key) {
- t.Errorf("keys don't match: %x (serialied) vs %x (parsed)", key, key2)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/write_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/write_test.go
deleted file mode 100644
index 8e9a33583f5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/openpgp/write_test.go
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package openpgp
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "testing"
- "time"
-
- "golang.org/x/crypto/openpgp/packet"
-)
-
-func TestSignDetached(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
- out := bytes.NewBuffer(nil)
- message := bytes.NewBufferString(signedInput)
- err := DetachSign(out, kring[0], message, nil)
- if err != nil {
- t.Error(err)
- }
-
- testDetachedSignature(t, kring, out, signedInput, "check", testKey1KeyId)
-}
-
-func TestSignTextDetached(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
- out := bytes.NewBuffer(nil)
- message := bytes.NewBufferString(signedInput)
- err := DetachSignText(out, kring[0], message, nil)
- if err != nil {
- t.Error(err)
- }
-
- testDetachedSignature(t, kring, out, signedInput, "check", testKey1KeyId)
-}
-
-func TestSignDetachedDSA(t *testing.T) {
- kring, _ := ReadKeyRing(readerFromHex(dsaTestKeyPrivateHex))
- out := bytes.NewBuffer(nil)
- message := bytes.NewBufferString(signedInput)
- err := DetachSign(out, kring[0], message, nil)
- if err != nil {
- t.Error(err)
- }
-
- testDetachedSignature(t, kring, out, signedInput, "check", testKey3KeyId)
-}
-
-func TestNewEntity(t *testing.T) {
- if testing.Short() {
- return
- }
-
- // Check bit-length with no config.
- e, err := NewEntity("Test User", "test", "test@example.com", nil)
- if err != nil {
- t.Errorf("failed to create entity: %s", err)
- return
- }
- bl, err := e.PrimaryKey.BitLength()
- if err != nil {
- t.Errorf("failed to find bit length: %s", err)
- }
- if int(bl) != defaultRSAKeyBits {
- t.Errorf("BitLength %v, expected %v", defaultRSAKeyBits)
- }
-
- // Check bit-length with a config.
- cfg := &packet.Config{RSABits: 1024}
- e, err = NewEntity("Test User", "test", "test@example.com", cfg)
- if err != nil {
- t.Errorf("failed to create entity: %s", err)
- return
- }
- bl, err = e.PrimaryKey.BitLength()
- if err != nil {
- t.Errorf("failed to find bit length: %s", err)
- }
- if int(bl) != cfg.RSABits {
- t.Errorf("BitLength %v, expected %v", bl, cfg.RSABits)
- }
-
- w := bytes.NewBuffer(nil)
- if err := e.SerializePrivate(w, nil); err != nil {
- t.Errorf("failed to serialize entity: %s", err)
- return
- }
- serialized := w.Bytes()
-
- el, err := ReadKeyRing(w)
- if err != nil {
- t.Errorf("failed to reparse entity: %s", err)
- return
- }
-
- if len(el) != 1 {
- t.Errorf("wrong number of entities found, got %d, want 1", len(el))
- }
-
- w = bytes.NewBuffer(nil)
- if err := e.SerializePrivate(w, nil); err != nil {
- t.Errorf("failed to serialize entity second time: %s", err)
- return
- }
-
- if !bytes.Equal(w.Bytes(), serialized) {
- t.Errorf("results differed")
- }
-}
-
-func TestSymmetricEncryption(t *testing.T) {
- buf := new(bytes.Buffer)
- plaintext, err := SymmetricallyEncrypt(buf, []byte("testing"), nil, nil)
- if err != nil {
- t.Errorf("error writing headers: %s", err)
- return
- }
- message := []byte("hello world\n")
- _, err = plaintext.Write(message)
- if err != nil {
- t.Errorf("error writing to plaintext writer: %s", err)
- }
- err = plaintext.Close()
- if err != nil {
- t.Errorf("error closing plaintext writer: %s", err)
- }
-
- md, err := ReadMessage(buf, nil, func(keys []Key, symmetric bool) ([]byte, error) {
- return []byte("testing"), nil
- }, nil)
- if err != nil {
- t.Errorf("error rereading message: %s", err)
- }
- messageBuf := bytes.NewBuffer(nil)
- _, err = io.Copy(messageBuf, md.UnverifiedBody)
- if err != nil {
- t.Errorf("error rereading message: %s", err)
- }
- if !bytes.Equal(message, messageBuf.Bytes()) {
- t.Errorf("recovered message incorrect got '%s', want '%s'", messageBuf.Bytes(), message)
- }
-}
-
-var testEncryptionTests = []struct {
- keyRingHex string
- isSigned bool
-}{
- {
- testKeys1And2PrivateHex,
- false,
- },
- {
- testKeys1And2PrivateHex,
- true,
- },
- {
- dsaElGamalTestKeysHex,
- false,
- },
- {
- dsaElGamalTestKeysHex,
- true,
- },
-}
-
-func TestEncryption(t *testing.T) {
- for i, test := range testEncryptionTests {
- kring, _ := ReadKeyRing(readerFromHex(test.keyRingHex))
-
- passphrase := []byte("passphrase")
- for _, entity := range kring {
- if entity.PrivateKey != nil && entity.PrivateKey.Encrypted {
- err := entity.PrivateKey.Decrypt(passphrase)
- if err != nil {
- t.Errorf("#%d: failed to decrypt key", i)
- }
- }
- for _, subkey := range entity.Subkeys {
- if subkey.PrivateKey != nil && subkey.PrivateKey.Encrypted {
- err := subkey.PrivateKey.Decrypt(passphrase)
- if err != nil {
- t.Errorf("#%d: failed to decrypt subkey", i)
- }
- }
- }
- }
-
- var signed *Entity
- if test.isSigned {
- signed = kring[0]
- }
-
- buf := new(bytes.Buffer)
- w, err := Encrypt(buf, kring[:1], signed, nil /* no hints */, nil)
- if err != nil {
- t.Errorf("#%d: error in Encrypt: %s", i, err)
- continue
- }
-
- const message = "testing"
- _, err = w.Write([]byte(message))
- if err != nil {
- t.Errorf("#%d: error writing plaintext: %s", i, err)
- continue
- }
- err = w.Close()
- if err != nil {
- t.Errorf("#%d: error closing WriteCloser: %s", i, err)
- continue
- }
-
- md, err := ReadMessage(buf, kring, nil /* no prompt */, nil)
- if err != nil {
- t.Errorf("#%d: error reading message: %s", i, err)
- continue
- }
-
- testTime, _ := time.Parse("2006-01-02", "2013-07-01")
- if test.isSigned {
- signKey, _ := kring[0].signingKey(testTime)
- expectedKeyId := signKey.PublicKey.KeyId
- if md.SignedByKeyId != expectedKeyId {
- t.Errorf("#%d: message signed by wrong key id, got: %d, want: %d", i, *md.SignedBy, expectedKeyId)
- }
- if md.SignedBy == nil {
- t.Errorf("#%d: failed to find the signing Entity", i)
- }
- }
-
- plaintext, err := ioutil.ReadAll(md.UnverifiedBody)
- if err != nil {
- t.Errorf("#%d: error reading encrypted contents: %s", i, err)
- continue
- }
-
- encryptKey, _ := kring[0].encryptionKey(testTime)
- expectedKeyId := encryptKey.PublicKey.KeyId
- if len(md.EncryptedToKeyIds) != 1 || md.EncryptedToKeyIds[0] != expectedKeyId {
- t.Errorf("#%d: expected message to be encrypted to %v, but got %#v", i, expectedKeyId, md.EncryptedToKeyIds)
- }
-
- if string(plaintext) != message {
- t.Errorf("#%d: got: %s, want: %s", i, string(plaintext), message)
- }
-
- if test.isSigned {
- if md.SignatureError != nil {
- t.Errorf("#%d: signature error: %s", i, md.SignatureError)
- }
- if md.Signature == nil {
- t.Error("signature missing")
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/otr/otr_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/otr/otr_test.go
deleted file mode 100644
index cfcd062b274..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/otr/otr_test.go
+++ /dev/null
@@ -1,470 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package otr
-
-import (
- "bufio"
- "bytes"
- "crypto/rand"
- "encoding/hex"
- "math/big"
- "os"
- "os/exec"
- "testing"
-)
-
-var isQueryTests = []struct {
- msg string
- expectedVersion int
-}{
- {"foo", 0},
- {"?OtR", 0},
- {"?OtR?", 0},
- {"?OTR?", 0},
- {"?OTRv?", 0},
- {"?OTRv1?", 0},
- {"?OTR?v1?", 0},
- {"?OTR?v?", 0},
- {"?OTR?v2?", 2},
- {"?OTRv2?", 2},
- {"?OTRv23?", 2},
- {"?OTRv23 ?", 0},
-}
-
-func TestIsQuery(t *testing.T) {
- for i, test := range isQueryTests {
- version := isQuery([]byte(test.msg))
- if version != test.expectedVersion {
- t.Errorf("#%d: got %d, want %d", i, version, test.expectedVersion)
- }
- }
-}
-
-var alicePrivateKeyHex = "000000000080c81c2cb2eb729b7e6fd48e975a932c638b3a9055478583afa46755683e30102447f6da2d8bec9f386bbb5da6403b0040fee8650b6ab2d7f32c55ab017ae9b6aec8c324ab5844784e9a80e194830d548fb7f09a0410df2c4d5c8bc2b3e9ad484e65412be689cf0834694e0839fb2954021521ffdffb8f5c32c14dbf2020b3ce7500000014da4591d58def96de61aea7b04a8405fe1609308d000000808ddd5cb0b9d66956e3dea5a915d9aba9d8a6e7053b74dadb2fc52f9fe4e5bcc487d2305485ed95fed026ad93f06ebb8c9e8baf693b7887132c7ffdd3b0f72f4002ff4ed56583ca7c54458f8c068ca3e8a4dfa309d1dd5d34e2a4b68e6f4338835e5e0fb4317c9e4c7e4806dafda3ef459cd563775a586dd91b1319f72621bf3f00000080b8147e74d8c45e6318c37731b8b33b984a795b3653c2cd1d65cc99efe097cb7eb2fa49569bab5aab6e8a1c261a27d0f7840a5e80b317e6683042b59b6dceca2879c6ffc877a465be690c15e4a42f9a7588e79b10faac11b1ce3741fcef7aba8ce05327a2c16d279ee1b3d77eb783fb10e3356caa25635331e26dd42b8396c4d00000001420bec691fea37ecea58a5c717142f0b804452f57"
-
-var aliceFingerprintHex = "0bb01c360424522e94ee9c346ce877a1a4288b2f"
-
-var bobPrivateKeyHex = "000000000080a5138eb3d3eb9c1d85716faecadb718f87d31aaed1157671d7fee7e488f95e8e0ba60ad449ec732710a7dec5190f7182af2e2f98312d98497221dff160fd68033dd4f3a33b7c078d0d9f66e26847e76ca7447d4bab35486045090572863d9e4454777f24d6706f63e02548dfec2d0a620af37bbc1d24f884708a212c343b480d00000014e9c58f0ea21a5e4dfd9f44b6a9f7f6a9961a8fa9000000803c4d111aebd62d3c50c2889d420a32cdf1e98b70affcc1fcf44d59cca2eb019f6b774ef88153fb9b9615441a5fe25ea2d11b74ce922ca0232bd81b3c0fcac2a95b20cb6e6c0c5c1ace2e26f65dc43c751af0edbb10d669890e8ab6beea91410b8b2187af1a8347627a06ecea7e0f772c28aae9461301e83884860c9b656c722f0000008065af8625a555ea0e008cd04743671a3cda21162e83af045725db2eb2bb52712708dc0cc1a84c08b3649b88a966974bde27d8612c2861792ec9f08786a246fcadd6d8d3a81a32287745f309238f47618c2bd7612cb8b02d940571e0f30b96420bcd462ff542901b46109b1e5ad6423744448d20a57818a8cbb1647d0fea3b664e0000001440f9f2eb554cb00d45a5826b54bfa419b6980e48"
-
-func TestKeySerialization(t *testing.T) {
- var priv PrivateKey
- alicePrivateKey, _ := hex.DecodeString(alicePrivateKeyHex)
- rest, ok := priv.Parse(alicePrivateKey)
- if !ok {
- t.Error("failed to parse private key")
- }
- if len(rest) > 0 {
- t.Error("data remaining after parsing private key")
- }
-
- out := priv.Serialize(nil)
- if !bytes.Equal(alicePrivateKey, out) {
- t.Errorf("serialization (%x) is not equal to original (%x)", out, alicePrivateKey)
- }
-
- aliceFingerprint, _ := hex.DecodeString(aliceFingerprintHex)
- fingerprint := priv.PublicKey.Fingerprint()
- if !bytes.Equal(aliceFingerprint, fingerprint) {
- t.Errorf("fingerprint (%x) is not equal to expected value (%x)", fingerprint, aliceFingerprint)
- }
-}
-
-const libOTRPrivateKey = `(privkeys
- (account
-(name "foo@example.com")
-(protocol prpl-jabber)
-(private-key
- (dsa
- (p #00FC07ABCF0DC916AFF6E9AE47BEF60C7AB9B4D6B2469E436630E36F8A489BE812486A09F30B71224508654940A835301ACC525A4FF133FC152CC53DCC59D65C30A54F1993FE13FE63E5823D4C746DB21B90F9B9C00B49EC7404AB1D929BA7FBA12F2E45C6E0A651689750E8528AB8C031D3561FECEE72EBB4A090D450A9B7A857#)
- (q #00997BD266EF7B1F60A5C23F3A741F2AEFD07A2081#)
- (g #535E360E8A95EBA46A4F7DE50AD6E9B2A6DB785A66B64EB9F20338D2A3E8FB0E94725848F1AA6CC567CB83A1CC517EC806F2E92EAE71457E80B2210A189B91250779434B41FC8A8873F6DB94BEA7D177F5D59E7E114EE10A49CFD9CEF88AE43387023B672927BA74B04EB6BBB5E57597766A2F9CE3857D7ACE3E1E3BC1FC6F26#)
- (y #0AC8670AD767D7A8D9D14CC1AC6744CD7D76F993B77FFD9E39DF01E5A6536EF65E775FCEF2A983E2A19BD6415500F6979715D9FD1257E1FE2B6F5E1E74B333079E7C880D39868462A93454B41877BE62E5EF0A041C2EE9C9E76BD1E12AE25D9628DECB097025DD625EF49C3258A1A3C0FF501E3DC673B76D7BABF349009B6ECF#)
- (x #14D0345A3562C480A039E3C72764F72D79043216#)
- )
- )
- )
-)`
-
-func TestParseLibOTRPrivateKey(t *testing.T) {
- var priv PrivateKey
-
- if !priv.Import([]byte(libOTRPrivateKey)) {
- t.Fatalf("Failed to import sample private key")
- }
-}
-
-func TestSignVerify(t *testing.T) {
- var priv PrivateKey
- alicePrivateKey, _ := hex.DecodeString(alicePrivateKeyHex)
- _, ok := priv.Parse(alicePrivateKey)
- if !ok {
- t.Error("failed to parse private key")
- }
-
- var msg [32]byte
- rand.Reader.Read(msg[:])
-
- sig := priv.Sign(rand.Reader, msg[:])
- rest, ok := priv.PublicKey.Verify(msg[:], sig)
- if !ok {
- t.Errorf("signature (%x) of %x failed to verify", sig, msg[:])
- } else if len(rest) > 0 {
- t.Error("signature data remains after verification")
- }
-
- sig[10] ^= 80
- _, ok = priv.PublicKey.Verify(msg[:], sig)
- if ok {
- t.Errorf("corrupted signature (%x) of %x verified", sig, msg[:])
- }
-}
-
-func setupConversation(t *testing.T) (alice, bob *Conversation) {
- alicePrivateKey, _ := hex.DecodeString(alicePrivateKeyHex)
- bobPrivateKey, _ := hex.DecodeString(bobPrivateKeyHex)
-
- alice, bob = new(Conversation), new(Conversation)
-
- alice.PrivateKey = new(PrivateKey)
- bob.PrivateKey = new(PrivateKey)
- alice.PrivateKey.Parse(alicePrivateKey)
- bob.PrivateKey.Parse(bobPrivateKey)
- alice.FragmentSize = 100
- bob.FragmentSize = 100
-
- if alice.IsEncrypted() {
- t.Error("Alice believes that the conversation is secure before we've started")
- }
- if bob.IsEncrypted() {
- t.Error("Bob believes that the conversation is secure before we've started")
- }
-
- performHandshake(t, alice, bob)
- return alice, bob
-}
-
-func performHandshake(t *testing.T, alice, bob *Conversation) {
- var alicesMessage, bobsMessage [][]byte
- var out []byte
- var aliceChange, bobChange SecurityChange
- var err error
- alicesMessage = append(alicesMessage, []byte(QueryMessage))
-
- for round := 0; len(alicesMessage) > 0 || len(bobsMessage) > 0; round++ {
- bobsMessage = nil
- for i, msg := range alicesMessage {
- out, _, bobChange, bobsMessage, err = bob.Receive(msg)
- if len(out) > 0 {
- t.Errorf("Bob generated output during key exchange, round %d, message %d", round, i)
- }
- if err != nil {
- t.Fatalf("Bob returned an error, round %d, message %d (%x): %s", round, i, msg, err)
- }
- if len(bobsMessage) > 0 && i != len(alicesMessage)-1 {
- t.Errorf("Bob produced output while processing a fragment, round %d, message %d", round, i)
- }
- }
-
- alicesMessage = nil
- for i, msg := range bobsMessage {
- out, _, aliceChange, alicesMessage, err = alice.Receive(msg)
- if len(out) > 0 {
- t.Errorf("Alice generated output during key exchange, round %d, message %d", round, i)
- }
- if err != nil {
- t.Fatalf("Alice returned an error, round %d, message %d (%x): %s", round, i, msg, err)
- }
- if len(alicesMessage) > 0 && i != len(bobsMessage)-1 {
- t.Errorf("Alice produced output while processing a fragment, round %d, message %d", round, i)
- }
- }
- }
-
- if aliceChange != NewKeys {
- t.Errorf("Alice terminated without signaling new keys")
- }
- if bobChange != NewKeys {
- t.Errorf("Bob terminated without signaling new keys")
- }
-
- if !bytes.Equal(alice.SSID[:], bob.SSID[:]) {
- t.Errorf("Session identifiers don't match. Alice has %x, Bob has %x", alice.SSID[:], bob.SSID[:])
- }
-
- if !alice.IsEncrypted() {
- t.Error("Alice doesn't believe that the conversation is secure")
- }
- if !bob.IsEncrypted() {
- t.Error("Bob doesn't believe that the conversation is secure")
- }
-}
-
-const (
- firstRoundTrip = iota
- subsequentRoundTrip
- noMACKeyCheck
-)
-
-func roundTrip(t *testing.T, alice, bob *Conversation, message []byte, macKeyCheck int) {
- alicesMessage, err := alice.Send(message)
- if err != nil {
- t.Errorf("Error from Alice sending message: %s", err)
- }
-
- if len(alice.oldMACs) != 0 {
- t.Errorf("Alice has not revealed all MAC keys")
- }
-
- for i, msg := range alicesMessage {
- out, encrypted, _, _, err := bob.Receive(msg)
-
- if err != nil {
- t.Errorf("Error generated while processing test message: %s", err.Error())
- }
- if len(out) > 0 {
- if i != len(alicesMessage)-1 {
- t.Fatal("Bob produced a message while processing a fragment of Alice's")
- }
- if !encrypted {
- t.Errorf("Message was not marked as encrypted")
- }
- if !bytes.Equal(out, message) {
- t.Errorf("Message corrupted: got %x, want %x", out, message)
- }
- }
- }
-
- switch macKeyCheck {
- case firstRoundTrip:
- if len(bob.oldMACs) != 0 {
- t.Errorf("Bob should not have MAC keys to reveal")
- }
- case subsequentRoundTrip:
- if len(bob.oldMACs) != 40 {
- t.Errorf("Bob has %d bytes of MAC keys to reveal, but should have 40", len(bob.oldMACs))
- }
- }
-
- bobsMessage, err := bob.Send(message)
- if err != nil {
- t.Errorf("Error from Bob sending message: %s", err)
- }
-
- if len(bob.oldMACs) != 0 {
- t.Errorf("Bob has not revealed all MAC keys")
- }
-
- for i, msg := range bobsMessage {
- out, encrypted, _, _, err := alice.Receive(msg)
-
- if err != nil {
- t.Errorf("Error generated while processing test message: %s", err.Error())
- }
- if len(out) > 0 {
- if i != len(bobsMessage)-1 {
- t.Fatal("Alice produced a message while processing a fragment of Bob's")
- }
- if !encrypted {
- t.Errorf("Message was not marked as encrypted")
- }
- if !bytes.Equal(out, message) {
- t.Errorf("Message corrupted: got %x, want %x", out, message)
- }
- }
- }
-
- switch macKeyCheck {
- case firstRoundTrip:
- if len(alice.oldMACs) != 20 {
- t.Errorf("Alice has %d bytes of MAC keys to reveal, but should have 20", len(alice.oldMACs))
- }
- case subsequentRoundTrip:
- if len(alice.oldMACs) != 40 {
- t.Errorf("Alice has %d bytes of MAC keys to reveal, but should have 40", len(alice.oldMACs))
- }
- }
-}
-
-func TestConversation(t *testing.T) {
- alice, bob := setupConversation(t)
-
- var testMessages = [][]byte{
- []byte("hello"), []byte("bye"),
- }
-
- roundTripType := firstRoundTrip
-
- for _, testMessage := range testMessages {
- roundTrip(t, alice, bob, testMessage, roundTripType)
- roundTripType = subsequentRoundTrip
- }
-}
-
-func TestGoodSMP(t *testing.T) {
- var alice, bob Conversation
-
- alice.smp.secret = new(big.Int).SetInt64(42)
- bob.smp.secret = alice.smp.secret
-
- var alicesMessages, bobsMessages []tlv
- var aliceComplete, bobComplete bool
- var err error
- var out tlv
-
- alicesMessages = alice.startSMP("")
- for round := 0; len(alicesMessages) > 0 || len(bobsMessages) > 0; round++ {
- bobsMessages = bobsMessages[:0]
- for i, msg := range alicesMessages {
- out, bobComplete, err = bob.processSMP(msg)
- if err != nil {
- t.Errorf("Error from Bob in round %d: %s", round, err)
- }
- if bobComplete && i != len(alicesMessages)-1 {
- t.Errorf("Bob returned a completed signal before processing all of Alice's messages in round %d", round)
- }
- if out.typ != 0 {
- bobsMessages = append(bobsMessages, out)
- }
- }
-
- alicesMessages = alicesMessages[:0]
- for i, msg := range bobsMessages {
- out, aliceComplete, err = alice.processSMP(msg)
- if err != nil {
- t.Errorf("Error from Alice in round %d: %s", round, err)
- }
- if aliceComplete && i != len(bobsMessages)-1 {
- t.Errorf("Alice returned a completed signal before processing all of Bob's messages in round %d", round)
- }
- if out.typ != 0 {
- alicesMessages = append(alicesMessages, out)
- }
- }
- }
-
- if !aliceComplete || !bobComplete {
- t.Errorf("SMP completed without both sides reporting success: alice: %v, bob: %v\n", aliceComplete, bobComplete)
- }
-}
-
-func TestBadSMP(t *testing.T) {
- var alice, bob Conversation
-
- alice.smp.secret = new(big.Int).SetInt64(42)
- bob.smp.secret = new(big.Int).SetInt64(43)
-
- var alicesMessages, bobsMessages []tlv
-
- alicesMessages = alice.startSMP("")
- for round := 0; len(alicesMessages) > 0 || len(bobsMessages) > 0; round++ {
- bobsMessages = bobsMessages[:0]
- for _, msg := range alicesMessages {
- out, complete, _ := bob.processSMP(msg)
- if complete {
- t.Errorf("Bob signaled completion in round %d", round)
- }
- if out.typ != 0 {
- bobsMessages = append(bobsMessages, out)
- }
- }
-
- alicesMessages = alicesMessages[:0]
- for _, msg := range bobsMessages {
- out, complete, _ := alice.processSMP(msg)
- if complete {
- t.Errorf("Alice signaled completion in round %d", round)
- }
- if out.typ != 0 {
- alicesMessages = append(alicesMessages, out)
- }
- }
- }
-}
-
-func TestRehandshaking(t *testing.T) {
- alice, bob := setupConversation(t)
- roundTrip(t, alice, bob, []byte("test"), firstRoundTrip)
- roundTrip(t, alice, bob, []byte("test 2"), subsequentRoundTrip)
- roundTrip(t, alice, bob, []byte("test 3"), subsequentRoundTrip)
- roundTrip(t, alice, bob, []byte("test 4"), subsequentRoundTrip)
- roundTrip(t, alice, bob, []byte("test 5"), subsequentRoundTrip)
- roundTrip(t, alice, bob, []byte("test 6"), subsequentRoundTrip)
- roundTrip(t, alice, bob, []byte("test 7"), subsequentRoundTrip)
- roundTrip(t, alice, bob, []byte("test 8"), subsequentRoundTrip)
- performHandshake(t, alice, bob)
- roundTrip(t, alice, bob, []byte("test"), noMACKeyCheck)
- roundTrip(t, alice, bob, []byte("test 2"), noMACKeyCheck)
-}
-
-func TestAgainstLibOTR(t *testing.T) {
- // This test requires otr.c.test to be built as /tmp/a.out.
- // If enabled, this tests runs forever performing OTR handshakes in a
- // loop.
- return
-
- alicePrivateKey, _ := hex.DecodeString(alicePrivateKeyHex)
- var alice Conversation
- alice.PrivateKey = new(PrivateKey)
- alice.PrivateKey.Parse(alicePrivateKey)
-
- cmd := exec.Command("/tmp/a.out")
- cmd.Stderr = os.Stderr
-
- out, err := cmd.StdinPipe()
- if err != nil {
- t.Fatal(err)
- }
- defer out.Close()
- stdout, err := cmd.StdoutPipe()
- if err != nil {
- t.Fatal(err)
- }
- in := bufio.NewReader(stdout)
-
- if err := cmd.Start(); err != nil {
- t.Fatal(err)
- }
-
- out.Write([]byte(QueryMessage))
- out.Write([]byte("\n"))
- var expectedText = []byte("test message")
-
- for {
- line, isPrefix, err := in.ReadLine()
- if isPrefix {
- t.Fatal("line from subprocess too long")
- }
- if err != nil {
- t.Fatal(err)
- }
- text, encrypted, change, alicesMessage, err := alice.Receive(line)
- if err != nil {
- t.Fatal(err)
- }
- for _, msg := range alicesMessage {
- out.Write(msg)
- out.Write([]byte("\n"))
- }
- if change == NewKeys {
- alicesMessage, err := alice.Send([]byte("Go -> libotr test message"))
- if err != nil {
- t.Fatalf("error sending message: %s", err.Error())
- } else {
- for _, msg := range alicesMessage {
- out.Write(msg)
- out.Write([]byte("\n"))
- }
- }
- }
- if len(text) > 0 {
- if !bytes.Equal(text, expectedText) {
- t.Fatalf("expected %x, but got %x", expectedText, text)
- }
- if !encrypted {
- t.Fatal("message wasn't encrypted")
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pbkdf2/pbkdf2_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pbkdf2/pbkdf2_test.go
deleted file mode 100644
index 1379240610b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pbkdf2/pbkdf2_test.go
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pbkdf2
-
-import (
- "bytes"
- "crypto/sha1"
- "crypto/sha256"
- "hash"
- "testing"
-)
-
-type testVector struct {
- password string
- salt string
- iter int
- output []byte
-}
-
-// Test vectors from RFC 6070, http://tools.ietf.org/html/rfc6070
-var sha1TestVectors = []testVector{
- {
- "password",
- "salt",
- 1,
- []byte{
- 0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e, 0x71,
- 0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60, 0x12, 0x06,
- 0x2f, 0xe0, 0x37, 0xa6,
- },
- },
- {
- "password",
- "salt",
- 2,
- []byte{
- 0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c,
- 0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0,
- 0xd8, 0xde, 0x89, 0x57,
- },
- },
- {
- "password",
- "salt",
- 4096,
- []byte{
- 0x4b, 0x00, 0x79, 0x01, 0xb7, 0x65, 0x48, 0x9a,
- 0xbe, 0xad, 0x49, 0xd9, 0x26, 0xf7, 0x21, 0xd0,
- 0x65, 0xa4, 0x29, 0xc1,
- },
- },
- // // This one takes too long
- // {
- // "password",
- // "salt",
- // 16777216,
- // []byte{
- // 0xee, 0xfe, 0x3d, 0x61, 0xcd, 0x4d, 0xa4, 0xe4,
- // 0xe9, 0x94, 0x5b, 0x3d, 0x6b, 0xa2, 0x15, 0x8c,
- // 0x26, 0x34, 0xe9, 0x84,
- // },
- // },
- {
- "passwordPASSWORDpassword",
- "saltSALTsaltSALTsaltSALTsaltSALTsalt",
- 4096,
- []byte{
- 0x3d, 0x2e, 0xec, 0x4f, 0xe4, 0x1c, 0x84, 0x9b,
- 0x80, 0xc8, 0xd8, 0x36, 0x62, 0xc0, 0xe4, 0x4a,
- 0x8b, 0x29, 0x1a, 0x96, 0x4c, 0xf2, 0xf0, 0x70,
- 0x38,
- },
- },
- {
- "pass\000word",
- "sa\000lt",
- 4096,
- []byte{
- 0x56, 0xfa, 0x6a, 0xa7, 0x55, 0x48, 0x09, 0x9d,
- 0xcc, 0x37, 0xd7, 0xf0, 0x34, 0x25, 0xe0, 0xc3,
- },
- },
-}
-
-// Test vectors from
-// http://stackoverflow.com/questions/5130513/pbkdf2-hmac-sha2-test-vectors
-var sha256TestVectors = []testVector{
- {
- "password",
- "salt",
- 1,
- []byte{
- 0x12, 0x0f, 0xb6, 0xcf, 0xfc, 0xf8, 0xb3, 0x2c,
- 0x43, 0xe7, 0x22, 0x52, 0x56, 0xc4, 0xf8, 0x37,
- 0xa8, 0x65, 0x48, 0xc9,
- },
- },
- {
- "password",
- "salt",
- 2,
- []byte{
- 0xae, 0x4d, 0x0c, 0x95, 0xaf, 0x6b, 0x46, 0xd3,
- 0x2d, 0x0a, 0xdf, 0xf9, 0x28, 0xf0, 0x6d, 0xd0,
- 0x2a, 0x30, 0x3f, 0x8e,
- },
- },
- {
- "password",
- "salt",
- 4096,
- []byte{
- 0xc5, 0xe4, 0x78, 0xd5, 0x92, 0x88, 0xc8, 0x41,
- 0xaa, 0x53, 0x0d, 0xb6, 0x84, 0x5c, 0x4c, 0x8d,
- 0x96, 0x28, 0x93, 0xa0,
- },
- },
- {
- "passwordPASSWORDpassword",
- "saltSALTsaltSALTsaltSALTsaltSALTsalt",
- 4096,
- []byte{
- 0x34, 0x8c, 0x89, 0xdb, 0xcb, 0xd3, 0x2b, 0x2f,
- 0x32, 0xd8, 0x14, 0xb8, 0x11, 0x6e, 0x84, 0xcf,
- 0x2b, 0x17, 0x34, 0x7e, 0xbc, 0x18, 0x00, 0x18,
- 0x1c,
- },
- },
- {
- "pass\000word",
- "sa\000lt",
- 4096,
- []byte{
- 0x89, 0xb6, 0x9d, 0x05, 0x16, 0xf8, 0x29, 0x89,
- 0x3c, 0x69, 0x62, 0x26, 0x65, 0x0a, 0x86, 0x87,
- },
- },
-}
-
-func testHash(t *testing.T, h func() hash.Hash, hashName string, vectors []testVector) {
- for i, v := range vectors {
- o := Key([]byte(v.password), []byte(v.salt), v.iter, len(v.output), h)
- if !bytes.Equal(o, v.output) {
- t.Errorf("%s %d: expected %x, got %x", hashName, i, v.output, o)
- }
- }
-}
-
-func TestWithHMACSHA1(t *testing.T) {
- testHash(t, sha1.New, "SHA1", sha1TestVectors)
-}
-
-func TestWithHMACSHA256(t *testing.T) {
- testHash(t, sha256.New, "SHA256", sha256TestVectors)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/bmp-string_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/bmp-string_test.go
deleted file mode 100644
index 7fca55f4e8b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/bmp-string_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pkcs12
-
-import (
- "bytes"
- "encoding/hex"
- "testing"
-)
-
-var bmpStringTests = []struct {
- in string
- expectedHex string
- shouldFail bool
-}{
- {"", "0000", false},
- // Example from https://tools.ietf.org/html/rfc7292#appendix-B.
- {"Beavis", "0042006500610076006900730000", false},
- // Some characters from the "Letterlike Symbols Unicode block".
- {"\u2115 - Double-struck N", "21150020002d00200044006f00750062006c0065002d00730074007200750063006b0020004e0000", false},
- // any character outside the BMP should trigger an error.
- {"\U0001f000 East wind (Mahjong)", "", true},
-}
-
-func TestBMPString(t *testing.T) {
- for i, test := range bmpStringTests {
- expected, err := hex.DecodeString(test.expectedHex)
- if err != nil {
- t.Fatalf("#%d: failed to decode expectation", i)
- }
-
- out, err := bmpString(test.in)
- if err == nil && test.shouldFail {
- t.Errorf("#%d: expected to fail, but produced %x", i, out)
- continue
- }
-
- if err != nil && !test.shouldFail {
- t.Errorf("#%d: failed unexpectedly: %s", i, err)
- continue
- }
-
- if !test.shouldFail {
- if !bytes.Equal(out, expected) {
- t.Errorf("#%d: expected %s, got %x", i, test.expectedHex, out)
- continue
- }
-
- roundTrip, err := decodeBMPString(out)
- if err != nil {
- t.Errorf("#%d: decoding output gave an error: %s", i, err)
- continue
- }
-
- if roundTrip != test.in {
- t.Errorf("#%d: decoding output resulted in %q, but it should have been %q", i, roundTrip, test.in)
- continue
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/crypto_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/crypto_test.go
deleted file mode 100644
index eb4dae8fceb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/crypto_test.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pkcs12
-
-import (
- "bytes"
- "crypto/x509/pkix"
- "encoding/asn1"
- "testing"
-)
-
-var sha1WithTripleDES = asn1.ObjectIdentifier([]int{1, 2, 840, 113549, 1, 12, 1, 3})
-
-func TestPbDecrypterFor(t *testing.T) {
- params, _ := asn1.Marshal(pbeParams{
- Salt: []byte{1, 2, 3, 4, 5, 6, 7, 8},
- Iterations: 2048,
- })
- alg := pkix.AlgorithmIdentifier{
- Algorithm: asn1.ObjectIdentifier([]int{1, 2, 3}),
- Parameters: asn1.RawValue{
- FullBytes: params,
- },
- }
-
- pass, _ := bmpString("Sesame open")
-
- _, _, err := pbDecrypterFor(alg, pass)
- if _, ok := err.(NotImplementedError); !ok {
- t.Errorf("expected not implemented error, got: %T %s", err, err)
- }
-
- alg.Algorithm = sha1WithTripleDES
- cbc, blockSize, err := pbDecrypterFor(alg, pass)
- if err != nil {
- t.Errorf("unexpected error from pbDecrypterFor %v", err)
- }
- if blockSize != 8 {
- t.Errorf("unexpected block size %d, wanted 8", blockSize)
- }
-
- plaintext := []byte{1, 2, 3, 4, 5, 6, 7, 8}
- expectedCiphertext := []byte{185, 73, 135, 249, 137, 1, 122, 247}
- ciphertext := make([]byte, len(plaintext))
- cbc.CryptBlocks(ciphertext, plaintext)
-
- if bytes.Compare(ciphertext, expectedCiphertext) != 0 {
- t.Errorf("bad ciphertext, got %x but wanted %x", ciphertext, expectedCiphertext)
- }
-}
-
-var pbDecryptTests = []struct {
- in []byte
- expected []byte
- expectedError error
-}{
- {
- []byte("\x33\x73\xf3\x9f\xda\x49\xae\xfc\xa0\x9a\xdf\x5a\x58\xa0\xea\x46"), // 7 padding bytes
- []byte("A secret!"),
- nil,
- },
- {
- []byte("\x33\x73\xf3\x9f\xda\x49\xae\xfc\x96\x24\x2f\x71\x7e\x32\x3f\xe7"), // 8 padding bytes
- []byte("A secret"),
- nil,
- },
- {
- []byte("\x35\x0c\xc0\x8d\xab\xa9\x5d\x30\x7f\x9a\xec\x6a\xd8\x9b\x9c\xd9"), // 9 padding bytes, incorrect
- nil,
- ErrDecryption,
- },
- {
- []byte("\xb2\xf9\x6e\x06\x60\xae\x20\xcf\x08\xa0\x7b\xd9\x6b\x20\xef\x41"), // incorrect padding bytes: [ ... 0x04 0x02 ]
- nil,
- ErrDecryption,
- },
-}
-
-func TestPbDecrypt(t *testing.T) {
- for i, test := range pbDecryptTests {
- decryptable := testDecryptable{
- data: test.in,
- algorithm: pkix.AlgorithmIdentifier{
- Algorithm: sha1WithTripleDES,
- Parameters: pbeParams{
- Salt: []byte("\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8"),
- Iterations: 4096,
- }.RawASN1(),
- },
- }
- password, _ := bmpString("sesame")
-
- plaintext, err := pbDecrypt(decryptable, password)
- if err != test.expectedError {
- t.Errorf("#%d: got error %q, but wanted %q", i, err, test.expectedError)
- continue
- }
-
- if !bytes.Equal(plaintext, test.expected) {
- t.Errorf("#%d: got %x, but wanted %x", i, plaintext, test.expected)
- }
- }
-}
-
-type testDecryptable struct {
- data []byte
- algorithm pkix.AlgorithmIdentifier
-}
-
-func (d testDecryptable) Algorithm() pkix.AlgorithmIdentifier { return d.algorithm }
-func (d testDecryptable) Data() []byte { return d.data }
-
-func (params pbeParams) RawASN1() (raw asn1.RawValue) {
- asn1Bytes, err := asn1.Marshal(params)
- if err != nil {
- panic(err)
- }
- _, err = asn1.Unmarshal(asn1Bytes, &raw)
- if err != nil {
- panic(err)
- }
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/bench_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/bench_test.go
deleted file mode 100644
index 3347f338c18..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/bench_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package rc2
-
-import (
- "testing"
-)
-
-func BenchmarkEncrypt(b *testing.B) {
- r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64)
- b.ResetTimer()
- var src [8]byte
- for i := 0; i < b.N; i++ {
- r.Encrypt(src[:], src[:])
- }
-}
-
-func BenchmarkDecrypt(b *testing.B) {
- r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64)
- b.ResetTimer()
- var src [8]byte
- for i := 0; i < b.N; i++ {
- r.Decrypt(src[:], src[:])
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2_test.go
deleted file mode 100644
index 8a49dfaf3c6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/internal/rc2/rc2_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package rc2
-
-import (
- "bytes"
- "encoding/hex"
- "testing"
-)
-
-func TestEncryptDecrypt(t *testing.T) {
-
- // TODO(dgryski): add the rest of the test vectors from the RFC
- var tests = []struct {
- key string
- plain string
- cipher string
- t1 int
- }{
- {
- "0000000000000000",
- "0000000000000000",
- "ebb773f993278eff",
- 63,
- },
- {
- "ffffffffffffffff",
- "ffffffffffffffff",
- "278b27e42e2f0d49",
- 64,
- },
- {
- "3000000000000000",
- "1000000000000001",
- "30649edf9be7d2c2",
- 64,
- },
- {
- "88",
- "0000000000000000",
- "61a8a244adacccf0",
- 64,
- },
- {
- "88bca90e90875a",
- "0000000000000000",
- "6ccf4308974c267f",
- 64,
- },
- {
- "88bca90e90875a7f0f79c384627bafb2",
- "0000000000000000",
- "1a807d272bbe5db1",
- 64,
- },
- {
- "88bca90e90875a7f0f79c384627bafb2",
- "0000000000000000",
- "2269552ab0f85ca6",
- 128,
- },
- {
- "88bca90e90875a7f0f79c384627bafb216f80a6f85920584c42fceb0be255daf1e",
- "0000000000000000",
- "5b78d3a43dfff1f1",
- 129,
- },
- }
-
- for _, tt := range tests {
- k, _ := hex.DecodeString(tt.key)
- p, _ := hex.DecodeString(tt.plain)
- c, _ := hex.DecodeString(tt.cipher)
-
- b, _ := New(k, tt.t1)
-
- var dst [8]byte
-
- b.Encrypt(dst[:], p)
-
- if !bytes.Equal(dst[:], c) {
- t.Errorf("encrypt failed: got % 2x wanted % 2x\n", dst, c)
- }
-
- b.Decrypt(dst[:], c)
-
- if !bytes.Equal(dst[:], p) {
- t.Errorf("decrypt failed: got % 2x wanted % 2x\n", dst, p)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/mac_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/mac_test.go
deleted file mode 100644
index 1ed4ff21e14..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/mac_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pkcs12
-
-import (
- "encoding/asn1"
- "testing"
-)
-
-func TestVerifyMac(t *testing.T) {
- td := macData{
- Mac: digestInfo{
- Digest: []byte{0x18, 0x20, 0x3d, 0xff, 0x1e, 0x16, 0xf4, 0x92, 0xf2, 0xaf, 0xc8, 0x91, 0xa9, 0xba, 0xd6, 0xca, 0x9d, 0xee, 0x51, 0x93},
- },
- MacSalt: []byte{1, 2, 3, 4, 5, 6, 7, 8},
- Iterations: 2048,
- }
-
- message := []byte{11, 12, 13, 14, 15}
- password, _ := bmpString("")
-
- td.Mac.Algorithm.Algorithm = asn1.ObjectIdentifier([]int{1, 2, 3})
- err := verifyMac(&td, message, password)
- if _, ok := err.(NotImplementedError); !ok {
- t.Errorf("err: %v", err)
- }
-
- td.Mac.Algorithm.Algorithm = asn1.ObjectIdentifier([]int{1, 3, 14, 3, 2, 26})
- err = verifyMac(&td, message, password)
- if err != ErrIncorrectPassword {
- t.Errorf("Expected incorrect password, got err: %v", err)
- }
-
- password, _ = bmpString("Sesame open")
- err = verifyMac(&td, message, password)
- if err != nil {
- t.Errorf("err: %v", err)
- }
-
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pbkdf_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pbkdf_test.go
deleted file mode 100644
index 262037d7eba..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pbkdf_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pkcs12
-
-import (
- "bytes"
- "testing"
-)
-
-func TestThatPBKDFWorksCorrectlyForLongKeys(t *testing.T) {
- cipherInfo := shaWithTripleDESCBC{}
-
- salt := []byte("\xff\xff\xff\xff\xff\xff\xff\xff")
- password, _ := bmpString("sesame")
- key := cipherInfo.deriveKey(salt, password, 2048)
-
- if expected := []byte("\x7c\xd9\xfd\x3e\x2b\x3b\xe7\x69\x1a\x44\xe3\xbe\xf0\xf9\xea\x0f\xb9\xb8\x97\xd4\xe3\x25\xd9\xd1"); bytes.Compare(key, expected) != 0 {
- t.Fatalf("expected key '%x', but found '%x'", expected, key)
- }
-}
-
-func TestThatPBKDFHandlesLeadingZeros(t *testing.T) {
- // This test triggers a case where I_j (in step 6C) ends up with leading zero
- // byte, meaning that len(Ijb) < v (leading zeros get stripped by big.Int).
- // This was previously causing bug whereby certain inputs would break the
- // derivation and produce the wrong output.
- key := pbkdf(sha1Sum, 20, 64, []byte("\xf3\x7e\x05\xb5\x18\x32\x4b\x4b"), []byte("\x00\x00"), 2048, 1, 24)
- expected := []byte("\x00\xf7\x59\xff\x47\xd1\x4d\xd0\x36\x65\xd5\x94\x3c\xb3\xc4\xa3\x9a\x25\x55\xc0\x2a\xed\x66\xe1")
- if bytes.Compare(key, expected) != 0 {
- t.Fatalf("expected key '%x', but found '%x'", expected, key)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pkcs12_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pkcs12_test.go
deleted file mode 100644
index 14dd2a6c5d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/pkcs12/pkcs12_test.go
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pkcs12
-
-import (
- "crypto/rsa"
- "crypto/tls"
- "encoding/base64"
- "encoding/pem"
- "testing"
-)
-
-func TestPfx(t *testing.T) {
- for commonName, base64P12 := range testdata {
- p12, _ := base64.StdEncoding.DecodeString(base64P12)
-
- priv, cert, err := Decode(p12, "")
- if err != nil {
- t.Fatal(err)
- }
-
- if err := priv.(*rsa.PrivateKey).Validate(); err != nil {
- t.Errorf("error while validating private key: %v", err)
- }
-
- if cert.Subject.CommonName != commonName {
- t.Errorf("expected common name to be %q, but found %q", commonName, cert.Subject.CommonName)
- }
- }
-}
-
-func TestPEM(t *testing.T) {
- for commonName, base64P12 := range testdata {
- p12, _ := base64.StdEncoding.DecodeString(base64P12)
-
- blocks, err := ToPEM(p12, "")
- if err != nil {
- t.Fatalf("error while converting to PEM: %s", err)
- }
-
- var pemData []byte
- for _, b := range blocks {
- pemData = append(pemData, pem.EncodeToMemory(b)...)
- }
-
- cert, err := tls.X509KeyPair(pemData, pemData)
- if err != nil {
- t.Errorf("err while converting to key pair: %v", err)
- }
- config := tls.Config{
- Certificates: []tls.Certificate{cert},
- }
- config.BuildNameToCertificate()
-
- if _, exists := config.NameToCertificate[commonName]; !exists {
- t.Errorf("did not find our cert in PEM?: %v", config.NameToCertificate)
- }
- }
-}
-
-func ExampleToPEM() {
- p12, _ := base64.StdEncoding.DecodeString(`MIIJzgIBAzCCCZQGCS ... CA+gwggPk==`)
-
- blocks, err := ToPEM(p12, "password")
- if err != nil {
- panic(err)
- }
-
- var pemData []byte
- for _, b := range blocks {
- pemData = append(pemData, pem.EncodeToMemory(b)...)
- }
-
- // then use PEM data for tls to construct tls certificate:
- cert, err := tls.X509KeyPair(pemData, pemData)
- if err != nil {
- panic(err)
- }
-
- config := &tls.Config{
- Certificates: []tls.Certificate{cert},
- }
-
- _ = config
-}
-
-var testdata = map[string]string{
- // 'null' password test case
- "Windows Azure Tools": `MIIKDAIBAzCCCcwGCSqGSIb3DQEHAaCCCb0Eggm5MIIJtTCCBe4GCSqGSIb3DQEHAaCCBd8EggXbMIIF1zCCBdMGCyqGSIb3DQEMCgECoIIE7jCCBOowHAYKKoZIhvcNAQwBAzAOBAhStUNnlTGV+gICB9AEggTIJ81JIossF6boFWpPtkiQRPtI6DW6e9QD4/WvHAVrM2bKdpMzSMsCML5NyuddANTKHBVq00Jc9keqGNAqJPKkjhSUebzQFyhe0E1oI9T4zY5UKr/I8JclOeccH4QQnsySzYUG2SnniXnQ+JrG3juetli7EKth9h6jLc6xbubPadY5HMB3wL/eG/kJymiXwU2KQ9Mgd4X6jbcV+NNCE/8jbZHvSTCPeYTJIjxfeX61Sj5kFKUCzERbsnpyevhY3X0eYtEDezZQarvGmXtMMdzf8HJHkWRdk9VLDLgjk8uiJif/+X4FohZ37ig0CpgC2+dP4DGugaZZ51hb8tN9GeCKIsrmWogMXDIVd0OACBp/EjJVmFB6y0kUCXxUE0TZt0XA1tjAGJcjDUpBvTntZjPsnH/4ZySy+s2d9OOhJ6pzRQBRm360TzkFdSwk9DLiLdGfv4pwMMu/vNGBlqjP/1sQtj+jprJiD1sDbCl4AdQZVoMBQHadF2uSD4/o17XG/Ci0r2h6Htc2yvZMAbEY4zMjjIn2a+vqIxD6onexaek1R3zbkS9j19D6EN9EWn8xgz80YRCyW65znZk8xaIhhvlU/mg7sTxeyuqroBZNcq6uDaQTehDpyH7bY2l4zWRpoj10a6JfH2q5shYz8Y6UZC/kOTfuGqbZDNZWro/9pYquvNNW0M847E5t9bsf9VkAAMHRGBbWoVoU9VpI0UnoXSfvpOo+aXa2DSq5sHHUTVY7A9eov3z5IqT+pligx11xcs+YhDWcU8di3BTJisohKvv5Y8WSkm/rloiZd4ig269k0jTRk1olP/vCksPli4wKG2wdsd5o42nX1yL7mFfXocOANZbB+5qMkiwdyoQSk+Vq+C8nAZx2bbKhUq2MbrORGMzOe0Hh0x2a0PeObycN1Bpyv7Mp3ZI9h5hBnONKCnqMhtyQHUj/nNvbJUnDVYNfoOEqDiEqqEwB7YqWzAKz8KW0OIqdlM8uiQ4JqZZlFllnWJUfaiDrdFM3lYSnFQBkzeVlts6GpDOOBjCYd7dcCNS6kq6pZC6p6HN60Twu0JnurZD6RT7rrPkIGE8vAenFt4iGe/yF52fahCSY8Ws4K0UTwN7bAS+4xRHVCWvE8sMRZsRCHizb5laYsVrPZJhE6+hux6OBb6w8kwPYXc+ud5v6UxawUWgt6uPwl8mlAtU9Z7Miw4Nn/wtBkiLL/ke1UI1gqJtcQXgHxx6mzsjh41+nAgTvdbsSEyU6vfOmxGj3Rwc1eOrIhJUqn5YjOWfzzsz/D5DzWKmwXIwdspt1p+u+kol1N3f2wT9fKPnd/RGCb4g/1hc3Aju4DQYgGY782l89CEEdalpQ/35bQczMFk6Fje12HykakWEXd/bGm9Unh82gH84USiRpeOfQvBDYoqEyrY3zkFZzBjhDqa+jEcAj41tcGx47oSfDq3iVYCdL7HSIjtnyEktVXd7mISZLoMt20JACFcMw+mrbjlug+eU7o2GR7T+LwtOp/p4LZqyLa7oQJDwde1BNZtm3TCK2P1mW94QDL0nDUps5KLtr1DaZXEkRbjSJub2ZE9WqDHyU3KA8G84Tq/rN1IoNu/if45jacyPje1Npj9IftUZSP22nV7HMwZtwQ4P4MYHRMBMGCSqGSIb3DQEJFTEGBAQBAAAAMFsGCSqGSIb3DQEJFDFOHkwAewBCADQAQQA0AEYARQBCADAALQBBADEAOABBAC0ANAA0AEIAQgAtAEIANQBGADIALQA0ADkAMQBFAEYAMQA1ADIAQgBBADEANgB9MF0GCSsGAQQBgjcRATFQHk4ATQBpAGMAcgBvAHMAbwBmAHQAIABTAG8AZgB0AHcAYQByAGUAIABLAGUAeQAgAFMAdABvAHIAYQBnAGUAIABQAHIAbwB2AGkAZABlAHIwggO/BgkqhkiG9w0BBwagggOwMIIDrAIBADCCA6UGCSqGSIb3DQEHATAcBgoqhkiG9w0BDAEGMA4ECEBk5ZAYpu0WAgIH0ICCA3hik4mQFGpw9Ha8TQPtk+j2jwWdxfF0+sTk6S8PTsEfIhB7wPltjiCK92Uv2tCBQnodBUmatIfkpnRDEySmgmdglmOCzj204lWAMRs94PoALGn3JVBXbO1vIDCbAPOZ7Z0Hd0/1t2hmk8v3//QJGUg+qr59/4y/MuVfIg4qfkPcC2QSvYWcK3oTf6SFi5rv9B1IOWFgN5D0+C+x/9Lb/myPYX+rbOHrwtJ4W1fWKoz9g7wwmGFA9IJ2DYGuH8ifVFbDFT1Vcgsvs8arSX7oBsJVW0qrP7XkuDRe3EqCmKW7rBEwYrFznhxZcRDEpMwbFoSvgSIZ4XhFY9VKYglT+JpNH5iDceYEBOQL4vBLpxNUk3l5jKaBNxVa14AIBxq18bVHJ+STInhLhad4u10v/Xbx7wIL3f9DX1yLAkPrpBYbNHS2/ew6H/ySDJnoIDxkw2zZ4qJ+qUJZ1S0lbZVG+VT0OP5uF6tyOSpbMlcGkdl3z254n6MlCrTifcwkzscysDsgKXaYQw06rzrPW6RDub+t+hXzGny799fS9jhQMLDmOggaQ7+LA4oEZsfT89HLMWxJYDqjo3gIfjciV2mV54R684qLDS+AO09U49e6yEbwGlq8lpmO/pbXCbpGbB1b3EomcQbxdWxW2WEkkEd/VBn81K4M3obmywwXJkw+tPXDXfBmzzaqqCR+onMQ5ME1nMkY8ybnfoCc1bDIupjVWsEL2Wvq752RgI6KqzVNr1ew1IdqV5AWN2fOfek+0vi3Jd9FHF3hx8JMwjJL9dZsETV5kHtYJtE7wJ23J68BnCt2eI0GEuwXcCf5EdSKN/xXCTlIokc4Qk/gzRdIZsvcEJ6B1lGovKG54X4IohikqTjiepjbsMWj38yxDmK3mtENZ9ci8FPfbbvIEcOCZIinuY3qFUlRSbx7VUerEoV1IP3clUwexVQo4lHFee2jd7ocWsdSqSapW7OWUupBtDzRkqVhE7tGria+i1W2d6YLlJ21QTjyapWJehAMO637OdbJCCzDs1cXbodRRE7bsP492ocJy8OX66rKdhYbg8srSFNKdb3pF3UDNbN9jhI/t8iagRhNBhlQtTr1me2E/c86Q18qcRXl4bcXTt6acgCeffK6Y26LcVlrgjlD33AEYRRUeyC+rpxbT0aMjdFderlndKRIyG23mSp0HaUwNzAfMAcGBSsOAwIaBBRlviCbIyRrhIysg2dc/KbLFTc2vQQUg4rfwHMM4IKYRD/fsd1x6dda+wQ=`,
- // empty string password test case
- "testing@example.com": `MIIJzgIBAzCCCZQGCSqGSIb3DQEHAaCCCYUEggmBMIIJfTCCA/cGCSqGSIb3DQEHBqCCA+gwggPk
-AgEAMIID3QYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIIszfRGqcmPcCAggAgIIDsOZ9Eg1L
-s5Wx8JhYoV3HAL4aRnkAWvTYB5NISZOgSgIQTssmt/3A7134dibTmaT/93LikkL3cTKLnQzJ4wDf
-YZ1bprpVJvUqz+HFT79m27bP9zYXFrvxWBJbxjYKTSjQMgz+h8LAEpXXGajCmxMJ1oCOtdXkhhzc
-LdZN6SAYgtmtyFnCdMEDskSggGuLb3fw84QEJ/Sj6FAULXunW/CPaS7Ce0TMsKmNU/jfFWj3yXXw
-ro0kwjKiVLpVFlnBlHo2OoVU7hmkm59YpGhLgS7nxLD3n7nBroQ0ID1+8R01NnV9XLGoGzxMm1te
-6UyTCkr5mj+kEQ8EP1Ys7g/TC411uhVWySMt/rcpkx7Vz1r9kYEAzJpONAfr6cuEVkPKrxpq4Fh0
-2fzlKBky0i/hrfIEUmngh+ERHUb/Mtv/fkv1j5w9suESbhsMLLiCXAlsP1UWMX+3bNizi3WVMEts
-FM2k9byn+p8IUD/A8ULlE4kEaWeoc+2idkCNQkLGuIdGUXUFVm58se0auUkVRoRJx8x4CkMesT8j
-b1H831W66YRWoEwwDQp2kK1lA2vQXxdVHWlFevMNxJeromLzj3ayiaFrfByeUXhR2S+Hpm+c0yNR
-4UVU9WED2kacsZcpRm9nlEa5sr28mri5JdBrNa/K02OOhvKCxr5ZGmbOVzUQKla2z4w+Ku9k8POm
-dfDNU/fGx1b5hcFWtghXe3msWVsSJrQihnN6q1ughzNiYZlJUGcHdZDRtiWwCFI0bR8h/Dmg9uO9
-4rawQQrjIRT7B8yF3UbkZyAqs8Ppb1TsMeNPHh1rxEfGVQknh/48ouJYsmtbnzugTUt3mJCXXiL+
-XcPMV6bBVAUu4aaVKSmg9+yJtY4/VKv10iw88ktv29fViIdBe3t6l/oPuvQgbQ8dqf4T8w0l/uKZ
-9lS1Na9jfT1vCoS7F5TRi+tmyj1vL5kr/amEIW6xKEP6oeAMvCMtbPAzVEj38zdJ1R22FfuIBxkh
-f0Zl7pdVbmzRxl/SBx9iIBJSqAvcXItiT0FIj8HxQ+0iZKqMQMiBuNWJf5pYOLWGrIyntCWwHuaQ
-wrx0sTGuEL9YXLEAsBDrsvzLkx/56E4INGZFrH8G7HBdW6iGqb22IMI4GHltYSyBRKbB0gadYTyv
-abPEoqww8o7/85aPSzOTJ/53ozD438Q+d0u9SyDuOb60SzCD/zPuCEd78YgtXJwBYTuUNRT27FaM
-3LGMX8Hz+6yPNRnmnA2XKPn7dx/IlaqAjIs8MIIFfgYJKoZIhvcNAQcBoIIFbwSCBWswggVnMIIF
-YwYLKoZIhvcNAQwKAQKgggTuMIIE6jAcBgoqhkiG9w0BDAEDMA4ECJr0cClYqOlcAgIIAASCBMhe
-OQSiP2s0/46ONXcNeVAkz2ksW3u/+qorhSiskGZ0b3dFa1hhgBU2Q7JVIkc4Hf7OXaT1eVQ8oqND
-uhqsNz83/kqYo70+LS8Hocj49jFgWAKrf/yQkdyP1daHa2yzlEw4mkpqOfnIORQHvYCa8nEApspZ
-wVu8y6WVuLHKU67mel7db2xwstQp7PRuSAYqGjTfAylElog8ASdaqqYbYIrCXucF8iF9oVgmb/Qo
-xrXshJ9aSLO4MuXlTPELmWgj07AXKSb90FKNihE+y0bWb9LPVFY1Sly3AX9PfrtkSXIZwqW3phpv
-MxGxQl/R6mr1z+hlTfY9Wdpb5vlKXPKA0L0Rt8d2pOesylFi6esJoS01QgP1kJILjbrV731kvDc0
-Jsd+Oxv4BMwA7ClG8w1EAOInc/GrV1MWFGw/HeEqj3CZ/l/0jv9bwkbVeVCiIhoL6P6lVx9pXq4t
-KZ0uKg/tk5TVJmG2vLcMLvezD0Yk3G2ZOMrywtmskrwoF7oAUpO9e87szoH6fEvUZlkDkPVW1NV4
-cZk3DBSQiuA3VOOg8qbo/tx/EE3H59P0axZWno2GSB0wFPWd1aj+b//tJEJHaaNR6qPRj4IWj9ru
-Qbc8eRAcVWleHg8uAehSvUXlFpyMQREyrnpvMGddpiTC8N4UMrrBRhV7+UbCOWhxPCbItnInBqgl
-1JpSZIP7iUtsIMdu3fEC2cdbXMTRul+4rdzUR7F9OaezV3jjvcAbDvgbK1CpyC+MJ1Mxm/iTgk9V
-iUArydhlR8OniN84GyGYoYCW9O/KUwb6ASmeFOu/msx8x6kAsSQHIkKqMKv0TUR3kZnkxUvdpBGP
-KTl4YCTvNGX4dYALBqrAETRDhua2KVBD/kEttDHwBNVbN2xi81+Mc7ml461aADfk0c66R/m2sjHB
-2tN9+wG12OIWFQjL6wF/UfJMYamxx2zOOExiId29Opt57uYiNVLOO4ourPewHPeH0u8Gz35aero7
-lkt7cZAe1Q0038JUuE/QGlnK4lESK9UkSIQAjSaAlTsrcfwtQxB2EjoOoLhwH5mvxUEmcNGNnXUc
-9xj3M5BD3zBz3Ft7G3YMMDwB1+zC2l+0UG0MGVjMVaeoy32VVNvxgX7jk22OXG1iaOB+PY9kdk+O
-X+52BGSf/rD6X0EnqY7XuRPkMGgjtpZeAYxRQnFtCZgDY4wYheuxqSSpdF49yNczSPLkgB3CeCfS
-+9NTKN7aC6hBbmW/8yYh6OvSiCEwY0lFS/T+7iaVxr1loE4zI1y/FFp4Pe1qfLlLttVlkygga2UU
-SCunTQ8UB/M5IXWKkhMOO11dP4niWwb39Y7pCWpau7mwbXOKfRPX96cgHnQJK5uG+BesDD1oYnX0
-6frN7FOnTSHKruRIwuI8KnOQ/I+owmyz71wiv5LMQt+yM47UrEjB/EZa5X8dpEwOZvkdqL7utcyo
-l0XH5kWMXdW856LL/FYftAqJIDAmtX1TXF/rbP6mPyN/IlDC0gjP84Uzd/a2UyTIWr+wk49Ek3vQ
-/uDamq6QrwAxVmNh5Tset5Vhpc1e1kb7mRMZIzxSP8JcTuYd45oFKi98I8YjvueHVZce1g7OudQP
-SbFQoJvdT46iBg1TTatlltpOiH2mFaxWVS0xYjAjBgkqhkiG9w0BCRUxFgQUdA9eVqvETX4an/c8
-p8SsTugkit8wOwYJKoZIhvcNAQkUMS4eLABGAHIAaQBlAG4AZABsAHkAIABuAGEAbQBlACAAZgBv
-AHIAIABjAGUAcgB0MDEwITAJBgUrDgMCGgUABBRFsNz3Zd1O1GI8GTuFwCWuDOjEEwQIuBEfIcAy
-HQ8CAggA`,
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/poly1305/poly1305_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/poly1305/poly1305_test.go
deleted file mode 100644
index b3e92310b5d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/poly1305/poly1305_test.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package poly1305
-
-import (
- "bytes"
- "testing"
- "unsafe"
-)
-
-var testData = []struct {
- in, k, correct []byte
-}{
- {
- []byte("Hello world!"),
- []byte("this is 32-byte key for Poly1305"),
- []byte{0xa6, 0xf7, 0x45, 0x00, 0x8f, 0x81, 0xc9, 0x16, 0xa2, 0x0d, 0xcc, 0x74, 0xee, 0xf2, 0xb2, 0xf0},
- },
- {
- make([]byte, 32),
- []byte("this is 32-byte key for Poly1305"),
- []byte{0x49, 0xec, 0x78, 0x09, 0x0e, 0x48, 0x1e, 0xc6, 0xc2, 0x6b, 0x33, 0xb9, 0x1c, 0xcc, 0x03, 0x07},
- },
- {
- make([]byte, 2007),
- []byte("this is 32-byte key for Poly1305"),
- []byte{0xda, 0x84, 0xbc, 0xab, 0x02, 0x67, 0x6c, 0x38, 0xcd, 0xb0, 0x15, 0x60, 0x42, 0x74, 0xc2, 0xaa},
- },
- {
- make([]byte, 2007),
- make([]byte, 32),
- make([]byte, 16),
- },
-}
-
-func testSum(t *testing.T, unaligned bool) {
- var out [16]byte
- var key [32]byte
-
- for i, v := range testData {
- in := v.in
- if unaligned {
- in = unalignBytes(in)
- }
- copy(key[:], v.k)
- Sum(&out, in, &key)
- if !bytes.Equal(out[:], v.correct) {
- t.Errorf("%d: expected %x, got %x", i, v.correct, out[:])
- }
- }
-}
-
-func TestSum(t *testing.T) { testSum(t, false) }
-func TestSumUnaligned(t *testing.T) { testSum(t, true) }
-
-func benchmark(b *testing.B, size int, unaligned bool) {
- var out [16]byte
- var key [32]byte
- in := make([]byte, size)
- if unaligned {
- in = unalignBytes(in)
- }
- b.SetBytes(int64(len(in)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- Sum(&out, in, &key)
- }
-}
-
-func Benchmark64(b *testing.B) { benchmark(b, 64, false) }
-func Benchmark1K(b *testing.B) { benchmark(b, 1024, false) }
-func Benchmark64Unaligned(b *testing.B) { benchmark(b, 64, true) }
-func Benchmark1KUnaligned(b *testing.B) { benchmark(b, 1024, true) }
-
-func unalignBytes(in []byte) []byte {
- out := make([]byte, len(in)+1)
- if uintptr(unsafe.Pointer(&out[0]))&(unsafe.Alignof(uint32(0))-1) == 0 {
- out = out[1:]
- } else {
- out = out[:len(in)]
- }
- copy(out, in)
- return out
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ripemd160/ripemd160_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ripemd160/ripemd160_test.go
deleted file mode 100644
index 5df1b2593d2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ripemd160/ripemd160_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ripemd160
-
-// Test vectors are from:
-// http://homes.esat.kuleuven.be/~bosselae/ripemd160.html
-
-import (
- "fmt"
- "io"
- "testing"
-)
-
-type mdTest struct {
- out string
- in string
-}
-
-var vectors = [...]mdTest{
- {"9c1185a5c5e9fc54612808977ee8f548b2258d31", ""},
- {"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", "a"},
- {"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", "abc"},
- {"5d0689ef49d2fae572b881b123a85ffa21595f36", "message digest"},
- {"f71c27109c692c1b56bbdceb5b9d2865b3708dbc", "abcdefghijklmnopqrstuvwxyz"},
- {"12a053384a9c0c88e405a06c27dcf49ada62eb2b", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"},
- {"b0e20b6e3116640286ed3a87a5713079b21f5189", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
- {"9b752e45573d4b39f4dbd3323cab82bf63326bfb", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"},
-}
-
-func TestVectors(t *testing.T) {
- for i := 0; i < len(vectors); i++ {
- tv := vectors[i]
- md := New()
- for j := 0; j < 3; j++ {
- if j < 2 {
- io.WriteString(md, tv.in)
- } else {
- io.WriteString(md, tv.in[0:len(tv.in)/2])
- md.Sum(nil)
- io.WriteString(md, tv.in[len(tv.in)/2:])
- }
- s := fmt.Sprintf("%x", md.Sum(nil))
- if s != tv.out {
- t.Fatalf("RIPEMD-160[%d](%s) = %s, expected %s", j, tv.in, s, tv.out)
- }
- md.Reset()
- }
- }
-}
-
-func TestMillionA(t *testing.T) {
- md := New()
- for i := 0; i < 100000; i++ {
- io.WriteString(md, "aaaaaaaaaa")
- }
- out := "52783243c1697bdbe16d37f97f68f08325dc1528"
- s := fmt.Sprintf("%x", md.Sum(nil))
- if s != out {
- t.Fatalf("RIPEMD-160 (1 million 'a') = %s, expected %s", s, out)
- }
- md.Reset()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
deleted file mode 100644
index f8cecd9e6e9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package salsa
-
-import "testing"
-
-func TestCore208(t *testing.T) {
- in := [64]byte{
- 0x7e, 0x87, 0x9a, 0x21, 0x4f, 0x3e, 0xc9, 0x86,
- 0x7c, 0xa9, 0x40, 0xe6, 0x41, 0x71, 0x8f, 0x26,
- 0xba, 0xee, 0x55, 0x5b, 0x8c, 0x61, 0xc1, 0xb5,
- 0x0d, 0xf8, 0x46, 0x11, 0x6d, 0xcd, 0x3b, 0x1d,
- 0xee, 0x24, 0xf3, 0x19, 0xdf, 0x9b, 0x3d, 0x85,
- 0x14, 0x12, 0x1e, 0x4b, 0x5a, 0xc5, 0xaa, 0x32,
- 0x76, 0x02, 0x1d, 0x29, 0x09, 0xc7, 0x48, 0x29,
- 0xed, 0xeb, 0xc6, 0x8d, 0xb8, 0xb8, 0xc2, 0x5e}
-
- out := [64]byte{
- 0xa4, 0x1f, 0x85, 0x9c, 0x66, 0x08, 0xcc, 0x99,
- 0x3b, 0x81, 0xca, 0xcb, 0x02, 0x0c, 0xef, 0x05,
- 0x04, 0x4b, 0x21, 0x81, 0xa2, 0xfd, 0x33, 0x7d,
- 0xfd, 0x7b, 0x1c, 0x63, 0x96, 0x68, 0x2f, 0x29,
- 0xb4, 0x39, 0x31, 0x68, 0xe3, 0xc9, 0xe6, 0xbc,
- 0xfe, 0x6b, 0xc5, 0xb7, 0xa0, 0x6d, 0x96, 0xba,
- 0xe4, 0x24, 0xcc, 0x10, 0x2c, 0x91, 0x74, 0x5c,
- 0x24, 0xad, 0x67, 0x3d, 0xc7, 0x61, 0x8f, 0x81,
- }
-
- Core208(&in, &in)
- if in != out {
- t.Errorf("expected %x, got %x", out, in)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa20_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa20_test.go
deleted file mode 100644
index 0ef3328eb0a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/salsa20/salsa20_test.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package salsa20
-
-import (
- "bytes"
- "encoding/hex"
- "testing"
-)
-
-func fromHex(s string) []byte {
- ret, err := hex.DecodeString(s)
- if err != nil {
- panic(err)
- }
- return ret
-}
-
-// testVectors was taken from set 6 of the ECRYPT test vectors:
-// http://www.ecrypt.eu.org/stream/svn/viewcvs.cgi/ecrypt/trunk/submissions/salsa20/full/verified.test-vectors?logsort=rev&rev=210&view=markup
-var testVectors = []struct {
- key []byte
- iv []byte
- numBytes int
- xor []byte
-}{
- {
- fromHex("0053A6F94C9FF24598EB3E91E4378ADD3083D6297CCF2275C81B6EC11467BA0D"),
- fromHex("0D74DB42A91077DE"),
- 131072,
- fromHex("C349B6A51A3EC9B712EAED3F90D8BCEE69B7628645F251A996F55260C62EF31FD6C6B0AEA94E136C9D984AD2DF3578F78E457527B03A0450580DD874F63B1AB9"),
- },
- {
- fromHex("0558ABFE51A4F74A9DF04396E93C8FE23588DB2E81D4277ACD2073C6196CBF12"),
- fromHex("167DE44BB21980E7"),
- 131072,
- fromHex("C3EAAF32836BACE32D04E1124231EF47E101367D6305413A0EEB07C60698A2876E4D031870A739D6FFDDD208597AFF0A47AC17EDB0167DD67EBA84F1883D4DFD"),
- },
- {
- fromHex("0A5DB00356A9FC4FA2F5489BEE4194E73A8DE03386D92C7FD22578CB1E71C417"),
- fromHex("1F86ED54BB2289F0"),
- 131072,
- fromHex("3CD23C3DC90201ACC0CF49B440B6C417F0DC8D8410A716D5314C059E14B1A8D9A9FB8EA3D9C8DAE12B21402F674AA95C67B1FC514E994C9D3F3A6E41DFF5BBA6"),
- },
- {
- fromHex("0F62B5085BAE0154A7FA4DA0F34699EC3F92E5388BDE3184D72A7DD02376C91C"),
- fromHex("288FF65DC42B92F9"),
- 131072,
- fromHex("E00EBCCD70D69152725F9987982178A2E2E139C7BCBE04CA8A0E99E318D9AB76F988C8549F75ADD790BA4F81C176DA653C1A043F11A958E169B6D2319F4EEC1A"),
- },
-}
-
-func TestSalsa20(t *testing.T) {
- var inBuf, outBuf []byte
- var key [32]byte
-
- for i, test := range testVectors {
- if test.numBytes%64 != 0 {
- t.Errorf("#%d: numBytes is not a multiple of 64", i)
- continue
- }
-
- if test.numBytes > len(inBuf) {
- inBuf = make([]byte, test.numBytes)
- outBuf = make([]byte, test.numBytes)
- }
- in := inBuf[:test.numBytes]
- out := outBuf[:test.numBytes]
- copy(key[:], test.key)
- XORKeyStream(out, in, test.iv, &key)
-
- var xor [64]byte
- for len(out) > 0 {
- for i := 0; i < 64; i++ {
- xor[i] ^= out[i]
- }
- out = out[64:]
- }
-
- if !bytes.Equal(xor[:], test.xor) {
- t.Errorf("#%d: bad result", i)
- }
- }
-}
-
-var xSalsa20TestData = []struct {
- in, nonce, key, out []byte
-}{
- {
- []byte("Hello world!"),
- []byte("24-byte nonce for xsalsa"),
- []byte("this is 32-byte key for xsalsa20"),
- []byte{0x00, 0x2d, 0x45, 0x13, 0x84, 0x3f, 0xc2, 0x40, 0xc4, 0x01, 0xe5, 0x41},
- },
- {
- make([]byte, 64),
- []byte("24-byte nonce for xsalsa"),
- []byte("this is 32-byte key for xsalsa20"),
- []byte{0x48, 0x48, 0x29, 0x7f, 0xeb, 0x1f, 0xb5, 0x2f, 0xb6,
- 0x6d, 0x81, 0x60, 0x9b, 0xd5, 0x47, 0xfa, 0xbc, 0xbe, 0x70,
- 0x26, 0xed, 0xc8, 0xb5, 0xe5, 0xe4, 0x49, 0xd0, 0x88, 0xbf,
- 0xa6, 0x9c, 0x08, 0x8f, 0x5d, 0x8d, 0xa1, 0xd7, 0x91, 0x26,
- 0x7c, 0x2c, 0x19, 0x5a, 0x7f, 0x8c, 0xae, 0x9c, 0x4b, 0x40,
- 0x50, 0xd0, 0x8c, 0xe6, 0xd3, 0xa1, 0x51, 0xec, 0x26, 0x5f,
- 0x3a, 0x58, 0xe4, 0x76, 0x48},
- },
-}
-
-func TestXSalsa20(t *testing.T) {
- var key [32]byte
-
- for i, test := range xSalsa20TestData {
- out := make([]byte, len(test.in))
- copy(key[:], test.key)
- XORKeyStream(out, test.in, test.nonce, &key)
- if !bytes.Equal(out, test.out) {
- t.Errorf("%d: expected %x, got %x", i, test.out, out)
- }
- }
-}
-
-var (
- keyArray [32]byte
- key = &keyArray
- nonce [8]byte
- msg = make([]byte, 1<<10)
-)
-
-func BenchmarkXOR1K(b *testing.B) {
- b.StopTimer()
- out := make([]byte, 1024)
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- XORKeyStream(out, msg[:1024], nonce[:], key)
- }
- b.SetBytes(1024)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/scrypt/scrypt_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/scrypt/scrypt_test.go
deleted file mode 100644
index e096c3a31ab..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/scrypt/scrypt_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package scrypt
-
-import (
- "bytes"
- "testing"
-)
-
-type testVector struct {
- password string
- salt string
- N, r, p int
- output []byte
-}
-
-var good = []testVector{
- {
- "password",
- "salt",
- 2, 10, 10,
- []byte{
- 0x48, 0x2c, 0x85, 0x8e, 0x22, 0x90, 0x55, 0xe6, 0x2f,
- 0x41, 0xe0, 0xec, 0x81, 0x9a, 0x5e, 0xe1, 0x8b, 0xdb,
- 0x87, 0x25, 0x1a, 0x53, 0x4f, 0x75, 0xac, 0xd9, 0x5a,
- 0xc5, 0xe5, 0xa, 0xa1, 0x5f,
- },
- },
- {
- "password",
- "salt",
- 16, 100, 100,
- []byte{
- 0x88, 0xbd, 0x5e, 0xdb, 0x52, 0xd1, 0xdd, 0x0, 0x18,
- 0x87, 0x72, 0xad, 0x36, 0x17, 0x12, 0x90, 0x22, 0x4e,
- 0x74, 0x82, 0x95, 0x25, 0xb1, 0x8d, 0x73, 0x23, 0xa5,
- 0x7f, 0x91, 0x96, 0x3c, 0x37,
- },
- },
- {
- "this is a long \000 password",
- "and this is a long \000 salt",
- 16384, 8, 1,
- []byte{
- 0xc3, 0xf1, 0x82, 0xee, 0x2d, 0xec, 0x84, 0x6e, 0x70,
- 0xa6, 0x94, 0x2f, 0xb5, 0x29, 0x98, 0x5a, 0x3a, 0x09,
- 0x76, 0x5e, 0xf0, 0x4c, 0x61, 0x29, 0x23, 0xb1, 0x7f,
- 0x18, 0x55, 0x5a, 0x37, 0x07, 0x6d, 0xeb, 0x2b, 0x98,
- 0x30, 0xd6, 0x9d, 0xe5, 0x49, 0x26, 0x51, 0xe4, 0x50,
- 0x6a, 0xe5, 0x77, 0x6d, 0x96, 0xd4, 0x0f, 0x67, 0xaa,
- 0xee, 0x37, 0xe1, 0x77, 0x7b, 0x8a, 0xd5, 0xc3, 0x11,
- 0x14, 0x32, 0xbb, 0x3b, 0x6f, 0x7e, 0x12, 0x64, 0x40,
- 0x18, 0x79, 0xe6, 0x41, 0xae,
- },
- },
- {
- "p",
- "s",
- 2, 1, 1,
- []byte{
- 0x48, 0xb0, 0xd2, 0xa8, 0xa3, 0x27, 0x26, 0x11, 0x98,
- 0x4c, 0x50, 0xeb, 0xd6, 0x30, 0xaf, 0x52,
- },
- },
-
- {
- "",
- "",
- 16, 1, 1,
- []byte{
- 0x77, 0xd6, 0x57, 0x62, 0x38, 0x65, 0x7b, 0x20, 0x3b,
- 0x19, 0xca, 0x42, 0xc1, 0x8a, 0x04, 0x97, 0xf1, 0x6b,
- 0x48, 0x44, 0xe3, 0x07, 0x4a, 0xe8, 0xdf, 0xdf, 0xfa,
- 0x3f, 0xed, 0xe2, 0x14, 0x42, 0xfc, 0xd0, 0x06, 0x9d,
- 0xed, 0x09, 0x48, 0xf8, 0x32, 0x6a, 0x75, 0x3a, 0x0f,
- 0xc8, 0x1f, 0x17, 0xe8, 0xd3, 0xe0, 0xfb, 0x2e, 0x0d,
- 0x36, 0x28, 0xcf, 0x35, 0xe2, 0x0c, 0x38, 0xd1, 0x89,
- 0x06,
- },
- },
- {
- "password",
- "NaCl",
- 1024, 8, 16,
- []byte{
- 0xfd, 0xba, 0xbe, 0x1c, 0x9d, 0x34, 0x72, 0x00, 0x78,
- 0x56, 0xe7, 0x19, 0x0d, 0x01, 0xe9, 0xfe, 0x7c, 0x6a,
- 0xd7, 0xcb, 0xc8, 0x23, 0x78, 0x30, 0xe7, 0x73, 0x76,
- 0x63, 0x4b, 0x37, 0x31, 0x62, 0x2e, 0xaf, 0x30, 0xd9,
- 0x2e, 0x22, 0xa3, 0x88, 0x6f, 0xf1, 0x09, 0x27, 0x9d,
- 0x98, 0x30, 0xda, 0xc7, 0x27, 0xaf, 0xb9, 0x4a, 0x83,
- 0xee, 0x6d, 0x83, 0x60, 0xcb, 0xdf, 0xa2, 0xcc, 0x06,
- 0x40,
- },
- },
- {
- "pleaseletmein", "SodiumChloride",
- 16384, 8, 1,
- []byte{
- 0x70, 0x23, 0xbd, 0xcb, 0x3a, 0xfd, 0x73, 0x48, 0x46,
- 0x1c, 0x06, 0xcd, 0x81, 0xfd, 0x38, 0xeb, 0xfd, 0xa8,
- 0xfb, 0xba, 0x90, 0x4f, 0x8e, 0x3e, 0xa9, 0xb5, 0x43,
- 0xf6, 0x54, 0x5d, 0xa1, 0xf2, 0xd5, 0x43, 0x29, 0x55,
- 0x61, 0x3f, 0x0f, 0xcf, 0x62, 0xd4, 0x97, 0x05, 0x24,
- 0x2a, 0x9a, 0xf9, 0xe6, 0x1e, 0x85, 0xdc, 0x0d, 0x65,
- 0x1e, 0x40, 0xdf, 0xcf, 0x01, 0x7b, 0x45, 0x57, 0x58,
- 0x87,
- },
- },
- /*
- // Disabled: needs 1 GiB RAM and takes too long for a simple test.
- {
- "pleaseletmein", "SodiumChloride",
- 1048576, 8, 1,
- []byte{
- 0x21, 0x01, 0xcb, 0x9b, 0x6a, 0x51, 0x1a, 0xae, 0xad,
- 0xdb, 0xbe, 0x09, 0xcf, 0x70, 0xf8, 0x81, 0xec, 0x56,
- 0x8d, 0x57, 0x4a, 0x2f, 0xfd, 0x4d, 0xab, 0xe5, 0xee,
- 0x98, 0x20, 0xad, 0xaa, 0x47, 0x8e, 0x56, 0xfd, 0x8f,
- 0x4b, 0xa5, 0xd0, 0x9f, 0xfa, 0x1c, 0x6d, 0x92, 0x7c,
- 0x40, 0xf4, 0xc3, 0x37, 0x30, 0x40, 0x49, 0xe8, 0xa9,
- 0x52, 0xfb, 0xcb, 0xf4, 0x5c, 0x6f, 0xa7, 0x7a, 0x41,
- 0xa4,
- },
- },
- */
-}
-
-var bad = []testVector{
- {"p", "s", 0, 1, 1, nil}, // N == 0
- {"p", "s", 1, 1, 1, nil}, // N == 1
- {"p", "s", 7, 8, 1, nil}, // N is not power of 2
- {"p", "s", 16, maxInt / 2, maxInt / 2, nil}, // p * r too large
-}
-
-func TestKey(t *testing.T) {
- for i, v := range good {
- k, err := Key([]byte(v.password), []byte(v.salt), v.N, v.r, v.p, len(v.output))
- if err != nil {
- t.Errorf("%d: got unexpected error: %s", i, err)
- }
- if !bytes.Equal(k, v.output) {
- t.Errorf("%d: expected %x, got %x", i, v.output, k)
- }
- }
- for i, v := range bad {
- _, err := Key([]byte(v.password), []byte(v.salt), v.N, v.r, v.p, 32)
- if err == nil {
- t.Errorf("%d: expected error, got nil", i)
- }
- }
-}
-
-func BenchmarkKey(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Key([]byte("password"), []byte("salt"), 16384, 8, 1, 64)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/sha3/sha3_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/sha3/sha3_test.go
deleted file mode 100644
index caf72f279f1..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/sha3/sha3_test.go
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package sha3
-
-// Tests include all the ShortMsgKATs provided by the Keccak team at
-// https://github.com/gvanas/KeccakCodePackage
-//
-// They only include the zero-bit case of the bitwise testvectors
-// published by NIST in the draft of FIPS-202.
-
-import (
- "bytes"
- "compress/flate"
- "encoding/hex"
- "encoding/json"
- "hash"
- "os"
- "strings"
- "testing"
-)
-
-const (
- testString = "brekeccakkeccak koax koax"
- katFilename = "testdata/keccakKats.json.deflate"
-)
-
-// Internal-use instances of SHAKE used to test against KATs.
-func newHashShake128() hash.Hash {
- return &state{rate: 168, dsbyte: 0x1f, outputLen: 512}
-}
-func newHashShake256() hash.Hash {
- return &state{rate: 136, dsbyte: 0x1f, outputLen: 512}
-}
-
-// testDigests contains functions returning hash.Hash instances
-// with output-length equal to the KAT length for both SHA-3 and
-// SHAKE instances.
-var testDigests = map[string]func() hash.Hash{
- "SHA3-224": New224,
- "SHA3-256": New256,
- "SHA3-384": New384,
- "SHA3-512": New512,
- "SHAKE128": newHashShake128,
- "SHAKE256": newHashShake256,
-}
-
-// testShakes contains functions that return ShakeHash instances for
-// testing the ShakeHash-specific interface.
-var testShakes = map[string]func() ShakeHash{
- "SHAKE128": NewShake128,
- "SHAKE256": NewShake256,
-}
-
-// decodeHex converts a hex-encoded string into a raw byte string.
-func decodeHex(s string) []byte {
- b, err := hex.DecodeString(s)
- if err != nil {
- panic(err)
- }
- return b
-}
-
-// structs used to marshal JSON test-cases.
-type KeccakKats struct {
- Kats map[string][]struct {
- Digest string `json:"digest"`
- Length int64 `json:"length"`
- Message string `json:"message"`
- }
-}
-
-func testUnalignedAndGeneric(t *testing.T, testf func(impl string)) {
- xorInOrig, copyOutOrig := xorIn, copyOut
- xorIn, copyOut = xorInGeneric, copyOutGeneric
- testf("generic")
- if xorImplementationUnaligned != "generic" {
- xorIn, copyOut = xorInUnaligned, copyOutUnaligned
- testf("unaligned")
- }
- xorIn, copyOut = xorInOrig, copyOutOrig
-}
-
-// TestKeccakKats tests the SHA-3 and Shake implementations against all the
-// ShortMsgKATs from https://github.com/gvanas/KeccakCodePackage
-// (The testvectors are stored in keccakKats.json.deflate due to their length.)
-func TestKeccakKats(t *testing.T) {
- testUnalignedAndGeneric(t, func(impl string) {
- // Read the KATs.
- deflated, err := os.Open(katFilename)
- if err != nil {
- t.Errorf("error opening %s: %s", katFilename, err)
- }
- file := flate.NewReader(deflated)
- dec := json.NewDecoder(file)
- var katSet KeccakKats
- err = dec.Decode(&katSet)
- if err != nil {
- t.Errorf("error decoding KATs: %s", err)
- }
-
- // Do the KATs.
- for functionName, kats := range katSet.Kats {
- d := testDigests[functionName]()
- for _, kat := range kats {
- d.Reset()
- in, err := hex.DecodeString(kat.Message)
- if err != nil {
- t.Errorf("error decoding KAT: %s", err)
- }
- d.Write(in[:kat.Length/8])
- got := strings.ToUpper(hex.EncodeToString(d.Sum(nil)))
- if got != kat.Digest {
- t.Errorf("function=%s, implementation=%s, length=%d\nmessage:\n %s\ngot:\n %s\nwanted:\n %s",
- functionName, impl, kat.Length, kat.Message, got, kat.Digest)
- t.Logf("wanted %+v", kat)
- t.FailNow()
- }
- continue
- }
- }
- })
-}
-
-// TestUnalignedWrite tests that writing data in an arbitrary pattern with
-// small input buffers.
-func testUnalignedWrite(t *testing.T) {
- testUnalignedAndGeneric(t, func(impl string) {
- buf := sequentialBytes(0x10000)
- for alg, df := range testDigests {
- d := df()
- d.Reset()
- d.Write(buf)
- want := d.Sum(nil)
- d.Reset()
- for i := 0; i < len(buf); {
- // Cycle through offsets which make a 137 byte sequence.
- // Because 137 is prime this sequence should exercise all corner cases.
- offsets := [17]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1}
- for _, j := range offsets {
- if v := len(buf) - i; v < j {
- j = v
- }
- d.Write(buf[i : i+j])
- i += j
- }
- }
- got := d.Sum(nil)
- if !bytes.Equal(got, want) {
- t.Errorf("Unaligned writes, implementation=%s, alg=%s\ngot %q, want %q", impl, alg, got, want)
- }
- }
- })
-}
-
-// TestAppend checks that appending works when reallocation is necessary.
-func TestAppend(t *testing.T) {
- testUnalignedAndGeneric(t, func(impl string) {
- d := New224()
-
- for capacity := 2; capacity <= 66; capacity += 64 {
- // The first time around the loop, Sum will have to reallocate.
- // The second time, it will not.
- buf := make([]byte, 2, capacity)
- d.Reset()
- d.Write([]byte{0xcc})
- buf = d.Sum(buf)
- expected := "0000DF70ADC49B2E76EEE3A6931B93FA41841C3AF2CDF5B32A18B5478C39"
- if got := strings.ToUpper(hex.EncodeToString(buf)); got != expected {
- t.Errorf("got %s, want %s", got, expected)
- }
- }
- })
-}
-
-// TestAppendNoRealloc tests that appending works when no reallocation is necessary.
-func TestAppendNoRealloc(t *testing.T) {
- testUnalignedAndGeneric(t, func(impl string) {
- buf := make([]byte, 1, 200)
- d := New224()
- d.Write([]byte{0xcc})
- buf = d.Sum(buf)
- expected := "00DF70ADC49B2E76EEE3A6931B93FA41841C3AF2CDF5B32A18B5478C39"
- if got := strings.ToUpper(hex.EncodeToString(buf)); got != expected {
- t.Errorf("%s: got %s, want %s", impl, got, expected)
- }
- })
-}
-
-// TestSqueezing checks that squeezing the full output a single time produces
-// the same output as repeatedly squeezing the instance.
-func TestSqueezing(t *testing.T) {
- testUnalignedAndGeneric(t, func(impl string) {
- for functionName, newShakeHash := range testShakes {
- d0 := newShakeHash()
- d0.Write([]byte(testString))
- ref := make([]byte, 32)
- d0.Read(ref)
-
- d1 := newShakeHash()
- d1.Write([]byte(testString))
- var multiple []byte
- for _ = range ref {
- one := make([]byte, 1)
- d1.Read(one)
- multiple = append(multiple, one...)
- }
- if !bytes.Equal(ref, multiple) {
- t.Errorf("%s (%s): squeezing %d bytes one at a time failed", functionName, impl, len(ref))
- }
- }
- })
-}
-
-// sequentialBytes produces a buffer of size consecutive bytes 0x00, 0x01, ..., used for testing.
-func sequentialBytes(size int) []byte {
- result := make([]byte, size)
- for i := range result {
- result[i] = byte(i)
- }
- return result
-}
-
-// BenchmarkPermutationFunction measures the speed of the permutation function
-// with no input data.
-func BenchmarkPermutationFunction(b *testing.B) {
- b.SetBytes(int64(200))
- var lanes [25]uint64
- for i := 0; i < b.N; i++ {
- keccakF1600(&lanes)
- }
-}
-
-// benchmarkHash tests the speed to hash num buffers of buflen each.
-func benchmarkHash(b *testing.B, h hash.Hash, size, num int) {
- b.StopTimer()
- h.Reset()
- data := sequentialBytes(size)
- b.SetBytes(int64(size * num))
- b.StartTimer()
-
- var state []byte
- for i := 0; i < b.N; i++ {
- for j := 0; j < num; j++ {
- h.Write(data)
- }
- state = h.Sum(state[:0])
- }
- b.StopTimer()
- h.Reset()
-}
-
-// benchmarkShake is specialized to the Shake instances, which don't
-// require a copy on reading output.
-func benchmarkShake(b *testing.B, h ShakeHash, size, num int) {
- b.StopTimer()
- h.Reset()
- data := sequentialBytes(size)
- d := make([]byte, 32)
-
- b.SetBytes(int64(size * num))
- b.StartTimer()
-
- for i := 0; i < b.N; i++ {
- h.Reset()
- for j := 0; j < num; j++ {
- h.Write(data)
- }
- h.Read(d)
- }
-}
-
-func BenchmarkSha3_512_MTU(b *testing.B) { benchmarkHash(b, New512(), 1350, 1) }
-func BenchmarkSha3_384_MTU(b *testing.B) { benchmarkHash(b, New384(), 1350, 1) }
-func BenchmarkSha3_256_MTU(b *testing.B) { benchmarkHash(b, New256(), 1350, 1) }
-func BenchmarkSha3_224_MTU(b *testing.B) { benchmarkHash(b, New224(), 1350, 1) }
-
-func BenchmarkShake128_MTU(b *testing.B) { benchmarkShake(b, NewShake128(), 1350, 1) }
-func BenchmarkShake256_MTU(b *testing.B) { benchmarkShake(b, NewShake256(), 1350, 1) }
-func BenchmarkShake256_16x(b *testing.B) { benchmarkShake(b, NewShake256(), 16, 1024) }
-func BenchmarkShake256_1MiB(b *testing.B) { benchmarkShake(b, NewShake256(), 1024, 1024) }
-
-func BenchmarkSha3_512_1MiB(b *testing.B) { benchmarkHash(b, New512(), 1024, 1024) }
-
-func Example_sum() {
- buf := []byte("some data to hash")
- // A hash needs to be 64 bytes long to have 256-bit collision resistance.
- h := make([]byte, 64)
- // Compute a 64-byte hash of buf and put it in h.
- ShakeSum256(h, buf)
-}
-
-func Example_mac() {
- k := []byte("this is a secret key; you should generate a strong random key that's at least 32 bytes long")
- buf := []byte("and this is some data to authenticate")
- // A MAC with 32 bytes of output has 256-bit security strength -- if you use at least a 32-byte-long key.
- h := make([]byte, 32)
- d := NewShake256()
- // Write the key into the hash.
- d.Write(k)
- // Now write the data.
- d.Write(buf)
- // Read 32 bytes of output from the hash into h.
- d.Read(h)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/client_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/client_test.go
deleted file mode 100644
index ec7198d549d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/client_test.go
+++ /dev/null
@@ -1,287 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "bytes"
- "crypto/rand"
- "errors"
- "net"
- "os"
- "os/exec"
- "path/filepath"
- "strconv"
- "testing"
-
- "golang.org/x/crypto/ssh"
-)
-
-// startAgent executes ssh-agent, and returns a Agent interface to it.
-func startAgent(t *testing.T) (client Agent, socket string, cleanup func()) {
- if testing.Short() {
- // ssh-agent is not always available, and the key
- // types supported vary by platform.
- t.Skip("skipping test due to -short")
- }
-
- bin, err := exec.LookPath("ssh-agent")
- if err != nil {
- t.Skip("could not find ssh-agent")
- }
-
- cmd := exec.Command(bin, "-s")
- out, err := cmd.Output()
- if err != nil {
- t.Fatalf("cmd.Output: %v", err)
- }
-
- /* Output looks like:
-
- SSH_AUTH_SOCK=/tmp/ssh-P65gpcqArqvH/agent.15541; export SSH_AUTH_SOCK;
- SSH_AGENT_PID=15542; export SSH_AGENT_PID;
- echo Agent pid 15542;
- */
- fields := bytes.Split(out, []byte(";"))
- line := bytes.SplitN(fields[0], []byte("="), 2)
- line[0] = bytes.TrimLeft(line[0], "\n")
- if string(line[0]) != "SSH_AUTH_SOCK" {
- t.Fatalf("could not find key SSH_AUTH_SOCK in %q", fields[0])
- }
- socket = string(line[1])
-
- line = bytes.SplitN(fields[2], []byte("="), 2)
- line[0] = bytes.TrimLeft(line[0], "\n")
- if string(line[0]) != "SSH_AGENT_PID" {
- t.Fatalf("could not find key SSH_AGENT_PID in %q", fields[2])
- }
- pidStr := line[1]
- pid, err := strconv.Atoi(string(pidStr))
- if err != nil {
- t.Fatalf("Atoi(%q): %v", pidStr, err)
- }
-
- conn, err := net.Dial("unix", string(socket))
- if err != nil {
- t.Fatalf("net.Dial: %v", err)
- }
-
- ac := NewClient(conn)
- return ac, socket, func() {
- proc, _ := os.FindProcess(pid)
- if proc != nil {
- proc.Kill()
- }
- conn.Close()
- os.RemoveAll(filepath.Dir(socket))
- }
-}
-
-func testAgent(t *testing.T, key interface{}, cert *ssh.Certificate, lifetimeSecs uint32) {
- agent, _, cleanup := startAgent(t)
- defer cleanup()
-
- testAgentInterface(t, agent, key, cert, lifetimeSecs)
-}
-
-func testAgentInterface(t *testing.T, agent Agent, key interface{}, cert *ssh.Certificate, lifetimeSecs uint32) {
- signer, err := ssh.NewSignerFromKey(key)
- if err != nil {
- t.Fatalf("NewSignerFromKey(%T): %v", key, err)
- }
- // The agent should start up empty.
- if keys, err := agent.List(); err != nil {
- t.Fatalf("RequestIdentities: %v", err)
- } else if len(keys) > 0 {
- t.Fatalf("got %d keys, want 0: %v", len(keys), keys)
- }
-
- // Attempt to insert the key, with certificate if specified.
- var pubKey ssh.PublicKey
- if cert != nil {
- err = agent.Add(AddedKey{
- PrivateKey: key,
- Certificate: cert,
- Comment: "comment",
- LifetimeSecs: lifetimeSecs,
- })
- pubKey = cert
- } else {
- err = agent.Add(AddedKey{PrivateKey: key, Comment: "comment", LifetimeSecs: lifetimeSecs})
- pubKey = signer.PublicKey()
- }
- if err != nil {
- t.Fatalf("insert(%T): %v", key, err)
- }
-
- // Did the key get inserted successfully?
- if keys, err := agent.List(); err != nil {
- t.Fatalf("List: %v", err)
- } else if len(keys) != 1 {
- t.Fatalf("got %v, want 1 key", keys)
- } else if keys[0].Comment != "comment" {
- t.Fatalf("key comment: got %v, want %v", keys[0].Comment, "comment")
- } else if !bytes.Equal(keys[0].Blob, pubKey.Marshal()) {
- t.Fatalf("key mismatch")
- }
-
- // Can the agent make a valid signature?
- data := []byte("hello")
- sig, err := agent.Sign(pubKey, data)
- if err != nil {
- t.Fatalf("Sign(%s): %v", pubKey.Type(), err)
- }
-
- if err := pubKey.Verify(data, sig); err != nil {
- t.Fatalf("Verify(%s): %v", pubKey.Type(), err)
- }
-}
-
-func TestAgent(t *testing.T) {
- for _, keyType := range []string{"rsa", "dsa", "ecdsa"} {
- testAgent(t, testPrivateKeys[keyType], nil, 0)
- }
-}
-
-func TestCert(t *testing.T) {
- cert := &ssh.Certificate{
- Key: testPublicKeys["rsa"],
- ValidBefore: ssh.CertTimeInfinity,
- CertType: ssh.UserCert,
- }
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
-
- testAgent(t, testPrivateKeys["rsa"], cert, 0)
-}
-
-func TestConstraints(t *testing.T) {
- testAgent(t, testPrivateKeys["rsa"], nil, 3600 /* lifetime in seconds */)
-}
-
-// netPipe is analogous to net.Pipe, but it uses a real net.Conn, and
-// therefore is buffered (net.Pipe deadlocks if both sides start with
-// a write.)
-func netPipe() (net.Conn, net.Conn, error) {
- listener, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- return nil, nil, err
- }
- defer listener.Close()
- c1, err := net.Dial("tcp", listener.Addr().String())
- if err != nil {
- return nil, nil, err
- }
-
- c2, err := listener.Accept()
- if err != nil {
- c1.Close()
- return nil, nil, err
- }
-
- return c1, c2, nil
-}
-
-func TestAuth(t *testing.T) {
- a, b, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
-
- defer a.Close()
- defer b.Close()
-
- agent, _, cleanup := startAgent(t)
- defer cleanup()
-
- if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["rsa"], Comment: "comment"}); err != nil {
- t.Errorf("Add: %v", err)
- }
-
- serverConf := ssh.ServerConfig{}
- serverConf.AddHostKey(testSigners["rsa"])
- serverConf.PublicKeyCallback = func(c ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) {
- if bytes.Equal(key.Marshal(), testPublicKeys["rsa"].Marshal()) {
- return nil, nil
- }
-
- return nil, errors.New("pubkey rejected")
- }
-
- go func() {
- conn, _, _, err := ssh.NewServerConn(a, &serverConf)
- if err != nil {
- t.Fatalf("Server: %v", err)
- }
- conn.Close()
- }()
-
- conf := ssh.ClientConfig{}
- conf.Auth = append(conf.Auth, ssh.PublicKeysCallback(agent.Signers))
- conn, _, _, err := ssh.NewClientConn(b, "", &conf)
- if err != nil {
- t.Fatalf("NewClientConn: %v", err)
- }
- conn.Close()
-}
-
-func TestLockClient(t *testing.T) {
- agent, _, cleanup := startAgent(t)
- defer cleanup()
- testLockAgent(agent, t)
-}
-
-func testLockAgent(agent Agent, t *testing.T) {
- if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["rsa"], Comment: "comment 1"}); err != nil {
- t.Errorf("Add: %v", err)
- }
- if err := agent.Add(AddedKey{PrivateKey: testPrivateKeys["dsa"], Comment: "comment dsa"}); err != nil {
- t.Errorf("Add: %v", err)
- }
- if keys, err := agent.List(); err != nil {
- t.Errorf("List: %v", err)
- } else if len(keys) != 2 {
- t.Errorf("Want 2 keys, got %v", keys)
- }
-
- passphrase := []byte("secret")
- if err := agent.Lock(passphrase); err != nil {
- t.Errorf("Lock: %v", err)
- }
-
- if keys, err := agent.List(); err != nil {
- t.Errorf("List: %v", err)
- } else if len(keys) != 0 {
- t.Errorf("Want 0 keys, got %v", keys)
- }
-
- signer, _ := ssh.NewSignerFromKey(testPrivateKeys["rsa"])
- if _, err := agent.Sign(signer.PublicKey(), []byte("hello")); err == nil {
- t.Fatalf("Sign did not fail")
- }
-
- if err := agent.Remove(signer.PublicKey()); err == nil {
- t.Fatalf("Remove did not fail")
- }
-
- if err := agent.RemoveAll(); err == nil {
- t.Fatalf("RemoveAll did not fail")
- }
-
- if err := agent.Unlock(nil); err == nil {
- t.Errorf("Unlock with wrong passphrase succeeded")
- }
- if err := agent.Unlock(passphrase); err != nil {
- t.Errorf("Unlock: %v", err)
- }
-
- if err := agent.Remove(signer.PublicKey()); err != nil {
- t.Fatalf("Remove: %v", err)
- }
-
- if keys, err := agent.List(); err != nil {
- t.Errorf("List: %v", err)
- } else if len(keys) != 1 {
- t.Errorf("Want 1 keys, got %v", keys)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go
deleted file mode 100644
index 7f05905712d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/keyring_test.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "testing"
-)
-
-func addTestKey(t *testing.T, a Agent, keyName string) {
- err := a.Add(AddedKey{
- PrivateKey: testPrivateKeys[keyName],
- Comment: keyName,
- })
- if err != nil {
- t.Fatalf("failed to add key %q: %v", keyName, err)
- }
-}
-
-func removeTestKey(t *testing.T, a Agent, keyName string) {
- err := a.Remove(testPublicKeys[keyName])
- if err != nil {
- t.Fatalf("failed to remove key %q: %v", keyName, err)
- }
-}
-
-func validateListedKeys(t *testing.T, a Agent, expectedKeys []string) {
- listedKeys, err := a.List()
- if err != nil {
- t.Fatalf("failed to list keys: %v", err)
- return
- }
- actualKeys := make(map[string]bool)
- for _, key := range listedKeys {
- actualKeys[key.Comment] = true
- }
-
- matchedKeys := make(map[string]bool)
- for _, expectedKey := range expectedKeys {
- if !actualKeys[expectedKey] {
- t.Fatalf("expected key %q, but was not found", expectedKey)
- } else {
- matchedKeys[expectedKey] = true
- }
- }
-
- for actualKey := range actualKeys {
- if !matchedKeys[actualKey] {
- t.Fatalf("key %q was found, but was not expected", actualKey)
- }
- }
-}
-
-func TestKeyringAddingAndRemoving(t *testing.T) {
- keyNames := []string{"dsa", "ecdsa", "rsa", "user"}
-
- // add all test private keys
- k := NewKeyring()
- for _, keyName := range keyNames {
- addTestKey(t, k, keyName)
- }
- validateListedKeys(t, k, keyNames)
-
- // remove a key in the middle
- keyToRemove := keyNames[1]
- keyNames = append(keyNames[:1], keyNames[2:]...)
-
- removeTestKey(t, k, keyToRemove)
- validateListedKeys(t, k, keyNames)
-
- // remove all keys
- err := k.RemoveAll()
- if err != nil {
- t.Fatalf("failed to remove all keys: %v", err)
- }
- validateListedKeys(t, k, []string{})
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/server_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/server_test.go
deleted file mode 100644
index ef0ab293487..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/server_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "testing"
-
- "golang.org/x/crypto/ssh"
-)
-
-func TestServer(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
- client := NewClient(c1)
-
- go ServeAgent(NewKeyring(), c2)
-
- testAgentInterface(t, client, testPrivateKeys["rsa"], nil, 0)
-}
-
-func TestLockServer(t *testing.T) {
- testLockAgent(NewKeyring(), t)
-}
-
-func TestSetupForwardAgent(t *testing.T) {
- a, b, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
-
- defer a.Close()
- defer b.Close()
-
- _, socket, cleanup := startAgent(t)
- defer cleanup()
-
- serverConf := ssh.ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["rsa"])
- incoming := make(chan *ssh.ServerConn, 1)
- go func() {
- conn, _, _, err := ssh.NewServerConn(a, &serverConf)
- if err != nil {
- t.Fatalf("Server: %v", err)
- }
- incoming <- conn
- }()
-
- conf := ssh.ClientConfig{}
- conn, chans, reqs, err := ssh.NewClientConn(b, "", &conf)
- if err != nil {
- t.Fatalf("NewClientConn: %v", err)
- }
- client := ssh.NewClient(conn, chans, reqs)
-
- if err := ForwardToRemote(client, socket); err != nil {
- t.Fatalf("SetupForwardAgent: %v", err)
- }
-
- server := <-incoming
- ch, reqs, err := server.OpenChannel(channelType, nil)
- if err != nil {
- t.Fatalf("OpenChannel(%q): %v", channelType, err)
- }
- go ssh.DiscardRequests(reqs)
-
- agentClient := NewClient(ch)
- testAgentInterface(t, agentClient, testPrivateKeys["rsa"], nil, 0)
- conn.Close()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go
deleted file mode 100644
index b7a8781e1a5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/agent/testdata_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// IMPLEMENTOR NOTE: To avoid a package loop, this file is in three places:
-// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three
-// instances.
-
-package agent
-
-import (
- "crypto/rand"
- "fmt"
-
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/testdata"
-)
-
-var (
- testPrivateKeys map[string]interface{}
- testSigners map[string]ssh.Signer
- testPublicKeys map[string]ssh.PublicKey
-)
-
-func init() {
- var err error
-
- n := len(testdata.PEMBytes)
- testPrivateKeys = make(map[string]interface{}, n)
- testSigners = make(map[string]ssh.Signer, n)
- testPublicKeys = make(map[string]ssh.PublicKey, n)
- for t, k := range testdata.PEMBytes {
- testPrivateKeys[t], err = ssh.ParseRawPrivateKey(k)
- if err != nil {
- panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err))
- }
- testSigners[t], err = ssh.NewSignerFromKey(testPrivateKeys[t])
- if err != nil {
- panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err))
- }
- testPublicKeys[t] = testSigners[t].PublicKey()
- }
-
- // Create a cert and sign it for use in tests.
- testCert := &ssh.Certificate{
- Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage
- ValidAfter: 0, // unix epoch
- ValidBefore: ssh.CertTimeInfinity, // The end of currently representable time.
- Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- Key: testPublicKeys["ecdsa"],
- SignatureKey: testPublicKeys["rsa"],
- Permissions: ssh.Permissions{
- CriticalOptions: map[string]string{},
- Extensions: map[string]string{},
- },
- }
- testCert.SignCert(rand.Reader, testSigners["rsa"])
- testPrivateKeys["cert"] = testPrivateKeys["ecdsa"]
- testSigners["cert"], err = ssh.NewCertSigner(testCert, testSigners["ecdsa"])
- if err != nil {
- panic(fmt.Sprintf("Unable to create certificate signer: %v", err))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/benchmark_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/benchmark_test.go
deleted file mode 100644
index d9f7eb9b60a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/benchmark_test.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "errors"
- "io"
- "net"
- "testing"
-)
-
-type server struct {
- *ServerConn
- chans <-chan NewChannel
-}
-
-func newServer(c net.Conn, conf *ServerConfig) (*server, error) {
- sconn, chans, reqs, err := NewServerConn(c, conf)
- if err != nil {
- return nil, err
- }
- go DiscardRequests(reqs)
- return &server{sconn, chans}, nil
-}
-
-func (s *server) Accept() (NewChannel, error) {
- n, ok := <-s.chans
- if !ok {
- return nil, io.EOF
- }
- return n, nil
-}
-
-func sshPipe() (Conn, *server, error) {
- c1, c2, err := netPipe()
- if err != nil {
- return nil, nil, err
- }
-
- clientConf := ClientConfig{
- User: "user",
- }
- serverConf := ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["ecdsa"])
- done := make(chan *server, 1)
- go func() {
- server, err := newServer(c2, &serverConf)
- if err != nil {
- done <- nil
- }
- done <- server
- }()
-
- client, _, reqs, err := NewClientConn(c1, "", &clientConf)
- if err != nil {
- return nil, nil, err
- }
-
- server := <-done
- if server == nil {
- return nil, nil, errors.New("server handshake failed.")
- }
- go DiscardRequests(reqs)
-
- return client, server, nil
-}
-
-func BenchmarkEndToEnd(b *testing.B) {
- b.StopTimer()
-
- client, server, err := sshPipe()
- if err != nil {
- b.Fatalf("sshPipe: %v", err)
- }
-
- defer client.Close()
- defer server.Close()
-
- size := (1 << 20)
- input := make([]byte, size)
- output := make([]byte, size)
- b.SetBytes(int64(size))
- done := make(chan int, 1)
-
- go func() {
- newCh, err := server.Accept()
- if err != nil {
- b.Fatalf("Client: %v", err)
- }
- ch, incoming, err := newCh.Accept()
- go DiscardRequests(incoming)
- for i := 0; i < b.N; i++ {
- if _, err := io.ReadFull(ch, output); err != nil {
- b.Fatalf("ReadFull: %v", err)
- }
- }
- ch.Close()
- done <- 1
- }()
-
- ch, in, err := client.OpenChannel("speed", nil)
- if err != nil {
- b.Fatalf("OpenChannel: %v", err)
- }
- go DiscardRequests(in)
-
- b.ResetTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- if _, err := ch.Write(input); err != nil {
- b.Fatalf("WriteFull: %v", err)
- }
- }
- ch.Close()
- b.StopTimer()
-
- <-done
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/buffer_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/buffer_test.go
deleted file mode 100644
index d5781cb3da9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/buffer_test.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "testing"
-)
-
-var alphabet = []byte("abcdefghijklmnopqrstuvwxyz")
-
-func TestBufferReadwrite(t *testing.T) {
- b := newBuffer()
- b.write(alphabet[:10])
- r, _ := b.Read(make([]byte, 10))
- if r != 10 {
- t.Fatalf("Expected written == read == 10, written: 10, read %d", r)
- }
-
- b = newBuffer()
- b.write(alphabet[:5])
- r, _ = b.Read(make([]byte, 10))
- if r != 5 {
- t.Fatalf("Expected written == read == 5, written: 5, read %d", r)
- }
-
- b = newBuffer()
- b.write(alphabet[:10])
- r, _ = b.Read(make([]byte, 5))
- if r != 5 {
- t.Fatalf("Expected written == 10, read == 5, written: 10, read %d", r)
- }
-
- b = newBuffer()
- b.write(alphabet[:5])
- b.write(alphabet[5:15])
- r, _ = b.Read(make([]byte, 10))
- r2, _ := b.Read(make([]byte, 10))
- if r != 10 || r2 != 5 || 15 != r+r2 {
- t.Fatal("Expected written == read == 15")
- }
-}
-
-func TestBufferClose(t *testing.T) {
- b := newBuffer()
- b.write(alphabet[:10])
- b.eof()
- _, err := b.Read(make([]byte, 5))
- if err != nil {
- t.Fatal("expected read of 5 to not return EOF")
- }
- b = newBuffer()
- b.write(alphabet[:10])
- b.eof()
- r, err := b.Read(make([]byte, 5))
- r2, err2 := b.Read(make([]byte, 10))
- if r != 5 || r2 != 5 || err != nil || err2 != nil {
- t.Fatal("expected reads of 5 and 5")
- }
-
- b = newBuffer()
- b.write(alphabet[:10])
- b.eof()
- r, err = b.Read(make([]byte, 5))
- r2, err2 = b.Read(make([]byte, 10))
- r3, err3 := b.Read(make([]byte, 10))
- if r != 5 || r2 != 5 || r3 != 0 || err != nil || err2 != nil || err3 != io.EOF {
- t.Fatal("expected reads of 5 and 5 and 0, with EOF")
- }
-
- b = newBuffer()
- b.write(make([]byte, 5))
- b.write(make([]byte, 10))
- b.eof()
- r, err = b.Read(make([]byte, 9))
- r2, err2 = b.Read(make([]byte, 3))
- r3, err3 = b.Read(make([]byte, 3))
- r4, err4 := b.Read(make([]byte, 10))
- if err != nil || err2 != nil || err3 != nil || err4 != io.EOF {
- t.Fatalf("Expected EOF on forth read only, err=%v, err2=%v, err3=%v, err4=%v", err, err2, err3, err4)
- }
- if r != 9 || r2 != 3 || r3 != 3 || r4 != 0 {
- t.Fatal("Expected written == read == 15", r, r2, r3, r4)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/certs_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/certs_test.go
deleted file mode 100644
index c5f2e533043..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/certs_test.go
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "reflect"
- "testing"
- "time"
-)
-
-// Cert generated by ssh-keygen 6.0p1 Debian-4.
-// % ssh-keygen -s ca-key -I test user-key
-const exampleSSHCert = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgb1srW/W3ZDjYAO45xLYAwzHBDLsJ4Ux6ICFIkTjb1LEAAAADAQABAAAAYQCkoR51poH0wE8w72cqSB8Sszx+vAhzcMdCO0wqHTj7UNENHWEXGrU0E0UQekD7U+yhkhtoyjbPOVIP7hNa6aRk/ezdh/iUnCIt4Jt1v3Z1h1P+hA4QuYFMHNB+rmjPwAcAAAAAAAAAAAAAAAEAAAAEdGVzdAAAAAAAAAAAAAAAAP//////////AAAAAAAAAIIAAAAVcGVybWl0LVgxMS1mb3J3YXJkaW5nAAAAAAAAABdwZXJtaXQtYWdlbnQtZm9yd2FyZGluZwAAAAAAAAAWcGVybWl0LXBvcnQtZm9yd2FyZGluZwAAAAAAAAAKcGVybWl0LXB0eQAAAAAAAAAOcGVybWl0LXVzZXItcmMAAAAAAAAAAAAAAHcAAAAHc3NoLXJzYQAAAAMBAAEAAABhANFS2kaktpSGc+CcmEKPyw9mJC4nZKxHKTgLVZeaGbFZOvJTNzBspQHdy7Q1uKSfktxpgjZnksiu/tFF9ngyY2KFoc+U88ya95IZUycBGCUbBQ8+bhDtw/icdDGQD5WnUwAAAG8AAAAHc3NoLXJzYQAAAGC8Y9Z2LQKhIhxf52773XaWrXdxP0t3GBVo4A10vUWiYoAGepr6rQIoGGXFxT4B9Gp+nEBJjOwKDXPrAevow0T9ca8gZN+0ykbhSrXLE5Ao48rqr3zP4O1/9P7e6gp0gw8=`
-
-func TestParseCert(t *testing.T) {
- authKeyBytes := []byte(exampleSSHCert)
-
- key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes)
- if err != nil {
- t.Fatalf("ParseAuthorizedKey: %v", err)
- }
- if len(rest) > 0 {
- t.Errorf("rest: got %q, want empty", rest)
- }
-
- if _, ok := key.(*Certificate); !ok {
- t.Fatalf("got %v (%T), want *Certificate", key, key)
- }
-
- marshaled := MarshalAuthorizedKey(key)
- // Before comparison, remove the trailing newline that
- // MarshalAuthorizedKey adds.
- marshaled = marshaled[:len(marshaled)-1]
- if !bytes.Equal(authKeyBytes, marshaled) {
- t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes)
- }
-}
-
-// Cert generated by ssh-keygen OpenSSH_6.8p1 OS X 10.10.3
-// % ssh-keygen -s ca -I testcert -O source-address=192.168.1.0/24 -O force-command=/bin/sleep user.pub
-// user.pub key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMN
-// Critical Options:
-// force-command /bin/sleep
-// source-address 192.168.1.0/24
-// Extensions:
-// permit-X11-forwarding
-// permit-agent-forwarding
-// permit-port-forwarding
-// permit-pty
-// permit-user-rc
-const exampleSSHCertWithOptions = `ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgDyysCJY0XrO1n03EeRRoITnTPdjENFmWDs9X58PP3VUAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMNAAAAAAAAAAAAAAABAAAACHRlc3RjZXJ0AAAAAAAAAAAAAAAA//////////8AAABLAAAADWZvcmNlLWNvbW1hbmQAAAAOAAAACi9iaW4vc2xlZXAAAAAOc291cmNlLWFkZHJlc3MAAAASAAAADjE5Mi4xNjguMS4wLzI0AAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAwU+c5ui5A8+J/CFpjW8wCa52bEODA808WWQDCSuTG/eMXNf59v9Y8Pk0F1E9dGCosSNyVcB/hacUrc6He+i97+HJCyKavBsE6GDxrjRyxYqAlfcOXi/IVmaUGiO8OQ39d4GHrjToInKvExSUeleQyH4Y4/e27T/pILAqPFL3fyrvMLT5qU9QyIt6zIpa7GBP5+urouNavMprV3zsfIqNBbWypinOQAw823a5wN+zwXnhZrgQiHZ/USG09Y6k98y1dTVz8YHlQVR4D3lpTAsKDKJ5hCH9WU4fdf+lU8OyNGaJ/vz0XNqxcToe1l4numLTnaoSuH89pHryjqurB7lJKwAAAQ8AAAAHc3NoLXJzYQAAAQCaHvUIoPL1zWUHIXLvu96/HU1s/i4CAW2IIEuGgxCUCiFj6vyTyYtgxQxcmbfZf6eaITlS6XJZa7Qq4iaFZh75C1DXTX8labXhRSD4E2t//AIP9MC1rtQC5xo6FmbQ+BoKcDskr+mNACcbRSxs3IL3bwCfWDnIw2WbVox9ZdcthJKk4UoCW4ix4QwdHw7zlddlz++fGEEVhmTbll1SUkycGApPFBsAYRTMupUJcYPIeReBI/m8XfkoMk99bV8ZJQTAd7OekHY2/48Ff53jLmyDjP7kNw1F8OaPtkFs6dGJXta4krmaekPy87j+35In5hFj7yoOqvSbmYUkeX70/GGQ`
-
-func TestParseCertWithOptions(t *testing.T) {
- opts := map[string]string{
- "source-address": "192.168.1.0/24",
- "force-command": "/bin/sleep",
- }
- exts := map[string]string{
- "permit-X11-forwarding": "",
- "permit-agent-forwarding": "",
- "permit-port-forwarding": "",
- "permit-pty": "",
- "permit-user-rc": "",
- }
- authKeyBytes := []byte(exampleSSHCertWithOptions)
-
- key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes)
- if err != nil {
- t.Fatalf("ParseAuthorizedKey: %v", err)
- }
- if len(rest) > 0 {
- t.Errorf("rest: got %q, want empty", rest)
- }
- cert, ok := key.(*Certificate)
- if !ok {
- t.Fatalf("got %v (%T), want *Certificate", key, key)
- }
- if !reflect.DeepEqual(cert.CriticalOptions, opts) {
- t.Errorf("unexpected critical options - got %v, want %v", cert.CriticalOptions, opts)
- }
- if !reflect.DeepEqual(cert.Extensions, exts) {
- t.Errorf("unexpected Extensions - got %v, want %v", cert.Extensions, exts)
- }
- marshaled := MarshalAuthorizedKey(key)
- // Before comparison, remove the trailing newline that
- // MarshalAuthorizedKey adds.
- marshaled = marshaled[:len(marshaled)-1]
- if !bytes.Equal(authKeyBytes, marshaled) {
- t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes)
- }
-}
-
-func TestValidateCert(t *testing.T) {
- key, _, _, _, err := ParseAuthorizedKey([]byte(exampleSSHCert))
- if err != nil {
- t.Fatalf("ParseAuthorizedKey: %v", err)
- }
- validCert, ok := key.(*Certificate)
- if !ok {
- t.Fatalf("got %v (%T), want *Certificate", key, key)
- }
- checker := CertChecker{}
- checker.IsAuthority = func(k PublicKey) bool {
- return bytes.Equal(k.Marshal(), validCert.SignatureKey.Marshal())
- }
-
- if err := checker.CheckCert("user", validCert); err != nil {
- t.Errorf("Unable to validate certificate: %v", err)
- }
- invalidCert := &Certificate{
- Key: testPublicKeys["rsa"],
- SignatureKey: testPublicKeys["ecdsa"],
- ValidBefore: CertTimeInfinity,
- Signature: &Signature{},
- }
- if err := checker.CheckCert("user", invalidCert); err == nil {
- t.Error("Invalid cert signature passed validation")
- }
-}
-
-func TestValidateCertTime(t *testing.T) {
- cert := Certificate{
- ValidPrincipals: []string{"user"},
- Key: testPublicKeys["rsa"],
- ValidAfter: 50,
- ValidBefore: 100,
- }
-
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
-
- for ts, ok := range map[int64]bool{
- 25: false,
- 50: true,
- 99: true,
- 100: false,
- 125: false,
- } {
- checker := CertChecker{
- Clock: func() time.Time { return time.Unix(ts, 0) },
- }
- checker.IsAuthority = func(k PublicKey) bool {
- return bytes.Equal(k.Marshal(),
- testPublicKeys["ecdsa"].Marshal())
- }
-
- if v := checker.CheckCert("user", &cert); (v == nil) != ok {
- t.Errorf("Authenticate(%d): %v", ts, v)
- }
- }
-}
-
-// TODO(hanwen): tests for
-//
-// host keys:
-// * fallbacks
-
-func TestHostKeyCert(t *testing.T) {
- cert := &Certificate{
- ValidPrincipals: []string{"hostname", "hostname.domain"},
- Key: testPublicKeys["rsa"],
- ValidBefore: CertTimeInfinity,
- CertType: HostCert,
- }
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
-
- checker := &CertChecker{
- IsAuthority: func(p PublicKey) bool {
- return bytes.Equal(testPublicKeys["ecdsa"].Marshal(), p.Marshal())
- },
- }
-
- certSigner, err := NewCertSigner(cert, testSigners["rsa"])
- if err != nil {
- t.Errorf("NewCertSigner: %v", err)
- }
-
- for _, name := range []string{"hostname", "otherhost"} {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- errc := make(chan error)
-
- go func() {
- conf := ServerConfig{
- NoClientAuth: true,
- }
- conf.AddHostKey(certSigner)
- _, _, _, err := NewServerConn(c1, &conf)
- errc <- err
- }()
-
- config := &ClientConfig{
- User: "user",
- HostKeyCallback: checker.CheckHostKey,
- }
- _, _, _, err = NewClientConn(c2, name, config)
-
- succeed := name == "hostname"
- if (err == nil) != succeed {
- t.Fatalf("NewClientConn(%q): %v", name, err)
- }
-
- err = <-errc
- if (err == nil) != succeed {
- t.Fatalf("NewServerConn(%q): %v", name, err)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/cipher_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/cipher_test.go
deleted file mode 100644
index 54b92b6edce..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/cipher_test.go
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto"
- "crypto/aes"
- "crypto/rand"
- "testing"
-)
-
-func TestDefaultCiphersExist(t *testing.T) {
- for _, cipherAlgo := range supportedCiphers {
- if _, ok := cipherModes[cipherAlgo]; !ok {
- t.Errorf("default cipher %q is unknown", cipherAlgo)
- }
- }
-}
-
-func TestPacketCiphers(t *testing.T) {
- // Still test aes128cbc cipher althought it's commented out.
- cipherModes[aes128cbcID] = &streamCipherMode{16, aes.BlockSize, 0, nil}
- defer delete(cipherModes, aes128cbcID)
-
- for cipher := range cipherModes {
- kr := &kexResult{Hash: crypto.SHA1}
- algs := directionAlgorithms{
- Cipher: cipher,
- MAC: "hmac-sha1",
- Compression: "none",
- }
- client, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Errorf("newPacketCipher(client, %q): %v", cipher, err)
- continue
- }
- server, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Errorf("newPacketCipher(client, %q): %v", cipher, err)
- continue
- }
-
- want := "bla bla"
- input := []byte(want)
- buf := &bytes.Buffer{}
- if err := client.writePacket(0, buf, rand.Reader, input); err != nil {
- t.Errorf("writePacket(%q): %v", cipher, err)
- continue
- }
-
- packet, err := server.readPacket(0, buf)
- if err != nil {
- t.Errorf("readPacket(%q): %v", cipher, err)
- continue
- }
-
- if string(packet) != want {
- t.Errorf("roundtrip(%q): got %q, want %q", cipher, packet, want)
- }
- }
-}
-
-func TestCBCOracleCounterMeasure(t *testing.T) {
- cipherModes[aes128cbcID] = &streamCipherMode{16, aes.BlockSize, 0, nil}
- defer delete(cipherModes, aes128cbcID)
-
- kr := &kexResult{Hash: crypto.SHA1}
- algs := directionAlgorithms{
- Cipher: aes128cbcID,
- MAC: "hmac-sha1",
- Compression: "none",
- }
- client, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Fatalf("newPacketCipher(client): %v", err)
- }
-
- want := "bla bla"
- input := []byte(want)
- buf := &bytes.Buffer{}
- if err := client.writePacket(0, buf, rand.Reader, input); err != nil {
- t.Errorf("writePacket: %v", err)
- }
-
- packetSize := buf.Len()
- buf.Write(make([]byte, 2*maxPacket))
-
- // We corrupt each byte, but this usually will only test the
- // 'packet too large' or 'MAC failure' cases.
- lastRead := -1
- for i := 0; i < packetSize; i++ {
- server, err := newPacketCipher(clientKeys, algs, kr)
- if err != nil {
- t.Fatalf("newPacketCipher(client): %v", err)
- }
-
- fresh := &bytes.Buffer{}
- fresh.Write(buf.Bytes())
- fresh.Bytes()[i] ^= 0x01
-
- before := fresh.Len()
- _, err = server.readPacket(0, fresh)
- if err == nil {
- t.Errorf("corrupt byte %d: readPacket succeeded ", i)
- continue
- }
- if _, ok := err.(cbcError); !ok {
- t.Errorf("corrupt byte %d: got %v (%T), want cbcError", i, err, err)
- continue
- }
-
- after := fresh.Len()
- bytesRead := before - after
- if bytesRead < maxPacket {
- t.Errorf("corrupt byte %d: read %d bytes, want more than %d", i, bytesRead, maxPacket)
- continue
- }
-
- if i > 0 && bytesRead != lastRead {
- t.Errorf("corrupt byte %d: read %d bytes, want %d bytes read", i, bytesRead, lastRead)
- }
- lastRead = bytesRead
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_auth_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_auth_test.go
deleted file mode 100644
index 2ea44624fc1..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_auth_test.go
+++ /dev/null
@@ -1,393 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "errors"
- "fmt"
- "strings"
- "testing"
-)
-
-type keyboardInteractive map[string]string
-
-func (cr keyboardInteractive) Challenge(user string, instruction string, questions []string, echos []bool) ([]string, error) {
- var answers []string
- for _, q := range questions {
- answers = append(answers, cr[q])
- }
- return answers, nil
-}
-
-// reused internally by tests
-var clientPassword = "tiger"
-
-// tryAuth runs a handshake with a given config against an SSH server
-// with config serverConfig
-func tryAuth(t *testing.T, config *ClientConfig) error {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- certChecker := CertChecker{
- IsAuthority: func(k PublicKey) bool {
- return bytes.Equal(k.Marshal(), testPublicKeys["ecdsa"].Marshal())
- },
- UserKeyFallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) {
- if conn.User() == "testuser" && bytes.Equal(key.Marshal(), testPublicKeys["rsa"].Marshal()) {
- return nil, nil
- }
-
- return nil, fmt.Errorf("pubkey for %q not acceptable", conn.User())
- },
- IsRevoked: func(c *Certificate) bool {
- return c.Serial == 666
- },
- }
-
- serverConfig := &ServerConfig{
- PasswordCallback: func(conn ConnMetadata, pass []byte) (*Permissions, error) {
- if conn.User() == "testuser" && string(pass) == clientPassword {
- return nil, nil
- }
- return nil, errors.New("password auth failed")
- },
- PublicKeyCallback: certChecker.Authenticate,
- KeyboardInteractiveCallback: func(conn ConnMetadata, challenge KeyboardInteractiveChallenge) (*Permissions, error) {
- ans, err := challenge("user",
- "instruction",
- []string{"question1", "question2"},
- []bool{true, true})
- if err != nil {
- return nil, err
- }
- ok := conn.User() == "testuser" && ans[0] == "answer1" && ans[1] == "answer2"
- if ok {
- challenge("user", "motd", nil, nil)
- return nil, nil
- }
- return nil, errors.New("keyboard-interactive failed")
- },
- AuthLogCallback: func(conn ConnMetadata, method string, err error) {
- t.Logf("user %q, method %q: %v", conn.User(), method, err)
- },
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- go newServer(c1, serverConfig)
- _, _, _, err = NewClientConn(c2, "", config)
- return err
-}
-
-func TestClientAuthPublicKey(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- }
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodPassword(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- Password(clientPassword),
- },
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodFallback(t *testing.T) {
- var passwordCalled bool
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- PasswordCallback(
- func() (string, error) {
- passwordCalled = true
- return "WRONG", nil
- }),
- },
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-
- if passwordCalled {
- t.Errorf("password auth tried before public-key auth.")
- }
-}
-
-func TestAuthMethodWrongPassword(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- Password("wrong"),
- PublicKeys(testSigners["rsa"]),
- },
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodKeyboardInteractive(t *testing.T) {
- answers := keyboardInteractive(map[string]string{
- "question1": "answer1",
- "question2": "answer2",
- })
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- KeyboardInteractive(answers.Challenge),
- },
- }
-
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("unable to dial remote side: %s", err)
- }
-}
-
-func TestAuthMethodWrongKeyboardInteractive(t *testing.T) {
- answers := keyboardInteractive(map[string]string{
- "question1": "answer1",
- "question2": "WRONG",
- })
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- KeyboardInteractive(answers.Challenge),
- },
- }
-
- if err := tryAuth(t, config); err == nil {
- t.Fatalf("wrong answers should not have authenticated with KeyboardInteractive")
- }
-}
-
-// the mock server will only authenticate ssh-rsa keys
-func TestAuthMethodInvalidPublicKey(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["dsa"]),
- },
- }
-
- if err := tryAuth(t, config); err == nil {
- t.Fatalf("dsa private key should not have authenticated with rsa public key")
- }
-}
-
-// the client should authenticate with the second key
-func TestAuthMethodRSAandDSA(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["dsa"], testSigners["rsa"]),
- },
- }
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("client could not authenticate with rsa key: %v", err)
- }
-}
-
-func TestClientHMAC(t *testing.T) {
- for _, mac := range supportedMACs {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- Config: Config{
- MACs: []string{mac},
- },
- }
- if err := tryAuth(t, config); err != nil {
- t.Fatalf("client could not authenticate with mac algo %s: %v", mac, err)
- }
- }
-}
-
-// issue 4285.
-func TestClientUnsupportedCipher(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(),
- },
- Config: Config{
- Ciphers: []string{"aes128-cbc"}, // not currently supported
- },
- }
- if err := tryAuth(t, config); err == nil {
- t.Errorf("expected no ciphers in common")
- }
-}
-
-func TestClientUnsupportedKex(t *testing.T) {
- config := &ClientConfig{
- User: "testuser",
- Auth: []AuthMethod{
- PublicKeys(),
- },
- Config: Config{
- KeyExchanges: []string{"diffie-hellman-group-exchange-sha256"}, // not currently supported
- },
- }
- if err := tryAuth(t, config); err == nil || !strings.Contains(err.Error(), "common algorithm") {
- t.Errorf("got %v, expected 'common algorithm'", err)
- }
-}
-
-func TestClientLoginCert(t *testing.T) {
- cert := &Certificate{
- Key: testPublicKeys["rsa"],
- ValidBefore: CertTimeInfinity,
- CertType: UserCert,
- }
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- certSigner, err := NewCertSigner(cert, testSigners["rsa"])
- if err != nil {
- t.Fatalf("NewCertSigner: %v", err)
- }
-
- clientConfig := &ClientConfig{
- User: "user",
- }
- clientConfig.Auth = append(clientConfig.Auth, PublicKeys(certSigner))
-
- t.Log("should succeed")
- if err := tryAuth(t, clientConfig); err != nil {
- t.Errorf("cert login failed: %v", err)
- }
-
- t.Log("corrupted signature")
- cert.Signature.Blob[0]++
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with corrupted sig")
- }
-
- t.Log("revoked")
- cert.Serial = 666
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("revoked cert login succeeded")
- }
- cert.Serial = 1
-
- t.Log("sign with wrong key")
- cert.SignCert(rand.Reader, testSigners["dsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with non-authoritive key")
- }
-
- t.Log("host cert")
- cert.CertType = HostCert
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with wrong type")
- }
- cert.CertType = UserCert
-
- t.Log("principal specified")
- cert.ValidPrincipals = []string{"user"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err != nil {
- t.Errorf("cert login failed: %v", err)
- }
-
- t.Log("wrong principal specified")
- cert.ValidPrincipals = []string{"fred"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with wrong principal")
- }
- cert.ValidPrincipals = nil
-
- t.Log("added critical option")
- cert.CriticalOptions = map[string]string{"root-access": "yes"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login passed with unrecognized critical option")
- }
-
- t.Log("allowed source address")
- cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42/24"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err != nil {
- t.Errorf("cert login with source-address failed: %v", err)
- }
-
- t.Log("disallowed source address")
- cert.CriticalOptions = map[string]string{"source-address": "127.0.0.42"}
- cert.SignCert(rand.Reader, testSigners["ecdsa"])
- if err := tryAuth(t, clientConfig); err == nil {
- t.Errorf("cert login with source-address succeeded")
- }
-}
-
-func testPermissionsPassing(withPermissions bool, t *testing.T) {
- serverConfig := &ServerConfig{
- PublicKeyCallback: func(conn ConnMetadata, key PublicKey) (*Permissions, error) {
- if conn.User() == "nopermissions" {
- return nil, nil
- } else {
- return &Permissions{}, nil
- }
- },
- }
- serverConfig.AddHostKey(testSigners["rsa"])
-
- clientConfig := &ClientConfig{
- Auth: []AuthMethod{
- PublicKeys(testSigners["rsa"]),
- },
- }
- if withPermissions {
- clientConfig.User = "permissions"
- } else {
- clientConfig.User = "nopermissions"
- }
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewClientConn(c2, "", clientConfig)
- serverConn, err := newServer(c1, serverConfig)
- if err != nil {
- t.Fatal(err)
- }
- if p := serverConn.Permissions; (p != nil) != withPermissions {
- t.Fatalf("withPermissions is %t, but Permissions object is %#v", withPermissions, p)
- }
-}
-
-func TestPermissionsPassing(t *testing.T) {
- testPermissionsPassing(true, t)
-}
-
-func TestNoPermissionsPassing(t *testing.T) {
- testPermissionsPassing(false, t)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_test.go
deleted file mode 100644
index 1fe790cb494..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/client_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "net"
- "testing"
-)
-
-func testClientVersion(t *testing.T, config *ClientConfig, expected string) {
- clientConn, serverConn := net.Pipe()
- defer clientConn.Close()
- receivedVersion := make(chan string, 1)
- go func() {
- version, err := readVersion(serverConn)
- if err != nil {
- receivedVersion <- ""
- } else {
- receivedVersion <- string(version)
- }
- serverConn.Close()
- }()
- NewClientConn(clientConn, "", config)
- actual := <-receivedVersion
- if actual != expected {
- t.Fatalf("got %s; want %s", actual, expected)
- }
-}
-
-func TestCustomClientVersion(t *testing.T) {
- version := "Test-Client-Version-0.0"
- testClientVersion(t, &ClientConfig{ClientVersion: version}, version)
-}
-
-func TestDefaultClientVersion(t *testing.T) {
- testClientVersion(t, &ClientConfig{}, packageVersion)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/example_test.go
deleted file mode 100644
index dfd9dcab606..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/example_test.go
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh_test
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "log"
- "net"
- "net/http"
-
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/terminal"
-)
-
-func ExampleNewServerConn() {
- // An SSH server is represented by a ServerConfig, which holds
- // certificate details and handles authentication of ServerConns.
- config := &ssh.ServerConfig{
- PasswordCallback: func(c ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error) {
- // Should use constant-time compare (or better, salt+hash) in
- // a production setting.
- if c.User() == "testuser" && string(pass) == "tiger" {
- return nil, nil
- }
- return nil, fmt.Errorf("password rejected for %q", c.User())
- },
- }
-
- privateBytes, err := ioutil.ReadFile("id_rsa")
- if err != nil {
- panic("Failed to load private key")
- }
-
- private, err := ssh.ParsePrivateKey(privateBytes)
- if err != nil {
- panic("Failed to parse private key")
- }
-
- config.AddHostKey(private)
-
- // Once a ServerConfig has been configured, connections can be
- // accepted.
- listener, err := net.Listen("tcp", "0.0.0.0:2022")
- if err != nil {
- panic("failed to listen for connection")
- }
- nConn, err := listener.Accept()
- if err != nil {
- panic("failed to accept incoming connection")
- }
-
- // Before use, a handshake must be performed on the incoming
- // net.Conn.
- _, chans, reqs, err := ssh.NewServerConn(nConn, config)
- if err != nil {
- panic("failed to handshake")
- }
- // The incoming Request channel must be serviced.
- go ssh.DiscardRequests(reqs)
-
- // Service the incoming Channel channel.
- for newChannel := range chans {
- // Channels have a type, depending on the application level
- // protocol intended. In the case of a shell, the type is
- // "session" and ServerShell may be used to present a simple
- // terminal interface.
- if newChannel.ChannelType() != "session" {
- newChannel.Reject(ssh.UnknownChannelType, "unknown channel type")
- continue
- }
- channel, requests, err := newChannel.Accept()
- if err != nil {
- panic("could not accept channel.")
- }
-
- // Sessions have out-of-band requests such as "shell",
- // "pty-req" and "env". Here we handle only the
- // "shell" request.
- go func(in <-chan *ssh.Request) {
- for req := range in {
- ok := false
- switch req.Type {
- case "shell":
- ok = true
- if len(req.Payload) > 0 {
- // We don't accept any
- // commands, only the
- // default shell.
- ok = false
- }
- }
- req.Reply(ok, nil)
- }
- }(requests)
-
- term := terminal.NewTerminal(channel, "> ")
-
- go func() {
- defer channel.Close()
- for {
- line, err := term.ReadLine()
- if err != nil {
- break
- }
- fmt.Println(line)
- }
- }()
- }
-}
-
-func ExampleDial() {
- // An SSH client is represented with a ClientConn. Currently only
- // the "password" authentication method is supported.
- //
- // To authenticate with the remote server you must pass at least one
- // implementation of AuthMethod via the Auth field in ClientConfig.
- config := &ssh.ClientConfig{
- User: "username",
- Auth: []ssh.AuthMethod{
- ssh.Password("yourpassword"),
- },
- }
- client, err := ssh.Dial("tcp", "yourserver.com:22", config)
- if err != nil {
- panic("Failed to dial: " + err.Error())
- }
-
- // Each ClientConn can support multiple interactive sessions,
- // represented by a Session.
- session, err := client.NewSession()
- if err != nil {
- panic("Failed to create session: " + err.Error())
- }
- defer session.Close()
-
- // Once a Session is created, you can execute a single command on
- // the remote side using the Run method.
- var b bytes.Buffer
- session.Stdout = &b
- if err := session.Run("/usr/bin/whoami"); err != nil {
- panic("Failed to run: " + err.Error())
- }
- fmt.Println(b.String())
-}
-
-func ExampleClient_Listen() {
- config := &ssh.ClientConfig{
- User: "username",
- Auth: []ssh.AuthMethod{
- ssh.Password("password"),
- },
- }
- // Dial your ssh server.
- conn, err := ssh.Dial("tcp", "localhost:22", config)
- if err != nil {
- log.Fatalf("unable to connect: %s", err)
- }
- defer conn.Close()
-
- // Request the remote side to open port 8080 on all interfaces.
- l, err := conn.Listen("tcp", "0.0.0.0:8080")
- if err != nil {
- log.Fatalf("unable to register tcp forward: %v", err)
- }
- defer l.Close()
-
- // Serve HTTP with your SSH server acting as a reverse proxy.
- http.Serve(l, http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
- fmt.Fprintf(resp, "Hello world!\n")
- }))
-}
-
-func ExampleSession_RequestPty() {
- // Create client config
- config := &ssh.ClientConfig{
- User: "username",
- Auth: []ssh.AuthMethod{
- ssh.Password("password"),
- },
- }
- // Connect to ssh server
- conn, err := ssh.Dial("tcp", "localhost:22", config)
- if err != nil {
- log.Fatalf("unable to connect: %s", err)
- }
- defer conn.Close()
- // Create a session
- session, err := conn.NewSession()
- if err != nil {
- log.Fatalf("unable to create session: %s", err)
- }
- defer session.Close()
- // Set up terminal modes
- modes := ssh.TerminalModes{
- ssh.ECHO: 0, // disable echoing
- ssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud
- ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
- }
- // Request pseudo terminal
- if err := session.RequestPty("xterm", 80, 40, modes); err != nil {
- log.Fatalf("request for pseudo terminal failed: %s", err)
- }
- // Start remote shell
- if err := session.Shell(); err != nil {
- log.Fatalf("failed to start shell: %s", err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/handshake_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/handshake_test.go
deleted file mode 100644
index b86d369cced..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/handshake_test.go
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "errors"
- "fmt"
- "net"
- "runtime"
- "strings"
- "sync"
- "testing"
-)
-
-type testChecker struct {
- calls []string
-}
-
-func (t *testChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error {
- if dialAddr == "bad" {
- return fmt.Errorf("dialAddr is bad")
- }
-
- if tcpAddr, ok := addr.(*net.TCPAddr); !ok || tcpAddr == nil {
- return fmt.Errorf("testChecker: got %T want *net.TCPAddr", addr)
- }
-
- t.calls = append(t.calls, fmt.Sprintf("%s %v %s %x", dialAddr, addr, key.Type(), key.Marshal()))
-
- return nil
-}
-
-// netPipe is analogous to net.Pipe, but it uses a real net.Conn, and
-// therefore is buffered (net.Pipe deadlocks if both sides start with
-// a write.)
-func netPipe() (net.Conn, net.Conn, error) {
- listener, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- return nil, nil, err
- }
- defer listener.Close()
- c1, err := net.Dial("tcp", listener.Addr().String())
- if err != nil {
- return nil, nil, err
- }
-
- c2, err := listener.Accept()
- if err != nil {
- c1.Close()
- return nil, nil, err
- }
-
- return c1, c2, nil
-}
-
-func handshakePair(clientConf *ClientConfig, addr string) (client *handshakeTransport, server *handshakeTransport, err error) {
- a, b, err := netPipe()
- if err != nil {
- return nil, nil, err
- }
-
- trC := newTransport(a, rand.Reader, true)
- trS := newTransport(b, rand.Reader, false)
- clientConf.SetDefaults()
-
- v := []byte("version")
- client = newClientTransport(trC, v, v, clientConf, addr, a.RemoteAddr())
-
- serverConf := &ServerConfig{}
- serverConf.AddHostKey(testSigners["ecdsa"])
- serverConf.AddHostKey(testSigners["rsa"])
- serverConf.SetDefaults()
- server = newServerTransport(trS, v, v, serverConf)
-
- return client, server, nil
-}
-
-func TestHandshakeBasic(t *testing.T) {
- if runtime.GOOS == "plan9" {
- t.Skip("see golang.org/issue/7237")
- }
- checker := &testChecker{}
- trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr")
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
-
- defer trC.Close()
- defer trS.Close()
-
- go func() {
- // Client writes a bunch of stuff, and does a key
- // change in the middle. This should not confuse the
- // handshake in progress
- for i := 0; i < 10; i++ {
- p := []byte{msgRequestSuccess, byte(i)}
- if err := trC.writePacket(p); err != nil {
- t.Fatalf("sendPacket: %v", err)
- }
- if i == 5 {
- // halfway through, we request a key change.
- _, _, err := trC.sendKexInit()
- if err != nil {
- t.Fatalf("sendKexInit: %v", err)
- }
- }
- }
- trC.Close()
- }()
-
- // Server checks that client messages come in cleanly
- i := 0
- for {
- p, err := trS.readPacket()
- if err != nil {
- break
- }
- if p[0] == msgNewKeys {
- continue
- }
- want := []byte{msgRequestSuccess, byte(i)}
- if bytes.Compare(p, want) != 0 {
- t.Errorf("message %d: got %q, want %q", i, p, want)
- }
- i++
- }
- if i != 10 {
- t.Errorf("received %d messages, want 10.", i)
- }
-
- // If all went well, we registered exactly 1 key change.
- if len(checker.calls) != 1 {
- t.Fatalf("got %d host key checks, want 1", len(checker.calls))
- }
-
- pub := testSigners["ecdsa"].PublicKey()
- want := fmt.Sprintf("%s %v %s %x", "addr", trC.remoteAddr, pub.Type(), pub.Marshal())
- if want != checker.calls[0] {
- t.Errorf("got %q want %q for host key check", checker.calls[0], want)
- }
-}
-
-func TestHandshakeError(t *testing.T) {
- checker := &testChecker{}
- trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "bad")
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
- defer trC.Close()
- defer trS.Close()
-
- // send a packet
- packet := []byte{msgRequestSuccess, 42}
- if err := trC.writePacket(packet); err != nil {
- t.Errorf("writePacket: %v", err)
- }
-
- // Now request a key change.
- _, _, err = trC.sendKexInit()
- if err != nil {
- t.Errorf("sendKexInit: %v", err)
- }
-
- // the key change will fail, and afterwards we can't write.
- if err := trC.writePacket([]byte{msgRequestSuccess, 43}); err == nil {
- t.Errorf("writePacket after botched rekey succeeded.")
- }
-
- readback, err := trS.readPacket()
- if err != nil {
- t.Fatalf("server closed too soon: %v", err)
- }
- if bytes.Compare(readback, packet) != 0 {
- t.Errorf("got %q want %q", readback, packet)
- }
- readback, err = trS.readPacket()
- if err == nil {
- t.Errorf("got a message %q after failed key change", readback)
- }
-}
-
-func TestHandshakeTwice(t *testing.T) {
- checker := &testChecker{}
- trC, trS, err := handshakePair(&ClientConfig{HostKeyCallback: checker.Check}, "addr")
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
-
- defer trC.Close()
- defer trS.Close()
-
- // send a packet
- packet := make([]byte, 5)
- packet[0] = msgRequestSuccess
- if err := trC.writePacket(packet); err != nil {
- t.Errorf("writePacket: %v", err)
- }
-
- // Now request a key change.
- _, _, err = trC.sendKexInit()
- if err != nil {
- t.Errorf("sendKexInit: %v", err)
- }
-
- // Send another packet. Use a fresh one, since writePacket destroys.
- packet = make([]byte, 5)
- packet[0] = msgRequestSuccess
- if err := trC.writePacket(packet); err != nil {
- t.Errorf("writePacket: %v", err)
- }
-
- // 2nd key change.
- _, _, err = trC.sendKexInit()
- if err != nil {
- t.Errorf("sendKexInit: %v", err)
- }
-
- packet = make([]byte, 5)
- packet[0] = msgRequestSuccess
- if err := trC.writePacket(packet); err != nil {
- t.Errorf("writePacket: %v", err)
- }
-
- packet = make([]byte, 5)
- packet[0] = msgRequestSuccess
- for i := 0; i < 5; i++ {
- msg, err := trS.readPacket()
- if err != nil {
- t.Fatalf("server closed too soon: %v", err)
- }
- if msg[0] == msgNewKeys {
- continue
- }
-
- if bytes.Compare(msg, packet) != 0 {
- t.Errorf("packet %d: got %q want %q", i, msg, packet)
- }
- }
- if len(checker.calls) != 2 {
- t.Errorf("got %d key changes, want 2", len(checker.calls))
- }
-}
-
-func TestHandshakeAutoRekeyWrite(t *testing.T) {
- checker := &testChecker{}
- clientConf := &ClientConfig{HostKeyCallback: checker.Check}
- clientConf.RekeyThreshold = 500
- trC, trS, err := handshakePair(clientConf, "addr")
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
- defer trC.Close()
- defer trS.Close()
-
- for i := 0; i < 5; i++ {
- packet := make([]byte, 251)
- packet[0] = msgRequestSuccess
- if err := trC.writePacket(packet); err != nil {
- t.Errorf("writePacket: %v", err)
- }
- }
-
- j := 0
- for ; j < 5; j++ {
- _, err := trS.readPacket()
- if err != nil {
- break
- }
- }
-
- if j != 5 {
- t.Errorf("got %d, want 5 messages", j)
- }
-
- if len(checker.calls) != 2 {
- t.Errorf("got %d key changes, wanted 2", len(checker.calls))
- }
-}
-
-type syncChecker struct {
- called chan int
-}
-
-func (t *syncChecker) Check(dialAddr string, addr net.Addr, key PublicKey) error {
- t.called <- 1
- return nil
-}
-
-func TestHandshakeAutoRekeyRead(t *testing.T) {
- sync := &syncChecker{make(chan int, 2)}
- clientConf := &ClientConfig{
- HostKeyCallback: sync.Check,
- }
- clientConf.RekeyThreshold = 500
-
- trC, trS, err := handshakePair(clientConf, "addr")
- if err != nil {
- t.Fatalf("handshakePair: %v", err)
- }
- defer trC.Close()
- defer trS.Close()
-
- packet := make([]byte, 501)
- packet[0] = msgRequestSuccess
- if err := trS.writePacket(packet); err != nil {
- t.Fatalf("writePacket: %v", err)
- }
- // While we read out the packet, a key change will be
- // initiated.
- if _, err := trC.readPacket(); err != nil {
- t.Fatalf("readPacket(client): %v", err)
- }
-
- <-sync.called
-}
-
-// errorKeyingTransport generates errors after a given number of
-// read/write operations.
-type errorKeyingTransport struct {
- packetConn
- readLeft, writeLeft int
-}
-
-func (n *errorKeyingTransport) prepareKeyChange(*algorithms, *kexResult) error {
- return nil
-}
-func (n *errorKeyingTransport) getSessionID() []byte {
- return nil
-}
-
-func (n *errorKeyingTransport) writePacket(packet []byte) error {
- if n.writeLeft == 0 {
- n.Close()
- return errors.New("barf")
- }
-
- n.writeLeft--
- return n.packetConn.writePacket(packet)
-}
-
-func (n *errorKeyingTransport) readPacket() ([]byte, error) {
- if n.readLeft == 0 {
- n.Close()
- return nil, errors.New("barf")
- }
-
- n.readLeft--
- return n.packetConn.readPacket()
-}
-
-func TestHandshakeErrorHandlingRead(t *testing.T) {
- for i := 0; i < 20; i++ {
- testHandshakeErrorHandlingN(t, i, -1)
- }
-}
-
-func TestHandshakeErrorHandlingWrite(t *testing.T) {
- for i := 0; i < 20; i++ {
- testHandshakeErrorHandlingN(t, -1, i)
- }
-}
-
-// testHandshakeErrorHandlingN runs handshakes, injecting errors. If
-// handshakeTransport deadlocks, the go runtime will detect it and
-// panic.
-func testHandshakeErrorHandlingN(t *testing.T, readLimit, writeLimit int) {
- msg := Marshal(&serviceRequestMsg{strings.Repeat("x", int(minRekeyThreshold)/4)})
-
- a, b := memPipe()
- defer a.Close()
- defer b.Close()
-
- key := testSigners["ecdsa"]
- serverConf := Config{RekeyThreshold: minRekeyThreshold}
- serverConf.SetDefaults()
- serverConn := newHandshakeTransport(&errorKeyingTransport{a, readLimit, writeLimit}, &serverConf, []byte{'a'}, []byte{'b'})
- serverConn.hostKeys = []Signer{key}
- go serverConn.readLoop()
-
- clientConf := Config{RekeyThreshold: 10 * minRekeyThreshold}
- clientConf.SetDefaults()
- clientConn := newHandshakeTransport(&errorKeyingTransport{b, -1, -1}, &clientConf, []byte{'a'}, []byte{'b'})
- clientConn.hostKeyAlgorithms = []string{key.PublicKey().Type()}
- go clientConn.readLoop()
-
- var wg sync.WaitGroup
- wg.Add(4)
-
- for _, hs := range []packetConn{serverConn, clientConn} {
- go func(c packetConn) {
- for {
- err := c.writePacket(msg)
- if err != nil {
- break
- }
- }
- wg.Done()
- }(hs)
- go func(c packetConn) {
- for {
- _, err := c.readPacket()
- if err != nil {
- break
- }
- }
- wg.Done()
- }(hs)
- }
-
- wg.Wait()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/kex_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/kex_test.go
deleted file mode 100644
index 12ca0acd31d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/kex_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Key exchange tests.
-
-import (
- "crypto/rand"
- "reflect"
- "testing"
-)
-
-func TestKexes(t *testing.T) {
- type kexResultErr struct {
- result *kexResult
- err error
- }
-
- for name, kex := range kexAlgoMap {
- a, b := memPipe()
-
- s := make(chan kexResultErr, 1)
- c := make(chan kexResultErr, 1)
- var magics handshakeMagics
- go func() {
- r, e := kex.Client(a, rand.Reader, &magics)
- a.Close()
- c <- kexResultErr{r, e}
- }()
- go func() {
- r, e := kex.Server(b, rand.Reader, &magics, testSigners["ecdsa"])
- b.Close()
- s <- kexResultErr{r, e}
- }()
-
- clientRes := <-c
- serverRes := <-s
- if clientRes.err != nil {
- t.Errorf("client: %v", clientRes.err)
- }
- if serverRes.err != nil {
- t.Errorf("server: %v", serverRes.err)
- }
- if !reflect.DeepEqual(clientRes.result, serverRes.result) {
- t.Errorf("kex %q: mismatch %#v, %#v", name, clientRes.result, serverRes.result)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/keys_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/keys_test.go
deleted file mode 100644
index 27569473fcf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/keys_test.go
+++ /dev/null
@@ -1,437 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/rsa"
- "encoding/base64"
- "fmt"
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/crypto/ssh/testdata"
-)
-
-func rawKey(pub PublicKey) interface{} {
- switch k := pub.(type) {
- case *rsaPublicKey:
- return (*rsa.PublicKey)(k)
- case *dsaPublicKey:
- return (*dsa.PublicKey)(k)
- case *ecdsaPublicKey:
- return (*ecdsa.PublicKey)(k)
- case *Certificate:
- return k
- }
- panic("unknown key type")
-}
-
-func TestKeyMarshalParse(t *testing.T) {
- for _, priv := range testSigners {
- pub := priv.PublicKey()
- roundtrip, err := ParsePublicKey(pub.Marshal())
- if err != nil {
- t.Errorf("ParsePublicKey(%T): %v", pub, err)
- }
-
- k1 := rawKey(pub)
- k2 := rawKey(roundtrip)
-
- if !reflect.DeepEqual(k1, k2) {
- t.Errorf("got %#v in roundtrip, want %#v", k2, k1)
- }
- }
-}
-
-func TestUnsupportedCurves(t *testing.T) {
- raw, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader)
- if err != nil {
- t.Fatalf("GenerateKey: %v", err)
- }
-
- if _, err = NewSignerFromKey(raw); err == nil || !strings.Contains(err.Error(), "only P-256") {
- t.Fatalf("NewPrivateKey should not succeed with P-224, got: %v", err)
- }
-
- if _, err = NewPublicKey(&raw.PublicKey); err == nil || !strings.Contains(err.Error(), "only P-256") {
- t.Fatalf("NewPublicKey should not succeed with P-224, got: %v", err)
- }
-}
-
-func TestNewPublicKey(t *testing.T) {
- for _, k := range testSigners {
- raw := rawKey(k.PublicKey())
- // Skip certificates, as NewPublicKey does not support them.
- if _, ok := raw.(*Certificate); ok {
- continue
- }
- pub, err := NewPublicKey(raw)
- if err != nil {
- t.Errorf("NewPublicKey(%#v): %v", raw, err)
- }
- if !reflect.DeepEqual(k.PublicKey(), pub) {
- t.Errorf("NewPublicKey(%#v) = %#v, want %#v", raw, pub, k.PublicKey())
- }
- }
-}
-
-func TestKeySignVerify(t *testing.T) {
- for _, priv := range testSigners {
- pub := priv.PublicKey()
-
- data := []byte("sign me")
- sig, err := priv.Sign(rand.Reader, data)
- if err != nil {
- t.Fatalf("Sign(%T): %v", priv, err)
- }
-
- if err := pub.Verify(data, sig); err != nil {
- t.Errorf("publicKey.Verify(%T): %v", priv, err)
- }
- sig.Blob[5]++
- if err := pub.Verify(data, sig); err == nil {
- t.Errorf("publicKey.Verify on broken sig did not fail")
- }
- }
-}
-
-func TestParseRSAPrivateKey(t *testing.T) {
- key := testPrivateKeys["rsa"]
-
- rsa, ok := key.(*rsa.PrivateKey)
- if !ok {
- t.Fatalf("got %T, want *rsa.PrivateKey", rsa)
- }
-
- if err := rsa.Validate(); err != nil {
- t.Errorf("Validate: %v", err)
- }
-}
-
-func TestParseECPrivateKey(t *testing.T) {
- key := testPrivateKeys["ecdsa"]
-
- ecKey, ok := key.(*ecdsa.PrivateKey)
- if !ok {
- t.Fatalf("got %T, want *ecdsa.PrivateKey", ecKey)
- }
-
- if !validateECPublicKey(ecKey.Curve, ecKey.X, ecKey.Y) {
- t.Fatalf("public key does not validate.")
- }
-}
-
-func TestParseDSA(t *testing.T) {
- // We actually exercise the ParsePrivateKey codepath here, as opposed to
- // using the ParseRawPrivateKey+NewSignerFromKey path that testdata_test.go
- // uses.
- s, err := ParsePrivateKey(testdata.PEMBytes["dsa"])
- if err != nil {
- t.Fatalf("ParsePrivateKey returned error: %s", err)
- }
-
- data := []byte("sign me")
- sig, err := s.Sign(rand.Reader, data)
- if err != nil {
- t.Fatalf("dsa.Sign: %v", err)
- }
-
- if err := s.PublicKey().Verify(data, sig); err != nil {
- t.Errorf("Verify failed: %v", err)
- }
-}
-
-// Tests for authorized_keys parsing.
-
-// getTestKey returns a public key, and its base64 encoding.
-func getTestKey() (PublicKey, string) {
- k := testPublicKeys["rsa"]
-
- b := &bytes.Buffer{}
- e := base64.NewEncoder(base64.StdEncoding, b)
- e.Write(k.Marshal())
- e.Close()
-
- return k, b.String()
-}
-
-func TestMarshalParsePublicKey(t *testing.T) {
- pub, pubSerialized := getTestKey()
- line := fmt.Sprintf("%s %s user@host", pub.Type(), pubSerialized)
-
- authKeys := MarshalAuthorizedKey(pub)
- actualFields := strings.Fields(string(authKeys))
- if len(actualFields) == 0 {
- t.Fatalf("failed authKeys: %v", authKeys)
- }
-
- // drop the comment
- expectedFields := strings.Fields(line)[0:2]
-
- if !reflect.DeepEqual(actualFields, expectedFields) {
- t.Errorf("got %v, expected %v", actualFields, expectedFields)
- }
-
- actPub, _, _, _, err := ParseAuthorizedKey([]byte(line))
- if err != nil {
- t.Fatalf("cannot parse %v: %v", line, err)
- }
- if !reflect.DeepEqual(actPub, pub) {
- t.Errorf("got %v, expected %v", actPub, pub)
- }
-}
-
-type authResult struct {
- pubKey PublicKey
- options []string
- comments string
- rest string
- ok bool
-}
-
-func testAuthorizedKeys(t *testing.T, authKeys []byte, expected []authResult) {
- rest := authKeys
- var values []authResult
- for len(rest) > 0 {
- var r authResult
- var err error
- r.pubKey, r.comments, r.options, rest, err = ParseAuthorizedKey(rest)
- r.ok = (err == nil)
- t.Log(err)
- r.rest = string(rest)
- values = append(values, r)
- }
-
- if !reflect.DeepEqual(values, expected) {
- t.Errorf("got %#v, expected %#v", values, expected)
- }
-}
-
-func TestAuthorizedKeyBasic(t *testing.T) {
- pub, pubSerialized := getTestKey()
- line := "ssh-rsa " + pubSerialized + " user@host"
- testAuthorizedKeys(t, []byte(line),
- []authResult{
- {pub, nil, "user@host", "", true},
- })
-}
-
-func TestAuth(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithOptions := []string{
- `# comments to ignore before any keys...`,
- ``,
- `env="HOME=/home/root",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`,
- `# comments to ignore, along with a blank line`,
- ``,
- `env="HOME=/home/root2" ssh-rsa ` + pubSerialized + ` user2@host2`,
- ``,
- `# more comments, plus a invalid entry`,
- `ssh-rsa data-that-will-not-parse user@host3`,
- }
- for _, eol := range []string{"\n", "\r\n"} {
- authOptions := strings.Join(authWithOptions, eol)
- rest2 := strings.Join(authWithOptions[3:], eol)
- rest3 := strings.Join(authWithOptions[6:], eol)
- testAuthorizedKeys(t, []byte(authOptions), []authResult{
- {pub, []string{`env="HOME=/home/root"`, "no-port-forwarding"}, "user@host", rest2, true},
- {pub, []string{`env="HOME=/home/root2"`}, "user2@host2", rest3, true},
- {nil, nil, "", "", false},
- })
- }
-}
-
-func TestAuthWithQuotedSpaceInEnv(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithQuotedSpaceInEnv := []byte(`env="HOME=/home/root dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`)
- testAuthorizedKeys(t, []byte(authWithQuotedSpaceInEnv), []authResult{
- {pub, []string{`env="HOME=/home/root dir"`, "no-port-forwarding"}, "user@host", "", true},
- })
-}
-
-func TestAuthWithQuotedCommaInEnv(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithQuotedCommaInEnv := []byte(`env="HOME=/home/root,dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`)
- testAuthorizedKeys(t, []byte(authWithQuotedCommaInEnv), []authResult{
- {pub, []string{`env="HOME=/home/root,dir"`, "no-port-forwarding"}, "user@host", "", true},
- })
-}
-
-func TestAuthWithQuotedQuoteInEnv(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithQuotedQuoteInEnv := []byte(`env="HOME=/home/\"root dir",no-port-forwarding` + "\t" + `ssh-rsa` + "\t" + pubSerialized + ` user@host`)
- authWithDoubleQuotedQuote := []byte(`no-port-forwarding,env="HOME=/home/ \"root dir\"" ssh-rsa ` + pubSerialized + "\t" + `user@host`)
- testAuthorizedKeys(t, []byte(authWithQuotedQuoteInEnv), []authResult{
- {pub, []string{`env="HOME=/home/\"root dir"`, "no-port-forwarding"}, "user@host", "", true},
- })
-
- testAuthorizedKeys(t, []byte(authWithDoubleQuotedQuote), []authResult{
- {pub, []string{"no-port-forwarding", `env="HOME=/home/ \"root dir\""`}, "user@host", "", true},
- })
-}
-
-func TestAuthWithInvalidSpace(t *testing.T) {
- _, pubSerialized := getTestKey()
- authWithInvalidSpace := []byte(`env="HOME=/home/root dir", no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host
-#more to follow but still no valid keys`)
- testAuthorizedKeys(t, []byte(authWithInvalidSpace), []authResult{
- {nil, nil, "", "", false},
- })
-}
-
-func TestAuthWithMissingQuote(t *testing.T) {
- pub, pubSerialized := getTestKey()
- authWithMissingQuote := []byte(`env="HOME=/home/root,no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host
-env="HOME=/home/root",shared-control ssh-rsa ` + pubSerialized + ` user@host`)
-
- testAuthorizedKeys(t, []byte(authWithMissingQuote), []authResult{
- {pub, []string{`env="HOME=/home/root"`, `shared-control`}, "user@host", "", true},
- })
-}
-
-func TestInvalidEntry(t *testing.T) {
- authInvalid := []byte(`ssh-rsa`)
- _, _, _, _, err := ParseAuthorizedKey(authInvalid)
- if err == nil {
- t.Errorf("got valid entry for %q", authInvalid)
- }
-}
-
-var knownHostsParseTests = []struct {
- input string
- err string
-
- marker string
- comment string
- hosts []string
- rest string
-} {
- {
- "",
- "EOF",
-
- "", "", nil, "",
- },
- {
- "# Just a comment",
- "EOF",
-
- "", "", nil, "",
- },
- {
- " \t ",
- "EOF",
-
- "", "", nil, "",
- },
- {
- "localhost ssh-rsa {RSAPUB}",
- "",
-
- "", "", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}",
- "",
-
- "", "", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment",
- "",
-
- "", "comment comment", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment\n",
- "",
-
- "", "comment comment", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment\r\n",
- "",
-
- "", "comment comment", []string{"localhost"}, "",
- },
- {
- "localhost\tssh-rsa {RSAPUB}\tcomment comment\r\nnext line",
- "",
-
- "", "comment comment", []string{"localhost"}, "next line",
- },
- {
- "localhost,[host2:123]\tssh-rsa {RSAPUB}\tcomment comment",
- "",
-
- "", "comment comment", []string{"localhost","[host2:123]"}, "",
- },
- {
- "@marker \tlocalhost,[host2:123]\tssh-rsa {RSAPUB}",
- "",
-
- "marker", "", []string{"localhost","[host2:123]"}, "",
- },
- {
- "@marker \tlocalhost,[host2:123]\tssh-rsa aabbccdd",
- "short read",
-
- "", "", nil, "",
- },
-}
-
-func TestKnownHostsParsing(t *testing.T) {
- rsaPub, rsaPubSerialized := getTestKey()
-
- for i, test := range knownHostsParseTests {
- var expectedKey PublicKey
- const rsaKeyToken = "{RSAPUB}"
-
- input := test.input
- if strings.Contains(input, rsaKeyToken) {
- expectedKey = rsaPub
- input = strings.Replace(test.input, rsaKeyToken, rsaPubSerialized, -1)
- }
-
- marker, hosts, pubKey, comment, rest, err := ParseKnownHosts([]byte(input))
- if err != nil {
- if len(test.err) == 0 {
- t.Errorf("#%d: unexpectedly failed with %q", i, err)
- } else if !strings.Contains(err.Error(), test.err) {
- t.Errorf("#%d: expected error containing %q, but got %q", i, test.err, err)
- }
- continue
- } else if len(test.err) != 0 {
- t.Errorf("#%d: succeeded but expected error including %q", i, test.err)
- continue
- }
-
- if !reflect.DeepEqual(expectedKey, pubKey) {
- t.Errorf("#%d: expected key %#v, but got %#v", i, expectedKey, pubKey)
- }
-
- if marker != test.marker {
- t.Errorf("#%d: expected marker %q, but got %q", i, test.marker, marker)
- }
-
- if comment != test.comment {
- t.Errorf("#%d: expected comment %q, but got %q", i, test.comment, comment)
- }
-
- if !reflect.DeepEqual(test.hosts, hosts) {
- t.Errorf("#%d: expected hosts %#v, but got %#v", i, test.hosts, hosts)
- }
-
- if rest := string(rest); rest != test.rest {
- t.Errorf("#%d: expected remaining input to be %q, but got %q", i, test.rest, rest)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mempipe_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mempipe_test.go
deleted file mode 100644
index 8697cd6140a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mempipe_test.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "sync"
- "testing"
-)
-
-// An in-memory packetConn. It is safe to call Close and writePacket
-// from different goroutines.
-type memTransport struct {
- eof bool
- pending [][]byte
- write *memTransport
- sync.Mutex
- *sync.Cond
-}
-
-func (t *memTransport) readPacket() ([]byte, error) {
- t.Lock()
- defer t.Unlock()
- for {
- if len(t.pending) > 0 {
- r := t.pending[0]
- t.pending = t.pending[1:]
- return r, nil
- }
- if t.eof {
- return nil, io.EOF
- }
- t.Cond.Wait()
- }
-}
-
-func (t *memTransport) closeSelf() error {
- t.Lock()
- defer t.Unlock()
- if t.eof {
- return io.EOF
- }
- t.eof = true
- t.Cond.Broadcast()
- return nil
-}
-
-func (t *memTransport) Close() error {
- err := t.write.closeSelf()
- t.closeSelf()
- return err
-}
-
-func (t *memTransport) writePacket(p []byte) error {
- t.write.Lock()
- defer t.write.Unlock()
- if t.write.eof {
- return io.EOF
- }
- c := make([]byte, len(p))
- copy(c, p)
- t.write.pending = append(t.write.pending, c)
- t.write.Cond.Signal()
- return nil
-}
-
-func memPipe() (a, b packetConn) {
- t1 := memTransport{}
- t2 := memTransport{}
- t1.write = &t2
- t2.write = &t1
- t1.Cond = sync.NewCond(&t1.Mutex)
- t2.Cond = sync.NewCond(&t2.Mutex)
- return &t1, &t2
-}
-
-func TestMemPipe(t *testing.T) {
- a, b := memPipe()
- if err := a.writePacket([]byte{42}); err != nil {
- t.Fatalf("writePacket: %v", err)
- }
- if err := a.Close(); err != nil {
- t.Fatal("Close: ", err)
- }
- p, err := b.readPacket()
- if err != nil {
- t.Fatal("readPacket: ", err)
- }
- if len(p) != 1 || p[0] != 42 {
- t.Fatalf("got %v, want {42}", p)
- }
- p, err = b.readPacket()
- if err != io.EOF {
- t.Fatalf("got %v, %v, want EOF", p, err)
- }
-}
-
-func TestDoubleClose(t *testing.T) {
- a, _ := memPipe()
- err := a.Close()
- if err != nil {
- t.Errorf("Close: %v", err)
- }
- err = a.Close()
- if err != io.EOF {
- t.Errorf("expect EOF on double close.")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/messages_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/messages_test.go
deleted file mode 100644
index 955b5127f9b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/messages_test.go
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "math/big"
- "math/rand"
- "reflect"
- "testing"
- "testing/quick"
-)
-
-var intLengthTests = []struct {
- val, length int
-}{
- {0, 4 + 0},
- {1, 4 + 1},
- {127, 4 + 1},
- {128, 4 + 2},
- {-1, 4 + 1},
-}
-
-func TestIntLength(t *testing.T) {
- for _, test := range intLengthTests {
- v := new(big.Int).SetInt64(int64(test.val))
- length := intLength(v)
- if length != test.length {
- t.Errorf("For %d, got length %d but expected %d", test.val, length, test.length)
- }
- }
-}
-
-type msgAllTypes struct {
- Bool bool `sshtype:"21"`
- Array [16]byte
- Uint64 uint64
- Uint32 uint32
- Uint8 uint8
- String string
- Strings []string
- Bytes []byte
- Int *big.Int
- Rest []byte `ssh:"rest"`
-}
-
-func (t *msgAllTypes) Generate(rand *rand.Rand, size int) reflect.Value {
- m := &msgAllTypes{}
- m.Bool = rand.Intn(2) == 1
- randomBytes(m.Array[:], rand)
- m.Uint64 = uint64(rand.Int63n(1<<63 - 1))
- m.Uint32 = uint32(rand.Intn((1 << 31) - 1))
- m.Uint8 = uint8(rand.Intn(1 << 8))
- m.String = string(m.Array[:])
- m.Strings = randomNameList(rand)
- m.Bytes = m.Array[:]
- m.Int = randomInt(rand)
- m.Rest = m.Array[:]
- return reflect.ValueOf(m)
-}
-
-func TestMarshalUnmarshal(t *testing.T) {
- rand := rand.New(rand.NewSource(0))
- iface := &msgAllTypes{}
- ty := reflect.ValueOf(iface).Type()
-
- n := 100
- if testing.Short() {
- n = 5
- }
- for j := 0; j < n; j++ {
- v, ok := quick.Value(ty, rand)
- if !ok {
- t.Errorf("failed to create value")
- break
- }
-
- m1 := v.Elem().Interface()
- m2 := iface
-
- marshaled := Marshal(m1)
- if err := Unmarshal(marshaled, m2); err != nil {
- t.Errorf("Unmarshal %#v: %s", m1, err)
- break
- }
-
- if !reflect.DeepEqual(v.Interface(), m2) {
- t.Errorf("got: %#v\nwant:%#v\n%x", m2, m1, marshaled)
- break
- }
- }
-}
-
-func TestUnmarshalEmptyPacket(t *testing.T) {
- var b []byte
- var m channelRequestSuccessMsg
- if err := Unmarshal(b, &m); err == nil {
- t.Fatalf("unmarshal of empty slice succeeded")
- }
-}
-
-func TestUnmarshalUnexpectedPacket(t *testing.T) {
- type S struct {
- I uint32 `sshtype:"43"`
- S string
- B bool
- }
-
- s := S{11, "hello", true}
- packet := Marshal(s)
- packet[0] = 42
- roundtrip := S{}
- err := Unmarshal(packet, &roundtrip)
- if err == nil {
- t.Fatal("expected error, not nil")
- }
-}
-
-func TestMarshalPtr(t *testing.T) {
- s := struct {
- S string
- }{"hello"}
-
- m1 := Marshal(s)
- m2 := Marshal(&s)
- if !bytes.Equal(m1, m2) {
- t.Errorf("got %q, want %q for marshaled pointer", m2, m1)
- }
-}
-
-func TestBareMarshalUnmarshal(t *testing.T) {
- type S struct {
- I uint32
- S string
- B bool
- }
-
- s := S{42, "hello", true}
- packet := Marshal(s)
- roundtrip := S{}
- Unmarshal(packet, &roundtrip)
-
- if !reflect.DeepEqual(s, roundtrip) {
- t.Errorf("got %#v, want %#v", roundtrip, s)
- }
-}
-
-func TestBareMarshal(t *testing.T) {
- type S2 struct {
- I uint32
- }
- s := S2{42}
- packet := Marshal(s)
- i, rest, ok := parseUint32(packet)
- if len(rest) > 0 || !ok {
- t.Errorf("parseInt(%q): parse error", packet)
- }
- if i != s.I {
- t.Errorf("got %d, want %d", i, s.I)
- }
-}
-
-func TestUnmarshalShortKexInitPacket(t *testing.T) {
- // This used to panic.
- // Issue 11348
- packet := []byte{0x14, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xff, 0xff, 0xff, 0xff}
- kim := &kexInitMsg{}
- if err := Unmarshal(packet, kim); err == nil {
- t.Error("truncated packet unmarshaled without error")
- }
-}
-
-func randomBytes(out []byte, rand *rand.Rand) {
- for i := 0; i < len(out); i++ {
- out[i] = byte(rand.Int31())
- }
-}
-
-func randomNameList(rand *rand.Rand) []string {
- ret := make([]string, rand.Int31()&15)
- for i := range ret {
- s := make([]byte, 1+(rand.Int31()&15))
- for j := range s {
- s[j] = 'a' + uint8(rand.Int31()&15)
- }
- ret[i] = string(s)
- }
- return ret
-}
-
-func randomInt(rand *rand.Rand) *big.Int {
- return new(big.Int).SetInt64(int64(int32(rand.Uint32())))
-}
-
-func (*kexInitMsg) Generate(rand *rand.Rand, size int) reflect.Value {
- ki := &kexInitMsg{}
- randomBytes(ki.Cookie[:], rand)
- ki.KexAlgos = randomNameList(rand)
- ki.ServerHostKeyAlgos = randomNameList(rand)
- ki.CiphersClientServer = randomNameList(rand)
- ki.CiphersServerClient = randomNameList(rand)
- ki.MACsClientServer = randomNameList(rand)
- ki.MACsServerClient = randomNameList(rand)
- ki.CompressionClientServer = randomNameList(rand)
- ki.CompressionServerClient = randomNameList(rand)
- ki.LanguagesClientServer = randomNameList(rand)
- ki.LanguagesServerClient = randomNameList(rand)
- if rand.Int31()&1 == 1 {
- ki.FirstKexFollows = true
- }
- return reflect.ValueOf(ki)
-}
-
-func (*kexDHInitMsg) Generate(rand *rand.Rand, size int) reflect.Value {
- dhi := &kexDHInitMsg{}
- dhi.X = randomInt(rand)
- return reflect.ValueOf(dhi)
-}
-
-var (
- _kexInitMsg = new(kexInitMsg).Generate(rand.New(rand.NewSource(0)), 10).Elem().Interface()
- _kexDHInitMsg = new(kexDHInitMsg).Generate(rand.New(rand.NewSource(0)), 10).Elem().Interface()
-
- _kexInit = Marshal(_kexInitMsg)
- _kexDHInit = Marshal(_kexDHInitMsg)
-)
-
-func BenchmarkMarshalKexInitMsg(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Marshal(_kexInitMsg)
- }
-}
-
-func BenchmarkUnmarshalKexInitMsg(b *testing.B) {
- m := new(kexInitMsg)
- for i := 0; i < b.N; i++ {
- Unmarshal(_kexInit, m)
- }
-}
-
-func BenchmarkMarshalKexDHInitMsg(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Marshal(_kexDHInitMsg)
- }
-}
-
-func BenchmarkUnmarshalKexDHInitMsg(b *testing.B) {
- m := new(kexDHInitMsg)
- for i := 0; i < b.N; i++ {
- Unmarshal(_kexDHInit, m)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mux_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mux_test.go
deleted file mode 100644
index 523038960f2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/mux_test.go
+++ /dev/null
@@ -1,525 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "io/ioutil"
- "sync"
- "testing"
-)
-
-func muxPair() (*mux, *mux) {
- a, b := memPipe()
-
- s := newMux(a)
- c := newMux(b)
-
- return s, c
-}
-
-// Returns both ends of a channel, and the mux for the the 2nd
-// channel.
-func channelPair(t *testing.T) (*channel, *channel, *mux) {
- c, s := muxPair()
-
- res := make(chan *channel, 1)
- go func() {
- newCh, ok := <-s.incomingChannels
- if !ok {
- t.Fatalf("No incoming channel")
- }
- if newCh.ChannelType() != "chan" {
- t.Fatalf("got type %q want chan", newCh.ChannelType())
- }
- ch, _, err := newCh.Accept()
- if err != nil {
- t.Fatalf("Accept %v", err)
- }
- res <- ch.(*channel)
- }()
-
- ch, err := c.openChannel("chan", nil)
- if err != nil {
- t.Fatalf("OpenChannel: %v", err)
- }
-
- return <-res, ch, c
-}
-
-// Test that stderr and stdout can be addressed from different
-// goroutines. This is intended for use with the race detector.
-func TestMuxChannelExtendedThreadSafety(t *testing.T) {
- writer, reader, mux := channelPair(t)
- defer writer.Close()
- defer reader.Close()
- defer mux.Close()
-
- var wr, rd sync.WaitGroup
- magic := "hello world"
-
- wr.Add(2)
- go func() {
- io.WriteString(writer, magic)
- wr.Done()
- }()
- go func() {
- io.WriteString(writer.Stderr(), magic)
- wr.Done()
- }()
-
- rd.Add(2)
- go func() {
- c, err := ioutil.ReadAll(reader)
- if string(c) != magic {
- t.Fatalf("stdout read got %q, want %q (error %s)", c, magic, err)
- }
- rd.Done()
- }()
- go func() {
- c, err := ioutil.ReadAll(reader.Stderr())
- if string(c) != magic {
- t.Fatalf("stderr read got %q, want %q (error %s)", c, magic, err)
- }
- rd.Done()
- }()
-
- wr.Wait()
- writer.CloseWrite()
- rd.Wait()
-}
-
-func TestMuxReadWrite(t *testing.T) {
- s, c, mux := channelPair(t)
- defer s.Close()
- defer c.Close()
- defer mux.Close()
-
- magic := "hello world"
- magicExt := "hello stderr"
- go func() {
- _, err := s.Write([]byte(magic))
- if err != nil {
- t.Fatalf("Write: %v", err)
- }
- _, err = s.Extended(1).Write([]byte(magicExt))
- if err != nil {
- t.Fatalf("Write: %v", err)
- }
- err = s.Close()
- if err != nil {
- t.Fatalf("Close: %v", err)
- }
- }()
-
- var buf [1024]byte
- n, err := c.Read(buf[:])
- if err != nil {
- t.Fatalf("server Read: %v", err)
- }
- got := string(buf[:n])
- if got != magic {
- t.Fatalf("server: got %q want %q", got, magic)
- }
-
- n, err = c.Extended(1).Read(buf[:])
- if err != nil {
- t.Fatalf("server Read: %v", err)
- }
-
- got = string(buf[:n])
- if got != magicExt {
- t.Fatalf("server: got %q want %q", got, magic)
- }
-}
-
-func TestMuxChannelOverflow(t *testing.T) {
- reader, writer, mux := channelPair(t)
- defer reader.Close()
- defer writer.Close()
- defer mux.Close()
-
- wDone := make(chan int, 1)
- go func() {
- if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil {
- t.Errorf("could not fill window: %v", err)
- }
- writer.Write(make([]byte, 1))
- wDone <- 1
- }()
- writer.remoteWin.waitWriterBlocked()
-
- // Send 1 byte.
- packet := make([]byte, 1+4+4+1)
- packet[0] = msgChannelData
- marshalUint32(packet[1:], writer.remoteId)
- marshalUint32(packet[5:], uint32(1))
- packet[9] = 42
-
- if err := writer.mux.conn.writePacket(packet); err != nil {
- t.Errorf("could not send packet")
- }
- if _, err := reader.SendRequest("hello", true, nil); err == nil {
- t.Errorf("SendRequest succeeded.")
- }
- <-wDone
-}
-
-func TestMuxChannelCloseWriteUnblock(t *testing.T) {
- reader, writer, mux := channelPair(t)
- defer reader.Close()
- defer writer.Close()
- defer mux.Close()
-
- wDone := make(chan int, 1)
- go func() {
- if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil {
- t.Errorf("could not fill window: %v", err)
- }
- if _, err := writer.Write(make([]byte, 1)); err != io.EOF {
- t.Errorf("got %v, want EOF for unblock write", err)
- }
- wDone <- 1
- }()
-
- writer.remoteWin.waitWriterBlocked()
- reader.Close()
- <-wDone
-}
-
-func TestMuxConnectionCloseWriteUnblock(t *testing.T) {
- reader, writer, mux := channelPair(t)
- defer reader.Close()
- defer writer.Close()
- defer mux.Close()
-
- wDone := make(chan int, 1)
- go func() {
- if _, err := writer.Write(make([]byte, channelWindowSize)); err != nil {
- t.Errorf("could not fill window: %v", err)
- }
- if _, err := writer.Write(make([]byte, 1)); err != io.EOF {
- t.Errorf("got %v, want EOF for unblock write", err)
- }
- wDone <- 1
- }()
-
- writer.remoteWin.waitWriterBlocked()
- mux.Close()
- <-wDone
-}
-
-func TestMuxReject(t *testing.T) {
- client, server := muxPair()
- defer server.Close()
- defer client.Close()
-
- go func() {
- ch, ok := <-server.incomingChannels
- if !ok {
- t.Fatalf("Accept")
- }
- if ch.ChannelType() != "ch" || string(ch.ExtraData()) != "extra" {
- t.Fatalf("unexpected channel: %q, %q", ch.ChannelType(), ch.ExtraData())
- }
- ch.Reject(RejectionReason(42), "message")
- }()
-
- ch, err := client.openChannel("ch", []byte("extra"))
- if ch != nil {
- t.Fatal("openChannel not rejected")
- }
-
- ocf, ok := err.(*OpenChannelError)
- if !ok {
- t.Errorf("got %#v want *OpenChannelError", err)
- } else if ocf.Reason != 42 || ocf.Message != "message" {
- t.Errorf("got %#v, want {Reason: 42, Message: %q}", ocf, "message")
- }
-
- want := "ssh: rejected: unknown reason 42 (message)"
- if err.Error() != want {
- t.Errorf("got %q, want %q", err.Error(), want)
- }
-}
-
-func TestMuxChannelRequest(t *testing.T) {
- client, server, mux := channelPair(t)
- defer server.Close()
- defer client.Close()
- defer mux.Close()
-
- var received int
- var wg sync.WaitGroup
- wg.Add(1)
- go func() {
- for r := range server.incomingRequests {
- received++
- r.Reply(r.Type == "yes", nil)
- }
- wg.Done()
- }()
- _, err := client.SendRequest("yes", false, nil)
- if err != nil {
- t.Fatalf("SendRequest: %v", err)
- }
- ok, err := client.SendRequest("yes", true, nil)
- if err != nil {
- t.Fatalf("SendRequest: %v", err)
- }
-
- if !ok {
- t.Errorf("SendRequest(yes): %v", ok)
-
- }
-
- ok, err = client.SendRequest("no", true, nil)
- if err != nil {
- t.Fatalf("SendRequest: %v", err)
- }
- if ok {
- t.Errorf("SendRequest(no): %v", ok)
-
- }
-
- client.Close()
- wg.Wait()
-
- if received != 3 {
- t.Errorf("got %d requests, want %d", received, 3)
- }
-}
-
-func TestMuxGlobalRequest(t *testing.T) {
- clientMux, serverMux := muxPair()
- defer serverMux.Close()
- defer clientMux.Close()
-
- var seen bool
- go func() {
- for r := range serverMux.incomingRequests {
- seen = seen || r.Type == "peek"
- if r.WantReply {
- err := r.Reply(r.Type == "yes",
- append([]byte(r.Type), r.Payload...))
- if err != nil {
- t.Errorf("AckRequest: %v", err)
- }
- }
- }
- }()
-
- _, _, err := clientMux.SendRequest("peek", false, nil)
- if err != nil {
- t.Errorf("SendRequest: %v", err)
- }
-
- ok, data, err := clientMux.SendRequest("yes", true, []byte("a"))
- if !ok || string(data) != "yesa" || err != nil {
- t.Errorf("SendRequest(\"yes\", true, \"a\"): %v %v %v",
- ok, data, err)
- }
- if ok, data, err := clientMux.SendRequest("yes", true, []byte("a")); !ok || string(data) != "yesa" || err != nil {
- t.Errorf("SendRequest(\"yes\", true, \"a\"): %v %v %v",
- ok, data, err)
- }
-
- if ok, data, err := clientMux.SendRequest("no", true, []byte("a")); ok || string(data) != "noa" || err != nil {
- t.Errorf("SendRequest(\"no\", true, \"a\"): %v %v %v",
- ok, data, err)
- }
-
- clientMux.Disconnect(0, "")
- if !seen {
- t.Errorf("never saw 'peek' request")
- }
-}
-
-func TestMuxGlobalRequestUnblock(t *testing.T) {
- clientMux, serverMux := muxPair()
- defer serverMux.Close()
- defer clientMux.Close()
-
- result := make(chan error, 1)
- go func() {
- _, _, err := clientMux.SendRequest("hello", true, nil)
- result <- err
- }()
-
- <-serverMux.incomingRequests
- serverMux.conn.Close()
- err := <-result
-
- if err != io.EOF {
- t.Errorf("want EOF, got %v", io.EOF)
- }
-}
-
-func TestMuxChannelRequestUnblock(t *testing.T) {
- a, b, connB := channelPair(t)
- defer a.Close()
- defer b.Close()
- defer connB.Close()
-
- result := make(chan error, 1)
- go func() {
- _, err := a.SendRequest("hello", true, nil)
- result <- err
- }()
-
- <-b.incomingRequests
- connB.conn.Close()
- err := <-result
-
- if err != io.EOF {
- t.Errorf("want EOF, got %v", err)
- }
-}
-
-func TestMuxDisconnect(t *testing.T) {
- a, b := muxPair()
- defer a.Close()
- defer b.Close()
-
- go func() {
- for r := range b.incomingRequests {
- r.Reply(true, nil)
- }
- }()
-
- a.Disconnect(42, "whatever")
- ok, _, err := a.SendRequest("hello", true, nil)
- if ok || err == nil {
- t.Errorf("got reply after disconnecting")
- }
- err = b.Wait()
- if d, ok := err.(*disconnectMsg); !ok || d.Reason != 42 {
- t.Errorf("got %#v, want disconnectMsg{Reason:42}", err)
- }
-}
-
-func TestMuxCloseChannel(t *testing.T) {
- r, w, mux := channelPair(t)
- defer mux.Close()
- defer r.Close()
- defer w.Close()
-
- result := make(chan error, 1)
- go func() {
- var b [1024]byte
- _, err := r.Read(b[:])
- result <- err
- }()
- if err := w.Close(); err != nil {
- t.Errorf("w.Close: %v", err)
- }
-
- if _, err := w.Write([]byte("hello")); err != io.EOF {
- t.Errorf("got err %v, want io.EOF after Close", err)
- }
-
- if err := <-result; err != io.EOF {
- t.Errorf("got %v (%T), want io.EOF", err, err)
- }
-}
-
-func TestMuxCloseWriteChannel(t *testing.T) {
- r, w, mux := channelPair(t)
- defer mux.Close()
-
- result := make(chan error, 1)
- go func() {
- var b [1024]byte
- _, err := r.Read(b[:])
- result <- err
- }()
- if err := w.CloseWrite(); err != nil {
- t.Errorf("w.CloseWrite: %v", err)
- }
-
- if _, err := w.Write([]byte("hello")); err != io.EOF {
- t.Errorf("got err %v, want io.EOF after CloseWrite", err)
- }
-
- if err := <-result; err != io.EOF {
- t.Errorf("got %v (%T), want io.EOF", err, err)
- }
-}
-
-func TestMuxInvalidRecord(t *testing.T) {
- a, b := muxPair()
- defer a.Close()
- defer b.Close()
-
- packet := make([]byte, 1+4+4+1)
- packet[0] = msgChannelData
- marshalUint32(packet[1:], 29348723 /* invalid channel id */)
- marshalUint32(packet[5:], 1)
- packet[9] = 42
-
- a.conn.writePacket(packet)
- go a.SendRequest("hello", false, nil)
- // 'a' wrote an invalid packet, so 'b' has exited.
- req, ok := <-b.incomingRequests
- if ok {
- t.Errorf("got request %#v after receiving invalid packet", req)
- }
-}
-
-func TestZeroWindowAdjust(t *testing.T) {
- a, b, mux := channelPair(t)
- defer a.Close()
- defer b.Close()
- defer mux.Close()
-
- go func() {
- io.WriteString(a, "hello")
- // bogus adjust.
- a.sendMessage(windowAdjustMsg{})
- io.WriteString(a, "world")
- a.Close()
- }()
-
- want := "helloworld"
- c, _ := ioutil.ReadAll(b)
- if string(c) != want {
- t.Errorf("got %q want %q", c, want)
- }
-}
-
-func TestMuxMaxPacketSize(t *testing.T) {
- a, b, mux := channelPair(t)
- defer a.Close()
- defer b.Close()
- defer mux.Close()
-
- large := make([]byte, a.maxRemotePayload+1)
- packet := make([]byte, 1+4+4+1+len(large))
- packet[0] = msgChannelData
- marshalUint32(packet[1:], a.remoteId)
- marshalUint32(packet[5:], uint32(len(large)))
- packet[9] = 42
-
- if err := a.mux.conn.writePacket(packet); err != nil {
- t.Errorf("could not send packet")
- }
-
- go a.SendRequest("hello", false, nil)
-
- _, ok := <-b.incomingRequests
- if ok {
- t.Errorf("connection still alive after receiving large packet.")
- }
-}
-
-// Don't ship code with debug=true.
-func TestDebug(t *testing.T) {
- if debugMux {
- t.Error("mux debug switched on")
- }
- if debugHandshake {
- t.Error("handshake debug switched on")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/session_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/session_test.go
deleted file mode 100644
index f7f0f7642e7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/session_test.go
+++ /dev/null
@@ -1,774 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Session tests.
-
-import (
- "bytes"
- crypto_rand "crypto/rand"
- "errors"
- "io"
- "io/ioutil"
- "math/rand"
- "net"
- "testing"
-
- "golang.org/x/crypto/ssh/terminal"
-)
-
-type serverType func(Channel, <-chan *Request, *testing.T)
-
-// dial constructs a new test server and returns a *ClientConn.
-func dial(handler serverType, t *testing.T) *Client {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
-
- go func() {
- defer c1.Close()
- conf := ServerConfig{
- NoClientAuth: true,
- }
- conf.AddHostKey(testSigners["rsa"])
-
- _, chans, reqs, err := NewServerConn(c1, &conf)
- if err != nil {
- t.Fatalf("Unable to handshake: %v", err)
- }
- go DiscardRequests(reqs)
-
- for newCh := range chans {
- if newCh.ChannelType() != "session" {
- newCh.Reject(UnknownChannelType, "unknown channel type")
- continue
- }
-
- ch, inReqs, err := newCh.Accept()
- if err != nil {
- t.Errorf("Accept: %v", err)
- continue
- }
- go func() {
- handler(ch, inReqs, t)
- }()
- }
- }()
-
- config := &ClientConfig{
- User: "testuser",
- }
-
- conn, chans, reqs, err := NewClientConn(c2, "", config)
- if err != nil {
- t.Fatalf("unable to dial remote side: %v", err)
- }
-
- return NewClient(conn, chans, reqs)
-}
-
-// Test a simple string is returned to session.Stdout.
-func TestSessionShell(t *testing.T) {
- conn := dial(shellHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- stdout := new(bytes.Buffer)
- session.Stdout = stdout
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %s", err)
- }
- if err := session.Wait(); err != nil {
- t.Fatalf("Remote command did not exit cleanly: %v", err)
- }
- actual := stdout.String()
- if actual != "golang" {
- t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual)
- }
-}
-
-// TODO(dfc) add support for Std{in,err}Pipe when the Server supports it.
-
-// Test a simple string is returned via StdoutPipe.
-func TestSessionStdoutPipe(t *testing.T) {
- conn := dial(shellHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("Unable to request StdoutPipe(): %v", err)
- }
- var buf bytes.Buffer
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- done := make(chan bool, 1)
- go func() {
- if _, err := io.Copy(&buf, stdout); err != nil {
- t.Errorf("Copy of stdout failed: %v", err)
- }
- done <- true
- }()
- if err := session.Wait(); err != nil {
- t.Fatalf("Remote command did not exit cleanly: %v", err)
- }
- <-done
- actual := buf.String()
- if actual != "golang" {
- t.Fatalf("Remote shell did not return expected string: expected=golang, actual=%s", actual)
- }
-}
-
-// Test that a simple string is returned via the Output helper,
-// and that stderr is discarded.
-func TestSessionOutput(t *testing.T) {
- conn := dial(fixedOutputHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
-
- buf, err := session.Output("") // cmd is ignored by fixedOutputHandler
- if err != nil {
- t.Error("Remote command did not exit cleanly:", err)
- }
- w := "this-is-stdout."
- g := string(buf)
- if g != w {
- t.Error("Remote command did not return expected string:")
- t.Logf("want %q", w)
- t.Logf("got %q", g)
- }
-}
-
-// Test that both stdout and stderr are returned
-// via the CombinedOutput helper.
-func TestSessionCombinedOutput(t *testing.T) {
- conn := dial(fixedOutputHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
-
- buf, err := session.CombinedOutput("") // cmd is ignored by fixedOutputHandler
- if err != nil {
- t.Error("Remote command did not exit cleanly:", err)
- }
- const stdout = "this-is-stdout."
- const stderr = "this-is-stderr."
- g := string(buf)
- if g != stdout+stderr && g != stderr+stdout {
- t.Error("Remote command did not return expected string:")
- t.Logf("want %q, or %q", stdout+stderr, stderr+stdout)
- t.Logf("got %q", g)
- }
-}
-
-// Test non-0 exit status is returned correctly.
-func TestExitStatusNonZero(t *testing.T) {
- conn := dial(exitStatusNonZeroHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.ExitStatus() != 15 {
- t.Fatalf("expected command to exit with 15 but got %v", e.ExitStatus())
- }
-}
-
-// Test 0 exit status is returned correctly.
-func TestExitStatusZero(t *testing.T) {
- conn := dial(exitStatusZeroHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
-
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err != nil {
- t.Fatalf("expected nil but got %v", err)
- }
-}
-
-// Test exit signal and status are both returned correctly.
-func TestExitSignalAndStatus(t *testing.T) {
- conn := dial(exitSignalAndStatusHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.Signal() != "TERM" || e.ExitStatus() != 15 {
- t.Fatalf("expected command to exit with signal TERM and status 15 but got signal %s and status %v", e.Signal(), e.ExitStatus())
- }
-}
-
-// Test exit signal and status are both returned correctly.
-func TestKnownExitSignalOnly(t *testing.T) {
- conn := dial(exitSignalHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.Signal() != "TERM" || e.ExitStatus() != 143 {
- t.Fatalf("expected command to exit with signal TERM and status 143 but got signal %s and status %v", e.Signal(), e.ExitStatus())
- }
-}
-
-// Test exit signal and status are both returned correctly.
-func TestUnknownExitSignal(t *testing.T) {
- conn := dial(exitSignalUnknownHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- e, ok := err.(*ExitError)
- if !ok {
- t.Fatalf("expected *ExitError but got %T", err)
- }
- if e.Signal() != "SYS" || e.ExitStatus() != 128 {
- t.Fatalf("expected command to exit with signal SYS and status 128 but got signal %s and status %v", e.Signal(), e.ExitStatus())
- }
-}
-
-// Test WaitMsg is not returned if the channel closes abruptly.
-func TestExitWithoutStatusOrSignal(t *testing.T) {
- conn := dial(exitWithoutSignalOrStatus, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("Unable to request new session: %v", err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err == nil {
- t.Fatalf("expected command to fail but it didn't")
- }
- _, ok := err.(*ExitError)
- if ok {
- // you can't actually test for errors.errorString
- // because it's not exported.
- t.Fatalf("expected *errorString but got %T", err)
- }
-}
-
-// windowTestBytes is the number of bytes that we'll send to the SSH server.
-const windowTestBytes = 16000 * 200
-
-// TestServerWindow writes random data to the server. The server is expected to echo
-// the same data back, which is compared against the original.
-func TestServerWindow(t *testing.T) {
- origBuf := bytes.NewBuffer(make([]byte, 0, windowTestBytes))
- io.CopyN(origBuf, crypto_rand.Reader, windowTestBytes)
- origBytes := origBuf.Bytes()
-
- conn := dial(echoHandler, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatal(err)
- }
- defer session.Close()
- result := make(chan []byte)
-
- go func() {
- defer close(result)
- echoedBuf := bytes.NewBuffer(make([]byte, 0, windowTestBytes))
- serverStdout, err := session.StdoutPipe()
- if err != nil {
- t.Errorf("StdoutPipe failed: %v", err)
- return
- }
- n, err := copyNRandomly("stdout", echoedBuf, serverStdout, windowTestBytes)
- if err != nil && err != io.EOF {
- t.Errorf("Read only %d bytes from server, expected %d: %v", n, windowTestBytes, err)
- }
- result <- echoedBuf.Bytes()
- }()
-
- serverStdin, err := session.StdinPipe()
- if err != nil {
- t.Fatalf("StdinPipe failed: %v", err)
- }
- written, err := copyNRandomly("stdin", serverStdin, origBuf, windowTestBytes)
- if err != nil {
- t.Fatalf("failed to copy origBuf to serverStdin: %v", err)
- }
- if written != windowTestBytes {
- t.Fatalf("Wrote only %d of %d bytes to server", written, windowTestBytes)
- }
-
- echoedBytes := <-result
-
- if !bytes.Equal(origBytes, echoedBytes) {
- t.Fatalf("Echoed buffer differed from original, orig %d, echoed %d", len(origBytes), len(echoedBytes))
- }
-}
-
-// Verify the client can handle a keepalive packet from the server.
-func TestClientHandlesKeepalives(t *testing.T) {
- conn := dial(channelKeepaliveSender, t)
- defer conn.Close()
- session, err := conn.NewSession()
- if err != nil {
- t.Fatal(err)
- }
- defer session.Close()
- if err := session.Shell(); err != nil {
- t.Fatalf("Unable to execute command: %v", err)
- }
- err = session.Wait()
- if err != nil {
- t.Fatalf("expected nil but got: %v", err)
- }
-}
-
-type exitStatusMsg struct {
- Status uint32
-}
-
-type exitSignalMsg struct {
- Signal string
- CoreDumped bool
- Errmsg string
- Lang string
-}
-
-func handleTerminalRequests(in <-chan *Request) {
- for req := range in {
- ok := false
- switch req.Type {
- case "shell":
- ok = true
- if len(req.Payload) > 0 {
- // We don't accept any commands, only the default shell.
- ok = false
- }
- case "env":
- ok = true
- }
- req.Reply(ok, nil)
- }
-}
-
-func newServerShell(ch Channel, in <-chan *Request, prompt string) *terminal.Terminal {
- term := terminal.NewTerminal(ch, prompt)
- go handleTerminalRequests(in)
- return term
-}
-
-func exitStatusZeroHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- // this string is returned to stdout
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendStatus(0, ch, t)
-}
-
-func exitStatusNonZeroHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendStatus(15, ch, t)
-}
-
-func exitSignalAndStatusHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendStatus(15, ch, t)
- sendSignal("TERM", ch, t)
-}
-
-func exitSignalHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendSignal("TERM", ch, t)
-}
-
-func exitSignalUnknownHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- sendSignal("SYS", ch, t)
-}
-
-func exitWithoutSignalOrStatus(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
-}
-
-func shellHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- // this string is returned to stdout
- shell := newServerShell(ch, in, "golang")
- readLine(shell, t)
- sendStatus(0, ch, t)
-}
-
-// Ignores the command, writes fixed strings to stderr and stdout.
-// Strings are "this-is-stdout." and "this-is-stderr.".
-func fixedOutputHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- _, err := ch.Read(nil)
-
- req, ok := <-in
- if !ok {
- t.Fatalf("error: expected channel request, got: %#v", err)
- return
- }
-
- // ignore request, always send some text
- req.Reply(true, nil)
-
- _, err = io.WriteString(ch, "this-is-stdout.")
- if err != nil {
- t.Fatalf("error writing on server: %v", err)
- }
- _, err = io.WriteString(ch.Stderr(), "this-is-stderr.")
- if err != nil {
- t.Fatalf("error writing on server: %v", err)
- }
- sendStatus(0, ch, t)
-}
-
-func readLine(shell *terminal.Terminal, t *testing.T) {
- if _, err := shell.ReadLine(); err != nil && err != io.EOF {
- t.Errorf("unable to read line: %v", err)
- }
-}
-
-func sendStatus(status uint32, ch Channel, t *testing.T) {
- msg := exitStatusMsg{
- Status: status,
- }
- if _, err := ch.SendRequest("exit-status", false, Marshal(&msg)); err != nil {
- t.Errorf("unable to send status: %v", err)
- }
-}
-
-func sendSignal(signal string, ch Channel, t *testing.T) {
- sig := exitSignalMsg{
- Signal: signal,
- CoreDumped: false,
- Errmsg: "Process terminated",
- Lang: "en-GB-oed",
- }
- if _, err := ch.SendRequest("exit-signal", false, Marshal(&sig)); err != nil {
- t.Errorf("unable to send signal: %v", err)
- }
-}
-
-func discardHandler(ch Channel, t *testing.T) {
- defer ch.Close()
- io.Copy(ioutil.Discard, ch)
-}
-
-func echoHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- if n, err := copyNRandomly("echohandler", ch, ch, windowTestBytes); err != nil {
- t.Errorf("short write, wrote %d, expected %d: %v ", n, windowTestBytes, err)
- }
-}
-
-// copyNRandomly copies n bytes from src to dst. It uses a variable, and random,
-// buffer size to exercise more code paths.
-func copyNRandomly(title string, dst io.Writer, src io.Reader, n int) (int, error) {
- var (
- buf = make([]byte, 32*1024)
- written int
- remaining = n
- )
- for remaining > 0 {
- l := rand.Intn(1 << 15)
- if remaining < l {
- l = remaining
- }
- nr, er := src.Read(buf[:l])
- nw, ew := dst.Write(buf[:nr])
- remaining -= nw
- written += nw
- if ew != nil {
- return written, ew
- }
- if nr != nw {
- return written, io.ErrShortWrite
- }
- if er != nil && er != io.EOF {
- return written, er
- }
- }
- return written, nil
-}
-
-func channelKeepaliveSender(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- shell := newServerShell(ch, in, "> ")
- readLine(shell, t)
- if _, err := ch.SendRequest("keepalive@openssh.com", true, nil); err != nil {
- t.Errorf("unable to send channel keepalive request: %v", err)
- }
- sendStatus(0, ch, t)
-}
-
-func TestClientWriteEOF(t *testing.T) {
- conn := dial(simpleEchoHandler, t)
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatal(err)
- }
- defer session.Close()
- stdin, err := session.StdinPipe()
- if err != nil {
- t.Fatalf("StdinPipe failed: %v", err)
- }
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("StdoutPipe failed: %v", err)
- }
-
- data := []byte(`0000`)
- _, err = stdin.Write(data)
- if err != nil {
- t.Fatalf("Write failed: %v", err)
- }
- stdin.Close()
-
- res, err := ioutil.ReadAll(stdout)
- if err != nil {
- t.Fatalf("Read failed: %v", err)
- }
-
- if !bytes.Equal(data, res) {
- t.Fatalf("Read differed from write, wrote: %v, read: %v", data, res)
- }
-}
-
-func simpleEchoHandler(ch Channel, in <-chan *Request, t *testing.T) {
- defer ch.Close()
- data, err := ioutil.ReadAll(ch)
- if err != nil {
- t.Errorf("handler read error: %v", err)
- }
- _, err = ch.Write(data)
- if err != nil {
- t.Errorf("handler write error: %v", err)
- }
-}
-
-func TestSessionID(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- serverID := make(chan []byte, 1)
- clientID := make(chan []byte, 1)
-
- serverConf := &ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["ecdsa"])
- clientConf := &ClientConfig{
- User: "user",
- }
-
- go func() {
- conn, chans, reqs, err := NewServerConn(c1, serverConf)
- if err != nil {
- t.Fatalf("server handshake: %v", err)
- }
- serverID <- conn.SessionID()
- go DiscardRequests(reqs)
- for ch := range chans {
- ch.Reject(Prohibited, "")
- }
- }()
-
- go func() {
- conn, chans, reqs, err := NewClientConn(c2, "", clientConf)
- if err != nil {
- t.Fatalf("client handshake: %v", err)
- }
- clientID <- conn.SessionID()
- go DiscardRequests(reqs)
- for ch := range chans {
- ch.Reject(Prohibited, "")
- }
- }()
-
- s := <-serverID
- c := <-clientID
- if bytes.Compare(s, c) != 0 {
- t.Errorf("server session ID (%x) != client session ID (%x)", s, c)
- } else if len(s) == 0 {
- t.Errorf("client and server SessionID were empty.")
- }
-}
-
-type noReadConn struct {
- readSeen bool
- net.Conn
-}
-
-func (c *noReadConn) Close() error {
- return nil
-}
-
-func (c *noReadConn) Read(b []byte) (int, error) {
- c.readSeen = true
- return 0, errors.New("noReadConn error")
-}
-
-func TestInvalidServerConfiguration(t *testing.T) {
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- serveConn := noReadConn{Conn: c1}
- serverConf := &ServerConfig{}
-
- NewServerConn(&serveConn, serverConf)
- if serveConn.readSeen {
- t.Fatalf("NewServerConn attempted to Read() from Conn while configuration is missing host key")
- }
-
- serverConf.AddHostKey(testSigners["ecdsa"])
-
- NewServerConn(&serveConn, serverConf)
- if serveConn.readSeen {
- t.Fatalf("NewServerConn attempted to Read() from Conn while configuration is missing authentication method")
- }
-}
-
-func TestHostKeyAlgorithms(t *testing.T) {
- serverConf := &ServerConfig{
- NoClientAuth: true,
- }
- serverConf.AddHostKey(testSigners["rsa"])
- serverConf.AddHostKey(testSigners["ecdsa"])
-
- connect := func(clientConf *ClientConfig, want string) {
- var alg string
- clientConf.HostKeyCallback = func(h string, a net.Addr, key PublicKey) error {
- alg = key.Type()
- return nil
- }
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewServerConn(c1, serverConf)
- _, _, _, err = NewClientConn(c2, "", clientConf)
- if err != nil {
- t.Fatalf("NewClientConn: %v", err)
- }
- if alg != want {
- t.Errorf("selected key algorithm %s, want %s", alg, want)
- }
- }
-
- // By default, we get the preferred algorithm, which is ECDSA 256.
-
- clientConf := &ClientConfig{}
- connect(clientConf, KeyAlgoECDSA256)
-
- // Client asks for RSA explicitly.
- clientConf.HostKeyAlgorithms = []string{KeyAlgoRSA}
- connect(clientConf, KeyAlgoRSA)
-
- c1, c2, err := netPipe()
- if err != nil {
- t.Fatalf("netPipe: %v", err)
- }
- defer c1.Close()
- defer c2.Close()
-
- go NewServerConn(c1, serverConf)
- clientConf.HostKeyAlgorithms = []string{"nonexistent-hostkey-algo"}
- _, _, _, err = NewClientConn(c2, "", clientConf)
- if err == nil {
- t.Fatal("succeeded connecting with unknown hostkey algorithm")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/tcpip_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/tcpip_test.go
deleted file mode 100644
index f1265cb4964..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/tcpip_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "testing"
-)
-
-func TestAutoPortListenBroken(t *testing.T) {
- broken := "SSH-2.0-OpenSSH_5.9hh11"
- works := "SSH-2.0-OpenSSH_6.1"
- if !isBrokenOpenSSHVersion(broken) {
- t.Errorf("version %q not marked as broken", broken)
- }
- if isBrokenOpenSSHVersion(works) {
- t.Errorf("version %q marked as broken", works)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go
deleted file mode 100644
index a663fe41b77..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/terminal/terminal_test.go
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package terminal
-
-import (
- "io"
- "testing"
-)
-
-type MockTerminal struct {
- toSend []byte
- bytesPerRead int
- received []byte
-}
-
-func (c *MockTerminal) Read(data []byte) (n int, err error) {
- n = len(data)
- if n == 0 {
- return
- }
- if n > len(c.toSend) {
- n = len(c.toSend)
- }
- if n == 0 {
- return 0, io.EOF
- }
- if c.bytesPerRead > 0 && n > c.bytesPerRead {
- n = c.bytesPerRead
- }
- copy(data, c.toSend[:n])
- c.toSend = c.toSend[n:]
- return
-}
-
-func (c *MockTerminal) Write(data []byte) (n int, err error) {
- c.received = append(c.received, data...)
- return len(data), nil
-}
-
-func TestClose(t *testing.T) {
- c := &MockTerminal{}
- ss := NewTerminal(c, "> ")
- line, err := ss.ReadLine()
- if line != "" {
- t.Errorf("Expected empty line but got: %s", line)
- }
- if err != io.EOF {
- t.Errorf("Error should have been EOF but got: %s", err)
- }
-}
-
-var keyPressTests = []struct {
- in string
- line string
- err error
- throwAwayLines int
-}{
- {
- err: io.EOF,
- },
- {
- in: "\r",
- line: "",
- },
- {
- in: "foo\r",
- line: "foo",
- },
- {
- in: "a\x1b[Cb\r", // right
- line: "ab",
- },
- {
- in: "a\x1b[Db\r", // left
- line: "ba",
- },
- {
- in: "a\177b\r", // backspace
- line: "b",
- },
- {
- in: "\x1b[A\r", // up
- },
- {
- in: "\x1b[B\r", // down
- },
- {
- in: "line\x1b[A\x1b[B\r", // up then down
- line: "line",
- },
- {
- in: "line1\rline2\x1b[A\r", // recall previous line.
- line: "line1",
- throwAwayLines: 1,
- },
- {
- // recall two previous lines and append.
- in: "line1\rline2\rline3\x1b[A\x1b[Axxx\r",
- line: "line1xxx",
- throwAwayLines: 2,
- },
- {
- // Ctrl-A to move to beginning of line followed by ^K to kill
- // line.
- in: "a b \001\013\r",
- line: "",
- },
- {
- // Ctrl-A to move to beginning of line, Ctrl-E to move to end,
- // finally ^K to kill nothing.
- in: "a b \001\005\013\r",
- line: "a b ",
- },
- {
- in: "\027\r",
- line: "",
- },
- {
- in: "a\027\r",
- line: "",
- },
- {
- in: "a \027\r",
- line: "",
- },
- {
- in: "a b\027\r",
- line: "a ",
- },
- {
- in: "a b \027\r",
- line: "a ",
- },
- {
- in: "one two thr\x1b[D\027\r",
- line: "one two r",
- },
- {
- in: "\013\r",
- line: "",
- },
- {
- in: "a\013\r",
- line: "a",
- },
- {
- in: "ab\x1b[D\013\r",
- line: "a",
- },
- {
- in: "Ξεσκεπάζω\r",
- line: "Ξεσκεπάζω",
- },
- {
- in: "£\r\x1b[A\177\r", // non-ASCII char, enter, up, backspace.
- line: "",
- throwAwayLines: 1,
- },
- {
- in: "£\r££\x1b[A\x1b[B\177\r", // non-ASCII char, enter, 2x non-ASCII, up, down, backspace, enter.
- line: "£",
- throwAwayLines: 1,
- },
- {
- // Ctrl-D at the end of the line should be ignored.
- in: "a\004\r",
- line: "a",
- },
- {
- // a, b, left, Ctrl-D should erase the b.
- in: "ab\x1b[D\004\r",
- line: "a",
- },
- {
- // a, b, c, d, left, left, ^U should erase to the beginning of
- // the line.
- in: "abcd\x1b[D\x1b[D\025\r",
- line: "cd",
- },
- {
- // Bracketed paste mode: control sequences should be returned
- // verbatim in paste mode.
- in: "abc\x1b[200~de\177f\x1b[201~\177\r",
- line: "abcde\177",
- },
- {
- // Enter in bracketed paste mode should still work.
- in: "abc\x1b[200~d\refg\x1b[201~h\r",
- line: "efgh",
- throwAwayLines: 1,
- },
- {
- // Lines consisting entirely of pasted data should be indicated as such.
- in: "\x1b[200~a\r",
- line: "a",
- err: ErrPasteIndicator,
- },
-}
-
-func TestKeyPresses(t *testing.T) {
- for i, test := range keyPressTests {
- for j := 1; j < len(test.in); j++ {
- c := &MockTerminal{
- toSend: []byte(test.in),
- bytesPerRead: j,
- }
- ss := NewTerminal(c, "> ")
- for k := 0; k < test.throwAwayLines; k++ {
- _, err := ss.ReadLine()
- if err != nil {
- t.Errorf("Throwaway line %d from test %d resulted in error: %s", k, i, err)
- }
- }
- line, err := ss.ReadLine()
- if line != test.line {
- t.Errorf("Line resulting from test %d (%d bytes per read) was '%s', expected '%s'", i, j, line, test.line)
- break
- }
- if err != test.err {
- t.Errorf("Error resulting from test %d (%d bytes per read) was '%v', expected '%v'", i, j, err, test.err)
- break
- }
- }
- }
-}
-
-func TestPasswordNotSaved(t *testing.T) {
- c := &MockTerminal{
- toSend: []byte("password\r\x1b[A\r"),
- bytesPerRead: 1,
- }
- ss := NewTerminal(c, "> ")
- pw, _ := ss.ReadPassword("> ")
- if pw != "password" {
- t.Fatalf("failed to read password, got %s", pw)
- }
- line, _ := ss.ReadLine()
- if len(line) > 0 {
- t.Fatalf("password was saved in history")
- }
-}
-
-var setSizeTests = []struct {
- width, height int
-}{
- {40, 13},
- {80, 24},
- {132, 43},
-}
-
-func TestTerminalSetSize(t *testing.T) {
- for _, setSize := range setSizeTests {
- c := &MockTerminal{
- toSend: []byte("password\r\x1b[A\r"),
- bytesPerRead: 1,
- }
- ss := NewTerminal(c, "> ")
- ss.SetSize(setSize.width, setSize.height)
- pw, _ := ss.ReadPassword("Password: ")
- if pw != "password" {
- t.Fatalf("failed to read password, got %s", pw)
- }
- if string(c.received) != "Password: \r\n" {
- t.Errorf("failed to set the temporary prompt expected %q, got %q", "Password: ", c.received)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go
deleted file mode 100644
index f481253c9eb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/agent_unix_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd
-
-package test
-
-import (
- "bytes"
- "testing"
-
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/agent"
-)
-
-func TestAgentForward(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- keyring := agent.NewKeyring()
- if err := keyring.Add(agent.AddedKey{PrivateKey: testPrivateKeys["dsa"]}); err != nil {
- t.Fatalf("Error adding key: %s", err)
- }
- if err := keyring.Add(agent.AddedKey{
- PrivateKey: testPrivateKeys["dsa"],
- ConfirmBeforeUse: true,
- LifetimeSecs: 3600,
- }); err != nil {
- t.Fatalf("Error adding key with constraints: %s", err)
- }
- pub := testPublicKeys["dsa"]
-
- sess, err := conn.NewSession()
- if err != nil {
- t.Fatalf("NewSession: %v", err)
- }
- if err := agent.RequestAgentForwarding(sess); err != nil {
- t.Fatalf("RequestAgentForwarding: %v", err)
- }
-
- if err := agent.ForwardToAgent(conn, keyring); err != nil {
- t.Fatalf("SetupForwardKeyring: %v", err)
- }
- out, err := sess.CombinedOutput("ssh-add -L")
- if err != nil {
- t.Fatalf("running ssh-add: %v, out %s", err, out)
- }
- key, _, _, _, err := ssh.ParseAuthorizedKey(out)
- if err != nil {
- t.Fatalf("ParseAuthorizedKey(%q): %v", out, err)
- }
-
- if !bytes.Equal(key.Marshal(), pub.Marshal()) {
- t.Fatalf("got key %s, want %s", ssh.MarshalAuthorizedKey(key), ssh.MarshalAuthorizedKey(pub))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/cert_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/cert_test.go
deleted file mode 100644
index 364790f17d7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/cert_test.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd
-
-package test
-
-import (
- "crypto/rand"
- "testing"
-
- "golang.org/x/crypto/ssh"
-)
-
-func TestCertLogin(t *testing.T) {
- s := newServer(t)
- defer s.Shutdown()
-
- // Use a key different from the default.
- clientKey := testSigners["dsa"]
- caAuthKey := testSigners["ecdsa"]
- cert := &ssh.Certificate{
- Key: clientKey.PublicKey(),
- ValidPrincipals: []string{username()},
- CertType: ssh.UserCert,
- ValidBefore: ssh.CertTimeInfinity,
- }
- if err := cert.SignCert(rand.Reader, caAuthKey); err != nil {
- t.Fatalf("SetSignature: %v", err)
- }
-
- certSigner, err := ssh.NewCertSigner(cert, clientKey)
- if err != nil {
- t.Fatalf("NewCertSigner: %v", err)
- }
-
- conf := &ssh.ClientConfig{
- User: username(),
- }
- conf.Auth = append(conf.Auth, ssh.PublicKeys(certSigner))
- client, err := s.TryDial(conf)
- if err != nil {
- t.Fatalf("TryDial: %v", err)
- }
- client.Close()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go
deleted file mode 100644
index 877a88cde3d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/forward_unix_test.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd
-
-package test
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "math/rand"
- "net"
- "testing"
- "time"
-)
-
-func TestPortForward(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- sshListener, err := conn.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatal(err)
- }
-
- go func() {
- sshConn, err := sshListener.Accept()
- if err != nil {
- t.Fatalf("listen.Accept failed: %v", err)
- }
-
- _, err = io.Copy(sshConn, sshConn)
- if err != nil && err != io.EOF {
- t.Fatalf("ssh client copy: %v", err)
- }
- sshConn.Close()
- }()
-
- forwardedAddr := sshListener.Addr().String()
- tcpConn, err := net.Dial("tcp", forwardedAddr)
- if err != nil {
- t.Fatalf("TCP dial failed: %v", err)
- }
-
- readChan := make(chan []byte)
- go func() {
- data, _ := ioutil.ReadAll(tcpConn)
- readChan <- data
- }()
-
- // Invent some data.
- data := make([]byte, 100*1000)
- for i := range data {
- data[i] = byte(i % 255)
- }
-
- var sent []byte
- for len(sent) < 1000*1000 {
- // Send random sized chunks
- m := rand.Intn(len(data))
- n, err := tcpConn.Write(data[:m])
- if err != nil {
- break
- }
- sent = append(sent, data[:n]...)
- }
- if err := tcpConn.(*net.TCPConn).CloseWrite(); err != nil {
- t.Errorf("tcpConn.CloseWrite: %v", err)
- }
-
- read := <-readChan
-
- if len(sent) != len(read) {
- t.Fatalf("got %d bytes, want %d", len(read), len(sent))
- }
- if bytes.Compare(sent, read) != 0 {
- t.Fatalf("read back data does not match")
- }
-
- if err := sshListener.Close(); err != nil {
- t.Fatalf("sshListener.Close: %v", err)
- }
-
- // Check that the forward disappeared.
- tcpConn, err = net.Dial("tcp", forwardedAddr)
- if err == nil {
- tcpConn.Close()
- t.Errorf("still listening to %s after closing", forwardedAddr)
- }
-}
-
-func TestAcceptClose(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
-
- sshListener, err := conn.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatal(err)
- }
-
- quit := make(chan error, 1)
- go func() {
- for {
- c, err := sshListener.Accept()
- if err != nil {
- quit <- err
- break
- }
- c.Close()
- }
- }()
- sshListener.Close()
-
- select {
- case <-time.After(1 * time.Second):
- t.Errorf("timeout: listener did not close.")
- case err := <-quit:
- t.Logf("quit as expected (error %v)", err)
- }
-}
-
-// Check that listeners exit if the underlying client transport dies.
-func TestPortForwardConnectionClose(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
-
- sshListener, err := conn.Listen("tcp", "localhost:0")
- if err != nil {
- t.Fatal(err)
- }
-
- quit := make(chan error, 1)
- go func() {
- for {
- c, err := sshListener.Accept()
- if err != nil {
- quit <- err
- break
- }
- c.Close()
- }
- }()
-
- // It would be even nicer if we closed the server side, but it
- // is more involved as the fd for that side is dup()ed.
- server.clientConn.Close()
-
- select {
- case <-time.After(1 * time.Second):
- t.Errorf("timeout: listener did not close.")
- case err := <-quit:
- t.Logf("quit as expected (error %v)", err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/session_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/session_test.go
deleted file mode 100644
index c0e714ba906..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/session_test.go
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !windows
-
-package test
-
-// Session functional tests.
-
-import (
- "bytes"
- "errors"
- "io"
- "strings"
- "testing"
-
- "golang.org/x/crypto/ssh"
-)
-
-func TestRunCommandSuccess(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- defer session.Close()
- err = session.Run("true")
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
-}
-
-func TestHostKeyCheck(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
-
- conf := clientConfig()
- hostDB := hostKeyDB()
- conf.HostKeyCallback = hostDB.Check
-
- // change the keys.
- hostDB.keys[ssh.KeyAlgoRSA][25]++
- hostDB.keys[ssh.KeyAlgoDSA][25]++
- hostDB.keys[ssh.KeyAlgoECDSA256][25]++
-
- conn, err := server.TryDial(conf)
- if err == nil {
- conn.Close()
- t.Fatalf("dial should have failed.")
- } else if !strings.Contains(err.Error(), "host key mismatch") {
- t.Fatalf("'host key mismatch' not found in %v", err)
- }
-}
-
-func TestRunCommandStdin(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- defer session.Close()
-
- r, w := io.Pipe()
- defer r.Close()
- defer w.Close()
- session.Stdin = r
-
- err = session.Run("true")
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
-}
-
-func TestRunCommandStdinError(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- defer session.Close()
-
- r, w := io.Pipe()
- defer r.Close()
- session.Stdin = r
- pipeErr := errors.New("closing write end of pipe")
- w.CloseWithError(pipeErr)
-
- err = session.Run("true")
- if err != pipeErr {
- t.Fatalf("expected %v, found %v", pipeErr, err)
- }
-}
-
-func TestRunCommandFailed(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- defer session.Close()
- err = session.Run(`bash -c "kill -9 $$"`)
- if err == nil {
- t.Fatalf("session succeeded: %v", err)
- }
-}
-
-func TestRunCommandWeClosed(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- err = session.Shell()
- if err != nil {
- t.Fatalf("shell failed: %v", err)
- }
- err = session.Close()
- if err != nil {
- t.Fatalf("shell failed: %v", err)
- }
-}
-
-func TestFuncLargeRead(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("unable to create new session: %s", err)
- }
-
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("unable to acquire stdout pipe: %s", err)
- }
-
- err = session.Start("dd if=/dev/urandom bs=2048 count=1024")
- if err != nil {
- t.Fatalf("unable to execute remote command: %s", err)
- }
-
- buf := new(bytes.Buffer)
- n, err := io.Copy(buf, stdout)
- if err != nil {
- t.Fatalf("error reading from remote stdout: %s", err)
- }
-
- if n != 2048*1024 {
- t.Fatalf("Expected %d bytes but read only %d from remote command", 2048, n)
- }
-}
-
-func TestKeyChange(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conf := clientConfig()
- hostDB := hostKeyDB()
- conf.HostKeyCallback = hostDB.Check
- conf.RekeyThreshold = 1024
- conn := server.Dial(conf)
- defer conn.Close()
-
- for i := 0; i < 4; i++ {
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("unable to create new session: %s", err)
- }
-
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("unable to acquire stdout pipe: %s", err)
- }
-
- err = session.Start("dd if=/dev/urandom bs=1024 count=1")
- if err != nil {
- t.Fatalf("unable to execute remote command: %s", err)
- }
- buf := new(bytes.Buffer)
- n, err := io.Copy(buf, stdout)
- if err != nil {
- t.Fatalf("error reading from remote stdout: %s", err)
- }
-
- want := int64(1024)
- if n != want {
- t.Fatalf("Expected %d bytes but read only %d from remote command", want, n)
- }
- }
-
- if changes := hostDB.checkCount; changes < 4 {
- t.Errorf("got %d key changes, want 4", changes)
- }
-}
-
-func TestInvalidTerminalMode(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- defer session.Close()
-
- if err = session.RequestPty("vt100", 80, 40, ssh.TerminalModes{255: 1984}); err == nil {
- t.Fatalf("req-pty failed: successful request with invalid mode")
- }
-}
-
-func TestValidTerminalMode(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- conn := server.Dial(clientConfig())
- defer conn.Close()
-
- session, err := conn.NewSession()
- if err != nil {
- t.Fatalf("session failed: %v", err)
- }
- defer session.Close()
-
- stdout, err := session.StdoutPipe()
- if err != nil {
- t.Fatalf("unable to acquire stdout pipe: %s", err)
- }
-
- stdin, err := session.StdinPipe()
- if err != nil {
- t.Fatalf("unable to acquire stdin pipe: %s", err)
- }
-
- tm := ssh.TerminalModes{ssh.ECHO: 0}
- if err = session.RequestPty("xterm", 80, 40, tm); err != nil {
- t.Fatalf("req-pty failed: %s", err)
- }
-
- err = session.Shell()
- if err != nil {
- t.Fatalf("session failed: %s", err)
- }
-
- stdin.Write([]byte("stty -a && exit\n"))
-
- var buf bytes.Buffer
- if _, err := io.Copy(&buf, stdout); err != nil {
- t.Fatalf("reading failed: %s", err)
- }
-
- if sttyOutput := buf.String(); !strings.Contains(sttyOutput, "-echo ") {
- t.Fatalf("terminal mode failure: expected -echo in stty output, got %s", sttyOutput)
- }
-}
-
-func TestCiphers(t *testing.T) {
- var config ssh.Config
- config.SetDefaults()
- cipherOrder := config.Ciphers
- // This cipher will not be tested when commented out in cipher.go it will
- // fallback to the next available as per line 292.
- cipherOrder = append(cipherOrder, "aes128-cbc")
-
- for _, ciph := range cipherOrder {
- server := newServer(t)
- defer server.Shutdown()
- conf := clientConfig()
- conf.Ciphers = []string{ciph}
- // Don't fail if sshd doesnt have the cipher.
- conf.Ciphers = append(conf.Ciphers, cipherOrder...)
- conn, err := server.TryDial(conf)
- if err == nil {
- conn.Close()
- } else {
- t.Fatalf("failed for cipher %q", ciph)
- }
- }
-}
-
-func TestMACs(t *testing.T) {
- var config ssh.Config
- config.SetDefaults()
- macOrder := config.MACs
-
- for _, mac := range macOrder {
- server := newServer(t)
- defer server.Shutdown()
- conf := clientConfig()
- conf.MACs = []string{mac}
- // Don't fail if sshd doesnt have the MAC.
- conf.MACs = append(conf.MACs, macOrder...)
- if conn, err := server.TryDial(conf); err == nil {
- conn.Close()
- } else {
- t.Fatalf("failed for MAC %q", mac)
- }
- }
-}
-
-func TestKeyExchanges(t *testing.T) {
- var config ssh.Config
- config.SetDefaults()
- kexOrder := config.KeyExchanges
- for _, kex := range kexOrder {
- server := newServer(t)
- defer server.Shutdown()
- conf := clientConfig()
- // Don't fail if sshd doesnt have the kex.
- conf.KeyExchanges = append([]string{kex}, kexOrder...)
- conn, err := server.TryDial(conf)
- if err == nil {
- conn.Close()
- } else {
- t.Errorf("failed for kex %q", kex)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go
deleted file mode 100644
index a2eb9358d02..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !windows
-
-package test
-
-// direct-tcpip functional tests
-
-import (
- "io"
- "net"
- "testing"
-)
-
-func TestDial(t *testing.T) {
- server := newServer(t)
- defer server.Shutdown()
- sshConn := server.Dial(clientConfig())
- defer sshConn.Close()
-
- l, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- t.Fatalf("Listen: %v", err)
- }
- defer l.Close()
-
- go func() {
- for {
- c, err := l.Accept()
- if err != nil {
- break
- }
-
- io.WriteString(c, c.RemoteAddr().String())
- c.Close()
- }
- }()
-
- conn, err := sshConn.Dial("tcp", l.Addr().String())
- if err != nil {
- t.Fatalf("Dial: %v", err)
- }
- defer conn.Close()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go
deleted file mode 100644
index f1fc50b2e48..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go
+++ /dev/null
@@ -1,261 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build darwin dragonfly freebsd linux netbsd openbsd plan9
-
-package test
-
-// functional test harness for unix.
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "log"
- "net"
- "os"
- "os/exec"
- "os/user"
- "path/filepath"
- "testing"
- "text/template"
-
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/testdata"
-)
-
-const sshd_config = `
-Protocol 2
-HostKey {{.Dir}}/id_rsa
-HostKey {{.Dir}}/id_dsa
-HostKey {{.Dir}}/id_ecdsa
-Pidfile {{.Dir}}/sshd.pid
-#UsePrivilegeSeparation no
-KeyRegenerationInterval 3600
-ServerKeyBits 768
-SyslogFacility AUTH
-LogLevel DEBUG2
-LoginGraceTime 120
-PermitRootLogin no
-StrictModes no
-RSAAuthentication yes
-PubkeyAuthentication yes
-AuthorizedKeysFile {{.Dir}}/id_user.pub
-TrustedUserCAKeys {{.Dir}}/id_ecdsa.pub
-IgnoreRhosts yes
-RhostsRSAAuthentication no
-HostbasedAuthentication no
-`
-
-var configTmpl = template.Must(template.New("").Parse(sshd_config))
-
-type server struct {
- t *testing.T
- cleanup func() // executed during Shutdown
- configfile string
- cmd *exec.Cmd
- output bytes.Buffer // holds stderr from sshd process
-
- // Client half of the network connection.
- clientConn net.Conn
-}
-
-func username() string {
- var username string
- if user, err := user.Current(); err == nil {
- username = user.Username
- } else {
- // user.Current() currently requires cgo. If an error is
- // returned attempt to get the username from the environment.
- log.Printf("user.Current: %v; falling back on $USER", err)
- username = os.Getenv("USER")
- }
- if username == "" {
- panic("Unable to get username")
- }
- return username
-}
-
-type storedHostKey struct {
- // keys map from an algorithm string to binary key data.
- keys map[string][]byte
-
- // checkCount counts the Check calls. Used for testing
- // rekeying.
- checkCount int
-}
-
-func (k *storedHostKey) Add(key ssh.PublicKey) {
- if k.keys == nil {
- k.keys = map[string][]byte{}
- }
- k.keys[key.Type()] = key.Marshal()
-}
-
-func (k *storedHostKey) Check(addr string, remote net.Addr, key ssh.PublicKey) error {
- k.checkCount++
- algo := key.Type()
-
- if k.keys == nil || bytes.Compare(key.Marshal(), k.keys[algo]) != 0 {
- return fmt.Errorf("host key mismatch. Got %q, want %q", key, k.keys[algo])
- }
- return nil
-}
-
-func hostKeyDB() *storedHostKey {
- keyChecker := &storedHostKey{}
- keyChecker.Add(testPublicKeys["ecdsa"])
- keyChecker.Add(testPublicKeys["rsa"])
- keyChecker.Add(testPublicKeys["dsa"])
- return keyChecker
-}
-
-func clientConfig() *ssh.ClientConfig {
- config := &ssh.ClientConfig{
- User: username(),
- Auth: []ssh.AuthMethod{
- ssh.PublicKeys(testSigners["user"]),
- },
- HostKeyCallback: hostKeyDB().Check,
- }
- return config
-}
-
-// unixConnection creates two halves of a connected net.UnixConn. It
-// is used for connecting the Go SSH client with sshd without opening
-// ports.
-func unixConnection() (*net.UnixConn, *net.UnixConn, error) {
- dir, err := ioutil.TempDir("", "unixConnection")
- if err != nil {
- return nil, nil, err
- }
- defer os.Remove(dir)
-
- addr := filepath.Join(dir, "ssh")
- listener, err := net.Listen("unix", addr)
- if err != nil {
- return nil, nil, err
- }
- defer listener.Close()
- c1, err := net.Dial("unix", addr)
- if err != nil {
- return nil, nil, err
- }
-
- c2, err := listener.Accept()
- if err != nil {
- c1.Close()
- return nil, nil, err
- }
-
- return c1.(*net.UnixConn), c2.(*net.UnixConn), nil
-}
-
-func (s *server) TryDial(config *ssh.ClientConfig) (*ssh.Client, error) {
- sshd, err := exec.LookPath("sshd")
- if err != nil {
- s.t.Skipf("skipping test: %v", err)
- }
-
- c1, c2, err := unixConnection()
- if err != nil {
- s.t.Fatalf("unixConnection: %v", err)
- }
-
- s.cmd = exec.Command(sshd, "-f", s.configfile, "-i", "-e")
- f, err := c2.File()
- if err != nil {
- s.t.Fatalf("UnixConn.File: %v", err)
- }
- defer f.Close()
- s.cmd.Stdin = f
- s.cmd.Stdout = f
- s.cmd.Stderr = &s.output
- if err := s.cmd.Start(); err != nil {
- s.t.Fail()
- s.Shutdown()
- s.t.Fatalf("s.cmd.Start: %v", err)
- }
- s.clientConn = c1
- conn, chans, reqs, err := ssh.NewClientConn(c1, "", config)
- if err != nil {
- return nil, err
- }
- return ssh.NewClient(conn, chans, reqs), nil
-}
-
-func (s *server) Dial(config *ssh.ClientConfig) *ssh.Client {
- conn, err := s.TryDial(config)
- if err != nil {
- s.t.Fail()
- s.Shutdown()
- s.t.Fatalf("ssh.Client: %v", err)
- }
- return conn
-}
-
-func (s *server) Shutdown() {
- if s.cmd != nil && s.cmd.Process != nil {
- // Don't check for errors; if it fails it's most
- // likely "os: process already finished", and we don't
- // care about that. Use os.Interrupt, so child
- // processes are killed too.
- s.cmd.Process.Signal(os.Interrupt)
- s.cmd.Wait()
- }
- if s.t.Failed() {
- // log any output from sshd process
- s.t.Logf("sshd: %s", s.output.String())
- }
- s.cleanup()
-}
-
-func writeFile(path string, contents []byte) {
- f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0600)
- if err != nil {
- panic(err)
- }
- defer f.Close()
- if _, err := f.Write(contents); err != nil {
- panic(err)
- }
-}
-
-// newServer returns a new mock ssh server.
-func newServer(t *testing.T) *server {
- if testing.Short() {
- t.Skip("skipping test due to -short")
- }
- dir, err := ioutil.TempDir("", "sshtest")
- if err != nil {
- t.Fatal(err)
- }
- f, err := os.Create(filepath.Join(dir, "sshd_config"))
- if err != nil {
- t.Fatal(err)
- }
- err = configTmpl.Execute(f, map[string]string{
- "Dir": dir,
- })
- if err != nil {
- t.Fatal(err)
- }
- f.Close()
-
- for k, v := range testdata.PEMBytes {
- filename := "id_" + k
- writeFile(filepath.Join(dir, filename), v)
- writeFile(filepath.Join(dir, filename+".pub"), ssh.MarshalAuthorizedKey(testPublicKeys[k]))
- }
-
- return &server{
- t: t,
- configfile: f.Name(),
- cleanup: func() {
- if err := os.RemoveAll(dir); err != nil {
- t.Error(err)
- }
- },
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/testdata_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/testdata_test.go
deleted file mode 100644
index ae48c7516cb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/test/testdata_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// IMPLEMENTOR NOTE: To avoid a package loop, this file is in three places:
-// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three
-// instances.
-
-package test
-
-import (
- "crypto/rand"
- "fmt"
-
- "golang.org/x/crypto/ssh"
- "golang.org/x/crypto/ssh/testdata"
-)
-
-var (
- testPrivateKeys map[string]interface{}
- testSigners map[string]ssh.Signer
- testPublicKeys map[string]ssh.PublicKey
-)
-
-func init() {
- var err error
-
- n := len(testdata.PEMBytes)
- testPrivateKeys = make(map[string]interface{}, n)
- testSigners = make(map[string]ssh.Signer, n)
- testPublicKeys = make(map[string]ssh.PublicKey, n)
- for t, k := range testdata.PEMBytes {
- testPrivateKeys[t], err = ssh.ParseRawPrivateKey(k)
- if err != nil {
- panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err))
- }
- testSigners[t], err = ssh.NewSignerFromKey(testPrivateKeys[t])
- if err != nil {
- panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err))
- }
- testPublicKeys[t] = testSigners[t].PublicKey()
- }
-
- // Create a cert and sign it for use in tests.
- testCert := &ssh.Certificate{
- Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage
- ValidAfter: 0, // unix epoch
- ValidBefore: ssh.CertTimeInfinity, // The end of currently representable time.
- Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- Key: testPublicKeys["ecdsa"],
- SignatureKey: testPublicKeys["rsa"],
- Permissions: ssh.Permissions{
- CriticalOptions: map[string]string{},
- Extensions: map[string]string{},
- },
- }
- testCert.SignCert(rand.Reader, testSigners["rsa"])
- testPrivateKeys["cert"] = testPrivateKeys["ecdsa"]
- testSigners["cert"], err = ssh.NewCertSigner(testCert, testSigners["ecdsa"])
- if err != nil {
- panic(fmt.Sprintf("Unable to create certificate signer: %v", err))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/testdata_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/testdata_test.go
deleted file mode 100644
index f2828c1b5fb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/testdata_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// IMPLEMENTOR NOTE: To avoid a package loop, this file is in three places:
-// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three
-// instances.
-
-package ssh
-
-import (
- "crypto/rand"
- "fmt"
-
- "golang.org/x/crypto/ssh/testdata"
-)
-
-var (
- testPrivateKeys map[string]interface{}
- testSigners map[string]Signer
- testPublicKeys map[string]PublicKey
-)
-
-func init() {
- var err error
-
- n := len(testdata.PEMBytes)
- testPrivateKeys = make(map[string]interface{}, n)
- testSigners = make(map[string]Signer, n)
- testPublicKeys = make(map[string]PublicKey, n)
- for t, k := range testdata.PEMBytes {
- testPrivateKeys[t], err = ParseRawPrivateKey(k)
- if err != nil {
- panic(fmt.Sprintf("Unable to parse test key %s: %v", t, err))
- }
- testSigners[t], err = NewSignerFromKey(testPrivateKeys[t])
- if err != nil {
- panic(fmt.Sprintf("Unable to create signer for test key %s: %v", t, err))
- }
- testPublicKeys[t] = testSigners[t].PublicKey()
- }
-
- // Create a cert and sign it for use in tests.
- testCert := &Certificate{
- Nonce: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- ValidPrincipals: []string{"gopher1", "gopher2"}, // increases test coverage
- ValidAfter: 0, // unix epoch
- ValidBefore: CertTimeInfinity, // The end of currently representable time.
- Reserved: []byte{}, // To pass reflect.DeepEqual after marshal & parse, this must be non-nil
- Key: testPublicKeys["ecdsa"],
- SignatureKey: testPublicKeys["rsa"],
- Permissions: Permissions{
- CriticalOptions: map[string]string{},
- Extensions: map[string]string{},
- },
- }
- testCert.SignCert(rand.Reader, testSigners["rsa"])
- testPrivateKeys["cert"] = testPrivateKeys["ecdsa"]
- testSigners["cert"], err = NewCertSigner(testCert, testSigners["ecdsa"])
- if err != nil {
- panic(fmt.Sprintf("Unable to create certificate signer: %v", err))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/transport_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/transport_test.go
deleted file mode 100644
index 92d83abf93f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/ssh/transport_test.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto/rand"
- "encoding/binary"
- "strings"
- "testing"
-)
-
-func TestReadVersion(t *testing.T) {
- longversion := strings.Repeat("SSH-2.0-bla", 50)[:253]
- cases := map[string]string{
- "SSH-2.0-bla\r\n": "SSH-2.0-bla",
- "SSH-2.0-bla\n": "SSH-2.0-bla",
- longversion + "\r\n": longversion,
- }
-
- for in, want := range cases {
- result, err := readVersion(bytes.NewBufferString(in))
- if err != nil {
- t.Errorf("readVersion(%q): %s", in, err)
- }
- got := string(result)
- if got != want {
- t.Errorf("got %q, want %q", got, want)
- }
- }
-}
-
-func TestReadVersionError(t *testing.T) {
- longversion := strings.Repeat("SSH-2.0-bla", 50)[:253]
- cases := []string{
- longversion + "too-long\r\n",
- }
- for _, in := range cases {
- if _, err := readVersion(bytes.NewBufferString(in)); err == nil {
- t.Errorf("readVersion(%q) should have failed", in)
- }
- }
-}
-
-func TestExchangeVersionsBasic(t *testing.T) {
- v := "SSH-2.0-bla"
- buf := bytes.NewBufferString(v + "\r\n")
- them, err := exchangeVersions(buf, []byte("xyz"))
- if err != nil {
- t.Errorf("exchangeVersions: %v", err)
- }
-
- if want := "SSH-2.0-bla"; string(them) != want {
- t.Errorf("got %q want %q for our version", them, want)
- }
-}
-
-func TestExchangeVersions(t *testing.T) {
- cases := []string{
- "not\x000allowed",
- "not allowed\n",
- }
- for _, c := range cases {
- buf := bytes.NewBufferString("SSH-2.0-bla\r\n")
- if _, err := exchangeVersions(buf, []byte(c)); err == nil {
- t.Errorf("exchangeVersions(%q): should have failed", c)
- }
- }
-}
-
-type closerBuffer struct {
- bytes.Buffer
-}
-
-func (b *closerBuffer) Close() error {
- return nil
-}
-
-func TestTransportMaxPacketWrite(t *testing.T) {
- buf := &closerBuffer{}
- tr := newTransport(buf, rand.Reader, true)
- huge := make([]byte, maxPacket+1)
- err := tr.writePacket(huge)
- if err == nil {
- t.Errorf("transport accepted write for a huge packet.")
- }
-}
-
-func TestTransportMaxPacketReader(t *testing.T) {
- var header [5]byte
- huge := make([]byte, maxPacket+128)
- binary.BigEndian.PutUint32(header[0:], uint32(len(huge)))
- // padding.
- header[4] = 0
-
- buf := &closerBuffer{}
- buf.Write(header[:])
- buf.Write(huge)
-
- tr := newTransport(buf, rand.Reader, true)
- _, err := tr.readPacket()
- if err == nil {
- t.Errorf("transport succeeded reading huge packet.")
- } else if !strings.Contains(err.Error(), "large") {
- t.Errorf("got %q, should mention %q", err.Error(), "large")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/tea/tea_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/tea/tea_test.go
deleted file mode 100644
index eb98d1e0e03..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/tea/tea_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package tea
-
-import (
- "bytes"
- "testing"
-)
-
-// A sample test key for when we just want to initialize a cipher
-var testKey = []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}
-
-// Test that the block size for tea is correct
-func TestBlocksize(t *testing.T) {
- c, err := NewCipher(testKey)
- if err != nil {
- t.Fatalf("NewCipher returned error: %s", err)
- }
-
- if result := c.BlockSize(); result != BlockSize {
- t.Errorf("cipher.BlockSize returned %d, but expected %d", result, BlockSize)
- }
-}
-
-// Test that invalid key sizes return an error
-func TestInvalidKeySize(t *testing.T) {
- var key [KeySize + 1]byte
-
- if _, err := NewCipher(key[:]); err == nil {
- t.Errorf("invalid key size %d didn't result in an error.", len(key))
- }
-
- if _, err := NewCipher(key[:KeySize-1]); err == nil {
- t.Errorf("invalid key size %d didn't result in an error.", KeySize-1)
- }
-}
-
-// Test Vectors
-type teaTest struct {
- rounds int
- key []byte
- plaintext []byte
- ciphertext []byte
-}
-
-var teaTests = []teaTest{
- // These were sourced from https://github.com/froydnj/ironclad/blob/master/testing/test-vectors/tea.testvec
- {
- numRounds,
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x41, 0xea, 0x3a, 0x0a, 0x94, 0xba, 0xa9, 0x40},
- },
- {
- numRounds,
- []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
- []byte{0x31, 0x9b, 0xbe, 0xfb, 0x01, 0x6a, 0xbd, 0xb2},
- },
- {
- 16,
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0xed, 0x28, 0x5d, 0xa1, 0x45, 0x5b, 0x33, 0xc1},
- },
-}
-
-// Test encryption
-func TestCipherEncrypt(t *testing.T) {
- // Test encryption with standard 64 rounds
- for i, test := range teaTests {
- c, err := NewCipherWithRounds(test.key, test.rounds)
- if err != nil {
- t.Fatalf("#%d: NewCipher returned error: %s", i, err)
- }
-
- var ciphertext [BlockSize]byte
- c.Encrypt(ciphertext[:], test.plaintext)
-
- if !bytes.Equal(ciphertext[:], test.ciphertext) {
- t.Errorf("#%d: incorrect ciphertext. Got %x, wanted %x", i, ciphertext, test.ciphertext)
- }
-
- var plaintext2 [BlockSize]byte
- c.Decrypt(plaintext2[:], ciphertext[:])
-
- if !bytes.Equal(plaintext2[:], test.plaintext) {
- t.Errorf("#%d: incorrect plaintext. Got %x, wanted %x", i, plaintext2, test.plaintext)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/twofish/twofish_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/twofish/twofish_test.go
deleted file mode 100644
index 303081f3f28..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/twofish/twofish_test.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package twofish
-
-import (
- "bytes"
- "testing"
-)
-
-var qbox = [2][4][16]byte{
- {
- {0x8, 0x1, 0x7, 0xD, 0x6, 0xF, 0x3, 0x2, 0x0, 0xB, 0x5, 0x9, 0xE, 0xC, 0xA, 0x4},
- {0xE, 0xC, 0xB, 0x8, 0x1, 0x2, 0x3, 0x5, 0xF, 0x4, 0xA, 0x6, 0x7, 0x0, 0x9, 0xD},
- {0xB, 0xA, 0x5, 0xE, 0x6, 0xD, 0x9, 0x0, 0xC, 0x8, 0xF, 0x3, 0x2, 0x4, 0x7, 0x1},
- {0xD, 0x7, 0xF, 0x4, 0x1, 0x2, 0x6, 0xE, 0x9, 0xB, 0x3, 0x0, 0x8, 0x5, 0xC, 0xA},
- },
- {
- {0x2, 0x8, 0xB, 0xD, 0xF, 0x7, 0x6, 0xE, 0x3, 0x1, 0x9, 0x4, 0x0, 0xA, 0xC, 0x5},
- {0x1, 0xE, 0x2, 0xB, 0x4, 0xC, 0x3, 0x7, 0x6, 0xD, 0xA, 0x5, 0xF, 0x9, 0x0, 0x8},
- {0x4, 0xC, 0x7, 0x5, 0x1, 0x6, 0x9, 0xA, 0x0, 0xE, 0xD, 0x8, 0x2, 0xB, 0x3, 0xF},
- {0xB, 0x9, 0x5, 0x1, 0xC, 0x3, 0xD, 0xE, 0x6, 0x4, 0x7, 0xF, 0x2, 0x0, 0x8, 0xA},
- },
-}
-
-// genSbox generates the variable sbox
-func genSbox(qi int, x byte) byte {
- a0, b0 := x/16, x%16
- for i := 0; i < 2; i++ {
- a1 := a0 ^ b0
- b1 := (a0 ^ ((b0 << 3) | (b0 >> 1)) ^ (a0 << 3)) & 15
- a0 = qbox[qi][2*i][a1]
- b0 = qbox[qi][2*i+1][b1]
- }
- return (b0 << 4) + a0
-}
-
-func TestSbox(t *testing.T) {
- for n := range sbox {
- for m := range sbox[n] {
- if genSbox(n, byte(m)) != sbox[n][m] {
- t.Errorf("#%d|%d: sbox value = %d want %d", n, m, sbox[n][m], genSbox(n, byte(m)))
- }
- }
- }
-}
-
-var testVectors = []struct {
- key []byte
- dec []byte
- enc []byte
-}{
- // These tests are extracted from LibTom
- {
- []byte{0x9F, 0x58, 0x9F, 0x5C, 0xF6, 0x12, 0x2C, 0x32, 0xB6, 0xBF, 0xEC, 0x2F, 0x2A, 0xE8, 0xC3, 0x5A},
- []byte{0xD4, 0x91, 0xDB, 0x16, 0xE7, 0xB1, 0xC3, 0x9E, 0x86, 0xCB, 0x08, 0x6B, 0x78, 0x9F, 0x54, 0x19},
- []byte{0x01, 0x9F, 0x98, 0x09, 0xDE, 0x17, 0x11, 0x85, 0x8F, 0xAA, 0xC3, 0xA3, 0xBA, 0x20, 0xFB, 0xC3},
- },
- {
- []byte{0x88, 0xB2, 0xB2, 0x70, 0x6B, 0x10, 0x5E, 0x36, 0xB4, 0x46, 0xBB, 0x6D, 0x73, 0x1A, 0x1E, 0x88,
- 0xEF, 0xA7, 0x1F, 0x78, 0x89, 0x65, 0xBD, 0x44},
- []byte{0x39, 0xDA, 0x69, 0xD6, 0xBA, 0x49, 0x97, 0xD5, 0x85, 0xB6, 0xDC, 0x07, 0x3C, 0xA3, 0x41, 0xB2},
- []byte{0x18, 0x2B, 0x02, 0xD8, 0x14, 0x97, 0xEA, 0x45, 0xF9, 0xDA, 0xAC, 0xDC, 0x29, 0x19, 0x3A, 0x65},
- },
- {
- []byte{0xD4, 0x3B, 0xB7, 0x55, 0x6E, 0xA3, 0x2E, 0x46, 0xF2, 0xA2, 0x82, 0xB7, 0xD4, 0x5B, 0x4E, 0x0D,
- 0x57, 0xFF, 0x73, 0x9D, 0x4D, 0xC9, 0x2C, 0x1B, 0xD7, 0xFC, 0x01, 0x70, 0x0C, 0xC8, 0x21, 0x6F},
- []byte{0x90, 0xAF, 0xE9, 0x1B, 0xB2, 0x88, 0x54, 0x4F, 0x2C, 0x32, 0xDC, 0x23, 0x9B, 0x26, 0x35, 0xE6},
- []byte{0x6C, 0xB4, 0x56, 0x1C, 0x40, 0xBF, 0x0A, 0x97, 0x05, 0x93, 0x1C, 0xB6, 0xD4, 0x08, 0xE7, 0xFA},
- },
- // These test are derived from http://www.schneier.com/code/ecb_ival.txt
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x9F, 0x58, 0x9F, 0x5C, 0xF6, 0x12, 0x2C, 0x32, 0xB6, 0xBF, 0xEC, 0x2F, 0x2A, 0xE8, 0xC3, 0x5A},
- },
- {
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
- },
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0xCF, 0xD1, 0xD2, 0xE5, 0xA9, 0xBE, 0x9C, 0xDF, 0x50, 0x1F, 0x13, 0xB8, 0x92, 0xBD, 0x22, 0x48},
- },
- {
- []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
- },
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x37, 0x52, 0x7B, 0xE0, 0x05, 0x23, 0x34, 0xB8, 0x9F, 0x0C, 0xFC, 0xCA, 0xE8, 0x7C, 0xFA, 0x20},
- },
-}
-
-func TestCipher(t *testing.T) {
- for n, tt := range testVectors {
- // Test if the plaintext (dec) is encrypts to the given
- // ciphertext (enc) using the given key. Test also if enc can
- // be decrypted again into dec.
- c, err := NewCipher(tt.key)
- if err != nil {
- t.Errorf("#%d: NewCipher: %v", n, err)
- return
- }
-
- buf := make([]byte, 16)
- c.Encrypt(buf, tt.dec)
- if !bytes.Equal(buf, tt.enc) {
- t.Errorf("#%d: encrypt = %x want %x", n, buf, tt.enc)
- }
- c.Decrypt(buf, tt.enc)
- if !bytes.Equal(buf, tt.dec) {
- t.Errorf("#%d: decrypt = %x want %x", n, buf, tt.dec)
- }
-
- // Test that 16 zero bytes, encrypted 1000 times then decrypted
- // 1000 times results in zero bytes again.
- zero := make([]byte, 16)
- buf = make([]byte, 16)
- for i := 0; i < 1000; i++ {
- c.Encrypt(buf, buf)
- }
- for i := 0; i < 1000; i++ {
- c.Decrypt(buf, buf)
- }
- if !bytes.Equal(buf, zero) {
- t.Errorf("#%d: encrypt/decrypt 1000: have %x want %x", n, buf, zero)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xtea/xtea_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xtea/xtea_test.go
deleted file mode 100644
index be711bf5af0..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xtea/xtea_test.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xtea
-
-import (
- "testing"
-)
-
-// A sample test key for when we just want to initialize a cipher
-var testKey = []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}
-
-// Test that the block size for XTEA is correct
-func TestBlocksize(t *testing.T) {
- if BlockSize != 8 {
- t.Errorf("BlockSize constant - expected 8, got %d", BlockSize)
- return
- }
-
- c, err := NewCipher(testKey)
- if err != nil {
- t.Errorf("NewCipher(%d bytes) = %s", len(testKey), err)
- return
- }
-
- result := c.BlockSize()
- if result != 8 {
- t.Errorf("BlockSize function - expected 8, got %d", result)
- return
- }
-}
-
-// A series of test values to confirm that the Cipher.table array was initialized correctly
-var testTable = []uint32{
- 0x00112233, 0x6B1568B8, 0xE28CE030, 0xC5089E2D, 0xC5089E2D, 0x1EFBD3A2, 0xA7845C2A, 0x78EF0917,
- 0x78EF0917, 0x172682D0, 0x5B6AC714, 0x822AC955, 0x3DE68511, 0xDC1DFECA, 0x2062430E, 0x3611343F,
- 0xF1CCEFFB, 0x900469B4, 0xD448ADF8, 0x2E3BE36D, 0xB6C46BF5, 0x994029F2, 0x994029F2, 0xF3335F67,
- 0x6AAAD6DF, 0x4D2694DC, 0x4D2694DC, 0xEB5E0E95, 0x2FA252D9, 0x4551440A, 0x121E10D6, 0xB0558A8F,
- 0xE388BDC3, 0x0A48C004, 0xC6047BC0, 0x643BF579, 0xA88039BD, 0x02736F32, 0x8AFBF7BA, 0x5C66A4A7,
- 0x5C66A4A7, 0xC76AEB2C, 0x3EE262A4, 0x215E20A1, 0x215E20A1, 0x7B515616, 0x03D9DE9E, 0x1988CFCF,
- 0xD5448B8B, 0x737C0544, 0xB7C04988, 0xDE804BC9, 0x9A3C0785, 0x3873813E, 0x7CB7C582, 0xD6AAFAF7,
- 0x4E22726F, 0x309E306C, 0x309E306C, 0x8A9165E1, 0x1319EE69, 0xF595AC66, 0xF595AC66, 0x4F88E1DB,
-}
-
-// Test that the cipher context is initialized correctly
-func TestCipherInit(t *testing.T) {
- c, err := NewCipher(testKey)
- if err != nil {
- t.Errorf("NewCipher(%d bytes) = %s", len(testKey), err)
- return
- }
-
- for i := 0; i < len(c.table); i++ {
- if c.table[i] != testTable[i] {
- t.Errorf("NewCipher() failed to initialize Cipher.table[%d] correctly. Expected %08X, got %08X", i, testTable[i], c.table[i])
- break
- }
- }
-}
-
-// Test that invalid key sizes return an error
-func TestInvalidKeySize(t *testing.T) {
- // Test a long key
- key := []byte{
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
- }
-
- _, err := NewCipher(key)
- if err == nil {
- t.Errorf("Invalid key size %d didn't result in an error.", len(key))
- }
-
- // Test a short key
- key = []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77}
-
- _, err = NewCipher(key)
- if err == nil {
- t.Errorf("Invalid key size %d didn't result in an error.", len(key))
- }
-}
-
-// Test that we can correctly decode some bytes we have encoded
-func TestEncodeDecode(t *testing.T) {
- original := []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}
- input := original
- output := make([]byte, BlockSize)
-
- c, err := NewCipher(testKey)
- if err != nil {
- t.Errorf("NewCipher(%d bytes) = %s", len(testKey), err)
- return
- }
-
- // Encrypt the input block
- c.Encrypt(output, input)
-
- // Check that the output does not match the input
- differs := false
- for i := 0; i < len(input); i++ {
- if output[i] != input[i] {
- differs = true
- break
- }
- }
- if differs == false {
- t.Error("Cipher.Encrypt: Failed to encrypt the input block.")
- return
- }
-
- // Decrypt the block we just encrypted
- input = output
- output = make([]byte, BlockSize)
- c.Decrypt(output, input)
-
- // Check that the output from decrypt matches our initial input
- for i := 0; i < len(input); i++ {
- if output[i] != original[i] {
- t.Errorf("Decrypted byte %d differed. Expected %02X, got %02X\n", i, original[i], output[i])
- return
- }
- }
-}
-
-// Test Vectors
-type CryptTest struct {
- key []byte
- plainText []byte
- cipherText []byte
-}
-
-var CryptTests = []CryptTest{
- // These were sourced from http://www.freemedialibrary.com/index.php/XTEA_test_vectors
- {
- []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- []byte{0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
- []byte{0x49, 0x7d, 0xf3, 0xd0, 0x72, 0x61, 0x2c, 0xb5},
- },
- {
- []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
- []byte{0xe7, 0x8f, 0x2d, 0x13, 0x74, 0x43, 0x41, 0xd8},
- },
- {
- []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
- []byte{0x5a, 0x5b, 0x6e, 0x27, 0x89, 0x48, 0xd7, 0x7f},
- []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
- },
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
- []byte{0xa0, 0x39, 0x05, 0x89, 0xf8, 0xb8, 0xef, 0xa5},
- },
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
- []byte{0xed, 0x23, 0x37, 0x5a, 0x82, 0x1a, 0x8c, 0x2d},
- },
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x70, 0xe1, 0x22, 0x5d, 0x6e, 0x4e, 0x76, 0x55},
- []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
- },
-
- // These vectors are from http://wiki.secondlife.com/wiki/XTEA_Strong_Encryption_Implementation#Bouncy_Castle_C.23_API
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0xDE, 0xE9, 0xD4, 0xD8, 0xF7, 0x13, 0x1E, 0xD9},
- },
- {
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08},
- []byte{0x06, 0x5C, 0x1B, 0x89, 0x75, 0xC6, 0xA8, 0x16},
- },
- {
- []byte{0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A},
- []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
- []byte{0x1F, 0xF9, 0xA0, 0x26, 0x1A, 0xC6, 0x42, 0x64},
- },
- {
- []byte{0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A},
- []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08},
- []byte{0x8C, 0x67, 0x15, 0x5B, 0x2E, 0xF9, 0x1E, 0xAD},
- },
-}
-
-// Test encryption
-func TestCipherEncrypt(t *testing.T) {
- for i, tt := range CryptTests {
- c, err := NewCipher(tt.key)
- if err != nil {
- t.Errorf("NewCipher(%d bytes), vector %d = %s", len(tt.key), i, err)
- continue
- }
-
- out := make([]byte, len(tt.plainText))
- c.Encrypt(out, tt.plainText)
-
- for j := 0; j < len(out); j++ {
- if out[j] != tt.cipherText[j] {
- t.Errorf("Cipher.Encrypt %d: out[%d] = %02X, expected %02X", i, j, out[j], tt.cipherText[j])
- break
- }
- }
- }
-}
-
-// Test decryption
-func TestCipherDecrypt(t *testing.T) {
- for i, tt := range CryptTests {
- c, err := NewCipher(tt.key)
- if err != nil {
- t.Errorf("NewCipher(%d bytes), vector %d = %s", len(tt.key), i, err)
- continue
- }
-
- out := make([]byte, len(tt.cipherText))
- c.Decrypt(out, tt.cipherText)
-
- for j := 0; j < len(out); j++ {
- if out[j] != tt.plainText[j] {
- t.Errorf("Cipher.Decrypt %d: out[%d] = %02X, expected %02X", i, j, out[j], tt.plainText[j])
- break
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xts/xts_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xts/xts_test.go
deleted file mode 100644
index 7a5e9fadd60..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/crypto/xts/xts_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package xts
-
-import (
- "bytes"
- "crypto/aes"
- "encoding/hex"
- "testing"
-)
-
-// These test vectors have been taken from IEEE P1619/D16, Annex B.
-var xtsTestVectors = []struct {
- key string
- sector uint64
- plaintext string
- ciphertext string
-}{
- {
- "0000000000000000000000000000000000000000000000000000000000000000",
- 0,
- "0000000000000000000000000000000000000000000000000000000000000000",
- "917cf69ebd68b2ec9b9fe9a3eadda692cd43d2f59598ed858c02c2652fbf922e",
- }, {
- "1111111111111111111111111111111122222222222222222222222222222222",
- 0x3333333333,
- "4444444444444444444444444444444444444444444444444444444444444444",
- "c454185e6a16936e39334038acef838bfb186fff7480adc4289382ecd6d394f0",
- }, {
- "fffefdfcfbfaf9f8f7f6f5f4f3f2f1f022222222222222222222222222222222",
- 0x3333333333,
- "4444444444444444444444444444444444444444444444444444444444444444",
- "af85336b597afc1a900b2eb21ec949d292df4c047e0b21532186a5971a227a89",
- }, {
- "2718281828459045235360287471352631415926535897932384626433832795",
- 0,
- "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
- "27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568",
- }, {
- "2718281828459045235360287471352631415926535897932384626433832795",
- 1,
- "27a7479befa1d476489f308cd4cfa6e2a96e4bbe3208ff25287dd3819616e89cc78cf7f5e543445f8333d8fa7f56000005279fa5d8b5e4ad40e736ddb4d35412328063fd2aab53e5ea1e0a9f332500a5df9487d07a5c92cc512c8866c7e860ce93fdf166a24912b422976146ae20ce846bb7dc9ba94a767aaef20c0d61ad02655ea92dc4c4e41a8952c651d33174be51a10c421110e6d81588ede82103a252d8a750e8768defffed9122810aaeb99f9172af82b604dc4b8e51bcb08235a6f4341332e4ca60482a4ba1a03b3e65008fc5da76b70bf1690db4eae29c5f1badd03c5ccf2a55d705ddcd86d449511ceb7ec30bf12b1fa35b913f9f747a8afd1b130e94bff94effd01a91735ca1726acd0b197c4e5b03393697e126826fb6bbde8ecc1e08298516e2c9ed03ff3c1b7860f6de76d4cecd94c8119855ef5297ca67e9f3e7ff72b1e99785ca0a7e7720c5b36dc6d72cac9574c8cbbc2f801e23e56fd344b07f22154beba0f08ce8891e643ed995c94d9a69c9f1b5f499027a78572aeebd74d20cc39881c213ee770b1010e4bea718846977ae119f7a023ab58cca0ad752afe656bb3c17256a9f6e9bf19fdd5a38fc82bbe872c5539edb609ef4f79c203ebb140f2e583cb2ad15b4aa5b655016a8449277dbd477ef2c8d6c017db738b18deb4a427d1923ce3ff262735779a418f20a282df920147beabe421ee5319d0568",
- "264d3ca8512194fec312c8c9891f279fefdd608d0c027b60483a3fa811d65ee59d52d9e40ec5672d81532b38b6b089ce951f0f9c35590b8b978d175213f329bb1c2fd30f2f7f30492a61a532a79f51d36f5e31a7c9a12c286082ff7d2394d18f783e1a8e72c722caaaa52d8f065657d2631fd25bfd8e5baad6e527d763517501c68c5edc3cdd55435c532d7125c8614deed9adaa3acade5888b87bef641c4c994c8091b5bcd387f3963fb5bc37aa922fbfe3df4e5b915e6eb514717bdd2a74079a5073f5c4bfd46adf7d282e7a393a52579d11a028da4d9cd9c77124f9648ee383b1ac763930e7162a8d37f350b2f74b8472cf09902063c6b32e8c2d9290cefbd7346d1c779a0df50edcde4531da07b099c638e83a755944df2aef1aa31752fd323dcb710fb4bfbb9d22b925bc3577e1b8949e729a90bbafeacf7f7879e7b1147e28ba0bae940db795a61b15ecf4df8db07b824bb062802cc98a9545bb2aaeed77cb3fc6db15dcd7d80d7d5bc406c4970a3478ada8899b329198eb61c193fb6275aa8ca340344a75a862aebe92eee1ce032fd950b47d7704a3876923b4ad62844bf4a09c4dbe8b4397184b7471360c9564880aedddb9baa4af2e75394b08cd32ff479c57a07d3eab5d54de5f9738b8d27f27a9f0ab11799d7b7ffefb2704c95c6ad12c39f1e867a4b7b1d7818a4b753dfd2a89ccb45e001a03a867b187f225dd",
- }, {
- "27182818284590452353602874713526624977572470936999595749669676273141592653589793238462643383279502884197169399375105820974944592",
- 0xff,
- "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
- "1c3b3a102f770386e4836c99e370cf9bea00803f5e482357a4ae12d414a3e63b5d31e276f8fe4a8d66b317f9ac683f44680a86ac35adfc3345befecb4bb188fd5776926c49a3095eb108fd1098baec70aaa66999a72a82f27d848b21d4a741b0c5cd4d5fff9dac89aeba122961d03a757123e9870f8acf1000020887891429ca2a3e7a7d7df7b10355165c8b9a6d0a7de8b062c4500dc4cd120c0f7418dae3d0b5781c34803fa75421c790dfe1de1834f280d7667b327f6c8cd7557e12ac3a0f93ec05c52e0493ef31a12d3d9260f79a289d6a379bc70c50841473d1a8cc81ec583e9645e07b8d9670655ba5bbcfecc6dc3966380ad8fecb17b6ba02469a020a84e18e8f84252070c13e9f1f289be54fbc481457778f616015e1327a02b140f1505eb309326d68378f8374595c849d84f4c333ec4423885143cb47bd71c5edae9be69a2ffeceb1bec9de244fbe15992b11b77c040f12bd8f6a975a44a0f90c29a9abc3d4d893927284c58754cce294529f8614dcd2aba991925fedc4ae74ffac6e333b93eb4aff0479da9a410e4450e0dd7ae4c6e2910900575da401fc07059f645e8b7e9bfdef33943054ff84011493c27b3429eaedb4ed5376441a77ed43851ad77f16f541dfd269d50d6a5f14fb0aab1cbb4c1550be97f7ab4066193c4caa773dad38014bd2092fa755c824bb5e54c4f36ffda9fcea70b9c6e693e148c151",
- },
-}
-
-func fromHex(s string) []byte {
- ret, err := hex.DecodeString(s)
- if err != nil {
- panic("xts: invalid hex in test")
- }
- return ret
-}
-
-func TestXTS(t *testing.T) {
- for i, test := range xtsTestVectors {
- c, err := NewCipher(aes.NewCipher, fromHex(test.key))
- if err != nil {
- t.Errorf("#%d: failed to create cipher: %s", i, err)
- continue
- }
- plaintext := fromHex(test.plaintext)
- ciphertext := make([]byte, len(plaintext))
- c.Encrypt(ciphertext, plaintext, test.sector)
-
- expectedCiphertext := fromHex(test.ciphertext)
- if !bytes.Equal(ciphertext, expectedCiphertext) {
- t.Errorf("#%d: encrypted failed, got: %x, want: %x", i, ciphertext, expectedCiphertext)
- continue
- }
-
- decrypted := make([]byte, len(ciphertext))
- c.Decrypt(decrypted, ciphertext, test.sector)
- if !bytes.Equal(decrypted, plaintext) {
- t.Errorf("#%d: decryption failed, got: %x, want: %x", i, decrypted, plaintext)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/context_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/context_test.go
deleted file mode 100644
index f5908780771..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/context_test.go
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cases
-
-import (
- "strings"
- "testing"
- "unicode"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/norm"
- "golang.org/x/text/unicode/rangetable"
-)
-
-// The following definitions are taken directly from Chapter 3 of The Unicode
-// Standard.
-
-func propCased(r rune) bool {
- return propLower(r) || propUpper(r) || unicode.IsTitle(r)
-}
-
-func propLower(r rune) bool {
- return unicode.IsLower(r) || unicode.Is(unicode.Other_Lowercase, r)
-}
-
-func propUpper(r rune) bool {
- return unicode.IsUpper(r) || unicode.Is(unicode.Other_Uppercase, r)
-}
-
-func propIgnore(r rune) bool {
- if unicode.In(r, unicode.Mn, unicode.Me, unicode.Cf, unicode.Lm, unicode.Sk) {
- return true
- }
- return caseIgnorable[r]
-}
-
-func hasBreakProp(r rune) bool {
- // binary search over ranges
- lo := 0
- hi := len(breakProp)
- for lo < hi {
- m := lo + (hi-lo)/2
- bp := &breakProp[m]
- if bp.lo <= r && r <= bp.hi {
- return true
- }
- if r < bp.lo {
- hi = m
- } else {
- lo = m + 1
- }
- }
- return false
-}
-
-func contextFromRune(r rune) *context {
- c := context{dst: make([]byte, 128), src: []byte(string(r)), atEOF: true}
- c.next()
- return &c
-}
-
-func TestCaseProperties(t *testing.T) {
- if unicode.Version != UnicodeVersion {
- // Properties of existing code points may change by Unicode version, so
- // we need to skip.
- t.Skipf("Skipping as core Unicode version %s different than %s", unicode.Version, UnicodeVersion)
- }
- assigned := rangetable.Assigned(UnicodeVersion)
- coreVersion := rangetable.Assigned(unicode.Version)
- for r := rune(0); r <= lastRuneForTesting; r++ {
- if !unicode.In(r, assigned) || !unicode.In(r, coreVersion) {
- continue
- }
- c := contextFromRune(r)
- if got, want := c.info.isCaseIgnorable(), propIgnore(r); got != want {
- t.Errorf("caseIgnorable(%U): got %v; want %v (%x)", r, got, want, c.info)
- }
- // New letters may change case types, but existing case pairings should
- // not change. See Case Pair Stability in
- // http://unicode.org/policies/stability_policy.html.
- if rf := unicode.SimpleFold(r); rf != r && unicode.In(rf, assigned) {
- if got, want := c.info.isCased(), propCased(r); got != want {
- t.Errorf("cased(%U): got %v; want %v (%x)", r, got, want, c.info)
- }
- if got, want := c.caseType() == cUpper, propUpper(r); got != want {
- t.Errorf("upper(%U): got %v; want %v (%x)", r, got, want, c.info)
- }
- if got, want := c.caseType() == cLower, propLower(r); got != want {
- t.Errorf("lower(%U): got %v; want %v (%x)", r, got, want, c.info)
- }
- }
- if got, want := c.info.isBreak(), hasBreakProp(r); got != want {
- t.Errorf("isBreak(%U): got %v; want %v (%x)", r, got, want, c.info)
- }
- }
- // TODO: get title case from unicode file.
-}
-
-func TestMapping(t *testing.T) {
- assigned := rangetable.Assigned(UnicodeVersion)
- coreVersion := rangetable.Assigned(unicode.Version)
- if coreVersion == nil {
- coreVersion = assigned
- }
- apply := func(r rune, f func(c *context) bool) string {
- c := contextFromRune(r)
- f(c)
- return string(c.dst[:c.pDst])
- }
-
- for r, tt := range special {
- if got, want := apply(r, lower), tt.toLower; got != want {
- t.Errorf("lowerSpecial:(%U): got %+q; want %+q", r, got, want)
- }
- if got, want := apply(r, title), tt.toTitle; got != want {
- t.Errorf("titleSpecial:(%U): got %+q; want %+q", r, got, want)
- }
- if got, want := apply(r, upper), tt.toUpper; got != want {
- t.Errorf("upperSpecial:(%U): got %+q; want %+q", r, got, want)
- }
- }
-
- for r := rune(0); r <= lastRuneForTesting; r++ {
- if !unicode.In(r, assigned) || !unicode.In(r, coreVersion) {
- continue
- }
- if rf := unicode.SimpleFold(r); rf == r || !unicode.In(rf, assigned) {
- continue
- }
- if _, ok := special[r]; ok {
- continue
- }
- want := string(unicode.ToLower(r))
- if got := apply(r, lower); got != want {
- t.Errorf("lower:%q (%U): got %q %U; want %q %U", r, r, got, []rune(got), want, []rune(want))
- }
-
- want = string(unicode.ToUpper(r))
- if got := apply(r, upper); got != want {
- t.Errorf("upper:%q (%U): got %q %U; want %q %U", r, r, got, []rune(got), want, []rune(want))
- }
-
- want = string(unicode.ToTitle(r))
- if got := apply(r, title); got != want {
- t.Errorf("title:%q (%U): got %q %U; want %q %U", r, r, got, []rune(got), want, []rune(want))
- }
- }
-}
-
-func runeFoldData(r rune) (x struct{ simple, full, special string }) {
- x = foldMap[r]
- if x.simple == "" {
- x.simple = string(unicode.ToLower(r))
- }
- if x.full == "" {
- x.full = string(unicode.ToLower(r))
- }
- if x.special == "" {
- x.special = x.full
- }
- return
-}
-
-func TestFoldData(t *testing.T) {
- assigned := rangetable.Assigned(UnicodeVersion)
- coreVersion := rangetable.Assigned(unicode.Version)
- if coreVersion == nil {
- coreVersion = assigned
- }
- apply := func(r rune, f func(c *context) bool) (string, info) {
- c := contextFromRune(r)
- f(c)
- return string(c.dst[:c.pDst]), c.info.cccType()
- }
- for r := rune(0); r <= lastRuneForTesting; r++ {
- if !unicode.In(r, assigned) || !unicode.In(r, coreVersion) {
- continue
- }
- x := runeFoldData(r)
- if got, info := apply(r, foldFull); got != x.full {
- t.Errorf("full:%q (%U): got %q %U; want %q %U (ccc=%x)", r, r, got, []rune(got), x.full, []rune(x.full), info)
- }
- // TODO: special and simple.
- }
-}
-
-func TestCCC(t *testing.T) {
- assigned := rangetable.Assigned(UnicodeVersion)
- normVersion := rangetable.Assigned(norm.Version)
- for r := rune(0); r <= lastRuneForTesting; r++ {
- if !unicode.In(r, assigned) || !unicode.In(r, normVersion) {
- continue
- }
- c := contextFromRune(r)
-
- p := norm.NFC.PropertiesString(string(r))
- want := cccOther
- switch p.CCC() {
- case 0:
- want = cccZero
- case above:
- want = cccAbove
- }
- if got := c.info.cccType(); got != want {
- t.Errorf("%U: got %x; want %x", r, got, want)
- }
- }
-}
-
-func TestWordBreaks(t *testing.T) {
- for _, tt := range breakTest {
- testtext.Run(t, tt, func(t *testing.T) {
- parts := strings.Split(tt, "|")
- want := ""
- for _, s := range parts {
- found := false
- // This algorithm implements title casing given word breaks
- // as defined in the Unicode standard 3.13 R3.
- for _, r := range s {
- title := unicode.ToTitle(r)
- lower := unicode.ToLower(r)
- if !found && title != lower {
- found = true
- want += string(title)
- } else {
- want += string(lower)
- }
- }
- }
- src := strings.Join(parts, "")
- got := Title(language.Und).String(src)
- if got != want {
- t.Errorf("got %q; want %q", got, want)
- }
- })
- }
-}
-
-func TestContext(t *testing.T) {
- tests := []struct {
- desc string
- dstSize int
- atEOF bool
- src string
- out string
- nSrc int
- err error
- ops string
- prefixArg string
- prefixWant bool
- }{{
- desc: "next: past end, atEOF, no checkpoint",
- dstSize: 10,
- atEOF: true,
- src: "12",
- out: "",
- nSrc: 2,
- ops: "next;next;next",
- // Test that calling prefix with a non-empty argument when the buffer
- // is depleted returns false.
- prefixArg: "x",
- prefixWant: false,
- }, {
- desc: "next: not at end, atEOF, no checkpoint",
- dstSize: 10,
- atEOF: false,
- src: "12",
- out: "",
- nSrc: 0,
- err: transform.ErrShortSrc,
- ops: "next;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "next: past end, !atEOF, no checkpoint",
- dstSize: 10,
- atEOF: false,
- src: "12",
- out: "",
- nSrc: 0,
- err: transform.ErrShortSrc,
- ops: "next;next;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "next: past end, !atEOF, checkpoint",
- dstSize: 10,
- atEOF: false,
- src: "12",
- out: "",
- nSrc: 2,
- ops: "next;next;checkpoint;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "copy: exact count, atEOF, no checkpoint",
- dstSize: 2,
- atEOF: true,
- src: "12",
- out: "12",
- nSrc: 2,
- ops: "next;copy;next;copy;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "copy: past end, !atEOF, no checkpoint",
- dstSize: 2,
- atEOF: false,
- src: "12",
- out: "",
- nSrc: 0,
- err: transform.ErrShortSrc,
- ops: "next;copy;next;copy;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "copy: past end, !atEOF, checkpoint",
- dstSize: 2,
- atEOF: false,
- src: "12",
- out: "12",
- nSrc: 2,
- ops: "next;copy;next;copy;checkpoint;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "copy: short dst",
- dstSize: 1,
- atEOF: false,
- src: "12",
- out: "",
- nSrc: 0,
- err: transform.ErrShortDst,
- ops: "next;copy;next;copy;checkpoint;next",
- prefixArg: "12",
- prefixWant: false,
- }, {
- desc: "copy: short dst, checkpointed",
- dstSize: 1,
- atEOF: false,
- src: "12",
- out: "1",
- nSrc: 1,
- err: transform.ErrShortDst,
- ops: "next;copy;checkpoint;next;copy;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "writeString: simple",
- dstSize: 3,
- atEOF: true,
- src: "1",
- out: "1ab",
- nSrc: 1,
- ops: "next;copy;writeab;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "writeString: short dst",
- dstSize: 2,
- atEOF: true,
- src: "12",
- out: "",
- nSrc: 0,
- err: transform.ErrShortDst,
- ops: "next;copy;writeab;next",
- prefixArg: "2",
- prefixWant: true,
- }, {
- desc: "writeString: simple",
- dstSize: 3,
- atEOF: true,
- src: "12",
- out: "1ab",
- nSrc: 2,
- ops: "next;copy;next;writeab;next",
- prefixArg: "",
- prefixWant: true,
- }, {
- desc: "writeString: short dst",
- dstSize: 2,
- atEOF: true,
- src: "12",
- out: "",
- nSrc: 0,
- err: transform.ErrShortDst,
- ops: "next;copy;next;writeab;next",
- prefixArg: "1",
- prefixWant: false,
- }, {
- desc: "prefix",
- dstSize: 2,
- atEOF: true,
- src: "12",
- out: "",
- nSrc: 0,
- // Context will assign an ErrShortSrc if the input wasn't exhausted.
- err: transform.ErrShortSrc,
- prefixArg: "12",
- prefixWant: true,
- }}
- for _, tt := range tests {
- c := context{dst: make([]byte, tt.dstSize), src: []byte(tt.src), atEOF: tt.atEOF}
-
- for _, op := range strings.Split(tt.ops, ";") {
- switch op {
- case "next":
- c.next()
- case "checkpoint":
- c.checkpoint()
- case "writeab":
- c.writeString("ab")
- case "copy":
- c.copy()
- case "":
- default:
- t.Fatalf("unknown op %q", op)
- }
- }
- if got := c.hasPrefix(tt.prefixArg); got != tt.prefixWant {
- t.Errorf("%s:\nprefix was %v; want %v", tt.desc, got, tt.prefixWant)
- }
- nDst, nSrc, err := c.ret()
- if err != tt.err {
- t.Errorf("%s:\nerror was %v; want %v", tt.desc, err, tt.err)
- }
- if out := string(c.dst[:nDst]); out != tt.out {
- t.Errorf("%s:\nout was %q; want %q", tt.desc, out, tt.out)
- }
- if nSrc != tt.nSrc {
- t.Errorf("%s:\nnSrc was %d; want %d", tt.desc, nSrc, tt.nSrc)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/example_test.go
deleted file mode 100644
index 56e6e33eed6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/example_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cases_test
-
-import (
- "fmt"
-
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
-)
-
-func Example() {
- src := []string{
- "hello world!",
- "i with dot",
- "'n ijsberg",
- "here comes O'Brian",
- }
- for _, c := range []cases.Caser{
- cases.Lower(language.Und),
- cases.Upper(language.Turkish),
- cases.Title(language.Dutch),
- cases.Title(language.Und, cases.NoLower),
- } {
- fmt.Println()
- for _, s := range src {
- fmt.Println(c.String(s))
- }
- }
-
- // Output:
- // hello world!
- // i with dot
- // 'n ijsberg
- // here comes o'brian
- //
- // HELLO WORLD!
- // İ WİTH DOT
- // 'N İJSBERG
- // HERE COMES O'BRİAN
- //
- // Hello World!
- // I With Dot
- // 'n IJsberg
- // Here Comes O'brian
- //
- // Hello World!
- // I With Dot
- // 'N Ijsberg
- // Here Comes O'Brian
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/fold_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/fold_test.go
deleted file mode 100644
index ca939c7c169..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/fold_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cases
-
-import (
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-var foldTestCases = []string{
- "βß\u13f8", // "βssᏰ"
- "ab\u13fc\uab7aꭰ", // abᏴᎪᎠ
- "affifflast", // affifflast
- "Iİiı\u0345", // ii̇iıι
- "µµΜΜςσΣΣ", // μμμμσσσσ
-}
-
-func TestFold(t *testing.T) {
- for _, tc := range foldTestCases {
- testEntry := func(name string, c Caser, m func(r rune) string) {
- want := ""
- for _, r := range tc {
- want += m(r)
- }
- if got := c.String(tc); got != want {
- t.Errorf("%s(%s) = %+q; want %+q", name, tc, got, want)
- }
- dst := make([]byte, 256) // big enough to hold any result
- src := []byte(tc)
- v := testtext.AllocsPerRun(20, func() {
- c.Transform(dst, src, true)
- })
- if v > 0 {
- t.Errorf("%s(%s): number of allocs was %f; want 0", name, tc, v)
- }
- }
- testEntry("FullFold", Fold(), func(r rune) string {
- return runeFoldData(r).full
- })
- // TODO:
- // testEntry("SimpleFold", Fold(Compact), func(r rune) string {
- // return runeFoldData(r).simple
- // })
- // testEntry("SpecialFold", Fold(Turkic), func(r rune) string {
- // return runeFoldData(r).special
- // })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/icu_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/icu_test.go
deleted file mode 100644
index 3d07e2588e4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/icu_test.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build icu
-
-package cases
-
-import (
- "path"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/unicode/norm"
-)
-
-func TestICUConformance(t *testing.T) {
- // Build test set.
- input := []string{
- "a.a a_a",
- "a\u05d0a",
- "\u05d0'a",
- "a\u03084a",
- "a\u0308a",
- "a3\u30a3a",
- "a\u303aa",
- "a_\u303a_a",
- "1_a..a",
- "1_a.a",
- "a..a.",
- "a--a-",
- "a-a-",
- "a\u200ba",
- "a\u200b\u200ba",
- "a\u00ad\u00ada", // Format
- "a\u00ada",
- "a''a", // SingleQuote
- "a'a",
- "a::a", // MidLetter
- "a:a",
- "a..a", // MidNumLet
- "a.a",
- "a;;a", // MidNum
- "a;a",
- "a__a", // ExtendNumlet
- "a_a",
- "ΟΣ''a",
- }
- add := func(x interface{}) {
- switch v := x.(type) {
- case string:
- input = append(input, v)
- case []string:
- for _, s := range v {
- input = append(input, s)
- }
- }
- }
- for _, tc := range testCases {
- add(tc.src)
- add(tc.lower)
- add(tc.upper)
- add(tc.title)
- }
- for _, tc := range bufferTests {
- add(tc.src)
- }
- for _, tc := range breakTest {
- add(strings.Replace(tc, "|", "", -1))
- }
- for _, tc := range foldTestCases {
- add(tc)
- }
-
- // Compare ICU to Go.
- for _, c := range []string{"lower", "upper", "title", "fold"} {
- for _, tag := range []string{
- "und", "af", "az", "el", "lt", "nl", "tr",
- } {
- for _, s := range input {
- if exclude(c, tag, s) {
- continue
- }
- testtext.Run(t, path.Join(c, tag, s), func(t *testing.T) {
- want := doICU(tag, c, s)
- got := doGo(tag, c, s)
- if norm.NFC.String(got) != norm.NFC.String(want) {
- t.Errorf("\n in %[3]q (%+[3]q)\n got %[1]q (%+[1]q)\n want %[2]q (%+[2]q)", got, want, s)
- }
- })
- }
- }
- }
-}
-
-// exclude indicates if a string should be excluded from testing.
-func exclude(cm, tag, s string) bool {
- list := []struct{ cm, tags, pattern string }{
- // TODO: Go does not handle certain esoteric breaks correctly. This will be
- // fixed once we have a real word break iterator. Alternatively, it
- // seems like we're not too far off from making it work, so we could
- // fix these last steps. But first verify that using a separate word
- // breaker does not hurt performance.
- {"title", "af nl", "a''a"},
- {"", "", "א'a"},
-
- // All the exclusions below seem to be issues with the ICU
- // implementation (at version 57) and thus are not marked as TODO.
-
- // ICU does not handle leading apostrophe for Dutch and
- // Afrikaans correctly. See http://unicode.org/cldr/trac/ticket/7078.
- {"title", "af nl", "'n"},
- {"title", "af nl", "'N"},
-
- // Go terminates the final sigma check after a fixed number of
- // ignorables have been found. This ensures that the algorithm can make
- // progress in a streaming scenario.
- {"lower title", "", "\u039f\u03a3...............................a"},
- // This also applies to upper in Greek.
- // NOTE: we could fix the following two cases by adding state to elUpper
- // and aztrLower. However, considering a modifier to not belong to the
- // preceding letter after the maximum modifiers count is reached is
- // consistent with the behavior of unicode/norm.
- {"upper", "el", "\u03bf" + strings.Repeat("\u0321", 29) + "\u0313"},
- {"lower", "az tr lt", "I" + strings.Repeat("\u0321", 30) + "\u0307\u0300"},
- {"upper", "lt", "i" + strings.Repeat("\u0321", 30) + "\u0307\u0300"},
- {"lower", "lt", "I" + strings.Repeat("\u0321", 30) + "\u0300"},
-
- // ICU title case seems to erroneously removes \u0307 from an upper case
- // I unconditionally, instead of only when lowercasing. The ICU
- // transform algorithm transforms these cases consistently with our
- // implementation.
- {"title", "az tr", "\u0307"},
-
- // The spec says to remove \u0307 after Soft-Dotted characters. ICU
- // transforms conform but ucasemap_utf8ToUpper does not.
- {"upper title", "lt", "i\u0307"},
- {"upper title", "lt", "i" + strings.Repeat("\u0321", 29) + "\u0307\u0300"},
-
- // Both Unicode and CLDR prescribe an extra explicit dot above after a
- // Soft_Dotted character if there are other modifiers.
- // ucasemap_utf8ToUpper does not do this; ICU transforms do.
- // The issue with ucasemap_utf8ToUpper seems to be that it does not
- // consider the modifiers that are part of composition in the evaluation
- // of More_Above. For instance, according to the More_Above rule for lt,
- // a dotted capital I (U+0130) becomes i\u0307\u0307 (an small i with
- // two additional dots). This seems odd, but is correct. ICU is
- // definitely not correct as it produces different results for different
- // normal forms. For instance, for an İ:
- // \u0130 (NFC) -> i\u0307 (incorrect)
- // I\u0307 (NFD) -> i\u0307\u0307 (correct)
- // We could argue that we should not add a \u0307 if there already is
- // one, but this may be hard to get correct and is not conform the
- // standard.
- {"lower title", "lt", "\u0130"},
- {"lower title", "lt", "\u00cf"},
-
- // We are conform ICU ucasemap_utf8ToUpper if we remove support for
- // elUpper. However, this is clearly not conform the spec. Moreover, the
- // ICU transforms _do_ implement this transform and produces results
- // consistent with our implementation. Note that we still prefer to use
- // ucasemap_utf8ToUpper instead of transforms as the latter have
- // inconsistencies in the word breaking algorithm.
- {"upper", "el", "\u0386"}, // GREEK CAPITAL LETTER ALPHA WITH TONOS
- {"upper", "el", "\u0389"}, // GREEK CAPITAL LETTER ETA WITH TONOS
- {"upper", "el", "\u038A"}, // GREEK CAPITAL LETTER IOTA WITH TONOS
-
- {"upper", "el", "\u0391"}, // GREEK CAPITAL LETTER ALPHA
- {"upper", "el", "\u0397"}, // GREEK CAPITAL LETTER ETA
- {"upper", "el", "\u0399"}, // GREEK CAPITAL LETTER IOTA
-
- {"upper", "el", "\u03AC"}, // GREEK SMALL LETTER ALPHA WITH TONOS
- {"upper", "el", "\u03AE"}, // GREEK SMALL LETTER ALPHA WITH ETA
- {"upper", "el", "\u03AF"}, // GREEK SMALL LETTER ALPHA WITH IOTA
-
- {"upper", "el", "\u03B1"}, // GREEK SMALL LETTER ALPHA
- {"upper", "el", "\u03B7"}, // GREEK SMALL LETTER ETA
- {"upper", "el", "\u03B9"}, // GREEK SMALL LETTER IOTA
- }
- for _, x := range list {
- if x.cm != "" && strings.Index(x.cm, cm) == -1 {
- continue
- }
- if x.tags != "" && strings.Index(x.tags, tag) == -1 {
- continue
- }
- if strings.Index(s, x.pattern) != -1 {
- return true
- }
- }
- return false
-}
-
-func doGo(tag, caser, input string) string {
- var c Caser
- t := language.MustParse(tag)
- switch caser {
- case "lower":
- c = Lower(t)
- case "upper":
- c = Upper(t)
- case "title":
- c = Title(t)
- case "fold":
- c = Fold()
- }
- return c.String(input)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/map_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/map_test.go
deleted file mode 100644
index 8ac39118daa..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/map_test.go
+++ /dev/null
@@ -1,950 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cases
-
-import (
- "bytes"
- "fmt"
- "path"
- "strings"
- "testing"
- "unicode/utf8"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/norm"
-)
-
-type testCase struct {
- lang string
- src interface{} // string, []string, or nil to skip test
- title interface{} // string, []string, or nil to skip test
- lower interface{} // string, []string, or nil to skip test
- upper interface{} // string, []string, or nil to skip test
- opts options
-}
-
-var testCases = []testCase{
- 0: {
- lang: "und",
- src: "abc aBc ABC abC İsıI ΕΣΆΣ",
- title: "Abc Abc Abc Abc İsıi Εσάσ",
- lower: "abc abc abc abc i\u0307sıi εσάσ",
- upper: "ABC ABC ABC ABC İSII ΕΣΆΣ",
- opts: getOpts(HandleFinalSigma(false)),
- },
-
- 1: {
- lang: "und",
- src: "abc aBc ABC abC İsıI ΕΣΆΣ Σ _Σ -Σ",
- title: "Abc Abc Abc Abc İsıi Εσάς Σ _Σ -Σ",
- lower: "abc abc abc abc i\u0307sıi εσάς σ _σ -σ",
- upper: "ABC ABC ABC ABC İSII ΕΣΆΣ Σ _Σ -Σ",
- opts: getOpts(HandleFinalSigma(true)),
- },
-
- 2: { // Title cased runes.
- lang: supported,
- src: "DžA",
- title: "Dža",
- lower: "dža",
- upper: "DŽA",
- },
-
- 3: {
- // Title breaking.
- lang: supported,
- src: []string{
- "FOO CASE TEST",
- "DON'T DO THiS",
- "χωΡΊΣ χωΡΊΣ^a χωΡΊΣ:a χωΡΊΣ:^a χωΡΊΣ^ όμΩΣ Σ",
- "with-hyphens",
- "49ers 49ers",
- `"capitalize a^a -hyphen 0X _u a_u:a`,
- "MidNumLet a.b\u2018c\u2019d\u2024e\ufe52f\uff07f\uff0eg",
- "MidNum a,b;c\u037ed\u0589e\u060cf\u2044g\ufe50h",
- "\u0345 x\u3031x x\u05d0x \u05d0x a'.a a.a a4,a",
- },
- title: []string{
- "Foo Case Test",
- "Don't Do This",
- "Χωρίς Χωρίσ^A Χωρίσ:a Χωρίσ:^A Χωρίς^ Όμως Σ",
- "With-Hyphens",
- // Note that 49Ers is correct according to the spec.
- // TODO: provide some option to the user to treat different
- // characters as cased.
- "49Ers 49Ers",
- `"Capitalize A^A -Hyphen 0X _U A_u:a`,
- "Midnumlet A.b\u2018c\u2019d\u2024e\ufe52f\uff07f\uff0eg",
- "Midnum A,B;C\u037eD\u0589E\u060cF\u2044G\ufe50H",
- "\u0399 X\u3031X X\u05d0x \u05d0X A'.A A.a A4,A",
- },
- },
-
- // TODO: These are known deviations from the options{} Unicode Word Breaking
- // Algorithm.
- // {
- // "und",
- // "x_\u3031_x a4,4a",
- // "X_\u3031_x A4,4a", // Currently is "X_\U3031_X A4,4A".
- // "x_\u3031_x a4,4a",
- // "X_\u3031_X A4,4A",
- // options{},
- // },
-
- 4: {
- // Tests title options
- lang: "und",
- src: "abc aBc ABC abC İsıI o'Brien",
- title: "Abc ABc ABC AbC İsıI O'Brien",
- opts: getOpts(NoLower),
- },
-
- 5: {
- lang: "el",
- src: "aBc ΟΔΌΣ Οδός Σο ΣΟ Σ oΣ ΟΣ σ ἕξ \u03ac",
- title: "Abc Οδός Οδός Σο Σο Σ Oς Ος Σ Ἕξ \u0386",
- lower: "abc οδός οδός σο σο σ oς ος σ ἕξ \u03ac",
- upper: "ABC ΟΔΟΣ ΟΔΟΣ ΣΟ ΣΟ Σ OΣ ΟΣ Σ ΕΞ \u0391", // Uppercase removes accents
- },
-
- 6: {
- lang: "tr az",
- src: "Isiİ İsıI I\u0307sIiİ İsıI\u0307 I\u0300\u0307",
- title: "Isii İsıı I\u0307sıii İsıi I\u0300\u0307",
- lower: "ısii isıı isıii isıi \u0131\u0300\u0307",
- upper: "ISİİ İSII I\u0307SIİİ İSII\u0307 I\u0300\u0307",
- },
-
- 7: {
- lang: "lt",
- src: "I Ï J J̈ Į Į̈ Ì Í Ĩ xi̇̈ xj̇̈ xį̇̈ xi̇̀ xi̇́ xi̇̃ XI XÏ XJ XJ̈ XĮ XĮ̈ XI̟̤",
- title: "I Ï J J̈ Į Į̈ Ì Í Ĩ Xi̇̈ Xj̇̈ Xį̇̈ Xi̇̀ Xi̇́ Xi̇̃ Xi Xi̇̈ Xj Xj̇̈ Xį Xį̇̈ Xi̟̤",
- lower: "i i̇̈ j j̇̈ į į̇̈ i̇̀ i̇́ i̇̃ xi̇̈ xj̇̈ xį̇̈ xi̇̀ xi̇́ xi̇̃ xi xi̇̈ xj xj̇̈ xį xį̇̈ xi̟̤",
- upper: "I Ï J J̈ Į Į̈ Ì Í Ĩ XÏ XJ̈ XĮ̈ XÌ XÍ XĨ XI XÏ XJ XJ̈ XĮ XĮ̈ XI̟̤",
- },
-
- 8: {
- lang: "lt",
- src: "\u012e\u0300 \u00cc i\u0307\u0300 i\u0307\u0301 i\u0307\u0303 i\u0307\u0308 i\u0300\u0307",
- title: "\u012e\u0300 \u00cc \u00cc \u00cd \u0128 \u00cf I\u0300\u0307",
- lower: "\u012f\u0307\u0300 i\u0307\u0300 i\u0307\u0300 i\u0307\u0301 i\u0307\u0303 i\u0307\u0308 i\u0300\u0307",
- upper: "\u012e\u0300 \u00cc \u00cc \u00cd \u0128 \u00cf I\u0300\u0307",
- },
-
- 9: {
- lang: "nl",
- src: "ijs IJs Ij Ijs İJ İJs aa aA 'ns 'S",
- title: "IJs IJs IJ IJs İj İjs Aa Aa 'ns 's",
- },
-
- // Note: this specification is not currently part of CLDR. The same holds
- // for the leading apostrophe handling for Dutch.
- // See http://unicode.org/cldr/trac/ticket/7078.
- 10: {
- lang: "af",
- src: "wag 'n bietjie",
- title: "Wag 'n Bietjie",
- lower: "wag 'n bietjie",
- upper: "WAG 'N BIETJIE",
- },
-}
-
-func TestCaseMappings(t *testing.T) {
- for i, tt := range testCases {
- src, ok := tt.src.([]string)
- if !ok {
- src = strings.Split(tt.src.(string), " ")
- }
-
- for _, lang := range strings.Split(tt.lang, " ") {
- tag := language.MustParse(lang)
- testEntry := func(name string, mk func(language.Tag, options) transform.SpanningTransformer, gold interface{}) {
- c := Caser{mk(tag, tt.opts)}
- if gold != nil {
- wants, ok := gold.([]string)
- if !ok {
- wants = strings.Split(gold.(string), " ")
- }
- for j, want := range wants {
- if got := c.String(src[j]); got != want {
- t.Errorf("%d:%s:\n%s.String(%+q):\ngot %+q;\nwant %+q", i, lang, name, src[j], got, want)
- }
- }
- }
- dst := make([]byte, 256) // big enough to hold any result
- src := []byte(strings.Join(src, " "))
- v := testtext.AllocsPerRun(20, func() {
- c.Transform(dst, src, true)
- })
- if v > 1.1 {
- t.Errorf("%d:%s:\n%s: number of allocs was %f; want 0", i, lang, name, v)
- }
- }
- testEntry("Upper", makeUpper, tt.upper)
- testEntry("Lower", makeLower, tt.lower)
- testEntry("Title", makeTitle, tt.title)
- }
- }
-}
-
-// TestAlloc tests that some mapping methods should not cause any allocation.
-func TestAlloc(t *testing.T) {
- dst := make([]byte, 256) // big enough to hold any result
- src := []byte(txtNonASCII)
-
- for i, f := range []func() Caser{
- func() Caser { return Upper(language.Und) },
- func() Caser { return Lower(language.Und) },
- func() Caser { return Lower(language.Und, HandleFinalSigma(false)) },
- // TODO: use a shared copy for these casers as well, in order of
- // importance, starting with the most important:
- // func() Caser { return Title(language.Und) },
- // func() Caser { return Title(language.Und, HandleFinalSigma(false)) },
- } {
- testtext.Run(t, "", func(t *testing.T) {
- var c Caser
- v := testtext.AllocsPerRun(10, func() {
- c = f()
- })
- if v > 0 {
- // TODO: Right now only Upper has 1 allocation. Special-case Lower
- // and Title as well to have less allocations for the root locale.
- t.Errorf("%d:init: number of allocs was %f; want 0", i, v)
- }
- v = testtext.AllocsPerRun(2, func() {
- c.Transform(dst, src, true)
- })
- if v > 0 {
- t.Errorf("%d:transform: number of allocs was %f; want 0", i, v)
- }
- })
- }
-}
-
-func testHandover(t *testing.T, c Caser, src string) {
- want := c.String(src)
- // Find the common prefix.
- pSrc := 0
- for ; pSrc < len(src) && pSrc < len(want) && want[pSrc] == src[pSrc]; pSrc++ {
- }
-
- // Test handover for each substring of the prefix.
- for i := 0; i < pSrc; i++ {
- testtext.Run(t, fmt.Sprint("interleave/", i), func(t *testing.T) {
- dst := make([]byte, 4*len(src))
- c.Reset()
- nSpan, _ := c.Span([]byte(src[:i]), false)
- copy(dst, src[:nSpan])
- nTransform, _, _ := c.Transform(dst[nSpan:], []byte(src[nSpan:]), true)
- got := string(dst[:nSpan+nTransform])
- if got != want {
- t.Errorf("full string: got %q; want %q", got, want)
- }
- })
- }
-}
-
-func TestHandover(t *testing.T) {
- testCases := []struct {
- desc string
- t Caser
- first, second string
- }{{
- "title/nosigma/single midword",
- Title(language.Und, HandleFinalSigma(false)),
- "A.", "a",
- }, {
- "title/nosigma/single midword",
- Title(language.Und, HandleFinalSigma(false)),
- "A", ".a",
- }, {
- "title/nosigma/double midword",
- Title(language.Und, HandleFinalSigma(false)),
- "A..", "a",
- }, {
- "title/nosigma/double midword",
- Title(language.Und, HandleFinalSigma(false)),
- "A.", ".a",
- }, {
- "title/nosigma/double midword",
- Title(language.Und, HandleFinalSigma(false)),
- "A", "..a",
- }, {
- "title/sigma/single midword",
- Title(language.Und),
- "ΟΣ.", "a",
- }, {
- "title/sigma/single midword",
- Title(language.Und),
- "ΟΣ", ".a",
- }, {
- "title/sigma/double midword",
- Title(language.Und),
- "ΟΣ..", "a",
- }, {
- "title/sigma/double midword",
- Title(language.Und),
- "ΟΣ.", ".a",
- }, {
- "title/sigma/double midword",
- Title(language.Und),
- "ΟΣ", "..a",
- }, {
- "title/af/leading apostrophe",
- Title(language.Afrikaans),
- "'", "n bietje",
- }}
- for _, tc := range testCases {
- testtext.Run(t, tc.desc, func(t *testing.T) {
- src := tc.first + tc.second
- want := tc.t.String(src)
- tc.t.Reset()
- n, _ := tc.t.Span([]byte(tc.first), false)
-
- dst := make([]byte, len(want))
- copy(dst, tc.first[:n])
-
- nDst, _, _ := tc.t.Transform(dst[n:], []byte(src[n:]), true)
- got := string(dst[:n+nDst])
- if got != want {
- t.Errorf("got %q; want %q", got, want)
- }
- })
- }
-}
-
-// minBufSize is the size of the buffer by which the casing operation in
-// this package are guaranteed to make progress.
-const minBufSize = norm.MaxSegmentSize
-
-type bufferTest struct {
- desc, src, want string
- firstErr error
- dstSize, srcSize int
- t transform.SpanningTransformer
-}
-
-var bufferTests []bufferTest
-
-func init() {
- bufferTests = []bufferTest{{
- desc: "und/upper/short dst",
- src: "abcdefg",
- want: "ABCDEFG",
- firstErr: transform.ErrShortDst,
- dstSize: 3,
- srcSize: minBufSize,
- t: Upper(language.Und),
- }, {
- desc: "und/upper/short src",
- src: "123é56",
- want: "123É56",
- firstErr: transform.ErrShortSrc,
- dstSize: 4,
- srcSize: 4,
- t: Upper(language.Und),
- }, {
- desc: "und/upper/no error on short",
- src: "12",
- want: "12",
- firstErr: nil,
- dstSize: 1,
- srcSize: 1,
- t: Upper(language.Und),
- }, {
- desc: "und/lower/short dst",
- src: "ABCDEFG",
- want: "abcdefg",
- firstErr: transform.ErrShortDst,
- dstSize: 3,
- srcSize: minBufSize,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/short src",
- src: "123É56",
- want: "123é56",
- firstErr: transform.ErrShortSrc,
- dstSize: 4,
- srcSize: 4,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/no error on short",
- src: "12",
- want: "12",
- firstErr: nil,
- dstSize: 1,
- srcSize: 1,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/simple (no final sigma)",
- src: "ΟΣ ΟΣΣ",
- want: "οσ οσσ",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Lower(language.Und, HandleFinalSigma(false)),
- }, {
- desc: "und/title/simple (no final sigma)",
- src: "ΟΣ ΟΣΣ",
- want: "Οσ Οσσ",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Title(language.Und, HandleFinalSigma(false)),
- }, {
- desc: "und/title/final sigma: no error",
- src: "ΟΣ",
- want: "Ος",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- desc: "und/title/final sigma: short source",
- src: "ΟΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣ",
- want: "Οσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσς",
- firstErr: transform.ErrShortSrc,
- dstSize: minBufSize,
- srcSize: 10,
- t: Title(language.Und),
- }, {
- desc: "und/title/final sigma: short destination 1",
- src: "ΟΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣ",
- want: "Οσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσς",
- firstErr: transform.ErrShortDst,
- dstSize: 10,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- desc: "und/title/final sigma: short destination 2",
- src: "ΟΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣ",
- want: "Οσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσς",
- firstErr: transform.ErrShortDst,
- dstSize: 9,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- desc: "und/title/final sigma: short destination 3",
- src: "ΟΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣΣ",
- want: "Οσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσς",
- firstErr: transform.ErrShortDst,
- dstSize: 8,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- desc: "und/title/clipped UTF-8 rune",
- src: "σσσσσσσσσσσ",
- want: "Σσσσσσσσσσσ",
- firstErr: transform.ErrShortSrc,
- dstSize: minBufSize,
- srcSize: 5,
- t: Title(language.Und),
- }, {
- desc: "und/title/clipped UTF-8 rune atEOF",
- src: "σσσ" + string([]byte{0xCF}),
- want: "Σσσ" + string([]byte{0xCF}),
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- // Note: the choice to change the final sigma at the end in case of
- // too many case ignorables is arbitrary. The main reason for this
- // choice is that it results in simpler code.
- desc: "und/title/final sigma: max ignorables",
- src: "ΟΣ" + strings.Repeat(".", maxIgnorable) + "a",
- want: "Οσ" + strings.Repeat(".", maxIgnorable) + "A",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- // Note: the choice to change the final sigma at the end in case of
- // too many case ignorables is arbitrary. The main reason for this
- // choice is that it results in simpler code.
- desc: "und/title/long string",
- src: "AA" + strings.Repeat(".", maxIgnorable+1) + "a",
- want: "Aa" + strings.Repeat(".", maxIgnorable+1) + "A",
- dstSize: minBufSize,
- srcSize: len("AA" + strings.Repeat(".", maxIgnorable+1)),
- t: Title(language.Und),
- }, {
- // Note: the choice to change the final sigma at the end in case of
- // too many case ignorables is arbitrary. The main reason for this
- // choice is that it results in simpler code.
- desc: "und/title/final sigma: too many ignorables",
- src: "ΟΣ" + strings.Repeat(".", maxIgnorable+1) + "a",
- want: "Ος" + strings.Repeat(".", maxIgnorable+1) + "A",
- dstSize: minBufSize,
- srcSize: len("ΟΣ" + strings.Repeat(".", maxIgnorable+1)),
- t: Title(language.Und),
- }, {
- desc: "und/title/final sigma: apostrophe",
- src: "ΟΣ''a",
- want: "Οσ''A",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Title(language.Und),
- }, {
- desc: "el/upper/max ignorables",
- src: "ο" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0313",
- want: "Ο" + strings.Repeat("\u0321", maxIgnorable-1),
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Upper(language.Greek),
- }, {
- desc: "el/upper/too many ignorables",
- src: "ο" + strings.Repeat("\u0321", maxIgnorable) + "\u0313",
- want: "Ο" + strings.Repeat("\u0321", maxIgnorable) + "\u0313",
- dstSize: minBufSize,
- srcSize: len("ο" + strings.Repeat("\u0321", maxIgnorable)),
- t: Upper(language.Greek),
- }, {
- desc: "el/upper/short dst",
- src: "123ο",
- want: "123Ο",
- firstErr: transform.ErrShortDst,
- dstSize: 3,
- srcSize: minBufSize,
- t: Upper(language.Greek),
- }, {
- desc: "lt/lower/max ignorables",
- src: "I" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0300",
- want: "i" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0307\u0300",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/lower/too many ignorables",
- src: "I" + strings.Repeat("\u0321", maxIgnorable) + "\u0300",
- want: "i" + strings.Repeat("\u0321", maxIgnorable) + "\u0300",
- dstSize: minBufSize,
- srcSize: len("I" + strings.Repeat("\u0321", maxIgnorable)),
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/lower/decomposition with short dst buffer 1",
- src: "aaaaa\u00cc", // U+00CC LATIN CAPITAL LETTER I GRAVE
- firstErr: transform.ErrShortDst,
- want: "aaaaai\u0307\u0300",
- dstSize: 5,
- srcSize: minBufSize,
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/lower/decomposition with short dst buffer 2",
- src: "aaaa\u00cc", // U+00CC LATIN CAPITAL LETTER I GRAVE
- firstErr: transform.ErrShortDst,
- want: "aaaai\u0307\u0300",
- dstSize: 5,
- srcSize: minBufSize,
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/upper/max ignorables",
- src: "i" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0307\u0300",
- want: "I" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0300",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Upper(language.Lithuanian),
- }, {
- desc: "lt/upper/too many ignorables",
- src: "i" + strings.Repeat("\u0321", maxIgnorable) + "\u0307\u0300",
- want: "I" + strings.Repeat("\u0321", maxIgnorable) + "\u0307\u0300",
- dstSize: minBufSize,
- srcSize: len("i" + strings.Repeat("\u0321", maxIgnorable)),
- t: Upper(language.Lithuanian),
- }, {
- desc: "lt/upper/short dst",
- src: "12i\u0307\u0300",
- want: "12\u00cc",
- firstErr: transform.ErrShortDst,
- dstSize: 3,
- srcSize: minBufSize,
- t: Upper(language.Lithuanian),
- }, {
- desc: "aztr/lower/max ignorables",
- src: "I" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0307\u0300",
- want: "i" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0300",
- dstSize: minBufSize,
- srcSize: minBufSize,
- t: Lower(language.Turkish),
- }, {
- desc: "aztr/lower/too many ignorables",
- src: "I" + strings.Repeat("\u0321", maxIgnorable) + "\u0307\u0300",
- want: "\u0131" + strings.Repeat("\u0321", maxIgnorable) + "\u0307\u0300",
- dstSize: minBufSize,
- srcSize: len("I" + strings.Repeat("\u0321", maxIgnorable)),
- t: Lower(language.Turkish),
- }, {
- desc: "nl/title/pre-IJ cutoff",
- src: " ij",
- want: " IJ",
- firstErr: transform.ErrShortDst,
- dstSize: 2,
- srcSize: minBufSize,
- t: Title(language.Dutch),
- }, {
- desc: "nl/title/mid-IJ cutoff",
- src: " ij",
- want: " IJ",
- firstErr: transform.ErrShortDst,
- dstSize: 3,
- srcSize: minBufSize,
- t: Title(language.Dutch),
- }, {
- desc: "af/title/apostrophe",
- src: "'n bietje",
- want: "'n Bietje",
- firstErr: transform.ErrShortDst,
- dstSize: 3,
- srcSize: minBufSize,
- t: Title(language.Afrikaans),
- }}
-}
-
-func TestShortBuffersAndOverflow(t *testing.T) {
- for i, tt := range bufferTests {
- testtext.Run(t, tt.desc, func(t *testing.T) {
- buf := make([]byte, tt.dstSize)
- got := []byte{}
- var nSrc, nDst int
- var err error
- for p := 0; p < len(tt.src); p += nSrc {
- q := p + tt.srcSize
- if q > len(tt.src) {
- q = len(tt.src)
- }
- nDst, nSrc, err = tt.t.Transform(buf, []byte(tt.src[p:q]), q == len(tt.src))
- got = append(got, buf[:nDst]...)
-
- if p == 0 && err != tt.firstErr {
- t.Errorf("%d:%s:\n error was %v; want %v", i, tt.desc, err, tt.firstErr)
- break
- }
- }
- if string(got) != tt.want {
- t.Errorf("%d:%s:\ngot %+q;\nwant %+q", i, tt.desc, got, tt.want)
- }
- testHandover(t, Caser{tt.t}, tt.src)
- })
- }
-}
-
-func TestSpan(t *testing.T) {
- for _, tt := range []struct {
- desc string
- src string
- want string
- atEOF bool
- err error
- t Caser
- }{{
- desc: "und/upper/basic",
- src: "abcdefg",
- want: "",
- atEOF: true,
- err: transform.ErrEndOfSpan,
- t: Upper(language.Und),
- }, {
- desc: "und/upper/short src",
- src: "123É"[:4],
- want: "123",
- atEOF: false,
- err: transform.ErrShortSrc,
- t: Upper(language.Und),
- }, {
- desc: "und/upper/no error on short",
- src: "12",
- want: "12",
- atEOF: false,
- t: Upper(language.Und),
- }, {
- desc: "und/lower/basic",
- src: "ABCDEFG",
- want: "",
- atEOF: true,
- err: transform.ErrEndOfSpan,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/short src num",
- src: "123é"[:4],
- want: "123",
- atEOF: false,
- err: transform.ErrShortSrc,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/short src greek",
- src: "αβγé"[:7],
- want: "αβγ",
- atEOF: false,
- err: transform.ErrShortSrc,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/no error on short",
- src: "12",
- want: "12",
- atEOF: false,
- t: Lower(language.Und),
- }, {
- desc: "und/lower/simple (no final sigma)",
- src: "ος οσσ",
- want: "οσ οσσ",
- atEOF: true,
- t: Lower(language.Und, HandleFinalSigma(false)),
- }, {
- desc: "und/title/simple (no final sigma)",
- src: "Οσ Οσσ",
- want: "Οσ Οσσ",
- atEOF: true,
- t: Title(language.Und, HandleFinalSigma(false)),
- }, {
- desc: "und/lower/final sigma: no error",
- src: "οΣ", // Oς
- want: "ο", // Oς
- err: transform.ErrEndOfSpan,
- t: Lower(language.Und),
- }, {
- desc: "und/title/final sigma: no error",
- src: "ΟΣ", // Oς
- want: "Ο", // Oς
- err: transform.ErrEndOfSpan,
- t: Title(language.Und),
- }, {
- desc: "und/title/final sigma: no short source!",
- src: "ΟσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσΣ",
- want: "Οσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσσ",
- err: transform.ErrEndOfSpan,
- t: Title(language.Und),
- }, {
- desc: "und/title/clipped UTF-8 rune",
- src: "Σσ" + string([]byte{0xCF}),
- want: "Σσ",
- atEOF: false,
- err: transform.ErrShortSrc,
- t: Title(language.Und),
- }, {
- desc: "und/title/clipped UTF-8 rune atEOF",
- src: "Σσσ" + string([]byte{0xCF}),
- want: "Σσσ" + string([]byte{0xCF}),
- atEOF: true,
- t: Title(language.Und),
- }, {
- // Note: the choice to change the final sigma at the end in case of
- // too many case ignorables is arbitrary. The main reason for this
- // choice is that it results in simpler code.
- desc: "und/title/long string",
- src: "A" + strings.Repeat("a", maxIgnorable+5),
- want: "A" + strings.Repeat("a", maxIgnorable+5),
- t: Title(language.Und),
- }, {
- // Note: the choice to change the final sigma at the end in case of
- // too many case ignorables is arbitrary. The main reason for this
- // choice is that it results in simpler code.
- desc: "und/title/cyrillic",
- src: "При",
- want: "При",
- atEOF: true,
- t: Title(language.Und, HandleFinalSigma(false)),
- }, {
- // Note: the choice to change the final sigma at the end in case of
- // too many case ignorables is arbitrary. The main reason for this
- // choice is that it results in simpler code.
- desc: "und/title/final sigma: max ignorables",
- src: "Οσ" + strings.Repeat(".", maxIgnorable) + "A",
- want: "Οσ" + strings.Repeat(".", maxIgnorable) + "A",
- t: Title(language.Und),
- }, {
- desc: "el/upper/max ignorables - not implemented",
- src: "Ο" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0313",
- want: "",
- err: transform.ErrEndOfSpan,
- t: Upper(language.Greek),
- }, {
- desc: "el/upper/too many ignorables - not implemented",
- src: "Ο" + strings.Repeat("\u0321", maxIgnorable) + "\u0313",
- want: "",
- err: transform.ErrEndOfSpan,
- t: Upper(language.Greek),
- }, {
- desc: "el/upper/short dst",
- src: "123ο",
- want: "",
- err: transform.ErrEndOfSpan,
- t: Upper(language.Greek),
- }, {
- desc: "lt/lower/max ignorables",
- src: "i" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0307\u0300",
- want: "i" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0307\u0300",
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/lower/isLower",
- src: "I" + strings.Repeat("\u0321", maxIgnorable) + "\u0300",
- want: "",
- err: transform.ErrEndOfSpan,
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/lower/not identical",
- src: "aaaaa\u00cc", // U+00CC LATIN CAPITAL LETTER I GRAVE
- err: transform.ErrEndOfSpan,
- want: "aaaaa",
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/lower/identical",
- src: "aaaai\u0307\u0300", // U+00CC LATIN CAPITAL LETTER I GRAVE
- want: "aaaai\u0307\u0300",
- t: Lower(language.Lithuanian),
- }, {
- desc: "lt/upper/not implemented",
- src: "I" + strings.Repeat("\u0321", maxIgnorable-1) + "\u0300",
- want: "",
- err: transform.ErrEndOfSpan,
- t: Upper(language.Lithuanian),
- }, {
- desc: "lt/upper/not implemented, ascii",
- src: "AB",
- want: "",
- err: transform.ErrEndOfSpan,
- t: Upper(language.Lithuanian),
- }, {
- desc: "nl/title/pre-IJ cutoff",
- src: " IJ",
- want: " IJ",
- t: Title(language.Dutch),
- }, {
- desc: "nl/title/mid-IJ cutoff",
- src: " Ia",
- want: " Ia",
- t: Title(language.Dutch),
- }, {
- desc: "af/title/apostrophe",
- src: "'n Bietje",
- want: "'n Bietje",
- t: Title(language.Afrikaans),
- }, {
- desc: "af/title/apostrophe-incorrect",
- src: "'N Bietje",
- // The Single_Quote (a MidWord), needs to be retained as unspanned so
- // that a successive call to Transform can detect that N should not be
- // capitalized.
- want: "",
- err: transform.ErrEndOfSpan,
- t: Title(language.Afrikaans),
- }} {
- testtext.Run(t, tt.desc, func(t *testing.T) {
- for p := 0; p < len(tt.want); p += utf8.RuneLen([]rune(tt.src[p:])[0]) {
- tt.t.Reset()
- n, err := tt.t.Span([]byte(tt.src[:p]), false)
- if err != nil && err != transform.ErrShortSrc {
- t.Errorf("early failure:Span(%+q): %v (%d < %d)", tt.src[:p], err, n, len(tt.want))
- break
- }
- }
- tt.t.Reset()
- n, err := tt.t.Span([]byte(tt.src), tt.atEOF)
- if n != len(tt.want) || err != tt.err {
- t.Errorf("Span(%+q, %v): got %d, %v; want %d, %v", tt.src, tt.atEOF, n, err, len(tt.want), tt.err)
- }
- testHandover(t, tt.t, tt.src)
- })
- }
-}
-
-var txtASCII = strings.Repeat("The quick brown fox jumps over the lazy dog. ", 50)
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/vn/
-const txt_vn = `Với các điều kiện sau: Ghi nhận công của tác giả. Nếu bạn sử
-dụng, chuyển đổi, hoặc xây dựng dự án từ nội dung được chia sẻ này, bạn phải áp
-dụng giấy phép này hoặc một giấy phép khác có các điều khoản tương tự như giấy
-phép này cho dự án của bạn. Hiểu rằng: Miễn — Bất kỳ các điều kiện nào trên đây
-cũng có thể được miễn bỏ nếu bạn được sự cho phép của người sở hữu bản quyền.
-Phạm vi công chúng — Khi tác phẩm hoặc bất kỳ chương nào của tác phẩm đã trong
-vùng dành cho công chúng theo quy định của pháp luật thì tình trạng của nó không
-bị ảnh hưởng bởi giấy phép trong bất kỳ trường hợp nào.`
-
-// http://creativecommons.org/licenses/by-sa/2.5/cn/
-const txt_cn = `您可以自由: 复制、发行、展览、表演、放映、
-广播或通过信息网络传播本作品 创作演绎作品
-对本作品进行商业性使用 惟须遵守下列条件:
-署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。
-相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,
-您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。`
-
-// Taken from http://creativecommons.org/licenses/by-sa/1.0/deed.ru
-const txt_ru = `При обязательном соблюдении следующих условий: Attribution — Вы
-должны атрибутировать произведение (указывать автора и источник) в порядке,
-предусмотренном автором или лицензиаром (но только так, чтобы никоим образом не
-подразумевалось, что они поддерживают вас или использование вами данного
-произведения). Υπό τις ακόλουθες προϋποθέσεις:`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/gr/
-const txt_gr = `Αναφορά Δημιουργού — Θα πρέπει να κάνετε την αναφορά στο έργο με
-τον τρόπο που έχει οριστεί από το δημιουργό ή το χορηγούντο την άδεια (χωρίς
-όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή τη χρήση του έργου
-από εσάς). Παρόμοια Διανομή — Εάν αλλοιώσετε, τροποποιήσετε ή δημιουργήσετε
-περαιτέρω βασισμένοι στο έργο θα μπορείτε να διανέμετε το έργο που θα προκύψει
-μόνο με την ίδια ή παρόμοια άδεια.`
-
-const txtNonASCII = txt_vn + txt_cn + txt_ru + txt_gr
-
-// TODO: Improve ASCII performance.
-
-func BenchmarkCasers(b *testing.B) {
- for _, s := range []struct{ name, text string }{
- {"ascii", txtASCII},
- {"nonASCII", txtNonASCII},
- {"short", "При"},
- } {
- src := []byte(s.text)
- // Measure case mappings in bytes package for comparison.
- for _, f := range []struct {
- name string
- fn func(b []byte) []byte
- }{
- {"lower", bytes.ToLower},
- {"title", bytes.ToTitle},
- {"upper", bytes.ToUpper},
- } {
- testtext.Bench(b, path.Join(s.name, "bytes", f.name), func(b *testing.B) {
- b.SetBytes(int64(len(src)))
- for i := 0; i < b.N; i++ {
- f.fn(src)
- }
- })
- }
- for _, t := range []struct {
- name string
- caser transform.SpanningTransformer
- }{
- {"fold/default", Fold()},
- {"upper/default", Upper(language.Und)},
- {"lower/sigma", Lower(language.Und)},
- {"lower/simple", Lower(language.Und, HandleFinalSigma(false))},
- {"title/sigma", Title(language.Und)},
- {"title/simple", Title(language.Und, HandleFinalSigma(false))},
- } {
- c := Caser{t.caser}
- dst := make([]byte, len(src))
- testtext.Bench(b, path.Join(s.name, t.name, "transform"), func(b *testing.B) {
- b.SetBytes(int64(len(src)))
- for i := 0; i < b.N; i++ {
- c.Reset()
- c.Transform(dst, src, true)
- }
- })
- // No need to check span for simple cases, as they will be the same
- // as sigma.
- if strings.HasSuffix(t.name, "/simple") {
- continue
- }
- spanSrc := c.Bytes(src)
- testtext.Bench(b, path.Join(s.name, t.name, "span"), func(b *testing.B) {
- c.Reset()
- if n, _ := c.Span(spanSrc, true); n < len(spanSrc) {
- b.Fatalf("spanner is not recognizing text %q as done (at %d)", spanSrc, n)
- }
- b.SetBytes(int64(len(spanSrc)))
- for i := 0; i < b.N; i++ {
- c.Reset()
- c.Span(spanSrc, true)
- }
- })
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables10.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables10.0.0_test.go
deleted file mode 100644
index c73c9795f07..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables10.0.0_test.go
+++ /dev/null
@@ -1,1160 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// +build go1.10
-
-package cases
-
-var (
- caseIgnorable = map[rune]bool{
- 0x0027: true,
- 0x002e: true,
- 0x003a: true,
- 0x00b7: true,
- 0x0387: true,
- 0x05f4: true,
- 0x2018: true,
- 0x2019: true,
- 0x2024: true,
- 0x2027: true,
- 0xfe13: true,
- 0xfe52: true,
- 0xfe55: true,
- 0xff07: true,
- 0xff0e: true,
- 0xff1a: true,
- }
-
- special = map[rune]struct{ toLower, toTitle, toUpper string }{
- 0x00df: {"ß", "Ss", "SS"},
- 0x0130: {"i̇", "İ", "İ"},
- 0xfb00: {"ff", "Ff", "FF"},
- 0xfb01: {"fi", "Fi", "FI"},
- 0xfb02: {"fl", "Fl", "FL"},
- 0xfb03: {"ffi", "Ffi", "FFI"},
- 0xfb04: {"ffl", "Ffl", "FFL"},
- 0xfb05: {"ſt", "St", "ST"},
- 0xfb06: {"st", "St", "ST"},
- 0x0587: {"և", "Եւ", "ԵՒ"},
- 0xfb13: {"ﬓ", "Մն", "ՄՆ"},
- 0xfb14: {"ﬔ", "Մե", "ՄԵ"},
- 0xfb15: {"ﬕ", "Մի", "ՄԻ"},
- 0xfb16: {"ﬖ", "Վն", "ՎՆ"},
- 0xfb17: {"ﬗ", "Մխ", "ՄԽ"},
- 0x0149: {"ʼn", "ʼN", "ʼN"},
- 0x0390: {"ΐ", "Ϊ́", "Ϊ́"},
- 0x03b0: {"ΰ", "Ϋ́", "Ϋ́"},
- 0x01f0: {"ǰ", "J̌", "J̌"},
- 0x1e96: {"ẖ", "H̱", "H̱"},
- 0x1e97: {"ẗ", "T̈", "T̈"},
- 0x1e98: {"ẘ", "W̊", "W̊"},
- 0x1e99: {"ẙ", "Y̊", "Y̊"},
- 0x1e9a: {"ẚ", "Aʾ", "Aʾ"},
- 0x1f50: {"ὐ", "Υ̓", "Υ̓"},
- 0x1f52: {"ὒ", "Υ̓̀", "Υ̓̀"},
- 0x1f54: {"ὔ", "Υ̓́", "Υ̓́"},
- 0x1f56: {"ὖ", "Υ̓͂", "Υ̓͂"},
- 0x1fb6: {"ᾶ", "Α͂", "Α͂"},
- 0x1fc6: {"ῆ", "Η͂", "Η͂"},
- 0x1fd2: {"ῒ", "Ϊ̀", "Ϊ̀"},
- 0x1fd3: {"ΐ", "Ϊ́", "Ϊ́"},
- 0x1fd6: {"ῖ", "Ι͂", "Ι͂"},
- 0x1fd7: {"ῗ", "Ϊ͂", "Ϊ͂"},
- 0x1fe2: {"ῢ", "Ϋ̀", "Ϋ̀"},
- 0x1fe3: {"ΰ", "Ϋ́", "Ϋ́"},
- 0x1fe4: {"ῤ", "Ρ̓", "Ρ̓"},
- 0x1fe6: {"ῦ", "Υ͂", "Υ͂"},
- 0x1fe7: {"ῧ", "Ϋ͂", "Ϋ͂"},
- 0x1ff6: {"ῶ", "Ω͂", "Ω͂"},
- 0x1f80: {"ᾀ", "ᾈ", "ἈΙ"},
- 0x1f81: {"ᾁ", "ᾉ", "ἉΙ"},
- 0x1f82: {"ᾂ", "ᾊ", "ἊΙ"},
- 0x1f83: {"ᾃ", "ᾋ", "ἋΙ"},
- 0x1f84: {"ᾄ", "ᾌ", "ἌΙ"},
- 0x1f85: {"ᾅ", "ᾍ", "ἍΙ"},
- 0x1f86: {"ᾆ", "ᾎ", "ἎΙ"},
- 0x1f87: {"ᾇ", "ᾏ", "ἏΙ"},
- 0x1f88: {"ᾀ", "ᾈ", "ἈΙ"},
- 0x1f89: {"ᾁ", "ᾉ", "ἉΙ"},
- 0x1f8a: {"ᾂ", "ᾊ", "ἊΙ"},
- 0x1f8b: {"ᾃ", "ᾋ", "ἋΙ"},
- 0x1f8c: {"ᾄ", "ᾌ", "ἌΙ"},
- 0x1f8d: {"ᾅ", "ᾍ", "ἍΙ"},
- 0x1f8e: {"ᾆ", "ᾎ", "ἎΙ"},
- 0x1f8f: {"ᾇ", "ᾏ", "ἏΙ"},
- 0x1f90: {"ᾐ", "ᾘ", "ἨΙ"},
- 0x1f91: {"ᾑ", "ᾙ", "ἩΙ"},
- 0x1f92: {"ᾒ", "ᾚ", "ἪΙ"},
- 0x1f93: {"ᾓ", "ᾛ", "ἫΙ"},
- 0x1f94: {"ᾔ", "ᾜ", "ἬΙ"},
- 0x1f95: {"ᾕ", "ᾝ", "ἭΙ"},
- 0x1f96: {"ᾖ", "ᾞ", "ἮΙ"},
- 0x1f97: {"ᾗ", "ᾟ", "ἯΙ"},
- 0x1f98: {"ᾐ", "ᾘ", "ἨΙ"},
- 0x1f99: {"ᾑ", "ᾙ", "ἩΙ"},
- 0x1f9a: {"ᾒ", "ᾚ", "ἪΙ"},
- 0x1f9b: {"ᾓ", "ᾛ", "ἫΙ"},
- 0x1f9c: {"ᾔ", "ᾜ", "ἬΙ"},
- 0x1f9d: {"ᾕ", "ᾝ", "ἭΙ"},
- 0x1f9e: {"ᾖ", "ᾞ", "ἮΙ"},
- 0x1f9f: {"ᾗ", "ᾟ", "ἯΙ"},
- 0x1fa0: {"ᾠ", "ᾨ", "ὨΙ"},
- 0x1fa1: {"ᾡ", "ᾩ", "ὩΙ"},
- 0x1fa2: {"ᾢ", "ᾪ", "ὪΙ"},
- 0x1fa3: {"ᾣ", "ᾫ", "ὫΙ"},
- 0x1fa4: {"ᾤ", "ᾬ", "ὬΙ"},
- 0x1fa5: {"ᾥ", "ᾭ", "ὭΙ"},
- 0x1fa6: {"ᾦ", "ᾮ", "ὮΙ"},
- 0x1fa7: {"ᾧ", "ᾯ", "ὯΙ"},
- 0x1fa8: {"ᾠ", "ᾨ", "ὨΙ"},
- 0x1fa9: {"ᾡ", "ᾩ", "ὩΙ"},
- 0x1faa: {"ᾢ", "ᾪ", "ὪΙ"},
- 0x1fab: {"ᾣ", "ᾫ", "ὫΙ"},
- 0x1fac: {"ᾤ", "ᾬ", "ὬΙ"},
- 0x1fad: {"ᾥ", "ᾭ", "ὭΙ"},
- 0x1fae: {"ᾦ", "ᾮ", "ὮΙ"},
- 0x1faf: {"ᾧ", "ᾯ", "ὯΙ"},
- 0x1fb3: {"ᾳ", "ᾼ", "ΑΙ"},
- 0x1fbc: {"ᾳ", "ᾼ", "ΑΙ"},
- 0x1fc3: {"ῃ", "ῌ", "ΗΙ"},
- 0x1fcc: {"ῃ", "ῌ", "ΗΙ"},
- 0x1ff3: {"ῳ", "ῼ", "ΩΙ"},
- 0x1ffc: {"ῳ", "ῼ", "ΩΙ"},
- 0x1fb2: {"ᾲ", "Ὰͅ", "ᾺΙ"},
- 0x1fb4: {"ᾴ", "Άͅ", "ΆΙ"},
- 0x1fc2: {"ῂ", "Ὴͅ", "ῊΙ"},
- 0x1fc4: {"ῄ", "Ήͅ", "ΉΙ"},
- 0x1ff2: {"ῲ", "Ὼͅ", "ῺΙ"},
- 0x1ff4: {"ῴ", "Ώͅ", "ΏΙ"},
- 0x1fb7: {"ᾷ", "ᾼ͂", "Α͂Ι"},
- 0x1fc7: {"ῇ", "ῌ͂", "Η͂Ι"},
- 0x1ff7: {"ῷ", "ῼ͂", "Ω͂Ι"},
- }
-
- foldMap = map[rune]struct{ simple, full, special string }{
- 0x0049: {"", "", "ı"},
- 0x00b5: {"μ", "μ", ""},
- 0x00df: {"", "ss", ""},
- 0x0130: {"", "i̇", "i"},
- 0x0149: {"", "ʼn", ""},
- 0x017f: {"s", "s", ""},
- 0x01f0: {"", "ǰ", ""},
- 0x0345: {"ι", "ι", ""},
- 0x0390: {"", "ΐ", ""},
- 0x03b0: {"", "ΰ", ""},
- 0x03c2: {"σ", "σ", ""},
- 0x03d0: {"β", "β", ""},
- 0x03d1: {"θ", "θ", ""},
- 0x03d5: {"φ", "φ", ""},
- 0x03d6: {"π", "π", ""},
- 0x03f0: {"κ", "κ", ""},
- 0x03f1: {"ρ", "ρ", ""},
- 0x03f5: {"ε", "ε", ""},
- 0x0587: {"", "եւ", ""},
- 0x13f8: {"Ᏸ", "Ᏸ", ""},
- 0x13f9: {"Ᏹ", "Ᏹ", ""},
- 0x13fa: {"Ᏺ", "Ᏺ", ""},
- 0x13fb: {"Ᏻ", "Ᏻ", ""},
- 0x13fc: {"Ᏼ", "Ᏼ", ""},
- 0x13fd: {"Ᏽ", "Ᏽ", ""},
- 0x1c80: {"в", "в", ""},
- 0x1c81: {"д", "д", ""},
- 0x1c82: {"о", "о", ""},
- 0x1c83: {"с", "с", ""},
- 0x1c84: {"т", "т", ""},
- 0x1c85: {"т", "т", ""},
- 0x1c86: {"ъ", "ъ", ""},
- 0x1c87: {"ѣ", "ѣ", ""},
- 0x1c88: {"ꙋ", "ꙋ", ""},
- 0x1e96: {"", "ẖ", ""},
- 0x1e97: {"", "ẗ", ""},
- 0x1e98: {"", "ẘ", ""},
- 0x1e99: {"", "ẙ", ""},
- 0x1e9a: {"", "aʾ", ""},
- 0x1e9b: {"ṡ", "ṡ", ""},
- 0x1e9e: {"", "ss", ""},
- 0x1f50: {"", "ὐ", ""},
- 0x1f52: {"", "ὒ", ""},
- 0x1f54: {"", "ὔ", ""},
- 0x1f56: {"", "ὖ", ""},
- 0x1f80: {"", "ἀι", ""},
- 0x1f81: {"", "ἁι", ""},
- 0x1f82: {"", "ἂι", ""},
- 0x1f83: {"", "ἃι", ""},
- 0x1f84: {"", "ἄι", ""},
- 0x1f85: {"", "ἅι", ""},
- 0x1f86: {"", "ἆι", ""},
- 0x1f87: {"", "ἇι", ""},
- 0x1f88: {"", "ἀι", ""},
- 0x1f89: {"", "ἁι", ""},
- 0x1f8a: {"", "ἂι", ""},
- 0x1f8b: {"", "ἃι", ""},
- 0x1f8c: {"", "ἄι", ""},
- 0x1f8d: {"", "ἅι", ""},
- 0x1f8e: {"", "ἆι", ""},
- 0x1f8f: {"", "ἇι", ""},
- 0x1f90: {"", "ἠι", ""},
- 0x1f91: {"", "ἡι", ""},
- 0x1f92: {"", "ἢι", ""},
- 0x1f93: {"", "ἣι", ""},
- 0x1f94: {"", "ἤι", ""},
- 0x1f95: {"", "ἥι", ""},
- 0x1f96: {"", "ἦι", ""},
- 0x1f97: {"", "ἧι", ""},
- 0x1f98: {"", "ἠι", ""},
- 0x1f99: {"", "ἡι", ""},
- 0x1f9a: {"", "ἢι", ""},
- 0x1f9b: {"", "ἣι", ""},
- 0x1f9c: {"", "ἤι", ""},
- 0x1f9d: {"", "ἥι", ""},
- 0x1f9e: {"", "ἦι", ""},
- 0x1f9f: {"", "ἧι", ""},
- 0x1fa0: {"", "ὠι", ""},
- 0x1fa1: {"", "ὡι", ""},
- 0x1fa2: {"", "ὢι", ""},
- 0x1fa3: {"", "ὣι", ""},
- 0x1fa4: {"", "ὤι", ""},
- 0x1fa5: {"", "ὥι", ""},
- 0x1fa6: {"", "ὦι", ""},
- 0x1fa7: {"", "ὧι", ""},
- 0x1fa8: {"", "ὠι", ""},
- 0x1fa9: {"", "ὡι", ""},
- 0x1faa: {"", "ὢι", ""},
- 0x1fab: {"", "ὣι", ""},
- 0x1fac: {"", "ὤι", ""},
- 0x1fad: {"", "ὥι", ""},
- 0x1fae: {"", "ὦι", ""},
- 0x1faf: {"", "ὧι", ""},
- 0x1fb2: {"", "ὰι", ""},
- 0x1fb3: {"", "αι", ""},
- 0x1fb4: {"", "άι", ""},
- 0x1fb6: {"", "ᾶ", ""},
- 0x1fb7: {"", "ᾶι", ""},
- 0x1fbc: {"", "αι", ""},
- 0x1fbe: {"ι", "ι", ""},
- 0x1fc2: {"", "ὴι", ""},
- 0x1fc3: {"", "ηι", ""},
- 0x1fc4: {"", "ήι", ""},
- 0x1fc6: {"", "ῆ", ""},
- 0x1fc7: {"", "ῆι", ""},
- 0x1fcc: {"", "ηι", ""},
- 0x1fd2: {"", "ῒ", ""},
- 0x1fd3: {"", "ΐ", ""},
- 0x1fd6: {"", "ῖ", ""},
- 0x1fd7: {"", "ῗ", ""},
- 0x1fe2: {"", "ῢ", ""},
- 0x1fe3: {"", "ΰ", ""},
- 0x1fe4: {"", "ῤ", ""},
- 0x1fe6: {"", "ῦ", ""},
- 0x1fe7: {"", "ῧ", ""},
- 0x1ff2: {"", "ὼι", ""},
- 0x1ff3: {"", "ωι", ""},
- 0x1ff4: {"", "ώι", ""},
- 0x1ff6: {"", "ῶ", ""},
- 0x1ff7: {"", "ῶι", ""},
- 0x1ffc: {"", "ωι", ""},
- 0xab70: {"Ꭰ", "Ꭰ", ""},
- 0xab71: {"Ꭱ", "Ꭱ", ""},
- 0xab72: {"Ꭲ", "Ꭲ", ""},
- 0xab73: {"Ꭳ", "Ꭳ", ""},
- 0xab74: {"Ꭴ", "Ꭴ", ""},
- 0xab75: {"Ꭵ", "Ꭵ", ""},
- 0xab76: {"Ꭶ", "Ꭶ", ""},
- 0xab77: {"Ꭷ", "Ꭷ", ""},
- 0xab78: {"Ꭸ", "Ꭸ", ""},
- 0xab79: {"Ꭹ", "Ꭹ", ""},
- 0xab7a: {"Ꭺ", "Ꭺ", ""},
- 0xab7b: {"Ꭻ", "Ꭻ", ""},
- 0xab7c: {"Ꭼ", "Ꭼ", ""},
- 0xab7d: {"Ꭽ", "Ꭽ", ""},
- 0xab7e: {"Ꭾ", "Ꭾ", ""},
- 0xab7f: {"Ꭿ", "Ꭿ", ""},
- 0xab80: {"Ꮀ", "Ꮀ", ""},
- 0xab81: {"Ꮁ", "Ꮁ", ""},
- 0xab82: {"Ꮂ", "Ꮂ", ""},
- 0xab83: {"Ꮃ", "Ꮃ", ""},
- 0xab84: {"Ꮄ", "Ꮄ", ""},
- 0xab85: {"Ꮅ", "Ꮅ", ""},
- 0xab86: {"Ꮆ", "Ꮆ", ""},
- 0xab87: {"Ꮇ", "Ꮇ", ""},
- 0xab88: {"Ꮈ", "Ꮈ", ""},
- 0xab89: {"Ꮉ", "Ꮉ", ""},
- 0xab8a: {"Ꮊ", "Ꮊ", ""},
- 0xab8b: {"Ꮋ", "Ꮋ", ""},
- 0xab8c: {"Ꮌ", "Ꮌ", ""},
- 0xab8d: {"Ꮍ", "Ꮍ", ""},
- 0xab8e: {"Ꮎ", "Ꮎ", ""},
- 0xab8f: {"Ꮏ", "Ꮏ", ""},
- 0xab90: {"Ꮐ", "Ꮐ", ""},
- 0xab91: {"Ꮑ", "Ꮑ", ""},
- 0xab92: {"Ꮒ", "Ꮒ", ""},
- 0xab93: {"Ꮓ", "Ꮓ", ""},
- 0xab94: {"Ꮔ", "Ꮔ", ""},
- 0xab95: {"Ꮕ", "Ꮕ", ""},
- 0xab96: {"Ꮖ", "Ꮖ", ""},
- 0xab97: {"Ꮗ", "Ꮗ", ""},
- 0xab98: {"Ꮘ", "Ꮘ", ""},
- 0xab99: {"Ꮙ", "Ꮙ", ""},
- 0xab9a: {"Ꮚ", "Ꮚ", ""},
- 0xab9b: {"Ꮛ", "Ꮛ", ""},
- 0xab9c: {"Ꮜ", "Ꮜ", ""},
- 0xab9d: {"Ꮝ", "Ꮝ", ""},
- 0xab9e: {"Ꮞ", "Ꮞ", ""},
- 0xab9f: {"Ꮟ", "Ꮟ", ""},
- 0xaba0: {"Ꮠ", "Ꮠ", ""},
- 0xaba1: {"Ꮡ", "Ꮡ", ""},
- 0xaba2: {"Ꮢ", "Ꮢ", ""},
- 0xaba3: {"Ꮣ", "Ꮣ", ""},
- 0xaba4: {"Ꮤ", "Ꮤ", ""},
- 0xaba5: {"Ꮥ", "Ꮥ", ""},
- 0xaba6: {"Ꮦ", "Ꮦ", ""},
- 0xaba7: {"Ꮧ", "Ꮧ", ""},
- 0xaba8: {"Ꮨ", "Ꮨ", ""},
- 0xaba9: {"Ꮩ", "Ꮩ", ""},
- 0xabaa: {"Ꮪ", "Ꮪ", ""},
- 0xabab: {"Ꮫ", "Ꮫ", ""},
- 0xabac: {"Ꮬ", "Ꮬ", ""},
- 0xabad: {"Ꮭ", "Ꮭ", ""},
- 0xabae: {"Ꮮ", "Ꮮ", ""},
- 0xabaf: {"Ꮯ", "Ꮯ", ""},
- 0xabb0: {"Ꮰ", "Ꮰ", ""},
- 0xabb1: {"Ꮱ", "Ꮱ", ""},
- 0xabb2: {"Ꮲ", "Ꮲ", ""},
- 0xabb3: {"Ꮳ", "Ꮳ", ""},
- 0xabb4: {"Ꮴ", "Ꮴ", ""},
- 0xabb5: {"Ꮵ", "Ꮵ", ""},
- 0xabb6: {"Ꮶ", "Ꮶ", ""},
- 0xabb7: {"Ꮷ", "Ꮷ", ""},
- 0xabb8: {"Ꮸ", "Ꮸ", ""},
- 0xabb9: {"Ꮹ", "Ꮹ", ""},
- 0xabba: {"Ꮺ", "Ꮺ", ""},
- 0xabbb: {"Ꮻ", "Ꮻ", ""},
- 0xabbc: {"Ꮼ", "Ꮼ", ""},
- 0xabbd: {"Ꮽ", "Ꮽ", ""},
- 0xabbe: {"Ꮾ", "Ꮾ", ""},
- 0xabbf: {"Ꮿ", "Ꮿ", ""},
- 0xfb00: {"", "ff", ""},
- 0xfb01: {"", "fi", ""},
- 0xfb02: {"", "fl", ""},
- 0xfb03: {"", "ffi", ""},
- 0xfb04: {"", "ffl", ""},
- 0xfb05: {"", "st", ""},
- 0xfb06: {"", "st", ""},
- 0xfb13: {"", "մն", ""},
- 0xfb14: {"", "մե", ""},
- 0xfb15: {"", "մի", ""},
- 0xfb16: {"", "վն", ""},
- 0xfb17: {"", "մխ", ""},
- }
-
- breakProp = []struct{ lo, hi rune }{
- {0x0, 0x26},
- {0x28, 0x2d},
- {0x2f, 0x2f},
- {0x3b, 0x40},
- {0x5b, 0x5e},
- {0x60, 0x60},
- {0x7b, 0xa9},
- {0xab, 0xac},
- {0xae, 0xb4},
- {0xb6, 0xb6},
- {0xb8, 0xb9},
- {0xbb, 0xbf},
- {0xd7, 0xd7},
- {0xf7, 0xf7},
- {0x2d8, 0x2dd},
- {0x2e5, 0x2eb},
- {0x375, 0x375},
- {0x378, 0x379},
- {0x37e, 0x37e},
- {0x380, 0x385},
- {0x38b, 0x38b},
- {0x38d, 0x38d},
- {0x3a2, 0x3a2},
- {0x3f6, 0x3f6},
- {0x482, 0x482},
- {0x530, 0x530},
- {0x557, 0x558},
- {0x55a, 0x560},
- {0x588, 0x590},
- {0x5be, 0x5be},
- {0x5c0, 0x5c0},
- {0x5c3, 0x5c3},
- {0x5c6, 0x5c6},
- {0x5c8, 0x5cf},
- {0x5eb, 0x5ef},
- {0x5f5, 0x5ff},
- {0x606, 0x60f},
- {0x61b, 0x61b},
- {0x61d, 0x61f},
- {0x66a, 0x66a},
- {0x66c, 0x66d},
- {0x6d4, 0x6d4},
- {0x6de, 0x6de},
- {0x6e9, 0x6e9},
- {0x6fd, 0x6fe},
- {0x700, 0x70e},
- {0x74b, 0x74c},
- {0x7b2, 0x7bf},
- {0x7f6, 0x7f9},
- {0x7fb, 0x7ff},
- {0x82e, 0x83f},
- {0x85c, 0x85f},
- {0x86b, 0x89f},
- {0x8b5, 0x8b5},
- {0x8be, 0x8d3},
- {0x964, 0x965},
- {0x970, 0x970},
- {0x984, 0x984},
- {0x98d, 0x98e},
- {0x991, 0x992},
- {0x9a9, 0x9a9},
- {0x9b1, 0x9b1},
- {0x9b3, 0x9b5},
- {0x9ba, 0x9bb},
- {0x9c5, 0x9c6},
- {0x9c9, 0x9ca},
- {0x9cf, 0x9d6},
- {0x9d8, 0x9db},
- {0x9de, 0x9de},
- {0x9e4, 0x9e5},
- {0x9f2, 0x9fb},
- {0x9fd, 0xa00},
- {0xa04, 0xa04},
- {0xa0b, 0xa0e},
- {0xa11, 0xa12},
- {0xa29, 0xa29},
- {0xa31, 0xa31},
- {0xa34, 0xa34},
- {0xa37, 0xa37},
- {0xa3a, 0xa3b},
- {0xa3d, 0xa3d},
- {0xa43, 0xa46},
- {0xa49, 0xa4a},
- {0xa4e, 0xa50},
- {0xa52, 0xa58},
- {0xa5d, 0xa5d},
- {0xa5f, 0xa65},
- {0xa76, 0xa80},
- {0xa84, 0xa84},
- {0xa8e, 0xa8e},
- {0xa92, 0xa92},
- {0xaa9, 0xaa9},
- {0xab1, 0xab1},
- {0xab4, 0xab4},
- {0xaba, 0xabb},
- {0xac6, 0xac6},
- {0xaca, 0xaca},
- {0xace, 0xacf},
- {0xad1, 0xadf},
- {0xae4, 0xae5},
- {0xaf0, 0xaf8},
- {0xb00, 0xb00},
- {0xb04, 0xb04},
- {0xb0d, 0xb0e},
- {0xb11, 0xb12},
- {0xb29, 0xb29},
- {0xb31, 0xb31},
- {0xb34, 0xb34},
- {0xb3a, 0xb3b},
- {0xb45, 0xb46},
- {0xb49, 0xb4a},
- {0xb4e, 0xb55},
- {0xb58, 0xb5b},
- {0xb5e, 0xb5e},
- {0xb64, 0xb65},
- {0xb70, 0xb70},
- {0xb72, 0xb81},
- {0xb84, 0xb84},
- {0xb8b, 0xb8d},
- {0xb91, 0xb91},
- {0xb96, 0xb98},
- {0xb9b, 0xb9b},
- {0xb9d, 0xb9d},
- {0xba0, 0xba2},
- {0xba5, 0xba7},
- {0xbab, 0xbad},
- {0xbba, 0xbbd},
- {0xbc3, 0xbc5},
- {0xbc9, 0xbc9},
- {0xbce, 0xbcf},
- {0xbd1, 0xbd6},
- {0xbd8, 0xbe5},
- {0xbf0, 0xbff},
- {0xc04, 0xc04},
- {0xc0d, 0xc0d},
- {0xc11, 0xc11},
- {0xc29, 0xc29},
- {0xc3a, 0xc3c},
- {0xc45, 0xc45},
- {0xc49, 0xc49},
- {0xc4e, 0xc54},
- {0xc57, 0xc57},
- {0xc5b, 0xc5f},
- {0xc64, 0xc65},
- {0xc70, 0xc7f},
- {0xc84, 0xc84},
- {0xc8d, 0xc8d},
- {0xc91, 0xc91},
- {0xca9, 0xca9},
- {0xcb4, 0xcb4},
- {0xcba, 0xcbb},
- {0xcc5, 0xcc5},
- {0xcc9, 0xcc9},
- {0xcce, 0xcd4},
- {0xcd7, 0xcdd},
- {0xcdf, 0xcdf},
- {0xce4, 0xce5},
- {0xcf0, 0xcf0},
- {0xcf3, 0xcff},
- {0xd04, 0xd04},
- {0xd0d, 0xd0d},
- {0xd11, 0xd11},
- {0xd45, 0xd45},
- {0xd49, 0xd49},
- {0xd4f, 0xd53},
- {0xd58, 0xd5e},
- {0xd64, 0xd65},
- {0xd70, 0xd79},
- {0xd80, 0xd81},
- {0xd84, 0xd84},
- {0xd97, 0xd99},
- {0xdb2, 0xdb2},
- {0xdbc, 0xdbc},
- {0xdbe, 0xdbf},
- {0xdc7, 0xdc9},
- {0xdcb, 0xdce},
- {0xdd5, 0xdd5},
- {0xdd7, 0xdd7},
- {0xde0, 0xde5},
- {0xdf0, 0xdf1},
- {0xdf4, 0xe30},
- {0xe32, 0xe33},
- {0xe3b, 0xe46},
- {0xe4f, 0xe4f},
- {0xe5a, 0xeb0},
- {0xeb2, 0xeb3},
- {0xeba, 0xeba},
- {0xebd, 0xec7},
- {0xece, 0xecf},
- {0xeda, 0xeff},
- {0xf01, 0xf17},
- {0xf1a, 0xf1f},
- {0xf2a, 0xf34},
- {0xf36, 0xf36},
- {0xf38, 0xf38},
- {0xf3a, 0xf3d},
- {0xf48, 0xf48},
- {0xf6d, 0xf70},
- {0xf85, 0xf85},
- {0xf98, 0xf98},
- {0xfbd, 0xfc5},
- {0xfc7, 0x102a},
- {0x103f, 0x103f},
- {0x104a, 0x1055},
- {0x105a, 0x105d},
- {0x1061, 0x1061},
- {0x1065, 0x1066},
- {0x106e, 0x1070},
- {0x1075, 0x1081},
- {0x108e, 0x108e},
- {0x109e, 0x109f},
- {0x10c6, 0x10c6},
- {0x10c8, 0x10cc},
- {0x10ce, 0x10cf},
- {0x10fb, 0x10fb},
- {0x1249, 0x1249},
- {0x124e, 0x124f},
- {0x1257, 0x1257},
- {0x1259, 0x1259},
- {0x125e, 0x125f},
- {0x1289, 0x1289},
- {0x128e, 0x128f},
- {0x12b1, 0x12b1},
- {0x12b6, 0x12b7},
- {0x12bf, 0x12bf},
- {0x12c1, 0x12c1},
- {0x12c6, 0x12c7},
- {0x12d7, 0x12d7},
- {0x1311, 0x1311},
- {0x1316, 0x1317},
- {0x135b, 0x135c},
- {0x1360, 0x137f},
- {0x1390, 0x139f},
- {0x13f6, 0x13f7},
- {0x13fe, 0x1400},
- {0x166d, 0x166e},
- {0x1680, 0x1680},
- {0x169b, 0x169f},
- {0x16eb, 0x16ed},
- {0x16f9, 0x16ff},
- {0x170d, 0x170d},
- {0x1715, 0x171f},
- {0x1735, 0x173f},
- {0x1754, 0x175f},
- {0x176d, 0x176d},
- {0x1771, 0x1771},
- {0x1774, 0x17b3},
- {0x17d4, 0x17dc},
- {0x17de, 0x17df},
- {0x17ea, 0x180a},
- {0x180f, 0x180f},
- {0x181a, 0x181f},
- {0x1878, 0x187f},
- {0x18ab, 0x18af},
- {0x18f6, 0x18ff},
- {0x191f, 0x191f},
- {0x192c, 0x192f},
- {0x193c, 0x1945},
- {0x1950, 0x19cf},
- {0x19da, 0x19ff},
- {0x1a1c, 0x1a54},
- {0x1a5f, 0x1a5f},
- {0x1a7d, 0x1a7e},
- {0x1a8a, 0x1a8f},
- {0x1a9a, 0x1aaf},
- {0x1abf, 0x1aff},
- {0x1b4c, 0x1b4f},
- {0x1b5a, 0x1b6a},
- {0x1b74, 0x1b7f},
- {0x1bf4, 0x1bff},
- {0x1c38, 0x1c3f},
- {0x1c4a, 0x1c4c},
- {0x1c7e, 0x1c7f},
- {0x1c89, 0x1ccf},
- {0x1cd3, 0x1cd3},
- {0x1cfa, 0x1cff},
- {0x1dfa, 0x1dfa},
- {0x1f16, 0x1f17},
- {0x1f1e, 0x1f1f},
- {0x1f46, 0x1f47},
- {0x1f4e, 0x1f4f},
- {0x1f58, 0x1f58},
- {0x1f5a, 0x1f5a},
- {0x1f5c, 0x1f5c},
- {0x1f5e, 0x1f5e},
- {0x1f7e, 0x1f7f},
- {0x1fb5, 0x1fb5},
- {0x1fbd, 0x1fbd},
- {0x1fbf, 0x1fc1},
- {0x1fc5, 0x1fc5},
- {0x1fcd, 0x1fcf},
- {0x1fd4, 0x1fd5},
- {0x1fdc, 0x1fdf},
- {0x1fed, 0x1ff1},
- {0x1ff5, 0x1ff5},
- {0x1ffd, 0x200b},
- {0x2010, 0x2017},
- {0x201a, 0x2023},
- {0x2025, 0x2026},
- {0x2028, 0x2029},
- {0x2030, 0x203e},
- {0x2041, 0x2053},
- {0x2055, 0x205f},
- {0x2065, 0x2065},
- {0x2070, 0x2070},
- {0x2072, 0x207e},
- {0x2080, 0x208f},
- {0x209d, 0x20cf},
- {0x20f1, 0x2101},
- {0x2103, 0x2106},
- {0x2108, 0x2109},
- {0x2114, 0x2114},
- {0x2116, 0x2118},
- {0x211e, 0x2123},
- {0x2125, 0x2125},
- {0x2127, 0x2127},
- {0x2129, 0x2129},
- {0x212e, 0x212e},
- {0x213a, 0x213b},
- {0x2140, 0x2144},
- {0x214a, 0x214d},
- {0x214f, 0x215f},
- {0x2189, 0x24b5},
- {0x24ea, 0x2bff},
- {0x2c2f, 0x2c2f},
- {0x2c5f, 0x2c5f},
- {0x2ce5, 0x2cea},
- {0x2cf4, 0x2cff},
- {0x2d26, 0x2d26},
- {0x2d28, 0x2d2c},
- {0x2d2e, 0x2d2f},
- {0x2d68, 0x2d6e},
- {0x2d70, 0x2d7e},
- {0x2d97, 0x2d9f},
- {0x2da7, 0x2da7},
- {0x2daf, 0x2daf},
- {0x2db7, 0x2db7},
- {0x2dbf, 0x2dbf},
- {0x2dc7, 0x2dc7},
- {0x2dcf, 0x2dcf},
- {0x2dd7, 0x2dd7},
- {0x2ddf, 0x2ddf},
- {0x2e00, 0x2e2e},
- {0x2e30, 0x3004},
- {0x3006, 0x3029},
- {0x3030, 0x303a},
- {0x303d, 0x3098},
- {0x309b, 0x3104},
- {0x312f, 0x3130},
- {0x318f, 0x319f},
- {0x31bb, 0x9fff},
- {0xa48d, 0xa4cf},
- {0xa4fe, 0xa4ff},
- {0xa60d, 0xa60f},
- {0xa62c, 0xa63f},
- {0xa673, 0xa673},
- {0xa67e, 0xa67e},
- {0xa6f2, 0xa716},
- {0xa7af, 0xa7af},
- {0xa7b8, 0xa7f6},
- {0xa828, 0xa83f},
- {0xa874, 0xa87f},
- {0xa8c6, 0xa8cf},
- {0xa8da, 0xa8df},
- {0xa8f8, 0xa8fa},
- {0xa8fc, 0xa8fc},
- {0xa8fe, 0xa8ff},
- {0xa92e, 0xa92f},
- {0xa954, 0xa95f},
- {0xa97d, 0xa97f},
- {0xa9c1, 0xa9ce},
- {0xa9da, 0xa9e4},
- {0xa9e6, 0xa9ef},
- {0xa9fa, 0xa9ff},
- {0xaa37, 0xaa3f},
- {0xaa4e, 0xaa4f},
- {0xaa5a, 0xaa7a},
- {0xaa7e, 0xaaaf},
- {0xaab1, 0xaab1},
- {0xaab5, 0xaab6},
- {0xaab9, 0xaabd},
- {0xaac0, 0xaac0},
- {0xaac2, 0xaadf},
- {0xaaf0, 0xaaf1},
- {0xaaf7, 0xab00},
- {0xab07, 0xab08},
- {0xab0f, 0xab10},
- {0xab17, 0xab1f},
- {0xab27, 0xab27},
- {0xab2f, 0xab2f},
- {0xab66, 0xab6f},
- {0xabeb, 0xabeb},
- {0xabee, 0xabef},
- {0xabfa, 0xabff},
- {0xd7a4, 0xd7af},
- {0xd7c7, 0xd7ca},
- {0xd7fc, 0xfaff},
- {0xfb07, 0xfb12},
- {0xfb18, 0xfb1c},
- {0xfb29, 0xfb29},
- {0xfb37, 0xfb37},
- {0xfb3d, 0xfb3d},
- {0xfb3f, 0xfb3f},
- {0xfb42, 0xfb42},
- {0xfb45, 0xfb45},
- {0xfbb2, 0xfbd2},
- {0xfd3e, 0xfd4f},
- {0xfd90, 0xfd91},
- {0xfdc8, 0xfdef},
- {0xfdfc, 0xfdff},
- {0xfe10, 0xfe12},
- {0xfe14, 0xfe1f},
- {0xfe30, 0xfe32},
- {0xfe35, 0xfe4c},
- {0xfe50, 0xfe51},
- {0xfe53, 0xfe54},
- {0xfe56, 0xfe6f},
- {0xfe75, 0xfe75},
- {0xfefd, 0xfefe},
- {0xff00, 0xff06},
- {0xff08, 0xff0d},
- {0xff0f, 0xff19},
- {0xff1b, 0xff20},
- {0xff3b, 0xff3e},
- {0xff40, 0xff40},
- {0xff5b, 0xff9d},
- {0xffbf, 0xffc1},
- {0xffc8, 0xffc9},
- {0xffd0, 0xffd1},
- {0xffd8, 0xffd9},
- {0xffdd, 0xfff8},
- {0xfffc, 0xffff},
- {0x1000c, 0x1000c},
- {0x10027, 0x10027},
- {0x1003b, 0x1003b},
- {0x1003e, 0x1003e},
- {0x1004e, 0x1004f},
- {0x1005e, 0x1007f},
- {0x100fb, 0x1013f},
- {0x10175, 0x101fc},
- {0x101fe, 0x1027f},
- {0x1029d, 0x1029f},
- {0x102d1, 0x102df},
- {0x102e1, 0x102ff},
- {0x10320, 0x1032c},
- {0x1034b, 0x1034f},
- {0x1037b, 0x1037f},
- {0x1039e, 0x1039f},
- {0x103c4, 0x103c7},
- {0x103d0, 0x103d0},
- {0x103d6, 0x103ff},
- {0x1049e, 0x1049f},
- {0x104aa, 0x104af},
- {0x104d4, 0x104d7},
- {0x104fc, 0x104ff},
- {0x10528, 0x1052f},
- {0x10564, 0x105ff},
- {0x10737, 0x1073f},
- {0x10756, 0x1075f},
- {0x10768, 0x107ff},
- {0x10806, 0x10807},
- {0x10809, 0x10809},
- {0x10836, 0x10836},
- {0x10839, 0x1083b},
- {0x1083d, 0x1083e},
- {0x10856, 0x1085f},
- {0x10877, 0x1087f},
- {0x1089f, 0x108df},
- {0x108f3, 0x108f3},
- {0x108f6, 0x108ff},
- {0x10916, 0x1091f},
- {0x1093a, 0x1097f},
- {0x109b8, 0x109bd},
- {0x109c0, 0x109ff},
- {0x10a04, 0x10a04},
- {0x10a07, 0x10a0b},
- {0x10a14, 0x10a14},
- {0x10a18, 0x10a18},
- {0x10a34, 0x10a37},
- {0x10a3b, 0x10a3e},
- {0x10a40, 0x10a5f},
- {0x10a7d, 0x10a7f},
- {0x10a9d, 0x10abf},
- {0x10ac8, 0x10ac8},
- {0x10ae7, 0x10aff},
- {0x10b36, 0x10b3f},
- {0x10b56, 0x10b5f},
- {0x10b73, 0x10b7f},
- {0x10b92, 0x10bff},
- {0x10c49, 0x10c7f},
- {0x10cb3, 0x10cbf},
- {0x10cf3, 0x10fff},
- {0x11047, 0x11065},
- {0x11070, 0x1107e},
- {0x110bb, 0x110bc},
- {0x110be, 0x110cf},
- {0x110e9, 0x110ef},
- {0x110fa, 0x110ff},
- {0x11135, 0x11135},
- {0x11140, 0x1114f},
- {0x11174, 0x11175},
- {0x11177, 0x1117f},
- {0x111c5, 0x111c9},
- {0x111cd, 0x111cf},
- {0x111db, 0x111db},
- {0x111dd, 0x111ff},
- {0x11212, 0x11212},
- {0x11238, 0x1123d},
- {0x1123f, 0x1127f},
- {0x11287, 0x11287},
- {0x11289, 0x11289},
- {0x1128e, 0x1128e},
- {0x1129e, 0x1129e},
- {0x112a9, 0x112af},
- {0x112eb, 0x112ef},
- {0x112fa, 0x112ff},
- {0x11304, 0x11304},
- {0x1130d, 0x1130e},
- {0x11311, 0x11312},
- {0x11329, 0x11329},
- {0x11331, 0x11331},
- {0x11334, 0x11334},
- {0x1133a, 0x1133b},
- {0x11345, 0x11346},
- {0x11349, 0x1134a},
- {0x1134e, 0x1134f},
- {0x11351, 0x11356},
- {0x11358, 0x1135c},
- {0x11364, 0x11365},
- {0x1136d, 0x1136f},
- {0x11375, 0x113ff},
- {0x1144b, 0x1144f},
- {0x1145a, 0x1147f},
- {0x114c6, 0x114c6},
- {0x114c8, 0x114cf},
- {0x114da, 0x1157f},
- {0x115b6, 0x115b7},
- {0x115c1, 0x115d7},
- {0x115de, 0x115ff},
- {0x11641, 0x11643},
- {0x11645, 0x1164f},
- {0x1165a, 0x1167f},
- {0x116b8, 0x116bf},
- {0x116ca, 0x1171c},
- {0x1172c, 0x1172f},
- {0x1173a, 0x1189f},
- {0x118ea, 0x118fe},
- {0x11900, 0x119ff},
- {0x11a3f, 0x11a46},
- {0x11a48, 0x11a4f},
- {0x11a84, 0x11a85},
- {0x11a9a, 0x11abf},
- {0x11af9, 0x11bff},
- {0x11c09, 0x11c09},
- {0x11c37, 0x11c37},
- {0x11c41, 0x11c4f},
- {0x11c5a, 0x11c71},
- {0x11c90, 0x11c91},
- {0x11ca8, 0x11ca8},
- {0x11cb7, 0x11cff},
- {0x11d07, 0x11d07},
- {0x11d0a, 0x11d0a},
- {0x11d37, 0x11d39},
- {0x11d3b, 0x11d3b},
- {0x11d3e, 0x11d3e},
- {0x11d48, 0x11d4f},
- {0x11d5a, 0x11fff},
- {0x1239a, 0x123ff},
- {0x1246f, 0x1247f},
- {0x12544, 0x12fff},
- {0x1342f, 0x143ff},
- {0x14647, 0x167ff},
- {0x16a39, 0x16a3f},
- {0x16a5f, 0x16a5f},
- {0x16a6a, 0x16acf},
- {0x16aee, 0x16aef},
- {0x16af5, 0x16aff},
- {0x16b37, 0x16b3f},
- {0x16b44, 0x16b4f},
- {0x16b5a, 0x16b62},
- {0x16b78, 0x16b7c},
- {0x16b90, 0x16eff},
- {0x16f45, 0x16f4f},
- {0x16f7f, 0x16f8e},
- {0x16fa0, 0x16fdf},
- {0x16fe2, 0x1bbff},
- {0x1bc6b, 0x1bc6f},
- {0x1bc7d, 0x1bc7f},
- {0x1bc89, 0x1bc8f},
- {0x1bc9a, 0x1bc9c},
- {0x1bc9f, 0x1bc9f},
- {0x1bca4, 0x1d164},
- {0x1d16a, 0x1d16c},
- {0x1d183, 0x1d184},
- {0x1d18c, 0x1d1a9},
- {0x1d1ae, 0x1d241},
- {0x1d245, 0x1d3ff},
- {0x1d455, 0x1d455},
- {0x1d49d, 0x1d49d},
- {0x1d4a0, 0x1d4a1},
- {0x1d4a3, 0x1d4a4},
- {0x1d4a7, 0x1d4a8},
- {0x1d4ad, 0x1d4ad},
- {0x1d4ba, 0x1d4ba},
- {0x1d4bc, 0x1d4bc},
- {0x1d4c4, 0x1d4c4},
- {0x1d506, 0x1d506},
- {0x1d50b, 0x1d50c},
- {0x1d515, 0x1d515},
- {0x1d51d, 0x1d51d},
- {0x1d53a, 0x1d53a},
- {0x1d53f, 0x1d53f},
- {0x1d545, 0x1d545},
- {0x1d547, 0x1d549},
- {0x1d551, 0x1d551},
- {0x1d6a6, 0x1d6a7},
- {0x1d6c1, 0x1d6c1},
- {0x1d6db, 0x1d6db},
- {0x1d6fb, 0x1d6fb},
- {0x1d715, 0x1d715},
- {0x1d735, 0x1d735},
- {0x1d74f, 0x1d74f},
- {0x1d76f, 0x1d76f},
- {0x1d789, 0x1d789},
- {0x1d7a9, 0x1d7a9},
- {0x1d7c3, 0x1d7c3},
- {0x1d7cc, 0x1d7cd},
- {0x1d800, 0x1d9ff},
- {0x1da37, 0x1da3a},
- {0x1da6d, 0x1da74},
- {0x1da76, 0x1da83},
- {0x1da85, 0x1da9a},
- {0x1daa0, 0x1daa0},
- {0x1dab0, 0x1dfff},
- {0x1e007, 0x1e007},
- {0x1e019, 0x1e01a},
- {0x1e022, 0x1e022},
- {0x1e025, 0x1e025},
- {0x1e02b, 0x1e7ff},
- {0x1e8c5, 0x1e8cf},
- {0x1e8d7, 0x1e8ff},
- {0x1e94b, 0x1e94f},
- {0x1e95a, 0x1edff},
- {0x1ee04, 0x1ee04},
- {0x1ee20, 0x1ee20},
- {0x1ee23, 0x1ee23},
- {0x1ee25, 0x1ee26},
- {0x1ee28, 0x1ee28},
- {0x1ee33, 0x1ee33},
- {0x1ee38, 0x1ee38},
- {0x1ee3a, 0x1ee3a},
- {0x1ee3c, 0x1ee41},
- {0x1ee43, 0x1ee46},
- {0x1ee48, 0x1ee48},
- {0x1ee4a, 0x1ee4a},
- {0x1ee4c, 0x1ee4c},
- {0x1ee50, 0x1ee50},
- {0x1ee53, 0x1ee53},
- {0x1ee55, 0x1ee56},
- {0x1ee58, 0x1ee58},
- {0x1ee5a, 0x1ee5a},
- {0x1ee5c, 0x1ee5c},
- {0x1ee5e, 0x1ee5e},
- {0x1ee60, 0x1ee60},
- {0x1ee63, 0x1ee63},
- {0x1ee65, 0x1ee66},
- {0x1ee6b, 0x1ee6b},
- {0x1ee73, 0x1ee73},
- {0x1ee78, 0x1ee78},
- {0x1ee7d, 0x1ee7d},
- {0x1ee7f, 0x1ee7f},
- {0x1ee8a, 0x1ee8a},
- {0x1ee9c, 0x1eea0},
- {0x1eea4, 0x1eea4},
- {0x1eeaa, 0x1eeaa},
- {0x1eebc, 0x1f12f},
- {0x1f14a, 0x1f14f},
- {0x1f16a, 0x1f16f},
- {0x1f18a, 0x1ffff},
- }
-
- breakTest = []string{
- "AA",
- "ÄA",
- "Aa\u2060",
- "Äa\u2060",
- "Aa|:",
- "Äa|:",
- "Aa|'",
- "Äa|'",
- "Aa|'\u2060",
- "Äa|'\u2060",
- "Aa|,",
- "Äa|,",
- "a\u2060A",
- "a\u2060̈A",
- "a\u2060a\u2060",
- "a\u2060̈a\u2060",
- "a\u2060a|:",
- "a\u2060̈a|:",
- "a\u2060a|'",
- "a\u2060̈a|'",
- "a\u2060a|'\u2060",
- "a\u2060̈a|'\u2060",
- "a\u2060a|,",
- "a\u2060̈a|,",
- "a:A",
- "a:̈A",
- "a:a\u2060",
- "a:̈a\u2060",
- "a:a|:",
- "a:̈a|:",
- "a:a|'",
- "a:̈a|'",
- "a:a|'\u2060",
- "a:̈a|'\u2060",
- "a:a|,",
- "a:̈a|,",
- "a'A",
- "a'̈A",
- "a'a\u2060",
- "a'̈a\u2060",
- "a'a|:",
- "a'̈a|:",
- "a'a|'",
- "a'̈a|'",
- "a'a|'\u2060",
- "a'̈a|'\u2060",
- "a'a|,",
- "a'̈a|,",
- "a'\u2060A",
- "a'\u2060̈A",
- "a'\u2060a\u2060",
- "a'\u2060̈a\u2060",
- "a'\u2060a|:",
- "a'\u2060̈a|:",
- "a'\u2060a|'",
- "a'\u2060̈a|'",
- "a'\u2060a|'\u2060",
- "a'\u2060̈a|'\u2060",
- "a'\u2060a|,",
- "a'\u2060̈a|,",
- "a|,|A",
- "a|,̈|A",
- "a|,|a\u2060",
- "a|,̈|a\u2060",
- "a|,|a|:",
- "a|,̈|a|:",
- "a|,|a|'",
- "a|,̈|a|'",
- "a|,|a|'\u2060",
- "a|,̈|a|'\u2060",
- "a|,|a|,",
- "a|,̈|a|,",
- "AAA",
- "A:A",
- "A|:|:|A",
- "A00A",
- "A__A",
- "a|🇦🇧|🇨|b",
- "a|🇦🇧\u200d|🇨|b",
- "a|🇦\u200d🇧|🇨|b",
- "a|🇦🇧|🇨🇩|b",
- "ä\u200d̈b",
- "1_a|:|:|a",
- "1_a|:|.|a",
- "1_a|:|,|a",
- "1_a|.|:|a",
- "1_a|.|.|a",
- "1_a|.|,|a",
- "1_a|,|:|a",
- "1_a|,|.|a",
- "1_a|,|,|a",
- "a_a|:|:|1",
- "a|:|:|a",
- "a_1|:|:|a",
- "a_a|:|:|a",
- "a_a|:|.|1",
- "a|:|.|a",
- "a_1|:|.|a",
- "a_a|:|.|a",
- "a_a|:|,|1",
- "a|:|,|a",
- "a_1|:|,|a",
- "a_a|:|,|a",
- "a_a|.|:|1",
- "a|.|:|a",
- "a_1|.|:|a",
- "a_a|.|:|a",
- "a_a|.|.|1",
- "a|.|.|a",
- "a_1|.|.|a",
- "a_a|.|.|a",
- "a_a|.|,|1",
- "a|.|,|a",
- "a_1|.|,|a",
- "a_a|.|,|a",
- "a_a|,|:|1",
- "a|,|:|a",
- "a_1|,|:|a",
- "a_a|,|:|a",
- "a_a|,|.|1",
- "a|,|.|a",
- "a_1|,|.|a",
- "a_a|,|.|a",
- "a_a|,|,|1",
- "a|,|,|a",
- "a_1|,|,|a",
- "a_a|,|,|a",
- }
-)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables9.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables9.0.0_test.go
deleted file mode 100644
index 398d2533128..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/cases/tables9.0.0_test.go
+++ /dev/null
@@ -1,1156 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// +build !go1.10
-
-package cases
-
-var (
- caseIgnorable = map[rune]bool{
- 0x0027: true,
- 0x002e: true,
- 0x003a: true,
- 0x00b7: true,
- 0x0387: true,
- 0x05f4: true,
- 0x2018: true,
- 0x2019: true,
- 0x2024: true,
- 0x2027: true,
- 0xfe13: true,
- 0xfe52: true,
- 0xfe55: true,
- 0xff07: true,
- 0xff0e: true,
- 0xff1a: true,
- }
-
- special = map[rune]struct{ toLower, toTitle, toUpper string }{
- 0x00df: {"ß", "Ss", "SS"},
- 0x0130: {"i̇", "İ", "İ"},
- 0xfb00: {"ff", "Ff", "FF"},
- 0xfb01: {"fi", "Fi", "FI"},
- 0xfb02: {"fl", "Fl", "FL"},
- 0xfb03: {"ffi", "Ffi", "FFI"},
- 0xfb04: {"ffl", "Ffl", "FFL"},
- 0xfb05: {"ſt", "St", "ST"},
- 0xfb06: {"st", "St", "ST"},
- 0x0587: {"և", "Եւ", "ԵՒ"},
- 0xfb13: {"ﬓ", "Մն", "ՄՆ"},
- 0xfb14: {"ﬔ", "Մե", "ՄԵ"},
- 0xfb15: {"ﬕ", "Մի", "ՄԻ"},
- 0xfb16: {"ﬖ", "Վն", "ՎՆ"},
- 0xfb17: {"ﬗ", "Մխ", "ՄԽ"},
- 0x0149: {"ʼn", "ʼN", "ʼN"},
- 0x0390: {"ΐ", "Ϊ́", "Ϊ́"},
- 0x03b0: {"ΰ", "Ϋ́", "Ϋ́"},
- 0x01f0: {"ǰ", "J̌", "J̌"},
- 0x1e96: {"ẖ", "H̱", "H̱"},
- 0x1e97: {"ẗ", "T̈", "T̈"},
- 0x1e98: {"ẘ", "W̊", "W̊"},
- 0x1e99: {"ẙ", "Y̊", "Y̊"},
- 0x1e9a: {"ẚ", "Aʾ", "Aʾ"},
- 0x1f50: {"ὐ", "Υ̓", "Υ̓"},
- 0x1f52: {"ὒ", "Υ̓̀", "Υ̓̀"},
- 0x1f54: {"ὔ", "Υ̓́", "Υ̓́"},
- 0x1f56: {"ὖ", "Υ̓͂", "Υ̓͂"},
- 0x1fb6: {"ᾶ", "Α͂", "Α͂"},
- 0x1fc6: {"ῆ", "Η͂", "Η͂"},
- 0x1fd2: {"ῒ", "Ϊ̀", "Ϊ̀"},
- 0x1fd3: {"ΐ", "Ϊ́", "Ϊ́"},
- 0x1fd6: {"ῖ", "Ι͂", "Ι͂"},
- 0x1fd7: {"ῗ", "Ϊ͂", "Ϊ͂"},
- 0x1fe2: {"ῢ", "Ϋ̀", "Ϋ̀"},
- 0x1fe3: {"ΰ", "Ϋ́", "Ϋ́"},
- 0x1fe4: {"ῤ", "Ρ̓", "Ρ̓"},
- 0x1fe6: {"ῦ", "Υ͂", "Υ͂"},
- 0x1fe7: {"ῧ", "Ϋ͂", "Ϋ͂"},
- 0x1ff6: {"ῶ", "Ω͂", "Ω͂"},
- 0x1f80: {"ᾀ", "ᾈ", "ἈΙ"},
- 0x1f81: {"ᾁ", "ᾉ", "ἉΙ"},
- 0x1f82: {"ᾂ", "ᾊ", "ἊΙ"},
- 0x1f83: {"ᾃ", "ᾋ", "ἋΙ"},
- 0x1f84: {"ᾄ", "ᾌ", "ἌΙ"},
- 0x1f85: {"ᾅ", "ᾍ", "ἍΙ"},
- 0x1f86: {"ᾆ", "ᾎ", "ἎΙ"},
- 0x1f87: {"ᾇ", "ᾏ", "ἏΙ"},
- 0x1f88: {"ᾀ", "ᾈ", "ἈΙ"},
- 0x1f89: {"ᾁ", "ᾉ", "ἉΙ"},
- 0x1f8a: {"ᾂ", "ᾊ", "ἊΙ"},
- 0x1f8b: {"ᾃ", "ᾋ", "ἋΙ"},
- 0x1f8c: {"ᾄ", "ᾌ", "ἌΙ"},
- 0x1f8d: {"ᾅ", "ᾍ", "ἍΙ"},
- 0x1f8e: {"ᾆ", "ᾎ", "ἎΙ"},
- 0x1f8f: {"ᾇ", "ᾏ", "ἏΙ"},
- 0x1f90: {"ᾐ", "ᾘ", "ἨΙ"},
- 0x1f91: {"ᾑ", "ᾙ", "ἩΙ"},
- 0x1f92: {"ᾒ", "ᾚ", "ἪΙ"},
- 0x1f93: {"ᾓ", "ᾛ", "ἫΙ"},
- 0x1f94: {"ᾔ", "ᾜ", "ἬΙ"},
- 0x1f95: {"ᾕ", "ᾝ", "ἭΙ"},
- 0x1f96: {"ᾖ", "ᾞ", "ἮΙ"},
- 0x1f97: {"ᾗ", "ᾟ", "ἯΙ"},
- 0x1f98: {"ᾐ", "ᾘ", "ἨΙ"},
- 0x1f99: {"ᾑ", "ᾙ", "ἩΙ"},
- 0x1f9a: {"ᾒ", "ᾚ", "ἪΙ"},
- 0x1f9b: {"ᾓ", "ᾛ", "ἫΙ"},
- 0x1f9c: {"ᾔ", "ᾜ", "ἬΙ"},
- 0x1f9d: {"ᾕ", "ᾝ", "ἭΙ"},
- 0x1f9e: {"ᾖ", "ᾞ", "ἮΙ"},
- 0x1f9f: {"ᾗ", "ᾟ", "ἯΙ"},
- 0x1fa0: {"ᾠ", "ᾨ", "ὨΙ"},
- 0x1fa1: {"ᾡ", "ᾩ", "ὩΙ"},
- 0x1fa2: {"ᾢ", "ᾪ", "ὪΙ"},
- 0x1fa3: {"ᾣ", "ᾫ", "ὫΙ"},
- 0x1fa4: {"ᾤ", "ᾬ", "ὬΙ"},
- 0x1fa5: {"ᾥ", "ᾭ", "ὭΙ"},
- 0x1fa6: {"ᾦ", "ᾮ", "ὮΙ"},
- 0x1fa7: {"ᾧ", "ᾯ", "ὯΙ"},
- 0x1fa8: {"ᾠ", "ᾨ", "ὨΙ"},
- 0x1fa9: {"ᾡ", "ᾩ", "ὩΙ"},
- 0x1faa: {"ᾢ", "ᾪ", "ὪΙ"},
- 0x1fab: {"ᾣ", "ᾫ", "ὫΙ"},
- 0x1fac: {"ᾤ", "ᾬ", "ὬΙ"},
- 0x1fad: {"ᾥ", "ᾭ", "ὭΙ"},
- 0x1fae: {"ᾦ", "ᾮ", "ὮΙ"},
- 0x1faf: {"ᾧ", "ᾯ", "ὯΙ"},
- 0x1fb3: {"ᾳ", "ᾼ", "ΑΙ"},
- 0x1fbc: {"ᾳ", "ᾼ", "ΑΙ"},
- 0x1fc3: {"ῃ", "ῌ", "ΗΙ"},
- 0x1fcc: {"ῃ", "ῌ", "ΗΙ"},
- 0x1ff3: {"ῳ", "ῼ", "ΩΙ"},
- 0x1ffc: {"ῳ", "ῼ", "ΩΙ"},
- 0x1fb2: {"ᾲ", "Ὰͅ", "ᾺΙ"},
- 0x1fb4: {"ᾴ", "Άͅ", "ΆΙ"},
- 0x1fc2: {"ῂ", "Ὴͅ", "ῊΙ"},
- 0x1fc4: {"ῄ", "Ήͅ", "ΉΙ"},
- 0x1ff2: {"ῲ", "Ὼͅ", "ῺΙ"},
- 0x1ff4: {"ῴ", "Ώͅ", "ΏΙ"},
- 0x1fb7: {"ᾷ", "ᾼ͂", "Α͂Ι"},
- 0x1fc7: {"ῇ", "ῌ͂", "Η͂Ι"},
- 0x1ff7: {"ῷ", "ῼ͂", "Ω͂Ι"},
- }
-
- foldMap = map[rune]struct{ simple, full, special string }{
- 0x0049: {"", "", "ı"},
- 0x00b5: {"μ", "μ", ""},
- 0x00df: {"", "ss", ""},
- 0x0130: {"", "i̇", "i"},
- 0x0149: {"", "ʼn", ""},
- 0x017f: {"s", "s", ""},
- 0x01f0: {"", "ǰ", ""},
- 0x0345: {"ι", "ι", ""},
- 0x0390: {"", "ΐ", ""},
- 0x03b0: {"", "ΰ", ""},
- 0x03c2: {"σ", "σ", ""},
- 0x03d0: {"β", "β", ""},
- 0x03d1: {"θ", "θ", ""},
- 0x03d5: {"φ", "φ", ""},
- 0x03d6: {"π", "π", ""},
- 0x03f0: {"κ", "κ", ""},
- 0x03f1: {"ρ", "ρ", ""},
- 0x03f5: {"ε", "ε", ""},
- 0x0587: {"", "եւ", ""},
- 0x13f8: {"Ᏸ", "Ᏸ", ""},
- 0x13f9: {"Ᏹ", "Ᏹ", ""},
- 0x13fa: {"Ᏺ", "Ᏺ", ""},
- 0x13fb: {"Ᏻ", "Ᏻ", ""},
- 0x13fc: {"Ᏼ", "Ᏼ", ""},
- 0x13fd: {"Ᏽ", "Ᏽ", ""},
- 0x1c80: {"в", "в", ""},
- 0x1c81: {"д", "д", ""},
- 0x1c82: {"о", "о", ""},
- 0x1c83: {"с", "с", ""},
- 0x1c84: {"т", "т", ""},
- 0x1c85: {"т", "т", ""},
- 0x1c86: {"ъ", "ъ", ""},
- 0x1c87: {"ѣ", "ѣ", ""},
- 0x1c88: {"ꙋ", "ꙋ", ""},
- 0x1e96: {"", "ẖ", ""},
- 0x1e97: {"", "ẗ", ""},
- 0x1e98: {"", "ẘ", ""},
- 0x1e99: {"", "ẙ", ""},
- 0x1e9a: {"", "aʾ", ""},
- 0x1e9b: {"ṡ", "ṡ", ""},
- 0x1e9e: {"", "ss", ""},
- 0x1f50: {"", "ὐ", ""},
- 0x1f52: {"", "ὒ", ""},
- 0x1f54: {"", "ὔ", ""},
- 0x1f56: {"", "ὖ", ""},
- 0x1f80: {"", "ἀι", ""},
- 0x1f81: {"", "ἁι", ""},
- 0x1f82: {"", "ἂι", ""},
- 0x1f83: {"", "ἃι", ""},
- 0x1f84: {"", "ἄι", ""},
- 0x1f85: {"", "ἅι", ""},
- 0x1f86: {"", "ἆι", ""},
- 0x1f87: {"", "ἇι", ""},
- 0x1f88: {"", "ἀι", ""},
- 0x1f89: {"", "ἁι", ""},
- 0x1f8a: {"", "ἂι", ""},
- 0x1f8b: {"", "ἃι", ""},
- 0x1f8c: {"", "ἄι", ""},
- 0x1f8d: {"", "ἅι", ""},
- 0x1f8e: {"", "ἆι", ""},
- 0x1f8f: {"", "ἇι", ""},
- 0x1f90: {"", "ἠι", ""},
- 0x1f91: {"", "ἡι", ""},
- 0x1f92: {"", "ἢι", ""},
- 0x1f93: {"", "ἣι", ""},
- 0x1f94: {"", "ἤι", ""},
- 0x1f95: {"", "ἥι", ""},
- 0x1f96: {"", "ἦι", ""},
- 0x1f97: {"", "ἧι", ""},
- 0x1f98: {"", "ἠι", ""},
- 0x1f99: {"", "ἡι", ""},
- 0x1f9a: {"", "ἢι", ""},
- 0x1f9b: {"", "ἣι", ""},
- 0x1f9c: {"", "ἤι", ""},
- 0x1f9d: {"", "ἥι", ""},
- 0x1f9e: {"", "ἦι", ""},
- 0x1f9f: {"", "ἧι", ""},
- 0x1fa0: {"", "ὠι", ""},
- 0x1fa1: {"", "ὡι", ""},
- 0x1fa2: {"", "ὢι", ""},
- 0x1fa3: {"", "ὣι", ""},
- 0x1fa4: {"", "ὤι", ""},
- 0x1fa5: {"", "ὥι", ""},
- 0x1fa6: {"", "ὦι", ""},
- 0x1fa7: {"", "ὧι", ""},
- 0x1fa8: {"", "ὠι", ""},
- 0x1fa9: {"", "ὡι", ""},
- 0x1faa: {"", "ὢι", ""},
- 0x1fab: {"", "ὣι", ""},
- 0x1fac: {"", "ὤι", ""},
- 0x1fad: {"", "ὥι", ""},
- 0x1fae: {"", "ὦι", ""},
- 0x1faf: {"", "ὧι", ""},
- 0x1fb2: {"", "ὰι", ""},
- 0x1fb3: {"", "αι", ""},
- 0x1fb4: {"", "άι", ""},
- 0x1fb6: {"", "ᾶ", ""},
- 0x1fb7: {"", "ᾶι", ""},
- 0x1fbc: {"", "αι", ""},
- 0x1fbe: {"ι", "ι", ""},
- 0x1fc2: {"", "ὴι", ""},
- 0x1fc3: {"", "ηι", ""},
- 0x1fc4: {"", "ήι", ""},
- 0x1fc6: {"", "ῆ", ""},
- 0x1fc7: {"", "ῆι", ""},
- 0x1fcc: {"", "ηι", ""},
- 0x1fd2: {"", "ῒ", ""},
- 0x1fd3: {"", "ΐ", ""},
- 0x1fd6: {"", "ῖ", ""},
- 0x1fd7: {"", "ῗ", ""},
- 0x1fe2: {"", "ῢ", ""},
- 0x1fe3: {"", "ΰ", ""},
- 0x1fe4: {"", "ῤ", ""},
- 0x1fe6: {"", "ῦ", ""},
- 0x1fe7: {"", "ῧ", ""},
- 0x1ff2: {"", "ὼι", ""},
- 0x1ff3: {"", "ωι", ""},
- 0x1ff4: {"", "ώι", ""},
- 0x1ff6: {"", "ῶ", ""},
- 0x1ff7: {"", "ῶι", ""},
- 0x1ffc: {"", "ωι", ""},
- 0xab70: {"Ꭰ", "Ꭰ", ""},
- 0xab71: {"Ꭱ", "Ꭱ", ""},
- 0xab72: {"Ꭲ", "Ꭲ", ""},
- 0xab73: {"Ꭳ", "Ꭳ", ""},
- 0xab74: {"Ꭴ", "Ꭴ", ""},
- 0xab75: {"Ꭵ", "Ꭵ", ""},
- 0xab76: {"Ꭶ", "Ꭶ", ""},
- 0xab77: {"Ꭷ", "Ꭷ", ""},
- 0xab78: {"Ꭸ", "Ꭸ", ""},
- 0xab79: {"Ꭹ", "Ꭹ", ""},
- 0xab7a: {"Ꭺ", "Ꭺ", ""},
- 0xab7b: {"Ꭻ", "Ꭻ", ""},
- 0xab7c: {"Ꭼ", "Ꭼ", ""},
- 0xab7d: {"Ꭽ", "Ꭽ", ""},
- 0xab7e: {"Ꭾ", "Ꭾ", ""},
- 0xab7f: {"Ꭿ", "Ꭿ", ""},
- 0xab80: {"Ꮀ", "Ꮀ", ""},
- 0xab81: {"Ꮁ", "Ꮁ", ""},
- 0xab82: {"Ꮂ", "Ꮂ", ""},
- 0xab83: {"Ꮃ", "Ꮃ", ""},
- 0xab84: {"Ꮄ", "Ꮄ", ""},
- 0xab85: {"Ꮅ", "Ꮅ", ""},
- 0xab86: {"Ꮆ", "Ꮆ", ""},
- 0xab87: {"Ꮇ", "Ꮇ", ""},
- 0xab88: {"Ꮈ", "Ꮈ", ""},
- 0xab89: {"Ꮉ", "Ꮉ", ""},
- 0xab8a: {"Ꮊ", "Ꮊ", ""},
- 0xab8b: {"Ꮋ", "Ꮋ", ""},
- 0xab8c: {"Ꮌ", "Ꮌ", ""},
- 0xab8d: {"Ꮍ", "Ꮍ", ""},
- 0xab8e: {"Ꮎ", "Ꮎ", ""},
- 0xab8f: {"Ꮏ", "Ꮏ", ""},
- 0xab90: {"Ꮐ", "Ꮐ", ""},
- 0xab91: {"Ꮑ", "Ꮑ", ""},
- 0xab92: {"Ꮒ", "Ꮒ", ""},
- 0xab93: {"Ꮓ", "Ꮓ", ""},
- 0xab94: {"Ꮔ", "Ꮔ", ""},
- 0xab95: {"Ꮕ", "Ꮕ", ""},
- 0xab96: {"Ꮖ", "Ꮖ", ""},
- 0xab97: {"Ꮗ", "Ꮗ", ""},
- 0xab98: {"Ꮘ", "Ꮘ", ""},
- 0xab99: {"Ꮙ", "Ꮙ", ""},
- 0xab9a: {"Ꮚ", "Ꮚ", ""},
- 0xab9b: {"Ꮛ", "Ꮛ", ""},
- 0xab9c: {"Ꮜ", "Ꮜ", ""},
- 0xab9d: {"Ꮝ", "Ꮝ", ""},
- 0xab9e: {"Ꮞ", "Ꮞ", ""},
- 0xab9f: {"Ꮟ", "Ꮟ", ""},
- 0xaba0: {"Ꮠ", "Ꮠ", ""},
- 0xaba1: {"Ꮡ", "Ꮡ", ""},
- 0xaba2: {"Ꮢ", "Ꮢ", ""},
- 0xaba3: {"Ꮣ", "Ꮣ", ""},
- 0xaba4: {"Ꮤ", "Ꮤ", ""},
- 0xaba5: {"Ꮥ", "Ꮥ", ""},
- 0xaba6: {"Ꮦ", "Ꮦ", ""},
- 0xaba7: {"Ꮧ", "Ꮧ", ""},
- 0xaba8: {"Ꮨ", "Ꮨ", ""},
- 0xaba9: {"Ꮩ", "Ꮩ", ""},
- 0xabaa: {"Ꮪ", "Ꮪ", ""},
- 0xabab: {"Ꮫ", "Ꮫ", ""},
- 0xabac: {"Ꮬ", "Ꮬ", ""},
- 0xabad: {"Ꮭ", "Ꮭ", ""},
- 0xabae: {"Ꮮ", "Ꮮ", ""},
- 0xabaf: {"Ꮯ", "Ꮯ", ""},
- 0xabb0: {"Ꮰ", "Ꮰ", ""},
- 0xabb1: {"Ꮱ", "Ꮱ", ""},
- 0xabb2: {"Ꮲ", "Ꮲ", ""},
- 0xabb3: {"Ꮳ", "Ꮳ", ""},
- 0xabb4: {"Ꮴ", "Ꮴ", ""},
- 0xabb5: {"Ꮵ", "Ꮵ", ""},
- 0xabb6: {"Ꮶ", "Ꮶ", ""},
- 0xabb7: {"Ꮷ", "Ꮷ", ""},
- 0xabb8: {"Ꮸ", "Ꮸ", ""},
- 0xabb9: {"Ꮹ", "Ꮹ", ""},
- 0xabba: {"Ꮺ", "Ꮺ", ""},
- 0xabbb: {"Ꮻ", "Ꮻ", ""},
- 0xabbc: {"Ꮼ", "Ꮼ", ""},
- 0xabbd: {"Ꮽ", "Ꮽ", ""},
- 0xabbe: {"Ꮾ", "Ꮾ", ""},
- 0xabbf: {"Ꮿ", "Ꮿ", ""},
- 0xfb00: {"", "ff", ""},
- 0xfb01: {"", "fi", ""},
- 0xfb02: {"", "fl", ""},
- 0xfb03: {"", "ffi", ""},
- 0xfb04: {"", "ffl", ""},
- 0xfb05: {"", "st", ""},
- 0xfb06: {"", "st", ""},
- 0xfb13: {"", "մն", ""},
- 0xfb14: {"", "մե", ""},
- 0xfb15: {"", "մի", ""},
- 0xfb16: {"", "վն", ""},
- 0xfb17: {"", "մխ", ""},
- }
-
- breakProp = []struct{ lo, hi rune }{
- {0x0, 0x26},
- {0x28, 0x2d},
- {0x2f, 0x2f},
- {0x3b, 0x40},
- {0x5b, 0x5e},
- {0x60, 0x60},
- {0x7b, 0xa9},
- {0xab, 0xac},
- {0xae, 0xb4},
- {0xb6, 0xb6},
- {0xb8, 0xb9},
- {0xbb, 0xbf},
- {0xd7, 0xd7},
- {0xf7, 0xf7},
- {0x2c2, 0x2c5},
- {0x2d2, 0x2d6},
- {0x2d8, 0x2df},
- {0x2e5, 0x2eb},
- {0x2ed, 0x2ed},
- {0x2ef, 0x2ff},
- {0x375, 0x375},
- {0x378, 0x379},
- {0x37e, 0x37e},
- {0x380, 0x385},
- {0x38b, 0x38b},
- {0x38d, 0x38d},
- {0x3a2, 0x3a2},
- {0x3f6, 0x3f6},
- {0x482, 0x482},
- {0x530, 0x530},
- {0x557, 0x558},
- {0x55a, 0x560},
- {0x588, 0x590},
- {0x5be, 0x5be},
- {0x5c0, 0x5c0},
- {0x5c3, 0x5c3},
- {0x5c6, 0x5c6},
- {0x5c8, 0x5cf},
- {0x5eb, 0x5ef},
- {0x5f5, 0x5ff},
- {0x606, 0x60f},
- {0x61b, 0x61b},
- {0x61d, 0x61f},
- {0x66a, 0x66a},
- {0x66c, 0x66d},
- {0x6d4, 0x6d4},
- {0x6de, 0x6de},
- {0x6e9, 0x6e9},
- {0x6fd, 0x6fe},
- {0x700, 0x70e},
- {0x74b, 0x74c},
- {0x7b2, 0x7bf},
- {0x7f6, 0x7f9},
- {0x7fb, 0x7ff},
- {0x82e, 0x83f},
- {0x85c, 0x89f},
- {0x8b5, 0x8b5},
- {0x8be, 0x8d3},
- {0x964, 0x965},
- {0x970, 0x970},
- {0x984, 0x984},
- {0x98d, 0x98e},
- {0x991, 0x992},
- {0x9a9, 0x9a9},
- {0x9b1, 0x9b1},
- {0x9b3, 0x9b5},
- {0x9ba, 0x9bb},
- {0x9c5, 0x9c6},
- {0x9c9, 0x9ca},
- {0x9cf, 0x9d6},
- {0x9d8, 0x9db},
- {0x9de, 0x9de},
- {0x9e4, 0x9e5},
- {0x9f2, 0xa00},
- {0xa04, 0xa04},
- {0xa0b, 0xa0e},
- {0xa11, 0xa12},
- {0xa29, 0xa29},
- {0xa31, 0xa31},
- {0xa34, 0xa34},
- {0xa37, 0xa37},
- {0xa3a, 0xa3b},
- {0xa3d, 0xa3d},
- {0xa43, 0xa46},
- {0xa49, 0xa4a},
- {0xa4e, 0xa50},
- {0xa52, 0xa58},
- {0xa5d, 0xa5d},
- {0xa5f, 0xa65},
- {0xa76, 0xa80},
- {0xa84, 0xa84},
- {0xa8e, 0xa8e},
- {0xa92, 0xa92},
- {0xaa9, 0xaa9},
- {0xab1, 0xab1},
- {0xab4, 0xab4},
- {0xaba, 0xabb},
- {0xac6, 0xac6},
- {0xaca, 0xaca},
- {0xace, 0xacf},
- {0xad1, 0xadf},
- {0xae4, 0xae5},
- {0xaf0, 0xaf8},
- {0xafa, 0xb00},
- {0xb04, 0xb04},
- {0xb0d, 0xb0e},
- {0xb11, 0xb12},
- {0xb29, 0xb29},
- {0xb31, 0xb31},
- {0xb34, 0xb34},
- {0xb3a, 0xb3b},
- {0xb45, 0xb46},
- {0xb49, 0xb4a},
- {0xb4e, 0xb55},
- {0xb58, 0xb5b},
- {0xb5e, 0xb5e},
- {0xb64, 0xb65},
- {0xb70, 0xb70},
- {0xb72, 0xb81},
- {0xb84, 0xb84},
- {0xb8b, 0xb8d},
- {0xb91, 0xb91},
- {0xb96, 0xb98},
- {0xb9b, 0xb9b},
- {0xb9d, 0xb9d},
- {0xba0, 0xba2},
- {0xba5, 0xba7},
- {0xbab, 0xbad},
- {0xbba, 0xbbd},
- {0xbc3, 0xbc5},
- {0xbc9, 0xbc9},
- {0xbce, 0xbcf},
- {0xbd1, 0xbd6},
- {0xbd8, 0xbe5},
- {0xbf0, 0xbff},
- {0xc04, 0xc04},
- {0xc0d, 0xc0d},
- {0xc11, 0xc11},
- {0xc29, 0xc29},
- {0xc3a, 0xc3c},
- {0xc45, 0xc45},
- {0xc49, 0xc49},
- {0xc4e, 0xc54},
- {0xc57, 0xc57},
- {0xc5b, 0xc5f},
- {0xc64, 0xc65},
- {0xc70, 0xc7f},
- {0xc84, 0xc84},
- {0xc8d, 0xc8d},
- {0xc91, 0xc91},
- {0xca9, 0xca9},
- {0xcb4, 0xcb4},
- {0xcba, 0xcbb},
- {0xcc5, 0xcc5},
- {0xcc9, 0xcc9},
- {0xcce, 0xcd4},
- {0xcd7, 0xcdd},
- {0xcdf, 0xcdf},
- {0xce4, 0xce5},
- {0xcf0, 0xcf0},
- {0xcf3, 0xd00},
- {0xd04, 0xd04},
- {0xd0d, 0xd0d},
- {0xd11, 0xd11},
- {0xd3b, 0xd3c},
- {0xd45, 0xd45},
- {0xd49, 0xd49},
- {0xd4f, 0xd53},
- {0xd58, 0xd5e},
- {0xd64, 0xd65},
- {0xd70, 0xd79},
- {0xd80, 0xd81},
- {0xd84, 0xd84},
- {0xd97, 0xd99},
- {0xdb2, 0xdb2},
- {0xdbc, 0xdbc},
- {0xdbe, 0xdbf},
- {0xdc7, 0xdc9},
- {0xdcb, 0xdce},
- {0xdd5, 0xdd5},
- {0xdd7, 0xdd7},
- {0xde0, 0xde5},
- {0xdf0, 0xdf1},
- {0xdf4, 0xe30},
- {0xe32, 0xe33},
- {0xe3b, 0xe46},
- {0xe4f, 0xe4f},
- {0xe5a, 0xeb0},
- {0xeb2, 0xeb3},
- {0xeba, 0xeba},
- {0xebd, 0xec7},
- {0xece, 0xecf},
- {0xeda, 0xeff},
- {0xf01, 0xf17},
- {0xf1a, 0xf1f},
- {0xf2a, 0xf34},
- {0xf36, 0xf36},
- {0xf38, 0xf38},
- {0xf3a, 0xf3d},
- {0xf48, 0xf48},
- {0xf6d, 0xf70},
- {0xf85, 0xf85},
- {0xf98, 0xf98},
- {0xfbd, 0xfc5},
- {0xfc7, 0x102a},
- {0x103f, 0x103f},
- {0x104a, 0x1055},
- {0x105a, 0x105d},
- {0x1061, 0x1061},
- {0x1065, 0x1066},
- {0x106e, 0x1070},
- {0x1075, 0x1081},
- {0x108e, 0x108e},
- {0x109e, 0x109f},
- {0x10c6, 0x10c6},
- {0x10c8, 0x10cc},
- {0x10ce, 0x10cf},
- {0x10fb, 0x10fb},
- {0x1249, 0x1249},
- {0x124e, 0x124f},
- {0x1257, 0x1257},
- {0x1259, 0x1259},
- {0x125e, 0x125f},
- {0x1289, 0x1289},
- {0x128e, 0x128f},
- {0x12b1, 0x12b1},
- {0x12b6, 0x12b7},
- {0x12bf, 0x12bf},
- {0x12c1, 0x12c1},
- {0x12c6, 0x12c7},
- {0x12d7, 0x12d7},
- {0x1311, 0x1311},
- {0x1316, 0x1317},
- {0x135b, 0x135c},
- {0x1360, 0x137f},
- {0x1390, 0x139f},
- {0x13f6, 0x13f7},
- {0x13fe, 0x1400},
- {0x166d, 0x166e},
- {0x1680, 0x1680},
- {0x169b, 0x169f},
- {0x16eb, 0x16ed},
- {0x16f9, 0x16ff},
- {0x170d, 0x170d},
- {0x1715, 0x171f},
- {0x1735, 0x173f},
- {0x1754, 0x175f},
- {0x176d, 0x176d},
- {0x1771, 0x1771},
- {0x1774, 0x17b3},
- {0x17d4, 0x17dc},
- {0x17de, 0x17df},
- {0x17ea, 0x180a},
- {0x180f, 0x180f},
- {0x181a, 0x181f},
- {0x1878, 0x187f},
- {0x18ab, 0x18af},
- {0x18f6, 0x18ff},
- {0x191f, 0x191f},
- {0x192c, 0x192f},
- {0x193c, 0x1945},
- {0x1950, 0x19cf},
- {0x19da, 0x19ff},
- {0x1a1c, 0x1a54},
- {0x1a5f, 0x1a5f},
- {0x1a7d, 0x1a7e},
- {0x1a8a, 0x1a8f},
- {0x1a9a, 0x1aaf},
- {0x1abf, 0x1aff},
- {0x1b4c, 0x1b4f},
- {0x1b5a, 0x1b6a},
- {0x1b74, 0x1b7f},
- {0x1bf4, 0x1bff},
- {0x1c38, 0x1c3f},
- {0x1c4a, 0x1c4c},
- {0x1c7e, 0x1c7f},
- {0x1c89, 0x1ccf},
- {0x1cd3, 0x1cd3},
- {0x1cf7, 0x1cf7},
- {0x1cfa, 0x1cff},
- {0x1df6, 0x1dfa},
- {0x1f16, 0x1f17},
- {0x1f1e, 0x1f1f},
- {0x1f46, 0x1f47},
- {0x1f4e, 0x1f4f},
- {0x1f58, 0x1f58},
- {0x1f5a, 0x1f5a},
- {0x1f5c, 0x1f5c},
- {0x1f5e, 0x1f5e},
- {0x1f7e, 0x1f7f},
- {0x1fb5, 0x1fb5},
- {0x1fbd, 0x1fbd},
- {0x1fbf, 0x1fc1},
- {0x1fc5, 0x1fc5},
- {0x1fcd, 0x1fcf},
- {0x1fd4, 0x1fd5},
- {0x1fdc, 0x1fdf},
- {0x1fed, 0x1ff1},
- {0x1ff5, 0x1ff5},
- {0x1ffd, 0x200b},
- {0x2010, 0x2017},
- {0x201a, 0x2023},
- {0x2025, 0x2026},
- {0x2028, 0x2029},
- {0x2030, 0x203e},
- {0x2041, 0x2053},
- {0x2055, 0x205f},
- {0x2065, 0x2065},
- {0x2070, 0x2070},
- {0x2072, 0x207e},
- {0x2080, 0x208f},
- {0x209d, 0x20cf},
- {0x20f1, 0x2101},
- {0x2103, 0x2106},
- {0x2108, 0x2109},
- {0x2114, 0x2114},
- {0x2116, 0x2118},
- {0x211e, 0x2123},
- {0x2125, 0x2125},
- {0x2127, 0x2127},
- {0x2129, 0x2129},
- {0x212e, 0x212e},
- {0x213a, 0x213b},
- {0x2140, 0x2144},
- {0x214a, 0x214d},
- {0x214f, 0x215f},
- {0x2189, 0x24b5},
- {0x24ea, 0x2bff},
- {0x2c2f, 0x2c2f},
- {0x2c5f, 0x2c5f},
- {0x2ce5, 0x2cea},
- {0x2cf4, 0x2cff},
- {0x2d26, 0x2d26},
- {0x2d28, 0x2d2c},
- {0x2d2e, 0x2d2f},
- {0x2d68, 0x2d6e},
- {0x2d70, 0x2d7e},
- {0x2d97, 0x2d9f},
- {0x2da7, 0x2da7},
- {0x2daf, 0x2daf},
- {0x2db7, 0x2db7},
- {0x2dbf, 0x2dbf},
- {0x2dc7, 0x2dc7},
- {0x2dcf, 0x2dcf},
- {0x2dd7, 0x2dd7},
- {0x2ddf, 0x2ddf},
- {0x2e00, 0x2e2e},
- {0x2e30, 0x3004},
- {0x3006, 0x3029},
- {0x3030, 0x303a},
- {0x303d, 0x3098},
- {0x309b, 0x3104},
- {0x312e, 0x3130},
- {0x318f, 0x319f},
- {0x31bb, 0x9fff},
- {0xa48d, 0xa4cf},
- {0xa4fe, 0xa4ff},
- {0xa60d, 0xa60f},
- {0xa62c, 0xa63f},
- {0xa673, 0xa673},
- {0xa67e, 0xa67e},
- {0xa6f2, 0xa716},
- {0xa720, 0xa721},
- {0xa789, 0xa78a},
- {0xa7af, 0xa7af},
- {0xa7b8, 0xa7f6},
- {0xa828, 0xa83f},
- {0xa874, 0xa87f},
- {0xa8c6, 0xa8cf},
- {0xa8da, 0xa8df},
- {0xa8f8, 0xa8fa},
- {0xa8fc, 0xa8fc},
- {0xa8fe, 0xa8ff},
- {0xa92e, 0xa92f},
- {0xa954, 0xa95f},
- {0xa97d, 0xa97f},
- {0xa9c1, 0xa9ce},
- {0xa9da, 0xa9e4},
- {0xa9e6, 0xa9ef},
- {0xa9fa, 0xa9ff},
- {0xaa37, 0xaa3f},
- {0xaa4e, 0xaa4f},
- {0xaa5a, 0xaa7a},
- {0xaa7e, 0xaaaf},
- {0xaab1, 0xaab1},
- {0xaab5, 0xaab6},
- {0xaab9, 0xaabd},
- {0xaac0, 0xaac0},
- {0xaac2, 0xaadf},
- {0xaaf0, 0xaaf1},
- {0xaaf7, 0xab00},
- {0xab07, 0xab08},
- {0xab0f, 0xab10},
- {0xab17, 0xab1f},
- {0xab27, 0xab27},
- {0xab2f, 0xab2f},
- {0xab5b, 0xab5b},
- {0xab66, 0xab6f},
- {0xabeb, 0xabeb},
- {0xabee, 0xabef},
- {0xabfa, 0xabff},
- {0xd7a4, 0xd7af},
- {0xd7c7, 0xd7ca},
- {0xd7fc, 0xfaff},
- {0xfb07, 0xfb12},
- {0xfb18, 0xfb1c},
- {0xfb29, 0xfb29},
- {0xfb37, 0xfb37},
- {0xfb3d, 0xfb3d},
- {0xfb3f, 0xfb3f},
- {0xfb42, 0xfb42},
- {0xfb45, 0xfb45},
- {0xfbb2, 0xfbd2},
- {0xfd3e, 0xfd4f},
- {0xfd90, 0xfd91},
- {0xfdc8, 0xfdef},
- {0xfdfc, 0xfdff},
- {0xfe10, 0xfe12},
- {0xfe14, 0xfe1f},
- {0xfe30, 0xfe32},
- {0xfe35, 0xfe4c},
- {0xfe50, 0xfe51},
- {0xfe53, 0xfe54},
- {0xfe56, 0xfe6f},
- {0xfe75, 0xfe75},
- {0xfefd, 0xfefe},
- {0xff00, 0xff06},
- {0xff08, 0xff0d},
- {0xff0f, 0xff19},
- {0xff1b, 0xff20},
- {0xff3b, 0xff3e},
- {0xff40, 0xff40},
- {0xff5b, 0xff9d},
- {0xffbf, 0xffc1},
- {0xffc8, 0xffc9},
- {0xffd0, 0xffd1},
- {0xffd8, 0xffd9},
- {0xffdd, 0xfff8},
- {0xfffc, 0xffff},
- {0x1000c, 0x1000c},
- {0x10027, 0x10027},
- {0x1003b, 0x1003b},
- {0x1003e, 0x1003e},
- {0x1004e, 0x1004f},
- {0x1005e, 0x1007f},
- {0x100fb, 0x1013f},
- {0x10175, 0x101fc},
- {0x101fe, 0x1027f},
- {0x1029d, 0x1029f},
- {0x102d1, 0x102df},
- {0x102e1, 0x102ff},
- {0x10320, 0x1032f},
- {0x1034b, 0x1034f},
- {0x1037b, 0x1037f},
- {0x1039e, 0x1039f},
- {0x103c4, 0x103c7},
- {0x103d0, 0x103d0},
- {0x103d6, 0x103ff},
- {0x1049e, 0x1049f},
- {0x104aa, 0x104af},
- {0x104d4, 0x104d7},
- {0x104fc, 0x104ff},
- {0x10528, 0x1052f},
- {0x10564, 0x105ff},
- {0x10737, 0x1073f},
- {0x10756, 0x1075f},
- {0x10768, 0x107ff},
- {0x10806, 0x10807},
- {0x10809, 0x10809},
- {0x10836, 0x10836},
- {0x10839, 0x1083b},
- {0x1083d, 0x1083e},
- {0x10856, 0x1085f},
- {0x10877, 0x1087f},
- {0x1089f, 0x108df},
- {0x108f3, 0x108f3},
- {0x108f6, 0x108ff},
- {0x10916, 0x1091f},
- {0x1093a, 0x1097f},
- {0x109b8, 0x109bd},
- {0x109c0, 0x109ff},
- {0x10a04, 0x10a04},
- {0x10a07, 0x10a0b},
- {0x10a14, 0x10a14},
- {0x10a18, 0x10a18},
- {0x10a34, 0x10a37},
- {0x10a3b, 0x10a3e},
- {0x10a40, 0x10a5f},
- {0x10a7d, 0x10a7f},
- {0x10a9d, 0x10abf},
- {0x10ac8, 0x10ac8},
- {0x10ae7, 0x10aff},
- {0x10b36, 0x10b3f},
- {0x10b56, 0x10b5f},
- {0x10b73, 0x10b7f},
- {0x10b92, 0x10bff},
- {0x10c49, 0x10c7f},
- {0x10cb3, 0x10cbf},
- {0x10cf3, 0x10fff},
- {0x11047, 0x11065},
- {0x11070, 0x1107e},
- {0x110bb, 0x110bc},
- {0x110be, 0x110cf},
- {0x110e9, 0x110ef},
- {0x110fa, 0x110ff},
- {0x11135, 0x11135},
- {0x11140, 0x1114f},
- {0x11174, 0x11175},
- {0x11177, 0x1117f},
- {0x111c5, 0x111c9},
- {0x111cd, 0x111cf},
- {0x111db, 0x111db},
- {0x111dd, 0x111ff},
- {0x11212, 0x11212},
- {0x11238, 0x1123d},
- {0x1123f, 0x1127f},
- {0x11287, 0x11287},
- {0x11289, 0x11289},
- {0x1128e, 0x1128e},
- {0x1129e, 0x1129e},
- {0x112a9, 0x112af},
- {0x112eb, 0x112ef},
- {0x112fa, 0x112ff},
- {0x11304, 0x11304},
- {0x1130d, 0x1130e},
- {0x11311, 0x11312},
- {0x11329, 0x11329},
- {0x11331, 0x11331},
- {0x11334, 0x11334},
- {0x1133a, 0x1133b},
- {0x11345, 0x11346},
- {0x11349, 0x1134a},
- {0x1134e, 0x1134f},
- {0x11351, 0x11356},
- {0x11358, 0x1135c},
- {0x11364, 0x11365},
- {0x1136d, 0x1136f},
- {0x11375, 0x113ff},
- {0x1144b, 0x1144f},
- {0x1145a, 0x1147f},
- {0x114c6, 0x114c6},
- {0x114c8, 0x114cf},
- {0x114da, 0x1157f},
- {0x115b6, 0x115b7},
- {0x115c1, 0x115d7},
- {0x115de, 0x115ff},
- {0x11641, 0x11643},
- {0x11645, 0x1164f},
- {0x1165a, 0x1167f},
- {0x116b8, 0x116bf},
- {0x116ca, 0x1171c},
- {0x1172c, 0x1172f},
- {0x1173a, 0x1189f},
- {0x118ea, 0x118fe},
- {0x11900, 0x11abf},
- {0x11af9, 0x11bff},
- {0x11c09, 0x11c09},
- {0x11c37, 0x11c37},
- {0x11c41, 0x11c4f},
- {0x11c5a, 0x11c71},
- {0x11c90, 0x11c91},
- {0x11ca8, 0x11ca8},
- {0x11cb7, 0x11fff},
- {0x1239a, 0x123ff},
- {0x1246f, 0x1247f},
- {0x12544, 0x12fff},
- {0x1342f, 0x143ff},
- {0x14647, 0x167ff},
- {0x16a39, 0x16a3f},
- {0x16a5f, 0x16a5f},
- {0x16a6a, 0x16acf},
- {0x16aee, 0x16aef},
- {0x16af5, 0x16aff},
- {0x16b37, 0x16b3f},
- {0x16b44, 0x16b4f},
- {0x16b5a, 0x16b62},
- {0x16b78, 0x16b7c},
- {0x16b90, 0x16eff},
- {0x16f45, 0x16f4f},
- {0x16f7f, 0x16f8e},
- {0x16fa0, 0x16fdf},
- {0x16fe1, 0x1bbff},
- {0x1bc6b, 0x1bc6f},
- {0x1bc7d, 0x1bc7f},
- {0x1bc89, 0x1bc8f},
- {0x1bc9a, 0x1bc9c},
- {0x1bc9f, 0x1bc9f},
- {0x1bca4, 0x1d164},
- {0x1d16a, 0x1d16c},
- {0x1d183, 0x1d184},
- {0x1d18c, 0x1d1a9},
- {0x1d1ae, 0x1d241},
- {0x1d245, 0x1d3ff},
- {0x1d455, 0x1d455},
- {0x1d49d, 0x1d49d},
- {0x1d4a0, 0x1d4a1},
- {0x1d4a3, 0x1d4a4},
- {0x1d4a7, 0x1d4a8},
- {0x1d4ad, 0x1d4ad},
- {0x1d4ba, 0x1d4ba},
- {0x1d4bc, 0x1d4bc},
- {0x1d4c4, 0x1d4c4},
- {0x1d506, 0x1d506},
- {0x1d50b, 0x1d50c},
- {0x1d515, 0x1d515},
- {0x1d51d, 0x1d51d},
- {0x1d53a, 0x1d53a},
- {0x1d53f, 0x1d53f},
- {0x1d545, 0x1d545},
- {0x1d547, 0x1d549},
- {0x1d551, 0x1d551},
- {0x1d6a6, 0x1d6a7},
- {0x1d6c1, 0x1d6c1},
- {0x1d6db, 0x1d6db},
- {0x1d6fb, 0x1d6fb},
- {0x1d715, 0x1d715},
- {0x1d735, 0x1d735},
- {0x1d74f, 0x1d74f},
- {0x1d76f, 0x1d76f},
- {0x1d789, 0x1d789},
- {0x1d7a9, 0x1d7a9},
- {0x1d7c3, 0x1d7c3},
- {0x1d7cc, 0x1d7cd},
- {0x1d800, 0x1d9ff},
- {0x1da37, 0x1da3a},
- {0x1da6d, 0x1da74},
- {0x1da76, 0x1da83},
- {0x1da85, 0x1da9a},
- {0x1daa0, 0x1daa0},
- {0x1dab0, 0x1dfff},
- {0x1e007, 0x1e007},
- {0x1e019, 0x1e01a},
- {0x1e022, 0x1e022},
- {0x1e025, 0x1e025},
- {0x1e02b, 0x1e7ff},
- {0x1e8c5, 0x1e8cf},
- {0x1e8d7, 0x1e8ff},
- {0x1e94b, 0x1e94f},
- {0x1e95a, 0x1edff},
- {0x1ee04, 0x1ee04},
- {0x1ee20, 0x1ee20},
- {0x1ee23, 0x1ee23},
- {0x1ee25, 0x1ee26},
- {0x1ee28, 0x1ee28},
- {0x1ee33, 0x1ee33},
- {0x1ee38, 0x1ee38},
- {0x1ee3a, 0x1ee3a},
- {0x1ee3c, 0x1ee41},
- {0x1ee43, 0x1ee46},
- {0x1ee48, 0x1ee48},
- {0x1ee4a, 0x1ee4a},
- {0x1ee4c, 0x1ee4c},
- {0x1ee50, 0x1ee50},
- {0x1ee53, 0x1ee53},
- {0x1ee55, 0x1ee56},
- {0x1ee58, 0x1ee58},
- {0x1ee5a, 0x1ee5a},
- {0x1ee5c, 0x1ee5c},
- {0x1ee5e, 0x1ee5e},
- {0x1ee60, 0x1ee60},
- {0x1ee63, 0x1ee63},
- {0x1ee65, 0x1ee66},
- {0x1ee6b, 0x1ee6b},
- {0x1ee73, 0x1ee73},
- {0x1ee78, 0x1ee78},
- {0x1ee7d, 0x1ee7d},
- {0x1ee7f, 0x1ee7f},
- {0x1ee8a, 0x1ee8a},
- {0x1ee9c, 0x1eea0},
- {0x1eea4, 0x1eea4},
- {0x1eeaa, 0x1eeaa},
- {0x1eebc, 0x1f12f},
- {0x1f14a, 0x1f14f},
- {0x1f16a, 0x1f16f},
- {0x1f18a, 0x1ffff},
- }
-
- breakTest = []string{
- "AA",
- "ÄA",
- "Aa\u2060",
- "Äa\u2060",
- "Aa|:",
- "Äa|:",
- "Aa|'",
- "Äa|'",
- "Aa|'\u2060",
- "Äa|'\u2060",
- "Aa|,",
- "Äa|,",
- "a\u2060A",
- "a\u2060̈A",
- "a\u2060a\u2060",
- "a\u2060̈a\u2060",
- "a\u2060a|:",
- "a\u2060̈a|:",
- "a\u2060a|'",
- "a\u2060̈a|'",
- "a\u2060a|'\u2060",
- "a\u2060̈a|'\u2060",
- "a\u2060a|,",
- "a\u2060̈a|,",
- "a:A",
- "a:̈A",
- "a:a\u2060",
- "a:̈a\u2060",
- "a:a|:",
- "a:̈a|:",
- "a:a|'",
- "a:̈a|'",
- "a:a|'\u2060",
- "a:̈a|'\u2060",
- "a:a|,",
- "a:̈a|,",
- "a'A",
- "a'̈A",
- "a'a\u2060",
- "a'̈a\u2060",
- "a'a|:",
- "a'̈a|:",
- "a'a|'",
- "a'̈a|'",
- "a'a|'\u2060",
- "a'̈a|'\u2060",
- "a'a|,",
- "a'̈a|,",
- "a'\u2060A",
- "a'\u2060̈A",
- "a'\u2060a\u2060",
- "a'\u2060̈a\u2060",
- "a'\u2060a|:",
- "a'\u2060̈a|:",
- "a'\u2060a|'",
- "a'\u2060̈a|'",
- "a'\u2060a|'\u2060",
- "a'\u2060̈a|'\u2060",
- "a'\u2060a|,",
- "a'\u2060̈a|,",
- "a|,|A",
- "a|,̈|A",
- "a|,|a\u2060",
- "a|,̈|a\u2060",
- "a|,|a|:",
- "a|,̈|a|:",
- "a|,|a|'",
- "a|,̈|a|'",
- "a|,|a|'\u2060",
- "a|,̈|a|'\u2060",
- "a|,|a|,",
- "a|,̈|a|,",
- "AAA",
- "A:A",
- "A|:|:|A",
- "A00A",
- "A__A",
- "a|🇦🇧|🇨|b",
- "a|🇦🇧\u200d|🇨|b",
- "a|🇦\u200d🇧|🇨|b",
- "a|🇦🇧|🇨🇩|b",
- "ä\u200d̈b",
- "1_a|:|:|a",
- "1_a|:|.|a",
- "1_a|:|,|a",
- "1_a|.|:|a",
- "1_a|.|.|a",
- "1_a|.|,|a",
- "1_a|,|:|a",
- "1_a|,|.|a",
- "1_a|,|,|a",
- "a_a|:|:|1",
- "a|:|:|a",
- "a_1|:|:|a",
- "a_a|:|:|a",
- "a_a|:|.|1",
- "a|:|.|a",
- "a_1|:|.|a",
- "a_a|:|.|a",
- "a_a|:|,|1",
- "a|:|,|a",
- "a_1|:|,|a",
- "a_a|:|,|a",
- "a_a|.|:|1",
- "a|.|:|a",
- "a_1|.|:|a",
- "a_a|.|:|a",
- "a_a|.|.|1",
- "a|.|.|a",
- "a_1|.|.|a",
- "a_a|.|.|a",
- "a_a|.|,|1",
- "a|.|,|a",
- "a_1|.|,|a",
- "a_a|.|,|a",
- "a_a|,|:|1",
- "a|,|:|a",
- "a_1|,|:|a",
- "a_a|,|:|a",
- "a_a|,|.|1",
- "a|,|.|a",
- "a_1|,|.|a",
- "a_a|,|.|a",
- "a_a|,|,|1",
- "a|,|,|a",
- "a_1|,|,|a",
- "a_a|,|,|a",
- }
-)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/builder_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/builder_test.go
deleted file mode 100644
index ff0aba3aee7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/builder_test.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import "testing"
-
-// cjk returns an implicit collation element for a CJK rune.
-func cjk(r rune) []rawCE {
- // A CJK character C is represented in the DUCET as
- // [.AAAA.0020.0002.C][.BBBB.0000.0000.C]
- // Where AAAA is the most significant 15 bits plus a base value.
- // Any base value will work for the test, so we pick the common value of FB40.
- const base = 0xFB40
- return []rawCE{
- {w: []int{base + int(r>>15), defaultSecondary, defaultTertiary, int(r)}},
- {w: []int{int(r&0x7FFF) | 0x8000, 0, 0, int(r)}},
- }
-}
-
-func pCE(p int) []rawCE {
- return mkCE([]int{p, defaultSecondary, defaultTertiary, 0}, 0)
-}
-
-func pqCE(p, q int) []rawCE {
- return mkCE([]int{p, defaultSecondary, defaultTertiary, q}, 0)
-}
-
-func ptCE(p, t int) []rawCE {
- return mkCE([]int{p, defaultSecondary, t, 0}, 0)
-}
-
-func ptcCE(p, t int, ccc uint8) []rawCE {
- return mkCE([]int{p, defaultSecondary, t, 0}, ccc)
-}
-
-func sCE(s int) []rawCE {
- return mkCE([]int{0, s, defaultTertiary, 0}, 0)
-}
-
-func stCE(s, t int) []rawCE {
- return mkCE([]int{0, s, t, 0}, 0)
-}
-
-func scCE(s int, ccc uint8) []rawCE {
- return mkCE([]int{0, s, defaultTertiary, 0}, ccc)
-}
-
-func mkCE(w []int, ccc uint8) []rawCE {
- return []rawCE{rawCE{w, ccc}}
-}
-
-// ducetElem is used to define test data that is used to generate a table.
-type ducetElem struct {
- str string
- ces []rawCE
-}
-
-func newBuilder(t *testing.T, ducet []ducetElem) *Builder {
- b := NewBuilder()
- for _, e := range ducet {
- ces := [][]int{}
- for _, ce := range e.ces {
- ces = append(ces, ce.w)
- }
- if err := b.Add([]rune(e.str), ces, nil); err != nil {
- t.Errorf(err.Error())
- }
- }
- b.t = &table{}
- b.root.sort()
- return b
-}
-
-type convertTest struct {
- in, out []rawCE
- err bool
-}
-
-var convLargeTests = []convertTest{
- {pCE(0xFB39), pCE(0xFB39), false},
- {cjk(0x2F9B2), pqCE(0x3F9B2, 0x2F9B2), false},
- {pCE(0xFB40), pCE(0), true},
- {append(pCE(0xFB40), pCE(0)[0]), pCE(0), true},
- {pCE(0xFFFE), pCE(illegalOffset), false},
- {pCE(0xFFFF), pCE(illegalOffset + 1), false},
-}
-
-func TestConvertLarge(t *testing.T) {
- for i, tt := range convLargeTests {
- e := new(entry)
- for _, ce := range tt.in {
- e.elems = append(e.elems, makeRawCE(ce.w, ce.ccc))
- }
- elems, err := convertLargeWeights(e.elems)
- if tt.err {
- if err == nil {
- t.Errorf("%d: expected error; none found", i)
- }
- continue
- } else if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err)
- }
- if !equalCEArrays(elems, tt.out) {
- t.Errorf("%d: conversion was %x; want %x", i, elems, tt.out)
- }
- }
-}
-
-// Collation element table for simplify tests.
-var simplifyTest = []ducetElem{
- {"\u0300", sCE(30)}, // grave
- {"\u030C", sCE(40)}, // caron
- {"A", ptCE(100, 8)},
- {"D", ptCE(104, 8)},
- {"E", ptCE(105, 8)},
- {"I", ptCE(110, 8)},
- {"z", ptCE(130, 8)},
- {"\u05F2", append(ptCE(200, 4), ptCE(200, 4)[0])},
- {"\u05B7", sCE(80)},
- {"\u00C0", append(ptCE(100, 8), sCE(30)...)}, // A with grave, can be removed
- {"\u00C8", append(ptCE(105, 8), sCE(30)...)}, // E with grave
- {"\uFB1F", append(ptCE(200, 4), ptCE(200, 4)[0], sCE(80)[0])}, // eliminated by NFD
- {"\u00C8\u0302", ptCE(106, 8)}, // block previous from simplifying
- {"\u01C5", append(ptCE(104, 9), ptCE(130, 4)[0], stCE(40, maxTertiary)[0])}, // eliminated by NFKD
- // no removal: tertiary value of third element is not maxTertiary
- {"\u2162", append(ptCE(110, 9), ptCE(110, 4)[0], ptCE(110, 8)[0])},
-}
-
-var genColTests = []ducetElem{
- {"\uFA70", pqCE(0x1FA70, 0xFA70)},
- {"A\u0300", append(ptCE(100, 8), sCE(30)...)},
- {"A\u0300\uFA70", append(ptCE(100, 8), sCE(30)[0], pqCE(0x1FA70, 0xFA70)[0])},
- {"A\u0300A\u0300", append(ptCE(100, 8), sCE(30)[0], ptCE(100, 8)[0], sCE(30)[0])},
-}
-
-func TestGenColElems(t *testing.T) {
- b := newBuilder(t, simplifyTest[:5])
-
- for i, tt := range genColTests {
- res := b.root.genColElems(tt.str)
- if !equalCEArrays(tt.ces, res) {
- t.Errorf("%d: result %X; want %X", i, res, tt.ces)
- }
- }
-}
-
-type strArray []string
-
-func (sa strArray) contains(s string) bool {
- for _, e := range sa {
- if e == s {
- return true
- }
- }
- return false
-}
-
-var simplifyRemoved = strArray{"\u00C0", "\uFB1F"}
-var simplifyMarked = strArray{"\u01C5"}
-
-func TestSimplify(t *testing.T) {
- b := newBuilder(t, simplifyTest)
- o := &b.root
- simplify(o)
-
- for i, tt := range simplifyTest {
- if simplifyRemoved.contains(tt.str) {
- continue
- }
- e := o.find(tt.str)
- if e.str != tt.str || !equalCEArrays(e.elems, tt.ces) {
- t.Errorf("%d: found element %s -> %X; want %s -> %X", i, e.str, e.elems, tt.str, tt.ces)
- break
- }
- }
- var i, k int
- for e := o.front(); e != nil; e, _ = e.nextIndexed() {
- gold := simplifyMarked.contains(e.str)
- if gold {
- k++
- }
- if gold != e.decompose {
- t.Errorf("%d: %s has decompose %v; want %v", i, e.str, e.decompose, gold)
- }
- i++
- }
- if k != len(simplifyMarked) {
- t.Errorf(" an entry that should be marked as decompose was deleted")
- }
-}
-
-var expandTest = []ducetElem{
- {"\u0300", append(scCE(29, 230), scCE(30, 230)...)},
- {"\u00C0", append(ptCE(100, 8), scCE(30, 230)...)},
- {"\u00C8", append(ptCE(105, 8), scCE(30, 230)...)},
- {"\u00C9", append(ptCE(105, 8), scCE(30, 230)...)}, // identical expansion
- {"\u05F2", append(ptCE(200, 4), ptCE(200, 4)[0], ptCE(200, 4)[0])},
- {"\u01FF", append(ptCE(200, 4), ptcCE(201, 4, 0)[0], scCE(30, 230)[0])},
-}
-
-func TestExpand(t *testing.T) {
- const (
- totalExpansions = 5
- totalElements = 2 + 2 + 2 + 3 + 3 + totalExpansions
- )
- b := newBuilder(t, expandTest)
- o := &b.root
- b.processExpansions(o)
-
- e := o.front()
- for _, tt := range expandTest {
- exp := b.t.ExpandElem[e.expansionIndex:]
- if int(exp[0]) != len(tt.ces) {
- t.Errorf("%U: len(expansion)==%d; want %d", []rune(tt.str)[0], exp[0], len(tt.ces))
- }
- exp = exp[1:]
- for j, w := range tt.ces {
- if ce, _ := makeCE(w); exp[j] != ce {
- t.Errorf("%U: element %d is %X; want %X", []rune(tt.str)[0], j, exp[j], ce)
- }
- }
- e, _ = e.nextIndexed()
- }
- // Verify uniquing.
- if len(b.t.ExpandElem) != totalElements {
- t.Errorf("len(expandElem)==%d; want %d", len(b.t.ExpandElem), totalElements)
- }
-}
-
-var contractTest = []ducetElem{
- {"abc", pCE(102)},
- {"abd", pCE(103)},
- {"a", pCE(100)},
- {"ab", pCE(101)},
- {"ac", pCE(104)},
- {"bcd", pCE(202)},
- {"b", pCE(200)},
- {"bc", pCE(201)},
- {"bd", pCE(203)},
- // shares suffixes with a*
- {"Ab", pCE(301)},
- {"A", pCE(300)},
- {"Ac", pCE(304)},
- {"Abc", pCE(302)},
- {"Abd", pCE(303)},
- // starter to be ignored
- {"z", pCE(1000)},
-}
-
-func TestContract(t *testing.T) {
- const (
- totalElements = 5 + 5 + 4
- )
- b := newBuilder(t, contractTest)
- o := &b.root
- b.processContractions(o)
-
- indexMap := make(map[int]bool)
- handleMap := make(map[rune]*entry)
- for e := o.front(); e != nil; e, _ = e.nextIndexed() {
- if e.contractionHandle.n > 0 {
- handleMap[e.runes[0]] = e
- indexMap[e.contractionHandle.index] = true
- }
- }
- // Verify uniquing.
- if len(indexMap) != 2 {
- t.Errorf("number of tries is %d; want %d", len(indexMap), 2)
- }
- for _, tt := range contractTest {
- e, ok := handleMap[[]rune(tt.str)[0]]
- if !ok {
- continue
- }
- str := tt.str[1:]
- offset, n := lookup(&b.t.ContractTries, e.contractionHandle, []byte(str))
- if len(str) != n {
- t.Errorf("%s: bytes consumed==%d; want %d", tt.str, n, len(str))
- }
- ce := b.t.ContractElem[offset+e.contractionIndex]
- if want, _ := makeCE(tt.ces[0]); want != ce {
- t.Errorf("%s: element %X; want %X", tt.str, ce, want)
- }
- }
- if len(b.t.ContractElem) != totalElements {
- t.Errorf("len(expandElem)==%d; want %d", len(b.t.ContractElem), totalElements)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/colelem_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/colelem_test.go
deleted file mode 100644
index d0c8d07d8ac..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/colelem_test.go
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "testing"
-
- "golang.org/x/text/internal/colltab"
-)
-
-type ceTest struct {
- f func(in []int) (uint32, error)
- arg []int
- val uint32
-}
-
-func normalCE(in []int) (ce uint32, err error) {
- return makeCE(rawCE{w: in[:3], ccc: uint8(in[3])})
-}
-
-func expandCE(in []int) (ce uint32, err error) {
- return makeExpandIndex(in[0])
-}
-
-func contractCE(in []int) (ce uint32, err error) {
- return makeContractIndex(ctHandle{in[0], in[1]}, in[2])
-}
-
-func decompCE(in []int) (ce uint32, err error) {
- return makeDecompose(in[0], in[1])
-}
-
-var ceTests = []ceTest{
- {normalCE, []int{0, 0, 0, 0}, 0xA0000000},
- {normalCE, []int{0, 0x28, 3, 0}, 0xA0002803},
- {normalCE, []int{0, 0x28, 3, 0xFF}, 0xAFF02803},
- {normalCE, []int{100, defaultSecondary, 3, 0}, 0x0000C883},
- // non-ignorable primary with non-default secondary
- {normalCE, []int{100, 0x28, defaultTertiary, 0}, 0x4000C828},
- {normalCE, []int{100, defaultSecondary + 8, 3, 0}, 0x0000C983},
- {normalCE, []int{100, 0, 3, 0}, 0xFFFF}, // non-ignorable primary with non-supported secondary
- {normalCE, []int{100, 1, 3, 0}, 0xFFFF},
- {normalCE, []int{1 << maxPrimaryBits, defaultSecondary, 0, 0}, 0xFFFF},
- {normalCE, []int{0, 1 << maxSecondaryBits, 0, 0}, 0xFFFF},
- {normalCE, []int{100, defaultSecondary, 1 << maxTertiaryBits, 0}, 0xFFFF},
- {normalCE, []int{0x123, defaultSecondary, 8, 0xFF}, 0x88FF0123},
- {normalCE, []int{0x123, defaultSecondary + 1, 8, 0xFF}, 0xFFFF},
-
- {contractCE, []int{0, 0, 0}, 0xC0000000},
- {contractCE, []int{1, 1, 1}, 0xC0010011},
- {contractCE, []int{1, (1 << maxNBits) - 1, 1}, 0xC001001F},
- {contractCE, []int{(1 << maxTrieIndexBits) - 1, 1, 1}, 0xC001FFF1},
- {contractCE, []int{1, 1, (1 << maxContractOffsetBits) - 1}, 0xDFFF0011},
- {contractCE, []int{1, (1 << maxNBits), 1}, 0xFFFF},
- {contractCE, []int{(1 << maxTrieIndexBits), 1, 1}, 0xFFFF},
- {contractCE, []int{1, (1 << maxContractOffsetBits), 1}, 0xFFFF},
-
- {expandCE, []int{0}, 0xE0000000},
- {expandCE, []int{5}, 0xE0000005},
- {expandCE, []int{(1 << maxExpandIndexBits) - 1}, 0xE000FFFF},
- {expandCE, []int{1 << maxExpandIndexBits}, 0xFFFF},
-
- {decompCE, []int{0, 0}, 0xF0000000},
- {decompCE, []int{1, 1}, 0xF0000101},
- {decompCE, []int{0x1F, 0x1F}, 0xF0001F1F},
- {decompCE, []int{256, 0x1F}, 0xFFFF},
- {decompCE, []int{0x1F, 256}, 0xFFFF},
-}
-
-func TestColElem(t *testing.T) {
- for i, tt := range ceTests {
- in := make([]int, len(tt.arg))
- copy(in, tt.arg)
- ce, err := tt.f(in)
- if tt.val == 0xFFFF {
- if err == nil {
- t.Errorf("%d: expected error for args %x", i, tt.arg)
- }
- continue
- }
- if err != nil {
- t.Errorf("%d: unexpected error: %v", i, err.Error())
- }
- if ce != tt.val {
- t.Errorf("%d: colElem=%X; want %X", i, ce, tt.val)
- }
- }
-}
-
-func mkRawCES(in [][]int) []rawCE {
- out := []rawCE{}
- for _, w := range in {
- out = append(out, rawCE{w: w})
- }
- return out
-}
-
-type weightsTest struct {
- a, b [][]int
- level colltab.Level
- result int
-}
-
-var nextWeightTests = []weightsTest{
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{101, defaultSecondary, defaultTertiary, 0}},
- level: colltab.Primary,
- },
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{100, 21, defaultTertiary, 0}},
- level: colltab.Secondary,
- },
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{100, 20, 6, 0}},
- level: colltab.Tertiary,
- },
- {
- a: [][]int{{100, 20, 5, 0}},
- b: [][]int{{100, 20, 5, 0}},
- level: colltab.Identity,
- },
-}
-
-var extra = [][]int{{200, 32, 8, 0}, {0, 32, 8, 0}, {0, 0, 8, 0}, {0, 0, 0, 0}}
-
-func TestNextWeight(t *testing.T) {
- for i, tt := range nextWeightTests {
- test := func(l colltab.Level, tt weightsTest, a, gold [][]int) {
- res := nextWeight(tt.level, mkRawCES(a))
- if !equalCEArrays(mkRawCES(gold), res) {
- t.Errorf("%d:%d: expected weights %d; found %d", i, l, gold, res)
- }
- }
- test(-1, tt, tt.a, tt.b)
- for l := colltab.Primary; l <= colltab.Tertiary; l++ {
- if tt.level <= l {
- test(l, tt, append(tt.a, extra[l]), tt.b)
- } else {
- test(l, tt, append(tt.a, extra[l]), append(tt.b, extra[l]))
- }
- }
- }
-}
-
-var compareTests = []weightsTest{
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{100, 20, 5, 0}},
- colltab.Identity,
- 0,
- },
- {
- [][]int{{100, 20, 5, 0}, extra[0]},
- [][]int{{100, 20, 5, 1}},
- colltab.Primary,
- 1,
- },
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{101, 20, 5, 0}},
- colltab.Primary,
- -1,
- },
- {
- [][]int{{101, 20, 5, 0}},
- [][]int{{100, 20, 5, 0}},
- colltab.Primary,
- 1,
- },
- {
- [][]int{{100, 0, 0, 0}, {0, 20, 5, 0}},
- [][]int{{0, 20, 5, 0}, {100, 0, 0, 0}},
- colltab.Identity,
- 0,
- },
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{100, 21, 5, 0}},
- colltab.Secondary,
- -1,
- },
- {
- [][]int{{100, 20, 5, 0}},
- [][]int{{100, 20, 2, 0}},
- colltab.Tertiary,
- 1,
- },
- {
- [][]int{{100, 20, 5, 1}},
- [][]int{{100, 20, 5, 2}},
- colltab.Quaternary,
- -1,
- },
-}
-
-func TestCompareWeights(t *testing.T) {
- for i, tt := range compareTests {
- test := func(tt weightsTest, a, b [][]int) {
- res, level := compareWeights(mkRawCES(a), mkRawCES(b))
- if res != tt.result {
- t.Errorf("%d: expected comparison result %d; found %d", i, tt.result, res)
- }
- if level != tt.level {
- t.Errorf("%d: expected level %d; found %d", i, tt.level, level)
- }
- }
- test(tt, tt.a, tt.b)
- test(tt, append(tt.a, extra[0]), append(tt.b, extra[0]))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/contract_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/contract_test.go
deleted file mode 100644
index 2e0eaecd512..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/contract_test.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "bytes"
- "sort"
- "testing"
-
- "golang.org/x/text/internal/colltab"
-)
-
-var largetosmall = []stridx{
- {"a", 5},
- {"ab", 4},
- {"abc", 3},
- {"abcd", 2},
- {"abcde", 1},
- {"abcdef", 0},
-}
-
-var offsetSortTests = [][]stridx{
- {
- {"bcde", 1},
- {"bc", 5},
- {"ab", 4},
- {"bcd", 3},
- {"abcd", 0},
- {"abc", 2},
- },
- largetosmall,
-}
-
-func TestOffsetSort(t *testing.T) {
- for i, st := range offsetSortTests {
- sort.Sort(offsetSort(st))
- for j, si := range st {
- if j != si.index {
- t.Errorf("%d: failed: %v", i, st)
- }
- }
- }
- for i, tt := range genStateTests {
- // ensure input is well-formed
- sort.Sort(offsetSort(tt.in))
- for j, si := range tt.in {
- if si.index != j+1 {
- t.Errorf("%dth sort failed: %v", i, tt.in)
- }
- }
- }
-}
-
-var genidxtest1 = []stridx{
- {"bcde", 3},
- {"bc", 6},
- {"ab", 2},
- {"bcd", 5},
- {"abcd", 0},
- {"abc", 1},
- {"bcdf", 4},
-}
-
-var genidxSortTests = [][]stridx{
- genidxtest1,
- largetosmall,
-}
-
-func TestGenIdxSort(t *testing.T) {
- for i, st := range genidxSortTests {
- sort.Sort(genidxSort(st))
- for j, si := range st {
- if j != si.index {
- t.Errorf("%dth sort failed %v", i, st)
- break
- }
- }
- }
-}
-
-var entrySortTests = []colltab.ContractTrieSet{
- {
- {10, 0, 1, 3},
- {99, 0, 1, 0},
- {20, 50, 0, 2},
- {30, 0, 1, 1},
- },
-}
-
-func TestEntrySort(t *testing.T) {
- for i, et := range entrySortTests {
- sort.Sort(entrySort(et))
- for j, fe := range et {
- if j != int(fe.I) {
- t.Errorf("%dth sort failed %v", i, et)
- break
- }
- }
- }
-}
-
-type GenStateTest struct {
- in []stridx
- firstBlockLen int
- out colltab.ContractTrieSet
-}
-
-var genStateTests = []GenStateTest{
- {[]stridx{
- {"abc", 1},
- },
- 1,
- colltab.ContractTrieSet{
- {'a', 0, 1, noIndex},
- {'b', 0, 1, noIndex},
- {'c', 'c', final, 1},
- },
- },
- {[]stridx{
- {"abc", 1},
- {"abd", 2},
- {"abe", 3},
- },
- 1,
- colltab.ContractTrieSet{
- {'a', 0, 1, noIndex},
- {'b', 0, 1, noIndex},
- {'c', 'e', final, 1},
- },
- },
- {[]stridx{
- {"abc", 1},
- {"ab", 2},
- {"a", 3},
- },
- 1,
- colltab.ContractTrieSet{
- {'a', 0, 1, 3},
- {'b', 0, 1, 2},
- {'c', 'c', final, 1},
- },
- },
- {[]stridx{
- {"abc", 1},
- {"abd", 2},
- {"ab", 3},
- {"ac", 4},
- {"a", 5},
- {"b", 6},
- },
- 2,
- colltab.ContractTrieSet{
- {'b', 'b', final, 6},
- {'a', 0, 2, 5},
- {'c', 'c', final, 4},
- {'b', 0, 1, 3},
- {'c', 'd', final, 1},
- },
- },
- {[]stridx{
- {"bcde", 2},
- {"bc", 7},
- {"ab", 6},
- {"bcd", 5},
- {"abcd", 1},
- {"abc", 4},
- {"bcdf", 3},
- },
- 2,
- colltab.ContractTrieSet{
- {'b', 3, 1, noIndex},
- {'a', 0, 1, noIndex},
- {'b', 0, 1, 6},
- {'c', 0, 1, 4},
- {'d', 'd', final, 1},
- {'c', 0, 1, 7},
- {'d', 0, 1, 5},
- {'e', 'f', final, 2},
- },
- },
-}
-
-func TestGenStates(t *testing.T) {
- for i, tt := range genStateTests {
- si := []stridx{}
- for _, e := range tt.in {
- si = append(si, e)
- }
- // ensure input is well-formed
- sort.Sort(genidxSort(si))
- ct := colltab.ContractTrieSet{}
- n, _ := genStates(&ct, si)
- if nn := tt.firstBlockLen; nn != n {
- t.Errorf("%d: block len %v; want %v", i, n, nn)
- }
- if lv, lw := len(ct), len(tt.out); lv != lw {
- t.Errorf("%d: len %v; want %v", i, lv, lw)
- continue
- }
- for j, fe := range tt.out {
- const msg = "%d:%d: value %s=%v; want %v"
- if fe.L != ct[j].L {
- t.Errorf(msg, i, j, "l", ct[j].L, fe.L)
- }
- if fe.H != ct[j].H {
- t.Errorf(msg, i, j, "h", ct[j].H, fe.H)
- }
- if fe.N != ct[j].N {
- t.Errorf(msg, i, j, "n", ct[j].N, fe.N)
- }
- if fe.I != ct[j].I {
- t.Errorf(msg, i, j, "i", ct[j].I, fe.I)
- }
- }
- }
-}
-
-func TestLookupContraction(t *testing.T) {
- for i, tt := range genStateTests {
- input := []string{}
- for _, e := range tt.in {
- input = append(input, e.str)
- }
- cts := colltab.ContractTrieSet{}
- h, _ := appendTrie(&cts, input)
- for j, si := range tt.in {
- str := si.str
- for _, s := range []string{str, str + "X"} {
- msg := "%d:%d: %s(%s) %v; want %v"
- idx, sn := lookup(&cts, h, []byte(s))
- if idx != si.index {
- t.Errorf(msg, i, j, "index", s, idx, si.index)
- }
- if sn != len(str) {
- t.Errorf(msg, i, j, "sn", s, sn, len(str))
- }
- }
- }
- }
-}
-
-func TestPrintContractionTrieSet(t *testing.T) {
- testdata := colltab.ContractTrieSet(genStateTests[4].out)
- buf := &bytes.Buffer{}
- print(&testdata, buf, "test")
- if contractTrieOutput != buf.String() {
- t.Errorf("output differs; found\n%s", buf.String())
- println(string(buf.Bytes()))
- }
-}
-
-const contractTrieOutput = `// testCTEntries: 8 entries, 32 bytes
-var testCTEntries = [8]struct{L,H,N,I uint8}{
- {0x62, 0x3, 1, 255},
- {0x61, 0x0, 1, 255},
- {0x62, 0x0, 1, 6},
- {0x63, 0x0, 1, 4},
- {0x64, 0x64, 0, 1},
- {0x63, 0x0, 1, 7},
- {0x64, 0x0, 1, 5},
- {0x65, 0x66, 0, 2},
-}
-var testContractTrieSet = colltab.ContractTrieSet( testCTEntries[:] )
-`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/order_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/order_test.go
deleted file mode 100644
index 0e174bfbd4a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/order_test.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "strconv"
- "testing"
-
- "golang.org/x/text/internal/colltab"
-)
-
-type entryTest struct {
- f func(in []int) (uint32, error)
- arg []int
- val uint32
-}
-
-// makeList returns a list of entries of length n+2, with n normal
-// entries plus a leading and trailing anchor.
-func makeList(n int) []*entry {
- es := make([]*entry, n+2)
- weights := []rawCE{{w: []int{100, 20, 5, 0}}}
- for i := range es {
- runes := []rune{rune(i)}
- es[i] = &entry{
- runes: runes,
- elems: weights,
- }
- weights = nextWeight(colltab.Primary, weights)
- }
- for i := 1; i < len(es); i++ {
- es[i-1].next = es[i]
- es[i].prev = es[i-1]
- _, es[i-1].level = compareWeights(es[i-1].elems, es[i].elems)
- }
- es[0].exclude = true
- es[0].logical = firstAnchor
- es[len(es)-1].exclude = true
- es[len(es)-1].logical = lastAnchor
- return es
-}
-
-func TestNextIndexed(t *testing.T) {
- const n = 5
- es := makeList(n)
- for i := int64(0); i < 1<<n; i++ {
- mask := strconv.FormatInt(i+(1<<n), 2)
- for i, c := range mask {
- es[i].exclude = c == '1'
- }
- e := es[0]
- for i, c := range mask {
- if c == '0' {
- e, _ = e.nextIndexed()
- if e != es[i] {
- t.Errorf("%d: expected entry %d; found %d", i, es[i].elems, e.elems)
- }
- }
- }
- if e, _ = e.nextIndexed(); e != nil {
- t.Errorf("%d: expected nil entry; found %d", i, e.elems)
- }
- }
-}
-
-func TestRemove(t *testing.T) {
- const n = 5
- for i := int64(0); i < 1<<n; i++ {
- es := makeList(n)
- mask := strconv.FormatInt(i+(1<<n), 2)
- for i, c := range mask {
- if c == '0' {
- es[i].remove()
- }
- }
- e := es[0]
- for i, c := range mask {
- if c == '1' {
- if e != es[i] {
- t.Errorf("%d: expected entry %d; found %d", i, es[i].elems, e.elems)
- }
- e, _ = e.nextIndexed()
- }
- }
- if e != nil {
- t.Errorf("%d: expected nil entry; found %d", i, e.elems)
- }
- }
-}
-
-// nextPerm generates the next permutation of the array. The starting
-// permutation is assumed to be a list of integers sorted in increasing order.
-// It returns false if there are no more permuations left.
-func nextPerm(a []int) bool {
- i := len(a) - 2
- for ; i >= 0; i-- {
- if a[i] < a[i+1] {
- break
- }
- }
- if i < 0 {
- return false
- }
- for j := len(a) - 1; j >= i; j-- {
- if a[j] > a[i] {
- a[i], a[j] = a[j], a[i]
- break
- }
- }
- for j := i + 1; j < (len(a)+i+1)/2; j++ {
- a[j], a[len(a)+i-j] = a[len(a)+i-j], a[j]
- }
- return true
-}
-
-func TestInsertAfter(t *testing.T) {
- const n = 5
- orig := makeList(n)
- perm := make([]int, n)
- for i := range perm {
- perm[i] = i + 1
- }
- for ok := true; ok; ok = nextPerm(perm) {
- es := makeList(n)
- last := es[0]
- for _, i := range perm {
- last.insertAfter(es[i])
- last = es[i]
- }
- for _, e := range es {
- e.elems = es[0].elems
- }
- e := es[0]
- for _, i := range perm {
- e, _ = e.nextIndexed()
- if e.runes[0] != orig[i].runes[0] {
- t.Errorf("%d:%d: expected entry %X; found %X", perm, i, orig[i].runes, e.runes)
- break
- }
- }
- }
-}
-
-func TestInsertBefore(t *testing.T) {
- const n = 5
- orig := makeList(n)
- perm := make([]int, n)
- for i := range perm {
- perm[i] = i + 1
- }
- for ok := true; ok; ok = nextPerm(perm) {
- es := makeList(n)
- last := es[len(es)-1]
- for _, i := range perm {
- last.insertBefore(es[i])
- last = es[i]
- }
- for _, e := range es {
- e.elems = es[0].elems
- }
- e := es[0]
- for i := n - 1; i >= 0; i-- {
- e, _ = e.nextIndexed()
- if e.runes[0] != rune(perm[i]) {
- t.Errorf("%d:%d: expected entry %X; found %X", perm, i, orig[i].runes, e.runes)
- break
- }
- }
- }
-}
-
-type entryLessTest struct {
- a, b *entry
- res bool
-}
-
-var (
- w1 = []rawCE{{w: []int{100, 20, 5, 5}}}
- w2 = []rawCE{{w: []int{101, 20, 5, 5}}}
-)
-
-var entryLessTests = []entryLessTest{
- {&entry{str: "a", elems: w1},
- &entry{str: "a", elems: w1},
- false,
- },
- {&entry{str: "a", elems: w1},
- &entry{str: "a", elems: w2},
- true,
- },
- {&entry{str: "a", elems: w1},
- &entry{str: "b", elems: w1},
- true,
- },
- {&entry{str: "a", elems: w2},
- &entry{str: "a", elems: w1},
- false,
- },
- {&entry{str: "c", elems: w1},
- &entry{str: "b", elems: w1},
- false,
- },
- {&entry{str: "a", elems: w1, logical: firstAnchor},
- &entry{str: "a", elems: w1},
- true,
- },
- {&entry{str: "a", elems: w1},
- &entry{str: "b", elems: w1, logical: firstAnchor},
- false,
- },
- {&entry{str: "b", elems: w1},
- &entry{str: "a", elems: w1, logical: lastAnchor},
- true,
- },
- {&entry{str: "a", elems: w1, logical: lastAnchor},
- &entry{str: "c", elems: w1},
- false,
- },
-}
-
-func TestEntryLess(t *testing.T) {
- for i, tt := range entryLessTests {
- if res := entryLess(tt.a, tt.b); res != tt.res {
- t.Errorf("%d: was %v; want %v", i, res, tt.res)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/trie_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/trie_test.go
deleted file mode 100644
index 4d4f6e4d140..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/build/trie_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package build
-
-import (
- "bytes"
- "fmt"
- "testing"
-)
-
-// We take the smallest, largest and an arbitrary value for each
-// of the UTF-8 sequence lengths.
-var testRunes = []rune{
- 0x01, 0x0C, 0x7F, // 1-byte sequences
- 0x80, 0x100, 0x7FF, // 2-byte sequences
- 0x800, 0x999, 0xFFFF, // 3-byte sequences
- 0x10000, 0x10101, 0x10FFFF, // 4-byte sequences
- 0x200, 0x201, 0x202, 0x210, 0x215, // five entries in one sparse block
-}
-
-func makeTestTrie(t *testing.T) trie {
- n := newNode()
- for i, r := range testRunes {
- n.insert(r, uint32(i))
- }
- idx := newTrieBuilder()
- idx.addTrie(n)
- tr, err := idx.generate()
- if err != nil {
- t.Errorf(err.Error())
- }
- return *tr
-}
-
-func TestGenerateTrie(t *testing.T) {
- testdata := makeTestTrie(t)
- buf := &bytes.Buffer{}
- testdata.printArrays(buf, "test")
- fmt.Fprintf(buf, "var testTrie = ")
- testdata.printStruct(buf, &trieHandle{19, 0}, "test")
- if output != buf.String() {
- t.Error("output differs")
- }
-}
-
-var output = `// testValues: 832 entries, 3328 bytes
-// Block 2 is the null block.
-var testValues = [832]uint32 {
- // Block 0x0, offset 0x0
- 0x000c:0x00000001,
- // Block 0x1, offset 0x40
- 0x007f:0x00000002,
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0x00c0:0x00000003,
- // Block 0x4, offset 0x100
- 0x0100:0x00000004,
- // Block 0x5, offset 0x140
- 0x0140:0x0000000c, 0x0141:0x0000000d, 0x0142:0x0000000e,
- 0x0150:0x0000000f,
- 0x0155:0x00000010,
- // Block 0x6, offset 0x180
- 0x01bf:0x00000005,
- // Block 0x7, offset 0x1c0
- 0x01c0:0x00000006,
- // Block 0x8, offset 0x200
- 0x0219:0x00000007,
- // Block 0x9, offset 0x240
- 0x027f:0x00000008,
- // Block 0xa, offset 0x280
- 0x0280:0x00000009,
- // Block 0xb, offset 0x2c0
- 0x02c1:0x0000000a,
- // Block 0xc, offset 0x300
- 0x033f:0x0000000b,
-}
-
-// testLookup: 640 entries, 1280 bytes
-// Block 0 is the null block.
-var testLookup = [640]uint16 {
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0x0e0:0x05, 0x0e6:0x06,
- // Block 0x4, offset 0x100
- 0x13f:0x07,
- // Block 0x5, offset 0x140
- 0x140:0x08, 0x144:0x09,
- // Block 0x6, offset 0x180
- 0x190:0x03,
- // Block 0x7, offset 0x1c0
- 0x1ff:0x0a,
- // Block 0x8, offset 0x200
- 0x20f:0x05,
- // Block 0x9, offset 0x240
- 0x242:0x01, 0x244:0x02,
- 0x248:0x03,
- 0x25f:0x04,
- 0x260:0x01,
- 0x26f:0x02,
- 0x270:0x04, 0x274:0x06,
-}
-
-var testTrie = trie{ testLookup[1216:], testValues[0:], testLookup[:], testValues[:]}`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/collate_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/collate_test.go
deleted file mode 100644
index 0e78b96faef..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/collate_test.go
+++ /dev/null
@@ -1,482 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-import (
- "bytes"
- "testing"
-
- "golang.org/x/text/internal/colltab"
- "golang.org/x/text/language"
-)
-
-type weightsTest struct {
- opt opts
- in, out ColElems
-}
-
-type opts struct {
- lev int
- alt alternateHandling
- top int
-
- backwards bool
- caseLevel bool
-}
-
-// ignore returns an initialized boolean array based on the given Level.
-// A negative value means using the default setting of quaternary.
-func ignore(level colltab.Level) (ignore [colltab.NumLevels]bool) {
- if level < 0 {
- level = colltab.Quaternary
- }
- for i := range ignore {
- ignore[i] = level < colltab.Level(i)
- }
- return ignore
-}
-
-func makeCE(w []int) colltab.Elem {
- ce, err := colltab.MakeElem(w[0], w[1], w[2], uint8(w[3]))
- if err != nil {
- panic(err)
- }
- return ce
-}
-
-func (o opts) collator() *Collator {
- c := &Collator{
- options: options{
- ignore: ignore(colltab.Level(o.lev - 1)),
- alternate: o.alt,
- backwards: o.backwards,
- caseLevel: o.caseLevel,
- variableTop: uint32(o.top),
- },
- }
- return c
-}
-
-const (
- maxQ = 0x1FFFFF
-)
-
-func wpq(p, q int) Weights {
- return W(p, defaults.Secondary, defaults.Tertiary, q)
-}
-
-func wsq(s, q int) Weights {
- return W(0, s, defaults.Tertiary, q)
-}
-
-func wq(q int) Weights {
- return W(0, 0, 0, q)
-}
-
-var zero = W(0, 0, 0, 0)
-
-var processTests = []weightsTest{
- // Shifted
- { // simple sequence of non-variables
- opt: opts{alt: altShifted, top: 100},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wpq(200, maxQ), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // first is a variable
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wq(200), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // all but first are variable
- opt: opts{alt: altShifted, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{wpq(1000, maxQ), wq(200), wq(300), wq(400)},
- },
- { // first is a modifier
- opt: opts{alt: altShifted, top: 999},
- in: ColElems{W(0, 10), W(1000)},
- out: ColElems{wsq(10, maxQ), wpq(1000, maxQ)},
- },
- { // primary ignorables
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), wsq(15, maxQ), wpq(400, maxQ)},
- },
- { // secondary ignorables
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), W(0, 0, 15, maxQ), wpq(400, maxQ)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altShifted, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), zero, wpq(400, maxQ)},
- },
-
- // ShiftTrimmed (same as Shifted)
- { // simple sequence of non-variables
- opt: opts{alt: altShiftTrimmed, top: 100},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wpq(200, maxQ), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // first is a variable
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{wq(200), wpq(300, maxQ), wpq(400, maxQ)},
- },
- { // all but first are variable
- opt: opts{alt: altShiftTrimmed, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{wpq(1000, maxQ), wq(200), wq(300), wq(400)},
- },
- { // first is a modifier
- opt: opts{alt: altShiftTrimmed, top: 999},
- in: ColElems{W(0, 10), W(1000)},
- out: ColElems{wsq(10, maxQ), wpq(1000, maxQ)},
- },
- { // primary ignorables
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), wsq(15, maxQ), wpq(400, maxQ)},
- },
- { // secondary ignorables
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), W(0, 0, 15, maxQ), wpq(400, maxQ)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altShiftTrimmed, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{wq(200), zero, wpq(300, maxQ), zero, wpq(400, maxQ)},
- },
-
- // Blanked
- { // simple sequence of non-variables
- opt: opts{alt: altBlanked, top: 100},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{W(200), W(300), W(400)},
- },
- { // first is a variable
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), W(300), W(400)},
- out: ColElems{zero, W(300), W(400)},
- },
- { // all but first are variable
- opt: opts{alt: altBlanked, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{W(1000), zero, zero, zero},
- },
- { // first is a modifier
- opt: opts{alt: altBlanked, top: 999},
- in: ColElems{W(0, 10), W(1000)},
- out: ColElems{W(0, 10), W(1000)},
- },
- { // primary ignorables
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{zero, zero, W(300), W(0, 15), W(400)},
- },
- { // secondary ignorables
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{zero, zero, W(300), W(0, 0, 15), W(400)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altBlanked, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{zero, zero, W(300), zero, W(400)},
- },
-
- // Non-ignorable: input is always equal to output.
- { // all but first are variable
- opt: opts{alt: altNonIgnorable, top: 999},
- in: ColElems{W(1000), W(200), W(300), W(400)},
- out: ColElems{W(1000), W(200), W(300), W(400)},
- },
- { // primary ignorables
- opt: opts{alt: altNonIgnorable, top: 250},
- in: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- out: ColElems{W(200), W(0, 10), W(300), W(0, 15), W(400)},
- },
- { // secondary ignorables
- opt: opts{alt: altNonIgnorable, top: 250},
- in: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- out: ColElems{W(200), W(0, 0, 10), W(300), W(0, 0, 15), W(400)},
- },
- { // tertiary ignorables, no change
- opt: opts{alt: altNonIgnorable, top: 250},
- in: ColElems{W(200), zero, W(300), zero, W(400)},
- out: ColElems{W(200), zero, W(300), zero, W(400)},
- },
-}
-
-func TestProcessWeights(t *testing.T) {
- for i, tt := range processTests {
- in := convertFromWeights(tt.in)
- out := convertFromWeights(tt.out)
- processWeights(tt.opt.alt, uint32(tt.opt.top), in)
- for j, w := range in {
- if w != out[j] {
- t.Errorf("%d: Weights %d was %v; want %v", i, j, w, out[j])
- }
- }
- }
-}
-
-type keyFromElemTest struct {
- opt opts
- in ColElems
- out []byte
-}
-
-var defS = byte(defaults.Secondary)
-var defT = byte(defaults.Tertiary)
-
-const sep = 0 // separator byte
-
-var keyFromElemTests = []keyFromElemTest{
- { // simple primary and secondary weights.
- opts{alt: altShifted},
- ColElems{W(0x200), W(0x7FFF), W(0, 0x30), W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, but with zero element that need to be removed
- opts{alt: altShifted},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, with large primary values
- opts{alt: altShifted},
- ColElems{W(0x200), W(0x8000), W(0, 0x30), W(0x12345)},
- []byte{0x2, 0, 0x80, 0x80, 0x00, 0x81, 0x23, 0x45, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, but with the secondary level backwards
- opts{alt: altShifted, backwards: true},
- ColElems{W(0x200), W(0x7FFF), W(0, 0x30), W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, 0x30, 0, defS, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0xFF, 0xFF, 0xFF, // quaternary
- },
- },
- { // same as first, ignoring quaternary level
- opts{alt: altShifted, lev: 3},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- },
- },
- { // same as first, ignoring tertiary level
- opts{alt: altShifted, lev: 2},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- },
- },
- { // same as first, ignoring secondary level
- opts{alt: altShifted, lev: 1},
- ColElems{W(0x200), zero, W(0x7FFF), W(0, 0x30), zero, W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00},
- },
- { // simple primary and secondary weights.
- opts{alt: altShiftTrimmed, top: 0x250},
- ColElems{W(0x300), W(0x200), W(0x7FFF), W(0, 0x30), W(0x800)},
- []byte{0x3, 0, 0x7F, 0xFF, 0x8, 0x00, // primary
- sep, sep, 0, defS, 0, defS, 0, 0x30, 0, defS, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- sep, 0xFF, 0x2, 0, // quaternary
- },
- },
- { // as first, primary with case level enabled
- opts{alt: altShifted, lev: 1, caseLevel: true},
- ColElems{W(0x200), W(0x7FFF), W(0, 0x30), W(0x100)},
- []byte{0x2, 0, 0x7F, 0xFF, 0x1, 0x00, // primary
- sep, sep, // secondary
- sep, sep, defT, defT, defT, defT, // tertiary
- },
- },
-}
-
-func TestKeyFromElems(t *testing.T) {
- buf := Buffer{}
- for i, tt := range keyFromElemTests {
- buf.Reset()
- in := convertFromWeights(tt.in)
- processWeights(tt.opt.alt, uint32(tt.opt.top), in)
- tt.opt.collator().keyFromElems(&buf, in)
- res := buf.key
- if len(res) != len(tt.out) {
- t.Errorf("%d: len(ws) was %d; want %d (%X should be %X)", i, len(res), len(tt.out), res, tt.out)
- }
- n := len(res)
- if len(tt.out) < n {
- n = len(tt.out)
- }
- for j, c := range res[:n] {
- if c != tt.out[j] {
- t.Errorf("%d: byte %d was %X; want %X", i, j, c, tt.out[j])
- }
- }
- }
-}
-
-func TestGetColElems(t *testing.T) {
- for i, tt := range appendNextTests {
- c, err := makeTable(tt.in)
- if err != nil {
- // error is reported in TestAppendNext
- continue
- }
- // Create one large test per table
- str := make([]byte, 0, 4000)
- out := ColElems{}
- for len(str) < 3000 {
- for _, chk := range tt.chk {
- str = append(str, chk.in[:chk.n]...)
- out = append(out, chk.out...)
- }
- }
- for j, chk := range append(tt.chk, check{string(str), len(str), out}) {
- out := convertFromWeights(chk.out)
- ce := c.getColElems([]byte(chk.in)[:chk.n])
- if len(ce) != len(out) {
- t.Errorf("%d:%d: len(ws) was %d; want %d", i, j, len(ce), len(out))
- continue
- }
- cnt := 0
- for k, w := range ce {
- w, _ = colltab.MakeElem(w.Primary(), w.Secondary(), int(w.Tertiary()), 0)
- if w != out[k] {
- t.Errorf("%d:%d: Weights %d was %X; want %X", i, j, k, w, out[k])
- cnt++
- }
- if cnt > 10 {
- break
- }
- }
- }
- }
-}
-
-type keyTest struct {
- in string
- out []byte
-}
-
-var keyTests = []keyTest{
- {"abc",
- []byte{0, 100, 0, 200, 1, 44, 0, 0, 0, 32, 0, 32, 0, 32, 0, 0, 2, 2, 2, 0, 255, 255, 255},
- },
- {"a\u0301",
- []byte{0, 102, 0, 0, 0, 32, 0, 0, 2, 0, 255},
- },
- {"aaaaa",
- []byte{0, 100, 0, 100, 0, 100, 0, 100, 0, 100, 0, 0,
- 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 0,
- 2, 2, 2, 2, 2, 0,
- 255, 255, 255, 255, 255,
- },
- },
- // Issue 16391: incomplete rune at end of UTF-8 sequence.
- {"\xc2", []byte{133, 255, 253, 0, 0, 0, 32, 0, 0, 2, 0, 255}},
- {"\xc2a", []byte{133, 255, 253, 0, 100, 0, 0, 0, 32, 0, 32, 0, 0, 2, 2, 0, 255, 255}},
-}
-
-func TestKey(t *testing.T) {
- c, _ := makeTable(appendNextTests[4].in)
- c.alternate = altShifted
- c.ignore = ignore(colltab.Quaternary)
- buf := Buffer{}
- keys1 := [][]byte{}
- keys2 := [][]byte{}
- for _, tt := range keyTests {
- keys1 = append(keys1, c.Key(&buf, []byte(tt.in)))
- keys2 = append(keys2, c.KeyFromString(&buf, tt.in))
- }
- // Separate generation from testing to ensure buffers are not overwritten.
- for i, tt := range keyTests {
- if !bytes.Equal(keys1[i], tt.out) {
- t.Errorf("%d: Key(%q) = %d; want %d", i, tt.in, keys1[i], tt.out)
- }
- if !bytes.Equal(keys2[i], tt.out) {
- t.Errorf("%d: KeyFromString(%q) = %d; want %d", i, tt.in, keys2[i], tt.out)
- }
- }
-}
-
-type compareTest struct {
- a, b string
- res int // comparison result
-}
-
-var compareTests = []compareTest{
- {"a\u0301", "a", 1},
- {"a\u0301b", "ab", 1},
- {"a", "a\u0301", -1},
- {"ab", "a\u0301b", -1},
- {"bc", "a\u0301c", 1},
- {"ab", "aB", -1},
- {"a\u0301", "a\u0301", 0},
- {"a", "a", 0},
- // Only clip prefixes of whole runes.
- {"\u302E", "\u302F", 1},
- // Don't clip prefixes when last rune of prefix may be part of contraction.
- {"a\u035E", "a\u0301\u035F", -1},
- {"a\u0301\u035Fb", "a\u0301\u035F", -1},
-}
-
-func TestCompare(t *testing.T) {
- c, _ := makeTable(appendNextTests[4].in)
- for i, tt := range compareTests {
- if res := c.Compare([]byte(tt.a), []byte(tt.b)); res != tt.res {
- t.Errorf("%d: Compare(%q, %q) == %d; want %d", i, tt.a, tt.b, res, tt.res)
- }
- if res := c.CompareString(tt.a, tt.b); res != tt.res {
- t.Errorf("%d: CompareString(%q, %q) == %d; want %d", i, tt.a, tt.b, res, tt.res)
- }
- }
-}
-
-func TestNumeric(t *testing.T) {
- c := New(language.English, Loose, Numeric)
-
- for i, tt := range []struct {
- a, b string
- want int
- }{
- {"1", "2", -1},
- {"2", "12", -1},
- {"2", "12", -1}, // Fullwidth is sorted as usual.
- {"₂", "₁₂", 1}, // Subscript is not sorted as numbers.
- {"②", "①②", 1}, // Circled is not sorted as numbers.
- { // Imperial Aramaic, is not sorted as number.
- "\U00010859",
- "\U00010858\U00010859",
- 1,
- },
- {"12", "2", 1},
- {"A-1", "A-2", -1},
- {"A-2", "A-12", -1},
- {"A-12", "A-2", 1},
- {"A-0001", "A-1", 0},
- } {
- if got := c.CompareString(tt.a, tt.b); got != tt.want {
- t.Errorf("%d: CompareString(%s, %s) = %d; want %d", i, tt.a, tt.b, got, tt.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/export_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/export_test.go
deleted file mode 100644
index 69bfeaf1ace..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/export_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-// Export for testing.
-// TODO: no longer necessary. Remove at some point.
-
-import (
- "fmt"
-
- "golang.org/x/text/internal/colltab"
-)
-
-const (
- defaultSecondary = 0x20
- defaultTertiary = 0x2
-)
-
-type Weights struct {
- Primary, Secondary, Tertiary, Quaternary int
-}
-
-func W(ce ...int) Weights {
- w := Weights{ce[0], defaultSecondary, defaultTertiary, 0}
- if len(ce) > 1 {
- w.Secondary = ce[1]
- }
- if len(ce) > 2 {
- w.Tertiary = ce[2]
- }
- if len(ce) > 3 {
- w.Quaternary = ce[3]
- }
- return w
-}
-func (w Weights) String() string {
- return fmt.Sprintf("[%X.%X.%X.%X]", w.Primary, w.Secondary, w.Tertiary, w.Quaternary)
-}
-
-func convertFromWeights(ws []Weights) []colltab.Elem {
- out := make([]colltab.Elem, len(ws))
- for i, w := range ws {
- out[i], _ = colltab.MakeElem(w.Primary, w.Secondary, w.Tertiary, 0)
- if out[i] == colltab.Ignore && w.Quaternary > 0 {
- out[i] = colltab.MakeQuaternary(w.Quaternary)
- }
- }
- return out
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/option_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/option_test.go
deleted file mode 100644
index 0f6ba9bc811..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/option_test.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-package collate
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/colltab"
- "golang.org/x/text/language"
-)
-
-var (
- defaultIgnore = ignore(colltab.Tertiary)
- defaultTable = getTable(locales[0])
-)
-
-func TestOptions(t *testing.T) {
- for i, tt := range []struct {
- in []Option
- out options
- }{
- 0: {
- out: options{
- ignore: defaultIgnore,
- },
- },
- 1: {
- in: []Option{IgnoreDiacritics},
- out: options{
- ignore: [colltab.NumLevels]bool{false, true, false, true, true},
- },
- },
- 2: {
- in: []Option{IgnoreCase, IgnoreDiacritics},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 3: {
- in: []Option{ignoreDiacritics, IgnoreWidth},
- out: options{
- ignore: ignore(colltab.Primary),
- caseLevel: true,
- },
- },
- 4: {
- in: []Option{IgnoreWidth, ignoreDiacritics},
- out: options{
- ignore: ignore(colltab.Primary),
- caseLevel: true,
- },
- },
- 5: {
- in: []Option{IgnoreCase, IgnoreWidth},
- out: options{
- ignore: ignore(colltab.Secondary),
- },
- },
- 6: {
- in: []Option{IgnoreCase, IgnoreWidth, Loose},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 7: {
- in: []Option{Force, IgnoreCase, IgnoreWidth, Loose},
- out: options{
- ignore: [colltab.NumLevels]bool{false, true, true, true, false},
- },
- },
- 8: {
- in: []Option{IgnoreDiacritics, IgnoreCase},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 9: {
- in: []Option{Numeric},
- out: options{
- ignore: defaultIgnore,
- numeric: true,
- },
- },
- 10: {
- in: []Option{OptionsFromTag(language.MustParse("und-u-ks-level1"))},
- out: options{
- ignore: ignore(colltab.Primary),
- },
- },
- 11: {
- in: []Option{OptionsFromTag(language.MustParse("und-u-ks-level4"))},
- out: options{
- ignore: ignore(colltab.Quaternary),
- },
- },
- 12: {
- in: []Option{OptionsFromTag(language.MustParse("und-u-ks-identic"))},
- out: options{},
- },
- 13: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-kn-true-kb-true-kc-true")),
- },
- out: options{
- ignore: defaultIgnore,
- caseLevel: true,
- backwards: true,
- numeric: true,
- },
- },
- 14: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-kn-true-kb-true-kc-true")),
- OptionsFromTag(language.MustParse("und-u-kn-false-kb-false-kc-false")),
- },
- out: options{
- ignore: defaultIgnore,
- },
- },
- 15: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-kn-true-kb-true-kc-true")),
- OptionsFromTag(language.MustParse("und-u-kn-foo-kb-foo-kc-foo")),
- },
- out: options{
- ignore: defaultIgnore,
- caseLevel: true,
- backwards: true,
- numeric: true,
- },
- },
- 16: { // Normal options take precedence over tag options.
- in: []Option{
- Numeric, IgnoreCase,
- OptionsFromTag(language.MustParse("und-u-kn-false-kc-true")),
- },
- out: options{
- ignore: ignore(colltab.Secondary),
- caseLevel: false,
- numeric: true,
- },
- },
- 17: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-ka-shifted")),
- },
- out: options{
- ignore: defaultIgnore,
- alternate: altShifted,
- },
- },
- 18: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-ka-blanked")),
- },
- out: options{
- ignore: defaultIgnore,
- alternate: altBlanked,
- },
- },
- 19: {
- in: []Option{
- OptionsFromTag(language.MustParse("und-u-ka-posix")),
- },
- out: options{
- ignore: defaultIgnore,
- alternate: altShiftTrimmed,
- },
- },
- } {
- c := newCollator(defaultTable)
- c.t = nil
- c.variableTop = 0
- c.f = 0
-
- c.setOptions(tt.in)
- if !reflect.DeepEqual(c.options, tt.out) {
- t.Errorf("%d: got %v; want %v", i, c.options, tt.out)
- }
- }
-}
-
-func TestAlternateSortTypes(t *testing.T) {
- testCases := []struct {
- lang string
- in []string
- want []string
- }{{
- lang: "zh,cmn,zh-Hant-u-co-pinyin,zh-HK-u-co-pinyin,zh-pinyin",
- in: []string{"爸爸", "妈妈", "儿子", "女儿"},
- want: []string{"爸爸", "儿子", "妈妈", "女儿"},
- }, {
- lang: "zh-Hant,zh-u-co-stroke,zh-Hant-u-co-stroke",
- in: []string{"爸爸", "妈妈", "儿子", "女儿"},
- want: []string{"儿子", "女儿", "妈妈", "爸爸"},
- }}
- for _, tc := range testCases {
- for _, tag := range strings.Split(tc.lang, ",") {
- got := append([]string{}, tc.in...)
- New(language.MustParse(tag)).SortStrings(got)
- if !reflect.DeepEqual(got, tc.want) {
- t.Errorf("New(%s).SortStrings(%v) = %v; want %v", tag, tc.in, got, tc.want)
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/reg_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/reg_test.go
deleted file mode 100644
index 1ac5fedc8af..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/reg_test.go
+++ /dev/null
@@ -1,230 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-import (
- "archive/zip"
- "bufio"
- "bytes"
- "flag"
- "io"
- "io/ioutil"
- "log"
- "path"
- "regexp"
- "strconv"
- "strings"
- "testing"
- "unicode/utf8"
-
- "golang.org/x/text/collate/build"
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/language"
-)
-
-var long = flag.Bool("long", false,
- "run time-consuming tests, such as tests that fetch data online")
-
-// This regression test runs tests for the test files in CollationTest.zip
-// (taken from http://www.unicode.org/Public/UCA/<gen.UnicodeVersion()>/).
-//
-// The test files have the following form:
-// # header
-// 0009 0021; # ('\u0009') <CHARACTER TABULATION> [| | | 0201 025E]
-// 0009 003F; # ('\u0009') <CHARACTER TABULATION> [| | | 0201 0263]
-// 000A 0021; # ('\u000A') <LINE FEED (LF)> [| | | 0202 025E]
-// 000A 003F; # ('\u000A') <LINE FEED (LF)> [| | | 0202 0263]
-//
-// The part before the semicolon is the hex representation of a sequence
-// of runes. After the hash mark is a comment. The strings
-// represented by rune sequence are in the file in sorted order, as
-// defined by the DUCET.
-
-type Test struct {
- name string
- str [][]byte
- comment []string
-}
-
-var versionRe = regexp.MustCompile(`# UCA Version: (.*)\n?$`)
-var testRe = regexp.MustCompile(`^([\dA-F ]+);.*# (.*)\n?$`)
-
-func TestCollation(t *testing.T) {
- if !gen.IsLocal() && !*long {
- t.Skip("skipping test to prevent downloading; to run use -long or use -local to specify a local source")
- }
- t.Skip("must first update to new file format to support test")
- for _, test := range loadTestData() {
- doTest(t, test)
- }
-}
-
-func Error(e error) {
- if e != nil {
- log.Fatal(e)
- }
-}
-
-// parseUCA parses a Default Unicode Collation Element Table of the format
-// specified in http://www.unicode.org/reports/tr10/#File_Format.
-// It returns the variable top.
-func parseUCA(builder *build.Builder) {
- r := gen.OpenUnicodeFile("UCA", "", "allkeys.txt")
- defer r.Close()
- input := bufio.NewReader(r)
- colelem := regexp.MustCompile(`\[([.*])([0-9A-F.]+)\]`)
- for i := 1; true; i++ {
- l, prefix, err := input.ReadLine()
- if err == io.EOF {
- break
- }
- Error(err)
- line := string(l)
- if prefix {
- log.Fatalf("%d: buffer overflow", i)
- }
- if len(line) == 0 || line[0] == '#' {
- continue
- }
- if line[0] == '@' {
- if strings.HasPrefix(line[1:], "version ") {
- if v := strings.Split(line[1:], " ")[1]; v != gen.UnicodeVersion() {
- log.Fatalf("incompatible version %s; want %s", v, gen.UnicodeVersion())
- }
- }
- } else {
- // parse entries
- part := strings.Split(line, " ; ")
- if len(part) != 2 {
- log.Fatalf("%d: production rule without ';': %v", i, line)
- }
- lhs := []rune{}
- for _, v := range strings.Split(part[0], " ") {
- if v != "" {
- lhs = append(lhs, rune(convHex(i, v)))
- }
- }
- vars := []int{}
- rhs := [][]int{}
- for i, m := range colelem.FindAllStringSubmatch(part[1], -1) {
- if m[1] == "*" {
- vars = append(vars, i)
- }
- elem := []int{}
- for _, h := range strings.Split(m[2], ".") {
- elem = append(elem, convHex(i, h))
- }
- rhs = append(rhs, elem)
- }
- builder.Add(lhs, rhs, vars)
- }
- }
-}
-
-func convHex(line int, s string) int {
- r, e := strconv.ParseInt(s, 16, 32)
- if e != nil {
- log.Fatalf("%d: %v", line, e)
- }
- return int(r)
-}
-
-func loadTestData() []Test {
- f := gen.OpenUnicodeFile("UCA", "", "CollationTest.zip")
- buffer, err := ioutil.ReadAll(f)
- f.Close()
- Error(err)
- archive, err := zip.NewReader(bytes.NewReader(buffer), int64(len(buffer)))
- Error(err)
- tests := []Test{}
- for _, f := range archive.File {
- // Skip the short versions, which are simply duplicates of the long versions.
- if strings.Contains(f.Name, "SHORT") || f.FileInfo().IsDir() {
- continue
- }
- ff, err := f.Open()
- Error(err)
- defer ff.Close()
- scanner := bufio.NewScanner(ff)
- test := Test{name: path.Base(f.Name)}
- for scanner.Scan() {
- line := scanner.Text()
- if len(line) <= 1 || line[0] == '#' {
- if m := versionRe.FindStringSubmatch(line); m != nil {
- if m[1] != gen.UnicodeVersion() {
- log.Printf("warning:%s: version is %s; want %s", f.Name, m[1], gen.UnicodeVersion())
- }
- }
- continue
- }
- m := testRe.FindStringSubmatch(line)
- if m == nil || len(m) < 3 {
- log.Fatalf(`Failed to parse: "%s" result: %#v`, line, m)
- }
- str := []byte{}
- // In the regression test data (unpaired) surrogates are assigned a weight
- // corresponding to their code point value. However, utf8.DecodeRune,
- // which is used to compute the implicit weight, assigns FFFD to surrogates.
- // We therefore skip tests with surrogates. This skips about 35 entries
- // per test.
- valid := true
- for _, split := range strings.Split(m[1], " ") {
- r, err := strconv.ParseUint(split, 16, 64)
- Error(err)
- valid = valid && utf8.ValidRune(rune(r))
- str = append(str, string(rune(r))...)
- }
- if valid {
- test.str = append(test.str, str)
- test.comment = append(test.comment, m[2])
- }
- }
- if scanner.Err() != nil {
- log.Fatal(scanner.Err())
- }
- tests = append(tests, test)
- }
- return tests
-}
-
-var errorCount int
-
-func runes(b []byte) []rune {
- return []rune(string(b))
-}
-
-var shifted = language.MustParse("und-u-ka-shifted-ks-level4")
-
-func doTest(t *testing.T, tc Test) {
- bld := build.NewBuilder()
- parseUCA(bld)
- w, err := bld.Build()
- Error(err)
- var tag language.Tag
- if !strings.Contains(tc.name, "NON_IGNOR") {
- tag = shifted
- }
- c := NewFromTable(w, OptionsFromTag(tag))
- b := &Buffer{}
- prev := tc.str[0]
- for i := 1; i < len(tc.str); i++ {
- b.Reset()
- s := tc.str[i]
- ka := c.Key(b, prev)
- kb := c.Key(b, s)
- if r := bytes.Compare(ka, kb); r == 1 {
- t.Errorf("%s:%d: Key(%.4X) < Key(%.4X) (%X < %X) == %d; want -1 or 0", tc.name, i, []rune(string(prev)), []rune(string(s)), ka, kb, r)
- prev = s
- continue
- }
- if r := c.Compare(prev, s); r == 1 {
- t.Errorf("%s:%d: Compare(%.4X, %.4X) == %d; want -1 or 0", tc.name, i, runes(prev), runes(s), r)
- }
- if r := c.Compare(s, prev); r == -1 {
- t.Errorf("%s:%d: Compare(%.4X, %.4X) == %d; want 1 or 0", tc.name, i, runes(s), runes(prev), r)
- }
- prev = s
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/sort_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/sort_test.go
deleted file mode 100644
index d9e7f31cc9a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/sort_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate_test
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/collate"
- "golang.org/x/text/language"
-)
-
-func ExampleCollator_Strings() {
- c := collate.New(language.Und)
- strings := []string{
- "ad",
- "ab",
- "äb",
- "ac",
- }
- c.SortStrings(strings)
- fmt.Println(strings)
- // Output: [ab äb ac ad]
-}
-
-type sorter []string
-
-func (s sorter) Len() int {
- return len(s)
-}
-
-func (s sorter) Swap(i, j int) {
- s[j], s[i] = s[i], s[j]
-}
-
-func (s sorter) Bytes(i int) []byte {
- return []byte(s[i])
-}
-
-func TestSort(t *testing.T) {
- c := collate.New(language.English)
- strings := []string{
- "bcd",
- "abc",
- "ddd",
- }
- c.Sort(sorter(strings))
- res := fmt.Sprint(strings)
- want := "[abc bcd ddd]"
- if res != want {
- t.Errorf("found %s; want %s", res, want)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/table_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/table_test.go
deleted file mode 100644
index 3a6b12fd625..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/collate/table_test.go
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package collate
-
-import (
- "testing"
-
- "golang.org/x/text/collate/build"
- "golang.org/x/text/internal/colltab"
- "golang.org/x/text/unicode/norm"
-)
-
-type ColElems []Weights
-
-type input struct {
- str string
- ces [][]int
-}
-
-type check struct {
- in string
- n int
- out ColElems
-}
-
-type tableTest struct {
- in []input
- chk []check
-}
-
-func w(ce ...int) Weights {
- return W(ce...)
-}
-
-var defaults = w(0)
-
-func pt(p, t int) []int {
- return []int{p, defaults.Secondary, t}
-}
-
-func makeTable(in []input) (*Collator, error) {
- b := build.NewBuilder()
- for _, r := range in {
- if e := b.Add([]rune(r.str), r.ces, nil); e != nil {
- panic(e)
- }
- }
- t, err := b.Build()
- if err != nil {
- return nil, err
- }
- return NewFromTable(t), nil
-}
-
-// modSeq holds a seqeunce of modifiers in increasing order of CCC long enough
-// to cause a segment overflow if not handled correctly. The last rune in this
-// list has a CCC of 214.
-var modSeq = []rune{
- 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BB,
- 0x05BC, 0x05BD, 0x05BF, 0x05C1, 0x05C2, 0xFB1E, 0x064B, 0x064C, 0x064D, 0x064E,
- 0x064F, 0x0650, 0x0651, 0x0652, 0x0670, 0x0711, 0x0C55, 0x0C56, 0x0E38, 0x0E48,
- 0x0EB8, 0x0EC8, 0x0F71, 0x0F72, 0x0F74, 0x0321, 0x1DCE,
-}
-
-var mods []input
-var modW = func() ColElems {
- ws := ColElems{}
- for _, r := range modSeq {
- rune := norm.NFC.PropertiesString(string(r))
- ws = append(ws, w(0, int(rune.CCC())))
- mods = append(mods, input{string(r), [][]int{{0, int(rune.CCC())}}})
- }
- return ws
-}()
-
-var appendNextTests = []tableTest{
- { // test getWeights
- []input{
- {"a", [][]int{{100}}},
- {"b", [][]int{{105}}},
- {"c", [][]int{{110}}},
- {"ß", [][]int{{120}}},
- },
- []check{
- {"a", 1, ColElems{w(100)}},
- {"b", 1, ColElems{w(105)}},
- {"c", 1, ColElems{w(110)}},
- {"d", 1, ColElems{w(0x50064)}},
- {"ab", 1, ColElems{w(100)}},
- {"bc", 1, ColElems{w(105)}},
- {"dd", 1, ColElems{w(0x50064)}},
- {"ß", 2, ColElems{w(120)}},
- },
- },
- { // test expansion
- []input{
- {"u", [][]int{{100}}},
- {"U", [][]int{{100}, {0, 25}}},
- {"w", [][]int{{100}, {100}}},
- {"W", [][]int{{100}, {0, 25}, {100}, {0, 25}}},
- },
- []check{
- {"u", 1, ColElems{w(100)}},
- {"U", 1, ColElems{w(100), w(0, 25)}},
- {"w", 1, ColElems{w(100), w(100)}},
- {"W", 1, ColElems{w(100), w(0, 25), w(100), w(0, 25)}},
- },
- },
- { // test decompose
- []input{
- {"D", [][]int{pt(104, 8)}},
- {"z", [][]int{pt(130, 8)}},
- {"\u030C", [][]int{{0, 40}}}, // Caron
- {"\u01C5", [][]int{pt(104, 9), pt(130, 4), {0, 40, 0x1F}}}, // Dž = D+z+caron
- },
- []check{
- {"\u01C5", 2, ColElems{w(pt(104, 9)...), w(pt(130, 4)...), w(0, 40, 0x1F)}},
- },
- },
- { // test basic contraction
- []input{
- {"a", [][]int{{100}}},
- {"ab", [][]int{{101}}},
- {"aab", [][]int{{101}, {101}}},
- {"abc", [][]int{{102}}},
- {"b", [][]int{{200}}},
- {"c", [][]int{{300}}},
- {"d", [][]int{{400}}},
- },
- []check{
- {"a", 1, ColElems{w(100)}},
- {"aa", 1, ColElems{w(100)}},
- {"aac", 1, ColElems{w(100)}},
- {"d", 1, ColElems{w(400)}},
- {"ab", 2, ColElems{w(101)}},
- {"abb", 2, ColElems{w(101)}},
- {"aab", 3, ColElems{w(101), w(101)}},
- {"aaba", 3, ColElems{w(101), w(101)}},
- {"abc", 3, ColElems{w(102)}},
- {"abcd", 3, ColElems{w(102)}},
- },
- },
- { // test discontinuous contraction
- append(mods, []input{
- // modifiers; secondary weight equals ccc
- {"\u0316", [][]int{{0, 220}}},
- {"\u0317", [][]int{{0, 220}, {0, 220}}},
- {"\u302D", [][]int{{0, 222}}},
- {"\u302E", [][]int{{0, 225}}}, // used as starter
- {"\u302F", [][]int{{0, 224}}}, // used as starter
- {"\u18A9", [][]int{{0, 228}}},
- {"\u0300", [][]int{{0, 230}}},
- {"\u0301", [][]int{{0, 230}}},
- {"\u0315", [][]int{{0, 232}}},
- {"\u031A", [][]int{{0, 232}}},
- {"\u035C", [][]int{{0, 233}}},
- {"\u035F", [][]int{{0, 233}}},
- {"\u035D", [][]int{{0, 234}}},
- {"\u035E", [][]int{{0, 234}}},
- {"\u0345", [][]int{{0, 240}}},
-
- // starters
- {"a", [][]int{{100}}},
- {"b", [][]int{{200}}},
- {"c", [][]int{{300}}},
- {"\u03B1", [][]int{{900}}},
- {"\x01", [][]int{{0, 0, 0, 0}}},
-
- // contractions
- {"a\u0300", [][]int{{101}}},
- {"a\u0301", [][]int{{102}}},
- {"a\u035E", [][]int{{110}}},
- {"a\u035Eb\u035E", [][]int{{115}}},
- {"ac\u035Eaca\u035E", [][]int{{116}}},
- {"a\u035Db\u035D", [][]int{{117}}},
- {"a\u0301\u035Db", [][]int{{120}}},
- {"a\u0301\u035F", [][]int{{121}}},
- {"a\u0301\u035Fb", [][]int{{119}}},
- {"\u03B1\u0345", [][]int{{901}, {902}}},
- {"\u302E\u302F", [][]int{{0, 131}, {0, 131}}},
- {"\u302F\u18A9", [][]int{{0, 130}}},
- }...),
- []check{
- {"a\x01\u0300", 1, ColElems{w(100)}},
- {"ab", 1, ColElems{w(100)}}, // closing segment
- {"a\u0316\u0300b", 5, ColElems{w(101), w(0, 220)}}, // closing segment
- {"a\u0316\u0300", 5, ColElems{w(101), w(0, 220)}}, // no closing segment
- {"a\u0316\u0300\u035Cb", 5, ColElems{w(101), w(0, 220)}}, // completes before segment end
- {"a\u0316\u0300\u035C", 5, ColElems{w(101), w(0, 220)}}, // completes before segment end
-
- {"a\u0316\u0301b", 5, ColElems{w(102), w(0, 220)}}, // closing segment
- {"a\u0316\u0301", 5, ColElems{w(102), w(0, 220)}}, // no closing segment
- {"a\u0316\u0301\u035Cb", 5, ColElems{w(102), w(0, 220)}}, // completes before segment end
- {"a\u0316\u0301\u035C", 5, ColElems{w(102), w(0, 220)}}, // completes before segment end
-
- // match blocked by modifier with same ccc
- {"a\u0301\u0315\u031A\u035Fb", 3, ColElems{w(102)}},
-
- // multiple gaps
- {"a\u0301\u035Db", 6, ColElems{w(120)}},
- {"a\u0301\u035F", 5, ColElems{w(121)}},
- {"a\u0301\u035Fb", 6, ColElems{w(119)}},
- {"a\u0316\u0301\u035F", 7, ColElems{w(121), w(0, 220)}},
- {"a\u0301\u0315\u035Fb", 7, ColElems{w(121), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035Db", 5, ColElems{w(102), w(0, 220)}},
- {"a\u0316\u0301\u0315\u035F", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035Fb", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035F\u035D", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
- {"a\u0316\u0301\u0315\u035F\u035Db", 9, ColElems{w(121), w(0, 220), w(0, 232)}},
-
- // handling of segment overflow
- { // just fits within segment
- "a" + string(modSeq[:30]) + "\u0301",
- 3 + len(string(modSeq[:30])),
- append(ColElems{w(102)}, modW[:30]...),
- },
- {"a" + string(modSeq[:31]) + "\u0301", 1, ColElems{w(100)}}, // overflow
- {"a" + string(modSeq) + "\u0301", 1, ColElems{w(100)}},
- { // just fits within segment with two interstitial runes
- "a" + string(modSeq[:28]) + "\u0301\u0315\u035F",
- 7 + len(string(modSeq[:28])),
- append(append(ColElems{w(121)}, modW[:28]...), w(0, 232)),
- },
- { // second half does not fit within segment
- "a" + string(modSeq[:29]) + "\u0301\u0315\u035F",
- 3 + len(string(modSeq[:29])),
- append(ColElems{w(102)}, modW[:29]...),
- },
-
- // discontinuity can only occur in last normalization segment
- {"a\u035Eb\u035E", 6, ColElems{w(115)}},
- {"a\u0316\u035Eb\u035E", 5, ColElems{w(110), w(0, 220)}},
- {"a\u035Db\u035D", 6, ColElems{w(117)}},
- {"a\u0316\u035Db\u035D", 1, ColElems{w(100)}},
- {"a\u035Eb\u0316\u035E", 8, ColElems{w(115), w(0, 220)}},
- {"a\u035Db\u0316\u035D", 8, ColElems{w(117), w(0, 220)}},
- {"ac\u035Eaca\u035E", 9, ColElems{w(116)}},
- {"a\u0316c\u035Eaca\u035E", 1, ColElems{w(100)}},
- {"ac\u035Eac\u0316a\u035E", 1, ColElems{w(100)}},
-
- // expanding contraction
- {"\u03B1\u0345", 4, ColElems{w(901), w(902)}},
-
- // Theoretical possibilities
- // contraction within a gap
- {"a\u302F\u18A9\u0301", 9, ColElems{w(102), w(0, 130)}},
- // expansion within a gap
- {"a\u0317\u0301", 5, ColElems{w(102), w(0, 220), w(0, 220)}},
- // repeating CCC blocks last modifier
- {"a\u302E\u302F\u0301", 1, ColElems{w(100)}},
- // The trailing combining characters (with lower CCC) should block the first one.
- // TODO: make the following pass.
- // {"a\u035E\u0316\u0316", 1, ColElems{w(100)}},
- {"a\u035F\u035Eb", 5, ColElems{w(110), w(0, 233)}},
- // Last combiner should match after normalization.
- // TODO: make the following pass.
- // {"a\u035D\u0301", 3, ColElems{w(102), w(0, 234)}},
- // The first combiner is blocking the second one as they have the same CCC.
- {"a\u035D\u035Eb", 1, ColElems{w(100)}},
- },
- },
-}
-
-func TestAppendNext(t *testing.T) {
- for i, tt := range appendNextTests {
- c, err := makeTable(tt.in)
- if err != nil {
- t.Errorf("%d: error creating table: %v", i, err)
- continue
- }
- for j, chk := range tt.chk {
- ws, n := c.t.AppendNext(nil, []byte(chk.in))
- if n != chk.n {
- t.Errorf("%d:%d: bytes consumed was %d; want %d", i, j, n, chk.n)
- }
- out := convertFromWeights(chk.out)
- if len(ws) != len(out) {
- t.Errorf("%d:%d: len(ws) was %d; want %d (%X vs %X)\n%X", i, j, len(ws), len(out), ws, out, chk.in)
- continue
- }
- for k, w := range ws {
- w, _ = colltab.MakeElem(w.Primary(), w.Secondary(), int(w.Tertiary()), 0)
- if w != out[k] {
- t.Errorf("%d:%d: Weights %d was %X; want %X", i, j, k, w, out[k])
- }
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/currency_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/currency_test.go
deleted file mode 100644
index db93a0ff9e9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/currency_test.go
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package currency
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
-)
-
-var (
- cup = MustParseISO("CUP")
- czk = MustParseISO("CZK")
- xcd = MustParseISO("XCD")
- zwr = MustParseISO("ZWR")
-)
-
-func TestParseISO(t *testing.T) {
- testCases := []struct {
- in string
- out Unit
- ok bool
- }{
- {"USD", USD, true},
- {"xxx", XXX, true},
- {"xts", XTS, true},
- {"XX", XXX, false},
- {"XXXX", XXX, false},
- {"", XXX, false}, // not well-formed
- {"UUU", XXX, false}, // unknown
- {"\u22A9", XXX, false}, // non-ASCII, printable
-
- {"aaa", XXX, false},
- {"zzz", XXX, false},
- {"000", XXX, false},
- {"999", XXX, false},
- {"---", XXX, false},
- {"\x00\x00\x00", XXX, false},
- {"\xff\xff\xff", XXX, false},
- }
- for i, tc := range testCases {
- if x, err := ParseISO(tc.in); x != tc.out || err == nil != tc.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tc.in, x, err == nil, tc.out, tc.ok)
- }
- }
-}
-
-func TestFromRegion(t *testing.T) {
- testCases := []struct {
- region string
- currency Unit
- ok bool
- }{
- {"NL", EUR, true},
- {"BE", EUR, true},
- {"AG", xcd, true},
- {"CH", CHF, true},
- {"CU", cup, true}, // first of multiple
- {"DG", USD, true}, // does not have M49 code
- {"150", XXX, false}, // implicit false
- {"CP", XXX, false}, // explicit false in CLDR
- {"CS", XXX, false}, // all expired
- {"ZZ", XXX, false}, // none match
- }
- for _, tc := range testCases {
- cur, ok := FromRegion(language.MustParseRegion(tc.region))
- if cur != tc.currency || ok != tc.ok {
- t.Errorf("%s: got %v, %v; want %v, %v", tc.region, cur, ok, tc.currency, tc.ok)
- }
- }
-}
-
-func TestFromTag(t *testing.T) {
- testCases := []struct {
- tag string
- currency Unit
- conf language.Confidence
- }{
- {"nl", EUR, language.Low}, // nl also spoken outside Euro land.
- {"nl-BE", EUR, language.Exact}, // region is known
- {"pt", BRL, language.Low},
- {"en", USD, language.Low},
- {"en-u-cu-eur", EUR, language.Exact},
- {"tlh", XXX, language.No}, // Klingon has no country.
- {"es-419", XXX, language.No},
- {"und", USD, language.Low},
- }
- for _, tc := range testCases {
- cur, conf := FromTag(language.MustParse(tc.tag))
- if cur != tc.currency || conf != tc.conf {
- t.Errorf("%s: got %v, %v; want %v, %v", tc.tag, cur, conf, tc.currency, tc.conf)
- }
- }
-}
-
-func TestTable(t *testing.T) {
- for i := 4; i < len(currency); i += 4 {
- if a, b := currency[i-4:i-1], currency[i:i+3]; a >= b {
- t.Errorf("currency unordered at element %d: %s >= %s", i, a, b)
- }
- }
- // First currency has index 1, last is numCurrencies.
- if c := currency.Elem(1)[:3]; c != "ADP" {
- t.Errorf("first was %q; want ADP", c)
- }
- if c := currency.Elem(numCurrencies)[:3]; c != "ZWR" {
- t.Errorf("last was %q; want ZWR", c)
- }
-}
-
-func TestKindRounding(t *testing.T) {
- testCases := []struct {
- kind Kind
- cur Unit
- scale int
- inc int
- }{
- {Standard, USD, 2, 1},
- {Standard, CHF, 2, 1},
- {Cash, CHF, 2, 5},
- {Standard, TWD, 2, 1},
- {Cash, TWD, 0, 1},
- {Standard, czk, 2, 1},
- {Cash, czk, 0, 1},
- {Standard, zwr, 2, 1},
- {Cash, zwr, 0, 1},
- {Standard, KRW, 0, 1},
- {Cash, KRW, 0, 1}, // Cash defaults to standard.
- }
- for i, tc := range testCases {
- if scale, inc := tc.kind.Rounding(tc.cur); scale != tc.scale && inc != tc.inc {
- t.Errorf("%d: got %d, %d; want %d, %d", i, scale, inc, tc.scale, tc.inc)
- }
- }
-}
-
-const body = `package main
-import (
- "fmt"
- "golang.org/x/text/currency"
-)
-func main() {
- %s
-}
-`
-
-func TestLinking(t *testing.T) {
- base := getSize(t, `fmt.Print(currency.CLDRVersion)`)
- symbols := getSize(t, `fmt.Print(currency.Symbol(currency.USD))`)
- if d := symbols - base; d < 2*1024 {
- t.Errorf("size(symbols)-size(base) was %d; want > 2K", d)
- }
-}
-
-func getSize(t *testing.T, main string) int {
- size, err := testtext.CodeSize(fmt.Sprintf(body, main))
- if err != nil {
- t.Skipf("skipping link size test; binary size could not be determined: %v", err)
- }
- return size
-}
-
-func BenchmarkString(b *testing.B) {
- for i := 0; i < b.N; i++ {
- USD.String()
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/example_test.go
deleted file mode 100644
index f7984aa7324..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/example_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package currency_test
-
-import (
- "fmt"
- "time"
-
- "golang.org/x/text/currency"
-)
-
-func ExampleQuery() {
- t1799, _ := time.Parse("2006-01-02", "1799-01-01")
- for it := currency.Query(currency.Date(t1799)); it.Next(); {
- from := ""
- if t, ok := it.From(); ok {
- from = t.Format("2006-01-01")
- }
- fmt.Printf("%v is used in %v since: %v\n", it.Unit(), it.Region(), from)
- }
- // Output:
- // GBP is used in GB since: 1694-07-07
- // GIP is used in GI since: 1713-01-01
- // USD is used in US since: 1792-01-01
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/format_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/format_test.go
deleted file mode 100644
index 0aa0d58aff0..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/format_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package currency
-
-import (
- "testing"
-
- "golang.org/x/text/language"
- "golang.org/x/text/message"
-)
-
-var (
- en = language.English
- fr = language.French
- en_US = language.AmericanEnglish
- en_GB = language.BritishEnglish
- en_AU = language.MustParse("en-AU")
- und = language.Und
-)
-
-func TestFormatting(t *testing.T) {
- testCases := []struct {
- tag language.Tag
- value interface{}
- format Formatter
- want string
- }{
- 0: {en, USD.Amount(0.1), nil, "USD 0.10"},
- 1: {en, XPT.Amount(1.0), Symbol, "XPT 1.00"},
-
- 2: {en, USD.Amount(2.0), ISO, "USD 2.00"},
- 3: {und, USD.Amount(3.0), Symbol, "US$ 3.00"},
- 4: {en, USD.Amount(4.0), Symbol, "$ 4.00"},
-
- 5: {en, USD.Amount(5.20), NarrowSymbol, "$ 5.20"},
- 6: {en, AUD.Amount(6.20), Symbol, "A$ 6.20"},
-
- 7: {en_AU, AUD.Amount(7.20), Symbol, "$ 7.20"},
- 8: {en_GB, USD.Amount(8.20), Symbol, "US$ 8.20"},
-
- 9: {en, 9.0, Symbol.Default(EUR), "€ 9.00"},
- 10: {en, 10.123, Symbol.Default(KRW), "₩ 10"},
- 11: {fr, 11.52, Symbol.Default(TWD), "TWD 11.52"},
- 12: {en, 12.123, Symbol.Default(czk), "CZK 12.12"},
- 13: {en, 13.123, Symbol.Default(czk).Kind(Cash), "CZK 13"},
- 14: {en, 14.12345, ISO.Default(MustParseISO("CLF")), "CLF 14.1235"},
- 15: {en, USD.Amount(15.00), ISO.Default(TWD), "USD 15.00"},
- 16: {en, KRW.Amount(16.00), ISO.Kind(Cash), "KRW 16"},
-
- // TODO: support integers as well.
-
- 17: {en, USD, nil, "USD"},
- 18: {en, USD, ISO, "USD"},
- 19: {en, USD, Symbol, "$"},
- 20: {en_GB, USD, Symbol, "US$"},
- 21: {en_AU, USD, NarrowSymbol, "$"},
- }
- for i, tc := range testCases {
- p := message.NewPrinter(tc.tag)
- v := tc.value
- if tc.format != nil {
- v = tc.format(v)
- }
- if got := p.Sprint(v); got != tc.want {
- t.Errorf("%d: got %q; want %q", i, got, tc.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/query_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/query_test.go
deleted file mode 100644
index 6caea9dbbf7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/query_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package currency
-
-import (
- "testing"
- "time"
-
- "golang.org/x/text/language"
-)
-
-func TestQuery(t *testing.T) {
- r := func(region string) language.Region {
- return language.MustParseRegion(region)
- }
- t1800, _ := time.Parse("2006-01-02", "1800-01-01")
- type result struct {
- region language.Region
- unit Unit
- isTender bool
- from, to string
- }
- testCases := []struct {
- name string
- opts []QueryOption
- results []result
- }{{
- name: "XA",
- opts: []QueryOption{Region(r("XA"))},
- results: []result{},
- }, {
- name: "AC",
- opts: []QueryOption{Region(r("AC"))},
- results: []result{
- {r("AC"), MustParseISO("SHP"), true, "1976-01-01", ""},
- },
- }, {
- name: "US",
- opts: []QueryOption{Region(r("US"))},
- results: []result{
- {r("US"), MustParseISO("USD"), true, "1792-01-01", ""},
- },
- }, {
- name: "US-hist",
- opts: []QueryOption{Region(r("US")), Historical},
- results: []result{
- {r("US"), MustParseISO("USD"), true, "1792-01-01", ""},
- },
- }, {
- name: "US-non-tender",
- opts: []QueryOption{Region(r("US")), NonTender},
- results: []result{
- {r("US"), MustParseISO("USD"), true, "1792-01-01", ""},
- {r("US"), MustParseISO("USN"), false, "", ""},
- },
- }, {
- name: "US-historical+non-tender",
- opts: []QueryOption{Region(r("US")), Historical, NonTender},
- results: []result{
- {r("US"), MustParseISO("USD"), true, "1792-01-01", ""},
- {r("US"), MustParseISO("USN"), false, "", ""},
- {r("US"), MustParseISO("USS"), false, "", "2014-03-01"},
- },
- }, {
- name: "1800",
- opts: []QueryOption{Date(t1800)},
- results: []result{
- {r("CH"), MustParseISO("CHF"), true, "1799-03-17", ""},
- {r("GB"), MustParseISO("GBP"), true, "1694-07-27", ""},
- {r("GI"), MustParseISO("GIP"), true, "1713-01-01", ""},
- // The date for IE and PR seem wrong, so these may be updated at
- // some point causing the tests to fail.
- {r("IE"), MustParseISO("GBP"), true, "1800-01-01", "1922-01-01"},
- {r("PR"), MustParseISO("ESP"), true, "1800-01-01", "1898-12-10"},
- {r("US"), MustParseISO("USD"), true, "1792-01-01", ""},
- },
- }}
- for _, tc := range testCases {
- n := 0
- for it := Query(tc.opts...); it.Next(); n++ {
- if n < len(tc.results) {
- got := result{
- it.Region(),
- it.Unit(),
- it.IsTender(),
- getTime(it.From()),
- getTime(it.To()),
- }
- if got != tc.results[n] {
- t.Errorf("%s:%d: got %v; want %v", tc.name, n, got, tc.results[n])
- }
- }
- }
- if n != len(tc.results) {
- t.Errorf("%s: unexpected number of results: got %d; want %d", tc.name, n, len(tc.results))
- }
- }
-}
-
-func getTime(t time.Time, ok bool) string {
- if !ok {
- return ""
- }
- return t.Format("2006-01-02")
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/tables_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/tables_test.go
deleted file mode 100644
index 779f5001d18..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/currency/tables_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package currency
-
-import (
- "flag"
- "strings"
- "testing"
- "time"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/message"
- "golang.org/x/text/unicode/cldr"
-)
-
-var draft = flag.String("draft",
- "contributed",
- `Minimal draft requirements (approved, contributed, provisional, unconfirmed).`)
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- // Read the CLDR zip file.
- r := gen.OpenCLDRCoreZip()
- defer r.Close()
-
- d := &cldr.Decoder{}
- d.SetDirFilter("supplemental", "main")
- d.SetSectionFilter("numbers")
- data, err := d.DecodeZip(r)
- if err != nil {
- t.Fatalf("DecodeZip: %v", err)
- }
-
- dr, err := cldr.ParseDraft(*draft)
- if err != nil {
- t.Fatalf("filter: %v", err)
- }
-
- for _, lang := range data.Locales() {
- p := message.NewPrinter(language.MustParse(lang))
-
- ldml := data.RawLDML(lang)
- if ldml.Numbers == nil || ldml.Numbers.Currencies == nil {
- continue
- }
- for _, c := range ldml.Numbers.Currencies.Currency {
- syms := cldr.MakeSlice(&c.Symbol)
- syms.SelectDraft(dr)
-
- for _, sym := range c.Symbol {
- cur, err := ParseISO(c.Type)
- if err != nil {
- continue
- }
- formatter := Symbol
- switch sym.Alt {
- case "":
- case "narrow":
- formatter = NarrowSymbol
- default:
- continue
- }
- want := sym.Data()
- if got := p.Sprint(formatter(cur)); got != want {
- t.Errorf("%s:%sSymbol(%s) = %s; want %s", lang, strings.Title(sym.Alt), c.Type, got, want)
- }
- }
- }
- }
-
- for _, reg := range data.Supplemental().CurrencyData.Region {
- i := 0
- for ; regionData[i].Region().String() != reg.Iso3166; i++ {
- }
- it := Query(Historical, NonTender, Region(language.MustParseRegion(reg.Iso3166)))
- for _, cur := range reg.Currency {
- from, _ := time.Parse("2006-01-02", cur.From)
- to, _ := time.Parse("2006-01-02", cur.To)
-
- it.Next()
- for j, r := range []QueryIter{&iter{regionInfo: &regionData[i]}, it} {
- if got, _ := r.From(); from != got {
- t.Errorf("%d:%s:%s:from: got %v; want %v", j, reg.Iso3166, cur.Iso4217, got, from)
- }
- if got, _ := r.To(); to != got {
- t.Errorf("%d:%s:%s:to: got %v; want %v", j, reg.Iso3166, cur.Iso4217, got, to)
- }
- }
- i++
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/data_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/data_test.go
deleted file mode 100644
index eb388cbc551..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/data_test.go
+++ /dev/null
@@ -1,335 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package date
-
-var enumMap = map[string]uint16{
- "": 0,
- "calendars": 0,
- "fields": 1,
- "timeZoneNames": 2,
- "buddhist": 0,
- "chinese": 1,
- "coptic": 2,
- "dangi": 3,
- "ethiopic": 4,
- "ethiopic-amete-alem": 5,
- "generic": 6,
- "gregorian": 7,
- "hebrew": 8,
- "indian": 9,
- "islamic": 10,
- "islamic-civil": 11,
- "islamic-rgsa": 12,
- "islamic-tbla": 13,
- "islamic-umalqura": 14,
- "japanese": 15,
- "persian": 16,
- "roc": 17,
- "months": 0,
- "days": 1,
- "quarters": 2,
- "dayPeriods": 3,
- "eras": 4,
- "dateFormats": 5,
- "timeFormats": 6,
- "dateTimeFormats": 7,
- "monthPatterns": 8,
- "cyclicNameSets": 9,
- "format": 0,
- "stand-alone": 1,
- "numeric": 2,
- "widthAbbreviated": 0,
- "widthNarrow": 1,
- "widthWide": 2,
- "widthAll": 3,
- "widthShort": 4,
- "leap7": 0,
- "sun": 0,
- "mon": 1,
- "tue": 2,
- "wed": 3,
- "thu": 4,
- "fri": 5,
- "sat": 6,
- "am": 0,
- "pm": 1,
- "midnight": 2,
- "morning1": 3,
- "afternoon1": 4,
- "evening1": 5,
- "night1": 6,
- "noon": 7,
- "morning2": 8,
- "afternoon2": 9,
- "night2": 10,
- "evening2": 11,
- "variant": 1,
- "short": 0,
- "long": 1,
- "full": 2,
- "medium": 3,
- "dayPartsCycleType": 0,
- "daysCycleType": 1,
- "monthsCycleType": 2,
- "solarTermsCycleType": 3,
- "yearsCycleType": 4,
- "zodiacsCycleType": 5,
- "eraField": 0,
- "era-shortField": 1,
- "era-narrowField": 2,
- "yearField": 3,
- "year-shortField": 4,
- "year-narrowField": 5,
- "quarterField": 6,
- "quarter-shortField": 7,
- "quarter-narrowField": 8,
- "monthField": 9,
- "month-shortField": 10,
- "month-narrowField": 11,
- "weekField": 12,
- "week-shortField": 13,
- "week-narrowField": 14,
- "weekOfMonthField": 15,
- "weekOfMonth-shortField": 16,
- "weekOfMonth-narrowField": 17,
- "dayField": 18,
- "day-shortField": 19,
- "day-narrowField": 20,
- "dayOfYearField": 21,
- "dayOfYear-shortField": 22,
- "dayOfYear-narrowField": 23,
- "weekdayField": 24,
- "weekday-shortField": 25,
- "weekday-narrowField": 26,
- "weekdayOfMonthField": 27,
- "weekdayOfMonth-shortField": 28,
- "weekdayOfMonth-narrowField": 29,
- "sunField": 30,
- "sun-shortField": 31,
- "sun-narrowField": 32,
- "monField": 33,
- "mon-shortField": 34,
- "mon-narrowField": 35,
- "tueField": 36,
- "tue-shortField": 37,
- "tue-narrowField": 38,
- "wedField": 39,
- "wed-shortField": 40,
- "wed-narrowField": 41,
- "thuField": 42,
- "thu-shortField": 43,
- "thu-narrowField": 44,
- "friField": 45,
- "fri-shortField": 46,
- "fri-narrowField": 47,
- "satField": 48,
- "sat-shortField": 49,
- "sat-narrowField": 50,
- "dayperiod-shortField": 51,
- "dayperiodField": 52,
- "dayperiod-narrowField": 53,
- "hourField": 54,
- "hour-shortField": 55,
- "hour-narrowField": 56,
- "minuteField": 57,
- "minute-shortField": 58,
- "minute-narrowField": 59,
- "secondField": 60,
- "second-shortField": 61,
- "second-narrowField": 62,
- "zoneField": 63,
- "zone-shortField": 64,
- "zone-narrowField": 65,
- "displayName": 0,
- "relative": 1,
- "relativeTime": 2,
- "relativePeriod": 3,
- "before1": 0,
- "current": 1,
- "after1": 2,
- "before2": 3,
- "after2": 4,
- "after3": 5,
- "future": 0,
- "past": 1,
- "other": 0,
- "one": 1,
- "zero": 2,
- "two": 3,
- "few": 4,
- "many": 5,
- "zoneFormat": 0,
- "regionFormat": 1,
- "zone": 2,
- "metaZone": 3,
- "hourFormat": 0,
- "gmtFormat": 1,
- "gmtZeroFormat": 2,
- "genericTime": 0,
- "daylightTime": 1,
- "standardTime": 2,
- "Etc/UTC": 0,
- "Europe/London": 1,
- "Europe/Dublin": 2,
- "Pacific/Honolulu": 3,
- "Afghanistan": 0,
- "Africa_Central": 1,
- "Africa_Eastern": 2,
- "Africa_Southern": 3,
- "Africa_Western": 4,
- "Alaska": 5,
- "Amazon": 6,
- "America_Central": 7,
- "America_Eastern": 8,
- "America_Mountain": 9,
- "America_Pacific": 10,
- "Anadyr": 11,
- "Apia": 12,
- "Arabian": 13,
- "Argentina": 14,
- "Argentina_Western": 15,
- "Armenia": 16,
- "Atlantic": 17,
- "Australia_Central": 18,
- "Australia_CentralWestern": 19,
- "Australia_Eastern": 20,
- "Australia_Western": 21,
- "Azerbaijan": 22,
- "Azores": 23,
- "Bangladesh": 24,
- "Bhutan": 25,
- "Bolivia": 26,
- "Brasilia": 27,
- "Brunei": 28,
- "Cape_Verde": 29,
- "Chamorro": 30,
- "Chatham": 31,
- "Chile": 32,
- "China": 33,
- "Choibalsan": 34,
- "Christmas": 35,
- "Cocos": 36,
- "Colombia": 37,
- "Cook": 38,
- "Cuba": 39,
- "Davis": 40,
- "DumontDUrville": 41,
- "East_Timor": 42,
- "Easter": 43,
- "Ecuador": 44,
- "Europe_Central": 45,
- "Europe_Eastern": 46,
- "Europe_Further_Eastern": 47,
- "Europe_Western": 48,
- "Falkland": 49,
- "Fiji": 50,
- "French_Guiana": 51,
- "French_Southern": 52,
- "Galapagos": 53,
- "Gambier": 54,
- "Georgia": 55,
- "Gilbert_Islands": 56,
- "GMT": 57,
- "Greenland_Eastern": 58,
- "Greenland_Western": 59,
- "Gulf": 60,
- "Guyana": 61,
- "Hawaii_Aleutian": 62,
- "Hong_Kong": 63,
- "Hovd": 64,
- "India": 65,
- "Indian_Ocean": 66,
- "Indochina": 67,
- "Indonesia_Central": 68,
- "Indonesia_Eastern": 69,
- "Indonesia_Western": 70,
- "Iran": 71,
- "Irkutsk": 72,
- "Israel": 73,
- "Japan": 74,
- "Kamchatka": 75,
- "Kazakhstan_Eastern": 76,
- "Kazakhstan_Western": 77,
- "Korea": 78,
- "Kosrae": 79,
- "Krasnoyarsk": 80,
- "Kyrgystan": 81,
- "Line_Islands": 82,
- "Lord_Howe": 83,
- "Macquarie": 84,
- "Magadan": 85,
- "Malaysia": 86,
- "Maldives": 87,
- "Marquesas": 88,
- "Marshall_Islands": 89,
- "Mauritius": 90,
- "Mawson": 91,
- "Mexico_Northwest": 92,
- "Mexico_Pacific": 93,
- "Mongolia": 94,
- "Moscow": 95,
- "Myanmar": 96,
- "Nauru": 97,
- "Nepal": 98,
- "New_Caledonia": 99,
- "New_Zealand": 100,
- "Newfoundland": 101,
- "Niue": 102,
- "Norfolk": 103,
- "Noronha": 104,
- "Novosibirsk": 105,
- "Omsk": 106,
- "Pakistan": 107,
- "Palau": 108,
- "Papua_New_Guinea": 109,
- "Paraguay": 110,
- "Peru": 111,
- "Philippines": 112,
- "Phoenix_Islands": 113,
- "Pierre_Miquelon": 114,
- "Pitcairn": 115,
- "Ponape": 116,
- "Pyongyang": 117,
- "Reunion": 118,
- "Rothera": 119,
- "Sakhalin": 120,
- "Samara": 121,
- "Samoa": 122,
- "Seychelles": 123,
- "Singapore": 124,
- "Solomon": 125,
- "South_Georgia": 126,
- "Suriname": 127,
- "Syowa": 128,
- "Tahiti": 129,
- "Taipei": 130,
- "Tajikistan": 131,
- "Tokelau": 132,
- "Tonga": 133,
- "Truk": 134,
- "Turkmenistan": 135,
- "Tuvalu": 136,
- "Uruguay": 137,
- "Uzbekistan": 138,
- "Vanuatu": 139,
- "Venezuela": 140,
- "Vladivostok": 141,
- "Volgograd": 142,
- "Vostok": 143,
- "Wake": 144,
- "Wallis": 145,
- "Yakutsk": 146,
- "Yekaterinburg": 147,
- "Guam": 148,
- "North_Mariana": 149,
- "Acre": 150,
- "Almaty": 151,
- "Aqtau": 152,
- "Aqtobe": 153,
- "Casey": 154,
- "Lanka": 155,
- "Macau": 156,
- "Qyzylorda": 157,
-}
-
-// Total table size 0 bytes (0KiB); checksum: 811C9DC5
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/gen_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/gen_test.go
deleted file mode 100644
index 798cb4fa3b4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/date/gen_test.go
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package date
-
-import (
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/cldrtree"
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/unicode/cldr"
-)
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- r := gen.OpenCLDRCoreZip()
- defer r.Close()
-
- d := &cldr.Decoder{}
- d.SetDirFilter("supplemental", "main")
- d.SetSectionFilter("dates")
- data, err := d.DecodeZip(r)
- if err != nil {
- t.Fatalf("DecodeZip: %v", err)
- }
-
- count := 0
- for _, lang := range data.Locales() {
- ldml := data.RawLDML(lang)
- if ldml.Dates == nil {
- continue
- }
- tag, _ := language.CompactIndex(language.MustParse(lang))
-
- test := func(want cldrtree.Element, path ...string) {
- if count > 30 {
- return
- }
- t.Run(lang+"/"+strings.Join(path, "/"), func(t *testing.T) {
- p := make([]uint16, len(path))
- for i, s := range path {
- if v, err := strconv.Atoi(s); err == nil {
- p[i] = uint16(v)
- } else if v, ok := enumMap[s]; ok {
- p[i] = v
- } else {
- count++
- t.Fatalf("Unknown key %q", s)
- }
- }
- wantStr := want.GetCommon().Data()
- if got := tree.Lookup(tag, p...); got != wantStr {
- count++
- t.Errorf("got %q; want %q", got, wantStr)
- }
- })
- }
-
- width := func(s string) string { return "width" + strings.Title(s) }
-
- if ldml.Dates.Calendars != nil {
- for _, cal := range ldml.Dates.Calendars.Calendar {
- if cal.Months != nil {
- for _, mc := range cal.Months.MonthContext {
- for _, mw := range mc.MonthWidth {
- for _, m := range mw.Month {
- test(m, "calendars", cal.Type, "months", mc.Type, width(mw.Type), m.Yeartype+m.Type)
- }
- }
- }
- }
- if cal.MonthPatterns != nil {
- for _, mc := range cal.MonthPatterns.MonthPatternContext {
- for _, mw := range mc.MonthPatternWidth {
- for _, m := range mw.MonthPattern {
- test(m, "calendars", cal.Type, "monthPatterns", mc.Type, width(mw.Type))
- }
- }
- }
- }
- if cal.CyclicNameSets != nil {
- for _, cns := range cal.CyclicNameSets.CyclicNameSet {
- for _, cc := range cns.CyclicNameContext {
- for _, cw := range cc.CyclicNameWidth {
- for _, c := range cw.CyclicName {
- test(c, "calendars", cal.Type, "cyclicNameSets", cns.Type+"CycleType", cc.Type, width(cw.Type), c.Type)
-
- }
- }
- }
- }
- }
- if cal.Days != nil {
- for _, dc := range cal.Days.DayContext {
- for _, dw := range dc.DayWidth {
- for _, d := range dw.Day {
- test(d, "calendars", cal.Type, "days", dc.Type, width(dw.Type), d.Type)
- }
- }
- }
- }
- if cal.Quarters != nil {
- for _, qc := range cal.Quarters.QuarterContext {
- for _, qw := range qc.QuarterWidth {
- for _, q := range qw.Quarter {
- test(q, "calendars", cal.Type, "quarters", qc.Type, width(qw.Type), q.Type)
- }
- }
- }
- }
- if cal.DayPeriods != nil {
- for _, dc := range cal.DayPeriods.DayPeriodContext {
- for _, dw := range dc.DayPeriodWidth {
- for _, d := range dw.DayPeriod {
- test(d, "calendars", cal.Type, "dayPeriods", dc.Type, width(dw.Type), d.Type, d.Alt)
- }
- }
- }
- }
- if cal.Eras != nil {
- if cal.Eras.EraNames != nil {
- for _, e := range cal.Eras.EraNames.Era {
- test(e, "calendars", cal.Type, "eras", "widthWide", e.Alt, e.Type)
- }
- }
- if cal.Eras.EraAbbr != nil {
- for _, e := range cal.Eras.EraAbbr.Era {
- test(e, "calendars", cal.Type, "eras", "widthAbbreviated", e.Alt, e.Type)
- }
- }
- if cal.Eras.EraNarrow != nil {
- for _, e := range cal.Eras.EraNarrow.Era {
- test(e, "calendars", cal.Type, "eras", "widthNarrow", e.Alt, e.Type)
- }
- }
- }
- if cal.DateFormats != nil {
- for _, dfl := range cal.DateFormats.DateFormatLength {
- for _, df := range dfl.DateFormat {
- for _, p := range df.Pattern {
- test(p, "calendars", cal.Type, "dateFormats", dfl.Type, p.Alt)
- }
- }
- }
- }
- if cal.TimeFormats != nil {
- for _, tfl := range cal.TimeFormats.TimeFormatLength {
- for _, tf := range tfl.TimeFormat {
- for _, p := range tf.Pattern {
- test(p, "calendars", cal.Type, "timeFormats", tfl.Type, p.Alt)
- }
- }
- }
- }
- if cal.DateTimeFormats != nil {
- for _, dtfl := range cal.DateTimeFormats.DateTimeFormatLength {
- for _, dtf := range dtfl.DateTimeFormat {
- for _, p := range dtf.Pattern {
- test(p, "calendars", cal.Type, "dateTimeFormats", dtfl.Type, p.Alt)
- }
- }
- }
- // TODO:
- // - appendItems
- // - intervalFormats
- }
- }
- }
- // TODO: this is a lot of data and is probably relatively little used.
- // Store this somewhere else.
- if ldml.Dates.Fields != nil {
- for _, f := range ldml.Dates.Fields.Field {
- field := f.Type + "Field"
- for _, d := range f.DisplayName {
- test(d, "fields", field, "displayName", d.Alt)
- }
- for _, r := range f.Relative {
- i, _ := strconv.Atoi(r.Type)
- v := []string{"before2", "before1", "current", "after1", "after2", "after3"}[i+2]
- test(r, "fields", field, "relative", v)
- }
- for _, rt := range f.RelativeTime {
- for _, p := range rt.RelativeTimePattern {
- test(p, "fields", field, "relativeTime", rt.Type, p.Count)
- }
- }
- for _, rp := range f.RelativePeriod {
- test(rp, "fields", field, "relativePeriod", rp.Alt)
- }
- }
- }
- if ldml.Dates.TimeZoneNames != nil {
- for _, h := range ldml.Dates.TimeZoneNames.HourFormat {
- test(h, "timeZoneNames", "zoneFormat", h.Element())
- }
- for _, g := range ldml.Dates.TimeZoneNames.GmtFormat {
- test(g, "timeZoneNames", "zoneFormat", g.Element())
- }
- for _, g := range ldml.Dates.TimeZoneNames.GmtZeroFormat {
- test(g, "timeZoneNames", "zoneFormat", g.Element())
- }
- for _, r := range ldml.Dates.TimeZoneNames.RegionFormat {
- s := r.Type
- if s == "" {
- s = "generic"
- }
- test(r, "timeZoneNames", "regionFormat", s+"Time")
- }
-
- testZone := func(zoneType, zoneWidth, zone string, a ...[]*cldr.Common) {
- for _, e := range a {
- for _, n := range e {
- test(n, "timeZoneNames", zoneType, zoneWidth, n.Element()+"Time", zone)
- }
- }
- }
- for _, z := range ldml.Dates.TimeZoneNames.Zone {
- for _, l := range z.Long {
- testZone("zone", l.Element(), z.Type, l.Generic, l.Standard, l.Daylight)
- }
- for _, l := range z.Short {
- testZone("zone", l.Element(), z.Type, l.Generic, l.Standard, l.Daylight)
- }
- }
- for _, z := range ldml.Dates.TimeZoneNames.Metazone {
- for _, l := range z.Long {
- testZone("metaZone", l.Element(), z.Type, l.Generic, l.Standard, l.Daylight)
- }
- for _, l := range z.Short {
- testZone("metaZone", l.Element(), z.Type, l.Generic, l.Standard, l.Daylight)
- }
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/charmap/charmap_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/charmap/charmap_test.go
deleted file mode 100644
index 03dd76ebd27..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/charmap/charmap_test.go
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package charmap
-
-import (
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Decode", e.NewDecoder(), nil
-}
-
-func encASCIISuperset(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement
-}
-
-func encEBCDIC(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Encode", e.NewEncoder(), internal.RepertoireError(0x3f)
-}
-
-func TestNonRepertoire(t *testing.T) {
- testCases := []struct {
- init func(e encoding.Encoding) (string, transform.Transformer, error)
- e encoding.Encoding
- src, want string
- }{
- {dec, Windows1252, "\x81", "\ufffd"},
-
- {encEBCDIC, CodePage037, "갂", ""},
-
- {encEBCDIC, CodePage1047, "갂", ""},
- {encEBCDIC, CodePage1047, "a¤갂", "\x81\x9F"},
-
- {encEBCDIC, CodePage1140, "갂", ""},
- {encEBCDIC, CodePage1140, "a€갂", "\x81\x9F"},
-
- {encASCIISuperset, Windows1252, "갂", ""},
- {encASCIISuperset, Windows1252, "a갂", "a"},
- {encASCIISuperset, Windows1252, "\u00E9갂", "\xE9"},
- }
- for _, tc := range testCases {
- dir, tr, wantErr := tc.init(tc.e)
-
- dst, _, err := transform.String(tr, tc.src)
- if err != wantErr {
- t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr)
- }
- if got := string(dst); got != tc.want {
- t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want)
- }
- }
-}
-
-func TestBasics(t *testing.T) {
- testCases := []struct {
- e encoding.Encoding
- encoded string
- utf8 string
- }{{
- e: CodePage037,
- encoded: "\xc8\x51\xba\x93\xcf",
- utf8: "Hé[lõ",
- }, {
- e: CodePage437,
- encoded: "H\x82ll\x93 \x9d\xa7\xf4\x9c\xbe",
- utf8: "Héllô ¥º⌠£╛",
- }, {
- e: CodePage866,
- encoded: "H\xf3\xd3o \x98\xfd\x9f\xdd\xa1",
- utf8: "Hє╙o Ш¤Я▌б",
- }, {
- e: CodePage1047,
- encoded: "\xc8\x54\x93\x93\x9f",
- utf8: "Hèll¤",
- }, {
- e: CodePage1140,
- encoded: "\xc8\x9f\x93\x93\xcf",
- utf8: "H€llõ",
- }, {
- e: ISO8859_2,
- encoded: "Hel\xe5\xf5",
- utf8: "Helĺő",
- }, {
- e: ISO8859_3,
- encoded: "He\xbd\xd4",
- utf8: "He½Ô",
- }, {
- e: ISO8859_4,
- encoded: "Hel\xb6\xf8",
- utf8: "Helļø",
- }, {
- e: ISO8859_5,
- encoded: "H\xd7\xc6o",
- utf8: "HзЦo",
- }, {
- e: ISO8859_6,
- encoded: "Hel\xc2\xc9",
- utf8: "Helآة",
- }, {
- e: ISO8859_7,
- encoded: "H\xeel\xebo",
- utf8: "Hξlλo",
- }, {
- e: ISO8859_8,
- encoded: "Hel\xf5\xed",
- utf8: "Helץם",
- }, {
- e: ISO8859_9,
- encoded: "\xdeayet",
- utf8: "Şayet",
- }, {
- e: ISO8859_10,
- encoded: "H\xea\xbfo",
- utf8: "Hęŋo",
- }, {
- e: ISO8859_13,
- encoded: "H\xe6l\xf9o",
- utf8: "Hęlło",
- }, {
- e: ISO8859_14,
- encoded: "He\xfe\xd0o",
- utf8: "HeŷŴo",
- }, {
- e: ISO8859_15,
- encoded: "H\xa4ll\xd8",
- utf8: "H€llØ",
- }, {
- e: ISO8859_16,
- encoded: "H\xe6ll\xbd",
- utf8: "Hællœ",
- }, {
- e: KOI8R,
- encoded: "He\x93\xad\x9c",
- utf8: "He⌠╜°",
- }, {
- e: KOI8U,
- encoded: "He\x93\xad\x9c",
- utf8: "He⌠ґ°",
- }, {
- e: Macintosh,
- encoded: "He\xdf\xd7",
- utf8: "Hefl◊",
- }, {
- e: MacintoshCyrillic,
- encoded: "He\xbe\x94",
- utf8: "HeЊФ",
- }, {
- e: Windows874,
- encoded: "He\xb7\xf0",
- utf8: "Heท๐",
- }, {
- e: Windows1250,
- encoded: "He\xe5\xe5o",
- utf8: "Heĺĺo",
- }, {
- e: Windows1251,
- encoded: "H\xball\xfe",
- utf8: "Hєllю",
- }, {
- e: Windows1252,
- encoded: "H\xe9ll\xf4 \xa5\xbA\xae\xa3\xd0",
- utf8: "Héllô ¥º®£Ð",
- }, {
- e: Windows1253,
- encoded: "H\xe5ll\xd6",
- utf8: "HεllΦ",
- }, {
- e: Windows1254,
- encoded: "\xd0ello",
- utf8: "Ğello",
- }, {
- e: Windows1255,
- encoded: "He\xd4o",
- utf8: "Heװo",
- }, {
- e: Windows1256,
- encoded: "H\xdbllo",
- utf8: "Hغllo",
- }, {
- e: Windows1257,
- encoded: "He\xeflo",
- utf8: "Heļlo",
- }, {
- e: Windows1258,
- encoded: "Hell\xf5",
- utf8: "Hellơ",
- }, {
- e: XUserDefined,
- encoded: "\x00\x40\x7f\x80\xab\xff",
- utf8: "\u0000\u0040\u007f\uf780\uf7ab\uf7ff",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, "", "")
- }
-}
-
-var windows1255TestCases = []struct {
- b byte
- ok bool
- r rune
-}{
- {'\x00', true, '\u0000'},
- {'\x1a', true, '\u001a'},
- {'\x61', true, '\u0061'},
- {'\x7f', true, '\u007f'},
- {'\x80', true, '\u20ac'},
- {'\x95', true, '\u2022'},
- {'\xa0', true, '\u00a0'},
- {'\xc0', true, '\u05b0'},
- {'\xfc', true, '\ufffd'},
- {'\xfd', true, '\u200e'},
- {'\xfe', true, '\u200f'},
- {'\xff', true, '\ufffd'},
- {encoding.ASCIISub, false, '\u0400'},
- {encoding.ASCIISub, false, '\u2603'},
- {encoding.ASCIISub, false, '\U0001f4a9'},
-}
-
-func TestDecodeByte(t *testing.T) {
- for _, tc := range windows1255TestCases {
- if !tc.ok {
- continue
- }
-
- got := Windows1255.DecodeByte(tc.b)
- want := tc.r
- if got != want {
- t.Errorf("DecodeByte(%#02x): got %#08x, want %#08x", tc.b, got, want)
- }
- }
-}
-
-func TestEncodeRune(t *testing.T) {
- for _, tc := range windows1255TestCases {
- // There can be multiple tc.b values that map to tc.r = '\ufffd'.
- if tc.r == '\ufffd' {
- continue
- }
-
- gotB, gotOK := Windows1255.EncodeRune(tc.r)
- wantB, wantOK := tc.b, tc.ok
- if gotB != wantB || gotOK != wantOK {
- t.Errorf("EncodeRune(%#08x): got (%#02x, %t), want (%#02x, %t)", tc.r, gotB, gotOK, wantB, wantOK)
- }
- }
-}
-
-func TestFiles(t *testing.T) { enctest.TestFile(t, Windows1252) }
-
-func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, Windows1252) }
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/encoding_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/encoding_test.go
deleted file mode 100644
index 1738147622c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/encoding_test.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package encoding_test
-
-import (
- "io/ioutil"
- "strings"
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/charmap"
- "golang.org/x/text/transform"
-)
-
-func TestEncodeInvalidUTF8(t *testing.T) {
- inputs := []string{
- "hello.",
- "wo\ufffdld.",
- "ABC\xff\x80\x80", // Invalid UTF-8.
- "\x80\x80\x80\x80\x80",
- "\x80\x80D\x80\x80", // Valid rune at "D".
- "E\xed\xa0\x80\xed\xbf\xbfF", // Two invalid UTF-8 runes (surrogates).
- "G",
- "H\xe2\x82", // U+20AC in UTF-8 is "\xe2\x82\xac", which we split over two
- "\xacI\xe2\x82", // input lines. It maps to 0x80 in the Windows-1252 encoding.
- }
- // Each invalid source byte becomes '\x1a'.
- want := strings.Replace("hello.wo?ld.ABC??????????D??E??????FGH\x80I??", "?", "\x1a", -1)
-
- transformer := encoding.ReplaceUnsupported(charmap.Windows1252.NewEncoder())
- gotBuf := make([]byte, 0, 1024)
- src := make([]byte, 0, 1024)
- for i, input := range inputs {
- dst := make([]byte, 1024)
- src = append(src, input...)
- atEOF := i == len(inputs)-1
- nDst, nSrc, err := transformer.Transform(dst, src, atEOF)
- gotBuf = append(gotBuf, dst[:nDst]...)
- src = src[nSrc:]
- if err != nil && err != transform.ErrShortSrc {
- t.Fatalf("i=%d: %v", i, err)
- }
- if atEOF && err != nil {
- t.Fatalf("i=%d: atEOF: %v", i, err)
- }
- }
- if got := string(gotBuf); got != want {
- t.Fatalf("\ngot %+q\nwant %+q", got, want)
- }
-}
-
-func TestReplacement(t *testing.T) {
- for _, direction := range []string{"Decode", "Encode"} {
- enc, want := (transform.Transformer)(nil), ""
- if direction == "Decode" {
- enc = encoding.Replacement.NewDecoder()
- want = "\ufffd"
- } else {
- enc = encoding.Replacement.NewEncoder()
- want = "AB\x00CD\ufffdYZ"
- }
- sr := strings.NewReader("AB\x00CD\x80YZ")
- g, err := ioutil.ReadAll(transform.NewReader(sr, enc))
- if err != nil {
- t.Errorf("%s: ReadAll: %v", direction, err)
- continue
- }
- if got := string(g); got != want {
- t.Errorf("%s:\ngot %q\nwant %q", direction, got, want)
- continue
- }
- }
-}
-
-func TestUTF8Validator(t *testing.T) {
- testCases := []struct {
- desc string
- dstSize int
- src string
- atEOF bool
- want string
- wantErr error
- }{
- {
- "empty input",
- 100,
- "",
- false,
- "",
- nil,
- },
- {
- "valid 1-byte 1-rune input",
- 100,
- "a",
- false,
- "a",
- nil,
- },
- {
- "valid 3-byte 1-rune input",
- 100,
- "\u1234",
- false,
- "\u1234",
- nil,
- },
- {
- "valid 5-byte 3-rune input",
- 100,
- "a\u0100\u0101",
- false,
- "a\u0100\u0101",
- nil,
- },
- {
- "perfectly sized dst (non-ASCII)",
- 5,
- "a\u0100\u0101",
- false,
- "a\u0100\u0101",
- nil,
- },
- {
- "short dst (non-ASCII)",
- 4,
- "a\u0100\u0101",
- false,
- "a\u0100",
- transform.ErrShortDst,
- },
- {
- "perfectly sized dst (ASCII)",
- 5,
- "abcde",
- false,
- "abcde",
- nil,
- },
- {
- "short dst (ASCII)",
- 4,
- "abcde",
- false,
- "abcd",
- transform.ErrShortDst,
- },
- {
- "partial input (!EOF)",
- 100,
- "a\u0100\xf1",
- false,
- "a\u0100",
- transform.ErrShortSrc,
- },
- {
- "invalid input (EOF)",
- 100,
- "a\u0100\xf1",
- true,
- "a\u0100",
- encoding.ErrInvalidUTF8,
- },
- {
- "invalid input (!EOF)",
- 100,
- "a\u0100\x80",
- false,
- "a\u0100",
- encoding.ErrInvalidUTF8,
- },
- {
- "invalid input (above U+10FFFF)",
- 100,
- "a\u0100\xf7\xbf\xbf\xbf",
- false,
- "a\u0100",
- encoding.ErrInvalidUTF8,
- },
- {
- "invalid input (surrogate half)",
- 100,
- "a\u0100\xed\xa0\x80",
- false,
- "a\u0100",
- encoding.ErrInvalidUTF8,
- },
- }
- for _, tc := range testCases {
- dst := make([]byte, tc.dstSize)
- nDst, nSrc, err := encoding.UTF8Validator.Transform(dst, []byte(tc.src), tc.atEOF)
- if nDst < 0 || len(dst) < nDst {
- t.Errorf("%s: nDst=%d out of range", tc.desc, nDst)
- continue
- }
- got := string(dst[:nDst])
- if got != tc.want || nSrc != len(tc.want) || err != tc.wantErr {
- t.Errorf("%s:\ngot %+q, %d, %v\nwant %+q, %d, %v",
- tc.desc, got, nSrc, err, tc.want, len(tc.want), tc.wantErr)
- continue
- }
- }
-}
-
-func TestErrorHandler(t *testing.T) {
- testCases := []struct {
- desc string
- handler func(*encoding.Encoder) *encoding.Encoder
- sizeDst int
- src, want string
- nSrc int
- err error
- }{
- {
- desc: "one rune replacement",
- handler: encoding.ReplaceUnsupported,
- sizeDst: 100,
- src: "\uAC00",
- want: "\x1a",
- nSrc: 3,
- },
- {
- desc: "mid-stream rune replacement",
- handler: encoding.ReplaceUnsupported,
- sizeDst: 100,
- src: "a\uAC00bcd\u00e9",
- want: "a\x1abcd\xe9",
- nSrc: 9,
- },
- {
- desc: "at end rune replacement",
- handler: encoding.ReplaceUnsupported,
- sizeDst: 10,
- src: "\u00e9\uAC00",
- want: "\xe9\x1a",
- nSrc: 5,
- },
- {
- desc: "short buffer replacement",
- handler: encoding.ReplaceUnsupported,
- sizeDst: 1,
- src: "\u00e9\uAC00",
- want: "\xe9",
- nSrc: 2,
- err: transform.ErrShortDst,
- },
- {
- desc: "one rune html escape",
- handler: encoding.HTMLEscapeUnsupported,
- sizeDst: 100,
- src: "\uAC00",
- want: "&#44032;",
- nSrc: 3,
- },
- {
- desc: "mid-stream html escape",
- handler: encoding.HTMLEscapeUnsupported,
- sizeDst: 100,
- src: "\u00e9\uAC00dcba",
- want: "\xe9&#44032;dcba",
- nSrc: 9,
- },
- {
- desc: "short buffer html escape",
- handler: encoding.HTMLEscapeUnsupported,
- sizeDst: 9,
- src: "ab\uAC01",
- want: "ab",
- nSrc: 2,
- err: transform.ErrShortDst,
- },
- }
- for i, tc := range testCases {
- tr := tc.handler(charmap.Windows1250.NewEncoder())
- b := make([]byte, tc.sizeDst)
- nDst, nSrc, err := tr.Transform(b, []byte(tc.src), true)
- if err != tc.err {
- t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err)
- }
- if got := string(b[:nDst]); got != tc.want {
- t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want)
- }
- if nSrc != tc.nSrc {
- t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc)
- }
-
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/example_test.go
deleted file mode 100644
index 4f923530f07..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/example_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package encoding_test
-
-import (
- "fmt"
- "io"
- "os"
- "strings"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/charmap"
- "golang.org/x/text/encoding/unicode"
- "golang.org/x/text/transform"
-)
-
-func ExampleDecodeWindows1252() {
- sr := strings.NewReader("Gar\xe7on !")
- tr := charmap.Windows1252.NewDecoder().Reader(sr)
- io.Copy(os.Stdout, tr)
- // Output: Garçon !
-}
-
-func ExampleUTF8Validator() {
- for i := 0; i < 2; i++ {
- var transformer transform.Transformer
- transformer = unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewEncoder()
- if i == 1 {
- transformer = transform.Chain(encoding.UTF8Validator, transformer)
- }
- dst := make([]byte, 256)
- src := []byte("abc\xffxyz") // src is invalid UTF-8.
- nDst, nSrc, err := transformer.Transform(dst, src, true)
- fmt.Printf("i=%d: produced %q, consumed %q, error %v\n",
- i, dst[:nDst], src[:nSrc], err)
- }
- // Output:
- // i=0: produced "\x00a\x00b\x00c\xff\xfd\x00x\x00y\x00z", consumed "abc\xffxyz", error <nil>
- // i=1: produced "\x00a\x00b\x00c", consumed "abc", error encoding: invalid UTF-8
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go
deleted file mode 100644
index 3fdab0f49d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package htmlindex
-
-import (
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/charmap"
- "golang.org/x/text/encoding/internal/identifier"
- "golang.org/x/text/encoding/unicode"
- "golang.org/x/text/language"
-)
-
-func TestGet(t *testing.T) {
- for i, tc := range []struct {
- name string
- canonical string
- err error
- }{
- {"utf-8", "utf-8", nil},
- {" utf-8 ", "utf-8", nil},
- {" l5 ", "windows-1254", nil},
- {"latin5 ", "windows-1254", nil},
- {"latin 5", "", errInvalidName},
- {"latin-5", "", errInvalidName},
- } {
- enc, err := Get(tc.name)
- if err != tc.err {
- t.Errorf("%d: error was %v; want %v", i, err, tc.err)
- }
- if err != nil {
- continue
- }
- if got, err := Name(enc); got != tc.canonical {
- t.Errorf("%d: Name(Get(%q)) = %q; want %q (%v)", i, tc.name, got, tc.canonical, err)
- }
- }
-}
-
-func TestTables(t *testing.T) {
- for name, index := range nameMap {
- got, err := Get(name)
- if err != nil {
- t.Errorf("%s:err: expected non-nil error", name)
- }
- if want := encodings[index]; got != want {
- t.Errorf("%s:encoding: got %v; want %v", name, got, want)
- }
- mib, _ := got.(identifier.Interface).ID()
- if mibMap[mib] != index {
- t.Errorf("%s:mibMab: got %d; want %d", name, mibMap[mib], index)
- }
- }
-}
-
-func TestName(t *testing.T) {
- for i, tc := range []struct {
- desc string
- enc encoding.Encoding
- name string
- err error
- }{{
- "defined encoding",
- charmap.ISO8859_2,
- "iso-8859-2",
- nil,
- }, {
- "defined Unicode encoding",
- unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM),
- "utf-16be",
- nil,
- }, {
- "undefined Unicode encoding in HTML standard",
- unicode.UTF16(unicode.BigEndian, unicode.UseBOM),
- "",
- errUnsupported,
- }, {
- "undefined other encoding in HTML standard",
- charmap.CodePage437,
- "",
- errUnsupported,
- }, {
- "unknown encoding",
- encoding.Nop,
- "",
- errUnknown,
- }} {
- name, err := Name(tc.enc)
- if name != tc.name || err != tc.err {
- t.Errorf("%d:%s: got %q, %v; want %q, %v", i, tc.desc, name, err, tc.name, tc.err)
- }
- }
-}
-
-func TestLanguageDefault(t *testing.T) {
- for _, tc := range []struct{ tag, want string }{
- {"und", "windows-1252"}, // The default value.
- {"ar", "windows-1256"},
- {"ba", "windows-1251"},
- {"be", "windows-1251"},
- {"bg", "windows-1251"},
- {"cs", "windows-1250"},
- {"el", "iso-8859-7"},
- {"et", "windows-1257"},
- {"fa", "windows-1256"},
- {"he", "windows-1255"},
- {"hr", "windows-1250"},
- {"hu", "iso-8859-2"},
- {"ja", "shift_jis"},
- {"kk", "windows-1251"},
- {"ko", "euc-kr"},
- {"ku", "windows-1254"},
- {"ky", "windows-1251"},
- {"lt", "windows-1257"},
- {"lv", "windows-1257"},
- {"mk", "windows-1251"},
- {"pl", "iso-8859-2"},
- {"ru", "windows-1251"},
- {"sah", "windows-1251"},
- {"sk", "windows-1250"},
- {"sl", "iso-8859-2"},
- {"sr", "windows-1251"},
- {"tg", "windows-1251"},
- {"th", "windows-874"},
- {"tr", "windows-1254"},
- {"tt", "windows-1251"},
- {"uk", "windows-1251"},
- {"vi", "windows-1258"},
- {"zh-hans", "gb18030"},
- {"zh-hant", "big5"},
- // Variants and close approximates of the above.
- {"ar_EG", "windows-1256"},
- {"bs", "windows-1250"}, // Bosnian Latin maps to Croatian.
- // Use default fallback in case of miss.
- {"nl", "windows-1252"},
- } {
- if got := LanguageDefault(language.MustParse(tc.tag)); got != tc.want {
- t.Errorf("LanguageDefault(%s) = %s; want %s", tc.tag, got, tc.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/example_test.go
deleted file mode 100644
index e2a3a7ef6a8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/example_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ianaindex_test
-
-import (
- "fmt"
-
- "golang.org/x/text/encoding/charmap"
- "golang.org/x/text/encoding/ianaindex"
-)
-
-func ExampleIndex() {
- fmt.Println(ianaindex.MIME.Name(charmap.ISO8859_7))
- fmt.Println(ianaindex.IANA.Name(charmap.ISO8859_7))
- fmt.Println(ianaindex.MIB.Name(charmap.ISO8859_7))
-
- e, _ := ianaindex.IANA.Encoding("cp437")
- fmt.Println(ianaindex.IANA.Name(e))
-
- // Output:
- // ISO-8859-7 <nil>
- // ISO_8859-7:1987 <nil>
- // ISOLatinGreek <nil>
- // IBM437 <nil>
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go
deleted file mode 100644
index 20a2131f4c8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ianaindex
-
-import (
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/charmap"
- "golang.org/x/text/encoding/internal/identifier"
- "golang.org/x/text/encoding/japanese"
- "golang.org/x/text/encoding/korean"
- "golang.org/x/text/encoding/simplifiedchinese"
- "golang.org/x/text/encoding/traditionalchinese"
- "golang.org/x/text/encoding/unicode"
-)
-
-var All = [][]encoding.Encoding{
- unicode.All,
- charmap.All,
- japanese.All,
- korean.All,
- simplifiedchinese.All,
- traditionalchinese.All,
-}
-
-// TestAllIANA tests whether an Encoding supported in x/text is defined by IANA but
-// not supported by this package.
-func TestAllIANA(t *testing.T) {
- for _, ea := range All {
- for _, e := range ea {
- mib, _ := e.(identifier.Interface).ID()
- if x := findMIB(ianaToMIB, mib); x != -1 && encodings[x] == nil {
- t.Errorf("supported MIB %v (%v) not in index", mib, e)
- }
- }
- }
-}
-
-// TestNotSupported reports the encodings in IANA, but not by x/text.
-func TestNotSupported(t *testing.T) {
- mibs := map[identifier.MIB]bool{}
- for _, ea := range All {
- for _, e := range ea {
- mib, _ := e.(identifier.Interface).ID()
- mibs[mib] = true
- }
- }
-
- // Many encodings in the IANA index will likely not be suppored by the
- // Go encodings. That is fine.
- // TODO: consider wheter we should add this test.
- // for code, mib := range ianaToMIB {
- // t.Run(fmt.Sprint("IANA:", mib), func(t *testing.T) {
- // if !mibs[mib] {
- // t.Skipf("IANA encoding %s (MIB %v) not supported",
- // ianaNames[code], mib)
- // }
- // })
- // }
-}
-
-func TestEncoding(t *testing.T) {
- testCases := []struct {
- index *Index
- name string
- canonical string
- err error
- }{
- {MIME, "utf-8", "UTF-8", nil},
- {MIME, " utf-8 ", "UTF-8", nil},
- {MIME, " l5 ", "ISO-8859-9", nil},
- {MIME, "latin5 ", "ISO-8859-9", nil},
- {MIME, "LATIN5 ", "ISO-8859-9", nil},
- {MIME, "latin 5", "", errInvalidName},
- {MIME, "latin-5", "", errInvalidName},
-
- {IANA, "utf-8", "UTF-8", nil},
- {IANA, " utf-8 ", "UTF-8", nil},
- {IANA, " l5 ", "ISO_8859-9:1989", nil},
- {IANA, "latin5 ", "ISO_8859-9:1989", nil},
- {IANA, "LATIN5 ", "ISO_8859-9:1989", nil},
- {IANA, "latin 5", "", errInvalidName},
- {IANA, "latin-5", "", errInvalidName},
-
- {MIB, "utf-8", "UTF8", nil},
- {MIB, " utf-8 ", "UTF8", nil},
- {MIB, " l5 ", "ISOLatin5", nil},
- {MIB, "latin5 ", "ISOLatin5", nil},
- {MIB, "LATIN5 ", "ISOLatin5", nil},
- {MIB, "latin 5", "", errInvalidName},
- {MIB, "latin-5", "", errInvalidName},
- }
- for i, tc := range testCases {
- enc, err := tc.index.Encoding(tc.name)
- if err != tc.err {
- t.Errorf("%d: error was %v; want %v", i, err, tc.err)
- }
- if err != nil {
- continue
- }
- if got, err := tc.index.Name(enc); got != tc.canonical {
- t.Errorf("%d: Name(Encoding(%q)) = %q; want %q (%v)", i, tc.name, got, tc.canonical, err)
- }
- }
-}
-
-func TestTables(t *testing.T) {
- for i, x := range []*Index{MIME, IANA} {
- for name, index := range x.alias {
- got, err := x.Encoding(name)
- if err != nil {
- t.Errorf("%d%s:err: unexpected error %v", i, name, err)
- }
- if want := x.enc[index]; got != want {
- t.Errorf("%d%s:encoding: got %v; want %v", i, name, got, want)
- }
- if got != nil {
- mib, _ := got.(identifier.Interface).ID()
- if i := findMIB(x.toMIB, mib); i != index {
- t.Errorf("%d%s:mib: got %d; want %d", i, name, i, index)
- }
- }
- }
- }
-}
-
-type unsupported struct {
- encoding.Encoding
-}
-
-func (unsupported) ID() (identifier.MIB, string) { return 9999, "" }
-
-func TestName(t *testing.T) {
- testCases := []struct {
- desc string
- enc encoding.Encoding
- f func(e encoding.Encoding) (string, error)
- name string
- err error
- }{{
- "defined encoding",
- charmap.ISO8859_2,
- MIME.Name,
- "ISO-8859-2",
- nil,
- }, {
- "defined Unicode encoding",
- unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM),
- IANA.Name,
- "UTF-16BE",
- nil,
- }, {
- "another defined Unicode encoding",
- unicode.UTF16(unicode.BigEndian, unicode.UseBOM),
- MIME.Name,
- "UTF-16",
- nil,
- }, {
- "unknown Unicode encoding",
- unicode.UTF16(unicode.BigEndian, unicode.ExpectBOM),
- MIME.Name,
- "",
- errUnknown,
- }, {
- "undefined encoding",
- unsupported{},
- MIME.Name,
- "",
- errUnsupported,
- }, {
- "undefined other encoding in HTML standard",
- charmap.CodePage437,
- IANA.Name,
- "IBM437",
- nil,
- }, {
- "unknown encoding",
- encoding.Nop,
- IANA.Name,
- "",
- errUnknown,
- }}
- for i, tc := range testCases {
- name, err := tc.f(tc.enc)
- if name != tc.name || err != tc.err {
- t.Errorf("%d:%s: got %q, %v; want %q, %v", i, tc.desc, name, err, tc.name, tc.err)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/japanese/all_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/japanese/all_test.go
deleted file mode 100644
index 9cffe10dc19..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/japanese/all_test.go
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package japanese
-
-import (
- "fmt"
- "strings"
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Decode", e.NewDecoder(), nil
-}
-func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement
-}
-
-func TestNonRepertoire(t *testing.T) {
- // Pick n to cause the destination buffer in transform.String to overflow.
- const n = 100
- long := strings.Repeat(".", n)
- testCases := []struct {
- init func(e encoding.Encoding) (string, transform.Transformer, error)
- e encoding.Encoding
- src, want string
- }{
- {enc, EUCJP, "갂", ""},
- {enc, EUCJP, "a갂", "a"},
- {enc, EUCJP, "丌갂", "\x8f\xb0\xa4"},
-
- {enc, ISO2022JP, "갂", ""},
- {enc, ISO2022JP, "a갂", "a"},
- {enc, ISO2022JP, "朗갂", "\x1b$BzF\x1b(B"}, // switch back to ASCII mode at end
-
- {enc, ShiftJIS, "갂", ""},
- {enc, ShiftJIS, "a갂", "a"},
- {enc, ShiftJIS, "\u2190갂", "\x81\xa9"},
-
- // Continue correctly after errors
- {dec, EUCJP, "\x8e\xa0", "\ufffd\ufffd"},
- {dec, EUCJP, "\x8e\xe0", "\ufffd"},
- {dec, EUCJP, "\x8e\xff", "\ufffd\ufffd"},
- {dec, EUCJP, "\x8ea", "\ufffda"},
- {dec, EUCJP, "\x8f\xa0", "\ufffd\ufffd"},
- {dec, EUCJP, "\x8f\xa1\xa0", "\ufffd\ufffd"},
- {dec, EUCJP, "\x8f\xa1a", "\ufffda"},
- {dec, EUCJP, "\x8f\xa1a", "\ufffda"},
- {dec, EUCJP, "\x8f\xa1a", "\ufffda"},
- {dec, EUCJP, "\x8f\xa2\xa2", "\ufffd"},
- {dec, EUCJP, "\xfe", "\ufffd"},
- {dec, EUCJP, "\xfe\xfc", "\ufffd"},
- {dec, EUCJP, "\xfe\xff", "\ufffd\ufffd"},
- // Correct handling of end of source
- {dec, EUCJP, strings.Repeat("\x8e", n), strings.Repeat("\ufffd", n)},
- {dec, EUCJP, strings.Repeat("\x8f", n), strings.Repeat("\ufffd", n)},
- {dec, EUCJP, strings.Repeat("\x8f\xa0", n), strings.Repeat("\ufffd", 2*n)},
- {dec, EUCJP, "a" + strings.Repeat("\x8f\xa1", n), "a" + strings.Repeat("\ufffd", n)},
- {dec, EUCJP, "a" + strings.Repeat("\x8f\xa1\xff", n), "a" + strings.Repeat("\ufffd", 2*n)},
-
- // Continue correctly after errors
- {dec, ShiftJIS, "\x80", "\u0080"}, // It's what the spec says.
- {dec, ShiftJIS, "\x81", "\ufffd"},
- {dec, ShiftJIS, "\x81\x7f", "\ufffd\u007f"},
- {dec, ShiftJIS, "\xe0", "\ufffd"},
- {dec, ShiftJIS, "\xe0\x39", "\ufffd\u0039"},
- {dec, ShiftJIS, "\xe0\x9f", "燹"},
- {dec, ShiftJIS, "\xe0\xfd", "\ufffd"},
- {dec, ShiftJIS, "\xef\xfc", "\ufffd"},
- {dec, ShiftJIS, "\xfc\xfc", "\ufffd"},
- {dec, ShiftJIS, "\xfc\xfd", "\ufffd"},
- {dec, ShiftJIS, "\xfdaa", "\ufffdaa"},
-
- {dec, ShiftJIS, strings.Repeat("\x81\x81", n), strings.Repeat("=", n)},
- {dec, ShiftJIS, strings.Repeat("\xe0\xfd", n), strings.Repeat("\ufffd", n)},
- {dec, ShiftJIS, "a" + strings.Repeat("\xe0\xfd", n), "a" + strings.Repeat("\ufffd", n)},
-
- {dec, ISO2022JP, "\x1b$", "\ufffd$"},
- {dec, ISO2022JP, "\x1b(", "\ufffd("},
- {dec, ISO2022JP, "\x1b@", "\ufffd@"},
- {dec, ISO2022JP, "\x1bZ", "\ufffdZ"},
- // incomplete escapes
- {dec, ISO2022JP, "\x1b$", "\ufffd$"},
- {dec, ISO2022JP, "\x1b$J.", "\ufffd$J."}, // illegal
- {dec, ISO2022JP, "\x1b$B.", "\ufffd"}, // JIS208
- {dec, ISO2022JP, "\x1b$(", "\ufffd$("}, // JIS212
- {dec, ISO2022JP, "\x1b$(..", "\ufffd$(.."}, // JIS212
- {dec, ISO2022JP, "\x1b$(" + long, "\ufffd$(" + long}, // JIS212
- {dec, ISO2022JP, "\x1b$(D.", "\ufffd"}, // JIS212
- {dec, ISO2022JP, "\x1b$(D..", "\ufffd"}, // JIS212
- {dec, ISO2022JP, "\x1b$(D...", "\ufffd\ufffd"}, // JIS212
- {dec, ISO2022JP, "\x1b(B.", "."}, // ascii
- {dec, ISO2022JP, "\x1b(B..", ".."}, // ascii
- {dec, ISO2022JP, "\x1b(J.", "."}, // roman
- {dec, ISO2022JP, "\x1b(J..", ".."}, // roman
- {dec, ISO2022JP, "\x1b(I\x20", "\ufffd"}, // katakana
- {dec, ISO2022JP, "\x1b(I\x20\x20", "\ufffd\ufffd"}, // katakana
- // recover to same state
- {dec, ISO2022JP, "\x1b(B\x1b.", "\ufffd."},
- {dec, ISO2022JP, "\x1b(I\x1b.", "\ufffdョ"},
- {dec, ISO2022JP, "\x1b(I\x1b$.", "\ufffd、ョ"},
- {dec, ISO2022JP, "\x1b(I\x1b(.", "\ufffdィョ"},
- {dec, ISO2022JP, "\x1b$B\x7e\x7e", "\ufffd"},
- {dec, ISO2022JP, "\x1b$@\x0a.", "\x0a."},
- {dec, ISO2022JP, "\x1b$B\x0a.", "\x0a."},
- {dec, ISO2022JP, "\x1b$(D\x0a.", "\x0a."},
- {dec, ISO2022JP, "\x1b$(D\x7e\x7e", "\ufffd"},
- {dec, ISO2022JP, "\x80", "\ufffd"},
-
- // TODO: according to https://encoding.spec.whatwg.org/#iso-2022-jp,
- // these should all be correct.
- // {dec, ISO2022JP, "\x1b(B\x0E", "\ufffd"},
- // {dec, ISO2022JP, "\x1b(B\x0F", "\ufffd"},
- {dec, ISO2022JP, "\x1b(B\x5C", "\u005C"},
- {dec, ISO2022JP, "\x1b(B\x7E", "\u007E"},
- // {dec, ISO2022JP, "\x1b(J\x0E", "\ufffd"},
- // {dec, ISO2022JP, "\x1b(J\x0F", "\ufffd"},
- // {dec, ISO2022JP, "\x1b(J\x5C", "\u00A5"},
- // {dec, ISO2022JP, "\x1b(J\x7E", "\u203E"},
- }
- for _, tc := range testCases {
- dir, tr, wantErr := tc.init(tc.e)
- t.Run(fmt.Sprintf("%s/%v/%q", dir, tc.e, tc.src), func(t *testing.T) {
- dst := make([]byte, 100000)
- src := []byte(tc.src)
- for i := 0; i <= len(tc.src); i++ {
- nDst, nSrc, err := tr.Transform(dst, src[:i], false)
- if err != nil && err != transform.ErrShortSrc && err != wantErr {
- t.Fatalf("error on first call to Transform: %v", err)
- }
- n, _, err := tr.Transform(dst[nDst:], src[nSrc:], true)
- nDst += n
- if err != wantErr {
- t.Fatalf("(%q|%q): got %v; want %v", tc.src[:i], tc.src[i:], err, wantErr)
- }
- if got := string(dst[:nDst]); got != tc.want {
- t.Errorf("(%q|%q):\ngot %q\nwant %q", tc.src[:i], tc.src[i:], got, tc.want)
- }
- }
- })
- }
-}
-
-func TestCorrect(t *testing.T) {
- testCases := []struct {
- init func(e encoding.Encoding) (string, transform.Transformer, error)
- e encoding.Encoding
- src, want string
- }{
- {dec, ShiftJIS, "\x9f\xfc", "滌"},
- {dec, ShiftJIS, "\xfb\xfc", "髙"},
- {dec, ShiftJIS, "\xfa\xb1", "﨑"},
- {enc, ShiftJIS, "滌", "\x9f\xfc"},
- {enc, ShiftJIS, "﨑", "\xed\x95"},
- }
- for _, tc := range testCases {
- dir, tr, _ := tc.init(tc.e)
-
- dst, _, err := transform.String(tr, tc.src)
- if err != nil {
- t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, nil)
- }
- if got := string(dst); got != tc.want {
- t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want)
- }
- }
-}
-
-func TestBasics(t *testing.T) {
- // The encoded forms can be verified by the iconv program:
- // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd
- testCases := []struct {
- e encoding.Encoding
- encPrefix string
- encSuffix string
- encoded string
- utf8 string
- }{{
- // "A。カ゚ 0208: etc 0212: etc" is a nonsense string that contains ASCII, half-width
- // kana, JIS X 0208 (including two near the kink in the Shift JIS second byte
- // encoding) and JIS X 0212 encodable codepoints.
- //
- // "月日は百代の過客にして、行かふ年も又旅人也。" is from the 17th century poem
- // "Oku no Hosomichi" and contains both hiragana and kanji.
- e: EUCJP,
- encoded: "A\x8e\xa1\x8e\xb6\x8e\xdf " +
- "0208: \xa1\xa1\xa1\xa2\xa1\xdf\xa1\xe0\xa1\xfd\xa1\xfe\xa2\xa1\xa2\xa2\xf4\xa6 " +
- "0212: \x8f\xa2\xaf\x8f\xed\xe3",
- utf8: "A。カ゚ " +
- "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199 " +
- "0212: \u02d8\u9fa5",
- }, {
- e: EUCJP,
- encoded: "\xb7\xee\xc6\xfc\xa4\xcf\xc9\xb4\xc2\xe5\xa4\xce\xb2\xe1\xb5\xd2" +
- "\xa4\xcb\xa4\xb7\xa4\xc6\xa1\xa2\xb9\xd4\xa4\xab\xa4\xd5\xc7\xaf" +
- "\xa4\xe2\xcb\xf4\xce\xb9\xbf\xcd\xcc\xe9\xa1\xa3",
- utf8: "月日は百代の過客にして、行かふ年も又旅人也。",
- }, {
- e: ISO2022JP,
- encSuffix: "\x1b\x28\x42",
- encoded: "\x1b\x28\x49\x21\x36\x5f\x1b\x28\x42 " +
- "0208: \x1b\x24\x42\x21\x21\x21\x22\x21\x5f\x21\x60\x21\x7d\x21\x7e\x22\x21\x22\x22\x74\x26",
- utf8: "。カ゚ " +
- "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199",
- }, {
- e: ISO2022JP,
- encPrefix: "\x1b\x24\x42",
- encSuffix: "\x1b\x28\x42",
- encoded: "\x37\x6e\x46\x7c\x24\x4f\x49\x34\x42\x65\x24\x4e\x32\x61\x35\x52" +
- "\x24\x4b\x24\x37\x24\x46\x21\x22\x39\x54\x24\x2b\x24\x55\x47\x2f" +
- "\x24\x62\x4b\x74\x4e\x39\x3f\x4d\x4c\x69\x21\x23",
- utf8: "月日は百代の過客にして、行かふ年も又旅人也。",
- }, {
- e: ShiftJIS,
- encoded: "A\xa1\xb6\xdf " +
- "0208: \x81\x40\x81\x41\x81\x7e\x81\x80\x81\x9d\x81\x9e\x81\x9f\x81\xa0\xea\xa4",
- utf8: "A。カ゚ " +
- "0208: \u3000\u3001\u00d7\u00f7\u25ce\u25c7\u25c6\u25a1\u7199",
- }, {
- e: ShiftJIS,
- encoded: "\x8c\x8e\x93\xfa\x82\xcd\x95\x53\x91\xe3\x82\xcc\x89\xdf\x8b\x71" +
- "\x82\xc9\x82\xb5\x82\xc4\x81\x41\x8d\x73\x82\xa9\x82\xd3\x94\x4e" +
- "\x82\xe0\x96\x94\x97\xb7\x90\x6c\x96\xe7\x81\x42",
- utf8: "月日は百代の過客にして、行かふ年も又旅人也。",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, tc.encSuffix)
- }
-}
-
-func TestFiles(t *testing.T) {
- enctest.TestFile(t, EUCJP)
- enctest.TestFile(t, ISO2022JP)
- enctest.TestFile(t, ShiftJIS)
-}
-
-func BenchmarkEncoding(b *testing.B) {
- enctest.Benchmark(b, EUCJP)
- enctest.Benchmark(b, ISO2022JP)
- enctest.Benchmark(b, ShiftJIS)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/korean/all_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/korean/all_test.go
deleted file mode 100644
index 8225ce62a8c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/korean/all_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package korean
-
-import (
- "strings"
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Decode", e.NewDecoder(), nil
-}
-func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement
-}
-
-func TestNonRepertoire(t *testing.T) {
- // Pick n large enough to cause an overflow in the destination buffer of
- // transform.String.
- const n = 10000
- testCases := []struct {
- init func(e encoding.Encoding) (string, transform.Transformer, error)
- e encoding.Encoding
- src, want string
- }{
- {dec, EUCKR, "\xfe\xfe", "\ufffd"},
- // {dec, EUCKR, "א", "\ufffd"}, // TODO: why is this different?
-
- {enc, EUCKR, "א", ""},
- {enc, EUCKR, "aא", "a"},
- {enc, EUCKR, "\uac00א", "\xb0\xa1"},
- // TODO: should we also handle Jamo?
-
- {dec, EUCKR, "\x80", "\ufffd"},
- {dec, EUCKR, "\xff", "\ufffd"},
- {dec, EUCKR, "\x81", "\ufffd"},
- {dec, EUCKR, "\xb0\x40", "\ufffd@"},
- {dec, EUCKR, "\xb0\xff", "\ufffd"},
- {dec, EUCKR, "\xd0\x20", "\ufffd "},
- {dec, EUCKR, "\xd0\xff", "\ufffd"},
-
- {dec, EUCKR, strings.Repeat("\x81", n), strings.Repeat("걖", n/2)},
- }
- for _, tc := range testCases {
- dir, tr, wantErr := tc.init(tc.e)
-
- dst, _, err := transform.String(tr, tc.src)
- if err != wantErr {
- t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr)
- }
- if got := string(dst); got != tc.want {
- t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want)
- }
- }
-}
-
-func TestBasics(t *testing.T) {
- // The encoded forms can be verified by the iconv program:
- // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd
- testCases := []struct {
- e encoding.Encoding
- encoded string
- utf8 string
- }{{
- // Korean tests.
- //
- // "A\uac02\uac35\uac56\ud401B\ud408\ud620\ud624C\u4f3d\u8a70D" is a
- // nonsense string that contains ASCII, Hangul and CJK ideographs.
- //
- // "세계야, 안녕" translates as "Hello, world".
- e: EUCKR,
- encoded: "A\x81\x41\x81\x61\x81\x81\xc6\xfeB\xc7\xa1\xc7\xfe\xc8\xa1C\xca\xa1\xfd\xfeD",
- utf8: "A\uac02\uac35\uac56\ud401B\ud408\ud620\ud624C\u4f3d\u8a70D",
- }, {
- e: EUCKR,
- encoded: "\xbc\xbc\xb0\xe8\xbe\xdf\x2c\x20\xbe\xc8\xb3\xe7",
- utf8: "세계야, 안녕",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, "", "")
- }
-}
-
-func TestFiles(t *testing.T) { enctest.TestFile(t, EUCKR) }
-
-func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, EUCKR) }
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go
deleted file mode 100644
index b369da21abb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package simplifiedchinese
-
-import (
- "strings"
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Decode", e.NewDecoder(), nil
-}
-func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement
-}
-
-func TestNonRepertoire(t *testing.T) {
- // Pick n large enough to overflow the destination buffer of transform.String.
- const n = 10000
- testCases := []struct {
- init func(e encoding.Encoding) (string, transform.Transformer, error)
- e encoding.Encoding
- src, want string
- }{
- {dec, GBK, "a\xfe\xfeb", "a\ufffdb"},
- {dec, HZGB2312, "~{z~", "\ufffd"},
-
- {enc, GBK, "갂", ""},
- {enc, GBK, "a갂", "a"},
- {enc, GBK, "\u4e02갂", "\x81@"},
-
- {enc, HZGB2312, "갂", ""},
- {enc, HZGB2312, "a갂", "a"},
- {enc, HZGB2312, "\u6cf5갂", "~{1C~}"},
-
- {dec, GB18030, "\x80", "€"},
- {dec, GB18030, "\x81", "\ufffd"},
- {dec, GB18030, "\x81\x20", "\ufffd "},
- {dec, GB18030, "\xfe\xfe", "\ufffd"},
- {dec, GB18030, "\xfe\xff", "\ufffd\ufffd"},
- {dec, GB18030, "\xfe\x30", "\ufffd0"},
- {dec, GB18030, "\xfe\x30\x30 ", "\ufffd00 "},
- {dec, GB18030, "\xfe\x30\xff ", "\ufffd0\ufffd "},
- {dec, GB18030, "\xfe\x30\x81\x21", "\ufffd0\ufffd!"},
-
- {dec, GB18030, strings.Repeat("\xfe\x30", n), strings.Repeat("\ufffd0", n)},
-
- {dec, HZGB2312, "~/", "\ufffd"},
- {dec, HZGB2312, "~{a\x80", "\ufffd"},
- {dec, HZGB2312, "~{a\x80", "\ufffd"},
- {dec, HZGB2312, "~{" + strings.Repeat("z~", n), strings.Repeat("\ufffd", n)},
- {dec, HZGB2312, "~{" + strings.Repeat("\xfe\x30", n), strings.Repeat("\ufffd", n*2)},
- }
- for _, tc := range testCases {
- dir, tr, wantErr := tc.init(tc.e)
-
- dst, _, err := transform.String(tr, tc.src)
- if err != wantErr {
- t.Errorf("%s %v(%q): got %v; want %v", dir, tc.e, tc.src, err, wantErr)
- }
- if got := string(dst); got != tc.want {
- t.Errorf("%s %v(%q):\ngot %q\nwant %q", dir, tc.e, tc.src, got, tc.want)
- }
- }
-}
-
-func TestBasics(t *testing.T) {
- // The encoded forms can be verified by the iconv program:
- // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd
- testCases := []struct {
- e encoding.Encoding
- encPrefix string
- encoded string
- utf8 string
- }{{
- // "\u0081\u00de\u00df\u00e0\u00e1\u00e2\u00e3\uffff\U00010000" is a
- // nonsense string that contains GB18030 encodable codepoints of which
- // only U+00E0 and U+00E1 are GBK encodable.
- //
- // "A\u3000\u554a\u4e02\u4e90\u72dc\u7349\u02ca\u2588Z€" is a nonsense
- // string that contains ASCII and GBK encodable codepoints from Levels
- // 1-5 as well as the Euro sign.
- //
- // "A\u43f0\u4c32\U00027267\u3000\U0002910d\u79d4Z€" is a nonsense string
- // that contains ASCII and Big5 encodable codepoints from the Basic
- // Multilingual Plane and the Supplementary Ideographic Plane as well as
- // the Euro sign.
- //
- // "花间一壶酒,独酌无相亲。" (simplified) and
- // "花間一壺酒,獨酌無相親。" (traditional)
- // are from the 8th century poem "Yuè Xià Dú Zhuó".
- e: GB18030,
- encoded: "\x81\x30\x81\x31\x81\x30\x89\x37\x81\x30\x89\x38\xa8\xa4\xa8\xa2" +
- "\x81\x30\x89\x39\x81\x30\x8a\x30\x84\x31\xa4\x39\x90\x30\x81\x30",
- utf8: "\u0081\u00de\u00df\u00e0\u00e1\u00e2\u00e3\uffff\U00010000",
- }, {
- e: GB18030,
- encoded: "\xbb\xa8\xbc\xe4\xd2\xbb\xba\xf8\xbe\xc6\xa3\xac\xb6\xc0\xd7\xc3" +
- "\xce\xde\xcf\xe0\xc7\xd7\xa1\xa3",
- utf8: "花间一壶酒,独酌无相亲。",
- }, {
- e: GBK,
- encoded: "A\xa1\xa1\xb0\xa1\x81\x40\x81\x80\xaa\x40\xaa\x80\xa8\x40\xa8\x80Z\x80",
- utf8: "A\u3000\u554a\u4e02\u4e90\u72dc\u7349\u02ca\u2588Z€",
- }, {
- e: GBK,
- encoded: "\xbb\xa8\xbc\xe4\xd2\xbb\xba\xf8\xbe\xc6\xa3\xac\xb6\xc0\xd7\xc3" +
- "\xce\xde\xcf\xe0\xc7\xd7\xa1\xa3",
- utf8: "花间一壶酒,独酌无相亲。",
- }, {
- e: HZGB2312,
- encoded: "A~{\x21\x21~~\x30\x21~}Z~~",
- utf8: "A\u3000~\u554aZ~",
- }, {
- e: HZGB2312,
- encPrefix: "~{",
- encoded: ";(<dR;:x>F#,6@WCN^O`GW!#",
- utf8: "花间一壶酒,独酌无相亲。",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, "")
- }
-}
-
-func TestFiles(t *testing.T) {
- enctest.TestFile(t, GB18030)
- enctest.TestFile(t, GBK)
- enctest.TestFile(t, HZGB2312)
-}
-
-func BenchmarkEncoding(b *testing.B) {
- enctest.Benchmark(b, GB18030)
- enctest.Benchmark(b, GBK)
- enctest.Benchmark(b, HZGB2312)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go
deleted file mode 100644
index 3825c7672d2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package traditionalchinese
-
-import (
- "fmt"
- "io/ioutil"
- "strings"
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Decode", e.NewDecoder(), nil
-}
-func enc(e encoding.Encoding) (dir string, t transform.Transformer, err error) {
- return "Encode", e.NewEncoder(), internal.ErrASCIIReplacement
-}
-
-func TestNonRepertoire(t *testing.T) {
- testCases := []struct {
- init func(e encoding.Encoding) (string, transform.Transformer, error)
- e encoding.Encoding
- src, want string
- }{
- {dec, Big5, "\x80", "\ufffd"},
- {dec, Big5, "\x81", "\ufffd"},
- {dec, Big5, "\x81\x30", "\ufffd\x30"},
- {dec, Big5, "\x81\x40", "\ufffd"},
- {dec, Big5, "\x81\xa0", "\ufffd"},
- {dec, Big5, "\xff", "\ufffd"},
-
- {enc, Big5, "갂", ""},
- {enc, Big5, "a갂", "a"},
- {enc, Big5, "\u43f0갂", "\x87@"},
- }
- for _, tc := range testCases {
- dir, tr, wantErr := tc.init(tc.e)
- t.Run(fmt.Sprintf("%s/%v/%q", dir, tc.e, tc.src), func(t *testing.T) {
- dst := make([]byte, 100)
- src := []byte(tc.src)
- for i := 0; i <= len(tc.src); i++ {
- nDst, nSrc, err := tr.Transform(dst, src[:i], false)
- if err != nil && err != transform.ErrShortSrc && err != wantErr {
- t.Fatalf("error on first call to Transform: %v", err)
- }
- n, _, err := tr.Transform(dst[nDst:], src[nSrc:], true)
- nDst += n
- if err != wantErr {
- t.Fatalf("(%q|%q): got %v; want %v", tc.src[:i], tc.src[i:], err, wantErr)
- }
- if got := string(dst[:nDst]); got != tc.want {
- t.Errorf("(%q|%q):\ngot %q\nwant %q", tc.src[:i], tc.src[i:], got, tc.want)
- }
- }
- })
- }
-}
-
-func TestBasics(t *testing.T) {
- // The encoded forms can be verified by the iconv program:
- // $ echo 月日は百代 | iconv -f UTF-8 -t SHIFT-JIS | xxd
- testCases := []struct {
- e encoding.Encoding
- encPrefix string
- encSuffix string
- encoded string
- utf8 string
- }{{
- e: Big5,
- encoded: "A\x87\x40\x87\x41\x87\x45\xa1\x40\xfe\xfd\xfe\xfeZ\xa3\xe1",
- utf8: "A\u43f0\u4c32\U00027267\u3000\U0002910d\u79d4Z€",
- }, {
- e: Big5,
- encoded: "\xaa\xe1\xb6\xa1\xa4\x40\xb3\xfd\xb0\x73\xa1\x41\xbf\x57\xb0\x75" +
- "\xb5\x4c\xac\xdb\xbf\xcb\xa1\x43",
- utf8: "花間一壺酒,獨酌無相親。",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, "", "")
- }
-}
-
-func TestFiles(t *testing.T) { enctest.TestFile(t, Big5) }
-
-func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, Big5) }
-
-// TestBig5CircumflexAndMacron tests the special cases listed in
-// http://encoding.spec.whatwg.org/#big5
-// Note that these special cases aren't preserved by round-tripping through
-// decoding and encoding (since
-// http://encoding.spec.whatwg.org/index-big5.txt does not have an entry for
-// U+0304 or U+030C), so we can't test this in TestBasics.
-func TestBig5CircumflexAndMacron(t *testing.T) {
- src := "\x88\x5f\x88\x60\x88\x61\x88\x62\x88\x63\x88\x64\x88\x65\x88\x66 " +
- "\x88\xa2\x88\xa3\x88\xa4\x88\xa5\x88\xa6"
- want := "ÓǑÒ\u00ca\u0304Ế\u00ca\u030cỀÊ " +
- "ü\u00ea\u0304ế\u00ea\u030cề"
- dst, err := ioutil.ReadAll(transform.NewReader(
- strings.NewReader(src), Big5.NewDecoder()))
- if err != nil {
- t.Fatal(err)
- }
- if got := string(dst); got != want {
- t.Fatalf("\ngot %q\nwant %q", got, want)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/unicode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/unicode_test.go
deleted file mode 100644
index 51b4712d80b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/unicode_test.go
+++ /dev/null
@@ -1,499 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unicode
-
-import (
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/charmap"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-func TestBasics(t *testing.T) {
- testCases := []struct {
- e encoding.Encoding
- encPrefix string
- encSuffix string
- encoded string
- utf8 string
- }{{
- e: utf16BEIB,
- encoded: "\x00\x57\x00\xe4\xd8\x35\xdd\x65",
- utf8: "\x57\u00e4\U0001d565",
- }, {
- e: utf16BEEB,
- encPrefix: "\xfe\xff",
- encoded: "\x00\x57\x00\xe4\xd8\x35\xdd\x65",
- utf8: "\x57\u00e4\U0001d565",
- }, {
- e: utf16LEIB,
- encoded: "\x57\x00\xe4\x00\x35\xd8\x65\xdd",
- utf8: "\x57\u00e4\U0001d565",
- }, {
- e: utf16LEEB,
- encPrefix: "\xff\xfe",
- encoded: "\x57\x00\xe4\x00\x35\xd8\x65\xdd",
- utf8: "\x57\u00e4\U0001d565",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, tc.encSuffix)
- }
-}
-
-func TestFiles(t *testing.T) {
- enctest.TestFile(t, UTF8)
- enctest.TestFile(t, utf16LEIB)
-}
-
-func BenchmarkEncoding(b *testing.B) {
- enctest.Benchmark(b, UTF8)
- enctest.Benchmark(b, utf16LEIB)
-}
-
-var (
- utf16LEIB = UTF16(LittleEndian, IgnoreBOM) // UTF-16LE (atypical interpretation)
- utf16LEUB = UTF16(LittleEndian, UseBOM) // UTF-16, LE
- utf16LEEB = UTF16(LittleEndian, ExpectBOM) // UTF-16, LE, Expect
- utf16BEIB = UTF16(BigEndian, IgnoreBOM) // UTF-16BE (atypical interpretation)
- utf16BEUB = UTF16(BigEndian, UseBOM) // UTF-16 default
- utf16BEEB = UTF16(BigEndian, ExpectBOM) // UTF-16 Expect
-)
-
-func TestUTF16(t *testing.T) {
- testCases := []struct {
- desc string
- src string
- notEOF bool // the inverse of atEOF
- sizeDst int
- want string
- nSrc int
- err error
- t transform.Transformer
- }{{
- desc: "utf-16 IgnoreBOM dec: empty string",
- t: utf16BEIB.NewDecoder(),
- }, {
- desc: "utf-16 UseBOM dec: empty string",
- t: utf16BEUB.NewDecoder(),
- }, {
- desc: "utf-16 ExpectBOM dec: empty string",
- err: ErrMissingBOM,
- t: utf16BEEB.NewDecoder(),
- }, {
- desc: "utf-16 dec: BOM determines encoding BE (RFC 2781:3.3)",
- src: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 12,
- t: utf16BEUB.NewDecoder(),
- }, {
- desc: "utf-16 dec: BOM determines encoding LE (RFC 2781:3.3)",
- src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 12,
- t: utf16LEUB.NewDecoder(),
- }, {
- desc: "utf-16 dec: BOM determines encoding LE, change default (RFC 2781:3.3)",
- src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 12,
- t: utf16BEUB.NewDecoder(),
- }, {
- desc: "utf-16 dec: Fail on missing BOM when required",
- src: "\x08\xD8\x45\xDF\x3D\x00\xFF\xFE\xFE\xFF\x00\x52\x00\x61",
- sizeDst: 100,
- want: "",
- nSrc: 0,
- err: ErrMissingBOM,
- t: utf16BEEB.NewDecoder(),
- }, {
- desc: "utf-16 dec: SHOULD interpret text as big-endian when BOM not present (RFC 2781:4.3)",
- src: "\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 10,
- t: utf16BEUB.NewDecoder(),
- }, {
- // This is an error according to RFC 2781. But errors in RFC 2781 are
- // open to interpretations, so I guess this is fine.
- desc: "utf-16le dec: incorrect BOM is an error (RFC 2781:4.1)",
- src: "\xFE\xFF\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00",
- sizeDst: 100,
- want: "\uFFFE\U00012345=Ra",
- nSrc: 12,
- t: utf16LEIB.NewDecoder(),
- }, {
- desc: "utf-16 enc: SHOULD write BOM (RFC 2781:3.3)",
- src: "\U00012345=Ra",
- sizeDst: 100,
- want: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00",
- nSrc: 7,
- t: utf16LEUB.NewEncoder(),
- }, {
- desc: "utf-16 enc: SHOULD write BOM (RFC 2781:3.3)",
- src: "\U00012345=Ra",
- sizeDst: 100,
- want: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61",
- nSrc: 7,
- t: utf16BEUB.NewEncoder(),
- }, {
- desc: "utf-16le enc: MUST NOT write BOM (RFC 2781:3.3)",
- src: "\U00012345=Ra",
- sizeDst: 100,
- want: "\x08\xD8\x45\xDF\x3D\x00\x52\x00\x61\x00",
- nSrc: 7,
- t: utf16LEIB.NewEncoder(),
- }, {
- desc: "utf-16be dec: incorrect UTF-16: odd bytes",
- src: "\x00",
- sizeDst: 100,
- want: "\uFFFD",
- nSrc: 1,
- t: utf16BEIB.NewDecoder(),
- }, {
- desc: "utf-16be dec: unpaired surrogate, odd bytes",
- src: "\xD8\x45\x00",
- sizeDst: 100,
- want: "\uFFFD\uFFFD",
- nSrc: 3,
- t: utf16BEIB.NewDecoder(),
- }, {
- desc: "utf-16be dec: unpaired low surrogate + valid text",
- src: "\xD8\x45\x00a",
- sizeDst: 100,
- want: "\uFFFDa",
- nSrc: 4,
- t: utf16BEIB.NewDecoder(),
- }, {
- desc: "utf-16be dec: unpaired low surrogate + valid text + single byte",
- src: "\xD8\x45\x00ab",
- sizeDst: 100,
- want: "\uFFFDa\uFFFD",
- nSrc: 5,
- t: utf16BEIB.NewDecoder(),
- }, {
- desc: "utf-16le dec: unpaired high surrogate",
- src: "\x00\x00\x00\xDC\x12\xD8",
- sizeDst: 100,
- want: "\x00\uFFFD\uFFFD",
- nSrc: 6,
- t: utf16LEIB.NewDecoder(),
- }, {
- desc: "utf-16be dec: two unpaired low surrogates",
- src: "\xD8\x45\xD8\x12",
- sizeDst: 100,
- want: "\uFFFD\uFFFD",
- nSrc: 4,
- t: utf16BEIB.NewDecoder(),
- }, {
- desc: "utf-16be dec: short dst",
- src: "\x00a",
- sizeDst: 0,
- want: "",
- nSrc: 0,
- t: utf16BEIB.NewDecoder(),
- err: transform.ErrShortDst,
- }, {
- desc: "utf-16be dec: short dst surrogate",
- src: "\xD8\xF5\xDC\x12",
- sizeDst: 3,
- want: "",
- nSrc: 0,
- t: utf16BEIB.NewDecoder(),
- err: transform.ErrShortDst,
- }, {
- desc: "utf-16be dec: short dst trailing byte",
- src: "\x00",
- sizeDst: 2,
- want: "",
- nSrc: 0,
- t: utf16BEIB.NewDecoder(),
- err: transform.ErrShortDst,
- }, {
- desc: "utf-16be dec: short src",
- src: "\x00",
- notEOF: true,
- sizeDst: 3,
- want: "",
- nSrc: 0,
- t: utf16BEIB.NewDecoder(),
- err: transform.ErrShortSrc,
- }, {
- desc: "utf-16 enc",
- src: "\U00012345=Ra",
- sizeDst: 100,
- want: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61",
- nSrc: 7,
- t: utf16BEUB.NewEncoder(),
- }, {
- desc: "utf-16 enc: short dst normal",
- src: "\U00012345=Ra",
- sizeDst: 9,
- want: "\xD8\x08\xDF\x45\x00\x3D\x00\x52",
- nSrc: 6,
- t: utf16BEIB.NewEncoder(),
- err: transform.ErrShortDst,
- }, {
- desc: "utf-16 enc: short dst surrogate",
- src: "\U00012345=Ra",
- sizeDst: 3,
- want: "",
- nSrc: 0,
- t: utf16BEIB.NewEncoder(),
- err: transform.ErrShortDst,
- }, {
- desc: "utf-16 enc: short src",
- src: "\U00012345=Ra\xC2",
- notEOF: true,
- sizeDst: 100,
- want: "\xD8\x08\xDF\x45\x00\x3D\x00\x52\x00\x61",
- nSrc: 7,
- t: utf16BEIB.NewEncoder(),
- err: transform.ErrShortSrc,
- }, {
- desc: "utf-16be dec: don't change byte order mid-stream",
- src: "\xFE\xFF\xD8\x08\xDF\x45\x00\x3D\xFF\xFE\x00\x52\x00\x61",
- sizeDst: 100,
- want: "\U00012345=\ufffeRa",
- nSrc: 14,
- t: utf16BEUB.NewDecoder(),
- }, {
- desc: "utf-16le dec: don't change byte order mid-stream",
- src: "\xFF\xFE\x08\xD8\x45\xDF\x3D\x00\xFF\xFE\xFE\xFF\x52\x00\x61\x00",
- sizeDst: 100,
- want: "\U00012345=\ufeff\ufffeRa",
- nSrc: 16,
- t: utf16LEUB.NewDecoder(),
- }}
- for i, tc := range testCases {
- b := make([]byte, tc.sizeDst)
- nDst, nSrc, err := tc.t.Transform(b, []byte(tc.src), !tc.notEOF)
- if err != tc.err {
- t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err)
- }
- if got := string(b[:nDst]); got != tc.want {
- t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want)
- }
- if nSrc != tc.nSrc {
- t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc)
- }
- }
-}
-
-func TestUTF8Decoder(t *testing.T) {
- testCases := []struct {
- desc string
- src string
- notEOF bool // the inverse of atEOF
- sizeDst int
- want string
- nSrc int
- err error
- }{{
- desc: "empty string, empty dest buffer",
- }, {
- desc: "empty string",
- sizeDst: 8,
- }, {
- desc: "empty string, streaming",
- notEOF: true,
- sizeDst: 8,
- }, {
- desc: "ascii",
- src: "abcde",
- sizeDst: 8,
- want: "abcde",
- nSrc: 5,
- }, {
- desc: "ascii and error",
- src: "ab\x80de",
- sizeDst: 7,
- want: "ab\ufffdde",
- nSrc: 5,
- }, {
- desc: "valid two-byte sequence",
- src: "a\u0300bc",
- sizeDst: 7,
- want: "a\u0300bc",
- nSrc: 5,
- }, {
- desc: "valid three-byte sequence",
- src: "a\u0300中",
- sizeDst: 7,
- want: "a\u0300中",
- nSrc: 6,
- }, {
- desc: "valid four-byte sequence",
- src: "a中\U00016F50",
- sizeDst: 8,
- want: "a中\U00016F50",
- nSrc: 8,
- }, {
- desc: "short source buffer",
- src: "abc\xf0\x90",
- notEOF: true,
- sizeDst: 10,
- want: "abc",
- nSrc: 3,
- err: transform.ErrShortSrc,
- }, {
- // We don't check for the maximal subpart of an ill-formed subsequence
- // at the end of an open segment.
- desc: "complete invalid that looks like short at end",
- src: "abc\xf0\x80",
- notEOF: true,
- sizeDst: 10,
- want: "abc", // instead of "abc\ufffd\ufffd",
- nSrc: 3,
- err: transform.ErrShortSrc,
- }, {
- desc: "incomplete sequence at end",
- src: "a\x80bc\xf0\x90",
- sizeDst: 9,
- want: "a\ufffdbc\ufffd",
- nSrc: 6,
- }, {
- desc: "invalid second byte",
- src: "abc\xf0dddd",
- sizeDst: 10,
- want: "abc\ufffddddd",
- nSrc: 8,
- }, {
- desc: "invalid second byte at end",
- src: "abc\xf0d",
- sizeDst: 10,
- want: "abc\ufffdd",
- nSrc: 5,
- }, {
- desc: "invalid third byte",
- src: "a\u0300bc\xf0\x90dddd",
- sizeDst: 12,
- want: "a\u0300bc\ufffddddd",
- nSrc: 11,
- }, {
- desc: "invalid third byte at end",
- src: "a\u0300bc\xf0\x90d",
- sizeDst: 12,
- want: "a\u0300bc\ufffdd",
- nSrc: 8,
- }, {
- desc: "invalid fourth byte, tight buffer",
- src: "a\u0300bc\xf0\x90\x80d",
- sizeDst: 9,
- want: "a\u0300bc\ufffdd",
- nSrc: 9,
- }, {
- desc: "invalid fourth byte at end",
- src: "a\u0300bc\xf0\x90\x80",
- sizeDst: 8,
- want: "a\u0300bc\ufffd",
- nSrc: 8,
- }, {
- desc: "invalid fourth byte and short four byte sequence",
- src: "a\u0300bc\xf0\x90\x80\xf0\x90\x80",
- notEOF: true,
- sizeDst: 20,
- want: "a\u0300bc\ufffd",
- nSrc: 8,
- err: transform.ErrShortSrc,
- }, {
- desc: "valid four-byte sequence overflowing short buffer",
- src: "a\u0300bc\xf0\x90\x80\x80",
- notEOF: true,
- sizeDst: 8,
- want: "a\u0300bc",
- nSrc: 5,
- err: transform.ErrShortDst,
- }, {
- desc: "invalid fourth byte at end short, but short dst",
- src: "a\u0300bc\xf0\x90\x80\xf0\x90\x80",
- notEOF: true,
- sizeDst: 8,
- // More bytes would fit in the buffer, but this seems to require a more
- // complicated and slower algorithm.
- want: "a\u0300bc", // instead of "a\u0300bc"
- nSrc: 5,
- err: transform.ErrShortDst,
- }, {
- desc: "short dst for error",
- src: "abc\x80",
- notEOF: true,
- sizeDst: 5,
- want: "abc",
- nSrc: 3,
- err: transform.ErrShortDst,
- }, {
- desc: "adjusting short dst buffer",
- src: "abc\x80ef",
- notEOF: true,
- sizeDst: 6,
- want: "abc\ufffd",
- nSrc: 4,
- err: transform.ErrShortDst,
- }}
- tr := UTF8.NewDecoder()
- for i, tc := range testCases {
- b := make([]byte, tc.sizeDst)
- nDst, nSrc, err := tr.Transform(b, []byte(tc.src), !tc.notEOF)
- if err != tc.err {
- t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err)
- }
- if got := string(b[:nDst]); got != tc.want {
- t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want)
- }
- if nSrc != tc.nSrc {
- t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc)
- }
- }
-}
-
-func TestBOMOverride(t *testing.T) {
- dec := BOMOverride(charmap.CodePage437.NewDecoder())
- dst := make([]byte, 100)
- for i, tc := range []struct {
- src string
- atEOF bool
- dst string
- nSrc int
- err error
- }{
- 0: {"H\x82ll\x93", true, "Héllô", 5, nil},
- 1: {"\uFEFFHéllö", true, "Héllö", 10, nil},
- 2: {"\xFE\xFF\x00H\x00e\x00l\x00l\x00o", true, "Hello", 12, nil},
- 3: {"\xFF\xFEH\x00e\x00l\x00l\x00o\x00", true, "Hello", 12, nil},
- 4: {"\uFEFF", true, "", 3, nil},
- 5: {"\xFE\xFF", true, "", 2, nil},
- 6: {"\xFF\xFE", true, "", 2, nil},
- 7: {"\xEF\xBB", true, "\u2229\u2557", 2, nil},
- 8: {"\xEF", true, "\u2229", 1, nil},
- 9: {"", true, "", 0, nil},
- 10: {"\xFE", true, "\u25a0", 1, nil},
- 11: {"\xFF", true, "\u00a0", 1, nil},
- 12: {"\xEF\xBB", false, "", 0, transform.ErrShortSrc},
- 13: {"\xEF", false, "", 0, transform.ErrShortSrc},
- 14: {"", false, "", 0, transform.ErrShortSrc},
- 15: {"\xFE", false, "", 0, transform.ErrShortSrc},
- 16: {"\xFF", false, "", 0, transform.ErrShortSrc},
- 17: {"\xFF\xFE", false, "", 0, transform.ErrShortSrc},
- } {
- dec.Reset()
- nDst, nSrc, err := dec.Transform(dst, []byte(tc.src), tc.atEOF)
- got := string(dst[:nDst])
- if nSrc != tc.nSrc {
- t.Errorf("%d: nSrc: got %d; want %d", i, nSrc, tc.nSrc)
- }
- if got != tc.dst {
- t.Errorf("%d: got %+q; want %+q", i, got, tc.dst)
- }
- if err != tc.err {
- t.Errorf("%d: error: got %v; want %v", i, err, tc.err)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go
deleted file mode 100644
index cd6158e5ead..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package utf32
-
-import (
- "testing"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal/enctest"
- "golang.org/x/text/transform"
-)
-
-var (
- utf32LEIB = UTF32(LittleEndian, IgnoreBOM) // UTF-32LE (atypical interpretation)
- utf32LEUB = UTF32(LittleEndian, UseBOM) // UTF-32, LE
- // utf32LEEB = UTF32(LittleEndian, ExpectBOM) // UTF-32, LE, Expect - covered in encoding_test.go
- utf32BEIB = UTF32(BigEndian, IgnoreBOM) // UTF-32BE (atypical interpretation)
- utf32BEUB = UTF32(BigEndian, UseBOM) // UTF-32 default
- utf32BEEB = UTF32(BigEndian, ExpectBOM) // UTF-32 Expect
-)
-
-func TestBasics(t *testing.T) {
- testCases := []struct {
- e encoding.Encoding
- encPrefix string
- encSuffix string
- encoded string
- utf8 string
- }{{
- e: utf32BEIB,
- encoded: "\x00\x00\x00\x57\x00\x00\x00\xe4\x00\x01\xd5\x65",
- utf8: "\x57\u00e4\U0001d565",
- }, {
- e: UTF32(BigEndian, ExpectBOM),
- encPrefix: "\x00\x00\xfe\xff",
- encoded: "\x00\x00\x00\x57\x00\x00\x00\xe4\x00\x01\xd5\x65",
- utf8: "\x57\u00e4\U0001d565",
- }, {
- e: UTF32(LittleEndian, IgnoreBOM),
- encoded: "\x57\x00\x00\x00\xe4\x00\x00\x00\x65\xd5\x01\x00",
- utf8: "\x57\u00e4\U0001d565",
- }, {
- e: UTF32(LittleEndian, ExpectBOM),
- encPrefix: "\xff\xfe\x00\x00",
- encoded: "\x57\x00\x00\x00\xe4\x00\x00\x00\x65\xd5\x01\x00",
- utf8: "\x57\u00e4\U0001d565",
- }}
-
- for _, tc := range testCases {
- enctest.TestEncoding(t, tc.e, tc.encoded, tc.utf8, tc.encPrefix, tc.encSuffix)
- }
-}
-
-func TestFiles(t *testing.T) { enctest.TestFile(t, utf32BEIB) }
-
-func BenchmarkEncoding(b *testing.B) { enctest.Benchmark(b, utf32BEIB) }
-
-func TestUTF32(t *testing.T) {
- testCases := []struct {
- desc string
- src string
- notEOF bool // the inverse of atEOF
- sizeDst int
- want string
- nSrc int
- err error
- t transform.Transformer
- }{{
- desc: "utf-32 IgnoreBOM dec: empty string",
- t: utf32BEIB.NewDecoder(),
- }, {
- desc: "utf-32 UseBOM dec: empty string",
- t: utf32BEUB.NewDecoder(),
- }, {
- desc: "utf-32 ExpectBOM dec: empty string",
- err: ErrMissingBOM,
- t: utf32BEEB.NewDecoder(),
- }, {
- desc: "utf-32be dec: Doesn't interpret U+FEFF as BOM",
- src: "\x00\x00\xFE\xFF\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "\uFEFF\U00012345=Ra",
- nSrc: 20,
- t: utf32BEIB.NewDecoder(),
- }, {
- desc: "utf-32be dec: Interprets little endian U+FEFF as invalid",
- src: "\xFF\xFE\x00\x00\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "\uFFFD\U00012345=Ra",
- nSrc: 20,
- t: utf32BEIB.NewDecoder(),
- }, {
- desc: "utf-32le dec: Doesn't interpret U+FEFF as BOM",
- src: "\xFF\xFE\x00\x00\x45\x23\x01\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- sizeDst: 100,
- want: "\uFEFF\U00012345=Ra",
- nSrc: 20,
- t: utf32LEIB.NewDecoder(),
- }, {
- desc: "utf-32le dec: Interprets big endian U+FEFF as invalid",
- src: "\x00\x00\xFE\xFF\x45\x23\x01\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- sizeDst: 100,
- want: "\uFFFD\U00012345=Ra",
- nSrc: 20,
- t: utf32LEIB.NewDecoder(),
- }, {
- desc: "utf-32 enc: Writes big-endian BOM",
- src: "\U00012345=Ra",
- sizeDst: 100,
- want: "\x00\x00\xFE\xFF\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- nSrc: 7,
- t: utf32BEUB.NewEncoder(),
- }, {
- desc: "utf-32 enc: Writes little-endian BOM",
- src: "\U00012345=Ra",
- sizeDst: 100,
- want: "\xFF\xFE\x00\x00\x45\x23\x01\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- nSrc: 7,
- t: utf32LEUB.NewEncoder(),
- }, {
- desc: "utf-32 dec: Interprets text using big-endian default when BOM not present",
- src: "\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 16,
- t: utf32BEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: Interprets text using little-endian default when BOM not present",
- src: "\x45\x23\x01\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 16,
- t: utf32LEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: BOM determines encoding BE",
- src: "\x00\x00\xFE\xFF\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 20,
- t: utf32BEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: BOM determines encoding LE",
- src: "\xFF\xFE\x00\x00\x45\x23\x01\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 20,
- t: utf32LEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: BOM determines encoding LE, change default",
- src: "\xFF\xFE\x00\x00\x45\x23\x01\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 20,
- t: utf32BEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: BOM determines encoding BE, change default",
- src: "\x00\x00\xFE\xFF\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "\U00012345=Ra",
- nSrc: 20,
- t: utf32LEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: Don't change big-endian byte order mid-stream",
- src: "\x00\x01\x23\x45\x00\x00\x00\x3D\xFF\xFE\x00\x00\x00\x00\xFE\xFF\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "\U00012345=\uFFFD\uFEFFRa",
- nSrc: 24,
- t: utf32BEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: Don't change little-endian byte order mid-stream",
- src: "\x45\x23\x01\x00\x3D\x00\x00\x00\x00\x00\xFE\xFF\xFF\xFE\x00\x00\x52\x00\x00\x00\x61\x00\x00\x00",
- sizeDst: 100,
- want: "\U00012345=\uFFFD\uFEFFRa",
- nSrc: 24,
- t: utf32LEUB.NewDecoder(),
- }, {
- desc: "utf-32 dec: Fail on missing BOM when required",
- src: "\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- sizeDst: 100,
- want: "",
- nSrc: 0,
- err: ErrMissingBOM,
- t: utf32BEEB.NewDecoder(),
- }, {
- desc: "utf-32 enc: Short dst",
- src: "\U00012345=Ra",
- sizeDst: 15,
- want: "\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52",
- nSrc: 6,
- err: transform.ErrShortDst,
- t: utf32BEIB.NewEncoder(),
- }, {
- desc: "utf-32 enc: Short src",
- src: "\U00012345=Ra\xC2",
- notEOF: true,
- sizeDst: 100,
- want: "\x00\x01\x23\x45\x00\x00\x00\x3D\x00\x00\x00\x52\x00\x00\x00\x61",
- nSrc: 7,
- err: transform.ErrShortSrc,
- t: utf32BEIB.NewEncoder(),
- }, {
- desc: "utf-32 enc: Invalid input",
- src: "\x80\xC1\xC2\x7F\xC2",
- sizeDst: 100,
- want: "\x00\x00\xFF\xFD\x00\x00\xFF\xFD\x00\x00\xFF\xFD\x00\x00\x00\x7F\x00\x00\xFF\xFD",
- nSrc: 5,
- t: utf32BEIB.NewEncoder(),
- }, {
- desc: "utf-32 dec: Short dst",
- src: "\x00\x00\x00\x41",
- sizeDst: 0,
- want: "",
- nSrc: 0,
- err: transform.ErrShortDst,
- t: utf32BEIB.NewDecoder(),
- }, {
- desc: "utf-32 dec: Short src",
- src: "\x00\x00\x00",
- notEOF: true,
- sizeDst: 4,
- want: "",
- nSrc: 0,
- err: transform.ErrShortSrc,
- t: utf32BEIB.NewDecoder(),
- }, {
- desc: "utf-32 dec: Invalid input",
- src: "\x00\x00\xD8\x00\x00\x00\xDF\xFF\x00\x11\x00\x00\x00\x00\x00",
- sizeDst: 100,
- want: "\uFFFD\uFFFD\uFFFD\uFFFD",
- nSrc: 15,
- t: utf32BEIB.NewDecoder(),
- }}
- for i, tc := range testCases {
- b := make([]byte, tc.sizeDst)
- nDst, nSrc, err := tc.t.Transform(b, []byte(tc.src), !tc.notEOF)
- if err != tc.err {
- t.Errorf("%d:%s: error was %v; want %v", i, tc.desc, err, tc.err)
- }
- if got := string(b[:nDst]); got != tc.want {
- t.Errorf("%d:%s: result was %q: want %q", i, tc.desc, got, tc.want)
- }
- if nSrc != tc.nSrc {
- t.Errorf("%d:%s: nSrc was %d; want %d", i, tc.desc, nSrc, tc.nSrc)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/data_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/data_test.go
deleted file mode 100644
index bd4c240f90b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/data_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package plural
-
-type pluralTest struct {
- locales string
- form int
- integer []string
- decimal []string
-}
-
-var ordinalTests = []pluralTest{ // 66 elements
- 0: {locales: "af am ar bg bs ce cs da de dsb el es et eu fa fi fy gl gsw he hr hsb id in is iw ja km kn ko ky lt lv ml mn my nb nl pa pl prg ps pt root ru sd sh si sk sl sr sw ta te th tr ur uz yue zh zu", form: 0, integer: []string{"0~15", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 1: {locales: "sv", form: 2, integer: []string{"1", "2", "21", "22", "31", "32", "41", "42", "51", "52", "61", "62", "71", "72", "81", "82", "101", "1001"}, decimal: []string(nil)},
- 2: {locales: "sv", form: 0, integer: []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 3: {locales: "fil fr ga hy lo mo ms ro tl vi", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 4: {locales: "fil fr ga hy lo mo ms ro tl vi", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 5: {locales: "hu", form: 2, integer: []string{"1", "5"}, decimal: []string(nil)},
- 6: {locales: "hu", form: 0, integer: []string{"0", "2~4", "6~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 7: {locales: "ne", form: 2, integer: []string{"1~4"}, decimal: []string(nil)},
- 8: {locales: "ne", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 9: {locales: "be", form: 4, integer: []string{"2", "3", "22", "23", "32", "33", "42", "43", "52", "53", "62", "63", "72", "73", "82", "83", "102", "1002"}, decimal: []string(nil)},
- 10: {locales: "be", form: 0, integer: []string{"0", "1", "4~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 11: {locales: "uk", form: 4, integer: []string{"3", "23", "33", "43", "53", "63", "73", "83", "103", "1003"}, decimal: []string(nil)},
- 12: {locales: "uk", form: 0, integer: []string{"0~2", "4~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 13: {locales: "tk", form: 4, integer: []string{"6", "9", "10", "16", "19", "26", "29", "36", "39", "106", "1006"}, decimal: []string(nil)},
- 14: {locales: "tk", form: 0, integer: []string{"0~5", "7", "8", "11~15", "17", "18", "20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 15: {locales: "kk", form: 5, integer: []string{"6", "9", "10", "16", "19", "20", "26", "29", "30", "36", "39", "40", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 16: {locales: "kk", form: 0, integer: []string{"0~5", "7", "8", "11~15", "17", "18", "21", "101", "1001"}, decimal: []string(nil)},
- 17: {locales: "it", form: 5, integer: []string{"8", "11", "80", "800"}, decimal: []string(nil)},
- 18: {locales: "it", form: 0, integer: []string{"0~7", "9", "10", "12~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 19: {locales: "ka", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 20: {locales: "ka", form: 5, integer: []string{"0", "2~16", "102", "1002"}, decimal: []string(nil)},
- 21: {locales: "ka", form: 0, integer: []string{"21~36", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 22: {locales: "sq", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 23: {locales: "sq", form: 5, integer: []string{"4", "24", "34", "44", "54", "64", "74", "84", "104", "1004"}, decimal: []string(nil)},
- 24: {locales: "sq", form: 0, integer: []string{"0", "2", "3", "5~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 25: {locales: "en", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
- 26: {locales: "en", form: 3, integer: []string{"2", "22", "32", "42", "52", "62", "72", "82", "102", "1002"}, decimal: []string(nil)},
- 27: {locales: "en", form: 4, integer: []string{"3", "23", "33", "43", "53", "63", "73", "83", "103", "1003"}, decimal: []string(nil)},
- 28: {locales: "en", form: 0, integer: []string{"0", "4~18", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 29: {locales: "mr", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 30: {locales: "mr", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 31: {locales: "mr", form: 4, integer: []string{"4"}, decimal: []string(nil)},
- 32: {locales: "mr", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 33: {locales: "ca", form: 2, integer: []string{"1", "3"}, decimal: []string(nil)},
- 34: {locales: "ca", form: 3, integer: []string{"2"}, decimal: []string(nil)},
- 35: {locales: "ca", form: 4, integer: []string{"4"}, decimal: []string(nil)},
- 36: {locales: "ca", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 37: {locales: "mk", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
- 38: {locales: "mk", form: 3, integer: []string{"2", "22", "32", "42", "52", "62", "72", "82", "102", "1002"}, decimal: []string(nil)},
- 39: {locales: "mk", form: 5, integer: []string{"7", "8", "27", "28", "37", "38", "47", "48", "57", "58", "67", "68", "77", "78", "87", "88", "107", "1007"}, decimal: []string(nil)},
- 40: {locales: "mk", form: 0, integer: []string{"0", "3~6", "9~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 41: {locales: "az", form: 2, integer: []string{"1", "2", "5", "7", "8", "11", "12", "15", "17", "18", "20~22", "25", "101", "1001"}, decimal: []string(nil)},
- 42: {locales: "az", form: 4, integer: []string{"3", "4", "13", "14", "23", "24", "33", "34", "43", "44", "53", "54", "63", "64", "73", "74", "100", "1003"}, decimal: []string(nil)},
- 43: {locales: "az", form: 5, integer: []string{"0", "6", "16", "26", "36", "40", "46", "56", "106", "1006"}, decimal: []string(nil)},
- 44: {locales: "az", form: 0, integer: []string{"9", "10", "19", "29", "30", "39", "49", "59", "69", "79", "109", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 45: {locales: "gu hi", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 46: {locales: "gu hi", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 47: {locales: "gu hi", form: 4, integer: []string{"4"}, decimal: []string(nil)},
- 48: {locales: "gu hi", form: 5, integer: []string{"6"}, decimal: []string(nil)},
- 49: {locales: "gu hi", form: 0, integer: []string{"0", "5", "7~20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 50: {locales: "as bn", form: 2, integer: []string{"1", "5", "7~10"}, decimal: []string(nil)},
- 51: {locales: "as bn", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 52: {locales: "as bn", form: 4, integer: []string{"4"}, decimal: []string(nil)},
- 53: {locales: "as bn", form: 5, integer: []string{"6"}, decimal: []string(nil)},
- 54: {locales: "as bn", form: 0, integer: []string{"0", "11~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 55: {locales: "or", form: 2, integer: []string{"1", "5", "7~9"}, decimal: []string(nil)},
- 56: {locales: "or", form: 3, integer: []string{"2", "3"}, decimal: []string(nil)},
- 57: {locales: "or", form: 4, integer: []string{"4"}, decimal: []string(nil)},
- 58: {locales: "or", form: 5, integer: []string{"6"}, decimal: []string(nil)},
- 59: {locales: "or", form: 0, integer: []string{"0", "10~24", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 60: {locales: "cy", form: 1, integer: []string{"0", "7~9"}, decimal: []string(nil)},
- 61: {locales: "cy", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 62: {locales: "cy", form: 3, integer: []string{"2"}, decimal: []string(nil)},
- 63: {locales: "cy", form: 4, integer: []string{"3", "4"}, decimal: []string(nil)},
- 64: {locales: "cy", form: 5, integer: []string{"5", "6"}, decimal: []string(nil)},
- 65: {locales: "cy", form: 0, integer: []string{"10~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
-} // Size: 4776 bytes
-
-var cardinalTests = []pluralTest{ // 113 elements
- 0: {locales: "bm bo dz id ig ii in ja jbo jv jw kde kea km ko lkt lo ms my nqo root sah ses sg th to vi wo yo yue zh", form: 0, integer: []string{"0~15", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 1: {locales: "am as bn fa gu hi kn mr zu", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.0", "0.00~0.04"}},
- 2: {locales: "am as bn fa gu hi kn mr zu", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"1.1~2.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 3: {locales: "ff fr hy kab", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.5"}},
- 4: {locales: "ff fr hy kab", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 5: {locales: "pt", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.5"}},
- 6: {locales: "pt", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 7: {locales: "ast ca de en et fi fy gl io it ji nl pt_PT sv sw ur yi", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 8: {locales: "ast ca de en et fi fy gl io it ji nl pt_PT sv sw ur yi", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 9: {locales: "si", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0", "0.1", "1.0", "0.00", "0.01", "1.00", "0.000", "0.001", "1.000", "0.0000", "0.0001", "1.0000"}},
- 10: {locales: "si", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.2~0.9", "1.1~1.8", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 11: {locales: "ak bh guw ln mg nso pa ti wa", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0", "1.0", "0.00", "1.00", "0.000", "1.000", "0.0000", "1.0000"}},
- 12: {locales: "ak bh guw ln mg nso pa ti wa", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 13: {locales: "tzm", form: 2, integer: []string{"0", "1", "11~24"}, decimal: []string{"0.0", "1.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0", "20.0", "21.0", "22.0", "23.0", "24.0"}},
- 14: {locales: "tzm", form: 0, integer: []string{"2~10", "100~106", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 15: {locales: "af asa az bem bez bg brx ce cgg chr ckb dv ee el eo es eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sd sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 16: {locales: "af asa az bem bez bg brx ce cgg chr ckb dv ee el eo es eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sd sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 17: {locales: "da", form: 2, integer: []string{"1"}, decimal: []string{"0.1~1.6"}},
- 18: {locales: "da", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "2.0~3.4", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 19: {locales: "is", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1~1.6", "10.1", "100.1", "1000.1"}},
- 20: {locales: "is", form: 0, integer: []string{"0", "2~16", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 21: {locales: "mk", form: 2, integer: []string{"1", "11", "21", "31", "41", "51", "61", "71", "101", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 22: {locales: "mk", form: 0, integer: []string{"0", "2~10", "12~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.2~1.0", "1.2~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 23: {locales: "fil tl", form: 2, integer: []string{"0~3", "5", "7", "8", "10~13", "15", "17", "18", "20", "21", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.3", "0.5", "0.7", "0.8", "1.0~1.3", "1.5", "1.7", "1.8", "2.0", "2.1", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 24: {locales: "fil tl", form: 0, integer: []string{"4", "6", "9", "14", "16", "19", "24", "26", "104", "1004"}, decimal: []string{"0.4", "0.6", "0.9", "1.4", "1.6", "1.9", "2.4", "2.6", "10.4", "100.4", "1000.4"}},
- 25: {locales: "lv prg", form: 1, integer: []string{"0", "10~20", "30", "40", "50", "60", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 26: {locales: "lv prg", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1", "1.0", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 27: {locales: "lv prg", form: 0, integer: []string{"2~9", "22~29", "102", "1002"}, decimal: []string{"0.2~0.9", "1.2~1.9", "10.2", "100.2", "1000.2"}},
- 28: {locales: "lag", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 29: {locales: "lag", form: 2, integer: []string{"1"}, decimal: []string{"0.1~1.6"}},
- 30: {locales: "lag", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"2.0~3.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 31: {locales: "ksh", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 32: {locales: "ksh", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 33: {locales: "ksh", form: 0, integer: []string{"2~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 34: {locales: "iu kw naq se sma smi smj smn sms", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 35: {locales: "iu kw naq se sma smi smj smn sms", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 36: {locales: "iu kw naq se sma smi smj smn sms", form: 0, integer: []string{"0", "3~17", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 37: {locales: "shi", form: 2, integer: []string{"0", "1"}, decimal: []string{"0.0~1.0", "0.00~0.04"}},
- 38: {locales: "shi", form: 4, integer: []string{"2~10"}, decimal: []string{"2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "2.00", "3.00", "4.00", "5.00", "6.00", "7.00", "8.00"}},
- 39: {locales: "shi", form: 0, integer: []string{"11~26", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"1.1~1.9", "2.1~2.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 40: {locales: "mo ro", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 41: {locales: "mo ro", form: 4, integer: []string{"0", "2~16", "101", "1001"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 42: {locales: "mo ro", form: 0, integer: []string{"20~35", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 43: {locales: "bs hr sh sr", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 44: {locales: "bs hr sh sr", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string{"0.2~0.4", "1.2~1.4", "2.2~2.4", "3.2~3.4", "4.2~4.4", "5.2", "10.2", "100.2", "1000.2"}},
- 45: {locales: "bs hr sh sr", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.5~1.0", "1.5~2.0", "2.5~2.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 46: {locales: "gd", form: 2, integer: []string{"1", "11"}, decimal: []string{"1.0", "11.0", "1.00", "11.00", "1.000", "11.000", "1.0000"}},
- 47: {locales: "gd", form: 3, integer: []string{"2", "12"}, decimal: []string{"2.0", "12.0", "2.00", "12.00", "2.000", "12.000", "2.0000"}},
- 48: {locales: "gd", form: 4, integer: []string{"3~10", "13~19"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0", "3.00"}},
- 49: {locales: "gd", form: 0, integer: []string{"0", "20~34", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 50: {locales: "sl", form: 2, integer: []string{"1", "101", "201", "301", "401", "501", "601", "701", "1001"}, decimal: []string(nil)},
- 51: {locales: "sl", form: 3, integer: []string{"2", "102", "202", "302", "402", "502", "602", "702", "1002"}, decimal: []string(nil)},
- 52: {locales: "sl", form: 4, integer: []string{"3", "4", "103", "104", "203", "204", "303", "304", "403", "404", "503", "504", "603", "604", "703", "704", "1003"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 53: {locales: "sl", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 54: {locales: "dsb hsb", form: 2, integer: []string{"1", "101", "201", "301", "401", "501", "601", "701", "1001"}, decimal: []string{"0.1", "1.1", "2.1", "3.1", "4.1", "5.1", "6.1", "7.1", "10.1", "100.1", "1000.1"}},
- 55: {locales: "dsb hsb", form: 3, integer: []string{"2", "102", "202", "302", "402", "502", "602", "702", "1002"}, decimal: []string{"0.2", "1.2", "2.2", "3.2", "4.2", "5.2", "6.2", "7.2", "10.2", "100.2", "1000.2"}},
- 56: {locales: "dsb hsb", form: 4, integer: []string{"3", "4", "103", "104", "203", "204", "303", "304", "403", "404", "503", "504", "603", "604", "703", "704", "1003"}, decimal: []string{"0.3", "0.4", "1.3", "1.4", "2.3", "2.4", "3.3", "3.4", "4.3", "4.4", "5.3", "5.4", "6.3", "6.4", "7.3", "7.4", "10.3", "100.3", "1000.3"}},
- 57: {locales: "dsb hsb", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "0.5~1.0", "1.5~2.0", "2.5~2.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 58: {locales: "he iw", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 59: {locales: "he iw", form: 3, integer: []string{"2"}, decimal: []string(nil)},
- 60: {locales: "he iw", form: 5, integer: []string{"20", "30", "40", "50", "60", "70", "80", "90", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 61: {locales: "he iw", form: 0, integer: []string{"0", "3~17", "101", "1001"}, decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 62: {locales: "cs sk", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 63: {locales: "cs sk", form: 4, integer: []string{"2~4"}, decimal: []string(nil)},
- 64: {locales: "cs sk", form: 5, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 65: {locales: "cs sk", form: 0, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 66: {locales: "pl", form: 2, integer: []string{"1"}, decimal: []string(nil)},
- 67: {locales: "pl", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string(nil)},
- 68: {locales: "pl", form: 5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 69: {locales: "pl", form: 0, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 70: {locales: "be", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "71.0", "81.0", "101.0", "1001.0"}},
- 71: {locales: "be", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string{"2.0", "3.0", "4.0", "22.0", "23.0", "24.0", "32.0", "33.0", "102.0", "1002.0"}},
- 72: {locales: "be", form: 5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "11.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 73: {locales: "be", form: 0, integer: []string(nil), decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.1", "1000.1"}},
- 74: {locales: "lt", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "71.0", "81.0", "101.0", "1001.0"}},
- 75: {locales: "lt", form: 4, integer: []string{"2~9", "22~29", "102", "1002"}, decimal: []string{"2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "22.0", "102.0", "1002.0"}},
- 76: {locales: "lt", form: 5, integer: []string(nil), decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.1", "1000.1"}},
- 77: {locales: "lt", form: 0, integer: []string{"0", "10~20", "30", "40", "50", "60", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 78: {locales: "mt", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 79: {locales: "mt", form: 4, integer: []string{"0", "2~10", "102~107", "1002"}, decimal: []string{"0.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "10.0", "102.0", "1002.0"}},
- 80: {locales: "mt", form: 5, integer: []string{"11~19", "111~117", "1011"}, decimal: []string{"11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "111.0", "1011.0"}},
- 81: {locales: "mt", form: 0, integer: []string{"20~35", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 82: {locales: "ru uk", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "71", "81", "101", "1001"}, decimal: []string(nil)},
- 83: {locales: "ru uk", form: 4, integer: []string{"2~4", "22~24", "32~34", "42~44", "52~54", "62", "102", "1002"}, decimal: []string(nil)},
- 84: {locales: "ru uk", form: 5, integer: []string{"0", "5~19", "100", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 85: {locales: "ru uk", form: 0, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 86: {locales: "br", form: 2, integer: []string{"1", "21", "31", "41", "51", "61", "81", "101", "1001"}, decimal: []string{"1.0", "21.0", "31.0", "41.0", "51.0", "61.0", "81.0", "101.0", "1001.0"}},
- 87: {locales: "br", form: 3, integer: []string{"2", "22", "32", "42", "52", "62", "82", "102", "1002"}, decimal: []string{"2.0", "22.0", "32.0", "42.0", "52.0", "62.0", "82.0", "102.0", "1002.0"}},
- 88: {locales: "br", form: 4, integer: []string{"3", "4", "9", "23", "24", "29", "33", "34", "39", "43", "44", "49", "103", "1003"}, decimal: []string{"3.0", "4.0", "9.0", "23.0", "24.0", "29.0", "33.0", "34.0", "103.0", "1003.0"}},
- 89: {locales: "br", form: 5, integer: []string{"1000000"}, decimal: []string{"1000000.0", "1000000.00", "1000000.000"}},
- 90: {locales: "br", form: 0, integer: []string{"0", "5~8", "10~20", "100", "1000", "10000", "100000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.0", "100.0", "1000.0", "10000.0", "100000.0"}},
- 91: {locales: "ga", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 92: {locales: "ga", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 93: {locales: "ga", form: 4, integer: []string{"3~6"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "3.00", "4.00", "5.00", "6.00", "3.000", "4.000", "5.000", "6.000", "3.0000", "4.0000", "5.0000", "6.0000"}},
- 94: {locales: "ga", form: 5, integer: []string{"7~10"}, decimal: []string{"7.0", "8.0", "9.0", "10.0", "7.00", "8.00", "9.00", "10.00", "7.000", "8.000", "9.000", "10.000", "7.0000", "8.0000", "9.0000", "10.0000"}},
- 95: {locales: "ga", form: 0, integer: []string{"0", "11~25", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.0~0.9", "1.1~1.6", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 96: {locales: "gv", form: 2, integer: []string{"1", "11", "21", "31", "41", "51", "61", "71", "101", "1001"}, decimal: []string(nil)},
- 97: {locales: "gv", form: 3, integer: []string{"2", "12", "22", "32", "42", "52", "62", "72", "102", "1002"}, decimal: []string(nil)},
- 98: {locales: "gv", form: 4, integer: []string{"0", "20", "40", "60", "80", "100", "120", "140", "1000", "10000", "100000", "1000000"}, decimal: []string(nil)},
- 99: {locales: "gv", form: 5, integer: []string(nil), decimal: []string{"0.0~1.5", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 100: {locales: "gv", form: 0, integer: []string{"3~10", "13~19", "23", "103", "1003"}, decimal: []string(nil)},
- 101: {locales: "ar ars", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 102: {locales: "ar ars", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 103: {locales: "ar ars", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 104: {locales: "ar ars", form: 4, integer: []string{"3~10", "103~110", "1003"}, decimal: []string{"3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0", "10.0", "103.0", "1003.0"}},
- 105: {locales: "ar ars", form: 5, integer: []string{"11~26", "111", "1011"}, decimal: []string{"11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "111.0", "1011.0"}},
- 106: {locales: "ar ars", form: 0, integer: []string{"100~102", "200~202", "300~302", "400~402", "500~502", "600", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.1", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
- 107: {locales: "cy", form: 1, integer: []string{"0"}, decimal: []string{"0.0", "0.00", "0.000", "0.0000"}},
- 108: {locales: "cy", form: 2, integer: []string{"1"}, decimal: []string{"1.0", "1.00", "1.000", "1.0000"}},
- 109: {locales: "cy", form: 3, integer: []string{"2"}, decimal: []string{"2.0", "2.00", "2.000", "2.0000"}},
- 110: {locales: "cy", form: 4, integer: []string{"3"}, decimal: []string{"3.0", "3.00", "3.000", "3.0000"}},
- 111: {locales: "cy", form: 5, integer: []string{"6"}, decimal: []string{"6.0", "6.00", "6.000", "6.0000"}},
- 112: {locales: "cy", form: 0, integer: []string{"4", "5", "7~20", "100", "1000", "10000", "100000", "1000000"}, decimal: []string{"0.1~0.9", "1.1~1.7", "10.0", "100.0", "1000.0", "10000.0", "100000.0", "1000000.0"}},
-} // Size: 8160 bytes
-
-// Total table size 12936 bytes (12KiB); checksum: 8456DC5D
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/example_test.go
deleted file mode 100644
index c75408c0ea7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/example_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package plural_test
-
-import (
- "golang.org/x/text/feature/plural"
- "golang.org/x/text/language"
- "golang.org/x/text/message"
-)
-
-func ExampleSelect() {
- // Manually set some translations. This is typically done programmatically.
- message.Set(language.English, "%d files remaining",
- plural.Selectf(1, "%d",
- "=0", "done!",
- plural.One, "one file remaining",
- plural.Other, "%[1]d files remaining",
- ))
- message.Set(language.Dutch, "%d files remaining",
- plural.Selectf(1, "%d",
- "=0", "klaar!",
- // One can also use a string instead of a Kind
- "one", "nog één bestand te gaan",
- "other", "nog %[1]d bestanden te gaan",
- ))
-
- p := message.NewPrinter(language.English)
- p.Printf("%d files remaining", 5)
- p.Println()
- p.Printf("%d files remaining", 1)
- p.Println()
-
- p = message.NewPrinter(language.Dutch)
- p.Printf("%d files remaining", 1)
- p.Println()
- p.Printf("%d files remaining", 0)
- p.Println()
-
- // Output:
- // 5 files remaining
- // one file remaining
- // nog één bestand te gaan
- // klaar!
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/message_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/message_test.go
deleted file mode 100644
index b5bc47e87e6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/message_test.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package plural
-
-import (
- "fmt"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/catmsg"
- "golang.org/x/text/language"
- "golang.org/x/text/message/catalog"
-)
-
-func TestSelect(t *testing.T) {
- lang := language.English
- type test struct {
- arg interface{}
- result string
- err string
- }
- testCases := []struct {
- desc string
- msg catalog.Message
- err string
- tests []test
- }{{
- desc: "basic",
- msg: Selectf(1, "%d", "one", "foo", "other", "bar"),
- tests: []test{
- {arg: 0, result: "bar"},
- {arg: 1, result: "foo"},
- {arg: 2, result: "bar"},
- {arg: opposite(1), result: "bar"},
- {arg: opposite(2), result: "foo"},
- {arg: "unknown", result: "bar"}, // other
- },
- }, {
- desc: "comparisons",
- msg: Selectf(1, "%d",
- "=0", "zero",
- "=1", "one",
- "one", "cannot match", // never matches
- "<5", "<5", // never matches
- "=5", "=5",
- Other, "other"),
- tests: []test{
- {arg: 0, result: "zero"},
- {arg: 1, result: "one"},
- {arg: 2, result: "<5"},
- {arg: 4, result: "<5"},
- {arg: 5, result: "=5"},
- {arg: 6, result: "other"},
- {arg: "unknown", result: "other"},
- },
- }, {
- desc: "fractions",
- msg: Selectf(1, "%.2f", "one", "foo", "other", "bar"),
- tests: []test{
- // fractions are always plural in english
- {arg: 0, result: "bar"},
- {arg: 1, result: "bar"},
- },
- }, {
- desc: "decimal without fractions",
- msg: Selectf(1, "%.0f", "one", "foo", "other", "bar"),
- tests: []test{
- // fractions are always plural in english
- {arg: 0, result: "bar"},
- {arg: 1, result: "foo"},
- },
- }, {
- desc: "scientific",
- msg: Selectf(1, "%.0e", "one", "foo", "other", "bar"),
- tests: []test{
- {arg: 0, result: "bar"},
- {arg: 1, result: "foo"},
- },
- }, {
- desc: "variable",
- msg: Selectf(1, "%.1g", "one", "foo", "other", "bar"),
- tests: []test{
- // fractions are always plural in english
- {arg: 0, result: "bar"},
- {arg: 1, result: "foo"},
- {arg: 2, result: "bar"},
- },
- }, {
- desc: "default",
- msg: Selectf(1, "", "one", "foo", "other", "bar"),
- tests: []test{
- {arg: 0, result: "bar"},
- {arg: 1, result: "foo"},
- {arg: 2, result: "bar"},
- {arg: 1.0, result: "bar"},
- },
- }, {
- desc: "nested",
- msg: Selectf(1, "", "other", Selectf(2, "", "one", "foo", "other", "bar")),
- tests: []test{
- {arg: 0, result: "bar"},
- {arg: 1, result: "foo"},
- {arg: 2, result: "bar"},
- },
- }, {
- desc: "arg unavailable",
- msg: Selectf(100, "%.2f", "one", "foo", "other", "bar"),
- tests: []test{{arg: 1, result: "bar"}},
- }, {
- desc: "no match",
- msg: Selectf(1, "%.2f", "one", "foo"),
- tests: []test{{arg: 0, result: "bar", err: catmsg.ErrNoMatch.Error()}},
- }, {
- desc: "error invalid form",
- err: `invalid plural form "excessive"`,
- msg: Selectf(1, "%d", "excessive", "foo"),
- }, {
- desc: "error form not used by language",
- err: `form "many" not supported for language "en"`,
- msg: Selectf(1, "%d", "many", "foo"),
- }, {
- desc: "error invalid selector",
- err: `selector of type int; want string or Form`,
- msg: Selectf(1, "%d", 1, "foo"),
- }, {
- desc: "error missing message",
- err: `no message defined for selector one`,
- msg: Selectf(1, "%d", "one"),
- }, {
- desc: "error invalid number",
- err: `invalid number in selector "<1.00"`,
- msg: Selectf(1, "%d", "<1.00"),
- }, {
- desc: "error empty selector",
- err: `empty selector`,
- msg: Selectf(1, "%d", "", "foo"),
- }, {
- desc: "error invalid message",
- err: `message of type int; must be string or catalog.Message`,
- msg: Selectf(1, "%d", "one", 3),
- }, {
- desc: "nested error",
- err: `empty selector`,
- msg: Selectf(1, "", "other", Selectf(2, "", "")),
- }}
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- data, err := catmsg.Compile(lang, nil, tc.msg)
- chkError(t, err, tc.err)
- for _, tx := range tc.tests {
- t.Run(fmt.Sprint(tx.arg), func(t *testing.T) {
- r := renderer{arg: tx.arg}
- d := catmsg.NewDecoder(lang, &r, nil)
- err := d.Execute(data)
- chkError(t, err, tx.err)
- if r.result != tx.result {
- t.Errorf("got %q; want %q", r.result, tx.result)
- }
- })
- }
- })
- }
-}
-
-func chkError(t *testing.T, got error, want string) {
- if (got == nil && want != "") ||
- (got != nil && (want == "" || !strings.Contains(got.Error(), want))) {
- t.Fatalf("got %v; want %v", got, want)
- }
- if got != nil {
- t.SkipNow()
- }
-}
-
-type renderer struct {
- arg interface{}
- result string
-}
-
-func (r *renderer) Render(s string) { r.result += s }
-func (r *renderer) Arg(i int) interface{} {
- if i > 10 { // Allow testing "arg unavailable" path
- return nil
- }
- return r.arg
-}
-
-type opposite int
-
-func (o opposite) PluralForm(lang language.Tag, scale int) (Form, int) {
- if o == 1 {
- return Other, 1
- }
- return One, int(o)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/plural_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/plural_test.go
deleted file mode 100644
index b3cf4c44934..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/feature/plural/plural_test.go
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package plural
-
-import (
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestGetIntApprox(t *testing.T) {
- const big = 1234567890
- testCases := []struct {
- digits string
- start int
- end int
- nMod int
- want int
- }{
- {"123", 0, 1, 1, 1},
- {"123", 0, 2, 1, big},
- {"123", 0, 2, 2, 12},
- {"123", 3, 4, 2, 0},
- {"12345", 3, 4, 2, 4},
- {"40", 0, 1, 2, 4},
- {"1", 0, 7, 2, big},
-
- {"123", 0, 5, 2, big},
- {"123", 0, 5, 3, big},
- {"123", 0, 5, 4, big},
- {"123", 0, 5, 5, 12300},
- {"123", 0, 5, 6, 12300},
- {"123", 0, 5, 7, 12300},
-
- // Translation of examples in MatchDigits.
- // Integer parts
- {"123", 0, 3, 3, 123}, // 123
- {"1234", 0, 3, 3, 123}, // 123.4
- {"1", 0, 6, 8, 100000}, // 100000
-
- // Fraction parts
- {"123", 3, 3, 3, 0}, // 123
- {"1234", 3, 4, 3, 4}, // 123.4
- {"1234", 3, 5, 3, 40}, // 123.40
- {"1", 6, 8, 8, 0}, // 100000.00
- }
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("%s:%d:%d/%d", tc.digits, tc.start, tc.end, tc.nMod), func(t *testing.T) {
- got := getIntApprox(mkDigits(tc.digits), tc.start, tc.end, tc.nMod, big)
- if got != tc.want {
- t.Errorf("got %d; want %d", got, tc.want)
- }
- })
- }
-}
-
-func mkDigits(s string) []byte {
- b := []byte(s)
- for i := range b {
- b[i] -= '0'
- }
- return b
-}
-
-func TestValidForms(t *testing.T) {
- testCases := []struct {
- tag language.Tag
- want []Form
- }{
- {language.AmericanEnglish, []Form{Other, One}},
- {language.Portuguese, []Form{Other, One}},
- {language.Latvian, []Form{Other, Zero, One}},
- {language.Arabic, []Form{Other, Zero, One, Two, Few, Many}},
- {language.Russian, []Form{Other, One, Few, Many}},
- }
- for _, tc := range testCases {
- got := validForms(cardinal, tc.tag)
- if !reflect.DeepEqual(got, tc.want) {
- t.Errorf("validForms(%v): got %v; want %v", tc.tag, got, tc.want)
- }
- }
-}
-
-func TestOrdinal(t *testing.T) {
- testPlurals(t, Ordinal, ordinalTests)
-}
-
-func TestCardinal(t *testing.T) {
- testPlurals(t, Cardinal, cardinalTests)
-}
-
-func testPlurals(t *testing.T, p *Rules, testCases []pluralTest) {
- for _, tc := range testCases {
- for _, loc := range strings.Split(tc.locales, " ") {
- tag := language.MustParse(loc)
- // Test integers
- for _, s := range tc.integer {
- a := strings.Split(s, "~")
- from := parseUint(t, a[0])
- to := from
- if len(a) > 1 {
- to = parseUint(t, a[1])
- }
- for n := from; n <= to; n++ {
- t.Run(fmt.Sprintf("%s/int(%d)", loc, n), func(t *testing.T) {
- if f := p.matchComponents(tag, n, 0, 0); f != Form(tc.form) {
- t.Errorf("matchComponents: got %v; want %v", f, Form(tc.form))
- }
- digits := []byte(fmt.Sprint(n))
- for i := range digits {
- digits[i] -= '0'
- }
- if f := p.MatchDigits(tag, digits, len(digits), 0); f != Form(tc.form) {
- t.Errorf("MatchDigits: got %v; want %v", f, Form(tc.form))
- }
- })
- }
- }
- // Test decimals
- for _, s := range tc.decimal {
- a := strings.Split(s, "~")
- from, scale := parseFixedPoint(t, a[0])
- to := from
- if len(a) > 1 {
- var toScale int
- if to, toScale = parseFixedPoint(t, a[1]); toScale != scale {
- t.Fatalf("%s:%s: non-matching scales %d versus %d", loc, s, scale, toScale)
- }
- }
- m := 1
- for i := 0; i < scale; i++ {
- m *= 10
- }
- for n := from; n <= to; n++ {
- num := fmt.Sprintf("%[1]d.%0[3]*[2]d", n/m, n%m, scale)
- name := fmt.Sprintf("%s:dec(%s)", loc, num)
- t.Run(name, func(t *testing.T) {
- ff := n % m
- tt := ff
- w := scale
- for tt > 0 && tt%10 == 0 {
- w--
- tt /= 10
- }
- if f := p.MatchPlural(tag, n/m, scale, w, ff, tt); f != Form(tc.form) {
- t.Errorf("MatchPlural: got %v; want %v", f, Form(tc.form))
- }
- if f := p.matchComponents(tag, n/m, n%m, scale); f != Form(tc.form) {
- t.Errorf("matchComponents: got %v; want %v", f, Form(tc.form))
- }
- exp := strings.IndexByte(num, '.')
- digits := []byte(strings.Replace(num, ".", "", 1))
- for i := range digits {
- digits[i] -= '0'
- }
- if f := p.MatchDigits(tag, digits, exp, scale); f != Form(tc.form) {
- t.Errorf("MatchDigits: got %v; want %v", f, Form(tc.form))
- }
- })
- }
- }
- }
- }
-}
-
-func parseUint(t *testing.T, s string) int {
- val, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- t.Fatal(err)
- }
- return int(val)
-}
-
-func parseFixedPoint(t *testing.T, s string) (val, scale int) {
- p := strings.Index(s, ".")
- s = strings.Replace(s, ".", "", 1)
- v, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- t.Fatal(err)
- }
- return int(v), len(s) - p
-}
-
-func BenchmarkPluralSimpleCases(b *testing.B) {
- p := Cardinal
- en, _ := language.CompactIndex(language.English)
- zh, _ := language.CompactIndex(language.Chinese)
- for i := 0; i < b.N; i++ {
- matchPlural(p, en, 0, 0, 0) // 0
- matchPlural(p, en, 1, 0, 0) // 1
- matchPlural(p, en, 2, 12, 3) // 2.120
- matchPlural(p, zh, 0, 0, 0) // 0
- matchPlural(p, zh, 1, 0, 0) // 1
- matchPlural(p, zh, 2, 12, 3) // 2.120
- }
-}
-
-func BenchmarkPluralComplexCases(b *testing.B) {
- p := Cardinal
- ar, _ := language.CompactIndex(language.Arabic)
- lv, _ := language.CompactIndex(language.Latvian)
- for i := 0; i < b.N; i++ {
- matchPlural(p, lv, 0, 19, 2) // 0.19
- matchPlural(p, lv, 11, 0, 3) // 11.000
- matchPlural(p, lv, 100, 123, 4) // 0.1230
- matchPlural(p, ar, 0, 0, 0) // 0
- matchPlural(p, ar, 110, 0, 0) // 110
- matchPlural(p, ar, 99, 99, 2) // 99.99
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go
deleted file mode 100644
index 485d19c9632..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package catmsg
-
-import (
- "errors"
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-type renderer struct {
- args []int
- result string
-}
-
-func (r *renderer) Arg(i int) interface{} {
- if i >= len(r.args) {
- return nil
- }
- return r.args[i]
-}
-
-func (r *renderer) Render(s string) {
- if r.result != "" {
- r.result += "|"
- }
- r.result += s
-}
-
-func TestCodec(t *testing.T) {
- type test struct {
- args []int
- out string
- decErr string
- }
- single := func(out, err string) []test { return []test{{out: out, decErr: err}} }
- testCases := []struct {
- desc string
- m Message
- enc string
- encErr string
- tests []test
- }{{
- desc: "unused variable",
- m: &Var{"name", String("foo")},
- encErr: errIsVar.Error(),
- tests: single("", ""),
- }, {
- desc: "empty",
- m: empty{},
- tests: single("", ""),
- }, {
- desc: "sequence with empty",
- m: seq{empty{}},
- tests: single("", ""),
- }, {
- desc: "raw string",
- m: Raw("foo"),
- tests: single("foo", ""),
- }, {
- desc: "raw string no sub",
- m: Raw("${foo}"),
- enc: "\x02${foo}",
- tests: single("${foo}", ""),
- }, {
- desc: "simple string",
- m: String("foo"),
- tests: single("foo", ""),
- }, {
- desc: "missing var",
- m: String("foo${bar}"),
- enc: "\x03\x03foo\x02\x03bar",
- encErr: `unknown var "bar"`,
- tests: single("foo|bar", ""),
- }, {
- desc: "empty var",
- m: seq{
- &Var{"bar", seq{}},
- String("foo${bar}"),
- },
- enc: "\x00\x05\x04\x02bar\x03\x03foo\x00\x00",
- // TODO: recognize that it is cheaper to substitute bar.
- tests: single("foo|bar", ""),
- }, {
- desc: "var after value",
- m: seq{
- String("foo${bar}"),
- &Var{"bar", String("baz")},
- },
- encErr: errIsVar.Error(),
- tests: single("foo|bar", ""),
- }, {
- desc: "substitution",
- m: seq{
- &Var{"bar", String("baz")},
- String("foo${bar}"),
- },
- tests: single("foo|baz", ""),
- }, {
- desc: "shadowed variable",
- m: seq{
- &Var{"bar", String("baz")},
- seq{
- &Var{"bar", String("BAZ")},
- String("foo${bar}"),
- },
- },
- tests: single("foo|BAZ", ""),
- }, {
- desc: "nested value",
- m: nestedLang{nestedLang{empty{}}},
- tests: single("nl|nl", ""),
- }, {
- desc: "not shadowed variable",
- m: seq{
- &Var{"bar", String("baz")},
- seq{
- String("foo${bar}"),
- &Var{"bar", String("BAZ")},
- },
- },
- encErr: errIsVar.Error(),
- tests: single("foo|baz", ""),
- }, {
- desc: "duplicate variable",
- m: seq{
- &Var{"bar", String("baz")},
- &Var{"bar", String("BAZ")},
- String("${bar}"),
- },
- encErr: "catmsg: duplicate variable \"bar\"",
- tests: single("baz", ""),
- }, {
- desc: "complete incomplete variable",
- m: seq{
- &Var{"bar", incomplete{}},
- String("${bar}"),
- },
- enc: "\x00\t\b\x01\x01\x04\x04\x02bar\x03\x00\x00\x00",
- // TODO: recognize that it is cheaper to substitute bar.
- tests: single("bar", ""),
- }, {
- desc: "incomplete sequence",
- m: seq{
- incomplete{},
- incomplete{},
- },
- encErr: ErrIncomplete.Error(),
- tests: single("", ErrNoMatch.Error()),
- }, {
- desc: "compile error variable",
- m: seq{
- &Var{"bar", errorCompileMsg{}},
- String("${bar}"),
- },
- encErr: errCompileTest.Error(),
- tests: single("bar", ""),
- }, {
- desc: "compile error message",
- m: errorCompileMsg{},
- encErr: errCompileTest.Error(),
- tests: single("", ""),
- }, {
- desc: "compile error sequence",
- m: seq{
- errorCompileMsg{},
- errorCompileMsg{},
- },
- encErr: errCompileTest.Error(),
- tests: single("", ""),
- }, {
- desc: "macro",
- m: String("${exists(1)}"),
- tests: single("you betya!", ""),
- }, {
- desc: "macro incomplete",
- m: String("${incomplete(1)}"),
- enc: "\x03\x00\x01\nincomplete\x01",
- tests: single("incomplete", ""),
- }, {
- desc: "macro undefined at end",
- m: String("${undefined(1)}"),
- enc: "\x03\x00\x01\tundefined\x01",
- tests: single("undefined", "catmsg: undefined macro \"undefined\""),
- }, {
- desc: "macro undefined with more text following",
- m: String("${undefined(1)}."),
- enc: "\x03\x00\x01\tundefined\x01\x01.",
- tests: single("undefined|.", "catmsg: undefined macro \"undefined\""),
- }, {
- desc: "macro missing paren",
- m: String("${missing(1}"),
- encErr: "catmsg: missing ')'",
- tests: single("$!(MISSINGPAREN)", ""),
- }, {
- desc: "macro bad num",
- m: String("aa${bad(a)}"),
- encErr: "catmsg: invalid number \"a\"",
- tests: single("aa$!(BADNUM)", ""),
- }, {
- desc: "var missing brace",
- m: String("a${missing"),
- encErr: "catmsg: missing '}'",
- tests: single("a$!(MISSINGBRACE)", ""),
- }}
- r := &renderer{}
- dec := NewDecoder(language.Und, r, macros)
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- // Use a language other than Und so that we can test
- // passing the language to nested values.
- data, err := Compile(language.Dutch, macros, tc.m)
- if failErr(err, tc.encErr) {
- t.Errorf("encoding error: got %+q; want %+q", err, tc.encErr)
- }
- if tc.enc != "" && data != tc.enc {
- t.Errorf("encoding: got %+q; want %+q", data, tc.enc)
- }
- for _, st := range tc.tests {
- t.Run("", func(t *testing.T) {
- *r = renderer{args: st.args}
- if err = dec.Execute(data); failErr(err, st.decErr) {
- t.Errorf("decoding error: got %+q; want %+q", err, st.decErr)
- }
- if r.result != st.out {
- t.Errorf("decode: got %+q; want %+q", r.result, st.out)
- }
- })
- }
- })
- }
-}
-
-func failErr(got error, want string) bool {
- if got == nil {
- return want != ""
- }
- return want == "" || !strings.Contains(got.Error(), want)
-}
-
-type seq []Message
-
-func (s seq) Compile(e *Encoder) (err error) {
- err = ErrIncomplete
- e.EncodeMessageType(msgFirst)
- for _, m := range s {
- // Pass only the last error, but allow erroneous or complete messages
- // here to allow testing different scenarios.
- err = e.EncodeMessage(m)
- }
- return err
-}
-
-type empty struct{}
-
-func (empty) Compile(e *Encoder) (err error) { return nil }
-
-var msgIncomplete = Register(
- "golang.org/x/text/internal/catmsg.incomplete",
- func(d *Decoder) bool { return false })
-
-type incomplete struct{}
-
-func (incomplete) Compile(e *Encoder) (err error) {
- e.EncodeMessageType(msgIncomplete)
- return ErrIncomplete
-}
-
-var msgNested = Register(
- "golang.org/x/text/internal/catmsg.nested",
- func(d *Decoder) bool {
- d.Render(d.DecodeString())
- d.ExecuteMessage()
- return true
- })
-
-type nestedLang struct{ Message }
-
-func (n nestedLang) Compile(e *Encoder) (err error) {
- e.EncodeMessageType(msgNested)
- e.EncodeString(e.Language().String())
- e.EncodeMessage(n.Message)
- return nil
-}
-
-type errorCompileMsg struct{}
-
-var errCompileTest = errors.New("catmsg: compile error test")
-
-func (errorCompileMsg) Compile(e *Encoder) (err error) {
- return errCompileTest
-}
-
-type dictionary struct{}
-
-var (
- macros = dictionary{}
- dictMessages = map[string]string{
- "exists": compile(String("you betya!")),
- "incomplete": compile(incomplete{}),
- }
-)
-
-func (d dictionary) Lookup(key string) (data string, ok bool) {
- data, ok = dictMessages[key]
- return
-}
-
-func compile(m Message) (data string) {
- data, _ = Compile(language.Und, macros, m)
- return data
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/varint_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/varint_test.go
deleted file mode 100644
index 04d881d41d7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/catmsg/varint_test.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package catmsg
-
-import (
- "fmt"
- "testing"
-)
-
-func TestEncodeUint(t *testing.T) {
- testCases := []struct {
- x uint64
- enc string
- }{
- {0, "\x00"},
- {1, "\x01"},
- {2, "\x02"},
- {0x7f, "\x7f"},
- {0x80, "\x80\x01"},
- {1 << 14, "\x80\x80\x01"},
- {0xffffffff, "\xff\xff\xff\xff\x0f"},
- {0xffffffffffffffff, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01"},
- }
- for _, tc := range testCases {
- buf := [maxVarintBytes]byte{}
- got := string(buf[:encodeUint(buf[:], tc.x)])
- if got != tc.enc {
- t.Errorf("EncodeUint(%#x) = %q; want %q", tc.x, got, tc.enc)
- }
- }
-}
-
-func TestDecodeUint(t *testing.T) {
- testCases := []struct {
- x uint64
- size int
- enc string
- err error
- }{{
- x: 0,
- size: 0,
- enc: "",
- err: errIllegalVarint,
- }, {
- x: 0,
- size: 1,
- enc: "\x80",
- err: errIllegalVarint,
- }, {
- x: 0,
- size: 3,
- enc: "\x80\x80\x80",
- err: errIllegalVarint,
- }, {
- x: 0,
- size: 1,
- enc: "\x00",
- }, {
- x: 1,
- size: 1,
- enc: "\x01",
- }, {
- x: 2,
- size: 1,
- enc: "\x02",
- }, {
- x: 0x7f,
- size: 1,
- enc: "\x7f",
- }, {
- x: 0x80,
- size: 2,
- enc: "\x80\x01",
- }, {
- x: 1 << 14,
- size: 3,
- enc: "\x80\x80\x01",
- }, {
- x: 0xffffffff,
- size: 5,
- enc: "\xff\xff\xff\xff\x0f",
- }, {
- x: 0xffffffffffffffff,
- size: 10,
- enc: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01",
- }, {
- x: 0xffffffffffffffff,
- size: 10,
- enc: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x00",
- }, {
- x: 0,
- size: 10,
- enc: "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01",
- err: errVarintTooLarge,
- }}
- forms := []struct {
- name string
- decode func(s string) (x uint64, size int, err error)
- }{
- {"decode", func(s string) (x uint64, size int, err error) {
- return decodeUint([]byte(s))
- }},
- {"decodeString", decodeUintString},
- }
- for _, f := range forms {
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("%s:%q", f.name, tc.enc), func(t *testing.T) {
- x, size, err := f.decode(tc.enc)
- if err != tc.err {
- t.Errorf("err = %q; want %q", err, tc.err)
- }
- if size != tc.size {
- t.Errorf("size = %d; want %d", size, tc.size)
- }
- if x != tc.x {
- t.Errorf("decode = %#x; want %#x", x, tc.x)
- }
- })
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/cldrtree/cldrtree_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/cldrtree/cldrtree_test.go
deleted file mode 100644
index d93c7633700..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/cldrtree/cldrtree_test.go
+++ /dev/null
@@ -1,456 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldrtree
-
-import (
- "bytes"
- "flag"
- "io/ioutil"
- "log"
- "math/rand"
- "path/filepath"
- "reflect"
- "regexp"
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/language"
- "golang.org/x/text/unicode/cldr"
-)
-
-var genOutput = flag.Bool("gen", false, "generate output files")
-
-func TestAliasRegexp(t *testing.T) {
- testCases := []struct {
- alias string
- want []string
- }{{
- alias: "miscPatterns[@numberSystem='latn']",
- want: []string{
- "miscPatterns[@numberSystem='latn']",
- "miscPatterns",
- "[@numberSystem='latn']",
- "numberSystem",
- "latn",
- },
- }, {
- alias: `calendar[@type='greg-foo']/days/`,
- want: []string{
- "calendar[@type='greg-foo']",
- "calendar",
- "[@type='greg-foo']",
- "type",
- "greg-foo",
- },
- }, {
- alias: "eraAbbr",
- want: []string{
- "eraAbbr",
- "eraAbbr",
- "",
- "",
- "",
- },
- }, {
- // match must be anchored at beginning.
- alias: `../calendar[@type='gregorian']/days/`,
- }}
- for _, tc := range testCases {
- t.Run(tc.alias, func(t *testing.T) {
- got := aliasRe.FindStringSubmatch(tc.alias)
- if !reflect.DeepEqual(got, tc.want) {
- t.Errorf("got %v; want %v", got, tc.want)
- }
- })
- }
-}
-
-func TestBuild(t *testing.T) {
- tree1, _ := loadTestdata(t, "test1")
- tree2, _ := loadTestdata(t, "test2")
-
- // Constants for second test test
- const (
- calendar = iota
- field
- )
- const (
- month = iota
- era
- filler
- cyclicNameSet
- )
- const (
- abbreviated = iota
- narrow
- wide
- )
-
- testCases := []struct {
- desc string
- tree *Tree
- locale string
- path []uint16
- isFeature bool
- result string
- }{{
- desc: "und/chinese month format wide m1",
- tree: tree1,
- locale: "und",
- path: path(calendar, 0, month, 0, wide, 1),
- result: "cM01",
- }, {
- desc: "und/chinese month format wide m12",
- tree: tree1,
- locale: "und",
- path: path(calendar, 0, month, 0, wide, 12),
- result: "cM12",
- }, {
- desc: "und/non-existing value",
- tree: tree1,
- locale: "und",
- path: path(calendar, 0, month, 0, wide, 13),
- result: "",
- }, {
- desc: "und/dangi:chinese month format wide",
- tree: tree1,
- locale: "und",
- path: path(calendar, 1, month, 0, wide, 1),
- result: "cM01",
- }, {
- desc: "und/chinese month format abbreviated:wide",
- tree: tree1,
- locale: "und",
- path: path(calendar, 0, month, 0, abbreviated, 1),
- result: "cM01",
- }, {
- desc: "und/chinese month format narrow:wide",
- tree: tree1,
- locale: "und",
- path: path(calendar, 0, month, 0, narrow, 1),
- result: "cM01",
- }, {
- desc: "und/gregorian month format wide",
- tree: tree1,
- locale: "und",
- path: path(calendar, 2, month, 0, wide, 2),
- result: "gM02",
- }, {
- desc: "und/gregorian month format:stand-alone narrow",
- tree: tree1,
- locale: "und",
- path: path(calendar, 2, month, 0, narrow, 1),
- result: "1",
- }, {
- desc: "und/gregorian month stand-alone:format abbreviated",
- tree: tree1,
- locale: "und",
- path: path(calendar, 2, month, 1, abbreviated, 1),
- result: "gM01",
- }, {
- desc: "und/gregorian month stand-alone:format wide ",
- tree: tree1,
- locale: "und",
- path: path(calendar, 2, month, 1, abbreviated, 1),
- result: "gM01",
- }, {
- desc: "und/dangi:chinese month format narrow:wide ",
- tree: tree1,
- locale: "und",
- path: path(calendar, 1, month, 0, narrow, 4),
- result: "cM04",
- }, {
- desc: "und/field era displayname 0",
- tree: tree2,
- locale: "und",
- path: path(field, 0, 0, 0),
- result: "Era",
- }, {
- desc: "en/field era displayname 0",
- tree: tree2,
- locale: "en",
- path: path(field, 0, 0, 0),
- result: "era",
- }, {
- desc: "und/calendar hebrew format wide 7-leap",
- tree: tree2,
- locale: "und",
- path: path(calendar, 7, month, 0, wide, 0),
- result: "Adar II",
- }, {
- desc: "en-GB:en-001:en:und/calendar hebrew format wide 7-leap",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 7, month, 0, wide, 0),
- result: "Adar II",
- }, {
- desc: "und/buddhist month format wide 11",
- tree: tree2,
- locale: "und",
- path: path(calendar, 0, month, 0, wide, 12),
- result: "genWideM12",
- }, {
- desc: "en-GB/gregorian month stand-alone narrow 2",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, month, 1, narrow, 3),
- result: "gbNarrowM3",
- }, {
- desc: "en-GB/gregorian month format narrow 3/missing in en-GB",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, month, 0, narrow, 4),
- result: "enNarrowM4",
- }, {
- desc: "en-GB/gregorian month format narrow 3/missing in en and en-GB",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, month, 0, narrow, 7),
- result: "gregNarrowM7",
- }, {
- desc: "en-GB/gregorian month format narrow 3/missing in en and en-GB",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, month, 0, narrow, 7),
- result: "gregNarrowM7",
- }, {
- desc: "en-GB/gregorian era narrow",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, era, abbreviated, 0, 1),
- isFeature: true,
- result: "AD",
- }, {
- desc: "en-GB/gregorian era narrow",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, era, narrow, 0, 0),
- isFeature: true,
- result: "BC",
- }, {
- desc: "en-GB/gregorian era narrow",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 6, era, wide, 1, 0),
- isFeature: true,
- result: "Before Common Era",
- }, {
- desc: "en-GB/dangi:chinese cyclicName, months, format, narrow:abbreviated 2",
- tree: tree2,
- locale: "en-GB",
- path: path(calendar, 1, cyclicNameSet, 3, 0, 1, 2),
- isFeature: true,
- result: "year2",
- }, {
- desc: "en-GB/field era-narrow ",
- tree: tree2,
- locale: "en-GB",
- path: path(field, 2, 0, 0),
- result: "era",
- }, {
- desc: "en-GB/field month-narrow relativeTime future one",
- tree: tree2,
- locale: "en-GB",
- path: path(field, 5, 2, 0, 1),
- isFeature: true,
- result: "001NarrowFutMOne",
- }, {
- // Don't fall back to the one of "en".
- desc: "en-GB/field month-short relativeTime past one:other",
- tree: tree2,
- locale: "en-GB",
- path: path(field, 4, 2, 1, 1),
- isFeature: true,
- result: "001ShortPastMOther",
- }, {
- desc: "en-GB/field month relativeTime future two:other",
- tree: tree2,
- locale: "en-GB",
- path: path(field, 3, 2, 0, 2),
- isFeature: true,
- result: "enFutMOther",
- }}
-
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- tag, _ := language.CompactIndex(language.MustParse(tc.locale))
- s := tc.tree.lookup(tag, tc.isFeature, tc.path...)
- if s != tc.result {
- t.Errorf("got %q; want %q", s, tc.result)
- }
- })
- }
-}
-
-func path(e ...uint16) []uint16 { return e }
-
-func TestGen(t *testing.T) {
- testCases := []string{"test1", "test2"}
- for _, tc := range testCases {
- t.Run(tc, func(t *testing.T) {
- _, got := loadTestdata(t, tc)
-
- // Remove sizes that may vary per architecture.
- re := regexp.MustCompile("// Size: [0-9]*")
- got = re.ReplaceAllLiteral(got, []byte("// Size: xxxx"))
- re = regexp.MustCompile("// Total table size [0-9]*")
- got = re.ReplaceAllLiteral(got, []byte("// Total table size: xxxx"))
-
- file := filepath.Join("testdata", tc, "output.go")
- if *genOutput {
- ioutil.WriteFile(file, got, 0700)
- t.SkipNow()
- }
-
- b, err := ioutil.ReadFile(file)
- if err != nil {
- t.Fatalf("failed to open file: %v", err)
- }
- if want := string(b); string(got) != want {
- t.Log(string(got))
- t.Errorf("files differ")
- }
- })
- }
-}
-
-func loadTestdata(t *testing.T, test string) (tree *Tree, file []byte) {
- b := New("test")
-
- var d cldr.Decoder
-
- data, err := d.DecodePath(filepath.Join("testdata", test))
- if err != nil {
- t.Fatalf("error decoding testdata: %v", err)
- }
-
- context := Enum("context")
- widthMap := func(s string) string {
- // Align era with width values.
- if r, ok := map[string]string{
- "eraAbbr": "abbreviated",
- "eraNarrow": "narrow",
- "eraNames": "wide",
- }[s]; ok {
- s = r
- }
- return "w" + strings.Title(s)
- }
- width := EnumFunc("width", widthMap, "abbreviated", "narrow", "wide")
- month := Enum("month", "leap7")
- relative := EnumFunc("relative", func(s string) string {
- x, err := strconv.ParseInt(s, 10, 8)
- if err != nil {
- log.Fatal("Invalid number:", err)
- }
- return []string{
- "before1",
- "current",
- "after1",
- }[x+1]
- })
- cycleType := EnumFunc("cycleType", func(s string) string {
- return "cyc" + strings.Title(s)
- })
- r := rand.New(rand.NewSource(0))
-
- for _, loc := range data.Locales() {
- ldml := data.RawLDML(loc)
- x := b.Locale(language.Make(loc))
-
- if x := x.Index(ldml.Dates.Calendars); x != nil {
- for _, cal := range ldml.Dates.Calendars.Calendar {
- x := x.IndexFromType(cal)
- if x := x.Index(cal.Months); x != nil {
- for _, mc := range cal.Months.MonthContext {
- x := x.IndexFromType(mc, context)
- for _, mw := range mc.MonthWidth {
- x := x.IndexFromType(mw, width)
- for _, m := range mw.Month {
- x.SetValue(m.Yeartype+m.Type, m, month)
- }
- }
- }
- }
- if x := x.Index(cal.CyclicNameSets); x != nil {
- for _, cns := range cal.CyclicNameSets.CyclicNameSet {
- x := x.IndexFromType(cns, cycleType)
- for _, cc := range cns.CyclicNameContext {
- x := x.IndexFromType(cc, context)
- for _, cw := range cc.CyclicNameWidth {
- x := x.IndexFromType(cw, width)
- for _, c := range cw.CyclicName {
- x.SetValue(c.Type, c)
- }
- }
- }
- }
- }
- if x := x.Index(cal.Eras); x != nil {
- opts := []Option{width, SharedType()}
- if x := x.Index(cal.Eras.EraNames, opts...); x != nil {
- for _, e := range cal.Eras.EraNames.Era {
- x.IndexFromAlt(e).SetValue(e.Type, e)
- }
- }
- if x := x.Index(cal.Eras.EraAbbr, opts...); x != nil {
- for _, e := range cal.Eras.EraAbbr.Era {
- x.IndexFromAlt(e).SetValue(e.Type, e)
- }
- }
- if x := x.Index(cal.Eras.EraNarrow, opts...); x != nil {
- for _, e := range cal.Eras.EraNarrow.Era {
- x.IndexFromAlt(e).SetValue(e.Type, e)
- }
- }
- }
- {
- // Ensure having more than 2 buckets.
- f := x.IndexWithName("filler")
- b := make([]byte, maxStrlen)
- opt := &options{parent: x}
- r.Read(b)
- f.setValue("0", string(b), opt)
- }
- }
- }
- if x := x.Index(ldml.Dates.Fields); x != nil {
- for _, f := range ldml.Dates.Fields.Field {
- x := x.IndexFromType(f)
- for _, d := range f.DisplayName {
- x.Index(d).SetValue("", d)
- }
- for _, r := range f.Relative {
- x.Index(r).SetValue(r.Type, r, relative)
- }
- for _, rt := range f.RelativeTime {
- x := x.Index(rt).IndexFromType(rt)
- for _, p := range rt.RelativeTimePattern {
- x.SetValue(p.Count, p)
- }
- }
- for _, rp := range f.RelativePeriod {
- x.Index(rp).SetValue("", rp)
- }
- }
- }
- }
-
- tree, err = build(b)
- if err != nil {
- t.Fatal("error building tree:", err)
- }
- w := gen.NewCodeWriter()
- generate(b, tree, w)
- generateTestData(b, w)
- buf := &bytes.Buffer{}
- if _, err = w.WriteGo(buf, "test", ""); err != nil {
- t.Log(buf.String())
- t.Fatal("error generating code:", err)
- }
- return tree, buf.Bytes()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collate_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collate_test.go
deleted file mode 100644
index 580c85c22da..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collate_test.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab_test
-
-// This file contains tests which need to import package collate, which causes
-// an import cycle when done within package colltab itself.
-
-import (
- "bytes"
- "testing"
- "unicode"
-
- "golang.org/x/text/collate"
- "golang.org/x/text/language"
- "golang.org/x/text/unicode/rangetable"
-)
-
-// assigned is used to only test runes that are inside the scope of the Unicode
-// version used to generation the collation table.
-var assigned = rangetable.Assigned(collate.UnicodeVersion)
-
-func TestNonDigits(t *testing.T) {
- c := collate.New(language.English, collate.Loose, collate.Numeric)
-
- // Verify that all non-digit numbers sort outside of the number range.
- for r, hi := rune(unicode.N.R16[0].Lo), rune(unicode.N.R32[0].Hi); r <= hi; r++ {
- if unicode.In(r, unicode.Nd) || !unicode.In(r, assigned) {
- continue
- }
- if a := string(r); c.CompareString(a, "0") != -1 && c.CompareString(a, "999999") != 1 {
- t.Errorf("%+q non-digit number is collated as digit", a)
- }
- }
-}
-
-func TestNumericCompare(t *testing.T) {
- c := collate.New(language.English, collate.Loose, collate.Numeric)
-
- // Iterate over all digits.
- for _, r16 := range unicode.Nd.R16 {
- testDigitCompare(t, c, rune(r16.Lo), rune(r16.Hi))
- }
- for _, r32 := range unicode.Nd.R32 {
- testDigitCompare(t, c, rune(r32.Lo), rune(r32.Hi))
- }
-}
-
-func testDigitCompare(t *testing.T, c *collate.Collator, zero, nine rune) {
- if !unicode.In(zero, assigned) {
- return
- }
- n := int(nine - zero + 1)
- if n%10 != 0 {
- t.Fatalf("len([%+q, %+q]) = %d; want a multiple of 10", zero, nine, n)
- }
- for _, tt := range []struct {
- prefix string
- b [11]string
- }{
- {
- prefix: "",
- b: [11]string{
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
- },
- },
- {
- prefix: "1",
- b: [11]string{
- "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
- },
- },
- {
- prefix: "0",
- b: [11]string{
- "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10",
- },
- },
- {
- prefix: "00",
- b: [11]string{
- "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010",
- },
- },
- {
- prefix: "9",
- b: [11]string{
- "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100",
- },
- },
- } {
- for k := 0; k <= n; k++ {
- i := k % 10
- a := tt.prefix + string(zero+rune(i))
- for j, b := range tt.b {
- want := 0
- switch {
- case i < j:
- want = -1
- case i > j:
- want = 1
- }
- got := c.CompareString(a, b)
- if got != want {
- t.Errorf("Compare(%+q, %+q) = %d; want %d", a, b, got, want)
- return
- }
- }
- }
- }
-}
-
-func BenchmarkNumericWeighter(b *testing.B) {
- c := collate.New(language.English, collate.Numeric)
- input := bytes.Repeat([]byte("Testing, testing 123..."), 100)
- b.SetBytes(int64(2 * len(input)))
- for i := 0; i < b.N; i++ {
- c.Compare(input, input)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collelem_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collelem_test.go
deleted file mode 100644
index f131ecc32d5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/collelem_test.go
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "fmt"
- "testing"
- "unicode"
-)
-
-func (e Elem) String() string {
- q := ""
- if v := e.Quaternary(); v == MaxQuaternary {
- q = "max"
- } else {
- q = fmt.Sprint(v)
- }
- return fmt.Sprintf("[%d, %d, %d, %s]",
- e.Primary(),
- e.Secondary(),
- e.Tertiary(),
- q)
-}
-
-type ceTest struct {
- f func(inout []int) (Elem, ceType)
- arg []int
-}
-
-func makeCE(weights []int) Elem {
- ce, _ := MakeElem(weights[0], weights[1], weights[2], uint8(weights[3]))
- return ce
-}
-
-var defaultValues = []int{0, defaultSecondary, defaultTertiary, 0}
-
-func e(w ...int) Elem {
- return makeCE(append(w, defaultValues[len(w):]...))
-}
-
-func makeContractIndex(index, n, offset int) Elem {
- const (
- contractID = 0xC0000000
- maxNBits = 4
- maxTrieIndexBits = 12
- maxContractOffsetBits = 13
- )
- ce := Elem(contractID)
- ce += Elem(offset << (maxNBits + maxTrieIndexBits))
- ce += Elem(index << maxNBits)
- ce += Elem(n)
- return ce
-}
-
-func makeExpandIndex(index int) Elem {
- const expandID = 0xE0000000
- return expandID + Elem(index)
-}
-
-func makeDecompose(t1, t2 int) Elem {
- const decompID = 0xF0000000
- return Elem(t2<<8+t1) + decompID
-}
-
-func normalCE(inout []int) (ce Elem, t ceType) {
- ce = makeCE(inout)
- inout[0] = ce.Primary()
- inout[1] = ce.Secondary()
- inout[2] = int(ce.Tertiary())
- inout[3] = int(ce.CCC())
- return ce, ceNormal
-}
-
-func expandCE(inout []int) (ce Elem, t ceType) {
- ce = makeExpandIndex(inout[0])
- inout[0] = splitExpandIndex(ce)
- return ce, ceExpansionIndex
-}
-
-func contractCE(inout []int) (ce Elem, t ceType) {
- ce = makeContractIndex(inout[0], inout[1], inout[2])
- i, n, o := splitContractIndex(ce)
- inout[0], inout[1], inout[2] = i, n, o
- return ce, ceContractionIndex
-}
-
-func decompCE(inout []int) (ce Elem, t ceType) {
- ce = makeDecompose(inout[0], inout[1])
- t1, t2 := splitDecompose(ce)
- inout[0], inout[1] = int(t1), int(t2)
- return ce, ceDecompose
-}
-
-var ceTests = []ceTest{
- {normalCE, []int{0, 0, 0, 0}},
- {normalCE, []int{0, 30, 3, 0}},
- {normalCE, []int{0, 30, 3, 0xFF}},
- {normalCE, []int{100, defaultSecondary, defaultTertiary, 0}},
- {normalCE, []int{100, defaultSecondary, defaultTertiary, 0xFF}},
- {normalCE, []int{100, defaultSecondary, 3, 0}},
- {normalCE, []int{0x123, defaultSecondary, 8, 0xFF}},
-
- {contractCE, []int{0, 0, 0}},
- {contractCE, []int{1, 1, 1}},
- {contractCE, []int{1, (1 << maxNBits) - 1, 1}},
- {contractCE, []int{(1 << maxTrieIndexBits) - 1, 1, 1}},
- {contractCE, []int{1, 1, (1 << maxContractOffsetBits) - 1}},
-
- {expandCE, []int{0}},
- {expandCE, []int{5}},
- {expandCE, []int{(1 << maxExpandIndexBits) - 1}},
-
- {decompCE, []int{0, 0}},
- {decompCE, []int{1, 1}},
- {decompCE, []int{0x1F, 0x1F}},
-}
-
-func TestColElem(t *testing.T) {
- for i, tt := range ceTests {
- inout := make([]int, len(tt.arg))
- copy(inout, tt.arg)
- ce, typ := tt.f(inout)
- if ce.ctype() != typ {
- t.Errorf("%d: type is %d; want %d (ColElem: %X)", i, ce.ctype(), typ, ce)
- }
- for j, a := range tt.arg {
- if inout[j] != a {
- t.Errorf("%d: argument %d is %X; want %X (ColElem: %X)", i, j, inout[j], a, ce)
- }
- }
- }
-}
-
-type implicitTest struct {
- r rune
- p int
-}
-
-var implicitTests = []implicitTest{
- {0x33FF, 0x533FF},
- {0x3400, 0x23400},
- {0x4DC0, 0x54DC0},
- {0x4DFF, 0x54DFF},
- {0x4E00, 0x14E00},
- {0x9FCB, 0x19FCB},
- {0xA000, 0x5A000},
- {0xF8FF, 0x5F8FF},
- {0xF900, 0x1F900},
- {0xFA23, 0x1FA23},
- {0xFAD9, 0x1FAD9},
- {0xFB00, 0x5FB00},
- {0x20000, 0x40000},
- {0x2B81C, 0x4B81C},
- {unicode.MaxRune, 0x15FFFF}, // maximum primary value
-}
-
-func TestImplicit(t *testing.T) {
- for _, tt := range implicitTests {
- if p := implicitPrimary(tt.r); p != tt.p {
- t.Errorf("%U: was %X; want %X", tt.r, p, tt.p)
- }
- }
-}
-
-func TestUpdateTertiary(t *testing.T) {
- tests := []struct {
- in, out Elem
- t uint8
- }{
- {0x4000FE20, 0x0000FE8A, 0x0A},
- {0x4000FE21, 0x0000FEAA, 0x0A},
- {0x0000FE8B, 0x0000FE83, 0x03},
- {0x82FF0188, 0x9BFF0188, 0x1B},
- {0xAFF0CC02, 0xAFF0CC1B, 0x1B},
- }
- for i, tt := range tests {
- if out := tt.in.updateTertiary(tt.t); out != tt.out {
- t.Errorf("%d: was %X; want %X", i, out, tt.out)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/colltab_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/colltab_test.go
deleted file mode 100644
index c403ac34618..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/colltab_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package colltab
-
-import (
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestMatchLang(t *testing.T) {
- tags := []language.Tag{
- 0: language.Und,
- 1: language.MustParse("bs"),
- 2: language.German,
- 3: language.English,
- 4: language.AmericanEnglish,
- 5: language.MustParse("en-US-u-va-posix"),
- 6: language.Portuguese,
- 7: language.Serbian,
- 8: language.MustParse("sr-Latn"),
- 9: language.Chinese,
- 10: language.MustParse("zh-u-co-stroke"),
- 11: language.MustParse("zh-Hant-u-co-pinyin"),
- 12: language.TraditionalChinese,
- }
- for i, tc := range []struct {
- x int
- t language.Tag
- }{
- {0, language.Und},
- {0, language.Persian}, // Default to first element when no match.
- {3, language.English},
- {4, language.AmericanEnglish},
- {5, language.MustParse("en-US-u-va-posix")}, // Ext. variant match.
- {4, language.MustParse("en-US-u-va-noposix")}, // Ext. variant mismatch.
- {3, language.MustParse("en-UK-u-va-noposix")}, // Ext. variant mismatch.
- {7, language.Serbian},
- {0, language.Croatian}, // Don't match to close language!
- {0, language.MustParse("gsw")}, // Don't match to close language!
- {1, language.MustParse("bs-Cyrl")}, // Odd, but correct.
- {1, language.MustParse("bs-Latn")}, // Estimated script drops.
- {8, language.MustParse("sr-Latn")},
- {9, language.Chinese},
- {9, language.SimplifiedChinese},
- {12, language.TraditionalChinese},
- {11, language.MustParse("zh-Hant-u-co-pinyin")},
- // TODO: should this be 12? Either inherited value (10) or default is
- // fine in this case, though. Other locales are not affected.
- {10, language.MustParse("zh-Hant-u-co-stroke")},
- // There is no "phonebk" sorting order for zh-Hant, so use default.
- {12, language.MustParse("zh-Hant-u-co-phonebk")},
- {10, language.MustParse("zh-u-co-stroke")},
- {12, language.MustParse("und-TW")}, // Infer script and language.
- {12, language.MustParse("und-HK")}, // Infer script and language.
- {6, language.MustParse("und-BR")}, // Infer script and language.
- {6, language.MustParse("und-PT")}, // Infer script and language.
- {2, language.MustParse("und-Latn-DE")}, // Infer language.
- {0, language.MustParse("und-Jpan-BR")}, // Infers "ja", so no match.
- {0, language.MustParse("zu")}, // No match past index.
- } {
- if x := MatchLang(tc.t, tags); x != tc.x {
- t.Errorf("%d: MatchLang(%q, tags) = %d; want %d", i, tc.t, x, tc.x)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/contract_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/contract_test.go
deleted file mode 100644
index ce2871dd4f6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/contract_test.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "testing"
-)
-
-type lookupStrings struct {
- str string
- offset int
- n int // bytes consumed from input
-}
-
-type LookupTest struct {
- lookup []lookupStrings
- n int
- tries ContractTrieSet
-}
-
-var lookupTests = []LookupTest{{
- []lookupStrings{
- {"abc", 1, 3},
- {"a", 0, 0},
- {"b", 0, 0},
- {"c", 0, 0},
- {"d", 0, 0},
- },
- 1,
- ContractTrieSet{
- {'a', 0, 1, 0xFF},
- {'b', 0, 1, 0xFF},
- {'c', 'c', 0, 1},
- },
-}, {
- []lookupStrings{
- {"abc", 1, 3},
- {"abd", 2, 3},
- {"abe", 3, 3},
- {"a", 0, 0},
- {"ab", 0, 0},
- {"d", 0, 0},
- {"f", 0, 0},
- },
- 1,
- ContractTrieSet{
- {'a', 0, 1, 0xFF},
- {'b', 0, 1, 0xFF},
- {'c', 'e', 0, 1},
- },
-}, {
- []lookupStrings{
- {"abc", 1, 3},
- {"ab", 2, 2},
- {"a", 3, 1},
- {"abcd", 1, 3},
- {"abe", 2, 2},
- },
- 1,
- ContractTrieSet{
- {'a', 0, 1, 3},
- {'b', 0, 1, 2},
- {'c', 'c', 0, 1},
- },
-}, {
- []lookupStrings{
- {"abc", 1, 3},
- {"abd", 2, 3},
- {"ab", 3, 2},
- {"ac", 4, 2},
- {"a", 5, 1},
- {"b", 6, 1},
- {"ba", 6, 1},
- },
- 2,
- ContractTrieSet{
- {'b', 'b', 0, 6},
- {'a', 0, 2, 5},
- {'c', 'c', 0, 4},
- {'b', 0, 1, 3},
- {'c', 'd', 0, 1},
- },
-}, {
- []lookupStrings{
- {"bcde", 2, 4},
- {"bc", 7, 2},
- {"ab", 6, 2},
- {"bcd", 5, 3},
- {"abcd", 1, 4},
- {"abc", 4, 3},
- {"bcdf", 3, 4},
- },
- 2,
- ContractTrieSet{
- {'b', 3, 1, 0xFF},
- {'a', 0, 1, 0xFF},
- {'b', 0, 1, 6},
- {'c', 0, 1, 4},
- {'d', 'd', 0, 1},
- {'c', 0, 1, 7},
- {'d', 0, 1, 5},
- {'e', 'f', 0, 2},
- },
-}}
-
-func lookup(c *ContractTrieSet, nnode int, s []uint8) (i, n int) {
- scan := c.scanner(0, nnode, s)
- scan.scan(0)
- return scan.result()
-}
-
-func TestLookupContraction(t *testing.T) {
- for i, tt := range lookupTests {
- cts := ContractTrieSet(tt.tries)
- for j, lu := range tt.lookup {
- str := lu.str
- for _, s := range []string{str, str + "X"} {
- const msg = `%d:%d: %s of "%s" %v; want %v`
- offset, n := lookup(&cts, tt.n, []byte(s))
- if offset != lu.offset {
- t.Errorf(msg, i, j, "offset", s, offset, lu.offset)
- }
- if n != lu.n {
- t.Errorf(msg, i, j, "bytes consumed", s, n, len(str))
- }
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/iter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/iter_test.go
deleted file mode 100644
index 5783534c7df..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/iter_test.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "testing"
-)
-
-func TestDoNorm(t *testing.T) {
- const div = -1 // The insertion point of the next block.
- tests := []struct {
- in, out []int
- }{{
- in: []int{4, div, 3},
- out: []int{3, 4},
- }, {
- in: []int{4, div, 3, 3, 3},
- out: []int{3, 3, 3, 4},
- }, {
- in: []int{0, 4, div, 3},
- out: []int{0, 3, 4},
- }, {
- in: []int{0, 0, 4, 5, div, 3, 3},
- out: []int{0, 0, 3, 3, 4, 5},
- }, {
- in: []int{0, 0, 1, 4, 5, div, 3, 3},
- out: []int{0, 0, 1, 3, 3, 4, 5},
- }, {
- in: []int{0, 0, 1, 4, 5, div, 4, 4},
- out: []int{0, 0, 1, 4, 4, 4, 5},
- },
- }
- for j, tt := range tests {
- i := Iter{}
- var w, p int
- for k, cc := range tt.in {
-
- if cc == div {
- w = 100
- p = k
- continue
- }
- i.Elems = append(i.Elems, makeCE([]int{w, defaultSecondary, 2, cc}))
- }
- i.doNorm(p, i.Elems[p].CCC())
- if len(i.Elems) != len(tt.out) {
- t.Errorf("%d: length was %d; want %d", j, len(i.Elems), len(tt.out))
- }
- prevCCC := uint8(0)
- for k, ce := range i.Elems {
- if int(ce.CCC()) != tt.out[k] {
- t.Errorf("%d:%d: unexpected CCC. Was %d; want %d", j, k, ce.CCC(), tt.out[k])
- }
- if k > 0 && ce.CCC() == prevCCC && i.Elems[k-1].Primary() > ce.Primary() {
- t.Errorf("%d:%d: normalization crossed across CCC boundary.", j, k)
- }
- }
- }
-
- // Combining rune overflow is tested in search/pattern_test.go.
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/numeric_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/numeric_test.go
deleted file mode 100644
index e9406ae3fb0..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/numeric_test.go
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-const (
- digSec = defaultSecondary
- digTert = defaultTertiary
-)
-
-var tPlus3 = e(0, 50, digTert+3)
-
-// numWeighter is a testWeighter used for testing numericWeighter.
-var numWeighter = testWeighter{
- "0": p(100),
- "0": []Elem{e(100, digSec, digTert+1)}, // U+FF10 FULLWIDTH DIGIT ZERO
- "₀": []Elem{e(100, digSec, digTert+5)}, // U+2080 SUBSCRIPT ZERO
-
- "1": p(101),
- // Allow non-primary collation elements to be inserted.
- "١": append(p(101), tPlus3), // U+0661 ARABIC-INDIC DIGIT ONE
- // Allow varying tertiary weight if the number is Nd.
- "1": []Elem{e(101, digSec, digTert+1)}, // U+FF11 FULLWIDTH DIGIT ONE
- "2": p(102),
- // Allow non-primary collation elements to be inserted.
- "٢": append(p(102), tPlus3), // U+0662 ARABIC-INDIC DIGIT TWO
- // Varying tertiary weights should be ignored.
- "2": []Elem{e(102, digSec, digTert+3)}, // U+FF12 FULLWIDTH DIGIT TWO
- "3": p(103),
- "4": p(104),
- "5": p(105),
- "6": p(106),
- "7": p(107),
- // Weights must be strictly monotonically increasing, but do not need to be
- // consecutive.
- "8": p(118),
- "9": p(119),
- // Allow non-primary collation elements to be inserted.
- "٩": append(p(119), tPlus3), // U+0669 ARABIC-INDIC DIGIT NINE
- // Varying tertiary weights should be ignored.
- "9": []Elem{e(119, digSec, digTert+1)}, // U+FF19 FULLWIDTH DIGIT NINE
- "₉": []Elem{e(119, digSec, digTert+5)}, // U+2089 SUBSCRIPT NINE
-
- "a": p(5),
- "b": p(6),
- "c": p(8, 2),
-
- "klm": p(99),
-
- "nop": p(121),
-
- "x": p(200),
- "y": p(201),
-}
-
-func p(w ...int) (elems []Elem) {
- for _, x := range w {
- e, _ := MakeElem(x, digSec, digTert, 0)
- elems = append(elems, e)
- }
- return elems
-}
-
-func TestNumericAppendNext(t *testing.T) {
- for _, tt := range []struct {
- in string
- w []Elem
- }{
- {"a", p(5)},
- {"klm", p(99)},
- {"aa", p(5, 5)},
- {"1", p(120, 1, 101)},
- {"0", p(120, 0)},
- {"01", p(120, 1, 101)},
- {"0001", p(120, 1, 101)},
- {"10", p(120, 2, 101, 100)},
- {"99", p(120, 2, 119, 119)},
- {"9999", p(120, 4, 119, 119, 119, 119)},
- {"1a", p(120, 1, 101, 5)},
- {"0b", p(120, 0, 6)},
- {"01c", p(120, 1, 101, 8, 2)},
- {"10x", p(120, 2, 101, 100, 200)},
- {"99y", p(120, 2, 119, 119, 201)},
- {"9999nop", p(120, 4, 119, 119, 119, 119, 121)},
-
- // Allow follow-up collation elements if they have a zero non-primary.
- {"١٢٩", []Elem{e(120), e(3), e(101), tPlus3, e(102), tPlus3, e(119), tPlus3}},
- {
- "129",
- []Elem{
- e(120), e(3),
- e(101, digSec, digTert+1),
- e(102, digSec, digTert+3),
- e(119, digSec, digTert+1),
- },
- },
-
- // Ensure AppendNext* adds to the given buffer.
- {"a10", p(5, 120, 2, 101, 100)},
- } {
- nw := NewNumericWeighter(numWeighter)
-
- b := []byte(tt.in)
- got := []Elem(nil)
- for n, sz := 0, 0; n < len(b); {
- got, sz = nw.AppendNext(got, b[n:])
- n += sz
- }
- if !reflect.DeepEqual(got, tt.w) {
- t.Errorf("AppendNext(%q) =\n%v; want\n%v", tt.in, got, tt.w)
- }
-
- got = nil
- for n, sz := 0, 0; n < len(tt.in); {
- got, sz = nw.AppendNextString(got, tt.in[n:])
- n += sz
- }
- if !reflect.DeepEqual(got, tt.w) {
- t.Errorf("AppendNextString(%q) =\n%v; want\n%v", tt.in, got, tt.w)
- }
- }
-}
-
-func TestNumericOverflow(t *testing.T) {
- manyDigits := strings.Repeat("9", maxDigits+1) + "a"
-
- nw := NewNumericWeighter(numWeighter)
-
- got, n := nw.AppendNextString(nil, manyDigits)
-
- if n != maxDigits {
- t.Errorf("n: got %d; want %d", n, maxDigits)
- }
-
- if got[1].Primary() != maxDigits {
- t.Errorf("primary(e[1]): got %d; want %d", n, maxDigits)
- }
-}
-
-func TestNumericWeighterAlloc(t *testing.T) {
- buf := make([]Elem, 100)
- w := NewNumericWeighter(numWeighter)
- s := "1234567890a"
-
- nNormal := testtext.AllocsPerRun(3, func() { numWeighter.AppendNextString(buf, s) })
- nNumeric := testtext.AllocsPerRun(3, func() { w.AppendNextString(buf, s) })
- if n := nNumeric - nNormal; n > 0 {
- t.Errorf("got %f; want 0", n)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/trie_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/trie_test.go
deleted file mode 100644
index b056a811ebf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/trie_test.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-import (
- "testing"
-)
-
-// We take the smallest, largest and an arbitrary value for each
-// of the UTF-8 sequence lengths.
-var testRunes = []rune{
- 0x01, 0x0C, 0x7F, // 1-byte sequences
- 0x80, 0x100, 0x7FF, // 2-byte sequences
- 0x800, 0x999, 0xFFFF, // 3-byte sequences
- 0x10000, 0x10101, 0x10FFFF, // 4-byte sequences
- 0x200, 0x201, 0x202, 0x210, 0x215, // five entries in one sparse block
-}
-
-// Test cases for illegal runes.
-type trietest struct {
- size int
- bytes []byte
-}
-
-var tests = []trietest{
- // illegal runes
- {1, []byte{0x80}},
- {1, []byte{0xFF}},
- {1, []byte{t2, tx - 1}},
- {1, []byte{t2, t2}},
- {2, []byte{t3, tx, tx - 1}},
- {2, []byte{t3, tx, t2}},
- {1, []byte{t3, tx - 1, tx}},
- {3, []byte{t4, tx, tx, tx - 1}},
- {3, []byte{t4, tx, tx, t2}},
- {1, []byte{t4, t2, tx, tx - 1}},
- {2, []byte{t4, tx, t2, tx - 1}},
-
- // short runes
- {0, []byte{t2}},
- {0, []byte{t3, tx}},
- {0, []byte{t4, tx, tx}},
-
- // we only support UTF-8 up to utf8.UTFMax bytes (4 bytes)
- {1, []byte{t5, tx, tx, tx, tx}},
- {1, []byte{t6, tx, tx, tx, tx, tx}},
-}
-
-func TestLookupTrie(t *testing.T) {
- for i, r := range testRunes {
- b := []byte(string(r))
- v, sz := testTrie.lookup(b)
- if int(v) != i {
- t.Errorf("lookup(%U): found value %#x, expected %#x", r, v, i)
- }
- if sz != len(b) {
- t.Errorf("lookup(%U): found size %d, expected %d", r, sz, len(b))
- }
- }
- for i, tt := range tests {
- v, sz := testTrie.lookup(tt.bytes)
- if int(v) != 0 {
- t.Errorf("lookup of illegal rune, case %d: found value %#x, expected 0", i, v)
- }
- if sz != tt.size {
- t.Errorf("lookup of illegal rune, case %d: found size %d, expected %d", i, sz, tt.size)
- }
- }
-}
-
-// test data is taken from exp/collate/locale/build/trie_test.go
-var testValues = [832]uint32{
- 0x000c: 0x00000001,
- 0x007f: 0x00000002,
- 0x00c0: 0x00000003,
- 0x0100: 0x00000004,
- 0x0140: 0x0000000c, 0x0141: 0x0000000d, 0x0142: 0x0000000e,
- 0x0150: 0x0000000f,
- 0x0155: 0x00000010,
- 0x01bf: 0x00000005,
- 0x01c0: 0x00000006,
- 0x0219: 0x00000007,
- 0x027f: 0x00000008,
- 0x0280: 0x00000009,
- 0x02c1: 0x0000000a,
- 0x033f: 0x0000000b,
-}
-
-var testLookup = [640]uint16{
- 0x0e0: 0x05, 0x0e6: 0x06,
- 0x13f: 0x07,
- 0x140: 0x08, 0x144: 0x09,
- 0x190: 0x03,
- 0x1ff: 0x0a,
- 0x20f: 0x05,
- 0x242: 0x01, 0x244: 0x02,
- 0x248: 0x03,
- 0x25f: 0x04,
- 0x260: 0x01,
- 0x26f: 0x02,
- 0x270: 0x04, 0x274: 0x06,
-}
-
-var testTrie = Trie{testLookup[6*blockSize:], testValues[:], testLookup[:], testValues[:]}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/weighter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/weighter_test.go
deleted file mode 100644
index b5f8487b33b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/colltab/weighter_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package colltab
-
-// testWeighter is a simple Weighter that returns weights from a user-defined map.
-type testWeighter map[string][]Elem
-
-func (t testWeighter) Start(int, []byte) int { return 0 }
-func (t testWeighter) StartString(int, string) int { return 0 }
-func (t testWeighter) Domain() []string { return nil }
-func (t testWeighter) Top() uint32 { return 0 }
-
-// maxContractBytes is the maximum length of any key in the map.
-const maxContractBytes = 10
-
-func (t testWeighter) AppendNext(buf []Elem, s []byte) ([]Elem, int) {
- n := len(s)
- if n > maxContractBytes {
- n = maxContractBytes
- }
- for i := n; i > 0; i-- {
- if e, ok := t[string(s[:i])]; ok {
- return append(buf, e...), i
- }
- }
- panic("incomplete testWeighter: could not find " + string(s))
-}
-
-func (t testWeighter) AppendNextString(buf []Elem, s string) ([]Elem, int) {
- n := len(s)
- if n > maxContractBytes {
- n = maxContractBytes
- }
- for i := n; i > 0; i-- {
- if e, ok := t[s[:i]]; ok {
- return append(buf, e...), i
- }
- }
- panic("incomplete testWeighter: could not find " + s)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/common_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/common_test.go
deleted file mode 100644
index 0b07c12d7ce..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/common_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package idna
-
-// This file contains code that is common between the generation code and the
-// package's test code.
-
-import (
- "log"
-
- "golang.org/x/text/internal/ucd"
-)
-
-func catFromEntry(p *ucd.Parser) (cat category) {
- r := p.Rune(0)
- switch s := p.String(1); s {
- case "valid":
- cat = valid
- case "disallowed":
- cat = disallowed
- case "disallowed_STD3_valid":
- cat = disallowedSTD3Valid
- case "disallowed_STD3_mapped":
- cat = disallowedSTD3Mapped
- case "mapped":
- cat = mapped
- case "deviation":
- cat = deviation
- case "ignored":
- cat = ignored
- default:
- log.Fatalf("%U: Unknown category %q", r, s)
- }
- if s := p.String(3); s != "" {
- if cat != valid {
- log.Fatalf(`%U: %s defined for %q; want "valid"`, r, s, p.String(1))
- }
- switch s {
- case "NV8":
- cat = validNV8
- case "XV8":
- cat = validXV8
- default:
- log.Fatalf("%U: Unexpected exception %q", r, s)
- }
- }
- return cat
-}
-
-var joinType = map[string]info{
- "L": joiningL,
- "D": joiningD,
- "T": joiningT,
- "R": joiningR,
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/example_test.go
deleted file mode 100644
index 6e6b8727cd4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/example_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package idna_test
-
-import (
- "fmt"
-
- "golang.org/x/text/internal/export/idna"
-)
-
-func ExampleProfile() {
- // Raw Punycode has no restrictions and does no mappings.
- fmt.Println(idna.ToASCII(""))
- fmt.Println(idna.ToASCII("*.faß.com"))
- fmt.Println(idna.Punycode.ToASCII("*.faß.com"))
-
- // Rewrite IDN for lookup. This (currently) uses transitional mappings to
- // find a balance between IDNA2003 and IDNA2008 compatibility.
- fmt.Println(idna.Lookup.ToASCII(""))
- fmt.Println(idna.Lookup.ToASCII("www.faß.com"))
-
- // Convert an IDN to ASCII for registration purposes. This changes the
- // encoding, but reports an error if the input was illformed.
- fmt.Println(idna.Registration.ToASCII(""))
- fmt.Println(idna.Registration.ToASCII("www.faß.com"))
-
- // Output:
- // <nil>
- // *.xn--fa-hia.com <nil>
- // *.xn--fa-hia.com <nil>
- // <nil>
- // www.fass.com <nil>
- // idna: invalid label ""
- // www.xn--fa-hia.com <nil>
-}
-
-func ExampleNew() {
- var p *idna.Profile
-
- // Raw Punycode has no restrictions and does no mappings.
- p = idna.New()
- fmt.Println(p.ToASCII("*.faß.com"))
-
- // Do mappings. Note that star is not allowed in a DNS lookup.
- p = idna.New(
- idna.MapForLookup(),
- idna.Transitional(true)) // Map ß -> ss
- fmt.Println(p.ToASCII("*.faß.com"))
-
- // Lookup for registration. Also does not allow '*'.
- p = idna.New(idna.ValidateForRegistration())
- fmt.Println(p.ToUnicode("*.faß.com"))
-
- // Set up a profile maps for lookup, but allows wild cards.
- p = idna.New(
- idna.MapForLookup(),
- idna.Transitional(true), // Map ß -> ss
- idna.StrictDomainName(false)) // Set more permissive ASCII rules.
- fmt.Println(p.ToASCII("*.faß.com"))
-
- // Output:
- // *.xn--fa-hia.com <nil>
- // *.fass.com idna: disallowed rune U+002A
- // *.faß.com idna: disallowed rune U+002A
- // *.fass.com <nil>
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen10.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen10.0.0_test.go
deleted file mode 100644
index c5dfdde610f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen10.0.0_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.10
-
-package idna
-
-import (
- "testing"
- "unicode"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- lookup := func(r rune) info {
- v, _ := trie.lookupString(string(r))
- return info(v)
- }
-
- ucd.Parse(gen.OpenUnicodeFile("idna", "", "IdnaMappingTable.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- x := lookup(r)
- if got, want := x.category(), catFromEntry(p); got != want {
- t.Errorf("%U:category: got %x; want %x", r, got, want)
- }
-
- mapped := false
- switch p.String(1) {
- case "mapped", "disallowed_STD3_mapped", "deviation":
- mapped = true
- }
- if x.isMapped() != mapped {
- t.Errorf("%U:isMapped: got %v; want %v", r, x.isMapped(), mapped)
- }
- if !mapped {
- return
- }
- want := string(p.Runes(2))
- got := string(x.appendMapping(nil, string(r)))
- if got != want {
- t.Errorf("%U:mapping: got %+q; want %+q", r, got, want)
- }
-
- if x.isMapped() {
- return
- }
- wantMark := unicode.In(r, unicode.Mark)
- gotMark := x.isModifier()
- if gotMark != wantMark {
- t.Errorf("IsMark(%U) = %v; want %v", r, gotMark, wantMark)
- }
- })
-
- ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- x := lookup(r)
- got := x.isViramaModifier()
-
- const cccVirama = 9
- want := p.Int(ucd.CanonicalCombiningClass) == cccVirama
- if got != want {
- t.Errorf("IsVirama(%U) = %v; want %v", r, got, want)
- }
-
- rtl := false
- switch p.String(ucd.BidiClass) {
- case "R", "AL", "AN":
- rtl = true
- }
- if got := x.isBidi("A"); got != rtl && !x.isMapped() {
- t.Errorf("IsBidi(%U) = %v; want %v", r, got, rtl)
- }
- })
-
- ucd.Parse(gen.OpenUCDFile("extracted/DerivedJoiningType.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- x := lookup(r)
- if x.isMapped() {
- return
- }
- got := x.joinType()
- want := joinType[p.String(1)]
- if got != want {
- t.Errorf("JoinType(%U) = %x; want %x", r, got, want)
- }
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen9.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen9.0.0_test.go
deleted file mode 100644
index 0e66f0b16c9..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/gen9.0.0_test.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.10
-
-package idna
-
-import (
- "testing"
- "unicode"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- lookup := func(r rune) info {
- v, _ := trie.lookupString(string(r))
- return info(v)
- }
-
- ucd.Parse(gen.OpenUnicodeFile("idna", "", "IdnaMappingTable.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- x := lookup(r)
- if got, want := x.category(), catFromEntry(p); got != want {
- t.Errorf("%U:category: got %x; want %x", r, got, want)
- }
-
- mapped := false
- switch p.String(1) {
- case "mapped", "disallowed_STD3_mapped", "deviation":
- mapped = true
- }
- if x.isMapped() != mapped {
- t.Errorf("%U:isMapped: got %v; want %v", r, x.isMapped(), mapped)
- }
- if !mapped {
- return
- }
- want := string(p.Runes(2))
- got := string(x.appendMapping(nil, string(r)))
- if got != want {
- t.Errorf("%U:mapping: got %+q; want %+q", r, got, want)
- }
-
- if x.isMapped() {
- return
- }
- wantMark := unicode.In(r, unicode.Mark)
- gotMark := x.isModifier()
- if gotMark != wantMark {
- t.Errorf("IsMark(%U) = %v; want %v", r, gotMark, wantMark)
- }
- })
-
- ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- x := lookup(r)
- got := x.isViramaModifier()
-
- const cccVirama = 9
- want := p.Int(ucd.CanonicalCombiningClass) == cccVirama
- if got != want {
- t.Errorf("IsVirama(%U) = %v; want %v", r, got, want)
- }
- })
-
- ucd.Parse(gen.OpenUCDFile("extracted/DerivedJoiningType.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- x := lookup(r)
- if x.isMapped() {
- return
- }
- got := x.joinType()
- want := joinType[p.String(1)]
- if got != want {
- t.Errorf("JoinType(%U) = %x; want %x", r, got, want)
- }
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna10.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna10.0.0_test.go
deleted file mode 100644
index d03909111cf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna10.0.0_test.go
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.10
-
-package idna
-
-import "testing"
-
-// TestLabelErrors tests strings returned in case of error. All results should
-// be identical to the reference implementation and can be verified at
-// http://unicode.org/cldr/utility/idna.jsp. The reference implementation,
-// however, seems to not display Bidi and ContextJ errors.
-//
-// In some cases the behavior of browsers is added as a comment. In all cases,
-// whenever a resolve search returns an error here, Chrome will treat the input
-// string as a search string (including those for Bidi and Context J errors),
-// unless noted otherwise.
-func TestLabelErrors(t *testing.T) {
- encode := func(s string) string { s, _ = encode(acePrefix, s); return s }
- type kind struct {
- name string
- f func(string) (string, error)
- }
- punyA := kind{"PunycodeA", punycode.ToASCII}
- resolve := kind{"ResolveA", Lookup.ToASCII}
- display := kind{"ToUnicode", Display.ToUnicode}
- p := New(VerifyDNSLength(true), MapForLookup(), BidiRule())
- lengthU := kind{"CheckLengthU", p.ToUnicode}
- lengthA := kind{"CheckLengthA", p.ToASCII}
- p = New(MapForLookup(), StrictDomainName(false))
- std3 := kind{"STD3", p.ToASCII}
-
- testCases := []struct {
- kind
- input string
- want string
- wantErr string
- }{
- {lengthU, "", "", "A4"}, // From UTS 46 conformance test.
- {lengthA, "", "", "A4"},
-
- {lengthU, "xn--", "", "A4"},
- {lengthU, "foo.xn--", "foo.", "A4"}, // TODO: is dropping xn-- correct?
- {lengthU, "xn--.foo", ".foo", "A4"},
- {lengthU, "foo.xn--.bar", "foo..bar", "A4"},
-
- {display, "xn--", "", ""},
- {display, "foo.xn--", "foo.", ""}, // TODO: is dropping xn-- correct?
- {display, "xn--.foo", ".foo", ""},
- {display, "foo.xn--.bar", "foo..bar", ""},
-
- {lengthA, "a..b", "a..b", "A4"},
- {punyA, ".b", ".b", ""},
- // For backwards compatibility, the Punycode profile does not map runes.
- {punyA, "\u3002b", "xn--b-83t", ""},
- {punyA, "..b", "..b", ""},
-
- {lengthA, ".b", ".b", "A4"},
- {lengthA, "\u3002b", ".b", "A4"},
- {lengthA, "..b", "..b", "A4"},
- {lengthA, "b..", "b..", ""},
-
- // Sharpened Bidi rules for Unicode 10.0.0. Apply for ALL labels in ANY
- // of the labels is RTL.
- {lengthA, "\ufe05\u3002\u3002\U0002603e\u1ce0", "..xn--t6f5138v", "A4"},
- {lengthA, "FAX\u2a77\U0001d186\u3002\U0001e942\U000e0181\u180c", "", "B6"},
-
- {resolve, "a..b", "a..b", ""},
- // Note that leading dots are not stripped. This is to be consistent
- // with the Punycode profile as well as the conformance test.
- {resolve, ".b", ".b", ""},
- {resolve, "\u3002b", ".b", ""},
- {resolve, "..b", "..b", ""},
- {resolve, "b..", "b..", ""},
- {resolve, "\xed", "", "P1"},
-
- // Raw punycode
- {punyA, "", "", ""},
- {punyA, "*.foo.com", "*.foo.com", ""},
- {punyA, "Foo.com", "Foo.com", ""},
-
- // STD3 rules
- {display, "*.foo.com", "*.foo.com", "P1"},
- {std3, "*.foo.com", "*.foo.com", ""},
-
- // Don't map U+2490 (DIGIT NINE FULL STOP). This is the behavior of
- // Chrome, Safari, and IE. Firefox will first map ⒐ to 9. and return
- // lab9.be.
- {resolve, "lab⒐be", "xn--labbe-zh9b", "P1"}, // encode("lab⒐be")
- {display, "lab⒐be", "lab⒐be", "P1"},
-
- {resolve, "plan⒐faß.de", "xn--planfass-c31e.de", "P1"}, // encode("plan⒐fass") + ".de"
- {display, "Plan⒐faß.de", "plan⒐faß.de", "P1"},
-
- // Chrome 54.0 recognizes the error and treats this input verbatim as a
- // search string.
- // Safari 10.0 (non-conform spec) decomposes "⒈" and computes the
- // punycode on the result using transitional mapping.
- // Firefox 49.0.1 goes haywire on this string and prints a bunch of what
- // seems to be nested punycode encodings.
- {resolve, "日本⒈co.ßßß.de", "xn--co-wuw5954azlb.ssssss.de", "P1"},
- {display, "日本⒈co.ßßß.de", "日本⒈co.ßßß.de", "P1"},
-
- {resolve, "a\u200Cb", "ab", ""},
- {display, "a\u200Cb", "a\u200Cb", "C"},
-
- {resolve, encode("a\u200Cb"), encode("a\u200Cb"), "C"},
- {display, "a\u200Cb", "a\u200Cb", "C"},
-
- {resolve, "grﻋﺮﺑﻲ.de", "xn--gr-gtd9a1b0g.de", "B"},
- {
- // Notice how the string gets transformed, even with an error.
- // Chrome will use the original string if it finds an error, so not
- // the transformed one.
- display,
- "gr\ufecb\ufeae\ufe91\ufef2.de",
- "gr\u0639\u0631\u0628\u064a.de",
- "B",
- },
-
- {resolve, "\u0671.\u03c3\u07dc", "xn--qib.xn--4xa21s", "B"}, // ٱ.σߜ
- {display, "\u0671.\u03c3\u07dc", "\u0671.\u03c3\u07dc", "B"},
-
- // normalize input
- {resolve, "a\u0323\u0322", "xn--jta191l", ""}, // ạ̢
- {display, "a\u0323\u0322", "\u1ea1\u0322", ""},
-
- // Non-normalized strings are not normalized when they originate from
- // punycode. Despite the error, Chrome, Safari and Firefox will attempt
- // to look up the input punycode.
- {resolve, encode("a\u0323\u0322") + ".com", "xn--a-tdbc.com", "V1"},
- {display, encode("a\u0323\u0322") + ".com", "a\u0323\u0322.com", "V1"},
- }
-
- for _, tc := range testCases {
- doTest(t, tc.f, tc.name, tc.input, tc.want, tc.wantErr)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna9.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna9.0.0_test.go
deleted file mode 100644
index d60394c2c30..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna9.0.0_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.10
-
-package idna
-
-import "testing"
-
-// TestLabelErrors tests strings returned in case of error. All results should
-// be identical to the reference implementation and can be verified at
-// http://unicode.org/cldr/utility/idna.jsp. The reference implementation,
-// however, seems to not display Bidi and ContextJ errors.
-//
-// In some cases the behavior of browsers is added as a comment. In all cases,
-// whenever a resolve search returns an error here, Chrome will treat the input
-// string as a search string (including those for Bidi and Context J errors),
-// unless noted otherwise.
-func TestLabelErrors(t *testing.T) {
- encode := func(s string) string { s, _ = encode(acePrefix, s); return s }
- type kind struct {
- name string
- f func(string) (string, error)
- }
- punyA := kind{"PunycodeA", punycode.ToASCII}
- resolve := kind{"ResolveA", Lookup.ToASCII}
- display := kind{"ToUnicode", Display.ToUnicode}
- p := New(VerifyDNSLength(true), MapForLookup(), BidiRule())
- lengthU := kind{"CheckLengthU", p.ToUnicode}
- lengthA := kind{"CheckLengthA", p.ToASCII}
- p = New(MapForLookup(), StrictDomainName(false))
- std3 := kind{"STD3", p.ToASCII}
-
- testCases := []struct {
- kind
- input string
- want string
- wantErr string
- }{
- {lengthU, "", "", "A4"}, // From UTS 46 conformance test.
- {lengthA, "", "", "A4"},
-
- {lengthU, "xn--", "", "A4"},
- {lengthU, "foo.xn--", "foo.", "A4"}, // TODO: is dropping xn-- correct?
- {lengthU, "xn--.foo", ".foo", "A4"},
- {lengthU, "foo.xn--.bar", "foo..bar", "A4"},
-
- {display, "xn--", "", ""},
- {display, "foo.xn--", "foo.", ""}, // TODO: is dropping xn-- correct?
- {display, "xn--.foo", ".foo", ""},
- {display, "foo.xn--.bar", "foo..bar", ""},
-
- {lengthA, "a..b", "a..b", "A4"},
- {punyA, ".b", ".b", ""},
- // For backwards compatibility, the Punycode profile does not map runes.
- {punyA, "\u3002b", "xn--b-83t", ""},
- {punyA, "..b", "..b", ""},
- // Only strip leading empty labels for certain profiles. Stripping
- // leading empty labels here but not for "empty" punycode above seems
- // inconsistent, but seems to be applied by both the conformance test
- // and Chrome. So we turn it off by default, support it as an option,
- // and enable it in profiles where it seems commonplace.
- {lengthA, ".b", "b", ""},
- {lengthA, "\u3002b", "b", ""},
- {lengthA, "..b", "b", ""},
- {lengthA, "b..", "b..", ""},
-
- {resolve, "a..b", "a..b", ""},
- {resolve, ".b", "b", ""},
- {resolve, "\u3002b", "b", ""},
- {resolve, "..b", "b", ""},
- {resolve, "b..", "b..", ""},
-
- // Raw punycode
- {punyA, "", "", ""},
- {punyA, "*.foo.com", "*.foo.com", ""},
- {punyA, "Foo.com", "Foo.com", ""},
-
- // STD3 rules
- {display, "*.foo.com", "*.foo.com", "P1"},
- {std3, "*.foo.com", "*.foo.com", ""},
-
- // Don't map U+2490 (DIGIT NINE FULL STOP). This is the behavior of
- // Chrome, Safari, and IE. Firefox will first map ⒐ to 9. and return
- // lab9.be.
- {resolve, "lab⒐be", "xn--labbe-zh9b", "P1"}, // encode("lab⒐be")
- {display, "lab⒐be", "lab⒐be", "P1"},
-
- {resolve, "plan⒐faß.de", "xn--planfass-c31e.de", "P1"}, // encode("plan⒐fass") + ".de"
- {display, "Plan⒐faß.de", "plan⒐faß.de", "P1"},
-
- // Chrome 54.0 recognizes the error and treats this input verbatim as a
- // search string.
- // Safari 10.0 (non-conform spec) decomposes "⒈" and computes the
- // punycode on the result using transitional mapping.
- // Firefox 49.0.1 goes haywire on this string and prints a bunch of what
- // seems to be nested punycode encodings.
- {resolve, "日本⒈co.ßßß.de", "xn--co-wuw5954azlb.ssssss.de", "P1"},
- {display, "日本⒈co.ßßß.de", "日本⒈co.ßßß.de", "P1"},
-
- {resolve, "a\u200Cb", "ab", ""},
- {display, "a\u200Cb", "a\u200Cb", "C"},
-
- {resolve, encode("a\u200Cb"), encode("a\u200Cb"), "C"},
- {display, "a\u200Cb", "a\u200Cb", "C"},
-
- {resolve, "grﻋﺮﺑﻲ.de", "xn--gr-gtd9a1b0g.de", "B"},
- {
- // Notice how the string gets transformed, even with an error.
- // Chrome will use the original string if it finds an error, so not
- // the transformed one.
- display,
- "gr\ufecb\ufeae\ufe91\ufef2.de",
- "gr\u0639\u0631\u0628\u064a.de",
- "B",
- },
-
- {resolve, "\u0671.\u03c3\u07dc", "xn--qib.xn--4xa21s", "B"}, // ٱ.σߜ
- {display, "\u0671.\u03c3\u07dc", "\u0671.\u03c3\u07dc", "B"},
-
- // normalize input
- {resolve, "a\u0323\u0322", "xn--jta191l", ""}, // ạ̢
- {display, "a\u0323\u0322", "\u1ea1\u0322", ""},
-
- // Non-normalized strings are not normalized when they originate from
- // punycode. Despite the error, Chrome, Safari and Firefox will attempt
- // to look up the input punycode.
- {resolve, encode("a\u0323\u0322") + ".com", "xn--a-tdbc.com", "V1"},
- {display, encode("a\u0323\u0322") + ".com", "a\u0323\u0322.com", "V1"},
- }
-
- for _, tc := range testCases {
- doTest(t, tc.f, tc.name, tc.input, tc.want, tc.wantErr)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna_test.go
deleted file mode 100644
index f9dadc036e7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/idna_test.go
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package idna
-
-import (
- "fmt"
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-func TestAllocToUnicode(t *testing.T) {
- avg := testtext.AllocsPerRun(1000, func() {
- ToUnicode("www.golang.org")
- })
- if avg > 0 {
- t.Errorf("got %f; want 0", avg)
- }
-}
-
-func TestAllocToASCII(t *testing.T) {
- avg := testtext.AllocsPerRun(1000, func() {
- ToASCII("www.golang.org")
- })
- if avg > 0 {
- t.Errorf("got %f; want 0", avg)
- }
-}
-
-func TestProfiles(t *testing.T) {
- testCases := []struct {
- name string
- want, got *Profile
- }{
- {"Punycode", punycode, New()},
- {"Registration", registration, New(ValidateForRegistration())},
- {"Registration", registration, New(
- ValidateForRegistration(),
- VerifyDNSLength(true),
- BidiRule(),
- )},
- {"Lookup", lookup, New(MapForLookup(), BidiRule(), Transitional(true))},
- {"Display", display, New(MapForLookup(), BidiRule())},
- }
- for _, tc := range testCases {
- // Functions are not comparable, but the printed version will include
- // their pointers.
- got := fmt.Sprintf("%#v", tc.got)
- want := fmt.Sprintf("%#v", tc.want)
- if got != want {
- t.Errorf("%s: \ngot %#v,\nwant %#v", tc.name, got, want)
- }
- }
-}
-
-// doTest performs a single test f(input) and verifies that the output matches
-// out and that the returned error is expected. The errors string contains
-// all allowed error codes as categorized in
-// http://www.unicode.org/Public/idna/9.0.0/IdnaTest.txt:
-// P: Processing
-// V: Validity
-// A: to ASCII
-// B: Bidi
-// C: Context J
-func doTest(t *testing.T, f func(string) (string, error), name, input, want, errors string) {
- errors = strings.Trim(errors, "[]")
- test := "ok"
- if errors != "" {
- test = "err:" + errors
- }
- // Replace some of the escape sequences to make it easier to single out
- // tests on the command name.
- in := strings.Trim(strconv.QuoteToASCII(input), `"`)
- in = strings.Replace(in, `\u`, "#", -1)
- in = strings.Replace(in, `\U`, "#", -1)
- name = fmt.Sprintf("%s/%s/%s", name, in, test)
-
- testtext.Run(t, name, func(t *testing.T) {
- got, err := f(input)
-
- if err != nil {
- code := err.(interface {
- code() string
- }).code()
- if strings.Index(errors, code) == -1 {
- t.Errorf("error %q not in set of expected errors {%v}", code, errors)
- }
- } else if errors != "" {
- t.Errorf("no errors; want error in {%v}", errors)
- }
-
- if want != "" && got != want {
- t.Errorf(`string: got %+q; want %+q`, got, want)
- }
- })
-}
-
-func TestConformance(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- r := gen.OpenUnicodeFile("idna", "", "IdnaTest.txt")
- defer r.Close()
-
- section := "main"
- started := false
- p := ucd.New(r, ucd.CommentHandler(func(s string) {
- if started {
- section = strings.ToLower(strings.Split(s, " ")[0])
- }
- }))
- transitional := New(Transitional(true), VerifyDNSLength(true), BidiRule(), MapForLookup())
- nonTransitional := New(VerifyDNSLength(true), BidiRule(), MapForLookup())
- for p.Next() {
- started = true
-
- // What to test
- profiles := []*Profile{}
- switch p.String(0) {
- case "T":
- profiles = append(profiles, transitional)
- case "N":
- profiles = append(profiles, nonTransitional)
- case "B":
- profiles = append(profiles, transitional)
- profiles = append(profiles, nonTransitional)
- }
-
- src := unescape(p.String(1))
-
- wantToUnicode := unescape(p.String(2))
- if wantToUnicode == "" {
- wantToUnicode = src
- }
- wantToASCII := unescape(p.String(3))
- if wantToASCII == "" {
- wantToASCII = wantToUnicode
- }
- wantErrToUnicode := ""
- if strings.HasPrefix(wantToUnicode, "[") {
- wantErrToUnicode = wantToUnicode
- wantToUnicode = ""
- }
- wantErrToASCII := ""
- if strings.HasPrefix(wantToASCII, "[") {
- wantErrToASCII = wantToASCII
- wantToASCII = ""
- }
-
- // TODO: also do IDNA tests.
- // invalidInIDNA2008 := p.String(4) == "NV8"
-
- for _, p := range profiles {
- name := fmt.Sprintf("%s:%s", section, p)
- doTest(t, p.ToUnicode, name+":ToUnicode", src, wantToUnicode, wantErrToUnicode)
- doTest(t, p.ToASCII, name+":ToASCII", src, wantToASCII, wantErrToASCII)
- }
- }
-}
-
-func unescape(s string) string {
- s, err := strconv.Unquote(`"` + s + `"`)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-func BenchmarkProfile(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Lookup.ToASCII("www.yahoogle.com")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/punycode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/punycode_test.go
deleted file mode 100644
index 2d99239ecb3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/export/idna/punycode_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package idna
-
-import (
- "strings"
- "testing"
-)
-
-var punycodeTestCases = [...]struct {
- s, encoded string
-}{
- {"", ""},
- {"-", "--"},
- {"-a", "-a-"},
- {"-a-", "-a--"},
- {"a", "a-"},
- {"a-", "a--"},
- {"a-b", "a-b-"},
- {"books", "books-"},
- {"bücher", "bcher-kva"},
- {"Hello世界", "Hello-ck1hg65u"},
- {"ü", "tda"},
- {"üý", "tdac"},
-
- // The test cases below come from RFC 3492 section 7.1 with Errata 3026.
- {
- // (A) Arabic (Egyptian).
- "\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644" +
- "\u0645\u0648\u0634\u0639\u0631\u0628\u064A\u061F",
- "egbpdaj6bu4bxfgehfvwxn",
- },
- {
- // (B) Chinese (simplified).
- "\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587",
- "ihqwcrb4cv8a8dqg056pqjye",
- },
- {
- // (C) Chinese (traditional).
- "\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587",
- "ihqwctvzc91f659drss3x8bo0yb",
- },
- {
- // (D) Czech.
- "\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074" +
- "\u011B\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D" +
- "\u0065\u0073\u006B\u0079",
- "Proprostnemluvesky-uyb24dma41a",
- },
- {
- // (E) Hebrew.
- "\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8" +
- "\u05DC\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2" +
- "\u05D1\u05E8\u05D9\u05EA",
- "4dbcagdahymbxekheh6e0a7fei0b",
- },
- {
- // (F) Hindi (Devanagari).
- "\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D" +
- "\u0926\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939" +
- "\u0940\u0902\u092C\u094B\u0932\u0938\u0915\u0924\u0947" +
- "\u0939\u0948\u0902",
- "i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd",
- },
- {
- // (G) Japanese (kanji and hiragana).
- "\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092" +
- "\u8A71\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B",
- "n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa",
- },
- {
- // (H) Korean (Hangul syllables).
- "\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774" +
- "\uD55C\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74" +
- "\uC5BC\uB9C8\uB098\uC88B\uC744\uAE4C",
- "989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j" +
- "psd879ccm6fea98c",
- },
- {
- // (I) Russian (Cyrillic).
- "\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E" +
- "\u043D\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440" +
- "\u044F\u0442\u043F\u043E\u0440\u0443\u0441\u0441\u043A" +
- "\u0438",
- "b1abfaaepdrnnbgefbadotcwatmq2g4l",
- },
- {
- // (J) Spanish.
- "\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070" +
- "\u0075\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070" +
- "\u006C\u0065\u006D\u0065\u006E\u0074\u0065\u0068\u0061" +
- "\u0062\u006C\u0061\u0072\u0065\u006E\u0045\u0073\u0070" +
- "\u0061\u00F1\u006F\u006C",
- "PorqunopuedensimplementehablarenEspaol-fmd56a",
- },
- {
- // (K) Vietnamese.
- "\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B" +
- "\u0068\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068" +
- "\u1EC9\u006E\u00F3\u0069\u0074\u0069\u1EBF\u006E\u0067" +
- "\u0056\u0069\u1EC7\u0074",
- "TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g",
- },
- {
- // (L) 3<nen>B<gumi><kinpachi><sensei>.
- "\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F",
- "3B-ww4c5e180e575a65lsy2b",
- },
- {
- // (M) <amuro><namie>-with-SUPER-MONKEYS.
- "\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074" +
- "\u0068\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D" +
- "\u004F\u004E\u004B\u0045\u0059\u0053",
- "-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n",
- },
- {
- // (N) Hello-Another-Way-<sorezore><no><basho>.
- "\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F" +
- "\u0074\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D" +
- "\u305D\u308C\u305E\u308C\u306E\u5834\u6240",
- "Hello-Another-Way--fc4qua05auwb3674vfr0b",
- },
- {
- // (O) <hitotsu><yane><no><shita>2.
- "\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032",
- "2-u9tlzr9756bt3uc0v",
- },
- {
- // (P) Maji<de>Koi<suru>5<byou><mae>
- "\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059" +
- "\u308B\u0035\u79D2\u524D",
- "MajiKoi5-783gue6qz075azm5e",
- },
- {
- // (Q) <pafii>de<runba>
- "\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0",
- "de-jg4avhby1noc0d",
- },
- {
- // (R) <sono><supiido><de>
- "\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067",
- "d9juau41awczczp",
- },
- {
- // (S) -> $1.00 <-
- "\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020" +
- "\u003C\u002D",
- "-> $1.00 <--",
- },
-}
-
-func TestPunycode(t *testing.T) {
- for _, tc := range punycodeTestCases {
- if got, err := decode(tc.encoded); err != nil {
- t.Errorf("decode(%q): %v", tc.encoded, err)
- } else if got != tc.s {
- t.Errorf("decode(%q): got %q, want %q", tc.encoded, got, tc.s)
- }
-
- if got, err := encode("", tc.s); err != nil {
- t.Errorf(`encode("", %q): %v`, tc.s, err)
- } else if got != tc.encoded {
- t.Errorf(`encode("", %q): got %q, want %q`, tc.s, got, tc.encoded)
- }
- }
-}
-
-var punycodeErrorTestCases = [...]string{
- "decode -", // A sole '-' is invalid.
- "decode foo\x00bar", // '\x00' is not in [0-9A-Za-z].
- "decode foo#bar", // '#' is not in [0-9A-Za-z].
- "decode foo\u00A3bar", // '\u00A3' is not in [0-9A-Za-z].
- "decode 9", // "9a" decodes to codepoint \u00A3; "9" is truncated.
- "decode 99999a", // "99999a" decodes to codepoint \U0048A3C1, which is > \U0010FFFF.
- "decode 9999999999a", // "9999999999a" overflows the int32 calculation.
-
- "encode " + strings.Repeat("x", 65536) + "\uff00", // int32 overflow.
-}
-
-func TestPunycodeErrors(t *testing.T) {
- for _, tc := range punycodeErrorTestCases {
- var err error
- switch {
- case strings.HasPrefix(tc, "decode "):
- _, err = decode(tc[7:])
- case strings.HasPrefix(tc, "encode "):
- _, err = encode("", tc[7:])
- }
- if err == nil {
- if len(tc) > 256 {
- tc = tc[:100] + "..." + tc[len(tc)-100:]
- }
- t.Errorf("no error for %s", tc)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/format/parser_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/format/parser_test.go
deleted file mode 100644
index 72299082aa6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/format/parser_test.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package format
-
-import "testing"
-
-// TODO: most of Parser is tested in x/message. Move some tests here.
-
-func TestParsenum(t *testing.T) {
- testCases := []struct {
- s string
- start, end int
- num int
- isnum bool
- newi int
- }{
- {"a123", 0, 4, 0, false, 0},
- {"1234", 1, 1, 0, false, 1},
- {"123a", 0, 4, 123, true, 3},
- {"12a3", 0, 4, 12, true, 2},
- {"1234", 0, 4, 1234, true, 4},
- {"1a234", 1, 3, 0, false, 1},
- }
- for _, tt := range testCases {
- num, isnum, newi := parsenum(tt.s, tt.start, tt.end)
- if num != tt.num || isnum != tt.isnum || newi != tt.newi {
- t.Errorf("parsenum(%q, %d, %d) = %d, %v, %d, want %d, %v, %d", tt.s, tt.start, tt.end, num, isnum, newi, tt.num, tt.isnum, tt.newi)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/gen_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/gen_test.go
deleted file mode 100644
index a2e1981ae2d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/gen_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestParents(t *testing.T) {
- testCases := []struct {
- tag, parent string
- }{
- {"af", "und"},
- {"en", "und"},
- {"en-001", "en"},
- {"en-AU", "en-001"},
- {"en-US", "en"},
- {"en-US-u-va-posix", "en-US"},
- {"ca-ES-valencia", "ca-ES"},
- }
- for _, tc := range testCases {
- tag, ok := language.CompactIndex(language.MustParse(tc.tag))
- if !ok {
- t.Fatalf("Could not get index of flag %s", tc.tag)
- }
- want, ok := language.CompactIndex(language.MustParse(tc.parent))
- if !ok {
- t.Fatalf("Could not get index of parent %s of tag %s", tc.parent, tc.tag)
- }
- if got := int(Parent[tag]); got != want {
- t.Errorf("Parent[%s] = %d; want %d (%s)", tc.tag, got, want, tc.parent)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/internal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/internal_test.go
deleted file mode 100644
index ce1b9a38276..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/internal_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "fmt"
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestUnique(t *testing.T) {
- testCases := []struct {
- in, want string
- }{
- {"", "[]"},
- {"en", "[en]"},
- {"en en", "[en]"},
- {"en en en", "[en]"},
- {"en-u-cu-eur en", "[en en-u-cu-eur]"},
- {"nl en", "[en nl]"},
- {"pt-Pt pt", "[pt pt-PT]"},
- }
- for _, tc := range testCases {
- tags := []language.Tag{}
- for _, s := range strings.Split(tc.in, " ") {
- if s != "" {
- tags = append(tags, language.MustParse(s))
- }
- }
- if got := fmt.Sprint(UniqueTags(tags)); got != tc.want {
- t.Errorf("Unique(%s) = %s; want %s", tc.in, got, tc.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/match_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/match_test.go
deleted file mode 100644
index 8a3fe65729a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/match_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestInheritanceMatcher(t *testing.T) {
- for i, tt := range []struct {
- haveTags string
- wantTags string
- match string
- conf language.Confidence
- }{
- {"und,en,en-US", "en-US", "en-US", language.Exact}, // most specific match
- {"zh-Hant,zh", "zh-TW", "zh-Hant", language.High}, // zh-TW implies Hant.
- {"und,zh", "zh-TW", "und", language.High}, // zh-TW does not match zh.
- {"zh", "zh-TW", "und", language.No}, // zh-TW does not match zh.
- {"iw,en,nl", "he", "he", language.Exact}, // matches after canonicalization
- {"he,en,nl", "iw", "he", language.Exact}, // matches after canonicalization
- // Prefer first match over more specific match for various reasons:
- // a) consistency of user interface is more important than an exact match,
- // b) _if_ und is specified, it should be considered a correct and useful match,
- // Note that a call to this Match will almost always be with a single tag.
- {"und,en,en-US", "he,en-US", "und", language.High},
- } {
- have := parseTags(tt.haveTags)
- m := NewInheritanceMatcher(have)
- tag, index, conf := m.Match(parseTags(tt.wantTags)...)
- want := language.Raw.Make(tt.match)
- if tag != want {
- t.Errorf("%d:tag: got %q; want %q", i, tag, want)
- }
- if conf != language.No {
- if got, _ := language.All.Canonicalize(have[index]); got != want {
- t.Errorf("%d:index: got %q; want %q ", i, got, want)
- }
- }
- if conf != tt.conf {
- t.Errorf("%d:conf: got %v; want %v", i, conf, tt.conf)
- }
- }
-}
-
-func parseTags(list string) (out []language.Tag) {
- for _, s := range strings.Split(list, ",") {
- out = append(out, language.Raw.Make(strings.TrimSpace(s)))
- }
- return out
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/decimal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/decimal_test.go
deleted file mode 100644
index 97c7e25b614..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/decimal_test.go
+++ /dev/null
@@ -1,329 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "fmt"
- "math"
- "strconv"
- "strings"
- "testing"
-)
-
-func mkfloat(num string) float64 {
- u, _ := strconv.ParseUint(num, 10, 32)
- return float64(u)
-}
-
-// mkdec creates a decimal from a string. All ASCII digits are converted to
-// digits in the decimal. The dot is used to indicate the scale by which the
-// digits are shifted. Numbers may have an additional exponent or be the special
-// value NaN, Inf, or -Inf.
-func mkdec(num string) (d Decimal) {
- var r RoundingContext
- d.Convert(r, dec(num))
- return
-}
-
-type dec string
-
-func (s dec) Convert(d *Decimal, _ RoundingContext) {
- num := string(s)
- if num[0] == '-' {
- d.Neg = true
- num = num[1:]
- }
- switch num {
- case "NaN":
- d.NaN = true
- return
- case "Inf":
- d.Inf = true
- return
- }
- if p := strings.IndexAny(num, "eE"); p != -1 {
- i64, err := strconv.ParseInt(num[p+1:], 10, 32)
- if err != nil {
- panic(err)
- }
- d.Exp = int32(i64)
- num = num[:p]
- }
- if p := strings.IndexByte(num, '.'); p != -1 {
- d.Exp += int32(p)
- num = num[:p] + num[p+1:]
- } else {
- d.Exp += int32(len(num))
- }
- d.Digits = []byte(num)
- for i := range d.Digits {
- d.Digits[i] -= '0'
- }
- *d = d.normalize()
-}
-
-func byteNum(s string) []byte {
- b := make([]byte, len(s))
- for i := 0; i < len(s); i++ {
- if c := s[i]; '0' <= c && c <= '9' {
- b[i] = s[i] - '0'
- } else {
- b[i] = s[i] - 'a' + 10
- }
- }
- return b
-}
-
-func strNum(s string) string {
- return string(byteNum(s))
-}
-
-func TestDecimalString(t *testing.T) {
- for _, test := range []struct {
- x Decimal
- want string
- }{
- {want: "0"},
- {Decimal{digits: digits{Digits: nil, Exp: 1000}}, "0"}, // exponent of 1000 is ignored
- {Decimal{digits: digits{Digits: byteNum("12345"), Exp: 0}}, "0.12345"},
- {Decimal{digits: digits{Digits: byteNum("12345"), Exp: -3}}, "0.00012345"},
- {Decimal{digits: digits{Digits: byteNum("12345"), Exp: +3}}, "123.45"},
- {Decimal{digits: digits{Digits: byteNum("12345"), Exp: +10}}, "1234500000"},
- } {
- if got := test.x.String(); got != test.want {
- t.Errorf("%v == %q; want %q", test.x, got, test.want)
- }
- }
-}
-
-func TestRounding(t *testing.T) {
- testCases := []struct {
- x string
- n int
- // modes is the result for modes. Signs are left out of the result.
- // The results are stored in the following order:
- // zero, negInf
- // nearZero, nearEven, nearAway
- // away, posInf
- modes [numModes]string
- }{
- {"0", 1, [numModes]string{
- "0", "0",
- "0", "0", "0",
- "0", "0"}},
- {"1", 1, [numModes]string{
- "1", "1",
- "1", "1", "1",
- "1", "1"}},
- {"5", 1, [numModes]string{
- "5", "5",
- "5", "5", "5",
- "5", "5"}},
- {"15", 1, [numModes]string{
- "10", "10",
- "10", "20", "20",
- "20", "20"}},
- {"45", 1, [numModes]string{
- "40", "40",
- "40", "40", "50",
- "50", "50"}},
- {"95", 1, [numModes]string{
- "90", "90",
- "90", "100", "100",
- "100", "100"}},
-
- {"12344999", 4, [numModes]string{
- "12340000", "12340000",
- "12340000", "12340000", "12340000",
- "12350000", "12350000"}},
- {"12345000", 4, [numModes]string{
- "12340000", "12340000",
- "12340000", "12340000", "12350000",
- "12350000", "12350000"}},
- {"12345001", 4, [numModes]string{
- "12340000", "12340000",
- "12350000", "12350000", "12350000",
- "12350000", "12350000"}},
- {"12345100", 4, [numModes]string{
- "12340000", "12340000",
- "12350000", "12350000", "12350000",
- "12350000", "12350000"}},
- {"23454999", 4, [numModes]string{
- "23450000", "23450000",
- "23450000", "23450000", "23450000",
- "23460000", "23460000"}},
- {"23455000", 4, [numModes]string{
- "23450000", "23450000",
- "23450000", "23460000", "23460000",
- "23460000", "23460000"}},
- {"23455001", 4, [numModes]string{
- "23450000", "23450000",
- "23460000", "23460000", "23460000",
- "23460000", "23460000"}},
- {"23455100", 4, [numModes]string{
- "23450000", "23450000",
- "23460000", "23460000", "23460000",
- "23460000", "23460000"}},
-
- {"99994999", 4, [numModes]string{
- "99990000", "99990000",
- "99990000", "99990000", "99990000",
- "100000000", "100000000"}},
- {"99995000", 4, [numModes]string{
- "99990000", "99990000",
- "99990000", "100000000", "100000000",
- "100000000", "100000000"}},
- {"99999999", 4, [numModes]string{
- "99990000", "99990000",
- "100000000", "100000000", "100000000",
- "100000000", "100000000"}},
-
- {"12994999", 4, [numModes]string{
- "12990000", "12990000",
- "12990000", "12990000", "12990000",
- "13000000", "13000000"}},
- {"12995000", 4, [numModes]string{
- "12990000", "12990000",
- "12990000", "13000000", "13000000",
- "13000000", "13000000"}},
- {"12999999", 4, [numModes]string{
- "12990000", "12990000",
- "13000000", "13000000", "13000000",
- "13000000", "13000000"}},
- }
- modes := []RoundingMode{
- ToZero, ToNegativeInf,
- ToNearestZero, ToNearestEven, ToNearestAway,
- AwayFromZero, ToPositiveInf,
- }
- for _, tc := range testCases {
- // Create negative counterpart tests: the sign is reversed and
- // ToPositiveInf and ToNegativeInf swapped.
- negModes := tc.modes
- negModes[1], negModes[6] = negModes[6], negModes[1]
- for i, res := range negModes {
- negModes[i] = "-" + res
- }
- for i, m := range modes {
- t.Run(fmt.Sprintf("x:%s/n:%d/%s", tc.x, tc.n, m), func(t *testing.T) {
- d := mkdec(tc.x)
- d.round(m, tc.n)
- if got := d.String(); got != tc.modes[i] {
- t.Errorf("pos decimal: got %q; want %q", d.String(), tc.modes[i])
- }
-
- mult := math.Pow(10, float64(len(tc.x)-tc.n))
- f := mkfloat(tc.x)
- f = m.roundFloat(f/mult) * mult
- if got := fmt.Sprintf("%.0f", f); got != tc.modes[i] {
- t.Errorf("pos float: got %q; want %q", got, tc.modes[i])
- }
-
- // Test the negative case. This is the same as the positive
- // case, but with ToPositiveInf and ToNegativeInf swapped.
- d = mkdec(tc.x)
- d.Neg = true
- d.round(m, tc.n)
- if got, want := d.String(), negModes[i]; got != want {
- t.Errorf("neg decimal: got %q; want %q", d.String(), want)
- }
-
- f = -mkfloat(tc.x)
- f = m.roundFloat(f/mult) * mult
- if got := fmt.Sprintf("%.0f", f); got != negModes[i] {
- t.Errorf("neg float: got %q; want %q", got, negModes[i])
- }
- })
- }
- }
-}
-
-func TestConvert(t *testing.T) {
- scale2 := RoundingContext{}
- scale2.SetScale(2)
- scale2away := RoundingContext{Mode: AwayFromZero}
- scale2away.SetScale(2)
- inc0_05 := RoundingContext{Increment: 5, IncrementScale: 2}
- inc0_05.SetScale(2)
- inc50 := RoundingContext{Increment: 50}
- prec3 := RoundingContext{}
- prec3.SetPrecision(3)
- roundShift := RoundingContext{DigitShift: 2, MaxFractionDigits: 2}
- testCases := []struct {
- x interface{}
- rc RoundingContext
- out string
- }{
- {-0.001, scale2, "-0.00"},
- {0.1234, prec3, "0.123"},
- {1234.0, prec3, "1230"},
- {1.2345e10, prec3, "12300000000"},
-
- {int8(-34), scale2, "-34"},
- {int16(-234), scale2, "-234"},
- {int32(-234), scale2, "-234"},
- {int64(-234), scale2, "-234"},
- {int(-234), scale2, "-234"},
- {uint8(234), scale2, "234"},
- {uint16(234), scale2, "234"},
- {uint32(234), scale2, "234"},
- {uint64(234), scale2, "234"},
- {uint(234), scale2, "234"},
- {-1e9, scale2, "-1000000000.00"},
- // The following two causes this result to have a lot of digits:
- // 1) 0.234 cannot be accurately represented as a float64, and
- // 2) as strconv does not support the rounding AwayFromZero, Convert
- // leaves the rounding to caller.
- {0.234, scale2away,
- "0.2340000000000000135447209004269097931683063507080078125"},
-
- {0.0249, inc0_05, "0.00"},
- {0.025, inc0_05, "0.00"},
- {0.0251, inc0_05, "0.05"},
- {0.03, inc0_05, "0.05"},
- {0.049, inc0_05, "0.05"},
- {0.05, inc0_05, "0.05"},
- {0.051, inc0_05, "0.05"},
- {0.0749, inc0_05, "0.05"},
- {0.075, inc0_05, "0.10"},
- {0.0751, inc0_05, "0.10"},
- {324, inc50, "300"},
- {325, inc50, "300"},
- {326, inc50, "350"},
- {349, inc50, "350"},
- {350, inc50, "350"},
- {351, inc50, "350"},
- {374, inc50, "350"},
- {375, inc50, "400"},
- {376, inc50, "400"},
-
- // Here the scale is 2, but the digits get shifted left. As we use
- // AppendFloat to do the rounding an exta 0 gets added.
- {0.123, roundShift, "0.1230"},
-
- {converter(3), scale2, "100"},
-
- {math.Inf(1), inc50, "Inf"},
- {math.Inf(-1), inc50, "-Inf"},
- {math.NaN(), inc50, "NaN"},
- {"clearly not a number", scale2, "NaN"},
- }
- for _, tc := range testCases {
- var d Decimal
- t.Run(fmt.Sprintf("%T:%v-%v", tc.x, tc.x, tc.rc), func(t *testing.T) {
- d.Convert(tc.rc, tc.x)
- if got := d.String(); got != tc.out {
- t.Errorf("got %q; want %q", got, tc.out)
- }
- })
- }
-}
-
-type converter int
-
-func (c converter) Convert(d *Decimal, r RoundingContext) {
- d.Digits = append(d.Digits, 1, 0, 0)
- d.Exp = 3
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/format_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/format_test.go
deleted file mode 100644
index 01a08943018..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/format_test.go
+++ /dev/null
@@ -1,522 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "fmt"
- "log"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestAppendDecimal(t *testing.T) {
- type pairs map[string]string // alternates with decimal input and result
-
- testCases := []struct {
- pattern string
- // We want to be able to test some forms of patterns that cannot be
- // represented as a string.
- pat *Pattern
-
- test pairs
- }{{
- pattern: "0",
- test: pairs{
- "0": "0",
- "1": "1",
- "-1": "-1",
- ".00": "0",
- "10.": "10",
- "12": "12",
- "1.2": "1",
- "NaN": "NaN",
- "-Inf": "-∞",
- },
- }, {
- pattern: "+0;+0",
- test: pairs{
- "0": "+0",
- "1": "+1",
- "-1": "-1",
- ".00": "+0",
- "10.": "+10",
- "12": "+12",
- "1.2": "+1",
- "NaN": "NaN",
- "-Inf": "-∞",
- "Inf": "+∞",
- },
- }, {
- pattern: "0 +;0 +",
- test: pairs{
- "0": "0 +",
- "1": "1 +",
- "-1": "1 -",
- ".00": "0 +",
- },
- }, {
- pattern: "0;0-",
- test: pairs{
- "-1": "1-",
- "NaN": "NaN",
- "-Inf": "∞-",
- "Inf": "∞",
- },
- }, {
- pattern: "0000",
- test: pairs{
- "0": "0000",
- "1": "0001",
- "12": "0012",
- "12345": "12345",
- },
- }, {
- pattern: ".0",
- test: pairs{
- "0": ".0",
- "1": "1.0",
- "1.2": "1.2",
- "1.2345": "1.2",
- },
- }, {
- pattern: "#.0",
- test: pairs{
- "0": ".0",
- },
- }, {
- pattern: "#.0#",
- test: pairs{
- "0": ".0",
- "1": "1.0",
- },
- }, {
- pattern: "0.0#",
- test: pairs{
- "0": "0.0",
- },
- }, {
- pattern: "#0.###",
- test: pairs{
- "0": "0",
- "1": "1",
- "1.2": "1.2",
- "1.2345": "1.234", // rounding should have been done earlier
- "1234.5": "1234.5",
- "1234.567": "1234.567",
- },
- }, {
- pattern: "#0.######",
- test: pairs{
- "0": "0",
- "1234.5678": "1234.5678",
- "0.123456789": "0.123457",
- "NaN": "NaN",
- "Inf": "∞",
- },
-
- // Test separators.
- }, {
- pattern: "#,#.00",
- test: pairs{
- "100": "1,0,0.00",
- },
- }, {
- pattern: "#,0.##",
- test: pairs{
- "10": "1,0",
- },
- }, {
- pattern: "#,0",
- test: pairs{
- "10": "1,0",
- },
- }, {
- pattern: "#,##,#.00",
- test: pairs{
- "1000": "1,00,0.00",
- },
- }, {
- pattern: "#,##0.###",
- test: pairs{
- "0": "0",
- "1234.5678": "1,234.568",
- "0.123456789": "0.123",
- },
- }, {
- pattern: "#,##,##0.###",
- test: pairs{
- "0": "0",
- "123456789012": "1,23,45,67,89,012",
- "0.123456789": "0.123",
- },
- }, {
- pattern: "0,00,000.###",
- test: pairs{
- "0": "0,00,000",
- "123456789012": "1,23,45,67,89,012",
- "12.3456789": "0,00,012.346",
- "0.123456789": "0,00,000.123",
- },
-
- // Support for ill-formed patterns.
- }, {
- pattern: "#",
- test: pairs{
- ".00": "", // This is the behavior of fmt.
- "0": "", // This is the behavior of fmt.
- "1": "1",
- "10.": "10",
- },
- }, {
- pattern: ".#",
- test: pairs{
- "0": "", // This is the behavior of fmt.
- "1": "1",
- "1.2": "1.2",
- "1.2345": "1.2",
- },
- }, {
- pattern: "#,#.##",
- test: pairs{
- "10": "1,0",
- },
- }, {
- pattern: "#,#",
- test: pairs{
- "10": "1,0",
- },
-
- // Special patterns
- }, {
- pattern: "#,max_int=2",
- pat: &Pattern{
- RoundingContext: RoundingContext{
- MaxIntegerDigits: 2,
- },
- },
- test: pairs{
- "2017": "17",
- },
- }, {
- pattern: "0,max_int=2",
- pat: &Pattern{
- RoundingContext: RoundingContext{
- MaxIntegerDigits: 2,
- MinIntegerDigits: 1,
- },
- },
- test: pairs{
- "2000": "0",
- "2001": "1",
- "2017": "17",
- },
- }, {
- pattern: "00,max_int=2",
- pat: &Pattern{
- RoundingContext: RoundingContext{
- MaxIntegerDigits: 2,
- MinIntegerDigits: 2,
- },
- },
- test: pairs{
- "2000": "00",
- "2001": "01",
- "2017": "17",
- },
- }, {
- pattern: "@@@@,max_int=2",
- pat: &Pattern{
- RoundingContext: RoundingContext{
- MaxIntegerDigits: 2,
- MinSignificantDigits: 4,
- },
- },
- test: pairs{
- "2017": "17.00",
- "2000": "0.000",
- "2001": "1.000",
- },
-
- // Significant digits
- }, {
- pattern: "@@##",
- test: pairs{
- "1": "1.0",
- "0.1": "0.10", // leading zero does not count as significant digit
- "123": "123",
- "1234": "1234",
- "12345": "12340",
- },
- }, {
- pattern: "@@@@",
- test: pairs{
- "1": "1.000",
- ".1": "0.1000",
- ".001": "0.001000",
- "123": "123.0",
- "1234": "1234",
- "12345": "12340", // rounding down
- "NaN": "NaN",
- "-Inf": "-∞",
- },
-
- // TODO: rounding
- // {"@@@@": "23456": "23460"}, // rounding up
- // TODO: padding
-
- // Scientific and Engineering notation
- }, {
- pattern: "#E0",
- test: pairs{
- "0": "0\u202f×\u202f10⁰",
- "1": "1\u202f×\u202f10⁰",
- "123.456": "1\u202f×\u202f10²",
- },
- }, {
- pattern: "#E+0",
- test: pairs{
- "0": "0\u202f×\u202f10⁺⁰",
- "1000": "1\u202f×\u202f10⁺³",
- "1E100": "1\u202f×\u202f10⁺¹⁰⁰",
- "1E-100": "1\u202f×\u202f10⁻¹⁰⁰",
- "NaN": "NaN",
- "-Inf": "-∞",
- },
- }, {
- pattern: "##0E00",
- test: pairs{
- "100": "100\u202f×\u202f10⁰⁰",
- "12345": "12\u202f×\u202f10⁰³",
- "123.456": "123\u202f×\u202f10⁰⁰",
- },
- }, {
- pattern: "##0.###E00",
- test: pairs{
- "100": "100\u202f×\u202f10⁰⁰",
- "12345": "12.345\u202f×\u202f10⁰³",
- "123456": "123.456\u202f×\u202f10⁰³",
- "123.456": "123.456\u202f×\u202f10⁰⁰",
- "123.4567": "123.457\u202f×\u202f10⁰⁰",
- },
- }, {
- pattern: "##0.000E00",
- test: pairs{
- "100": "100.000\u202f×\u202f10⁰⁰",
- "12345": "12.345\u202f×\u202f10⁰³",
- "123.456": "123.456\u202f×\u202f10⁰⁰",
- "12.3456": "12.346\u202f×\u202f10⁰⁰",
- },
- }, {
- pattern: "@@E0",
- test: pairs{
- "0": "0.0\u202f×\u202f10⁰",
- "99": "9.9\u202f×\u202f10¹",
- "0.99": "9.9\u202f×\u202f10⁻¹",
- },
- }, {
- pattern: "@###E00",
- test: pairs{
- "0": "0\u202f×\u202f10⁰⁰",
- "1": "1\u202f×\u202f10⁰⁰",
- "11": "1.1\u202f×\u202f10⁰¹",
- "111": "1.11\u202f×\u202f10⁰²",
- "1111": "1.111\u202f×\u202f10⁰³",
- "11111": "1.111\u202f×\u202f10⁰⁴",
- "0.1": "1\u202f×\u202f10⁻⁰¹",
- "0.11": "1.1\u202f×\u202f10⁻⁰¹",
- "0.001": "1\u202f×\u202f10⁻⁰³",
- },
- }, {
- pattern: "*x##0",
- test: pairs{
- "0": "xx0",
- "10": "x10",
- "100": "100",
- "1000": "1000",
- },
- }, {
- pattern: "##0*x",
- test: pairs{
- "0": "0xx",
- "10": "10x",
- "100": "100",
- "1000": "1000",
- },
- }, {
- pattern: "* ###0.000",
- test: pairs{
- "0": " 0.000",
- "123": " 123.000",
- "123.456": " 123.456",
- "1234.567": "1234.567",
- },
- }, {
- pattern: "**0.0#######E00",
- test: pairs{
- "0": "***0.0\u202f×\u202f10⁰⁰",
- "10": "***1.0\u202f×\u202f10⁰¹",
- "11": "***1.1\u202f×\u202f10⁰¹",
- "111": "**1.11\u202f×\u202f10⁰²",
- "1111": "*1.111\u202f×\u202f10⁰³",
- "11111": "1.1111\u202f×\u202f10⁰⁴",
- "11110": "*1.111\u202f×\u202f10⁰⁴",
- "11100": "**1.11\u202f×\u202f10⁰⁴",
- "11000": "***1.1\u202f×\u202f10⁰⁴",
- "10000": "***1.0\u202f×\u202f10⁰⁴",
- },
- }, {
- pattern: "*xpre0suf",
- test: pairs{
- "0": "pre0suf",
- "10": "pre10suf",
- },
- }, {
- pattern: "*∞ pre ###0 suf",
- test: pairs{
- "0": "∞∞∞ pre 0 suf",
- "10": "∞∞ pre 10 suf",
- "100": "∞ pre 100 suf",
- "1000": " pre 1000 suf",
- },
- }, {
- pattern: "pre *∞###0 suf",
- test: pairs{
- "0": "pre ∞∞∞0 suf",
- "10": "pre ∞∞10 suf",
- "100": "pre ∞100 suf",
- "1000": "pre 1000 suf",
- },
- }, {
- pattern: "pre ###0*∞ suf",
- test: pairs{
- "0": "pre 0∞∞∞ suf",
- "10": "pre 10∞∞ suf",
- "100": "pre 100∞ suf",
- "1000": "pre 1000 suf",
- },
- }, {
- pattern: "pre ###0 suf *∞",
- test: pairs{
- "0": "pre 0 suf ∞∞∞",
- "10": "pre 10 suf ∞∞",
- "100": "pre 100 suf ∞",
- "1000": "pre 1000 suf ",
- },
- }, {
- // Take width of positive pattern.
- pattern: "**###0;**-#####0x",
- test: pairs{
- "0": "***0",
- "-1": "*-1x",
- },
- }, {
- pattern: "0.00%",
- test: pairs{
- "0.1": "10.00%",
- },
- }, {
- pattern: "0.##%",
- test: pairs{
- "0.1": "10%",
- "0.11": "11%",
- "0.111": "11.1%",
- "0.1111": "11.11%",
- "0.11111": "11.11%",
- },
- }, {
- pattern: "‰ 0.0#",
- test: pairs{
- "0.1": "‰ 100.0",
- "0.11": "‰ 110.0",
- "0.111": "‰ 111.0",
- "0.1111": "‰ 111.1",
- "0.11111": "‰ 111.11",
- "0.111111": "‰ 111.11",
- },
- }}
-
- // TODO:
- // "#,##0.00¤",
- // "#,##0.00 ¤;(#,##0.00 ¤)",
-
- for _, tc := range testCases {
- pat := tc.pat
- if pat == nil {
- var err error
- if pat, err = ParsePattern(tc.pattern); err != nil {
- log.Fatal(err)
- }
- }
- var f Formatter
- f.InitPattern(language.English, pat)
- for num, want := range tc.test {
- buf := make([]byte, 100)
- t.Run(tc.pattern+"/"+num, func(t *testing.T) {
- var d Decimal
- d.Convert(f.RoundingContext, dec(num))
- buf = f.Format(buf[:0], &d)
- if got := string(buf); got != want {
- t.Errorf("\n got %[1]q (%[1]s)\nwant %[2]q (%[2]s)", got, want)
- }
- })
- }
- }
-}
-
-func TestLocales(t *testing.T) {
- testCases := []struct {
- tag language.Tag
- num string
- want string
- }{
- {language.Make("en"), "123456.78", "123,456.78"},
- {language.Make("de"), "123456.78", "123.456,78"},
- {language.Make("de-CH"), "123456.78", "123’456.78"},
- {language.Make("fr"), "123456.78", "123 456,78"},
- {language.Make("bn"), "123456.78", "১,২৩,৪৫৬.৭৮"},
- }
- for _, tc := range testCases {
- t.Run(fmt.Sprint(tc.tag, "/", tc.num), func(t *testing.T) {
- var f Formatter
- f.InitDecimal(tc.tag)
- var d Decimal
- d.Convert(f.RoundingContext, dec(tc.num))
- b := f.Format(nil, &d)
- if got := string(b); got != tc.want {
- t.Errorf("got %[1]q (%[1]s); want %[2]q (%[2]s)", got, tc.want)
- }
- })
- }
-}
-
-func TestFormatters(t *testing.T) {
- var f Formatter
- testCases := []struct {
- init func(t language.Tag)
- num string
- want string
- }{
- {f.InitDecimal, "123456.78", "123,456.78"},
- {f.InitScientific, "123456.78", "1.23\u202f×\u202f10⁵"},
- {f.InitEngineering, "123456.78", "123.46\u202f×\u202f10³"},
- {f.InitEngineering, "1234", "1.23\u202f×\u202f10³"},
-
- {f.InitPercent, "0.1234", "12.34%"},
- {f.InitPerMille, "0.1234", "123.40‰"},
- }
- for i, tc := range testCases {
- t.Run(fmt.Sprint(i, "/", tc.num), func(t *testing.T) {
- tc.init(language.English)
- f.SetScale(2)
- var d Decimal
- d.Convert(f.RoundingContext, dec(tc.num))
- b := f.Format(nil, &d)
- if got := string(b); got != tc.want {
- t.Errorf("got %[1]q (%[1]s); want %[2]q (%[2]s)", got, tc.want)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/number_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/number_test.go
deleted file mode 100644
index cbc28ab49b6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/number_test.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
-)
-
-func TestInfo(t *testing.T) {
- testCases := []struct {
- lang string
- sym SymbolType
- wantSym string
- wantNine rune
- }{
- {"und", SymDecimal, ".", '9'},
- {"de", SymGroup, ".", '9'},
- {"de-BE", SymGroup, ".", '9'}, // inherits from de (no number data in CLDR)
- {"de-BE-oxendict", SymGroup, ".", '9'}, // inherits from de (no compact index)
-
- // U+096F DEVANAGARI DIGIT NINE ('९')
- {"de-BE-u-nu-deva", SymGroup, ".", '\u096f'}, // miss -> latn -> de
- {"de-Cyrl-BE", SymGroup, ",", '9'}, // inherits from root
- {"de-CH", SymGroup, "’", '9'}, // overrides values in de
- {"de-CH-oxendict", SymGroup, "’", '9'}, // inherits from de-CH (no compact index)
- {"de-CH-u-nu-deva", SymGroup, "’", '\u096f'}, // miss -> latn -> de-CH
-
- {"bn-u-nu-beng", SymGroup, ",", '\u09ef'},
- {"bn-u-nu-deva", SymGroup, ",", '\u096f'},
- {"bn-u-nu-latn", SymGroup, ",", '9'},
-
- {"pa", SymExponential, "E", '9'},
-
- // "×۱۰^" -> U+00d7 U+06f1 U+06f0^"
- // U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO
- // U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE
- // U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE
- {"pa-u-nu-arabext", SymExponential, "\u00d7\u06f1\u06f0^", '\u06f9'},
-
- // "གྲངས་མེད" - > U+0f42 U+0fb2 U+0f44 U+0f66 U+0f0b U+0f58 U+0f7a U+0f51
- // Examples:
- // U+0F29 TIBETAN DIGIT NINE (༩)
- {"dz", SymInfinity, "\u0f42\u0fb2\u0f44\u0f66\u0f0b\u0f58\u0f7a\u0f51", '\u0f29'}, // defaults to tibt
- {"dz-u-nu-latn", SymInfinity, "∞", '9'}, // select alternative
- {"dz-u-nu-tibt", SymInfinity, "\u0f42\u0fb2\u0f44\u0f66\u0f0b\u0f58\u0f7a\u0f51", '\u0f29'},
- {"en-u-nu-tibt", SymInfinity, "∞", '\u0f29'},
-
- // algorithmic number systems fall back to ASCII if Digits is used.
- {"en-u-nu-hanidec", SymPlusSign, "+", '9'},
- {"en-u-nu-roman", SymPlusSign, "+", '9'},
- }
- for _, tc := range testCases {
- t.Run(fmt.Sprintf("%s:%v", tc.lang, tc.sym), func(t *testing.T) {
- info := InfoFromTag(language.MustParse(tc.lang))
- if got := info.Symbol(tc.sym); got != tc.wantSym {
- t.Errorf("sym: got %q; want %q", got, tc.wantSym)
- }
- if got := info.Digit('9'); got != tc.wantNine {
- t.Errorf("Digit(9): got %+q; want %+q", got, tc.wantNine)
- }
- var buf [4]byte
- if got := string(buf[:info.WriteDigit(buf[:], '9')]); got != string(tc.wantNine) {
- t.Errorf("WriteDigit(9): got %+q; want %+q", got, tc.wantNine)
- }
- if got := string(info.AppendDigit([]byte{}, 9)); got != string(tc.wantNine) {
- t.Errorf("AppendDigit(9): got %+q; want %+q", got, tc.wantNine)
- }
- })
- }
-}
-
-func TestFormats(t *testing.T) {
- testCases := []struct {
- lang string
- pattern string
- index []byte
- }{
- {"en", "#,##0.###", tagToDecimal},
- {"de", "#,##0.###", tagToDecimal},
- {"de-CH", "#,##0.###", tagToDecimal},
- {"pa", "#,##,##0.###", tagToDecimal},
- {"pa-Arab", "#,##0.###", tagToDecimal}, // Does NOT inherit from pa!
- {"mr", "#,##,##0.###", tagToDecimal},
- {"mr-IN", "#,##,##0.###", tagToDecimal}, // Inherits from mr.
- {"nl", "#E0", tagToScientific},
- {"nl-MX", "#E0", tagToScientific}, // Inherits through Tag.Parent.
- {"zgh", "#,##0 %", tagToPercent},
- }
- for _, tc := range testCases {
- testtext.Run(t, tc.lang, func(t *testing.T) {
- got := formatForLang(language.MustParse(tc.lang), tc.index)
- want, _ := ParsePattern(tc.pattern)
- if *got != *want {
- t.Errorf("\ngot %#v;\nwant %#v", got, want)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/pattern_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/pattern_test.go
deleted file mode 100644
index a7517d0047e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/pattern_test.go
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "reflect"
- "testing"
- "unsafe"
-)
-
-var testCases = []struct {
- pat string
- want *Pattern
-}{{
- "#",
- &Pattern{
- FormatWidth: 1,
- // TODO: Should MinIntegerDigits be 1?
- },
-}, {
- "0",
- &Pattern{
- FormatWidth: 1,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- },
- },
-}, {
- "+0",
- &Pattern{
- Affix: "\x01+\x00",
- FormatWidth: 2,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- },
- },
-}, {
- "0+",
- &Pattern{
- Affix: "\x00\x01+",
- FormatWidth: 2,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- },
- },
-}, {
- "0000",
- &Pattern{
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 4,
- },
- },
-}, {
- ".#",
- &Pattern{
- FormatWidth: 2,
- RoundingContext: RoundingContext{
- MaxFractionDigits: 1,
- },
- },
-}, {
- "#0.###",
- &Pattern{
- FormatWidth: 6,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxFractionDigits: 3,
- },
- },
-}, {
- "#0.######",
- &Pattern{
- FormatWidth: 9,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxFractionDigits: 6,
- },
- },
-}, {
- "#,0",
- &Pattern{
- FormatWidth: 3,
- GroupingSize: [2]uint8{1, 0},
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- },
- },
-}, {
- "#,0.00",
- &Pattern{
- FormatWidth: 6,
- GroupingSize: [2]uint8{1, 0},
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MinFractionDigits: 2,
- MaxFractionDigits: 2,
- },
- },
-}, {
- "#,##0.###",
- &Pattern{
- FormatWidth: 9,
- GroupingSize: [2]uint8{3, 0},
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxFractionDigits: 3,
- },
- },
-}, {
- "#,##,##0.###",
- &Pattern{
- FormatWidth: 12,
- GroupingSize: [2]uint8{3, 2},
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxFractionDigits: 3,
- },
- },
-}, {
- // Ignore additional separators.
- "#,####,##,##0.###",
- &Pattern{
- FormatWidth: 17,
- GroupingSize: [2]uint8{3, 2},
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxFractionDigits: 3,
- },
- },
-}, {
- "#E0",
- &Pattern{
- FormatWidth: 3,
- RoundingContext: RoundingContext{
- MaxIntegerDigits: 1,
- MinExponentDigits: 1,
- },
- },
-}, {
- // At least one exponent digit is required. As long as this is true, one can
- // determine that scientific rendering is needed if MinExponentDigits > 0.
- "#E#",
- nil,
-}, {
- "0E0",
- &Pattern{
- FormatWidth: 3,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MinExponentDigits: 1,
- },
- },
-}, {
- "##0.###E00",
- &Pattern{
- FormatWidth: 10,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxIntegerDigits: 3,
- MaxFractionDigits: 3,
- MinExponentDigits: 2,
- },
- },
-}, {
- "##00.0#E0",
- &Pattern{
- FormatWidth: 9,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 2,
- MaxIntegerDigits: 4,
- MinFractionDigits: 1,
- MaxFractionDigits: 2,
- MinExponentDigits: 1,
- },
- },
-}, {
- "#00.0E+0",
- &Pattern{
- FormatWidth: 8,
- Flags: AlwaysExpSign,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 2,
- MaxIntegerDigits: 3,
- MinFractionDigits: 1,
- MaxFractionDigits: 1,
- MinExponentDigits: 1,
- },
- },
-}, {
- "0.0E++0",
- nil,
-}, {
- "#0E+",
- nil,
-}, {
- // significant digits
- "@",
- &Pattern{
- FormatWidth: 1,
- RoundingContext: RoundingContext{
- MinSignificantDigits: 1,
- MaxSignificantDigits: 1,
- MaxFractionDigits: -1,
- },
- },
-}, {
- // significant digits
- "@@@@",
- &Pattern{
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- MinSignificantDigits: 4,
- MaxSignificantDigits: 4,
- MaxFractionDigits: -1,
- },
- },
-}, {
- "@###",
- &Pattern{
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- MinSignificantDigits: 1,
- MaxSignificantDigits: 4,
- MaxFractionDigits: -1,
- },
- },
-}, {
- // Exponents in significant digits mode gets normalized.
- "@@E0",
- &Pattern{
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxIntegerDigits: 1,
- MinFractionDigits: 1,
- MaxFractionDigits: 1,
- MinExponentDigits: 1,
- },
- },
-}, {
- "@###E00",
- &Pattern{
- FormatWidth: 7,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxIntegerDigits: 1,
- MinFractionDigits: 0,
- MaxFractionDigits: 3,
- MinExponentDigits: 2,
- },
- },
-}, {
- // The significant digits mode does not allow fractions.
- "@###.#E0",
- nil,
-}, {
- //alternative negative pattern
- "#0.###;(#0.###)",
- &Pattern{
- Affix: "\x00\x00\x01(\x01)",
- NegOffset: 2,
- FormatWidth: 6,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MaxFractionDigits: 3,
- },
- },
-}, {
- // Rounding increment
- "1.05",
- &Pattern{
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- Increment: 105,
- IncrementScale: 2,
- MinIntegerDigits: 1,
- MinFractionDigits: 2,
- MaxFractionDigits: 2,
- },
- },
-}, {
- // Rounding increment with grouping
- "1,05",
- &Pattern{
- FormatWidth: 4,
- GroupingSize: [2]uint8{2, 0},
- RoundingContext: RoundingContext{
- Increment: 105,
- IncrementScale: 0,
- MinIntegerDigits: 3,
- MinFractionDigits: 0,
- MaxFractionDigits: 0,
- },
- },
-}, {
- "0.0%",
- &Pattern{
- Affix: "\x00\x01%",
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- DigitShift: 2,
- MinIntegerDigits: 1,
- MinFractionDigits: 1,
- MaxFractionDigits: 1,
- },
- },
-}, {
- "0.0‰",
- &Pattern{
- Affix: "\x00\x03‰",
- FormatWidth: 4,
- RoundingContext: RoundingContext{
- DigitShift: 3,
- MinIntegerDigits: 1,
- MinFractionDigits: 1,
- MaxFractionDigits: 1,
- },
- },
-}, {
- "#,##0.00¤",
- &Pattern{
- Affix: "\x00\x02¤",
- FormatWidth: 9,
- GroupingSize: [2]uint8{3, 0},
- RoundingContext: RoundingContext{
- MinIntegerDigits: 1,
- MinFractionDigits: 2,
- MaxFractionDigits: 2,
- },
- },
-}, {
- "#,##0.00 ¤;(#,##0.00 ¤)",
- &Pattern{Affix: "\x00\x04\u00a0¤\x01(\x05\u00a0¤)",
- NegOffset: 6,
- FormatWidth: 10,
- GroupingSize: [2]uint8{3, 0},
- RoundingContext: RoundingContext{
- DigitShift: 0,
- MinIntegerDigits: 1,
- MinFractionDigits: 2,
- MaxFractionDigits: 2,
- },
- },
-}, {
- // padding
- "*x#",
- &Pattern{
- PadRune: 'x',
- FormatWidth: 1,
- },
-}, {
- // padding
- "#*x",
- &Pattern{
- PadRune: 'x',
- FormatWidth: 1,
- Flags: PadBeforeSuffix,
- },
-}, {
- "*xpre#suf",
- &Pattern{
- Affix: "\x03pre\x03suf",
- PadRune: 'x',
- FormatWidth: 7,
- },
-}, {
- "pre*x#suf",
- &Pattern{
- Affix: "\x03pre\x03suf",
- PadRune: 'x',
- FormatWidth: 7,
- Flags: PadAfterPrefix,
- },
-}, {
- "pre#*xsuf",
- &Pattern{
- Affix: "\x03pre\x03suf",
- PadRune: 'x',
- FormatWidth: 7,
- Flags: PadBeforeSuffix,
- },
-}, {
- "pre#suf*x",
- &Pattern{
- Affix: "\x03pre\x03suf",
- PadRune: 'x',
- FormatWidth: 7,
- Flags: PadAfterSuffix,
- },
-}, {
- `* #0 o''clock`,
- &Pattern{Affix: "\x00\x09 o\\'clock",
- FormatWidth: 10,
- PadRune: 32,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 0x1,
- },
- },
-}, {
- `'123'* #0'456'`,
- &Pattern{Affix: "\x05'123'\x05'456'",
- FormatWidth: 8,
- PadRune: 32,
- RoundingContext: RoundingContext{
- MinIntegerDigits: 0x1,
- },
- Flags: PadAfterPrefix},
-}, {
- // no duplicate padding
- "*xpre#suf*x", nil,
-}, {
- // no duplicate padding
- "*xpre#suf*x", nil,
-}}
-
-func TestParsePattern(t *testing.T) {
- for i, tc := range testCases {
- t.Run(tc.pat, func(t *testing.T) {
- f, err := ParsePattern(tc.pat)
- if !reflect.DeepEqual(f, tc.want) {
- t.Errorf("%d:%s:\ngot %#v;\nwant %#v", i, tc.pat, f, tc.want)
- }
- if got, want := err != nil, tc.want == nil; got != want {
- t.Errorf("%d:%s:error: got %v; want %v", i, tc.pat, err, want)
- }
- })
- }
-}
-
-func TestPatternSize(t *testing.T) {
- if sz := unsafe.Sizeof(Pattern{}); sz > 56 {
- t.Errorf("got %d; want <= 56", sz)
- }
-
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/tables_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/tables_test.go
deleted file mode 100644
index 054e23d2644..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/number/tables_test.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "flag"
- "log"
- "reflect"
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/unicode/cldr"
-)
-
-var draft = flag.String("draft",
- "contributed",
- `Minimal draft requirements (approved, contributed, provisional, unconfirmed).`)
-
-func TestNumberSystems(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- r := gen.OpenCLDRCoreZip()
- defer r.Close()
-
- d := &cldr.Decoder{}
- d.SetDirFilter("supplemental")
- d.SetSectionFilter("numberingSystem")
- data, err := d.DecodeZip(r)
- if err != nil {
- t.Fatalf("DecodeZip: %v", err)
- }
-
- for _, ns := range data.Supplemental().NumberingSystems.NumberingSystem {
- n := systemMap[ns.Id]
- if int(n) >= len(numSysData) {
- continue
- }
- info := InfoFromLangID(0, ns.Id)
- val := '0'
- for _, rWant := range ns.Digits {
- if rGot := info.Digit(val); rGot != rWant {
- t.Errorf("%s:%d: got %U; want %U", ns.Id, val, rGot, rWant)
- }
- val++
- }
- }
-}
-
-func TestSymbols(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- draft, err := cldr.ParseDraft(*draft)
- if err != nil {
- log.Fatalf("invalid draft level: %v", err)
- }
-
- r := gen.OpenCLDRCoreZip()
- defer r.Close()
-
- d := &cldr.Decoder{}
- d.SetDirFilter("main")
- d.SetSectionFilter("numbers")
- data, err := d.DecodeZip(r)
- if err != nil {
- t.Fatalf("DecodeZip: %v", err)
- }
-
- for _, lang := range data.Locales() {
- ldml := data.RawLDML(lang)
- if ldml.Numbers == nil {
- continue
- }
- langIndex, ok := language.CompactIndex(language.MustParse(lang))
- if !ok {
- t.Fatalf("No compact index for language %s", lang)
- }
-
- syms := cldr.MakeSlice(&ldml.Numbers.Symbols)
- syms.SelectDraft(draft)
-
- for _, sym := range ldml.Numbers.Symbols {
- if sym.NumberSystem == "" {
- continue
- }
- testCases := []struct {
- name string
- st SymbolType
- x interface{}
- }{
- {"Decimal", SymDecimal, sym.Decimal},
- {"Group", SymGroup, sym.Group},
- {"List", SymList, sym.List},
- {"PercentSign", SymPercentSign, sym.PercentSign},
- {"PlusSign", SymPlusSign, sym.PlusSign},
- {"MinusSign", SymMinusSign, sym.MinusSign},
- {"Exponential", SymExponential, sym.Exponential},
- {"SuperscriptingExponent", SymSuperscriptingExponent, sym.SuperscriptingExponent},
- {"PerMille", SymPerMille, sym.PerMille},
- {"Infinity", SymInfinity, sym.Infinity},
- {"NaN", SymNan, sym.Nan},
- {"TimeSeparator", SymTimeSeparator, sym.TimeSeparator},
- }
- info := InfoFromLangID(langIndex, sym.NumberSystem)
- for _, tc := range testCases {
- // Extract the wanted value.
- v := reflect.ValueOf(tc.x)
- if v.Len() == 0 {
- return
- }
- if v.Len() > 1 {
- t.Fatalf("Multiple values of %q within single symbol not supported.", tc.name)
- }
- want := v.Index(0).MethodByName("Data").Call(nil)[0].String()
- got := info.Symbol(tc.st)
- if got != want {
- t.Errorf("%s:%s:%s: got %q; want %q", lang, sym.NumberSystem, tc.name, got, want)
- }
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/stringset/set_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/stringset/set_test.go
deleted file mode 100644
index 97b9e58be3e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/stringset/set_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package stringset
-
-import "testing"
-
-func TestStringSet(t *testing.T) {
- testCases := [][]string{
- {""},
- {"∫"},
- {"a", "b", "c"},
- {"", "a", "bb", "ccc"},
- {" ", "aaa", "bb", "c"},
- }
- test := func(tc int, b *Builder) {
- set := b.Set()
- if set.Len() != len(testCases[tc]) {
- t.Errorf("%d:Len() = %d; want %d", tc, set.Len(), len(testCases[tc]))
- }
- for i, s := range testCases[tc] {
- if x := b.Index(s); x != i {
- t.Errorf("%d:Index(%q) = %d; want %d", tc, s, x, i)
- }
- if p := Search(&set, s); p != i {
- t.Errorf("%d:Search(%q) = %d; want %d", tc, s, p, i)
- }
- if set.Elem(i) != s {
- t.Errorf("%d:Elem(%d) = %s; want %s", tc, i, set.Elem(i), s)
- }
- }
- if p := Search(&set, "apple"); p != -1 {
- t.Errorf(`%d:Search("apple") = %d; want -1`, tc, p)
- }
- }
- for i, tc := range testCases {
- b := NewBuilder()
- for _, s := range tc {
- b.Add(s)
- }
- b.Add(tc...)
- test(i, b)
- }
- for i, tc := range testCases {
- b := NewBuilder()
- b.Add(tc...)
- for _, s := range tc {
- b.Add(s)
- }
- test(i, b)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/tag/tag_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/tag/tag_test.go
deleted file mode 100644
index da174a24c42..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/tag/tag_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package tag
-
-import (
- "strings"
- "testing"
-)
-
-var strdata = []string{
- "aa ",
- "aaa ",
- "aaaa",
- "aaab",
- "aab ",
- "ab ",
- "ba ",
- "xxxx",
- "\xff\xff\xff\xff",
-}
-
-var testCases = map[string]int{
- "a": 0,
- "aa": 0,
- "aaa": 1,
- "aa ": 0,
- "aaaa": 2,
- "aaab": 3,
- "b": 6,
- "ba": 6,
- " ": -1,
- "aaax": -1,
- "bbbb": -1,
- "zzzz": -1,
-}
-
-func TestIndex(t *testing.T) {
- index := Index(strings.Join(strdata, ""))
- for k, v := range testCases {
- if i := index.Index([]byte(k)); i != v {
- t.Errorf("%s: got %d; want %d", k, i, v)
- }
- }
-}
-
-func TestFixCase(t *testing.T) {
- tests := []string{
- "aaaa", "AbCD", "abcd",
- "Zzzz", "AbCD", "Abcd",
- "Zzzz", "AbC", "",
- "XXX", "ab ", "",
- "XXX", "usd", "USD",
- "cmn", "AB ", "",
- "gsw", "CMN", "cmn",
- }
- for tc := tests; len(tc) > 0; tc = tc[3:] {
- b := []byte(tc[1])
- if !FixCase(tc[0], b) {
- b = nil
- }
- if string(b) != tc[2] {
- t.Errorf("FixCase(%q, %q) = %q; want %q", tc[0], tc[1], b, tc[2])
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/data_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/data_test.go
deleted file mode 100644
index 91de547a553..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/data_test.go
+++ /dev/null
@@ -1,875 +0,0 @@
-// This file is generated with "go test -tags generate". DO NOT EDIT!
-// +build !generate
-
-package triegen_test
-
-// lookup returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *randTrie) lookup(s []byte) (v uint8, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return randValues[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = randIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *randTrie) lookupUnsafe(s []byte) uint8 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return randValues[c0]
- }
- i := randIndex[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = randIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = randIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// lookupString returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *randTrie) lookupString(s string) (v uint8, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return randValues[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := randIndex[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = randIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = randIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *randTrie) lookupStringUnsafe(s string) uint8 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return randValues[c0]
- }
- i := randIndex[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = randIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = randIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// randTrie. Total size: 9280 bytes (9.06 KiB). Checksum: 6debd324a8debb8f.
-type randTrie struct{}
-
-func newRandTrie(i int) *randTrie {
- return &randTrie{}
-}
-
-// lookupValue determines the type of block n and looks up the value for b.
-func (t *randTrie) lookupValue(n uint32, b byte) uint8 {
- switch {
- default:
- return uint8(randValues[n<<6+uint32(b)])
- }
-}
-
-// randValues: 56 blocks, 3584 entries, 3584 bytes
-// The third block is the zero block.
-var randValues = [3584]uint8{
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xc9: 0x0001,
- // Block 0x4, offset 0x100
- 0x100: 0x0001,
- // Block 0x5, offset 0x140
- 0x155: 0x0001,
- // Block 0x6, offset 0x180
- 0x196: 0x0001,
- // Block 0x7, offset 0x1c0
- 0x1ef: 0x0001,
- // Block 0x8, offset 0x200
- 0x206: 0x0001,
- // Block 0x9, offset 0x240
- 0x258: 0x0001,
- // Block 0xa, offset 0x280
- 0x288: 0x0001,
- // Block 0xb, offset 0x2c0
- 0x2f2: 0x0001,
- // Block 0xc, offset 0x300
- 0x304: 0x0001,
- // Block 0xd, offset 0x340
- 0x34b: 0x0001,
- // Block 0xe, offset 0x380
- 0x3ba: 0x0001,
- // Block 0xf, offset 0x3c0
- 0x3f5: 0x0001,
- // Block 0x10, offset 0x400
- 0x41d: 0x0001,
- // Block 0x11, offset 0x440
- 0x442: 0x0001,
- // Block 0x12, offset 0x480
- 0x4bb: 0x0001,
- // Block 0x13, offset 0x4c0
- 0x4e9: 0x0001,
- // Block 0x14, offset 0x500
- 0x53e: 0x0001,
- // Block 0x15, offset 0x540
- 0x55f: 0x0001,
- // Block 0x16, offset 0x580
- 0x5b7: 0x0001,
- // Block 0x17, offset 0x5c0
- 0x5d9: 0x0001,
- // Block 0x18, offset 0x600
- 0x60e: 0x0001,
- // Block 0x19, offset 0x640
- 0x652: 0x0001,
- // Block 0x1a, offset 0x680
- 0x68f: 0x0001,
- // Block 0x1b, offset 0x6c0
- 0x6dc: 0x0001,
- // Block 0x1c, offset 0x700
- 0x703: 0x0001,
- // Block 0x1d, offset 0x740
- 0x741: 0x0001,
- // Block 0x1e, offset 0x780
- 0x79b: 0x0001,
- // Block 0x1f, offset 0x7c0
- 0x7f1: 0x0001,
- // Block 0x20, offset 0x800
- 0x833: 0x0001,
- // Block 0x21, offset 0x840
- 0x853: 0x0001,
- // Block 0x22, offset 0x880
- 0x8a2: 0x0001,
- // Block 0x23, offset 0x8c0
- 0x8f8: 0x0001,
- // Block 0x24, offset 0x900
- 0x917: 0x0001,
- // Block 0x25, offset 0x940
- 0x945: 0x0001,
- // Block 0x26, offset 0x980
- 0x99e: 0x0001,
- // Block 0x27, offset 0x9c0
- 0x9fd: 0x0001,
- // Block 0x28, offset 0xa00
- 0xa0d: 0x0001,
- // Block 0x29, offset 0xa40
- 0xa66: 0x0001,
- // Block 0x2a, offset 0xa80
- 0xaab: 0x0001,
- // Block 0x2b, offset 0xac0
- 0xaea: 0x0001,
- // Block 0x2c, offset 0xb00
- 0xb2d: 0x0001,
- // Block 0x2d, offset 0xb40
- 0xb54: 0x0001,
- // Block 0x2e, offset 0xb80
- 0xb90: 0x0001,
- // Block 0x2f, offset 0xbc0
- 0xbe5: 0x0001,
- // Block 0x30, offset 0xc00
- 0xc28: 0x0001,
- // Block 0x31, offset 0xc40
- 0xc7c: 0x0001,
- // Block 0x32, offset 0xc80
- 0xcbf: 0x0001,
- // Block 0x33, offset 0xcc0
- 0xcc7: 0x0001,
- // Block 0x34, offset 0xd00
- 0xd34: 0x0001,
- // Block 0x35, offset 0xd40
- 0xd61: 0x0001,
- // Block 0x36, offset 0xd80
- 0xdb9: 0x0001,
- // Block 0x37, offset 0xdc0
- 0xdda: 0x0001,
-}
-
-// randIndex: 89 blocks, 5696 entries, 5696 bytes
-// Block 0 is the zero block.
-var randIndex = [5696]uint8{
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xe1: 0x02, 0xe3: 0x03, 0xe4: 0x04,
- 0xea: 0x05, 0xeb: 0x06, 0xec: 0x07,
- 0xf0: 0x10, 0xf1: 0x24, 0xf2: 0x3d, 0xf3: 0x4f, 0xf4: 0x56,
- // Block 0x4, offset 0x100
- 0x107: 0x01,
- // Block 0x5, offset 0x140
- 0x16c: 0x02,
- // Block 0x6, offset 0x180
- 0x19c: 0x03,
- 0x1ae: 0x04,
- // Block 0x7, offset 0x1c0
- 0x1d8: 0x05,
- 0x1f7: 0x06,
- // Block 0x8, offset 0x200
- 0x20c: 0x07,
- // Block 0x9, offset 0x240
- 0x24a: 0x08,
- // Block 0xa, offset 0x280
- 0x2b6: 0x09,
- // Block 0xb, offset 0x2c0
- 0x2d5: 0x0a,
- // Block 0xc, offset 0x300
- 0x31a: 0x0b,
- // Block 0xd, offset 0x340
- 0x373: 0x0c,
- // Block 0xe, offset 0x380
- 0x38b: 0x0d,
- // Block 0xf, offset 0x3c0
- 0x3f0: 0x0e,
- // Block 0x10, offset 0x400
- 0x433: 0x0f,
- // Block 0x11, offset 0x440
- 0x45d: 0x10,
- // Block 0x12, offset 0x480
- 0x491: 0x08, 0x494: 0x09, 0x497: 0x0a,
- 0x49b: 0x0b, 0x49c: 0x0c,
- 0x4a1: 0x0d,
- 0x4ad: 0x0e,
- 0x4ba: 0x0f,
- // Block 0x13, offset 0x4c0
- 0x4c1: 0x11,
- // Block 0x14, offset 0x500
- 0x531: 0x12,
- // Block 0x15, offset 0x540
- 0x546: 0x13,
- // Block 0x16, offset 0x580
- 0x5ab: 0x14,
- // Block 0x17, offset 0x5c0
- 0x5d4: 0x11,
- 0x5fe: 0x11,
- // Block 0x18, offset 0x600
- 0x618: 0x0a,
- // Block 0x19, offset 0x640
- 0x65b: 0x15,
- // Block 0x1a, offset 0x680
- 0x6a0: 0x16,
- // Block 0x1b, offset 0x6c0
- 0x6d2: 0x17,
- 0x6f6: 0x18,
- // Block 0x1c, offset 0x700
- 0x711: 0x19,
- // Block 0x1d, offset 0x740
- 0x768: 0x1a,
- // Block 0x1e, offset 0x780
- 0x783: 0x1b,
- // Block 0x1f, offset 0x7c0
- 0x7f9: 0x1c,
- // Block 0x20, offset 0x800
- 0x831: 0x1d,
- // Block 0x21, offset 0x840
- 0x85e: 0x1e,
- // Block 0x22, offset 0x880
- 0x898: 0x1f,
- // Block 0x23, offset 0x8c0
- 0x8c7: 0x18,
- 0x8d5: 0x14,
- 0x8f7: 0x20,
- 0x8fe: 0x1f,
- // Block 0x24, offset 0x900
- 0x905: 0x21,
- // Block 0x25, offset 0x940
- 0x966: 0x03,
- // Block 0x26, offset 0x980
- 0x981: 0x07, 0x983: 0x11,
- 0x989: 0x12, 0x98a: 0x13, 0x98e: 0x14, 0x98f: 0x15,
- 0x992: 0x16, 0x995: 0x17, 0x996: 0x18,
- 0x998: 0x19, 0x999: 0x1a, 0x99b: 0x1b, 0x99f: 0x1c,
- 0x9a3: 0x1d,
- 0x9ad: 0x1e, 0x9af: 0x1f,
- 0x9b0: 0x20, 0x9b1: 0x21,
- 0x9b8: 0x22, 0x9bd: 0x23,
- // Block 0x27, offset 0x9c0
- 0x9cd: 0x22,
- // Block 0x28, offset 0xa00
- 0xa0c: 0x08,
- // Block 0x29, offset 0xa40
- 0xa6f: 0x1c,
- // Block 0x2a, offset 0xa80
- 0xa90: 0x1a,
- 0xaaf: 0x23,
- // Block 0x2b, offset 0xac0
- 0xae3: 0x19,
- 0xae8: 0x24,
- 0xafc: 0x25,
- // Block 0x2c, offset 0xb00
- 0xb13: 0x26,
- // Block 0x2d, offset 0xb40
- 0xb67: 0x1c,
- // Block 0x2e, offset 0xb80
- 0xb8f: 0x0b,
- // Block 0x2f, offset 0xbc0
- 0xbcb: 0x27,
- 0xbe7: 0x26,
- // Block 0x30, offset 0xc00
- 0xc34: 0x16,
- // Block 0x31, offset 0xc40
- 0xc62: 0x03,
- // Block 0x32, offset 0xc80
- 0xcbb: 0x12,
- // Block 0x33, offset 0xcc0
- 0xcdf: 0x09,
- // Block 0x34, offset 0xd00
- 0xd34: 0x0a,
- // Block 0x35, offset 0xd40
- 0xd41: 0x1e,
- // Block 0x36, offset 0xd80
- 0xd83: 0x28,
- // Block 0x37, offset 0xdc0
- 0xdc0: 0x15,
- // Block 0x38, offset 0xe00
- 0xe1a: 0x15,
- // Block 0x39, offset 0xe40
- 0xe65: 0x29,
- // Block 0x3a, offset 0xe80
- 0xe86: 0x1f,
- // Block 0x3b, offset 0xec0
- 0xeec: 0x18,
- // Block 0x3c, offset 0xf00
- 0xf28: 0x2a,
- // Block 0x3d, offset 0xf40
- 0xf53: 0x08,
- // Block 0x3e, offset 0xf80
- 0xfa2: 0x2b,
- 0xfaa: 0x17,
- // Block 0x3f, offset 0xfc0
- 0xfc0: 0x25, 0xfc2: 0x26,
- 0xfc9: 0x27, 0xfcd: 0x28, 0xfce: 0x29,
- 0xfd5: 0x2a,
- 0xfd8: 0x2b, 0xfd9: 0x2c, 0xfdf: 0x2d,
- 0xfe1: 0x2e, 0xfe2: 0x2f, 0xfe3: 0x30, 0xfe6: 0x31,
- 0xfe9: 0x32, 0xfec: 0x33, 0xfed: 0x34, 0xfef: 0x35,
- 0xff1: 0x36, 0xff2: 0x37, 0xff3: 0x38, 0xff4: 0x39,
- 0xffa: 0x3a, 0xffc: 0x3b, 0xffe: 0x3c,
- // Block 0x40, offset 0x1000
- 0x102c: 0x2c,
- // Block 0x41, offset 0x1040
- 0x1074: 0x2c,
- // Block 0x42, offset 0x1080
- 0x108c: 0x08,
- 0x10a0: 0x2d,
- // Block 0x43, offset 0x10c0
- 0x10e8: 0x10,
- // Block 0x44, offset 0x1100
- 0x110f: 0x13,
- // Block 0x45, offset 0x1140
- 0x114b: 0x2e,
- // Block 0x46, offset 0x1180
- 0x118b: 0x23,
- 0x119d: 0x0c,
- // Block 0x47, offset 0x11c0
- 0x11c3: 0x12,
- 0x11f9: 0x0f,
- // Block 0x48, offset 0x1200
- 0x121e: 0x1b,
- // Block 0x49, offset 0x1240
- 0x1270: 0x2f,
- // Block 0x4a, offset 0x1280
- 0x128a: 0x1b,
- 0x12a7: 0x02,
- // Block 0x4b, offset 0x12c0
- 0x12fb: 0x14,
- // Block 0x4c, offset 0x1300
- 0x1333: 0x30,
- // Block 0x4d, offset 0x1340
- 0x134d: 0x31,
- // Block 0x4e, offset 0x1380
- 0x138e: 0x15,
- // Block 0x4f, offset 0x13c0
- 0x13f4: 0x32,
- // Block 0x50, offset 0x1400
- 0x141b: 0x33,
- // Block 0x51, offset 0x1440
- 0x1448: 0x3e, 0x1449: 0x3f, 0x144a: 0x40, 0x144f: 0x41,
- 0x1459: 0x42, 0x145c: 0x43, 0x145e: 0x44, 0x145f: 0x45,
- 0x1468: 0x46, 0x1469: 0x47, 0x146c: 0x48, 0x146d: 0x49, 0x146e: 0x4a,
- 0x1472: 0x4b, 0x1473: 0x4c,
- 0x1479: 0x4d, 0x147b: 0x4e,
- // Block 0x52, offset 0x1480
- 0x1480: 0x34,
- 0x1499: 0x11,
- 0x14b6: 0x2c,
- // Block 0x53, offset 0x14c0
- 0x14e4: 0x0d,
- // Block 0x54, offset 0x1500
- 0x1527: 0x08,
- // Block 0x55, offset 0x1540
- 0x1555: 0x2b,
- // Block 0x56, offset 0x1580
- 0x15b2: 0x35,
- // Block 0x57, offset 0x15c0
- 0x15f2: 0x1c, 0x15f4: 0x29,
- // Block 0x58, offset 0x1600
- 0x1600: 0x50, 0x1603: 0x51,
- 0x1608: 0x52, 0x160a: 0x53, 0x160d: 0x54, 0x160e: 0x55,
-}
-
-// lookup returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *multiTrie) lookup(s []byte) (v uint64, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return t.ascii[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = multiIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *multiTrie) lookupUnsafe(s []byte) uint64 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return t.ascii[c0]
- }
- i := t.utf8Start[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// lookupString returns the trie value for the first UTF-8 encoding in s and
-// the width in bytes of this encoding. The size will be 0 if s does not
-// hold enough bytes to complete the encoding. len(s) must be greater than 0.
-func (t *multiTrie) lookupString(s string) (v uint64, sz int) {
- c0 := s[0]
- switch {
- case c0 < 0x80: // is ASCII
- return t.ascii[c0], 1
- case c0 < 0xC2:
- return 0, 1 // Illegal UTF-8: not a starter, not ASCII.
- case c0 < 0xE0: // 2-byte UTF-8
- if len(s) < 2 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c1), 2
- case c0 < 0xF0: // 3-byte UTF-8
- if len(s) < 3 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c2), 3
- case c0 < 0xF8: // 4-byte UTF-8
- if len(s) < 4 {
- return 0, 0
- }
- i := t.utf8Start[c0]
- c1 := s[1]
- if c1 < 0x80 || 0xC0 <= c1 {
- return 0, 1 // Illegal UTF-8: not a continuation byte.
- }
- o := uint32(i)<<6 + uint32(c1)
- i = multiIndex[o]
- c2 := s[2]
- if c2 < 0x80 || 0xC0 <= c2 {
- return 0, 2 // Illegal UTF-8: not a continuation byte.
- }
- o = uint32(i)<<6 + uint32(c2)
- i = multiIndex[o]
- c3 := s[3]
- if c3 < 0x80 || 0xC0 <= c3 {
- return 0, 3 // Illegal UTF-8: not a continuation byte.
- }
- return t.lookupValue(uint32(i), c3), 4
- }
- // Illegal rune
- return 0, 1
-}
-
-// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s.
-// s must start with a full and valid UTF-8 encoded rune.
-func (t *multiTrie) lookupStringUnsafe(s string) uint64 {
- c0 := s[0]
- if c0 < 0x80 { // is ASCII
- return t.ascii[c0]
- }
- i := t.utf8Start[c0]
- if c0 < 0xE0 { // 2-byte UTF-8
- return t.lookupValue(uint32(i), s[1])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[1])]
- if c0 < 0xF0 { // 3-byte UTF-8
- return t.lookupValue(uint32(i), s[2])
- }
- i = multiIndex[uint32(i)<<6+uint32(s[2])]
- if c0 < 0xF8 { // 4-byte UTF-8
- return t.lookupValue(uint32(i), s[3])
- }
- return 0
-}
-
-// multiTrie. Total size: 18250 bytes (17.82 KiB). Checksum: a69a609d8696aa5e.
-type multiTrie struct {
- ascii []uint64 // index for ASCII bytes
- utf8Start []uint8 // index for UTF-8 bytes >= 0xC0
-}
-
-func newMultiTrie(i int) *multiTrie {
- h := multiTrieHandles[i]
- return &multiTrie{multiValues[uint32(h.ascii)<<6:], multiIndex[uint32(h.multi)<<6:]}
-}
-
-type multiTrieHandle struct {
- ascii, multi uint8
-}
-
-// multiTrieHandles: 5 handles, 10 bytes
-var multiTrieHandles = [5]multiTrieHandle{
- {0, 0}, // 8c1e77823143d35c: all
- {0, 23}, // 8fb58ff8243b45b0: ASCII only
- {0, 23}, // 8fb58ff8243b45b0: ASCII only 2
- {0, 24}, // 2ccc43994f11046f: BMP only
- {30, 25}, // ce448591bdcb4733: No BMP
-}
-
-// lookupValue determines the type of block n and looks up the value for b.
-func (t *multiTrie) lookupValue(n uint32, b byte) uint64 {
- switch {
- default:
- return uint64(multiValues[n<<6+uint32(b)])
- }
-}
-
-// multiValues: 32 blocks, 2048 entries, 16384 bytes
-// The third block is the zero block.
-var multiValues = [2048]uint64{
- // Block 0x0, offset 0x0
- 0x03: 0x6e361699800b9fb8, 0x04: 0x52d3935a34f6f0b, 0x05: 0x2948319393e7ef10,
- 0x07: 0x20f03b006704f663, 0x08: 0x6c15c0732bb2495f, 0x09: 0xe54e2c59d953551,
- 0x0f: 0x33d8a825807d8037, 0x10: 0x6ecd93cb12168b92, 0x11: 0x6a81c9c0ce86e884,
- 0x1f: 0xa03e77aac8be79b, 0x20: 0x28591d0e7e486efa, 0x21: 0x716fa3bc398dec8,
- 0x3f: 0x4fd3bcfa72bce8b0,
- // Block 0x1, offset 0x40
- 0x40: 0x3cbaef3db8ba5f12, 0x41: 0x2d262347c1f56357,
- 0x7f: 0x782caa2d25a418a9,
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xc0: 0x6bbd1f937b1ff5d2, 0xc1: 0x732e23088d2eb8a4,
- // Block 0x4, offset 0x100
- 0x13f: 0x56f8c4c82f5962dc,
- // Block 0x5, offset 0x140
- 0x140: 0x57dc4544729a5da2, 0x141: 0x2f62f9cd307ffa0d,
- // Block 0x6, offset 0x180
- 0x1bf: 0x7bf4d0ebf302a088,
- // Block 0x7, offset 0x1c0
- 0x1c0: 0x1f0d67f249e59931, 0x1c1: 0x3011def73aa550c7,
- // Block 0x8, offset 0x200
- 0x23f: 0x5de81c1dff6bf29d,
- // Block 0x9, offset 0x240
- 0x240: 0x752c035737b825e8, 0x241: 0x1e793399081e3bb3,
- // Block 0xa, offset 0x280
- 0x2bf: 0x6a28f01979cbf059,
- // Block 0xb, offset 0x2c0
- 0x2c0: 0x373a4b0f2cbd4c74, 0x2c1: 0x4fd2c288683b767c,
- // Block 0xc, offset 0x300
- 0x33f: 0x5a10ffa9e29184fb,
- // Block 0xd, offset 0x340
- 0x340: 0x700f9bdb53fff6a5, 0x341: 0xcde93df0427eb79,
- // Block 0xe, offset 0x380
- 0x3bf: 0x74071288fff39c76,
- // Block 0xf, offset 0x3c0
- 0x3c0: 0x481fc2f510e5268a, 0x3c1: 0x7565c28164204849,
- // Block 0x10, offset 0x400
- 0x43f: 0x5676a62fd49c6bec,
- // Block 0x11, offset 0x440
- 0x440: 0x2f2d15776cbafc6b, 0x441: 0x4c55e8dc0ff11a3f,
- // Block 0x12, offset 0x480
- 0x4bf: 0x69d6f0fe711fafc9,
- // Block 0x13, offset 0x4c0
- 0x4c0: 0x33181de28cfb062d, 0x4c1: 0x2ef3adc6bb2f2d02,
- // Block 0x14, offset 0x500
- 0x53f: 0xe03b31814c95f8b,
- // Block 0x15, offset 0x540
- 0x540: 0x3bf6dc9a1c115603, 0x541: 0x6984ec9b7f51f7fc,
- // Block 0x16, offset 0x580
- 0x5bf: 0x3c02ea92fb168559,
- // Block 0x17, offset 0x5c0
- 0x5c0: 0x1badfe42e7629494, 0x5c1: 0x6dc4a554005f7645,
- // Block 0x18, offset 0x600
- 0x63f: 0x3bb2ed2a72748f4b,
- // Block 0x19, offset 0x640
- 0x640: 0x291354cd6767ec10, 0x641: 0x2c3a4715e3c070d6,
- // Block 0x1a, offset 0x680
- 0x6bf: 0x352711cfb7236418,
- // Block 0x1b, offset 0x6c0
- 0x6c0: 0x3a59d34fb8bceda, 0x6c1: 0x5e90d8ebedd64fa1,
- // Block 0x1c, offset 0x700
- 0x73f: 0x7191a77b28d23110,
- // Block 0x1d, offset 0x740
- 0x740: 0x4ca7f0c1623423d8, 0x741: 0x4f7156d996e2d0de,
- // Block 0x1e, offset 0x780
- // Block 0x1f, offset 0x7c0
-}
-
-// multiIndex: 29 blocks, 1856 entries, 1856 bytes
-// Block 0 is the zero block.
-var multiIndex = [1856]uint8{
- // Block 0x0, offset 0x0
- // Block 0x1, offset 0x40
- // Block 0x2, offset 0x80
- // Block 0x3, offset 0xc0
- 0xc2: 0x01, 0xc3: 0x02, 0xc4: 0x03, 0xc7: 0x04,
- 0xc8: 0x05, 0xcf: 0x06,
- 0xd0: 0x07,
- 0xdf: 0x08,
- 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe7: 0x07,
- 0xe8: 0x08, 0xef: 0x09,
- 0xf0: 0x0e, 0xf1: 0x11, 0xf2: 0x13, 0xf3: 0x15, 0xf4: 0x17,
- // Block 0x4, offset 0x100
- 0x120: 0x09,
- 0x13f: 0x0a,
- // Block 0x5, offset 0x140
- 0x140: 0x0b,
- 0x17f: 0x0c,
- // Block 0x6, offset 0x180
- 0x180: 0x0d,
- // Block 0x7, offset 0x1c0
- 0x1ff: 0x0e,
- // Block 0x8, offset 0x200
- 0x200: 0x0f,
- // Block 0x9, offset 0x240
- 0x27f: 0x10,
- // Block 0xa, offset 0x280
- 0x280: 0x11,
- // Block 0xb, offset 0x2c0
- 0x2ff: 0x12,
- // Block 0xc, offset 0x300
- 0x300: 0x13,
- // Block 0xd, offset 0x340
- 0x37f: 0x14,
- // Block 0xe, offset 0x380
- 0x380: 0x15,
- // Block 0xf, offset 0x3c0
- 0x3ff: 0x16,
- // Block 0x10, offset 0x400
- 0x410: 0x0a,
- 0x41f: 0x0b,
- 0x420: 0x0c,
- 0x43f: 0x0d,
- // Block 0x11, offset 0x440
- 0x440: 0x17,
- // Block 0x12, offset 0x480
- 0x4bf: 0x18,
- // Block 0x13, offset 0x4c0
- 0x4c0: 0x0f,
- 0x4ff: 0x10,
- // Block 0x14, offset 0x500
- 0x500: 0x19,
- // Block 0x15, offset 0x540
- 0x540: 0x12,
- // Block 0x16, offset 0x580
- 0x5bf: 0x1a,
- // Block 0x17, offset 0x5c0
- 0x5ff: 0x14,
- // Block 0x18, offset 0x600
- 0x600: 0x1b,
- // Block 0x19, offset 0x640
- 0x640: 0x16,
- // Block 0x1a, offset 0x680
- // Block 0x1b, offset 0x6c0
- 0x6c2: 0x01, 0x6c3: 0x02, 0x6c4: 0x03, 0x6c7: 0x04,
- 0x6c8: 0x05, 0x6cf: 0x06,
- 0x6d0: 0x07,
- 0x6df: 0x08,
- 0x6e0: 0x02, 0x6e1: 0x03, 0x6e2: 0x04, 0x6e3: 0x05, 0x6e4: 0x06, 0x6e7: 0x07,
- 0x6e8: 0x08, 0x6ef: 0x09,
- // Block 0x1c, offset 0x700
- 0x730: 0x0e, 0x731: 0x11, 0x732: 0x13, 0x733: 0x15, 0x734: 0x17,
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_compact_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_compact_test.go
deleted file mode 100644
index 7cf604ca474..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_compact_test.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package triegen_test
-
-import (
- "fmt"
- "io"
- "io/ioutil"
-
- "golang.org/x/text/internal/triegen"
-)
-
-func ExampleCompacter() {
- t := triegen.NewTrie("root")
- for r := rune(0); r < 10000; r += 64 {
- t.Insert(r, 0x9015BADA55^uint64(r))
- }
- sz, _ := t.Gen(ioutil.Discard)
-
- fmt.Printf("Size normal: %5d\n", sz)
-
- var c myCompacter
- sz, _ = t.Gen(ioutil.Discard, triegen.Compact(&c))
-
- fmt.Printf("Size compacted: %5d\n", sz)
-
- // Output:
- // Size normal: 81344
- // Size compacted: 3224
-}
-
-// A myCompacter accepts a block if only the first value is given.
-type myCompacter []uint64
-
-func (c *myCompacter) Size(values []uint64) (sz int, ok bool) {
- for _, v := range values[1:] {
- if v != 0 {
- return 0, false
- }
- }
- return 8, true // the size of a uint64
-}
-
-func (c *myCompacter) Store(v []uint64) uint32 {
- x := uint32(len(*c))
- *c = append(*c, v[0])
- return x
-}
-
-func (c *myCompacter) Print(w io.Writer) error {
- fmt.Fprintln(w, "var firstValue = []uint64{")
- for _, v := range *c {
- fmt.Fprintf(w, "\t%#x,\n", v)
- }
- fmt.Fprintln(w, "}")
- return nil
-}
-
-func (c *myCompacter) Handler() string {
- return "getFirstValue"
-
- // Where getFirstValue is included along with the generated code:
- // func getFirstValue(n uint32, b byte) uint64 {
- // if b == 0x80 { // the first continuation byte
- // return firstValue[n]
- // }
- // return 0
- // }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_test.go
deleted file mode 100644
index 557a152e703..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/example_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package triegen_test
-
-import (
- "fmt"
- "io/ioutil"
- "math/rand"
- "unicode"
-
- "golang.org/x/text/internal/triegen"
-)
-
-const seed = 0x12345
-
-var genWriter = ioutil.Discard
-
-func randomRunes() map[rune]uint8 {
- rnd := rand.New(rand.NewSource(seed))
- m := map[rune]uint8{}
- for len(m) < 100 {
- // Only set our random rune if it is a valid Unicode code point.
- if r := rune(rnd.Int31n(unicode.MaxRune + 1)); []rune(string(r))[0] == r {
- m[r] = 1
- }
- }
- return m
-}
-
-// Example_build shows how to build a simple trie. It assigns the value 1 to
-// 100 random runes generated by randomRunes.
-func Example_build() {
- t := triegen.NewTrie("rand")
-
- for r, _ := range randomRunes() {
- t.Insert(r, 1)
- }
- sz, err := t.Gen(genWriter)
-
- fmt.Printf("Trie size: %d bytes\n", sz)
- fmt.Printf("Error: %v\n", err)
-
- // Output:
- // Trie size: 9280 bytes
- // Error: <nil>
-}
-
-// Example_lookup demonstrates how to use the trie generated by Example_build.
-func Example_lookup() {
- trie := newRandTrie(0)
-
- // The same set of runes used by Example_build.
- runes := randomRunes()
-
- // Verify the right value is returned for all runes.
- for r := rune(0); r <= unicode.MaxRune; r++ {
- // Note that the return type of lookup is uint8.
- if v, _ := trie.lookupString(string(r)); v != runes[r] {
- fmt.Println("FAILURE")
- return
- }
- }
- fmt.Println("SUCCESS")
-
- // Output:
- // SUCCESS
-}
-
-// runeValues generates some random values for a set of interesting runes.
-func runeValues() map[rune]uint64 {
- rnd := rand.New(rand.NewSource(seed))
- m := map[rune]uint64{}
- for p := 4; p <= unicode.MaxRune; p <<= 1 {
- for d := -1; d <= 1; d++ {
- m[rune(p+d)] = uint64(rnd.Int63())
- }
- }
- return m
-}
-
-// ExampleGen_build demonstrates the creation of multiple tries sharing common
-// blocks. ExampleGen_lookup demonstrates how to use the generated tries.
-func ExampleGen_build() {
- var tries []*triegen.Trie
-
- rv := runeValues()
- for _, c := range []struct {
- include func(rune) bool
- name string
- }{
- {func(r rune) bool { return true }, "all"},
- {func(r rune) bool { return r < 0x80 }, "ASCII only"},
- {func(r rune) bool { return r < 0x80 }, "ASCII only 2"},
- {func(r rune) bool { return r <= 0xFFFF }, "BMP only"},
- {func(r rune) bool { return r > 0xFFFF }, "No BMP"},
- } {
- t := triegen.NewTrie(c.name)
- tries = append(tries, t)
-
- for r, v := range rv {
- if c.include(r) {
- t.Insert(r, v)
- }
- }
- }
- sz, err := triegen.Gen(genWriter, "multi", tries)
-
- fmt.Printf("Trie size: %d bytes\n", sz)
- fmt.Printf("Error: %v\n", err)
-
- // Output:
- // Trie size: 18250 bytes
- // Error: <nil>
-}
-
-// ExampleGen_lookup shows how to look up values in the trie generated by
-// ExampleGen_build.
-func ExampleGen_lookup() {
- rv := runeValues()
- for i, include := range []func(rune) bool{
- func(r rune) bool { return true }, // all
- func(r rune) bool { return r < 0x80 }, // ASCII only
- func(r rune) bool { return r < 0x80 }, // ASCII only 2
- func(r rune) bool { return r <= 0xFFFF }, // BMP only
- func(r rune) bool { return r > 0xFFFF }, // No BMP
- } {
- t := newMultiTrie(i)
-
- for r := rune(0); r <= unicode.MaxRune; r++ {
- x := uint64(0)
- if include(r) {
- x = rv[r]
- }
- // As we convert from a valid rune, we know it is safe to use
- // lookupStringUnsafe.
- if v := t.lookupStringUnsafe(string(r)); x != v {
- fmt.Println("FAILURE")
- return
- }
- }
- }
- fmt.Println("SUCCESS")
-
- // Output:
- // SUCCESS
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/gen_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/gen_test.go
deleted file mode 100644
index 831627d7a05..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/triegen/gen_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build generate
-
-package triegen_test
-
-// The code in this file generates captures and writes the tries generated in
-// the examples to data_test.go. To invoke it, run:
-// go test -tags=generate
-//
-// Making the generation code a "test" allows us to link in the necessary test
-// code.
-
-import (
- "log"
- "os"
- "os/exec"
-)
-
-func init() {
- const tmpfile = "tmpout"
- const dstfile = "data_test.go"
-
- f, err := os.Create(tmpfile)
- if err != nil {
- log.Fatalf("Could not create output file: %v", err)
- }
- defer os.Remove(tmpfile)
- defer f.Close()
-
- // We exit before this function returns, regardless of success or failure,
- // so there's no need to save (and later restore) the existing genWriter
- // value.
- genWriter = f
-
- f.Write([]byte(header))
-
- Example_build()
- ExampleGen_build()
-
- if err := exec.Command("gofmt", "-w", tmpfile).Run(); err != nil {
- log.Fatal(err)
- }
- os.Remove(dstfile)
- os.Rename(tmpfile, dstfile)
-
- os.Exit(0)
-}
-
-const header = `// This file is generated with "go test -tags generate". DO NOT EDIT!
-// +build !generate
-
-package triegen_test
-`
-
-// Stubs for generated tries. These are needed as we exclude data_test.go if
-// the generate flag is set. This will clearly make the tests fail, but that
-// is okay. It allows us to bootstrap.
-
-type trie struct{}
-
-func (t *trie) lookupString(string) (uint8, int) { return 0, 1 }
-func (t *trie) lookupStringUnsafe(string) uint64 { return 0 }
-
-func newRandTrie(i int) *trie { return &trie{} }
-func newMultiTrie(i int) *trie { return &trie{} }
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/example_test.go
deleted file mode 100644
index 338a50d1c9a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/example_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ucd_test
-
-import (
- "fmt"
- "strings"
-
- "golang.org/x/text/internal/ucd"
-)
-
-func Example() {
- // Read rune-by-rune from UnicodeData.
- var count int
- p := ucd.New(strings.NewReader(unicodeData))
- for p.Next() {
- count++
- if lower := p.Runes(ucd.SimpleLowercaseMapping); lower != nil {
- fmt.Printf("lower(%U) -> %U\n", p.Rune(0), lower[0])
- }
- }
- if err := p.Err(); err != nil {
- fmt.Println(err)
- }
- fmt.Println("Number of runes visited:", count)
-
- // Read raw ranges from Scripts.
- p = ucd.New(strings.NewReader(scripts), ucd.KeepRanges)
- for p.Next() {
- start, end := p.Range(0)
- fmt.Printf("%04X..%04X: %s\n", start, end, p.String(1))
- }
- if err := p.Err(); err != nil {
- fmt.Println(err)
- }
-
- // Output:
- // lower(U+00C0) -> U+00E0
- // lower(U+00C1) -> U+00E1
- // lower(U+00C2) -> U+00E2
- // lower(U+00C3) -> U+00E3
- // lower(U+00C4) -> U+00E4
- // Number of runes visited: 6594
- // 0000..001F: Common
- // 0020..0020: Common
- // 0021..0023: Common
- // 0024..0024: Common
-}
-
-// Excerpt from UnicodeData.txt
-const unicodeData = `
-00B9;SUPERSCRIPT ONE;No;0;EN;<super> 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;;
-00BA;MASCULINE ORDINAL INDICATOR;Lo;0;L;<super> 006F;;;;N;;;;;
-00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;;;;
-00BC;VULGAR FRACTION ONE QUARTER;No;0;ON;<fraction> 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;;
-00BD;VULGAR FRACTION ONE HALF;No;0;ON;<fraction> 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;;
-00BE;VULGAR FRACTION THREE QUARTERS;No;0;ON;<fraction> 0033 2044 0034;;;3/4;N;FRACTION THREE QUARTERS;;;;
-00BF;INVERTED QUESTION MARK;Po;0;ON;;;;;N;;;;;
-00C0;LATIN CAPITAL LETTER A WITH GRAVE;Lu;0;L;0041 0300;;;;N;LATIN CAPITAL LETTER A GRAVE;;;00E0;
-00C1;LATIN CAPITAL LETTER A WITH ACUTE;Lu;0;L;0041 0301;;;;N;LATIN CAPITAL LETTER A ACUTE;;;00E1;
-00C2;LATIN CAPITAL LETTER A WITH CIRCUMFLEX;Lu;0;L;0041 0302;;;;N;LATIN CAPITAL LETTER A CIRCUMFLEX;;;00E2;
-00C3;LATIN CAPITAL LETTER A WITH TILDE;Lu;0;L;0041 0303;;;;N;LATIN CAPITAL LETTER A TILDE;;;00E3;
-00C4;LATIN CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0041 0308;;;;N;LATIN CAPITAL LETTER A DIAERESIS;;;00E4;
-
-# A legacy rune range.
-3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
-4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
-`
-
-// Excerpt from Scripts.txt
-const scripts = `
-# Property: Script
-# ================================================
-
-0000..001F ; Common # Cc [32] <control-0000>..<control-001F>
-0020 ; Common # Zs SPACE
-0021..0023 ; Common # Po [3] EXCLAMATION MARK..NUMBER SIGN
-0024 ; Common # Sc DOLLAR SIGN
-`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/ucd_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/ucd_test.go
deleted file mode 100644
index 11a6542e41d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/internal/ucd/ucd_test.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package ucd
-
-import (
- "strings"
- "testing"
-)
-
-const file = `
-# Comments should be skipped
-# rune; bool; uint; int; float; runes; # Y
-0..0005; Y; 0; 2; -5.25 ; 0 1 2 3 4 5;
-6..0007; Yes ; 6; 1; -4.25 ; 0006 0007;
-8; T ; 8 ; 0 ;-3.25 ;;# T
-9; True ;9 ; -1;-2.25 ; 0009;
-
-# more comments to be ignored
-@Part0
-
-A; N; 10 ; -2; -1.25; ;# N
-B; No; 11 ; -3; -0.25;
-C; False;12; -4; 0.75;
-D; ;13;-5;1.75;
-
-@Part1 # Another part.
-# We test part comments get removed by not commenting the the next line.
-E..10FFFF; F; 14 ; -6; 2.75;
-`
-
-var want = []struct {
- start, end rune
-}{
- {0x00, 0x05},
- {0x06, 0x07},
- {0x08, 0x08},
- {0x09, 0x09},
- {0x0A, 0x0A},
- {0x0B, 0x0B},
- {0x0C, 0x0C},
- {0x0D, 0x0D},
- {0x0E, 0x10FFFF},
-}
-
-func TestGetters(t *testing.T) {
- parts := [][2]string{
- {"Part0", ""},
- {"Part1", "Another part."},
- }
- handler := func(p *Parser) {
- if len(parts) == 0 {
- t.Error("Part handler invoked too many times.")
- return
- }
- want := parts[0]
- parts = parts[1:]
- if got0, got1 := p.String(0), p.Comment(); got0 != want[0] || got1 != want[1] {
- t.Errorf(`part: got %q, %q; want %q"`, got0, got1, want)
- }
- }
-
- p := New(strings.NewReader(file), KeepRanges, Part(handler))
- for i := 0; p.Next(); i++ {
- start, end := p.Range(0)
- w := want[i]
- if start != w.start || end != w.end {
- t.Fatalf("%d:Range(0); got %#x..%#x; want %#x..%#x", i, start, end, w.start, w.end)
- }
- if w.start == w.end && p.Rune(0) != w.start {
- t.Errorf("%d:Range(0).start: got %U; want %U", i, p.Rune(0), w.start)
- }
- if got, want := p.Bool(1), w.start <= 9; got != want {
- t.Errorf("%d:Bool(1): got %v; want %v", i, got, want)
- }
- if got := p.Rune(4); got != 0 || p.Err() == nil {
- t.Errorf("%d:Rune(%q): got no error; want error", i, p.String(1))
- }
- p.err = nil
- if got := p.Uint(2); rune(got) != start {
- t.Errorf("%d:Uint(2): got %v; want %v", i, got, start)
- }
- if got, want := p.Int(3), 2-i; got != want {
- t.Errorf("%d:Int(3): got %v; want %v", i, got, want)
- }
- if got, want := p.Float(4), -5.25+float64(i); got != want {
- t.Errorf("%d:Int(3): got %v; want %v", i, got, want)
- }
- if got := p.Runes(5); got == nil {
- if p.String(5) != "" {
- t.Errorf("%d:Runes(5): expected non-empty list", i)
- }
- } else {
- if got[0] != start || got[len(got)-1] != end {
- t.Errorf("%d:Runes(5): got %#x; want %#x..%#x", i, got, start, end)
- }
- }
- if got := p.Comment(); got != "" && got != p.String(1) {
- t.Errorf("%d:Comment(): got %v; want %v", i, got, p.String(1))
- }
- }
- if err := p.Err(); err != nil {
- t.Errorf("Parser error: %v", err)
- }
- if len(parts) != 0 {
- t.Errorf("expected %d more invocations of part handler", len(parts))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/coverage_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/coverage_test.go
deleted file mode 100644
index 8e08e5ca4cf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/coverage_test.go
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-func TestSupported(t *testing.T) {
- // To prove the results are correct for a type, we test that the number of
- // results is identical to the number of results on record, that all results
- // are distinct and that all results are valid.
- tests := map[string]int{
- "BaseLanguages": numLanguages,
- "Scripts": numScripts,
- "Regions": numRegions,
- "Tags": 0,
- }
- sup := reflect.ValueOf(Supported)
- for name, num := range tests {
- v := sup.MethodByName(name).Call(nil)[0]
- if n := v.Len(); n != num {
- t.Errorf("len(%s()) was %d; want %d", name, n, num)
- }
- dup := make(map[string]bool)
- for i := 0; i < v.Len(); i++ {
- x := v.Index(i).Interface()
- // An invalid value will either cause a crash or result in a
- // duplicate when passed to Sprint.
- s := fmt.Sprint(x)
- if dup[s] {
- t.Errorf("%s: duplicate entry %q", name, s)
- }
- dup[s] = true
- }
- if len(dup) != v.Len() {
- t.Errorf("%s: # unique entries was %d; want %d", name, len(dup), v.Len())
- }
- }
-}
-
-func TestNewCoverage(t *testing.T) {
- bases := []Base{Base{0}, Base{3}, Base{7}}
- scripts := []Script{Script{11}, Script{17}, Script{23}}
- regions := []Region{Region{101}, Region{103}, Region{107}}
- tags := []Tag{Make("pt"), Make("en"), Make("en-GB"), Make("en-US"), Make("pt-PT")}
- fbases := func() []Base { return bases }
- fscripts := func() []Script { return scripts }
- fregions := func() []Region { return regions }
- ftags := func() []Tag { return tags }
-
- tests := []struct {
- desc string
- list []interface{}
- bases []Base
- scripts []Script
- regions []Region
- tags []Tag
- }{
- {
- desc: "empty",
- },
- {
- desc: "bases",
- list: []interface{}{bases},
- bases: bases,
- },
- {
- desc: "scripts",
- list: []interface{}{scripts},
- scripts: scripts,
- },
- {
- desc: "regions",
- list: []interface{}{regions},
- regions: regions,
- },
- {
- desc: "bases derives from tags",
- list: []interface{}{tags},
- bases: []Base{Base{_en}, Base{_pt}},
- tags: tags,
- },
- {
- desc: "tags and bases",
- list: []interface{}{tags, bases},
- bases: bases,
- tags: tags,
- },
- {
- desc: "fully specified",
- list: []interface{}{tags, bases, scripts, regions},
- bases: bases,
- scripts: scripts,
- regions: regions,
- tags: tags,
- },
- {
- desc: "bases func",
- list: []interface{}{fbases},
- bases: bases,
- },
- {
- desc: "scripts func",
- list: []interface{}{fscripts},
- scripts: scripts,
- },
- {
- desc: "regions func",
- list: []interface{}{fregions},
- regions: regions,
- },
- {
- desc: "tags func",
- list: []interface{}{ftags},
- bases: []Base{Base{_en}, Base{_pt}},
- tags: tags,
- },
- {
- desc: "tags and bases",
- list: []interface{}{ftags, fbases},
- bases: bases,
- tags: tags,
- },
- {
- desc: "fully specified",
- list: []interface{}{ftags, fbases, fscripts, fregions},
- bases: bases,
- scripts: scripts,
- regions: regions,
- tags: tags,
- },
- }
-
- for i, tt := range tests {
- l := NewCoverage(tt.list...)
- if a := l.BaseLanguages(); !reflect.DeepEqual(a, tt.bases) {
- t.Errorf("%d:%s: BaseLanguages was %v; want %v", i, tt.desc, a, tt.bases)
- }
- if a := l.Scripts(); !reflect.DeepEqual(a, tt.scripts) {
- t.Errorf("%d:%s: Scripts was %v; want %v", i, tt.desc, a, tt.scripts)
- }
- if a := l.Regions(); !reflect.DeepEqual(a, tt.regions) {
- t.Errorf("%d:%s: Regions was %v; want %v", i, tt.desc, a, tt.regions)
- }
- if a := l.Tags(); !reflect.DeepEqual(a, tt.tags) {
- t.Errorf("%d:%s: Tags was %v; want %v", i, tt.desc, a, tt.tags)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/dict_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/dict_test.go
deleted file mode 100644
index 17b138980a3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/dict_test.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package display
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-func TestLinking(t *testing.T) {
- base := getSize(t, `display.Tags(language.English).Name(language.English)`)
- compact := getSize(t, `display.English.Languages().Name(language.English)`)
-
- if d := base - compact; d < 1.5*1024*1024 {
- t.Errorf("size(base) - size(compact) = %d - %d = was %d; want > 1.5MB", base, compact, d)
- }
-}
-
-func getSize(t *testing.T, main string) int {
- size, err := testtext.CodeSize(fmt.Sprintf(body, main))
- if err != nil {
- t.Skipf("skipping link size test; binary size could not be determined: %v", err)
- }
- return size
-}
-
-const body = `package main
-import (
- "golang.org/x/text/language"
- "golang.org/x/text/language/display"
-)
-func main() {
- %s
-}
-`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/display_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/display_test.go
deleted file mode 100644
index 4f5b48e0011..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/display_test.go
+++ /dev/null
@@ -1,714 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package display
-
-import (
- "fmt"
- "reflect"
- "strings"
- "testing"
- "unicode"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/language"
- "golang.org/x/text/message"
-)
-
-// TODO: test that tables are properly dropped by the linker for various use
-// cases.
-
-var (
- firstLang2aa = language.MustParseBase("aa")
- lastLang2zu = language.MustParseBase("zu")
- firstLang3ace = language.MustParseBase("ace")
- lastLang3zza = language.MustParseBase("zza")
- firstTagAr001 = language.MustParse("ar-001")
- lastTagZhHant = language.MustParse("zh-Hant")
-)
-
-// TestValues tests that for all languages, regions, and scripts in Values, at
-// least one language has a name defined for it by checking it exists in
-// English, which is assumed to be the most comprehensive. It is also tested
-// that a Namer returns "" for unsupported values.
-func TestValues(t *testing.T) {
- type testcase struct {
- kind string
- n Namer
- }
- // checkDefined checks that a value exists in a Namer.
- checkDefined := func(x interface{}, namers []testcase) {
- for _, n := range namers {
- testtext.Run(t, fmt.Sprintf("%s.Name(%s)", n.kind, x), func(t *testing.T) {
- if n.n.Name(x) == "" {
- // As of version 28 there is no data for az-Arab in English,
- // although there is useful data in other languages.
- if x.(fmt.Stringer).String() == "az-Arab" {
- return
- }
- t.Errorf("supported but no result")
- }
- })
- }
- }
- // checkUnsupported checks that a value does not exist in a Namer.
- checkUnsupported := func(x interface{}, namers []testcase) {
- for _, n := range namers {
- if got := n.n.Name(x); got != "" {
- t.Fatalf("%s.Name(%s): unsupported tag gave non-empty result: %q", n.kind, x, got)
- }
- }
- }
-
- tags := map[language.Tag]bool{}
- namers := []testcase{
- {"Languages(en)", Languages(language.English)},
- {"Tags(en)", Tags(language.English)},
- {"English.Languages()", English.Languages()},
- {"English.Tags()", English.Tags()},
- }
- for _, tag := range Values.Tags() {
- checkDefined(tag, namers)
- tags[tag] = true
- }
- for _, base := range language.Supported.BaseLanguages() {
- tag, _ := language.All.Compose(base)
- if !tags[tag] {
- checkUnsupported(tag, namers)
- }
- }
-
- regions := map[language.Region]bool{}
- namers = []testcase{
- {"Regions(en)", Regions(language.English)},
- {"English.Regions()", English.Regions()},
- }
- for _, r := range Values.Regions() {
- checkDefined(r, namers)
- regions[r] = true
- }
- for _, r := range language.Supported.Regions() {
- if r = r.Canonicalize(); !regions[r] {
- checkUnsupported(r, namers)
- }
- }
-
- scripts := map[language.Script]bool{}
- namers = []testcase{
- {"Scripts(en)", Scripts(language.English)},
- {"English.Scripts()", English.Scripts()},
- }
- for _, s := range Values.Scripts() {
- checkDefined(s, namers)
- scripts[s] = true
- }
- for _, s := range language.Supported.Scripts() {
- // Canonicalize the script.
- tag, _ := language.DeprecatedScript.Compose(s)
- if _, s, _ = tag.Raw(); !scripts[s] {
- checkUnsupported(s, namers)
- }
- }
-}
-
-// TestSupported tests that we have at least some Namers for languages that we
-// claim to support. To test the claims in the documentation, it also verifies
-// that if a Namer is returned, it will have at least some data.
-func TestSupported(t *testing.T) {
- supportedTags := Supported.Tags()
- if len(supportedTags) != numSupported {
- t.Errorf("number of supported was %d; want %d", len(supportedTags), numSupported)
- }
-
- namerFuncs := []struct {
- kind string
- fn func(language.Tag) Namer
- }{
- {"Tags", Tags},
- {"Languages", Languages},
- {"Regions", Regions},
- {"Scripts", Scripts},
- }
-
- // Verify that we have at least one Namer for all tags we claim to support.
- tags := make(map[language.Tag]bool)
- for _, tag := range supportedTags {
- // Test we have at least one Namer for this supported Tag.
- found := false
- for _, kind := range namerFuncs {
- if defined(t, kind.kind, kind.fn(tag), tag) {
- found = true
- }
- }
- if !found {
- t.Errorf("%s: supported, but no data available", tag)
- }
- if tags[tag] {
- t.Errorf("%s: included in Supported.Tags more than once", tag)
- }
- tags[tag] = true
- }
-
- // Verify that we have no Namers for tags we don't claim to support.
- for _, base := range language.Supported.BaseLanguages() {
- tag, _ := language.All.Compose(base)
- // Skip tags that are supported after matching.
- if _, _, conf := matcher.Match(tag); conf != language.No {
- continue
- }
- // Test there are no Namers for this tag.
- for _, kind := range namerFuncs {
- if defined(t, kind.kind, kind.fn(tag), tag) {
- t.Errorf("%[1]s(%[2]s) returns a Namer, but %[2]s is not in the set of supported Tags.", kind.kind, tag)
- }
- }
- }
-}
-
-// defined reports whether n is a proper Namer, which means it is non-nil and
-// must have at least one non-empty value.
-func defined(t *testing.T, kind string, n Namer, tag language.Tag) bool {
- if n == nil {
- return false
- }
- switch kind {
- case "Tags":
- for _, t := range Values.Tags() {
- if n.Name(t) != "" {
- return true
- }
- }
- case "Languages":
- for _, t := range Values.BaseLanguages() {
- if n.Name(t) != "" {
- return true
- }
- }
- case "Regions":
- for _, t := range Values.Regions() {
- if n.Name(t) != "" {
- return true
- }
- }
- case "Scripts":
- for _, t := range Values.Scripts() {
- if n.Name(t) != "" {
- return true
- }
- }
- }
- t.Errorf("%s(%s) returns non-nil Namer without content", kind, tag)
- return false
-}
-
-func TestCoverage(t *testing.T) {
- en := language.English
- tests := []struct {
- n Namer
- x interface{}
- }{
- {Languages(en), Values.Tags()},
- {Scripts(en), Values.Scripts()},
- {Regions(en), Values.Regions()},
- }
- for i, tt := range tests {
- uniq := make(map[string]interface{})
-
- v := reflect.ValueOf(tt.x)
- for j := 0; j < v.Len(); j++ {
- x := v.Index(j).Interface()
- // As of version 28 there is no data for az-Arab in English,
- // although there is useful data in other languages.
- if x.(fmt.Stringer).String() == "az-Arab" {
- continue
- }
- s := tt.n.Name(x)
- if s == "" {
- t.Errorf("%d:%d:%s: missing content", i, j, x)
- } else if uniq[s] != nil {
- t.Errorf("%d:%d:%s: identical return value %q for %v and %v", i, j, x, s, x, uniq[s])
- }
- uniq[s] = x
- }
- }
-}
-
-// TestUpdate tests whether dictionary entries for certain languages need to be
-// updated. For some languages, some of the headers may be empty or they may be
-// identical to the parent. This code detects if such entries need to be updated
-// after a table update.
-func TestUpdate(t *testing.T) {
- tests := []struct {
- d *Dictionary
- tag string
- }{
- {ModernStandardArabic, "ar-001"},
- {AmericanEnglish, "en-US"},
- {EuropeanSpanish, "es-ES"},
- {BrazilianPortuguese, "pt-BR"},
- {SimplifiedChinese, "zh-Hans"},
- }
-
- for _, tt := range tests {
- _, i, _ := matcher.Match(language.MustParse(tt.tag))
- if !reflect.DeepEqual(tt.d.lang, langHeaders[i]) {
- t.Errorf("%s: lang table update needed", tt.tag)
- }
- if !reflect.DeepEqual(tt.d.script, scriptHeaders[i]) {
- t.Errorf("%s: script table update needed", tt.tag)
- }
- if !reflect.DeepEqual(tt.d.region, regionHeaders[i]) {
- t.Errorf("%s: region table update needed", tt.tag)
- }
- }
-}
-
-func TestIndex(t *testing.T) {
- notIn := []string{"aa", "xx", "zz", "aaa", "xxx", "zzz", "Aaaa", "Xxxx", "Zzzz"}
- tests := []tagIndex{
- {
- "",
- "",
- "",
- },
- {
- "bb",
- "",
- "",
- },
- {
- "",
- "bbb",
- "",
- },
- {
- "",
- "",
- "Bbbb",
- },
- {
- "bb",
- "bbb",
- "Bbbb",
- },
- {
- "bbccddyy",
- "bbbcccdddyyy",
- "BbbbCcccDdddYyyy",
- },
- }
- for i, tt := range tests {
- // Create the test set from the tagIndex.
- cnt := 0
- for sz := 2; sz <= 4; sz++ {
- a := tt[sz-2]
- for j := 0; j < len(a); j += sz {
- s := a[j : j+sz]
- if idx := tt.index(s); idx != cnt {
- t.Errorf("%d:%s: index was %d; want %d", i, s, idx, cnt)
- }
- cnt++
- }
- }
- if n := tt.len(); n != cnt {
- t.Errorf("%d: len was %d; want %d", i, n, cnt)
- }
- for _, x := range notIn {
- if idx := tt.index(x); idx != -1 {
- t.Errorf("%d:%s: index was %d; want -1", i, x, idx)
- }
- }
- }
-}
-
-func TestTag(t *testing.T) {
- tests := []struct {
- dict string
- tag string
- name string
- }{
- // sr is in Value.Languages(), but is not supported by agq.
- {"agq", "sr", "|[language: sr]"},
- {"nl", "nl", "Nederlands"},
- // CLDR 30 dropped Vlaams as the word for nl-BE. It is still called
- // Flemish in English, though. TODO: check if this is a CLDR bug.
- // {"nl", "nl-BE", "Vlaams"},
- {"nl", "nl-BE", "Nederlands (België)"},
- {"nl", "vls", "West-Vlaams"},
- {"en", "nl-BE", "Flemish"},
- {"en", "en", "English"},
- {"en", "en-GB", "British English"},
- {"en", "en-US", "American English"}, // American English in CLDR 24+
- {"ru", "ru", "русский"},
- {"ru", "ru-RU", "русский (Россия)"},
- {"ru", "ru-Cyrl", "русский (кириллица)"},
- {"en", lastLang2zu.String(), "Zulu"},
- {"en", firstLang2aa.String(), "Afar"},
- {"en", lastLang3zza.String(), "Zaza"},
- {"en", firstLang3ace.String(), "Achinese"},
- {"en", firstTagAr001.String(), "Modern Standard Arabic"},
- {"en", lastTagZhHant.String(), "Traditional Chinese"},
- {"en", "aaa", "|Unknown language (aaa)"},
- {"en", "zzj", "|Unknown language (zzj)"},
- // If full tag doesn't match, try without script or region.
- {"en", "aa-Hans", "Afar (Simplified Han)"},
- {"en", "af-Arab", "Afrikaans (Arabic)"},
- {"en", "zu-Cyrl", "Zulu (Cyrillic)"},
- {"en", "aa-GB", "Afar (United Kingdom)"},
- {"en", "af-NA", "Afrikaans (Namibia)"},
- {"en", "zu-BR", "Zulu (Brazil)"},
- // Correct inheritance and language selection.
- {"zh", "zh-TW", "中文 (台湾)"},
- {"zh", "zh-Hant-TW", "繁体中文 (台湾)"},
- {"zh-Hant", "zh-TW", "中文 (台灣)"},
- {"zh-Hant", "zh-Hant-TW", "繁體中文 (台灣)"},
- // Some rather arbitrary interpretations for Serbian. This is arguably
- // correct and consistent with the way zh-[Hant-]TW is handled. It will
- // also give results more in line with the expectations if users
- // explicitly use "sh".
- {"sr-Latn", "sr-ME", "srpski (Crna Gora)"},
- {"sr-Latn", "sr-Latn-ME", "srpskohrvatski (Crna Gora)"},
- // Double script and region
- {"nl", "en-Cyrl-BE", "Engels (Cyrillisch, België)"},
- }
- for _, tt := range tests {
- t.Run(tt.dict+"/"+tt.tag, func(t *testing.T) {
- name, fmtName := splitName(tt.name)
- dict := language.MustParse(tt.dict)
- tag := language.Raw.MustParse(tt.tag)
- d := Tags(dict)
- if n := d.Name(tag); n != name {
- // There are inconsistencies w.r.t. capitalization in the tests
- // due to CLDR's update procedure which treats modern and other
- // languages differently.
- // See http://unicode.org/cldr/trac/ticket/8051.
- // TODO: use language capitalization to sanitize the strings.
- t.Errorf("Name(%s) = %q; want %q", tag, n, name)
- }
-
- p := message.NewPrinter(dict)
- if n := p.Sprint(Tag(tag)); n != fmtName {
- t.Errorf("Tag(%s) = %q; want %q", tag, n, fmtName)
- }
- })
- }
-}
-
-func splitName(names string) (name, formatName string) {
- split := strings.Split(names, "|")
- name, formatName = split[0], split[0]
- if len(split) > 1 {
- formatName = split[1]
- }
- return name, formatName
-}
-
-func TestLanguage(t *testing.T) {
- tests := []struct {
- dict string
- tag string
- name string
- }{
- // sr is in Value.Languages(), but is not supported by agq.
- {"agq", "sr", "|[language: sr]"},
- // CLDR 30 dropped Vlaams as the word for nl-BE. It is still called
- // Flemish in English, though. TODO: this is probably incorrect.
- // West-Vlaams (vls) is not Vlaams. West-Vlaams could be considered its
- // own language, whereas Vlaams is generally Dutch. So expect to have
- // to change these tests back.
- {"nl", "nl", "Nederlands"},
- {"nl", "vls", "West-Vlaams"},
- {"nl", "nl-BE", "Nederlands"},
- {"en", "pt", "Portuguese"},
- {"en", "pt-PT", "European Portuguese"},
- {"en", "pt-BR", "Brazilian Portuguese"},
- {"en", "en", "English"},
- {"en", "en-GB", "British English"},
- {"en", "en-US", "American English"}, // American English in CLDR 24+
- {"en", lastLang2zu.String(), "Zulu"},
- {"en", firstLang2aa.String(), "Afar"},
- {"en", lastLang3zza.String(), "Zaza"},
- {"en", firstLang3ace.String(), "Achinese"},
- {"en", firstTagAr001.String(), "Modern Standard Arabic"},
- {"en", lastTagZhHant.String(), "Traditional Chinese"},
- {"en", "aaa", "|Unknown language (aaa)"},
- {"en", "zzj", "|Unknown language (zzj)"},
- // If full tag doesn't match, try without script or region.
- {"en", "aa-Hans", "Afar"},
- {"en", "af-Arab", "Afrikaans"},
- {"en", "zu-Cyrl", "Zulu"},
- {"en", "aa-GB", "Afar"},
- {"en", "af-NA", "Afrikaans"},
- {"en", "zu-BR", "Zulu"},
- {"agq", "zh-Hant", "|[language: zh-Hant]"},
- {"en", "sh", "Serbo-Croatian"},
- {"en", "sr-Latn", "Serbo-Croatian"},
- {"en", "sr", "Serbian"},
- {"en", "sr-ME", "Serbian"},
- {"en", "sr-Latn-ME", "Serbo-Croatian"}, // See comments in TestTag.
- }
- for _, tt := range tests {
- testtext.Run(t, tt.dict+"/"+tt.tag, func(t *testing.T) {
- name, fmtName := splitName(tt.name)
- dict := language.MustParse(tt.dict)
- tag := language.Raw.MustParse(tt.tag)
- p := message.NewPrinter(dict)
- d := Languages(dict)
- if n := d.Name(tag); n != name {
- t.Errorf("Name(%v) = %q; want %q", tag, n, name)
- }
- if n := p.Sprint(Language(tag)); n != fmtName {
- t.Errorf("Language(%v) = %q; want %q", tag, n, fmtName)
- }
- if len(tt.tag) <= 3 {
- base := language.MustParseBase(tt.tag)
- if n := d.Name(base); n != name {
- t.Errorf("Name(%v) = %q; want %q", base, n, name)
- }
- if n := p.Sprint(Language(base)); n != fmtName {
- t.Errorf("Language(%v) = %q; want %q", base, n, fmtName)
- }
- }
- })
- }
-}
-
-func TestScript(t *testing.T) {
- tests := []struct {
- dict string
- scr string
- name string
- }{
- {"nl", "Arab", "Arabisch"},
- {"en", "Arab", "Arabic"},
- {"en", "Zzzz", "Unknown Script"},
- {"zh-Hant", "Hang", "韓文字"},
- {"zh-Hant-HK", "Hang", "韓文字"},
- {"zh", "Arab", "阿拉伯文"},
- {"zh-Hans-HK", "Arab", "阿拉伯文"}, // same as zh
- {"zh-Hant", "Arab", "阿拉伯文"},
- {"zh-Hant-HK", "Arab", "阿拉伯文"}, // same as zh
- // Canonicalized form
- {"en", "Qaai", "Inherited"}, // deprecated script, now is Zinh
- {"en", "sh", "Unknown Script"}, // sh canonicalizes to sr-Latn
- {"en", "en", "Unknown Script"},
- // Don't introduce scripts with canonicalization.
- {"en", "sh", "Unknown Script"}, // sh canonicalizes to sr-Latn
- }
- for _, tt := range tests {
- t.Run(tt.dict+"/"+tt.scr, func(t *testing.T) {
- name, fmtName := splitName(tt.name)
- dict := language.MustParse(tt.dict)
- p := message.NewPrinter(dict)
- d := Scripts(dict)
- var tag language.Tag
- if unicode.IsUpper(rune(tt.scr[0])) {
- x := language.MustParseScript(tt.scr)
- if n := d.Name(x); n != name {
- t.Errorf("Name(%v) = %q; want %q", x, n, name)
- }
- if n := p.Sprint(Script(x)); n != fmtName {
- t.Errorf("Script(%v) = %q; want %q", x, n, fmtName)
- }
- tag, _ = language.Raw.Compose(x)
- } else {
- tag = language.Raw.MustParse(tt.scr)
- }
- if n := d.Name(tag); n != name {
- t.Errorf("Name(%v) = %q; want %q", tag, n, name)
- }
- if n := p.Sprint(Script(tag)); n != fmtName {
- t.Errorf("Script(%v) = %q; want %q", tag, n, fmtName)
- }
- })
- }
-}
-
-func TestRegion(t *testing.T) {
- tests := []struct {
- dict string
- reg string
- name string
- }{
- {"nl", "NL", "Nederland"},
- {"en", "US", "United States"},
- {"en", "ZZ", "Unknown Region"},
- {"en-GB", "NL", "Netherlands"},
- // Canonical equivalents
- {"en", "UK", "United Kingdom"},
- // No region
- {"en", "pt", "Unknown Region"},
- {"en", "und", "Unknown Region"},
- // Don't introduce regions with canonicalization.
- {"en", "mo", "Unknown Region"},
- }
- for _, tt := range tests {
- t.Run(tt.dict+"/"+tt.reg, func(t *testing.T) {
- dict := language.MustParse(tt.dict)
- p := message.NewPrinter(dict)
- d := Regions(dict)
- var tag language.Tag
- if unicode.IsUpper(rune(tt.reg[0])) {
- // Region
- x := language.MustParseRegion(tt.reg)
- if n := d.Name(x); n != tt.name {
- t.Errorf("Name(%v) = %q; want %q", x, n, tt.name)
- }
- if n := p.Sprint(Region(x)); n != tt.name {
- t.Errorf("Region(%v) = %q; want %q", x, n, tt.name)
- }
- tag, _ = language.Raw.Compose(x)
- } else {
- tag = language.Raw.MustParse(tt.reg)
- }
- if n := d.Name(tag); n != tt.name {
- t.Errorf("Name(%v) = %q; want %q", tag, n, tt.name)
- }
- if n := p.Sprint(Region(tag)); n != tt.name {
- t.Errorf("Region(%v) = %q; want %q", tag, n, tt.name)
- }
- })
- }
-}
-
-func TestSelf(t *testing.T) {
- tests := []struct {
- tag string
- name string
- }{
- {"nl", "Nederlands"},
- // CLDR 30 dropped Vlaams as the word for nl-BE. It is still called
- // Flemish in English, though. TODO: check if this is a CLDR bug.
- // {"nl-BE", "Vlaams"},
- {"nl-BE", "Nederlands"},
- {"en-GB", "British English"},
- {lastLang2zu.String(), "isiZulu"},
- {firstLang2aa.String(), ""}, // not defined
- {lastLang3zza.String(), ""}, // not defined
- {firstLang3ace.String(), ""}, // not defined
- {firstTagAr001.String(), "العربية الرسمية الحديثة"},
- {"ar", "العربية"},
- {lastTagZhHant.String(), "繁體中文"},
- {"aaa", ""},
- {"zzj", ""},
- // Drop entries that are not in the requested script, even if there is
- // an entry for the language.
- {"aa-Hans", ""},
- {"af-Arab", ""},
- {"zu-Cyrl", ""},
- // Append the country name in the language of the matching language.
- {"af-NA", "Afrikaans"},
- {"zh", "中文"},
- // zh-TW should match zh-Hant instead of zh!
- {"zh-TW", "繁體中文"},
- {"zh-Hant", "繁體中文"},
- {"zh-Hans", "简体中文"},
- {"zh-Hant-TW", "繁體中文"},
- {"zh-Hans-TW", "简体中文"},
- // Take the entry for sr which has the matching script.
- // TODO: Capitalization changed as of CLDR 26, but change seems
- // arbitrary. Revisit capitalization with revision 27. See
- // http://unicode.org/cldr/trac/ticket/8051.
- {"sr", "српски"},
- // TODO: sr-ME should show up as Serbian or Montenegrin, not Serbo-
- // Croatian. This is an artifact of the current algorithm, which is the
- // way it is to have the preferred behavior for other languages such as
- // Chinese. We can hardwire this case in the table generator or package
- // code, but we first check if CLDR can be updated.
- // {"sr-ME", "Srpski"}, // Is Srpskohrvatski
- {"sr-Latn-ME", "srpskohrvatski"},
- {"sr-Cyrl-ME", "српски"},
- {"sr-NL", "српски"},
- // NOTE: kk is defined, but in Cyrillic script. For China, Arab is the
- // dominant script. We do not have data for kk-Arab and we chose to not
- // fall back in such cases.
- {"kk-CN", ""},
- }
- for i, tt := range tests {
- d := Self
- if n := d.Name(language.Raw.MustParse(tt.tag)); n != tt.name {
- t.Errorf("%d:%s: was %q; want %q", i, tt.tag, n, tt.name)
- }
- }
-}
-
-func TestEquivalence(t *testing.T) {
- testCases := []struct {
- desc string
- namer Namer
- }{
- {"Self", Self},
- {"Tags", Tags(language.Romanian)},
- {"Languages", Languages(language.Romanian)},
- {"Scripts", Scripts(language.Romanian)},
- }
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- ro := tc.namer.Name(language.Raw.MustParse("ro-MD"))
- mo := tc.namer.Name(language.Raw.MustParse("mo"))
- if ro != mo {
- t.Errorf("%q != %q", ro, mo)
- }
- })
- }
-}
-
-func TestDictionaryLang(t *testing.T) {
- tests := []struct {
- d *Dictionary
- tag string
- name string
- }{
- {English, "en", "English"},
- {Portuguese, "af", "africâner"},
- {EuropeanPortuguese, "af", "africanês"},
- {English, "nl-BE", "Flemish"},
- }
- for i, test := range tests {
- tag := language.MustParse(test.tag)
- if got := test.d.Tags().Name(tag); got != test.name {
- t.Errorf("%d:%v: got %s; want %s", i, tag, got, test.name)
- }
- if base, _ := language.Compose(tag.Base()); base == tag {
- if got := test.d.Languages().Name(base); got != test.name {
- t.Errorf("%d:%v: got %s; want %s", i, tag, got, test.name)
- }
- }
- }
-}
-
-func TestDictionaryRegion(t *testing.T) {
- tests := []struct {
- d *Dictionary
- region string
- name string
- }{
- {English, "FR", "France"},
- {Portuguese, "009", "Oceania"},
- {EuropeanPortuguese, "009", "Oceânia"},
- }
- for i, test := range tests {
- tag := language.MustParseRegion(test.region)
- if got := test.d.Regions().Name(tag); got != test.name {
- t.Errorf("%d:%v: got %s; want %s", i, tag, got, test.name)
- }
- }
-}
-
-func TestDictionaryScript(t *testing.T) {
- tests := []struct {
- d *Dictionary
- script string
- name string
- }{
- {English, "Cyrl", "Cyrillic"},
- {EuropeanPortuguese, "Gujr", "guzerate"},
- }
- for i, test := range tests {
- tag := language.MustParseScript(test.script)
- if got := test.d.Scripts().Name(tag); got != test.name {
- t.Errorf("%d:%v: got %s; want %s", i, tag, got, test.name)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/examples_test.go
deleted file mode 100644
index 15d75843499..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/display/examples_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package display_test
-
-import (
- "fmt"
-
- "golang.org/x/text/language"
- "golang.org/x/text/language/display"
- "golang.org/x/text/message"
-)
-
-func ExampleFormatter() {
- message.SetString(language.Dutch, "In %v people speak %v.", "In %v spreekt men %v.")
-
- fr := language.French
- region, _ := fr.Region()
- for _, tag := range []string{"en", "nl"} {
- p := message.NewPrinter(language.Make(tag))
-
- p.Printf("In %v people speak %v.", display.Region(region), display.Language(fr))
- p.Println()
- }
-
- // Output:
- // In France people speak French.
- // In Frankrijk spreekt men Frans.
-}
-
-func ExampleNamer() {
- supported := []string{
- "en-US", "en-GB", "ja", "zh", "zh-Hans", "zh-Hant", "pt", "pt-PT", "ko", "ar", "el", "ru", "uk", "pa",
- }
-
- en := display.English.Languages()
-
- for _, s := range supported {
- t := language.MustParse(s)
- fmt.Printf("%-20s (%s)\n", en.Name(t), display.Self.Name(t))
- }
-
- // Output:
- // American English (American English)
- // British English (British English)
- // Japanese (日本語)
- // Chinese (中文)
- // Simplified Chinese (简体中文)
- // Traditional Chinese (繁體中文)
- // Portuguese (português)
- // European Portuguese (português europeu)
- // Korean (한국어)
- // Arabic (العربية)
- // Greek (Ελληνικά)
- // Russian (русский)
- // Ukrainian (українська)
- // Punjabi (ਪੰਜਾਬੀ)
-}
-
-func ExampleTags() {
- n := display.Tags(language.English)
- fmt.Println(n.Name(language.Make("nl")))
- fmt.Println(n.Name(language.Make("nl-BE")))
- fmt.Println(n.Name(language.Make("nl-CW")))
- fmt.Println(n.Name(language.Make("nl-Arab")))
- fmt.Println(n.Name(language.Make("nl-Cyrl-RU")))
-
- // Output:
- // Dutch
- // Flemish
- // Dutch (Curaçao)
- // Dutch (Arabic)
- // Dutch (Cyrillic, Russia)
-}
-
-// ExampleDictionary shows how to reduce the amount of data linked into your
-// binary by only using the predefined Dictionary variables of the languages you
-// wish to support.
-func ExampleDictionary() {
- tags := []language.Tag{
- language.English,
- language.German,
- language.Japanese,
- language.Russian,
- }
- dicts := []*display.Dictionary{
- display.English,
- display.German,
- display.Japanese,
- display.Russian,
- }
-
- m := language.NewMatcher(tags)
-
- getDict := func(t language.Tag) *display.Dictionary {
- _, i, confidence := m.Match(t)
- // Skip this check if you want to support a fall-back language, which
- // will be the first one passed to NewMatcher.
- if confidence == language.No {
- return nil
- }
- return dicts[i]
- }
-
- // The matcher will match Swiss German to German.
- n := getDict(language.Make("gsw")).Languages()
- fmt.Println(n.Name(language.German))
- fmt.Println(n.Name(language.Make("de-CH")))
- fmt.Println(n.Name(language.Make("gsw")))
-
- // Output:
- // Deutsch
- // Schweizer Hochdeutsch
- // Schweizerdeutsch
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/examples_test.go
deleted file mode 100644
index d5e8176dce3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/examples_test.go
+++ /dev/null
@@ -1,413 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language_test
-
-import (
- "fmt"
- "net/http"
-
- "golang.org/x/text/language"
-)
-
-func ExampleCanonType() {
- p := func(id string) {
- fmt.Printf("Default(%s) -> %s\n", id, language.Make(id))
- fmt.Printf("BCP47(%s) -> %s\n", id, language.BCP47.Make(id))
- fmt.Printf("Macro(%s) -> %s\n", id, language.Macro.Make(id))
- fmt.Printf("All(%s) -> %s\n", id, language.All.Make(id))
- }
- p("en-Latn")
- p("sh")
- p("zh-cmn")
- p("bjd")
- p("iw-Latn-fonipa-u-cu-usd")
- // Output:
- // Default(en-Latn) -> en-Latn
- // BCP47(en-Latn) -> en
- // Macro(en-Latn) -> en-Latn
- // All(en-Latn) -> en
- // Default(sh) -> sr-Latn
- // BCP47(sh) -> sh
- // Macro(sh) -> sh
- // All(sh) -> sr-Latn
- // Default(zh-cmn) -> cmn
- // BCP47(zh-cmn) -> cmn
- // Macro(zh-cmn) -> zh
- // All(zh-cmn) -> zh
- // Default(bjd) -> drl
- // BCP47(bjd) -> drl
- // Macro(bjd) -> bjd
- // All(bjd) -> drl
- // Default(iw-Latn-fonipa-u-cu-usd) -> he-Latn-fonipa-u-cu-usd
- // BCP47(iw-Latn-fonipa-u-cu-usd) -> he-Latn-fonipa-u-cu-usd
- // Macro(iw-Latn-fonipa-u-cu-usd) -> iw-Latn-fonipa-u-cu-usd
- // All(iw-Latn-fonipa-u-cu-usd) -> he-Latn-fonipa-u-cu-usd
-}
-
-func ExampleTag_Base() {
- fmt.Println(language.Make("und").Base())
- fmt.Println(language.Make("und-US").Base())
- fmt.Println(language.Make("und-NL").Base())
- fmt.Println(language.Make("und-419").Base()) // Latin America
- fmt.Println(language.Make("und-ZZ").Base())
- // Output:
- // en Low
- // en High
- // nl High
- // es Low
- // en Low
-}
-
-func ExampleTag_Script() {
- en := language.Make("en")
- sr := language.Make("sr")
- sr_Latn := language.Make("sr_Latn")
- fmt.Println(en.Script())
- fmt.Println(sr.Script())
- // Was a script explicitly specified?
- _, c := sr.Script()
- fmt.Println(c == language.Exact)
- _, c = sr_Latn.Script()
- fmt.Println(c == language.Exact)
- // Output:
- // Latn High
- // Cyrl Low
- // false
- // true
-}
-
-func ExampleTag_Region() {
- ru := language.Make("ru")
- en := language.Make("en")
- fmt.Println(ru.Region())
- fmt.Println(en.Region())
- // Output:
- // RU Low
- // US Low
-}
-
-func ExampleRegion_TLD() {
- us := language.MustParseRegion("US")
- gb := language.MustParseRegion("GB")
- uk := language.MustParseRegion("UK")
- bu := language.MustParseRegion("BU")
-
- fmt.Println(us.TLD())
- fmt.Println(gb.TLD())
- fmt.Println(uk.TLD())
- fmt.Println(bu.TLD())
-
- fmt.Println(us.Canonicalize().TLD())
- fmt.Println(gb.Canonicalize().TLD())
- fmt.Println(uk.Canonicalize().TLD())
- fmt.Println(bu.Canonicalize().TLD())
- // Output:
- // US <nil>
- // UK <nil>
- // UK <nil>
- // ZZ language: region is not a valid ccTLD
- // US <nil>
- // UK <nil>
- // UK <nil>
- // MM <nil>
-}
-
-func ExampleCompose() {
- nl, _ := language.ParseBase("nl")
- us, _ := language.ParseRegion("US")
- de := language.Make("de-1901-u-co-phonebk")
- jp := language.Make("ja-JP")
- fi := language.Make("fi-x-ing")
-
- u, _ := language.ParseExtension("u-nu-arabic")
- x, _ := language.ParseExtension("x-piglatin")
-
- // Combine a base language and region.
- fmt.Println(language.Compose(nl, us))
- // Combine a base language and extension.
- fmt.Println(language.Compose(nl, x))
- // Replace the region.
- fmt.Println(language.Compose(jp, us))
- // Combine several tags.
- fmt.Println(language.Compose(us, nl, u))
-
- // Replace the base language of a tag.
- fmt.Println(language.Compose(de, nl))
- fmt.Println(language.Compose(de, nl, u))
- // Remove the base language.
- fmt.Println(language.Compose(de, language.Base{}))
- // Remove all variants.
- fmt.Println(language.Compose(de, []language.Variant{}))
- // Remove all extensions.
- fmt.Println(language.Compose(de, []language.Extension{}))
- fmt.Println(language.Compose(fi, []language.Extension{}))
- // Remove all variants and extensions.
- fmt.Println(language.Compose(de.Raw()))
-
- // An error is gobbled or returned if non-nil.
- fmt.Println(language.Compose(language.ParseRegion("ZA")))
- fmt.Println(language.Compose(language.ParseRegion("HH")))
-
- // Compose uses the same Default canonicalization as Make.
- fmt.Println(language.Compose(language.Raw.Parse("en-Latn-UK")))
-
- // Call compose on a different CanonType for different results.
- fmt.Println(language.All.Compose(language.Raw.Parse("en-Latn-UK")))
-
- // Output:
- // nl-US <nil>
- // nl-x-piglatin <nil>
- // ja-US <nil>
- // nl-US-u-nu-arabic <nil>
- // nl-1901-u-co-phonebk <nil>
- // nl-1901-u-nu-arabic <nil>
- // und-1901-u-co-phonebk <nil>
- // de-u-co-phonebk <nil>
- // de-1901 <nil>
- // fi <nil>
- // de <nil>
- // und-ZA <nil>
- // und language: subtag "HH" is well-formed but unknown
- // en-Latn-GB <nil>
- // en-GB <nil>
-}
-
-func ExampleParse_errors() {
- for _, s := range []string{"Foo", "Bar", "Foobar"} {
- _, err := language.Parse(s)
- if err != nil {
- if inv, ok := err.(language.ValueError); ok {
- fmt.Println(inv.Subtag())
- } else {
- fmt.Println(s)
- }
- }
- }
- for _, s := range []string{"en", "aa-Uuuu", "AC", "ac-u"} {
- _, err := language.Parse(s)
- switch e := err.(type) {
- case language.ValueError:
- fmt.Printf("%s: culprit %q\n", s, e.Subtag())
- case nil:
- // No error.
- default:
- // A syntax error.
- fmt.Printf("%s: ill-formed\n", s)
- }
- }
- // Output:
- // foo
- // Foobar
- // aa-Uuuu: culprit "Uuuu"
- // AC: culprit "ac"
- // ac-u: ill-formed
-}
-
-func ExampleParent() {
- p := func(tag string) {
- fmt.Printf("parent(%v): %v\n", tag, language.Make(tag).Parent())
- }
- p("zh-CN")
-
- // Australian English inherits from World English.
- p("en-AU")
-
- // If the tag has a different maximized script from its parent, a tag with
- // this maximized script is inserted. This allows different language tags
- // which have the same base language and script in common to inherit from
- // a common set of settings.
- p("zh-HK")
-
- // If the maximized script of the parent is not identical, CLDR will skip
- // inheriting from it, as it means there will not be many entries in common
- // and inheriting from it is nonsensical.
- p("zh-Hant")
-
- // The parent of a tag with variants and extensions is the tag with all
- // variants and extensions removed.
- p("de-1994-u-co-phonebk")
-
- // Remove default script.
- p("de-Latn-LU")
-
- // Output:
- // parent(zh-CN): zh
- // parent(en-AU): en-001
- // parent(zh-HK): zh-Hant
- // parent(zh-Hant): und
- // parent(de-1994-u-co-phonebk): de
- // parent(de-Latn-LU): de
-}
-
-// ExampleMatcher_bestMatch gives some examples of getting the best match of
-// a set of tags to any of the tags of given set.
-func ExampleMatcher() {
- // This is the set of tags from which we want to pick the best match. These
- // can be, for example, the supported languages for some package.
- tags := []language.Tag{
- language.English,
- language.BritishEnglish,
- language.French,
- language.Afrikaans,
- language.BrazilianPortuguese,
- language.EuropeanPortuguese,
- language.Croatian,
- language.SimplifiedChinese,
- language.Raw.Make("iw-IL"),
- language.Raw.Make("iw"),
- language.Raw.Make("he"),
- }
- m := language.NewMatcher(tags)
-
- // A simple match.
- fmt.Println(m.Match(language.Make("fr")))
-
- // Australian English is closer to British than American English.
- fmt.Println(m.Match(language.Make("en-AU")))
-
- // Default to the first tag passed to the Matcher if there is no match.
- fmt.Println(m.Match(language.Make("ar")))
-
- // Get the default tag.
- fmt.Println(m.Match())
-
- fmt.Println("----")
-
- // Someone specifying sr-Latn is probably fine with getting Croatian.
- fmt.Println(m.Match(language.Make("sr-Latn")))
-
- // We match SimplifiedChinese, but with Low confidence.
- fmt.Println(m.Match(language.TraditionalChinese))
-
- // Serbian in Latin script is a closer match to Croatian than Traditional
- // Chinese to Simplified Chinese.
- fmt.Println(m.Match(language.TraditionalChinese, language.Make("sr-Latn")))
-
- fmt.Println("----")
-
- // In case a multiple variants of a language are available, the most spoken
- // variant is typically returned.
- fmt.Println(m.Match(language.Portuguese))
-
- // Pick the first value passed to Match in case of a tie.
- fmt.Println(m.Match(language.Dutch, language.Make("fr-BE"), language.Make("af-NA")))
- fmt.Println(m.Match(language.Dutch, language.Make("af-NA"), language.Make("fr-BE")))
-
- fmt.Println("----")
-
- // If a Matcher is initialized with a language and it's deprecated version,
- // it will distinguish between them.
- fmt.Println(m.Match(language.Raw.Make("iw")))
-
- // However, for non-exact matches, it will treat deprecated versions as
- // equivalent and consider other factors first.
- fmt.Println(m.Match(language.Raw.Make("he-IL")))
-
- fmt.Println("----")
-
- // User settings passed to the Unicode extension are ignored for matching
- // and preserved in the returned tag.
- fmt.Println(m.Match(language.Make("de-u-co-phonebk"), language.Make("fr-u-cu-frf")))
-
- // Even if the matching language is different.
- fmt.Println(m.Match(language.Make("de-u-co-phonebk"), language.Make("br-u-cu-frf")))
-
- // If there is no matching language, the options of the first preferred tag are used.
- fmt.Println(m.Match(language.Make("de-u-co-phonebk")))
-
- // Output:
- // fr 2 Exact
- // en-GB 1 High
- // en 0 No
- // en 0 No
- // ----
- // hr 6 High
- // zh-Hans 7 Low
- // hr 6 High
- // ----
- // pt-BR 4 High
- // fr 2 High
- // af 3 High
- // ----
- // iw 9 Exact
- // he 10 Exact
- // ----
- // fr-u-cu-frf 2 Exact
- // fr-u-cu-frf 2 High
- // en-u-co-phonebk 0 No
-
- // TODO: "he" should be "he-u-rg-IL High"
-}
-
-func ExampleMatchStrings() {
- // languages supported by this service:
- matcher := language.NewMatcher([]language.Tag{
- language.English, language.Dutch, language.German,
- })
-
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- lang, _ := r.Cookie("lang")
- tag, _ := language.MatchStrings(matcher, lang.String(), r.Header.Get("Accept-Language"))
-
- fmt.Println("User language:", tag)
- })
-}
-
-func ExampleComprehends() {
- // Various levels of comprehensibility.
- fmt.Println(language.Comprehends(language.English, language.English))
- fmt.Println(language.Comprehends(language.AmericanEnglish, language.BritishEnglish))
-
- // An explicit Und results in no match.
- fmt.Println(language.Comprehends(language.English, language.Und))
-
- fmt.Println("----")
-
- // There is usually no mutual comprehensibility between different scripts.
- fmt.Println(language.Comprehends(language.Make("en-Dsrt"), language.English))
-
- // One exception is for Traditional versus Simplified Chinese, albeit with
- // a low confidence.
- fmt.Println(language.Comprehends(language.TraditionalChinese, language.SimplifiedChinese))
-
- fmt.Println("----")
-
- // A Swiss German speaker will often understand High German.
- fmt.Println(language.Comprehends(language.Make("gsw"), language.Make("de")))
-
- // The converse is not generally the case.
- fmt.Println(language.Comprehends(language.Make("de"), language.Make("gsw")))
-
- // Output:
- // Exact
- // High
- // No
- // ----
- // No
- // Low
- // ----
- // High
- // No
-}
-
-func ExampleTag_values() {
- us := language.MustParseRegion("US")
- en := language.MustParseBase("en")
-
- lang, _, region := language.AmericanEnglish.Raw()
- fmt.Println(lang == en, region == us)
-
- lang, _, region = language.BritishEnglish.Raw()
- fmt.Println(lang == en, region == us)
-
- // Tags can be compared for exact equivalence using '=='.
- en_us, _ := language.Compose(en, us)
- fmt.Println(en_us == language.AmericanEnglish)
-
- // Output:
- // true true
- // true false
- // true
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/httpexample_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/httpexample_test.go
deleted file mode 100644
index 40d0663c8f4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/httpexample_test.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language_test
-
-import (
- "fmt"
- "net/http"
- "strings"
-
- "golang.org/x/text/language"
-)
-
-// matcher is a language.Matcher configured for all supported languages.
-var matcher = language.NewMatcher([]language.Tag{
- language.BritishEnglish,
- language.Norwegian,
- language.German,
-})
-
-// handler is a http.HandlerFunc.
-func handler(w http.ResponseWriter, r *http.Request) {
- t, q, err := language.ParseAcceptLanguage(r.Header.Get("Accept-Language"))
- // We ignore the error: the default language will be selected for t == nil.
- tag, _, _ := matcher.Match(t...)
- fmt.Printf("%5v (t: %6v; q: %3v; err: %v)\n", tag, t, q, err)
-}
-
-func ExampleParseAcceptLanguage() {
- for _, al := range []string{
- "nn;q=0.3, en-us;q=0.8, en,",
- "gsw, en;q=0.7, en-US;q=0.8",
- "gsw, nl, da",
- "invalid",
- } {
- // Create dummy request with Accept-Language set and pass it to handler.
- r, _ := http.NewRequest("GET", "example.com", strings.NewReader("Hello"))
- r.Header.Set("Accept-Language", al)
- handler(nil, r)
- }
-
- // Output:
- // en-GB (t: [ en en-US nn]; q: [ 1 0.8 0.3]; err: <nil>)
- // en-GB (t: [ gsw en-US en]; q: [ 1 0.8 0.7]; err: <nil>)
- // de (t: [ gsw nl da]; q: [ 1 1 1]; err: <nil>)
- // en-GB (t: []; q: []; err: language: tag is not well-formed)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/language_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/language_test.go
deleted file mode 100644
index 9e42d15dc6f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/language_test.go
+++ /dev/null
@@ -1,911 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "reflect"
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-func TestTagSize(t *testing.T) {
- id := Tag{}
- typ := reflect.TypeOf(id)
- if typ.Size() > 24 {
- t.Errorf("size of Tag was %d; want 24", typ.Size())
- }
-}
-
-func TestIsRoot(t *testing.T) {
- loc := Tag{}
- if !loc.IsRoot() {
- t.Errorf("unspecified should be root.")
- }
- for i, tt := range parseTests() {
- loc, _ := Parse(tt.in)
- undef := tt.lang == "und" && tt.script == "" && tt.region == "" && tt.ext == ""
- if loc.IsRoot() != undef {
- t.Errorf("%d: was %v; want %v", i, loc.IsRoot(), undef)
- }
- }
-}
-
-func TestEquality(t *testing.T) {
- for i, tt := range parseTests()[48:49] {
- s := tt.in
- tag := Make(s)
- t1 := Make(tag.String())
- if tag != t1 {
- t.Errorf("%d:%s: equality test 1 failed\n got: %#v\nwant: %#v)", i, s, t1, tag)
- }
- t2, _ := Compose(tag)
- if tag != t2 {
- t.Errorf("%d:%s: equality test 2 failed\n got: %#v\nwant: %#v", i, s, t2, tag)
- }
- }
-}
-
-func TestMakeString(t *testing.T) {
- tests := []struct{ in, out string }{
- {"und", "und"},
- {"und", "und-CW"},
- {"nl", "nl-NL"},
- {"de-1901", "nl-1901"},
- {"de-1901", "de-Arab-1901"},
- {"x-a-b", "de-Arab-x-a-b"},
- {"x-a-b", "x-a-b"},
- }
- for i, tt := range tests {
- id, _ := Parse(tt.in)
- mod, _ := Parse(tt.out)
- id.setTagsFrom(mod)
- for j := 0; j < 2; j++ {
- id.remakeString()
- if str := id.String(); str != tt.out {
- t.Errorf("%d:%d: found %s; want %s", i, j, id.String(), tt.out)
- }
- }
- // The bytes to string conversion as used in remakeString
- // occasionally measures as more than one alloc, breaking this test.
- // To alleviate this we set the number of runs to more than 1.
- if n := testtext.AllocsPerRun(8, id.remakeString); n > 1 {
- t.Errorf("%d: # allocs got %.1f; want <= 1", i, n)
- }
- }
-}
-
-func TestCompactIndex(t *testing.T) {
- tests := []struct {
- tag string
- index int
- ok bool
- }{
- // TODO: these values will change with each CLDR update. This issue
- // will be solved if we decide to fix the indexes.
- {"und", 0, true},
- {"ca-ES-valencia", 1, true},
- {"ca-ES-valencia-u-va-posix", 0, false},
- {"ca-ES-valencia-u-co-phonebk", 1, true},
- {"ca-ES-valencia-u-co-phonebk-va-posix", 0, false},
- {"x-klingon", 0, false},
- {"en-US", 232, true},
- {"en-US-u-va-posix", 2, true},
- {"en", 136, true},
- {"en-u-co-phonebk", 136, true},
- {"en-001", 137, true},
- {"sh", 0, false}, // We don't normalize.
- }
- for _, tt := range tests {
- x, ok := CompactIndex(Raw.MustParse(tt.tag))
- if x != tt.index || ok != tt.ok {
- t.Errorf("%s: got %d, %v; want %d %v", tt.tag, x, ok, tt.index, tt.ok)
- }
- }
-}
-
-func TestMarshal(t *testing.T) {
- testCases := []string{
- // TODO: these values will change with each CLDR update. This issue
- // will be solved if we decide to fix the indexes.
- "und",
- "ca-ES-valencia",
- "ca-ES-valencia-u-va-posix",
- "ca-ES-valencia-u-co-phonebk",
- "ca-ES-valencia-u-co-phonebk-va-posix",
- "x-klingon",
- "en-US",
- "en-US-u-va-posix",
- "en",
- "en-u-co-phonebk",
- "en-001",
- "sh",
- }
- for _, tc := range testCases {
- var tag Tag
- err := tag.UnmarshalText([]byte(tc))
- if err != nil {
- t.Errorf("UnmarshalText(%q): unexpected error: %v", tc, err)
- }
- b, err := tag.MarshalText()
- if err != nil {
- t.Errorf("MarshalText(%q): unexpected error: %v", tc, err)
- }
- if got := string(b); got != tc {
- t.Errorf("%s: got %q; want %q", tc, got, tc)
- }
- }
-}
-
-func TestBase(t *testing.T) {
- tests := []struct {
- loc, lang string
- conf Confidence
- }{
- {"und", "en", Low},
- {"x-abc", "und", No},
- {"en", "en", Exact},
- {"und-Cyrl", "ru", High},
- // If a region is not included, the official language should be English.
- {"und-US", "en", High},
- // TODO: not-explicitly listed scripts should probably be und, No
- // Modify addTags to return info on how the match was derived.
- // {"und-Aghb", "und", No},
- }
- for i, tt := range tests {
- loc, _ := Parse(tt.loc)
- lang, conf := loc.Base()
- if lang.String() != tt.lang {
- t.Errorf("%d: language was %s; want %s", i, lang, tt.lang)
- }
- if conf != tt.conf {
- t.Errorf("%d: confidence was %d; want %d", i, conf, tt.conf)
- }
- }
-}
-
-func TestParseBase(t *testing.T) {
- tests := []struct {
- in string
- out string
- ok bool
- }{
- {"en", "en", true},
- {"EN", "en", true},
- {"nld", "nl", true},
- {"dut", "dut", true}, // bibliographic
- {"aaj", "und", false}, // unknown
- {"qaa", "qaa", true},
- {"a", "und", false},
- {"", "und", false},
- {"aaaa", "und", false},
- }
- for i, tt := range tests {
- x, err := ParseBase(tt.in)
- if x.String() != tt.out || err == nil != tt.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, x, err == nil, tt.out, tt.ok)
- }
- if y, _, _ := Raw.Make(tt.out).Raw(); x != y {
- t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, x, y)
- }
- }
-}
-
-func TestScript(t *testing.T) {
- tests := []struct {
- loc, scr string
- conf Confidence
- }{
- {"und", "Latn", Low},
- {"en-Latn", "Latn", Exact},
- {"en", "Latn", High},
- {"sr", "Cyrl", Low},
- {"kk", "Cyrl", High},
- {"kk-CN", "Arab", Low},
- {"cmn", "Hans", Low},
- {"ru", "Cyrl", High},
- {"ru-RU", "Cyrl", High},
- {"yue", "Hant", Low},
- {"x-abc", "Zzzz", Low},
- {"und-zyyy", "Zyyy", Exact},
- }
- for i, tt := range tests {
- loc, _ := Parse(tt.loc)
- sc, conf := loc.Script()
- if sc.String() != tt.scr {
- t.Errorf("%d:%s: script was %s; want %s", i, tt.loc, sc, tt.scr)
- }
- if conf != tt.conf {
- t.Errorf("%d:%s: confidence was %d; want %d", i, tt.loc, conf, tt.conf)
- }
- }
-}
-
-func TestParseScript(t *testing.T) {
- tests := []struct {
- in string
- out string
- ok bool
- }{
- {"Latn", "Latn", true},
- {"zzzz", "Zzzz", true},
- {"zyyy", "Zyyy", true},
- {"Latm", "Zzzz", false},
- {"Zzz", "Zzzz", false},
- {"", "Zzzz", false},
- {"Zzzxx", "Zzzz", false},
- }
- for i, tt := range tests {
- x, err := ParseScript(tt.in)
- if x.String() != tt.out || err == nil != tt.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, x, err == nil, tt.out, tt.ok)
- }
- if err == nil {
- if _, y, _ := Raw.Make("und-" + tt.out).Raw(); x != y {
- t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, x, y)
- }
- }
- }
-}
-
-func TestRegion(t *testing.T) {
- tests := []struct {
- loc, reg string
- conf Confidence
- }{
- {"und", "US", Low},
- {"en", "US", Low},
- {"zh-Hant", "TW", Low},
- {"en-US", "US", Exact},
- {"cmn", "CN", Low},
- {"ru", "RU", Low},
- {"yue", "HK", Low},
- {"x-abc", "ZZ", Low},
- }
- for i, tt := range tests {
- loc, _ := Raw.Parse(tt.loc)
- reg, conf := loc.Region()
- if reg.String() != tt.reg {
- t.Errorf("%d:%s: region was %s; want %s", i, tt.loc, reg, tt.reg)
- }
- if conf != tt.conf {
- t.Errorf("%d:%s: confidence was %d; want %d", i, tt.loc, conf, tt.conf)
- }
- }
-}
-
-func TestEncodeM49(t *testing.T) {
- tests := []struct {
- m49 int
- code string
- ok bool
- }{
- {1, "001", true},
- {840, "US", true},
- {899, "ZZ", false},
- }
- for i, tt := range tests {
- if r, err := EncodeM49(tt.m49); r.String() != tt.code || err == nil != tt.ok {
- t.Errorf("%d:%d: was %s, %v; want %s, %v", i, tt.m49, r, err == nil, tt.code, tt.ok)
- }
- }
- for i := 1; i <= 1000; i++ {
- if r, err := EncodeM49(i); err == nil && r.M49() == 0 {
- t.Errorf("%d has no error, but maps to undefined region", i)
- }
- }
-}
-
-func TestParseRegion(t *testing.T) {
- tests := []struct {
- in string
- out string
- ok bool
- }{
- {"001", "001", true},
- {"840", "US", true},
- {"899", "ZZ", false},
- {"USA", "US", true},
- {"US", "US", true},
- {"BC", "ZZ", false},
- {"C", "ZZ", false},
- {"CCCC", "ZZ", false},
- {"01", "ZZ", false},
- }
- for i, tt := range tests {
- r, err := ParseRegion(tt.in)
- if r.String() != tt.out || err == nil != tt.ok {
- t.Errorf("%d:%s: was %s, %v; want %s, %v", i, tt.in, r, err == nil, tt.out, tt.ok)
- }
- if err == nil {
- if _, _, y := Raw.Make("und-" + tt.out).Raw(); r != y {
- t.Errorf("%d:%s: tag was %s; want %s", i, tt.in, r, y)
- }
- }
- }
-}
-
-func TestIsCountry(t *testing.T) {
- tests := []struct {
- reg string
- country bool
- }{
- {"US", true},
- {"001", false},
- {"958", false},
- {"419", false},
- {"203", true},
- {"020", true},
- {"900", false},
- {"999", false},
- {"QO", false},
- {"EU", false},
- {"AA", false},
- {"XK", true},
- }
- for i, tt := range tests {
- reg, _ := getRegionID([]byte(tt.reg))
- r := Region{reg}
- if r.IsCountry() != tt.country {
- t.Errorf("%d: IsCountry(%s) was %v; want %v", i, tt.reg, r.IsCountry(), tt.country)
- }
- }
-}
-
-func TestIsGroup(t *testing.T) {
- tests := []struct {
- reg string
- group bool
- }{
- {"US", false},
- {"001", true},
- {"958", false},
- {"419", true},
- {"203", false},
- {"020", false},
- {"900", false},
- {"999", false},
- {"QO", true},
- {"EU", true},
- {"AA", false},
- {"XK", false},
- }
- for i, tt := range tests {
- reg, _ := getRegionID([]byte(tt.reg))
- r := Region{reg}
- if r.IsGroup() != tt.group {
- t.Errorf("%d: IsGroup(%s) was %v; want %v", i, tt.reg, r.IsGroup(), tt.group)
- }
- }
-}
-
-func TestContains(t *testing.T) {
- tests := []struct {
- enclosing, contained string
- contains bool
- }{
- // A region contains itself.
- {"US", "US", true},
- {"001", "001", true},
-
- // Direct containment.
- {"001", "002", true},
- {"039", "XK", true},
- {"150", "XK", true},
- {"EU", "AT", true},
- {"QO", "AQ", true},
-
- // Indirect containemnt.
- {"001", "US", true},
- {"001", "419", true},
- {"001", "013", true},
-
- // No containment.
- {"US", "001", false},
- {"155", "EU", false},
- }
- for i, tt := range tests {
- enc, _ := getRegionID([]byte(tt.enclosing))
- con, _ := getRegionID([]byte(tt.contained))
- r := Region{enc}
- if got := r.Contains(Region{con}); got != tt.contains {
- t.Errorf("%d: %s.Contains(%s) was %v; want %v", i, tt.enclosing, tt.contained, got, tt.contains)
- }
- }
-}
-
-func TestRegionCanonicalize(t *testing.T) {
- for i, tt := range []struct{ in, out string }{
- {"UK", "GB"},
- {"TP", "TL"},
- {"QU", "EU"},
- {"SU", "SU"},
- {"VD", "VN"},
- {"DD", "DE"},
- } {
- r := MustParseRegion(tt.in)
- want := MustParseRegion(tt.out)
- if got := r.Canonicalize(); got != want {
- t.Errorf("%d: got %v; want %v", i, got, want)
- }
- }
-}
-
-func TestRegionTLD(t *testing.T) {
- for _, tt := range []struct {
- in, out string
- ok bool
- }{
- {"EH", "EH", true},
- {"FR", "FR", true},
- {"TL", "TL", true},
-
- // In ccTLD before in ISO.
- {"GG", "GG", true},
-
- // Non-standard assignment of ccTLD to ISO code.
- {"GB", "UK", true},
-
- // Exceptionally reserved in ISO and valid ccTLD.
- {"UK", "UK", true},
- {"AC", "AC", true},
- {"EU", "EU", true},
- {"SU", "SU", true},
-
- // Exceptionally reserved in ISO and invalid ccTLD.
- {"CP", "ZZ", false},
- {"DG", "ZZ", false},
- {"EA", "ZZ", false},
- {"FX", "ZZ", false},
- {"IC", "ZZ", false},
- {"TA", "ZZ", false},
-
- // Transitionally reserved in ISO (e.g. deprecated) but valid ccTLD as
- // it is still being phased out.
- {"AN", "AN", true},
- {"TP", "TP", true},
-
- // Transitionally reserved in ISO (e.g. deprecated) and invalid ccTLD.
- // Defined in package language as it has a mapping in CLDR.
- {"BU", "ZZ", false},
- {"CS", "ZZ", false},
- {"NT", "ZZ", false},
- {"YU", "ZZ", false},
- {"ZR", "ZZ", false},
- // Not defined in package: SF.
-
- // Indeterminately reserved in ISO.
- // Defined in package language as it has a legacy mapping in CLDR.
- {"DY", "ZZ", false},
- {"RH", "ZZ", false},
- {"VD", "ZZ", false},
- // Not defined in package: EW, FL, JA, LF, PI, RA, RB, RC, RI, RL, RM,
- // RN, RP, WG, WL, WV, and YV.
-
- // Not assigned in ISO, but legacy definitions in CLDR.
- {"DD", "ZZ", false},
- {"YD", "ZZ", false},
-
- // Normal mappings but somewhat special status in ccTLD.
- {"BL", "BL", true},
- {"MF", "MF", true},
- {"BV", "BV", true},
- {"SJ", "SJ", true},
-
- // Have values when normalized, but not as is.
- {"QU", "ZZ", false},
-
- // ISO Private Use.
- {"AA", "ZZ", false},
- {"QM", "ZZ", false},
- {"QO", "ZZ", false},
- {"XA", "ZZ", false},
- {"XK", "ZZ", false}, // Sometimes used for Kosovo, but invalid ccTLD.
- } {
- if tt.in == "" {
- continue
- }
-
- r := MustParseRegion(tt.in)
- var want Region
- if tt.out != "ZZ" {
- want = MustParseRegion(tt.out)
- }
- tld, err := r.TLD()
- if got := err == nil; got != tt.ok {
- t.Errorf("error(%v): got %v; want %v", r, got, tt.ok)
- }
- if tld != want {
- t.Errorf("TLD(%v): got %v; want %v", r, tld, want)
- }
- }
-}
-
-func TestCanonicalize(t *testing.T) {
- // TODO: do a full test using CLDR data in a separate regression test.
- tests := []struct {
- in, out string
- option CanonType
- }{
- {"en-Latn", "en", SuppressScript},
- {"sr-Cyrl", "sr-Cyrl", SuppressScript},
- {"sh", "sr-Latn", Legacy},
- {"sh-HR", "sr-Latn-HR", Legacy},
- {"sh-Cyrl-HR", "sr-Cyrl-HR", Legacy},
- {"tl", "fil", Legacy},
- {"no", "no", Legacy},
- {"no", "nb", Legacy | CLDR},
- {"cmn", "cmn", Legacy},
- {"cmn", "zh", Macro},
- {"cmn-u-co-stroke", "zh-u-co-stroke", Macro},
- {"yue", "yue", Macro},
- {"nb", "no", Macro},
- {"nb", "nb", Macro | CLDR},
- {"no", "no", Macro},
- {"no", "no", Macro | CLDR},
- {"iw", "he", DeprecatedBase},
- {"iw", "he", Deprecated | CLDR},
- {"mo", "ro-MD", Deprecated}, // Adopted by CLDR as of version 25.
- {"alb", "sq", Legacy}, // bibliographic
- {"dut", "nl", Legacy}, // bibliographic
- // As of CLDR 25, mo is no longer considered a legacy mapping.
- {"mo", "mo", Legacy | CLDR},
- {"und-AN", "und-AN", Deprecated},
- {"und-YD", "und-YE", DeprecatedRegion},
- {"und-YD", "und-YD", DeprecatedBase},
- {"und-Qaai", "und-Zinh", DeprecatedScript},
- {"und-Qaai", "und-Qaai", DeprecatedBase},
- {"drh", "mn", All}, // drh -> khk -> mn
- }
- for i, tt := range tests {
- in, _ := Raw.Parse(tt.in)
- in, _ = tt.option.Canonicalize(in)
- if in.String() != tt.out {
- t.Errorf("%d:%s: was %s; want %s", i, tt.in, in.String(), tt.out)
- }
- if int(in.pVariant) > int(in.pExt) || int(in.pExt) > len(in.str) {
- t.Errorf("%d:%s:offsets %d <= %d <= %d must be true", i, tt.in, in.pVariant, in.pExt, len(in.str))
- }
- }
- // Test idempotence.
- for _, base := range Supported.BaseLanguages() {
- tag, _ := Raw.Compose(base)
- got, _ := All.Canonicalize(tag)
- want, _ := All.Canonicalize(got)
- if got != want {
- t.Errorf("idem(%s): got %s; want %s", tag, got, want)
- }
- }
-}
-
-func TestTypeForKey(t *testing.T) {
- tests := []struct{ key, in, out string }{
- {"co", "en", ""},
- {"co", "en-u-abc", ""},
- {"co", "en-u-co-phonebk", "phonebk"},
- {"co", "en-u-co-phonebk-cu-aud", "phonebk"},
- {"co", "x-foo-u-co-phonebk", ""},
- {"nu", "en-u-co-phonebk-nu-arabic", "arabic"},
- {"kc", "cmn-u-co-stroke", ""},
- }
- for _, tt := range tests {
- if v := Make(tt.in).TypeForKey(tt.key); v != tt.out {
- t.Errorf("%q[%q]: was %q; want %q", tt.in, tt.key, v, tt.out)
- }
- }
-}
-
-func TestSetTypeForKey(t *testing.T) {
- tests := []struct {
- key, value, in, out string
- err bool
- }{
- // replace existing value
- {"co", "pinyin", "en-u-co-phonebk", "en-u-co-pinyin", false},
- {"co", "pinyin", "en-u-co-phonebk-cu-xau", "en-u-co-pinyin-cu-xau", false},
- {"co", "pinyin", "en-u-co-phonebk-v-xx", "en-u-co-pinyin-v-xx", false},
- {"co", "pinyin", "en-u-co-phonebk-x-x", "en-u-co-pinyin-x-x", false},
- {"nu", "arabic", "en-u-co-phonebk-nu-vaai", "en-u-co-phonebk-nu-arabic", false},
- // add to existing -u extension
- {"co", "pinyin", "en-u-ca-gregory", "en-u-ca-gregory-co-pinyin", false},
- {"co", "pinyin", "en-u-ca-gregory-nu-vaai", "en-u-ca-gregory-co-pinyin-nu-vaai", false},
- {"co", "pinyin", "en-u-ca-gregory-v-va", "en-u-ca-gregory-co-pinyin-v-va", false},
- {"co", "pinyin", "en-u-ca-gregory-x-a", "en-u-ca-gregory-co-pinyin-x-a", false},
- {"ca", "gregory", "en-u-co-pinyin", "en-u-ca-gregory-co-pinyin", false},
- // remove pair
- {"co", "", "en-u-co-phonebk", "en", false},
- {"co", "", "en-u-ca-gregory-co-phonebk", "en-u-ca-gregory", false},
- {"co", "", "en-u-co-phonebk-nu-arabic", "en-u-nu-arabic", false},
- {"co", "", "en", "en", false},
- // add -u extension
- {"co", "pinyin", "en", "en-u-co-pinyin", false},
- {"co", "pinyin", "und", "und-u-co-pinyin", false},
- {"co", "pinyin", "en-a-aaa", "en-a-aaa-u-co-pinyin", false},
- {"co", "pinyin", "en-x-aaa", "en-u-co-pinyin-x-aaa", false},
- {"co", "pinyin", "en-v-aa", "en-u-co-pinyin-v-aa", false},
- {"co", "pinyin", "en-a-aaa-x-x", "en-a-aaa-u-co-pinyin-x-x", false},
- {"co", "pinyin", "en-a-aaa-v-va", "en-a-aaa-u-co-pinyin-v-va", false},
- // error on invalid values
- {"co", "pinyinxxx", "en", "en", true},
- {"co", "piny.n", "en", "en", true},
- {"co", "pinyinxxx", "en-a-aaa", "en-a-aaa", true},
- {"co", "pinyinxxx", "en-u-aaa", "en-u-aaa", true},
- {"co", "pinyinxxx", "en-u-aaa-co-pinyin", "en-u-aaa-co-pinyin", true},
- {"co", "pinyi.", "en-u-aaa-co-pinyin", "en-u-aaa-co-pinyin", true},
- {"col", "pinyin", "en", "en", true},
- {"co", "cu", "en", "en", true},
- // error when setting on a private use tag
- {"co", "phonebook", "x-foo", "x-foo", true},
- }
- for i, tt := range tests {
- tag := Make(tt.in)
- if v, err := tag.SetTypeForKey(tt.key, tt.value); v.String() != tt.out {
- t.Errorf("%d:%q[%q]=%q: was %q; want %q", i, tt.in, tt.key, tt.value, v, tt.out)
- } else if (err != nil) != tt.err {
- t.Errorf("%d:%q[%q]=%q: error was %v; want %v", i, tt.in, tt.key, tt.value, err != nil, tt.err)
- } else if val := v.TypeForKey(tt.key); err == nil && val != tt.value {
- t.Errorf("%d:%q[%q]==%q: was %v; want %v", i, tt.out, tt.key, tt.value, val, tt.value)
- }
- if len(tag.String()) <= 3 {
- // Simulate a tag for which the string has not been set.
- tag.str, tag.pExt, tag.pVariant = "", 0, 0
- if tag, err := tag.SetTypeForKey(tt.key, tt.value); err == nil {
- if val := tag.TypeForKey(tt.key); err == nil && val != tt.value {
- t.Errorf("%d:%q[%q]==%q: was %v; want %v", i, tt.out, tt.key, tt.value, val, tt.value)
- }
- }
- }
- }
-}
-
-func TestFindKeyAndType(t *testing.T) {
- // out is either the matched type in case of a match or the original
- // string up till the insertion point.
- tests := []struct {
- key string
- hasExt bool
- in, out string
- }{
- // Don't search past a private use extension.
- {"co", false, "en-x-foo-u-co-pinyin", "en"},
- {"co", false, "x-foo-u-co-pinyin", ""},
- {"co", false, "en-s-fff-x-foo", "en-s-fff"},
- // Insertion points in absence of -u extension.
- {"cu", false, "en", ""}, // t.str is ""
- {"cu", false, "en-v-va", "en"},
- {"cu", false, "en-a-va", "en-a-va"},
- {"cu", false, "en-a-va-v-va", "en-a-va"},
- {"cu", false, "en-x-a", "en"},
- // Tags with the -u extension.
- {"co", true, "en-u-co-standard", "standard"},
- {"co", true, "yue-u-co-pinyin", "pinyin"},
- {"co", true, "en-u-co-abc", "abc"},
- {"co", true, "en-u-co-abc-def", "abc-def"},
- {"co", true, "en-u-co-abc-def-x-foo", "abc-def"},
- {"co", true, "en-u-co-standard-nu-arab", "standard"},
- {"co", true, "yue-u-co-pinyin-nu-arab", "pinyin"},
- // Insertion points.
- {"cu", true, "en-u-co-standard", "en-u-co-standard"},
- {"cu", true, "yue-u-co-pinyin-x-foo", "yue-u-co-pinyin"},
- {"cu", true, "en-u-co-abc", "en-u-co-abc"},
- {"cu", true, "en-u-nu-arabic", "en-u"},
- {"cu", true, "en-u-co-abc-def-nu-arabic", "en-u-co-abc-def"},
- }
- for i, tt := range tests {
- start, end, hasExt := Make(tt.in).findTypeForKey(tt.key)
- if start != end {
- res := tt.in[start:end]
- if res != tt.out {
- t.Errorf("%d:%s: was %q; want %q", i, tt.in, res, tt.out)
- }
- } else {
- if hasExt != tt.hasExt {
- t.Errorf("%d:%s: hasExt was %v; want %v", i, tt.in, hasExt, tt.hasExt)
- continue
- }
- if tt.in[:start] != tt.out {
- t.Errorf("%d:%s: insertion point was %q; want %q", i, tt.in, tt.in[:start], tt.out)
- }
- }
- }
-}
-
-func TestParent(t *testing.T) {
- tests := []struct{ in, out string }{
- // Strip variants and extensions first
- {"de-u-co-phonebk", "de"},
- {"de-1994", "de"},
- {"de-Latn-1994", "de"}, // remove superfluous script.
-
- // Ensure the canonical Tag for an entry is in the chain for base-script
- // pairs.
- {"zh-Hans", "zh"},
-
- // Skip the script if it is the maximized version. CLDR files for the
- // skipped tag are always empty.
- {"zh-Hans-TW", "zh"},
- {"zh-Hans-CN", "zh"},
-
- // Insert the script if the maximized script is not the same as the
- // maximized script of the base language.
- {"zh-TW", "zh-Hant"},
- {"zh-HK", "zh-Hant"},
- {"zh-Hant-TW", "zh-Hant"},
- {"zh-Hant-HK", "zh-Hant"},
-
- // Non-default script skips to und.
- // CLDR
- {"az-Cyrl", "und"},
- {"bs-Cyrl", "und"},
- {"en-Dsrt", "und"},
- {"ha-Arab", "und"},
- {"mn-Mong", "und"},
- {"pa-Arab", "und"},
- {"shi-Latn", "und"},
- {"sr-Latn", "und"},
- {"uz-Arab", "und"},
- {"uz-Cyrl", "und"},
- {"vai-Latn", "und"},
- {"zh-Hant", "und"},
- // extra
- {"nl-Cyrl", "und"},
-
- // World english inherits from en-001.
- {"en-150", "en-001"},
- {"en-AU", "en-001"},
- {"en-BE", "en-001"},
- {"en-GG", "en-001"},
- {"en-GI", "en-001"},
- {"en-HK", "en-001"},
- {"en-IE", "en-001"},
- {"en-IM", "en-001"},
- {"en-IN", "en-001"},
- {"en-JE", "en-001"},
- {"en-MT", "en-001"},
- {"en-NZ", "en-001"},
- {"en-PK", "en-001"},
- {"en-SG", "en-001"},
-
- // Spanish in Latin-American countries have es-419 as parent.
- {"es-AR", "es-419"},
- {"es-BO", "es-419"},
- {"es-CL", "es-419"},
- {"es-CO", "es-419"},
- {"es-CR", "es-419"},
- {"es-CU", "es-419"},
- {"es-DO", "es-419"},
- {"es-EC", "es-419"},
- {"es-GT", "es-419"},
- {"es-HN", "es-419"},
- {"es-MX", "es-419"},
- {"es-NI", "es-419"},
- {"es-PA", "es-419"},
- {"es-PE", "es-419"},
- {"es-PR", "es-419"},
- {"es-PY", "es-419"},
- {"es-SV", "es-419"},
- {"es-US", "es-419"},
- {"es-UY", "es-419"},
- {"es-VE", "es-419"},
- // exceptions (according to CLDR)
- {"es-CW", "es"},
-
- // Inherit from pt-PT, instead of pt for these countries.
- {"pt-AO", "pt-PT"},
- {"pt-CV", "pt-PT"},
- {"pt-GW", "pt-PT"},
- {"pt-MO", "pt-PT"},
- {"pt-MZ", "pt-PT"},
- {"pt-ST", "pt-PT"},
- {"pt-TL", "pt-PT"},
- }
- for _, tt := range tests {
- tag := Raw.MustParse(tt.in)
- if p := Raw.MustParse(tt.out); p != tag.Parent() {
- t.Errorf("%s: was %v; want %v", tt.in, tag.Parent(), p)
- }
- }
-}
-
-var (
- // Tags without error that don't need to be changed.
- benchBasic = []string{
- "en",
- "en-Latn",
- "en-GB",
- "za",
- "zh-Hant",
- "zh",
- "zh-HK",
- "ar-MK",
- "en-CA",
- "fr-CA",
- "fr-CH",
- "fr",
- "lv",
- "he-IT",
- "tlh",
- "ja",
- "ja-Jpan",
- "ja-Jpan-JP",
- "de-1996",
- "de-CH",
- "sr",
- "sr-Latn",
- }
- // Tags with extensions, not changes required.
- benchExt = []string{
- "x-a-b-c-d",
- "x-aa-bbbb-cccccccc-d",
- "en-x_cc-b-bbb-a-aaa",
- "en-c_cc-b-bbb-a-aaa-x-x",
- "en-u-co-phonebk",
- "en-Cyrl-u-co-phonebk",
- "en-US-u-co-phonebk-cu-xau",
- "en-nedix-u-co-phonebk",
- "en-t-t0-abcd",
- "en-t-nl-latn",
- "en-t-t0-abcd-x-a",
- }
- // Change, but not memory allocation required.
- benchSimpleChange = []string{
- "EN",
- "i-klingon",
- "en-latn",
- "zh-cmn-Hans-CN",
- "iw-NL",
- }
- // Change and memory allocation required.
- benchChangeAlloc = []string{
- "en-c_cc-b-bbb-a-aaa",
- "en-u-cu-xua-co-phonebk",
- "en-u-cu-xua-co-phonebk-a-cd",
- "en-u-def-abc-cu-xua-co-phonebk",
- "en-t-en-Cyrl-NL-1994",
- "en-t-en-Cyrl-NL-1994-t0-abc-def",
- }
- // Tags that result in errors.
- benchErr = []string{
- // IllFormed
- "x_A.-B-C_D",
- "en-u-cu-co-phonebk",
- "en-u-cu-xau-co",
- "en-t-nl-abcd",
- // Invalid
- "xx",
- "nl-Uuuu",
- "nl-QB",
- }
- benchChange = append(benchSimpleChange, benchChangeAlloc...)
- benchAll = append(append(append(benchBasic, benchExt...), benchChange...), benchErr...)
-)
-
-func doParse(b *testing.B, tag []string) {
- for i := 0; i < b.N; i++ {
- // Use the modulo instead of looping over all tags so that we get a somewhat
- // meaningful ns/op.
- Parse(tag[i%len(tag)])
- }
-}
-
-func BenchmarkParse(b *testing.B) {
- doParse(b, benchAll)
-}
-
-func BenchmarkParseBasic(b *testing.B) {
- doParse(b, benchBasic)
-}
-
-func BenchmarkParseError(b *testing.B) {
- doParse(b, benchErr)
-}
-
-func BenchmarkParseSimpleChange(b *testing.B) {
- doParse(b, benchSimpleChange)
-}
-
-func BenchmarkParseChangeAlloc(b *testing.B) {
- doParse(b, benchChangeAlloc)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/lookup_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/lookup_test.go
deleted file mode 100644
index 9833830c416..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/lookup_test.go
+++ /dev/null
@@ -1,457 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "testing"
-
- "golang.org/x/text/internal/tag"
-)
-
-func b(s string) []byte {
- return []byte(s)
-}
-
-func TestLangID(t *testing.T) {
- tests := []struct {
- id, bcp47, iso3, norm string
- err error
- }{
- {id: "", bcp47: "und", iso3: "und", err: errSyntax},
- {id: " ", bcp47: "und", iso3: "und", err: errSyntax},
- {id: " ", bcp47: "und", iso3: "und", err: errSyntax},
- {id: " ", bcp47: "und", iso3: "und", err: errSyntax},
- {id: "xxx", bcp47: "und", iso3: "und", err: mkErrInvalid([]byte("xxx"))},
- {id: "und", bcp47: "und", iso3: "und"},
- {id: "aju", bcp47: "aju", iso3: "aju", norm: "jrb"},
- {id: "jrb", bcp47: "jrb", iso3: "jrb"},
- {id: "es", bcp47: "es", iso3: "spa"},
- {id: "spa", bcp47: "es", iso3: "spa"},
- {id: "ji", bcp47: "ji", iso3: "yid-", norm: "yi"},
- {id: "jw", bcp47: "jw", iso3: "jav-", norm: "jv"},
- {id: "ar", bcp47: "ar", iso3: "ara"},
- {id: "kw", bcp47: "kw", iso3: "cor"},
- {id: "arb", bcp47: "arb", iso3: "arb", norm: "ar"},
- {id: "ar", bcp47: "ar", iso3: "ara"},
- {id: "kur", bcp47: "ku", iso3: "kur"},
- {id: "nl", bcp47: "nl", iso3: "nld"},
- {id: "NL", bcp47: "nl", iso3: "nld"},
- {id: "gsw", bcp47: "gsw", iso3: "gsw"},
- {id: "gSW", bcp47: "gsw", iso3: "gsw"},
- {id: "und", bcp47: "und", iso3: "und"},
- {id: "sh", bcp47: "sh", iso3: "hbs", norm: "sr"},
- {id: "hbs", bcp47: "sh", iso3: "hbs", norm: "sr"},
- {id: "no", bcp47: "no", iso3: "nor", norm: "no"},
- {id: "nor", bcp47: "no", iso3: "nor", norm: "no"},
- {id: "cmn", bcp47: "cmn", iso3: "cmn", norm: "zh"},
- }
- for i, tt := range tests {
- want, err := getLangID(b(tt.id))
- if err != tt.err {
- t.Errorf("%d:err(%s): found %q; want %q", i, tt.id, err, tt.err)
- }
- if err != nil {
- continue
- }
- if id, _ := getLangISO2(b(tt.bcp47)); len(tt.bcp47) == 2 && want != id {
- t.Errorf("%d:getISO2(%s): found %v; want %v", i, tt.bcp47, id, want)
- }
- if len(tt.iso3) == 3 {
- if id, _ := getLangISO3(b(tt.iso3)); want != id {
- t.Errorf("%d:getISO3(%s): found %q; want %q", i, tt.iso3, id, want)
- }
- if id, _ := getLangID(b(tt.iso3)); want != id {
- t.Errorf("%d:getID3(%s): found %v; want %v", i, tt.iso3, id, want)
- }
- }
- norm := want
- if tt.norm != "" {
- norm, _ = getLangID(b(tt.norm))
- }
- id, _ := normLang(want)
- if id != norm {
- t.Errorf("%d:norm(%s): found %v; want %v", i, tt.id, id, norm)
- }
- if id := want.String(); tt.bcp47 != id {
- t.Errorf("%d:String(): found %s; want %s", i, id, tt.bcp47)
- }
- if id := want.ISO3(); tt.iso3[:3] != id {
- t.Errorf("%d:iso3(): found %s; want %s", i, id, tt.iso3[:3])
- }
- }
-}
-
-func TestGrandfathered(t *testing.T) {
- for _, tt := range []struct{ in, out string }{
- {"art-lojban", "jbo"},
- {"i-ami", "ami"},
- {"i-bnn", "bnn"},
- {"i-hak", "hak"},
- {"i-klingon", "tlh"},
- {"i-lux", "lb"},
- {"i-navajo", "nv"},
- {"i-pwn", "pwn"},
- {"i-tao", "tao"},
- {"i-tay", "tay"},
- {"i-tsu", "tsu"},
- {"no-bok", "nb"},
- {"no-nyn", "nn"},
- {"sgn-BE-FR", "sfb"},
- {"sgn-BE-NL", "vgt"},
- {"sgn-CH-DE", "sgg"},
- {"sgn-ch-de", "sgg"},
- {"zh-guoyu", "cmn"},
- {"zh-hakka", "hak"},
- {"zh-min-nan", "nan"},
- {"zh-xiang", "hsn"},
-
- // Grandfathered tags with no modern replacement will be converted as follows:
- {"cel-gaulish", "xtg-x-cel-gaulish"},
- {"en-GB-oed", "en-GB-oxendict"},
- {"en-gb-oed", "en-GB-oxendict"},
- {"i-default", "en-x-i-default"},
- {"i-enochian", "und-x-i-enochian"},
- {"i-mingo", "see-x-i-mingo"},
- {"zh-min", "nan-x-zh-min"},
-
- {"root", "und"},
- {"en_US_POSIX", "en-US-u-va-posix"},
- {"en_us_posix", "en-US-u-va-posix"},
- {"en-us-posix", "en-US-u-va-posix"},
- } {
- got := Raw.Make(tt.in)
- want := Raw.MustParse(tt.out)
- if got != want {
- t.Errorf("%s: got %q; want %q", tt.in, got, want)
- }
- }
-}
-
-func TestRegionID(t *testing.T) {
- tests := []struct {
- in, out string
- }{
- {"_ ", ""},
- {"_000", ""},
- {"419", "419"},
- {"AA", "AA"},
- {"ATF", "TF"},
- {"HV", "HV"},
- {"CT", "CT"},
- {"DY", "DY"},
- {"IC", "IC"},
- {"FQ", "FQ"},
- {"JT", "JT"},
- {"ZZ", "ZZ"},
- {"EU", "EU"},
- {"QO", "QO"},
- {"FX", "FX"},
- }
- for i, tt := range tests {
- if tt.in[0] == '_' {
- id := tt.in[1:]
- if _, err := getRegionID(b(id)); err == nil {
- t.Errorf("%d:err(%s): found nil; want error", i, id)
- }
- continue
- }
- want, _ := getRegionID(b(tt.in))
- if s := want.String(); s != tt.out {
- t.Errorf("%d:%s: found %q; want %q", i, tt.in, s, tt.out)
- }
- if len(tt.in) == 2 {
- want, _ := getRegionISO2(b(tt.in))
- if s := want.String(); s != tt.out {
- t.Errorf("%d:getISO2(%s): found %q; want %q", i, tt.in, s, tt.out)
- }
- }
- }
-}
-
-func TestRegionType(t *testing.T) {
- for _, tt := range []struct {
- r string
- t byte
- }{
- {"NL", bcp47Region | ccTLD},
- {"EU", bcp47Region | ccTLD}, // exceptionally reserved
- {"AN", bcp47Region | ccTLD}, // transitionally reserved
-
- {"DD", bcp47Region}, // deleted in ISO, deprecated in BCP 47
- {"NT", bcp47Region}, // transitionally reserved, deprecated in BCP 47
-
- {"XA", iso3166UserAssigned | bcp47Region},
- {"ZZ", iso3166UserAssigned | bcp47Region},
- {"AA", iso3166UserAssigned | bcp47Region},
- {"QO", iso3166UserAssigned | bcp47Region},
- {"QM", iso3166UserAssigned | bcp47Region},
- {"XK", iso3166UserAssigned | bcp47Region},
-
- {"CT", 0}, // deleted in ISO, not in BCP 47, canonicalized in CLDR
- } {
- r := MustParseRegion(tt.r)
- if tp := r.typ(); tp != tt.t {
- t.Errorf("Type(%s): got %x; want %x", tt.r, tp, tt.t)
- }
- }
-}
-
-func TestRegionISO3(t *testing.T) {
- tests := []struct {
- from, iso3, to string
- }{
- {" ", "ZZZ", "ZZ"},
- {"000", "ZZZ", "ZZ"},
- {"AA", "AAA", ""},
- {"CT", "CTE", ""},
- {"DY", "DHY", ""},
- {"EU", "QUU", ""},
- {"HV", "HVO", ""},
- {"IC", "ZZZ", "ZZ"},
- {"JT", "JTN", ""},
- {"PZ", "PCZ", ""},
- {"QU", "QUU", "EU"},
- {"QO", "QOO", ""},
- {"YD", "YMD", ""},
- {"FQ", "ATF", "TF"},
- {"TF", "ATF", ""},
- {"FX", "FXX", ""},
- {"ZZ", "ZZZ", ""},
- {"419", "ZZZ", "ZZ"},
- }
- for _, tt := range tests {
- r, _ := getRegionID(b(tt.from))
- if s := r.ISO3(); s != tt.iso3 {
- t.Errorf("iso3(%q): found %q; want %q", tt.from, s, tt.iso3)
- }
- if tt.iso3 == "" {
- continue
- }
- want := tt.to
- if tt.to == "" {
- want = tt.from
- }
- r, _ = getRegionID(b(want))
- if id, _ := getRegionISO3(b(tt.iso3)); id != r {
- t.Errorf("%s: found %q; want %q", tt.iso3, id, want)
- }
- }
-}
-
-func TestRegionM49(t *testing.T) {
- fromTests := []struct {
- m49 int
- id string
- }{
- {0, ""},
- {-1, ""},
- {1000, ""},
- {10000, ""},
-
- {001, "001"},
- {104, "MM"},
- {180, "CD"},
- {230, "ET"},
- {231, "ET"},
- {249, "FX"},
- {250, "FR"},
- {276, "DE"},
- {278, "DD"},
- {280, "DE"},
- {419, "419"},
- {626, "TL"},
- {736, "SD"},
- {840, "US"},
- {854, "BF"},
- {891, "CS"},
- {899, ""},
- {958, "AA"},
- {966, "QT"},
- {967, "EU"},
- {999, "ZZ"},
- }
- for _, tt := range fromTests {
- id, err := getRegionM49(tt.m49)
- if want, have := err != nil, tt.id == ""; want != have {
- t.Errorf("error(%d): have %v; want %v", tt.m49, have, want)
- continue
- }
- r, _ := getRegionID(b(tt.id))
- if r != id {
- t.Errorf("region(%d): have %s; want %s", tt.m49, id, r)
- }
- }
-
- toTests := []struct {
- m49 int
- id string
- }{
- {0, "000"},
- {0, "IC"}, // Some codes don't have an ID
-
- {001, "001"},
- {104, "MM"},
- {104, "BU"},
- {180, "CD"},
- {180, "ZR"},
- {231, "ET"},
- {250, "FR"},
- {249, "FX"},
- {276, "DE"},
- {278, "DD"},
- {419, "419"},
- {626, "TL"},
- {626, "TP"},
- {729, "SD"},
- {826, "GB"},
- {840, "US"},
- {854, "BF"},
- {891, "YU"},
- {891, "CS"},
- {958, "AA"},
- {966, "QT"},
- {967, "EU"},
- {967, "QU"},
- {999, "ZZ"},
- // For codes that don't have an M49 code use the replacement value,
- // if available.
- {854, "HV"}, // maps to Burkino Faso
- }
- for _, tt := range toTests {
- r, _ := getRegionID(b(tt.id))
- if r.M49() != tt.m49 {
- t.Errorf("m49(%q): have %d; want %d", tt.id, r.M49(), tt.m49)
- }
- }
-}
-
-func TestRegionDeprecation(t *testing.T) {
- tests := []struct{ in, out string }{
- {"BU", "MM"},
- {"BUR", "MM"},
- {"CT", "KI"},
- {"DD", "DE"},
- {"DDR", "DE"},
- {"DY", "BJ"},
- {"FX", "FR"},
- {"HV", "BF"},
- {"JT", "UM"},
- {"MI", "UM"},
- {"NH", "VU"},
- {"NQ", "AQ"},
- {"PU", "UM"},
- {"PZ", "PA"},
- {"QU", "EU"},
- {"RH", "ZW"},
- {"TP", "TL"},
- {"UK", "GB"},
- {"VD", "VN"},
- {"WK", "UM"},
- {"YD", "YE"},
- {"NL", "NL"},
- }
- for _, tt := range tests {
- rIn, _ := getRegionID([]byte(tt.in))
- rOut, _ := getRegionISO2([]byte(tt.out))
- r := normRegion(rIn)
- if rOut == rIn && r != 0 {
- t.Errorf("%s: was %q; want %q", tt.in, r, tt.in)
- }
- if rOut != rIn && r != rOut {
- t.Errorf("%s: was %q; want %q", tt.in, r, tt.out)
- }
-
- }
-}
-
-func TestGetScriptID(t *testing.T) {
- idx := tag.Index("0000BbbbDdddEeeeZzzz\xff\xff\xff\xff")
- tests := []struct {
- in string
- out scriptID
- }{
- {" ", 0},
- {" ", 0},
- {" ", 0},
- {"", 0},
- {"Aaaa", 0},
- {"Bbbb", 1},
- {"Dddd", 2},
- {"dddd", 2},
- {"dDDD", 2},
- {"Eeee", 3},
- {"Zzzz", 4},
- }
- for i, tt := range tests {
- if id, err := getScriptID(idx, b(tt.in)); id != tt.out {
- t.Errorf("%d:%s: found %d; want %d", i, tt.in, id, tt.out)
- } else if id == 0 && err == nil {
- t.Errorf("%d:%s: no error; expected one", i, tt.in)
- }
- }
-}
-
-func TestIsPrivateUse(t *testing.T) {
- type test struct {
- s string
- private bool
- }
- tests := []test{
- {"en", false},
- {"und", false},
- {"pzn", false},
- {"qaa", true},
- {"qtz", true},
- {"qua", false},
- }
- for i, tt := range tests {
- x, _ := getLangID([]byte(tt.s))
- if b := x.IsPrivateUse(); b != tt.private {
- t.Errorf("%d: langID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
- }
- }
- tests = []test{
- {"001", false},
- {"419", false},
- {"899", false},
- {"900", false},
- {"957", false},
- {"958", true},
- {"AA", true},
- {"AC", false},
- {"EU", false}, // CLDR grouping, exceptionally reserved in ISO.
- {"QU", true}, // Canonicalizes to EU, User-assigned in ISO.
- {"QO", true}, // CLDR grouping, User-assigned in ISO.
- {"QA", false},
- {"QM", true},
- {"QZ", true},
- {"XA", true},
- {"XK", true}, // Assigned to Kosovo in CLDR, User-assigned in ISO.
- {"XZ", true},
- {"ZW", false},
- {"ZZ", true},
- }
- for i, tt := range tests {
- x, _ := getRegionID([]byte(tt.s))
- if b := x.IsPrivateUse(); b != tt.private {
- t.Errorf("%d: regionID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
- }
- }
- tests = []test{
- {"Latn", false},
- {"Laaa", false}, // invalid
- {"Qaaa", true},
- {"Qabx", true},
- {"Qaby", false},
- {"Zyyy", false},
- {"Zzzz", false},
- }
- for i, tt := range tests {
- x, _ := getScriptID(script, []byte(tt.s))
- if b := x.IsPrivateUse(); b != tt.private {
- t.Errorf("%d: scriptID.IsPrivateUse(%s) was %v; want %v", i, tt.s, b, tt.private)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/match_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/match_test.go
deleted file mode 100644
index 8b60b07a34b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/match_test.go
+++ /dev/null
@@ -1,505 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "bytes"
- "flag"
- "fmt"
- "os"
- "path"
- "path/filepath"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-var verbose = flag.Bool("verbose", false, "set to true to print the internal tables of matchers")
-
-func TestCompliance(t *testing.T) {
- filepath.Walk("testdata", func(file string, info os.FileInfo, err error) error {
- if info.IsDir() {
- return nil
- }
- r, err := os.Open(file)
- if err != nil {
- t.Fatal(err)
- }
- ucd.Parse(r, func(p *ucd.Parser) {
- name := strings.Replace(path.Join(p.String(0), p.String(1)), " ", "", -1)
- if skip[name] {
- return
- }
- t.Run(info.Name()+"/"+name, func(t *testing.T) {
- supported := makeTagList(p.String(0))
- desired := makeTagList(p.String(1))
- gotCombined, index, conf := NewMatcher(supported).Match(desired...)
-
- gotMatch := supported[index]
- wantMatch := mk(p.String(2))
- if gotMatch != wantMatch {
- t.Fatalf("match: got %q; want %q (%v)", gotMatch, wantMatch, conf)
- }
- wantCombined, err := Raw.Parse(p.String(3))
- if err == nil && gotCombined != wantCombined {
- t.Errorf("combined: got %q; want %q (%v)", gotCombined, wantCombined, conf)
- }
- })
- })
- return nil
- })
-}
-
-var skip = map[string]bool{
- // TODO: bugs
- // Honor the wildcard match. This may only be useful to select non-exact
- // stuff.
- "mul,af/nl": true, // match: got "af"; want "mul"
-
- // TODO: include other extensions.
- // combined: got "en-GB-u-ca-buddhist-nu-arab"; want "en-GB-fonipa-t-m0-iso-i0-pinyin-u-ca-buddhist-nu-arab"
- "und,en-GB-u-sd-gbsct/en-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin": true,
-
- // Inconsistencies with Mark Davis' implementation where it is not clear
- // which is better.
-
- // Inconsistencies in combined. I think the Go approach is more appropriate.
- // We could use -u-rg- and -u-va- as alternative.
- "und,fr/fr-BE-fonipa": true, // combined: got "fr"; want "fr-BE-fonipa"
- "und,fr-CA/fr-BE-fonipa": true, // combined: got "fr-CA"; want "fr-BE-fonipa"
- "und,fr-fonupa/fr-BE-fonipa": true, // combined: got "fr-fonupa"; want "fr-BE-fonipa"
- "und,no/nn-BE-fonipa": true, // combined: got "no"; want "no-BE-fonipa"
- "50,und,fr-CA-fonupa/fr-BE-fonipa": true, // combined: got "fr-CA-fonupa"; want "fr-BE-fonipa"
-
- // The initial number is a threshold. As we don't use scoring, we will not
- // implement this.
- "50,und,fr-Cyrl-CA-fonupa/fr-BE-fonipa": true,
- // match: got "und"; want "fr-Cyrl-CA-fonupa"
- // combined: got "und"; want "fr-Cyrl-BE-fonipa"
-
- // Other interesting cases to test:
- // - Should same language or same script have the preference if there is
- // usually no understanding of the other script?
- // - More specific region in desired may replace enclosing supported.
-}
-
-func makeTagList(s string) (tags []Tag) {
- for _, s := range strings.Split(s, ",") {
- tags = append(tags, mk(strings.TrimSpace(s)))
- }
- return tags
-}
-
-func TestMatchStrings(t *testing.T) {
- testCases := []struct {
- supported string
- desired string // strings separted by |
- tag string
- index int
- }{{
- supported: "en",
- desired: "",
- tag: "en",
- index: 0,
- }, {
- supported: "en",
- desired: "nl",
- tag: "en",
- index: 0,
- }, {
- supported: "en,nl",
- desired: "nl",
- tag: "nl",
- index: 1,
- }, {
- supported: "en,nl",
- desired: "nl|en",
- tag: "nl",
- index: 1,
- }, {
- supported: "en-GB,nl",
- desired: "en ; q=0.1,nl",
- tag: "nl",
- index: 1,
- }, {
- supported: "en-GB,nl",
- desired: "en;q=0.005 | dk; q=0.1,nl ",
- tag: "en-GB",
- index: 0,
- }, {
- // do not match faulty tags with und
- supported: "en,und",
- desired: "|en",
- tag: "en",
- index: 0,
- }}
- for _, tc := range testCases {
- t.Run(path.Join(tc.supported, tc.desired), func(t *testing.T) {
- m := NewMatcher(makeTagList(tc.supported))
- tag, index := MatchStrings(m, strings.Split(tc.desired, "|")...)
- if tag.String() != tc.tag || index != tc.index {
- t.Errorf("got %v, %d; want %v, %d", tag, index, tc.tag, tc.index)
- }
- })
- }
-}
-
-func TestAddLikelySubtags(t *testing.T) {
- tests := []struct{ in, out string }{
- {"aa", "aa-Latn-ET"},
- {"aa-Latn", "aa-Latn-ET"},
- {"aa-Arab", "aa-Arab-ET"},
- {"aa-Arab-ER", "aa-Arab-ER"},
- {"kk", "kk-Cyrl-KZ"},
- {"kk-CN", "kk-Arab-CN"},
- {"cmn", "cmn"},
- {"zh-AU", "zh-Hant-AU"},
- {"zh-VN", "zh-Hant-VN"},
- {"zh-SG", "zh-Hans-SG"},
- {"zh-Hant", "zh-Hant-TW"},
- {"zh-Hani", "zh-Hani-CN"},
- {"und-Hani", "zh-Hani-CN"},
- {"und", "en-Latn-US"},
- {"und-GB", "en-Latn-GB"},
- {"und-CW", "pap-Latn-CW"},
- {"und-YT", "fr-Latn-YT"},
- {"und-Arab", "ar-Arab-EG"},
- {"und-AM", "hy-Armn-AM"},
- {"und-TW", "zh-Hant-TW"},
- {"und-002", "en-Latn-NG"},
- {"und-Latn-002", "en-Latn-NG"},
- {"en-Latn-002", "en-Latn-NG"},
- {"en-002", "en-Latn-NG"},
- {"en-001", "en-Latn-US"},
- {"und-003", "en-Latn-US"},
- {"und-GB", "en-Latn-GB"},
- {"Latn-001", "en-Latn-US"},
- {"en-001", "en-Latn-US"},
- {"es-419", "es-Latn-419"},
- {"he-145", "he-Hebr-IL"},
- {"ky-145", "ky-Latn-TR"},
- {"kk", "kk-Cyrl-KZ"},
- // Don't specialize duplicate and ambiguous matches.
- {"kk-034", "kk-Arab-034"}, // Matches IR and AF. Both are Arab.
- {"ku-145", "ku-Latn-TR"}, // Matches IQ, TR, and LB, but kk -> TR.
- {"und-Arab-CC", "ms-Arab-CC"},
- {"und-Arab-GB", "ks-Arab-GB"},
- {"und-Hans-CC", "zh-Hans-CC"},
- {"und-CC", "en-Latn-CC"},
- {"sr", "sr-Cyrl-RS"},
- {"sr-151", "sr-Latn-151"}, // Matches RO and RU.
- // We would like addLikelySubtags to generate the same results if the input
- // only changes by adding tags that would otherwise have been added
- // by the expansion.
- // In other words:
- // und-AA -> xx-Scrp-AA implies und-Scrp-AA -> xx-Scrp-AA
- // und-AA -> xx-Scrp-AA implies xx-AA -> xx-Scrp-AA
- // und-Scrp -> xx-Scrp-AA implies und-Scrp-AA -> xx-Scrp-AA
- // und-Scrp -> xx-Scrp-AA implies xx-Scrp -> xx-Scrp-AA
- // xx -> xx-Scrp-AA implies xx-Scrp -> xx-Scrp-AA
- // xx -> xx-Scrp-AA implies xx-AA -> xx-Scrp-AA
- //
- // The algorithm specified in
- // http://unicode.org/reports/tr35/tr35-9.html#Supplemental_Data,
- // Section C.10, does not handle the first case. For example,
- // the CLDR data contains an entry und-BJ -> fr-Latn-BJ, but not
- // there is no rule for und-Latn-BJ. According to spec, und-Latn-BJ
- // would expand to en-Latn-BJ, violating the aforementioned principle.
- // We deviate from the spec by letting und-Scrp-AA expand to xx-Scrp-AA
- // if a rule of the form und-AA -> xx-Scrp-AA is defined.
- // Note that as of version 23, CLDR has some explicitly specified
- // entries that do not conform to these rules. The implementation
- // will not correct these explicit inconsistencies. A later versions of CLDR
- // is supposed to fix this.
- {"und-Latn-BJ", "fr-Latn-BJ"},
- {"und-Bugi-ID", "bug-Bugi-ID"},
- // regions, scripts and languages without definitions
- {"und-Arab-AA", "ar-Arab-AA"},
- {"und-Afak-RE", "fr-Afak-RE"},
- {"und-Arab-GB", "ks-Arab-GB"},
- {"abp-Arab-GB", "abp-Arab-GB"},
- // script has preference over region
- {"und-Arab-NL", "ar-Arab-NL"},
- {"zza", "zza-Latn-TR"},
- // preserve variants and extensions
- {"de-1901", "de-Latn-DE-1901"},
- {"de-x-abc", "de-Latn-DE-x-abc"},
- {"de-1901-x-abc", "de-Latn-DE-1901-x-abc"},
- {"x-abc", "x-abc"}, // TODO: is this the desired behavior?
- }
- for i, tt := range tests {
- in, _ := Parse(tt.in)
- out, _ := Parse(tt.out)
- in, _ = in.addLikelySubtags()
- if in.String() != out.String() {
- t.Errorf("%d: add(%s) was %s; want %s", i, tt.in, in, tt.out)
- }
- }
-}
-func TestMinimize(t *testing.T) {
- tests := []struct{ in, out string }{
- {"aa", "aa"},
- {"aa-Latn", "aa"},
- {"aa-Latn-ET", "aa"},
- {"aa-ET", "aa"},
- {"aa-Arab", "aa-Arab"},
- {"aa-Arab-ER", "aa-Arab-ER"},
- {"aa-Arab-ET", "aa-Arab"},
- {"und", "und"},
- {"und-Latn", "und"},
- {"und-Latn-US", "und"},
- {"en-Latn-US", "en"},
- {"cmn", "cmn"},
- {"cmn-Hans", "cmn-Hans"},
- {"cmn-Hant", "cmn-Hant"},
- {"zh-AU", "zh-AU"},
- {"zh-VN", "zh-VN"},
- {"zh-SG", "zh-SG"},
- {"zh-Hant", "zh-Hant"},
- {"zh-Hant-TW", "zh-TW"},
- {"zh-Hans", "zh"},
- {"zh-Hani", "zh-Hani"},
- {"und-Hans", "und-Hans"},
- {"und-Hani", "und-Hani"},
-
- {"und-CW", "und-CW"},
- {"und-YT", "und-YT"},
- {"und-Arab", "und-Arab"},
- {"und-AM", "und-AM"},
- {"und-Arab-CC", "und-Arab-CC"},
- {"und-CC", "und-CC"},
- {"und-Latn-BJ", "und-BJ"},
- {"und-Bugi-ID", "und-Bugi"},
- {"bug-Bugi-ID", "bug-Bugi"},
- // regions, scripts and languages without definitions
- {"und-Arab-AA", "und-Arab-AA"},
- // preserve variants and extensions
- {"de-Latn-1901", "de-1901"},
- {"de-Latn-x-abc", "de-x-abc"},
- {"de-DE-1901-x-abc", "de-1901-x-abc"},
- {"x-abc", "x-abc"}, // TODO: is this the desired behavior?
- }
- for i, tt := range tests {
- in, _ := Parse(tt.in)
- out, _ := Parse(tt.out)
- min, _ := in.minimize()
- if min.String() != out.String() {
- t.Errorf("%d: min(%s) was %s; want %s", i, tt.in, min, tt.out)
- }
- max, _ := min.addLikelySubtags()
- if x, _ := in.addLikelySubtags(); x.String() != max.String() {
- t.Errorf("%d: max(min(%s)) = %s; want %s", i, tt.in, max, x)
- }
- }
-}
-
-func TestRegionGroups(t *testing.T) {
- testCases := []struct {
- a, b string
- distance uint8
- }{
- {"zh-TW", "zh-HK", 5},
- {"zh-MO", "zh-HK", 4},
- {"es-ES", "es-AR", 5},
- {"es-ES", "es", 4},
- {"es-419", "es-MX", 4},
- {"es-AR", "es-MX", 4},
- {"es-ES", "es-MX", 5},
- {"es-PT", "es-MX", 5},
- }
- for _, tc := range testCases {
- a := MustParse(tc.a)
- aScript, _ := a.Script()
- b := MustParse(tc.b)
- bScript, _ := b.Script()
-
- if aScript != bScript {
- t.Errorf("scripts differ: %q vs %q", aScript, bScript)
- continue
- }
- d, _ := regionGroupDist(a.region, b.region, aScript.scriptID, a.lang)
- if d != tc.distance {
- t.Errorf("got %q; want %q", d, tc.distance)
- }
- }
-}
-
-func TestIsParadigmLocale(t *testing.T) {
- testCases := map[string]bool{
- "en-US": true,
- "en-GB": true,
- "en-VI": false,
- "es-GB": false,
- "es-ES": true,
- "es-419": true,
- }
- for str, want := range testCases {
- tag := Make(str)
- got := isParadigmLocale(tag.lang, tag.region)
- if got != want {
- t.Errorf("isPL(%q) = %v; want %v", str, got, want)
- }
- }
-}
-
-// Implementation of String methods for various types for debugging purposes.
-
-func (m *matcher) String() string {
- w := &bytes.Buffer{}
- fmt.Fprintln(w, "Default:", m.default_)
- for tag, h := range m.index {
- fmt.Fprintf(w, " %s: %v\n", tag, h)
- }
- return w.String()
-}
-
-func (h *matchHeader) String() string {
- w := &bytes.Buffer{}
- fmt.Fprint(w, "haveTag: ")
- for _, h := range h.haveTags {
- fmt.Fprintf(w, "%v, ", h)
- }
- return w.String()
-}
-
-func (t haveTag) String() string {
- return fmt.Sprintf("%v:%d:%v:%v-%v|%v", t.tag, t.index, t.conf, t.maxRegion, t.maxScript, t.altScript)
-}
-
-func TestBestMatchAlloc(t *testing.T) {
- m := NewMatcher(makeTagList("en sr nl"))
- // Go allocates when creating a list of tags from a single tag!
- list := []Tag{English}
- avg := testtext.AllocsPerRun(1, func() {
- m.Match(list...)
- })
- if avg > 0 {
- t.Errorf("got %f; want 0", avg)
- }
-}
-
-var benchHave = []Tag{
- mk("en"),
- mk("en-GB"),
- mk("za"),
- mk("zh-Hant"),
- mk("zh-Hans-CN"),
- mk("zh"),
- mk("zh-HK"),
- mk("ar-MK"),
- mk("en-CA"),
- mk("fr-CA"),
- mk("fr-US"),
- mk("fr-CH"),
- mk("fr"),
- mk("lt"),
- mk("lv"),
- mk("iw"),
- mk("iw-NL"),
- mk("he"),
- mk("he-IT"),
- mk("tlh"),
- mk("ja"),
- mk("ja-Jpan"),
- mk("ja-Jpan-JP"),
- mk("de"),
- mk("de-CH"),
- mk("de-AT"),
- mk("de-DE"),
- mk("sr"),
- mk("sr-Latn"),
- mk("sr-Cyrl"),
- mk("sr-ME"),
-}
-
-var benchWant = [][]Tag{
- []Tag{
- mk("en"),
- },
- []Tag{
- mk("en-AU"),
- mk("de-HK"),
- mk("nl"),
- mk("fy"),
- mk("lv"),
- },
- []Tag{
- mk("en-AU"),
- mk("de-HK"),
- mk("nl"),
- mk("fy"),
- },
- []Tag{
- mk("ja-Hant"),
- mk("da-HK"),
- mk("nl"),
- mk("zh-TW"),
- },
- []Tag{
- mk("ja-Hant"),
- mk("da-HK"),
- mk("nl"),
- mk("hr"),
- },
-}
-
-func BenchmarkMatch(b *testing.B) {
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- for _, want := range benchWant {
- m.getBest(want...)
- }
- }
-}
-
-func BenchmarkMatchExact(b *testing.B) {
- want := mk("en")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltLanguagePresent(b *testing.B) {
- want := mk("hr")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltLanguageNotPresent(b *testing.B) {
- want := mk("nn")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltScriptPresent(b *testing.B) {
- want := mk("zh-Hant-CN")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchAltScriptNotPresent(b *testing.B) {
- want := mk("fr-Cyrl")
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want)
- }
-}
-
-func BenchmarkMatchLimitedExact(b *testing.B) {
- want := []Tag{mk("he-NL"), mk("iw-NL")}
- m := newMatcher(benchHave, nil)
- for i := 0; i < b.N; i++ {
- m.getBest(want...)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/parse_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/parse_test.go
deleted file mode 100644
index 9b40eb444eb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/language/parse_test.go
+++ /dev/null
@@ -1,517 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package language
-
-import (
- "bytes"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/tag"
-)
-
-type scanTest struct {
- ok bool // true if scanning does not result in an error
- in string
- tok []string // the expected tokens
-}
-
-var tests = []scanTest{
- {true, "", []string{}},
- {true, "1", []string{"1"}},
- {true, "en", []string{"en"}},
- {true, "root", []string{"root"}},
- {true, "maxchars", []string{"maxchars"}},
- {false, "bad/", []string{}},
- {false, "morethan8", []string{}},
- {false, "-", []string{}},
- {false, "----", []string{}},
- {false, "_", []string{}},
- {true, "en-US", []string{"en", "US"}},
- {true, "en_US", []string{"en", "US"}},
- {false, "en-US-", []string{"en", "US"}},
- {false, "en-US--", []string{"en", "US"}},
- {false, "en-US---", []string{"en", "US"}},
- {false, "en--US", []string{"en", "US"}},
- {false, "-en-US", []string{"en", "US"}},
- {false, "-en--US-", []string{"en", "US"}},
- {false, "-en--US-", []string{"en", "US"}},
- {false, "en-.-US", []string{"en", "US"}},
- {false, ".-en--US-.", []string{"en", "US"}},
- {false, "en-u.-US", []string{"en", "US"}},
- {true, "en-u1-US", []string{"en", "u1", "US"}},
- {true, "maxchar1_maxchar2-maxchar3", []string{"maxchar1", "maxchar2", "maxchar3"}},
- {false, "moreThan8-moreThan8-e", []string{"e"}},
-}
-
-func TestScan(t *testing.T) {
- for i, tt := range tests {
- scan := makeScannerString(tt.in)
- for j := 0; !scan.done; j++ {
- if j >= len(tt.tok) {
- t.Errorf("%d: extra token %q", i, scan.token)
- } else if tag.Compare(tt.tok[j], scan.token) != 0 {
- t.Errorf("%d: token %d: found %q; want %q", i, j, scan.token, tt.tok[j])
- break
- }
- scan.scan()
- }
- if s := strings.Join(tt.tok, "-"); tag.Compare(s, bytes.Replace(scan.b, b("_"), b("-"), -1)) != 0 {
- t.Errorf("%d: input: found %q; want %q", i, scan.b, s)
- }
- if (scan.err == nil) != tt.ok {
- t.Errorf("%d: ok: found %v; want %v", i, scan.err == nil, tt.ok)
- }
- }
-}
-
-func TestAcceptMinSize(t *testing.T) {
- for i, tt := range tests {
- // count number of successive tokens with a minimum size.
- for sz := 1; sz <= 8; sz++ {
- scan := makeScannerString(tt.in)
- scan.end, scan.next = 0, 0
- end := scan.acceptMinSize(sz)
- n := 0
- for i := 0; i < len(tt.tok) && len(tt.tok[i]) >= sz; i++ {
- n += len(tt.tok[i])
- if i > 0 {
- n++
- }
- }
- if end != n {
- t.Errorf("%d:%d: found len %d; want %d", i, sz, end, n)
- }
- }
- }
-}
-
-type parseTest struct {
- i int // the index of this test
- in string
- lang, script, region string
- variants, ext string
- extList []string // only used when more than one extension is present
- invalid bool
- rewrite bool // special rewrite not handled by parseTag
- changed bool // string needed to be reformatted
-}
-
-func parseTests() []parseTest {
- tests := []parseTest{
- {in: "root", lang: "und"},
- {in: "und", lang: "und"},
- {in: "en", lang: "en"},
- {in: "xy", lang: "und", invalid: true},
- {in: "en-ZY", lang: "en", invalid: true},
- {in: "gsw", lang: "gsw"},
- {in: "sr_Latn", lang: "sr", script: "Latn"},
- {in: "af-Arab", lang: "af", script: "Arab"},
- {in: "nl-BE", lang: "nl", region: "BE"},
- {in: "es-419", lang: "es", region: "419"},
- {in: "und-001", lang: "und", region: "001"},
- {in: "de-latn-be", lang: "de", script: "Latn", region: "BE"},
- // Variants
- {in: "de-1901", lang: "de", variants: "1901"},
- // Accept with unsuppressed script.
- {in: "de-Latn-1901", lang: "de", script: "Latn", variants: "1901"},
- // Specialized.
- {in: "sl-rozaj", lang: "sl", variants: "rozaj"},
- {in: "sl-rozaj-lipaw", lang: "sl", variants: "rozaj-lipaw"},
- {in: "sl-rozaj-biske", lang: "sl", variants: "rozaj-biske"},
- {in: "sl-rozaj-biske-1994", lang: "sl", variants: "rozaj-biske-1994"},
- {in: "sl-rozaj-1994", lang: "sl", variants: "rozaj-1994"},
- // Maximum number of variants while adhering to prefix rules.
- {in: "sl-rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp"},
-
- // Sorting.
- {in: "sl-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
- {in: "sl-rozaj-biske-1994-alalc97-fonupa-fonipa-fonxsamp", lang: "sl", variants: "rozaj-biske-1994-alalc97-fonipa-fonupa-fonxsamp", changed: true},
- {in: "nl-fonxsamp-alalc97-fonipa-fonupa", lang: "nl", variants: "alalc97-fonipa-fonupa-fonxsamp", changed: true},
-
- // Duplicates variants are removed, but not an error.
- {in: "nl-fonupa-fonupa", lang: "nl", variants: "fonupa"},
-
- // Variants that do not have correct prefixes. We still accept these.
- {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
- {in: "sl-rozaj-lipaw-1994", lang: "sl", variants: "rozaj-lipaw-1994"},
- {in: "sl-1994-biske-rozaj-1994-biske-rozaj", lang: "sl", variants: "rozaj-biske-1994", changed: true},
- {in: "de-Cyrl-1901", lang: "de", script: "Cyrl", variants: "1901"},
-
- // Invalid variant.
- {in: "de-1902", lang: "de", variants: "", invalid: true},
-
- {in: "EN_CYRL", lang: "en", script: "Cyrl"},
- // private use and extensions
- {in: "x-a-b-c-d", ext: "x-a-b-c-d"},
- {in: "x_A.-B-C_D", ext: "x-b-c-d", invalid: true, changed: true},
- {in: "x-aa-bbbb-cccccccc-d", ext: "x-aa-bbbb-cccccccc-d"},
- {in: "en-c_cc-b-bbb-a-aaa", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc"}},
- {in: "en-x_cc-b-bbb-a-aaa", lang: "en", ext: "x-cc-b-bbb-a-aaa", changed: true},
- {in: "en-c_cc-b-bbb-a-aaa-x-x", lang: "en", changed: true, extList: []string{"a-aaa", "b-bbb", "c-cc", "x-x"}},
- {in: "en-v-c", lang: "en", ext: "", invalid: true},
- {in: "en-v-abcdefghi", lang: "en", ext: "", invalid: true},
- {in: "en-v-abc-x", lang: "en", ext: "v-abc", invalid: true},
- {in: "en-v-abc-x-", lang: "en", ext: "v-abc", invalid: true},
- {in: "en-v-abc-w-x-xx", lang: "en", extList: []string{"v-abc", "x-xx"}, invalid: true, changed: true},
- {in: "en-v-abc-w-y-yx", lang: "en", extList: []string{"v-abc", "y-yx"}, invalid: true, changed: true},
- {in: "en-v-c-abc", lang: "en", ext: "c-abc", invalid: true, changed: true},
- {in: "en-v-w-abc", lang: "en", ext: "w-abc", invalid: true, changed: true},
- {in: "en-v-x-abc", lang: "en", ext: "x-abc", invalid: true, changed: true},
- {in: "en-v-x-a", lang: "en", ext: "x-a", invalid: true, changed: true},
- {in: "en-9-aa-0-aa-z-bb-x-a", lang: "en", extList: []string{"0-aa", "9-aa", "z-bb", "x-a"}, changed: true},
- {in: "en-u-c", lang: "en", ext: "", invalid: true},
- {in: "en-u-co-phonebk", lang: "en", ext: "u-co-phonebk"},
- {in: "en-u-co-phonebk-ca", lang: "en", ext: "u-co-phonebk", invalid: true},
- {in: "en-u-nu-arabic-co-phonebk-ca", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-nu-arabic-co-phonebk-ca-x", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-nu-arabic-co-phonebk-ca-s", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-nu-arabic-co-phonebk-ca-a12345678", lang: "en", ext: "u-co-phonebk-nu-arabic", invalid: true, changed: true},
- {in: "en-u-co-phonebook", lang: "en", ext: "", invalid: true},
- {in: "en-u-co-phonebook-cu-xau", lang: "en", ext: "u-cu-xau", invalid: true, changed: true},
- {in: "en-Cyrl-u-co-phonebk", lang: "en", script: "Cyrl", ext: "u-co-phonebk"},
- {in: "en-US-u-co-phonebk", lang: "en", region: "US", ext: "u-co-phonebk"},
- {in: "en-US-u-co-phonebk-cu-xau", lang: "en", region: "US", ext: "u-co-phonebk-cu-xau"},
- {in: "en-scotland-u-co-phonebk", lang: "en", variants: "scotland", ext: "u-co-phonebk"},
- {in: "en-u-cu-xua-co-phonebk", lang: "en", ext: "u-co-phonebk-cu-xua", changed: true},
- {in: "en-u-def-abc-cu-xua-co-phonebk", lang: "en", ext: "u-abc-def-co-phonebk-cu-xua", changed: true},
- {in: "en-u-def-abc", lang: "en", ext: "u-abc-def", changed: true},
- {in: "en-u-cu-xua-co-phonebk-a-cd", lang: "en", extList: []string{"a-cd", "u-co-phonebk-cu-xua"}, changed: true},
- // Invalid "u" extension. Drop invalid parts.
- {in: "en-u-cu-co-phonebk", lang: "en", extList: []string{"u-co-phonebk"}, invalid: true, changed: true},
- {in: "en-u-cu-xau-co", lang: "en", extList: []string{"u-cu-xau"}, invalid: true},
- // We allow duplicate keys as the LDML spec does not explicitly prohibit it.
- // TODO: Consider eliminating duplicates and returning an error.
- {in: "en-u-cu-xau-co-phonebk-cu-xau", lang: "en", ext: "u-co-phonebk-cu-xau-cu-xau", changed: true},
- {in: "en-t-en-Cyrl-NL-fonipa", lang: "en", ext: "t-en-cyrl-nl-fonipa", changed: true},
- {in: "en-t-en-Cyrl-NL-fonipa-t0-abc-def", lang: "en", ext: "t-en-cyrl-nl-fonipa-t0-abc-def", changed: true},
- {in: "en-t-t0-abcd", lang: "en", ext: "t-t0-abcd"},
- // Not necessary to have changed here.
- {in: "en-t-nl-abcd", lang: "en", ext: "t-nl", invalid: true},
- {in: "en-t-nl-latn", lang: "en", ext: "t-nl-latn"},
- {in: "en-t-t0-abcd-x-a", lang: "en", extList: []string{"t-t0-abcd", "x-a"}},
- // invalid
- {in: "", lang: "und", invalid: true},
- {in: "-", lang: "und", invalid: true},
- {in: "x", lang: "und", invalid: true},
- {in: "x-", lang: "und", invalid: true},
- {in: "x--", lang: "und", invalid: true},
- {in: "a-a-b-c-d", lang: "und", invalid: true},
- {in: "en-", lang: "en", invalid: true},
- {in: "enne-", lang: "und", invalid: true},
- {in: "en.", lang: "und", invalid: true},
- {in: "en.-latn", lang: "und", invalid: true},
- {in: "en.-en", lang: "en", invalid: true},
- {in: "x-a-tooManyChars-c-d", ext: "x-a-c-d", invalid: true, changed: true},
- {in: "a-tooManyChars-c-d", lang: "und", invalid: true},
- // TODO: check key-value validity
- // { in: "en-u-cu-xd", lang: "en", ext: "u-cu-xd", invalid: true },
- {in: "en-t-abcd", lang: "en", invalid: true},
- {in: "en-Latn-US-en", lang: "en", script: "Latn", region: "US", invalid: true},
- // rewrites (more tests in TestGrandfathered)
- {in: "zh-min-nan", lang: "nan"},
- {in: "zh-yue", lang: "yue"},
- {in: "zh-xiang", lang: "hsn", rewrite: true},
- {in: "zh-guoyu", lang: "cmn", rewrite: true},
- {in: "iw", lang: "iw"},
- {in: "sgn-BE-FR", lang: "sfb", rewrite: true},
- {in: "i-klingon", lang: "tlh", rewrite: true},
- }
- for i, tt := range tests {
- tests[i].i = i
- if tt.extList != nil {
- tests[i].ext = strings.Join(tt.extList, "-")
- }
- if tt.ext != "" && tt.extList == nil {
- tests[i].extList = []string{tt.ext}
- }
- }
- return tests
-}
-
-func TestParseExtensions(t *testing.T) {
- for i, tt := range parseTests() {
- if tt.ext == "" || tt.rewrite {
- continue
- }
- scan := makeScannerString(tt.in)
- if len(scan.b) > 1 && scan.b[1] != '-' {
- scan.end = nextExtension(string(scan.b), 0)
- scan.next = scan.end + 1
- scan.scan()
- }
- start := scan.start
- scan.toLower(start, len(scan.b))
- parseExtensions(&scan)
- ext := string(scan.b[start:])
- if ext != tt.ext {
- t.Errorf("%d(%s): ext was %v; want %v", i, tt.in, ext, tt.ext)
- }
- if changed := !strings.HasPrefix(tt.in[start:], ext); changed != tt.changed {
- t.Errorf("%d(%s): changed was %v; want %v", i, tt.in, changed, tt.changed)
- }
- }
-}
-
-// partChecks runs checks for each part by calling the function returned by f.
-func partChecks(t *testing.T, f func(*parseTest) (Tag, bool)) {
- for i, tt := range parseTests() {
- tag, skip := f(&tt)
- if skip {
- continue
- }
- if l, _ := getLangID(b(tt.lang)); l != tag.lang {
- t.Errorf("%d: lang was %q; want %q", i, tag.lang, l)
- }
- if sc, _ := getScriptID(script, b(tt.script)); sc != tag.script {
- t.Errorf("%d: script was %q; want %q", i, tag.script, sc)
- }
- if r, _ := getRegionID(b(tt.region)); r != tag.region {
- t.Errorf("%d: region was %q; want %q", i, tag.region, r)
- }
- if tag.str == "" {
- continue
- }
- p := int(tag.pVariant)
- if p < int(tag.pExt) {
- p++
- }
- if s, g := tag.str[p:tag.pExt], tt.variants; s != g {
- t.Errorf("%d: variants was %q; want %q", i, s, g)
- }
- p = int(tag.pExt)
- if p > 0 && p < len(tag.str) {
- p++
- }
- if s, g := (tag.str)[p:], tt.ext; s != g {
- t.Errorf("%d: extensions were %q; want %q", i, s, g)
- }
- }
-}
-
-func TestParseTag(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- if strings.HasPrefix(tt.in, "x-") || tt.rewrite {
- return Tag{}, true
- }
- scan := makeScannerString(tt.in)
- id, end := parseTag(&scan)
- id.str = string(scan.b[:end])
- tt.ext = ""
- tt.extList = []string{}
- return id, false
- })
-}
-
-func TestParse(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- id, err := Raw.Parse(tt.in)
- ext := ""
- if id.str != "" {
- if strings.HasPrefix(id.str, "x-") {
- ext = id.str
- } else if int(id.pExt) < len(id.str) && id.pExt > 0 {
- ext = id.str[id.pExt+1:]
- }
- }
- if tag, _ := Raw.Parse(id.String()); tag.String() != id.String() {
- t.Errorf("%d:%s: reparse was %q; want %q", tt.i, tt.in, id.String(), tag.String())
- }
- if ext != tt.ext {
- t.Errorf("%d:%s: ext was %q; want %q", tt.i, tt.in, ext, tt.ext)
- }
- changed := id.str != "" && !strings.HasPrefix(tt.in, id.str)
- if changed != tt.changed {
- t.Errorf("%d:%s: changed was %v; want %v", tt.i, tt.in, changed, tt.changed)
- }
- if (err != nil) != tt.invalid {
- t.Errorf("%d:%s: invalid was %v; want %v. Error: %v", tt.i, tt.in, err != nil, tt.invalid, err)
- }
- return id, false
- })
-}
-
-func TestErrors(t *testing.T) {
- mkInvalid := func(s string) error {
- return mkErrInvalid([]byte(s))
- }
- tests := []struct {
- in string
- out error
- }{
- // invalid subtags.
- {"ac", mkInvalid("ac")},
- {"AC", mkInvalid("ac")},
- {"aa-Uuuu", mkInvalid("Uuuu")},
- {"aa-AB", mkInvalid("AB")},
- // ill-formed wins over invalid.
- {"ac-u", errSyntax},
- {"ac-u-ca", errSyntax},
- {"ac-u-ca-co-pinyin", errSyntax},
- {"noob", errSyntax},
- }
- for _, tt := range tests {
- _, err := Parse(tt.in)
- if err != tt.out {
- t.Errorf("%s: was %q; want %q", tt.in, err, tt.out)
- }
- }
-}
-
-func TestCompose1(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- l, _ := ParseBase(tt.lang)
- s, _ := ParseScript(tt.script)
- r, _ := ParseRegion(tt.region)
- v := []Variant{}
- for _, x := range strings.Split(tt.variants, "-") {
- p, _ := ParseVariant(x)
- v = append(v, p)
- }
- e := []Extension{}
- for _, x := range tt.extList {
- p, _ := ParseExtension(x)
- e = append(e, p)
- }
- id, _ = Raw.Compose(l, s, r, v, e)
- return id, false
- })
-}
-
-func TestCompose2(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- l, _ := ParseBase(tt.lang)
- s, _ := ParseScript(tt.script)
- r, _ := ParseRegion(tt.region)
- p := []interface{}{l, s, r, s, r, l}
- for _, x := range strings.Split(tt.variants, "-") {
- v, _ := ParseVariant(x)
- p = append(p, v)
- }
- for _, x := range tt.extList {
- e, _ := ParseExtension(x)
- p = append(p, e)
- }
- id, _ = Raw.Compose(p...)
- return id, false
- })
-}
-
-func TestCompose3(t *testing.T) {
- partChecks(t, func(tt *parseTest) (id Tag, skip bool) {
- id, _ = Raw.Parse(tt.in)
- id, _ = Raw.Compose(id)
- return id, false
- })
-}
-
-func mk(s string) Tag {
- return Raw.Make(s)
-}
-
-func TestParseAcceptLanguage(t *testing.T) {
- type res struct {
- t Tag
- q float32
- }
- en := []res{{mk("en"), 1.0}}
- tests := []struct {
- out []res
- in string
- ok bool
- }{
- {en, "en", true},
- {en, " en", true},
- {en, "en ", true},
- {en, " en ", true},
- {en, "en,", true},
- {en, ",en", true},
- {en, ",,,en,,,", true},
- {en, ",en;q=1", true},
-
- // We allow an empty input, contrary to spec.
- {nil, "", true},
- {[]res{{mk("aa"), 1}}, "aa;", true}, // allow unspecified weight
-
- // errors
- {nil, ";", false},
- {nil, "$", false},
- {nil, "e;", false},
- {nil, "x;", false},
- {nil, "x", false},
- {nil, "ac", false}, // non-existing language
- {nil, "aa;q", false},
- {nil, "aa;q=", false},
- {nil, "aa;q=.", false},
-
- // odd fallbacks
- {
- []res{{mk("en"), 0.1}},
- " english ;q=.1",
- true,
- },
- {
- []res{{mk("it"), 1.0}, {mk("de"), 1.0}, {mk("fr"), 1.0}},
- " italian, deutsch, french",
- true,
- },
-
- // lists
- {
- []res{{mk("en"), 0.1}},
- "en;q=.1",
- true,
- },
- {
- []res{{mk("mul"), 1.0}},
- "*",
- true,
- },
- {
- []res{{mk("en"), 1.0}, {mk("de"), 1.0}},
- "en,de",
- true,
- },
- {
- []res{{mk("en"), 1.0}, {mk("de"), .5}},
- "en,de;q=0.5",
- true,
- },
- {
- []res{{mk("de"), 0.8}, {mk("en"), 0.5}},
- " en ; q = 0.5 , , de;q=0.8",
- true,
- },
- {
- []res{{mk("en"), 1.0}, {mk("de"), 1.0}, {mk("fr"), 1.0}, {mk("tlh"), 1.0}},
- "en,de,fr,i-klingon",
- true,
- },
- // sorting
- {
- []res{{mk("tlh"), 0.4}, {mk("de"), 0.2}, {mk("fr"), 0.2}, {mk("en"), 0.1}},
- "en;q=0.1,de;q=0.2,fr;q=0.2,i-klingon;q=0.4",
- true,
- },
- // dropping
- {
- []res{{mk("fr"), 0.2}, {mk("en"), 0.1}},
- "en;q=0.1,de;q=0,fr;q=0.2,i-klingon;q=0.0",
- true,
- },
- }
- for i, tt := range tests {
- tags, qs, e := ParseAcceptLanguage(tt.in)
- if e == nil != tt.ok {
- t.Errorf("%d:%s:err: was %v; want %v", i, tt.in, e == nil, tt.ok)
- }
- for j, tag := range tags {
- if out := tt.out[j]; !tag.equalTags(out.t) || qs[j] != out.q {
- t.Errorf("%d:%s: was %s, %1f; want %s, %1f", i, tt.in, tag, qs[j], out.t, out.q)
- break
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog/catalog_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog/catalog_test.go
deleted file mode 100644
index 08bfdc7ce09..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog/catalog_test.go
+++ /dev/null
@@ -1,296 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package catalog
-
-import (
- "bytes"
- "path"
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/catmsg"
- "golang.org/x/text/language"
-)
-
-type entry struct {
- tag, key string
- msg interface{}
-}
-
-func langs(s string) []language.Tag {
- t, _, _ := language.ParseAcceptLanguage(s)
- return t
-}
-
-type testCase struct {
- desc string
- cat []entry
- lookup []entry
- fallback string
- match []string
- tags []language.Tag
-}
-
-var testCases = []testCase{{
- desc: "empty catalog",
- lookup: []entry{
- {"en", "key", ""},
- {"en", "", ""},
- {"nl", "", ""},
- },
- match: []string{
- "gr -> und",
- "en-US -> und",
- "af -> und",
- },
- tags: nil, // not an empty list.
-}, {
- desc: "one entry",
- cat: []entry{
- {"en", "hello", "Hello!"},
- },
- lookup: []entry{
- {"und", "hello", ""},
- {"nl", "hello", ""},
- {"en", "hello", "Hello!"},
- {"en-US", "hello", "Hello!"},
- {"en-GB", "hello", "Hello!"},
- {"en-oxendict", "hello", "Hello!"},
- {"en-oxendict-u-ms-metric", "hello", "Hello!"},
- },
- match: []string{
- "gr -> en",
- "en-US -> en",
- },
- tags: langs("en"),
-}, {
- desc: "hierarchical languages",
- cat: []entry{
- {"en", "hello", "Hello!"},
- {"en-GB", "hello", "Hellø!"},
- {"en-US", "hello", "Howdy!"},
- {"en", "greetings", "Greetings!"},
- {"gsw", "hello", "Grüetzi!"},
- },
- lookup: []entry{
- {"und", "hello", ""},
- {"nl", "hello", ""},
- {"en", "hello", "Hello!"},
- {"en-US", "hello", "Howdy!"},
- {"en-GB", "hello", "Hellø!"},
- {"en-oxendict", "hello", "Hello!"},
- {"en-US-oxendict-u-ms-metric", "hello", "Howdy!"},
-
- {"und", "greetings", ""},
- {"nl", "greetings", ""},
- {"en", "greetings", "Greetings!"},
- {"en-US", "greetings", "Greetings!"},
- {"en-GB", "greetings", "Greetings!"},
- {"en-oxendict", "greetings", "Greetings!"},
- {"en-US-oxendict-u-ms-metric", "greetings", "Greetings!"},
- },
- fallback: "gsw",
- match: []string{
- "gr -> gsw",
- "en-US -> en-US",
- },
- tags: langs("gsw, en, en-GB, en-US"),
-}, {
- desc: "variables",
- cat: []entry{
- {"en", "hello %s", []Message{
- Var("person", String("Jane")),
- String("Hello ${person}!"),
- }},
- {"en", "hello error", []Message{
- Var("person", String("Jane")),
- noMatchMessage{}, // trigger sequence path.
- String("Hello ${person."),
- }},
- {"en", "fallback to var value", []Message{
- Var("you", noMatchMessage{}, noMatchMessage{}),
- String("Hello ${you}."),
- }},
- {"en", "scopes", []Message{
- Var("person1", String("Mark")),
- Var("person2", String("Jane")),
- Var("couple",
- Var("person1", String("Joe")),
- String("${person1} and ${person2}")),
- String("Hello ${couple}."),
- }},
- {"en", "missing var", String("Hello ${missing}.")},
- },
- lookup: []entry{
- {"en", "hello %s", "Hello Jane!"},
- {"en", "hello error", "Hello $!(MISSINGBRACE)"},
- {"en", "fallback to var value", "Hello you."},
- {"en", "scopes", "Hello Joe and Jane."},
- {"en", "missing var", "Hello missing."},
- },
- tags: langs("en"),
-}, {
- desc: "macros",
- cat: []entry{
- {"en", "macro1", String("Hello ${macro1(1)}.")},
- {"en", "macro2", String("Hello ${ macro1(2) }!")},
- {"en", "macroWS", String("Hello ${ macro1( 2 ) }!")},
- {"en", "missing", String("Hello ${ missing(1 }.")},
- {"en", "badnum", String("Hello ${ badnum(1b) }.")},
- {"en", "undefined", String("Hello ${ undefined(1) }.")},
- {"en", "macroU", String("Hello ${ macroU(2) }!")},
- },
- lookup: []entry{
- {"en", "macro1", "Hello Joe."},
- {"en", "macro2", "Hello Joe!"},
- {"en-US", "macroWS", "Hello Joe!"},
- {"en-NL", "missing", "Hello $!(MISSINGPAREN)."},
- {"en", "badnum", "Hello $!(BADNUM)."},
- {"en", "undefined", "Hello undefined."},
- {"en", "macroU", "Hello macroU!"},
- },
- tags: langs("en"),
-}}
-
-func setMacros(b *Builder) {
- b.SetMacro(language.English, "macro1", String("Joe"))
- b.SetMacro(language.Und, "macro2", String("${macro1(1)}"))
- b.SetMacro(language.English, "macroU", noMatchMessage{})
-}
-
-type buildFunc func(t *testing.T, tc testCase) Catalog
-
-func initBuilder(t *testing.T, tc testCase) Catalog {
- options := []Option{}
- if tc.fallback != "" {
- options = append(options, Fallback(language.MustParse(tc.fallback)))
- }
- cat := NewBuilder(options...)
- for _, e := range tc.cat {
- tag := language.MustParse(e.tag)
- switch msg := e.msg.(type) {
- case string:
-
- cat.SetString(tag, e.key, msg)
- case Message:
- cat.Set(tag, e.key, msg)
- case []Message:
- cat.Set(tag, e.key, msg...)
- }
- }
- setMacros(cat)
- return cat
-}
-
-type dictionary map[string]string
-
-func (d dictionary) Lookup(key string) (data string, ok bool) {
- data, ok = d[key]
- return data, ok
-}
-
-func initCatalog(t *testing.T, tc testCase) Catalog {
- m := map[string]Dictionary{}
- for _, e := range tc.cat {
- m[e.tag] = dictionary{}
- }
- for _, e := range tc.cat {
- var msg Message
- switch x := e.msg.(type) {
- case string:
- msg = String(x)
- case Message:
- msg = x
- case []Message:
- msg = firstInSequence(x)
- }
- data, _ := catmsg.Compile(language.MustParse(e.tag), nil, msg)
- m[e.tag].(dictionary)[e.key] = data
- }
- options := []Option{}
- if tc.fallback != "" {
- options = append(options, Fallback(language.MustParse(tc.fallback)))
- }
- c, err := NewFromMap(m, options...)
- if err != nil {
- t.Fatal(err)
- }
- // TODO: implement macros for fixed catalogs.
- b := NewBuilder()
- setMacros(b)
- c.(*catalog).macros.index = b.macros.index
- return c
-}
-
-func TestMatcher(t *testing.T) {
- test := func(t *testing.T, init buildFunc) {
- for _, tc := range testCases {
- for _, s := range tc.match {
- a := strings.Split(s, "->")
- t.Run(path.Join(tc.desc, a[0]), func(t *testing.T) {
- cat := init(t, tc)
- got, _ := language.MatchStrings(cat.Matcher(), a[0])
- want := language.MustParse(strings.TrimSpace(a[1]))
- if got != want {
- t.Errorf("got %q; want %q", got, want)
- }
- })
- }
- }
- }
- t.Run("Builder", func(t *testing.T) { test(t, initBuilder) })
- t.Run("Catalog", func(t *testing.T) { test(t, initCatalog) })
-}
-
-func TestCatalog(t *testing.T) {
- test := func(t *testing.T, init buildFunc) {
- for _, tc := range testCases {
- cat := init(t, tc)
- wantTags := tc.tags
- if got := cat.Languages(); !reflect.DeepEqual(got, wantTags) {
- t.Errorf("%s:Languages: got %v; want %v", tc.desc, got, wantTags)
- }
-
- for _, e := range tc.lookup {
- t.Run(path.Join(tc.desc, e.tag, e.key), func(t *testing.T) {
- tag := language.MustParse(e.tag)
- buf := testRenderer{}
- ctx := cat.Context(tag, &buf)
- want := e.msg.(string)
- err := ctx.Execute(e.key)
- gotFound := err != ErrNotFound
- wantFound := want != ""
- if gotFound != wantFound {
- t.Fatalf("err: got %v (%v); want %v", gotFound, err, wantFound)
- }
- if got := buf.buf.String(); got != want {
- t.Errorf("Lookup:\ngot %q\nwant %q", got, want)
- }
- })
- }
- }
- }
- t.Run("Builder", func(t *testing.T) { test(t, initBuilder) })
- t.Run("Catalog", func(t *testing.T) { test(t, initCatalog) })
-}
-
-type testRenderer struct {
- buf bytes.Buffer
-}
-
-func (f *testRenderer) Arg(i int) interface{} { return nil }
-func (f *testRenderer) Render(s string) { f.buf.WriteString(s) }
-
-var msgNoMatch = catmsg.Register("no match", func(d *catmsg.Decoder) bool {
- return false // no match
-})
-
-type noMatchMessage struct{}
-
-func (noMatchMessage) Compile(e *catmsg.Encoder) error {
- e.EncodeMessageType(msgNoMatch)
- return catmsg.ErrIncomplete
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog_test.go
deleted file mode 100644
index 7a2301c0eb5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/catalog_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package message
-
-import (
- "strings"
- "testing"
-
- "golang.org/x/text/language"
- "golang.org/x/text/message/catalog"
-)
-
-func TestMatchLanguage(t *testing.T) {
- c := catalog.NewBuilder(catalog.Fallback(language.English))
- c.SetString(language.Bengali, "", "")
- c.SetString(language.English, "", "")
- c.SetString(language.German, "", "")
-
- testCases := []struct {
- args string // '|'-separated list
- want string
- }{{
- args: "de-CH",
- want: "de",
- }, {
- args: "bn-u-nu-latn|en-US,en;q=0.9,de;q=0.8,nl;q=0.7",
- want: "bn-u-nu-latn",
- }, {
- args: "gr",
- want: "en",
- }}
- for _, tc := range testCases {
- DefaultCatalog = c
- t.Run(tc.args, func(t *testing.T) {
- got := MatchLanguage(strings.Split(tc.args, "|")...)
- if got != language.Make(tc.want) {
- t.Errorf("got %q; want %q", got, tc.want)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/examples_test.go
deleted file mode 100644
index c73eaf90b35..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/examples_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package message_test
-
-import (
- "net/http"
-
- "golang.org/x/text/language"
- "golang.org/x/text/message"
-)
-
-func Example_http() {
- // languages supported by this service:
- matcher := language.NewMatcher(message.DefaultCatalog.Languages())
-
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- lang, _ := r.Cookie("lang")
- accept := r.Header.Get("Accept-Language")
- fallback := "en"
- tag, _ := language.MatchStrings(matcher, lang.String(), accept, fallback)
-
- p := message.NewPrinter(tag)
-
- p.Fprintln(w, "User language is", tag)
- })
-}
-
-func ExamplePrinter_numbers() {
- for _, lang := range []string{"en", "de", "de-CH", "fr", "bn"} {
- p := message.NewPrinter(language.Make(lang))
- p.Printf("%-6s %g\n", lang, 123456.78)
- }
-
- // Output:
- // en 123,456.78
- // de 123.456,78
- // de-CH 123’456.78
- // fr 123 456,78
- // bn ১,২৩,৪৫৬.৭৮
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/fmt_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/fmt_test.go
deleted file mode 100644
index 2d6872bf888..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/fmt_test.go
+++ /dev/null
@@ -1,1871 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package message
-
-import (
- "bytes"
- "fmt"
- "io"
- "math"
- "reflect"
- "runtime"
- "strings"
- "testing"
- "time"
-
- "golang.org/x/text/language"
-)
-
-type (
- renamedBool bool
- renamedInt int
- renamedInt8 int8
- renamedInt16 int16
- renamedInt32 int32
- renamedInt64 int64
- renamedUint uint
- renamedUint8 uint8
- renamedUint16 uint16
- renamedUint32 uint32
- renamedUint64 uint64
- renamedUintptr uintptr
- renamedString string
- renamedBytes []byte
- renamedFloat32 float32
- renamedFloat64 float64
- renamedComplex64 complex64
- renamedComplex128 complex128
-)
-
-func TestFmtInterface(t *testing.T) {
- p := NewPrinter(language.Und)
- var i1 interface{}
- i1 = "abc"
- s := p.Sprintf("%s", i1)
- if s != "abc" {
- t.Errorf(`Sprintf("%%s", empty("abc")) = %q want %q`, s, "abc")
- }
-}
-
-var (
- NaN = math.NaN()
- posInf = math.Inf(1)
- negInf = math.Inf(-1)
-
- intVar = 0
-
- array = [5]int{1, 2, 3, 4, 5}
- iarray = [4]interface{}{1, "hello", 2.5, nil}
- slice = array[:]
- islice = iarray[:]
-)
-
-type A struct {
- i int
- j uint
- s string
- x []int
-}
-
-type I int
-
-func (i I) String() string {
- p := NewPrinter(language.Und)
- return p.Sprintf("<%d>", int(i))
-}
-
-type B struct {
- I I
- j int
-}
-
-type C struct {
- i int
- B
-}
-
-type F int
-
-func (f F) Format(s fmt.State, c rune) {
- p := NewPrinter(language.Und)
- p.Fprintf(s, "<%c=F(%d)>", c, int(f))
-}
-
-type G int
-
-func (g G) GoString() string {
- p := NewPrinter(language.Und)
- return p.Sprintf("GoString(%d)", int(g))
-}
-
-type S struct {
- F F // a struct field that Formats
- G G // a struct field that GoStrings
-}
-
-type SI struct {
- I interface{}
-}
-
-// P is a type with a String method with pointer receiver for testing %p.
-type P int
-
-var pValue P
-
-func (p *P) String() string {
- return "String(p)"
-}
-
-var barray = [5]renamedUint8{1, 2, 3, 4, 5}
-var bslice = barray[:]
-
-type byteStringer byte
-
-func (byteStringer) String() string {
- return "X"
-}
-
-var byteStringerSlice = []byteStringer{'h', 'e', 'l', 'l', 'o'}
-
-type byteFormatter byte
-
-func (byteFormatter) Format(f fmt.State, _ rune) {
- p := NewPrinter(language.Und)
- p.Fprint(f, "X")
-}
-
-var byteFormatterSlice = []byteFormatter{'h', 'e', 'l', 'l', 'o'}
-
-var fmtTests = []struct {
- fmt string
- val interface{}
- out string
-}{
- // The behavior of the following tests differs from that of the fmt package.
-
- // Unlike with the fmt package, it is okay to have extra arguments for
- // strings without format parameters. This is because it is impossible to
- // distinguish between reordered or ordered format strings in this case.
- // (For reordered format strings it is okay to not use arguments.)
- {"", nil, ""},
- {"", 2, ""},
- {"no args", "hello", "no args"},
-
- {"%017091901790959340919092959340919017929593813360", 0, "%!(NOVERB)"},
- {"%184467440737095516170v", 0, "%!(NOVERB)"},
- // Extra argument errors should format without flags set.
- {"%010.2", "12345", "%!(NOVERB)"},
-
- // Some key other differences, asides from localized values:
- // - NaN values should not use affixes; so no signs (CLDR requirement)
- // - Infinity uses patterns, so signs may be different (CLDR requirement)
- // - The # flag is used to disable localization.
-
- // All following tests are analogous to those of the fmt package, but with
- // localized numbers when appropriate.
- {"%d", 12345, "12,345"},
- {"%v", 12345, "12,345"},
- {"%t", true, "true"},
-
- // basic string
- {"%s", "abc", "abc"},
- {"%q", "abc", `"abc"`},
- {"%x", "abc", "616263"},
- {"%x", "\xff\xf0\x0f\xff", "fff00fff"},
- {"%X", "\xff\xf0\x0f\xff", "FFF00FFF"},
- {"%x", "", ""},
- {"% x", "", ""},
- {"%#x", "", ""},
- {"%# x", "", ""},
- {"%x", "xyz", "78797a"},
- {"%X", "xyz", "78797A"},
- {"% x", "xyz", "78 79 7a"},
- {"% X", "xyz", "78 79 7A"},
- {"%#x", "xyz", "0x78797a"},
- {"%#X", "xyz", "0X78797A"},
- {"%# x", "xyz", "0x78 0x79 0x7a"},
- {"%# X", "xyz", "0X78 0X79 0X7A"},
-
- // basic bytes
- {"%s", []byte("abc"), "abc"},
- {"%s", [3]byte{'a', 'b', 'c'}, "abc"},
- {"%s", &[3]byte{'a', 'b', 'c'}, "&abc"},
- {"%q", []byte("abc"), `"abc"`},
- {"%x", []byte("abc"), "616263"},
- {"%x", []byte("\xff\xf0\x0f\xff"), "fff00fff"},
- {"%X", []byte("\xff\xf0\x0f\xff"), "FFF00FFF"},
- {"%x", []byte(""), ""},
- {"% x", []byte(""), ""},
- {"%#x", []byte(""), ""},
- {"%# x", []byte(""), ""},
- {"%x", []byte("xyz"), "78797a"},
- {"%X", []byte("xyz"), "78797A"},
- {"% x", []byte("xyz"), "78 79 7a"},
- {"% X", []byte("xyz"), "78 79 7A"},
- {"%#x", []byte("xyz"), "0x78797a"},
- {"%#X", []byte("xyz"), "0X78797A"},
- {"%# x", []byte("xyz"), "0x78 0x79 0x7a"},
- {"%# X", []byte("xyz"), "0X78 0X79 0X7A"},
-
- // escaped strings
- {"%q", "", `""`},
- {"%#q", "", "``"},
- {"%q", "\"", `"\""`},
- {"%#q", "\"", "`\"`"},
- {"%q", "`", `"` + "`" + `"`},
- {"%#q", "`", `"` + "`" + `"`},
- {"%q", "\n", `"\n"`},
- {"%#q", "\n", `"\n"`},
- {"%q", `\n`, `"\\n"`},
- {"%#q", `\n`, "`\\n`"},
- {"%q", "abc", `"abc"`},
- {"%#q", "abc", "`abc`"},
- {"%q", "日本語", `"日本語"`},
- {"%+q", "日本語", `"\u65e5\u672c\u8a9e"`},
- {"%#q", "日本語", "`日本語`"},
- {"%#+q", "日本語", "`日本語`"},
- {"%q", "\a\b\f\n\r\t\v\"\\", `"\a\b\f\n\r\t\v\"\\"`},
- {"%+q", "\a\b\f\n\r\t\v\"\\", `"\a\b\f\n\r\t\v\"\\"`},
- {"%#q", "\a\b\f\n\r\t\v\"\\", `"\a\b\f\n\r\t\v\"\\"`},
- {"%#+q", "\a\b\f\n\r\t\v\"\\", `"\a\b\f\n\r\t\v\"\\"`},
- {"%q", "☺", `"☺"`},
- {"% q", "☺", `"☺"`}, // The space modifier should have no effect.
- {"%+q", "☺", `"\u263a"`},
- {"%#q", "☺", "`☺`"},
- {"%#+q", "☺", "`☺`"},
- {"%10q", "⌘", ` "⌘"`},
- {"%+10q", "⌘", ` "\u2318"`},
- {"%-10q", "⌘", `"⌘" `},
- {"%+-10q", "⌘", `"\u2318" `},
- {"%010q", "⌘", `0000000"⌘"`},
- {"%+010q", "⌘", `00"\u2318"`},
- {"%-010q", "⌘", `"⌘" `}, // 0 has no effect when - is present.
- {"%+-010q", "⌘", `"\u2318" `},
- {"%#8q", "\n", ` "\n"`},
- {"%#+8q", "\r", ` "\r"`},
- {"%#-8q", "\t", "` ` "},
- {"%#+-8q", "\b", `"\b" `},
- {"%q", "abc\xffdef", `"abc\xffdef"`},
- {"%+q", "abc\xffdef", `"abc\xffdef"`},
- {"%#q", "abc\xffdef", `"abc\xffdef"`},
- {"%#+q", "abc\xffdef", `"abc\xffdef"`},
- // Runes that are not printable.
- {"%q", "\U0010ffff", `"\U0010ffff"`},
- {"%+q", "\U0010ffff", `"\U0010ffff"`},
- {"%#q", "\U0010ffff", "`􏿿`"},
- {"%#+q", "\U0010ffff", "`􏿿`"},
- // Runes that are not valid.
- {"%q", string(0x110000), `"�"`},
- {"%+q", string(0x110000), `"\ufffd"`},
- {"%#q", string(0x110000), "`�`"},
- {"%#+q", string(0x110000), "`�`"},
-
- // characters
- {"%c", uint('x'), "x"},
- {"%c", 0xe4, "ä"},
- {"%c", 0x672c, "本"},
- {"%c", '日', "日"},
- {"%.0c", '⌘', "⌘"}, // Specifying precision should have no effect.
- {"%3c", '⌘', " ⌘"},
- {"%-3c", '⌘', "⌘ "},
- // Runes that are not printable.
- {"%c", '\U00000e00', "\u0e00"},
- {"%c", '\U0010ffff', "\U0010ffff"},
- // Runes that are not valid.
- {"%c", -1, "�"},
- {"%c", 0xDC80, "�"},
- {"%c", rune(0x110000), "�"},
- {"%c", int64(0xFFFFFFFFF), "�"},
- {"%c", uint64(0xFFFFFFFFF), "�"},
-
- // escaped characters
- {"%q", uint(0), `'\x00'`},
- {"%+q", uint(0), `'\x00'`},
- {"%q", '"', `'"'`},
- {"%+q", '"', `'"'`},
- {"%q", '\'', `'\''`},
- {"%+q", '\'', `'\''`},
- {"%q", '`', "'`'"},
- {"%+q", '`', "'`'"},
- {"%q", 'x', `'x'`},
- {"%+q", 'x', `'x'`},
- {"%q", 'ÿ', `'ÿ'`},
- {"%+q", 'ÿ', `'\u00ff'`},
- {"%q", '\n', `'\n'`},
- {"%+q", '\n', `'\n'`},
- {"%q", '☺', `'☺'`},
- {"%+q", '☺', `'\u263a'`},
- {"% q", '☺', `'☺'`}, // The space modifier should have no effect.
- {"%.0q", '☺', `'☺'`}, // Specifying precision should have no effect.
- {"%10q", '⌘', ` '⌘'`},
- {"%+10q", '⌘', ` '\u2318'`},
- {"%-10q", '⌘', `'⌘' `},
- {"%+-10q", '⌘', `'\u2318' `},
- {"%010q", '⌘', `0000000'⌘'`},
- {"%+010q", '⌘', `00'\u2318'`},
- {"%-010q", '⌘', `'⌘' `}, // 0 has no effect when - is present.
- {"%+-010q", '⌘', `'\u2318' `},
- // Runes that are not printable.
- {"%q", '\U00000e00', `'\u0e00'`},
- {"%q", '\U0010ffff', `'\U0010ffff'`},
- // Runes that are not valid.
- {"%q", int32(-1), "%!q(int32=-1)"},
- {"%q", 0xDC80, `'�'`},
- {"%q", rune(0x110000), "%!q(int32=1,114,112)"},
- {"%q", int64(0xFFFFFFFFF), "%!q(int64=68,719,476,735)"},
- {"%q", uint64(0xFFFFFFFFF), "%!q(uint64=68,719,476,735)"},
-
- // width
- {"%5s", "abc", " abc"},
- {"%2s", "\u263a", " ☺"},
- {"%-5s", "abc", "abc "},
- {"%-8q", "abc", `"abc" `},
- {"%05s", "abc", "00abc"},
- {"%08q", "abc", `000"abc"`},
- {"%5s", "abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"},
- {"%.5s", "abcdefghijklmnopqrstuvwxyz", "abcde"},
- {"%.0s", "日本語日本語", ""},
- {"%.5s", "日本語日本語", "日本語日本"},
- {"%.10s", "日本語日本語", "日本語日本語"},
- {"%.5s", []byte("日本語日本語"), "日本語日本"},
- {"%.5q", "abcdefghijklmnopqrstuvwxyz", `"abcde"`},
- {"%.5x", "abcdefghijklmnopqrstuvwxyz", "6162636465"},
- {"%.5q", []byte("abcdefghijklmnopqrstuvwxyz"), `"abcde"`},
- {"%.5x", []byte("abcdefghijklmnopqrstuvwxyz"), "6162636465"},
- {"%.3q", "日本語日本語", `"日本語"`},
- {"%.3q", []byte("日本語日本語"), `"日本語"`},
- {"%.1q", "日本語", `"日"`},
- {"%.1q", []byte("日本語"), `"日"`},
- {"%.1x", "日本語", "e6"},
- {"%.1X", []byte("日本語"), "E6"},
- {"%10.1q", "日本語日本語", ` "日"`},
- {"%10v", nil, " <nil>"},
- {"%-10v", nil, "<nil> "},
-
- // integers
- {"%d", uint(12345), "12,345"},
- {"%d", int(-12345), "-12,345"},
- {"%d", ^uint8(0), "255"},
- {"%d", ^uint16(0), "65,535"},
- {"%d", ^uint32(0), "4,294,967,295"},
- {"%d", ^uint64(0), "18,446,744,073,709,551,615"},
- {"%d", int8(-1 << 7), "-128"},
- {"%d", int16(-1 << 15), "-32,768"},
- {"%d", int32(-1 << 31), "-2,147,483,648"},
- {"%d", int64(-1 << 63), "-9,223,372,036,854,775,808"},
- {"%.d", 0, ""},
- {"%.0d", 0, ""},
- {"%6.0d", 0, " "},
- {"%06.0d", 0, " "},
- {"% d", 12345, " 12,345"},
- {"%+d", 12345, "+12,345"},
- {"%+d", -12345, "-12,345"},
- {"%b", 7, "111"},
- {"%b", -6, "-110"},
- {"%b", ^uint32(0), "11111111111111111111111111111111"},
- {"%b", ^uint64(0), "1111111111111111111111111111111111111111111111111111111111111111"},
- {"%b", int64(-1 << 63), zeroFill("-1", 63, "")},
- {"%o", 01234, "1234"},
- {"%#o", 01234, "01234"},
- {"%o", ^uint32(0), "37777777777"},
- {"%o", ^uint64(0), "1777777777777777777777"},
- {"%#X", 0, "0X0"},
- {"%x", 0x12abcdef, "12abcdef"},
- {"%X", 0x12abcdef, "12ABCDEF"},
- {"%x", ^uint32(0), "ffffffff"},
- {"%X", ^uint64(0), "FFFFFFFFFFFFFFFF"},
- {"%.20b", 7, "00000000000000000111"},
- {"%10d", 12345, " 12,345"},
- {"%10d", -12345, " -12,345"},
- {"%+10d", 12345, " +12,345"},
- {"%010d", 12345, "0,000,012,345"},
- {"%010d", -12345, "-0,000,012,345"},
- {"%20.8d", 1234, " 00,001,234"},
- {"%20.8d", -1234, " -00,001,234"},
- {"%020.8d", 1234, " 00,001,234"},
- {"%020.8d", -1234, " -00,001,234"},
- {"%-20.8d", 1234, "00,001,234 "},
- {"%-20.8d", -1234, "-00,001,234 "},
- {"%-#20.8x", 0x1234abc, "0x01234abc "},
- {"%-#20.8X", 0x1234abc, "0X01234ABC "},
- {"%-#20.8o", 01234, "00001234 "},
-
- // Test correct f.intbuf overflow checks.
- {"%068d", 1, "00," + strings.Repeat("000,", 21) + "001"},
- {"%068d", -1, "-00," + strings.Repeat("000,", 21) + "001"},
- {"%#.68x", 42, zeroFill("0x", 68, "2a")},
- {"%.68d", -42, "-00," + strings.Repeat("000,", 21) + "042"},
- {"%+.68d", 42, "+00," + strings.Repeat("000,", 21) + "042"},
- {"% .68d", 42, " 00," + strings.Repeat("000,", 21) + "042"},
- {"% +.68d", 42, "+00," + strings.Repeat("000,", 21) + "042"},
-
- // unicode format
- {"%U", 0, "U+0000"},
- {"%U", -1, "U+FFFFFFFFFFFFFFFF"},
- {"%U", '\n', `U+000A`},
- {"%#U", '\n', `U+000A`},
- {"%+U", 'x', `U+0078`}, // Plus flag should have no effect.
- {"%# U", 'x', `U+0078 'x'`}, // Space flag should have no effect.
- {"%#.2U", 'x', `U+0078 'x'`}, // Precisions below 4 should print 4 digits.
- {"%U", '\u263a', `U+263A`},
- {"%#U", '\u263a', `U+263A '☺'`},
- {"%U", '\U0001D6C2', `U+1D6C2`},
- {"%#U", '\U0001D6C2', `U+1D6C2 '𝛂'`},
- {"%#14.6U", '⌘', " U+002318 '⌘'"},
- {"%#-14.6U", '⌘', "U+002318 '⌘' "},
- {"%#014.6U", '⌘', " U+002318 '⌘'"},
- {"%#-014.6U", '⌘', "U+002318 '⌘' "},
- {"%.68U", uint(42), zeroFill("U+", 68, "2A")},
- {"%#.68U", '日', zeroFill("U+", 68, "65E5") + " '日'"},
-
- // floats
- {"%+.3e", 0.0, "+0.000\u202f×\u202f10⁰⁰"},
- {"%+.3e", 1.0, "+1.000\u202f×\u202f10⁰⁰"},
- {"%+.3f", -1.0, "-1.000"},
- {"%+.3F", -1.0, "-1.000"},
- {"%+.3F", float32(-1.0), "-1.000"},
- {"%+07.2f", 1.0, "+001.00"},
- {"%+07.2f", -1.0, "-001.00"},
- {"%-07.2f", 1.0, "1.00 "},
- {"%-07.2f", -1.0, "-1.00 "},
- {"%+-07.2f", 1.0, "+1.00 "},
- {"%+-07.2f", -1.0, "-1.00 "},
- {"%-+07.2f", 1.0, "+1.00 "},
- {"%-+07.2f", -1.0, "-1.00 "},
- {"%+10.2f", +1.0, " +1.00"},
- {"%+10.2f", -1.0, " -1.00"},
- {"% .3E", -1.0, "-1.000\u202f×\u202f10⁰⁰"},
- {"% .3e", 1.0, " 1.000\u202f×\u202f10⁰⁰"},
- {"%+.3g", 0.0, "+0"},
- {"%+.3g", 1.0, "+1"},
- {"%+.3g", -1.0, "-1"},
- {"% .3g", -1.0, "-1"},
- {"% .3g", 1.0, " 1"},
- {"%b", float32(1.0), "8388608p-23"},
- {"%b", 1.0, "4503599627370496p-52"},
- // Test sharp flag used with floats.
- {"%#g", 1e-323, "1.00000e-323"},
- {"%#g", -1.0, "-1.00000"},
- {"%#g", 1.1, "1.10000"},
- {"%#g", 123456.0, "123456."},
- {"%#g", 1234567.0, "1.234567e+06"},
- {"%#g", 1230000.0, "1.23000e+06"},
- {"%#g", 1000000.0, "1.00000e+06"},
- {"%#.0f", 1.0, "1."},
- {"%#.0e", 1.0, "1.e+00"},
- {"%#.0g", 1.0, "1."},
- {"%#.0g", 1100000.0, "1.e+06"},
- {"%#.4f", 1.0, "1.0000"},
- {"%#.4e", 1.0, "1.0000e+00"},
- {"%#.4g", 1.0, "1.000"},
- {"%#.4g", 100000.0, "1.000e+05"},
- {"%#.0f", 123.0, "123."},
- {"%#.0e", 123.0, "1.e+02"},
- {"%#.0g", 123.0, "1.e+02"},
- {"%#.4f", 123.0, "123.0000"},
- {"%#.4e", 123.0, "1.2300e+02"},
- {"%#.4g", 123.0, "123.0"},
- {"%#.4g", 123000.0, "1.230e+05"},
- {"%#9.4g", 1.0, " 1.000"},
- // The sharp flag has no effect for binary float format.
- {"%#b", 1.0, "4503599627370496p-52"},
- // Precision has no effect for binary float format.
- {"%.4b", float32(1.0), "8388608p-23"},
- {"%.4b", -1.0, "-4503599627370496p-52"},
- // Test correct f.intbuf boundary checks.
- {"%.68f", 1.0, zeroFill("1.", 68, "")},
- {"%.68f", -1.0, zeroFill("-1.", 68, "")},
- // float infinites and NaNs
- {"%f", posInf, "∞"},
- {"%.1f", negInf, "-∞"},
- {"% f", NaN, "NaN"},
- {"%20f", posInf, " ∞"},
- {"% 20F", posInf, " ∞"},
- {"% 20e", negInf, " -∞"},
- {"%+20E", negInf, " -∞"},
- {"% +20g", negInf, " -∞"},
- {"%+-20G", posInf, "+∞ "},
- {"%20e", NaN, " NaN"},
- {"% +20E", NaN, " NaN"},
- {"% -20g", NaN, "NaN "},
- {"%+-20G", NaN, "NaN "},
- // Zero padding does not apply to infinities and NaN.
- {"%+020e", posInf, " +∞"},
- {"%-020f", negInf, "-∞ "},
- {"%-020E", NaN, "NaN "},
-
- // complex values
- {"%.f", 0i, "(0+0i)"},
- {"% .f", 0i, "( 0+0i)"},
- {"%+.f", 0i, "(+0+0i)"},
- {"% +.f", 0i, "(+0+0i)"},
- {"%+.3e", 0i, "(+0.000\u202f×\u202f10⁰⁰+0.000\u202f×\u202f10⁰⁰i)"},
- {"%+.3f", 0i, "(+0.000+0.000i)"},
- {"%+.3g", 0i, "(+0+0i)"},
- {"%+.3e", 1 + 2i, "(+1.000\u202f×\u202f10⁰⁰+2.000\u202f×\u202f10⁰⁰i)"},
- {"%+.3f", 1 + 2i, "(+1.000+2.000i)"},
- {"%+.3g", 1 + 2i, "(+1+2i)"},
- {"%.3e", 0i, "(0.000\u202f×\u202f10⁰⁰+0.000\u202f×\u202f10⁰⁰i)"},
- {"%.3f", 0i, "(0.000+0.000i)"},
- {"%.3F", 0i, "(0.000+0.000i)"},
- {"%.3F", complex64(0i), "(0.000+0.000i)"},
- {"%.3g", 0i, "(0+0i)"},
- {"%.3e", 1 + 2i, "(1.000\u202f×\u202f10⁰⁰+2.000\u202f×\u202f10⁰⁰i)"},
- {"%.3f", 1 + 2i, "(1.000+2.000i)"},
- {"%.3g", 1 + 2i, "(1+2i)"},
- {"%.3e", -1 - 2i, "(-1.000\u202f×\u202f10⁰⁰-2.000\u202f×\u202f10⁰⁰i)"},
- {"%.3f", -1 - 2i, "(-1.000-2.000i)"},
- {"%.3g", -1 - 2i, "(-1-2i)"},
- {"% .3E", -1 - 2i, "(-1.000\u202f×\u202f10⁰⁰-2.000\u202f×\u202f10⁰⁰i)"},
- {"%+.3g", 1 + 2i, "(+1+2i)"},
- {"%+.3g", complex64(1 + 2i), "(+1+2i)"},
- {"%#g", 1 + 2i, "(1.00000+2.00000i)"},
- {"%#g", 123456 + 789012i, "(123456.+789012.i)"},
- {"%#g", 1e-10i, "(0.00000+1.00000e-10i)"},
- {"%#g", -1e10 - 1.11e100i, "(-1.00000e+10-1.11000e+100i)"},
- {"%#.0f", 1.23 + 1.0i, "(1.+1.i)"},
- {"%#.0e", 1.23 + 1.0i, "(1.e+00+1.e+00i)"},
- {"%#.0g", 1.23 + 1.0i, "(1.+1.i)"},
- {"%#.0g", 0 + 100000i, "(0.+1.e+05i)"},
- {"%#.0g", 1230000 + 0i, "(1.e+06+0.i)"},
- {"%#.4f", 1 + 1.23i, "(1.0000+1.2300i)"},
- {"%#.4e", 123 + 1i, "(1.2300e+02+1.0000e+00i)"},
- {"%#.4g", 123 + 1.23i, "(123.0+1.230i)"},
- {"%#12.5g", 0 + 100000i, "( 0.0000 +1.0000e+05i)"},
- {"%#12.5g", 1230000 - 0i, "( 1.2300e+06 +0.0000i)"},
- {"%b", 1 + 2i, "(4503599627370496p-52+4503599627370496p-51i)"},
- {"%b", complex64(1 + 2i), "(8388608p-23+8388608p-22i)"},
- // The sharp flag has no effect for binary complex format.
- {"%#b", 1 + 2i, "(4503599627370496p-52+4503599627370496p-51i)"},
- // Precision has no effect for binary complex format.
- {"%.4b", 1 + 2i, "(4503599627370496p-52+4503599627370496p-51i)"},
- {"%.4b", complex64(1 + 2i), "(8388608p-23+8388608p-22i)"},
- // complex infinites and NaNs
- {"%f", complex(posInf, posInf), "(∞+∞i)"},
- {"%f", complex(negInf, negInf), "(-∞-∞i)"},
- {"%f", complex(NaN, NaN), "(NaN+NaNi)"},
- {"%.1f", complex(posInf, posInf), "(∞+∞i)"},
- {"% f", complex(posInf, posInf), "( ∞+∞i)"},
- {"% f", complex(negInf, negInf), "(-∞-∞i)"},
- {"% f", complex(NaN, NaN), "(NaN+NaNi)"},
- {"%8e", complex(posInf, posInf), "( ∞ +∞i)"},
- {"% 8E", complex(posInf, posInf), "( ∞ +∞i)"},
- {"%+8f", complex(negInf, negInf), "( -∞ -∞i)"},
- {"% +8g", complex(negInf, negInf), "( -∞ -∞i)"}, // TODO(g)
- {"% -8G", complex(NaN, NaN), "(NaN +NaN i)"},
- {"%+-8b", complex(NaN, NaN), "(+NaN +NaN i)"},
- // Zero padding does not apply to infinities and NaN.
- {"%08f", complex(posInf, posInf), "( ∞ +∞i)"},
- {"%-08g", complex(negInf, negInf), "(-∞ -∞ i)"},
- {"%-08G", complex(NaN, NaN), "(NaN +NaN i)"},
-
- // old test/fmt_test.go
- {"%e", 1.0, "1.000000\u202f×\u202f10⁰⁰"},
- {"%e", 1234.5678e3, "1.234568\u202f×\u202f10⁰⁶"},
- {"%e", 1234.5678e-8, "1.234568\u202f×\u202f10⁻⁰⁵"},
- {"%e", -7.0, "-7.000000\u202f×\u202f10⁰⁰"},
- {"%e", -1e-9, "-1.000000\u202f×\u202f10⁻⁰⁹"},
- {"%f", 1234.5678e3, "1,234,567.800000"},
- {"%f", 1234.5678e-8, "0.000012"},
- {"%f", -7.0, "-7.000000"},
- {"%f", -1e-9, "-0.000000"},
- {"%g", 1234.5678e3, "1.2345678\u202f×\u202f10⁰⁶"},
- {"%g", float32(1234.5678e3), "1.2345678\u202f×\u202f10⁰⁶"},
- {"%g", 1234.5678e-8, "1.2345678\u202f×\u202f10⁻⁰⁵"},
- {"%g", -7.0, "-7"},
- {"%g", -1e-9, "-1\u202f×\u202f10⁻⁰⁹"},
- {"%g", float32(-1e-9), "-1\u202f×\u202f10⁻⁰⁹"},
- {"%E", 1.0, "1.000000\u202f×\u202f10⁰⁰"},
- {"%E", 1234.5678e3, "1.234568\u202f×\u202f10⁰⁶"},
- {"%E", 1234.5678e-8, "1.234568\u202f×\u202f10⁻⁰⁵"},
- {"%E", -7.0, "-7.000000\u202f×\u202f10⁰⁰"},
- {"%E", -1e-9, "-1.000000\u202f×\u202f10⁻⁰⁹"},
- {"%G", 1234.5678e3, "1.2345678\u202f×\u202f10⁰⁶"},
- {"%G", float32(1234.5678e3), "1.2345678\u202f×\u202f10⁰⁶"},
- {"%G", 1234.5678e-8, "1.2345678\u202f×\u202f10⁻⁰⁵"},
- {"%G", -7.0, "-7"},
- {"%G", -1e-9, "-1\u202f×\u202f10⁻⁰⁹"},
- {"%G", float32(-1e-9), "-1\u202f×\u202f10⁻⁰⁹"},
- {"%20.5s", "qwertyuiop", " qwert"},
- {"%.5s", "qwertyuiop", "qwert"},
- {"%-20.5s", "qwertyuiop", "qwert "},
- {"%20c", 'x', " x"},
- {"%-20c", 'x', "x "},
- {"%20.6e", 1.2345e3, " 1.234500\u202f×\u202f10⁰³"},
- {"%20.6e", 1.2345e-3, " 1.234500\u202f×\u202f10⁻⁰³"},
- {"%20e", 1.2345e3, " 1.234500\u202f×\u202f10⁰³"},
- {"%20e", 1.2345e-3, " 1.234500\u202f×\u202f10⁻⁰³"},
- {"%20.8e", 1.2345e3, " 1.23450000\u202f×\u202f10⁰³"},
- {"%20f", 1.23456789e3, " 1,234.567890"},
- {"%20f", 1.23456789e-3, " 0.001235"},
- {"%20f", 12345678901.23456789, "12,345,678,901.234568"},
- {"%-20f", 1.23456789e3, "1,234.567890 "},
- {"%20.8f", 1.23456789e3, " 1,234.56789000"},
- {"%20.8f", 1.23456789e-3, " 0.00123457"},
- {"%g", 1.23456789e3, "1,234.56789"},
- {"%g", 1.23456789e-3, "0.00123456789"},
- {"%g", 1.23456789e20, "1.23456789\u202f×\u202f10²⁰"},
-
- // arrays
- {"%v", array, "[1 2 3 4 5]"},
- {"%v", iarray, "[1 hello 2.5 <nil>]"},
- {"%v", barray, "[1 2 3 4 5]"},
- {"%v", &array, "&[1 2 3 4 5]"},
- {"%v", &iarray, "&[1 hello 2.5 <nil>]"},
- {"%v", &barray, "&[1 2 3 4 5]"},
-
- // slices
- {"%v", slice, "[1 2 3 4 5]"},
- {"%v", islice, "[1 hello 2.5 <nil>]"},
- {"%v", bslice, "[1 2 3 4 5]"},
- {"%v", &slice, "&[1 2 3 4 5]"},
- {"%v", &islice, "&[1 hello 2.5 <nil>]"},
- {"%v", &bslice, "&[1 2 3 4 5]"},
-
- // byte arrays and slices with %b,%c,%d,%o,%U and %v
- {"%b", [3]byte{65, 66, 67}, "[1000001 1000010 1000011]"},
- {"%c", [3]byte{65, 66, 67}, "[A B C]"},
- {"%d", [3]byte{65, 66, 67}, "[65 66 67]"},
- {"%o", [3]byte{65, 66, 67}, "[101 102 103]"},
- {"%U", [3]byte{65, 66, 67}, "[U+0041 U+0042 U+0043]"},
- {"%v", [3]byte{65, 66, 67}, "[65 66 67]"},
- {"%v", [1]byte{123}, "[123]"},
- {"%012v", []byte{}, "[]"},
- {"%#012v", []byte{}, "[]byte{}"},
- {"%6v", []byte{1, 11, 111}, "[ 1 11 111]"},
- {"%06v", []byte{1, 11, 111}, "[000001 000011 000111]"},
- {"%-6v", []byte{1, 11, 111}, "[1 11 111 ]"},
- {"%-06v", []byte{1, 11, 111}, "[1 11 111 ]"},
- {"%#v", []byte{1, 11, 111}, "[]byte{0x1, 0xb, 0x6f}"},
- {"%#6v", []byte{1, 11, 111}, "[]byte{ 0x1, 0xb, 0x6f}"},
- {"%#06v", []byte{1, 11, 111}, "[]byte{0x000001, 0x00000b, 0x00006f}"},
- {"%#-6v", []byte{1, 11, 111}, "[]byte{0x1 , 0xb , 0x6f }"},
- {"%#-06v", []byte{1, 11, 111}, "[]byte{0x1 , 0xb , 0x6f }"},
- // f.space should and f.plus should not have an effect with %v.
- {"% v", []byte{1, 11, 111}, "[ 1 11 111]"},
- {"%+v", [3]byte{1, 11, 111}, "[1 11 111]"},
- {"%# -6v", []byte{1, 11, 111}, "[]byte{ 0x1 , 0xb , 0x6f }"},
- {"%#+-6v", [3]byte{1, 11, 111}, "[3]uint8{0x1 , 0xb , 0x6f }"},
- // f.space and f.plus should have an effect with %d.
- {"% d", []byte{1, 11, 111}, "[ 1 11 111]"},
- {"%+d", [3]byte{1, 11, 111}, "[+1 +11 +111]"},
- {"%# -6d", []byte{1, 11, 111}, "[ 1 11 111 ]"},
- {"%#+-6d", [3]byte{1, 11, 111}, "[+1 +11 +111 ]"},
-
- // floates with %v
- {"%v", 1.2345678, "1.2345678"},
- {"%v", float32(1.2345678), "1.2345678"},
-
- // complexes with %v
- {"%v", 1 + 2i, "(1+2i)"},
- {"%v", complex64(1 + 2i), "(1+2i)"},
-
- // structs
- {"%v", A{1, 2, "a", []int{1, 2}}, `{1 2 a [1 2]}`},
- {"%+v", A{1, 2, "a", []int{1, 2}}, `{i:1 j:2 s:a x:[1 2]}`},
-
- // +v on structs with Stringable items
- {"%+v", B{1, 2}, `{I:<1> j:2}`},
- {"%+v", C{1, B{2, 3}}, `{i:1 B:{I:<2> j:3}}`},
-
- // other formats on Stringable items
- {"%s", I(23), `<23>`},
- {"%q", I(23), `"<23>"`},
- {"%x", I(23), `3c32333e`},
- {"%#x", I(23), `0x3c32333e`},
- {"%# x", I(23), `0x3c 0x32 0x33 0x3e`},
- // Stringer applies only to string formats.
- {"%d", I(23), `23`},
- // Stringer applies to the extracted value.
- {"%s", reflect.ValueOf(I(23)), `<23>`},
-
- // go syntax
- {"%#v", A{1, 2, "a", []int{1, 2}}, `message.A{i:1, j:0x2, s:"a", x:[]int{1, 2}}`},
- {"%#v", new(byte), "(*uint8)(0xPTR)"},
- {"%#v", TestFmtInterface, "(func(*testing.T))(0xPTR)"},
- {"%#v", make(chan int), "(chan int)(0xPTR)"},
- {"%#v", uint64(1<<64 - 1), "0xffffffffffffffff"},
- {"%#v", 1000000000, "1000000000"},
- {"%#v", map[string]int{"a": 1}, `map[string]int{"a":1}`},
- {"%#v", map[string]B{"a": {1, 2}}, `map[string]message.B{"a":message.B{I:1, j:2}}`},
- {"%#v", []string{"a", "b"}, `[]string{"a", "b"}`},
- {"%#v", SI{}, `message.SI{I:interface {}(nil)}`},
- {"%#v", []int(nil), `[]int(nil)`},
- {"%#v", []int{}, `[]int{}`},
- {"%#v", array, `[5]int{1, 2, 3, 4, 5}`},
- {"%#v", &array, `&[5]int{1, 2, 3, 4, 5}`},
- {"%#v", iarray, `[4]interface {}{1, "hello", 2.5, interface {}(nil)}`},
- {"%#v", &iarray, `&[4]interface {}{1, "hello", 2.5, interface {}(nil)}`},
- {"%#v", map[int]byte(nil), `map[int]uint8(nil)`},
- {"%#v", map[int]byte{}, `map[int]uint8{}`},
- {"%#v", "foo", `"foo"`},
- {"%#v", barray, `[5]message.renamedUint8{0x1, 0x2, 0x3, 0x4, 0x5}`},
- {"%#v", bslice, `[]message.renamedUint8{0x1, 0x2, 0x3, 0x4, 0x5}`},
- {"%#v", []int32(nil), "[]int32(nil)"},
- {"%#v", 1.2345678, "1.2345678"},
- {"%#v", float32(1.2345678), "1.2345678"},
- // Only print []byte and []uint8 as type []byte if they appear at the top level.
- {"%#v", []byte(nil), "[]byte(nil)"},
- {"%#v", []uint8(nil), "[]byte(nil)"},
- {"%#v", []byte{}, "[]byte{}"},
- {"%#v", []uint8{}, "[]byte{}"},
- {"%#v", reflect.ValueOf([]byte{}), "[]uint8{}"},
- {"%#v", reflect.ValueOf([]uint8{}), "[]uint8{}"},
- {"%#v", &[]byte{}, "&[]uint8{}"},
- {"%#v", &[]byte{}, "&[]uint8{}"},
- {"%#v", [3]byte{}, "[3]uint8{0x0, 0x0, 0x0}"},
- {"%#v", [3]uint8{}, "[3]uint8{0x0, 0x0, 0x0}"},
-
- // slices with other formats
- {"%#x", []int{1, 2, 15}, `[0x1 0x2 0xf]`},
- {"%x", []int{1, 2, 15}, `[1 2 f]`},
- {"%d", []int{1, 2, 15}, `[1 2 15]`},
- {"%d", []byte{1, 2, 15}, `[1 2 15]`},
- {"%q", []string{"a", "b"}, `["a" "b"]`},
- {"% 02x", []byte{1}, "01"},
- {"% 02x", []byte{1, 2, 3}, "01 02 03"},
-
- // Padding with byte slices.
- {"%2x", []byte{}, " "},
- {"%#2x", []byte{}, " "},
- {"% 02x", []byte{}, "00"},
- {"%# 02x", []byte{}, "00"},
- {"%-2x", []byte{}, " "},
- {"%-02x", []byte{}, " "},
- {"%8x", []byte{0xab}, " ab"},
- {"% 8x", []byte{0xab}, " ab"},
- {"%#8x", []byte{0xab}, " 0xab"},
- {"%# 8x", []byte{0xab}, " 0xab"},
- {"%08x", []byte{0xab}, "000000ab"},
- {"% 08x", []byte{0xab}, "000000ab"},
- {"%#08x", []byte{0xab}, "00000xab"},
- {"%# 08x", []byte{0xab}, "00000xab"},
- {"%10x", []byte{0xab, 0xcd}, " abcd"},
- {"% 10x", []byte{0xab, 0xcd}, " ab cd"},
- {"%#10x", []byte{0xab, 0xcd}, " 0xabcd"},
- {"%# 10x", []byte{0xab, 0xcd}, " 0xab 0xcd"},
- {"%010x", []byte{0xab, 0xcd}, "000000abcd"},
- {"% 010x", []byte{0xab, 0xcd}, "00000ab cd"},
- {"%#010x", []byte{0xab, 0xcd}, "00000xabcd"},
- {"%# 010x", []byte{0xab, 0xcd}, "00xab 0xcd"},
- {"%-10X", []byte{0xab}, "AB "},
- {"% -010X", []byte{0xab}, "AB "},
- {"%#-10X", []byte{0xab, 0xcd}, "0XABCD "},
- {"%# -010X", []byte{0xab, 0xcd}, "0XAB 0XCD "},
- // Same for strings
- {"%2x", "", " "},
- {"%#2x", "", " "},
- {"% 02x", "", "00"},
- {"%# 02x", "", "00"},
- {"%-2x", "", " "},
- {"%-02x", "", " "},
- {"%8x", "\xab", " ab"},
- {"% 8x", "\xab", " ab"},
- {"%#8x", "\xab", " 0xab"},
- {"%# 8x", "\xab", " 0xab"},
- {"%08x", "\xab", "000000ab"},
- {"% 08x", "\xab", "000000ab"},
- {"%#08x", "\xab", "00000xab"},
- {"%# 08x", "\xab", "00000xab"},
- {"%10x", "\xab\xcd", " abcd"},
- {"% 10x", "\xab\xcd", " ab cd"},
- {"%#10x", "\xab\xcd", " 0xabcd"},
- {"%# 10x", "\xab\xcd", " 0xab 0xcd"},
- {"%010x", "\xab\xcd", "000000abcd"},
- {"% 010x", "\xab\xcd", "00000ab cd"},
- {"%#010x", "\xab\xcd", "00000xabcd"},
- {"%# 010x", "\xab\xcd", "00xab 0xcd"},
- {"%-10X", "\xab", "AB "},
- {"% -010X", "\xab", "AB "},
- {"%#-10X", "\xab\xcd", "0XABCD "},
- {"%# -010X", "\xab\xcd", "0XAB 0XCD "},
-
- // renamings
- {"%v", renamedBool(true), "true"},
- {"%d", renamedBool(true), "%!d(message.renamedBool=true)"},
- {"%o", renamedInt(8), "10"},
- {"%d", renamedInt8(-9), "-9"},
- {"%v", renamedInt16(10), "10"},
- {"%v", renamedInt32(-11), "-11"},
- {"%X", renamedInt64(255), "FF"},
- {"%v", renamedUint(13), "13"},
- {"%o", renamedUint8(14), "16"},
- {"%X", renamedUint16(15), "F"},
- {"%d", renamedUint32(16), "16"},
- {"%X", renamedUint64(17), "11"},
- {"%o", renamedUintptr(18), "22"},
- {"%x", renamedString("thing"), "7468696e67"},
- {"%d", renamedBytes([]byte{1, 2, 15}), `[1 2 15]`},
- {"%q", renamedBytes([]byte("hello")), `"hello"`},
- {"%x", []renamedUint8{'h', 'e', 'l', 'l', 'o'}, "68656c6c6f"},
- {"%X", []renamedUint8{'h', 'e', 'l', 'l', 'o'}, "68656C6C6F"},
- {"%s", []renamedUint8{'h', 'e', 'l', 'l', 'o'}, "hello"},
- {"%q", []renamedUint8{'h', 'e', 'l', 'l', 'o'}, `"hello"`},
- {"%v", renamedFloat32(22), "22"},
- {"%v", renamedFloat64(33), "33"},
- {"%v", renamedComplex64(3 + 4i), "(3+4i)"},
- {"%v", renamedComplex128(4 - 3i), "(4-3i)"},
-
- // Formatter
- {"%x", F(1), "<x=F(1)>"},
- {"%x", G(2), "2"},
- {"%+v", S{F(4), G(5)}, "{F:<v=F(4)> G:5}"},
-
- // GoStringer
- {"%#v", G(6), "GoString(6)"},
- {"%#v", S{F(7), G(8)}, "message.S{F:<v=F(7)>, G:GoString(8)}"},
-
- // %T
- {"%T", byte(0), "uint8"},
- {"%T", reflect.ValueOf(nil), "reflect.Value"},
- {"%T", (4 - 3i), "complex128"},
- {"%T", renamedComplex128(4 - 3i), "message.renamedComplex128"},
- {"%T", intVar, "int"},
- {"%6T", &intVar, " *int"},
- {"%10T", nil, " <nil>"},
- {"%-10T", nil, "<nil> "},
-
- // %p with pointers
- {"%p", (*int)(nil), "0x0"},
- {"%#p", (*int)(nil), "0"},
- {"%p", &intVar, "0xPTR"},
- {"%#p", &intVar, "PTR"},
- {"%p", &array, "0xPTR"},
- {"%p", &slice, "0xPTR"},
- {"%8.2p", (*int)(nil), " 0x00"},
- {"%-20.16p", &intVar, "0xPTR "},
- // %p on non-pointers
- {"%p", make(chan int), "0xPTR"},
- {"%p", make(map[int]int), "0xPTR"},
- {"%p", func() {}, "0xPTR"},
- {"%p", 27, "%!p(int=27)"}, // not a pointer at all
- {"%p", nil, "%!p(<nil>)"}, // nil on its own has no type ...
- {"%#p", nil, "%!p(<nil>)"}, // ... and hence is not a pointer type.
- // pointers with specified base
- {"%b", &intVar, "PTR_b"},
- {"%d", &intVar, "PTR_d"},
- {"%o", &intVar, "PTR_o"},
- {"%x", &intVar, "PTR_x"},
- {"%X", &intVar, "PTR_X"},
- // %v on pointers
- {"%v", nil, "<nil>"},
- {"%#v", nil, "<nil>"},
- {"%v", (*int)(nil), "<nil>"},
- {"%#v", (*int)(nil), "(*int)(nil)"},
- {"%v", &intVar, "0xPTR"},
- {"%#v", &intVar, "(*int)(0xPTR)"},
- {"%8.2v", (*int)(nil), " <nil>"},
- {"%-20.16v", &intVar, "0xPTR "},
- // string method on pointer
- {"%s", &pValue, "String(p)"}, // String method...
- {"%p", &pValue, "0xPTR"}, // ... is not called with %p.
-
- // %d on Stringer should give integer if possible
- {"%s", time.Time{}.Month(), "January"},
- {"%d", time.Time{}.Month(), "1"},
-
- // erroneous things
- {"%s %", "hello", "hello %!(NOVERB)"},
- {"%s %.2", "hello", "hello %!(NOVERB)"},
-
- // The "<nil>" show up because maps are printed by
- // first obtaining a list of keys and then looking up
- // each key. Since NaNs can be map keys but cannot
- // be fetched directly, the lookup fails and returns a
- // zero reflect.Value, which formats as <nil>.
- // This test is just to check that it shows the two NaNs at all.
- {"%v", map[float64]int{NaN: 1, NaN: 2}, "map[NaN:<nil> NaN:<nil>]"},
-
- // Comparison of padding rules with C printf.
- /*
- C program:
- #include <stdio.h>
-
- char *format[] = {
- "[%.2f]",
- "[% .2f]",
- "[%+.2f]",
- "[%7.2f]",
- "[% 7.2f]",
- "[%+7.2f]",
- "[% +7.2f]",
- "[%07.2f]",
- "[% 07.2f]",
- "[%+07.2f]",
- "[% +07.2f]"
- };
-
- int main(void) {
- int i;
- for(i = 0; i < 11; i++) {
- printf("%s: ", format[i]);
- printf(format[i], 1.0);
- printf(" ");
- printf(format[i], -1.0);
- printf("\n");
- }
- }
-
- Output:
- [%.2f]: [1.00] [-1.00]
- [% .2f]: [ 1.00] [-1.00]
- [%+.2f]: [+1.00] [-1.00]
- [%7.2f]: [ 1.00] [ -1.00]
- [% 7.2f]: [ 1.00] [ -1.00]
- [%+7.2f]: [ +1.00] [ -1.00]
- [% +7.2f]: [ +1.00] [ -1.00]
- [%07.2f]: [0001.00] [-001.00]
- [% 07.2f]: [ 001.00] [-001.00]
- [%+07.2f]: [+001.00] [-001.00]
- [% +07.2f]: [+001.00] [-001.00]
-
- */
- {"%.2f", 1.0, "1.00"},
- {"%.2f", -1.0, "-1.00"},
- {"% .2f", 1.0, " 1.00"},
- {"% .2f", -1.0, "-1.00"},
- {"%+.2f", 1.0, "+1.00"},
- {"%+.2f", -1.0, "-1.00"},
- {"%7.2f", 1.0, " 1.00"},
- {"%7.2f", -1.0, " -1.00"},
- {"% 7.2f", 1.0, " 1.00"},
- {"% 7.2f", -1.0, " -1.00"},
- {"%+7.2f", 1.0, " +1.00"},
- {"%+7.2f", -1.0, " -1.00"},
- {"% +7.2f", 1.0, " +1.00"},
- {"% +7.2f", -1.0, " -1.00"},
- // Padding with 0's indicates minimum number of integer digits minus the
- // period, if present, and minus the sign if it is fixed.
- // TODO: consider making this number the number of significant digits.
- {"%07.2f", 1.0, "0,001.00"},
- {"%07.2f", -1.0, "-0,001.00"},
- {"% 07.2f", 1.0, " 001.00"},
- {"% 07.2f", -1.0, "-001.00"},
- {"%+07.2f", 1.0, "+001.00"},
- {"%+07.2f", -1.0, "-001.00"},
- {"% +07.2f", 1.0, "+001.00"},
- {"% +07.2f", -1.0, "-001.00"},
-
- // Complex numbers: exhaustively tested in TestComplexFormatting.
- {"%7.2f", 1 + 2i, "( 1.00 +2.00i)"},
- {"%+07.2f", -1 - 2i, "(-001.00-002.00i)"},
-
- // Use spaces instead of zero if padding to the right.
- {"%0-5s", "abc", "abc "},
- {"%-05.1f", 1.0, "1.0 "},
-
- // float and complex formatting should not change the padding width
- // for other elements. See issue 14642.
- {"%06v", []interface{}{+10.0, 10}, "[000,010 000,010]"},
- {"%06v", []interface{}{-10.0, 10}, "[-000,010 000,010]"},
- {"%06v", []interface{}{+10.0 + 10i, 10}, "[(000,010+00,010i) 000,010]"},
- {"%06v", []interface{}{-10.0 + 10i, 10}, "[(-000,010+00,010i) 000,010]"},
-
- // integer formatting should not alter padding for other elements.
- {"%03.6v", []interface{}{1, 2.0, "x"}, "[000,001 002 00x]"},
- {"%03.0v", []interface{}{0, 2.0, "x"}, "[ 002 000]"},
-
- // Complex fmt used to leave the plus flag set for future entries in the array
- // causing +2+0i and +3+0i instead of 2+0i and 3+0i.
- {"%v", []complex64{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
- {"%v", []complex128{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
-
- // Incomplete format specification caused crash.
- {"%.", 3, "%!.(int=3)"},
-
- // Padding for complex numbers. Has been bad, then fixed, then bad again.
- {"%+10.2f", +104.66 + 440.51i, "( +104.66 +440.51i)"},
- {"%+10.2f", -104.66 + 440.51i, "( -104.66 +440.51i)"},
- {"%+10.2f", +104.66 - 440.51i, "( +104.66 -440.51i)"},
- {"%+10.2f", -104.66 - 440.51i, "( -104.66 -440.51i)"},
- {"%010.2f", +104.66 + 440.51i, "(0,000,104.66+000,440.51i)"},
- {"%+010.2f", +104.66 + 440.51i, "(+000,104.66+000,440.51i)"},
- {"%+010.2f", -104.66 + 440.51i, "(-000,104.66+000,440.51i)"},
- {"%+010.2f", +104.66 - 440.51i, "(+000,104.66-000,440.51i)"},
- {"%+010.2f", -104.66 - 440.51i, "(-000,104.66-000,440.51i)"},
-
- // []T where type T is a byte with a Stringer method.
- {"%v", byteStringerSlice, "[X X X X X]"},
- {"%s", byteStringerSlice, "hello"},
- {"%q", byteStringerSlice, "\"hello\""},
- {"%x", byteStringerSlice, "68656c6c6f"},
- {"%X", byteStringerSlice, "68656C6C6F"},
- {"%#v", byteStringerSlice, "[]message.byteStringer{0x68, 0x65, 0x6c, 0x6c, 0x6f}"},
-
- // And the same for Formatter.
- {"%v", byteFormatterSlice, "[X X X X X]"},
- {"%s", byteFormatterSlice, "hello"},
- {"%q", byteFormatterSlice, "\"hello\""},
- {"%x", byteFormatterSlice, "68656c6c6f"},
- {"%X", byteFormatterSlice, "68656C6C6F"},
- // This next case seems wrong, but the docs say the Formatter wins here.
- {"%#v", byteFormatterSlice, "[]message.byteFormatter{X, X, X, X, X}"},
-
- // reflect.Value handled specially in Go 1.5, making it possible to
- // see inside non-exported fields (which cannot be accessed with Interface()).
- // Issue 8965.
- {"%v", reflect.ValueOf(A{}).Field(0).String(), "<int Value>"}, // Equivalent to the old way.
- {"%v", reflect.ValueOf(A{}).Field(0), "0"}, // Sees inside the field.
-
- // verbs apply to the extracted value too.
- {"%s", reflect.ValueOf("hello"), "hello"},
- {"%q", reflect.ValueOf("hello"), `"hello"`},
- {"%#04x", reflect.ValueOf(256), "0x0100"},
-
- // invalid reflect.Value doesn't crash.
- {"%v", reflect.Value{}, "<invalid reflect.Value>"},
- {"%v", &reflect.Value{}, "<invalid Value>"},
- {"%v", SI{reflect.Value{}}, "{<invalid Value>}"},
-
- // Tests to check that not supported verbs generate an error string.
- {"%☠", nil, "%!☠(<nil>)"},
- {"%☠", interface{}(nil), "%!☠(<nil>)"},
- {"%☠", int(0), "%!☠(int=0)"},
- {"%☠", uint(0), "%!☠(uint=0)"},
- {"%☠", []byte{0, 1}, "[%!☠(uint8=0) %!☠(uint8=1)]"},
- {"%☠", []uint8{0, 1}, "[%!☠(uint8=0) %!☠(uint8=1)]"},
- {"%☠", [1]byte{0}, "[%!☠(uint8=0)]"},
- {"%☠", [1]uint8{0}, "[%!☠(uint8=0)]"},
- {"%☠", "hello", "%!☠(string=hello)"},
- {"%☠", 1.2345678, "%!☠(float64=1.2345678)"},
- {"%☠", float32(1.2345678), "%!☠(float32=1.2345678)"},
- {"%☠", 1.2345678 + 1.2345678i, "%!☠(complex128=(1.2345678+1.2345678i))"},
- {"%☠", complex64(1.2345678 + 1.2345678i), "%!☠(complex64=(1.2345678+1.2345678i))"},
- {"%☠", &intVar, "%!☠(*int=0xPTR)"},
- {"%☠", make(chan int), "%!☠(chan int=0xPTR)"},
- {"%☠", func() {}, "%!☠(func()=0xPTR)"},
- {"%☠", reflect.ValueOf(renamedInt(0)), "%!☠(message.renamedInt=0)"},
- {"%☠", SI{renamedInt(0)}, "{%!☠(message.renamedInt=0)}"},
- {"%☠", &[]interface{}{I(1), G(2)}, "&[%!☠(message.I=1) %!☠(message.G=2)]"},
- {"%☠", SI{&[]interface{}{I(1), G(2)}}, "{%!☠(*[]interface {}=&[1 2])}"},
- {"%☠", reflect.Value{}, "<invalid reflect.Value>"},
- {"%☠", map[float64]int{NaN: 1}, "map[%!☠(float64=NaN):%!☠(<nil>)]"},
-}
-
-// zeroFill generates zero-filled strings of the specified width. The length
-// of the suffix (but not the prefix) is compensated for in the width calculation.
-func zeroFill(prefix string, width int, suffix string) string {
- return prefix + strings.Repeat("0", width-len(suffix)) + suffix
-}
-
-func TestSprintf(t *testing.T) {
- p := NewPrinter(language.Und)
- for _, tt := range fmtTests {
- t.Run(fmt.Sprint(tt.fmt, "/", tt.val), func(t *testing.T) {
- s := p.Sprintf(tt.fmt, tt.val)
- i := strings.Index(tt.out, "PTR")
- if i >= 0 && i < len(s) {
- var pattern, chars string
- switch {
- case strings.HasPrefix(tt.out[i:], "PTR_b"):
- pattern = "PTR_b"
- chars = "01"
- case strings.HasPrefix(tt.out[i:], "PTR_o"):
- pattern = "PTR_o"
- chars = "01234567"
- case strings.HasPrefix(tt.out[i:], "PTR_d"):
- pattern = "PTR_d"
- chars = "0123456789"
- case strings.HasPrefix(tt.out[i:], "PTR_x"):
- pattern = "PTR_x"
- chars = "0123456789abcdef"
- case strings.HasPrefix(tt.out[i:], "PTR_X"):
- pattern = "PTR_X"
- chars = "0123456789ABCDEF"
- default:
- pattern = "PTR"
- chars = "0123456789abcdefABCDEF"
- }
- p := s[:i] + pattern
- for j := i; j < len(s); j++ {
- if !strings.ContainsRune(chars, rune(s[j])) {
- p += s[j:]
- break
- }
- }
- s = p
- }
- if s != tt.out {
- if _, ok := tt.val.(string); ok {
- // Don't requote the already-quoted strings.
- // It's too confusing to read the errors.
- t.Errorf("Sprintf(%q, %q) = <%s> want <%s>", tt.fmt, tt.val, s, tt.out)
- } else {
- t.Errorf("Sprintf(%q, %v) = %q want %q", tt.fmt, tt.val, s, tt.out)
- }
- }
- })
- }
-}
-
-var f float64
-
-// TestComplexFormatting checks that a complex always formats to the same
-// thing as if done by hand with two singleton prints.
-func TestComplexFormatting(t *testing.T) {
- var yesNo = []bool{true, false}
- var values = []float64{1, 0, -1, posInf, negInf, NaN}
- p := NewPrinter(language.Und)
- for _, plus := range yesNo {
- for _, zero := range yesNo {
- for _, space := range yesNo {
- for _, char := range "fFeEgG" {
- realFmt := "%"
- if zero {
- realFmt += "0"
- }
- if space {
- realFmt += " "
- }
- if plus {
- realFmt += "+"
- }
- realFmt += "10.2"
- realFmt += string(char)
- // Imaginary part always has a sign, so force + and ignore space.
- imagFmt := "%"
- if zero {
- imagFmt += "0"
- }
- imagFmt += "+"
- imagFmt += "10.2"
- imagFmt += string(char)
- for _, realValue := range values {
- for _, imagValue := range values {
- one := p.Sprintf(realFmt, complex(realValue, imagValue))
- two := p.Sprintf("("+realFmt+imagFmt+"i)", realValue, imagValue)
- if math.IsNaN(imagValue) {
- p := len(two) - len("NaNi)") - 1
- if two[p] == ' ' {
- two = two[:p] + "+" + two[p+1:]
- } else {
- two = two[:p+1] + "+" + two[p+1:]
- }
- }
- if one != two {
- t.Error(f, one, two)
- }
- }
- }
- }
- }
- }
- }
-}
-
-type SE []interface{} // slice of empty; notational compactness.
-
-var reorderTests = []struct {
- format string
- args SE
- out string
-}{
- {"%[1]d", SE{1}, "1"},
- {"%[2]d", SE{2, 1}, "1"},
- {"%[2]d %[1]d", SE{1, 2}, "2 1"},
- {"%[2]*[1]d", SE{2, 5}, " 2"},
- {"%6.2f", SE{12.0}, " 12.00"}, // Explicit version of next line.
- {"%[3]*.[2]*[1]f", SE{12.0, 2, 6}, " 12.00"},
- {"%[1]*.[2]*[3]f", SE{6, 2, 12.0}, " 12.00"},
- {"%10f", SE{12.0}, " 12.000000"},
- {"%[1]*[3]f", SE{10, 99, 12.0}, " 12.000000"},
- {"%.6f", SE{12.0}, "12.000000"}, // Explicit version of next line.
- {"%.[1]*[3]f", SE{6, 99, 12.0}, "12.000000"},
- {"%6.f", SE{12.0}, " 12"}, // // Explicit version of next line; empty precision means zero.
- {"%[1]*.[3]f", SE{6, 3, 12.0}, " 12"},
- // An actual use! Print the same arguments twice.
- {"%d %d %d %#[1]o %#o %#o", SE{11, 12, 13}, "11 12 13 013 014 015"},
-
- // Erroneous cases.
- {"%[d", SE{2, 1}, "%!d(BADINDEX)"},
- {"%]d", SE{2, 1}, "%!](int=2)d%!(EXTRA int=1)"},
- {"%[]d", SE{2, 1}, "%!d(BADINDEX)"},
- {"%[-3]d", SE{2, 1}, "%!d(BADINDEX)"},
- {"%[99]d", SE{2, 1}, "%!d(BADINDEX)"},
- {"%[3]", SE{2, 1}, "%!(NOVERB)"},
- {"%[1].2d", SE{5, 6}, "%!d(BADINDEX)"},
- {"%[1]2d", SE{2, 1}, "%!d(BADINDEX)"},
- {"%3.[2]d", SE{7}, "%!d(BADINDEX)"},
- {"%.[2]d", SE{7}, "%!d(BADINDEX)"},
- {"%d %d %d %#[1]o %#o %#o %#o", SE{11, 12, 13}, "11 12 13 013 014 015 %!o(MISSING)"},
- {"%[5]d %[2]d %d", SE{1, 2, 3}, "%!d(BADINDEX) 2 3"},
- {"%d %[3]d %d", SE{1, 2}, "1 %!d(BADINDEX) 2"}, // Erroneous index does not affect sequence.
- {"%.[]", SE{}, "%!](BADINDEX)"}, // Issue 10675
- {"%.-3d", SE{42}, "%!-(int=42)3d"}, // TODO: Should this set return better error messages?
- // The following messages are interpreted as if there is no substitution,
- // in which case it is okay to have extra arguments. This is different
- // semantics from the fmt package.
- {"%2147483648d", SE{42}, "%!(NOVERB)"},
- {"%-2147483648d", SE{42}, "%!(NOVERB)"},
- {"%.2147483648d", SE{42}, "%!(NOVERB)"},
-}
-
-func TestReorder(t *testing.T) {
- p := NewPrinter(language.Und)
- for _, tc := range reorderTests {
- t.Run(fmt.Sprint(tc.format, "/", tc.args), func(t *testing.T) {
- s := p.Sprintf(tc.format, tc.args...)
- if s != tc.out {
- t.Errorf("Sprintf(%q, %v) = %q want %q", tc.format, tc.args, s, tc.out)
- }
- })
- }
-}
-
-func BenchmarkSprintfPadding(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%16f", 1.0)
- }
- })
-}
-
-func BenchmarkSprintfEmpty(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("")
- }
- })
-}
-
-func BenchmarkSprintfString(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%s", "hello")
- }
- })
-}
-
-func BenchmarkSprintfTruncateString(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%.3s", "日本語日本語日本語")
- }
- })
-}
-
-func BenchmarkSprintfQuoteString(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%q", "日本語日本語日本語")
- }
- })
-}
-
-func BenchmarkSprintfInt(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%d", 5)
- }
- })
-}
-
-func BenchmarkSprintfIntInt(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%d %d", 5, 6)
- }
- })
-}
-
-func BenchmarkSprintfPrefixedInt(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("This is some meaningless prefix text that needs to be scanned %d", 6)
- }
- })
-}
-
-func BenchmarkSprintfFloat(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%g", 5.23184)
- }
- })
-}
-
-func BenchmarkSprintfComplex(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%f", 5.23184+5.23184i)
- }
- })
-}
-
-func BenchmarkSprintfBoolean(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%t", true)
- }
- })
-}
-
-func BenchmarkSprintfHexString(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("% #x", "0123456789abcdef")
- }
- })
-}
-
-func BenchmarkSprintfHexBytes(b *testing.B) {
- data := []byte("0123456789abcdef")
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("% #x", data)
- }
- })
-}
-
-func BenchmarkSprintfBytes(b *testing.B) {
- data := []byte("0123456789abcdef")
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%v", data)
- }
- })
-}
-
-func BenchmarkSprintfStringer(b *testing.B) {
- stringer := I(12345)
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%v", stringer)
- }
- })
-}
-
-func BenchmarkSprintfStructure(b *testing.B) {
- s := &[]interface{}{SI{12345}, map[int]string{0: "hello"}}
- b.RunParallel(func(pb *testing.PB) {
- p := NewPrinter(language.English)
- for pb.Next() {
- p.Sprintf("%#v", s)
- }
- })
-}
-
-func BenchmarkManyArgs(b *testing.B) {
- b.RunParallel(func(pb *testing.PB) {
- var buf bytes.Buffer
- p := NewPrinter(language.English)
- for pb.Next() {
- buf.Reset()
- p.Fprintf(&buf, "%2d/%2d/%2d %d:%d:%d %s %s\n", 3, 4, 5, 11, 12, 13, "hello", "world")
- }
- })
-}
-
-func BenchmarkFprintInt(b *testing.B) {
- var buf bytes.Buffer
- p := NewPrinter(language.English)
- for i := 0; i < b.N; i++ {
- buf.Reset()
- p.Fprint(&buf, 123456)
- }
-}
-
-func BenchmarkFprintfBytes(b *testing.B) {
- data := []byte(string("0123456789"))
- var buf bytes.Buffer
- p := NewPrinter(language.English)
- for i := 0; i < b.N; i++ {
- buf.Reset()
- p.Fprintf(&buf, "%s", data)
- }
-}
-
-func BenchmarkFprintIntNoAlloc(b *testing.B) {
- var x interface{} = 123456
- var buf bytes.Buffer
- p := NewPrinter(language.English)
- for i := 0; i < b.N; i++ {
- buf.Reset()
- p.Fprint(&buf, x)
- }
-}
-
-var mallocBuf bytes.Buffer
-var mallocPointer *int // A pointer so we know the interface value won't allocate.
-
-var mallocTest = []struct {
- count int
- desc string
- fn func(p *Printer)
-}{
- {0, `Sprintf("")`, func(p *Printer) { p.Sprintf("") }},
- {1, `Sprintf("xxx")`, func(p *Printer) { p.Sprintf("xxx") }},
- {2, `Sprintf("%x")`, func(p *Printer) { p.Sprintf("%x", 7) }},
- {2, `Sprintf("%s")`, func(p *Printer) { p.Sprintf("%s", "hello") }},
- {3, `Sprintf("%x %x")`, func(p *Printer) { p.Sprintf("%x %x", 7, 112) }},
- {2, `Sprintf("%g")`, func(p *Printer) { p.Sprintf("%g", float32(3.14159)) }}, // TODO: Can this be 1?
- {1, `Fprintf(buf, "%s")`, func(p *Printer) { mallocBuf.Reset(); p.Fprintf(&mallocBuf, "%s", "hello") }},
- // If the interface value doesn't need to allocate, amortized allocation overhead should be zero.
- {0, `Fprintf(buf, "%x %x %x")`, func(p *Printer) {
- mallocBuf.Reset()
- p.Fprintf(&mallocBuf, "%x %x %x", mallocPointer, mallocPointer, mallocPointer)
- }},
-}
-
-var _ bytes.Buffer
-
-func TestCountMallocs(t *testing.T) {
- switch {
- case testing.Short():
- t.Skip("skipping malloc count in short mode")
- case runtime.GOMAXPROCS(0) > 1:
- t.Skip("skipping; GOMAXPROCS>1")
- // TODO: detect race detecter enabled.
- // case race.Enabled:
- // t.Skip("skipping malloc count under race detector")
- }
- p := NewPrinter(language.English)
- for _, mt := range mallocTest {
- mallocs := testing.AllocsPerRun(100, func() { mt.fn(p) })
- if got, max := mallocs, float64(mt.count); got > max {
- t.Errorf("%s: got %v allocs, want <=%v", mt.desc, got, max)
- }
- }
-}
-
-type flagPrinter struct{}
-
-func (flagPrinter) Format(f fmt.State, c rune) {
- s := "%"
- for i := 0; i < 128; i++ {
- if f.Flag(i) {
- s += string(i)
- }
- }
- if w, ok := f.Width(); ok {
- s += fmt.Sprintf("%d", w)
- }
- if p, ok := f.Precision(); ok {
- s += fmt.Sprintf(".%d", p)
- }
- s += string(c)
- io.WriteString(f, "["+s+"]")
-}
-
-var flagtests = []struct {
- in string
- out string
-}{
- {"%a", "[%a]"},
- {"%-a", "[%-a]"},
- {"%+a", "[%+a]"},
- {"%#a", "[%#a]"},
- {"% a", "[% a]"},
- {"%0a", "[%0a]"},
- {"%1.2a", "[%1.2a]"},
- {"%-1.2a", "[%-1.2a]"},
- {"%+1.2a", "[%+1.2a]"},
- {"%-+1.2a", "[%+-1.2a]"},
- {"%-+1.2abc", "[%+-1.2a]bc"},
- {"%-1.2abc", "[%-1.2a]bc"},
-}
-
-func TestFlagParser(t *testing.T) {
- var flagprinter flagPrinter
- for _, tt := range flagtests {
- s := NewPrinter(language.Und).Sprintf(tt.in, &flagprinter)
- if s != tt.out {
- t.Errorf("Sprintf(%q, &flagprinter) => %q, want %q", tt.in, s, tt.out)
- }
- }
-}
-
-func TestStructPrinter(t *testing.T) {
- type T struct {
- a string
- b string
- c int
- }
- var s T
- s.a = "abc"
- s.b = "def"
- s.c = 123
- var tests = []struct {
- fmt string
- out string
- }{
- {"%v", "{abc def 123}"},
- {"%+v", "{a:abc b:def c:123}"},
- {"%#v", `message.T{a:"abc", b:"def", c:123}`},
- }
- p := NewPrinter(language.Und)
- for _, tt := range tests {
- out := p.Sprintf(tt.fmt, s)
- if out != tt.out {
- t.Errorf("Sprintf(%q, s) = %#q, want %#q", tt.fmt, out, tt.out)
- }
- // The same but with a pointer.
- out = p.Sprintf(tt.fmt, &s)
- if out != "&"+tt.out {
- t.Errorf("Sprintf(%q, &s) = %#q, want %#q", tt.fmt, out, "&"+tt.out)
- }
- }
-}
-
-func TestSlicePrinter(t *testing.T) {
- p := NewPrinter(language.Und)
- slice := []int{}
- s := p.Sprint(slice)
- if s != "[]" {
- t.Errorf("empty slice printed as %q not %q", s, "[]")
- }
- slice = []int{1, 2, 3}
- s = p.Sprint(slice)
- if s != "[1 2 3]" {
- t.Errorf("slice: got %q expected %q", s, "[1 2 3]")
- }
- s = p.Sprint(&slice)
- if s != "&[1 2 3]" {
- t.Errorf("&slice: got %q expected %q", s, "&[1 2 3]")
- }
-}
-
-// presentInMap checks map printing using substrings so we don't depend on the
-// print order.
-func presentInMap(s string, a []string, t *testing.T) {
- for i := 0; i < len(a); i++ {
- loc := strings.Index(s, a[i])
- if loc < 0 {
- t.Errorf("map print: expected to find %q in %q", a[i], s)
- }
- // make sure the match ends here
- loc += len(a[i])
- if loc >= len(s) || (s[loc] != ' ' && s[loc] != ']') {
- t.Errorf("map print: %q not properly terminated in %q", a[i], s)
- }
- }
-}
-
-func TestMapPrinter(t *testing.T) {
- p := NewPrinter(language.Und)
- m0 := make(map[int]string)
- s := p.Sprint(m0)
- if s != "map[]" {
- t.Errorf("empty map printed as %q not %q", s, "map[]")
- }
- m1 := map[int]string{1: "one", 2: "two", 3: "three"}
- a := []string{"1:one", "2:two", "3:three"}
- presentInMap(p.Sprintf("%v", m1), a, t)
- presentInMap(p.Sprint(m1), a, t)
- // Pointer to map prints the same but with initial &.
- if !strings.HasPrefix(p.Sprint(&m1), "&") {
- t.Errorf("no initial & for address of map")
- }
- presentInMap(p.Sprintf("%v", &m1), a, t)
- presentInMap(p.Sprint(&m1), a, t)
-}
-
-func TestEmptyMap(t *testing.T) {
- const emptyMapStr = "map[]"
- var m map[string]int
- p := NewPrinter(language.Und)
- s := p.Sprint(m)
- if s != emptyMapStr {
- t.Errorf("nil map printed as %q not %q", s, emptyMapStr)
- }
- m = make(map[string]int)
- s = p.Sprint(m)
- if s != emptyMapStr {
- t.Errorf("empty map printed as %q not %q", s, emptyMapStr)
- }
-}
-
-// TestBlank checks that Sprint (and hence Print, Fprint) puts spaces in the
-// right places, that is, between arg pairs in which neither is a string.
-func TestBlank(t *testing.T) {
- p := NewPrinter(language.Und)
- got := p.Sprint("<", 1, ">:", 1, 2, 3, "!")
- expect := "<1>:1 2 3!"
- if got != expect {
- t.Errorf("got %q expected %q", got, expect)
- }
-}
-
-// TestBlankln checks that Sprintln (and hence Println, Fprintln) puts spaces in
-// the right places, that is, between all arg pairs.
-func TestBlankln(t *testing.T) {
- p := NewPrinter(language.Und)
- got := p.Sprintln("<", 1, ">:", 1, 2, 3, "!")
- expect := "< 1 >: 1 2 3 !\n"
- if got != expect {
- t.Errorf("got %q expected %q", got, expect)
- }
-}
-
-// TestFormatterPrintln checks Formatter with Sprint, Sprintln, Sprintf.
-func TestFormatterPrintln(t *testing.T) {
- p := NewPrinter(language.Und)
- f := F(1)
- expect := "<v=F(1)>\n"
- s := p.Sprint(f, "\n")
- if s != expect {
- t.Errorf("Sprint wrong with Formatter: expected %q got %q", expect, s)
- }
- s = p.Sprintln(f)
- if s != expect {
- t.Errorf("Sprintln wrong with Formatter: expected %q got %q", expect, s)
- }
- s = p.Sprintf("%v\n", f)
- if s != expect {
- t.Errorf("Sprintf wrong with Formatter: expected %q got %q", expect, s)
- }
-}
-
-func args(a ...interface{}) []interface{} { return a }
-
-var startests = []struct {
- fmt string
- in []interface{}
- out string
-}{
- {"%*d", args(4, 42), " 42"},
- {"%-*d", args(4, 42), "42 "},
- {"%*d", args(-4, 42), "42 "},
- {"%-*d", args(-4, 42), "42 "},
- {"%.*d", args(4, 42), "0,042"},
- {"%*.*d", args(8, 4, 42), " 0,042"},
- {"%0*d", args(4, 42), "0,042"},
- // Some non-int types for width. (Issue 10732).
- {"%0*d", args(uint(4), 42), "0,042"},
- {"%0*d", args(uint64(4), 42), "0,042"},
- {"%0*d", args('\x04', 42), "0,042"},
- {"%0*d", args(uintptr(4), 42), "0,042"},
-
- // erroneous
- {"%*d", args(nil, 42), "%!(BADWIDTH)42"},
- {"%*d", args(int(1e7), 42), "%!(BADWIDTH)42"},
- {"%*d", args(int(-1e7), 42), "%!(BADWIDTH)42"},
- {"%.*d", args(nil, 42), "%!(BADPREC)42"},
- {"%.*d", args(-1, 42), "%!(BADPREC)42"},
- {"%.*d", args(int(1e7), 42), "%!(BADPREC)42"},
- {"%.*d", args(uint(1e7), 42), "%!(BADPREC)42"},
- {"%.*d", args(uint64(1<<63), 42), "%!(BADPREC)42"}, // Huge negative (-inf).
- {"%.*d", args(uint64(1<<64-1), 42), "%!(BADPREC)42"}, // Small negative (-1).
- {"%*d", args(5, "foo"), "%!d(string= foo)"},
- {"%*% %d", args(20, 5), "% 5"},
- {"%*", args(4), "%!(NOVERB)"},
-}
-
-func TestWidthAndPrecision(t *testing.T) {
- p := NewPrinter(language.Und)
- for i, tt := range startests {
- t.Run(fmt.Sprint(tt.fmt, tt.in), func(t *testing.T) {
- s := p.Sprintf(tt.fmt, tt.in...)
- if s != tt.out {
- t.Errorf("#%d: %q: got %q expected %q", i, tt.fmt, s, tt.out)
- }
- })
- }
-}
-
-// PanicS is a type that panics in String.
-type PanicS struct {
- message interface{}
-}
-
-// Value receiver.
-func (p PanicS) String() string {
- panic(p.message)
-}
-
-// PanicGo is a type that panics in GoString.
-type PanicGo struct {
- message interface{}
-}
-
-// Value receiver.
-func (p PanicGo) GoString() string {
- panic(p.message)
-}
-
-// PanicF is a type that panics in Format.
-type PanicF struct {
- message interface{}
-}
-
-// Value receiver.
-func (p PanicF) Format(f fmt.State, c rune) {
- panic(p.message)
-}
-
-var panictests = []struct {
- desc string
- fmt string
- in interface{}
- out string
-}{
- // String
- {"String", "%s", (*PanicS)(nil), "<nil>"}, // nil pointer special case
- {"String", "%s", PanicS{io.ErrUnexpectedEOF}, "%!s(PANIC=unexpected EOF)"},
- {"String", "%s", PanicS{3}, "%!s(PANIC=3)"},
- // GoString
- {"GoString", "%#v", (*PanicGo)(nil), "<nil>"}, // nil pointer special case
- {"GoString", "%#v", PanicGo{io.ErrUnexpectedEOF}, "%!v(PANIC=unexpected EOF)"},
- {"GoString", "%#v", PanicGo{3}, "%!v(PANIC=3)"},
- // Issue 18282. catchPanic should not clear fmtFlags permanently.
- {"Issue 18282", "%#v", []interface{}{PanicGo{3}, PanicGo{3}}, "[]interface {}{%!v(PANIC=3), %!v(PANIC=3)}"},
- // Format
- {"Format", "%s", (*PanicF)(nil), "<nil>"}, // nil pointer special case
- {"Format", "%s", PanicF{io.ErrUnexpectedEOF}, "%!s(PANIC=unexpected EOF)"},
- {"Format", "%s", PanicF{3}, "%!s(PANIC=3)"},
-}
-
-func TestPanics(t *testing.T) {
- p := NewPrinter(language.Und)
- for i, tt := range panictests {
- t.Run(fmt.Sprint(tt.desc, "/", tt.fmt, "/", tt.in), func(t *testing.T) {
- s := p.Sprintf(tt.fmt, tt.in)
- if s != tt.out {
- t.Errorf("%d: %q: got %q expected %q", i, tt.fmt, s, tt.out)
- }
- })
- }
-}
-
-// recurCount tests that erroneous String routine doesn't cause fatal recursion.
-var recurCount = 0
-
-type Recur struct {
- i int
- failed *bool
-}
-
-func (r *Recur) String() string {
- p := NewPrinter(language.Und)
- if recurCount++; recurCount > 10 {
- *r.failed = true
- return "FAIL"
- }
- // This will call badVerb. Before the fix, that would cause us to recur into
- // this routine to print %!p(value). Now we don't call the user's method
- // during an error.
- return p.Sprintf("recur@%p value: %d", r, r.i)
-}
-
-func TestBadVerbRecursion(t *testing.T) {
- p := NewPrinter(language.Und)
- failed := false
- r := &Recur{3, &failed}
- p.Sprintf("recur@%p value: %d\n", &r, r.i)
- if failed {
- t.Error("fail with pointer")
- }
- failed = false
- r = &Recur{4, &failed}
- p.Sprintf("recur@%p, value: %d\n", r, r.i)
- if failed {
- t.Error("fail with value")
- }
-}
-
-func TestNilDoesNotBecomeTyped(t *testing.T) {
- p := NewPrinter(language.Und)
- type A struct{}
- type B struct{}
- var a *A = nil
- var b B = B{}
-
- // indirect the Sprintf call through this noVetWarn variable to avoid
- // "go test" failing vet checks in Go 1.10+.
- noVetWarn := p.Sprintf
- got := noVetWarn("%s %s %s %s %s", nil, a, nil, b, nil)
-
- const expect = "%!s(<nil>) %!s(*message.A=<nil>) %!s(<nil>) {} %!s(<nil>)"
- if got != expect {
- t.Errorf("expected:\n\t%q\ngot:\n\t%q", expect, got)
- }
-}
-
-var formatterFlagTests = []struct {
- in string
- val interface{}
- out string
-}{
- // scalar values with the (unused by fmt) 'a' verb.
- {"%a", flagPrinter{}, "[%a]"},
- {"%-a", flagPrinter{}, "[%-a]"},
- {"%+a", flagPrinter{}, "[%+a]"},
- {"%#a", flagPrinter{}, "[%#a]"},
- {"% a", flagPrinter{}, "[% a]"},
- {"%0a", flagPrinter{}, "[%0a]"},
- {"%1.2a", flagPrinter{}, "[%1.2a]"},
- {"%-1.2a", flagPrinter{}, "[%-1.2a]"},
- {"%+1.2a", flagPrinter{}, "[%+1.2a]"},
- {"%-+1.2a", flagPrinter{}, "[%+-1.2a]"},
- {"%-+1.2abc", flagPrinter{}, "[%+-1.2a]bc"},
- {"%-1.2abc", flagPrinter{}, "[%-1.2a]bc"},
-
- // composite values with the 'a' verb
- {"%a", [1]flagPrinter{}, "[[%a]]"},
- {"%-a", [1]flagPrinter{}, "[[%-a]]"},
- {"%+a", [1]flagPrinter{}, "[[%+a]]"},
- {"%#a", [1]flagPrinter{}, "[[%#a]]"},
- {"% a", [1]flagPrinter{}, "[[% a]]"},
- {"%0a", [1]flagPrinter{}, "[[%0a]]"},
- {"%1.2a", [1]flagPrinter{}, "[[%1.2a]]"},
- {"%-1.2a", [1]flagPrinter{}, "[[%-1.2a]]"},
- {"%+1.2a", [1]flagPrinter{}, "[[%+1.2a]]"},
- {"%-+1.2a", [1]flagPrinter{}, "[[%+-1.2a]]"},
- {"%-+1.2abc", [1]flagPrinter{}, "[[%+-1.2a]]bc"},
- {"%-1.2abc", [1]flagPrinter{}, "[[%-1.2a]]bc"},
-
- // simple values with the 'v' verb
- {"%v", flagPrinter{}, "[%v]"},
- {"%-v", flagPrinter{}, "[%-v]"},
- {"%+v", flagPrinter{}, "[%+v]"},
- {"%#v", flagPrinter{}, "[%#v]"},
- {"% v", flagPrinter{}, "[% v]"},
- {"%0v", flagPrinter{}, "[%0v]"},
- {"%1.2v", flagPrinter{}, "[%1.2v]"},
- {"%-1.2v", flagPrinter{}, "[%-1.2v]"},
- {"%+1.2v", flagPrinter{}, "[%+1.2v]"},
- {"%-+1.2v", flagPrinter{}, "[%+-1.2v]"},
- {"%-+1.2vbc", flagPrinter{}, "[%+-1.2v]bc"},
- {"%-1.2vbc", flagPrinter{}, "[%-1.2v]bc"},
-
- // composite values with the 'v' verb.
- {"%v", [1]flagPrinter{}, "[[%v]]"},
- {"%-v", [1]flagPrinter{}, "[[%-v]]"},
- {"%+v", [1]flagPrinter{}, "[[%+v]]"},
- {"%#v", [1]flagPrinter{}, "[1]message.flagPrinter{[%#v]}"},
- {"% v", [1]flagPrinter{}, "[[% v]]"},
- {"%0v", [1]flagPrinter{}, "[[%0v]]"},
- {"%1.2v", [1]flagPrinter{}, "[[%1.2v]]"},
- {"%-1.2v", [1]flagPrinter{}, "[[%-1.2v]]"},
- {"%+1.2v", [1]flagPrinter{}, "[[%+1.2v]]"},
- {"%-+1.2v", [1]flagPrinter{}, "[[%+-1.2v]]"},
- {"%-+1.2vbc", [1]flagPrinter{}, "[[%+-1.2v]]bc"},
- {"%-1.2vbc", [1]flagPrinter{}, "[[%-1.2v]]bc"},
-}
-
-func TestFormatterFlags(t *testing.T) {
- p := NewPrinter(language.Und)
- for _, tt := range formatterFlagTests {
- s := p.Sprintf(tt.in, tt.val)
- if s != tt.out {
- t.Errorf("Sprintf(%q, %T) = %q, want %q", tt.in, tt.val, s, tt.out)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/message_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/message_test.go
deleted file mode 100644
index 326f716fb51..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/message/message_test.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package message
-
-import (
- "bytes"
- "fmt"
- "io"
- "testing"
-
- "golang.org/x/text/internal"
- "golang.org/x/text/internal/format"
- "golang.org/x/text/language"
- "golang.org/x/text/message/catalog"
-)
-
-type formatFunc func(s fmt.State, v rune)
-
-func (f formatFunc) Format(s fmt.State, v rune) { f(s, v) }
-
-func TestBinding(t *testing.T) {
- testCases := []struct {
- tag string
- value interface{}
- want string
- }{
- {"en", 1, "1"},
- {"en", "2", "2"},
- { // Language is passed.
- "en",
- formatFunc(func(fs fmt.State, v rune) {
- s := fs.(format.State)
- io.WriteString(s, s.Language().String())
- }),
- "en",
- },
- }
- for i, tc := range testCases {
- p := NewPrinter(language.MustParse(tc.tag))
- if got := p.Sprint(tc.value); got != tc.want {
- t.Errorf("%d:%s:Sprint(%v) = %q; want %q", i, tc.tag, tc.value, got, tc.want)
- }
- var buf bytes.Buffer
- p.Fprint(&buf, tc.value)
- if got := buf.String(); got != tc.want {
- t.Errorf("%d:%s:Fprint(%v) = %q; want %q", i, tc.tag, tc.value, got, tc.want)
- }
- }
-}
-
-func TestLocalization(t *testing.T) {
- type test struct {
- tag string
- key Reference
- args []interface{}
- want string
- }
- args := func(x ...interface{}) []interface{} { return x }
- empty := []interface{}{}
- joe := []interface{}{"Joe"}
- joeAndMary := []interface{}{"Joe", "Mary"}
-
- testCases := []struct {
- desc string
- cat []entry
- test []test
- }{{
- desc: "empty",
- test: []test{
- {"en", "key", empty, "key"},
- {"en", "", empty, ""},
- {"nl", "", empty, ""},
- },
- }, {
- desc: "hierarchical languages",
- cat: []entry{
- {"en", "hello %s", "Hello %s!"},
- {"en-GB", "hello %s", "Hellø %s!"},
- {"en-US", "hello %s", "Howdy %s!"},
- {"en", "greetings %s and %s", "Greetings %s and %s!"},
- },
- test: []test{
- {"und", "hello %s", joe, "hello Joe"},
- {"nl", "hello %s", joe, "hello Joe"},
- {"en", "hello %s", joe, "Hello Joe!"},
- {"en-US", "hello %s", joe, "Howdy Joe!"},
- {"en-GB", "hello %s", joe, "Hellø Joe!"},
- {"en-oxendict", "hello %s", joe, "Hello Joe!"},
- {"en-US-oxendict-u-ms-metric", "hello %s", joe, "Howdy Joe!"},
-
- {"und", "greetings %s and %s", joeAndMary, "greetings Joe and Mary"},
- {"nl", "greetings %s and %s", joeAndMary, "greetings Joe and Mary"},
- {"en", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
- {"en-US", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
- {"en-GB", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
- {"en-oxendict", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
- {"en-US-oxendict-u-ms-metric", "greetings %s and %s", joeAndMary, "Greetings Joe and Mary!"},
- },
- }, {
- desc: "references",
- cat: []entry{
- {"en", "hello", "Hello!"},
- },
- test: []test{
- {"en", "hello", empty, "Hello!"},
- {"en", Key("hello", "fallback"), empty, "Hello!"},
- {"en", Key("xxx", "fallback"), empty, "fallback"},
- {"und", Key("hello", "fallback"), empty, "fallback"},
- },
- }, {
- desc: "zero substitution", // work around limitation of fmt
- cat: []entry{
- {"en", "hello %s", "Hello!"},
- {"en", "hi %s and %s", "Hello %[2]s!"},
- },
- test: []test{
- {"en", "hello %s", joe, "Hello!"},
- {"en", "hello %s", joeAndMary, "Hello!"},
- {"en", "hi %s and %s", joeAndMary, "Hello Mary!"},
- // The following tests resolve to the fallback string.
- {"und", "hello", joeAndMary, "hello"},
- {"und", "hello %%%%", joeAndMary, "hello %%"},
- {"und", "hello %#%%4.2% ", joeAndMary, "hello %% "},
- {"und", "hello %s", joeAndMary, "hello Joe%!(EXTRA string=Mary)"},
- {"und", "hello %+%%s", joeAndMary, "hello %Joe%!(EXTRA string=Mary)"},
- {"und", "hello %-42%%s ", joeAndMary, "hello %Joe %!(EXTRA string=Mary)"},
- },
- }, {
- desc: "number formatting", // work around limitation of fmt
- cat: []entry{
- {"und", "files", "%d files left"},
- {"und", "meters", "%.2f meters"},
- {"de", "files", "%d Dateien übrig"},
- },
- test: []test{
- {"en", "meters", args(3000.2), "3,000.20 meters"},
- {"en-u-nu-gujr", "files", args(123456), "૧૨૩,૪૫૬ files left"},
- {"de", "files", args(1234), "1.234 Dateien übrig"},
- {"de-CH", "files", args(1234), "1’234 Dateien übrig"},
- {"de-CH-u-nu-mong", "files", args(1234), "᠑’᠒᠓᠔ Dateien übrig"},
- },
- }}
-
- for _, tc := range testCases {
- cat, _ := initCat(tc.cat)
-
- for i, pt := range tc.test {
- t.Run(fmt.Sprintf("%s:%d", tc.desc, i), func(t *testing.T) {
- p := NewPrinter(language.MustParse(pt.tag), Catalog(cat))
-
- if got := p.Sprintf(pt.key, pt.args...); got != pt.want {
- t.Errorf("Sprintf(%q, %v) = %s; want %s",
- pt.key, pt.args, got, pt.want)
- return // Next error will likely be the same.
- }
-
- w := &bytes.Buffer{}
- p.Fprintf(w, pt.key, pt.args...)
- if got := w.String(); got != pt.want {
- t.Errorf("Fprintf(%q, %v) = %s; want %s",
- pt.key, pt.args, got, pt.want)
- }
- })
- }
- }
-}
-
-type entry struct{ tag, key, msg string }
-
-func initCat(entries []entry) (*catalog.Builder, []language.Tag) {
- tags := []language.Tag{}
- cat := catalog.NewBuilder()
- for _, e := range entries {
- tag := language.MustParse(e.tag)
- tags = append(tags, tag)
- cat.SetString(tag, e.key, e.msg)
- }
- return cat, internal.UniqueTags(tags)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/examples_test.go
deleted file mode 100644
index fb9bcc96078..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/examples_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number_test
-
-import (
- "golang.org/x/text/language"
- "golang.org/x/text/message"
- "golang.org/x/text/number"
-)
-
-func ExampleMaxIntegerDigits() {
- const year = 1999
- p := message.NewPrinter(language.English)
- p.Println("Year:", number.Decimal(year, number.MaxIntegerDigits(2)))
-
- // Output:
- // Year: 99
-}
-
-func ExampleIncrementString() {
- p := message.NewPrinter(language.English)
-
- p.Println(number.Decimal(1.33, number.IncrementString("0.50")))
-
- // Output: 1.50
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/format_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/format_test.go
deleted file mode 100644
index 0205f8d0d87..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/format_test.go
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/feature/plural"
- "golang.org/x/text/language"
- "golang.org/x/text/message"
-)
-
-func TestWrongVerb(t *testing.T) {
- testCases := []struct {
- f Formatter
- fmt string
- want string
- }{{
- f: Decimal(12),
- fmt: "%e",
- want: "%!e(int=12)",
- }, {
- f: Scientific(12),
- fmt: "%f",
- want: "%!f(int=12)",
- }, {
- f: Engineering(12),
- fmt: "%f",
- want: "%!f(int=12)",
- }, {
- f: Percent(12),
- fmt: "%e",
- want: "%!e(int=12)",
- }}
- for _, tc := range testCases {
- t.Run("", func(t *testing.T) {
- tag := language.Und
- got := message.NewPrinter(tag).Sprintf(tc.fmt, tc.f)
- if got != tc.want {
- t.Errorf("got %q; want %q", got, tc.want)
- }
- })
- }
-}
-
-func TestDigits(t *testing.T) {
- testCases := []struct {
- f Formatter
- scale int
- want string
- }{{
- f: Decimal(3),
- scale: 0,
- want: "digits:[3] exp:1 comma:0 end:1",
- }, {
- f: Decimal(3.1),
- scale: 0,
- want: "digits:[3] exp:1 comma:0 end:1",
- }, {
- f: Scientific(3.1),
- scale: 0,
- want: "digits:[3] exp:1 comma:1 end:1",
- }, {
- f: Scientific(3.1),
- scale: 3,
- want: "digits:[3 1] exp:1 comma:1 end:4",
- }}
- for _, tc := range testCases {
- t.Run("", func(t *testing.T) {
- d := tc.f.Digits(nil, language.Croatian, tc.scale)
- got := fmt.Sprintf("digits:%d exp:%d comma:%d end:%d", d.Digits, d.Exp, d.Comma, d.End)
- if got != tc.want {
- t.Errorf("got %v; want %v", got, tc.want)
- }
- })
- }
-}
-
-func TestPluralIntegration(t *testing.T) {
- testCases := []struct {
- f Formatter
- want string
- }{{
- f: Decimal(1),
- want: "one: 1",
- }, {
- f: Decimal(5),
- want: "other: 5",
- }}
- for _, tc := range testCases {
- t.Run("", func(t *testing.T) {
- message.Set(language.English, "num %f", plural.Selectf(1, "%f",
- "one", "one: %f",
- "other", "other: %f"))
-
- p := message.NewPrinter(language.English)
-
- // Indirect the call to p.Sprintf through the variable f
- // to avoid Go tip failing a vet check.
- // TODO: remove once vet check has been fixed. See Issue #22936.
- f := p.Sprintf
- got := f("num %f", tc.f)
-
- if got != tc.want {
- t.Errorf("got %q; want %q", got, tc.want)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/number_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/number_test.go
deleted file mode 100644
index 3dcac3649d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/number/number_test.go
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package number
-
-import (
- "strings"
- "testing"
-
- "golang.org/x/text/language"
- "golang.org/x/text/message"
-)
-
-func TestFormatter(t *testing.T) {
- overrides := map[string]string{
- "en": "*e#######0",
- "nl": "*n#######0",
- }
- testCases := []struct {
- desc string
- tag string
- f Formatter
- want string
- }{{
- desc: "decimal",
- f: Decimal(3),
- want: "3",
- }, {
- desc: "decimal fraction",
- f: Decimal(0.123),
- want: "0.123",
- }, {
- desc: "separators",
- f: Decimal(1234.567),
- want: "1,234.567",
- }, {
- desc: "no separators",
- f: Decimal(1234.567, NoSeparator()),
- want: "1234.567",
- }, {
- desc: "max integer",
- f: Decimal(1973, MaxIntegerDigits(2)),
- want: "73",
- }, {
- desc: "max integer overflow",
- f: Decimal(1973, MaxIntegerDigits(1000)),
- want: "1,973",
- }, {
- desc: "min integer",
- f: Decimal(12, MinIntegerDigits(5)),
- want: "00,012",
- }, {
- desc: "max fraction zero",
- f: Decimal(0.12345, MaxFractionDigits(0)),
- want: "0",
- }, {
- desc: "max fraction 2",
- f: Decimal(0.12, MaxFractionDigits(2)),
- want: "0.12",
- }, {
- desc: "min fraction 2",
- f: Decimal(0.12, MaxFractionDigits(2)),
- want: "0.12",
- }, {
- desc: "max fraction overflow",
- f: Decimal(0.125, MaxFractionDigits(1e6)),
- want: "0.125",
- }, {
- desc: "min integer overflow",
- f: Decimal(0, MinIntegerDigits(1e6)),
- want: strings.Repeat("000,", 255/3-1) + "000",
- }, {
- desc: "min fraction overflow",
- f: Decimal(0, MinFractionDigits(1e6)),
- want: "0." + strings.Repeat("0", 255), // TODO: fraction separators
- }, {
- desc: "format width",
- f: Decimal(123, FormatWidth(10)),
- want: " 123",
- }, {
- desc: "format width pad option before",
- f: Decimal(123, Pad('*'), FormatWidth(10)),
- want: "*******123",
- }, {
- desc: "format width pad option after",
- f: Decimal(123, FormatWidth(10), Pad('*')),
- want: "*******123",
- }, {
- desc: "format width illegal",
- f: Decimal(123, FormatWidth(-1)),
- want: "123",
- }, {
- desc: "increment",
- f: Decimal(10.33, IncrementString("0.5")),
- want: "10.5",
- }, {
- desc: "increment",
- f: Decimal(10, IncrementString("ppp")),
- want: "10",
- }, {
- desc: "increment and scale",
- f: Decimal(10.33, IncrementString("0.5"), Scale(2)),
- want: "10.50",
- }, {
- desc: "pattern overrides en",
- tag: "en",
- f: Decimal(101, PatternOverrides(overrides)),
- want: "eeeee101",
- }, {
- desc: "pattern overrides nl",
- tag: "nl",
- f: Decimal(101, PatternOverrides(overrides)),
- want: "nnnnn101",
- }, {
- desc: "pattern overrides de",
- tag: "de",
- f: Decimal(101, PatternOverrides(overrides)),
- want: "101",
- }, {
- desc: "language selection",
- tag: "bn",
- f: Decimal(123456.78, Scale(2)),
- want: "১,২৩,৪৫৬.৭৮",
- }, {
- desc: "scale",
- f: Decimal(1234.567, Scale(2)),
- want: "1,234.57",
- }, {
- desc: "scientific",
- f: Scientific(3.00),
- want: "3\u202f×\u202f10⁰",
- }, {
- desc: "scientific",
- f: Scientific(1234),
- want: "1.234\u202f×\u202f10³",
- }, {
- desc: "scientific",
- f: Scientific(1234, Scale(2)),
- want: "1.23\u202f×\u202f10³",
- }, {
- desc: "engineering",
- f: Engineering(12345),
- want: "12.345\u202f×\u202f10³",
- }, {
- desc: "engineering scale",
- f: Engineering(12345, Scale(2)),
- want: "12.34\u202f×\u202f10³",
- }, {
- desc: "engineering precision(4)",
- f: Engineering(12345, Precision(4)),
- want: "12.34\u202f×\u202f10³",
- }, {
- desc: "engineering precision(2)",
- f: Engineering(1234.5, Precision(2)),
- want: "1.2\u202f×\u202f10³",
- }, {
- desc: "percent",
- f: Percent(0.12),
- want: "12%",
- }, {
- desc: "permille",
- f: PerMille(0.123),
- want: "123‰",
- }, {
- desc: "percent rounding",
- f: PerMille(0.12345),
- want: "123‰",
- }, {
- desc: "percent fraction",
- f: PerMille(0.12345, Scale(2)),
- want: "123.45‰",
- }, {
- desc: "percent fraction",
- f: PerMille(0.12344, Scale(1)),
- want: "123.4‰",
- }}
- for _, tc := range testCases {
- t.Run(tc.desc, func(t *testing.T) {
- tag := language.Und
- if tc.tag != "" {
- tag = language.MustParse(tc.tag)
- }
- got := message.NewPrinter(tag).Sprint(tc.f)
- if got != tc.want {
- t.Errorf("got %q; want %q", got, tc.want)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/cond_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/cond_test.go
deleted file mode 100644
index 44cd36d0b15..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/cond_test.go
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package runes
-
-import (
- "strings"
- "testing"
- "unicode"
-
- "golang.org/x/text/cases"
- "golang.org/x/text/language"
- "golang.org/x/text/transform"
-)
-
-var (
- toUpper = cases.Upper(language.Und)
- toLower = cases.Lower(language.Und)
-)
-
-type spanformer interface {
- transform.SpanningTransformer
-}
-
-func TestPredicate(t *testing.T) {
- testConditional(t, func(rt *unicode.RangeTable, t, f spanformer) spanformer {
- return If(Predicate(func(r rune) bool {
- return unicode.Is(rt, r)
- }), t, f)
- })
-}
-
-func TestIn(t *testing.T) {
- testConditional(t, func(rt *unicode.RangeTable, t, f spanformer) spanformer {
- return If(In(rt), t, f)
- })
-}
-
-func TestNotIn(t *testing.T) {
- testConditional(t, func(rt *unicode.RangeTable, t, f spanformer) spanformer {
- return If(NotIn(rt), f, t)
- })
-}
-
-func testConditional(t *testing.T, f func(rt *unicode.RangeTable, t, f spanformer) spanformer) {
- lower := f(unicode.Latin, toLower, toLower)
-
- for i, tt := range []transformTest{{
- desc: "empty",
- szDst: large,
- atEOF: true,
- in: "",
- out: "",
- outFull: "",
- t: lower,
- }, {
- desc: "small",
- szDst: 1,
- atEOF: true,
- in: "B",
- out: "b",
- outFull: "b",
- errSpan: transform.ErrEndOfSpan,
- t: lower,
- }, {
- desc: "short dst",
- szDst: 2,
- atEOF: true,
- in: "AAA",
- out: "aa",
- outFull: "aaa",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: lower,
- }, {
- desc: "short dst writing error",
- szDst: 1,
- atEOF: false,
- in: "A\x80",
- out: "a",
- outFull: "a\x80",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: lower,
- }, {
- desc: "short dst writing incomplete rune",
- szDst: 2,
- atEOF: true,
- in: "Σ\xc2",
- out: "Σ",
- outFull: "Σ\xc2",
- err: transform.ErrShortDst,
- t: f(unicode.Latin, toLower, nil),
- }, {
- desc: "short dst, longer",
- szDst: 5,
- atEOF: true,
- in: "Hellø",
- out: "Hell",
- outFull: "Hellø",
- err: transform.ErrShortDst,
- // idem is used to test short buffers by forcing processing of full-rune increments.
- t: f(unicode.Latin, Map(idem), nil),
- }, {
- desc: "short dst, longer, writing error",
- szDst: 6,
- atEOF: false,
- in: "\x80Hello\x80",
- out: "\x80Hello",
- outFull: "\x80Hello\x80",
- err: transform.ErrShortDst,
- t: f(unicode.Latin, Map(idem), nil),
- }, {
- desc: "short src",
- szDst: 2,
- atEOF: false,
- in: "A\xc2",
- out: "a",
- outFull: "a\xc2",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: lower,
- }, {
- desc: "short src no change",
- szDst: 2,
- atEOF: false,
- in: "a\xc2",
- out: "a",
- outFull: "a\xc2",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrShortSrc,
- nSpan: 1,
- t: lower,
- }, {
- desc: "invalid input, atEOF",
- szDst: large,
- atEOF: true,
- in: "\x80",
- out: "\x80",
- outFull: "\x80",
- t: lower,
- }, {
- desc: "invalid input, !atEOF",
- szDst: large,
- atEOF: false,
- in: "\x80",
- out: "\x80",
- outFull: "\x80",
- t: lower,
- }, {
- desc: "invalid input, incomplete rune atEOF",
- szDst: large,
- atEOF: true,
- in: "\xc2",
- out: "\xc2",
- outFull: "\xc2",
- t: lower,
- }, {
- desc: "nop",
- szDst: large,
- atEOF: true,
- in: "Hello World!",
- out: "Hello World!",
- outFull: "Hello World!",
- t: f(unicode.Latin, nil, nil),
- }, {
- desc: "nop in",
- szDst: large,
- atEOF: true,
- in: "THIS IS α ΤΕΣΤ",
- out: "this is α ΤΕΣΤ",
- outFull: "this is α ΤΕΣΤ",
- errSpan: transform.ErrEndOfSpan,
- t: f(unicode.Greek, nil, toLower),
- }, {
- desc: "nop in latin",
- szDst: large,
- atEOF: true,
- in: "THIS IS α ΤΕΣΤ",
- out: "THIS IS α τεστ",
- outFull: "THIS IS α τεστ",
- errSpan: transform.ErrEndOfSpan,
- t: f(unicode.Latin, nil, toLower),
- }, {
- desc: "nop not in",
- szDst: large,
- atEOF: true,
- in: "THIS IS α ΤΕΣΤ",
- out: "this is α ΤΕΣΤ",
- outFull: "this is α ΤΕΣΤ",
- errSpan: transform.ErrEndOfSpan,
- t: f(unicode.Latin, toLower, nil),
- }, {
- desc: "pass atEOF is true when at end",
- szDst: large,
- atEOF: true,
- in: "hello",
- out: "HELLO",
- outFull: "HELLO",
- errSpan: transform.ErrEndOfSpan,
- t: f(unicode.Latin, upperAtEOF{}, nil),
- }, {
- desc: "pass atEOF is true when at end of segment",
- szDst: large,
- atEOF: true,
- in: "hello ",
- out: "HELLO ",
- outFull: "HELLO ",
- errSpan: transform.ErrEndOfSpan,
- t: f(unicode.Latin, upperAtEOF{}, nil),
- }, {
- desc: "don't pass atEOF is true when atEOF is false",
- szDst: large,
- atEOF: false,
- in: "hello",
- out: "",
- outFull: "HELLO",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrShortSrc,
- t: f(unicode.Latin, upperAtEOF{}, nil),
- }, {
- desc: "pass atEOF is true when at end, no change",
- szDst: large,
- atEOF: true,
- in: "HELLO",
- out: "HELLO",
- outFull: "HELLO",
- t: f(unicode.Latin, upperAtEOF{}, nil),
- }, {
- desc: "pass atEOF is true when at end of segment, no change",
- szDst: large,
- atEOF: true,
- in: "HELLO ",
- out: "HELLO ",
- outFull: "HELLO ",
- t: f(unicode.Latin, upperAtEOF{}, nil),
- }, {
- desc: "large input ASCII",
- szDst: 12000,
- atEOF: false,
- in: strings.Repeat("HELLO", 2000),
- out: strings.Repeat("hello", 2000),
- outFull: strings.Repeat("hello", 2000),
- errSpan: transform.ErrEndOfSpan,
- err: nil,
- t: lower,
- }, {
- desc: "large input non-ASCII",
- szDst: 12000,
- atEOF: false,
- in: strings.Repeat("\u3333", 2000),
- out: strings.Repeat("\u3333", 2000),
- outFull: strings.Repeat("\u3333", 2000),
- err: nil,
- t: lower,
- }} {
- tt.check(t, i)
- }
-}
-
-// upperAtEOF is a strange Transformer that converts text to uppercase, but only
-// if atEOF is true.
-type upperAtEOF struct{ transform.NopResetter }
-
-func (upperAtEOF) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if !atEOF {
- return 0, 0, transform.ErrShortSrc
- }
- return toUpper.Transform(dst, src, atEOF)
-}
-
-func (upperAtEOF) Span(src []byte, atEOF bool) (n int, err error) {
- if !atEOF {
- return 0, transform.ErrShortSrc
- }
- return toUpper.Span(src, atEOF)
-}
-
-func BenchmarkConditional(b *testing.B) {
- doBench(b, If(In(unicode.Hangul), transform.Nop, transform.Nop))
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/example_test.go
deleted file mode 100644
index a60bfd9d25b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/example_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package runes_test
-
-import (
- "fmt"
- "unicode"
-
- "golang.org/x/text/runes"
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/norm"
- "golang.org/x/text/width"
-)
-
-func ExampleRemove() {
- t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC)
- s, _, _ := transform.String(t, "résumé")
- fmt.Println(s)
-
- // Output:
- // resume
-}
-
-func ExampleMap() {
- replaceHyphens := runes.Map(func(r rune) rune {
- if unicode.Is(unicode.Hyphen, r) {
- return '|'
- }
- return r
- })
- s, _, _ := transform.String(replaceHyphens, "a-b‐c⸗d﹣e")
- fmt.Println(s)
-
- // Output:
- // a|b|c|d|e
-}
-
-func ExampleIn() {
- // Convert Latin characters to their canonical form, while keeping other
- // width distinctions.
- t := runes.If(runes.In(unicode.Latin), width.Fold, nil)
- s, _, _ := transform.String(t, "アルアノリウ tech / アルアノリウ tech")
- fmt.Println(s)
-
- // Output:
- // アルアノリウ tech / アルアノリウ tech
-}
-
-func ExampleIf() {
- // Widen everything but ASCII.
- isASCII := func(r rune) bool { return r <= unicode.MaxASCII }
- t := runes.If(runes.Predicate(isASCII), nil, width.Widen)
- s, _, _ := transform.String(t, "アルアノリウ tech / 中國 / 5₩")
- fmt.Println(s)
-
- // Output:
- // アルアノリウ tech / 中國 / 5₩
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/runes_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/runes_test.go
deleted file mode 100644
index 23c5bc952a5..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/runes/runes_test.go
+++ /dev/null
@@ -1,664 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package runes
-
-import (
- "strings"
- "testing"
- "unicode/utf8"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/transform"
-)
-
-type transformTest struct {
- desc string
- szDst int
- atEOF bool
- repl string
- in string
- out string // result string of first call to Transform
- outFull string // transform of entire input string
- err error
- errSpan error
- nSpan int
-
- t transform.SpanningTransformer
-}
-
-const large = 10240
-
-func (tt *transformTest) check(t *testing.T, i int) {
- if tt.t == nil {
- return
- }
- dst := make([]byte, tt.szDst)
- src := []byte(tt.in)
- nDst, nSrc, err := tt.t.Transform(dst, src, tt.atEOF)
- if err != tt.err {
- t.Errorf("%d:%s:error: got %v; want %v", i, tt.desc, err, tt.err)
- }
- if got := string(dst[:nDst]); got != tt.out {
- t.Errorf("%d:%s:out: got %q; want %q", i, tt.desc, got, tt.out)
- }
-
- // Calls tt.t.Transform for the remainder of the input. We use this to test
- // the nSrc return value.
- out := make([]byte, large)
- n := copy(out, dst[:nDst])
- nDst, _, _ = tt.t.Transform(out[n:], src[nSrc:], true)
- if got, want := string(out[:n+nDst]), tt.outFull; got != want {
- t.Errorf("%d:%s:outFull: got %q; want %q", i, tt.desc, got, want)
- }
-
- tt.t.Reset()
- p := 0
- for ; p < len(tt.in) && p < len(tt.outFull) && tt.in[p] == tt.outFull[p]; p++ {
- }
- if tt.nSpan != 0 {
- p = tt.nSpan
- }
- if n, err = tt.t.Span([]byte(tt.in), tt.atEOF); n != p || err != tt.errSpan {
- t.Errorf("%d:%s:span: got %d, %v; want %d, %v", i, tt.desc, n, err, p, tt.errSpan)
- }
-}
-
-func idem(r rune) rune { return r }
-
-func TestMap(t *testing.T) {
- runes := []rune{'a', 'ç', '中', '\U00012345', 'a'}
- // Default mapper used for this test.
- rotate := Map(func(r rune) rune {
- for i, m := range runes {
- if m == r {
- return runes[i+1]
- }
- }
- return r
- })
-
- for i, tt := range []transformTest{{
- desc: "empty",
- szDst: large,
- atEOF: true,
- in: "",
- out: "",
- outFull: "",
- t: rotate,
- }, {
- desc: "no change",
- szDst: 1,
- atEOF: true,
- in: "b",
- out: "b",
- outFull: "b",
- t: rotate,
- }, {
- desc: "short dst",
- szDst: 2,
- atEOF: true,
- in: "aaaa",
- out: "ç",
- outFull: "çççç",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "short dst ascii, no change",
- szDst: 2,
- atEOF: true,
- in: "bbb",
- out: "bb",
- outFull: "bbb",
- err: transform.ErrShortDst,
- t: rotate,
- }, {
- desc: "short dst writing error",
- szDst: 2,
- atEOF: false,
- in: "a\x80",
- out: "ç",
- outFull: "ç\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "short dst writing incomplete rune",
- szDst: 2,
- atEOF: true,
- in: "a\xc0",
- out: "ç",
- outFull: "ç\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "short dst, longer",
- szDst: 5,
- atEOF: true,
- in: "Hellø",
- out: "Hell",
- outFull: "Hellø",
- err: transform.ErrShortDst,
- t: rotate,
- }, {
- desc: "short dst, single",
- szDst: 1,
- atEOF: false,
- in: "ø",
- out: "",
- outFull: "ø",
- err: transform.ErrShortDst,
- t: Map(idem),
- }, {
- desc: "short dst, longer, writing error",
- szDst: 8,
- atEOF: false,
- in: "\x80Hello\x80",
- out: "\ufffdHello",
- outFull: "\ufffdHello\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "short src",
- szDst: 2,
- atEOF: false,
- in: "a\xc2",
- out: "ç",
- outFull: "ç\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "invalid input, atEOF",
- szDst: large,
- atEOF: true,
- in: "\x80",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "invalid input, !atEOF",
- szDst: large,
- atEOF: false,
- in: "\x80",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "incomplete rune !atEOF",
- szDst: large,
- atEOF: false,
- in: "\xc2",
- out: "",
- outFull: "\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrShortSrc,
- t: rotate,
- }, {
- desc: "invalid input, incomplete rune atEOF",
- szDst: large,
- atEOF: true,
- in: "\xc2",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "misc correct",
- szDst: large,
- atEOF: true,
- in: "a\U00012345 ç!",
- out: "ça 中!",
- outFull: "ça 中!",
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "misc correct and invalid",
- szDst: large,
- atEOF: true,
- in: "Hello\x80 w\x80orl\xc0d!\xc0",
- out: "Hello\ufffd w\ufffdorl\ufffdd!\ufffd",
- outFull: "Hello\ufffd w\ufffdorl\ufffdd!\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "misc correct and invalid, short src",
- szDst: large,
- atEOF: false,
- in: "Hello\x80 w\x80orl\xc0d!\xc2",
- out: "Hello\ufffd w\ufffdorl\ufffdd!",
- outFull: "Hello\ufffd w\ufffdorl\ufffdd!\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: rotate,
- }, {
- desc: "misc correct and invalid, short src, replacing RuneError",
- szDst: large,
- atEOF: false,
- in: "Hel\ufffdlo\x80 w\x80orl\xc0d!\xc2",
- out: "Hel?lo? w?orl?d!",
- outFull: "Hel?lo? w?orl?d!?",
- errSpan: transform.ErrEndOfSpan,
- err: transform.ErrShortSrc,
- t: Map(func(r rune) rune {
- if r == utf8.RuneError {
- return '?'
- }
- return r
- }),
- }} {
- tt.check(t, i)
- }
-}
-
-func TestRemove(t *testing.T) {
- remove := Remove(Predicate(func(r rune) bool {
- return strings.ContainsRune("aeiou\u0300\uFF24\U00012345", r)
- }))
-
- for i, tt := range []transformTest{
- 0: {
- szDst: large,
- atEOF: true,
- in: "",
- out: "",
- outFull: "",
- t: remove,
- },
- 1: {
- szDst: 0,
- atEOF: true,
- in: "aaaa",
- out: "",
- outFull: "",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 2: {
- szDst: 1,
- atEOF: true,
- in: "aaaa",
- out: "",
- outFull: "",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 3: {
- szDst: 1,
- atEOF: true,
- in: "baaaa",
- out: "b",
- outFull: "b",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 4: {
- szDst: 2,
- atEOF: true,
- in: "açaaa",
- out: "ç",
- outFull: "ç",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 5: {
- szDst: 2,
- atEOF: true,
- in: "aaaç",
- out: "ç",
- outFull: "ç",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 6: {
- szDst: 2,
- atEOF: false,
- in: "a\x80",
- out: "",
- outFull: "\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 7: {
- szDst: 1,
- atEOF: true,
- in: "a\xc0",
- out: "",
- outFull: "\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 8: {
- szDst: 1,
- atEOF: false,
- in: "a\xc2",
- out: "",
- outFull: "\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 9: {
- szDst: large,
- atEOF: true,
- in: "\x80",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 10: {
- szDst: large,
- atEOF: false,
- in: "\x80",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 11: {
- szDst: large,
- atEOF: true,
- in: "\xc2",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 12: {
- szDst: large,
- atEOF: false,
- in: "\xc2",
- out: "",
- outFull: "\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrShortSrc,
- t: remove,
- },
- 13: {
- szDst: large,
- atEOF: true,
- in: "Hello \U00012345world!",
- out: "Hll wrld!",
- outFull: "Hll wrld!",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 14: {
- szDst: large,
- atEOF: true,
- in: "Hello\x80 w\x80orl\xc0d!\xc0",
- out: "Hll\ufffd w\ufffdrl\ufffdd!\ufffd",
- outFull: "Hll\ufffd w\ufffdrl\ufffdd!\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 15: {
- szDst: large,
- atEOF: false,
- in: "Hello\x80 w\x80orl\xc0d!\xc2",
- out: "Hll\ufffd w\ufffdrl\ufffdd!",
- outFull: "Hll\ufffd w\ufffdrl\ufffdd!\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 16: {
- szDst: large,
- atEOF: false,
- in: "Hel\ufffdlo\x80 w\x80orl\xc0d!\xc2",
- out: "Hello world!",
- outFull: "Hello world!",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: Remove(Predicate(func(r rune) bool { return r == utf8.RuneError })),
- },
- 17: {
- szDst: 4,
- atEOF: true,
- in: "Hellø",
- out: "Hll",
- outFull: "Hllø",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 18: {
- szDst: 4,
- atEOF: false,
- in: "Hellø",
- out: "Hll",
- outFull: "Hllø",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 19: {
- szDst: 8,
- atEOF: false,
- in: "\x80Hello\uFF24\x80",
- out: "\ufffdHll",
- outFull: "\ufffdHll\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: remove,
- },
- 20: {
- szDst: 8,
- atEOF: false,
- in: "Hllll",
- out: "Hllll",
- outFull: "Hllll",
- t: remove,
- }} {
- tt.check(t, i)
- }
-}
-
-func TestReplaceIllFormed(t *testing.T) {
- replace := ReplaceIllFormed()
-
- for i, tt := range []transformTest{
- 0: {
- szDst: large,
- atEOF: true,
- in: "",
- out: "",
- outFull: "",
- t: replace,
- },
- 1: {
- szDst: 1,
- atEOF: true,
- in: "aa",
- out: "a",
- outFull: "aa",
- err: transform.ErrShortDst,
- t: replace,
- },
- 2: {
- szDst: 1,
- atEOF: true,
- in: "a\x80",
- out: "a",
- outFull: "a\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 3: {
- szDst: 1,
- atEOF: true,
- in: "a\xc2",
- out: "a",
- outFull: "a\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 4: {
- szDst: large,
- atEOF: true,
- in: "\x80",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 5: {
- szDst: large,
- atEOF: false,
- in: "\x80",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 6: {
- szDst: large,
- atEOF: true,
- in: "\xc2",
- out: "\ufffd",
- outFull: "\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 7: {
- szDst: large,
- atEOF: false,
- in: "\xc2",
- out: "",
- outFull: "\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrShortSrc,
- t: replace,
- },
- 8: {
- szDst: large,
- atEOF: true,
- in: "Hello world!",
- out: "Hello world!",
- outFull: "Hello world!",
- t: replace,
- },
- 9: {
- szDst: large,
- atEOF: true,
- in: "Hello\x80 w\x80orl\xc2d!\xc2",
- out: "Hello\ufffd w\ufffdorl\ufffdd!\ufffd",
- outFull: "Hello\ufffd w\ufffdorl\ufffdd!\ufffd",
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 10: {
- szDst: large,
- atEOF: false,
- in: "Hello\x80 w\x80orl\xc2d!\xc2",
- out: "Hello\ufffd w\ufffdorl\ufffdd!",
- outFull: "Hello\ufffd w\ufffdorl\ufffdd!\ufffd",
- err: transform.ErrShortSrc,
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 16: {
- szDst: 10,
- atEOF: false,
- in: "\x80Hello\x80",
- out: "\ufffdHello",
- outFull: "\ufffdHello\ufffd",
- err: transform.ErrShortDst,
- errSpan: transform.ErrEndOfSpan,
- t: replace,
- },
- 17: {
- szDst: 10,
- atEOF: false,
- in: "\ufffdHello\ufffd",
- out: "\ufffdHello",
- outFull: "\ufffdHello\ufffd",
- err: transform.ErrShortDst,
- t: replace,
- },
- } {
- tt.check(t, i)
- }
-}
-
-func TestMapAlloc(t *testing.T) {
- if n := testtext.AllocsPerRun(3, func() {
- Map(idem).Transform(nil, nil, false)
- }); n > 0 {
- t.Errorf("got %f; want 0", n)
- }
-}
-
-func rmNop(r rune) bool { return false }
-
-func TestRemoveAlloc(t *testing.T) {
- if n := testtext.AllocsPerRun(3, func() {
- Remove(Predicate(rmNop)).Transform(nil, nil, false)
- }); n > 0 {
- t.Errorf("got %f; want 0", n)
- }
-}
-
-func TestReplaceIllFormedAlloc(t *testing.T) {
- if n := testtext.AllocsPerRun(3, func() {
- ReplaceIllFormed().Transform(nil, nil, false)
- }); n > 0 {
- t.Errorf("got %f; want 0", n)
- }
-}
-
-func doBench(b *testing.B, t Transformer) {
- for _, bc := range []struct{ name, data string }{
- {"ascii", testtext.ASCII},
- {"3byte", testtext.ThreeByteUTF8},
- } {
- dst := make([]byte, 2*len(bc.data))
- src := []byte(bc.data)
-
- testtext.Bench(b, bc.name+"/transform", func(b *testing.B) {
- b.SetBytes(int64(len(src)))
- for i := 0; i < b.N; i++ {
- t.Transform(dst, src, true)
- }
- })
- src = t.Bytes(src)
- t.Reset()
- testtext.Bench(b, bc.name+"/span", func(b *testing.B) {
- b.SetBytes(int64(len(src)))
- for i := 0; i < b.N; i++ {
- t.Span(src, true)
- }
- })
- }
-}
-
-func BenchmarkRemove(b *testing.B) {
- doBench(b, Remove(Predicate(func(r rune) bool { return r == 'e' })))
-}
-
-func BenchmarkMapAll(b *testing.B) {
- doBench(b, Map(func(r rune) rune { return 'a' }))
-}
-
-func BenchmarkMapNone(b *testing.B) {
- doBench(b, Map(func(r rune) rune { return r }))
-}
-
-func BenchmarkReplaceIllFormed(b *testing.B) {
- doBench(b, ReplaceIllFormed())
-}
-
-var (
- input = strings.Repeat("Thé qüick brøwn føx jumps øver the lazy døg. ", 100)
-)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/search/pattern_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/search/pattern_test.go
deleted file mode 100644
index 931fa656289..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/search/pattern_test.go
+++ /dev/null
@@ -1,357 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package search
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "golang.org/x/text/language"
-)
-
-func TestCompile(t *testing.T) {
- for i, tc := range []struct {
- desc string
- pattern string
- options []Option
- n int
- }{{
- desc: "empty",
- pattern: "",
- n: 0,
- }, {
- desc: "single",
- pattern: "a",
- n: 1,
- }, {
- desc: "keep modifier",
- pattern: "a\u0300", // U+0300: COMBINING GRAVE ACCENT
- n: 2,
- }, {
- desc: "remove modifier",
- pattern: "a\u0300", // U+0300: COMBINING GRAVE ACCENT
- options: []Option{IgnoreDiacritics},
- n: 1,
- }, {
- desc: "single with double collation element",
- pattern: "ä",
- n: 2,
- }, {
- desc: "leading variable",
- pattern: " a",
- n: 2,
- }, {
- desc: "trailing variable",
- pattern: "aa ",
- n: 3,
- }, {
- desc: "leading and trailing variable",
- pattern: " äb ",
- n: 5,
- }, {
- desc: "keep interior variable",
- pattern: " ä b ",
- n: 6,
- }, {
- desc: "keep interior variables",
- pattern: " b ä ",
- n: 7,
- }, {
- desc: "remove ignoreables (zero-weights across the board)",
- pattern: "\u009Db\u009Dä\u009D", // U+009D: OPERATING SYSTEM COMMAND
- n: 3,
- }} {
- m := New(language.Und, tc.options...)
- p := m.CompileString(tc.pattern)
- if len(p.ce) != tc.n {
- t.Errorf("%d:%s: Compile(%+q): got %d; want %d", i, tc.desc, tc.pattern, len(p.ce), tc.n)
- }
- }
-}
-
-func TestNorm(t *testing.T) {
- // U+0300: COMBINING GRAVE ACCENT (CCC=230)
- // U+031B: COMBINING HORN (CCC=216)
- for _, tc := range []struct {
- desc string
- a string
- b string
- want bool // a and b compile into the same pattern?
- }{{
- "simple",
- "eee\u0300\u031b",
- "eee\u031b\u0300",
- true,
- }, {
- "large number of modifiers in pattern",
- strings.Repeat("\u0300", 29) + "\u0318",
- "\u0318" + strings.Repeat("\u0300", 29),
- true,
- }, {
- "modifier overflow in pattern",
- strings.Repeat("\u0300", 30) + "\u0318",
- "\u0318" + strings.Repeat("\u0300", 30),
- false,
- }} {
- m := New(language.Und)
- a := m.CompileString(tc.a)
- b := m.CompileString(tc.b)
- if got := reflect.DeepEqual(a, b); got != tc.want {
- t.Errorf("Compile(a) == Compile(b) == %v; want %v", got, tc.want)
- }
- }
-}
-
-func TestForwardSearch(t *testing.T) {
- for i, tc := range []struct {
- desc string
- tag string
- options []Option
- pattern string
- text string
- want []int
- }{{
- // The semantics of an empty search is to match nothing.
- // TODO: change this to be in line with strings.Index? It is quite a
- // different beast, so not sure yet.
-
- desc: "empty pattern and text",
- tag: "und",
- pattern: "",
- text: "",
- want: nil, // TODO: consider: []int{0, 0},
- }, {
- desc: "non-empty pattern and empty text",
- tag: "und",
- pattern: " ",
- text: "",
- want: nil,
- }, {
- desc: "empty pattern and non-empty text",
- tag: "und",
- pattern: "",
- text: "abc",
- want: nil, // TODO: consider: []int{0, 0, 1, 1, 2, 2, 3, 3},
- }, {
- // Variable-only patterns. We don't support variables at the moment,
- // but verify that, given this, the behavior is indeed as expected.
-
- desc: "exact match of variable",
- tag: "und",
- pattern: " ",
- text: " ",
- want: []int{0, 1},
- }, {
- desc: "variables not handled by default",
- tag: "und",
- pattern: "- ",
- text: " -",
- want: nil, // Would be (1, 2) for a median match with variable}.
- }, {
- desc: "multiple subsequent identical variables",
- tag: "und",
- pattern: " ",
- text: " ",
- want: []int{0, 1, 1, 2, 2, 3, 3, 4},
- }, {
- desc: "text with variables",
- tag: "und",
- options: []Option{IgnoreDiacritics},
- pattern: "abc",
- text: "3 abc 3",
- want: []int{2, 5},
- }, {
- desc: "pattern with interior variables",
- tag: "und",
- options: []Option{IgnoreDiacritics},
- pattern: "a b c",
- text: "3 a b c abc a b c 3",
- want: []int{2, 7}, // Would have 3 matches using variable.
-
- // TODO: Different variable handling settings.
- }, {
- // Options.
-
- desc: "match all levels",
- tag: "und",
- pattern: "Abc",
- text: "abcAbcABCÁbcábc",
- want: []int{3, 6},
- }, {
- desc: "ignore diacritics in text",
- tag: "und",
- options: []Option{IgnoreDiacritics},
- pattern: "Abc",
- text: "Ábc",
- want: []int{0, 4},
- }, {
- desc: "ignore diacritics in pattern",
- tag: "und",
- options: []Option{IgnoreDiacritics},
- pattern: "Ábc",
- text: "Abc",
- want: []int{0, 3},
- }, {
- desc: "ignore diacritics",
- tag: "und",
- options: []Option{IgnoreDiacritics},
- pattern: "Abc",
- text: "abcAbcABCÁbcábc",
- want: []int{3, 6, 9, 13},
- }, {
- desc: "ignore case",
- tag: "und",
- options: []Option{IgnoreCase},
- pattern: "Abc",
- text: "abcAbcABCÁbcábc",
- want: []int{0, 3, 3, 6, 6, 9},
- }, {
- desc: "ignore case and diacritics",
- tag: "und",
- options: []Option{IgnoreCase, IgnoreDiacritics},
- pattern: "Abc",
- text: "abcAbcABCÁbcábc",
- want: []int{0, 3, 3, 6, 6, 9, 9, 13, 13, 17},
- }, {
- desc: "ignore width to fullwidth",
- tag: "und",
- options: []Option{IgnoreWidth},
- pattern: "abc",
- text: "123 \uFF41\uFF42\uFF43 123", // U+FF41-3: FULLWIDTH LATIN SMALL LETTER A-C
- want: []int{4, 13},
- }, {
- // TODO: distinguish between case and width.
- desc: "don't ignore width to fullwidth, ignoring only case",
- tag: "und",
- options: []Option{IgnoreCase},
- pattern: "abc",
- text: "123 \uFF41\uFF42\uFF43 123", // U+FF41-3: FULLWIDTH LATIN SMALL LETTER A-C
- want: []int{4, 13},
- }, {
- desc: "ignore width to fullwidth and diacritics",
- tag: "und",
- options: []Option{IgnoreWidth, IgnoreDiacritics},
- pattern: "abc",
- text: "123 \uFF41\uFF42\uFF43 123", // U+FF41-3: FULLWIDTH LATIN SMALL LETTER A-C
- want: []int{4, 13},
- }, {
- desc: "whole grapheme, single rune",
- tag: "und",
- pattern: "eee",
- text: "123 eeé 123",
- want: nil,
- }, {
- // Note: rules on when to apply contractions may, for certain languages,
- // differ between search and collation. For example, "ch" is not
- // considered a contraction for the purpose of searching in Spanish.
- // Therefore, be careful picking this test.
- desc: "whole grapheme, contractions",
- tag: "da",
- pattern: "aba",
- // Fails at the primary level, because "aa" is a contraction.
- text: "123 abaa 123",
- want: []int{},
- }, {
- desc: "whole grapheme, trailing modifier",
- tag: "und",
- pattern: "eee",
- text: "123 eee\u0300 123", // U+0300: COMBINING GRAVE ACCENT
- want: nil,
- }, {
- // Language-specific matching.
-
- desc: "",
- tag: "da",
- options: []Option{IgnoreCase},
- pattern: "Århus",
- text: "AarhusÅrhus Århus ",
- want: []int{0, 6, 6, 12, 14, 20},
- }, {
- desc: "",
- tag: "da",
- options: []Option{IgnoreCase},
- pattern: "Aarhus",
- text: "Århus Aarhus",
- want: []int{0, 6, 7, 13},
- }, {
- desc: "",
- tag: "en", // Å does not match A for English.
- options: []Option{IgnoreCase},
- pattern: "Aarhus",
- text: "Århus",
- want: nil,
- }, {
- desc: "ignore modifier in text",
- options: []Option{IgnoreDiacritics},
- tag: "und",
- pattern: "eee",
- text: "123 eee\u0300 123", // U+0300: COMBINING GRAVE ACCENT
- want: []int{4, 9}, // Matches on grapheme boundary.
- }, {
- desc: "ignore multiple modifiers in text",
- options: []Option{IgnoreDiacritics},
- tag: "und",
- pattern: "eee",
- text: "123 eee\u0300\u0300 123", // U+0300: COMBINING GRAVE ACCENT
- want: []int{4, 11}, // Matches on grapheme boundary.
- }, {
- desc: "ignore modifier in pattern",
- options: []Option{IgnoreDiacritics},
- tag: "und",
- pattern: "eee\u0300", // U+0300: COMBINING GRAVE ACCENT
- text: "123 eee 123",
- want: []int{4, 7},
- }, {
- desc: "ignore multiple modifiers in pattern",
- options: []Option{IgnoreDiacritics},
- tag: "und",
- pattern: "eee\u0300\u0300", // U+0300: COMBINING GRAVE ACCENT
- text: "123 eee 123",
- want: []int{4, 7},
- }, {
- desc: "match non-normalized pattern",
- tag: "und",
- // U+0300: COMBINING GRAVE ACCENT (CCC=230)
- // U+031B: COMBINING HORN (CCC=216)
- pattern: "eee\u0300\u031b",
- text: "123 eee\u031b\u0300 123",
- want: []int{4, 11},
- }, {
- desc: "match non-normalized text",
- tag: "und",
- // U+0300: COMBINING GRAVE ACCENT (CCC=230)
- // U+031B: COMBINING HORN (CCC=216)
- pattern: "eee\u031b\u0300",
- text: "123 eee\u0300\u031b 123",
- want: []int{4, 11},
- }} {
- m := New(language.MustParse(tc.tag), tc.options...)
- p := m.CompileString(tc.pattern)
- for j := 0; j < len(tc.text); {
- start, end := p.IndexString(tc.text[j:])
- if start == -1 && end == -1 {
- j++
- continue
- }
- start += j
- end += j
- j = end
- if len(tc.want) == 0 {
- t.Errorf("%d:%s: found unexpected result [%d %d]", i, tc.desc, start, end)
- break
- }
- if tc.want[0] != start || tc.want[1] != end {
- t.Errorf("%d:%s: got [%d %d]; want %v", i, tc.desc, start, end, tc.want[:2])
- tc.want = tc.want[2:]
- break
- }
- tc.want = tc.want[2:]
- }
- if len(tc.want) != 0 {
- t.Errorf("%d:%s: %d extra results", i, tc.desc, len(tc.want)/2)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bench_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bench_test.go
deleted file mode 100644
index 2db922bfdc7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bench_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidirule
-
-import (
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-var benchData = []struct{ name, data string }{
- {"ascii", "Scheveningen"},
- {"arabic", "دبي"},
- {"hangul", "다음과"},
-}
-
-func doBench(b *testing.B, fn func(b *testing.B, data string)) {
- for _, d := range benchData {
- testtext.Bench(b, d.name, func(b *testing.B) { fn(b, d.data) })
- }
-}
-
-func BenchmarkSpan(b *testing.B) {
- r := New()
- doBench(b, func(b *testing.B, str string) {
- b.SetBytes(int64(len(str)))
- data := []byte(str)
- for i := 0; i < b.N; i++ {
- r.Reset()
- r.Span(data, true)
- }
- })
-}
-
-func BenchmarkDirectionASCII(b *testing.B) {
- doBench(b, func(b *testing.B, str string) {
- b.SetBytes(int64(len(str)))
- data := []byte(str)
- for i := 0; i < b.N; i++ {
- Direction(data)
- }
- })
-}
-
-func BenchmarkDirectionStringASCII(b *testing.B) {
- doBench(b, func(b *testing.B, str string) {
- b.SetBytes(int64(len(str)))
- for i := 0; i < b.N; i++ {
- DirectionString(str)
- }
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go
deleted file mode 100644
index 06ec5f5dfa8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0_test.go
+++ /dev/null
@@ -1,694 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.10
-
-package bidirule
-
-import (
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/bidi"
-)
-
-var testCases = [][]ruleTest{
- // Go-specific rules.
- // Invalid UTF-8 is invalid.
- 0: []ruleTest{{
- in: "",
- dir: bidi.LeftToRight,
- }, {
- in: "\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "abc\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: strR + "\x80",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strR + "\xcc",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strAL + "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strAL),
- }, {
- in: "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 0,
- }},
-
- // Rule 2.1: The first character must be a character with Bidi property L,
- // R, or AL. If it has the R or AL property, it is an RTL label; if it has
- // the L property, it is an LTR label.
- 1: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAN,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- }, {
- in: strEN,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strEN),
- }, {
- in: strES,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strES),
- }, {
- in: strET,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strET),
- }, {
- in: strCS,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strCS),
- }, {
- in: strNSM,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strNSM),
- }, {
- in: strBN,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strBN),
- }, {
- in: strB,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strB),
- }, {
- in: strS,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strS),
- }, {
- in: strWS,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strWS),
- }, {
- in: strON,
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: len(strON),
- }, {
- in: strEN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strES + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strET + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strCS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strNSM + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strBN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strB + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strWS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strON + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }},
-
- // Rule 2.2: In an RTL label, only characters with the Bidi properties R,
- // AL, AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 2: []ruleTest{{
- in: strR + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.3: In an RTL label, the end of the label must be a character with
- // Bidi property R, AL, EN, or AN, followed by zero or more characters with
- // Bidi property NSM.
- 3: []ruleTest{{
- in: strR + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strET,
- dir: bidi.RightToLeft,
- n: len(strR + strET),
- err: ErrInvalid,
- }, {
- in: strR + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strET,
- dir: bidi.RightToLeft,
- n: len(strAL + strET),
- err: ErrInvalid,
- }, {
- in: strAL + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.4: In an RTL label, if an EN is present, no AN may be present,
- // and vice versa.
- 4: []ruleTest{{
- in: strR + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strR + strEN),
- err: ErrInvalid,
- }, {
- in: strR + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strAN),
- err: ErrInvalid,
- }, {
- in: strAL + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strAL + strEN),
- err: ErrInvalid,
- }, {
- in: strAL + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strAN),
- err: ErrInvalid,
- }},
-
- // Rule 2.5: In an LTR label, only characters with the Bidi properties L,
- // EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 5: []ruleTest{{
- in: strL + strL + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strCS + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strET + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strON + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strBN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strR + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strB + strL),
- err: ErrInvalid,
- }, {
- in: strL + strB + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB + strL),
- err: ErrInvalid,
- }, {
- in: strL + strS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strWS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strWS + strL),
- err: ErrInvalid,
- }},
-
- // Rule 2.6: In an LTR label, the end of the label must be a character with
- // Bidi property L or EN, followed by zero or more characters with Bidi
- // property NSM.
- 6: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES,
- dir: bidi.LeftToRight,
- n: len(strL + strES),
- err: ErrInvalid,
- }, {
- in: strL + strES + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strES),
- err: ErrInvalid,
- }, {
- in: strL + strCS,
- dir: bidi.LeftToRight,
- n: len(strL + strCS),
- err: ErrInvalid,
- }, {
- in: strL + strCS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strCS),
- err: ErrInvalid,
- }, {
- in: strL + strET,
- dir: bidi.LeftToRight,
- n: len(strL + strET),
- err: ErrInvalid,
- }, {
- in: strL + strET + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strET),
- err: ErrInvalid,
- }, {
- in: strL + strON,
- dir: bidi.LeftToRight,
- n: len(strL + strON),
- err: ErrInvalid,
- }, {
- in: strL + strON + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strON),
- err: ErrInvalid,
- }, {
- in: strL + strBN,
- dir: bidi.LeftToRight,
- n: len(strL + strBN),
- err: ErrInvalid,
- }, {
- in: strL + strBN + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strBN),
- err: ErrInvalid,
- }, {
- in: strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strS,
- dir: bidi.LeftToRight,
- n: len(strL + strS),
- err: ErrInvalid,
- }, {
- in: strL + strS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strS),
- err: ErrInvalid,
- }, {
- in: strL + strWS,
- dir: bidi.LeftToRight,
- n: len(strL + strWS),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strWS),
- err: ErrInvalid,
- }},
-
- // Incremental processing.
- 9: []ruleTest{{
- in: "e\u0301", // é
- dir: bidi.LeftToRight,
-
- pSrc: 2,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- in: "e\u1000f", // é
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- // Remain invalid once invalid.
- in: strR + "ab",
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
-
- pSrc: len(strR) + 1,
- nSrc: len(strR),
- err0: ErrInvalid,
- }, {
- // Short destination
- in: "abcdefghij",
- dir: bidi.LeftToRight,
-
- pSrc: 10,
- szDst: 5,
- nSrc: 5,
- err0: transform.ErrShortDst,
- }, {
- in: "\U000102f7",
- dir: bidi.LeftToRight,
- n: len("\U000102f7"),
- err: ErrInvalid,
- }, {
- // Short destination splitting input rune
- in: "e\u0301",
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- szDst: 2,
- nSrc: 1,
- err0: transform.ErrShortDst,
- }, {
- // Unicode 10.0.0 IDNA test string.
- in: "FAX\u2a77\U0001d186",
- dir: bidi.LeftToRight,
- n: len("FAX\u2a77\U0001d186"),
- err: ErrInvalid,
- }, {
- in: "\x80\u0660",
- dir: bidi.RightToLeft,
- n: 0,
- err: ErrInvalid,
- }},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go
deleted file mode 100644
index 008874ed348..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0_test.go
+++ /dev/null
@@ -1,668 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.10
-
-package bidirule
-
-import (
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/bidi"
-)
-
-var testCases = [][]ruleTest{
- // Go-specific rules.
- // Invalid UTF-8 is invalid.
- 0: []ruleTest{{
- in: "",
- dir: bidi.LeftToRight,
- }, {
- in: "\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: "abc\x80",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xcc",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "abc\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 3,
- }, {
- in: "\xccdef",
- dir: bidi.LeftToRight,
- err: ErrInvalid,
- n: 0,
- }, {
- in: strR + "\x80",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strR + "\xcc",
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strR),
- }, {
- in: strAL + "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: len(strAL),
- }, {
- in: "\xcc" + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 0,
- }},
-
- // Rule 2.1: The first character must be a character with Bidi property L,
- // R, or AL. If it has the R or AL property, it is an RTL label; if it has
- // the L property, it is an LTR label.
- 1: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAN,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- }, {
- in: strEN,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strES,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strET,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strCS,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strNSM,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strBN,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strB,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strS,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strWS,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strON,
- dir: bidi.LeftToRight,
- err: nil, // not an RTL string
- }, {
- in: strEN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strES + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strET + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strCS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strNSM + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 2,
- }, {
- in: strBN + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strB + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 3,
- }, {
- in: strS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strWS + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }, {
- in: strON + strR,
- dir: bidi.RightToLeft,
- err: ErrInvalid,
- n: 1,
- }},
-
- // Rule 2.2: In an RTL label, only characters with the Bidi properties R,
- // AL, AN, EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 2: []ruleTest{{
- in: strR + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strR + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strCS + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strET + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strON + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strBN + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strNSM + strAL,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS + strAL,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.3: In an RTL label, the end of the label must be a character with
- // Bidi property R, AL, EN, or AN, followed by zero or more characters with
- // Bidi property NSM.
- 3: []ruleTest{{
- in: strR + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strR + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strET,
- dir: bidi.RightToLeft,
- n: len(strR + strET),
- err: ErrInvalid,
- }, {
- in: strR + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strR + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strR + strWS,
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
- }, {
- in: strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strR,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAL + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strEN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strAN,
- dir: bidi.RightToLeft,
- }, {
- in: strAL + strES + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strES + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strCS + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strCS + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strET,
- dir: bidi.RightToLeft,
- n: len(strAL + strET),
- err: ErrInvalid,
- }, {
- in: strAL + strON + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strON + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strBN + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strBN + strNSM + strNSM),
- err: ErrInvalid,
- }, {
- in: strAL + strL + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strB + strNSM + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }, {
- in: strAL + strWS,
- dir: bidi.RightToLeft,
- n: len(strAL),
- err: ErrInvalid,
- }},
-
- // Rule 2.4: In an RTL label, if an EN is present, no AN may be present,
- // and vice versa.
- 4: []ruleTest{{
- in: strR + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strR + strEN),
- err: ErrInvalid,
- }, {
- in: strR + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strR + strAN),
- err: ErrInvalid,
- }, {
- in: strAL + strEN + strAN,
- dir: bidi.RightToLeft,
- n: len(strAL + strEN),
- err: ErrInvalid,
- }, {
- in: strAL + strAN + strEN + strNSM,
- dir: bidi.RightToLeft,
- n: len(strAL + strAN),
- err: ErrInvalid,
- }},
-
- // Rule 2.5: In an LTR label, only characters with the Bidi properties L,
- // EN, ES, CS, ET, ON, BN, or NSM are allowed.
- 5: []ruleTest{{
- in: strL + strL + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strCS + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strET + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strON + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strBN + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strR + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN + strL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strAN + strL),
- err: nil,
- }, {
- in: strL + strB + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB + strL),
- err: ErrInvalid,
- }, {
- in: strL + strS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strS + strL),
- err: nil,
- }, {
- in: strL + strS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strS + strL),
- err: ErrInvalid,
- }, {
- in: strL + strWS + strL,
- dir: bidi.LeftToRight,
- n: len(strL + strWS + strL),
- err: nil,
- }, {
- in: strL + strWS + strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strWS + strL),
- err: ErrInvalid,
- }},
-
- // Rule 2.6: In an LTR label, the end of the label must be a character with
- // Bidi property L or EN, followed by zero or more characters with Bidi
- // property NSM.
- 6: []ruleTest{{
- in: strL,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strEN + strNSM + strNSM,
- dir: bidi.LeftToRight,
- }, {
- in: strL + strES,
- dir: bidi.LeftToRight,
- n: len(strL + strES),
- err: nil,
- }, {
- in: strL + strES + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strES),
- err: ErrInvalid,
- }, {
- in: strL + strCS,
- dir: bidi.LeftToRight,
- n: len(strL + strCS),
- err: nil,
- }, {
- in: strL + strCS + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strCS),
- err: ErrInvalid,
- }, {
- in: strL + strET,
- dir: bidi.LeftToRight,
- n: len(strL + strET),
- err: nil,
- }, {
- in: strL + strET + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strET),
- err: ErrInvalid,
- }, {
- in: strL + strON,
- dir: bidi.LeftToRight,
- n: len(strL + strON),
- err: nil,
- }, {
- in: strL + strON + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strON),
- err: ErrInvalid,
- }, {
- in: strL + strBN,
- dir: bidi.LeftToRight,
- n: len(strL + strBN),
- err: nil,
- }, {
- in: strL + strBN + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strBN),
- err: ErrInvalid,
- }, {
- in: strL + strR,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAL,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strAN,
- dir: bidi.RightToLeft,
- n: len(strL),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: nil,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: nil,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }, {
- in: strL + strB,
- dir: bidi.LeftToRight,
- n: len(strL + strB),
- err: nil,
- }, {
- in: strL + strB + strR,
- dir: bidi.RightToLeft,
- n: len(strL + strB),
- err: ErrInvalid,
- }},
-
- // Incremental processing.
- 9: []ruleTest{{
- in: "e\u0301", // é
- dir: bidi.LeftToRight,
-
- pSrc: 2,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- in: "e\u1000f", // é
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- nSrc: 1,
- err0: transform.ErrShortSrc,
- }, {
- // Remain invalid once invalid.
- in: strR + "ab",
- dir: bidi.RightToLeft,
- n: len(strR),
- err: ErrInvalid,
-
- pSrc: len(strR) + 1,
- nSrc: len(strR),
- err0: ErrInvalid,
- }, {
- // Short destination
- in: "abcdefghij",
- dir: bidi.LeftToRight,
-
- pSrc: 10,
- szDst: 5,
- nSrc: 5,
- err0: transform.ErrShortDst,
- }, {
- // Short destination splitting input rune
- in: "e\u0301",
- dir: bidi.LeftToRight,
-
- pSrc: 3,
- szDst: 2,
- nSrc: 1,
- err0: transform.ErrShortDst,
- }},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go
deleted file mode 100644
index e8fde3383da..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidirule
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/unicode/bidi"
-)
-
-const (
- strL = "ABC" // Left to right - most letters in LTR scripts
- strR = "עברית" // Right to left - most letters in non-Arabic RTL scripts
- strAL = "دبي" // Arabic letters - most letters in the Arabic script
- strEN = "123" // European Number (0-9, and Extended Arabic-Indic numbers)
- strES = "+-" // European Number Separator (+ and -)
- strET = "$" // European Number Terminator (currency symbols, the hash sign, the percent sign and so on)
- strAN = "\u0660" // Arabic Number; this encompasses the Arabic-Indic numbers, but not the Extended Arabic-Indic numbers
- strCS = "," // Common Number Separator (. , / : et al)
- strNSM = "\u0300" // Nonspacing Mark - most combining accents
- strBN = "\u200d" // Boundary Neutral - control characters (ZWNJ, ZWJ, and others)
- strB = "\u2029" // Paragraph Separator
- strS = "\u0009" // Segment Separator
- strWS = " " // Whitespace, including the SPACE character
- strON = "@" // Other Neutrals, including @, &, parentheses, MIDDLE DOT
-)
-
-type ruleTest struct {
- in string
- dir bidi.Direction
- n int // position at which the rule fails
- err error
-
- // For tests that split the string in two.
- pSrc int // number of source bytes to consume first
- szDst int // size of destination buffer
- nSrc int // source bytes consumed and bytes written
- err0 error // error after first run
-}
-
-func init() {
- for rule, cases := range testCases {
- for i, tc := range cases {
- if tc.err == nil {
- testCases[rule][i].n = len(tc.in)
- }
- }
- }
-}
-
-func doTests(t *testing.T, fn func(t *testing.T, tc ruleTest)) {
- for rule, cases := range testCases {
- for i, tc := range cases {
- name := fmt.Sprintf("%d/%d:%+q:%s", rule, i, tc.in, tc.in)
- testtext.Run(t, name, func(t *testing.T) {
- fn(t, tc)
- })
- }
- }
-}
-
-func TestDirection(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- dir := Direction([]byte(tc.in))
- if dir != tc.dir {
- t.Errorf("dir was %v; want %v", dir, tc.dir)
- }
- })
-}
-
-func TestDirectionString(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- dir := DirectionString(tc.in)
- if dir != tc.dir {
- t.Errorf("dir was %v; want %v", dir, tc.dir)
- }
- })
-}
-
-func TestValid(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- got := Valid([]byte(tc.in))
- want := tc.err == nil
- if got != want {
- t.Fatalf("Valid: got %v; want %v", got, want)
- }
-
- got = ValidString(tc.in)
- want = tc.err == nil
- if got != want {
- t.Fatalf("Valid: got %v; want %v", got, want)
- }
- })
-}
-
-func TestSpan(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- // Skip tests that test for limited destination buffer size.
- if tc.szDst > 0 {
- return
- }
-
- r := New()
- src := []byte(tc.in)
-
- n, err := r.Span(src[:tc.pSrc], tc.pSrc == len(tc.in))
- if err != tc.err0 {
- t.Errorf("err0 was %v; want %v", err, tc.err0)
- }
- if n != tc.nSrc {
- t.Fatalf("nSrc was %d; want %d", n, tc.nSrc)
- }
-
- n, err = r.Span(src[n:], true)
- if err != tc.err {
- t.Errorf("error was %v; want %v", err, tc.err)
- }
- if got := n + tc.nSrc; got != tc.n {
- t.Errorf("n was %d; want %d", got, tc.n)
- }
- })
-}
-
-func TestTransform(t *testing.T) {
- doTests(t, func(t *testing.T, tc ruleTest) {
- r := New()
-
- src := []byte(tc.in)
- dst := make([]byte, len(tc.in))
- if tc.szDst > 0 {
- dst = make([]byte, tc.szDst)
- }
-
- // First transform operates on a zero-length string for most tests.
- nDst, nSrc, err := r.Transform(dst, src[:tc.pSrc], tc.pSrc == len(tc.in))
- if err != tc.err0 {
- t.Errorf("err0 was %v; want %v", err, tc.err0)
- }
- if nDst != nSrc {
- t.Fatalf("nDst (%d) and nSrc (%d) should match", nDst, nSrc)
- }
- if nSrc != tc.nSrc {
- t.Fatalf("nSrc was %d; want %d", nSrc, tc.nSrc)
- }
-
- dst1 := make([]byte, len(tc.in))
- copy(dst1, dst[:nDst])
-
- nDst, nSrc, err = r.Transform(dst1[nDst:], src[nSrc:], true)
- if err != tc.err {
- t.Errorf("error was %v; want %v", err, tc.err)
- }
- if nDst != nSrc {
- t.Fatalf("nDst (%d) and nSrc (%d) should match", nDst, nSrc)
- }
- n := nSrc + tc.nSrc
- if n != tc.n {
- t.Fatalf("n was %d; want %d", n, tc.n)
- }
- if got, want := string(dst1[:n]), tc.in[:tc.n]; got != want {
- t.Errorf("got %+q; want %+q", got, want)
- }
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/benchmark_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/benchmark_test.go
deleted file mode 100644
index 6337d00639b..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/benchmark_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package precis
-
-import (
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-var benchData = []struct{ name, str string }{
- {"ASCII", "Malvolio"},
- {"NotNormalized", "abcdefg\u0301\u031f"},
- {"Arabic", "دبي"},
- {"Hangul", "동일조건변경허락"},
-}
-
-var benchProfiles = []struct {
- name string
- p *Profile
-}{
- {"FreeForm", NewFreeform()},
- {"Nickname", Nickname},
- {"OpaqueString", OpaqueString},
- {"UsernameCaseMapped", UsernameCaseMapped},
- {"UsernameCasePreserved", UsernameCasePreserved},
-}
-
-func doBench(b *testing.B, f func(b *testing.B, p *Profile, s string)) {
- for _, bp := range benchProfiles {
- for _, d := range benchData {
- testtext.Bench(b, bp.name+"/"+d.name, func(b *testing.B) {
- f(b, bp.p, d.str)
- })
- }
- }
-}
-
-func BenchmarkString(b *testing.B) {
- doBench(b, func(b *testing.B, p *Profile, s string) {
- for i := 0; i < b.N; i++ {
- p.String(s)
- }
- })
-}
-
-func BenchmarkBytes(b *testing.B) {
- doBench(b, func(b *testing.B, p *Profile, s string) {
- src := []byte(s)
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- p.Bytes(src)
- }
- })
-}
-
-func BenchmarkAppend(b *testing.B) {
- doBench(b, func(b *testing.B, p *Profile, s string) {
- src := []byte(s)
- dst := make([]byte, 0, 4096)
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- p.Append(dst, src)
- }
- })
-}
-
-func BenchmarkTransform(b *testing.B) {
- doBench(b, func(b *testing.B, p *Profile, s string) {
- src := []byte(s)
- dst := make([]byte, 2*len(s))
- t := p.NewTransformer()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- t.Transform(dst, src, true)
- }
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/class_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/class_test.go
deleted file mode 100644
index fbaf6457f4a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/class_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package precis
-
-import (
- "testing"
-
- "golang.org/x/text/runes"
-)
-
-// Compile-time regression test to ensure that Class is a Set
-var _ runes.Set = (*class)(nil)
-
-// Ensure that certain characters are (or are not) in the identifer class.
-func TestClassContains(t *testing.T) {
- tests := []struct {
- name string
- class *class
- allowed []rune
- disallowed []rune
- }{
- {
- name: "Identifier",
- class: identifier,
- allowed: []rune("Aa0\u0021\u007e\u00df\u3007"),
- disallowed: []rune("\u2150\u2100\u2200\u3164\u2190\u2600\u303b\u1e9b"),
- },
- {
- name: "Freeform",
- class: freeform,
- allowed: []rune("Aa0\u0021\u007e\u00df\u3007 \u2150\u2100\u2200\u2190\u2600\u1e9b"),
- disallowed: []rune("\u3164\u303b"),
- },
- }
-
- for _, rt := range tests {
- for _, r := range rt.allowed {
- if !rt.class.Contains(r) {
- t.Errorf("Class %s should contain %U", rt.name, r)
- }
- }
- for _, r := range rt.disallowed {
- if rt.class.Contains(r) {
- t.Errorf("Class %s should not contain %U", rt.name, r)
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce10.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce10.0.0_test.go
deleted file mode 100644
index f2249364e46..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce10.0.0_test.go
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.10
-
-package precis
-
-import (
- "golang.org/x/text/secure/bidirule"
-)
-
-var enforceTestCases = []struct {
- name string
- p *Profile
- cases []testCase
-}{
- {"Basic", NewFreeform(), []testCase{
- {"e\u0301\u031f", "\u00e9\u031f", nil}, // normalize
- }},
-
- {"Context Rule 1", NewFreeform(), []testCase{
- // Rule 1: zero-width non-joiner (U+200C)
- // From RFC:
- // False
- // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
- // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
- // (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
- //
- // Example runes for different joining types:
- // Join L: U+A872; PHAGS-PA SUPERFIXED LETTER RA
- // Join D: U+062C; HAH WITH DOT BELOW
- // Join T: U+0610; ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM
- // Join R: U+0627; ALEF
- // Virama: U+0A4D; GURMUKHI SIGN VIRAMA
- // Virama and Join T: U+0ACD; GUJARATI SIGN VIRAMA
- {"\u200c", "", errContext},
- {"\u200ca", "", errContext},
- {"a\u200c", "", errContext},
- {"\u200c\u0627", "", errContext}, // missing JoinStart
- {"\u062c\u200c", "", errContext}, // missing JoinEnd
- {"\u0610\u200c\u0610\u0627", "", errContext}, // missing JoinStart
- {"\u062c\u0610\u200c\u0610", "", errContext}, // missing JoinEnd
-
- // Variants of: D T* U+200c T* R
- {"\u062c\u200c\u0627", "\u062c\u200c\u0627", nil},
- {"\u062c\u0610\u200c\u0610\u0627", "\u062c\u0610\u200c\u0610\u0627", nil},
- {"\u062c\u0610\u0610\u200c\u0610\u0610\u0627", "\u062c\u0610\u0610\u200c\u0610\u0610\u0627", nil},
- {"\u062c\u0610\u200c\u0627", "\u062c\u0610\u200c\u0627", nil},
- {"\u062c\u200c\u0610\u0627", "\u062c\u200c\u0610\u0627", nil},
-
- // Variants of: L T* U+200c T* D
- {"\ua872\u200c\u062c", "\ua872\u200c\u062c", nil},
- {"\ua872\u0610\u200c\u0610\u062c", "\ua872\u0610\u200c\u0610\u062c", nil},
- {"\ua872\u0610\u0610\u200c\u0610\u0610\u062c", "\ua872\u0610\u0610\u200c\u0610\u0610\u062c", nil},
- {"\ua872\u0610\u200c\u062c", "\ua872\u0610\u200c\u062c", nil},
- {"\ua872\u200c\u0610\u062c", "\ua872\u200c\u0610\u062c", nil},
-
- // Virama
- {"\u0a4d\u200c", "\u0a4d\u200c", nil},
- {"\ua872\u0a4d\u200c", "\ua872\u0a4d\u200c", nil},
- {"\ua872\u0a4d\u0610\u200c", "", errContext},
- {"\ua872\u0a4d\u0610\u200c", "", errContext},
-
- {"\u0acd\u200c", "\u0acd\u200c", nil},
- {"\ua872\u0acd\u200c", "\ua872\u0acd\u200c", nil},
- {"\ua872\u0acd\u0610\u200c", "", errContext},
- {"\ua872\u0acd\u0610\u200c", "", errContext},
-
- // Using Virama as join T
- {"\ua872\u0acd\u200c\u062c", "\ua872\u0acd\u200c\u062c", nil},
- {"\ua872\u200c\u0acd\u062c", "\ua872\u200c\u0acd\u062c", nil},
- }},
-
- {"Context Rule 2", NewFreeform(), []testCase{
- // Rule 2: zero-width joiner (U+200D)
- {"\u200d", "", errContext},
- {"\u200da", "", errContext},
- {"a\u200d", "", errContext},
-
- {"\u0a4d\u200d", "\u0a4d\u200d", nil},
- {"\ua872\u0a4d\u200d", "\ua872\u0a4d\u200d", nil},
- {"\u0a4da\u200d", "", errContext},
- }},
-
- {"Context Rule 3", NewFreeform(), []testCase{
- // Rule 3: middle dot
- {"·", "", errContext},
- {"l·", "", errContext},
- {"·l", "", errContext},
- {"a·", "", errContext},
- {"l·a", "", errContext},
- {"a·a", "", errContext},
- {"l·l", "l·l", nil},
- {"al·la", "al·la", nil},
- }},
-
- {"Context Rule 4", NewFreeform(), []testCase{
- // Rule 4: Greek lower numeral U+0375
- {"͵", "", errContext},
- {"͵a", "", errContext},
- {"α͵", "", errContext},
- {"͵α", "͵α", nil},
- {"α͵α", "α͵α", nil},
- {"͵͵α", "͵͵α", nil}, // The numeric sign is itself Greek.
- {"α͵͵α", "α͵͵α", nil},
- {"α͵͵", "", errContext},
- {"α͵͵a", "", errContext},
- }},
-
- {"Context Rule 5+6", NewFreeform(), []testCase{
- // Rule 5+6: Hebrew preceding
- // U+05f3: Geresh
- {"׳", "", errContext},
- {"׳ה", "", errContext},
- {"a׳b", "", errContext},
- {"ש׳", "ש׳", nil}, // U+05e9 U+05f3
- {"ש׳׳׳", "ש׳׳׳", nil}, // U+05e9 U+05f3
-
- // U+05f4: Gershayim
- {"״", "", errContext},
- {"״ה", "", errContext},
- {"a״b", "", errContext},
- {"ש״", "ש״", nil}, // U+05e9 U+05f4
- {"ש״״״", "ש״״״", nil}, // U+05e9 U+05f4
- {"aש״״״", "aש״״״", nil}, // U+05e9 U+05f4
- }},
-
- {"Context Rule 7", NewFreeform(), []testCase{
- // Rule 7: Katakana middle Dot
- {"・", "", errContext},
- {"abc・", "", errContext},
- {"・def", "", errContext},
- {"abc・def", "", errContext},
- {"aヅc・def", "aヅc・def", nil},
- {"abc・dぶf", "abc・dぶf", nil},
- {"⺐bc・def", "⺐bc・def", nil},
- }},
-
- {"Context Rule 8+9", NewFreeform(), []testCase{
- // Rule 8+9: Arabic Indic Digit
- {"١٢٣٤٥۶", "", errContext},
- {"۱۲۳۴۵٦", "", errContext},
- {"١٢٣٤٥", "١٢٣٤٥", nil},
- {"۱۲۳۴۵", "۱۲۳۴۵", nil},
- }},
-
- {"Nickname", Nickname, []testCase{
- {" Swan of Avon ", "Swan of Avon", nil},
- {"", "", errEmptyString},
- {" ", "", errEmptyString},
- {" ", "", errEmptyString},
- {"a\u00A0a\u1680a\u2000a\u2001a\u2002a\u2003a\u2004a\u2005a\u2006a\u2007a\u2008a\u2009a\u200Aa\u202Fa\u205Fa\u3000a", "a a a a a a a a a a a a a a a a a", nil},
- {"Foo", "Foo", nil},
- {"foo", "foo", nil},
- {"Foo Bar", "Foo Bar", nil},
- {"foo bar", "foo bar", nil},
- {"\u03A3", "\u03A3", nil},
- {"\u03C3", "\u03C3", nil},
- // Greek final sigma is left as is (do not fold!)
- {"\u03C2", "\u03C2", nil},
- {"\u265A", "♚", nil},
- {"Richard \u2163", "Richard IV", nil},
- {"\u212B", "Å", nil},
- {"\uFB00", "ff", nil}, // because of NFKC
- {"שa", "שa", nil}, // no bidi rule
- {"동일조건변경허락", "동일조건변경허락", nil},
- }},
- {"OpaqueString", OpaqueString, []testCase{
- {" Swan of Avon ", " Swan of Avon ", nil},
- {"", "", errEmptyString},
- {" ", " ", nil},
- {" ", " ", nil},
- {"a\u00A0a\u1680a\u2000a\u2001a\u2002a\u2003a\u2004a\u2005a\u2006a\u2007a\u2008a\u2009a\u200Aa\u202Fa\u205Fa\u3000a", "a a a a a a a a a a a a a a a a a", nil},
- {"Foo", "Foo", nil},
- {"foo", "foo", nil},
- {"Foo Bar", "Foo Bar", nil},
- {"foo bar", "foo bar", nil},
- {"\u03C3", "\u03C3", nil},
- {"Richard \u2163", "Richard \u2163", nil},
- {"\u212B", "Å", nil},
- {"Jack of \u2666s", "Jack of \u2666s", nil},
- {"my cat is a \u0009by", "", errDisallowedRune},
- {"שa", "שa", nil}, // no bidi rule
- }},
- {"UsernameCaseMapped", UsernameCaseMapped, []testCase{
- // TODO: Should this work?
- // {UsernameCaseMapped, "", "", errDisallowedRune},
- {"juliet@example.com", "juliet@example.com", nil},
- {"fussball", "fussball", nil},
- {"fu\u00DFball", "fu\u00DFball", nil},
- {"\u03C0", "\u03C0", nil},
- {"\u03A3", "\u03C3", nil},
- {"\u03C3", "\u03C3", nil},
- // Greek final sigma is left as is (do not fold!)
- {"\u03C2", "\u03C2", nil},
- {"\u0049", "\u0069", nil},
- {"\u0049", "\u0069", nil},
- {"\u03D2", "", errDisallowedRune},
- {"\u03B0", "\u03B0", nil},
- {"foo bar", "", errDisallowedRune},
- {"♚", "", bidirule.ErrInvalid},
- {"\u007E", "~", nil},
- {"a", "a", nil},
- {"!", "!", nil},
- {"²", "", bidirule.ErrInvalid},
- {"\t", "", errDisallowedRune},
- {"\n", "", errDisallowedRune},
- {"\u26D6", "", bidirule.ErrInvalid},
- {"\u26FF", "", bidirule.ErrInvalid},
- {"\uFB00", "", errDisallowedRune},
- {"\u1680", "", bidirule.ErrInvalid},
- {" ", "", errDisallowedRune},
- {" ", "", errDisallowedRune},
- {"\u01C5", "", errDisallowedRune},
- {"\u16EE", "", errDisallowedRune}, // Nl RUNIC ARLAUG SYMBOL
- {"\u0488", "", bidirule.ErrInvalid}, // Me COMBINING CYRILLIC HUNDRED THOUSANDS SIGN
- {"\u212B", "\u00e5", nil}, // Angstrom sign, NFC -> U+00E5
- {"A\u030A", "å", nil}, // A + ring
- {"\u00C5", "å", nil}, // A with ring
- {"\u00E7", "ç", nil}, // c cedille
- {"\u0063\u0327", "ç", nil}, // c + cedille
- {"\u0158", "ř", nil},
- {"\u0052\u030C", "ř", nil},
-
- {"\u1E61", "\u1E61", nil}, // LATIN SMALL LETTER S WITH DOT ABOVE
-
- // Confusable characters ARE allowed and should NOT be mapped.
- {"\u0410", "\u0430", nil}, // CYRILLIC CAPITAL LETTER A
-
- // Full width should be mapped to the canonical decomposition.
- {"AB", "ab", nil},
- {"שc", "", bidirule.ErrInvalid}, // bidi rule
-
- }},
- {"UsernameCasePreserved", UsernameCasePreserved, []testCase{
- {"ABC", "ABC", nil},
- {"AB", "AB", nil},
- {"שc", "", bidirule.ErrInvalid}, // bidi rule
- {"\uFB00", "", errDisallowedRune},
- {"\u212B", "\u00c5", nil}, // Angstrom sign, NFC -> U+00E5
- {"ẛ", "", errDisallowedRune}, // LATIN SMALL LETTER LONG S WITH DOT ABOVE
- }},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce9.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce9.0.0_test.go
deleted file mode 100644
index 298c8a9bd7a..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce9.0.0_test.go
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.10
-
-package precis
-
-import (
- "golang.org/x/text/secure/bidirule"
-)
-
-var enforceTestCases = []struct {
- name string
- p *Profile
- cases []testCase
-}{
- {"Basic", NewFreeform(), []testCase{
- {"e\u0301\u031f", "\u00e9\u031f", nil}, // normalize
- }},
-
- {"Context Rule 1", NewFreeform(), []testCase{
- // Rule 1: zero-width non-joiner (U+200C)
- // From RFC:
- // False
- // If Canonical_Combining_Class(Before(cp)) .eq. Virama Then True;
- // If RegExpMatch((Joining_Type:{L,D})(Joining_Type:T)*\u200C
- // (Joining_Type:T)*(Joining_Type:{R,D})) Then True;
- //
- // Example runes for different joining types:
- // Join L: U+A872; PHAGS-PA SUPERFIXED LETTER RA
- // Join D: U+062C; HAH WITH DOT BELOW
- // Join T: U+0610; ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM
- // Join R: U+0627; ALEF
- // Virama: U+0A4D; GURMUKHI SIGN VIRAMA
- // Virama and Join T: U+0ACD; GUJARATI SIGN VIRAMA
- {"\u200c", "", errContext},
- {"\u200ca", "", errContext},
- {"a\u200c", "", errContext},
- {"\u200c\u0627", "", errContext}, // missing JoinStart
- {"\u062c\u200c", "", errContext}, // missing JoinEnd
- {"\u0610\u200c\u0610\u0627", "", errContext}, // missing JoinStart
- {"\u062c\u0610\u200c\u0610", "", errContext}, // missing JoinEnd
-
- // Variants of: D T* U+200c T* R
- {"\u062c\u200c\u0627", "\u062c\u200c\u0627", nil},
- {"\u062c\u0610\u200c\u0610\u0627", "\u062c\u0610\u200c\u0610\u0627", nil},
- {"\u062c\u0610\u0610\u200c\u0610\u0610\u0627", "\u062c\u0610\u0610\u200c\u0610\u0610\u0627", nil},
- {"\u062c\u0610\u200c\u0627", "\u062c\u0610\u200c\u0627", nil},
- {"\u062c\u200c\u0610\u0627", "\u062c\u200c\u0610\u0627", nil},
-
- // Variants of: L T* U+200c T* D
- {"\ua872\u200c\u062c", "\ua872\u200c\u062c", nil},
- {"\ua872\u0610\u200c\u0610\u062c", "\ua872\u0610\u200c\u0610\u062c", nil},
- {"\ua872\u0610\u0610\u200c\u0610\u0610\u062c", "\ua872\u0610\u0610\u200c\u0610\u0610\u062c", nil},
- {"\ua872\u0610\u200c\u062c", "\ua872\u0610\u200c\u062c", nil},
- {"\ua872\u200c\u0610\u062c", "\ua872\u200c\u0610\u062c", nil},
-
- // Virama
- {"\u0a4d\u200c", "\u0a4d\u200c", nil},
- {"\ua872\u0a4d\u200c", "\ua872\u0a4d\u200c", nil},
- {"\ua872\u0a4d\u0610\u200c", "", errContext},
- {"\ua872\u0a4d\u0610\u200c", "", errContext},
-
- {"\u0acd\u200c", "\u0acd\u200c", nil},
- {"\ua872\u0acd\u200c", "\ua872\u0acd\u200c", nil},
- {"\ua872\u0acd\u0610\u200c", "", errContext},
- {"\ua872\u0acd\u0610\u200c", "", errContext},
-
- // Using Virama as join T
- {"\ua872\u0acd\u200c\u062c", "\ua872\u0acd\u200c\u062c", nil},
- {"\ua872\u200c\u0acd\u062c", "\ua872\u200c\u0acd\u062c", nil},
- }},
-
- {"Context Rule 2", NewFreeform(), []testCase{
- // Rule 2: zero-width joiner (U+200D)
- {"\u200d", "", errContext},
- {"\u200da", "", errContext},
- {"a\u200d", "", errContext},
-
- {"\u0a4d\u200d", "\u0a4d\u200d", nil},
- {"\ua872\u0a4d\u200d", "\ua872\u0a4d\u200d", nil},
- {"\u0a4da\u200d", "", errContext},
- }},
-
- {"Context Rule 3", NewFreeform(), []testCase{
- // Rule 3: middle dot
- {"·", "", errContext},
- {"l·", "", errContext},
- {"·l", "", errContext},
- {"a·", "", errContext},
- {"l·a", "", errContext},
- {"a·a", "", errContext},
- {"l·l", "l·l", nil},
- {"al·la", "al·la", nil},
- }},
-
- {"Context Rule 4", NewFreeform(), []testCase{
- // Rule 4: Greek lower numeral U+0375
- {"͵", "", errContext},
- {"͵a", "", errContext},
- {"α͵", "", errContext},
- {"͵α", "͵α", nil},
- {"α͵α", "α͵α", nil},
- {"͵͵α", "͵͵α", nil}, // The numeric sign is itself Greek.
- {"α͵͵α", "α͵͵α", nil},
- {"α͵͵", "", errContext},
- {"α͵͵a", "", errContext},
- }},
-
- {"Context Rule 5+6", NewFreeform(), []testCase{
- // Rule 5+6: Hebrew preceding
- // U+05f3: Geresh
- {"׳", "", errContext},
- {"׳ה", "", errContext},
- {"a׳b", "", errContext},
- {"ש׳", "ש׳", nil}, // U+05e9 U+05f3
- {"ש׳׳׳", "ש׳׳׳", nil}, // U+05e9 U+05f3
-
- // U+05f4: Gershayim
- {"״", "", errContext},
- {"״ה", "", errContext},
- {"a״b", "", errContext},
- {"ש״", "ש״", nil}, // U+05e9 U+05f4
- {"ש״״״", "ש״״״", nil}, // U+05e9 U+05f4
- {"aש״״״", "aש״״״", nil}, // U+05e9 U+05f4
- }},
-
- {"Context Rule 7", NewFreeform(), []testCase{
- // Rule 7: Katakana middle Dot
- {"・", "", errContext},
- {"abc・", "", errContext},
- {"・def", "", errContext},
- {"abc・def", "", errContext},
- {"aヅc・def", "aヅc・def", nil},
- {"abc・dぶf", "abc・dぶf", nil},
- {"⺐bc・def", "⺐bc・def", nil},
- }},
-
- {"Context Rule 8+9", NewFreeform(), []testCase{
- // Rule 8+9: Arabic Indic Digit
- {"١٢٣٤٥۶", "", errContext},
- {"۱۲۳۴۵٦", "", errContext},
- {"١٢٣٤٥", "١٢٣٤٥", nil},
- {"۱۲۳۴۵", "۱۲۳۴۵", nil},
- }},
-
- {"Nickname", Nickname, []testCase{
- {" Swan of Avon ", "Swan of Avon", nil},
- {"", "", errEmptyString},
- {" ", "", errEmptyString},
- {" ", "", errEmptyString},
- {"a\u00A0a\u1680a\u2000a\u2001a\u2002a\u2003a\u2004a\u2005a\u2006a\u2007a\u2008a\u2009a\u200Aa\u202Fa\u205Fa\u3000a", "a a a a a a a a a a a a a a a a a", nil},
- {"Foo", "Foo", nil},
- {"foo", "foo", nil},
- {"Foo Bar", "Foo Bar", nil},
- {"foo bar", "foo bar", nil},
- {"\u03A3", "\u03A3", nil},
- {"\u03C3", "\u03C3", nil},
- // Greek final sigma is left as is (do not fold!)
- {"\u03C2", "\u03C2", nil},
- {"\u265A", "♚", nil},
- {"Richard \u2163", "Richard IV", nil},
- {"\u212B", "Å", nil},
- {"\uFB00", "ff", nil}, // because of NFKC
- {"שa", "שa", nil}, // no bidi rule
- {"동일조건변경허락", "동일조건변경허락", nil},
- }},
- {"OpaqueString", OpaqueString, []testCase{
- {" Swan of Avon ", " Swan of Avon ", nil},
- {"", "", errEmptyString},
- {" ", " ", nil},
- {" ", " ", nil},
- {"a\u00A0a\u1680a\u2000a\u2001a\u2002a\u2003a\u2004a\u2005a\u2006a\u2007a\u2008a\u2009a\u200Aa\u202Fa\u205Fa\u3000a", "a a a a a a a a a a a a a a a a a", nil},
- {"Foo", "Foo", nil},
- {"foo", "foo", nil},
- {"Foo Bar", "Foo Bar", nil},
- {"foo bar", "foo bar", nil},
- {"\u03C3", "\u03C3", nil},
- {"Richard \u2163", "Richard \u2163", nil},
- {"\u212B", "Å", nil},
- {"Jack of \u2666s", "Jack of \u2666s", nil},
- {"my cat is a \u0009by", "", errDisallowedRune},
- {"שa", "שa", nil}, // no bidi rule
- }},
- {"UsernameCaseMapped", UsernameCaseMapped, []testCase{
- // TODO: Should this work?
- // {UsernameCaseMapped, "", "", errDisallowedRune},
- {"juliet@example.com", "juliet@example.com", nil},
- {"fussball", "fussball", nil},
- {"fu\u00DFball", "fu\u00DFball", nil},
- {"\u03C0", "\u03C0", nil},
- {"\u03A3", "\u03C3", nil},
- {"\u03C3", "\u03C3", nil},
- // Greek final sigma is left as is (do not fold!)
- {"\u03C2", "\u03C2", nil},
- {"\u0049", "\u0069", nil},
- {"\u0049", "\u0069", nil},
- {"\u03D2", "", errDisallowedRune},
- {"\u03B0", "\u03B0", nil},
- {"foo bar", "", errDisallowedRune},
- {"♚", "", errDisallowedRune},
- {"\u007E", "~", nil},
- {"a", "a", nil},
- {"!", "!", nil},
- {"²", "", errDisallowedRune},
- {"\t", "", errDisallowedRune},
- {"\n", "", errDisallowedRune},
- {"\u26D6", "", errDisallowedRune},
- {"\u26FF", "", errDisallowedRune},
- {"\uFB00", "", errDisallowedRune},
- {"\u1680", "", errDisallowedRune},
- {" ", "", errDisallowedRune},
- {" ", "", errDisallowedRune},
- {"\u01C5", "", errDisallowedRune},
- {"\u16EE", "", errDisallowedRune}, // Nl RUNIC ARLAUG SYMBOL
- {"\u0488", "", errDisallowedRune}, // Me COMBINING CYRILLIC HUNDRED THOUSANDS SIGN
- {"\u212B", "\u00e5", nil}, // Angstrom sign, NFC -> U+00E5
- {"A\u030A", "å", nil}, // A + ring
- {"\u00C5", "å", nil}, // A with ring
- {"\u00E7", "ç", nil}, // c cedille
- {"\u0063\u0327", "ç", nil}, // c + cedille
- {"\u0158", "ř", nil},
- {"\u0052\u030C", "ř", nil},
-
- {"\u1E61", "\u1E61", nil}, // LATIN SMALL LETTER S WITH DOT ABOVE
-
- // Confusable characters ARE allowed and should NOT be mapped.
- {"\u0410", "\u0430", nil}, // CYRILLIC CAPITAL LETTER A
-
- // Full width should be mapped to the canonical decomposition.
- {"AB", "ab", nil},
- {"שc", "", bidirule.ErrInvalid}, // bidi rule
-
- }},
- {"UsernameCasePreserved", UsernameCasePreserved, []testCase{
- {"ABC", "ABC", nil},
- {"AB", "AB", nil},
- {"שc", "", bidirule.ErrInvalid}, // bidi rule
- {"\uFB00", "", errDisallowedRune},
- {"\u212B", "\u00c5", nil}, // Angstrom sign, NFC -> U+00E5
- {"ẛ", "", errDisallowedRune}, // LATIN SMALL LETTER LONG S WITH DOT ABOVE
- }},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce_test.go
deleted file mode 100644
index ac2aad2c667..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/enforce_test.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package precis
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/transform"
-)
-
-type testCase struct {
- input string
- output string
- err error
-}
-
-func doTests(t *testing.T, fn func(t *testing.T, p *Profile, tc testCase)) {
- for _, g := range enforceTestCases {
- for i, tc := range g.cases {
- name := fmt.Sprintf("%s:%d:%+q", g.name, i, tc.input)
- testtext.Run(t, name, func(t *testing.T) {
- fn(t, g.p, tc)
- })
- }
- }
-}
-
-func TestString(t *testing.T) {
- doTests(t, func(t *testing.T, p *Profile, tc testCase) {
- if e, err := p.String(tc.input); tc.err != err || e != tc.output {
- t.Errorf("got %+q (err: %v); want %+q (err: %v)", e, err, tc.output, tc.err)
- }
- })
-}
-
-func TestBytes(t *testing.T) {
- doTests(t, func(t *testing.T, p *Profile, tc testCase) {
- if e, err := p.Bytes([]byte(tc.input)); tc.err != err || string(e) != tc.output {
- t.Errorf("got %+q (err: %v); want %+q (err: %v)", string(e), err, tc.output, tc.err)
- }
- })
-
- t.Run("Copy", func(t *testing.T) {
- // Test that calling Bytes with something that doesn't transform returns a
- // copy.
- orig := []byte("hello")
- b, _ := NewFreeform().Bytes(orig)
- if reflect.ValueOf(b).Pointer() == reflect.ValueOf(orig).Pointer() {
- t.Error("original and result are the same slice; should be a copy")
- }
- })
-}
-
-func TestAppend(t *testing.T) {
- doTests(t, func(t *testing.T, p *Profile, tc testCase) {
- if e, err := p.Append(nil, []byte(tc.input)); tc.err != err || string(e) != tc.output {
- t.Errorf("got %+q (err: %v); want %+q (err: %v)", string(e), err, tc.output, tc.err)
- }
- })
-}
-
-func TestStringMallocs(t *testing.T) {
- if n := testtext.AllocsPerRun(100, func() { UsernameCaseMapped.String("helloworld") }); n > 0 {
- // TODO: reduce this to 0.
- t.Skipf("got %f allocs, want 0", n)
- }
-}
-
-func TestAppendMallocs(t *testing.T) {
- str := []byte("helloworld")
- out := make([]byte, 0, len(str))
- if n := testtext.AllocsPerRun(100, func() { UsernameCaseMapped.Append(out, str) }); n > 0 {
- t.Errorf("got %f allocs, want 0", n)
- }
-}
-
-func TestTransformMallocs(t *testing.T) {
- str := []byte("helloworld")
- out := make([]byte, 0, len(str))
- tr := UsernameCaseMapped.NewTransformer()
- if n := testtext.AllocsPerRun(100, func() {
- tr.Reset()
- tr.Transform(out, str, true)
- }); n > 0 {
- t.Errorf("got %f allocs, want 0", n)
- }
-}
-
-func min(a, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-// TestTransformerShortBuffers tests that the precis.Transformer implements the
-// spirit, not just the letter (the method signatures), of the
-// transform.Transformer interface.
-//
-// In particular, it tests that, if one or both of the dst or src buffers are
-// short, so that multiple Transform calls are required to complete the overall
-// transformation, the end result is identical to one Transform call with
-// sufficiently long buffers.
-func TestTransformerShortBuffers(t *testing.T) {
- srcUnit := []byte("a\u0300cce\u0301nts") // NFD normalization form.
- wantUnit := []byte("àccénts") // NFC normalization form.
- src := bytes.Repeat(srcUnit, 16)
- want := bytes.Repeat(wantUnit, 16)
- const long = 4096
- dst := make([]byte, long)
-
- // 5, 7, 9, 11, 13, 16 and 17 are all pair-wise co-prime, which means that
- // slicing the dst and src buffers into 5, 7, 13 and 17 byte chunks will
- // fall at different places inside the repeated srcUnit's and wantUnit's.
- if len(srcUnit) != 11 || len(wantUnit) != 9 || len(src) > long || len(want) > long {
- t.Fatal("inconsistent lengths")
- }
-
- tr := NewFreeform().NewTransformer()
- for _, deltaD := range []int{5, 7, 13, 17, long} {
- loop:
- for _, deltaS := range []int{5, 7, 13, 17, long} {
- tr.Reset()
- d0 := 0
- s0 := 0
- for {
- d1 := min(len(dst), d0+deltaD)
- s1 := min(len(src), s0+deltaS)
- nDst, nSrc, err := tr.Transform(dst[d0:d1:d1], src[s0:s1:s1], s1 == len(src))
- d0 += nDst
- s0 += nSrc
- if err == nil {
- break
- }
- if err == transform.ErrShortDst || err == transform.ErrShortSrc {
- continue
- }
- t.Errorf("deltaD=%d, deltaS=%d: %v", deltaD, deltaS, err)
- continue loop
- }
- if s0 != len(src) {
- t.Errorf("deltaD=%d, deltaS=%d: s0: got %d, want %d", deltaD, deltaS, s0, len(src))
- continue
- }
- if d0 != len(want) {
- t.Errorf("deltaD=%d, deltaS=%d: d0: got %d, want %d", deltaD, deltaS, d0, len(want))
- continue
- }
- got := dst[:d0]
- if !bytes.Equal(got, want) {
- t.Errorf("deltaD=%d, deltaS=%d:\ngot %q\nwant %q", deltaD, deltaS, got, want)
- continue
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/profile_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/profile_test.go
deleted file mode 100644
index 4edb28a760e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/profile_test.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package precis
-
-import (
- "fmt"
- "math/rand"
- "testing"
- "unicode"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/transform"
-)
-
-// copyOrbit is a Transformer for the sole purpose of testing the apply method,
-// testing that apply will always call Span for the prefix of the input that
-// remains identical and then call Transform for the remainder. It will produce
-// inconsistent output for other usage patterns.
-// Provided that copyOrbit is used this way, the first t bytes of the output
-// will be identical to the input and the remaining output will be the result
-// of calling caseOrbit on the remaining input bytes.
-type copyOrbit int
-
-func (t copyOrbit) Reset() {}
-func (t copyOrbit) Span(src []byte, atEOF bool) (n int, err error) {
- if int(t) == len(src) {
- return int(t), nil
- }
- return int(t), transform.ErrEndOfSpan
-}
-
-// Transform implements transform.Transformer specifically for testing the apply method.
-// See documentation of copyOrbit before using this method.
-func (t copyOrbit) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := copy(dst, src)
- for i, c := range dst[:n] {
- dst[i] = orbitCase(c)
- }
- return n, n, nil
-}
-
-func orbitCase(c byte) byte {
- if unicode.IsLower(rune(c)) {
- return byte(unicode.ToUpper(rune(c)))
- } else {
- return byte(unicode.ToLower(rune(c)))
- }
-}
-
-func TestBuffers(t *testing.T) {
- want := "Those who cannot remember the past are condemned to compute it."
-
- spans := rand.Perm(len(want) + 1)
-
- // Compute the result of applying copyOrbit(span) transforms in reverse.
- input := []byte(want)
- for i := len(spans) - 1; i >= 0; i-- {
- for j := spans[i]; j < len(input); j++ {
- input[j] = orbitCase(input[j])
- }
- }
-
- // Apply the copyOrbit(span) transforms.
- b := buffers{src: input}
- for _, n := range spans {
- b.apply(copyOrbit(n))
- if n%11 == 0 {
- b.apply(transform.Nop)
- }
- }
- if got := string(b.src); got != want {
- t.Errorf("got %q; want %q", got, want)
- }
-}
-
-type compareTestCase struct {
- a string
- b string
- result bool
-}
-
-var compareTestCases = []struct {
- name string
- p *Profile
- cases []compareTestCase
-}{
- {"Nickname", Nickname, []compareTestCase{
- {"a", "b", false},
- {" Swan of Avon ", "swan of avon", true},
- {"Foo", "foo", true},
- {"foo", "foo", true},
- {"Foo Bar", "foo bar", true},
- {"foo bar", "foo bar", true},
- {"\u03A3", "\u03C3", true},
- {"\u03A3", "\u03C2", false},
- {"\u03C3", "\u03C2", false},
- {"Richard \u2163", "richard iv", true},
- {"Å", "å", true},
- {"ff", "ff", true}, // because of NFKC
- {"ß", "sS", false},
-
- // After applying the Nickname profile, \u00a8 becomes \u0020\u0308,
- // however because the nickname profile is not idempotent, applying it again
- // to \u0020\u0308 results in \u0308.
- {"\u00a8", "\u0020\u0308", true},
- {"\u00a8", "\u0308", true},
- {"\u0020\u0308", "\u0308", true},
- }},
-}
-
-func doCompareTests(t *testing.T, fn func(t *testing.T, p *Profile, tc compareTestCase)) {
- for _, g := range compareTestCases {
- for i, tc := range g.cases {
- name := fmt.Sprintf("%s:%d:%+q", g.name, i, tc.a)
- testtext.Run(t, name, func(t *testing.T) {
- fn(t, g.p, tc)
- })
- }
- }
-}
-
-func TestCompare(t *testing.T) {
- doCompareTests(t, func(t *testing.T, p *Profile, tc compareTestCase) {
- if result := p.Compare(tc.a, tc.b); result != tc.result {
- t.Errorf("got %v; want %v", result, tc.result)
- }
- })
-}
-
-func TestCompareString(t *testing.T) {
- doCompareTests(t, func(t *testing.T, p *Profile, tc compareTestCase) {
- a, err := p.CompareKey(tc.a)
- if err != nil {
- t.Errorf("Unexpected error when creating key: %v", err)
- return
- }
- b, err := p.CompareKey(tc.b)
- if err != nil {
- t.Errorf("Unexpected error when creating key: %v", err)
- return
- }
-
- if result := (a == b); result != tc.result {
- t.Errorf("got %v; want %v", result, tc.result)
- }
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/tables_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/tables_test.go
deleted file mode 100644
index 67f5b40c67c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/secure/precis/tables_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package precis
-
-import (
- "testing"
- "unicode"
- "unicode/utf8"
-
- "golang.org/x/text/runes"
- "golang.org/x/text/unicode/rangetable"
-)
-
-type tableTest struct {
- rangeTable *unicode.RangeTable
- prop property
-}
-
-var exceptions = runes.Predicate(func(r rune) bool {
- switch uint32(r) {
- case 0x00DF, 0x03C2, 0x06FD, 0x06FE, 0x0F0B, 0x3007, 0x00B7, 0x0375, 0x05F3,
- 0x05F4, 0x30FB, 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666,
- 0x0667, 0x0668, 0x0669, 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5,
- 0x06F6, 0x06F7, 0x06F8, 0x06F9, 0x0640, 0x07FA, 0x302E, 0x302F, 0x3031,
- 0x3032, 0x3033, 0x3034, 0x3035, 0x303B:
- return true
- default:
- return false
- }
-})
-
-// Ensure that certain properties were generated correctly.
-func TestTable(t *testing.T) {
- tests := []tableTest{
- tableTest{
- rangetable.Merge(
- unicode.Lt, unicode.Nl, unicode.No, // Other letter digits
- unicode.Me, // Modifiers
- unicode.Zs, // Spaces
- unicode.So, // Symbols
- unicode.Pi, unicode.Pf, // Punctuation
- ),
- idDisOrFreePVal,
- },
- tableTest{
- rangetable.New(0x30000, 0x30101, 0xDFFFF),
- unassigned,
- },
- }
-
- assigned := rangetable.Assigned(UnicodeVersion)
-
- for _, test := range tests {
- rangetable.Visit(test.rangeTable, func(r rune) {
- if !unicode.In(r, assigned) {
- return
- }
- b := make([]byte, 4)
- n := utf8.EncodeRune(b, r)
- trieval, _ := dpTrie.lookup(b[:n])
- p := entry(trieval).property()
- if p != test.prop && !exceptions.Contains(r) {
- t.Errorf("%U: got %+x; want %+x", r, test.prop, p)
- }
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/examples_test.go
deleted file mode 100644
index f2e284dba52..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/examples_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package transform_test
-
-import (
- "fmt"
- "unicode"
-
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/norm"
-)
-
-func ExampleRemoveFunc() {
- input := []byte(`tschüß; до свидания`)
-
- b := make([]byte, len(input))
-
- t := transform.RemoveFunc(unicode.IsSpace)
- n, _, _ := t.Transform(b, input, true)
- fmt.Println(string(b[:n]))
-
- t = transform.RemoveFunc(func(r rune) bool {
- return !unicode.Is(unicode.Latin, r)
- })
- n, _, _ = t.Transform(b, input, true)
- fmt.Println(string(b[:n]))
-
- n, _, _ = t.Transform(b, norm.NFD.Bytes(input), true)
- fmt.Println(string(b[:n]))
-
- // Output:
- // tschüß;досвидания
- // tschüß
- // tschuß
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/transform_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/transform_test.go
deleted file mode 100644
index 771633d1d99..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/transform/transform_test.go
+++ /dev/null
@@ -1,1317 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package transform
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io/ioutil"
- "strconv"
- "strings"
- "testing"
- "time"
- "unicode/utf8"
-
- "golang.org/x/text/internal/testtext"
-)
-
-type lowerCaseASCII struct{ NopResetter }
-
-func (lowerCaseASCII) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n, err = len(dst), ErrShortDst
- }
- for i, c := range src[:n] {
- if 'A' <= c && c <= 'Z' {
- c += 'a' - 'A'
- }
- dst[i] = c
- }
- return n, n, err
-}
-
-// lowerCaseASCIILookahead lowercases the string and reports ErrShortSrc as long
-// as the input is not atEOF.
-type lowerCaseASCIILookahead struct{ NopResetter }
-
-func (lowerCaseASCIILookahead) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n, err = len(dst), ErrShortDst
- }
- for i, c := range src[:n] {
- if 'A' <= c && c <= 'Z' {
- c += 'a' - 'A'
- }
- dst[i] = c
- }
- if !atEOF {
- err = ErrShortSrc
- }
- return n, n, err
-}
-
-var errYouMentionedX = errors.New("you mentioned X")
-
-type dontMentionX struct{ NopResetter }
-
-func (dontMentionX) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n, err = len(dst), ErrShortDst
- }
- for i, c := range src[:n] {
- if c == 'X' {
- return i, i, errYouMentionedX
- }
- dst[i] = c
- }
- return n, n, err
-}
-
-var errAtEnd = errors.New("error after all text")
-
-type errorAtEnd struct{ NopResetter }
-
-func (errorAtEnd) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := copy(dst, src)
- if n < len(src) {
- return n, n, ErrShortDst
- }
- if atEOF {
- return n, n, errAtEnd
- }
- return n, n, nil
-}
-
-type replaceWithConstant struct {
- replacement string
- written int
-}
-
-func (t *replaceWithConstant) Reset() {
- t.written = 0
-}
-
-func (t *replaceWithConstant) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if atEOF {
- nDst = copy(dst, t.replacement[t.written:])
- t.written += nDst
- if t.written < len(t.replacement) {
- err = ErrShortDst
- }
- }
- return nDst, len(src), err
-}
-
-type addAnXAtTheEnd struct{ NopResetter }
-
-func (addAnXAtTheEnd) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := copy(dst, src)
- if n < len(src) {
- return n, n, ErrShortDst
- }
- if !atEOF {
- return n, n, nil
- }
- if len(dst) == n {
- return n, n, ErrShortDst
- }
- dst[n] = 'X'
- return n + 1, n, nil
-}
-
-// doublerAtEOF is a strange Transformer that transforms "this" to "tthhiiss",
-// but only if atEOF is true.
-type doublerAtEOF struct{ NopResetter }
-
-func (doublerAtEOF) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if !atEOF {
- return 0, 0, ErrShortSrc
- }
- for i, c := range src {
- if 2*i+2 >= len(dst) {
- return 2 * i, i, ErrShortDst
- }
- dst[2*i+0] = c
- dst[2*i+1] = c
- }
- return 2 * len(src), len(src), nil
-}
-
-// rleDecode and rleEncode implement a toy run-length encoding: "aabbbbbbbbbb"
-// is encoded as "2a10b". The decoding is assumed to not contain any numbers.
-
-type rleDecode struct{ NopResetter }
-
-func (rleDecode) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
-loop:
- for len(src) > 0 {
- n := 0
- for i, c := range src {
- if '0' <= c && c <= '9' {
- n = 10*n + int(c-'0')
- continue
- }
- if i == 0 {
- return nDst, nSrc, errors.New("rleDecode: bad input")
- }
- if n > len(dst) {
- return nDst, nSrc, ErrShortDst
- }
- for j := 0; j < n; j++ {
- dst[j] = c
- }
- dst, src = dst[n:], src[i+1:]
- nDst, nSrc = nDst+n, nSrc+i+1
- continue loop
- }
- if atEOF {
- return nDst, nSrc, errors.New("rleDecode: bad input")
- }
- return nDst, nSrc, ErrShortSrc
- }
- return nDst, nSrc, nil
-}
-
-type rleEncode struct {
- NopResetter
-
- // allowStutter means that "xxxxxxxx" can be encoded as "5x3x"
- // instead of always as "8x".
- allowStutter bool
-}
-
-func (e rleEncode) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- for len(src) > 0 {
- n, c0 := len(src), src[0]
- for i, c := range src[1:] {
- if c != c0 {
- n = i + 1
- break
- }
- }
- if n == len(src) && !atEOF && !e.allowStutter {
- return nDst, nSrc, ErrShortSrc
- }
- s := strconv.Itoa(n)
- if len(s) >= len(dst) {
- return nDst, nSrc, ErrShortDst
- }
- copy(dst, s)
- dst[len(s)] = c0
- dst, src = dst[len(s)+1:], src[n:]
- nDst, nSrc = nDst+len(s)+1, nSrc+n
- }
- return nDst, nSrc, nil
-}
-
-// trickler consumes all input bytes, but writes a single byte at a time to dst.
-type trickler []byte
-
-func (t *trickler) Reset() {
- *t = nil
-}
-
-func (t *trickler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- *t = append(*t, src...)
- if len(*t) == 0 {
- return 0, 0, nil
- }
- if len(dst) == 0 {
- return 0, len(src), ErrShortDst
- }
- dst[0] = (*t)[0]
- *t = (*t)[1:]
- if len(*t) > 0 {
- err = ErrShortDst
- }
- return 1, len(src), err
-}
-
-// delayedTrickler is like trickler, but delays writing output to dst. This is
-// highly unlikely to be relevant in practice, but it seems like a good idea
-// to have some tolerance as long as progress can be detected.
-type delayedTrickler []byte
-
-func (t *delayedTrickler) Reset() {
- *t = nil
-}
-
-func (t *delayedTrickler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if len(*t) > 0 && len(dst) > 0 {
- dst[0] = (*t)[0]
- *t = (*t)[1:]
- nDst = 1
- }
- *t = append(*t, src...)
- if len(*t) > 0 {
- err = ErrShortDst
- }
- return nDst, len(src), err
-}
-
-type testCase struct {
- desc string
- t Transformer
- src string
- dstSize int
- srcSize int
- ioSize int
- wantStr string
- wantErr error
- wantIter int // number of iterations taken; 0 means we don't care.
-}
-
-func (t testCase) String() string {
- return tstr(t.t) + "; " + t.desc
-}
-
-func tstr(t Transformer) string {
- if stringer, ok := t.(fmt.Stringer); ok {
- return stringer.String()
- }
- s := fmt.Sprintf("%T", t)
- return s[1+strings.Index(s, "."):]
-}
-
-func (c chain) String() string {
- buf := &bytes.Buffer{}
- buf.WriteString("Chain(")
- for i, l := range c.link[:len(c.link)-1] {
- if i != 0 {
- fmt.Fprint(buf, ", ")
- }
- buf.WriteString(tstr(l.t))
- }
- buf.WriteString(")")
- return buf.String()
-}
-
-var testCases = []testCase{
- {
- desc: "empty",
- t: lowerCaseASCII{},
- src: "",
- dstSize: 100,
- srcSize: 100,
- wantStr: "",
- },
-
- {
- desc: "basic",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 100,
- srcSize: 100,
- wantStr: "hello world.",
- },
-
- {
- desc: "small dst",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 100,
- wantStr: "hello world.",
- },
-
- {
- desc: "small src",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 100,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "small buffers",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "very small buffers",
- t: lowerCaseASCII{},
- src: "Hello WORLD.",
- dstSize: 1,
- srcSize: 1,
- wantStr: "hello world.",
- },
-
- {
- desc: "small dst with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 100,
- wantStr: "hello world.",
- },
-
- {
- desc: "small src with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 100,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "small buffers with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 3,
- srcSize: 4,
- wantStr: "hello world.",
- },
-
- {
- desc: "very small buffers with lookahead",
- t: lowerCaseASCIILookahead{},
- src: "Hello WORLD.",
- dstSize: 1,
- srcSize: 2,
- wantStr: "hello world.",
- },
-
- {
- desc: "user error",
- t: dontMentionX{},
- src: "The First Rule of Transform Club: don't mention Mister X, ever.",
- dstSize: 100,
- srcSize: 100,
- wantStr: "The First Rule of Transform Club: don't mention Mister ",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "user error at end",
- t: errorAtEnd{},
- src: "All goes well until it doesn't.",
- dstSize: 100,
- srcSize: 100,
- wantStr: "All goes well until it doesn't.",
- wantErr: errAtEnd,
- },
-
- {
- desc: "user error at end, incremental",
- t: errorAtEnd{},
- src: "All goes well until it doesn't.",
- dstSize: 10,
- srcSize: 10,
- wantStr: "All goes well until it doesn't.",
- wantErr: errAtEnd,
- },
-
- {
- desc: "replace entire non-empty string with one byte",
- t: &replaceWithConstant{replacement: "X"},
- src: "none of this will be copied",
- dstSize: 1,
- srcSize: 10,
- wantStr: "X",
- },
-
- {
- desc: "replace entire empty string with one byte",
- t: &replaceWithConstant{replacement: "X"},
- src: "",
- dstSize: 1,
- srcSize: 10,
- wantStr: "X",
- },
-
- {
- desc: "replace entire empty string with seven bytes",
- t: &replaceWithConstant{replacement: "ABCDEFG"},
- src: "",
- dstSize: 3,
- srcSize: 10,
- wantStr: "ABCDEFG",
- },
-
- {
- desc: "add an X (initialBufSize-1)",
- t: addAnXAtTheEnd{},
- src: aaa[:initialBufSize-1],
- dstSize: 10,
- srcSize: 10,
- wantStr: aaa[:initialBufSize-1] + "X",
- },
-
- {
- desc: "add an X (initialBufSize+0)",
- t: addAnXAtTheEnd{},
- src: aaa[:initialBufSize+0],
- dstSize: 10,
- srcSize: 10,
- wantStr: aaa[:initialBufSize+0] + "X",
- },
-
- {
- desc: "add an X (initialBufSize+1)",
- t: addAnXAtTheEnd{},
- src: aaa[:initialBufSize+1],
- dstSize: 10,
- srcSize: 10,
- wantStr: aaa[:initialBufSize+1] + "X",
- },
-
- {
- desc: "small buffers",
- t: dontMentionX{},
- src: "The First Rule of Transform Club: don't mention Mister X, ever.",
- dstSize: 10,
- srcSize: 10,
- wantStr: "The First Rule of Transform Club: don't mention Mister ",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "very small buffers",
- t: dontMentionX{},
- src: "The First Rule of Transform Club: don't mention Mister X, ever.",
- dstSize: 1,
- srcSize: 1,
- wantStr: "The First Rule of Transform Club: don't mention Mister ",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "only transform at EOF",
- t: doublerAtEOF{},
- src: "this",
- dstSize: 100,
- srcSize: 100,
- wantStr: "tthhiiss",
- },
-
- {
- desc: "basic",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 100,
- srcSize: 100,
- wantStr: "abbcccddddddddddeeeeeeeeeeeg",
- },
-
- {
- desc: "long",
- t: rleDecode{},
- src: "12a23b34c45d56e99z",
- dstSize: 100,
- srcSize: 100,
- wantStr: strings.Repeat("a", 12) +
- strings.Repeat("b", 23) +
- strings.Repeat("c", 34) +
- strings.Repeat("d", 45) +
- strings.Repeat("e", 56) +
- strings.Repeat("z", 99),
- },
-
- {
- desc: "tight buffers",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 11,
- srcSize: 3,
- wantStr: "abbcccddddddddddeeeeeeeeeeeg",
- },
-
- {
- desc: "short dst",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 10,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: ErrShortDst,
- },
-
- {
- desc: "short src",
- t: rleDecode{},
- src: "1a2b3c10d11e0f1g",
- dstSize: 11,
- srcSize: 2,
- ioSize: 2,
- wantStr: "abbccc",
- wantErr: ErrShortSrc,
- },
-
- {
- desc: "basic",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 100,
- srcSize: 100,
- wantStr: "1a2b3c10d11e1g",
- },
-
- {
- desc: "long",
- t: rleEncode{},
- src: strings.Repeat("a", 12) +
- strings.Repeat("b", 23) +
- strings.Repeat("c", 34) +
- strings.Repeat("d", 45) +
- strings.Repeat("e", 56) +
- strings.Repeat("z", 99),
- dstSize: 100,
- srcSize: 100,
- wantStr: "12a23b34c45d56e99z",
- },
-
- {
- desc: "tight buffers",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 3,
- srcSize: 12,
- wantStr: "1a2b3c10d11e1g",
- },
-
- {
- desc: "short dst",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 2,
- srcSize: 12,
- wantStr: "1a2b3c",
- wantErr: ErrShortDst,
- },
-
- {
- desc: "short src",
- t: rleEncode{},
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 3,
- srcSize: 11,
- ioSize: 11,
- wantStr: "1a2b3c10d",
- wantErr: ErrShortSrc,
- },
-
- {
- desc: "allowStutter = false",
- t: rleEncode{allowStutter: false},
- src: "aaaabbbbbbbbccccddddd",
- dstSize: 10,
- srcSize: 10,
- wantStr: "4a8b4c5d",
- },
-
- {
- desc: "allowStutter = true",
- t: rleEncode{allowStutter: true},
- src: "aaaabbbbbbbbccccddddd",
- dstSize: 10,
- srcSize: 10,
- ioSize: 10,
- wantStr: "4a6b2b4c4d1d",
- },
-
- {
- desc: "trickler",
- t: &trickler{},
- src: "abcdefghijklm",
- dstSize: 3,
- srcSize: 15,
- wantStr: "abcdefghijklm",
- },
-
- {
- desc: "delayedTrickler",
- t: &delayedTrickler{},
- src: "abcdefghijklm",
- dstSize: 3,
- srcSize: 15,
- wantStr: "abcdefghijklm",
- },
-}
-
-func TestReader(t *testing.T) {
- for _, tc := range testCases {
- testtext.Run(t, tc.desc, func(t *testing.T) {
- r := NewReader(strings.NewReader(tc.src), tc.t)
- // Differently sized dst and src buffers are not part of the
- // exported API. We override them manually.
- r.dst = make([]byte, tc.dstSize)
- r.src = make([]byte, tc.srcSize)
- got, err := ioutil.ReadAll(r)
- str := string(got)
- if str != tc.wantStr || err != tc.wantErr {
- t.Errorf("\ngot %q, %v\nwant %q, %v", str, err, tc.wantStr, tc.wantErr)
- }
- })
- }
-}
-
-func TestWriter(t *testing.T) {
- tests := append(testCases, chainTests()...)
- for _, tc := range tests {
- sizes := []int{1, 2, 3, 4, 5, 10, 100, 1000}
- if tc.ioSize > 0 {
- sizes = []int{tc.ioSize}
- }
- for _, sz := range sizes {
- testtext.Run(t, fmt.Sprintf("%s/%d", tc.desc, sz), func(t *testing.T) {
- bb := &bytes.Buffer{}
- w := NewWriter(bb, tc.t)
- // Differently sized dst and src buffers are not part of the
- // exported API. We override them manually.
- w.dst = make([]byte, tc.dstSize)
- w.src = make([]byte, tc.srcSize)
- src := make([]byte, sz)
- var err error
- for b := tc.src; len(b) > 0 && err == nil; {
- n := copy(src, b)
- b = b[n:]
- m := 0
- m, err = w.Write(src[:n])
- if m != n && err == nil {
- t.Errorf("did not consume all bytes %d < %d", m, n)
- }
- }
- if err == nil {
- err = w.Close()
- }
- str := bb.String()
- if str != tc.wantStr || err != tc.wantErr {
- t.Errorf("\ngot %q, %v\nwant %q, %v", str, err, tc.wantStr, tc.wantErr)
- }
- })
- }
- }
-}
-
-func TestNop(t *testing.T) {
- testCases := []struct {
- str string
- dstSize int
- err error
- }{
- {"", 0, nil},
- {"", 10, nil},
- {"a", 0, ErrShortDst},
- {"a", 1, nil},
- {"a", 10, nil},
- }
- for i, tc := range testCases {
- dst := make([]byte, tc.dstSize)
- nDst, nSrc, err := Nop.Transform(dst, []byte(tc.str), true)
- want := tc.str
- if tc.dstSize < len(want) {
- want = want[:tc.dstSize]
- }
- if got := string(dst[:nDst]); got != want || err != tc.err || nSrc != nDst {
- t.Errorf("%d:\ngot %q, %d, %v\nwant %q, %d, %v", i, got, nSrc, err, want, nDst, tc.err)
- }
- }
-}
-
-func TestDiscard(t *testing.T) {
- testCases := []struct {
- str string
- dstSize int
- }{
- {"", 0},
- {"", 10},
- {"a", 0},
- {"ab", 10},
- }
- for i, tc := range testCases {
- nDst, nSrc, err := Discard.Transform(make([]byte, tc.dstSize), []byte(tc.str), true)
- if nDst != 0 || nSrc != len(tc.str) || err != nil {
- t.Errorf("%d:\ngot %q, %d, %v\nwant 0, %d, nil", i, nDst, nSrc, err, len(tc.str))
- }
- }
-}
-
-// mkChain creates a Chain transformer. x must be alternating between transformer
-// and bufSize, like T, (sz, T)*
-func mkChain(x ...interface{}) *chain {
- t := []Transformer{}
- for i := 0; i < len(x); i += 2 {
- t = append(t, x[i].(Transformer))
- }
- c := Chain(t...).(*chain)
- for i, j := 1, 1; i < len(x); i, j = i+2, j+1 {
- c.link[j].b = make([]byte, x[i].(int))
- }
- return c
-}
-
-func chainTests() []testCase {
- return []testCase{
- {
- desc: "nil error",
- t: mkChain(rleEncode{}, 100, lowerCaseASCII{}),
- src: "ABB",
- dstSize: 100,
- srcSize: 100,
- wantStr: "1a2b",
- wantErr: nil,
- wantIter: 1,
- },
-
- {
- desc: "short dst buffer",
- t: mkChain(lowerCaseASCII{}, 3, rleDecode{}),
- src: "1a2b3c10d11e0f1g",
- dstSize: 10,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: ErrShortDst,
- },
-
- {
- desc: "short internal dst buffer",
- t: mkChain(lowerCaseASCII{}, 3, rleDecode{}, 10, Nop),
- src: "1a2b3c10d11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal dst buffer from input",
- t: mkChain(rleDecode{}, 10, Nop),
- src: "1a2b3c10d11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "abbcccdddddddddd",
- wantErr: errShortInternal,
- },
-
- {
- desc: "empty short internal dst buffer",
- t: mkChain(lowerCaseASCII{}, 3, rleDecode{}, 10, Nop),
- src: "4a7b11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "aaaabbbbbbb",
- wantErr: errShortInternal,
- },
-
- {
- desc: "empty short internal dst buffer from input",
- t: mkChain(rleDecode{}, 10, Nop),
- src: "4a7b11e0f1g",
- dstSize: 100,
- srcSize: 3,
- wantStr: "aaaabbbbbbb",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal src buffer after full dst buffer",
- t: mkChain(Nop, 5, rleEncode{}, 10, Nop),
- src: "cccccddddd",
- dstSize: 100,
- srcSize: 100,
- wantStr: "",
- wantErr: errShortInternal,
- wantIter: 1,
- },
-
- {
- desc: "short internal src buffer after short dst buffer; test lastFull",
- t: mkChain(rleDecode{}, 5, rleEncode{}, 4, Nop),
- src: "2a1b4c6d",
- dstSize: 100,
- srcSize: 100,
- wantStr: "2a1b",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal src buffer after successful complete fill",
- t: mkChain(Nop, 3, rleDecode{}),
- src: "123a4b",
- dstSize: 4,
- srcSize: 3,
- wantStr: "",
- wantErr: errShortInternal,
- wantIter: 1,
- },
-
- {
- desc: "short internal src buffer after short dst buffer; test lastFull",
- t: mkChain(rleDecode{}, 5, rleEncode{}),
- src: "2a1b4c6d",
- dstSize: 4,
- srcSize: 100,
- wantStr: "2a1b",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short src buffer",
- t: mkChain(rleEncode{}, 5, Nop),
- src: "abbcccddddeeeee",
- dstSize: 4,
- srcSize: 4,
- ioSize: 4,
- wantStr: "1a2b3c",
- wantErr: ErrShortSrc,
- },
-
- {
- desc: "process all in one go",
- t: mkChain(rleEncode{}, 5, Nop),
- src: "abbcccddddeeeeeffffff",
- dstSize: 100,
- srcSize: 100,
- wantStr: "1a2b3c4d5e6f",
- wantErr: nil,
- wantIter: 1,
- },
-
- {
- desc: "complete processing downstream after error",
- t: mkChain(dontMentionX{}, 2, rleDecode{}, 5, Nop),
- src: "3a4b5eX",
- dstSize: 100,
- srcSize: 100,
- ioSize: 100,
- wantStr: "aaabbbbeeeee",
- wantErr: errYouMentionedX,
- },
-
- {
- desc: "return downstream fatal errors first (followed by short dst)",
- t: mkChain(dontMentionX{}, 8, rleDecode{}, 4, Nop),
- src: "3a4b5eX",
- dstSize: 100,
- srcSize: 100,
- ioSize: 100,
- wantStr: "aaabbbb",
- wantErr: errShortInternal,
- },
-
- {
- desc: "return downstream fatal errors first (followed by short src)",
- t: mkChain(dontMentionX{}, 5, Nop, 1, rleDecode{}),
- src: "1a5bX",
- dstSize: 100,
- srcSize: 100,
- ioSize: 100,
- wantStr: "",
- wantErr: errShortInternal,
- },
-
- {
- desc: "short internal",
- t: mkChain(Nop, 11, rleEncode{}, 3, Nop),
- src: "abbcccddddddddddeeeeeeeeeeeg",
- dstSize: 3,
- srcSize: 100,
- wantStr: "1a2b3c10d",
- wantErr: errShortInternal,
- },
- }
-}
-
-func doTransform(tc testCase) (res string, iter int, err error) {
- tc.t.Reset()
- dst := make([]byte, tc.dstSize)
- out, in := make([]byte, 0, 2*len(tc.src)), []byte(tc.src)
- for {
- iter++
- src, atEOF := in, true
- if len(src) > tc.srcSize {
- src, atEOF = src[:tc.srcSize], false
- }
- nDst, nSrc, err := tc.t.Transform(dst, src, atEOF)
- out = append(out, dst[:nDst]...)
- in = in[nSrc:]
- switch {
- case err == nil && len(in) != 0:
- case err == ErrShortSrc && nSrc > 0:
- case err == ErrShortDst && (nDst > 0 || nSrc > 0):
- default:
- return string(out), iter, err
- }
- }
-}
-
-func TestChain(t *testing.T) {
- if c, ok := Chain().(nop); !ok {
- t.Errorf("empty chain: %v; want Nop", c)
- }
-
- // Test Chain for a single Transformer.
- for _, tc := range testCases {
- tc.t = Chain(tc.t)
- str, _, err := doTransform(tc)
- if str != tc.wantStr || err != tc.wantErr {
- t.Errorf("%s:\ngot %q, %v\nwant %q, %v", tc, str, err, tc.wantStr, tc.wantErr)
- }
- }
-
- tests := chainTests()
- sizes := []int{1, 2, 3, 4, 5, 7, 10, 100, 1000}
- addTest := func(tc testCase, t *chain) {
- if t.link[0].t != tc.t && tc.wantErr == ErrShortSrc {
- tc.wantErr = errShortInternal
- }
- if t.link[len(t.link)-2].t != tc.t && tc.wantErr == ErrShortDst {
- tc.wantErr = errShortInternal
- }
- tc.t = t
- tests = append(tests, tc)
- }
- for _, tc := range testCases {
- for _, sz := range sizes {
- tt := tc
- tt.dstSize = sz
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop))
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 2, Nop))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop))
- if sz >= tc.dstSize && (tc.wantErr != ErrShortDst || sz == tc.dstSize) {
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t))
- addTest(tt, mkChain(Nop, 100, Nop, tc.srcSize, tc.t))
- }
- }
- }
- for _, tc := range testCases {
- tt := tc
- tt.dstSize = 1
- tt.wantStr = ""
- addTest(tt, mkChain(tc.t, tc.dstSize, Discard))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Discard))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, tc.dstSize, Discard))
- }
- for _, tc := range testCases {
- tt := tc
- tt.dstSize = 100
- tt.wantStr = strings.Replace(tc.src, "0f", "", -1)
- // Chain encoders and decoders.
- if _, ok := tc.t.(rleEncode); ok && tc.wantErr == nil {
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 1000, rleDecode{}))
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, tc.dstSize, rleDecode{}))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleDecode{}))
- // decoding needs larger destinations
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, rleDecode{}, 100, Nop))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleDecode{}, 100, Nop))
- } else if _, ok := tc.t.(rleDecode); ok && tc.wantErr == nil {
- // The internal buffer size may need to be the sum of the maximum segment
- // size of the two encoders!
- addTest(tt, mkChain(tc.t, 2*tc.dstSize, rleEncode{}))
- addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 101, rleEncode{}))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleEncode{}))
- addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 200, rleEncode{}, 100, Nop))
- }
- }
- for _, tc := range tests {
- str, iter, err := doTransform(tc)
- mi := tc.wantIter != 0 && tc.wantIter != iter
- if str != tc.wantStr || err != tc.wantErr || mi {
- t.Errorf("%s:\ngot iter:%d, %q, %v\nwant iter:%d, %q, %v", tc, iter, str, err, tc.wantIter, tc.wantStr, tc.wantErr)
- }
- break
- }
-}
-
-func TestRemoveFunc(t *testing.T) {
- filter := RemoveFunc(func(r rune) bool {
- return strings.IndexRune("ab\u0300\u1234,", r) != -1
- })
- tests := []testCase{
- {
- src: ",",
- wantStr: "",
- },
-
- {
- src: "c",
- wantStr: "c",
- },
-
- {
- src: "\u2345",
- wantStr: "\u2345",
- },
-
- {
- src: "tschüß",
- wantStr: "tschüß",
- },
-
- {
- src: ",до,свидания,",
- wantStr: "досвидания",
- },
-
- {
- src: "a\xbd\xb2=\xbc ⌘",
- wantStr: "\uFFFD\uFFFD=\uFFFD ⌘",
- },
-
- {
- // If we didn't replace illegal bytes with RuneError, the result
- // would be \u0300 or the code would need to be more complex.
- src: "\xcc\u0300\x80",
- wantStr: "\uFFFD\uFFFD",
- },
-
- {
- src: "\xcc\u0300\x80",
- dstSize: 3,
- wantStr: "\uFFFD\uFFFD",
- wantIter: 2,
- },
-
- {
- // Test a long buffer greater than the internal buffer size
- src: "hello\xcc\xcc\xccworld",
- srcSize: 13,
- wantStr: "hello\uFFFD\uFFFD\uFFFDworld",
- wantIter: 1,
- },
-
- {
- src: "\u2345",
- dstSize: 2,
- wantStr: "",
- wantErr: ErrShortDst,
- },
-
- {
- src: "\xcc",
- dstSize: 2,
- wantStr: "",
- wantErr: ErrShortDst,
- },
-
- {
- src: "\u0300",
- dstSize: 2,
- srcSize: 1,
- wantStr: "",
- wantErr: ErrShortSrc,
- },
-
- {
- t: RemoveFunc(func(r rune) bool {
- return r == utf8.RuneError
- }),
- src: "\xcc\u0300\x80",
- wantStr: "\u0300",
- },
- }
-
- for _, tc := range tests {
- tc.desc = tc.src
- if tc.t == nil {
- tc.t = filter
- }
- if tc.dstSize == 0 {
- tc.dstSize = 100
- }
- if tc.srcSize == 0 {
- tc.srcSize = 100
- }
- str, iter, err := doTransform(tc)
- mi := tc.wantIter != 0 && tc.wantIter != iter
- if str != tc.wantStr || err != tc.wantErr || mi {
- t.Errorf("%+q:\ngot iter:%d, %+q, %v\nwant iter:%d, %+q, %v", tc.src, iter, str, err, tc.wantIter, tc.wantStr, tc.wantErr)
- }
-
- tc.src = str
- idem, _, _ := doTransform(tc)
- if str != idem {
- t.Errorf("%+q: found %+q; want %+q", tc.src, idem, str)
- }
- }
-}
-
-func testString(t *testing.T, f func(Transformer, string) (string, int, error)) {
- for _, tt := range append(testCases, chainTests()...) {
- if tt.desc == "allowStutter = true" {
- // We don't have control over the buffer size, so we eliminate tests
- // that depend on a specific buffer size being set.
- continue
- }
- if tt.wantErr == ErrShortDst || tt.wantErr == ErrShortSrc {
- // The result string will be different.
- continue
- }
- testtext.Run(t, tt.desc, func(t *testing.T) {
- got, n, err := f(tt.t, tt.src)
- if tt.wantErr != err {
- t.Errorf("error: got %v; want %v", err, tt.wantErr)
- }
- // Check that err == nil implies that n == len(tt.src). Note that vice
- // versa isn't necessarily true.
- if err == nil && n != len(tt.src) {
- t.Errorf("err == nil: got %d bytes, want %d", n, err)
- }
- if got != tt.wantStr {
- t.Errorf("string: got %q; want %q", got, tt.wantStr)
- }
- })
- }
-}
-
-func TestBytes(t *testing.T) {
- testString(t, func(z Transformer, s string) (string, int, error) {
- b, n, err := Bytes(z, []byte(s))
- return string(b), n, err
- })
-}
-
-func TestAppend(t *testing.T) {
- // Create a bunch of subtests for different buffer sizes.
- testCases := [][]byte{
- nil,
- make([]byte, 0, 0),
- make([]byte, 0, 1),
- make([]byte, 1, 1),
- make([]byte, 1, 5),
- make([]byte, 100, 100),
- make([]byte, 100, 200),
- }
- for _, tc := range testCases {
- testString(t, func(z Transformer, s string) (string, int, error) {
- b, n, err := Append(z, tc, []byte(s))
- return string(b[len(tc):]), n, err
- })
- }
-}
-
-func TestString(t *testing.T) {
- testtext.Run(t, "transform", func(t *testing.T) { testString(t, String) })
-
- // Overrun the internal destination buffer.
- for i, s := range []string{
- aaa[:1*initialBufSize-1],
- aaa[:1*initialBufSize+0],
- aaa[:1*initialBufSize+1],
- AAA[:1*initialBufSize-1],
- AAA[:1*initialBufSize+0],
- AAA[:1*initialBufSize+1],
- AAA[:2*initialBufSize-1],
- AAA[:2*initialBufSize+0],
- AAA[:2*initialBufSize+1],
- aaa[:1*initialBufSize-2] + "A",
- aaa[:1*initialBufSize-1] + "A",
- aaa[:1*initialBufSize+0] + "A",
- aaa[:1*initialBufSize+1] + "A",
- } {
- testtext.Run(t, fmt.Sprint("dst buffer test using lower/", i), func(t *testing.T) {
- got, _, _ := String(lowerCaseASCII{}, s)
- if want := strings.ToLower(s); got != want {
- t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want))
- }
- })
- }
-
- // Overrun the internal source buffer.
- for i, s := range []string{
- aaa[:1*initialBufSize-1],
- aaa[:1*initialBufSize+0],
- aaa[:1*initialBufSize+1],
- aaa[:2*initialBufSize+1],
- aaa[:2*initialBufSize+0],
- aaa[:2*initialBufSize+1],
- } {
- testtext.Run(t, fmt.Sprint("src buffer test using rleEncode/", i), func(t *testing.T) {
- got, _, _ := String(rleEncode{}, s)
- if want := fmt.Sprintf("%da", len(s)); got != want {
- t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want))
- }
- })
- }
-
- // Test allocations for non-changing strings.
- // Note we still need to allocate a single buffer.
- for i, s := range []string{
- "",
- "123456789",
- aaa[:initialBufSize-1],
- aaa[:initialBufSize+0],
- aaa[:initialBufSize+1],
- aaa[:10*initialBufSize],
- } {
- testtext.Run(t, fmt.Sprint("alloc/", i), func(t *testing.T) {
- if n := testtext.AllocsPerRun(5, func() { String(&lowerCaseASCIILookahead{}, s) }); n > 1 {
- t.Errorf("#allocs was %f; want 1", n)
- }
- })
- }
-}
-
-// TestBytesAllocation tests that buffer growth stays limited with the trickler
-// transformer, which behaves oddly but within spec. In case buffer growth is
-// not correctly handled, the test will either panic with a failed allocation or
-// thrash. To ensure the tests terminate under the last condition, we time out
-// after some sufficiently long period of time.
-func TestBytesAllocation(t *testing.T) {
- done := make(chan bool)
- go func() {
- in := bytes.Repeat([]byte{'a'}, 1000)
- tr := trickler(make([]byte, 1))
- Bytes(&tr, in)
- done <- true
- }()
- select {
- case <-done:
- case <-time.After(3 * time.Second):
- t.Error("time out, likely due to excessive allocation")
- }
-}
-
-// TestStringAllocation tests that buffer growth stays limited with the trickler
-// transformer, which behaves oddly but within spec. In case buffer growth is
-// not correctly handled, the test will either panic with a failed allocation or
-// thrash. To ensure the tests terminate under the last condition, we time out
-// after some sufficiently long period of time.
-func TestStringAllocation(t *testing.T) {
- done := make(chan bool)
- go func() {
- tr := trickler(make([]byte, 1))
- String(&tr, aaa[:1000])
- done <- true
- }()
- select {
- case <-done:
- case <-time.After(3 * time.Second):
- t.Error("time out, likely due to excessive allocation")
- }
-}
-
-func BenchmarkStringLowerEmpty(b *testing.B) {
- for i := 0; i < b.N; i++ {
- String(&lowerCaseASCIILookahead{}, "")
- }
-}
-
-func BenchmarkStringLowerIdentical(b *testing.B) {
- for i := 0; i < b.N; i++ {
- String(&lowerCaseASCIILookahead{}, aaa[:4096])
- }
-}
-
-func BenchmarkStringLowerChanged(b *testing.B) {
- for i := 0; i < b.N; i++ {
- String(&lowerCaseASCIILookahead{}, AAA[:4096])
- }
-}
-
-var (
- aaa = strings.Repeat("a", 4096)
- AAA = strings.Repeat("A", 4096)
-)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/core_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/core_test.go
deleted file mode 100644
index f28d386c8d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/core_test.go
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidi
-
-import (
- "flag"
- "fmt"
- "log"
- "strconv"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
- "golang.org/x/text/unicode/norm"
-)
-
-var testLevels = flag.Bool("levels", false, "enable testing of levels")
-
-// TestBidiCore performs the tests in BidiTest.txt.
-// See http://www.unicode.org/Public/UCD/latest/ucd/BidiTest.txt.
-func TestBidiCore(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- r := gen.OpenUCDFile("BidiTest.txt")
- defer r.Close()
-
- var wantLevels, wantOrder []string
- p := ucd.New(r, ucd.Part(func(p *ucd.Parser) {
- s := strings.Split(p.String(0), ":")
- switch s[0] {
- case "Levels":
- wantLevels = strings.Fields(s[1])
- case "Reorder":
- wantOrder = strings.Fields(s[1])
- default:
- log.Fatalf("Unknown part %q.", s[0])
- }
- }))
-
- for p.Next() {
- types := []Class{}
- for _, s := range p.Strings(0) {
- types = append(types, bidiClass[s])
- }
- // We ignore the bracketing part of the algorithm.
- pairTypes := make([]bracketType, len(types))
- pairValues := make([]rune, len(types))
-
- for i := uint(0); i < 3; i++ {
- if p.Uint(1)&(1<<i) == 0 {
- continue
- }
- lev := level(int(i) - 1)
- par := newParagraph(types, pairTypes, pairValues, lev)
-
- if *testLevels {
- levels := par.getLevels([]int{len(types)})
- for i, s := range wantLevels {
- if s == "x" {
- continue
- }
- l, _ := strconv.ParseUint(s, 10, 8)
- if level(l)&1 != levels[i]&1 {
- t.Errorf("%s:%d:levels: got %v; want %v", p.String(0), lev, levels, wantLevels)
- break
- }
- }
- }
-
- order := par.getReordering([]int{len(types)})
- gotOrder := filterOrder(types, order)
- if got, want := fmt.Sprint(gotOrder), fmt.Sprint(wantOrder); got != want {
- t.Errorf("%s:%d:order: got %v; want %v\noriginal %v", p.String(0), lev, got, want, order)
- }
- }
- }
- if err := p.Err(); err != nil {
- log.Fatal(err)
- }
-}
-
-var removeClasses = map[Class]bool{
- LRO: true,
- RLO: true,
- RLE: true,
- LRE: true,
- PDF: true,
- BN: true,
-}
-
-// TestBidiCharacters performs the tests in BidiCharacterTest.txt.
-// See http://www.unicode.org/Public/UCD/latest/ucd/BidiCharacterTest.txt
-func TestBidiCharacters(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- ucd.Parse(gen.OpenUCDFile("BidiCharacterTest.txt"), func(p *ucd.Parser) {
- var (
- types []Class
- pairTypes []bracketType
- pairValues []rune
- parLevel level
-
- wantLevel = level(p.Int(2))
- wantLevels = p.Strings(3)
- wantVisualOrder = p.Strings(4)
- )
-
- switch l := p.Int(1); l {
- case 0, 1:
- parLevel = level(l)
- case 2:
- parLevel = implicitLevel
- default:
- // Spec says to ignore unknown parts.
- }
-
- runes := p.Runes(0)
-
- for _, r := range runes {
- // Assign the bracket type.
- if d := norm.NFKD.PropertiesString(string(r)).Decomposition(); d != nil {
- r = []rune(string(d))[0]
- }
- p, _ := LookupRune(r)
-
- // Assign the class for this rune.
- types = append(types, p.Class())
-
- switch {
- case !p.IsBracket():
- pairTypes = append(pairTypes, bpNone)
- pairValues = append(pairValues, 0)
- case p.IsOpeningBracket():
- pairTypes = append(pairTypes, bpOpen)
- pairValues = append(pairValues, r)
- default:
- pairTypes = append(pairTypes, bpClose)
- pairValues = append(pairValues, p.reverseBracket(r))
- }
- }
- par := newParagraph(types, pairTypes, pairValues, parLevel)
-
- // Test results:
- if got := par.embeddingLevel; got != wantLevel {
- t.Errorf("%v:level: got %d; want %d", string(runes), got, wantLevel)
- }
-
- if *testLevels {
- gotLevels := getLevelStrings(types, par.getLevels([]int{len(types)}))
- if got, want := fmt.Sprint(gotLevels), fmt.Sprint(wantLevels); got != want {
- t.Errorf("%04X %q:%d: got %v; want %v\nval: %x\npair: %v", runes, string(runes), parLevel, got, want, pairValues, pairTypes)
- }
- }
-
- order := par.getReordering([]int{len(types)})
- order = filterOrder(types, order)
- if got, want := fmt.Sprint(order), fmt.Sprint(wantVisualOrder); got != want {
- t.Errorf("%04X %q:%d: got %v; want %v\ngot order: %s", runes, string(runes), parLevel, got, want, reorder(runes, order))
- }
- })
-}
-
-func getLevelStrings(cl []Class, levels []level) []string {
- var results []string
- for i, l := range levels {
- if !removeClasses[cl[i]] {
- results = append(results, fmt.Sprint(l))
- } else {
- results = append(results, "x")
- }
- }
- return results
-}
-
-func filterOrder(cl []Class, order []int) []int {
- no := []int{}
- for _, o := range order {
- if !removeClasses[cl[o]] {
- no = append(no, o)
- }
- }
- return no
-}
-
-func reorder(r []rune, order []int) string {
- nr := make([]rune, len(order))
- for i, o := range order {
- nr[i] = r[o]
- }
- return string(nr)
-}
-
-// bidiClass names and codes taken from class "bc" in
-// http://www.unicode.org/Public/8.0.0/ucd/PropertyValueAliases.txt
-var bidiClass = map[string]Class{
- "AL": AL, // classArabicLetter,
- "AN": AN, // classArabicNumber,
- "B": B, // classParagraphSeparator,
- "BN": BN, // classBoundaryNeutral,
- "CS": CS, // classCommonSeparator,
- "EN": EN, // classEuropeanNumber,
- "ES": ES, // classEuropeanSeparator,
- "ET": ET, // classEuropeanTerminator,
- "L": L, // classLeftToRight,
- "NSM": NSM, // classNonspacingMark,
- "ON": ON, // classOtherNeutral,
- "R": R, // classRightToLeft,
- "S": S, // classSegmentSeparator,
- "WS": WS, // classWhiteSpace,
-
- "LRO": LRO, // classLeftToRightOverride,
- "RLO": RLO, // classRightToLeftOverride,
- "LRE": LRE, // classLeftToRightEmbedding,
- "RLE": RLE, // classRightToLeftEmbedding,
- "PDF": PDF, // classPopDirectionalFormat,
- "LRI": LRI, // classLeftToRightIsolate,
- "RLI": RLI, // classRightToLeftIsolate,
- "FSI": FSI, // classFirstStrongIsolate,
- "PDI": PDI, // classPopDirectionalIsolate,
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/ranges_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/ranges_test.go
deleted file mode 100644
index bfaecd502d6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/ranges_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package bidi
-
-import (
- "unicode"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/ucd"
- "golang.org/x/text/unicode/rangetable"
-)
-
-// These tables are hand-extracted from:
-// http://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedBidiClass.txt
-func visitDefaults(fn func(r rune, c Class)) {
- // first write default values for ranges listed above.
- visitRunes(fn, AL, []rune{
- 0x0600, 0x07BF, // Arabic
- 0x08A0, 0x08FF, // Arabic Extended-A
- 0xFB50, 0xFDCF, // Arabic Presentation Forms
- 0xFDF0, 0xFDFF,
- 0xFE70, 0xFEFF,
- 0x0001EE00, 0x0001EEFF, // Arabic Mathematical Alpha Symbols
- })
- visitRunes(fn, R, []rune{
- 0x0590, 0x05FF, // Hebrew
- 0x07C0, 0x089F, // Nko et al.
- 0xFB1D, 0xFB4F,
- 0x00010800, 0x00010FFF, // Cypriot Syllabary et. al.
- 0x0001E800, 0x0001EDFF,
- 0x0001EF00, 0x0001EFFF,
- })
- visitRunes(fn, ET, []rune{ // European Terminator
- 0x20A0, 0x20Cf, // Currency symbols
- })
- rangetable.Visit(unicode.Noncharacter_Code_Point, func(r rune) {
- fn(r, BN) // Boundary Neutral
- })
- ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) {
- if p.String(1) == "Default_Ignorable_Code_Point" {
- fn(p.Rune(0), BN) // Boundary Neutral
- }
- })
-}
-
-func visitRunes(fn func(r rune, c Class), c Class, runes []rune) {
- for i := 0; i < len(runes); i += 2 {
- lo, hi := runes[i], runes[i+1]
- for j := lo; j <= hi; j++ {
- fn(j, c)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/tables_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/tables_test.go
deleted file mode 100644
index 356a4a58d87..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/bidi/tables_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bidi
-
-import (
- "testing"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-var labels = []string{
- AL: "AL",
- AN: "AN",
- B: "B",
- BN: "BN",
- CS: "CS",
- EN: "EN",
- ES: "ES",
- ET: "ET",
- L: "L",
- NSM: "NSM",
- ON: "ON",
- R: "R",
- S: "S",
- WS: "WS",
-
- LRO: "LRO",
- RLO: "RLO",
- LRE: "LRE",
- RLE: "RLE",
- PDF: "PDF",
- LRI: "LRI",
- RLI: "RLI",
- FSI: "FSI",
- PDI: "PDI",
-}
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- ucd.Parse(gen.OpenUCDFile("BidiBrackets.txt"), func(p *ucd.Parser) {
- r1 := p.Rune(0)
- want := p.Rune(1)
-
- e, _ := LookupRune(r1)
- if got := e.reverseBracket(r1); got != want {
- t.Errorf("Reverse(%U) = %U; want %U", r1, got, want)
- }
- })
-
- done := map[rune]bool{}
- test := func(name string, r rune, want string) {
- str := string(r)
- e, _ := LookupString(str)
- if got := labels[e.Class()]; got != want {
- t.Errorf("%s:%U: got %s; want %s", name, r, got, want)
- }
- if e2, sz := LookupRune(r); e != e2 || sz != len(str) {
- t.Errorf("LookupRune(%U) = %v, %d; want %v, %d", r, e2, e, sz, len(str))
- }
- if e2, sz := Lookup([]byte(str)); e != e2 || sz != len(str) {
- t.Errorf("Lookup(%U) = %v, %d; want %v, %d", r, e2, e, sz, len(str))
- }
- done[r] = true
- }
-
- // Insert the derived BiDi properties.
- ucd.Parse(gen.OpenUCDFile("extracted/DerivedBidiClass.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- test("derived", r, p.String(1))
- })
- visitDefaults(func(r rune, c Class) {
- if !done[r] {
- test("default", r, labels[c])
- }
- })
-
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/cldr_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/cldr_test.go
deleted file mode 100644
index 951028d7e19..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/cldr_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-import "testing"
-
-func TestParseDraft(t *testing.T) {
- tests := []struct {
- in string
- draft Draft
- err bool
- }{
- {"unconfirmed", Unconfirmed, false},
- {"provisional", Provisional, false},
- {"contributed", Contributed, false},
- {"approved", Approved, false},
- {"", Approved, false},
- {"foo", Approved, true},
- }
- for _, tt := range tests {
- if d, err := ParseDraft(tt.in); d != tt.draft || (err != nil) != tt.err {
- t.Errorf("%q: was %v, %v; want %v, %v", tt.in, d, err != nil, tt.draft, tt.err)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/collate_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/collate_test.go
deleted file mode 100644
index f6721639a3d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/collate_test.go
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-import (
- "fmt"
- "strings"
- "testing"
-)
-
-// A recorder implements the RuleProcessor interface, whereby its methods
-// simply record the invocations.
-type recorder struct {
- calls []string
-}
-
-func (r *recorder) Reset(anchor string, before int) error {
- if before > 5 {
- return fmt.Errorf("before %d > 5", before)
- }
- r.calls = append(r.calls, fmt.Sprintf("R:%s-%d", anchor, before))
- return nil
-}
-
-func (r *recorder) Insert(level int, str, context, extend string) error {
- s := fmt.Sprintf("O:%d:%s", level, str)
- if context != "" {
- s += "|" + context
- }
- if extend != "" {
- s += "/" + extend
- }
- r.calls = append(r.calls, s)
- return nil
-}
-
-func (r *recorder) Index(id string) {
- r.calls = append(r.calls, fmt.Sprintf("I:%s", id))
-}
-
-func (r *recorder) Error(err error) {
- r.calls = append(r.calls, fmt.Sprintf("E:%v", err))
-}
-
-func TestRuleProcessor(t *testing.T) {
- for _, tt := range []struct {
- desc string
- in string
- out string
- }{
- {desc: "empty"},
- {desc: "whitespace and comments only",
- in: `
-
-
- # adsfads
-# adfadf
- `,
- },
- {
- desc: "reset anchor",
- in: `
- & a
- &b #
- & [ before 3 ] c
- & [before 4] d & ee
- & [first tertiary ignorable]
- &'g'
- & 'h''h'h'h'
- &'\u0069' # LATIN SMALL LETTER I
- `,
- out: `
- R:a-0
- R:b-0
- R:c-3
- R:d-4
- R:ee-0
- R:<first tertiary ignorable/>-0
- R:g-0
- R:hhhh-0
- R:i-0
- `,
- },
- {
- desc: "ordering",
- in: `
- & 0
- < 1 <<''2#
-<<< 3'3''33'3#
- <<<<4
- = 5 << 6 | s
- <<<< 7 / z
- << 8'' | s / ch
- `,
- out: `
- R:0-0
- O:1:1
- O:2:'2
- O:3:33333
- O:4:4
- O:5:5
- O:2:6|s
- O:4:7/z
- O:2:8'|s/ch
- `,
- },
- {
- desc: "index",
- in: "< '\ufdd0'A",
- out: "I:A",
- },
- {
- desc: "sequence",
- in: `
- & 0
- <<* 1234
- <* a-cde-f
- =* q-q
- `,
- out: `
- R:0-0
- O:2:1
- O:2:2
- O:2:3
- O:2:4
- O:1:a
- O:1:b
- O:1:c
- O:1:d
- O:1:e
- O:1:f
- O:5:q
- `,
- },
- {
- desc: "compact",
- in: "&B<t<<<T<s<<<S<e<<<E",
- out: `
- R:B-0
- O:1:t
- O:3:T
- O:1:s
- O:3:S
- O:1:e
- O:3:E
- `,
- },
- {
- desc: "err operator",
- in: "a",
- out: "E:1: illegal operator 'a'",
- },
- {
- desc: "err line number",
- in: `& a
- << b
- a`,
- out: `
- R:a-0
- O:2:b
- E:3: illegal operator 'a'`,
- },
- {
- desc: "err empty anchor",
- in: " & ",
- out: "E:1: missing string",
- },
- {
- desc: "err anchor invalid special 1",
- in: " & [ foo ",
- out: "E:1: unmatched bracket",
- },
- {
- desc: "err anchor invalid special 2",
- in: "&[",
- out: "E:1: unmatched bracket",
- },
- {
- desc: "err anchor invalid before 1",
- in: "&[before a]",
- out: `E:1: strconv.ParseUint: parsing "a": invalid syntax`,
- },
- {
- desc: "err anchor invalid before 2",
- in: "&[before 12]",
- out: `E:1: strconv.ParseUint: parsing "12": value out of range`,
- },
- {
- desc: "err anchor invalid before 3",
- in: "&[before 2]",
- out: "E:1: missing string",
- },
- {
- desc: "err anchor invalid before 4",
- in: "&[before 6] a",
- out: "E:1: before 6 > 5",
- },
- {
- desc: "err empty order",
- in: " < ",
- out: "E:1: missing string",
- },
- {
- desc: "err empty identity",
- in: " = ",
- out: "E:1: missing string",
- },
- {
- desc: "err empty context",
- in: " < a | ",
- out: "E:1: missing string after context",
- },
- {
- desc: "err empty extend",
- in: " < a / ",
- out: "E:1: missing string after extension",
- },
- {
- desc: "err empty sequence",
- in: " <* ",
- out: "E:1: empty sequence",
- },
- {
- desc: "err sequence 1",
- in: " <* -a",
- out: "E:1: range without starter value",
- },
- {
- desc: "err sequence 3",
- in: " <* a-a-b",
- out: `O:1:a
- E:1: range without starter value
- `,
- },
- {
- desc: "err sequence 3",
- in: " <* b-a",
- out: `O:1:b
- E:1: invalid range 'b'-'a'
- `,
- },
- {
- desc: "err unmatched quote",
- in: " < 'b",
- out: ` E:1: unmatched single quote
- `,
- },
- } {
- rec := &recorder{}
- err := Collation{
- Cr: []*Common{
- {hidden: hidden{CharData: tt.in}},
- },
- }.Process(rec)
- if err != nil {
- rec.Error(err)
- }
- got := rec.calls
- want := strings.Split(strings.TrimSpace(tt.out), "\n")
- if tt.out == "" {
- want = nil
- }
- if len(got) != len(want) {
- t.Errorf("%s: nResults: got %d; want %d", tt.desc, len(got), len(want))
- continue
- }
- for i, g := range got {
- if want := strings.TrimSpace(want[i]); g != want {
- t.Errorf("%s:%d: got %q; want %q", tt.desc, i, g, want)
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/data_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/data_test.go
deleted file mode 100644
index 16621896272..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/data_test.go
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-// This file contains test data.
-
-import (
- "io"
- "strings"
-)
-
-type testLoader struct {
-}
-
-func (t testLoader) Len() int {
- return len(testFiles)
-}
-
-func (t testLoader) Path(i int) string {
- return testPaths[i]
-}
-
-func (t testLoader) Reader(i int) (io.ReadCloser, error) {
- return &reader{*strings.NewReader(testFiles[i])}, nil
-}
-
-// reader adds a dummy Close method to strings.Reader so that it
-// satisfies the io.ReadCloser interface.
-type reader struct {
- strings.Reader
-}
-
-func (r reader) Close() error {
- return nil
-}
-
-var (
- testFiles = []string{de_xml, gsw_xml, root_xml}
- testPaths = []string{
- "common/main/de.xml",
- "common/main/gsw.xml",
- "common/main/root.xml",
- }
-)
-
-var root_xml = `<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
-<ldml>
- <identity>
- <language type="root"/>
- <generation date="now"/>
- </identity>
- <characters>
- <exemplarCharacters>[]</exemplarCharacters>
- <exemplarCharacters type="auxiliary">[]</exemplarCharacters>
- <exemplarCharacters type="punctuation">[\- ‐ – — … ' ‘ ‚ &quot; “ „ \&amp; #]</exemplarCharacters>
- <ellipsis type="final">{0}…</ellipsis>
- <ellipsis type="initial">…{0}</ellipsis>
- <moreInformation>?</moreInformation>
- </characters>
- <dates>
- <calendars>
- <default choice="gregorian"/>
- <calendar type="buddhist">
- <months>
- <alias source="locale" path="../../calendar[@type='gregorian']/months"/>
- </months>
- </calendar>
- <calendar type="chinese">
- <months>
- <alias source="locale" path="../../calendar[@type='gregorian']/months"/>
- </months>
- </calendar>
- <calendar type="gregorian">
- <months>
- <default choice="format"/>
- <monthContext type="format">
- <default choice="wide"/>
- <monthWidth type="narrow">
- <alias source="locale" path="../../monthContext[@type='stand-alone']/monthWidth[@type='narrow']"/>
- </monthWidth>
- <monthWidth type="wide">
- <month type="1">11</month>
- <month type="2">22</month>
- <month type="3">33</month>
- <month type="4">44</month>
- </monthWidth>
- </monthContext>
- <monthContext type="stand-alone">
- <monthWidth type="narrow">
- <month type="1">1</month>
- <month type="2">2</month>
- <month type="3">3</month>
- <month type="4">4</month>
- </monthWidth>
- <monthWidth type="wide">
- <alias source="locale" path="../../monthContext[@type='format']/monthWidth[@type='wide']"/>
- </monthWidth>
- </monthContext>
- </months>
- </calendar>
- </calendars>
- </dates>
-</ldml>
-`
-
-var de_xml = `<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
-<ldml>
- <identity>
- <language type="de"/>
- </identity>
- <characters>
- <exemplarCharacters>[a ä b c d e ö p q r s ß t u ü v w x y z]</exemplarCharacters>
- <exemplarCharacters type="auxiliary">[á à ă]</exemplarCharacters>
- <exemplarCharacters type="index">[A B C D E F G H Z]</exemplarCharacters>
- <ellipsis type="final">{0} …</ellipsis>
- <ellipsis type="initial">… {0}</ellipsis>
- <moreInformation>?</moreInformation>
- <stopwords>
- <stopwordList type="collation" draft="provisional">der die das</stopwordList>
- </stopwords>
- </characters>
- <dates>
- <calendars>
- <calendar type="buddhist">
- <months>
- <monthContext type="format">
- <monthWidth type="narrow">
- <month type="3">BBB</month>
- </monthWidth>
- <monthWidth type="wide">
- <month type="3">bbb</month>
- </monthWidth>
- </monthContext>
- </months>
- </calendar>
- <calendar type="gregorian">
- <months>
- <monthContext type="format">
- <monthWidth type="narrow">
- <month type="3">M</month>
- <month type="4">A</month>
- </monthWidth>
- <monthWidth type="wide">
- <month type="3">Maerz</month>
- <month type="4">April</month>
- <month type="5">Mai</month>
- </monthWidth>
- </monthContext>
- <monthContext type="stand-alone">
- <monthWidth type="narrow">
- <month type="3">m</month>
- <month type="5">m</month>
- </monthWidth>
- <monthWidth type="wide">
- <month type="4">april</month>
- <month type="5">mai</month>
- </monthWidth>
- </monthContext>
- </months>
- </calendar>
- </calendars>
- </dates>
- <posix>
- <messages>
- <yesstr>yes:y</yesstr>
- <nostr>no:n</nostr>
- </messages>
- </posix>
-</ldml>
-`
-
-var gsw_xml = `<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
-<ldml>
- <identity>
- <language type="gsw"/>
- </identity>
- <posix>
- <alias source="de" path="//ldml/posix"/>
- </posix>
-</ldml>
-`
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/examples_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/examples_test.go
deleted file mode 100644
index 1a69b007383..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/examples_test.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package cldr_test
-
-import (
- "fmt"
-
- "golang.org/x/text/unicode/cldr"
-)
-
-func ExampleSlice() {
- var dr *cldr.CLDR // assume this is initialized
-
- x, _ := dr.LDML("en")
- cs := x.Collations.Collation
- // remove all but the default
- cldr.MakeSlice(&cs).Filter(func(e cldr.Elem) bool {
- return e.GetCommon().Type != x.Collations.Default()
- })
- for i, c := range cs {
- fmt.Println(i, c.Type)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/resolve_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/resolve_test.go
deleted file mode 100644
index 3d8edaec855..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/resolve_test.go
+++ /dev/null
@@ -1,368 +0,0 @@
-package cldr
-
-import (
- "fmt"
- "log"
- "reflect"
- "testing"
-)
-
-func failOnError(err error) {
- if err != nil {
- log.Panic(err)
- }
-}
-
-func data() *CLDR {
- d := Decoder{}
- data, err := d.Decode(testLoader{})
- failOnError(err)
- return data
-}
-
-type h struct {
- A string `xml:"ha,attr"`
- E string `xml:"he"`
- D string `xml:",chardata"`
- X string
-}
-
-type fieldTest struct {
- Common
- To string `xml:"to,attr"`
- Key string `xml:"key,attr"`
- E string `xml:"e"`
- D string `xml:",chardata"`
- X string
- h
-}
-
-var testStruct = fieldTest{
- Common: Common{
- name: "mapping", // exclude "type" as distinguishing attribute
- Type: "foo",
- Alt: "foo",
- },
- To: "nyc",
- Key: "k",
- E: "E",
- D: "D",
- h: h{
- A: "A",
- E: "E",
- D: "D",
- },
-}
-
-func TestIter(t *testing.T) {
- tests := map[string]string{
- "Type": "foo",
- "Alt": "foo",
- "To": "nyc",
- "A": "A",
- "Alias": "<nil>",
- }
- k := 0
- for i := iter(reflect.ValueOf(testStruct)); !i.done(); i.next() {
- v := i.value()
- if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.String {
- v = v.Elem()
- }
- name := i.field().Name
- if w, ok := tests[name]; ok {
- s := fmt.Sprint(v.Interface())
- if w != s {
- t.Errorf("value: found %q; want %q", w, s)
- }
- delete(tests, name)
- }
- k++
- }
- if len(tests) != 0 {
- t.Errorf("missing fields: %v", tests)
- }
-}
-
-func TestFindField(t *testing.T) {
- tests := []struct {
- name, val string
- exist bool
- }{
- {"type", "foo", true},
- {"alt", "foo", true},
- {"to", "nyc", true},
- {"he", "E", true},
- {"q", "", false},
- }
- vf := reflect.ValueOf(testStruct)
- for i, tt := range tests {
- v, err := findField(vf, tt.name)
- if (err == nil) != tt.exist {
- t.Errorf("%d: field %q present is %v; want %v", i, tt.name, err == nil, tt.exist)
- } else if tt.exist {
- if v.Kind() == reflect.Ptr {
- if v.IsNil() {
- continue
- }
- v = v.Elem()
- }
- if v.String() != tt.val {
- t.Errorf("%d: found value %q; want %q", i, v.String(), tt.val)
- }
- }
- }
-}
-
-var keyTests = []struct {
- exclude []string
- key string
-}{
- {[]string{}, "alt=foo;key=k;to=nyc"},
- {[]string{"type"}, "alt=foo;key=k;to=nyc"},
- {[]string{"choice"}, "alt=foo;key=k;to=nyc"},
- {[]string{"alt"}, "key=k;to=nyc"},
- {[]string{"a"}, "alt=foo;key=k;to=nyc"},
- {[]string{"to"}, "alt=foo;key=k"},
- {[]string{"alt", "to"}, "key=k"},
- {[]string{"alt", "to", "key"}, ""},
-}
-
-func TestAttrKey(t *testing.T) {
- v := reflect.ValueOf(&testStruct)
- for i, tt := range keyTests {
- key := attrKey(v, tt.exclude...)
- if key != tt.key {
- t.Errorf("%d: found %q, want %q", i, key, tt.key)
- }
- }
-}
-
-func TestKey(t *testing.T) {
- for i, tt := range keyTests {
- key := Key(&testStruct, tt.exclude...)
- if key != tt.key {
- t.Errorf("%d: found %q, want %q", i, key, tt.key)
- }
- }
-}
-
-func testEnclosing(t *testing.T, x *LDML, name string) {
- eq := func(a, b Elem, i int) {
- for ; i > 0; i-- {
- b = b.enclosing()
- }
- if a != b {
- t.Errorf("%s: found path %q, want %q", name, getPath(a), getPath(b))
- }
- }
- eq(x, x, 0)
- eq(x, x.Identity, 1)
- eq(x, x.Dates.Calendars, 2)
- eq(x, x.Dates.Calendars.Calendar[0], 3)
- eq(x, x.Dates.Calendars.Calendar[1], 3)
- //eq(x, x.Dates.Calendars.Calendar[0].Months, 4)
- eq(x, x.Dates.Calendars.Calendar[1].Months, 4)
-}
-
-func TestEnclosing(t *testing.T) {
- testEnclosing(t, data().RawLDML("de"), "enclosing-raw")
- de, _ := data().LDML("de")
- testEnclosing(t, de, "enclosing")
-}
-
-func TestDeepCopy(t *testing.T) {
- eq := func(have, want string) {
- if have != want {
- t.Errorf("found %q; want %q", have, want)
- }
- }
- x, _ := data().LDML("de")
- vc := deepCopy(reflect.ValueOf(x))
- c := vc.Interface().(*LDML)
- linkEnclosing(nil, c)
- if x == c {
- t.Errorf("did not copy")
- }
-
- eq(c.name, "ldml")
- eq(c.Dates.name, "dates")
- testEnclosing(t, c, "deepCopy")
-}
-
-type getTest struct {
- loc string
- path string
- field string // used in combination with length
- data string
- altData string // used for buddhist calendar if value != ""
- typ string
- length int
- missing bool
-}
-
-const (
- budMon = "dates/calendars/calendar[@type='buddhist']/months/"
- chnMon = "dates/calendars/calendar[@type='chinese']/months/"
- greMon = "dates/calendars/calendar[@type='gregorian']/months/"
-)
-
-func monthVal(path, context, width string, month int) string {
- const format = "%s/monthContext[@type='%s']/monthWidth[@type='%s']/month[@type='%d']"
- return fmt.Sprintf(format, path, context, width, month)
-}
-
-var rootGetTests = []getTest{
- {loc: "root", path: "identity/language", typ: "root"},
- {loc: "root", path: "characters/moreInformation", data: "?"},
- {loc: "root", path: "characters", field: "exemplarCharacters", length: 3},
- {loc: "root", path: greMon, field: "monthContext", length: 2},
- {loc: "root", path: greMon + "monthContext[@type='format']/monthWidth[@type='narrow']", field: "month", length: 4},
- {loc: "root", path: greMon + "monthContext[@type='stand-alone']/monthWidth[@type='wide']", field: "month", length: 4},
- // unescaping character data
- {loc: "root", path: "characters/exemplarCharacters[@type='punctuation']", data: `[\- ‐ – — … ' ‘ ‚ " “ „ \& #]`},
- // default resolution
- {loc: "root", path: "dates/calendars/calendar", typ: "gregorian"},
- // alias resolution
- {loc: "root", path: budMon, field: "monthContext", length: 2},
- // crossing but non-circular alias resolution
- {loc: "root", path: budMon + "monthContext[@type='format']/monthWidth[@type='narrow']", field: "month", length: 4},
- {loc: "root", path: budMon + "monthContext[@type='stand-alone']/monthWidth[@type='wide']", field: "month", length: 4},
- {loc: "root", path: monthVal(greMon, "format", "wide", 1), data: "11"},
- {loc: "root", path: monthVal(greMon, "format", "narrow", 2), data: "2"},
- {loc: "root", path: monthVal(greMon, "stand-alone", "wide", 3), data: "33"},
- {loc: "root", path: monthVal(greMon, "stand-alone", "narrow", 4), data: "4"},
- {loc: "root", path: monthVal(budMon, "format", "wide", 1), data: "11"},
- {loc: "root", path: monthVal(budMon, "format", "narrow", 2), data: "2"},
- {loc: "root", path: monthVal(budMon, "stand-alone", "wide", 3), data: "33"},
- {loc: "root", path: monthVal(budMon, "stand-alone", "narrow", 4), data: "4"},
-}
-
-// 19
-var deGetTests = []getTest{
- {loc: "de", path: "identity/language", typ: "de"},
- {loc: "de", path: "posix", length: 2},
- {loc: "de", path: "characters", field: "exemplarCharacters", length: 4},
- {loc: "de", path: "characters/exemplarCharacters[@type='auxiliary']", data: `[á à ă]`},
- // identity is a blocking element, so de should not inherit generation from root.
- {loc: "de", path: "identity/generation", missing: true},
- // default resolution
- {loc: "root", path: "dates/calendars/calendar", typ: "gregorian"},
-
- // absolute path alias resolution
- {loc: "gsw", path: "posix", field: "messages", length: 1},
- {loc: "gsw", path: "posix/messages/yesstr", data: "yes:y"},
-}
-
-// 27(greMon) - 52(budMon) - 77(chnMon)
-func calGetTests(s string) []getTest {
- tests := []getTest{
- {loc: "de", path: s, length: 2},
- {loc: "de", path: s + "monthContext[@type='format']/monthWidth[@type='wide']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "format", "wide", 1), data: "11"},
- {loc: "de", path: monthVal(s, "format", "wide", 2), data: "22"},
- {loc: "de", path: monthVal(s, "format", "wide", 3), data: "Maerz", altData: "bbb"},
- {loc: "de", path: monthVal(s, "format", "wide", 4), data: "April"},
- {loc: "de", path: monthVal(s, "format", "wide", 5), data: "Mai"},
-
- {loc: "de", path: s + "monthContext[@type='format']/monthWidth[@type='narrow']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "format", "narrow", 1), data: "1"},
- {loc: "de", path: monthVal(s, "format", "narrow", 2), data: "2"},
- {loc: "de", path: monthVal(s, "format", "narrow", 3), data: "M", altData: "BBB"},
- {loc: "de", path: monthVal(s, "format", "narrow", 4), data: "A"},
- {loc: "de", path: monthVal(s, "format", "narrow", 5), data: "m"},
-
- {loc: "de", path: s + "monthContext[@type='stand-alone']/monthWidth[@type='wide']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 1), data: "11"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 2), data: "22"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 3), data: "Maerz", altData: "bbb"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 4), data: "april"},
- {loc: "de", path: monthVal(s, "stand-alone", "wide", 5), data: "mai"},
-
- {loc: "de", path: s + "monthContext[@type='stand-alone']/monthWidth[@type='narrow']", field: "month", length: 5},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 1), data: "1"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 2), data: "2"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 3), data: "m"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 4), data: "4"},
- {loc: "de", path: monthVal(s, "stand-alone", "narrow", 5), data: "m"},
- }
- if s == budMon {
- for i, t := range tests {
- if t.altData != "" {
- tests[i].data = t.altData
- }
- }
- }
- return tests
-}
-
-var getTests = append(rootGetTests,
- append(deGetTests,
- append(calGetTests(greMon),
- append(calGetTests(budMon),
- calGetTests(chnMon)...)...)...)...)
-
-func TestPath(t *testing.T) {
- d := data()
- for i, tt := range getTests {
- x, _ := d.LDML(tt.loc)
- e, err := walkXPath(x, tt.path)
- if err != nil {
- if !tt.missing {
- t.Errorf("%d:error: %v %v", i, err, tt.missing)
- }
- continue
- }
- if tt.missing {
- t.Errorf("%d: missing is %v; want %v", i, e == nil, tt.missing)
- continue
- }
- if tt.data != "" && e.GetCommon().Data() != tt.data {
- t.Errorf("%d: data is %v; want %v", i, e.GetCommon().Data(), tt.data)
- continue
- }
- if tt.typ != "" && e.GetCommon().Type != tt.typ {
- t.Errorf("%d: type is %v; want %v", i, e.GetCommon().Type, tt.typ)
- continue
- }
- if tt.field != "" {
- slice, _ := findField(reflect.ValueOf(e), tt.field)
- if slice.Len() != tt.length {
- t.Errorf("%d: length is %v; want %v", i, slice.Len(), tt.length)
- continue
- }
- }
- }
-}
-
-func TestGet(t *testing.T) {
- d := data()
- for i, tt := range getTests {
- x, _ := d.LDML(tt.loc)
- e, err := Get(x, tt.path)
- if err != nil {
- if !tt.missing {
- t.Errorf("%d:error: %v %v", i, err, tt.missing)
- }
- continue
- }
- if tt.missing {
- t.Errorf("%d: missing is %v; want %v", i, e == nil, tt.missing)
- continue
- }
- if tt.data != "" && e.GetCommon().Data() != tt.data {
- t.Errorf("%d: data is %v; want %v", i, e.GetCommon().Data(), tt.data)
- continue
- }
- if tt.typ != "" && e.GetCommon().Type != tt.typ {
- t.Errorf("%d: type is %v; want %v", i, e.GetCommon().Type, tt.typ)
- continue
- }
- if tt.field != "" {
- slice, _ := findField(reflect.ValueOf(e), tt.field)
- if slice.Len() != tt.length {
- t.Errorf("%d: length is %v; want %v", i, slice.Len(), tt.length)
- continue
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/slice_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/slice_test.go
deleted file mode 100644
index 3d487d3bd17..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/cldr/slice_test.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cldr
-
-import (
- "reflect"
- "testing"
-)
-
-type testSlice []*Common
-
-func mkElem(alt, typ, ref string) *Common {
- return &Common{
- Type: typ,
- Reference: ref,
- Alt: alt,
- }
-}
-
-var (
- testSlice1 = testSlice{
- mkElem("1", "a", "i.a"),
- mkElem("1", "b", "i.b"),
- mkElem("1", "c", "i.c"),
- mkElem("2", "b", "ii"),
- mkElem("3", "c", "iii"),
- mkElem("4", "a", "iv.a"),
- mkElem("4", "d", "iv.d"),
- }
- testSliceE = testSlice{}
-)
-
-func panics(f func()) (panics bool) {
- defer func() {
- if err := recover(); err != nil {
- panics = true
- }
- }()
- f()
- return panics
-}
-
-func TestMakeSlice(t *testing.T) {
- foo := 1
- bar := []int{}
- tests := []struct {
- i interface{}
- panics bool
- err string
- }{
- {&foo, true, "should panic when passed a pointer to the wrong type"},
- {&bar, true, "should panic when slice element of the wrong type"},
- {testSlice1, true, "should panic when passed a slice"},
- {&testSlice1, false, "should not panic"},
- }
- for i, tt := range tests {
- if panics(func() { MakeSlice(tt.i) }) != tt.panics {
- t.Errorf("%d: %s", i, tt.err)
- }
- }
-}
-
-var anyOfTests = []struct {
- sl testSlice
- values []string
- n int
-}{
- {testSliceE, []string{}, 0},
- {testSliceE, []string{"1", "2", "3"}, 0},
- {testSlice1, []string{}, 0},
- {testSlice1, []string{"1"}, 3},
- {testSlice1, []string{"2"}, 1},
- {testSlice1, []string{"5"}, 0},
- {testSlice1, []string{"1", "2", "3"}, 5},
-}
-
-func TestSelectAnyOf(t *testing.T) {
- for i, tt := range anyOfTests {
- sl := tt.sl
- s := MakeSlice(&sl)
- s.SelectAnyOf("alt", tt.values...)
- if len(sl) != tt.n {
- t.Errorf("%d: found len == %d; want %d", i, len(sl), tt.n)
- }
- }
- sl := testSlice1
- s := MakeSlice(&sl)
- if !panics(func() { s.SelectAnyOf("foo") }) {
- t.Errorf("should panic on non-existing attribute")
- }
-}
-
-func TestFilter(t *testing.T) {
- for i, tt := range anyOfTests {
- sl := tt.sl
- s := MakeSlice(&sl)
- s.Filter(func(e Elem) bool {
- v, _ := findField(reflect.ValueOf(e), "alt")
- return in(tt.values, v.String())
- })
- if len(sl) != tt.n {
- t.Errorf("%d: found len == %d; want %d", i, len(sl), tt.n)
- }
- }
-}
-
-func TestGroup(t *testing.T) {
- f := func(excl ...string) func(Elem) string {
- return func(e Elem) string {
- return Key(e, excl...)
- }
- }
- tests := []struct {
- sl testSlice
- f func(Elem) string
- lens []int
- }{
- {testSliceE, f(), []int{}},
- {testSlice1, f(), []int{1, 1, 1, 1, 1, 1, 1}},
- {testSlice1, f("type"), []int{3, 1, 1, 2}},
- {testSlice1, f("alt"), []int{2, 2, 2, 1}},
- {testSlice1, f("alt", "type"), []int{7}},
- {testSlice1, f("alt", "type"), []int{7}},
- }
- for i, tt := range tests {
- sl := tt.sl
- s := MakeSlice(&sl)
- g := s.Group(tt.f)
- if len(tt.lens) != len(g) {
- t.Errorf("%d: found %d; want %d", i, len(g), len(tt.lens))
- continue
- }
- for j, v := range tt.lens {
- if n := g[j].Value().Len(); n != v {
- t.Errorf("%d: found %d for length of group %d; want %d", i, n, j, v)
- }
- }
- }
-}
-
-func TestSelectOnePerGroup(t *testing.T) {
- tests := []struct {
- sl testSlice
- attr string
- values []string
- refs []string
- }{
- {testSliceE, "alt", []string{"1"}, []string{}},
- {testSliceE, "type", []string{"a"}, []string{}},
- {testSlice1, "alt", []string{"2", "3", "1"}, []string{"i.a", "ii", "iii"}},
- {testSlice1, "alt", []string{"1", "4"}, []string{"i.a", "i.b", "i.c", "iv.d"}},
- {testSlice1, "type", []string{"c", "d"}, []string{"i.c", "iii", "iv.d"}},
- }
- for i, tt := range tests {
- sl := tt.sl
- s := MakeSlice(&sl)
- s.SelectOnePerGroup(tt.attr, tt.values)
- if len(sl) != len(tt.refs) {
- t.Errorf("%d: found result length %d; want %d", i, len(sl), len(tt.refs))
- continue
- }
- for j, e := range sl {
- if tt.refs[j] != e.Reference {
- t.Errorf("%d:%d found %s; want %s", i, j, e.Reference, tt.refs[i])
- }
- }
- }
- sl := testSlice1
- s := MakeSlice(&sl)
- if !panics(func() { s.SelectOnePerGroup("foo", nil) }) {
- t.Errorf("should panic on non-existing attribute")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/composition_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/composition_test.go
deleted file mode 100644
index 11684069d33..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/composition_test.go
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import "testing"
-
-// TestCase is used for most tests.
-type TestCase struct {
- in []rune
- out []rune
-}
-
-func runTests(t *testing.T, name string, fm Form, tests []TestCase) {
- rb := reorderBuffer{}
- rb.init(fm, nil)
- for i, test := range tests {
- rb.setFlusher(nil, appendFlush)
- for j, rune := range test.in {
- b := []byte(string(rune))
- src := inputBytes(b)
- info := rb.f.info(src, 0)
- if j == 0 {
- rb.ss.first(info)
- } else {
- rb.ss.next(info)
- }
- if rb.insertFlush(src, 0, info) < 0 {
- t.Errorf("%s:%d: insert failed for rune %d", name, i, j)
- }
- }
- rb.doFlush()
- was := string(rb.out)
- want := string(test.out)
- if len(was) != len(want) {
- t.Errorf("%s:%d: length = %d; want %d", name, i, len(was), len(want))
- }
- if was != want {
- k, pfx := pidx(was, want)
- t.Errorf("%s:%d: \nwas %s%+q; \nwant %s%+q", name, i, pfx, was[k:], pfx, want[k:])
- }
- }
-}
-
-func TestFlush(t *testing.T) {
- const (
- hello = "Hello "
- world = "world!"
- )
- buf := make([]byte, maxByteBufferSize)
- p := copy(buf, hello)
- out := buf[p:]
- rb := reorderBuffer{}
- rb.initString(NFC, world)
- if i := rb.flushCopy(out); i != 0 {
- t.Errorf("wrote bytes on flush of empty buffer. (len(out) = %d)", i)
- }
-
- for i := range world {
- // No need to set streamSafe values for this test.
- rb.insertFlush(rb.src, i, rb.f.info(rb.src, i))
- n := rb.flushCopy(out)
- out = out[n:]
- p += n
- }
-
- was := buf[:p]
- want := hello + world
- if string(was) != want {
- t.Errorf(`output after flush was "%s"; want "%s"`, string(was), want)
- }
- if rb.nrune != 0 {
- t.Errorf("non-null size of info buffer (rb.nrune == %d)", rb.nrune)
- }
- if rb.nbyte != 0 {
- t.Errorf("non-null size of byte buffer (rb.nbyte == %d)", rb.nbyte)
- }
-}
-
-var insertTests = []TestCase{
- {[]rune{'a'}, []rune{'a'}},
- {[]rune{0x300}, []rune{0x300}},
- {[]rune{0x300, 0x316}, []rune{0x316, 0x300}}, // CCC(0x300)==230; CCC(0x316)==220
- {[]rune{0x316, 0x300}, []rune{0x316, 0x300}},
- {[]rune{0x41, 0x316, 0x300}, []rune{0x41, 0x316, 0x300}},
- {[]rune{0x41, 0x300, 0x316}, []rune{0x41, 0x316, 0x300}},
- {[]rune{0x300, 0x316, 0x41}, []rune{0x316, 0x300, 0x41}},
- {[]rune{0x41, 0x300, 0x40, 0x316}, []rune{0x41, 0x300, 0x40, 0x316}},
-}
-
-func TestInsert(t *testing.T) {
- runTests(t, "TestInsert", NFD, insertTests)
-}
-
-var decompositionNFDTest = []TestCase{
- {[]rune{0xC0}, []rune{0x41, 0x300}},
- {[]rune{0xAC00}, []rune{0x1100, 0x1161}},
- {[]rune{0x01C4}, []rune{0x01C4}},
- {[]rune{0x320E}, []rune{0x320E}},
- {[]rune("음ẻ과"), []rune{0x110B, 0x1173, 0x11B7, 0x65, 0x309, 0x1100, 0x116A}},
-}
-
-var decompositionNFKDTest = []TestCase{
- {[]rune{0xC0}, []rune{0x41, 0x300}},
- {[]rune{0xAC00}, []rune{0x1100, 0x1161}},
- {[]rune{0x01C4}, []rune{0x44, 0x5A, 0x030C}},
- {[]rune{0x320E}, []rune{0x28, 0x1100, 0x1161, 0x29}},
-}
-
-func TestDecomposition(t *testing.T) {
- runTests(t, "TestDecompositionNFD", NFD, decompositionNFDTest)
- runTests(t, "TestDecompositionNFKD", NFKD, decompositionNFKDTest)
-}
-
-var compositionTest = []TestCase{
- {[]rune{0x41, 0x300}, []rune{0xC0}},
- {[]rune{0x41, 0x316}, []rune{0x41, 0x316}},
- {[]rune{0x41, 0x300, 0x35D}, []rune{0xC0, 0x35D}},
- {[]rune{0x41, 0x316, 0x300}, []rune{0xC0, 0x316}},
- // blocking starter
- {[]rune{0x41, 0x316, 0x40, 0x300}, []rune{0x41, 0x316, 0x40, 0x300}},
- {[]rune{0x1100, 0x1161}, []rune{0xAC00}},
- // parenthesized Hangul, alternate between ASCII and Hangul.
- {[]rune{0x28, 0x1100, 0x1161, 0x29}, []rune{0x28, 0xAC00, 0x29}},
-}
-
-func TestComposition(t *testing.T) {
- runTests(t, "TestComposition", NFC, compositionTest)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go
deleted file mode 100644
index 1d0f73dc131..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go
+++ /dev/null
@@ -1,7424 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// +build go1.10
-
-package norm
-
-const (
- Yes = iota
- No
- Maybe
-)
-
-type formData struct {
- qc uint8
- combinesForward bool
- decomposition string
-}
-
-type runeData struct {
- r rune
- ccc uint8
- nLead uint8
- nTrail uint8
- f [2]formData // 0: canonical; 1: compatibility
-}
-
-func f(qc uint8, cf bool, dec string) [2]formData {
- return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
-}
-
-func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
- return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
-}
-
-var testData = []runeData{
- {0x0, 0, 0, 0, f(Yes, false, "")},
- {0x3c, 0, 0, 0, f(Yes, true, "")},
- {0x3f, 0, 0, 0, f(Yes, false, "")},
- {0x41, 0, 0, 0, f(Yes, true, "")},
- {0x51, 0, 0, 0, f(Yes, false, "")},
- {0x52, 0, 0, 0, f(Yes, true, "")},
- {0x5b, 0, 0, 0, f(Yes, false, "")},
- {0x61, 0, 0, 0, f(Yes, true, "")},
- {0x71, 0, 0, 0, f(Yes, false, "")},
- {0x72, 0, 0, 0, f(Yes, true, "")},
- {0x7b, 0, 0, 0, f(Yes, false, "")},
- {0xa0, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0xa1, 0, 0, 0, f(Yes, false, "")},
- {0xa8, 0, 0, 1, g(Yes, No, true, false, "", " ̈")},
- {0xa9, 0, 0, 0, f(Yes, false, "")},
- {0xaa, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xab, 0, 0, 0, f(Yes, false, "")},
- {0xaf, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xb0, 0, 0, 0, f(Yes, false, "")},
- {0xb2, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xb3, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xb4, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0xb5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0xb6, 0, 0, 0, f(Yes, false, "")},
- {0xb8, 0, 0, 1, g(Yes, No, false, false, "", " ̧")},
- {0xb9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xba, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xbb, 0, 0, 0, f(Yes, false, "")},
- {0xbc, 0, 0, 0, g(Yes, No, false, false, "", "1⁄4")},
- {0xbd, 0, 0, 0, g(Yes, No, false, false, "", "1⁄2")},
- {0xbe, 0, 0, 0, g(Yes, No, false, false, "", "3⁄4")},
- {0xbf, 0, 0, 0, f(Yes, false, "")},
- {0xc0, 0, 0, 1, f(Yes, false, "À")},
- {0xc1, 0, 0, 1, f(Yes, false, "Á")},
- {0xc2, 0, 0, 1, f(Yes, true, "Â")},
- {0xc3, 0, 0, 1, f(Yes, false, "Ã")},
- {0xc4, 0, 0, 1, f(Yes, true, "Ä")},
- {0xc5, 0, 0, 1, f(Yes, true, "Å")},
- {0xc6, 0, 0, 0, f(Yes, true, "")},
- {0xc7, 0, 0, 1, f(Yes, true, "Ç")},
- {0xc8, 0, 0, 1, f(Yes, false, "È")},
- {0xc9, 0, 0, 1, f(Yes, false, "É")},
- {0xca, 0, 0, 1, f(Yes, true, "Ê")},
- {0xcb, 0, 0, 1, f(Yes, false, "Ë")},
- {0xcc, 0, 0, 1, f(Yes, false, "Ì")},
- {0xcd, 0, 0, 1, f(Yes, false, "Í")},
- {0xce, 0, 0, 1, f(Yes, false, "Î")},
- {0xcf, 0, 0, 1, f(Yes, true, "Ï")},
- {0xd0, 0, 0, 0, f(Yes, false, "")},
- {0xd1, 0, 0, 1, f(Yes, false, "Ñ")},
- {0xd2, 0, 0, 1, f(Yes, false, "Ò")},
- {0xd3, 0, 0, 1, f(Yes, false, "Ó")},
- {0xd4, 0, 0, 1, f(Yes, true, "Ô")},
- {0xd5, 0, 0, 1, f(Yes, true, "Õ")},
- {0xd6, 0, 0, 1, f(Yes, true, "Ö")},
- {0xd7, 0, 0, 0, f(Yes, false, "")},
- {0xd8, 0, 0, 0, f(Yes, true, "")},
- {0xd9, 0, 0, 1, f(Yes, false, "Ù")},
- {0xda, 0, 0, 1, f(Yes, false, "Ú")},
- {0xdb, 0, 0, 1, f(Yes, false, "Û")},
- {0xdc, 0, 0, 1, f(Yes, true, "Ü")},
- {0xdd, 0, 0, 1, f(Yes, false, "Ý")},
- {0xde, 0, 0, 0, f(Yes, false, "")},
- {0xe0, 0, 0, 1, f(Yes, false, "à")},
- {0xe1, 0, 0, 1, f(Yes, false, "á")},
- {0xe2, 0, 0, 1, f(Yes, true, "â")},
- {0xe3, 0, 0, 1, f(Yes, false, "ã")},
- {0xe4, 0, 0, 1, f(Yes, true, "ä")},
- {0xe5, 0, 0, 1, f(Yes, true, "å")},
- {0xe6, 0, 0, 0, f(Yes, true, "")},
- {0xe7, 0, 0, 1, f(Yes, true, "ç")},
- {0xe8, 0, 0, 1, f(Yes, false, "è")},
- {0xe9, 0, 0, 1, f(Yes, false, "é")},
- {0xea, 0, 0, 1, f(Yes, true, "ê")},
- {0xeb, 0, 0, 1, f(Yes, false, "ë")},
- {0xec, 0, 0, 1, f(Yes, false, "ì")},
- {0xed, 0, 0, 1, f(Yes, false, "í")},
- {0xee, 0, 0, 1, f(Yes, false, "î")},
- {0xef, 0, 0, 1, f(Yes, true, "ï")},
- {0xf0, 0, 0, 0, f(Yes, false, "")},
- {0xf1, 0, 0, 1, f(Yes, false, "ñ")},
- {0xf2, 0, 0, 1, f(Yes, false, "ò")},
- {0xf3, 0, 0, 1, f(Yes, false, "ó")},
- {0xf4, 0, 0, 1, f(Yes, true, "ô")},
- {0xf5, 0, 0, 1, f(Yes, true, "õ")},
- {0xf6, 0, 0, 1, f(Yes, true, "ö")},
- {0xf7, 0, 0, 0, f(Yes, false, "")},
- {0xf8, 0, 0, 0, f(Yes, true, "")},
- {0xf9, 0, 0, 1, f(Yes, false, "ù")},
- {0xfa, 0, 0, 1, f(Yes, false, "ú")},
- {0xfb, 0, 0, 1, f(Yes, false, "û")},
- {0xfc, 0, 0, 1, f(Yes, true, "ü")},
- {0xfd, 0, 0, 1, f(Yes, false, "ý")},
- {0xfe, 0, 0, 0, f(Yes, false, "")},
- {0xff, 0, 0, 1, f(Yes, false, "ÿ")},
- {0x100, 0, 0, 1, f(Yes, false, "Ā")},
- {0x101, 0, 0, 1, f(Yes, false, "ā")},
- {0x102, 0, 0, 1, f(Yes, true, "Ă")},
- {0x103, 0, 0, 1, f(Yes, true, "ă")},
- {0x104, 0, 0, 1, f(Yes, false, "Ą")},
- {0x105, 0, 0, 1, f(Yes, false, "ą")},
- {0x106, 0, 0, 1, f(Yes, false, "Ć")},
- {0x107, 0, 0, 1, f(Yes, false, "ć")},
- {0x108, 0, 0, 1, f(Yes, false, "Ĉ")},
- {0x109, 0, 0, 1, f(Yes, false, "ĉ")},
- {0x10a, 0, 0, 1, f(Yes, false, "Ċ")},
- {0x10b, 0, 0, 1, f(Yes, false, "ċ")},
- {0x10c, 0, 0, 1, f(Yes, false, "Č")},
- {0x10d, 0, 0, 1, f(Yes, false, "č")},
- {0x10e, 0, 0, 1, f(Yes, false, "Ď")},
- {0x10f, 0, 0, 1, f(Yes, false, "ď")},
- {0x110, 0, 0, 0, f(Yes, false, "")},
- {0x112, 0, 0, 1, f(Yes, true, "Ē")},
- {0x113, 0, 0, 1, f(Yes, true, "ē")},
- {0x114, 0, 0, 1, f(Yes, false, "Ĕ")},
- {0x115, 0, 0, 1, f(Yes, false, "ĕ")},
- {0x116, 0, 0, 1, f(Yes, false, "Ė")},
- {0x117, 0, 0, 1, f(Yes, false, "ė")},
- {0x118, 0, 0, 1, f(Yes, false, "Ę")},
- {0x119, 0, 0, 1, f(Yes, false, "ę")},
- {0x11a, 0, 0, 1, f(Yes, false, "Ě")},
- {0x11b, 0, 0, 1, f(Yes, false, "ě")},
- {0x11c, 0, 0, 1, f(Yes, false, "Ĝ")},
- {0x11d, 0, 0, 1, f(Yes, false, "ĝ")},
- {0x11e, 0, 0, 1, f(Yes, false, "Ğ")},
- {0x11f, 0, 0, 1, f(Yes, false, "ğ")},
- {0x120, 0, 0, 1, f(Yes, false, "Ġ")},
- {0x121, 0, 0, 1, f(Yes, false, "ġ")},
- {0x122, 0, 0, 1, f(Yes, false, "Ģ")},
- {0x123, 0, 0, 1, f(Yes, false, "ģ")},
- {0x124, 0, 0, 1, f(Yes, false, "Ĥ")},
- {0x125, 0, 0, 1, f(Yes, false, "ĥ")},
- {0x126, 0, 0, 0, f(Yes, false, "")},
- {0x128, 0, 0, 1, f(Yes, false, "Ĩ")},
- {0x129, 0, 0, 1, f(Yes, false, "ĩ")},
- {0x12a, 0, 0, 1, f(Yes, false, "Ī")},
- {0x12b, 0, 0, 1, f(Yes, false, "ī")},
- {0x12c, 0, 0, 1, f(Yes, false, "Ĭ")},
- {0x12d, 0, 0, 1, f(Yes, false, "ĭ")},
- {0x12e, 0, 0, 1, f(Yes, false, "Į")},
- {0x12f, 0, 0, 1, f(Yes, false, "į")},
- {0x130, 0, 0, 1, f(Yes, false, "İ")},
- {0x131, 0, 0, 0, f(Yes, false, "")},
- {0x132, 0, 0, 0, g(Yes, No, false, false, "", "IJ")},
- {0x133, 0, 0, 0, g(Yes, No, false, false, "", "ij")},
- {0x134, 0, 0, 1, f(Yes, false, "Ĵ")},
- {0x135, 0, 0, 1, f(Yes, false, "ĵ")},
- {0x136, 0, 0, 1, f(Yes, false, "Ķ")},
- {0x137, 0, 0, 1, f(Yes, false, "ķ")},
- {0x138, 0, 0, 0, f(Yes, false, "")},
- {0x139, 0, 0, 1, f(Yes, false, "Ĺ")},
- {0x13a, 0, 0, 1, f(Yes, false, "ĺ")},
- {0x13b, 0, 0, 1, f(Yes, false, "Ļ")},
- {0x13c, 0, 0, 1, f(Yes, false, "ļ")},
- {0x13d, 0, 0, 1, f(Yes, false, "Ľ")},
- {0x13e, 0, 0, 1, f(Yes, false, "ľ")},
- {0x13f, 0, 0, 0, g(Yes, No, false, false, "", "L·")},
- {0x140, 0, 0, 0, g(Yes, No, false, false, "", "l·")},
- {0x141, 0, 0, 0, f(Yes, false, "")},
- {0x143, 0, 0, 1, f(Yes, false, "Ń")},
- {0x144, 0, 0, 1, f(Yes, false, "ń")},
- {0x145, 0, 0, 1, f(Yes, false, "Ņ")},
- {0x146, 0, 0, 1, f(Yes, false, "ņ")},
- {0x147, 0, 0, 1, f(Yes, false, "Ň")},
- {0x148, 0, 0, 1, f(Yes, false, "ň")},
- {0x149, 0, 0, 0, g(Yes, No, false, false, "", "ʼn")},
- {0x14a, 0, 0, 0, f(Yes, false, "")},
- {0x14c, 0, 0, 1, f(Yes, true, "Ō")},
- {0x14d, 0, 0, 1, f(Yes, true, "ō")},
- {0x14e, 0, 0, 1, f(Yes, false, "Ŏ")},
- {0x14f, 0, 0, 1, f(Yes, false, "ŏ")},
- {0x150, 0, 0, 1, f(Yes, false, "Ő")},
- {0x151, 0, 0, 1, f(Yes, false, "ő")},
- {0x152, 0, 0, 0, f(Yes, false, "")},
- {0x154, 0, 0, 1, f(Yes, false, "Ŕ")},
- {0x155, 0, 0, 1, f(Yes, false, "ŕ")},
- {0x156, 0, 0, 1, f(Yes, false, "Ŗ")},
- {0x157, 0, 0, 1, f(Yes, false, "ŗ")},
- {0x158, 0, 0, 1, f(Yes, false, "Ř")},
- {0x159, 0, 0, 1, f(Yes, false, "ř")},
- {0x15a, 0, 0, 1, f(Yes, true, "Ś")},
- {0x15b, 0, 0, 1, f(Yes, true, "ś")},
- {0x15c, 0, 0, 1, f(Yes, false, "Ŝ")},
- {0x15d, 0, 0, 1, f(Yes, false, "ŝ")},
- {0x15e, 0, 0, 1, f(Yes, false, "Ş")},
- {0x15f, 0, 0, 1, f(Yes, false, "ş")},
- {0x160, 0, 0, 1, f(Yes, true, "Š")},
- {0x161, 0, 0, 1, f(Yes, true, "š")},
- {0x162, 0, 0, 1, f(Yes, false, "Ţ")},
- {0x163, 0, 0, 1, f(Yes, false, "ţ")},
- {0x164, 0, 0, 1, f(Yes, false, "Ť")},
- {0x165, 0, 0, 1, f(Yes, false, "ť")},
- {0x166, 0, 0, 0, f(Yes, false, "")},
- {0x168, 0, 0, 1, f(Yes, true, "Ũ")},
- {0x169, 0, 0, 1, f(Yes, true, "ũ")},
- {0x16a, 0, 0, 1, f(Yes, true, "Ū")},
- {0x16b, 0, 0, 1, f(Yes, true, "ū")},
- {0x16c, 0, 0, 1, f(Yes, false, "Ŭ")},
- {0x16d, 0, 0, 1, f(Yes, false, "ŭ")},
- {0x16e, 0, 0, 1, f(Yes, false, "Ů")},
- {0x16f, 0, 0, 1, f(Yes, false, "ů")},
- {0x170, 0, 0, 1, f(Yes, false, "Ű")},
- {0x171, 0, 0, 1, f(Yes, false, "ű")},
- {0x172, 0, 0, 1, f(Yes, false, "Ų")},
- {0x173, 0, 0, 1, f(Yes, false, "ų")},
- {0x174, 0, 0, 1, f(Yes, false, "Ŵ")},
- {0x175, 0, 0, 1, f(Yes, false, "ŵ")},
- {0x176, 0, 0, 1, f(Yes, false, "Ŷ")},
- {0x177, 0, 0, 1, f(Yes, false, "ŷ")},
- {0x178, 0, 0, 1, f(Yes, false, "Ÿ")},
- {0x179, 0, 0, 1, f(Yes, false, "Ź")},
- {0x17a, 0, 0, 1, f(Yes, false, "ź")},
- {0x17b, 0, 0, 1, f(Yes, false, "Ż")},
- {0x17c, 0, 0, 1, f(Yes, false, "ż")},
- {0x17d, 0, 0, 1, f(Yes, false, "Ž")},
- {0x17e, 0, 0, 1, f(Yes, false, "ž")},
- {0x17f, 0, 0, 0, g(Yes, No, true, false, "", "s")},
- {0x180, 0, 0, 0, f(Yes, false, "")},
- {0x1a0, 0, 0, 1, f(Yes, true, "Ơ")},
- {0x1a1, 0, 0, 1, f(Yes, true, "ơ")},
- {0x1a2, 0, 0, 0, f(Yes, false, "")},
- {0x1af, 0, 0, 1, f(Yes, true, "Ư")},
- {0x1b0, 0, 0, 1, f(Yes, true, "ư")},
- {0x1b1, 0, 0, 0, f(Yes, false, "")},
- {0x1b7, 0, 0, 0, f(Yes, true, "")},
- {0x1b8, 0, 0, 0, f(Yes, false, "")},
- {0x1c4, 0, 0, 1, g(Yes, No, false, false, "", "DŽ")},
- {0x1c5, 0, 0, 1, g(Yes, No, false, false, "", "Dž")},
- {0x1c6, 0, 0, 1, g(Yes, No, false, false, "", "dž")},
- {0x1c7, 0, 0, 0, g(Yes, No, false, false, "", "LJ")},
- {0x1c8, 0, 0, 0, g(Yes, No, false, false, "", "Lj")},
- {0x1c9, 0, 0, 0, g(Yes, No, false, false, "", "lj")},
- {0x1ca, 0, 0, 0, g(Yes, No, false, false, "", "NJ")},
- {0x1cb, 0, 0, 0, g(Yes, No, false, false, "", "Nj")},
- {0x1cc, 0, 0, 0, g(Yes, No, false, false, "", "nj")},
- {0x1cd, 0, 0, 1, f(Yes, false, "Ǎ")},
- {0x1ce, 0, 0, 1, f(Yes, false, "ǎ")},
- {0x1cf, 0, 0, 1, f(Yes, false, "Ǐ")},
- {0x1d0, 0, 0, 1, f(Yes, false, "ǐ")},
- {0x1d1, 0, 0, 1, f(Yes, false, "Ǒ")},
- {0x1d2, 0, 0, 1, f(Yes, false, "ǒ")},
- {0x1d3, 0, 0, 1, f(Yes, false, "Ǔ")},
- {0x1d4, 0, 0, 1, f(Yes, false, "ǔ")},
- {0x1d5, 0, 0, 2, f(Yes, false, "Ǖ")},
- {0x1d6, 0, 0, 2, f(Yes, false, "ǖ")},
- {0x1d7, 0, 0, 2, f(Yes, false, "Ǘ")},
- {0x1d8, 0, 0, 2, f(Yes, false, "ǘ")},
- {0x1d9, 0, 0, 2, f(Yes, false, "Ǚ")},
- {0x1da, 0, 0, 2, f(Yes, false, "ǚ")},
- {0x1db, 0, 0, 2, f(Yes, false, "Ǜ")},
- {0x1dc, 0, 0, 2, f(Yes, false, "ǜ")},
- {0x1dd, 0, 0, 0, f(Yes, false, "")},
- {0x1de, 0, 0, 2, f(Yes, false, "Ǟ")},
- {0x1df, 0, 0, 2, f(Yes, false, "ǟ")},
- {0x1e0, 0, 0, 2, f(Yes, false, "Ǡ")},
- {0x1e1, 0, 0, 2, f(Yes, false, "ǡ")},
- {0x1e2, 0, 0, 1, f(Yes, false, "Ǣ")},
- {0x1e3, 0, 0, 1, f(Yes, false, "ǣ")},
- {0x1e4, 0, 0, 0, f(Yes, false, "")},
- {0x1e6, 0, 0, 1, f(Yes, false, "Ǧ")},
- {0x1e7, 0, 0, 1, f(Yes, false, "ǧ")},
- {0x1e8, 0, 0, 1, f(Yes, false, "Ǩ")},
- {0x1e9, 0, 0, 1, f(Yes, false, "ǩ")},
- {0x1ea, 0, 0, 1, f(Yes, true, "Ǫ")},
- {0x1eb, 0, 0, 1, f(Yes, true, "ǫ")},
- {0x1ec, 0, 0, 2, f(Yes, false, "Ǭ")},
- {0x1ed, 0, 0, 2, f(Yes, false, "ǭ")},
- {0x1ee, 0, 0, 1, f(Yes, false, "Ǯ")},
- {0x1ef, 0, 0, 1, f(Yes, false, "ǯ")},
- {0x1f0, 0, 0, 1, f(Yes, false, "ǰ")},
- {0x1f1, 0, 0, 0, g(Yes, No, false, false, "", "DZ")},
- {0x1f2, 0, 0, 0, g(Yes, No, false, false, "", "Dz")},
- {0x1f3, 0, 0, 0, g(Yes, No, false, false, "", "dz")},
- {0x1f4, 0, 0, 1, f(Yes, false, "Ǵ")},
- {0x1f5, 0, 0, 1, f(Yes, false, "ǵ")},
- {0x1f6, 0, 0, 0, f(Yes, false, "")},
- {0x1f8, 0, 0, 1, f(Yes, false, "Ǹ")},
- {0x1f9, 0, 0, 1, f(Yes, false, "ǹ")},
- {0x1fa, 0, 0, 2, f(Yes, false, "Ǻ")},
- {0x1fb, 0, 0, 2, f(Yes, false, "ǻ")},
- {0x1fc, 0, 0, 1, f(Yes, false, "Ǽ")},
- {0x1fd, 0, 0, 1, f(Yes, false, "ǽ")},
- {0x1fe, 0, 0, 1, f(Yes, false, "Ǿ")},
- {0x1ff, 0, 0, 1, f(Yes, false, "ǿ")},
- {0x200, 0, 0, 1, f(Yes, false, "Ȁ")},
- {0x201, 0, 0, 1, f(Yes, false, "ȁ")},
- {0x202, 0, 0, 1, f(Yes, false, "Ȃ")},
- {0x203, 0, 0, 1, f(Yes, false, "ȃ")},
- {0x204, 0, 0, 1, f(Yes, false, "Ȅ")},
- {0x205, 0, 0, 1, f(Yes, false, "ȅ")},
- {0x206, 0, 0, 1, f(Yes, false, "Ȇ")},
- {0x207, 0, 0, 1, f(Yes, false, "ȇ")},
- {0x208, 0, 0, 1, f(Yes, false, "Ȉ")},
- {0x209, 0, 0, 1, f(Yes, false, "ȉ")},
- {0x20a, 0, 0, 1, f(Yes, false, "Ȋ")},
- {0x20b, 0, 0, 1, f(Yes, false, "ȋ")},
- {0x20c, 0, 0, 1, f(Yes, false, "Ȍ")},
- {0x20d, 0, 0, 1, f(Yes, false, "ȍ")},
- {0x20e, 0, 0, 1, f(Yes, false, "Ȏ")},
- {0x20f, 0, 0, 1, f(Yes, false, "ȏ")},
- {0x210, 0, 0, 1, f(Yes, false, "Ȑ")},
- {0x211, 0, 0, 1, f(Yes, false, "ȑ")},
- {0x212, 0, 0, 1, f(Yes, false, "Ȓ")},
- {0x213, 0, 0, 1, f(Yes, false, "ȓ")},
- {0x214, 0, 0, 1, f(Yes, false, "Ȕ")},
- {0x215, 0, 0, 1, f(Yes, false, "ȕ")},
- {0x216, 0, 0, 1, f(Yes, false, "Ȗ")},
- {0x217, 0, 0, 1, f(Yes, false, "ȗ")},
- {0x218, 0, 0, 1, f(Yes, false, "Ș")},
- {0x219, 0, 0, 1, f(Yes, false, "ș")},
- {0x21a, 0, 0, 1, f(Yes, false, "Ț")},
- {0x21b, 0, 0, 1, f(Yes, false, "ț")},
- {0x21c, 0, 0, 0, f(Yes, false, "")},
- {0x21e, 0, 0, 1, f(Yes, false, "Ȟ")},
- {0x21f, 0, 0, 1, f(Yes, false, "ȟ")},
- {0x220, 0, 0, 0, f(Yes, false, "")},
- {0x226, 0, 0, 1, f(Yes, true, "Ȧ")},
- {0x227, 0, 0, 1, f(Yes, true, "ȧ")},
- {0x228, 0, 0, 1, f(Yes, true, "Ȩ")},
- {0x229, 0, 0, 1, f(Yes, true, "ȩ")},
- {0x22a, 0, 0, 2, f(Yes, false, "Ȫ")},
- {0x22b, 0, 0, 2, f(Yes, false, "ȫ")},
- {0x22c, 0, 0, 2, f(Yes, false, "Ȭ")},
- {0x22d, 0, 0, 2, f(Yes, false, "ȭ")},
- {0x22e, 0, 0, 1, f(Yes, true, "Ȯ")},
- {0x22f, 0, 0, 1, f(Yes, true, "ȯ")},
- {0x230, 0, 0, 2, f(Yes, false, "Ȱ")},
- {0x231, 0, 0, 2, f(Yes, false, "ȱ")},
- {0x232, 0, 0, 1, f(Yes, false, "Ȳ")},
- {0x233, 0, 0, 1, f(Yes, false, "ȳ")},
- {0x234, 0, 0, 0, f(Yes, false, "")},
- {0x292, 0, 0, 0, f(Yes, true, "")},
- {0x293, 0, 0, 0, f(Yes, false, "")},
- {0x2b0, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2b1, 0, 0, 0, g(Yes, No, false, false, "", "ɦ")},
- {0x2b2, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2b3, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x2b4, 0, 0, 0, g(Yes, No, false, false, "", "ɹ")},
- {0x2b5, 0, 0, 0, g(Yes, No, false, false, "", "ɻ")},
- {0x2b6, 0, 0, 0, g(Yes, No, false, false, "", "ʁ")},
- {0x2b7, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x2b8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x2b9, 0, 0, 0, f(Yes, false, "")},
- {0x2d8, 0, 0, 1, g(Yes, No, false, false, "", " ̆")},
- {0x2d9, 0, 0, 1, g(Yes, No, false, false, "", " ̇")},
- {0x2da, 0, 0, 1, g(Yes, No, false, false, "", " ̊")},
- {0x2db, 0, 0, 1, g(Yes, No, false, false, "", " ̨")},
- {0x2dc, 0, 0, 1, g(Yes, No, false, false, "", " ̃")},
- {0x2dd, 0, 0, 1, g(Yes, No, false, false, "", " ̋")},
- {0x2de, 0, 0, 0, f(Yes, false, "")},
- {0x2e0, 0, 0, 0, g(Yes, No, false, false, "", "ɣ")},
- {0x2e1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x2e3, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2e4, 0, 0, 0, g(Yes, No, false, false, "", "ʕ")},
- {0x2e5, 0, 0, 0, f(Yes, false, "")},
- {0x300, 230, 1, 1, f(Maybe, false, "")},
- {0x305, 230, 1, 1, f(Yes, false, "")},
- {0x306, 230, 1, 1, f(Maybe, false, "")},
- {0x30d, 230, 1, 1, f(Yes, false, "")},
- {0x30f, 230, 1, 1, f(Maybe, false, "")},
- {0x310, 230, 1, 1, f(Yes, false, "")},
- {0x311, 230, 1, 1, f(Maybe, false, "")},
- {0x312, 230, 1, 1, f(Yes, false, "")},
- {0x313, 230, 1, 1, f(Maybe, false, "")},
- {0x315, 232, 1, 1, f(Yes, false, "")},
- {0x316, 220, 1, 1, f(Yes, false, "")},
- {0x31a, 232, 1, 1, f(Yes, false, "")},
- {0x31b, 216, 1, 1, f(Maybe, false, "")},
- {0x31c, 220, 1, 1, f(Yes, false, "")},
- {0x321, 202, 1, 1, f(Yes, false, "")},
- {0x323, 220, 1, 1, f(Maybe, false, "")},
- {0x327, 202, 1, 1, f(Maybe, false, "")},
- {0x329, 220, 1, 1, f(Yes, false, "")},
- {0x32d, 220, 1, 1, f(Maybe, false, "")},
- {0x32f, 220, 1, 1, f(Yes, false, "")},
- {0x330, 220, 1, 1, f(Maybe, false, "")},
- {0x332, 220, 1, 1, f(Yes, false, "")},
- {0x334, 1, 1, 1, f(Yes, false, "")},
- {0x338, 1, 1, 1, f(Maybe, false, "")},
- {0x339, 220, 1, 1, f(Yes, false, "")},
- {0x33d, 230, 1, 1, f(Yes, false, "")},
- {0x340, 230, 1, 1, f(No, false, "̀")},
- {0x341, 230, 1, 1, f(No, false, "́")},
- {0x342, 230, 1, 1, f(Maybe, false, "")},
- {0x343, 230, 1, 1, f(No, false, "̓")},
- {0x344, 230, 2, 2, f(No, false, "̈́")},
- {0x345, 240, 1, 1, f(Maybe, false, "")},
- {0x346, 230, 1, 1, f(Yes, false, "")},
- {0x347, 220, 1, 1, f(Yes, false, "")},
- {0x34a, 230, 1, 1, f(Yes, false, "")},
- {0x34d, 220, 1, 1, f(Yes, false, "")},
- {0x34f, 0, 0, 0, f(Yes, false, "")},
- {0x350, 230, 1, 1, f(Yes, false, "")},
- {0x353, 220, 1, 1, f(Yes, false, "")},
- {0x357, 230, 1, 1, f(Yes, false, "")},
- {0x358, 232, 1, 1, f(Yes, false, "")},
- {0x359, 220, 1, 1, f(Yes, false, "")},
- {0x35b, 230, 1, 1, f(Yes, false, "")},
- {0x35c, 233, 1, 1, f(Yes, false, "")},
- {0x35d, 234, 1, 1, f(Yes, false, "")},
- {0x35f, 233, 1, 1, f(Yes, false, "")},
- {0x360, 234, 1, 1, f(Yes, false, "")},
- {0x362, 233, 1, 1, f(Yes, false, "")},
- {0x363, 230, 1, 1, f(Yes, false, "")},
- {0x370, 0, 0, 0, f(Yes, false, "")},
- {0x374, 0, 0, 0, f(No, false, "ʹ")},
- {0x375, 0, 0, 0, f(Yes, false, "")},
- {0x37a, 0, 0, 1, g(Yes, No, false, false, "", " ͅ")},
- {0x37b, 0, 0, 0, f(Yes, false, "")},
- {0x37e, 0, 0, 0, f(No, false, ";")},
- {0x37f, 0, 0, 0, f(Yes, false, "")},
- {0x384, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0x385, 0, 0, 2, g(Yes, No, false, false, "΅", " ̈́")},
- {0x386, 0, 0, 1, f(Yes, false, "Ά")},
- {0x387, 0, 0, 0, f(No, false, "·")},
- {0x388, 0, 0, 1, f(Yes, false, "Έ")},
- {0x389, 0, 0, 1, f(Yes, false, "Ή")},
- {0x38a, 0, 0, 1, f(Yes, false, "Ί")},
- {0x38b, 0, 0, 0, f(Yes, false, "")},
- {0x38c, 0, 0, 1, f(Yes, false, "Ό")},
- {0x38d, 0, 0, 0, f(Yes, false, "")},
- {0x38e, 0, 0, 1, f(Yes, false, "Ύ")},
- {0x38f, 0, 0, 1, f(Yes, false, "Ώ")},
- {0x390, 0, 0, 2, f(Yes, false, "ΐ")},
- {0x391, 0, 0, 0, f(Yes, true, "")},
- {0x392, 0, 0, 0, f(Yes, false, "")},
- {0x395, 0, 0, 0, f(Yes, true, "")},
- {0x396, 0, 0, 0, f(Yes, false, "")},
- {0x397, 0, 0, 0, f(Yes, true, "")},
- {0x398, 0, 0, 0, f(Yes, false, "")},
- {0x399, 0, 0, 0, f(Yes, true, "")},
- {0x39a, 0, 0, 0, f(Yes, false, "")},
- {0x39f, 0, 0, 0, f(Yes, true, "")},
- {0x3a0, 0, 0, 0, f(Yes, false, "")},
- {0x3a1, 0, 0, 0, f(Yes, true, "")},
- {0x3a2, 0, 0, 0, f(Yes, false, "")},
- {0x3a5, 0, 0, 0, f(Yes, true, "")},
- {0x3a6, 0, 0, 0, f(Yes, false, "")},
- {0x3a9, 0, 0, 0, f(Yes, true, "")},
- {0x3aa, 0, 0, 1, f(Yes, false, "Ϊ")},
- {0x3ab, 0, 0, 1, f(Yes, false, "Ϋ")},
- {0x3ac, 0, 0, 1, f(Yes, true, "ά")},
- {0x3ad, 0, 0, 1, f(Yes, false, "έ")},
- {0x3ae, 0, 0, 1, f(Yes, true, "ή")},
- {0x3af, 0, 0, 1, f(Yes, false, "ί")},
- {0x3b0, 0, 0, 2, f(Yes, false, "ΰ")},
- {0x3b1, 0, 0, 0, f(Yes, true, "")},
- {0x3b2, 0, 0, 0, f(Yes, false, "")},
- {0x3b5, 0, 0, 0, f(Yes, true, "")},
- {0x3b6, 0, 0, 0, f(Yes, false, "")},
- {0x3b7, 0, 0, 0, f(Yes, true, "")},
- {0x3b8, 0, 0, 0, f(Yes, false, "")},
- {0x3b9, 0, 0, 0, f(Yes, true, "")},
- {0x3ba, 0, 0, 0, f(Yes, false, "")},
- {0x3bf, 0, 0, 0, f(Yes, true, "")},
- {0x3c0, 0, 0, 0, f(Yes, false, "")},
- {0x3c1, 0, 0, 0, f(Yes, true, "")},
- {0x3c2, 0, 0, 0, f(Yes, false, "")},
- {0x3c5, 0, 0, 0, f(Yes, true, "")},
- {0x3c6, 0, 0, 0, f(Yes, false, "")},
- {0x3c9, 0, 0, 0, f(Yes, true, "")},
- {0x3ca, 0, 0, 1, f(Yes, true, "ϊ")},
- {0x3cb, 0, 0, 1, f(Yes, true, "ϋ")},
- {0x3cc, 0, 0, 1, f(Yes, false, "ό")},
- {0x3cd, 0, 0, 1, f(Yes, false, "ύ")},
- {0x3ce, 0, 0, 1, f(Yes, true, "ώ")},
- {0x3cf, 0, 0, 0, f(Yes, false, "")},
- {0x3d0, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x3d1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x3d2, 0, 0, 0, g(Yes, No, true, false, "", "Υ")},
- {0x3d3, 0, 0, 1, g(Yes, No, false, false, "ϓ", "Ύ")},
- {0x3d4, 0, 0, 1, g(Yes, No, false, false, "ϔ", "Ϋ")},
- {0x3d5, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x3d6, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x3d7, 0, 0, 0, f(Yes, false, "")},
- {0x3f0, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x3f1, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x3f2, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x3f3, 0, 0, 0, f(Yes, false, "")},
- {0x3f4, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x3f5, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x3f6, 0, 0, 0, f(Yes, false, "")},
- {0x3f9, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x3fa, 0, 0, 0, f(Yes, false, "")},
- {0x400, 0, 0, 1, f(Yes, false, "Ѐ")},
- {0x401, 0, 0, 1, f(Yes, false, "Ё")},
- {0x402, 0, 0, 0, f(Yes, false, "")},
- {0x403, 0, 0, 1, f(Yes, false, "Ѓ")},
- {0x404, 0, 0, 0, f(Yes, false, "")},
- {0x406, 0, 0, 0, f(Yes, true, "")},
- {0x407, 0, 0, 1, f(Yes, false, "Ї")},
- {0x408, 0, 0, 0, f(Yes, false, "")},
- {0x40c, 0, 0, 1, f(Yes, false, "Ќ")},
- {0x40d, 0, 0, 1, f(Yes, false, "Ѝ")},
- {0x40e, 0, 0, 1, f(Yes, false, "Ў")},
- {0x40f, 0, 0, 0, f(Yes, false, "")},
- {0x410, 0, 0, 0, f(Yes, true, "")},
- {0x411, 0, 0, 0, f(Yes, false, "")},
- {0x413, 0, 0, 0, f(Yes, true, "")},
- {0x414, 0, 0, 0, f(Yes, false, "")},
- {0x415, 0, 0, 0, f(Yes, true, "")},
- {0x419, 0, 0, 1, f(Yes, false, "Й")},
- {0x41a, 0, 0, 0, f(Yes, true, "")},
- {0x41b, 0, 0, 0, f(Yes, false, "")},
- {0x41e, 0, 0, 0, f(Yes, true, "")},
- {0x41f, 0, 0, 0, f(Yes, false, "")},
- {0x423, 0, 0, 0, f(Yes, true, "")},
- {0x424, 0, 0, 0, f(Yes, false, "")},
- {0x427, 0, 0, 0, f(Yes, true, "")},
- {0x428, 0, 0, 0, f(Yes, false, "")},
- {0x42b, 0, 0, 0, f(Yes, true, "")},
- {0x42c, 0, 0, 0, f(Yes, false, "")},
- {0x42d, 0, 0, 0, f(Yes, true, "")},
- {0x42e, 0, 0, 0, f(Yes, false, "")},
- {0x430, 0, 0, 0, f(Yes, true, "")},
- {0x431, 0, 0, 0, f(Yes, false, "")},
- {0x433, 0, 0, 0, f(Yes, true, "")},
- {0x434, 0, 0, 0, f(Yes, false, "")},
- {0x435, 0, 0, 0, f(Yes, true, "")},
- {0x439, 0, 0, 1, f(Yes, false, "й")},
- {0x43a, 0, 0, 0, f(Yes, true, "")},
- {0x43b, 0, 0, 0, f(Yes, false, "")},
- {0x43e, 0, 0, 0, f(Yes, true, "")},
- {0x43f, 0, 0, 0, f(Yes, false, "")},
- {0x443, 0, 0, 0, f(Yes, true, "")},
- {0x444, 0, 0, 0, f(Yes, false, "")},
- {0x447, 0, 0, 0, f(Yes, true, "")},
- {0x448, 0, 0, 0, f(Yes, false, "")},
- {0x44b, 0, 0, 0, f(Yes, true, "")},
- {0x44c, 0, 0, 0, f(Yes, false, "")},
- {0x44d, 0, 0, 0, f(Yes, true, "")},
- {0x44e, 0, 0, 0, f(Yes, false, "")},
- {0x450, 0, 0, 1, f(Yes, false, "ѐ")},
- {0x451, 0, 0, 1, f(Yes, false, "ё")},
- {0x452, 0, 0, 0, f(Yes, false, "")},
- {0x453, 0, 0, 1, f(Yes, false, "ѓ")},
- {0x454, 0, 0, 0, f(Yes, false, "")},
- {0x456, 0, 0, 0, f(Yes, true, "")},
- {0x457, 0, 0, 1, f(Yes, false, "ї")},
- {0x458, 0, 0, 0, f(Yes, false, "")},
- {0x45c, 0, 0, 1, f(Yes, false, "ќ")},
- {0x45d, 0, 0, 1, f(Yes, false, "ѝ")},
- {0x45e, 0, 0, 1, f(Yes, false, "ў")},
- {0x45f, 0, 0, 0, f(Yes, false, "")},
- {0x474, 0, 0, 0, f(Yes, true, "")},
- {0x476, 0, 0, 1, f(Yes, false, "Ѷ")},
- {0x477, 0, 0, 1, f(Yes, false, "ѷ")},
- {0x478, 0, 0, 0, f(Yes, false, "")},
- {0x483, 230, 1, 1, f(Yes, false, "")},
- {0x488, 0, 0, 0, f(Yes, false, "")},
- {0x4c1, 0, 0, 1, f(Yes, false, "Ӂ")},
- {0x4c2, 0, 0, 1, f(Yes, false, "ӂ")},
- {0x4c3, 0, 0, 0, f(Yes, false, "")},
- {0x4d0, 0, 0, 1, f(Yes, false, "Ӑ")},
- {0x4d1, 0, 0, 1, f(Yes, false, "ӑ")},
- {0x4d2, 0, 0, 1, f(Yes, false, "Ӓ")},
- {0x4d3, 0, 0, 1, f(Yes, false, "ӓ")},
- {0x4d4, 0, 0, 0, f(Yes, false, "")},
- {0x4d6, 0, 0, 1, f(Yes, false, "Ӗ")},
- {0x4d7, 0, 0, 1, f(Yes, false, "ӗ")},
- {0x4d8, 0, 0, 0, f(Yes, true, "")},
- {0x4da, 0, 0, 1, f(Yes, false, "Ӛ")},
- {0x4db, 0, 0, 1, f(Yes, false, "ӛ")},
- {0x4dc, 0, 0, 1, f(Yes, false, "Ӝ")},
- {0x4dd, 0, 0, 1, f(Yes, false, "ӝ")},
- {0x4de, 0, 0, 1, f(Yes, false, "Ӟ")},
- {0x4df, 0, 0, 1, f(Yes, false, "ӟ")},
- {0x4e0, 0, 0, 0, f(Yes, false, "")},
- {0x4e2, 0, 0, 1, f(Yes, false, "Ӣ")},
- {0x4e3, 0, 0, 1, f(Yes, false, "ӣ")},
- {0x4e4, 0, 0, 1, f(Yes, false, "Ӥ")},
- {0x4e5, 0, 0, 1, f(Yes, false, "ӥ")},
- {0x4e6, 0, 0, 1, f(Yes, false, "Ӧ")},
- {0x4e7, 0, 0, 1, f(Yes, false, "ӧ")},
- {0x4e8, 0, 0, 0, f(Yes, true, "")},
- {0x4ea, 0, 0, 1, f(Yes, false, "Ӫ")},
- {0x4eb, 0, 0, 1, f(Yes, false, "ӫ")},
- {0x4ec, 0, 0, 1, f(Yes, false, "Ӭ")},
- {0x4ed, 0, 0, 1, f(Yes, false, "ӭ")},
- {0x4ee, 0, 0, 1, f(Yes, false, "Ӯ")},
- {0x4ef, 0, 0, 1, f(Yes, false, "ӯ")},
- {0x4f0, 0, 0, 1, f(Yes, false, "Ӱ")},
- {0x4f1, 0, 0, 1, f(Yes, false, "ӱ")},
- {0x4f2, 0, 0, 1, f(Yes, false, "Ӳ")},
- {0x4f3, 0, 0, 1, f(Yes, false, "ӳ")},
- {0x4f4, 0, 0, 1, f(Yes, false, "Ӵ")},
- {0x4f5, 0, 0, 1, f(Yes, false, "ӵ")},
- {0x4f6, 0, 0, 0, f(Yes, false, "")},
- {0x4f8, 0, 0, 1, f(Yes, false, "Ӹ")},
- {0x4f9, 0, 0, 1, f(Yes, false, "ӹ")},
- {0x4fa, 0, 0, 0, f(Yes, false, "")},
- {0x587, 0, 0, 0, g(Yes, No, false, false, "", "եւ")},
- {0x588, 0, 0, 0, f(Yes, false, "")},
- {0x591, 220, 1, 1, f(Yes, false, "")},
- {0x592, 230, 1, 1, f(Yes, false, "")},
- {0x596, 220, 1, 1, f(Yes, false, "")},
- {0x597, 230, 1, 1, f(Yes, false, "")},
- {0x59a, 222, 1, 1, f(Yes, false, "")},
- {0x59b, 220, 1, 1, f(Yes, false, "")},
- {0x59c, 230, 1, 1, f(Yes, false, "")},
- {0x5a2, 220, 1, 1, f(Yes, false, "")},
- {0x5a8, 230, 1, 1, f(Yes, false, "")},
- {0x5aa, 220, 1, 1, f(Yes, false, "")},
- {0x5ab, 230, 1, 1, f(Yes, false, "")},
- {0x5ad, 222, 1, 1, f(Yes, false, "")},
- {0x5ae, 228, 1, 1, f(Yes, false, "")},
- {0x5af, 230, 1, 1, f(Yes, false, "")},
- {0x5b0, 10, 1, 1, f(Yes, false, "")},
- {0x5b1, 11, 1, 1, f(Yes, false, "")},
- {0x5b2, 12, 1, 1, f(Yes, false, "")},
- {0x5b3, 13, 1, 1, f(Yes, false, "")},
- {0x5b4, 14, 1, 1, f(Yes, false, "")},
- {0x5b5, 15, 1, 1, f(Yes, false, "")},
- {0x5b6, 16, 1, 1, f(Yes, false, "")},
- {0x5b7, 17, 1, 1, f(Yes, false, "")},
- {0x5b8, 18, 1, 1, f(Yes, false, "")},
- {0x5b9, 19, 1, 1, f(Yes, false, "")},
- {0x5bb, 20, 1, 1, f(Yes, false, "")},
- {0x5bc, 21, 1, 1, f(Yes, false, "")},
- {0x5bd, 22, 1, 1, f(Yes, false, "")},
- {0x5be, 0, 0, 0, f(Yes, false, "")},
- {0x5bf, 23, 1, 1, f(Yes, false, "")},
- {0x5c0, 0, 0, 0, f(Yes, false, "")},
- {0x5c1, 24, 1, 1, f(Yes, false, "")},
- {0x5c2, 25, 1, 1, f(Yes, false, "")},
- {0x5c3, 0, 0, 0, f(Yes, false, "")},
- {0x5c4, 230, 1, 1, f(Yes, false, "")},
- {0x5c5, 220, 1, 1, f(Yes, false, "")},
- {0x5c6, 0, 0, 0, f(Yes, false, "")},
- {0x5c7, 18, 1, 1, f(Yes, false, "")},
- {0x5c8, 0, 0, 0, f(Yes, false, "")},
- {0x610, 230, 1, 1, f(Yes, false, "")},
- {0x618, 30, 1, 1, f(Yes, false, "")},
- {0x619, 31, 1, 1, f(Yes, false, "")},
- {0x61a, 32, 1, 1, f(Yes, false, "")},
- {0x61b, 0, 0, 0, f(Yes, false, "")},
- {0x622, 0, 0, 1, f(Yes, false, "آ")},
- {0x623, 0, 0, 1, f(Yes, false, "أ")},
- {0x624, 0, 0, 1, f(Yes, false, "ؤ")},
- {0x625, 0, 0, 1, f(Yes, false, "إ")},
- {0x626, 0, 0, 1, f(Yes, false, "ئ")},
- {0x627, 0, 0, 0, f(Yes, true, "")},
- {0x628, 0, 0, 0, f(Yes, false, "")},
- {0x648, 0, 0, 0, f(Yes, true, "")},
- {0x649, 0, 0, 0, f(Yes, false, "")},
- {0x64a, 0, 0, 0, f(Yes, true, "")},
- {0x64b, 27, 1, 1, f(Yes, false, "")},
- {0x64c, 28, 1, 1, f(Yes, false, "")},
- {0x64d, 29, 1, 1, f(Yes, false, "")},
- {0x64e, 30, 1, 1, f(Yes, false, "")},
- {0x64f, 31, 1, 1, f(Yes, false, "")},
- {0x650, 32, 1, 1, f(Yes, false, "")},
- {0x651, 33, 1, 1, f(Yes, false, "")},
- {0x652, 34, 1, 1, f(Yes, false, "")},
- {0x653, 230, 1, 1, f(Maybe, false, "")},
- {0x655, 220, 1, 1, f(Maybe, false, "")},
- {0x656, 220, 1, 1, f(Yes, false, "")},
- {0x657, 230, 1, 1, f(Yes, false, "")},
- {0x65c, 220, 1, 1, f(Yes, false, "")},
- {0x65d, 230, 1, 1, f(Yes, false, "")},
- {0x65f, 220, 1, 1, f(Yes, false, "")},
- {0x660, 0, 0, 0, f(Yes, false, "")},
- {0x670, 35, 1, 1, f(Yes, false, "")},
- {0x671, 0, 0, 0, f(Yes, false, "")},
- {0x675, 0, 0, 0, g(Yes, No, false, false, "", "اٴ")},
- {0x676, 0, 0, 0, g(Yes, No, false, false, "", "وٴ")},
- {0x677, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0x678, 0, 0, 0, g(Yes, No, false, false, "", "يٴ")},
- {0x679, 0, 0, 0, f(Yes, false, "")},
- {0x6c0, 0, 0, 1, f(Yes, false, "ۀ")},
- {0x6c1, 0, 0, 0, f(Yes, true, "")},
- {0x6c2, 0, 0, 1, f(Yes, false, "ۂ")},
- {0x6c3, 0, 0, 0, f(Yes, false, "")},
- {0x6d2, 0, 0, 0, f(Yes, true, "")},
- {0x6d3, 0, 0, 1, f(Yes, false, "ۓ")},
- {0x6d4, 0, 0, 0, f(Yes, false, "")},
- {0x6d5, 0, 0, 0, f(Yes, true, "")},
- {0x6d6, 230, 1, 1, f(Yes, false, "")},
- {0x6dd, 0, 0, 0, f(Yes, false, "")},
- {0x6df, 230, 1, 1, f(Yes, false, "")},
- {0x6e3, 220, 1, 1, f(Yes, false, "")},
- {0x6e4, 230, 1, 1, f(Yes, false, "")},
- {0x6e5, 0, 0, 0, f(Yes, false, "")},
- {0x6e7, 230, 1, 1, f(Yes, false, "")},
- {0x6e9, 0, 0, 0, f(Yes, false, "")},
- {0x6ea, 220, 1, 1, f(Yes, false, "")},
- {0x6eb, 230, 1, 1, f(Yes, false, "")},
- {0x6ed, 220, 1, 1, f(Yes, false, "")},
- {0x6ee, 0, 0, 0, f(Yes, false, "")},
- {0x711, 36, 1, 1, f(Yes, false, "")},
- {0x712, 0, 0, 0, f(Yes, false, "")},
- {0x730, 230, 1, 1, f(Yes, false, "")},
- {0x731, 220, 1, 1, f(Yes, false, "")},
- {0x732, 230, 1, 1, f(Yes, false, "")},
- {0x734, 220, 1, 1, f(Yes, false, "")},
- {0x735, 230, 1, 1, f(Yes, false, "")},
- {0x737, 220, 1, 1, f(Yes, false, "")},
- {0x73a, 230, 1, 1, f(Yes, false, "")},
- {0x73b, 220, 1, 1, f(Yes, false, "")},
- {0x73d, 230, 1, 1, f(Yes, false, "")},
- {0x73e, 220, 1, 1, f(Yes, false, "")},
- {0x73f, 230, 1, 1, f(Yes, false, "")},
- {0x742, 220, 1, 1, f(Yes, false, "")},
- {0x743, 230, 1, 1, f(Yes, false, "")},
- {0x744, 220, 1, 1, f(Yes, false, "")},
- {0x745, 230, 1, 1, f(Yes, false, "")},
- {0x746, 220, 1, 1, f(Yes, false, "")},
- {0x747, 230, 1, 1, f(Yes, false, "")},
- {0x748, 220, 1, 1, f(Yes, false, "")},
- {0x749, 230, 1, 1, f(Yes, false, "")},
- {0x74b, 0, 0, 0, f(Yes, false, "")},
- {0x7eb, 230, 1, 1, f(Yes, false, "")},
- {0x7f2, 220, 1, 1, f(Yes, false, "")},
- {0x7f3, 230, 1, 1, f(Yes, false, "")},
- {0x7f4, 0, 0, 0, f(Yes, false, "")},
- {0x816, 230, 1, 1, f(Yes, false, "")},
- {0x81a, 0, 0, 0, f(Yes, false, "")},
- {0x81b, 230, 1, 1, f(Yes, false, "")},
- {0x824, 0, 0, 0, f(Yes, false, "")},
- {0x825, 230, 1, 1, f(Yes, false, "")},
- {0x828, 0, 0, 0, f(Yes, false, "")},
- {0x829, 230, 1, 1, f(Yes, false, "")},
- {0x82e, 0, 0, 0, f(Yes, false, "")},
- {0x859, 220, 1, 1, f(Yes, false, "")},
- {0x85c, 0, 0, 0, f(Yes, false, "")},
- {0x8d4, 230, 1, 1, f(Yes, false, "")},
- {0x8e2, 0, 0, 0, f(Yes, false, "")},
- {0x8e3, 220, 1, 1, f(Yes, false, "")},
- {0x8e4, 230, 1, 1, f(Yes, false, "")},
- {0x8e6, 220, 1, 1, f(Yes, false, "")},
- {0x8e7, 230, 1, 1, f(Yes, false, "")},
- {0x8e9, 220, 1, 1, f(Yes, false, "")},
- {0x8ea, 230, 1, 1, f(Yes, false, "")},
- {0x8ed, 220, 1, 1, f(Yes, false, "")},
- {0x8f0, 27, 1, 1, f(Yes, false, "")},
- {0x8f1, 28, 1, 1, f(Yes, false, "")},
- {0x8f2, 29, 1, 1, f(Yes, false, "")},
- {0x8f3, 230, 1, 1, f(Yes, false, "")},
- {0x8f6, 220, 1, 1, f(Yes, false, "")},
- {0x8f7, 230, 1, 1, f(Yes, false, "")},
- {0x8f9, 220, 1, 1, f(Yes, false, "")},
- {0x8fb, 230, 1, 1, f(Yes, false, "")},
- {0x900, 0, 0, 0, f(Yes, false, "")},
- {0x928, 0, 0, 0, f(Yes, true, "")},
- {0x929, 0, 0, 1, f(Yes, false, "ऩ")},
- {0x92a, 0, 0, 0, f(Yes, false, "")},
- {0x930, 0, 0, 0, f(Yes, true, "")},
- {0x931, 0, 0, 1, f(Yes, false, "ऱ")},
- {0x932, 0, 0, 0, f(Yes, false, "")},
- {0x933, 0, 0, 0, f(Yes, true, "")},
- {0x934, 0, 0, 1, f(Yes, false, "ऴ")},
- {0x935, 0, 0, 0, f(Yes, false, "")},
- {0x93c, 7, 1, 1, f(Maybe, false, "")},
- {0x93d, 0, 0, 0, f(Yes, false, "")},
- {0x94d, 9, 1, 1, f(Yes, false, "")},
- {0x94e, 0, 0, 0, f(Yes, false, "")},
- {0x951, 230, 1, 1, f(Yes, false, "")},
- {0x952, 220, 1, 1, f(Yes, false, "")},
- {0x953, 230, 1, 1, f(Yes, false, "")},
- {0x955, 0, 0, 0, f(Yes, false, "")},
- {0x958, 0, 0, 1, f(No, false, "क़")},
- {0x959, 0, 0, 1, f(No, false, "ख़")},
- {0x95a, 0, 0, 1, f(No, false, "ग़")},
- {0x95b, 0, 0, 1, f(No, false, "ज़")},
- {0x95c, 0, 0, 1, f(No, false, "ड़")},
- {0x95d, 0, 0, 1, f(No, false, "ढ़")},
- {0x95e, 0, 0, 1, f(No, false, "फ़")},
- {0x95f, 0, 0, 1, f(No, false, "य़")},
- {0x960, 0, 0, 0, f(Yes, false, "")},
- {0x9bc, 7, 1, 1, f(Yes, false, "")},
- {0x9bd, 0, 0, 0, f(Yes, false, "")},
- {0x9be, 0, 1, 1, f(Maybe, false, "")},
- {0x9bf, 0, 0, 0, f(Yes, false, "")},
- {0x9c7, 0, 0, 0, f(Yes, true, "")},
- {0x9c8, 0, 0, 0, f(Yes, false, "")},
- {0x9cb, 0, 0, 1, f(Yes, false, "ো")},
- {0x9cc, 0, 0, 1, f(Yes, false, "ৌ")},
- {0x9cd, 9, 1, 1, f(Yes, false, "")},
- {0x9ce, 0, 0, 0, f(Yes, false, "")},
- {0x9d7, 0, 1, 1, f(Maybe, false, "")},
- {0x9d8, 0, 0, 0, f(Yes, false, "")},
- {0x9dc, 0, 0, 1, f(No, false, "ড়")},
- {0x9dd, 0, 0, 1, f(No, false, "ঢ়")},
- {0x9de, 0, 0, 0, f(Yes, false, "")},
- {0x9df, 0, 0, 1, f(No, false, "য়")},
- {0x9e0, 0, 0, 0, f(Yes, false, "")},
- {0xa33, 0, 0, 1, f(No, false, "ਲ਼")},
- {0xa34, 0, 0, 0, f(Yes, false, "")},
- {0xa36, 0, 0, 1, f(No, false, "ਸ਼")},
- {0xa37, 0, 0, 0, f(Yes, false, "")},
- {0xa3c, 7, 1, 1, f(Yes, false, "")},
- {0xa3d, 0, 0, 0, f(Yes, false, "")},
- {0xa4d, 9, 1, 1, f(Yes, false, "")},
- {0xa4e, 0, 0, 0, f(Yes, false, "")},
- {0xa59, 0, 0, 1, f(No, false, "ਖ਼")},
- {0xa5a, 0, 0, 1, f(No, false, "ਗ਼")},
- {0xa5b, 0, 0, 1, f(No, false, "ਜ਼")},
- {0xa5c, 0, 0, 0, f(Yes, false, "")},
- {0xa5e, 0, 0, 1, f(No, false, "ਫ਼")},
- {0xa5f, 0, 0, 0, f(Yes, false, "")},
- {0xabc, 7, 1, 1, f(Yes, false, "")},
- {0xabd, 0, 0, 0, f(Yes, false, "")},
- {0xacd, 9, 1, 1, f(Yes, false, "")},
- {0xace, 0, 0, 0, f(Yes, false, "")},
- {0xb3c, 7, 1, 1, f(Yes, false, "")},
- {0xb3d, 0, 0, 0, f(Yes, false, "")},
- {0xb3e, 0, 1, 1, f(Maybe, false, "")},
- {0xb3f, 0, 0, 0, f(Yes, false, "")},
- {0xb47, 0, 0, 0, f(Yes, true, "")},
- {0xb48, 0, 0, 1, f(Yes, false, "ୈ")},
- {0xb49, 0, 0, 0, f(Yes, false, "")},
- {0xb4b, 0, 0, 1, f(Yes, false, "ୋ")},
- {0xb4c, 0, 0, 1, f(Yes, false, "ୌ")},
- {0xb4d, 9, 1, 1, f(Yes, false, "")},
- {0xb4e, 0, 0, 0, f(Yes, false, "")},
- {0xb56, 0, 1, 1, f(Maybe, false, "")},
- {0xb58, 0, 0, 0, f(Yes, false, "")},
- {0xb5c, 0, 0, 1, f(No, false, "ଡ଼")},
- {0xb5d, 0, 0, 1, f(No, false, "ଢ଼")},
- {0xb5e, 0, 0, 0, f(Yes, false, "")},
- {0xb92, 0, 0, 0, f(Yes, true, "")},
- {0xb93, 0, 0, 0, f(Yes, false, "")},
- {0xb94, 0, 0, 1, f(Yes, false, "ஔ")},
- {0xb95, 0, 0, 0, f(Yes, false, "")},
- {0xbbe, 0, 1, 1, f(Maybe, false, "")},
- {0xbbf, 0, 0, 0, f(Yes, false, "")},
- {0xbc6, 0, 0, 0, f(Yes, true, "")},
- {0xbc8, 0, 0, 0, f(Yes, false, "")},
- {0xbca, 0, 0, 1, f(Yes, false, "ொ")},
- {0xbcb, 0, 0, 1, f(Yes, false, "ோ")},
- {0xbcc, 0, 0, 1, f(Yes, false, "ௌ")},
- {0xbcd, 9, 1, 1, f(Yes, false, "")},
- {0xbce, 0, 0, 0, f(Yes, false, "")},
- {0xbd7, 0, 1, 1, f(Maybe, false, "")},
- {0xbd8, 0, 0, 0, f(Yes, false, "")},
- {0xc46, 0, 0, 0, f(Yes, true, "")},
- {0xc47, 0, 0, 0, f(Yes, false, "")},
- {0xc48, 0, 0, 1, f(Yes, false, "ై")},
- {0xc49, 0, 0, 0, f(Yes, false, "")},
- {0xc4d, 9, 1, 1, f(Yes, false, "")},
- {0xc4e, 0, 0, 0, f(Yes, false, "")},
- {0xc55, 84, 1, 1, f(Yes, false, "")},
- {0xc56, 91, 1, 1, f(Maybe, false, "")},
- {0xc57, 0, 0, 0, f(Yes, false, "")},
- {0xcbc, 7, 1, 1, f(Yes, false, "")},
- {0xcbd, 0, 0, 0, f(Yes, false, "")},
- {0xcbf, 0, 0, 0, f(Yes, true, "")},
- {0xcc0, 0, 0, 1, f(Yes, false, "ೀ")},
- {0xcc1, 0, 0, 0, f(Yes, false, "")},
- {0xcc2, 0, 1, 1, f(Maybe, false, "")},
- {0xcc3, 0, 0, 0, f(Yes, false, "")},
- {0xcc6, 0, 0, 0, f(Yes, true, "")},
- {0xcc7, 0, 0, 1, f(Yes, false, "ೇ")},
- {0xcc8, 0, 0, 1, f(Yes, false, "ೈ")},
- {0xcc9, 0, 0, 0, f(Yes, false, "")},
- {0xcca, 0, 0, 1, f(Yes, true, "ೊ")},
- {0xccb, 0, 0, 2, f(Yes, false, "ೋ")},
- {0xccc, 0, 0, 0, f(Yes, false, "")},
- {0xccd, 9, 1, 1, f(Yes, false, "")},
- {0xcce, 0, 0, 0, f(Yes, false, "")},
- {0xcd5, 0, 1, 1, f(Maybe, false, "")},
- {0xcd7, 0, 0, 0, f(Yes, false, "")},
- {0xd3b, 9, 1, 1, f(Yes, false, "")},
- {0xd3d, 0, 0, 0, f(Yes, false, "")},
- {0xd3e, 0, 1, 1, f(Maybe, false, "")},
- {0xd3f, 0, 0, 0, f(Yes, false, "")},
- {0xd46, 0, 0, 0, f(Yes, true, "")},
- {0xd48, 0, 0, 0, f(Yes, false, "")},
- {0xd4a, 0, 0, 1, f(Yes, false, "ൊ")},
- {0xd4b, 0, 0, 1, f(Yes, false, "ോ")},
- {0xd4c, 0, 0, 1, f(Yes, false, "ൌ")},
- {0xd4d, 9, 1, 1, f(Yes, false, "")},
- {0xd4e, 0, 0, 0, f(Yes, false, "")},
- {0xd57, 0, 1, 1, f(Maybe, false, "")},
- {0xd58, 0, 0, 0, f(Yes, false, "")},
- {0xdca, 9, 1, 1, f(Maybe, false, "")},
- {0xdcb, 0, 0, 0, f(Yes, false, "")},
- {0xdcf, 0, 1, 1, f(Maybe, false, "")},
- {0xdd0, 0, 0, 0, f(Yes, false, "")},
- {0xdd9, 0, 0, 0, f(Yes, true, "")},
- {0xdda, 0, 0, 1, f(Yes, false, "ේ")},
- {0xddb, 0, 0, 0, f(Yes, false, "")},
- {0xddc, 0, 0, 1, f(Yes, true, "ො")},
- {0xddd, 0, 0, 2, f(Yes, false, "ෝ")},
- {0xdde, 0, 0, 1, f(Yes, false, "ෞ")},
- {0xddf, 0, 1, 1, f(Maybe, false, "")},
- {0xde0, 0, 0, 0, f(Yes, false, "")},
- {0xe33, 0, 0, 0, g(Yes, No, false, false, "", "ํา")},
- {0xe34, 0, 0, 0, f(Yes, false, "")},
- {0xe38, 103, 1, 1, f(Yes, false, "")},
- {0xe3a, 9, 1, 1, f(Yes, false, "")},
- {0xe3b, 0, 0, 0, f(Yes, false, "")},
- {0xe48, 107, 1, 1, f(Yes, false, "")},
- {0xe4c, 0, 0, 0, f(Yes, false, "")},
- {0xeb3, 0, 0, 0, g(Yes, No, false, false, "", "ໍາ")},
- {0xeb4, 0, 0, 0, f(Yes, false, "")},
- {0xeb8, 118, 1, 1, f(Yes, false, "")},
- {0xeba, 0, 0, 0, f(Yes, false, "")},
- {0xec8, 122, 1, 1, f(Yes, false, "")},
- {0xecc, 0, 0, 0, f(Yes, false, "")},
- {0xedc, 0, 0, 0, g(Yes, No, false, false, "", "ຫນ")},
- {0xedd, 0, 0, 0, g(Yes, No, false, false, "", "ຫມ")},
- {0xede, 0, 0, 0, f(Yes, false, "")},
- {0xf0c, 0, 0, 0, g(Yes, No, false, false, "", "་")},
- {0xf0d, 0, 0, 0, f(Yes, false, "")},
- {0xf18, 220, 1, 1, f(Yes, false, "")},
- {0xf1a, 0, 0, 0, f(Yes, false, "")},
- {0xf35, 220, 1, 1, f(Yes, false, "")},
- {0xf36, 0, 0, 0, f(Yes, false, "")},
- {0xf37, 220, 1, 1, f(Yes, false, "")},
- {0xf38, 0, 0, 0, f(Yes, false, "")},
- {0xf39, 216, 1, 1, f(Yes, false, "")},
- {0xf3a, 0, 0, 0, f(Yes, false, "")},
- {0xf43, 0, 0, 0, f(No, false, "གྷ")},
- {0xf44, 0, 0, 0, f(Yes, false, "")},
- {0xf4d, 0, 0, 0, f(No, false, "ཌྷ")},
- {0xf4e, 0, 0, 0, f(Yes, false, "")},
- {0xf52, 0, 0, 0, f(No, false, "དྷ")},
- {0xf53, 0, 0, 0, f(Yes, false, "")},
- {0xf57, 0, 0, 0, f(No, false, "བྷ")},
- {0xf58, 0, 0, 0, f(Yes, false, "")},
- {0xf5c, 0, 0, 0, f(No, false, "ཛྷ")},
- {0xf5d, 0, 0, 0, f(Yes, false, "")},
- {0xf69, 0, 0, 0, f(No, false, "ཀྵ")},
- {0xf6a, 0, 0, 0, f(Yes, false, "")},
- {0xf71, 129, 1, 1, f(Yes, false, "")},
- {0xf72, 130, 1, 1, f(Yes, false, "")},
- {0xf73, 0, 2, 2, f(No, false, "ཱི")},
- {0xf74, 132, 1, 1, f(Yes, false, "")},
- {0xf75, 0, 2, 2, f(No, false, "ཱུ")},
- {0xf76, 0, 0, 1, f(No, false, "ྲྀ")},
- {0xf77, 0, 0, 2, g(Yes, No, false, false, "", "ྲཱྀ")},
- {0xf78, 0, 0, 1, f(No, false, "ླྀ")},
- {0xf79, 0, 0, 2, g(Yes, No, false, false, "", "ླཱྀ")},
- {0xf7a, 130, 1, 1, f(Yes, false, "")},
- {0xf7e, 0, 0, 0, f(Yes, false, "")},
- {0xf80, 130, 1, 1, f(Yes, false, "")},
- {0xf81, 0, 2, 2, f(No, false, "ཱྀ")},
- {0xf82, 230, 1, 1, f(Yes, false, "")},
- {0xf84, 9, 1, 1, f(Yes, false, "")},
- {0xf85, 0, 0, 0, f(Yes, false, "")},
- {0xf86, 230, 1, 1, f(Yes, false, "")},
- {0xf88, 0, 0, 0, f(Yes, false, "")},
- {0xf93, 0, 0, 0, f(No, false, "ྒྷ")},
- {0xf94, 0, 0, 0, f(Yes, false, "")},
- {0xf9d, 0, 0, 0, f(No, false, "ྜྷ")},
- {0xf9e, 0, 0, 0, f(Yes, false, "")},
- {0xfa2, 0, 0, 0, f(No, false, "ྡྷ")},
- {0xfa3, 0, 0, 0, f(Yes, false, "")},
- {0xfa7, 0, 0, 0, f(No, false, "ྦྷ")},
- {0xfa8, 0, 0, 0, f(Yes, false, "")},
- {0xfac, 0, 0, 0, f(No, false, "ྫྷ")},
- {0xfad, 0, 0, 0, f(Yes, false, "")},
- {0xfb9, 0, 0, 0, f(No, false, "ྐྵ")},
- {0xfba, 0, 0, 0, f(Yes, false, "")},
- {0xfc6, 220, 1, 1, f(Yes, false, "")},
- {0xfc7, 0, 0, 0, f(Yes, false, "")},
- {0x1025, 0, 0, 0, f(Yes, true, "")},
- {0x1026, 0, 0, 1, f(Yes, false, "ဦ")},
- {0x1027, 0, 0, 0, f(Yes, false, "")},
- {0x102e, 0, 1, 1, f(Maybe, false, "")},
- {0x102f, 0, 0, 0, f(Yes, false, "")},
- {0x1037, 7, 1, 1, f(Yes, false, "")},
- {0x1038, 0, 0, 0, f(Yes, false, "")},
- {0x1039, 9, 1, 1, f(Yes, false, "")},
- {0x103b, 0, 0, 0, f(Yes, false, "")},
- {0x108d, 220, 1, 1, f(Yes, false, "")},
- {0x108e, 0, 0, 0, f(Yes, false, "")},
- {0x10fc, 0, 0, 0, g(Yes, No, false, false, "", "ნ")},
- {0x10fd, 0, 0, 0, f(Yes, false, "")},
- {0x1100, 0, 0, 0, f(Yes, true, "")},
- {0x1113, 0, 0, 0, f(Yes, false, "")},
- {0x1161, 0, 1, 1, f(Maybe, true, "")},
- {0x1176, 0, 0, 0, f(Yes, false, "")},
- {0x11a8, 0, 1, 1, f(Maybe, false, "")},
- {0x11c3, 0, 0, 0, f(Yes, false, "")},
- {0x135d, 230, 1, 1, f(Yes, false, "")},
- {0x1360, 0, 0, 0, f(Yes, false, "")},
- {0x1714, 9, 1, 1, f(Yes, false, "")},
- {0x1715, 0, 0, 0, f(Yes, false, "")},
- {0x1734, 9, 1, 1, f(Yes, false, "")},
- {0x1735, 0, 0, 0, f(Yes, false, "")},
- {0x17d2, 9, 1, 1, f(Yes, false, "")},
- {0x17d3, 0, 0, 0, f(Yes, false, "")},
- {0x17dd, 230, 1, 1, f(Yes, false, "")},
- {0x17de, 0, 0, 0, f(Yes, false, "")},
- {0x18a9, 228, 1, 1, f(Yes, false, "")},
- {0x18aa, 0, 0, 0, f(Yes, false, "")},
- {0x1939, 222, 1, 1, f(Yes, false, "")},
- {0x193a, 230, 1, 1, f(Yes, false, "")},
- {0x193b, 220, 1, 1, f(Yes, false, "")},
- {0x193c, 0, 0, 0, f(Yes, false, "")},
- {0x1a17, 230, 1, 1, f(Yes, false, "")},
- {0x1a18, 220, 1, 1, f(Yes, false, "")},
- {0x1a19, 0, 0, 0, f(Yes, false, "")},
- {0x1a60, 9, 1, 1, f(Yes, false, "")},
- {0x1a61, 0, 0, 0, f(Yes, false, "")},
- {0x1a75, 230, 1, 1, f(Yes, false, "")},
- {0x1a7d, 0, 0, 0, f(Yes, false, "")},
- {0x1a7f, 220, 1, 1, f(Yes, false, "")},
- {0x1a80, 0, 0, 0, f(Yes, false, "")},
- {0x1ab0, 230, 1, 1, f(Yes, false, "")},
- {0x1ab5, 220, 1, 1, f(Yes, false, "")},
- {0x1abb, 230, 1, 1, f(Yes, false, "")},
- {0x1abd, 220, 1, 1, f(Yes, false, "")},
- {0x1abe, 0, 0, 0, f(Yes, false, "")},
- {0x1b05, 0, 0, 0, f(Yes, true, "")},
- {0x1b06, 0, 0, 1, f(Yes, false, "ᬆ")},
- {0x1b07, 0, 0, 0, f(Yes, true, "")},
- {0x1b08, 0, 0, 1, f(Yes, false, "ᬈ")},
- {0x1b09, 0, 0, 0, f(Yes, true, "")},
- {0x1b0a, 0, 0, 1, f(Yes, false, "ᬊ")},
- {0x1b0b, 0, 0, 0, f(Yes, true, "")},
- {0x1b0c, 0, 0, 1, f(Yes, false, "ᬌ")},
- {0x1b0d, 0, 0, 0, f(Yes, true, "")},
- {0x1b0e, 0, 0, 1, f(Yes, false, "ᬎ")},
- {0x1b0f, 0, 0, 0, f(Yes, false, "")},
- {0x1b11, 0, 0, 0, f(Yes, true, "")},
- {0x1b12, 0, 0, 1, f(Yes, false, "ᬒ")},
- {0x1b13, 0, 0, 0, f(Yes, false, "")},
- {0x1b34, 7, 1, 1, f(Yes, false, "")},
- {0x1b35, 0, 1, 1, f(Maybe, false, "")},
- {0x1b36, 0, 0, 0, f(Yes, false, "")},
- {0x1b3a, 0, 0, 0, f(Yes, true, "")},
- {0x1b3b, 0, 0, 1, f(Yes, false, "ᬻ")},
- {0x1b3c, 0, 0, 0, f(Yes, true, "")},
- {0x1b3d, 0, 0, 1, f(Yes, false, "ᬽ")},
- {0x1b3e, 0, 0, 0, f(Yes, true, "")},
- {0x1b40, 0, 0, 1, f(Yes, false, "ᭀ")},
- {0x1b41, 0, 0, 1, f(Yes, false, "ᭁ")},
- {0x1b42, 0, 0, 0, f(Yes, true, "")},
- {0x1b43, 0, 0, 1, f(Yes, false, "ᭃ")},
- {0x1b44, 9, 1, 1, f(Yes, false, "")},
- {0x1b45, 0, 0, 0, f(Yes, false, "")},
- {0x1b6b, 230, 1, 1, f(Yes, false, "")},
- {0x1b6c, 220, 1, 1, f(Yes, false, "")},
- {0x1b6d, 230, 1, 1, f(Yes, false, "")},
- {0x1b74, 0, 0, 0, f(Yes, false, "")},
- {0x1baa, 9, 1, 1, f(Yes, false, "")},
- {0x1bac, 0, 0, 0, f(Yes, false, "")},
- {0x1be6, 7, 1, 1, f(Yes, false, "")},
- {0x1be7, 0, 0, 0, f(Yes, false, "")},
- {0x1bf2, 9, 1, 1, f(Yes, false, "")},
- {0x1bf4, 0, 0, 0, f(Yes, false, "")},
- {0x1c37, 7, 1, 1, f(Yes, false, "")},
- {0x1c38, 0, 0, 0, f(Yes, false, "")},
- {0x1cd0, 230, 1, 1, f(Yes, false, "")},
- {0x1cd3, 0, 0, 0, f(Yes, false, "")},
- {0x1cd4, 1, 1, 1, f(Yes, false, "")},
- {0x1cd5, 220, 1, 1, f(Yes, false, "")},
- {0x1cda, 230, 1, 1, f(Yes, false, "")},
- {0x1cdc, 220, 1, 1, f(Yes, false, "")},
- {0x1ce0, 230, 1, 1, f(Yes, false, "")},
- {0x1ce1, 0, 0, 0, f(Yes, false, "")},
- {0x1ce2, 1, 1, 1, f(Yes, false, "")},
- {0x1ce9, 0, 0, 0, f(Yes, false, "")},
- {0x1ced, 220, 1, 1, f(Yes, false, "")},
- {0x1cee, 0, 0, 0, f(Yes, false, "")},
- {0x1cf4, 230, 1, 1, f(Yes, false, "")},
- {0x1cf5, 0, 0, 0, f(Yes, false, "")},
- {0x1cf8, 230, 1, 1, f(Yes, false, "")},
- {0x1cfa, 0, 0, 0, f(Yes, false, "")},
- {0x1d2c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d2d, 0, 0, 0, g(Yes, No, false, false, "", "Æ")},
- {0x1d2e, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d2f, 0, 0, 0, f(Yes, false, "")},
- {0x1d30, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d31, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d32, 0, 0, 0, g(Yes, No, false, false, "", "Ǝ")},
- {0x1d33, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d34, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d35, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d36, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d37, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d38, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d39, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d3a, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d3b, 0, 0, 0, f(Yes, false, "")},
- {0x1d3c, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d3d, 0, 0, 0, g(Yes, No, false, false, "", "Ȣ")},
- {0x1d3e, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d3f, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d40, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d41, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d42, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d43, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44, 0, 0, 0, g(Yes, No, false, false, "", "ɐ")},
- {0x1d45, 0, 0, 0, g(Yes, No, false, false, "", "ɑ")},
- {0x1d46, 0, 0, 0, g(Yes, No, false, false, "", "ᴂ")},
- {0x1d47, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d48, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d49, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4a, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x1d4b, 0, 0, 0, g(Yes, No, false, false, "", "ɛ")},
- {0x1d4c, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1d4d, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4e, 0, 0, 0, f(Yes, false, "")},
- {0x1d4f, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d50, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d51, 0, 0, 0, g(Yes, No, false, false, "", "ŋ")},
- {0x1d52, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d53, 0, 0, 0, g(Yes, No, false, false, "", "ɔ")},
- {0x1d54, 0, 0, 0, g(Yes, No, false, false, "", "ᴖ")},
- {0x1d55, 0, 0, 0, g(Yes, No, false, false, "", "ᴗ")},
- {0x1d56, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d57, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d58, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59, 0, 0, 0, g(Yes, No, false, false, "", "ᴝ")},
- {0x1d5a, 0, 0, 0, g(Yes, No, false, false, "", "ɯ")},
- {0x1d5b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5c, 0, 0, 0, g(Yes, No, false, false, "", "ᴥ")},
- {0x1d5d, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d5e, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d5f, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d60, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d61, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d62, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d63, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d64, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d65, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d67, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d68, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d69, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6a, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6b, 0, 0, 0, f(Yes, false, "")},
- {0x1d78, 0, 0, 0, g(Yes, No, false, false, "", "н")},
- {0x1d79, 0, 0, 0, f(Yes, false, "")},
- {0x1d9b, 0, 0, 0, g(Yes, No, false, false, "", "ɒ")},
- {0x1d9c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d9d, 0, 0, 0, g(Yes, No, false, false, "", "ɕ")},
- {0x1d9e, 0, 0, 0, g(Yes, No, false, false, "", "ð")},
- {0x1d9f, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1da0, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1da1, 0, 0, 0, g(Yes, No, false, false, "", "ɟ")},
- {0x1da2, 0, 0, 0, g(Yes, No, false, false, "", "ɡ")},
- {0x1da3, 0, 0, 0, g(Yes, No, false, false, "", "ɥ")},
- {0x1da4, 0, 0, 0, g(Yes, No, false, false, "", "ɨ")},
- {0x1da5, 0, 0, 0, g(Yes, No, false, false, "", "ɩ")},
- {0x1da6, 0, 0, 0, g(Yes, No, false, false, "", "ɪ")},
- {0x1da7, 0, 0, 0, g(Yes, No, false, false, "", "ᵻ")},
- {0x1da8, 0, 0, 0, g(Yes, No, false, false, "", "ʝ")},
- {0x1da9, 0, 0, 0, g(Yes, No, false, false, "", "ɭ")},
- {0x1daa, 0, 0, 0, g(Yes, No, false, false, "", "ᶅ")},
- {0x1dab, 0, 0, 0, g(Yes, No, false, false, "", "ʟ")},
- {0x1dac, 0, 0, 0, g(Yes, No, false, false, "", "ɱ")},
- {0x1dad, 0, 0, 0, g(Yes, No, false, false, "", "ɰ")},
- {0x1dae, 0, 0, 0, g(Yes, No, false, false, "", "ɲ")},
- {0x1daf, 0, 0, 0, g(Yes, No, false, false, "", "ɳ")},
- {0x1db0, 0, 0, 0, g(Yes, No, false, false, "", "ɴ")},
- {0x1db1, 0, 0, 0, g(Yes, No, false, false, "", "ɵ")},
- {0x1db2, 0, 0, 0, g(Yes, No, false, false, "", "ɸ")},
- {0x1db3, 0, 0, 0, g(Yes, No, false, false, "", "ʂ")},
- {0x1db4, 0, 0, 0, g(Yes, No, false, false, "", "ʃ")},
- {0x1db5, 0, 0, 0, g(Yes, No, false, false, "", "ƫ")},
- {0x1db6, 0, 0, 0, g(Yes, No, false, false, "", "ʉ")},
- {0x1db7, 0, 0, 0, g(Yes, No, false, false, "", "ʊ")},
- {0x1db8, 0, 0, 0, g(Yes, No, false, false, "", "ᴜ")},
- {0x1db9, 0, 0, 0, g(Yes, No, false, false, "", "ʋ")},
- {0x1dba, 0, 0, 0, g(Yes, No, false, false, "", "ʌ")},
- {0x1dbb, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1dbc, 0, 0, 0, g(Yes, No, false, false, "", "ʐ")},
- {0x1dbd, 0, 0, 0, g(Yes, No, false, false, "", "ʑ")},
- {0x1dbe, 0, 0, 0, g(Yes, No, false, false, "", "ʒ")},
- {0x1dbf, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1dc0, 230, 1, 1, f(Yes, false, "")},
- {0x1dc2, 220, 1, 1, f(Yes, false, "")},
- {0x1dc3, 230, 1, 1, f(Yes, false, "")},
- {0x1dca, 220, 1, 1, f(Yes, false, "")},
- {0x1dcb, 230, 1, 1, f(Yes, false, "")},
- {0x1dcd, 234, 1, 1, f(Yes, false, "")},
- {0x1dce, 214, 1, 1, f(Yes, false, "")},
- {0x1dcf, 220, 1, 1, f(Yes, false, "")},
- {0x1dd0, 202, 1, 1, f(Yes, false, "")},
- {0x1dd1, 230, 1, 1, f(Yes, false, "")},
- {0x1df6, 232, 1, 1, f(Yes, false, "")},
- {0x1df7, 228, 1, 1, f(Yes, false, "")},
- {0x1df9, 220, 1, 1, f(Yes, false, "")},
- {0x1dfa, 0, 0, 0, f(Yes, false, "")},
- {0x1dfb, 230, 1, 1, f(Yes, false, "")},
- {0x1dfc, 233, 1, 1, f(Yes, false, "")},
- {0x1dfd, 220, 1, 1, f(Yes, false, "")},
- {0x1dfe, 230, 1, 1, f(Yes, false, "")},
- {0x1dff, 220, 1, 1, f(Yes, false, "")},
- {0x1e00, 0, 0, 1, f(Yes, false, "Ḁ")},
- {0x1e01, 0, 0, 1, f(Yes, false, "ḁ")},
- {0x1e02, 0, 0, 1, f(Yes, false, "Ḃ")},
- {0x1e03, 0, 0, 1, f(Yes, false, "ḃ")},
- {0x1e04, 0, 0, 1, f(Yes, false, "Ḅ")},
- {0x1e05, 0, 0, 1, f(Yes, false, "ḅ")},
- {0x1e06, 0, 0, 1, f(Yes, false, "Ḇ")},
- {0x1e07, 0, 0, 1, f(Yes, false, "ḇ")},
- {0x1e08, 0, 0, 2, f(Yes, false, "Ḉ")},
- {0x1e09, 0, 0, 2, f(Yes, false, "ḉ")},
- {0x1e0a, 0, 0, 1, f(Yes, false, "Ḋ")},
- {0x1e0b, 0, 0, 1, f(Yes, false, "ḋ")},
- {0x1e0c, 0, 0, 1, f(Yes, false, "Ḍ")},
- {0x1e0d, 0, 0, 1, f(Yes, false, "ḍ")},
- {0x1e0e, 0, 0, 1, f(Yes, false, "Ḏ")},
- {0x1e0f, 0, 0, 1, f(Yes, false, "ḏ")},
- {0x1e10, 0, 0, 1, f(Yes, false, "Ḑ")},
- {0x1e11, 0, 0, 1, f(Yes, false, "ḑ")},
- {0x1e12, 0, 0, 1, f(Yes, false, "Ḓ")},
- {0x1e13, 0, 0, 1, f(Yes, false, "ḓ")},
- {0x1e14, 0, 0, 2, f(Yes, false, "Ḕ")},
- {0x1e15, 0, 0, 2, f(Yes, false, "ḕ")},
- {0x1e16, 0, 0, 2, f(Yes, false, "Ḗ")},
- {0x1e17, 0, 0, 2, f(Yes, false, "ḗ")},
- {0x1e18, 0, 0, 1, f(Yes, false, "Ḙ")},
- {0x1e19, 0, 0, 1, f(Yes, false, "ḙ")},
- {0x1e1a, 0, 0, 1, f(Yes, false, "Ḛ")},
- {0x1e1b, 0, 0, 1, f(Yes, false, "ḛ")},
- {0x1e1c, 0, 0, 2, f(Yes, false, "Ḝ")},
- {0x1e1d, 0, 0, 2, f(Yes, false, "ḝ")},
- {0x1e1e, 0, 0, 1, f(Yes, false, "Ḟ")},
- {0x1e1f, 0, 0, 1, f(Yes, false, "ḟ")},
- {0x1e20, 0, 0, 1, f(Yes, false, "Ḡ")},
- {0x1e21, 0, 0, 1, f(Yes, false, "ḡ")},
- {0x1e22, 0, 0, 1, f(Yes, false, "Ḣ")},
- {0x1e23, 0, 0, 1, f(Yes, false, "ḣ")},
- {0x1e24, 0, 0, 1, f(Yes, false, "Ḥ")},
- {0x1e25, 0, 0, 1, f(Yes, false, "ḥ")},
- {0x1e26, 0, 0, 1, f(Yes, false, "Ḧ")},
- {0x1e27, 0, 0, 1, f(Yes, false, "ḧ")},
- {0x1e28, 0, 0, 1, f(Yes, false, "Ḩ")},
- {0x1e29, 0, 0, 1, f(Yes, false, "ḩ")},
- {0x1e2a, 0, 0, 1, f(Yes, false, "Ḫ")},
- {0x1e2b, 0, 0, 1, f(Yes, false, "ḫ")},
- {0x1e2c, 0, 0, 1, f(Yes, false, "Ḭ")},
- {0x1e2d, 0, 0, 1, f(Yes, false, "ḭ")},
- {0x1e2e, 0, 0, 2, f(Yes, false, "Ḯ")},
- {0x1e2f, 0, 0, 2, f(Yes, false, "ḯ")},
- {0x1e30, 0, 0, 1, f(Yes, false, "Ḱ")},
- {0x1e31, 0, 0, 1, f(Yes, false, "ḱ")},
- {0x1e32, 0, 0, 1, f(Yes, false, "Ḳ")},
- {0x1e33, 0, 0, 1, f(Yes, false, "ḳ")},
- {0x1e34, 0, 0, 1, f(Yes, false, "Ḵ")},
- {0x1e35, 0, 0, 1, f(Yes, false, "ḵ")},
- {0x1e36, 0, 0, 1, f(Yes, true, "Ḷ")},
- {0x1e37, 0, 0, 1, f(Yes, true, "ḷ")},
- {0x1e38, 0, 0, 2, f(Yes, false, "Ḹ")},
- {0x1e39, 0, 0, 2, f(Yes, false, "ḹ")},
- {0x1e3a, 0, 0, 1, f(Yes, false, "Ḻ")},
- {0x1e3b, 0, 0, 1, f(Yes, false, "ḻ")},
- {0x1e3c, 0, 0, 1, f(Yes, false, "Ḽ")},
- {0x1e3d, 0, 0, 1, f(Yes, false, "ḽ")},
- {0x1e3e, 0, 0, 1, f(Yes, false, "Ḿ")},
- {0x1e3f, 0, 0, 1, f(Yes, false, "ḿ")},
- {0x1e40, 0, 0, 1, f(Yes, false, "Ṁ")},
- {0x1e41, 0, 0, 1, f(Yes, false, "ṁ")},
- {0x1e42, 0, 0, 1, f(Yes, false, "Ṃ")},
- {0x1e43, 0, 0, 1, f(Yes, false, "ṃ")},
- {0x1e44, 0, 0, 1, f(Yes, false, "Ṅ")},
- {0x1e45, 0, 0, 1, f(Yes, false, "ṅ")},
- {0x1e46, 0, 0, 1, f(Yes, false, "Ṇ")},
- {0x1e47, 0, 0, 1, f(Yes, false, "ṇ")},
- {0x1e48, 0, 0, 1, f(Yes, false, "Ṉ")},
- {0x1e49, 0, 0, 1, f(Yes, false, "ṉ")},
- {0x1e4a, 0, 0, 1, f(Yes, false, "Ṋ")},
- {0x1e4b, 0, 0, 1, f(Yes, false, "ṋ")},
- {0x1e4c, 0, 0, 2, f(Yes, false, "Ṍ")},
- {0x1e4d, 0, 0, 2, f(Yes, false, "ṍ")},
- {0x1e4e, 0, 0, 2, f(Yes, false, "Ṏ")},
- {0x1e4f, 0, 0, 2, f(Yes, false, "ṏ")},
- {0x1e50, 0, 0, 2, f(Yes, false, "Ṑ")},
- {0x1e51, 0, 0, 2, f(Yes, false, "ṑ")},
- {0x1e52, 0, 0, 2, f(Yes, false, "Ṓ")},
- {0x1e53, 0, 0, 2, f(Yes, false, "ṓ")},
- {0x1e54, 0, 0, 1, f(Yes, false, "Ṕ")},
- {0x1e55, 0, 0, 1, f(Yes, false, "ṕ")},
- {0x1e56, 0, 0, 1, f(Yes, false, "Ṗ")},
- {0x1e57, 0, 0, 1, f(Yes, false, "ṗ")},
- {0x1e58, 0, 0, 1, f(Yes, false, "Ṙ")},
- {0x1e59, 0, 0, 1, f(Yes, false, "ṙ")},
- {0x1e5a, 0, 0, 1, f(Yes, true, "Ṛ")},
- {0x1e5b, 0, 0, 1, f(Yes, true, "ṛ")},
- {0x1e5c, 0, 0, 2, f(Yes, false, "Ṝ")},
- {0x1e5d, 0, 0, 2, f(Yes, false, "ṝ")},
- {0x1e5e, 0, 0, 1, f(Yes, false, "Ṟ")},
- {0x1e5f, 0, 0, 1, f(Yes, false, "ṟ")},
- {0x1e60, 0, 0, 1, f(Yes, false, "Ṡ")},
- {0x1e61, 0, 0, 1, f(Yes, false, "ṡ")},
- {0x1e62, 0, 0, 1, f(Yes, true, "Ṣ")},
- {0x1e63, 0, 0, 1, f(Yes, true, "ṣ")},
- {0x1e64, 0, 0, 2, f(Yes, false, "Ṥ")},
- {0x1e65, 0, 0, 2, f(Yes, false, "ṥ")},
- {0x1e66, 0, 0, 2, f(Yes, false, "Ṧ")},
- {0x1e67, 0, 0, 2, f(Yes, false, "ṧ")},
- {0x1e68, 0, 0, 2, f(Yes, false, "Ṩ")},
- {0x1e69, 0, 0, 2, f(Yes, false, "ṩ")},
- {0x1e6a, 0, 0, 1, f(Yes, false, "Ṫ")},
- {0x1e6b, 0, 0, 1, f(Yes, false, "ṫ")},
- {0x1e6c, 0, 0, 1, f(Yes, false, "Ṭ")},
- {0x1e6d, 0, 0, 1, f(Yes, false, "ṭ")},
- {0x1e6e, 0, 0, 1, f(Yes, false, "Ṯ")},
- {0x1e6f, 0, 0, 1, f(Yes, false, "ṯ")},
- {0x1e70, 0, 0, 1, f(Yes, false, "Ṱ")},
- {0x1e71, 0, 0, 1, f(Yes, false, "ṱ")},
- {0x1e72, 0, 0, 1, f(Yes, false, "Ṳ")},
- {0x1e73, 0, 0, 1, f(Yes, false, "ṳ")},
- {0x1e74, 0, 0, 1, f(Yes, false, "Ṵ")},
- {0x1e75, 0, 0, 1, f(Yes, false, "ṵ")},
- {0x1e76, 0, 0, 1, f(Yes, false, "Ṷ")},
- {0x1e77, 0, 0, 1, f(Yes, false, "ṷ")},
- {0x1e78, 0, 0, 2, f(Yes, false, "Ṹ")},
- {0x1e79, 0, 0, 2, f(Yes, false, "ṹ")},
- {0x1e7a, 0, 0, 2, f(Yes, false, "Ṻ")},
- {0x1e7b, 0, 0, 2, f(Yes, false, "ṻ")},
- {0x1e7c, 0, 0, 1, f(Yes, false, "Ṽ")},
- {0x1e7d, 0, 0, 1, f(Yes, false, "ṽ")},
- {0x1e7e, 0, 0, 1, f(Yes, false, "Ṿ")},
- {0x1e7f, 0, 0, 1, f(Yes, false, "ṿ")},
- {0x1e80, 0, 0, 1, f(Yes, false, "Ẁ")},
- {0x1e81, 0, 0, 1, f(Yes, false, "ẁ")},
- {0x1e82, 0, 0, 1, f(Yes, false, "Ẃ")},
- {0x1e83, 0, 0, 1, f(Yes, false, "ẃ")},
- {0x1e84, 0, 0, 1, f(Yes, false, "Ẅ")},
- {0x1e85, 0, 0, 1, f(Yes, false, "ẅ")},
- {0x1e86, 0, 0, 1, f(Yes, false, "Ẇ")},
- {0x1e87, 0, 0, 1, f(Yes, false, "ẇ")},
- {0x1e88, 0, 0, 1, f(Yes, false, "Ẉ")},
- {0x1e89, 0, 0, 1, f(Yes, false, "ẉ")},
- {0x1e8a, 0, 0, 1, f(Yes, false, "Ẋ")},
- {0x1e8b, 0, 0, 1, f(Yes, false, "ẋ")},
- {0x1e8c, 0, 0, 1, f(Yes, false, "Ẍ")},
- {0x1e8d, 0, 0, 1, f(Yes, false, "ẍ")},
- {0x1e8e, 0, 0, 1, f(Yes, false, "Ẏ")},
- {0x1e8f, 0, 0, 1, f(Yes, false, "ẏ")},
- {0x1e90, 0, 0, 1, f(Yes, false, "Ẑ")},
- {0x1e91, 0, 0, 1, f(Yes, false, "ẑ")},
- {0x1e92, 0, 0, 1, f(Yes, false, "Ẓ")},
- {0x1e93, 0, 0, 1, f(Yes, false, "ẓ")},
- {0x1e94, 0, 0, 1, f(Yes, false, "Ẕ")},
- {0x1e95, 0, 0, 1, f(Yes, false, "ẕ")},
- {0x1e96, 0, 0, 1, f(Yes, false, "ẖ")},
- {0x1e97, 0, 0, 1, f(Yes, false, "ẗ")},
- {0x1e98, 0, 0, 1, f(Yes, false, "ẘ")},
- {0x1e99, 0, 0, 1, f(Yes, false, "ẙ")},
- {0x1e9a, 0, 0, 0, g(Yes, No, false, false, "", "aʾ")},
- {0x1e9b, 0, 0, 1, g(Yes, No, false, false, "ẛ", "ṡ")},
- {0x1e9c, 0, 0, 0, f(Yes, false, "")},
- {0x1ea0, 0, 0, 1, f(Yes, true, "Ạ")},
- {0x1ea1, 0, 0, 1, f(Yes, true, "ạ")},
- {0x1ea2, 0, 0, 1, f(Yes, false, "Ả")},
- {0x1ea3, 0, 0, 1, f(Yes, false, "ả")},
- {0x1ea4, 0, 0, 2, f(Yes, false, "Ấ")},
- {0x1ea5, 0, 0, 2, f(Yes, false, "ấ")},
- {0x1ea6, 0, 0, 2, f(Yes, false, "Ầ")},
- {0x1ea7, 0, 0, 2, f(Yes, false, "ầ")},
- {0x1ea8, 0, 0, 2, f(Yes, false, "Ẩ")},
- {0x1ea9, 0, 0, 2, f(Yes, false, "ẩ")},
- {0x1eaa, 0, 0, 2, f(Yes, false, "Ẫ")},
- {0x1eab, 0, 0, 2, f(Yes, false, "ẫ")},
- {0x1eac, 0, 0, 2, f(Yes, false, "Ậ")},
- {0x1ead, 0, 0, 2, f(Yes, false, "ậ")},
- {0x1eae, 0, 0, 2, f(Yes, false, "Ắ")},
- {0x1eaf, 0, 0, 2, f(Yes, false, "ắ")},
- {0x1eb0, 0, 0, 2, f(Yes, false, "Ằ")},
- {0x1eb1, 0, 0, 2, f(Yes, false, "ằ")},
- {0x1eb2, 0, 0, 2, f(Yes, false, "Ẳ")},
- {0x1eb3, 0, 0, 2, f(Yes, false, "ẳ")},
- {0x1eb4, 0, 0, 2, f(Yes, false, "Ẵ")},
- {0x1eb5, 0, 0, 2, f(Yes, false, "ẵ")},
- {0x1eb6, 0, 0, 2, f(Yes, false, "Ặ")},
- {0x1eb7, 0, 0, 2, f(Yes, false, "ặ")},
- {0x1eb8, 0, 0, 1, f(Yes, true, "Ẹ")},
- {0x1eb9, 0, 0, 1, f(Yes, true, "ẹ")},
- {0x1eba, 0, 0, 1, f(Yes, false, "Ẻ")},
- {0x1ebb, 0, 0, 1, f(Yes, false, "ẻ")},
- {0x1ebc, 0, 0, 1, f(Yes, false, "Ẽ")},
- {0x1ebd, 0, 0, 1, f(Yes, false, "ẽ")},
- {0x1ebe, 0, 0, 2, f(Yes, false, "Ế")},
- {0x1ebf, 0, 0, 2, f(Yes, false, "ế")},
- {0x1ec0, 0, 0, 2, f(Yes, false, "Ề")},
- {0x1ec1, 0, 0, 2, f(Yes, false, "ề")},
- {0x1ec2, 0, 0, 2, f(Yes, false, "Ể")},
- {0x1ec3, 0, 0, 2, f(Yes, false, "ể")},
- {0x1ec4, 0, 0, 2, f(Yes, false, "Ễ")},
- {0x1ec5, 0, 0, 2, f(Yes, false, "ễ")},
- {0x1ec6, 0, 0, 2, f(Yes, false, "Ệ")},
- {0x1ec7, 0, 0, 2, f(Yes, false, "ệ")},
- {0x1ec8, 0, 0, 1, f(Yes, false, "Ỉ")},
- {0x1ec9, 0, 0, 1, f(Yes, false, "ỉ")},
- {0x1eca, 0, 0, 1, f(Yes, false, "Ị")},
- {0x1ecb, 0, 0, 1, f(Yes, false, "ị")},
- {0x1ecc, 0, 0, 1, f(Yes, true, "Ọ")},
- {0x1ecd, 0, 0, 1, f(Yes, true, "ọ")},
- {0x1ece, 0, 0, 1, f(Yes, false, "Ỏ")},
- {0x1ecf, 0, 0, 1, f(Yes, false, "ỏ")},
- {0x1ed0, 0, 0, 2, f(Yes, false, "Ố")},
- {0x1ed1, 0, 0, 2, f(Yes, false, "ố")},
- {0x1ed2, 0, 0, 2, f(Yes, false, "Ồ")},
- {0x1ed3, 0, 0, 2, f(Yes, false, "ồ")},
- {0x1ed4, 0, 0, 2, f(Yes, false, "Ổ")},
- {0x1ed5, 0, 0, 2, f(Yes, false, "ổ")},
- {0x1ed6, 0, 0, 2, f(Yes, false, "Ỗ")},
- {0x1ed7, 0, 0, 2, f(Yes, false, "ỗ")},
- {0x1ed8, 0, 0, 2, f(Yes, false, "Ộ")},
- {0x1ed9, 0, 0, 2, f(Yes, false, "ộ")},
- {0x1eda, 0, 0, 2, f(Yes, false, "Ớ")},
- {0x1edb, 0, 0, 2, f(Yes, false, "ớ")},
- {0x1edc, 0, 0, 2, f(Yes, false, "Ờ")},
- {0x1edd, 0, 0, 2, f(Yes, false, "ờ")},
- {0x1ede, 0, 0, 2, f(Yes, false, "Ở")},
- {0x1edf, 0, 0, 2, f(Yes, false, "ở")},
- {0x1ee0, 0, 0, 2, f(Yes, false, "Ỡ")},
- {0x1ee1, 0, 0, 2, f(Yes, false, "ỡ")},
- {0x1ee2, 0, 0, 2, f(Yes, false, "Ợ")},
- {0x1ee3, 0, 0, 2, f(Yes, false, "ợ")},
- {0x1ee4, 0, 0, 1, f(Yes, false, "Ụ")},
- {0x1ee5, 0, 0, 1, f(Yes, false, "ụ")},
- {0x1ee6, 0, 0, 1, f(Yes, false, "Ủ")},
- {0x1ee7, 0, 0, 1, f(Yes, false, "ủ")},
- {0x1ee8, 0, 0, 2, f(Yes, false, "Ứ")},
- {0x1ee9, 0, 0, 2, f(Yes, false, "ứ")},
- {0x1eea, 0, 0, 2, f(Yes, false, "Ừ")},
- {0x1eeb, 0, 0, 2, f(Yes, false, "ừ")},
- {0x1eec, 0, 0, 2, f(Yes, false, "Ử")},
- {0x1eed, 0, 0, 2, f(Yes, false, "ử")},
- {0x1eee, 0, 0, 2, f(Yes, false, "Ữ")},
- {0x1eef, 0, 0, 2, f(Yes, false, "ữ")},
- {0x1ef0, 0, 0, 2, f(Yes, false, "Ự")},
- {0x1ef1, 0, 0, 2, f(Yes, false, "ự")},
- {0x1ef2, 0, 0, 1, f(Yes, false, "Ỳ")},
- {0x1ef3, 0, 0, 1, f(Yes, false, "ỳ")},
- {0x1ef4, 0, 0, 1, f(Yes, false, "Ỵ")},
- {0x1ef5, 0, 0, 1, f(Yes, false, "ỵ")},
- {0x1ef6, 0, 0, 1, f(Yes, false, "Ỷ")},
- {0x1ef7, 0, 0, 1, f(Yes, false, "ỷ")},
- {0x1ef8, 0, 0, 1, f(Yes, false, "Ỹ")},
- {0x1ef9, 0, 0, 1, f(Yes, false, "ỹ")},
- {0x1efa, 0, 0, 0, f(Yes, false, "")},
- {0x1f00, 0, 0, 1, f(Yes, true, "ἀ")},
- {0x1f01, 0, 0, 1, f(Yes, true, "ἁ")},
- {0x1f02, 0, 0, 2, f(Yes, true, "ἂ")},
- {0x1f03, 0, 0, 2, f(Yes, true, "ἃ")},
- {0x1f04, 0, 0, 2, f(Yes, true, "ἄ")},
- {0x1f05, 0, 0, 2, f(Yes, true, "ἅ")},
- {0x1f06, 0, 0, 2, f(Yes, true, "ἆ")},
- {0x1f07, 0, 0, 2, f(Yes, true, "ἇ")},
- {0x1f08, 0, 0, 1, f(Yes, true, "Ἀ")},
- {0x1f09, 0, 0, 1, f(Yes, true, "Ἁ")},
- {0x1f0a, 0, 0, 2, f(Yes, true, "Ἂ")},
- {0x1f0b, 0, 0, 2, f(Yes, true, "Ἃ")},
- {0x1f0c, 0, 0, 2, f(Yes, true, "Ἄ")},
- {0x1f0d, 0, 0, 2, f(Yes, true, "Ἅ")},
- {0x1f0e, 0, 0, 2, f(Yes, true, "Ἆ")},
- {0x1f0f, 0, 0, 2, f(Yes, true, "Ἇ")},
- {0x1f10, 0, 0, 1, f(Yes, true, "ἐ")},
- {0x1f11, 0, 0, 1, f(Yes, true, "ἑ")},
- {0x1f12, 0, 0, 2, f(Yes, false, "ἒ")},
- {0x1f13, 0, 0, 2, f(Yes, false, "ἓ")},
- {0x1f14, 0, 0, 2, f(Yes, false, "ἔ")},
- {0x1f15, 0, 0, 2, f(Yes, false, "ἕ")},
- {0x1f16, 0, 0, 0, f(Yes, false, "")},
- {0x1f18, 0, 0, 1, f(Yes, true, "Ἐ")},
- {0x1f19, 0, 0, 1, f(Yes, true, "Ἑ")},
- {0x1f1a, 0, 0, 2, f(Yes, false, "Ἒ")},
- {0x1f1b, 0, 0, 2, f(Yes, false, "Ἓ")},
- {0x1f1c, 0, 0, 2, f(Yes, false, "Ἔ")},
- {0x1f1d, 0, 0, 2, f(Yes, false, "Ἕ")},
- {0x1f1e, 0, 0, 0, f(Yes, false, "")},
- {0x1f20, 0, 0, 1, f(Yes, true, "ἠ")},
- {0x1f21, 0, 0, 1, f(Yes, true, "ἡ")},
- {0x1f22, 0, 0, 2, f(Yes, true, "ἢ")},
- {0x1f23, 0, 0, 2, f(Yes, true, "ἣ")},
- {0x1f24, 0, 0, 2, f(Yes, true, "ἤ")},
- {0x1f25, 0, 0, 2, f(Yes, true, "ἥ")},
- {0x1f26, 0, 0, 2, f(Yes, true, "ἦ")},
- {0x1f27, 0, 0, 2, f(Yes, true, "ἧ")},
- {0x1f28, 0, 0, 1, f(Yes, true, "Ἠ")},
- {0x1f29, 0, 0, 1, f(Yes, true, "Ἡ")},
- {0x1f2a, 0, 0, 2, f(Yes, true, "Ἢ")},
- {0x1f2b, 0, 0, 2, f(Yes, true, "Ἣ")},
- {0x1f2c, 0, 0, 2, f(Yes, true, "Ἤ")},
- {0x1f2d, 0, 0, 2, f(Yes, true, "Ἥ")},
- {0x1f2e, 0, 0, 2, f(Yes, true, "Ἦ")},
- {0x1f2f, 0, 0, 2, f(Yes, true, "Ἧ")},
- {0x1f30, 0, 0, 1, f(Yes, true, "ἰ")},
- {0x1f31, 0, 0, 1, f(Yes, true, "ἱ")},
- {0x1f32, 0, 0, 2, f(Yes, false, "ἲ")},
- {0x1f33, 0, 0, 2, f(Yes, false, "ἳ")},
- {0x1f34, 0, 0, 2, f(Yes, false, "ἴ")},
- {0x1f35, 0, 0, 2, f(Yes, false, "ἵ")},
- {0x1f36, 0, 0, 2, f(Yes, false, "ἶ")},
- {0x1f37, 0, 0, 2, f(Yes, false, "ἷ")},
- {0x1f38, 0, 0, 1, f(Yes, true, "Ἰ")},
- {0x1f39, 0, 0, 1, f(Yes, true, "Ἱ")},
- {0x1f3a, 0, 0, 2, f(Yes, false, "Ἲ")},
- {0x1f3b, 0, 0, 2, f(Yes, false, "Ἳ")},
- {0x1f3c, 0, 0, 2, f(Yes, false, "Ἴ")},
- {0x1f3d, 0, 0, 2, f(Yes, false, "Ἵ")},
- {0x1f3e, 0, 0, 2, f(Yes, false, "Ἶ")},
- {0x1f3f, 0, 0, 2, f(Yes, false, "Ἷ")},
- {0x1f40, 0, 0, 1, f(Yes, true, "ὀ")},
- {0x1f41, 0, 0, 1, f(Yes, true, "ὁ")},
- {0x1f42, 0, 0, 2, f(Yes, false, "ὂ")},
- {0x1f43, 0, 0, 2, f(Yes, false, "ὃ")},
- {0x1f44, 0, 0, 2, f(Yes, false, "ὄ")},
- {0x1f45, 0, 0, 2, f(Yes, false, "ὅ")},
- {0x1f46, 0, 0, 0, f(Yes, false, "")},
- {0x1f48, 0, 0, 1, f(Yes, true, "Ὀ")},
- {0x1f49, 0, 0, 1, f(Yes, true, "Ὁ")},
- {0x1f4a, 0, 0, 2, f(Yes, false, "Ὂ")},
- {0x1f4b, 0, 0, 2, f(Yes, false, "Ὃ")},
- {0x1f4c, 0, 0, 2, f(Yes, false, "Ὄ")},
- {0x1f4d, 0, 0, 2, f(Yes, false, "Ὅ")},
- {0x1f4e, 0, 0, 0, f(Yes, false, "")},
- {0x1f50, 0, 0, 1, f(Yes, true, "ὐ")},
- {0x1f51, 0, 0, 1, f(Yes, true, "ὑ")},
- {0x1f52, 0, 0, 2, f(Yes, false, "ὒ")},
- {0x1f53, 0, 0, 2, f(Yes, false, "ὓ")},
- {0x1f54, 0, 0, 2, f(Yes, false, "ὔ")},
- {0x1f55, 0, 0, 2, f(Yes, false, "ὕ")},
- {0x1f56, 0, 0, 2, f(Yes, false, "ὖ")},
- {0x1f57, 0, 0, 2, f(Yes, false, "ὗ")},
- {0x1f58, 0, 0, 0, f(Yes, false, "")},
- {0x1f59, 0, 0, 1, f(Yes, true, "Ὑ")},
- {0x1f5a, 0, 0, 0, f(Yes, false, "")},
- {0x1f5b, 0, 0, 2, f(Yes, false, "Ὓ")},
- {0x1f5c, 0, 0, 0, f(Yes, false, "")},
- {0x1f5d, 0, 0, 2, f(Yes, false, "Ὕ")},
- {0x1f5e, 0, 0, 0, f(Yes, false, "")},
- {0x1f5f, 0, 0, 2, f(Yes, false, "Ὗ")},
- {0x1f60, 0, 0, 1, f(Yes, true, "ὠ")},
- {0x1f61, 0, 0, 1, f(Yes, true, "ὡ")},
- {0x1f62, 0, 0, 2, f(Yes, true, "ὢ")},
- {0x1f63, 0, 0, 2, f(Yes, true, "ὣ")},
- {0x1f64, 0, 0, 2, f(Yes, true, "ὤ")},
- {0x1f65, 0, 0, 2, f(Yes, true, "ὥ")},
- {0x1f66, 0, 0, 2, f(Yes, true, "ὦ")},
- {0x1f67, 0, 0, 2, f(Yes, true, "ὧ")},
- {0x1f68, 0, 0, 1, f(Yes, true, "Ὠ")},
- {0x1f69, 0, 0, 1, f(Yes, true, "Ὡ")},
- {0x1f6a, 0, 0, 2, f(Yes, true, "Ὢ")},
- {0x1f6b, 0, 0, 2, f(Yes, true, "Ὣ")},
- {0x1f6c, 0, 0, 2, f(Yes, true, "Ὤ")},
- {0x1f6d, 0, 0, 2, f(Yes, true, "Ὥ")},
- {0x1f6e, 0, 0, 2, f(Yes, true, "Ὦ")},
- {0x1f6f, 0, 0, 2, f(Yes, true, "Ὧ")},
- {0x1f70, 0, 0, 1, f(Yes, true, "ὰ")},
- {0x1f71, 0, 0, 1, f(No, false, "ά")},
- {0x1f72, 0, 0, 1, f(Yes, false, "ὲ")},
- {0x1f73, 0, 0, 1, f(No, false, "έ")},
- {0x1f74, 0, 0, 1, f(Yes, true, "ὴ")},
- {0x1f75, 0, 0, 1, f(No, false, "ή")},
- {0x1f76, 0, 0, 1, f(Yes, false, "ὶ")},
- {0x1f77, 0, 0, 1, f(No, false, "ί")},
- {0x1f78, 0, 0, 1, f(Yes, false, "ὸ")},
- {0x1f79, 0, 0, 1, f(No, false, "ό")},
- {0x1f7a, 0, 0, 1, f(Yes, false, "ὺ")},
- {0x1f7b, 0, 0, 1, f(No, false, "ύ")},
- {0x1f7c, 0, 0, 1, f(Yes, true, "ὼ")},
- {0x1f7d, 0, 0, 1, f(No, false, "ώ")},
- {0x1f7e, 0, 0, 0, f(Yes, false, "")},
- {0x1f80, 0, 0, 2, f(Yes, false, "ᾀ")},
- {0x1f81, 0, 0, 2, f(Yes, false, "ᾁ")},
- {0x1f82, 0, 0, 3, f(Yes, false, "ᾂ")},
- {0x1f83, 0, 0, 3, f(Yes, false, "ᾃ")},
- {0x1f84, 0, 0, 3, f(Yes, false, "ᾄ")},
- {0x1f85, 0, 0, 3, f(Yes, false, "ᾅ")},
- {0x1f86, 0, 0, 3, f(Yes, false, "ᾆ")},
- {0x1f87, 0, 0, 3, f(Yes, false, "ᾇ")},
- {0x1f88, 0, 0, 2, f(Yes, false, "ᾈ")},
- {0x1f89, 0, 0, 2, f(Yes, false, "ᾉ")},
- {0x1f8a, 0, 0, 3, f(Yes, false, "ᾊ")},
- {0x1f8b, 0, 0, 3, f(Yes, false, "ᾋ")},
- {0x1f8c, 0, 0, 3, f(Yes, false, "ᾌ")},
- {0x1f8d, 0, 0, 3, f(Yes, false, "ᾍ")},
- {0x1f8e, 0, 0, 3, f(Yes, false, "ᾎ")},
- {0x1f8f, 0, 0, 3, f(Yes, false, "ᾏ")},
- {0x1f90, 0, 0, 2, f(Yes, false, "ᾐ")},
- {0x1f91, 0, 0, 2, f(Yes, false, "ᾑ")},
- {0x1f92, 0, 0, 3, f(Yes, false, "ᾒ")},
- {0x1f93, 0, 0, 3, f(Yes, false, "ᾓ")},
- {0x1f94, 0, 0, 3, f(Yes, false, "ᾔ")},
- {0x1f95, 0, 0, 3, f(Yes, false, "ᾕ")},
- {0x1f96, 0, 0, 3, f(Yes, false, "ᾖ")},
- {0x1f97, 0, 0, 3, f(Yes, false, "ᾗ")},
- {0x1f98, 0, 0, 2, f(Yes, false, "ᾘ")},
- {0x1f99, 0, 0, 2, f(Yes, false, "ᾙ")},
- {0x1f9a, 0, 0, 3, f(Yes, false, "ᾚ")},
- {0x1f9b, 0, 0, 3, f(Yes, false, "ᾛ")},
- {0x1f9c, 0, 0, 3, f(Yes, false, "ᾜ")},
- {0x1f9d, 0, 0, 3, f(Yes, false, "ᾝ")},
- {0x1f9e, 0, 0, 3, f(Yes, false, "ᾞ")},
- {0x1f9f, 0, 0, 3, f(Yes, false, "ᾟ")},
- {0x1fa0, 0, 0, 2, f(Yes, false, "ᾠ")},
- {0x1fa1, 0, 0, 2, f(Yes, false, "ᾡ")},
- {0x1fa2, 0, 0, 3, f(Yes, false, "ᾢ")},
- {0x1fa3, 0, 0, 3, f(Yes, false, "ᾣ")},
- {0x1fa4, 0, 0, 3, f(Yes, false, "ᾤ")},
- {0x1fa5, 0, 0, 3, f(Yes, false, "ᾥ")},
- {0x1fa6, 0, 0, 3, f(Yes, false, "ᾦ")},
- {0x1fa7, 0, 0, 3, f(Yes, false, "ᾧ")},
- {0x1fa8, 0, 0, 2, f(Yes, false, "ᾨ")},
- {0x1fa9, 0, 0, 2, f(Yes, false, "ᾩ")},
- {0x1faa, 0, 0, 3, f(Yes, false, "ᾪ")},
- {0x1fab, 0, 0, 3, f(Yes, false, "ᾫ")},
- {0x1fac, 0, 0, 3, f(Yes, false, "ᾬ")},
- {0x1fad, 0, 0, 3, f(Yes, false, "ᾭ")},
- {0x1fae, 0, 0, 3, f(Yes, false, "ᾮ")},
- {0x1faf, 0, 0, 3, f(Yes, false, "ᾯ")},
- {0x1fb0, 0, 0, 1, f(Yes, false, "ᾰ")},
- {0x1fb1, 0, 0, 1, f(Yes, false, "ᾱ")},
- {0x1fb2, 0, 0, 2, f(Yes, false, "ᾲ")},
- {0x1fb3, 0, 0, 1, f(Yes, false, "ᾳ")},
- {0x1fb4, 0, 0, 2, f(Yes, false, "ᾴ")},
- {0x1fb5, 0, 0, 0, f(Yes, false, "")},
- {0x1fb6, 0, 0, 1, f(Yes, true, "ᾶ")},
- {0x1fb7, 0, 0, 2, f(Yes, false, "ᾷ")},
- {0x1fb8, 0, 0, 1, f(Yes, false, "Ᾰ")},
- {0x1fb9, 0, 0, 1, f(Yes, false, "Ᾱ")},
- {0x1fba, 0, 0, 1, f(Yes, false, "Ὰ")},
- {0x1fbb, 0, 0, 1, f(No, false, "Ά")},
- {0x1fbc, 0, 0, 1, f(Yes, false, "ᾼ")},
- {0x1fbd, 0, 0, 1, g(Yes, No, false, false, "", " ̓")},
- {0x1fbe, 0, 0, 0, f(No, false, "ι")},
- {0x1fbf, 0, 0, 1, g(Yes, No, true, false, "", " ̓")},
- {0x1fc0, 0, 0, 1, g(Yes, No, false, false, "", " ͂")},
- {0x1fc1, 0, 0, 2, g(Yes, No, false, false, "῁", " ̈͂")},
- {0x1fc2, 0, 0, 2, f(Yes, false, "ῂ")},
- {0x1fc3, 0, 0, 1, f(Yes, false, "ῃ")},
- {0x1fc4, 0, 0, 2, f(Yes, false, "ῄ")},
- {0x1fc5, 0, 0, 0, f(Yes, false, "")},
- {0x1fc6, 0, 0, 1, f(Yes, true, "ῆ")},
- {0x1fc7, 0, 0, 2, f(Yes, false, "ῇ")},
- {0x1fc8, 0, 0, 1, f(Yes, false, "Ὲ")},
- {0x1fc9, 0, 0, 1, f(No, false, "Έ")},
- {0x1fca, 0, 0, 1, f(Yes, false, "Ὴ")},
- {0x1fcb, 0, 0, 1, f(No, false, "Ή")},
- {0x1fcc, 0, 0, 1, f(Yes, false, "ῌ")},
- {0x1fcd, 0, 0, 2, g(Yes, No, false, false, "῍", " ̓̀")},
- {0x1fce, 0, 0, 2, g(Yes, No, false, false, "῎", " ̓́")},
- {0x1fcf, 0, 0, 2, g(Yes, No, false, false, "῏", " ̓͂")},
- {0x1fd0, 0, 0, 1, f(Yes, false, "ῐ")},
- {0x1fd1, 0, 0, 1, f(Yes, false, "ῑ")},
- {0x1fd2, 0, 0, 2, f(Yes, false, "ῒ")},
- {0x1fd3, 0, 0, 2, f(No, false, "ΐ")},
- {0x1fd4, 0, 0, 0, f(Yes, false, "")},
- {0x1fd6, 0, 0, 1, f(Yes, false, "ῖ")},
- {0x1fd7, 0, 0, 2, f(Yes, false, "ῗ")},
- {0x1fd8, 0, 0, 1, f(Yes, false, "Ῐ")},
- {0x1fd9, 0, 0, 1, f(Yes, false, "Ῑ")},
- {0x1fda, 0, 0, 1, f(Yes, false, "Ὶ")},
- {0x1fdb, 0, 0, 1, f(No, false, "Ί")},
- {0x1fdc, 0, 0, 0, f(Yes, false, "")},
- {0x1fdd, 0, 0, 2, g(Yes, No, false, false, "῝", " ̔̀")},
- {0x1fde, 0, 0, 2, g(Yes, No, false, false, "῞", " ̔́")},
- {0x1fdf, 0, 0, 2, g(Yes, No, false, false, "῟", " ̔͂")},
- {0x1fe0, 0, 0, 1, f(Yes, false, "ῠ")},
- {0x1fe1, 0, 0, 1, f(Yes, false, "ῡ")},
- {0x1fe2, 0, 0, 2, f(Yes, false, "ῢ")},
- {0x1fe3, 0, 0, 2, f(No, false, "ΰ")},
- {0x1fe4, 0, 0, 1, f(Yes, false, "ῤ")},
- {0x1fe5, 0, 0, 1, f(Yes, false, "ῥ")},
- {0x1fe6, 0, 0, 1, f(Yes, false, "ῦ")},
- {0x1fe7, 0, 0, 2, f(Yes, false, "ῧ")},
- {0x1fe8, 0, 0, 1, f(Yes, false, "Ῠ")},
- {0x1fe9, 0, 0, 1, f(Yes, false, "Ῡ")},
- {0x1fea, 0, 0, 1, f(Yes, false, "Ὺ")},
- {0x1feb, 0, 0, 1, f(No, false, "Ύ")},
- {0x1fec, 0, 0, 1, f(Yes, false, "Ῥ")},
- {0x1fed, 0, 0, 2, g(Yes, No, false, false, "῭", " ̈̀")},
- {0x1fee, 0, 0, 2, g(No, No, false, false, "΅", " ̈́")},
- {0x1fef, 0, 0, 0, f(No, false, "`")},
- {0x1ff0, 0, 0, 0, f(Yes, false, "")},
- {0x1ff2, 0, 0, 2, f(Yes, false, "ῲ")},
- {0x1ff3, 0, 0, 1, f(Yes, false, "ῳ")},
- {0x1ff4, 0, 0, 2, f(Yes, false, "ῴ")},
- {0x1ff5, 0, 0, 0, f(Yes, false, "")},
- {0x1ff6, 0, 0, 1, f(Yes, true, "ῶ")},
- {0x1ff7, 0, 0, 2, f(Yes, false, "ῷ")},
- {0x1ff8, 0, 0, 1, f(Yes, false, "Ὸ")},
- {0x1ff9, 0, 0, 1, f(No, false, "Ό")},
- {0x1ffa, 0, 0, 1, f(Yes, false, "Ὼ")},
- {0x1ffb, 0, 0, 1, f(No, false, "Ώ")},
- {0x1ffc, 0, 0, 1, f(Yes, false, "ῼ")},
- {0x1ffd, 0, 0, 1, g(No, No, false, false, "´", " ́")},
- {0x1ffe, 0, 0, 1, g(Yes, No, true, false, "", " ̔")},
- {0x1fff, 0, 0, 0, f(Yes, false, "")},
- {0x2000, 0, 0, 0, g(No, No, false, false, "\u2002", " ")},
- {0x2001, 0, 0, 0, g(No, No, false, false, "\u2003", " ")},
- {0x2002, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x200b, 0, 0, 0, f(Yes, false, "")},
- {0x2011, 0, 0, 0, g(Yes, No, false, false, "", "‐")},
- {0x2012, 0, 0, 0, f(Yes, false, "")},
- {0x2017, 0, 0, 1, g(Yes, No, false, false, "", " ̳")},
- {0x2018, 0, 0, 0, f(Yes, false, "")},
- {0x2024, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0x2025, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0x2026, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0x2027, 0, 0, 0, f(Yes, false, "")},
- {0x202f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2030, 0, 0, 0, f(Yes, false, "")},
- {0x2033, 0, 0, 0, g(Yes, No, false, false, "", "′′")},
- {0x2034, 0, 0, 0, g(Yes, No, false, false, "", "′′′")},
- {0x2035, 0, 0, 0, f(Yes, false, "")},
- {0x2036, 0, 0, 0, g(Yes, No, false, false, "", "‵‵")},
- {0x2037, 0, 0, 0, g(Yes, No, false, false, "", "‵‵‵")},
- {0x2038, 0, 0, 0, f(Yes, false, "")},
- {0x203c, 0, 0, 0, g(Yes, No, false, false, "", "!!")},
- {0x203d, 0, 0, 0, f(Yes, false, "")},
- {0x203e, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0x203f, 0, 0, 0, f(Yes, false, "")},
- {0x2047, 0, 0, 0, g(Yes, No, false, false, "", "??")},
- {0x2048, 0, 0, 0, g(Yes, No, false, false, "", "?!")},
- {0x2049, 0, 0, 0, g(Yes, No, false, false, "", "!?")},
- {0x204a, 0, 0, 0, f(Yes, false, "")},
- {0x2057, 0, 0, 0, g(Yes, No, false, false, "", "′′′′")},
- {0x2058, 0, 0, 0, f(Yes, false, "")},
- {0x205f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2060, 0, 0, 0, f(Yes, false, "")},
- {0x2070, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2071, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2072, 0, 0, 0, f(Yes, false, "")},
- {0x2074, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2075, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2076, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2077, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2078, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2079, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x207a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x207b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x207c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x207d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x207e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x207f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x2080, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2081, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2082, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2083, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2084, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2085, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2086, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2087, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2088, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2089, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x208a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x208b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x208c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x208d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x208e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x208f, 0, 0, 0, f(Yes, false, "")},
- {0x2090, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x2091, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2092, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2093, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2094, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x2095, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2096, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x2097, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2098, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2099, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x209a, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x209b, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x209c, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x209d, 0, 0, 0, f(Yes, false, "")},
- {0x20a8, 0, 0, 0, g(Yes, No, false, false, "", "Rs")},
- {0x20a9, 0, 0, 0, f(Yes, false, "")},
- {0x20d0, 230, 1, 1, f(Yes, false, "")},
- {0x20d2, 1, 1, 1, f(Yes, false, "")},
- {0x20d4, 230, 1, 1, f(Yes, false, "")},
- {0x20d8, 1, 1, 1, f(Yes, false, "")},
- {0x20db, 230, 1, 1, f(Yes, false, "")},
- {0x20dd, 0, 0, 0, f(Yes, false, "")},
- {0x20e1, 230, 1, 1, f(Yes, false, "")},
- {0x20e2, 0, 0, 0, f(Yes, false, "")},
- {0x20e5, 1, 1, 1, f(Yes, false, "")},
- {0x20e7, 230, 1, 1, f(Yes, false, "")},
- {0x20e8, 220, 1, 1, f(Yes, false, "")},
- {0x20e9, 230, 1, 1, f(Yes, false, "")},
- {0x20ea, 1, 1, 1, f(Yes, false, "")},
- {0x20ec, 220, 1, 1, f(Yes, false, "")},
- {0x20f0, 230, 1, 1, f(Yes, false, "")},
- {0x20f1, 0, 0, 0, f(Yes, false, "")},
- {0x2100, 0, 0, 0, g(Yes, No, false, false, "", "a/c")},
- {0x2101, 0, 0, 0, g(Yes, No, false, false, "", "a/s")},
- {0x2102, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x2103, 0, 0, 0, g(Yes, No, false, false, "", "°C")},
- {0x2104, 0, 0, 0, f(Yes, false, "")},
- {0x2105, 0, 0, 0, g(Yes, No, false, false, "", "c/o")},
- {0x2106, 0, 0, 0, g(Yes, No, false, false, "", "c/u")},
- {0x2107, 0, 0, 0, g(Yes, No, false, false, "", "Ɛ")},
- {0x2108, 0, 0, 0, f(Yes, false, "")},
- {0x2109, 0, 0, 0, g(Yes, No, false, false, "", "°F")},
- {0x210a, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x210b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x210e, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x210f, 0, 0, 0, g(Yes, No, false, false, "", "ħ")},
- {0x2110, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2112, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x2113, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2114, 0, 0, 0, f(Yes, false, "")},
- {0x2115, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x2116, 0, 0, 0, g(Yes, No, false, false, "", "No")},
- {0x2117, 0, 0, 0, f(Yes, false, "")},
- {0x2119, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x211a, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x211b, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x211e, 0, 0, 0, f(Yes, false, "")},
- {0x2120, 0, 0, 0, g(Yes, No, false, false, "", "SM")},
- {0x2121, 0, 0, 0, g(Yes, No, false, false, "", "TEL")},
- {0x2122, 0, 0, 0, g(Yes, No, false, false, "", "TM")},
- {0x2123, 0, 0, 0, f(Yes, false, "")},
- {0x2124, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2125, 0, 0, 0, f(Yes, false, "")},
- {0x2126, 0, 0, 0, f(No, false, "Ω")},
- {0x2127, 0, 0, 0, f(Yes, false, "")},
- {0x2128, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2129, 0, 0, 0, f(Yes, false, "")},
- {0x212a, 0, 0, 0, f(No, false, "K")},
- {0x212b, 0, 0, 1, f(No, false, "Å")},
- {0x212c, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x212d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x212e, 0, 0, 0, f(Yes, false, "")},
- {0x212f, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2130, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x2131, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x2132, 0, 0, 0, f(Yes, false, "")},
- {0x2133, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2134, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2135, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0x2136, 0, 0, 0, g(Yes, No, false, false, "", "ב")},
- {0x2137, 0, 0, 0, g(Yes, No, false, false, "", "ג")},
- {0x2138, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0x2139, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x213a, 0, 0, 0, f(Yes, false, "")},
- {0x213b, 0, 0, 0, g(Yes, No, false, false, "", "FAX")},
- {0x213c, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x213d, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x213e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x213f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x2140, 0, 0, 0, g(Yes, No, false, false, "", "∑")},
- {0x2141, 0, 0, 0, f(Yes, false, "")},
- {0x2145, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x2146, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x2147, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2148, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2149, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x214a, 0, 0, 0, f(Yes, false, "")},
- {0x2150, 0, 0, 0, g(Yes, No, false, false, "", "1⁄7")},
- {0x2151, 0, 0, 0, g(Yes, No, false, false, "", "1⁄9")},
- {0x2152, 0, 0, 0, g(Yes, No, false, false, "", "1⁄10")},
- {0x2153, 0, 0, 0, g(Yes, No, false, false, "", "1⁄3")},
- {0x2154, 0, 0, 0, g(Yes, No, false, false, "", "2⁄3")},
- {0x2155, 0, 0, 0, g(Yes, No, false, false, "", "1⁄5")},
- {0x2156, 0, 0, 0, g(Yes, No, false, false, "", "2⁄5")},
- {0x2157, 0, 0, 0, g(Yes, No, false, false, "", "3⁄5")},
- {0x2158, 0, 0, 0, g(Yes, No, false, false, "", "4⁄5")},
- {0x2159, 0, 0, 0, g(Yes, No, false, false, "", "1⁄6")},
- {0x215a, 0, 0, 0, g(Yes, No, false, false, "", "5⁄6")},
- {0x215b, 0, 0, 0, g(Yes, No, false, false, "", "1⁄8")},
- {0x215c, 0, 0, 0, g(Yes, No, false, false, "", "3⁄8")},
- {0x215d, 0, 0, 0, g(Yes, No, false, false, "", "5⁄8")},
- {0x215e, 0, 0, 0, g(Yes, No, false, false, "", "7⁄8")},
- {0x215f, 0, 0, 0, g(Yes, No, false, false, "", "1⁄")},
- {0x2160, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2161, 0, 0, 0, g(Yes, No, false, false, "", "II")},
- {0x2162, 0, 0, 0, g(Yes, No, false, false, "", "III")},
- {0x2163, 0, 0, 0, g(Yes, No, false, false, "", "IV")},
- {0x2164, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2165, 0, 0, 0, g(Yes, No, false, false, "", "VI")},
- {0x2166, 0, 0, 0, g(Yes, No, false, false, "", "VII")},
- {0x2167, 0, 0, 0, g(Yes, No, false, false, "", "VIII")},
- {0x2168, 0, 0, 0, g(Yes, No, false, false, "", "IX")},
- {0x2169, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x216a, 0, 0, 0, g(Yes, No, false, false, "", "XI")},
- {0x216b, 0, 0, 0, g(Yes, No, false, false, "", "XII")},
- {0x216c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x216d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x216e, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x216f, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2170, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2171, 0, 0, 0, g(Yes, No, false, false, "", "ii")},
- {0x2172, 0, 0, 0, g(Yes, No, false, false, "", "iii")},
- {0x2173, 0, 0, 0, g(Yes, No, false, false, "", "iv")},
- {0x2174, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x2175, 0, 0, 0, g(Yes, No, false, false, "", "vi")},
- {0x2176, 0, 0, 0, g(Yes, No, false, false, "", "vii")},
- {0x2177, 0, 0, 0, g(Yes, No, false, false, "", "viii")},
- {0x2178, 0, 0, 0, g(Yes, No, false, false, "", "ix")},
- {0x2179, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x217a, 0, 0, 0, g(Yes, No, false, false, "", "xi")},
- {0x217b, 0, 0, 0, g(Yes, No, false, false, "", "xii")},
- {0x217c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x217d, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x217e, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x217f, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2180, 0, 0, 0, f(Yes, false, "")},
- {0x2189, 0, 0, 0, g(Yes, No, false, false, "", "0⁄3")},
- {0x218a, 0, 0, 0, f(Yes, false, "")},
- {0x2190, 0, 0, 0, f(Yes, true, "")},
- {0x2191, 0, 0, 0, f(Yes, false, "")},
- {0x2192, 0, 0, 0, f(Yes, true, "")},
- {0x2193, 0, 0, 0, f(Yes, false, "")},
- {0x2194, 0, 0, 0, f(Yes, true, "")},
- {0x2195, 0, 0, 0, f(Yes, false, "")},
- {0x219a, 0, 0, 1, f(Yes, false, "↚")},
- {0x219b, 0, 0, 1, f(Yes, false, "↛")},
- {0x219c, 0, 0, 0, f(Yes, false, "")},
- {0x21ae, 0, 0, 1, f(Yes, false, "↮")},
- {0x21af, 0, 0, 0, f(Yes, false, "")},
- {0x21cd, 0, 0, 1, f(Yes, false, "⇍")},
- {0x21ce, 0, 0, 1, f(Yes, false, "⇎")},
- {0x21cf, 0, 0, 1, f(Yes, false, "⇏")},
- {0x21d0, 0, 0, 0, f(Yes, true, "")},
- {0x21d1, 0, 0, 0, f(Yes, false, "")},
- {0x21d2, 0, 0, 0, f(Yes, true, "")},
- {0x21d3, 0, 0, 0, f(Yes, false, "")},
- {0x21d4, 0, 0, 0, f(Yes, true, "")},
- {0x21d5, 0, 0, 0, f(Yes, false, "")},
- {0x2203, 0, 0, 0, f(Yes, true, "")},
- {0x2204, 0, 0, 1, f(Yes, false, "∄")},
- {0x2205, 0, 0, 0, f(Yes, false, "")},
- {0x2208, 0, 0, 0, f(Yes, true, "")},
- {0x2209, 0, 0, 1, f(Yes, false, "∉")},
- {0x220a, 0, 0, 0, f(Yes, false, "")},
- {0x220b, 0, 0, 0, f(Yes, true, "")},
- {0x220c, 0, 0, 1, f(Yes, false, "∌")},
- {0x220d, 0, 0, 0, f(Yes, false, "")},
- {0x2223, 0, 0, 0, f(Yes, true, "")},
- {0x2224, 0, 0, 1, f(Yes, false, "∤")},
- {0x2225, 0, 0, 0, f(Yes, true, "")},
- {0x2226, 0, 0, 1, f(Yes, false, "∦")},
- {0x2227, 0, 0, 0, f(Yes, false, "")},
- {0x222c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫")},
- {0x222d, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫")},
- {0x222e, 0, 0, 0, f(Yes, false, "")},
- {0x222f, 0, 0, 0, g(Yes, No, false, false, "", "∮∮")},
- {0x2230, 0, 0, 0, g(Yes, No, false, false, "", "∮∮∮")},
- {0x2231, 0, 0, 0, f(Yes, false, "")},
- {0x223c, 0, 0, 0, f(Yes, true, "")},
- {0x223d, 0, 0, 0, f(Yes, false, "")},
- {0x2241, 0, 0, 1, f(Yes, false, "≁")},
- {0x2242, 0, 0, 0, f(Yes, false, "")},
- {0x2243, 0, 0, 0, f(Yes, true, "")},
- {0x2244, 0, 0, 1, f(Yes, false, "≄")},
- {0x2245, 0, 0, 0, f(Yes, true, "")},
- {0x2246, 0, 0, 0, f(Yes, false, "")},
- {0x2247, 0, 0, 1, f(Yes, false, "≇")},
- {0x2248, 0, 0, 0, f(Yes, true, "")},
- {0x2249, 0, 0, 1, f(Yes, false, "≉")},
- {0x224a, 0, 0, 0, f(Yes, false, "")},
- {0x224d, 0, 0, 0, f(Yes, true, "")},
- {0x224e, 0, 0, 0, f(Yes, false, "")},
- {0x2260, 0, 0, 1, f(Yes, false, "≠")},
- {0x2261, 0, 0, 0, f(Yes, true, "")},
- {0x2262, 0, 0, 1, f(Yes, false, "≢")},
- {0x2263, 0, 0, 0, f(Yes, false, "")},
- {0x2264, 0, 0, 0, f(Yes, true, "")},
- {0x2266, 0, 0, 0, f(Yes, false, "")},
- {0x226d, 0, 0, 1, f(Yes, false, "≭")},
- {0x226e, 0, 0, 1, f(Yes, false, "≮")},
- {0x226f, 0, 0, 1, f(Yes, false, "≯")},
- {0x2270, 0, 0, 1, f(Yes, false, "≰")},
- {0x2271, 0, 0, 1, f(Yes, false, "≱")},
- {0x2272, 0, 0, 0, f(Yes, true, "")},
- {0x2274, 0, 0, 1, f(Yes, false, "≴")},
- {0x2275, 0, 0, 1, f(Yes, false, "≵")},
- {0x2276, 0, 0, 0, f(Yes, true, "")},
- {0x2278, 0, 0, 1, f(Yes, false, "≸")},
- {0x2279, 0, 0, 1, f(Yes, false, "≹")},
- {0x227a, 0, 0, 0, f(Yes, true, "")},
- {0x227e, 0, 0, 0, f(Yes, false, "")},
- {0x2280, 0, 0, 1, f(Yes, false, "⊀")},
- {0x2281, 0, 0, 1, f(Yes, false, "⊁")},
- {0x2282, 0, 0, 0, f(Yes, true, "")},
- {0x2284, 0, 0, 1, f(Yes, false, "⊄")},
- {0x2285, 0, 0, 1, f(Yes, false, "⊅")},
- {0x2286, 0, 0, 0, f(Yes, true, "")},
- {0x2288, 0, 0, 1, f(Yes, false, "⊈")},
- {0x2289, 0, 0, 1, f(Yes, false, "⊉")},
- {0x228a, 0, 0, 0, f(Yes, false, "")},
- {0x2291, 0, 0, 0, f(Yes, true, "")},
- {0x2293, 0, 0, 0, f(Yes, false, "")},
- {0x22a2, 0, 0, 0, f(Yes, true, "")},
- {0x22a3, 0, 0, 0, f(Yes, false, "")},
- {0x22a8, 0, 0, 0, f(Yes, true, "")},
- {0x22aa, 0, 0, 0, f(Yes, false, "")},
- {0x22ab, 0, 0, 0, f(Yes, true, "")},
- {0x22ac, 0, 0, 1, f(Yes, false, "⊬")},
- {0x22ad, 0, 0, 1, f(Yes, false, "⊭")},
- {0x22ae, 0, 0, 1, f(Yes, false, "⊮")},
- {0x22af, 0, 0, 1, f(Yes, false, "⊯")},
- {0x22b0, 0, 0, 0, f(Yes, false, "")},
- {0x22b2, 0, 0, 0, f(Yes, true, "")},
- {0x22b6, 0, 0, 0, f(Yes, false, "")},
- {0x22e0, 0, 0, 1, f(Yes, false, "⋠")},
- {0x22e1, 0, 0, 1, f(Yes, false, "⋡")},
- {0x22e2, 0, 0, 1, f(Yes, false, "⋢")},
- {0x22e3, 0, 0, 1, f(Yes, false, "⋣")},
- {0x22e4, 0, 0, 0, f(Yes, false, "")},
- {0x22ea, 0, 0, 1, f(Yes, false, "⋪")},
- {0x22eb, 0, 0, 1, f(Yes, false, "⋫")},
- {0x22ec, 0, 0, 1, f(Yes, false, "⋬")},
- {0x22ed, 0, 0, 1, f(Yes, false, "⋭")},
- {0x22ee, 0, 0, 0, f(Yes, false, "")},
- {0x2329, 0, 0, 0, f(No, false, "〈")},
- {0x232a, 0, 0, 0, f(No, false, "〉")},
- {0x232b, 0, 0, 0, f(Yes, false, "")},
- {0x2460, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2461, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2462, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2463, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2464, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2465, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2466, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2467, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2468, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x2469, 0, 0, 0, g(Yes, No, false, false, "", "10")},
- {0x246a, 0, 0, 0, g(Yes, No, false, false, "", "11")},
- {0x246b, 0, 0, 0, g(Yes, No, false, false, "", "12")},
- {0x246c, 0, 0, 0, g(Yes, No, false, false, "", "13")},
- {0x246d, 0, 0, 0, g(Yes, No, false, false, "", "14")},
- {0x246e, 0, 0, 0, g(Yes, No, false, false, "", "15")},
- {0x246f, 0, 0, 0, g(Yes, No, false, false, "", "16")},
- {0x2470, 0, 0, 0, g(Yes, No, false, false, "", "17")},
- {0x2471, 0, 0, 0, g(Yes, No, false, false, "", "18")},
- {0x2472, 0, 0, 0, g(Yes, No, false, false, "", "19")},
- {0x2473, 0, 0, 0, g(Yes, No, false, false, "", "20")},
- {0x2474, 0, 0, 0, g(Yes, No, false, false, "", "(1)")},
- {0x2475, 0, 0, 0, g(Yes, No, false, false, "", "(2)")},
- {0x2476, 0, 0, 0, g(Yes, No, false, false, "", "(3)")},
- {0x2477, 0, 0, 0, g(Yes, No, false, false, "", "(4)")},
- {0x2478, 0, 0, 0, g(Yes, No, false, false, "", "(5)")},
- {0x2479, 0, 0, 0, g(Yes, No, false, false, "", "(6)")},
- {0x247a, 0, 0, 0, g(Yes, No, false, false, "", "(7)")},
- {0x247b, 0, 0, 0, g(Yes, No, false, false, "", "(8)")},
- {0x247c, 0, 0, 0, g(Yes, No, false, false, "", "(9)")},
- {0x247d, 0, 0, 0, g(Yes, No, false, false, "", "(10)")},
- {0x247e, 0, 0, 0, g(Yes, No, false, false, "", "(11)")},
- {0x247f, 0, 0, 0, g(Yes, No, false, false, "", "(12)")},
- {0x2480, 0, 0, 0, g(Yes, No, false, false, "", "(13)")},
- {0x2481, 0, 0, 0, g(Yes, No, false, false, "", "(14)")},
- {0x2482, 0, 0, 0, g(Yes, No, false, false, "", "(15)")},
- {0x2483, 0, 0, 0, g(Yes, No, false, false, "", "(16)")},
- {0x2484, 0, 0, 0, g(Yes, No, false, false, "", "(17)")},
- {0x2485, 0, 0, 0, g(Yes, No, false, false, "", "(18)")},
- {0x2486, 0, 0, 0, g(Yes, No, false, false, "", "(19)")},
- {0x2487, 0, 0, 0, g(Yes, No, false, false, "", "(20)")},
- {0x2488, 0, 0, 0, g(Yes, No, false, false, "", "1.")},
- {0x2489, 0, 0, 0, g(Yes, No, false, false, "", "2.")},
- {0x248a, 0, 0, 0, g(Yes, No, false, false, "", "3.")},
- {0x248b, 0, 0, 0, g(Yes, No, false, false, "", "4.")},
- {0x248c, 0, 0, 0, g(Yes, No, false, false, "", "5.")},
- {0x248d, 0, 0, 0, g(Yes, No, false, false, "", "6.")},
- {0x248e, 0, 0, 0, g(Yes, No, false, false, "", "7.")},
- {0x248f, 0, 0, 0, g(Yes, No, false, false, "", "8.")},
- {0x2490, 0, 0, 0, g(Yes, No, false, false, "", "9.")},
- {0x2491, 0, 0, 0, g(Yes, No, false, false, "", "10.")},
- {0x2492, 0, 0, 0, g(Yes, No, false, false, "", "11.")},
- {0x2493, 0, 0, 0, g(Yes, No, false, false, "", "12.")},
- {0x2494, 0, 0, 0, g(Yes, No, false, false, "", "13.")},
- {0x2495, 0, 0, 0, g(Yes, No, false, false, "", "14.")},
- {0x2496, 0, 0, 0, g(Yes, No, false, false, "", "15.")},
- {0x2497, 0, 0, 0, g(Yes, No, false, false, "", "16.")},
- {0x2498, 0, 0, 0, g(Yes, No, false, false, "", "17.")},
- {0x2499, 0, 0, 0, g(Yes, No, false, false, "", "18.")},
- {0x249a, 0, 0, 0, g(Yes, No, false, false, "", "19.")},
- {0x249b, 0, 0, 0, g(Yes, No, false, false, "", "20.")},
- {0x249c, 0, 0, 0, g(Yes, No, false, false, "", "(a)")},
- {0x249d, 0, 0, 0, g(Yes, No, false, false, "", "(b)")},
- {0x249e, 0, 0, 0, g(Yes, No, false, false, "", "(c)")},
- {0x249f, 0, 0, 0, g(Yes, No, false, false, "", "(d)")},
- {0x24a0, 0, 0, 0, g(Yes, No, false, false, "", "(e)")},
- {0x24a1, 0, 0, 0, g(Yes, No, false, false, "", "(f)")},
- {0x24a2, 0, 0, 0, g(Yes, No, false, false, "", "(g)")},
- {0x24a3, 0, 0, 0, g(Yes, No, false, false, "", "(h)")},
- {0x24a4, 0, 0, 0, g(Yes, No, false, false, "", "(i)")},
- {0x24a5, 0, 0, 0, g(Yes, No, false, false, "", "(j)")},
- {0x24a6, 0, 0, 0, g(Yes, No, false, false, "", "(k)")},
- {0x24a7, 0, 0, 0, g(Yes, No, false, false, "", "(l)")},
- {0x24a8, 0, 0, 0, g(Yes, No, false, false, "", "(m)")},
- {0x24a9, 0, 0, 0, g(Yes, No, false, false, "", "(n)")},
- {0x24aa, 0, 0, 0, g(Yes, No, false, false, "", "(o)")},
- {0x24ab, 0, 0, 0, g(Yes, No, false, false, "", "(p)")},
- {0x24ac, 0, 0, 0, g(Yes, No, false, false, "", "(q)")},
- {0x24ad, 0, 0, 0, g(Yes, No, false, false, "", "(r)")},
- {0x24ae, 0, 0, 0, g(Yes, No, false, false, "", "(s)")},
- {0x24af, 0, 0, 0, g(Yes, No, false, false, "", "(t)")},
- {0x24b0, 0, 0, 0, g(Yes, No, false, false, "", "(u)")},
- {0x24b1, 0, 0, 0, g(Yes, No, false, false, "", "(v)")},
- {0x24b2, 0, 0, 0, g(Yes, No, false, false, "", "(w)")},
- {0x24b3, 0, 0, 0, g(Yes, No, false, false, "", "(x)")},
- {0x24b4, 0, 0, 0, g(Yes, No, false, false, "", "(y)")},
- {0x24b5, 0, 0, 0, g(Yes, No, false, false, "", "(z)")},
- {0x24b6, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x24b7, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x24b8, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x24b9, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x24ba, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x24bb, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x24bc, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x24bd, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x24be, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x24bf, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x24c0, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x24c1, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x24c2, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x24c3, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x24c4, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x24c5, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x24c6, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x24c7, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x24c8, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x24c9, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x24ca, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x24cb, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x24cc, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x24cd, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x24ce, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x24cf, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x24d0, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x24d1, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x24d2, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x24d3, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x24d4, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x24d5, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x24d6, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x24d7, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x24d8, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x24d9, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x24da, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x24db, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x24dc, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x24dd, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x24de, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x24df, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x24e0, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x24e1, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x24e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x24e3, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x24e4, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x24e5, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x24e6, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x24e7, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x24e8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x24e9, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x24ea, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x24eb, 0, 0, 0, f(Yes, false, "")},
- {0x2a0c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫∫")},
- {0x2a0d, 0, 0, 0, f(Yes, false, "")},
- {0x2a74, 0, 0, 0, g(Yes, No, false, false, "", "::=")},
- {0x2a75, 0, 0, 0, g(Yes, No, false, false, "", "==")},
- {0x2a76, 0, 0, 0, g(Yes, No, false, false, "", "===")},
- {0x2a77, 0, 0, 0, f(Yes, false, "")},
- {0x2adc, 0, 0, 1, f(No, false, "⫝̸")},
- {0x2add, 0, 0, 0, f(Yes, false, "")},
- {0x2c7c, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2c7d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2c7e, 0, 0, 0, f(Yes, false, "")},
- {0x2cef, 230, 1, 1, f(Yes, false, "")},
- {0x2cf2, 0, 0, 0, f(Yes, false, "")},
- {0x2d6f, 0, 0, 0, g(Yes, No, false, false, "", "ⵡ")},
- {0x2d70, 0, 0, 0, f(Yes, false, "")},
- {0x2d7f, 9, 1, 1, f(Yes, false, "")},
- {0x2d80, 0, 0, 0, f(Yes, false, "")},
- {0x2de0, 230, 1, 1, f(Yes, false, "")},
- {0x2e00, 0, 0, 0, f(Yes, false, "")},
- {0x2e9f, 0, 0, 0, g(Yes, No, false, false, "", "母")},
- {0x2ea0, 0, 0, 0, f(Yes, false, "")},
- {0x2ef3, 0, 0, 0, g(Yes, No, false, false, "", "龟")},
- {0x2ef4, 0, 0, 0, f(Yes, false, "")},
- {0x2f00, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x2f01, 0, 0, 0, g(Yes, No, false, false, "", "丨")},
- {0x2f02, 0, 0, 0, g(Yes, No, false, false, "", "丶")},
- {0x2f03, 0, 0, 0, g(Yes, No, false, false, "", "丿")},
- {0x2f04, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x2f05, 0, 0, 0, g(Yes, No, false, false, "", "亅")},
- {0x2f06, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x2f07, 0, 0, 0, g(Yes, No, false, false, "", "亠")},
- {0x2f08, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x2f09, 0, 0, 0, g(Yes, No, false, false, "", "儿")},
- {0x2f0a, 0, 0, 0, g(Yes, No, false, false, "", "入")},
- {0x2f0b, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x2f0c, 0, 0, 0, g(Yes, No, false, false, "", "冂")},
- {0x2f0d, 0, 0, 0, g(Yes, No, false, false, "", "冖")},
- {0x2f0e, 0, 0, 0, g(Yes, No, false, false, "", "冫")},
- {0x2f0f, 0, 0, 0, g(Yes, No, false, false, "", "几")},
- {0x2f10, 0, 0, 0, g(Yes, No, false, false, "", "凵")},
- {0x2f11, 0, 0, 0, g(Yes, No, false, false, "", "刀")},
- {0x2f12, 0, 0, 0, g(Yes, No, false, false, "", "力")},
- {0x2f13, 0, 0, 0, g(Yes, No, false, false, "", "勹")},
- {0x2f14, 0, 0, 0, g(Yes, No, false, false, "", "匕")},
- {0x2f15, 0, 0, 0, g(Yes, No, false, false, "", "匚")},
- {0x2f16, 0, 0, 0, g(Yes, No, false, false, "", "匸")},
- {0x2f17, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x2f18, 0, 0, 0, g(Yes, No, false, false, "", "卜")},
- {0x2f19, 0, 0, 0, g(Yes, No, false, false, "", "卩")},
- {0x2f1a, 0, 0, 0, g(Yes, No, false, false, "", "厂")},
- {0x2f1b, 0, 0, 0, g(Yes, No, false, false, "", "厶")},
- {0x2f1c, 0, 0, 0, g(Yes, No, false, false, "", "又")},
- {0x2f1d, 0, 0, 0, g(Yes, No, false, false, "", "口")},
- {0x2f1e, 0, 0, 0, g(Yes, No, false, false, "", "囗")},
- {0x2f1f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x2f20, 0, 0, 0, g(Yes, No, false, false, "", "士")},
- {0x2f21, 0, 0, 0, g(Yes, No, false, false, "", "夂")},
- {0x2f22, 0, 0, 0, g(Yes, No, false, false, "", "夊")},
- {0x2f23, 0, 0, 0, g(Yes, No, false, false, "", "夕")},
- {0x2f24, 0, 0, 0, g(Yes, No, false, false, "", "大")},
- {0x2f25, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x2f26, 0, 0, 0, g(Yes, No, false, false, "", "子")},
- {0x2f27, 0, 0, 0, g(Yes, No, false, false, "", "宀")},
- {0x2f28, 0, 0, 0, g(Yes, No, false, false, "", "寸")},
- {0x2f29, 0, 0, 0, g(Yes, No, false, false, "", "小")},
- {0x2f2a, 0, 0, 0, g(Yes, No, false, false, "", "尢")},
- {0x2f2b, 0, 0, 0, g(Yes, No, false, false, "", "尸")},
- {0x2f2c, 0, 0, 0, g(Yes, No, false, false, "", "屮")},
- {0x2f2d, 0, 0, 0, g(Yes, No, false, false, "", "山")},
- {0x2f2e, 0, 0, 0, g(Yes, No, false, false, "", "巛")},
- {0x2f2f, 0, 0, 0, g(Yes, No, false, false, "", "工")},
- {0x2f30, 0, 0, 0, g(Yes, No, false, false, "", "己")},
- {0x2f31, 0, 0, 0, g(Yes, No, false, false, "", "巾")},
- {0x2f32, 0, 0, 0, g(Yes, No, false, false, "", "干")},
- {0x2f33, 0, 0, 0, g(Yes, No, false, false, "", "幺")},
- {0x2f34, 0, 0, 0, g(Yes, No, false, false, "", "广")},
- {0x2f35, 0, 0, 0, g(Yes, No, false, false, "", "廴")},
- {0x2f36, 0, 0, 0, g(Yes, No, false, false, "", "廾")},
- {0x2f37, 0, 0, 0, g(Yes, No, false, false, "", "弋")},
- {0x2f38, 0, 0, 0, g(Yes, No, false, false, "", "弓")},
- {0x2f39, 0, 0, 0, g(Yes, No, false, false, "", "彐")},
- {0x2f3a, 0, 0, 0, g(Yes, No, false, false, "", "彡")},
- {0x2f3b, 0, 0, 0, g(Yes, No, false, false, "", "彳")},
- {0x2f3c, 0, 0, 0, g(Yes, No, false, false, "", "心")},
- {0x2f3d, 0, 0, 0, g(Yes, No, false, false, "", "戈")},
- {0x2f3e, 0, 0, 0, g(Yes, No, false, false, "", "戶")},
- {0x2f3f, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x2f40, 0, 0, 0, g(Yes, No, false, false, "", "支")},
- {0x2f41, 0, 0, 0, g(Yes, No, false, false, "", "攴")},
- {0x2f42, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x2f43, 0, 0, 0, g(Yes, No, false, false, "", "斗")},
- {0x2f44, 0, 0, 0, g(Yes, No, false, false, "", "斤")},
- {0x2f45, 0, 0, 0, g(Yes, No, false, false, "", "方")},
- {0x2f46, 0, 0, 0, g(Yes, No, false, false, "", "无")},
- {0x2f47, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x2f48, 0, 0, 0, g(Yes, No, false, false, "", "曰")},
- {0x2f49, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x2f4a, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x2f4b, 0, 0, 0, g(Yes, No, false, false, "", "欠")},
- {0x2f4c, 0, 0, 0, g(Yes, No, false, false, "", "止")},
- {0x2f4d, 0, 0, 0, g(Yes, No, false, false, "", "歹")},
- {0x2f4e, 0, 0, 0, g(Yes, No, false, false, "", "殳")},
- {0x2f4f, 0, 0, 0, g(Yes, No, false, false, "", "毋")},
- {0x2f50, 0, 0, 0, g(Yes, No, false, false, "", "比")},
- {0x2f51, 0, 0, 0, g(Yes, No, false, false, "", "毛")},
- {0x2f52, 0, 0, 0, g(Yes, No, false, false, "", "氏")},
- {0x2f53, 0, 0, 0, g(Yes, No, false, false, "", "气")},
- {0x2f54, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x2f55, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x2f56, 0, 0, 0, g(Yes, No, false, false, "", "爪")},
- {0x2f57, 0, 0, 0, g(Yes, No, false, false, "", "父")},
- {0x2f58, 0, 0, 0, g(Yes, No, false, false, "", "爻")},
- {0x2f59, 0, 0, 0, g(Yes, No, false, false, "", "爿")},
- {0x2f5a, 0, 0, 0, g(Yes, No, false, false, "", "片")},
- {0x2f5b, 0, 0, 0, g(Yes, No, false, false, "", "牙")},
- {0x2f5c, 0, 0, 0, g(Yes, No, false, false, "", "牛")},
- {0x2f5d, 0, 0, 0, g(Yes, No, false, false, "", "犬")},
- {0x2f5e, 0, 0, 0, g(Yes, No, false, false, "", "玄")},
- {0x2f5f, 0, 0, 0, g(Yes, No, false, false, "", "玉")},
- {0x2f60, 0, 0, 0, g(Yes, No, false, false, "", "瓜")},
- {0x2f61, 0, 0, 0, g(Yes, No, false, false, "", "瓦")},
- {0x2f62, 0, 0, 0, g(Yes, No, false, false, "", "甘")},
- {0x2f63, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x2f64, 0, 0, 0, g(Yes, No, false, false, "", "用")},
- {0x2f65, 0, 0, 0, g(Yes, No, false, false, "", "田")},
- {0x2f66, 0, 0, 0, g(Yes, No, false, false, "", "疋")},
- {0x2f67, 0, 0, 0, g(Yes, No, false, false, "", "疒")},
- {0x2f68, 0, 0, 0, g(Yes, No, false, false, "", "癶")},
- {0x2f69, 0, 0, 0, g(Yes, No, false, false, "", "白")},
- {0x2f6a, 0, 0, 0, g(Yes, No, false, false, "", "皮")},
- {0x2f6b, 0, 0, 0, g(Yes, No, false, false, "", "皿")},
- {0x2f6c, 0, 0, 0, g(Yes, No, false, false, "", "目")},
- {0x2f6d, 0, 0, 0, g(Yes, No, false, false, "", "矛")},
- {0x2f6e, 0, 0, 0, g(Yes, No, false, false, "", "矢")},
- {0x2f6f, 0, 0, 0, g(Yes, No, false, false, "", "石")},
- {0x2f70, 0, 0, 0, g(Yes, No, false, false, "", "示")},
- {0x2f71, 0, 0, 0, g(Yes, No, false, false, "", "禸")},
- {0x2f72, 0, 0, 0, g(Yes, No, false, false, "", "禾")},
- {0x2f73, 0, 0, 0, g(Yes, No, false, false, "", "穴")},
- {0x2f74, 0, 0, 0, g(Yes, No, false, false, "", "立")},
- {0x2f75, 0, 0, 0, g(Yes, No, false, false, "", "竹")},
- {0x2f76, 0, 0, 0, g(Yes, No, false, false, "", "米")},
- {0x2f77, 0, 0, 0, g(Yes, No, false, false, "", "糸")},
- {0x2f78, 0, 0, 0, g(Yes, No, false, false, "", "缶")},
- {0x2f79, 0, 0, 0, g(Yes, No, false, false, "", "网")},
- {0x2f7a, 0, 0, 0, g(Yes, No, false, false, "", "羊")},
- {0x2f7b, 0, 0, 0, g(Yes, No, false, false, "", "羽")},
- {0x2f7c, 0, 0, 0, g(Yes, No, false, false, "", "老")},
- {0x2f7d, 0, 0, 0, g(Yes, No, false, false, "", "而")},
- {0x2f7e, 0, 0, 0, g(Yes, No, false, false, "", "耒")},
- {0x2f7f, 0, 0, 0, g(Yes, No, false, false, "", "耳")},
- {0x2f80, 0, 0, 0, g(Yes, No, false, false, "", "聿")},
- {0x2f81, 0, 0, 0, g(Yes, No, false, false, "", "肉")},
- {0x2f82, 0, 0, 0, g(Yes, No, false, false, "", "臣")},
- {0x2f83, 0, 0, 0, g(Yes, No, false, false, "", "自")},
- {0x2f84, 0, 0, 0, g(Yes, No, false, false, "", "至")},
- {0x2f85, 0, 0, 0, g(Yes, No, false, false, "", "臼")},
- {0x2f86, 0, 0, 0, g(Yes, No, false, false, "", "舌")},
- {0x2f87, 0, 0, 0, g(Yes, No, false, false, "", "舛")},
- {0x2f88, 0, 0, 0, g(Yes, No, false, false, "", "舟")},
- {0x2f89, 0, 0, 0, g(Yes, No, false, false, "", "艮")},
- {0x2f8a, 0, 0, 0, g(Yes, No, false, false, "", "色")},
- {0x2f8b, 0, 0, 0, g(Yes, No, false, false, "", "艸")},
- {0x2f8c, 0, 0, 0, g(Yes, No, false, false, "", "虍")},
- {0x2f8d, 0, 0, 0, g(Yes, No, false, false, "", "虫")},
- {0x2f8e, 0, 0, 0, g(Yes, No, false, false, "", "血")},
- {0x2f8f, 0, 0, 0, g(Yes, No, false, false, "", "行")},
- {0x2f90, 0, 0, 0, g(Yes, No, false, false, "", "衣")},
- {0x2f91, 0, 0, 0, g(Yes, No, false, false, "", "襾")},
- {0x2f92, 0, 0, 0, g(Yes, No, false, false, "", "見")},
- {0x2f93, 0, 0, 0, g(Yes, No, false, false, "", "角")},
- {0x2f94, 0, 0, 0, g(Yes, No, false, false, "", "言")},
- {0x2f95, 0, 0, 0, g(Yes, No, false, false, "", "谷")},
- {0x2f96, 0, 0, 0, g(Yes, No, false, false, "", "豆")},
- {0x2f97, 0, 0, 0, g(Yes, No, false, false, "", "豕")},
- {0x2f98, 0, 0, 0, g(Yes, No, false, false, "", "豸")},
- {0x2f99, 0, 0, 0, g(Yes, No, false, false, "", "貝")},
- {0x2f9a, 0, 0, 0, g(Yes, No, false, false, "", "赤")},
- {0x2f9b, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x2f9c, 0, 0, 0, g(Yes, No, false, false, "", "足")},
- {0x2f9d, 0, 0, 0, g(Yes, No, false, false, "", "身")},
- {0x2f9e, 0, 0, 0, g(Yes, No, false, false, "", "車")},
- {0x2f9f, 0, 0, 0, g(Yes, No, false, false, "", "辛")},
- {0x2fa0, 0, 0, 0, g(Yes, No, false, false, "", "辰")},
- {0x2fa1, 0, 0, 0, g(Yes, No, false, false, "", "辵")},
- {0x2fa2, 0, 0, 0, g(Yes, No, false, false, "", "邑")},
- {0x2fa3, 0, 0, 0, g(Yes, No, false, false, "", "酉")},
- {0x2fa4, 0, 0, 0, g(Yes, No, false, false, "", "釆")},
- {0x2fa5, 0, 0, 0, g(Yes, No, false, false, "", "里")},
- {0x2fa6, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x2fa7, 0, 0, 0, g(Yes, No, false, false, "", "長")},
- {0x2fa8, 0, 0, 0, g(Yes, No, false, false, "", "門")},
- {0x2fa9, 0, 0, 0, g(Yes, No, false, false, "", "阜")},
- {0x2faa, 0, 0, 0, g(Yes, No, false, false, "", "隶")},
- {0x2fab, 0, 0, 0, g(Yes, No, false, false, "", "隹")},
- {0x2fac, 0, 0, 0, g(Yes, No, false, false, "", "雨")},
- {0x2fad, 0, 0, 0, g(Yes, No, false, false, "", "靑")},
- {0x2fae, 0, 0, 0, g(Yes, No, false, false, "", "非")},
- {0x2faf, 0, 0, 0, g(Yes, No, false, false, "", "面")},
- {0x2fb0, 0, 0, 0, g(Yes, No, false, false, "", "革")},
- {0x2fb1, 0, 0, 0, g(Yes, No, false, false, "", "韋")},
- {0x2fb2, 0, 0, 0, g(Yes, No, false, false, "", "韭")},
- {0x2fb3, 0, 0, 0, g(Yes, No, false, false, "", "音")},
- {0x2fb4, 0, 0, 0, g(Yes, No, false, false, "", "頁")},
- {0x2fb5, 0, 0, 0, g(Yes, No, false, false, "", "風")},
- {0x2fb6, 0, 0, 0, g(Yes, No, false, false, "", "飛")},
- {0x2fb7, 0, 0, 0, g(Yes, No, false, false, "", "食")},
- {0x2fb8, 0, 0, 0, g(Yes, No, false, false, "", "首")},
- {0x2fb9, 0, 0, 0, g(Yes, No, false, false, "", "香")},
- {0x2fba, 0, 0, 0, g(Yes, No, false, false, "", "馬")},
- {0x2fbb, 0, 0, 0, g(Yes, No, false, false, "", "骨")},
- {0x2fbc, 0, 0, 0, g(Yes, No, false, false, "", "高")},
- {0x2fbd, 0, 0, 0, g(Yes, No, false, false, "", "髟")},
- {0x2fbe, 0, 0, 0, g(Yes, No, false, false, "", "鬥")},
- {0x2fbf, 0, 0, 0, g(Yes, No, false, false, "", "鬯")},
- {0x2fc0, 0, 0, 0, g(Yes, No, false, false, "", "鬲")},
- {0x2fc1, 0, 0, 0, g(Yes, No, false, false, "", "鬼")},
- {0x2fc2, 0, 0, 0, g(Yes, No, false, false, "", "魚")},
- {0x2fc3, 0, 0, 0, g(Yes, No, false, false, "", "鳥")},
- {0x2fc4, 0, 0, 0, g(Yes, No, false, false, "", "鹵")},
- {0x2fc5, 0, 0, 0, g(Yes, No, false, false, "", "鹿")},
- {0x2fc6, 0, 0, 0, g(Yes, No, false, false, "", "麥")},
- {0x2fc7, 0, 0, 0, g(Yes, No, false, false, "", "麻")},
- {0x2fc8, 0, 0, 0, g(Yes, No, false, false, "", "黃")},
- {0x2fc9, 0, 0, 0, g(Yes, No, false, false, "", "黍")},
- {0x2fca, 0, 0, 0, g(Yes, No, false, false, "", "黑")},
- {0x2fcb, 0, 0, 0, g(Yes, No, false, false, "", "黹")},
- {0x2fcc, 0, 0, 0, g(Yes, No, false, false, "", "黽")},
- {0x2fcd, 0, 0, 0, g(Yes, No, false, false, "", "鼎")},
- {0x2fce, 0, 0, 0, g(Yes, No, false, false, "", "鼓")},
- {0x2fcf, 0, 0, 0, g(Yes, No, false, false, "", "鼠")},
- {0x2fd0, 0, 0, 0, g(Yes, No, false, false, "", "鼻")},
- {0x2fd1, 0, 0, 0, g(Yes, No, false, false, "", "齊")},
- {0x2fd2, 0, 0, 0, g(Yes, No, false, false, "", "齒")},
- {0x2fd3, 0, 0, 0, g(Yes, No, false, false, "", "龍")},
- {0x2fd4, 0, 0, 0, g(Yes, No, false, false, "", "龜")},
- {0x2fd5, 0, 0, 0, g(Yes, No, false, false, "", "龠")},
- {0x2fd6, 0, 0, 0, f(Yes, false, "")},
- {0x3000, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x3001, 0, 0, 0, f(Yes, false, "")},
- {0x302a, 218, 1, 1, f(Yes, false, "")},
- {0x302b, 228, 1, 1, f(Yes, false, "")},
- {0x302c, 232, 1, 1, f(Yes, false, "")},
- {0x302d, 222, 1, 1, f(Yes, false, "")},
- {0x302e, 224, 1, 1, f(Yes, false, "")},
- {0x3030, 0, 0, 0, f(Yes, false, "")},
- {0x3036, 0, 0, 0, g(Yes, No, false, false, "", "〒")},
- {0x3037, 0, 0, 0, f(Yes, false, "")},
- {0x3038, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x3039, 0, 0, 0, g(Yes, No, false, false, "", "卄")},
- {0x303a, 0, 0, 0, g(Yes, No, false, false, "", "卅")},
- {0x303b, 0, 0, 0, f(Yes, false, "")},
- {0x3046, 0, 0, 0, f(Yes, true, "")},
- {0x3047, 0, 0, 0, f(Yes, false, "")},
- {0x304b, 0, 0, 0, f(Yes, true, "")},
- {0x304c, 0, 0, 1, f(Yes, false, "が")},
- {0x304d, 0, 0, 0, f(Yes, true, "")},
- {0x304e, 0, 0, 1, f(Yes, false, "ぎ")},
- {0x304f, 0, 0, 0, f(Yes, true, "")},
- {0x3050, 0, 0, 1, f(Yes, false, "ぐ")},
- {0x3051, 0, 0, 0, f(Yes, true, "")},
- {0x3052, 0, 0, 1, f(Yes, false, "げ")},
- {0x3053, 0, 0, 0, f(Yes, true, "")},
- {0x3054, 0, 0, 1, f(Yes, false, "ご")},
- {0x3055, 0, 0, 0, f(Yes, true, "")},
- {0x3056, 0, 0, 1, f(Yes, false, "ざ")},
- {0x3057, 0, 0, 0, f(Yes, true, "")},
- {0x3058, 0, 0, 1, f(Yes, false, "じ")},
- {0x3059, 0, 0, 0, f(Yes, true, "")},
- {0x305a, 0, 0, 1, f(Yes, false, "ず")},
- {0x305b, 0, 0, 0, f(Yes, true, "")},
- {0x305c, 0, 0, 1, f(Yes, false, "ぜ")},
- {0x305d, 0, 0, 0, f(Yes, true, "")},
- {0x305e, 0, 0, 1, f(Yes, false, "ぞ")},
- {0x305f, 0, 0, 0, f(Yes, true, "")},
- {0x3060, 0, 0, 1, f(Yes, false, "だ")},
- {0x3061, 0, 0, 0, f(Yes, true, "")},
- {0x3062, 0, 0, 1, f(Yes, false, "ぢ")},
- {0x3063, 0, 0, 0, f(Yes, false, "")},
- {0x3064, 0, 0, 0, f(Yes, true, "")},
- {0x3065, 0, 0, 1, f(Yes, false, "づ")},
- {0x3066, 0, 0, 0, f(Yes, true, "")},
- {0x3067, 0, 0, 1, f(Yes, false, "で")},
- {0x3068, 0, 0, 0, f(Yes, true, "")},
- {0x3069, 0, 0, 1, f(Yes, false, "ど")},
- {0x306a, 0, 0, 0, f(Yes, false, "")},
- {0x306f, 0, 0, 0, f(Yes, true, "")},
- {0x3070, 0, 0, 1, f(Yes, false, "ば")},
- {0x3071, 0, 0, 1, f(Yes, false, "ぱ")},
- {0x3072, 0, 0, 0, f(Yes, true, "")},
- {0x3073, 0, 0, 1, f(Yes, false, "び")},
- {0x3074, 0, 0, 1, f(Yes, false, "ぴ")},
- {0x3075, 0, 0, 0, f(Yes, true, "")},
- {0x3076, 0, 0, 1, f(Yes, false, "ぶ")},
- {0x3077, 0, 0, 1, f(Yes, false, "ぷ")},
- {0x3078, 0, 0, 0, f(Yes, true, "")},
- {0x3079, 0, 0, 1, f(Yes, false, "べ")},
- {0x307a, 0, 0, 1, f(Yes, false, "ぺ")},
- {0x307b, 0, 0, 0, f(Yes, true, "")},
- {0x307c, 0, 0, 1, f(Yes, false, "ぼ")},
- {0x307d, 0, 0, 1, f(Yes, false, "ぽ")},
- {0x307e, 0, 0, 0, f(Yes, false, "")},
- {0x3094, 0, 0, 1, f(Yes, false, "ゔ")},
- {0x3095, 0, 0, 0, f(Yes, false, "")},
- {0x3099, 8, 1, 1, f(Maybe, false, "")},
- {0x309b, 0, 0, 1, g(Yes, No, false, false, "", " ゙")},
- {0x309c, 0, 0, 1, g(Yes, No, false, false, "", " ゚")},
- {0x309d, 0, 0, 0, f(Yes, true, "")},
- {0x309e, 0, 0, 1, f(Yes, false, "ゞ")},
- {0x309f, 0, 0, 0, g(Yes, No, false, false, "", "より")},
- {0x30a0, 0, 0, 0, f(Yes, false, "")},
- {0x30a6, 0, 0, 0, f(Yes, true, "")},
- {0x30a7, 0, 0, 0, f(Yes, false, "")},
- {0x30ab, 0, 0, 0, f(Yes, true, "")},
- {0x30ac, 0, 0, 1, f(Yes, false, "ガ")},
- {0x30ad, 0, 0, 0, f(Yes, true, "")},
- {0x30ae, 0, 0, 1, f(Yes, false, "ギ")},
- {0x30af, 0, 0, 0, f(Yes, true, "")},
- {0x30b0, 0, 0, 1, f(Yes, false, "グ")},
- {0x30b1, 0, 0, 0, f(Yes, true, "")},
- {0x30b2, 0, 0, 1, f(Yes, false, "ゲ")},
- {0x30b3, 0, 0, 0, f(Yes, true, "")},
- {0x30b4, 0, 0, 1, f(Yes, false, "ゴ")},
- {0x30b5, 0, 0, 0, f(Yes, true, "")},
- {0x30b6, 0, 0, 1, f(Yes, false, "ザ")},
- {0x30b7, 0, 0, 0, f(Yes, true, "")},
- {0x30b8, 0, 0, 1, f(Yes, false, "ジ")},
- {0x30b9, 0, 0, 0, f(Yes, true, "")},
- {0x30ba, 0, 0, 1, f(Yes, false, "ズ")},
- {0x30bb, 0, 0, 0, f(Yes, true, "")},
- {0x30bc, 0, 0, 1, f(Yes, false, "ゼ")},
- {0x30bd, 0, 0, 0, f(Yes, true, "")},
- {0x30be, 0, 0, 1, f(Yes, false, "ゾ")},
- {0x30bf, 0, 0, 0, f(Yes, true, "")},
- {0x30c0, 0, 0, 1, f(Yes, false, "ダ")},
- {0x30c1, 0, 0, 0, f(Yes, true, "")},
- {0x30c2, 0, 0, 1, f(Yes, false, "ヂ")},
- {0x30c3, 0, 0, 0, f(Yes, false, "")},
- {0x30c4, 0, 0, 0, f(Yes, true, "")},
- {0x30c5, 0, 0, 1, f(Yes, false, "ヅ")},
- {0x30c6, 0, 0, 0, f(Yes, true, "")},
- {0x30c7, 0, 0, 1, f(Yes, false, "デ")},
- {0x30c8, 0, 0, 0, f(Yes, true, "")},
- {0x30c9, 0, 0, 1, f(Yes, false, "ド")},
- {0x30ca, 0, 0, 0, f(Yes, false, "")},
- {0x30cf, 0, 0, 0, f(Yes, true, "")},
- {0x30d0, 0, 0, 1, f(Yes, false, "バ")},
- {0x30d1, 0, 0, 1, f(Yes, false, "パ")},
- {0x30d2, 0, 0, 0, f(Yes, true, "")},
- {0x30d3, 0, 0, 1, f(Yes, false, "ビ")},
- {0x30d4, 0, 0, 1, f(Yes, false, "ピ")},
- {0x30d5, 0, 0, 0, f(Yes, true, "")},
- {0x30d6, 0, 0, 1, f(Yes, false, "ブ")},
- {0x30d7, 0, 0, 1, f(Yes, false, "プ")},
- {0x30d8, 0, 0, 0, f(Yes, true, "")},
- {0x30d9, 0, 0, 1, f(Yes, false, "ベ")},
- {0x30da, 0, 0, 1, f(Yes, false, "ペ")},
- {0x30db, 0, 0, 0, f(Yes, true, "")},
- {0x30dc, 0, 0, 1, f(Yes, false, "ボ")},
- {0x30dd, 0, 0, 1, f(Yes, false, "ポ")},
- {0x30de, 0, 0, 0, f(Yes, false, "")},
- {0x30ef, 0, 0, 0, f(Yes, true, "")},
- {0x30f3, 0, 0, 0, f(Yes, false, "")},
- {0x30f4, 0, 0, 1, f(Yes, false, "ヴ")},
- {0x30f5, 0, 0, 0, f(Yes, false, "")},
- {0x30f7, 0, 0, 1, f(Yes, false, "ヷ")},
- {0x30f8, 0, 0, 1, f(Yes, false, "ヸ")},
- {0x30f9, 0, 0, 1, f(Yes, false, "ヹ")},
- {0x30fa, 0, 0, 1, f(Yes, false, "ヺ")},
- {0x30fb, 0, 0, 0, f(Yes, false, "")},
- {0x30fd, 0, 0, 0, f(Yes, true, "")},
- {0x30fe, 0, 0, 1, f(Yes, false, "ヾ")},
- {0x30ff, 0, 0, 0, g(Yes, No, false, false, "", "コト")},
- {0x3100, 0, 0, 0, f(Yes, false, "")},
- {0x3131, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3132, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0x3133, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0x3134, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3135, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0x3136, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0x3137, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3138, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0x3139, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x313a, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0x313b, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0x313c, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0x313d, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0x313e, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0x313f, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0x3140, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0x3141, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3142, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3143, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0x3144, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0x3145, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3146, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0x3147, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3148, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3149, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0x314a, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x314b, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x314c, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x314d, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x314e, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x314f, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0x3150, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0x3151, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0x3152, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0x3153, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0x3154, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0x3155, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0x3156, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0x3157, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0x3158, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0x3159, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0x315a, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0x315b, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0x315c, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0x315d, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0x315e, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0x315f, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0x3160, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0x3161, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0x3162, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0x3163, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0x3164, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0x3165, 0, 0, 0, g(Yes, No, false, false, "", "ᄔ")},
- {0x3166, 0, 0, 0, g(Yes, No, false, false, "", "ᄕ")},
- {0x3167, 0, 0, 0, g(Yes, No, false, false, "", "ᇇ")},
- {0x3168, 0, 0, 0, g(Yes, No, false, false, "", "ᇈ")},
- {0x3169, 0, 0, 0, g(Yes, No, false, false, "", "ᇌ")},
- {0x316a, 0, 0, 0, g(Yes, No, false, false, "", "ᇎ")},
- {0x316b, 0, 0, 0, g(Yes, No, false, false, "", "ᇓ")},
- {0x316c, 0, 0, 0, g(Yes, No, false, false, "", "ᇗ")},
- {0x316d, 0, 0, 0, g(Yes, No, false, false, "", "ᇙ")},
- {0x316e, 0, 0, 0, g(Yes, No, false, false, "", "ᄜ")},
- {0x316f, 0, 0, 0, g(Yes, No, false, false, "", "ᇝ")},
- {0x3170, 0, 0, 0, g(Yes, No, false, false, "", "ᇟ")},
- {0x3171, 0, 0, 0, g(Yes, No, false, false, "", "ᄝ")},
- {0x3172, 0, 0, 0, g(Yes, No, false, false, "", "ᄞ")},
- {0x3173, 0, 0, 0, g(Yes, No, false, false, "", "ᄠ")},
- {0x3174, 0, 0, 0, g(Yes, No, false, false, "", "ᄢ")},
- {0x3175, 0, 0, 0, g(Yes, No, false, false, "", "ᄣ")},
- {0x3176, 0, 0, 0, g(Yes, No, false, false, "", "ᄧ")},
- {0x3177, 0, 0, 0, g(Yes, No, false, false, "", "ᄩ")},
- {0x3178, 0, 0, 0, g(Yes, No, false, false, "", "ᄫ")},
- {0x3179, 0, 0, 0, g(Yes, No, false, false, "", "ᄬ")},
- {0x317a, 0, 0, 0, g(Yes, No, false, false, "", "ᄭ")},
- {0x317b, 0, 0, 0, g(Yes, No, false, false, "", "ᄮ")},
- {0x317c, 0, 0, 0, g(Yes, No, false, false, "", "ᄯ")},
- {0x317d, 0, 0, 0, g(Yes, No, false, false, "", "ᄲ")},
- {0x317e, 0, 0, 0, g(Yes, No, false, false, "", "ᄶ")},
- {0x317f, 0, 0, 0, g(Yes, No, false, false, "", "ᅀ")},
- {0x3180, 0, 0, 0, g(Yes, No, false, false, "", "ᅇ")},
- {0x3181, 0, 0, 0, g(Yes, No, false, false, "", "ᅌ")},
- {0x3182, 0, 0, 0, g(Yes, No, false, false, "", "ᇱ")},
- {0x3183, 0, 0, 0, g(Yes, No, false, false, "", "ᇲ")},
- {0x3184, 0, 0, 0, g(Yes, No, false, false, "", "ᅗ")},
- {0x3185, 0, 0, 0, g(Yes, No, false, false, "", "ᅘ")},
- {0x3186, 0, 0, 0, g(Yes, No, false, false, "", "ᅙ")},
- {0x3187, 0, 0, 0, g(Yes, No, false, false, "", "ᆄ")},
- {0x3188, 0, 0, 0, g(Yes, No, false, false, "", "ᆅ")},
- {0x3189, 0, 0, 0, g(Yes, No, false, false, "", "ᆈ")},
- {0x318a, 0, 0, 0, g(Yes, No, false, false, "", "ᆑ")},
- {0x318b, 0, 0, 0, g(Yes, No, false, false, "", "ᆒ")},
- {0x318c, 0, 0, 0, g(Yes, No, false, false, "", "ᆔ")},
- {0x318d, 0, 0, 0, g(Yes, No, false, false, "", "ᆞ")},
- {0x318e, 0, 0, 0, g(Yes, No, false, false, "", "ᆡ")},
- {0x318f, 0, 0, 0, f(Yes, false, "")},
- {0x3192, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3193, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3194, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3195, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3196, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x3197, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x3198, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x3199, 0, 0, 0, g(Yes, No, false, false, "", "甲")},
- {0x319a, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x319b, 0, 0, 0, g(Yes, No, false, false, "", "丙")},
- {0x319c, 0, 0, 0, g(Yes, No, false, false, "", "丁")},
- {0x319d, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x319e, 0, 0, 0, g(Yes, No, false, false, "", "地")},
- {0x319f, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x31a0, 0, 0, 0, f(Yes, false, "")},
- {0x3200, 0, 0, 0, g(Yes, No, false, false, "", "(ᄀ)")},
- {0x3201, 0, 0, 0, g(Yes, No, false, false, "", "(ᄂ)")},
- {0x3202, 0, 0, 0, g(Yes, No, false, false, "", "(ᄃ)")},
- {0x3203, 0, 0, 0, g(Yes, No, false, false, "", "(ᄅ)")},
- {0x3204, 0, 0, 0, g(Yes, No, false, false, "", "(ᄆ)")},
- {0x3205, 0, 0, 0, g(Yes, No, false, false, "", "(ᄇ)")},
- {0x3206, 0, 0, 0, g(Yes, No, false, false, "", "(ᄉ)")},
- {0x3207, 0, 0, 0, g(Yes, No, false, false, "", "(ᄋ)")},
- {0x3208, 0, 0, 0, g(Yes, No, false, false, "", "(ᄌ)")},
- {0x3209, 0, 0, 0, g(Yes, No, false, false, "", "(ᄎ)")},
- {0x320a, 0, 0, 0, g(Yes, No, false, false, "", "(ᄏ)")},
- {0x320b, 0, 0, 0, g(Yes, No, false, false, "", "(ᄐ)")},
- {0x320c, 0, 0, 0, g(Yes, No, false, false, "", "(ᄑ)")},
- {0x320d, 0, 0, 0, g(Yes, No, false, false, "", "(ᄒ)")},
- {0x320e, 0, 0, 0, g(Yes, No, false, false, "", "(가)")},
- {0x320f, 0, 0, 0, g(Yes, No, false, false, "", "(나)")},
- {0x3210, 0, 0, 0, g(Yes, No, false, false, "", "(다)")},
- {0x3211, 0, 0, 0, g(Yes, No, false, false, "", "(라)")},
- {0x3212, 0, 0, 0, g(Yes, No, false, false, "", "(마)")},
- {0x3213, 0, 0, 0, g(Yes, No, false, false, "", "(바)")},
- {0x3214, 0, 0, 0, g(Yes, No, false, false, "", "(사)")},
- {0x3215, 0, 0, 0, g(Yes, No, false, false, "", "(아)")},
- {0x3216, 0, 0, 0, g(Yes, No, false, false, "", "(자)")},
- {0x3217, 0, 0, 0, g(Yes, No, false, false, "", "(차)")},
- {0x3218, 0, 0, 0, g(Yes, No, false, false, "", "(카)")},
- {0x3219, 0, 0, 0, g(Yes, No, false, false, "", "(타)")},
- {0x321a, 0, 0, 0, g(Yes, No, false, false, "", "(파)")},
- {0x321b, 0, 0, 0, g(Yes, No, false, false, "", "(하)")},
- {0x321c, 0, 0, 0, g(Yes, No, false, false, "", "(주)")},
- {0x321d, 0, 0, 0, g(Yes, No, false, false, "", "(오전)")},
- {0x321e, 0, 0, 0, g(Yes, No, false, false, "", "(오후)")},
- {0x321f, 0, 0, 0, f(Yes, false, "")},
- {0x3220, 0, 0, 0, g(Yes, No, false, false, "", "(一)")},
- {0x3221, 0, 0, 0, g(Yes, No, false, false, "", "(二)")},
- {0x3222, 0, 0, 0, g(Yes, No, false, false, "", "(三)")},
- {0x3223, 0, 0, 0, g(Yes, No, false, false, "", "(四)")},
- {0x3224, 0, 0, 0, g(Yes, No, false, false, "", "(五)")},
- {0x3225, 0, 0, 0, g(Yes, No, false, false, "", "(六)")},
- {0x3226, 0, 0, 0, g(Yes, No, false, false, "", "(七)")},
- {0x3227, 0, 0, 0, g(Yes, No, false, false, "", "(八)")},
- {0x3228, 0, 0, 0, g(Yes, No, false, false, "", "(九)")},
- {0x3229, 0, 0, 0, g(Yes, No, false, false, "", "(十)")},
- {0x322a, 0, 0, 0, g(Yes, No, false, false, "", "(月)")},
- {0x322b, 0, 0, 0, g(Yes, No, false, false, "", "(火)")},
- {0x322c, 0, 0, 0, g(Yes, No, false, false, "", "(水)")},
- {0x322d, 0, 0, 0, g(Yes, No, false, false, "", "(木)")},
- {0x322e, 0, 0, 0, g(Yes, No, false, false, "", "(金)")},
- {0x322f, 0, 0, 0, g(Yes, No, false, false, "", "(土)")},
- {0x3230, 0, 0, 0, g(Yes, No, false, false, "", "(日)")},
- {0x3231, 0, 0, 0, g(Yes, No, false, false, "", "(株)")},
- {0x3232, 0, 0, 0, g(Yes, No, false, false, "", "(有)")},
- {0x3233, 0, 0, 0, g(Yes, No, false, false, "", "(社)")},
- {0x3234, 0, 0, 0, g(Yes, No, false, false, "", "(名)")},
- {0x3235, 0, 0, 0, g(Yes, No, false, false, "", "(特)")},
- {0x3236, 0, 0, 0, g(Yes, No, false, false, "", "(財)")},
- {0x3237, 0, 0, 0, g(Yes, No, false, false, "", "(祝)")},
- {0x3238, 0, 0, 0, g(Yes, No, false, false, "", "(労)")},
- {0x3239, 0, 0, 0, g(Yes, No, false, false, "", "(代)")},
- {0x323a, 0, 0, 0, g(Yes, No, false, false, "", "(呼)")},
- {0x323b, 0, 0, 0, g(Yes, No, false, false, "", "(学)")},
- {0x323c, 0, 0, 0, g(Yes, No, false, false, "", "(監)")},
- {0x323d, 0, 0, 0, g(Yes, No, false, false, "", "(企)")},
- {0x323e, 0, 0, 0, g(Yes, No, false, false, "", "(資)")},
- {0x323f, 0, 0, 0, g(Yes, No, false, false, "", "(協)")},
- {0x3240, 0, 0, 0, g(Yes, No, false, false, "", "(祭)")},
- {0x3241, 0, 0, 0, g(Yes, No, false, false, "", "(休)")},
- {0x3242, 0, 0, 0, g(Yes, No, false, false, "", "(自)")},
- {0x3243, 0, 0, 0, g(Yes, No, false, false, "", "(至)")},
- {0x3244, 0, 0, 0, g(Yes, No, false, false, "", "問")},
- {0x3245, 0, 0, 0, g(Yes, No, false, false, "", "幼")},
- {0x3246, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x3247, 0, 0, 0, g(Yes, No, false, false, "", "箏")},
- {0x3248, 0, 0, 0, f(Yes, false, "")},
- {0x3250, 0, 0, 0, g(Yes, No, false, false, "", "PTE")},
- {0x3251, 0, 0, 0, g(Yes, No, false, false, "", "21")},
- {0x3252, 0, 0, 0, g(Yes, No, false, false, "", "22")},
- {0x3253, 0, 0, 0, g(Yes, No, false, false, "", "23")},
- {0x3254, 0, 0, 0, g(Yes, No, false, false, "", "24")},
- {0x3255, 0, 0, 0, g(Yes, No, false, false, "", "25")},
- {0x3256, 0, 0, 0, g(Yes, No, false, false, "", "26")},
- {0x3257, 0, 0, 0, g(Yes, No, false, false, "", "27")},
- {0x3258, 0, 0, 0, g(Yes, No, false, false, "", "28")},
- {0x3259, 0, 0, 0, g(Yes, No, false, false, "", "29")},
- {0x325a, 0, 0, 0, g(Yes, No, false, false, "", "30")},
- {0x325b, 0, 0, 0, g(Yes, No, false, false, "", "31")},
- {0x325c, 0, 0, 0, g(Yes, No, false, false, "", "32")},
- {0x325d, 0, 0, 0, g(Yes, No, false, false, "", "33")},
- {0x325e, 0, 0, 0, g(Yes, No, false, false, "", "34")},
- {0x325f, 0, 0, 0, g(Yes, No, false, false, "", "35")},
- {0x3260, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3261, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3262, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3263, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x3264, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3265, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3266, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3267, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3268, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3269, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x326a, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x326b, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x326c, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x326d, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x326e, 0, 0, 1, g(Yes, No, false, false, "", "가")},
- {0x326f, 0, 0, 1, g(Yes, No, false, false, "", "나")},
- {0x3270, 0, 0, 1, g(Yes, No, false, false, "", "다")},
- {0x3271, 0, 0, 1, g(Yes, No, false, false, "", "라")},
- {0x3272, 0, 0, 1, g(Yes, No, false, false, "", "마")},
- {0x3273, 0, 0, 1, g(Yes, No, false, false, "", "바")},
- {0x3274, 0, 0, 1, g(Yes, No, false, false, "", "사")},
- {0x3275, 0, 0, 1, g(Yes, No, false, false, "", "아")},
- {0x3276, 0, 0, 1, g(Yes, No, false, false, "", "자")},
- {0x3277, 0, 0, 1, g(Yes, No, false, false, "", "차")},
- {0x3278, 0, 0, 1, g(Yes, No, false, false, "", "카")},
- {0x3279, 0, 0, 1, g(Yes, No, false, false, "", "타")},
- {0x327a, 0, 0, 1, g(Yes, No, false, false, "", "파")},
- {0x327b, 0, 0, 1, g(Yes, No, false, false, "", "하")},
- {0x327c, 0, 0, 1, g(Yes, No, false, false, "", "참고")},
- {0x327d, 0, 0, 1, g(Yes, No, false, false, "", "주의")},
- {0x327e, 0, 0, 1, g(Yes, No, false, false, "", "우")},
- {0x327f, 0, 0, 0, f(Yes, false, "")},
- {0x3280, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3281, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3282, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3283, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3284, 0, 0, 0, g(Yes, No, false, false, "", "五")},
- {0x3285, 0, 0, 0, g(Yes, No, false, false, "", "六")},
- {0x3286, 0, 0, 0, g(Yes, No, false, false, "", "七")},
- {0x3287, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x3288, 0, 0, 0, g(Yes, No, false, false, "", "九")},
- {0x3289, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x328a, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x328b, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x328c, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x328d, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x328e, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x328f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x3290, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x3291, 0, 0, 0, g(Yes, No, false, false, "", "株")},
- {0x3292, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x3293, 0, 0, 0, g(Yes, No, false, false, "", "社")},
- {0x3294, 0, 0, 0, g(Yes, No, false, false, "", "名")},
- {0x3295, 0, 0, 0, g(Yes, No, false, false, "", "特")},
- {0x3296, 0, 0, 0, g(Yes, No, false, false, "", "財")},
- {0x3297, 0, 0, 0, g(Yes, No, false, false, "", "祝")},
- {0x3298, 0, 0, 0, g(Yes, No, false, false, "", "労")},
- {0x3299, 0, 0, 0, g(Yes, No, false, false, "", "秘")},
- {0x329a, 0, 0, 0, g(Yes, No, false, false, "", "男")},
- {0x329b, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x329c, 0, 0, 0, g(Yes, No, false, false, "", "適")},
- {0x329d, 0, 0, 0, g(Yes, No, false, false, "", "優")},
- {0x329e, 0, 0, 0, g(Yes, No, false, false, "", "印")},
- {0x329f, 0, 0, 0, g(Yes, No, false, false, "", "注")},
- {0x32a0, 0, 0, 0, g(Yes, No, false, false, "", "項")},
- {0x32a1, 0, 0, 0, g(Yes, No, false, false, "", "休")},
- {0x32a2, 0, 0, 0, g(Yes, No, false, false, "", "写")},
- {0x32a3, 0, 0, 0, g(Yes, No, false, false, "", "正")},
- {0x32a4, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x32a5, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x32a6, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x32a7, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x32a8, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x32a9, 0, 0, 0, g(Yes, No, false, false, "", "医")},
- {0x32aa, 0, 0, 0, g(Yes, No, false, false, "", "宗")},
- {0x32ab, 0, 0, 0, g(Yes, No, false, false, "", "学")},
- {0x32ac, 0, 0, 0, g(Yes, No, false, false, "", "監")},
- {0x32ad, 0, 0, 0, g(Yes, No, false, false, "", "企")},
- {0x32ae, 0, 0, 0, g(Yes, No, false, false, "", "資")},
- {0x32af, 0, 0, 0, g(Yes, No, false, false, "", "協")},
- {0x32b0, 0, 0, 0, g(Yes, No, false, false, "", "夜")},
- {0x32b1, 0, 0, 0, g(Yes, No, false, false, "", "36")},
- {0x32b2, 0, 0, 0, g(Yes, No, false, false, "", "37")},
- {0x32b3, 0, 0, 0, g(Yes, No, false, false, "", "38")},
- {0x32b4, 0, 0, 0, g(Yes, No, false, false, "", "39")},
- {0x32b5, 0, 0, 0, g(Yes, No, false, false, "", "40")},
- {0x32b6, 0, 0, 0, g(Yes, No, false, false, "", "41")},
- {0x32b7, 0, 0, 0, g(Yes, No, false, false, "", "42")},
- {0x32b8, 0, 0, 0, g(Yes, No, false, false, "", "43")},
- {0x32b9, 0, 0, 0, g(Yes, No, false, false, "", "44")},
- {0x32ba, 0, 0, 0, g(Yes, No, false, false, "", "45")},
- {0x32bb, 0, 0, 0, g(Yes, No, false, false, "", "46")},
- {0x32bc, 0, 0, 0, g(Yes, No, false, false, "", "47")},
- {0x32bd, 0, 0, 0, g(Yes, No, false, false, "", "48")},
- {0x32be, 0, 0, 0, g(Yes, No, false, false, "", "49")},
- {0x32bf, 0, 0, 0, g(Yes, No, false, false, "", "50")},
- {0x32c0, 0, 0, 0, g(Yes, No, false, false, "", "1月")},
- {0x32c1, 0, 0, 0, g(Yes, No, false, false, "", "2月")},
- {0x32c2, 0, 0, 0, g(Yes, No, false, false, "", "3月")},
- {0x32c3, 0, 0, 0, g(Yes, No, false, false, "", "4月")},
- {0x32c4, 0, 0, 0, g(Yes, No, false, false, "", "5月")},
- {0x32c5, 0, 0, 0, g(Yes, No, false, false, "", "6月")},
- {0x32c6, 0, 0, 0, g(Yes, No, false, false, "", "7月")},
- {0x32c7, 0, 0, 0, g(Yes, No, false, false, "", "8月")},
- {0x32c8, 0, 0, 0, g(Yes, No, false, false, "", "9月")},
- {0x32c9, 0, 0, 0, g(Yes, No, false, false, "", "10月")},
- {0x32ca, 0, 0, 0, g(Yes, No, false, false, "", "11月")},
- {0x32cb, 0, 0, 0, g(Yes, No, false, false, "", "12月")},
- {0x32cc, 0, 0, 0, g(Yes, No, false, false, "", "Hg")},
- {0x32cd, 0, 0, 0, g(Yes, No, false, false, "", "erg")},
- {0x32ce, 0, 0, 0, g(Yes, No, false, false, "", "eV")},
- {0x32cf, 0, 0, 0, g(Yes, No, false, false, "", "LTD")},
- {0x32d0, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0x32d1, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0x32d2, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0x32d3, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0x32d4, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0x32d5, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0x32d6, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0x32d7, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0x32d8, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0x32d9, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0x32da, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x32db, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0x32dc, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0x32dd, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0x32de, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0x32df, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0x32e0, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0x32e1, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0x32e2, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0x32e3, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0x32e4, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0x32e5, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0x32e6, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0x32e7, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0x32e8, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0x32e9, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0x32ea, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0x32eb, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0x32ec, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0x32ed, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0x32ee, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0x32ef, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0x32f0, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0x32f1, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0x32f2, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0x32f3, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0x32f4, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0x32f5, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0x32f6, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0x32f7, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0x32f8, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0x32f9, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0x32fa, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0x32fb, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0x32fc, 0, 0, 0, g(Yes, No, false, false, "", "ヰ")},
- {0x32fd, 0, 0, 0, g(Yes, No, false, false, "", "ヱ")},
- {0x32fe, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0x32ff, 0, 0, 0, f(Yes, false, "")},
- {0x3300, 0, 0, 0, g(Yes, No, false, false, "", "アパート")},
- {0x3301, 0, 0, 0, g(Yes, No, false, false, "", "アルファ")},
- {0x3302, 0, 0, 0, g(Yes, No, false, false, "", "アンペア")},
- {0x3303, 0, 0, 0, g(Yes, No, false, false, "", "アール")},
- {0x3304, 0, 0, 1, g(Yes, No, false, false, "", "イニング")},
- {0x3305, 0, 0, 0, g(Yes, No, false, false, "", "インチ")},
- {0x3306, 0, 0, 0, g(Yes, No, false, false, "", "ウォン")},
- {0x3307, 0, 0, 1, g(Yes, No, false, false, "", "エスクード")},
- {0x3308, 0, 0, 0, g(Yes, No, false, false, "", "エーカー")},
- {0x3309, 0, 0, 0, g(Yes, No, false, false, "", "オンス")},
- {0x330a, 0, 0, 0, g(Yes, No, false, false, "", "オーム")},
- {0x330b, 0, 0, 0, g(Yes, No, false, false, "", "カイリ")},
- {0x330c, 0, 0, 0, g(Yes, No, false, false, "", "カラット")},
- {0x330d, 0, 0, 0, g(Yes, No, false, false, "", "カロリー")},
- {0x330e, 0, 0, 0, g(Yes, No, false, false, "", "ガロン")},
- {0x330f, 0, 0, 0, g(Yes, No, false, false, "", "ガンマ")},
- {0x3310, 0, 0, 1, g(Yes, No, false, false, "", "ギガ")},
- {0x3311, 0, 0, 0, g(Yes, No, false, false, "", "ギニー")},
- {0x3312, 0, 0, 0, g(Yes, No, false, false, "", "キュリー")},
- {0x3313, 0, 0, 0, g(Yes, No, false, false, "", "ギルダー")},
- {0x3314, 0, 0, 0, g(Yes, No, false, false, "", "キロ")},
- {0x3315, 0, 0, 0, g(Yes, No, false, false, "", "キログラム")},
- {0x3316, 0, 0, 0, g(Yes, No, false, false, "", "キロメートル")},
- {0x3317, 0, 0, 0, g(Yes, No, false, false, "", "キロワット")},
- {0x3318, 0, 0, 0, g(Yes, No, false, false, "", "グラム")},
- {0x3319, 0, 0, 0, g(Yes, No, false, false, "", "グラムトン")},
- {0x331a, 0, 0, 0, g(Yes, No, false, false, "", "クルゼイロ")},
- {0x331b, 0, 0, 0, g(Yes, No, false, false, "", "クローネ")},
- {0x331c, 0, 0, 0, g(Yes, No, false, false, "", "ケース")},
- {0x331d, 0, 0, 0, g(Yes, No, false, false, "", "コルナ")},
- {0x331e, 0, 0, 1, g(Yes, No, false, false, "", "コーポ")},
- {0x331f, 0, 0, 0, g(Yes, No, false, false, "", "サイクル")},
- {0x3320, 0, 0, 0, g(Yes, No, false, false, "", "サンチーム")},
- {0x3321, 0, 0, 1, g(Yes, No, false, false, "", "シリング")},
- {0x3322, 0, 0, 0, g(Yes, No, false, false, "", "センチ")},
- {0x3323, 0, 0, 0, g(Yes, No, false, false, "", "セント")},
- {0x3324, 0, 0, 0, g(Yes, No, false, false, "", "ダース")},
- {0x3325, 0, 0, 0, g(Yes, No, false, false, "", "デシ")},
- {0x3326, 0, 0, 0, g(Yes, No, false, false, "", "ドル")},
- {0x3327, 0, 0, 0, g(Yes, No, false, false, "", "トン")},
- {0x3328, 0, 0, 0, g(Yes, No, false, false, "", "ナノ")},
- {0x3329, 0, 0, 0, g(Yes, No, false, false, "", "ノット")},
- {0x332a, 0, 0, 0, g(Yes, No, false, false, "", "ハイツ")},
- {0x332b, 0, 0, 0, g(Yes, No, false, false, "", "パーセント")},
- {0x332c, 0, 0, 0, g(Yes, No, false, false, "", "パーツ")},
- {0x332d, 0, 0, 0, g(Yes, No, false, false, "", "バーレル")},
- {0x332e, 0, 0, 0, g(Yes, No, false, false, "", "ピアストル")},
- {0x332f, 0, 0, 0, g(Yes, No, false, false, "", "ピクル")},
- {0x3330, 0, 0, 0, g(Yes, No, false, false, "", "ピコ")},
- {0x3331, 0, 0, 0, g(Yes, No, false, false, "", "ビル")},
- {0x3332, 0, 0, 1, g(Yes, No, false, false, "", "ファラッド")},
- {0x3333, 0, 0, 0, g(Yes, No, false, false, "", "フィート")},
- {0x3334, 0, 0, 0, g(Yes, No, false, false, "", "ブッシェル")},
- {0x3335, 0, 0, 0, g(Yes, No, false, false, "", "フラン")},
- {0x3336, 0, 0, 0, g(Yes, No, false, false, "", "ヘクタール")},
- {0x3337, 0, 0, 0, g(Yes, No, false, false, "", "ペソ")},
- {0x3338, 0, 0, 0, g(Yes, No, false, false, "", "ペニヒ")},
- {0x3339, 0, 0, 0, g(Yes, No, false, false, "", "ヘルツ")},
- {0x333a, 0, 0, 0, g(Yes, No, false, false, "", "ペンス")},
- {0x333b, 0, 0, 1, g(Yes, No, false, false, "", "ページ")},
- {0x333c, 0, 0, 0, g(Yes, No, false, false, "", "ベータ")},
- {0x333d, 0, 0, 0, g(Yes, No, false, false, "", "ポイント")},
- {0x333e, 0, 0, 0, g(Yes, No, false, false, "", "ボルト")},
- {0x333f, 0, 0, 0, g(Yes, No, false, false, "", "ホン")},
- {0x3340, 0, 0, 1, g(Yes, No, false, false, "", "ポンド")},
- {0x3341, 0, 0, 0, g(Yes, No, false, false, "", "ホール")},
- {0x3342, 0, 0, 0, g(Yes, No, false, false, "", "ホーン")},
- {0x3343, 0, 0, 0, g(Yes, No, false, false, "", "マイクロ")},
- {0x3344, 0, 0, 0, g(Yes, No, false, false, "", "マイル")},
- {0x3345, 0, 0, 0, g(Yes, No, false, false, "", "マッハ")},
- {0x3346, 0, 0, 0, g(Yes, No, false, false, "", "マルク")},
- {0x3347, 0, 0, 0, g(Yes, No, false, false, "", "マンション")},
- {0x3348, 0, 0, 0, g(Yes, No, false, false, "", "ミクロン")},
- {0x3349, 0, 0, 0, g(Yes, No, false, false, "", "ミリ")},
- {0x334a, 0, 0, 0, g(Yes, No, false, false, "", "ミリバール")},
- {0x334b, 0, 0, 1, g(Yes, No, false, false, "", "メガ")},
- {0x334c, 0, 0, 0, g(Yes, No, false, false, "", "メガトン")},
- {0x334d, 0, 0, 0, g(Yes, No, false, false, "", "メートル")},
- {0x334e, 0, 0, 1, g(Yes, No, false, false, "", "ヤード")},
- {0x334f, 0, 0, 0, g(Yes, No, false, false, "", "ヤール")},
- {0x3350, 0, 0, 0, g(Yes, No, false, false, "", "ユアン")},
- {0x3351, 0, 0, 0, g(Yes, No, false, false, "", "リットル")},
- {0x3352, 0, 0, 0, g(Yes, No, false, false, "", "リラ")},
- {0x3353, 0, 0, 0, g(Yes, No, false, false, "", "ルピー")},
- {0x3354, 0, 0, 0, g(Yes, No, false, false, "", "ルーブル")},
- {0x3355, 0, 0, 0, g(Yes, No, false, false, "", "レム")},
- {0x3356, 0, 0, 0, g(Yes, No, false, false, "", "レントゲン")},
- {0x3357, 0, 0, 0, g(Yes, No, false, false, "", "ワット")},
- {0x3358, 0, 0, 0, g(Yes, No, false, false, "", "0点")},
- {0x3359, 0, 0, 0, g(Yes, No, false, false, "", "1点")},
- {0x335a, 0, 0, 0, g(Yes, No, false, false, "", "2点")},
- {0x335b, 0, 0, 0, g(Yes, No, false, false, "", "3点")},
- {0x335c, 0, 0, 0, g(Yes, No, false, false, "", "4点")},
- {0x335d, 0, 0, 0, g(Yes, No, false, false, "", "5点")},
- {0x335e, 0, 0, 0, g(Yes, No, false, false, "", "6点")},
- {0x335f, 0, 0, 0, g(Yes, No, false, false, "", "7点")},
- {0x3360, 0, 0, 0, g(Yes, No, false, false, "", "8点")},
- {0x3361, 0, 0, 0, g(Yes, No, false, false, "", "9点")},
- {0x3362, 0, 0, 0, g(Yes, No, false, false, "", "10点")},
- {0x3363, 0, 0, 0, g(Yes, No, false, false, "", "11点")},
- {0x3364, 0, 0, 0, g(Yes, No, false, false, "", "12点")},
- {0x3365, 0, 0, 0, g(Yes, No, false, false, "", "13点")},
- {0x3366, 0, 0, 0, g(Yes, No, false, false, "", "14点")},
- {0x3367, 0, 0, 0, g(Yes, No, false, false, "", "15点")},
- {0x3368, 0, 0, 0, g(Yes, No, false, false, "", "16点")},
- {0x3369, 0, 0, 0, g(Yes, No, false, false, "", "17点")},
- {0x336a, 0, 0, 0, g(Yes, No, false, false, "", "18点")},
- {0x336b, 0, 0, 0, g(Yes, No, false, false, "", "19点")},
- {0x336c, 0, 0, 0, g(Yes, No, false, false, "", "20点")},
- {0x336d, 0, 0, 0, g(Yes, No, false, false, "", "21点")},
- {0x336e, 0, 0, 0, g(Yes, No, false, false, "", "22点")},
- {0x336f, 0, 0, 0, g(Yes, No, false, false, "", "23点")},
- {0x3370, 0, 0, 0, g(Yes, No, false, false, "", "24点")},
- {0x3371, 0, 0, 0, g(Yes, No, false, false, "", "hPa")},
- {0x3372, 0, 0, 0, g(Yes, No, false, false, "", "da")},
- {0x3373, 0, 0, 0, g(Yes, No, false, false, "", "AU")},
- {0x3374, 0, 0, 0, g(Yes, No, false, false, "", "bar")},
- {0x3375, 0, 0, 0, g(Yes, No, false, false, "", "oV")},
- {0x3376, 0, 0, 0, g(Yes, No, false, false, "", "pc")},
- {0x3377, 0, 0, 0, g(Yes, No, false, false, "", "dm")},
- {0x3378, 0, 0, 0, g(Yes, No, false, false, "", "dm2")},
- {0x3379, 0, 0, 0, g(Yes, No, false, false, "", "dm3")},
- {0x337a, 0, 0, 0, g(Yes, No, false, false, "", "IU")},
- {0x337b, 0, 0, 0, g(Yes, No, false, false, "", "平成")},
- {0x337c, 0, 0, 0, g(Yes, No, false, false, "", "昭和")},
- {0x337d, 0, 0, 0, g(Yes, No, false, false, "", "大正")},
- {0x337e, 0, 0, 0, g(Yes, No, false, false, "", "明治")},
- {0x337f, 0, 0, 0, g(Yes, No, false, false, "", "株式会社")},
- {0x3380, 0, 0, 0, g(Yes, No, false, false, "", "pA")},
- {0x3381, 0, 0, 0, g(Yes, No, false, false, "", "nA")},
- {0x3382, 0, 0, 0, g(Yes, No, false, false, "", "μA")},
- {0x3383, 0, 0, 0, g(Yes, No, false, false, "", "mA")},
- {0x3384, 0, 0, 0, g(Yes, No, false, false, "", "kA")},
- {0x3385, 0, 0, 0, g(Yes, No, false, false, "", "KB")},
- {0x3386, 0, 0, 0, g(Yes, No, false, false, "", "MB")},
- {0x3387, 0, 0, 0, g(Yes, No, false, false, "", "GB")},
- {0x3388, 0, 0, 0, g(Yes, No, false, false, "", "cal")},
- {0x3389, 0, 0, 0, g(Yes, No, false, false, "", "kcal")},
- {0x338a, 0, 0, 0, g(Yes, No, false, false, "", "pF")},
- {0x338b, 0, 0, 0, g(Yes, No, false, false, "", "nF")},
- {0x338c, 0, 0, 0, g(Yes, No, false, false, "", "μF")},
- {0x338d, 0, 0, 0, g(Yes, No, false, false, "", "μg")},
- {0x338e, 0, 0, 0, g(Yes, No, false, false, "", "mg")},
- {0x338f, 0, 0, 0, g(Yes, No, false, false, "", "kg")},
- {0x3390, 0, 0, 0, g(Yes, No, false, false, "", "Hz")},
- {0x3391, 0, 0, 0, g(Yes, No, false, false, "", "kHz")},
- {0x3392, 0, 0, 0, g(Yes, No, false, false, "", "MHz")},
- {0x3393, 0, 0, 0, g(Yes, No, false, false, "", "GHz")},
- {0x3394, 0, 0, 0, g(Yes, No, false, false, "", "THz")},
- {0x3395, 0, 0, 0, g(Yes, No, false, false, "", "μl")},
- {0x3396, 0, 0, 0, g(Yes, No, false, false, "", "ml")},
- {0x3397, 0, 0, 0, g(Yes, No, false, false, "", "dl")},
- {0x3398, 0, 0, 0, g(Yes, No, false, false, "", "kl")},
- {0x3399, 0, 0, 0, g(Yes, No, false, false, "", "fm")},
- {0x339a, 0, 0, 0, g(Yes, No, false, false, "", "nm")},
- {0x339b, 0, 0, 0, g(Yes, No, false, false, "", "μm")},
- {0x339c, 0, 0, 0, g(Yes, No, false, false, "", "mm")},
- {0x339d, 0, 0, 0, g(Yes, No, false, false, "", "cm")},
- {0x339e, 0, 0, 0, g(Yes, No, false, false, "", "km")},
- {0x339f, 0, 0, 0, g(Yes, No, false, false, "", "mm2")},
- {0x33a0, 0, 0, 0, g(Yes, No, false, false, "", "cm2")},
- {0x33a1, 0, 0, 0, g(Yes, No, false, false, "", "m2")},
- {0x33a2, 0, 0, 0, g(Yes, No, false, false, "", "km2")},
- {0x33a3, 0, 0, 0, g(Yes, No, false, false, "", "mm3")},
- {0x33a4, 0, 0, 0, g(Yes, No, false, false, "", "cm3")},
- {0x33a5, 0, 0, 0, g(Yes, No, false, false, "", "m3")},
- {0x33a6, 0, 0, 0, g(Yes, No, false, false, "", "km3")},
- {0x33a7, 0, 0, 0, g(Yes, No, false, false, "", "m∕s")},
- {0x33a8, 0, 0, 0, g(Yes, No, false, false, "", "m∕s2")},
- {0x33a9, 0, 0, 0, g(Yes, No, false, false, "", "Pa")},
- {0x33aa, 0, 0, 0, g(Yes, No, false, false, "", "kPa")},
- {0x33ab, 0, 0, 0, g(Yes, No, false, false, "", "MPa")},
- {0x33ac, 0, 0, 0, g(Yes, No, false, false, "", "GPa")},
- {0x33ad, 0, 0, 0, g(Yes, No, false, false, "", "rad")},
- {0x33ae, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s")},
- {0x33af, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s2")},
- {0x33b0, 0, 0, 0, g(Yes, No, false, false, "", "ps")},
- {0x33b1, 0, 0, 0, g(Yes, No, false, false, "", "ns")},
- {0x33b2, 0, 0, 0, g(Yes, No, false, false, "", "μs")},
- {0x33b3, 0, 0, 0, g(Yes, No, false, false, "", "ms")},
- {0x33b4, 0, 0, 0, g(Yes, No, false, false, "", "pV")},
- {0x33b5, 0, 0, 0, g(Yes, No, false, false, "", "nV")},
- {0x33b6, 0, 0, 0, g(Yes, No, false, false, "", "μV")},
- {0x33b7, 0, 0, 0, g(Yes, No, false, false, "", "mV")},
- {0x33b8, 0, 0, 0, g(Yes, No, false, false, "", "kV")},
- {0x33b9, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x33ba, 0, 0, 0, g(Yes, No, false, false, "", "pW")},
- {0x33bb, 0, 0, 0, g(Yes, No, false, false, "", "nW")},
- {0x33bc, 0, 0, 0, g(Yes, No, false, false, "", "μW")},
- {0x33bd, 0, 0, 0, g(Yes, No, false, false, "", "mW")},
- {0x33be, 0, 0, 0, g(Yes, No, false, false, "", "kW")},
- {0x33bf, 0, 0, 0, g(Yes, No, false, false, "", "MW")},
- {0x33c0, 0, 0, 0, g(Yes, No, false, false, "", "kΩ")},
- {0x33c1, 0, 0, 0, g(Yes, No, false, false, "", "MΩ")},
- {0x33c2, 0, 0, 0, g(Yes, No, false, false, "", "a.m.")},
- {0x33c3, 0, 0, 0, g(Yes, No, false, false, "", "Bq")},
- {0x33c4, 0, 0, 0, g(Yes, No, false, false, "", "cc")},
- {0x33c5, 0, 0, 0, g(Yes, No, false, false, "", "cd")},
- {0x33c6, 0, 0, 0, g(Yes, No, false, false, "", "C∕kg")},
- {0x33c7, 0, 0, 0, g(Yes, No, false, false, "", "Co.")},
- {0x33c8, 0, 0, 0, g(Yes, No, false, false, "", "dB")},
- {0x33c9, 0, 0, 0, g(Yes, No, false, false, "", "Gy")},
- {0x33ca, 0, 0, 0, g(Yes, No, false, false, "", "ha")},
- {0x33cb, 0, 0, 0, g(Yes, No, false, false, "", "HP")},
- {0x33cc, 0, 0, 0, g(Yes, No, false, false, "", "in")},
- {0x33cd, 0, 0, 0, g(Yes, No, false, false, "", "KK")},
- {0x33ce, 0, 0, 0, g(Yes, No, false, false, "", "KM")},
- {0x33cf, 0, 0, 0, g(Yes, No, false, false, "", "kt")},
- {0x33d0, 0, 0, 0, g(Yes, No, false, false, "", "lm")},
- {0x33d1, 0, 0, 0, g(Yes, No, false, false, "", "ln")},
- {0x33d2, 0, 0, 0, g(Yes, No, false, false, "", "log")},
- {0x33d3, 0, 0, 0, g(Yes, No, false, false, "", "lx")},
- {0x33d4, 0, 0, 0, g(Yes, No, false, false, "", "mb")},
- {0x33d5, 0, 0, 0, g(Yes, No, false, false, "", "mil")},
- {0x33d6, 0, 0, 0, g(Yes, No, false, false, "", "mol")},
- {0x33d7, 0, 0, 0, g(Yes, No, false, false, "", "PH")},
- {0x33d8, 0, 0, 0, g(Yes, No, false, false, "", "p.m.")},
- {0x33d9, 0, 0, 0, g(Yes, No, false, false, "", "PPM")},
- {0x33da, 0, 0, 0, g(Yes, No, false, false, "", "PR")},
- {0x33db, 0, 0, 0, g(Yes, No, false, false, "", "sr")},
- {0x33dc, 0, 0, 0, g(Yes, No, false, false, "", "Sv")},
- {0x33dd, 0, 0, 0, g(Yes, No, false, false, "", "Wb")},
- {0x33de, 0, 0, 0, g(Yes, No, false, false, "", "V∕m")},
- {0x33df, 0, 0, 0, g(Yes, No, false, false, "", "A∕m")},
- {0x33e0, 0, 0, 0, g(Yes, No, false, false, "", "1日")},
- {0x33e1, 0, 0, 0, g(Yes, No, false, false, "", "2日")},
- {0x33e2, 0, 0, 0, g(Yes, No, false, false, "", "3日")},
- {0x33e3, 0, 0, 0, g(Yes, No, false, false, "", "4日")},
- {0x33e4, 0, 0, 0, g(Yes, No, false, false, "", "5日")},
- {0x33e5, 0, 0, 0, g(Yes, No, false, false, "", "6日")},
- {0x33e6, 0, 0, 0, g(Yes, No, false, false, "", "7日")},
- {0x33e7, 0, 0, 0, g(Yes, No, false, false, "", "8日")},
- {0x33e8, 0, 0, 0, g(Yes, No, false, false, "", "9日")},
- {0x33e9, 0, 0, 0, g(Yes, No, false, false, "", "10日")},
- {0x33ea, 0, 0, 0, g(Yes, No, false, false, "", "11日")},
- {0x33eb, 0, 0, 0, g(Yes, No, false, false, "", "12日")},
- {0x33ec, 0, 0, 0, g(Yes, No, false, false, "", "13日")},
- {0x33ed, 0, 0, 0, g(Yes, No, false, false, "", "14日")},
- {0x33ee, 0, 0, 0, g(Yes, No, false, false, "", "15日")},
- {0x33ef, 0, 0, 0, g(Yes, No, false, false, "", "16日")},
- {0x33f0, 0, 0, 0, g(Yes, No, false, false, "", "17日")},
- {0x33f1, 0, 0, 0, g(Yes, No, false, false, "", "18日")},
- {0x33f2, 0, 0, 0, g(Yes, No, false, false, "", "19日")},
- {0x33f3, 0, 0, 0, g(Yes, No, false, false, "", "20日")},
- {0x33f4, 0, 0, 0, g(Yes, No, false, false, "", "21日")},
- {0x33f5, 0, 0, 0, g(Yes, No, false, false, "", "22日")},
- {0x33f6, 0, 0, 0, g(Yes, No, false, false, "", "23日")},
- {0x33f7, 0, 0, 0, g(Yes, No, false, false, "", "24日")},
- {0x33f8, 0, 0, 0, g(Yes, No, false, false, "", "25日")},
- {0x33f9, 0, 0, 0, g(Yes, No, false, false, "", "26日")},
- {0x33fa, 0, 0, 0, g(Yes, No, false, false, "", "27日")},
- {0x33fb, 0, 0, 0, g(Yes, No, false, false, "", "28日")},
- {0x33fc, 0, 0, 0, g(Yes, No, false, false, "", "29日")},
- {0x33fd, 0, 0, 0, g(Yes, No, false, false, "", "30日")},
- {0x33fe, 0, 0, 0, g(Yes, No, false, false, "", "31日")},
- {0x33ff, 0, 0, 0, g(Yes, No, false, false, "", "gal")},
- {0x3400, 0, 0, 0, f(Yes, false, "")},
- {0xa66f, 230, 1, 1, f(Yes, false, "")},
- {0xa670, 0, 0, 0, f(Yes, false, "")},
- {0xa674, 230, 1, 1, f(Yes, false, "")},
- {0xa67e, 0, 0, 0, f(Yes, false, "")},
- {0xa69c, 0, 0, 0, g(Yes, No, false, false, "", "ъ")},
- {0xa69d, 0, 0, 0, g(Yes, No, false, false, "", "ь")},
- {0xa69e, 230, 1, 1, f(Yes, false, "")},
- {0xa6a0, 0, 0, 0, f(Yes, false, "")},
- {0xa6f0, 230, 1, 1, f(Yes, false, "")},
- {0xa6f2, 0, 0, 0, f(Yes, false, "")},
- {0xa770, 0, 0, 0, g(Yes, No, false, false, "", "ꝯ")},
- {0xa771, 0, 0, 0, f(Yes, false, "")},
- {0xa7f8, 0, 0, 0, g(Yes, No, false, false, "", "Ħ")},
- {0xa7f9, 0, 0, 0, g(Yes, No, false, false, "", "œ")},
- {0xa7fa, 0, 0, 0, f(Yes, false, "")},
- {0xa806, 9, 1, 1, f(Yes, false, "")},
- {0xa807, 0, 0, 0, f(Yes, false, "")},
- {0xa8c4, 9, 1, 1, f(Yes, false, "")},
- {0xa8c5, 0, 0, 0, f(Yes, false, "")},
- {0xa8e0, 230, 1, 1, f(Yes, false, "")},
- {0xa8f2, 0, 0, 0, f(Yes, false, "")},
- {0xa92b, 220, 1, 1, f(Yes, false, "")},
- {0xa92e, 0, 0, 0, f(Yes, false, "")},
- {0xa953, 9, 1, 1, f(Yes, false, "")},
- {0xa954, 0, 0, 0, f(Yes, false, "")},
- {0xa9b3, 7, 1, 1, f(Yes, false, "")},
- {0xa9b4, 0, 0, 0, f(Yes, false, "")},
- {0xa9c0, 9, 1, 1, f(Yes, false, "")},
- {0xa9c1, 0, 0, 0, f(Yes, false, "")},
- {0xaab0, 230, 1, 1, f(Yes, false, "")},
- {0xaab1, 0, 0, 0, f(Yes, false, "")},
- {0xaab2, 230, 1, 1, f(Yes, false, "")},
- {0xaab4, 220, 1, 1, f(Yes, false, "")},
- {0xaab5, 0, 0, 0, f(Yes, false, "")},
- {0xaab7, 230, 1, 1, f(Yes, false, "")},
- {0xaab9, 0, 0, 0, f(Yes, false, "")},
- {0xaabe, 230, 1, 1, f(Yes, false, "")},
- {0xaac0, 0, 0, 0, f(Yes, false, "")},
- {0xaac1, 230, 1, 1, f(Yes, false, "")},
- {0xaac2, 0, 0, 0, f(Yes, false, "")},
- {0xaaf6, 9, 1, 1, f(Yes, false, "")},
- {0xaaf7, 0, 0, 0, f(Yes, false, "")},
- {0xab5c, 0, 0, 0, g(Yes, No, false, false, "", "ꜧ")},
- {0xab5d, 0, 0, 0, g(Yes, No, false, false, "", "ꬷ")},
- {0xab5e, 0, 0, 0, g(Yes, No, false, false, "", "ɫ")},
- {0xab5f, 0, 0, 0, g(Yes, No, false, false, "", "ꭒ")},
- {0xab60, 0, 0, 0, f(Yes, false, "")},
- {0xabed, 9, 1, 1, f(Yes, false, "")},
- {0xabee, 0, 0, 0, f(Yes, false, "")},
- {0xac00, 0, 0, 1, f(Yes, true, "")},
- {0xac01, 0, 0, 2, f(Yes, false, "")},
- {0xac1c, 0, 0, 1, f(Yes, true, "")},
- {0xac1d, 0, 0, 2, f(Yes, false, "")},
- {0xac38, 0, 0, 1, f(Yes, true, "")},
- {0xac39, 0, 0, 2, f(Yes, false, "")},
- {0xac54, 0, 0, 1, f(Yes, true, "")},
- {0xac55, 0, 0, 2, f(Yes, false, "")},
- {0xac70, 0, 0, 1, f(Yes, true, "")},
- {0xac71, 0, 0, 2, f(Yes, false, "")},
- {0xac8c, 0, 0, 1, f(Yes, true, "")},
- {0xac8d, 0, 0, 2, f(Yes, false, "")},
- {0xaca8, 0, 0, 1, f(Yes, true, "")},
- {0xaca9, 0, 0, 2, f(Yes, false, "")},
- {0xacc4, 0, 0, 1, f(Yes, true, "")},
- {0xacc5, 0, 0, 2, f(Yes, false, "")},
- {0xace0, 0, 0, 1, f(Yes, true, "")},
- {0xace1, 0, 0, 2, f(Yes, false, "")},
- {0xacfc, 0, 0, 1, f(Yes, true, "")},
- {0xacfd, 0, 0, 2, f(Yes, false, "")},
- {0xad18, 0, 0, 1, f(Yes, true, "")},
- {0xad19, 0, 0, 2, f(Yes, false, "")},
- {0xad34, 0, 0, 1, f(Yes, true, "")},
- {0xad35, 0, 0, 2, f(Yes, false, "")},
- {0xad50, 0, 0, 1, f(Yes, true, "")},
- {0xad51, 0, 0, 2, f(Yes, false, "")},
- {0xad6c, 0, 0, 1, f(Yes, true, "")},
- {0xad6d, 0, 0, 2, f(Yes, false, "")},
- {0xad88, 0, 0, 1, f(Yes, true, "")},
- {0xad89, 0, 0, 2, f(Yes, false, "")},
- {0xada4, 0, 0, 1, f(Yes, true, "")},
- {0xada5, 0, 0, 2, f(Yes, false, "")},
- {0xadc0, 0, 0, 1, f(Yes, true, "")},
- {0xadc1, 0, 0, 2, f(Yes, false, "")},
- {0xaddc, 0, 0, 1, f(Yes, true, "")},
- {0xaddd, 0, 0, 2, f(Yes, false, "")},
- {0xadf8, 0, 0, 1, f(Yes, true, "")},
- {0xadf9, 0, 0, 2, f(Yes, false, "")},
- {0xae14, 0, 0, 1, f(Yes, true, "")},
- {0xae15, 0, 0, 2, f(Yes, false, "")},
- {0xae30, 0, 0, 1, f(Yes, true, "")},
- {0xae31, 0, 0, 2, f(Yes, false, "")},
- {0xae4c, 0, 0, 1, f(Yes, true, "")},
- {0xae4d, 0, 0, 2, f(Yes, false, "")},
- {0xae68, 0, 0, 1, f(Yes, true, "")},
- {0xae69, 0, 0, 2, f(Yes, false, "")},
- {0xae84, 0, 0, 1, f(Yes, true, "")},
- {0xae85, 0, 0, 2, f(Yes, false, "")},
- {0xaea0, 0, 0, 1, f(Yes, true, "")},
- {0xaea1, 0, 0, 2, f(Yes, false, "")},
- {0xaebc, 0, 0, 1, f(Yes, true, "")},
- {0xaebd, 0, 0, 2, f(Yes, false, "")},
- {0xaed8, 0, 0, 1, f(Yes, true, "")},
- {0xaed9, 0, 0, 2, f(Yes, false, "")},
- {0xaef4, 0, 0, 1, f(Yes, true, "")},
- {0xaef5, 0, 0, 2, f(Yes, false, "")},
- {0xaf10, 0, 0, 1, f(Yes, true, "")},
- {0xaf11, 0, 0, 2, f(Yes, false, "")},
- {0xaf2c, 0, 0, 1, f(Yes, true, "")},
- {0xaf2d, 0, 0, 2, f(Yes, false, "")},
- {0xaf48, 0, 0, 1, f(Yes, true, "")},
- {0xaf49, 0, 0, 2, f(Yes, false, "")},
- {0xaf64, 0, 0, 1, f(Yes, true, "")},
- {0xaf65, 0, 0, 2, f(Yes, false, "")},
- {0xaf80, 0, 0, 1, f(Yes, true, "")},
- {0xaf81, 0, 0, 2, f(Yes, false, "")},
- {0xaf9c, 0, 0, 1, f(Yes, true, "")},
- {0xaf9d, 0, 0, 2, f(Yes, false, "")},
- {0xafb8, 0, 0, 1, f(Yes, true, "")},
- {0xafb9, 0, 0, 2, f(Yes, false, "")},
- {0xafd4, 0, 0, 1, f(Yes, true, "")},
- {0xafd5, 0, 0, 2, f(Yes, false, "")},
- {0xaff0, 0, 0, 1, f(Yes, true, "")},
- {0xaff1, 0, 0, 2, f(Yes, false, "")},
- {0xb00c, 0, 0, 1, f(Yes, true, "")},
- {0xb00d, 0, 0, 2, f(Yes, false, "")},
- {0xb028, 0, 0, 1, f(Yes, true, "")},
- {0xb029, 0, 0, 2, f(Yes, false, "")},
- {0xb044, 0, 0, 1, f(Yes, true, "")},
- {0xb045, 0, 0, 2, f(Yes, false, "")},
- {0xb060, 0, 0, 1, f(Yes, true, "")},
- {0xb061, 0, 0, 2, f(Yes, false, "")},
- {0xb07c, 0, 0, 1, f(Yes, true, "")},
- {0xb07d, 0, 0, 2, f(Yes, false, "")},
- {0xb098, 0, 0, 1, f(Yes, true, "")},
- {0xb099, 0, 0, 2, f(Yes, false, "")},
- {0xb0b4, 0, 0, 1, f(Yes, true, "")},
- {0xb0b5, 0, 0, 2, f(Yes, false, "")},
- {0xb0d0, 0, 0, 1, f(Yes, true, "")},
- {0xb0d1, 0, 0, 2, f(Yes, false, "")},
- {0xb0ec, 0, 0, 1, f(Yes, true, "")},
- {0xb0ed, 0, 0, 2, f(Yes, false, "")},
- {0xb108, 0, 0, 1, f(Yes, true, "")},
- {0xb109, 0, 0, 2, f(Yes, false, "")},
- {0xb124, 0, 0, 1, f(Yes, true, "")},
- {0xb125, 0, 0, 2, f(Yes, false, "")},
- {0xb140, 0, 0, 1, f(Yes, true, "")},
- {0xb141, 0, 0, 2, f(Yes, false, "")},
- {0xb15c, 0, 0, 1, f(Yes, true, "")},
- {0xb15d, 0, 0, 2, f(Yes, false, "")},
- {0xb178, 0, 0, 1, f(Yes, true, "")},
- {0xb179, 0, 0, 2, f(Yes, false, "")},
- {0xb194, 0, 0, 1, f(Yes, true, "")},
- {0xb195, 0, 0, 2, f(Yes, false, "")},
- {0xb1b0, 0, 0, 1, f(Yes, true, "")},
- {0xb1b1, 0, 0, 2, f(Yes, false, "")},
- {0xb1cc, 0, 0, 1, f(Yes, true, "")},
- {0xb1cd, 0, 0, 2, f(Yes, false, "")},
- {0xb1e8, 0, 0, 1, f(Yes, true, "")},
- {0xb1e9, 0, 0, 2, f(Yes, false, "")},
- {0xb204, 0, 0, 1, f(Yes, true, "")},
- {0xb205, 0, 0, 2, f(Yes, false, "")},
- {0xb220, 0, 0, 1, f(Yes, true, "")},
- {0xb221, 0, 0, 2, f(Yes, false, "")},
- {0xb23c, 0, 0, 1, f(Yes, true, "")},
- {0xb23d, 0, 0, 2, f(Yes, false, "")},
- {0xb258, 0, 0, 1, f(Yes, true, "")},
- {0xb259, 0, 0, 2, f(Yes, false, "")},
- {0xb274, 0, 0, 1, f(Yes, true, "")},
- {0xb275, 0, 0, 2, f(Yes, false, "")},
- {0xb290, 0, 0, 1, f(Yes, true, "")},
- {0xb291, 0, 0, 2, f(Yes, false, "")},
- {0xb2ac, 0, 0, 1, f(Yes, true, "")},
- {0xb2ad, 0, 0, 2, f(Yes, false, "")},
- {0xb2c8, 0, 0, 1, f(Yes, true, "")},
- {0xb2c9, 0, 0, 2, f(Yes, false, "")},
- {0xb2e4, 0, 0, 1, f(Yes, true, "")},
- {0xb2e5, 0, 0, 2, f(Yes, false, "")},
- {0xb300, 0, 0, 1, f(Yes, true, "")},
- {0xb301, 0, 0, 2, f(Yes, false, "")},
- {0xb31c, 0, 0, 1, f(Yes, true, "")},
- {0xb31d, 0, 0, 2, f(Yes, false, "")},
- {0xb338, 0, 0, 1, f(Yes, true, "")},
- {0xb339, 0, 0, 2, f(Yes, false, "")},
- {0xb354, 0, 0, 1, f(Yes, true, "")},
- {0xb355, 0, 0, 2, f(Yes, false, "")},
- {0xb370, 0, 0, 1, f(Yes, true, "")},
- {0xb371, 0, 0, 2, f(Yes, false, "")},
- {0xb38c, 0, 0, 1, f(Yes, true, "")},
- {0xb38d, 0, 0, 2, f(Yes, false, "")},
- {0xb3a8, 0, 0, 1, f(Yes, true, "")},
- {0xb3a9, 0, 0, 2, f(Yes, false, "")},
- {0xb3c4, 0, 0, 1, f(Yes, true, "")},
- {0xb3c5, 0, 0, 2, f(Yes, false, "")},
- {0xb3e0, 0, 0, 1, f(Yes, true, "")},
- {0xb3e1, 0, 0, 2, f(Yes, false, "")},
- {0xb3fc, 0, 0, 1, f(Yes, true, "")},
- {0xb3fd, 0, 0, 2, f(Yes, false, "")},
- {0xb418, 0, 0, 1, f(Yes, true, "")},
- {0xb419, 0, 0, 2, f(Yes, false, "")},
- {0xb434, 0, 0, 1, f(Yes, true, "")},
- {0xb435, 0, 0, 2, f(Yes, false, "")},
- {0xb450, 0, 0, 1, f(Yes, true, "")},
- {0xb451, 0, 0, 2, f(Yes, false, "")},
- {0xb46c, 0, 0, 1, f(Yes, true, "")},
- {0xb46d, 0, 0, 2, f(Yes, false, "")},
- {0xb488, 0, 0, 1, f(Yes, true, "")},
- {0xb489, 0, 0, 2, f(Yes, false, "")},
- {0xb4a4, 0, 0, 1, f(Yes, true, "")},
- {0xb4a5, 0, 0, 2, f(Yes, false, "")},
- {0xb4c0, 0, 0, 1, f(Yes, true, "")},
- {0xb4c1, 0, 0, 2, f(Yes, false, "")},
- {0xb4dc, 0, 0, 1, f(Yes, true, "")},
- {0xb4dd, 0, 0, 2, f(Yes, false, "")},
- {0xb4f8, 0, 0, 1, f(Yes, true, "")},
- {0xb4f9, 0, 0, 2, f(Yes, false, "")},
- {0xb514, 0, 0, 1, f(Yes, true, "")},
- {0xb515, 0, 0, 2, f(Yes, false, "")},
- {0xb530, 0, 0, 1, f(Yes, true, "")},
- {0xb531, 0, 0, 2, f(Yes, false, "")},
- {0xb54c, 0, 0, 1, f(Yes, true, "")},
- {0xb54d, 0, 0, 2, f(Yes, false, "")},
- {0xb568, 0, 0, 1, f(Yes, true, "")},
- {0xb569, 0, 0, 2, f(Yes, false, "")},
- {0xb584, 0, 0, 1, f(Yes, true, "")},
- {0xb585, 0, 0, 2, f(Yes, false, "")},
- {0xb5a0, 0, 0, 1, f(Yes, true, "")},
- {0xb5a1, 0, 0, 2, f(Yes, false, "")},
- {0xb5bc, 0, 0, 1, f(Yes, true, "")},
- {0xb5bd, 0, 0, 2, f(Yes, false, "")},
- {0xb5d8, 0, 0, 1, f(Yes, true, "")},
- {0xb5d9, 0, 0, 2, f(Yes, false, "")},
- {0xb5f4, 0, 0, 1, f(Yes, true, "")},
- {0xb5f5, 0, 0, 2, f(Yes, false, "")},
- {0xb610, 0, 0, 1, f(Yes, true, "")},
- {0xb611, 0, 0, 2, f(Yes, false, "")},
- {0xb62c, 0, 0, 1, f(Yes, true, "")},
- {0xb62d, 0, 0, 2, f(Yes, false, "")},
- {0xb648, 0, 0, 1, f(Yes, true, "")},
- {0xb649, 0, 0, 2, f(Yes, false, "")},
- {0xb664, 0, 0, 1, f(Yes, true, "")},
- {0xb665, 0, 0, 2, f(Yes, false, "")},
- {0xb680, 0, 0, 1, f(Yes, true, "")},
- {0xb681, 0, 0, 2, f(Yes, false, "")},
- {0xb69c, 0, 0, 1, f(Yes, true, "")},
- {0xb69d, 0, 0, 2, f(Yes, false, "")},
- {0xb6b8, 0, 0, 1, f(Yes, true, "")},
- {0xb6b9, 0, 0, 2, f(Yes, false, "")},
- {0xb6d4, 0, 0, 1, f(Yes, true, "")},
- {0xb6d5, 0, 0, 2, f(Yes, false, "")},
- {0xb6f0, 0, 0, 1, f(Yes, true, "")},
- {0xb6f1, 0, 0, 2, f(Yes, false, "")},
- {0xb70c, 0, 0, 1, f(Yes, true, "")},
- {0xb70d, 0, 0, 2, f(Yes, false, "")},
- {0xb728, 0, 0, 1, f(Yes, true, "")},
- {0xb729, 0, 0, 2, f(Yes, false, "")},
- {0xb744, 0, 0, 1, f(Yes, true, "")},
- {0xb745, 0, 0, 2, f(Yes, false, "")},
- {0xb760, 0, 0, 1, f(Yes, true, "")},
- {0xb761, 0, 0, 2, f(Yes, false, "")},
- {0xb77c, 0, 0, 1, f(Yes, true, "")},
- {0xb77d, 0, 0, 2, f(Yes, false, "")},
- {0xb798, 0, 0, 1, f(Yes, true, "")},
- {0xb799, 0, 0, 2, f(Yes, false, "")},
- {0xb7b4, 0, 0, 1, f(Yes, true, "")},
- {0xb7b5, 0, 0, 2, f(Yes, false, "")},
- {0xb7d0, 0, 0, 1, f(Yes, true, "")},
- {0xb7d1, 0, 0, 2, f(Yes, false, "")},
- {0xb7ec, 0, 0, 1, f(Yes, true, "")},
- {0xb7ed, 0, 0, 2, f(Yes, false, "")},
- {0xb808, 0, 0, 1, f(Yes, true, "")},
- {0xb809, 0, 0, 2, f(Yes, false, "")},
- {0xb824, 0, 0, 1, f(Yes, true, "")},
- {0xb825, 0, 0, 2, f(Yes, false, "")},
- {0xb840, 0, 0, 1, f(Yes, true, "")},
- {0xb841, 0, 0, 2, f(Yes, false, "")},
- {0xb85c, 0, 0, 1, f(Yes, true, "")},
- {0xb85d, 0, 0, 2, f(Yes, false, "")},
- {0xb878, 0, 0, 1, f(Yes, true, "")},
- {0xb879, 0, 0, 2, f(Yes, false, "")},
- {0xb894, 0, 0, 1, f(Yes, true, "")},
- {0xb895, 0, 0, 2, f(Yes, false, "")},
- {0xb8b0, 0, 0, 1, f(Yes, true, "")},
- {0xb8b1, 0, 0, 2, f(Yes, false, "")},
- {0xb8cc, 0, 0, 1, f(Yes, true, "")},
- {0xb8cd, 0, 0, 2, f(Yes, false, "")},
- {0xb8e8, 0, 0, 1, f(Yes, true, "")},
- {0xb8e9, 0, 0, 2, f(Yes, false, "")},
- {0xb904, 0, 0, 1, f(Yes, true, "")},
- {0xb905, 0, 0, 2, f(Yes, false, "")},
- {0xb920, 0, 0, 1, f(Yes, true, "")},
- {0xb921, 0, 0, 2, f(Yes, false, "")},
- {0xb93c, 0, 0, 1, f(Yes, true, "")},
- {0xb93d, 0, 0, 2, f(Yes, false, "")},
- {0xb958, 0, 0, 1, f(Yes, true, "")},
- {0xb959, 0, 0, 2, f(Yes, false, "")},
- {0xb974, 0, 0, 1, f(Yes, true, "")},
- {0xb975, 0, 0, 2, f(Yes, false, "")},
- {0xb990, 0, 0, 1, f(Yes, true, "")},
- {0xb991, 0, 0, 2, f(Yes, false, "")},
- {0xb9ac, 0, 0, 1, f(Yes, true, "")},
- {0xb9ad, 0, 0, 2, f(Yes, false, "")},
- {0xb9c8, 0, 0, 1, f(Yes, true, "")},
- {0xb9c9, 0, 0, 2, f(Yes, false, "")},
- {0xb9e4, 0, 0, 1, f(Yes, true, "")},
- {0xb9e5, 0, 0, 2, f(Yes, false, "")},
- {0xba00, 0, 0, 1, f(Yes, true, "")},
- {0xba01, 0, 0, 2, f(Yes, false, "")},
- {0xba1c, 0, 0, 1, f(Yes, true, "")},
- {0xba1d, 0, 0, 2, f(Yes, false, "")},
- {0xba38, 0, 0, 1, f(Yes, true, "")},
- {0xba39, 0, 0, 2, f(Yes, false, "")},
- {0xba54, 0, 0, 1, f(Yes, true, "")},
- {0xba55, 0, 0, 2, f(Yes, false, "")},
- {0xba70, 0, 0, 1, f(Yes, true, "")},
- {0xba71, 0, 0, 2, f(Yes, false, "")},
- {0xba8c, 0, 0, 1, f(Yes, true, "")},
- {0xba8d, 0, 0, 2, f(Yes, false, "")},
- {0xbaa8, 0, 0, 1, f(Yes, true, "")},
- {0xbaa9, 0, 0, 2, f(Yes, false, "")},
- {0xbac4, 0, 0, 1, f(Yes, true, "")},
- {0xbac5, 0, 0, 2, f(Yes, false, "")},
- {0xbae0, 0, 0, 1, f(Yes, true, "")},
- {0xbae1, 0, 0, 2, f(Yes, false, "")},
- {0xbafc, 0, 0, 1, f(Yes, true, "")},
- {0xbafd, 0, 0, 2, f(Yes, false, "")},
- {0xbb18, 0, 0, 1, f(Yes, true, "")},
- {0xbb19, 0, 0, 2, f(Yes, false, "")},
- {0xbb34, 0, 0, 1, f(Yes, true, "")},
- {0xbb35, 0, 0, 2, f(Yes, false, "")},
- {0xbb50, 0, 0, 1, f(Yes, true, "")},
- {0xbb51, 0, 0, 2, f(Yes, false, "")},
- {0xbb6c, 0, 0, 1, f(Yes, true, "")},
- {0xbb6d, 0, 0, 2, f(Yes, false, "")},
- {0xbb88, 0, 0, 1, f(Yes, true, "")},
- {0xbb89, 0, 0, 2, f(Yes, false, "")},
- {0xbba4, 0, 0, 1, f(Yes, true, "")},
- {0xbba5, 0, 0, 2, f(Yes, false, "")},
- {0xbbc0, 0, 0, 1, f(Yes, true, "")},
- {0xbbc1, 0, 0, 2, f(Yes, false, "")},
- {0xbbdc, 0, 0, 1, f(Yes, true, "")},
- {0xbbdd, 0, 0, 2, f(Yes, false, "")},
- {0xbbf8, 0, 0, 1, f(Yes, true, "")},
- {0xbbf9, 0, 0, 2, f(Yes, false, "")},
- {0xbc14, 0, 0, 1, f(Yes, true, "")},
- {0xbc15, 0, 0, 2, f(Yes, false, "")},
- {0xbc30, 0, 0, 1, f(Yes, true, "")},
- {0xbc31, 0, 0, 2, f(Yes, false, "")},
- {0xbc4c, 0, 0, 1, f(Yes, true, "")},
- {0xbc4d, 0, 0, 2, f(Yes, false, "")},
- {0xbc68, 0, 0, 1, f(Yes, true, "")},
- {0xbc69, 0, 0, 2, f(Yes, false, "")},
- {0xbc84, 0, 0, 1, f(Yes, true, "")},
- {0xbc85, 0, 0, 2, f(Yes, false, "")},
- {0xbca0, 0, 0, 1, f(Yes, true, "")},
- {0xbca1, 0, 0, 2, f(Yes, false, "")},
- {0xbcbc, 0, 0, 1, f(Yes, true, "")},
- {0xbcbd, 0, 0, 2, f(Yes, false, "")},
- {0xbcd8, 0, 0, 1, f(Yes, true, "")},
- {0xbcd9, 0, 0, 2, f(Yes, false, "")},
- {0xbcf4, 0, 0, 1, f(Yes, true, "")},
- {0xbcf5, 0, 0, 2, f(Yes, false, "")},
- {0xbd10, 0, 0, 1, f(Yes, true, "")},
- {0xbd11, 0, 0, 2, f(Yes, false, "")},
- {0xbd2c, 0, 0, 1, f(Yes, true, "")},
- {0xbd2d, 0, 0, 2, f(Yes, false, "")},
- {0xbd48, 0, 0, 1, f(Yes, true, "")},
- {0xbd49, 0, 0, 2, f(Yes, false, "")},
- {0xbd64, 0, 0, 1, f(Yes, true, "")},
- {0xbd65, 0, 0, 2, f(Yes, false, "")},
- {0xbd80, 0, 0, 1, f(Yes, true, "")},
- {0xbd81, 0, 0, 2, f(Yes, false, "")},
- {0xbd9c, 0, 0, 1, f(Yes, true, "")},
- {0xbd9d, 0, 0, 2, f(Yes, false, "")},
- {0xbdb8, 0, 0, 1, f(Yes, true, "")},
- {0xbdb9, 0, 0, 2, f(Yes, false, "")},
- {0xbdd4, 0, 0, 1, f(Yes, true, "")},
- {0xbdd5, 0, 0, 2, f(Yes, false, "")},
- {0xbdf0, 0, 0, 1, f(Yes, true, "")},
- {0xbdf1, 0, 0, 2, f(Yes, false, "")},
- {0xbe0c, 0, 0, 1, f(Yes, true, "")},
- {0xbe0d, 0, 0, 2, f(Yes, false, "")},
- {0xbe28, 0, 0, 1, f(Yes, true, "")},
- {0xbe29, 0, 0, 2, f(Yes, false, "")},
- {0xbe44, 0, 0, 1, f(Yes, true, "")},
- {0xbe45, 0, 0, 2, f(Yes, false, "")},
- {0xbe60, 0, 0, 1, f(Yes, true, "")},
- {0xbe61, 0, 0, 2, f(Yes, false, "")},
- {0xbe7c, 0, 0, 1, f(Yes, true, "")},
- {0xbe7d, 0, 0, 2, f(Yes, false, "")},
- {0xbe98, 0, 0, 1, f(Yes, true, "")},
- {0xbe99, 0, 0, 2, f(Yes, false, "")},
- {0xbeb4, 0, 0, 1, f(Yes, true, "")},
- {0xbeb5, 0, 0, 2, f(Yes, false, "")},
- {0xbed0, 0, 0, 1, f(Yes, true, "")},
- {0xbed1, 0, 0, 2, f(Yes, false, "")},
- {0xbeec, 0, 0, 1, f(Yes, true, "")},
- {0xbeed, 0, 0, 2, f(Yes, false, "")},
- {0xbf08, 0, 0, 1, f(Yes, true, "")},
- {0xbf09, 0, 0, 2, f(Yes, false, "")},
- {0xbf24, 0, 0, 1, f(Yes, true, "")},
- {0xbf25, 0, 0, 2, f(Yes, false, "")},
- {0xbf40, 0, 0, 1, f(Yes, true, "")},
- {0xbf41, 0, 0, 2, f(Yes, false, "")},
- {0xbf5c, 0, 0, 1, f(Yes, true, "")},
- {0xbf5d, 0, 0, 2, f(Yes, false, "")},
- {0xbf78, 0, 0, 1, f(Yes, true, "")},
- {0xbf79, 0, 0, 2, f(Yes, false, "")},
- {0xbf94, 0, 0, 1, f(Yes, true, "")},
- {0xbf95, 0, 0, 2, f(Yes, false, "")},
- {0xbfb0, 0, 0, 1, f(Yes, true, "")},
- {0xbfb1, 0, 0, 2, f(Yes, false, "")},
- {0xbfcc, 0, 0, 1, f(Yes, true, "")},
- {0xbfcd, 0, 0, 2, f(Yes, false, "")},
- {0xbfe8, 0, 0, 1, f(Yes, true, "")},
- {0xbfe9, 0, 0, 2, f(Yes, false, "")},
- {0xc004, 0, 0, 1, f(Yes, true, "")},
- {0xc005, 0, 0, 2, f(Yes, false, "")},
- {0xc020, 0, 0, 1, f(Yes, true, "")},
- {0xc021, 0, 0, 2, f(Yes, false, "")},
- {0xc03c, 0, 0, 1, f(Yes, true, "")},
- {0xc03d, 0, 0, 2, f(Yes, false, "")},
- {0xc058, 0, 0, 1, f(Yes, true, "")},
- {0xc059, 0, 0, 2, f(Yes, false, "")},
- {0xc074, 0, 0, 1, f(Yes, true, "")},
- {0xc075, 0, 0, 2, f(Yes, false, "")},
- {0xc090, 0, 0, 1, f(Yes, true, "")},
- {0xc091, 0, 0, 2, f(Yes, false, "")},
- {0xc0ac, 0, 0, 1, f(Yes, true, "")},
- {0xc0ad, 0, 0, 2, f(Yes, false, "")},
- {0xc0c8, 0, 0, 1, f(Yes, true, "")},
- {0xc0c9, 0, 0, 2, f(Yes, false, "")},
- {0xc0e4, 0, 0, 1, f(Yes, true, "")},
- {0xc0e5, 0, 0, 2, f(Yes, false, "")},
- {0xc100, 0, 0, 1, f(Yes, true, "")},
- {0xc101, 0, 0, 2, f(Yes, false, "")},
- {0xc11c, 0, 0, 1, f(Yes, true, "")},
- {0xc11d, 0, 0, 2, f(Yes, false, "")},
- {0xc138, 0, 0, 1, f(Yes, true, "")},
- {0xc139, 0, 0, 2, f(Yes, false, "")},
- {0xc154, 0, 0, 1, f(Yes, true, "")},
- {0xc155, 0, 0, 2, f(Yes, false, "")},
- {0xc170, 0, 0, 1, f(Yes, true, "")},
- {0xc171, 0, 0, 2, f(Yes, false, "")},
- {0xc18c, 0, 0, 1, f(Yes, true, "")},
- {0xc18d, 0, 0, 2, f(Yes, false, "")},
- {0xc1a8, 0, 0, 1, f(Yes, true, "")},
- {0xc1a9, 0, 0, 2, f(Yes, false, "")},
- {0xc1c4, 0, 0, 1, f(Yes, true, "")},
- {0xc1c5, 0, 0, 2, f(Yes, false, "")},
- {0xc1e0, 0, 0, 1, f(Yes, true, "")},
- {0xc1e1, 0, 0, 2, f(Yes, false, "")},
- {0xc1fc, 0, 0, 1, f(Yes, true, "")},
- {0xc1fd, 0, 0, 2, f(Yes, false, "")},
- {0xc218, 0, 0, 1, f(Yes, true, "")},
- {0xc219, 0, 0, 2, f(Yes, false, "")},
- {0xc234, 0, 0, 1, f(Yes, true, "")},
- {0xc235, 0, 0, 2, f(Yes, false, "")},
- {0xc250, 0, 0, 1, f(Yes, true, "")},
- {0xc251, 0, 0, 2, f(Yes, false, "")},
- {0xc26c, 0, 0, 1, f(Yes, true, "")},
- {0xc26d, 0, 0, 2, f(Yes, false, "")},
- {0xc288, 0, 0, 1, f(Yes, true, "")},
- {0xc289, 0, 0, 2, f(Yes, false, "")},
- {0xc2a4, 0, 0, 1, f(Yes, true, "")},
- {0xc2a5, 0, 0, 2, f(Yes, false, "")},
- {0xc2c0, 0, 0, 1, f(Yes, true, "")},
- {0xc2c1, 0, 0, 2, f(Yes, false, "")},
- {0xc2dc, 0, 0, 1, f(Yes, true, "")},
- {0xc2dd, 0, 0, 2, f(Yes, false, "")},
- {0xc2f8, 0, 0, 1, f(Yes, true, "")},
- {0xc2f9, 0, 0, 2, f(Yes, false, "")},
- {0xc314, 0, 0, 1, f(Yes, true, "")},
- {0xc315, 0, 0, 2, f(Yes, false, "")},
- {0xc330, 0, 0, 1, f(Yes, true, "")},
- {0xc331, 0, 0, 2, f(Yes, false, "")},
- {0xc34c, 0, 0, 1, f(Yes, true, "")},
- {0xc34d, 0, 0, 2, f(Yes, false, "")},
- {0xc368, 0, 0, 1, f(Yes, true, "")},
- {0xc369, 0, 0, 2, f(Yes, false, "")},
- {0xc384, 0, 0, 1, f(Yes, true, "")},
- {0xc385, 0, 0, 2, f(Yes, false, "")},
- {0xc3a0, 0, 0, 1, f(Yes, true, "")},
- {0xc3a1, 0, 0, 2, f(Yes, false, "")},
- {0xc3bc, 0, 0, 1, f(Yes, true, "")},
- {0xc3bd, 0, 0, 2, f(Yes, false, "")},
- {0xc3d8, 0, 0, 1, f(Yes, true, "")},
- {0xc3d9, 0, 0, 2, f(Yes, false, "")},
- {0xc3f4, 0, 0, 1, f(Yes, true, "")},
- {0xc3f5, 0, 0, 2, f(Yes, false, "")},
- {0xc410, 0, 0, 1, f(Yes, true, "")},
- {0xc411, 0, 0, 2, f(Yes, false, "")},
- {0xc42c, 0, 0, 1, f(Yes, true, "")},
- {0xc42d, 0, 0, 2, f(Yes, false, "")},
- {0xc448, 0, 0, 1, f(Yes, true, "")},
- {0xc449, 0, 0, 2, f(Yes, false, "")},
- {0xc464, 0, 0, 1, f(Yes, true, "")},
- {0xc465, 0, 0, 2, f(Yes, false, "")},
- {0xc480, 0, 0, 1, f(Yes, true, "")},
- {0xc481, 0, 0, 2, f(Yes, false, "")},
- {0xc49c, 0, 0, 1, f(Yes, true, "")},
- {0xc49d, 0, 0, 2, f(Yes, false, "")},
- {0xc4b8, 0, 0, 1, f(Yes, true, "")},
- {0xc4b9, 0, 0, 2, f(Yes, false, "")},
- {0xc4d4, 0, 0, 1, f(Yes, true, "")},
- {0xc4d5, 0, 0, 2, f(Yes, false, "")},
- {0xc4f0, 0, 0, 1, f(Yes, true, "")},
- {0xc4f1, 0, 0, 2, f(Yes, false, "")},
- {0xc50c, 0, 0, 1, f(Yes, true, "")},
- {0xc50d, 0, 0, 2, f(Yes, false, "")},
- {0xc528, 0, 0, 1, f(Yes, true, "")},
- {0xc529, 0, 0, 2, f(Yes, false, "")},
- {0xc544, 0, 0, 1, f(Yes, true, "")},
- {0xc545, 0, 0, 2, f(Yes, false, "")},
- {0xc560, 0, 0, 1, f(Yes, true, "")},
- {0xc561, 0, 0, 2, f(Yes, false, "")},
- {0xc57c, 0, 0, 1, f(Yes, true, "")},
- {0xc57d, 0, 0, 2, f(Yes, false, "")},
- {0xc598, 0, 0, 1, f(Yes, true, "")},
- {0xc599, 0, 0, 2, f(Yes, false, "")},
- {0xc5b4, 0, 0, 1, f(Yes, true, "")},
- {0xc5b5, 0, 0, 2, f(Yes, false, "")},
- {0xc5d0, 0, 0, 1, f(Yes, true, "")},
- {0xc5d1, 0, 0, 2, f(Yes, false, "")},
- {0xc5ec, 0, 0, 1, f(Yes, true, "")},
- {0xc5ed, 0, 0, 2, f(Yes, false, "")},
- {0xc608, 0, 0, 1, f(Yes, true, "")},
- {0xc609, 0, 0, 2, f(Yes, false, "")},
- {0xc624, 0, 0, 1, f(Yes, true, "")},
- {0xc625, 0, 0, 2, f(Yes, false, "")},
- {0xc640, 0, 0, 1, f(Yes, true, "")},
- {0xc641, 0, 0, 2, f(Yes, false, "")},
- {0xc65c, 0, 0, 1, f(Yes, true, "")},
- {0xc65d, 0, 0, 2, f(Yes, false, "")},
- {0xc678, 0, 0, 1, f(Yes, true, "")},
- {0xc679, 0, 0, 2, f(Yes, false, "")},
- {0xc694, 0, 0, 1, f(Yes, true, "")},
- {0xc695, 0, 0, 2, f(Yes, false, "")},
- {0xc6b0, 0, 0, 1, f(Yes, true, "")},
- {0xc6b1, 0, 0, 2, f(Yes, false, "")},
- {0xc6cc, 0, 0, 1, f(Yes, true, "")},
- {0xc6cd, 0, 0, 2, f(Yes, false, "")},
- {0xc6e8, 0, 0, 1, f(Yes, true, "")},
- {0xc6e9, 0, 0, 2, f(Yes, false, "")},
- {0xc704, 0, 0, 1, f(Yes, true, "")},
- {0xc705, 0, 0, 2, f(Yes, false, "")},
- {0xc720, 0, 0, 1, f(Yes, true, "")},
- {0xc721, 0, 0, 2, f(Yes, false, "")},
- {0xc73c, 0, 0, 1, f(Yes, true, "")},
- {0xc73d, 0, 0, 2, f(Yes, false, "")},
- {0xc758, 0, 0, 1, f(Yes, true, "")},
- {0xc759, 0, 0, 2, f(Yes, false, "")},
- {0xc774, 0, 0, 1, f(Yes, true, "")},
- {0xc775, 0, 0, 2, f(Yes, false, "")},
- {0xc790, 0, 0, 1, f(Yes, true, "")},
- {0xc791, 0, 0, 2, f(Yes, false, "")},
- {0xc7ac, 0, 0, 1, f(Yes, true, "")},
- {0xc7ad, 0, 0, 2, f(Yes, false, "")},
- {0xc7c8, 0, 0, 1, f(Yes, true, "")},
- {0xc7c9, 0, 0, 2, f(Yes, false, "")},
- {0xc7e4, 0, 0, 1, f(Yes, true, "")},
- {0xc7e5, 0, 0, 2, f(Yes, false, "")},
- {0xc800, 0, 0, 1, f(Yes, true, "")},
- {0xc801, 0, 0, 2, f(Yes, false, "")},
- {0xc81c, 0, 0, 1, f(Yes, true, "")},
- {0xc81d, 0, 0, 2, f(Yes, false, "")},
- {0xc838, 0, 0, 1, f(Yes, true, "")},
- {0xc839, 0, 0, 2, f(Yes, false, "")},
- {0xc854, 0, 0, 1, f(Yes, true, "")},
- {0xc855, 0, 0, 2, f(Yes, false, "")},
- {0xc870, 0, 0, 1, f(Yes, true, "")},
- {0xc871, 0, 0, 2, f(Yes, false, "")},
- {0xc88c, 0, 0, 1, f(Yes, true, "")},
- {0xc88d, 0, 0, 2, f(Yes, false, "")},
- {0xc8a8, 0, 0, 1, f(Yes, true, "")},
- {0xc8a9, 0, 0, 2, f(Yes, false, "")},
- {0xc8c4, 0, 0, 1, f(Yes, true, "")},
- {0xc8c5, 0, 0, 2, f(Yes, false, "")},
- {0xc8e0, 0, 0, 1, f(Yes, true, "")},
- {0xc8e1, 0, 0, 2, f(Yes, false, "")},
- {0xc8fc, 0, 0, 1, f(Yes, true, "")},
- {0xc8fd, 0, 0, 2, f(Yes, false, "")},
- {0xc918, 0, 0, 1, f(Yes, true, "")},
- {0xc919, 0, 0, 2, f(Yes, false, "")},
- {0xc934, 0, 0, 1, f(Yes, true, "")},
- {0xc935, 0, 0, 2, f(Yes, false, "")},
- {0xc950, 0, 0, 1, f(Yes, true, "")},
- {0xc951, 0, 0, 2, f(Yes, false, "")},
- {0xc96c, 0, 0, 1, f(Yes, true, "")},
- {0xc96d, 0, 0, 2, f(Yes, false, "")},
- {0xc988, 0, 0, 1, f(Yes, true, "")},
- {0xc989, 0, 0, 2, f(Yes, false, "")},
- {0xc9a4, 0, 0, 1, f(Yes, true, "")},
- {0xc9a5, 0, 0, 2, f(Yes, false, "")},
- {0xc9c0, 0, 0, 1, f(Yes, true, "")},
- {0xc9c1, 0, 0, 2, f(Yes, false, "")},
- {0xc9dc, 0, 0, 1, f(Yes, true, "")},
- {0xc9dd, 0, 0, 2, f(Yes, false, "")},
- {0xc9f8, 0, 0, 1, f(Yes, true, "")},
- {0xc9f9, 0, 0, 2, f(Yes, false, "")},
- {0xca14, 0, 0, 1, f(Yes, true, "")},
- {0xca15, 0, 0, 2, f(Yes, false, "")},
- {0xca30, 0, 0, 1, f(Yes, true, "")},
- {0xca31, 0, 0, 2, f(Yes, false, "")},
- {0xca4c, 0, 0, 1, f(Yes, true, "")},
- {0xca4d, 0, 0, 2, f(Yes, false, "")},
- {0xca68, 0, 0, 1, f(Yes, true, "")},
- {0xca69, 0, 0, 2, f(Yes, false, "")},
- {0xca84, 0, 0, 1, f(Yes, true, "")},
- {0xca85, 0, 0, 2, f(Yes, false, "")},
- {0xcaa0, 0, 0, 1, f(Yes, true, "")},
- {0xcaa1, 0, 0, 2, f(Yes, false, "")},
- {0xcabc, 0, 0, 1, f(Yes, true, "")},
- {0xcabd, 0, 0, 2, f(Yes, false, "")},
- {0xcad8, 0, 0, 1, f(Yes, true, "")},
- {0xcad9, 0, 0, 2, f(Yes, false, "")},
- {0xcaf4, 0, 0, 1, f(Yes, true, "")},
- {0xcaf5, 0, 0, 2, f(Yes, false, "")},
- {0xcb10, 0, 0, 1, f(Yes, true, "")},
- {0xcb11, 0, 0, 2, f(Yes, false, "")},
- {0xcb2c, 0, 0, 1, f(Yes, true, "")},
- {0xcb2d, 0, 0, 2, f(Yes, false, "")},
- {0xcb48, 0, 0, 1, f(Yes, true, "")},
- {0xcb49, 0, 0, 2, f(Yes, false, "")},
- {0xcb64, 0, 0, 1, f(Yes, true, "")},
- {0xcb65, 0, 0, 2, f(Yes, false, "")},
- {0xcb80, 0, 0, 1, f(Yes, true, "")},
- {0xcb81, 0, 0, 2, f(Yes, false, "")},
- {0xcb9c, 0, 0, 1, f(Yes, true, "")},
- {0xcb9d, 0, 0, 2, f(Yes, false, "")},
- {0xcbb8, 0, 0, 1, f(Yes, true, "")},
- {0xcbb9, 0, 0, 2, f(Yes, false, "")},
- {0xcbd4, 0, 0, 1, f(Yes, true, "")},
- {0xcbd5, 0, 0, 2, f(Yes, false, "")},
- {0xcbf0, 0, 0, 1, f(Yes, true, "")},
- {0xcbf1, 0, 0, 2, f(Yes, false, "")},
- {0xcc0c, 0, 0, 1, f(Yes, true, "")},
- {0xcc0d, 0, 0, 2, f(Yes, false, "")},
- {0xcc28, 0, 0, 1, f(Yes, true, "")},
- {0xcc29, 0, 0, 2, f(Yes, false, "")},
- {0xcc44, 0, 0, 1, f(Yes, true, "")},
- {0xcc45, 0, 0, 2, f(Yes, false, "")},
- {0xcc60, 0, 0, 1, f(Yes, true, "")},
- {0xcc61, 0, 0, 2, f(Yes, false, "")},
- {0xcc7c, 0, 0, 1, f(Yes, true, "")},
- {0xcc7d, 0, 0, 2, f(Yes, false, "")},
- {0xcc98, 0, 0, 1, f(Yes, true, "")},
- {0xcc99, 0, 0, 2, f(Yes, false, "")},
- {0xccb4, 0, 0, 1, f(Yes, true, "")},
- {0xccb5, 0, 0, 2, f(Yes, false, "")},
- {0xccd0, 0, 0, 1, f(Yes, true, "")},
- {0xccd1, 0, 0, 2, f(Yes, false, "")},
- {0xccec, 0, 0, 1, f(Yes, true, "")},
- {0xcced, 0, 0, 2, f(Yes, false, "")},
- {0xcd08, 0, 0, 1, f(Yes, true, "")},
- {0xcd09, 0, 0, 2, f(Yes, false, "")},
- {0xcd24, 0, 0, 1, f(Yes, true, "")},
- {0xcd25, 0, 0, 2, f(Yes, false, "")},
- {0xcd40, 0, 0, 1, f(Yes, true, "")},
- {0xcd41, 0, 0, 2, f(Yes, false, "")},
- {0xcd5c, 0, 0, 1, f(Yes, true, "")},
- {0xcd5d, 0, 0, 2, f(Yes, false, "")},
- {0xcd78, 0, 0, 1, f(Yes, true, "")},
- {0xcd79, 0, 0, 2, f(Yes, false, "")},
- {0xcd94, 0, 0, 1, f(Yes, true, "")},
- {0xcd95, 0, 0, 2, f(Yes, false, "")},
- {0xcdb0, 0, 0, 1, f(Yes, true, "")},
- {0xcdb1, 0, 0, 2, f(Yes, false, "")},
- {0xcdcc, 0, 0, 1, f(Yes, true, "")},
- {0xcdcd, 0, 0, 2, f(Yes, false, "")},
- {0xcde8, 0, 0, 1, f(Yes, true, "")},
- {0xcde9, 0, 0, 2, f(Yes, false, "")},
- {0xce04, 0, 0, 1, f(Yes, true, "")},
- {0xce05, 0, 0, 2, f(Yes, false, "")},
- {0xce20, 0, 0, 1, f(Yes, true, "")},
- {0xce21, 0, 0, 2, f(Yes, false, "")},
- {0xce3c, 0, 0, 1, f(Yes, true, "")},
- {0xce3d, 0, 0, 2, f(Yes, false, "")},
- {0xce58, 0, 0, 1, f(Yes, true, "")},
- {0xce59, 0, 0, 2, f(Yes, false, "")},
- {0xce74, 0, 0, 1, f(Yes, true, "")},
- {0xce75, 0, 0, 2, f(Yes, false, "")},
- {0xce90, 0, 0, 1, f(Yes, true, "")},
- {0xce91, 0, 0, 2, f(Yes, false, "")},
- {0xceac, 0, 0, 1, f(Yes, true, "")},
- {0xcead, 0, 0, 2, f(Yes, false, "")},
- {0xcec8, 0, 0, 1, f(Yes, true, "")},
- {0xcec9, 0, 0, 2, f(Yes, false, "")},
- {0xcee4, 0, 0, 1, f(Yes, true, "")},
- {0xcee5, 0, 0, 2, f(Yes, false, "")},
- {0xcf00, 0, 0, 1, f(Yes, true, "")},
- {0xcf01, 0, 0, 2, f(Yes, false, "")},
- {0xcf1c, 0, 0, 1, f(Yes, true, "")},
- {0xcf1d, 0, 0, 2, f(Yes, false, "")},
- {0xcf38, 0, 0, 1, f(Yes, true, "")},
- {0xcf39, 0, 0, 2, f(Yes, false, "")},
- {0xcf54, 0, 0, 1, f(Yes, true, "")},
- {0xcf55, 0, 0, 2, f(Yes, false, "")},
- {0xcf70, 0, 0, 1, f(Yes, true, "")},
- {0xcf71, 0, 0, 2, f(Yes, false, "")},
- {0xcf8c, 0, 0, 1, f(Yes, true, "")},
- {0xcf8d, 0, 0, 2, f(Yes, false, "")},
- {0xcfa8, 0, 0, 1, f(Yes, true, "")},
- {0xcfa9, 0, 0, 2, f(Yes, false, "")},
- {0xcfc4, 0, 0, 1, f(Yes, true, "")},
- {0xcfc5, 0, 0, 2, f(Yes, false, "")},
- {0xcfe0, 0, 0, 1, f(Yes, true, "")},
- {0xcfe1, 0, 0, 2, f(Yes, false, "")},
- {0xcffc, 0, 0, 1, f(Yes, true, "")},
- {0xcffd, 0, 0, 2, f(Yes, false, "")},
- {0xd018, 0, 0, 1, f(Yes, true, "")},
- {0xd019, 0, 0, 2, f(Yes, false, "")},
- {0xd034, 0, 0, 1, f(Yes, true, "")},
- {0xd035, 0, 0, 2, f(Yes, false, "")},
- {0xd050, 0, 0, 1, f(Yes, true, "")},
- {0xd051, 0, 0, 2, f(Yes, false, "")},
- {0xd06c, 0, 0, 1, f(Yes, true, "")},
- {0xd06d, 0, 0, 2, f(Yes, false, "")},
- {0xd088, 0, 0, 1, f(Yes, true, "")},
- {0xd089, 0, 0, 2, f(Yes, false, "")},
- {0xd0a4, 0, 0, 1, f(Yes, true, "")},
- {0xd0a5, 0, 0, 2, f(Yes, false, "")},
- {0xd0c0, 0, 0, 1, f(Yes, true, "")},
- {0xd0c1, 0, 0, 2, f(Yes, false, "")},
- {0xd0dc, 0, 0, 1, f(Yes, true, "")},
- {0xd0dd, 0, 0, 2, f(Yes, false, "")},
- {0xd0f8, 0, 0, 1, f(Yes, true, "")},
- {0xd0f9, 0, 0, 2, f(Yes, false, "")},
- {0xd114, 0, 0, 1, f(Yes, true, "")},
- {0xd115, 0, 0, 2, f(Yes, false, "")},
- {0xd130, 0, 0, 1, f(Yes, true, "")},
- {0xd131, 0, 0, 2, f(Yes, false, "")},
- {0xd14c, 0, 0, 1, f(Yes, true, "")},
- {0xd14d, 0, 0, 2, f(Yes, false, "")},
- {0xd168, 0, 0, 1, f(Yes, true, "")},
- {0xd169, 0, 0, 2, f(Yes, false, "")},
- {0xd184, 0, 0, 1, f(Yes, true, "")},
- {0xd185, 0, 0, 2, f(Yes, false, "")},
- {0xd1a0, 0, 0, 1, f(Yes, true, "")},
- {0xd1a1, 0, 0, 2, f(Yes, false, "")},
- {0xd1bc, 0, 0, 1, f(Yes, true, "")},
- {0xd1bd, 0, 0, 2, f(Yes, false, "")},
- {0xd1d8, 0, 0, 1, f(Yes, true, "")},
- {0xd1d9, 0, 0, 2, f(Yes, false, "")},
- {0xd1f4, 0, 0, 1, f(Yes, true, "")},
- {0xd1f5, 0, 0, 2, f(Yes, false, "")},
- {0xd210, 0, 0, 1, f(Yes, true, "")},
- {0xd211, 0, 0, 2, f(Yes, false, "")},
- {0xd22c, 0, 0, 1, f(Yes, true, "")},
- {0xd22d, 0, 0, 2, f(Yes, false, "")},
- {0xd248, 0, 0, 1, f(Yes, true, "")},
- {0xd249, 0, 0, 2, f(Yes, false, "")},
- {0xd264, 0, 0, 1, f(Yes, true, "")},
- {0xd265, 0, 0, 2, f(Yes, false, "")},
- {0xd280, 0, 0, 1, f(Yes, true, "")},
- {0xd281, 0, 0, 2, f(Yes, false, "")},
- {0xd29c, 0, 0, 1, f(Yes, true, "")},
- {0xd29d, 0, 0, 2, f(Yes, false, "")},
- {0xd2b8, 0, 0, 1, f(Yes, true, "")},
- {0xd2b9, 0, 0, 2, f(Yes, false, "")},
- {0xd2d4, 0, 0, 1, f(Yes, true, "")},
- {0xd2d5, 0, 0, 2, f(Yes, false, "")},
- {0xd2f0, 0, 0, 1, f(Yes, true, "")},
- {0xd2f1, 0, 0, 2, f(Yes, false, "")},
- {0xd30c, 0, 0, 1, f(Yes, true, "")},
- {0xd30d, 0, 0, 2, f(Yes, false, "")},
- {0xd328, 0, 0, 1, f(Yes, true, "")},
- {0xd329, 0, 0, 2, f(Yes, false, "")},
- {0xd344, 0, 0, 1, f(Yes, true, "")},
- {0xd345, 0, 0, 2, f(Yes, false, "")},
- {0xd360, 0, 0, 1, f(Yes, true, "")},
- {0xd361, 0, 0, 2, f(Yes, false, "")},
- {0xd37c, 0, 0, 1, f(Yes, true, "")},
- {0xd37d, 0, 0, 2, f(Yes, false, "")},
- {0xd398, 0, 0, 1, f(Yes, true, "")},
- {0xd399, 0, 0, 2, f(Yes, false, "")},
- {0xd3b4, 0, 0, 1, f(Yes, true, "")},
- {0xd3b5, 0, 0, 2, f(Yes, false, "")},
- {0xd3d0, 0, 0, 1, f(Yes, true, "")},
- {0xd3d1, 0, 0, 2, f(Yes, false, "")},
- {0xd3ec, 0, 0, 1, f(Yes, true, "")},
- {0xd3ed, 0, 0, 2, f(Yes, false, "")},
- {0xd408, 0, 0, 1, f(Yes, true, "")},
- {0xd409, 0, 0, 2, f(Yes, false, "")},
- {0xd424, 0, 0, 1, f(Yes, true, "")},
- {0xd425, 0, 0, 2, f(Yes, false, "")},
- {0xd440, 0, 0, 1, f(Yes, true, "")},
- {0xd441, 0, 0, 2, f(Yes, false, "")},
- {0xd45c, 0, 0, 1, f(Yes, true, "")},
- {0xd45d, 0, 0, 2, f(Yes, false, "")},
- {0xd478, 0, 0, 1, f(Yes, true, "")},
- {0xd479, 0, 0, 2, f(Yes, false, "")},
- {0xd494, 0, 0, 1, f(Yes, true, "")},
- {0xd495, 0, 0, 2, f(Yes, false, "")},
- {0xd4b0, 0, 0, 1, f(Yes, true, "")},
- {0xd4b1, 0, 0, 2, f(Yes, false, "")},
- {0xd4cc, 0, 0, 1, f(Yes, true, "")},
- {0xd4cd, 0, 0, 2, f(Yes, false, "")},
- {0xd4e8, 0, 0, 1, f(Yes, true, "")},
- {0xd4e9, 0, 0, 2, f(Yes, false, "")},
- {0xd504, 0, 0, 1, f(Yes, true, "")},
- {0xd505, 0, 0, 2, f(Yes, false, "")},
- {0xd520, 0, 0, 1, f(Yes, true, "")},
- {0xd521, 0, 0, 2, f(Yes, false, "")},
- {0xd53c, 0, 0, 1, f(Yes, true, "")},
- {0xd53d, 0, 0, 2, f(Yes, false, "")},
- {0xd558, 0, 0, 1, f(Yes, true, "")},
- {0xd559, 0, 0, 2, f(Yes, false, "")},
- {0xd574, 0, 0, 1, f(Yes, true, "")},
- {0xd575, 0, 0, 2, f(Yes, false, "")},
- {0xd590, 0, 0, 1, f(Yes, true, "")},
- {0xd591, 0, 0, 2, f(Yes, false, "")},
- {0xd5ac, 0, 0, 1, f(Yes, true, "")},
- {0xd5ad, 0, 0, 2, f(Yes, false, "")},
- {0xd5c8, 0, 0, 1, f(Yes, true, "")},
- {0xd5c9, 0, 0, 2, f(Yes, false, "")},
- {0xd5e4, 0, 0, 1, f(Yes, true, "")},
- {0xd5e5, 0, 0, 2, f(Yes, false, "")},
- {0xd600, 0, 0, 1, f(Yes, true, "")},
- {0xd601, 0, 0, 2, f(Yes, false, "")},
- {0xd61c, 0, 0, 1, f(Yes, true, "")},
- {0xd61d, 0, 0, 2, f(Yes, false, "")},
- {0xd638, 0, 0, 1, f(Yes, true, "")},
- {0xd639, 0, 0, 2, f(Yes, false, "")},
- {0xd654, 0, 0, 1, f(Yes, true, "")},
- {0xd655, 0, 0, 2, f(Yes, false, "")},
- {0xd670, 0, 0, 1, f(Yes, true, "")},
- {0xd671, 0, 0, 2, f(Yes, false, "")},
- {0xd68c, 0, 0, 1, f(Yes, true, "")},
- {0xd68d, 0, 0, 2, f(Yes, false, "")},
- {0xd6a8, 0, 0, 1, f(Yes, true, "")},
- {0xd6a9, 0, 0, 2, f(Yes, false, "")},
- {0xd6c4, 0, 0, 1, f(Yes, true, "")},
- {0xd6c5, 0, 0, 2, f(Yes, false, "")},
- {0xd6e0, 0, 0, 1, f(Yes, true, "")},
- {0xd6e1, 0, 0, 2, f(Yes, false, "")},
- {0xd6fc, 0, 0, 1, f(Yes, true, "")},
- {0xd6fd, 0, 0, 2, f(Yes, false, "")},
- {0xd718, 0, 0, 1, f(Yes, true, "")},
- {0xd719, 0, 0, 2, f(Yes, false, "")},
- {0xd734, 0, 0, 1, f(Yes, true, "")},
- {0xd735, 0, 0, 2, f(Yes, false, "")},
- {0xd750, 0, 0, 1, f(Yes, true, "")},
- {0xd751, 0, 0, 2, f(Yes, false, "")},
- {0xd76c, 0, 0, 1, f(Yes, true, "")},
- {0xd76d, 0, 0, 2, f(Yes, false, "")},
- {0xd788, 0, 0, 1, f(Yes, true, "")},
- {0xd789, 0, 0, 2, f(Yes, false, "")},
- {0xd7a4, 0, 0, 0, f(Yes, false, "")},
- {0xf900, 0, 0, 0, f(No, false, "豈")},
- {0xf901, 0, 0, 0, f(No, false, "更")},
- {0xf902, 0, 0, 0, f(No, false, "車")},
- {0xf903, 0, 0, 0, f(No, false, "賈")},
- {0xf904, 0, 0, 0, f(No, false, "滑")},
- {0xf905, 0, 0, 0, f(No, false, "串")},
- {0xf906, 0, 0, 0, f(No, false, "句")},
- {0xf907, 0, 0, 0, f(No, false, "龜")},
- {0xf909, 0, 0, 0, f(No, false, "契")},
- {0xf90a, 0, 0, 0, f(No, false, "金")},
- {0xf90b, 0, 0, 0, f(No, false, "喇")},
- {0xf90c, 0, 0, 0, f(No, false, "奈")},
- {0xf90d, 0, 0, 0, f(No, false, "懶")},
- {0xf90e, 0, 0, 0, f(No, false, "癩")},
- {0xf90f, 0, 0, 0, f(No, false, "羅")},
- {0xf910, 0, 0, 0, f(No, false, "蘿")},
- {0xf911, 0, 0, 0, f(No, false, "螺")},
- {0xf912, 0, 0, 0, f(No, false, "裸")},
- {0xf913, 0, 0, 0, f(No, false, "邏")},
- {0xf914, 0, 0, 0, f(No, false, "樂")},
- {0xf915, 0, 0, 0, f(No, false, "洛")},
- {0xf916, 0, 0, 0, f(No, false, "烙")},
- {0xf917, 0, 0, 0, f(No, false, "珞")},
- {0xf918, 0, 0, 0, f(No, false, "落")},
- {0xf919, 0, 0, 0, f(No, false, "酪")},
- {0xf91a, 0, 0, 0, f(No, false, "駱")},
- {0xf91b, 0, 0, 0, f(No, false, "亂")},
- {0xf91c, 0, 0, 0, f(No, false, "卵")},
- {0xf91d, 0, 0, 0, f(No, false, "欄")},
- {0xf91e, 0, 0, 0, f(No, false, "爛")},
- {0xf91f, 0, 0, 0, f(No, false, "蘭")},
- {0xf920, 0, 0, 0, f(No, false, "鸞")},
- {0xf921, 0, 0, 0, f(No, false, "嵐")},
- {0xf922, 0, 0, 0, f(No, false, "濫")},
- {0xf923, 0, 0, 0, f(No, false, "藍")},
- {0xf924, 0, 0, 0, f(No, false, "襤")},
- {0xf925, 0, 0, 0, f(No, false, "拉")},
- {0xf926, 0, 0, 0, f(No, false, "臘")},
- {0xf927, 0, 0, 0, f(No, false, "蠟")},
- {0xf928, 0, 0, 0, f(No, false, "廊")},
- {0xf929, 0, 0, 0, f(No, false, "朗")},
- {0xf92a, 0, 0, 0, f(No, false, "浪")},
- {0xf92b, 0, 0, 0, f(No, false, "狼")},
- {0xf92c, 0, 0, 0, f(No, false, "郎")},
- {0xf92d, 0, 0, 0, f(No, false, "來")},
- {0xf92e, 0, 0, 0, f(No, false, "冷")},
- {0xf92f, 0, 0, 0, f(No, false, "勞")},
- {0xf930, 0, 0, 0, f(No, false, "擄")},
- {0xf931, 0, 0, 0, f(No, false, "櫓")},
- {0xf932, 0, 0, 0, f(No, false, "爐")},
- {0xf933, 0, 0, 0, f(No, false, "盧")},
- {0xf934, 0, 0, 0, f(No, false, "老")},
- {0xf935, 0, 0, 0, f(No, false, "蘆")},
- {0xf936, 0, 0, 0, f(No, false, "虜")},
- {0xf937, 0, 0, 0, f(No, false, "路")},
- {0xf938, 0, 0, 0, f(No, false, "露")},
- {0xf939, 0, 0, 0, f(No, false, "魯")},
- {0xf93a, 0, 0, 0, f(No, false, "鷺")},
- {0xf93b, 0, 0, 0, f(No, false, "碌")},
- {0xf93c, 0, 0, 0, f(No, false, "祿")},
- {0xf93d, 0, 0, 0, f(No, false, "綠")},
- {0xf93e, 0, 0, 0, f(No, false, "菉")},
- {0xf93f, 0, 0, 0, f(No, false, "錄")},
- {0xf940, 0, 0, 0, f(No, false, "鹿")},
- {0xf941, 0, 0, 0, f(No, false, "論")},
- {0xf942, 0, 0, 0, f(No, false, "壟")},
- {0xf943, 0, 0, 0, f(No, false, "弄")},
- {0xf944, 0, 0, 0, f(No, false, "籠")},
- {0xf945, 0, 0, 0, f(No, false, "聾")},
- {0xf946, 0, 0, 0, f(No, false, "牢")},
- {0xf947, 0, 0, 0, f(No, false, "磊")},
- {0xf948, 0, 0, 0, f(No, false, "賂")},
- {0xf949, 0, 0, 0, f(No, false, "雷")},
- {0xf94a, 0, 0, 0, f(No, false, "壘")},
- {0xf94b, 0, 0, 0, f(No, false, "屢")},
- {0xf94c, 0, 0, 0, f(No, false, "樓")},
- {0xf94d, 0, 0, 0, f(No, false, "淚")},
- {0xf94e, 0, 0, 0, f(No, false, "漏")},
- {0xf94f, 0, 0, 0, f(No, false, "累")},
- {0xf950, 0, 0, 0, f(No, false, "縷")},
- {0xf951, 0, 0, 0, f(No, false, "陋")},
- {0xf952, 0, 0, 0, f(No, false, "勒")},
- {0xf953, 0, 0, 0, f(No, false, "肋")},
- {0xf954, 0, 0, 0, f(No, false, "凜")},
- {0xf955, 0, 0, 0, f(No, false, "凌")},
- {0xf956, 0, 0, 0, f(No, false, "稜")},
- {0xf957, 0, 0, 0, f(No, false, "綾")},
- {0xf958, 0, 0, 0, f(No, false, "菱")},
- {0xf959, 0, 0, 0, f(No, false, "陵")},
- {0xf95a, 0, 0, 0, f(No, false, "讀")},
- {0xf95b, 0, 0, 0, f(No, false, "拏")},
- {0xf95c, 0, 0, 0, f(No, false, "樂")},
- {0xf95d, 0, 0, 0, f(No, false, "諾")},
- {0xf95e, 0, 0, 0, f(No, false, "丹")},
- {0xf95f, 0, 0, 0, f(No, false, "寧")},
- {0xf960, 0, 0, 0, f(No, false, "怒")},
- {0xf961, 0, 0, 0, f(No, false, "率")},
- {0xf962, 0, 0, 0, f(No, false, "異")},
- {0xf963, 0, 0, 0, f(No, false, "北")},
- {0xf964, 0, 0, 0, f(No, false, "磻")},
- {0xf965, 0, 0, 0, f(No, false, "便")},
- {0xf966, 0, 0, 0, f(No, false, "復")},
- {0xf967, 0, 0, 0, f(No, false, "不")},
- {0xf968, 0, 0, 0, f(No, false, "泌")},
- {0xf969, 0, 0, 0, f(No, false, "數")},
- {0xf96a, 0, 0, 0, f(No, false, "索")},
- {0xf96b, 0, 0, 0, f(No, false, "參")},
- {0xf96c, 0, 0, 0, f(No, false, "塞")},
- {0xf96d, 0, 0, 0, f(No, false, "省")},
- {0xf96e, 0, 0, 0, f(No, false, "葉")},
- {0xf96f, 0, 0, 0, f(No, false, "說")},
- {0xf970, 0, 0, 0, f(No, false, "殺")},
- {0xf971, 0, 0, 0, f(No, false, "辰")},
- {0xf972, 0, 0, 0, f(No, false, "沈")},
- {0xf973, 0, 0, 0, f(No, false, "拾")},
- {0xf974, 0, 0, 0, f(No, false, "若")},
- {0xf975, 0, 0, 0, f(No, false, "掠")},
- {0xf976, 0, 0, 0, f(No, false, "略")},
- {0xf977, 0, 0, 0, f(No, false, "亮")},
- {0xf978, 0, 0, 0, f(No, false, "兩")},
- {0xf979, 0, 0, 0, f(No, false, "凉")},
- {0xf97a, 0, 0, 0, f(No, false, "梁")},
- {0xf97b, 0, 0, 0, f(No, false, "糧")},
- {0xf97c, 0, 0, 0, f(No, false, "良")},
- {0xf97d, 0, 0, 0, f(No, false, "諒")},
- {0xf97e, 0, 0, 0, f(No, false, "量")},
- {0xf97f, 0, 0, 0, f(No, false, "勵")},
- {0xf980, 0, 0, 0, f(No, false, "呂")},
- {0xf981, 0, 0, 0, f(No, false, "女")},
- {0xf982, 0, 0, 0, f(No, false, "廬")},
- {0xf983, 0, 0, 0, f(No, false, "旅")},
- {0xf984, 0, 0, 0, f(No, false, "濾")},
- {0xf985, 0, 0, 0, f(No, false, "礪")},
- {0xf986, 0, 0, 0, f(No, false, "閭")},
- {0xf987, 0, 0, 0, f(No, false, "驪")},
- {0xf988, 0, 0, 0, f(No, false, "麗")},
- {0xf989, 0, 0, 0, f(No, false, "黎")},
- {0xf98a, 0, 0, 0, f(No, false, "力")},
- {0xf98b, 0, 0, 0, f(No, false, "曆")},
- {0xf98c, 0, 0, 0, f(No, false, "歷")},
- {0xf98d, 0, 0, 0, f(No, false, "轢")},
- {0xf98e, 0, 0, 0, f(No, false, "年")},
- {0xf98f, 0, 0, 0, f(No, false, "憐")},
- {0xf990, 0, 0, 0, f(No, false, "戀")},
- {0xf991, 0, 0, 0, f(No, false, "撚")},
- {0xf992, 0, 0, 0, f(No, false, "漣")},
- {0xf993, 0, 0, 0, f(No, false, "煉")},
- {0xf994, 0, 0, 0, f(No, false, "璉")},
- {0xf995, 0, 0, 0, f(No, false, "秊")},
- {0xf996, 0, 0, 0, f(No, false, "練")},
- {0xf997, 0, 0, 0, f(No, false, "聯")},
- {0xf998, 0, 0, 0, f(No, false, "輦")},
- {0xf999, 0, 0, 0, f(No, false, "蓮")},
- {0xf99a, 0, 0, 0, f(No, false, "連")},
- {0xf99b, 0, 0, 0, f(No, false, "鍊")},
- {0xf99c, 0, 0, 0, f(No, false, "列")},
- {0xf99d, 0, 0, 0, f(No, false, "劣")},
- {0xf99e, 0, 0, 0, f(No, false, "咽")},
- {0xf99f, 0, 0, 0, f(No, false, "烈")},
- {0xf9a0, 0, 0, 0, f(No, false, "裂")},
- {0xf9a1, 0, 0, 0, f(No, false, "說")},
- {0xf9a2, 0, 0, 0, f(No, false, "廉")},
- {0xf9a3, 0, 0, 0, f(No, false, "念")},
- {0xf9a4, 0, 0, 0, f(No, false, "捻")},
- {0xf9a5, 0, 0, 0, f(No, false, "殮")},
- {0xf9a6, 0, 0, 0, f(No, false, "簾")},
- {0xf9a7, 0, 0, 0, f(No, false, "獵")},
- {0xf9a8, 0, 0, 0, f(No, false, "令")},
- {0xf9a9, 0, 0, 0, f(No, false, "囹")},
- {0xf9aa, 0, 0, 0, f(No, false, "寧")},
- {0xf9ab, 0, 0, 0, f(No, false, "嶺")},
- {0xf9ac, 0, 0, 0, f(No, false, "怜")},
- {0xf9ad, 0, 0, 0, f(No, false, "玲")},
- {0xf9ae, 0, 0, 0, f(No, false, "瑩")},
- {0xf9af, 0, 0, 0, f(No, false, "羚")},
- {0xf9b0, 0, 0, 0, f(No, false, "聆")},
- {0xf9b1, 0, 0, 0, f(No, false, "鈴")},
- {0xf9b2, 0, 0, 0, f(No, false, "零")},
- {0xf9b3, 0, 0, 0, f(No, false, "靈")},
- {0xf9b4, 0, 0, 0, f(No, false, "領")},
- {0xf9b5, 0, 0, 0, f(No, false, "例")},
- {0xf9b6, 0, 0, 0, f(No, false, "禮")},
- {0xf9b7, 0, 0, 0, f(No, false, "醴")},
- {0xf9b8, 0, 0, 0, f(No, false, "隸")},
- {0xf9b9, 0, 0, 0, f(No, false, "惡")},
- {0xf9ba, 0, 0, 0, f(No, false, "了")},
- {0xf9bb, 0, 0, 0, f(No, false, "僚")},
- {0xf9bc, 0, 0, 0, f(No, false, "寮")},
- {0xf9bd, 0, 0, 0, f(No, false, "尿")},
- {0xf9be, 0, 0, 0, f(No, false, "料")},
- {0xf9bf, 0, 0, 0, f(No, false, "樂")},
- {0xf9c0, 0, 0, 0, f(No, false, "燎")},
- {0xf9c1, 0, 0, 0, f(No, false, "療")},
- {0xf9c2, 0, 0, 0, f(No, false, "蓼")},
- {0xf9c3, 0, 0, 0, f(No, false, "遼")},
- {0xf9c4, 0, 0, 0, f(No, false, "龍")},
- {0xf9c5, 0, 0, 0, f(No, false, "暈")},
- {0xf9c6, 0, 0, 0, f(No, false, "阮")},
- {0xf9c7, 0, 0, 0, f(No, false, "劉")},
- {0xf9c8, 0, 0, 0, f(No, false, "杻")},
- {0xf9c9, 0, 0, 0, f(No, false, "柳")},
- {0xf9ca, 0, 0, 0, f(No, false, "流")},
- {0xf9cb, 0, 0, 0, f(No, false, "溜")},
- {0xf9cc, 0, 0, 0, f(No, false, "琉")},
- {0xf9cd, 0, 0, 0, f(No, false, "留")},
- {0xf9ce, 0, 0, 0, f(No, false, "硫")},
- {0xf9cf, 0, 0, 0, f(No, false, "紐")},
- {0xf9d0, 0, 0, 0, f(No, false, "類")},
- {0xf9d1, 0, 0, 0, f(No, false, "六")},
- {0xf9d2, 0, 0, 0, f(No, false, "戮")},
- {0xf9d3, 0, 0, 0, f(No, false, "陸")},
- {0xf9d4, 0, 0, 0, f(No, false, "倫")},
- {0xf9d5, 0, 0, 0, f(No, false, "崙")},
- {0xf9d6, 0, 0, 0, f(No, false, "淪")},
- {0xf9d7, 0, 0, 0, f(No, false, "輪")},
- {0xf9d8, 0, 0, 0, f(No, false, "律")},
- {0xf9d9, 0, 0, 0, f(No, false, "慄")},
- {0xf9da, 0, 0, 0, f(No, false, "栗")},
- {0xf9db, 0, 0, 0, f(No, false, "率")},
- {0xf9dc, 0, 0, 0, f(No, false, "隆")},
- {0xf9dd, 0, 0, 0, f(No, false, "利")},
- {0xf9de, 0, 0, 0, f(No, false, "吏")},
- {0xf9df, 0, 0, 0, f(No, false, "履")},
- {0xf9e0, 0, 0, 0, f(No, false, "易")},
- {0xf9e1, 0, 0, 0, f(No, false, "李")},
- {0xf9e2, 0, 0, 0, f(No, false, "梨")},
- {0xf9e3, 0, 0, 0, f(No, false, "泥")},
- {0xf9e4, 0, 0, 0, f(No, false, "理")},
- {0xf9e5, 0, 0, 0, f(No, false, "痢")},
- {0xf9e6, 0, 0, 0, f(No, false, "罹")},
- {0xf9e7, 0, 0, 0, f(No, false, "裏")},
- {0xf9e8, 0, 0, 0, f(No, false, "裡")},
- {0xf9e9, 0, 0, 0, f(No, false, "里")},
- {0xf9ea, 0, 0, 0, f(No, false, "離")},
- {0xf9eb, 0, 0, 0, f(No, false, "匿")},
- {0xf9ec, 0, 0, 0, f(No, false, "溺")},
- {0xf9ed, 0, 0, 0, f(No, false, "吝")},
- {0xf9ee, 0, 0, 0, f(No, false, "燐")},
- {0xf9ef, 0, 0, 0, f(No, false, "璘")},
- {0xf9f0, 0, 0, 0, f(No, false, "藺")},
- {0xf9f1, 0, 0, 0, f(No, false, "隣")},
- {0xf9f2, 0, 0, 0, f(No, false, "鱗")},
- {0xf9f3, 0, 0, 0, f(No, false, "麟")},
- {0xf9f4, 0, 0, 0, f(No, false, "林")},
- {0xf9f5, 0, 0, 0, f(No, false, "淋")},
- {0xf9f6, 0, 0, 0, f(No, false, "臨")},
- {0xf9f7, 0, 0, 0, f(No, false, "立")},
- {0xf9f8, 0, 0, 0, f(No, false, "笠")},
- {0xf9f9, 0, 0, 0, f(No, false, "粒")},
- {0xf9fa, 0, 0, 0, f(No, false, "狀")},
- {0xf9fb, 0, 0, 0, f(No, false, "炙")},
- {0xf9fc, 0, 0, 0, f(No, false, "識")},
- {0xf9fd, 0, 0, 0, f(No, false, "什")},
- {0xf9fe, 0, 0, 0, f(No, false, "茶")},
- {0xf9ff, 0, 0, 0, f(No, false, "刺")},
- {0xfa00, 0, 0, 0, f(No, false, "切")},
- {0xfa01, 0, 0, 0, f(No, false, "度")},
- {0xfa02, 0, 0, 0, f(No, false, "拓")},
- {0xfa03, 0, 0, 0, f(No, false, "糖")},
- {0xfa04, 0, 0, 0, f(No, false, "宅")},
- {0xfa05, 0, 0, 0, f(No, false, "洞")},
- {0xfa06, 0, 0, 0, f(No, false, "暴")},
- {0xfa07, 0, 0, 0, f(No, false, "輻")},
- {0xfa08, 0, 0, 0, f(No, false, "行")},
- {0xfa09, 0, 0, 0, f(No, false, "降")},
- {0xfa0a, 0, 0, 0, f(No, false, "見")},
- {0xfa0b, 0, 0, 0, f(No, false, "廓")},
- {0xfa0c, 0, 0, 0, f(No, false, "兀")},
- {0xfa0d, 0, 0, 0, f(No, false, "嗀")},
- {0xfa0e, 0, 0, 0, f(Yes, false, "")},
- {0xfa10, 0, 0, 0, f(No, false, "塚")},
- {0xfa11, 0, 0, 0, f(Yes, false, "")},
- {0xfa12, 0, 0, 0, f(No, false, "晴")},
- {0xfa13, 0, 0, 0, f(Yes, false, "")},
- {0xfa15, 0, 0, 0, f(No, false, "凞")},
- {0xfa16, 0, 0, 0, f(No, false, "猪")},
- {0xfa17, 0, 0, 0, f(No, false, "益")},
- {0xfa18, 0, 0, 0, f(No, false, "礼")},
- {0xfa19, 0, 0, 0, f(No, false, "神")},
- {0xfa1a, 0, 0, 0, f(No, false, "祥")},
- {0xfa1b, 0, 0, 0, f(No, false, "福")},
- {0xfa1c, 0, 0, 0, f(No, false, "靖")},
- {0xfa1d, 0, 0, 0, f(No, false, "精")},
- {0xfa1e, 0, 0, 0, f(No, false, "羽")},
- {0xfa1f, 0, 0, 0, f(Yes, false, "")},
- {0xfa20, 0, 0, 0, f(No, false, "蘒")},
- {0xfa21, 0, 0, 0, f(Yes, false, "")},
- {0xfa22, 0, 0, 0, f(No, false, "諸")},
- {0xfa23, 0, 0, 0, f(Yes, false, "")},
- {0xfa25, 0, 0, 0, f(No, false, "逸")},
- {0xfa26, 0, 0, 0, f(No, false, "都")},
- {0xfa27, 0, 0, 0, f(Yes, false, "")},
- {0xfa2a, 0, 0, 0, f(No, false, "飯")},
- {0xfa2b, 0, 0, 0, f(No, false, "飼")},
- {0xfa2c, 0, 0, 0, f(No, false, "館")},
- {0xfa2d, 0, 0, 0, f(No, false, "鶴")},
- {0xfa2e, 0, 0, 0, f(No, false, "郞")},
- {0xfa2f, 0, 0, 0, f(No, false, "隷")},
- {0xfa30, 0, 0, 0, f(No, false, "侮")},
- {0xfa31, 0, 0, 0, f(No, false, "僧")},
- {0xfa32, 0, 0, 0, f(No, false, "免")},
- {0xfa33, 0, 0, 0, f(No, false, "勉")},
- {0xfa34, 0, 0, 0, f(No, false, "勤")},
- {0xfa35, 0, 0, 0, f(No, false, "卑")},
- {0xfa36, 0, 0, 0, f(No, false, "喝")},
- {0xfa37, 0, 0, 0, f(No, false, "嘆")},
- {0xfa38, 0, 0, 0, f(No, false, "器")},
- {0xfa39, 0, 0, 0, f(No, false, "塀")},
- {0xfa3a, 0, 0, 0, f(No, false, "墨")},
- {0xfa3b, 0, 0, 0, f(No, false, "層")},
- {0xfa3c, 0, 0, 0, f(No, false, "屮")},
- {0xfa3d, 0, 0, 0, f(No, false, "悔")},
- {0xfa3e, 0, 0, 0, f(No, false, "慨")},
- {0xfa3f, 0, 0, 0, f(No, false, "憎")},
- {0xfa40, 0, 0, 0, f(No, false, "懲")},
- {0xfa41, 0, 0, 0, f(No, false, "敏")},
- {0xfa42, 0, 0, 0, f(No, false, "既")},
- {0xfa43, 0, 0, 0, f(No, false, "暑")},
- {0xfa44, 0, 0, 0, f(No, false, "梅")},
- {0xfa45, 0, 0, 0, f(No, false, "海")},
- {0xfa46, 0, 0, 0, f(No, false, "渚")},
- {0xfa47, 0, 0, 0, f(No, false, "漢")},
- {0xfa48, 0, 0, 0, f(No, false, "煮")},
- {0xfa49, 0, 0, 0, f(No, false, "爫")},
- {0xfa4a, 0, 0, 0, f(No, false, "琢")},
- {0xfa4b, 0, 0, 0, f(No, false, "碑")},
- {0xfa4c, 0, 0, 0, f(No, false, "社")},
- {0xfa4d, 0, 0, 0, f(No, false, "祉")},
- {0xfa4e, 0, 0, 0, f(No, false, "祈")},
- {0xfa4f, 0, 0, 0, f(No, false, "祐")},
- {0xfa50, 0, 0, 0, f(No, false, "祖")},
- {0xfa51, 0, 0, 0, f(No, false, "祝")},
- {0xfa52, 0, 0, 0, f(No, false, "禍")},
- {0xfa53, 0, 0, 0, f(No, false, "禎")},
- {0xfa54, 0, 0, 0, f(No, false, "穀")},
- {0xfa55, 0, 0, 0, f(No, false, "突")},
- {0xfa56, 0, 0, 0, f(No, false, "節")},
- {0xfa57, 0, 0, 0, f(No, false, "練")},
- {0xfa58, 0, 0, 0, f(No, false, "縉")},
- {0xfa59, 0, 0, 0, f(No, false, "繁")},
- {0xfa5a, 0, 0, 0, f(No, false, "署")},
- {0xfa5b, 0, 0, 0, f(No, false, "者")},
- {0xfa5c, 0, 0, 0, f(No, false, "臭")},
- {0xfa5d, 0, 0, 0, f(No, false, "艹")},
- {0xfa5f, 0, 0, 0, f(No, false, "著")},
- {0xfa60, 0, 0, 0, f(No, false, "褐")},
- {0xfa61, 0, 0, 0, f(No, false, "視")},
- {0xfa62, 0, 0, 0, f(No, false, "謁")},
- {0xfa63, 0, 0, 0, f(No, false, "謹")},
- {0xfa64, 0, 0, 0, f(No, false, "賓")},
- {0xfa65, 0, 0, 0, f(No, false, "贈")},
- {0xfa66, 0, 0, 0, f(No, false, "辶")},
- {0xfa67, 0, 0, 0, f(No, false, "逸")},
- {0xfa68, 0, 0, 0, f(No, false, "難")},
- {0xfa69, 0, 0, 0, f(No, false, "響")},
- {0xfa6a, 0, 0, 0, f(No, false, "頻")},
- {0xfa6b, 0, 0, 0, f(No, false, "恵")},
- {0xfa6c, 0, 0, 0, f(No, false, "𤋮")},
- {0xfa6d, 0, 0, 0, f(No, false, "舘")},
- {0xfa6e, 0, 0, 0, f(Yes, false, "")},
- {0xfa70, 0, 0, 0, f(No, false, "並")},
- {0xfa71, 0, 0, 0, f(No, false, "况")},
- {0xfa72, 0, 0, 0, f(No, false, "全")},
- {0xfa73, 0, 0, 0, f(No, false, "侀")},
- {0xfa74, 0, 0, 0, f(No, false, "充")},
- {0xfa75, 0, 0, 0, f(No, false, "冀")},
- {0xfa76, 0, 0, 0, f(No, false, "勇")},
- {0xfa77, 0, 0, 0, f(No, false, "勺")},
- {0xfa78, 0, 0, 0, f(No, false, "喝")},
- {0xfa79, 0, 0, 0, f(No, false, "啕")},
- {0xfa7a, 0, 0, 0, f(No, false, "喙")},
- {0xfa7b, 0, 0, 0, f(No, false, "嗢")},
- {0xfa7c, 0, 0, 0, f(No, false, "塚")},
- {0xfa7d, 0, 0, 0, f(No, false, "墳")},
- {0xfa7e, 0, 0, 0, f(No, false, "奄")},
- {0xfa7f, 0, 0, 0, f(No, false, "奔")},
- {0xfa80, 0, 0, 0, f(No, false, "婢")},
- {0xfa81, 0, 0, 0, f(No, false, "嬨")},
- {0xfa82, 0, 0, 0, f(No, false, "廒")},
- {0xfa83, 0, 0, 0, f(No, false, "廙")},
- {0xfa84, 0, 0, 0, f(No, false, "彩")},
- {0xfa85, 0, 0, 0, f(No, false, "徭")},
- {0xfa86, 0, 0, 0, f(No, false, "惘")},
- {0xfa87, 0, 0, 0, f(No, false, "慎")},
- {0xfa88, 0, 0, 0, f(No, false, "愈")},
- {0xfa89, 0, 0, 0, f(No, false, "憎")},
- {0xfa8a, 0, 0, 0, f(No, false, "慠")},
- {0xfa8b, 0, 0, 0, f(No, false, "懲")},
- {0xfa8c, 0, 0, 0, f(No, false, "戴")},
- {0xfa8d, 0, 0, 0, f(No, false, "揄")},
- {0xfa8e, 0, 0, 0, f(No, false, "搜")},
- {0xfa8f, 0, 0, 0, f(No, false, "摒")},
- {0xfa90, 0, 0, 0, f(No, false, "敖")},
- {0xfa91, 0, 0, 0, f(No, false, "晴")},
- {0xfa92, 0, 0, 0, f(No, false, "朗")},
- {0xfa93, 0, 0, 0, f(No, false, "望")},
- {0xfa94, 0, 0, 0, f(No, false, "杖")},
- {0xfa95, 0, 0, 0, f(No, false, "歹")},
- {0xfa96, 0, 0, 0, f(No, false, "殺")},
- {0xfa97, 0, 0, 0, f(No, false, "流")},
- {0xfa98, 0, 0, 0, f(No, false, "滛")},
- {0xfa99, 0, 0, 0, f(No, false, "滋")},
- {0xfa9a, 0, 0, 0, f(No, false, "漢")},
- {0xfa9b, 0, 0, 0, f(No, false, "瀞")},
- {0xfa9c, 0, 0, 0, f(No, false, "煮")},
- {0xfa9d, 0, 0, 0, f(No, false, "瞧")},
- {0xfa9e, 0, 0, 0, f(No, false, "爵")},
- {0xfa9f, 0, 0, 0, f(No, false, "犯")},
- {0xfaa0, 0, 0, 0, f(No, false, "猪")},
- {0xfaa1, 0, 0, 0, f(No, false, "瑱")},
- {0xfaa2, 0, 0, 0, f(No, false, "甆")},
- {0xfaa3, 0, 0, 0, f(No, false, "画")},
- {0xfaa4, 0, 0, 0, f(No, false, "瘝")},
- {0xfaa5, 0, 0, 0, f(No, false, "瘟")},
- {0xfaa6, 0, 0, 0, f(No, false, "益")},
- {0xfaa7, 0, 0, 0, f(No, false, "盛")},
- {0xfaa8, 0, 0, 0, f(No, false, "直")},
- {0xfaa9, 0, 0, 0, f(No, false, "睊")},
- {0xfaaa, 0, 0, 0, f(No, false, "着")},
- {0xfaab, 0, 0, 0, f(No, false, "磌")},
- {0xfaac, 0, 0, 0, f(No, false, "窱")},
- {0xfaad, 0, 0, 0, f(No, false, "節")},
- {0xfaae, 0, 0, 0, f(No, false, "类")},
- {0xfaaf, 0, 0, 0, f(No, false, "絛")},
- {0xfab0, 0, 0, 0, f(No, false, "練")},
- {0xfab1, 0, 0, 0, f(No, false, "缾")},
- {0xfab2, 0, 0, 0, f(No, false, "者")},
- {0xfab3, 0, 0, 0, f(No, false, "荒")},
- {0xfab4, 0, 0, 0, f(No, false, "華")},
- {0xfab5, 0, 0, 0, f(No, false, "蝹")},
- {0xfab6, 0, 0, 0, f(No, false, "襁")},
- {0xfab7, 0, 0, 0, f(No, false, "覆")},
- {0xfab8, 0, 0, 0, f(No, false, "視")},
- {0xfab9, 0, 0, 0, f(No, false, "調")},
- {0xfaba, 0, 0, 0, f(No, false, "諸")},
- {0xfabb, 0, 0, 0, f(No, false, "請")},
- {0xfabc, 0, 0, 0, f(No, false, "謁")},
- {0xfabd, 0, 0, 0, f(No, false, "諾")},
- {0xfabe, 0, 0, 0, f(No, false, "諭")},
- {0xfabf, 0, 0, 0, f(No, false, "謹")},
- {0xfac0, 0, 0, 0, f(No, false, "變")},
- {0xfac1, 0, 0, 0, f(No, false, "贈")},
- {0xfac2, 0, 0, 0, f(No, false, "輸")},
- {0xfac3, 0, 0, 0, f(No, false, "遲")},
- {0xfac4, 0, 0, 0, f(No, false, "醙")},
- {0xfac5, 0, 0, 0, f(No, false, "鉶")},
- {0xfac6, 0, 0, 0, f(No, false, "陼")},
- {0xfac7, 0, 0, 0, f(No, false, "難")},
- {0xfac8, 0, 0, 0, f(No, false, "靖")},
- {0xfac9, 0, 0, 0, f(No, false, "韛")},
- {0xfaca, 0, 0, 0, f(No, false, "響")},
- {0xfacb, 0, 0, 0, f(No, false, "頋")},
- {0xfacc, 0, 0, 0, f(No, false, "頻")},
- {0xfacd, 0, 0, 0, f(No, false, "鬒")},
- {0xface, 0, 0, 0, f(No, false, "龜")},
- {0xfacf, 0, 0, 0, f(No, false, "𢡊")},
- {0xfad0, 0, 0, 0, f(No, false, "𢡄")},
- {0xfad1, 0, 0, 0, f(No, false, "𣏕")},
- {0xfad2, 0, 0, 0, f(No, false, "㮝")},
- {0xfad3, 0, 0, 0, f(No, false, "䀘")},
- {0xfad4, 0, 0, 0, f(No, false, "䀹")},
- {0xfad5, 0, 0, 0, f(No, false, "𥉉")},
- {0xfad6, 0, 0, 0, f(No, false, "𥳐")},
- {0xfad7, 0, 0, 0, f(No, false, "𧻓")},
- {0xfad8, 0, 0, 0, f(No, false, "齃")},
- {0xfad9, 0, 0, 0, f(No, false, "龎")},
- {0xfada, 0, 0, 0, f(Yes, false, "")},
- {0xfb00, 0, 0, 0, g(Yes, No, false, false, "", "ff")},
- {0xfb01, 0, 0, 0, g(Yes, No, false, false, "", "fi")},
- {0xfb02, 0, 0, 0, g(Yes, No, false, false, "", "fl")},
- {0xfb03, 0, 0, 0, g(Yes, No, false, false, "", "ffi")},
- {0xfb04, 0, 0, 0, g(Yes, No, false, false, "", "ffl")},
- {0xfb05, 0, 0, 0, g(Yes, No, false, false, "", "st")},
- {0xfb07, 0, 0, 0, f(Yes, false, "")},
- {0xfb13, 0, 0, 0, g(Yes, No, false, false, "", "մն")},
- {0xfb14, 0, 0, 0, g(Yes, No, false, false, "", "մե")},
- {0xfb15, 0, 0, 0, g(Yes, No, false, false, "", "մի")},
- {0xfb16, 0, 0, 0, g(Yes, No, false, false, "", "վն")},
- {0xfb17, 0, 0, 0, g(Yes, No, false, false, "", "մխ")},
- {0xfb18, 0, 0, 0, f(Yes, false, "")},
- {0xfb1d, 0, 0, 1, f(No, false, "יִ")},
- {0xfb1e, 26, 1, 1, f(Yes, false, "")},
- {0xfb1f, 0, 0, 1, f(No, false, "ײַ")},
- {0xfb20, 0, 0, 0, g(Yes, No, false, false, "", "ע")},
- {0xfb21, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0xfb22, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0xfb23, 0, 0, 0, g(Yes, No, false, false, "", "ה")},
- {0xfb24, 0, 0, 0, g(Yes, No, false, false, "", "כ")},
- {0xfb25, 0, 0, 0, g(Yes, No, false, false, "", "ל")},
- {0xfb26, 0, 0, 0, g(Yes, No, false, false, "", "ם")},
- {0xfb27, 0, 0, 0, g(Yes, No, false, false, "", "ר")},
- {0xfb28, 0, 0, 0, g(Yes, No, false, false, "", "ת")},
- {0xfb29, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfb2a, 0, 0, 1, f(No, false, "שׁ")},
- {0xfb2b, 0, 0, 1, f(No, false, "שׂ")},
- {0xfb2c, 0, 0, 2, f(No, false, "שּׁ")},
- {0xfb2d, 0, 0, 2, f(No, false, "שּׂ")},
- {0xfb2e, 0, 0, 1, f(No, false, "אַ")},
- {0xfb2f, 0, 0, 1, f(No, false, "אָ")},
- {0xfb30, 0, 0, 1, f(No, false, "אּ")},
- {0xfb31, 0, 0, 1, f(No, false, "בּ")},
- {0xfb32, 0, 0, 1, f(No, false, "גּ")},
- {0xfb33, 0, 0, 1, f(No, false, "דּ")},
- {0xfb34, 0, 0, 1, f(No, false, "הּ")},
- {0xfb35, 0, 0, 1, f(No, false, "וּ")},
- {0xfb36, 0, 0, 1, f(No, false, "זּ")},
- {0xfb37, 0, 0, 0, f(Yes, false, "")},
- {0xfb38, 0, 0, 1, f(No, false, "טּ")},
- {0xfb39, 0, 0, 1, f(No, false, "יּ")},
- {0xfb3a, 0, 0, 1, f(No, false, "ךּ")},
- {0xfb3b, 0, 0, 1, f(No, false, "כּ")},
- {0xfb3c, 0, 0, 1, f(No, false, "לּ")},
- {0xfb3d, 0, 0, 0, f(Yes, false, "")},
- {0xfb3e, 0, 0, 1, f(No, false, "מּ")},
- {0xfb3f, 0, 0, 0, f(Yes, false, "")},
- {0xfb40, 0, 0, 1, f(No, false, "נּ")},
- {0xfb41, 0, 0, 1, f(No, false, "סּ")},
- {0xfb42, 0, 0, 0, f(Yes, false, "")},
- {0xfb43, 0, 0, 1, f(No, false, "ףּ")},
- {0xfb44, 0, 0, 1, f(No, false, "פּ")},
- {0xfb45, 0, 0, 0, f(Yes, false, "")},
- {0xfb46, 0, 0, 1, f(No, false, "צּ")},
- {0xfb47, 0, 0, 1, f(No, false, "קּ")},
- {0xfb48, 0, 0, 1, f(No, false, "רּ")},
- {0xfb49, 0, 0, 1, f(No, false, "שּ")},
- {0xfb4a, 0, 0, 1, f(No, false, "תּ")},
- {0xfb4b, 0, 0, 1, f(No, false, "וֹ")},
- {0xfb4c, 0, 0, 1, f(No, false, "בֿ")},
- {0xfb4d, 0, 0, 1, f(No, false, "כֿ")},
- {0xfb4e, 0, 0, 1, f(No, false, "פֿ")},
- {0xfb4f, 0, 0, 0, g(Yes, No, false, false, "", "אל")},
- {0xfb50, 0, 0, 0, g(Yes, No, false, false, "", "ٱ")},
- {0xfb52, 0, 0, 0, g(Yes, No, false, false, "", "ٻ")},
- {0xfb56, 0, 0, 0, g(Yes, No, false, false, "", "پ")},
- {0xfb5a, 0, 0, 0, g(Yes, No, false, false, "", "ڀ")},
- {0xfb5e, 0, 0, 0, g(Yes, No, false, false, "", "ٺ")},
- {0xfb62, 0, 0, 0, g(Yes, No, false, false, "", "ٿ")},
- {0xfb66, 0, 0, 0, g(Yes, No, false, false, "", "ٹ")},
- {0xfb6a, 0, 0, 0, g(Yes, No, false, false, "", "ڤ")},
- {0xfb6e, 0, 0, 0, g(Yes, No, false, false, "", "ڦ")},
- {0xfb72, 0, 0, 0, g(Yes, No, false, false, "", "ڄ")},
- {0xfb76, 0, 0, 0, g(Yes, No, false, false, "", "ڃ")},
- {0xfb7a, 0, 0, 0, g(Yes, No, false, false, "", "چ")},
- {0xfb7e, 0, 0, 0, g(Yes, No, false, false, "", "ڇ")},
- {0xfb82, 0, 0, 0, g(Yes, No, false, false, "", "ڍ")},
- {0xfb84, 0, 0, 0, g(Yes, No, false, false, "", "ڌ")},
- {0xfb86, 0, 0, 0, g(Yes, No, false, false, "", "ڎ")},
- {0xfb88, 0, 0, 0, g(Yes, No, false, false, "", "ڈ")},
- {0xfb8a, 0, 0, 0, g(Yes, No, false, false, "", "ژ")},
- {0xfb8c, 0, 0, 0, g(Yes, No, false, false, "", "ڑ")},
- {0xfb8e, 0, 0, 0, g(Yes, No, false, false, "", "ک")},
- {0xfb92, 0, 0, 0, g(Yes, No, false, false, "", "گ")},
- {0xfb96, 0, 0, 0, g(Yes, No, false, false, "", "ڳ")},
- {0xfb9a, 0, 0, 0, g(Yes, No, false, false, "", "ڱ")},
- {0xfb9e, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0xfba0, 0, 0, 0, g(Yes, No, false, false, "", "ڻ")},
- {0xfba4, 0, 0, 1, g(Yes, No, false, false, "", "ۀ")},
- {0xfba6, 0, 0, 0, g(Yes, No, false, false, "", "ہ")},
- {0xfbaa, 0, 0, 0, g(Yes, No, false, false, "", "ھ")},
- {0xfbae, 0, 0, 0, g(Yes, No, false, false, "", "ے")},
- {0xfbb0, 0, 0, 1, g(Yes, No, false, false, "", "ۓ")},
- {0xfbb2, 0, 0, 0, f(Yes, false, "")},
- {0xfbd3, 0, 0, 0, g(Yes, No, false, false, "", "ڭ")},
- {0xfbd7, 0, 0, 0, g(Yes, No, false, false, "", "ۇ")},
- {0xfbd9, 0, 0, 0, g(Yes, No, false, false, "", "ۆ")},
- {0xfbdb, 0, 0, 0, g(Yes, No, false, false, "", "ۈ")},
- {0xfbdd, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0xfbde, 0, 0, 0, g(Yes, No, false, false, "", "ۋ")},
- {0xfbe0, 0, 0, 0, g(Yes, No, false, false, "", "ۅ")},
- {0xfbe2, 0, 0, 0, g(Yes, No, false, false, "", "ۉ")},
- {0xfbe4, 0, 0, 0, g(Yes, No, false, false, "", "ې")},
- {0xfbe8, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfbea, 0, 0, 0, g(Yes, No, false, false, "", "ئا")},
- {0xfbec, 0, 0, 0, g(Yes, No, false, false, "", "ئە")},
- {0xfbee, 0, 0, 0, g(Yes, No, false, false, "", "ئو")},
- {0xfbf0, 0, 0, 0, g(Yes, No, false, false, "", "ئۇ")},
- {0xfbf2, 0, 0, 0, g(Yes, No, false, false, "", "ئۆ")},
- {0xfbf4, 0, 0, 0, g(Yes, No, false, false, "", "ئۈ")},
- {0xfbf6, 0, 0, 0, g(Yes, No, false, false, "", "ئې")},
- {0xfbf9, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfbfc, 0, 0, 0, g(Yes, No, false, false, "", "ی")},
- {0xfc00, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc01, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc02, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc03, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc04, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc05, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc06, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc07, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc08, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc09, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc0a, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc0b, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfc0c, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfc0d, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfc0e, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc0f, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc10, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc11, 0, 0, 0, g(Yes, No, false, false, "", "ثج")},
- {0xfc12, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc13, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc14, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc15, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfc16, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfc17, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfc18, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfc19, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfc1a, 0, 0, 0, g(Yes, No, false, false, "", "خح")},
- {0xfc1b, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfc1c, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfc1d, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfc1e, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfc1f, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfc20, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfc21, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfc22, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfc23, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfc24, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfc25, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfc26, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfc27, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfc28, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfc29, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfc2a, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfc2b, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfc2c, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfc2d, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfc2e, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfc2f, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfc30, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfc31, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc32, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc33, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfc34, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfc35, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc36, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc37, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc38, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfc39, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfc3a, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfc3b, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc3c, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc3d, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc3e, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc3f, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfc40, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfc41, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfc42, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc43, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc44, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc45, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfc46, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfc47, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfc48, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc49, 0, 0, 0, g(Yes, No, false, false, "", "مى")},
- {0xfc4a, 0, 0, 0, g(Yes, No, false, false, "", "مي")},
- {0xfc4b, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfc4c, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfc4d, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfc4e, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc4f, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc50, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc51, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfc52, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfc53, 0, 0, 0, g(Yes, No, false, false, "", "هى")},
- {0xfc54, 0, 0, 0, g(Yes, No, false, false, "", "هي")},
- {0xfc55, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfc56, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfc57, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfc58, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc59, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc5a, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc5b, 0, 0, 1, g(Yes, No, false, false, "", "ذٰ")},
- {0xfc5c, 0, 0, 1, g(Yes, No, false, false, "", "رٰ")},
- {0xfc5d, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc5e, 0, 0, 2, g(Yes, No, false, false, "", " ٌّ")},
- {0xfc5f, 0, 0, 2, g(Yes, No, false, false, "", " ٍّ")},
- {0xfc60, 0, 0, 2, g(Yes, No, false, false, "", " َّ")},
- {0xfc61, 0, 0, 2, g(Yes, No, false, false, "", " ُّ")},
- {0xfc62, 0, 0, 2, g(Yes, No, false, false, "", " ِّ")},
- {0xfc63, 0, 0, 2, g(Yes, No, false, false, "", " ّٰ")},
- {0xfc64, 0, 0, 0, g(Yes, No, false, false, "", "ئر")},
- {0xfc65, 0, 0, 0, g(Yes, No, false, false, "", "ئز")},
- {0xfc66, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc67, 0, 0, 0, g(Yes, No, false, false, "", "ئن")},
- {0xfc68, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc69, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc6a, 0, 0, 0, g(Yes, No, false, false, "", "بر")},
- {0xfc6b, 0, 0, 0, g(Yes, No, false, false, "", "بز")},
- {0xfc6c, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc6d, 0, 0, 0, g(Yes, No, false, false, "", "بن")},
- {0xfc6e, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc6f, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc70, 0, 0, 0, g(Yes, No, false, false, "", "تر")},
- {0xfc71, 0, 0, 0, g(Yes, No, false, false, "", "تز")},
- {0xfc72, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc73, 0, 0, 0, g(Yes, No, false, false, "", "تن")},
- {0xfc74, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc75, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc76, 0, 0, 0, g(Yes, No, false, false, "", "ثر")},
- {0xfc77, 0, 0, 0, g(Yes, No, false, false, "", "ثز")},
- {0xfc78, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc79, 0, 0, 0, g(Yes, No, false, false, "", "ثن")},
- {0xfc7a, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc7b, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc7c, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc7d, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc7e, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc7f, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc80, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc81, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc82, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc83, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc84, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc85, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc86, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc87, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc88, 0, 0, 0, g(Yes, No, false, false, "", "ما")},
- {0xfc89, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc8a, 0, 0, 0, g(Yes, No, false, false, "", "نر")},
- {0xfc8b, 0, 0, 0, g(Yes, No, false, false, "", "نز")},
- {0xfc8c, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc8d, 0, 0, 0, g(Yes, No, false, false, "", "نن")},
- {0xfc8e, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc8f, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc90, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc91, 0, 0, 0, g(Yes, No, false, false, "", "ير")},
- {0xfc92, 0, 0, 0, g(Yes, No, false, false, "", "يز")},
- {0xfc93, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc94, 0, 0, 0, g(Yes, No, false, false, "", "ين")},
- {0xfc95, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc96, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc97, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc98, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc99, 0, 0, 0, g(Yes, No, false, false, "", "ئخ")},
- {0xfc9a, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc9b, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfc9c, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc9d, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc9e, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc9f, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfca0, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfca1, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfca2, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfca3, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfca4, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfca5, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfca6, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfca7, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfca8, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfca9, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfcaa, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfcab, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfcac, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfcad, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfcae, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfcaf, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfcb0, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfcb1, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfcb2, 0, 0, 0, g(Yes, No, false, false, "", "صخ")},
- {0xfcb3, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfcb4, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfcb5, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfcb6, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfcb7, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfcb8, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfcb9, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfcba, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfcbb, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfcbc, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfcbd, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfcbe, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfcbf, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfcc0, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfcc1, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfcc2, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfcc3, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfcc4, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfcc5, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfcc6, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfcc7, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcc8, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfcc9, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfcca, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfccb, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfccc, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfccd, 0, 0, 0, g(Yes, No, false, false, "", "له")},
- {0xfcce, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfccf, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfcd0, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfcd1, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfcd2, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfcd3, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfcd4, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfcd5, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcd6, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcd7, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfcd8, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfcd9, 0, 0, 1, g(Yes, No, false, false, "", "هٰ")},
- {0xfcda, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfcdb, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfcdc, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfcdd, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcde, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcdf, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfce0, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfce1, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfce2, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfce3, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfce4, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfce5, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfce6, 0, 0, 0, g(Yes, No, false, false, "", "ثه")},
- {0xfce7, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfce8, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfce9, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfcea, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfceb, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcec, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfced, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfcee, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcef, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcf0, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcf1, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcf2, 0, 0, 2, g(Yes, No, false, false, "", "ـَّ")},
- {0xfcf3, 0, 0, 2, g(Yes, No, false, false, "", "ـُّ")},
- {0xfcf4, 0, 0, 2, g(Yes, No, false, false, "", "ـِّ")},
- {0xfcf5, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfcf6, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfcf7, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfcf8, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfcf9, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfcfa, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfcfb, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfcfc, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfcfd, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfcfe, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfcff, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd00, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd01, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd02, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd03, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd04, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd05, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd06, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd07, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd08, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd09, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd0a, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd0b, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd0c, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd0d, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd0e, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd0f, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd10, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd11, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfd12, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfd13, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfd14, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfd15, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfd16, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfd17, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfd18, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfd19, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfd1a, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfd1b, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd1c, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd1d, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd1e, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd1f, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd20, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd21, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd22, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd23, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd24, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd25, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd26, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd27, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd28, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd29, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd2a, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd2b, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd2c, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd2d, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd2e, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd2f, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd30, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd31, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfd32, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfd33, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd34, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfd35, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfd36, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfd37, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd38, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd39, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd3a, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd3b, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfd3c, 0, 0, 1, g(Yes, No, false, false, "", "اً")},
- {0xfd3e, 0, 0, 0, f(Yes, false, "")},
- {0xfd50, 0, 0, 0, g(Yes, No, false, false, "", "تجم")},
- {0xfd51, 0, 0, 0, g(Yes, No, false, false, "", "تحج")},
- {0xfd53, 0, 0, 0, g(Yes, No, false, false, "", "تحم")},
- {0xfd54, 0, 0, 0, g(Yes, No, false, false, "", "تخم")},
- {0xfd55, 0, 0, 0, g(Yes, No, false, false, "", "تمج")},
- {0xfd56, 0, 0, 0, g(Yes, No, false, false, "", "تمح")},
- {0xfd57, 0, 0, 0, g(Yes, No, false, false, "", "تمخ")},
- {0xfd58, 0, 0, 0, g(Yes, No, false, false, "", "جمح")},
- {0xfd5a, 0, 0, 0, g(Yes, No, false, false, "", "حمي")},
- {0xfd5b, 0, 0, 0, g(Yes, No, false, false, "", "حمى")},
- {0xfd5c, 0, 0, 0, g(Yes, No, false, false, "", "سحج")},
- {0xfd5d, 0, 0, 0, g(Yes, No, false, false, "", "سجح")},
- {0xfd5e, 0, 0, 0, g(Yes, No, false, false, "", "سجى")},
- {0xfd5f, 0, 0, 0, g(Yes, No, false, false, "", "سمح")},
- {0xfd61, 0, 0, 0, g(Yes, No, false, false, "", "سمج")},
- {0xfd62, 0, 0, 0, g(Yes, No, false, false, "", "سمم")},
- {0xfd64, 0, 0, 0, g(Yes, No, false, false, "", "صحح")},
- {0xfd66, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfd67, 0, 0, 0, g(Yes, No, false, false, "", "شحم")},
- {0xfd69, 0, 0, 0, g(Yes, No, false, false, "", "شجي")},
- {0xfd6a, 0, 0, 0, g(Yes, No, false, false, "", "شمخ")},
- {0xfd6c, 0, 0, 0, g(Yes, No, false, false, "", "شمم")},
- {0xfd6e, 0, 0, 0, g(Yes, No, false, false, "", "ضحى")},
- {0xfd6f, 0, 0, 0, g(Yes, No, false, false, "", "ضخم")},
- {0xfd71, 0, 0, 0, g(Yes, No, false, false, "", "طمح")},
- {0xfd73, 0, 0, 0, g(Yes, No, false, false, "", "طمم")},
- {0xfd74, 0, 0, 0, g(Yes, No, false, false, "", "طمي")},
- {0xfd75, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfd76, 0, 0, 0, g(Yes, No, false, false, "", "عمم")},
- {0xfd78, 0, 0, 0, g(Yes, No, false, false, "", "عمى")},
- {0xfd79, 0, 0, 0, g(Yes, No, false, false, "", "غمم")},
- {0xfd7a, 0, 0, 0, g(Yes, No, false, false, "", "غمي")},
- {0xfd7b, 0, 0, 0, g(Yes, No, false, false, "", "غمى")},
- {0xfd7c, 0, 0, 0, g(Yes, No, false, false, "", "فخم")},
- {0xfd7e, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfd7f, 0, 0, 0, g(Yes, No, false, false, "", "قمم")},
- {0xfd80, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfd81, 0, 0, 0, g(Yes, No, false, false, "", "لحي")},
- {0xfd82, 0, 0, 0, g(Yes, No, false, false, "", "لحى")},
- {0xfd83, 0, 0, 0, g(Yes, No, false, false, "", "لجج")},
- {0xfd85, 0, 0, 0, g(Yes, No, false, false, "", "لخم")},
- {0xfd87, 0, 0, 0, g(Yes, No, false, false, "", "لمح")},
- {0xfd89, 0, 0, 0, g(Yes, No, false, false, "", "محج")},
- {0xfd8a, 0, 0, 0, g(Yes, No, false, false, "", "محم")},
- {0xfd8b, 0, 0, 0, g(Yes, No, false, false, "", "محي")},
- {0xfd8c, 0, 0, 0, g(Yes, No, false, false, "", "مجح")},
- {0xfd8d, 0, 0, 0, g(Yes, No, false, false, "", "مجم")},
- {0xfd8e, 0, 0, 0, g(Yes, No, false, false, "", "مخج")},
- {0xfd8f, 0, 0, 0, g(Yes, No, false, false, "", "مخم")},
- {0xfd90, 0, 0, 0, f(Yes, false, "")},
- {0xfd92, 0, 0, 0, g(Yes, No, false, false, "", "مجخ")},
- {0xfd93, 0, 0, 0, g(Yes, No, false, false, "", "همج")},
- {0xfd94, 0, 0, 0, g(Yes, No, false, false, "", "همم")},
- {0xfd95, 0, 0, 0, g(Yes, No, false, false, "", "نحم")},
- {0xfd96, 0, 0, 0, g(Yes, No, false, false, "", "نحى")},
- {0xfd97, 0, 0, 0, g(Yes, No, false, false, "", "نجم")},
- {0xfd99, 0, 0, 0, g(Yes, No, false, false, "", "نجى")},
- {0xfd9a, 0, 0, 0, g(Yes, No, false, false, "", "نمي")},
- {0xfd9b, 0, 0, 0, g(Yes, No, false, false, "", "نمى")},
- {0xfd9c, 0, 0, 0, g(Yes, No, false, false, "", "يمم")},
- {0xfd9e, 0, 0, 0, g(Yes, No, false, false, "", "بخي")},
- {0xfd9f, 0, 0, 0, g(Yes, No, false, false, "", "تجي")},
- {0xfda0, 0, 0, 0, g(Yes, No, false, false, "", "تجى")},
- {0xfda1, 0, 0, 0, g(Yes, No, false, false, "", "تخي")},
- {0xfda2, 0, 0, 0, g(Yes, No, false, false, "", "تخى")},
- {0xfda3, 0, 0, 0, g(Yes, No, false, false, "", "تمي")},
- {0xfda4, 0, 0, 0, g(Yes, No, false, false, "", "تمى")},
- {0xfda5, 0, 0, 0, g(Yes, No, false, false, "", "جمي")},
- {0xfda6, 0, 0, 0, g(Yes, No, false, false, "", "جحى")},
- {0xfda7, 0, 0, 0, g(Yes, No, false, false, "", "جمى")},
- {0xfda8, 0, 0, 0, g(Yes, No, false, false, "", "سخى")},
- {0xfda9, 0, 0, 0, g(Yes, No, false, false, "", "صحي")},
- {0xfdaa, 0, 0, 0, g(Yes, No, false, false, "", "شحي")},
- {0xfdab, 0, 0, 0, g(Yes, No, false, false, "", "ضحي")},
- {0xfdac, 0, 0, 0, g(Yes, No, false, false, "", "لجي")},
- {0xfdad, 0, 0, 0, g(Yes, No, false, false, "", "لمي")},
- {0xfdae, 0, 0, 0, g(Yes, No, false, false, "", "يحي")},
- {0xfdaf, 0, 0, 0, g(Yes, No, false, false, "", "يجي")},
- {0xfdb0, 0, 0, 0, g(Yes, No, false, false, "", "يمي")},
- {0xfdb1, 0, 0, 0, g(Yes, No, false, false, "", "ممي")},
- {0xfdb2, 0, 0, 0, g(Yes, No, false, false, "", "قمي")},
- {0xfdb3, 0, 0, 0, g(Yes, No, false, false, "", "نحي")},
- {0xfdb4, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfdb5, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfdb6, 0, 0, 0, g(Yes, No, false, false, "", "عمي")},
- {0xfdb7, 0, 0, 0, g(Yes, No, false, false, "", "كمي")},
- {0xfdb8, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdb9, 0, 0, 0, g(Yes, No, false, false, "", "مخي")},
- {0xfdba, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbb, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdbc, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbd, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdbe, 0, 0, 0, g(Yes, No, false, false, "", "جحي")},
- {0xfdbf, 0, 0, 0, g(Yes, No, false, false, "", "حجي")},
- {0xfdc0, 0, 0, 0, g(Yes, No, false, false, "", "مجي")},
- {0xfdc1, 0, 0, 0, g(Yes, No, false, false, "", "فمي")},
- {0xfdc2, 0, 0, 0, g(Yes, No, false, false, "", "بحي")},
- {0xfdc3, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdc4, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfdc5, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfdc6, 0, 0, 0, g(Yes, No, false, false, "", "سخي")},
- {0xfdc7, 0, 0, 0, g(Yes, No, false, false, "", "نجي")},
- {0xfdc8, 0, 0, 0, f(Yes, false, "")},
- {0xfdf0, 0, 0, 0, g(Yes, No, false, false, "", "صلے")},
- {0xfdf1, 0, 0, 0, g(Yes, No, false, false, "", "قلے")},
- {0xfdf2, 0, 0, 0, g(Yes, No, false, false, "", "الله")},
- {0xfdf3, 0, 0, 0, g(Yes, No, false, false, "", "اكبر")},
- {0xfdf4, 0, 0, 0, g(Yes, No, false, false, "", "محمد")},
- {0xfdf5, 0, 0, 0, g(Yes, No, false, false, "", "صلعم")},
- {0xfdf6, 0, 0, 0, g(Yes, No, false, false, "", "رسول")},
- {0xfdf7, 0, 0, 0, g(Yes, No, false, false, "", "عليه")},
- {0xfdf8, 0, 0, 0, g(Yes, No, false, false, "", "وسلم")},
- {0xfdf9, 0, 0, 0, g(Yes, No, false, false, "", "صلى")},
- {0xfdfa, 0, 0, 0, g(Yes, No, false, false, "", "صلى الله عليه وسلم")},
- {0xfdfb, 0, 0, 0, g(Yes, No, false, false, "", "جل جلاله")},
- {0xfdfc, 0, 0, 0, g(Yes, No, false, false, "", "ریال")},
- {0xfdfd, 0, 0, 0, f(Yes, false, "")},
- {0xfe10, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe11, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe12, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xfe13, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe14, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe15, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe16, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe17, 0, 0, 0, g(Yes, No, false, false, "", "〖")},
- {0xfe18, 0, 0, 0, g(Yes, No, false, false, "", "〗")},
- {0xfe19, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0xfe1a, 0, 0, 0, f(Yes, false, "")},
- {0xfe20, 230, 1, 1, f(Yes, false, "")},
- {0xfe27, 220, 1, 1, f(Yes, false, "")},
- {0xfe2e, 230, 1, 1, f(Yes, false, "")},
- {0xfe30, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0xfe31, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe32, 0, 0, 0, g(Yes, No, false, false, "", "–")},
- {0xfe33, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe35, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe36, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe37, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe38, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe39, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe3a, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe3b, 0, 0, 0, g(Yes, No, false, false, "", "【")},
- {0xfe3c, 0, 0, 0, g(Yes, No, false, false, "", "】")},
- {0xfe3d, 0, 0, 0, g(Yes, No, false, false, "", "《")},
- {0xfe3e, 0, 0, 0, g(Yes, No, false, false, "", "》")},
- {0xfe3f, 0, 0, 0, g(Yes, No, false, false, "", "〈")},
- {0xfe40, 0, 0, 0, g(Yes, No, false, false, "", "〉")},
- {0xfe41, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xfe42, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xfe43, 0, 0, 0, g(Yes, No, false, false, "", "『")},
- {0xfe44, 0, 0, 0, g(Yes, No, false, false, "", "』")},
- {0xfe45, 0, 0, 0, f(Yes, false, "")},
- {0xfe47, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xfe48, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xfe49, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0xfe4d, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe50, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe51, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe52, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xfe53, 0, 0, 0, f(Yes, false, "")},
- {0xfe54, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe55, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe56, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe57, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe58, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe59, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe5a, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe5c, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe5d, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe5e, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe5f, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xfe60, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xfe61, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xfe62, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfe63, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xfe64, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xfe65, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xfe66, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xfe67, 0, 0, 0, f(Yes, false, "")},
- {0xfe68, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xfe69, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xfe6a, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xfe6b, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xfe6c, 0, 0, 0, f(Yes, false, "")},
- {0xfe70, 0, 0, 1, g(Yes, No, false, false, "", " ً")},
- {0xfe71, 0, 0, 1, g(Yes, No, false, false, "", "ـً")},
- {0xfe72, 0, 0, 1, g(Yes, No, false, false, "", " ٌ")},
- {0xfe73, 0, 0, 0, f(Yes, false, "")},
- {0xfe74, 0, 0, 1, g(Yes, No, false, false, "", " ٍ")},
- {0xfe75, 0, 0, 0, f(Yes, false, "")},
- {0xfe76, 0, 0, 1, g(Yes, No, false, false, "", " َ")},
- {0xfe77, 0, 0, 1, g(Yes, No, false, false, "", "ـَ")},
- {0xfe78, 0, 0, 1, g(Yes, No, false, false, "", " ُ")},
- {0xfe79, 0, 0, 1, g(Yes, No, false, false, "", "ـُ")},
- {0xfe7a, 0, 0, 1, g(Yes, No, false, false, "", " ِ")},
- {0xfe7b, 0, 0, 1, g(Yes, No, false, false, "", "ـِ")},
- {0xfe7c, 0, 0, 1, g(Yes, No, false, false, "", " ّ")},
- {0xfe7d, 0, 0, 1, g(Yes, No, false, false, "", "ـّ")},
- {0xfe7e, 0, 0, 1, g(Yes, No, false, false, "", " ْ")},
- {0xfe7f, 0, 0, 1, g(Yes, No, false, false, "", "ـْ")},
- {0xfe80, 0, 0, 0, g(Yes, No, false, false, "", "ء")},
- {0xfe81, 0, 0, 1, g(Yes, No, false, false, "", "آ")},
- {0xfe83, 0, 0, 1, g(Yes, No, false, false, "", "أ")},
- {0xfe85, 0, 0, 1, g(Yes, No, false, false, "", "ؤ")},
- {0xfe87, 0, 0, 1, g(Yes, No, false, false, "", "إ")},
- {0xfe89, 0, 0, 1, g(Yes, No, false, false, "", "ئ")},
- {0xfe8d, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0xfe8f, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0xfe93, 0, 0, 0, g(Yes, No, false, false, "", "ة")},
- {0xfe95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0xfe99, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0xfe9d, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0xfea1, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0xfea5, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0xfea9, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0xfeab, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0xfead, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0xfeaf, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0xfeb1, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0xfeb5, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0xfeb9, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0xfebd, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0xfec1, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0xfec5, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0xfec9, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0xfecd, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0xfed1, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0xfed5, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0xfed9, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0xfedd, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0xfee1, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0xfee5, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0xfee9, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0xfeed, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0xfeef, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfef1, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0xfef5, 0, 0, 1, g(Yes, No, false, false, "", "لآ")},
- {0xfef7, 0, 0, 1, g(Yes, No, false, false, "", "لأ")},
- {0xfef9, 0, 0, 1, g(Yes, No, false, false, "", "لإ")},
- {0xfefb, 0, 0, 0, g(Yes, No, false, false, "", "لا")},
- {0xfefd, 0, 0, 0, f(Yes, false, "")},
- {0xff01, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xff02, 0, 0, 0, g(Yes, No, false, false, "", "\"")},
- {0xff03, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xff04, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xff05, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xff06, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xff07, 0, 0, 0, g(Yes, No, false, false, "", "'")},
- {0xff08, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xff09, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xff0a, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xff0b, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xff0c, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xff0d, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xff0e, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xff0f, 0, 0, 0, g(Yes, No, false, false, "", "/")},
- {0xff10, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0xff11, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xff12, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xff13, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xff14, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0xff15, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0xff16, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0xff17, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0xff18, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0xff19, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0xff1a, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xff1b, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xff1c, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xff1d, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xff1e, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xff1f, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xff20, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xff21, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0xff22, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0xff23, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0xff24, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0xff25, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0xff26, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0xff27, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0xff28, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0xff29, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0xff2a, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0xff2b, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0xff2c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0xff2d, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0xff2e, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0xff2f, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0xff30, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0xff31, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0xff32, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0xff33, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0xff34, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0xff35, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0xff36, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0xff37, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0xff38, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0xff39, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0xff3a, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0xff3b, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xff3c, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xff3d, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xff3e, 0, 0, 0, g(Yes, No, false, false, "", "^")},
- {0xff3f, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xff40, 0, 0, 0, g(Yes, No, false, false, "", "`")},
- {0xff41, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xff42, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0xff43, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0xff44, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0xff45, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0xff46, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0xff47, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0xff48, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0xff49, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0xff4a, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0xff4b, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0xff4c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0xff4d, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0xff4e, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0xff4f, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xff50, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0xff51, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0xff52, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0xff53, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0xff54, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0xff55, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0xff56, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0xff57, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0xff58, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0xff59, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0xff5a, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0xff5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xff5c, 0, 0, 0, g(Yes, No, false, false, "", "|")},
- {0xff5d, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xff5e, 0, 0, 0, g(Yes, No, false, false, "", "~")},
- {0xff5f, 0, 0, 0, g(Yes, No, false, false, "", "⦅")},
- {0xff60, 0, 0, 0, g(Yes, No, false, false, "", "⦆")},
- {0xff61, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xff62, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xff63, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xff64, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xff65, 0, 0, 0, g(Yes, No, false, false, "", "・")},
- {0xff66, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0xff67, 0, 0, 0, g(Yes, No, false, false, "", "ァ")},
- {0xff68, 0, 0, 0, g(Yes, No, false, false, "", "ィ")},
- {0xff69, 0, 0, 0, g(Yes, No, false, false, "", "ゥ")},
- {0xff6a, 0, 0, 0, g(Yes, No, false, false, "", "ェ")},
- {0xff6b, 0, 0, 0, g(Yes, No, false, false, "", "ォ")},
- {0xff6c, 0, 0, 0, g(Yes, No, false, false, "", "ャ")},
- {0xff6d, 0, 0, 0, g(Yes, No, false, false, "", "ュ")},
- {0xff6e, 0, 0, 0, g(Yes, No, false, false, "", "ョ")},
- {0xff6f, 0, 0, 0, g(Yes, No, false, false, "", "ッ")},
- {0xff70, 0, 0, 0, g(Yes, No, false, false, "", "ー")},
- {0xff71, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0xff72, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0xff73, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0xff74, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0xff75, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0xff76, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0xff77, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0xff78, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0xff79, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0xff7a, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0xff7b, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0xff7c, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0xff7d, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0xff7e, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0xff7f, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0xff80, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0xff81, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0xff82, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0xff83, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0xff84, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0xff85, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0xff86, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0xff87, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0xff88, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0xff89, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0xff8a, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0xff8b, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0xff8c, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0xff8d, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0xff8e, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0xff8f, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0xff90, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0xff91, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0xff92, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0xff93, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0xff94, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0xff95, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0xff96, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0xff97, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0xff98, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0xff99, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0xff9a, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0xff9b, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0xff9c, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0xff9d, 0, 0, 0, g(Yes, No, false, false, "", "ン")},
- {0xff9e, 0, 1, 1, g(Yes, No, false, false, "", "゙")},
- {0xff9f, 0, 1, 1, g(Yes, No, false, false, "", "゚")},
- {0xffa0, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0xffa1, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0xffa2, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0xffa3, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0xffa4, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0xffa5, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0xffa6, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0xffa7, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0xffa8, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0xffa9, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0xffaa, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0xffab, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0xffac, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0xffad, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0xffae, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0xffaf, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0xffb0, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0xffb1, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0xffb2, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0xffb3, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0xffb4, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0xffb5, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0xffb6, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0xffb7, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0xffb8, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0xffb9, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0xffba, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0xffbb, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0xffbc, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0xffbd, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0xffbe, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0xffbf, 0, 0, 0, f(Yes, false, "")},
- {0xffc2, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0xffc3, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0xffc4, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0xffc5, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0xffc6, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0xffc7, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0xffc8, 0, 0, 0, f(Yes, false, "")},
- {0xffca, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0xffcb, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0xffcc, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0xffcd, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0xffce, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0xffcf, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0xffd0, 0, 0, 0, f(Yes, false, "")},
- {0xffd2, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0xffd3, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0xffd4, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0xffd5, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0xffd6, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0xffd7, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0xffd8, 0, 0, 0, f(Yes, false, "")},
- {0xffda, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0xffdb, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0xffdc, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0xffdd, 0, 0, 0, f(Yes, false, "")},
- {0xffe0, 0, 0, 0, g(Yes, No, false, false, "", "¢")},
- {0xffe1, 0, 0, 0, g(Yes, No, false, false, "", "£")},
- {0xffe2, 0, 0, 0, g(Yes, No, false, false, "", "¬")},
- {0xffe3, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xffe4, 0, 0, 0, g(Yes, No, false, false, "", "¦")},
- {0xffe5, 0, 0, 0, g(Yes, No, false, false, "", "¥")},
- {0xffe6, 0, 0, 0, g(Yes, No, false, false, "", "₩")},
- {0xffe7, 0, 0, 0, f(Yes, false, "")},
- {0xffe8, 0, 0, 0, g(Yes, No, false, false, "", "│")},
- {0xffe9, 0, 0, 0, g(Yes, No, false, false, "", "←")},
- {0xffea, 0, 0, 0, g(Yes, No, false, false, "", "↑")},
- {0xffeb, 0, 0, 0, g(Yes, No, false, false, "", "→")},
- {0xffec, 0, 0, 0, g(Yes, No, false, false, "", "↓")},
- {0xffed, 0, 0, 0, g(Yes, No, false, false, "", "■")},
- {0xffee, 0, 0, 0, g(Yes, No, false, false, "", "○")},
- {0xffef, 0, 0, 0, f(Yes, false, "")},
- {0x101fd, 220, 1, 1, f(Yes, false, "")},
- {0x101fe, 0, 0, 0, f(Yes, false, "")},
- {0x102e0, 220, 1, 1, f(Yes, false, "")},
- {0x102e1, 0, 0, 0, f(Yes, false, "")},
- {0x10376, 230, 1, 1, f(Yes, false, "")},
- {0x1037b, 0, 0, 0, f(Yes, false, "")},
- {0x10a0d, 220, 1, 1, f(Yes, false, "")},
- {0x10a0e, 0, 0, 0, f(Yes, false, "")},
- {0x10a0f, 230, 1, 1, f(Yes, false, "")},
- {0x10a10, 0, 0, 0, f(Yes, false, "")},
- {0x10a38, 230, 1, 1, f(Yes, false, "")},
- {0x10a39, 1, 1, 1, f(Yes, false, "")},
- {0x10a3a, 220, 1, 1, f(Yes, false, "")},
- {0x10a3b, 0, 0, 0, f(Yes, false, "")},
- {0x10a3f, 9, 1, 1, f(Yes, false, "")},
- {0x10a40, 0, 0, 0, f(Yes, false, "")},
- {0x10ae5, 230, 1, 1, f(Yes, false, "")},
- {0x10ae6, 220, 1, 1, f(Yes, false, "")},
- {0x10ae7, 0, 0, 0, f(Yes, false, "")},
- {0x11046, 9, 1, 1, f(Yes, false, "")},
- {0x11047, 0, 0, 0, f(Yes, false, "")},
- {0x1107f, 9, 1, 1, f(Yes, false, "")},
- {0x11080, 0, 0, 0, f(Yes, false, "")},
- {0x11099, 0, 0, 0, f(Yes, true, "")},
- {0x1109a, 0, 0, 1, f(Yes, false, "𑂚")},
- {0x1109b, 0, 0, 0, f(Yes, true, "")},
- {0x1109c, 0, 0, 1, f(Yes, false, "𑂜")},
- {0x1109d, 0, 0, 0, f(Yes, false, "")},
- {0x110a5, 0, 0, 0, f(Yes, true, "")},
- {0x110a6, 0, 0, 0, f(Yes, false, "")},
- {0x110ab, 0, 0, 1, f(Yes, false, "𑂫")},
- {0x110ac, 0, 0, 0, f(Yes, false, "")},
- {0x110b9, 9, 1, 1, f(Yes, false, "")},
- {0x110ba, 7, 1, 1, f(Maybe, false, "")},
- {0x110bb, 0, 0, 0, f(Yes, false, "")},
- {0x11100, 230, 1, 1, f(Yes, false, "")},
- {0x11103, 0, 0, 0, f(Yes, false, "")},
- {0x11127, 0, 1, 1, f(Maybe, false, "")},
- {0x11128, 0, 0, 0, f(Yes, false, "")},
- {0x1112e, 0, 0, 1, f(Yes, false, "𑄮")},
- {0x1112f, 0, 0, 1, f(Yes, false, "𑄯")},
- {0x11130, 0, 0, 0, f(Yes, false, "")},
- {0x11131, 0, 0, 0, f(Yes, true, "")},
- {0x11133, 9, 1, 1, f(Yes, false, "")},
- {0x11135, 0, 0, 0, f(Yes, false, "")},
- {0x11173, 7, 1, 1, f(Yes, false, "")},
- {0x11174, 0, 0, 0, f(Yes, false, "")},
- {0x111c0, 9, 1, 1, f(Yes, false, "")},
- {0x111c1, 0, 0, 0, f(Yes, false, "")},
- {0x111ca, 7, 1, 1, f(Yes, false, "")},
- {0x111cb, 0, 0, 0, f(Yes, false, "")},
- {0x11235, 9, 1, 1, f(Yes, false, "")},
- {0x11236, 7, 1, 1, f(Yes, false, "")},
- {0x11237, 0, 0, 0, f(Yes, false, "")},
- {0x112e9, 7, 1, 1, f(Yes, false, "")},
- {0x112ea, 9, 1, 1, f(Yes, false, "")},
- {0x112eb, 0, 0, 0, f(Yes, false, "")},
- {0x1133c, 7, 1, 1, f(Yes, false, "")},
- {0x1133d, 0, 0, 0, f(Yes, false, "")},
- {0x1133e, 0, 1, 1, f(Maybe, false, "")},
- {0x1133f, 0, 0, 0, f(Yes, false, "")},
- {0x11347, 0, 0, 0, f(Yes, true, "")},
- {0x11348, 0, 0, 0, f(Yes, false, "")},
- {0x1134b, 0, 0, 1, f(Yes, false, "𑍋")},
- {0x1134c, 0, 0, 1, f(Yes, false, "𑍌")},
- {0x1134d, 9, 1, 1, f(Yes, false, "")},
- {0x1134e, 0, 0, 0, f(Yes, false, "")},
- {0x11357, 0, 1, 1, f(Maybe, false, "")},
- {0x11358, 0, 0, 0, f(Yes, false, "")},
- {0x11366, 230, 1, 1, f(Yes, false, "")},
- {0x1136d, 0, 0, 0, f(Yes, false, "")},
- {0x11370, 230, 1, 1, f(Yes, false, "")},
- {0x11375, 0, 0, 0, f(Yes, false, "")},
- {0x11442, 9, 1, 1, f(Yes, false, "")},
- {0x11443, 0, 0, 0, f(Yes, false, "")},
- {0x11446, 7, 1, 1, f(Yes, false, "")},
- {0x11447, 0, 0, 0, f(Yes, false, "")},
- {0x114b0, 0, 1, 1, f(Maybe, false, "")},
- {0x114b1, 0, 0, 0, f(Yes, false, "")},
- {0x114b9, 0, 0, 0, f(Yes, true, "")},
- {0x114ba, 0, 1, 1, f(Maybe, false, "")},
- {0x114bb, 0, 0, 1, f(Yes, false, "𑒻")},
- {0x114bc, 0, 0, 1, f(Yes, false, "𑒼")},
- {0x114bd, 0, 1, 1, f(Maybe, false, "")},
- {0x114be, 0, 0, 1, f(Yes, false, "𑒾")},
- {0x114bf, 0, 0, 0, f(Yes, false, "")},
- {0x114c2, 9, 1, 1, f(Yes, false, "")},
- {0x114c3, 7, 1, 1, f(Yes, false, "")},
- {0x114c4, 0, 0, 0, f(Yes, false, "")},
- {0x115af, 0, 1, 1, f(Maybe, false, "")},
- {0x115b0, 0, 0, 0, f(Yes, false, "")},
- {0x115b8, 0, 0, 0, f(Yes, true, "")},
- {0x115ba, 0, 0, 1, f(Yes, false, "𑖺")},
- {0x115bb, 0, 0, 1, f(Yes, false, "𑖻")},
- {0x115bc, 0, 0, 0, f(Yes, false, "")},
- {0x115bf, 9, 1, 1, f(Yes, false, "")},
- {0x115c0, 7, 1, 1, f(Yes, false, "")},
- {0x115c1, 0, 0, 0, f(Yes, false, "")},
- {0x1163f, 9, 1, 1, f(Yes, false, "")},
- {0x11640, 0, 0, 0, f(Yes, false, "")},
- {0x116b6, 9, 1, 1, f(Yes, false, "")},
- {0x116b7, 7, 1, 1, f(Yes, false, "")},
- {0x116b8, 0, 0, 0, f(Yes, false, "")},
- {0x1172b, 9, 1, 1, f(Yes, false, "")},
- {0x1172c, 0, 0, 0, f(Yes, false, "")},
- {0x11a34, 9, 1, 1, f(Yes, false, "")},
- {0x11a35, 0, 0, 0, f(Yes, false, "")},
- {0x11a47, 9, 1, 1, f(Yes, false, "")},
- {0x11a48, 0, 0, 0, f(Yes, false, "")},
- {0x11a99, 9, 1, 1, f(Yes, false, "")},
- {0x11a9a, 0, 0, 0, f(Yes, false, "")},
- {0x11c3f, 9, 1, 1, f(Yes, false, "")},
- {0x11c40, 0, 0, 0, f(Yes, false, "")},
- {0x11d42, 7, 1, 1, f(Yes, false, "")},
- {0x11d43, 0, 0, 0, f(Yes, false, "")},
- {0x11d44, 9, 1, 1, f(Yes, false, "")},
- {0x11d46, 0, 0, 0, f(Yes, false, "")},
- {0x16af0, 1, 1, 1, f(Yes, false, "")},
- {0x16af5, 0, 0, 0, f(Yes, false, "")},
- {0x16b30, 230, 1, 1, f(Yes, false, "")},
- {0x16b37, 0, 0, 0, f(Yes, false, "")},
- {0x1bc9e, 1, 1, 1, f(Yes, false, "")},
- {0x1bc9f, 0, 0, 0, f(Yes, false, "")},
- {0x1d15e, 0, 0, 1, f(No, false, "𝅗𝅥")},
- {0x1d15f, 0, 0, 1, f(No, false, "𝅘𝅥")},
- {0x1d160, 0, 0, 2, f(No, false, "𝅘𝅥𝅮")},
- {0x1d161, 0, 0, 2, f(No, false, "𝅘𝅥𝅯")},
- {0x1d162, 0, 0, 2, f(No, false, "𝅘𝅥𝅰")},
- {0x1d163, 0, 0, 2, f(No, false, "𝅘𝅥𝅱")},
- {0x1d164, 0, 0, 2, f(No, false, "𝅘𝅥𝅲")},
- {0x1d165, 216, 1, 1, f(Yes, false, "")},
- {0x1d167, 1, 1, 1, f(Yes, false, "")},
- {0x1d16a, 0, 0, 0, f(Yes, false, "")},
- {0x1d16d, 226, 1, 1, f(Yes, false, "")},
- {0x1d16e, 216, 1, 1, f(Yes, false, "")},
- {0x1d173, 0, 0, 0, f(Yes, false, "")},
- {0x1d17b, 220, 1, 1, f(Yes, false, "")},
- {0x1d183, 0, 0, 0, f(Yes, false, "")},
- {0x1d185, 230, 1, 1, f(Yes, false, "")},
- {0x1d18a, 220, 1, 1, f(Yes, false, "")},
- {0x1d18c, 0, 0, 0, f(Yes, false, "")},
- {0x1d1aa, 230, 1, 1, f(Yes, false, "")},
- {0x1d1ae, 0, 0, 0, f(Yes, false, "")},
- {0x1d1bb, 0, 0, 1, f(No, false, "𝆹𝅥")},
- {0x1d1bc, 0, 0, 1, f(No, false, "𝆺𝅥")},
- {0x1d1bd, 0, 0, 2, f(No, false, "𝆹𝅥𝅮")},
- {0x1d1be, 0, 0, 2, f(No, false, "𝆺𝅥𝅮")},
- {0x1d1bf, 0, 0, 2, f(No, false, "𝆹𝅥𝅯")},
- {0x1d1c0, 0, 0, 2, f(No, false, "𝆺𝅥𝅯")},
- {0x1d1c1, 0, 0, 0, f(Yes, false, "")},
- {0x1d242, 230, 1, 1, f(Yes, false, "")},
- {0x1d245, 0, 0, 0, f(Yes, false, "")},
- {0x1d400, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d401, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d402, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d403, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d404, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d405, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d406, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d407, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d408, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d409, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d40a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d40b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d40c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d40d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d40e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d40f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d410, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d411, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d412, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d413, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d414, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d415, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d416, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d417, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d418, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d419, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d41a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d41b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d41c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d41d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d41e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d41f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d420, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d421, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d422, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d423, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d424, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d425, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d426, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d427, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d428, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d429, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d42a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d42b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d42c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d42d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d42e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d42f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d430, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d431, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d432, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d433, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d434, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d435, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d436, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d437, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d438, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d439, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d43a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d43b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d43c, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d43d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d43e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d43f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d440, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d441, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d442, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d443, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d444, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d445, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d446, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d447, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d448, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d449, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d44a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d44b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d44c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d44d, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d44e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d450, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d451, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d452, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d453, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d454, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d455, 0, 0, 0, f(Yes, false, "")},
- {0x1d456, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d457, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d458, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d459, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d45a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d45b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d45c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d45d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d45e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d45f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d460, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d461, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d462, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d463, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d464, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d465, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d466, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d467, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d468, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d469, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d46a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d46b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d46c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d46d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d46e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d46f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d470, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d471, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d472, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d473, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d474, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d475, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d476, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d477, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d478, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d479, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d47a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d47b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d47c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d47d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d47e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d47f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d480, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d481, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d482, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d483, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d484, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d485, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d486, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d487, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d488, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d489, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d48a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d48b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d48c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d48d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d48e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d48f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d490, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d491, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d492, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d493, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d494, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d495, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d496, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d497, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d498, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d499, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d49a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d49b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d49c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d49d, 0, 0, 0, f(Yes, false, "")},
- {0x1d49e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d49f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4a0, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a2, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4a3, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a5, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4a6, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4a7, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a9, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4aa, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4ab, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4ac, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4ad, 0, 0, 0, f(Yes, false, "")},
- {0x1d4ae, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4af, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4b0, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4b1, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4b2, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4b3, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4b4, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4b5, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4b6, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4b7, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4b8, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4b9, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ba, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bb, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4bc, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bd, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4be, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4bf, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4c0, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4c1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4c2, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4c3, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4c4, 0, 0, 0, f(Yes, false, "")},
- {0x1d4c5, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4c6, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4c7, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4c8, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4c9, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4ca, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4cb, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d4cc, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d4cd, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d4ce, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d4cf, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d4d0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d4d1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d4d2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d4d3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4d4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d4d5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d4d6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4d7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d4d8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d4d9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4da, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4db, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d4dc, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d4dd, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4de, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4df, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4e0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4e1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d4e2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4e3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4e4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4e5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4e6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4e7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4e8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4e9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4ea, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4eb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4ec, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4ed, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ee, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4ef, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4f0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4f1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4f2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4f3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4f4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4f5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4f6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4f7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4f8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d4f9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4fa, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4fb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4fc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4fd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4fe, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4ff, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d500, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d501, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d502, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d503, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d504, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d505, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d506, 0, 0, 0, f(Yes, false, "")},
- {0x1d507, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d508, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d509, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d50a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d50b, 0, 0, 0, f(Yes, false, "")},
- {0x1d50d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d50e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d50f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d510, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d511, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d512, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d513, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d514, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d515, 0, 0, 0, f(Yes, false, "")},
- {0x1d516, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d517, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d518, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d519, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d51a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d51b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d51c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d51d, 0, 0, 0, f(Yes, false, "")},
- {0x1d51e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d51f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d520, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d521, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d522, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d523, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d524, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d525, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d526, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d527, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d528, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d529, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d52a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d52b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d52c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d52d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d52e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d52f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d530, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d531, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d532, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d533, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d534, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d535, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d536, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d537, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d538, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d539, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d53a, 0, 0, 0, f(Yes, false, "")},
- {0x1d53b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d53c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d53d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d53e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d53f, 0, 0, 0, f(Yes, false, "")},
- {0x1d540, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d541, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d542, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d543, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d544, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d545, 0, 0, 0, f(Yes, false, "")},
- {0x1d546, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d547, 0, 0, 0, f(Yes, false, "")},
- {0x1d54a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d54b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d54c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d54d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d54e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d54f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d550, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d551, 0, 0, 0, f(Yes, false, "")},
- {0x1d552, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d553, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d554, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d555, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d556, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d557, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d558, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d559, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d55a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d55b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d55c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d55d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d55e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d55f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d560, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d561, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d562, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d563, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d564, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d565, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d566, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d567, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d568, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d569, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d56a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d56b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d56c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d56d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d56e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d56f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d570, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d571, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d572, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d573, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d574, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d575, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d576, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d577, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d578, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d579, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d57a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d57b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d57c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d57d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d57e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d57f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d580, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d581, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d582, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d583, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d584, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d585, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d586, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d587, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d588, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d589, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d58a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d58b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d58c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d58d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d58e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d58f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d590, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d591, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d592, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d593, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d594, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d595, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d596, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d597, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d598, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d599, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d59a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d59c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d59d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d59e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d59f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5a0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5a1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5a2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5a3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5a4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5a5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5a6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5a7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5a8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5a9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5aa, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5ab, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5ac, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5ad, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5ae, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5af, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5b0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5b1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5b2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5b3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5b4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5b5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5b6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5b7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5b8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5b9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ba, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5bb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5bc, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5bd, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5be, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5bf, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5c0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5c1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5c2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5c3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5c4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5c5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5c6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5c7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5c8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5c9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5ca, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5cb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d5cc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d5cd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d5ce, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d5cf, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5d0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d5d1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d5d2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d5d3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5d4, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5d5, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5d6, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5d7, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5d8, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5d9, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5da, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5db, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5dc, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5dd, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5de, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5df, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5e0, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5e1, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5e2, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5e3, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5e4, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5e5, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5e6, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5e7, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5e8, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5e9, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5ea, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5eb, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5ec, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5ed, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ee, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5ef, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5f0, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5f1, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5f2, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5f3, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5f4, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5f5, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5f6, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5f7, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5f8, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5f9, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5fa, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5fb, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5fc, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5fd, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5fe, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5ff, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d600, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d601, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d602, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d603, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d604, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d605, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d606, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d607, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d608, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d609, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d60a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d60b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d60c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d60d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d60e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d60f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d610, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d611, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d612, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d613, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d614, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d615, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d616, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d617, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d618, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d619, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d61a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d61b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d61c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d61d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d61e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d61f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d620, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d621, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d622, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d623, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d624, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d625, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d626, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d627, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d628, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d629, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d62a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d62b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d62c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d62d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d62e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d62f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d630, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d631, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d632, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d633, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d634, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d635, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d636, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d637, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d638, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d639, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d63a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d63b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d63c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d63d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d63e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d63f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d640, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d641, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d642, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d643, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d644, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d645, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d646, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d647, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d648, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d649, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d64a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d64b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d64c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d64d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d64e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d64f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d650, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d651, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d652, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d653, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d654, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d655, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d656, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d657, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d658, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d659, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d65a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d65b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d65c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d65d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d65e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d65f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d660, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d661, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d662, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d663, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d664, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d665, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d666, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d667, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d668, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d669, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d66a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d66b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d66d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d66e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d66f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d670, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d671, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d672, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d673, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d674, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d675, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d676, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d677, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d678, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d679, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d67a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d67b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d67c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d67d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d67e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d67f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d680, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d681, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d682, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d683, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d684, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d685, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d686, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d687, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d688, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d689, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d68a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d68b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d68c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d68d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d68e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d68f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d690, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d691, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d692, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d693, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d694, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d695, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d696, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d697, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d698, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d699, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d69a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d69b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d69c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d69d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d69e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d69f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d6a0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d6a1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d6a2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d6a3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d6a4, 0, 0, 0, g(Yes, No, false, false, "", "ı")},
- {0x1d6a5, 0, 0, 0, g(Yes, No, false, false, "", "ȷ")},
- {0x1d6a6, 0, 0, 0, f(Yes, false, "")},
- {0x1d6a8, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6a9, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6aa, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6ab, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6ac, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6ad, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6ae, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6af, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6b0, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6b1, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6b2, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6b3, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6b4, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6b5, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6b6, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6b7, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6b8, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6b9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ba, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6bb, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6bc, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6bd, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6be, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6bf, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6c0, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6c1, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6c2, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6c3, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6c4, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6c5, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d6c6, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6c7, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d6c8, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d6c9, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6ca, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d6cb, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6cc, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d6cd, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d6ce, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d6cf, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d6d0, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d6d1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6d2, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6d3, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d6d4, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d6d5, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d6d6, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d6d7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6d8, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6d9, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d6da, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d6db, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d6dc, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6dd, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6de, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6df, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6e0, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6e1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6e2, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6e3, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6e4, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6e5, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6e6, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6e7, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6e8, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6e9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ea, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6eb, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6ec, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6ed, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6ee, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6ef, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6f0, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6f1, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6f2, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6f3, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6f4, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6f5, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6f6, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6f7, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6f8, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6f9, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6fa, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6fb, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6fc, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6fd, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6fe, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6ff, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d700, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d701, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d702, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d703, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d704, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d705, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d706, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d707, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d708, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d709, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d70a, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d70b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d70c, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d70d, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d70e, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d70f, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d710, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d711, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d712, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d713, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d714, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d715, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d716, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d717, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d718, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d719, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d71a, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d71b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d71c, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d71d, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d71e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d71f, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d720, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d721, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d722, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d723, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d724, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d725, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d726, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d727, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d728, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d729, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d72a, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d72b, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d72c, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d72d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d72e, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d72f, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d730, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d731, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d732, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d733, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d734, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d735, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d736, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d737, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d738, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d739, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d73a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d73b, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d73c, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d73d, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d73e, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d73f, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d740, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d741, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d742, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d743, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d744, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d745, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d746, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d747, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d748, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d749, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d74a, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d74b, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d74c, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d74d, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d74e, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d74f, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d750, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d751, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d752, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d753, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d754, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d755, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d756, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d757, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d758, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d759, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d75a, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d75b, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d75c, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d75d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d75e, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d75f, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d760, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d761, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d762, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d763, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d764, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d765, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d766, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d767, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d768, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d769, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d76a, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d76b, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d76c, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d76d, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d76e, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d76f, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d770, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d771, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d772, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d773, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d774, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d775, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d776, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d777, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d778, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d779, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d77a, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d77b, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d77c, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d77d, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d77e, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d77f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d780, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d781, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d782, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d783, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d784, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d785, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d786, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d787, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d788, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d789, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d78a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d78b, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d78c, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d78d, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d78e, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d78f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d790, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d791, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d792, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d793, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d794, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d795, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d796, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d797, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d798, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d799, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d79a, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d79b, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d79c, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d79d, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d79e, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d79f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d7a0, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d7a1, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d7a2, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d7a3, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d7a4, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d7a5, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d7a6, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d7a7, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d7a8, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d7a9, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d7aa, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d7ab, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d7ac, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d7ad, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d7ae, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7af, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d7b0, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d7b1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7b2, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d7b3, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7b4, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d7b5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d7b6, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d7b7, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d7b8, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d7b9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ba, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7bb, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d7bc, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d7bd, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d7be, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d7bf, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c0, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d7c1, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d7c2, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d7c3, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d7c4, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7c5, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7c6, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7c7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c8, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7c9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ca, 0, 0, 0, g(Yes, No, false, false, "", "Ϝ")},
- {0x1d7cb, 0, 0, 0, g(Yes, No, false, false, "", "ϝ")},
- {0x1d7cc, 0, 0, 0, f(Yes, false, "")},
- {0x1d7ce, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7cf, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7d0, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7d1, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7d2, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7d3, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7d4, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7d5, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7d6, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7d7, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7d8, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7d9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7da, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7db, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7dc, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7dd, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7de, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7df, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7e0, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7e1, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7e2, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7e3, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7e4, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7e5, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7e6, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7e7, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7e8, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7e9, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7ea, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7eb, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7ec, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7ed, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7ee, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7ef, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7f0, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7f1, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7f2, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7f3, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7f4, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7f5, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7f6, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7f7, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7f8, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7f9, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7fa, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7fb, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7fc, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7fd, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7fe, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7ff, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d800, 0, 0, 0, f(Yes, false, "")},
- {0x1e000, 230, 1, 1, f(Yes, false, "")},
- {0x1e007, 0, 0, 0, f(Yes, false, "")},
- {0x1e008, 230, 1, 1, f(Yes, false, "")},
- {0x1e019, 0, 0, 0, f(Yes, false, "")},
- {0x1e01b, 230, 1, 1, f(Yes, false, "")},
- {0x1e022, 0, 0, 0, f(Yes, false, "")},
- {0x1e023, 230, 1, 1, f(Yes, false, "")},
- {0x1e025, 0, 0, 0, f(Yes, false, "")},
- {0x1e026, 230, 1, 1, f(Yes, false, "")},
- {0x1e02b, 0, 0, 0, f(Yes, false, "")},
- {0x1e8d0, 220, 1, 1, f(Yes, false, "")},
- {0x1e8d7, 0, 0, 0, f(Yes, false, "")},
- {0x1e944, 230, 1, 1, f(Yes, false, "")},
- {0x1e94a, 7, 1, 1, f(Yes, false, "")},
- {0x1e94b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee00, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee01, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee02, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee03, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee04, 0, 0, 0, f(Yes, false, "")},
- {0x1ee05, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee06, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee07, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee08, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee09, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee0a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee0b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee0c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee0d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee0e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee0f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee10, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee11, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee12, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee13, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee14, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee15, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee16, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee17, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee18, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee19, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee1a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee1b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee1c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee1d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee1e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee1f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee20, 0, 0, 0, f(Yes, false, "")},
- {0x1ee21, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee22, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee23, 0, 0, 0, f(Yes, false, "")},
- {0x1ee24, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee25, 0, 0, 0, f(Yes, false, "")},
- {0x1ee27, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee28, 0, 0, 0, f(Yes, false, "")},
- {0x1ee29, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee2a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee2b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee2c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee2d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee2e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee2f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee30, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee31, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee32, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee33, 0, 0, 0, f(Yes, false, "")},
- {0x1ee34, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee35, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee36, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee37, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee38, 0, 0, 0, f(Yes, false, "")},
- {0x1ee39, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee3a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee3b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee3c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee42, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee43, 0, 0, 0, f(Yes, false, "")},
- {0x1ee47, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee48, 0, 0, 0, f(Yes, false, "")},
- {0x1ee49, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee4a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee4c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee4e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee4f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee50, 0, 0, 0, f(Yes, false, "")},
- {0x1ee51, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee52, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee53, 0, 0, 0, f(Yes, false, "")},
- {0x1ee54, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee55, 0, 0, 0, f(Yes, false, "")},
- {0x1ee57, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee58, 0, 0, 0, f(Yes, false, "")},
- {0x1ee59, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee5a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee5c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee5e, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee60, 0, 0, 0, f(Yes, false, "")},
- {0x1ee61, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee62, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee63, 0, 0, 0, f(Yes, false, "")},
- {0x1ee64, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee65, 0, 0, 0, f(Yes, false, "")},
- {0x1ee67, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee68, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee69, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee6a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee6b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee6c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee6d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee6e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee6f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee70, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee71, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee72, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee73, 0, 0, 0, f(Yes, false, "")},
- {0x1ee74, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee75, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee76, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee77, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee78, 0, 0, 0, f(Yes, false, "")},
- {0x1ee79, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee7a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee7b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee7c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee7d, 0, 0, 0, f(Yes, false, "")},
- {0x1ee7e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee7f, 0, 0, 0, f(Yes, false, "")},
- {0x1ee80, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee81, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee82, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee83, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee84, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee85, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee86, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee87, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee88, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee89, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee8a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee8b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee8c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee8d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee8e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee8f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee90, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee91, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee92, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee93, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee94, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee96, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee97, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee98, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee99, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee9a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee9b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee9c, 0, 0, 0, f(Yes, false, "")},
- {0x1eea1, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1eea2, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1eea3, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1eea4, 0, 0, 0, f(Yes, false, "")},
- {0x1eea5, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1eea6, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1eea7, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1eea8, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1eea9, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1eeaa, 0, 0, 0, f(Yes, false, "")},
- {0x1eeab, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1eeac, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1eead, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1eeae, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1eeaf, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1eeb0, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1eeb1, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1eeb2, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1eeb3, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1eeb4, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1eeb5, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1eeb6, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1eeb7, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1eeb8, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1eeb9, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1eeba, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1eebb, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1eebc, 0, 0, 0, f(Yes, false, "")},
- {0x1f100, 0, 0, 0, g(Yes, No, false, false, "", "0.")},
- {0x1f101, 0, 0, 0, g(Yes, No, false, false, "", "0,")},
- {0x1f102, 0, 0, 0, g(Yes, No, false, false, "", "1,")},
- {0x1f103, 0, 0, 0, g(Yes, No, false, false, "", "2,")},
- {0x1f104, 0, 0, 0, g(Yes, No, false, false, "", "3,")},
- {0x1f105, 0, 0, 0, g(Yes, No, false, false, "", "4,")},
- {0x1f106, 0, 0, 0, g(Yes, No, false, false, "", "5,")},
- {0x1f107, 0, 0, 0, g(Yes, No, false, false, "", "6,")},
- {0x1f108, 0, 0, 0, g(Yes, No, false, false, "", "7,")},
- {0x1f109, 0, 0, 0, g(Yes, No, false, false, "", "8,")},
- {0x1f10a, 0, 0, 0, g(Yes, No, false, false, "", "9,")},
- {0x1f10b, 0, 0, 0, f(Yes, false, "")},
- {0x1f110, 0, 0, 0, g(Yes, No, false, false, "", "(A)")},
- {0x1f111, 0, 0, 0, g(Yes, No, false, false, "", "(B)")},
- {0x1f112, 0, 0, 0, g(Yes, No, false, false, "", "(C)")},
- {0x1f113, 0, 0, 0, g(Yes, No, false, false, "", "(D)")},
- {0x1f114, 0, 0, 0, g(Yes, No, false, false, "", "(E)")},
- {0x1f115, 0, 0, 0, g(Yes, No, false, false, "", "(F)")},
- {0x1f116, 0, 0, 0, g(Yes, No, false, false, "", "(G)")},
- {0x1f117, 0, 0, 0, g(Yes, No, false, false, "", "(H)")},
- {0x1f118, 0, 0, 0, g(Yes, No, false, false, "", "(I)")},
- {0x1f119, 0, 0, 0, g(Yes, No, false, false, "", "(J)")},
- {0x1f11a, 0, 0, 0, g(Yes, No, false, false, "", "(K)")},
- {0x1f11b, 0, 0, 0, g(Yes, No, false, false, "", "(L)")},
- {0x1f11c, 0, 0, 0, g(Yes, No, false, false, "", "(M)")},
- {0x1f11d, 0, 0, 0, g(Yes, No, false, false, "", "(N)")},
- {0x1f11e, 0, 0, 0, g(Yes, No, false, false, "", "(O)")},
- {0x1f11f, 0, 0, 0, g(Yes, No, false, false, "", "(P)")},
- {0x1f120, 0, 0, 0, g(Yes, No, false, false, "", "(Q)")},
- {0x1f121, 0, 0, 0, g(Yes, No, false, false, "", "(R)")},
- {0x1f122, 0, 0, 0, g(Yes, No, false, false, "", "(S)")},
- {0x1f123, 0, 0, 0, g(Yes, No, false, false, "", "(T)")},
- {0x1f124, 0, 0, 0, g(Yes, No, false, false, "", "(U)")},
- {0x1f125, 0, 0, 0, g(Yes, No, false, false, "", "(V)")},
- {0x1f126, 0, 0, 0, g(Yes, No, false, false, "", "(W)")},
- {0x1f127, 0, 0, 0, g(Yes, No, false, false, "", "(X)")},
- {0x1f128, 0, 0, 0, g(Yes, No, false, false, "", "(Y)")},
- {0x1f129, 0, 0, 0, g(Yes, No, false, false, "", "(Z)")},
- {0x1f12a, 0, 0, 0, g(Yes, No, false, false, "", "〔S〕")},
- {0x1f12b, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f12c, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f12d, 0, 0, 0, g(Yes, No, false, false, "", "CD")},
- {0x1f12e, 0, 0, 0, g(Yes, No, false, false, "", "WZ")},
- {0x1f12f, 0, 0, 0, f(Yes, false, "")},
- {0x1f130, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1f131, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1f132, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f133, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1f134, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1f135, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1f136, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1f137, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1f138, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1f139, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1f13a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1f13b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1f13c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1f13d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1f13e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1f13f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1f140, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1f141, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f142, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1f143, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1f144, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1f145, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1f146, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1f147, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1f148, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1f149, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1f14a, 0, 0, 0, g(Yes, No, false, false, "", "HV")},
- {0x1f14b, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x1f14c, 0, 0, 0, g(Yes, No, false, false, "", "SD")},
- {0x1f14d, 0, 0, 0, g(Yes, No, false, false, "", "SS")},
- {0x1f14e, 0, 0, 0, g(Yes, No, false, false, "", "PPV")},
- {0x1f14f, 0, 0, 0, g(Yes, No, false, false, "", "WC")},
- {0x1f150, 0, 0, 0, f(Yes, false, "")},
- {0x1f16a, 0, 0, 0, g(Yes, No, false, false, "", "MC")},
- {0x1f16b, 0, 0, 0, g(Yes, No, false, false, "", "MD")},
- {0x1f16c, 0, 0, 0, f(Yes, false, "")},
- {0x1f190, 0, 0, 0, g(Yes, No, false, false, "", "DJ")},
- {0x1f191, 0, 0, 0, f(Yes, false, "")},
- {0x1f200, 0, 0, 0, g(Yes, No, false, false, "", "ほか")},
- {0x1f201, 0, 0, 0, g(Yes, No, false, false, "", "ココ")},
- {0x1f202, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x1f203, 0, 0, 0, f(Yes, false, "")},
- {0x1f210, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x1f211, 0, 0, 0, g(Yes, No, false, false, "", "字")},
- {0x1f212, 0, 0, 0, g(Yes, No, false, false, "", "双")},
- {0x1f213, 0, 0, 1, g(Yes, No, false, false, "", "デ")},
- {0x1f214, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x1f215, 0, 0, 0, g(Yes, No, false, false, "", "多")},
- {0x1f216, 0, 0, 0, g(Yes, No, false, false, "", "解")},
- {0x1f217, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x1f218, 0, 0, 0, g(Yes, No, false, false, "", "交")},
- {0x1f219, 0, 0, 0, g(Yes, No, false, false, "", "映")},
- {0x1f21a, 0, 0, 0, g(Yes, No, false, false, "", "無")},
- {0x1f21b, 0, 0, 0, g(Yes, No, false, false, "", "料")},
- {0x1f21c, 0, 0, 0, g(Yes, No, false, false, "", "前")},
- {0x1f21d, 0, 0, 0, g(Yes, No, false, false, "", "後")},
- {0x1f21e, 0, 0, 0, g(Yes, No, false, false, "", "再")},
- {0x1f21f, 0, 0, 0, g(Yes, No, false, false, "", "新")},
- {0x1f220, 0, 0, 0, g(Yes, No, false, false, "", "初")},
- {0x1f221, 0, 0, 0, g(Yes, No, false, false, "", "終")},
- {0x1f222, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x1f223, 0, 0, 0, g(Yes, No, false, false, "", "販")},
- {0x1f224, 0, 0, 0, g(Yes, No, false, false, "", "声")},
- {0x1f225, 0, 0, 0, g(Yes, No, false, false, "", "吹")},
- {0x1f226, 0, 0, 0, g(Yes, No, false, false, "", "演")},
- {0x1f227, 0, 0, 0, g(Yes, No, false, false, "", "投")},
- {0x1f228, 0, 0, 0, g(Yes, No, false, false, "", "捕")},
- {0x1f229, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x1f22a, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x1f22b, 0, 0, 0, g(Yes, No, false, false, "", "遊")},
- {0x1f22c, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x1f22d, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x1f22e, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x1f22f, 0, 0, 0, g(Yes, No, false, false, "", "指")},
- {0x1f230, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x1f231, 0, 0, 0, g(Yes, No, false, false, "", "打")},
- {0x1f232, 0, 0, 0, g(Yes, No, false, false, "", "禁")},
- {0x1f233, 0, 0, 0, g(Yes, No, false, false, "", "空")},
- {0x1f234, 0, 0, 0, g(Yes, No, false, false, "", "合")},
- {0x1f235, 0, 0, 0, g(Yes, No, false, false, "", "満")},
- {0x1f236, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x1f237, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x1f238, 0, 0, 0, g(Yes, No, false, false, "", "申")},
- {0x1f239, 0, 0, 0, g(Yes, No, false, false, "", "割")},
- {0x1f23a, 0, 0, 0, g(Yes, No, false, false, "", "営")},
- {0x1f23b, 0, 0, 0, g(Yes, No, false, false, "", "配")},
- {0x1f23c, 0, 0, 0, f(Yes, false, "")},
- {0x1f240, 0, 0, 0, g(Yes, No, false, false, "", "〔本〕")},
- {0x1f241, 0, 0, 0, g(Yes, No, false, false, "", "〔三〕")},
- {0x1f242, 0, 0, 0, g(Yes, No, false, false, "", "〔二〕")},
- {0x1f243, 0, 0, 0, g(Yes, No, false, false, "", "〔安〕")},
- {0x1f244, 0, 0, 0, g(Yes, No, false, false, "", "〔点〕")},
- {0x1f245, 0, 0, 0, g(Yes, No, false, false, "", "〔打〕")},
- {0x1f246, 0, 0, 0, g(Yes, No, false, false, "", "〔盗〕")},
- {0x1f247, 0, 0, 0, g(Yes, No, false, false, "", "〔勝〕")},
- {0x1f248, 0, 0, 0, g(Yes, No, false, false, "", "〔敗〕")},
- {0x1f249, 0, 0, 0, f(Yes, false, "")},
- {0x1f250, 0, 0, 0, g(Yes, No, false, false, "", "得")},
- {0x1f251, 0, 0, 0, g(Yes, No, false, false, "", "可")},
- {0x1f252, 0, 0, 0, f(Yes, false, "")},
- {0x2f800, 0, 0, 0, f(No, false, "丽")},
- {0x2f801, 0, 0, 0, f(No, false, "丸")},
- {0x2f802, 0, 0, 0, f(No, false, "乁")},
- {0x2f803, 0, 0, 0, f(No, false, "𠄢")},
- {0x2f804, 0, 0, 0, f(No, false, "你")},
- {0x2f805, 0, 0, 0, f(No, false, "侮")},
- {0x2f806, 0, 0, 0, f(No, false, "侻")},
- {0x2f807, 0, 0, 0, f(No, false, "倂")},
- {0x2f808, 0, 0, 0, f(No, false, "偺")},
- {0x2f809, 0, 0, 0, f(No, false, "備")},
- {0x2f80a, 0, 0, 0, f(No, false, "僧")},
- {0x2f80b, 0, 0, 0, f(No, false, "像")},
- {0x2f80c, 0, 0, 0, f(No, false, "㒞")},
- {0x2f80d, 0, 0, 0, f(No, false, "𠘺")},
- {0x2f80e, 0, 0, 0, f(No, false, "免")},
- {0x2f80f, 0, 0, 0, f(No, false, "兔")},
- {0x2f810, 0, 0, 0, f(No, false, "兤")},
- {0x2f811, 0, 0, 0, f(No, false, "具")},
- {0x2f812, 0, 0, 0, f(No, false, "𠔜")},
- {0x2f813, 0, 0, 0, f(No, false, "㒹")},
- {0x2f814, 0, 0, 0, f(No, false, "內")},
- {0x2f815, 0, 0, 0, f(No, false, "再")},
- {0x2f816, 0, 0, 0, f(No, false, "𠕋")},
- {0x2f817, 0, 0, 0, f(No, false, "冗")},
- {0x2f818, 0, 0, 0, f(No, false, "冤")},
- {0x2f819, 0, 0, 0, f(No, false, "仌")},
- {0x2f81a, 0, 0, 0, f(No, false, "冬")},
- {0x2f81b, 0, 0, 0, f(No, false, "况")},
- {0x2f81c, 0, 0, 0, f(No, false, "𩇟")},
- {0x2f81d, 0, 0, 0, f(No, false, "凵")},
- {0x2f81e, 0, 0, 0, f(No, false, "刃")},
- {0x2f81f, 0, 0, 0, f(No, false, "㓟")},
- {0x2f820, 0, 0, 0, f(No, false, "刻")},
- {0x2f821, 0, 0, 0, f(No, false, "剆")},
- {0x2f822, 0, 0, 0, f(No, false, "割")},
- {0x2f823, 0, 0, 0, f(No, false, "剷")},
- {0x2f824, 0, 0, 0, f(No, false, "㔕")},
- {0x2f825, 0, 0, 0, f(No, false, "勇")},
- {0x2f826, 0, 0, 0, f(No, false, "勉")},
- {0x2f827, 0, 0, 0, f(No, false, "勤")},
- {0x2f828, 0, 0, 0, f(No, false, "勺")},
- {0x2f829, 0, 0, 0, f(No, false, "包")},
- {0x2f82a, 0, 0, 0, f(No, false, "匆")},
- {0x2f82b, 0, 0, 0, f(No, false, "北")},
- {0x2f82c, 0, 0, 0, f(No, false, "卉")},
- {0x2f82d, 0, 0, 0, f(No, false, "卑")},
- {0x2f82e, 0, 0, 0, f(No, false, "博")},
- {0x2f82f, 0, 0, 0, f(No, false, "即")},
- {0x2f830, 0, 0, 0, f(No, false, "卽")},
- {0x2f831, 0, 0, 0, f(No, false, "卿")},
- {0x2f834, 0, 0, 0, f(No, false, "𠨬")},
- {0x2f835, 0, 0, 0, f(No, false, "灰")},
- {0x2f836, 0, 0, 0, f(No, false, "及")},
- {0x2f837, 0, 0, 0, f(No, false, "叟")},
- {0x2f838, 0, 0, 0, f(No, false, "𠭣")},
- {0x2f839, 0, 0, 0, f(No, false, "叫")},
- {0x2f83a, 0, 0, 0, f(No, false, "叱")},
- {0x2f83b, 0, 0, 0, f(No, false, "吆")},
- {0x2f83c, 0, 0, 0, f(No, false, "咞")},
- {0x2f83d, 0, 0, 0, f(No, false, "吸")},
- {0x2f83e, 0, 0, 0, f(No, false, "呈")},
- {0x2f83f, 0, 0, 0, f(No, false, "周")},
- {0x2f840, 0, 0, 0, f(No, false, "咢")},
- {0x2f841, 0, 0, 0, f(No, false, "哶")},
- {0x2f842, 0, 0, 0, f(No, false, "唐")},
- {0x2f843, 0, 0, 0, f(No, false, "啓")},
- {0x2f844, 0, 0, 0, f(No, false, "啣")},
- {0x2f845, 0, 0, 0, f(No, false, "善")},
- {0x2f847, 0, 0, 0, f(No, false, "喙")},
- {0x2f848, 0, 0, 0, f(No, false, "喫")},
- {0x2f849, 0, 0, 0, f(No, false, "喳")},
- {0x2f84a, 0, 0, 0, f(No, false, "嗂")},
- {0x2f84b, 0, 0, 0, f(No, false, "圖")},
- {0x2f84c, 0, 0, 0, f(No, false, "嘆")},
- {0x2f84d, 0, 0, 0, f(No, false, "圗")},
- {0x2f84e, 0, 0, 0, f(No, false, "噑")},
- {0x2f84f, 0, 0, 0, f(No, false, "噴")},
- {0x2f850, 0, 0, 0, f(No, false, "切")},
- {0x2f851, 0, 0, 0, f(No, false, "壮")},
- {0x2f852, 0, 0, 0, f(No, false, "城")},
- {0x2f853, 0, 0, 0, f(No, false, "埴")},
- {0x2f854, 0, 0, 0, f(No, false, "堍")},
- {0x2f855, 0, 0, 0, f(No, false, "型")},
- {0x2f856, 0, 0, 0, f(No, false, "堲")},
- {0x2f857, 0, 0, 0, f(No, false, "報")},
- {0x2f858, 0, 0, 0, f(No, false, "墬")},
- {0x2f859, 0, 0, 0, f(No, false, "𡓤")},
- {0x2f85a, 0, 0, 0, f(No, false, "売")},
- {0x2f85b, 0, 0, 0, f(No, false, "壷")},
- {0x2f85c, 0, 0, 0, f(No, false, "夆")},
- {0x2f85d, 0, 0, 0, f(No, false, "多")},
- {0x2f85e, 0, 0, 0, f(No, false, "夢")},
- {0x2f85f, 0, 0, 0, f(No, false, "奢")},
- {0x2f860, 0, 0, 0, f(No, false, "𡚨")},
- {0x2f861, 0, 0, 0, f(No, false, "𡛪")},
- {0x2f862, 0, 0, 0, f(No, false, "姬")},
- {0x2f863, 0, 0, 0, f(No, false, "娛")},
- {0x2f864, 0, 0, 0, f(No, false, "娧")},
- {0x2f865, 0, 0, 0, f(No, false, "姘")},
- {0x2f866, 0, 0, 0, f(No, false, "婦")},
- {0x2f867, 0, 0, 0, f(No, false, "㛮")},
- {0x2f868, 0, 0, 0, f(No, false, "㛼")},
- {0x2f869, 0, 0, 0, f(No, false, "嬈")},
- {0x2f86a, 0, 0, 0, f(No, false, "嬾")},
- {0x2f86c, 0, 0, 0, f(No, false, "𡧈")},
- {0x2f86d, 0, 0, 0, f(No, false, "寃")},
- {0x2f86e, 0, 0, 0, f(No, false, "寘")},
- {0x2f86f, 0, 0, 0, f(No, false, "寧")},
- {0x2f870, 0, 0, 0, f(No, false, "寳")},
- {0x2f871, 0, 0, 0, f(No, false, "𡬘")},
- {0x2f872, 0, 0, 0, f(No, false, "寿")},
- {0x2f873, 0, 0, 0, f(No, false, "将")},
- {0x2f874, 0, 0, 0, f(No, false, "当")},
- {0x2f875, 0, 0, 0, f(No, false, "尢")},
- {0x2f876, 0, 0, 0, f(No, false, "㞁")},
- {0x2f877, 0, 0, 0, f(No, false, "屠")},
- {0x2f878, 0, 0, 0, f(No, false, "屮")},
- {0x2f879, 0, 0, 0, f(No, false, "峀")},
- {0x2f87a, 0, 0, 0, f(No, false, "岍")},
- {0x2f87b, 0, 0, 0, f(No, false, "𡷤")},
- {0x2f87c, 0, 0, 0, f(No, false, "嵃")},
- {0x2f87d, 0, 0, 0, f(No, false, "𡷦")},
- {0x2f87e, 0, 0, 0, f(No, false, "嵮")},
- {0x2f87f, 0, 0, 0, f(No, false, "嵫")},
- {0x2f880, 0, 0, 0, f(No, false, "嵼")},
- {0x2f881, 0, 0, 0, f(No, false, "巡")},
- {0x2f882, 0, 0, 0, f(No, false, "巢")},
- {0x2f883, 0, 0, 0, f(No, false, "㠯")},
- {0x2f884, 0, 0, 0, f(No, false, "巽")},
- {0x2f885, 0, 0, 0, f(No, false, "帨")},
- {0x2f886, 0, 0, 0, f(No, false, "帽")},
- {0x2f887, 0, 0, 0, f(No, false, "幩")},
- {0x2f888, 0, 0, 0, f(No, false, "㡢")},
- {0x2f889, 0, 0, 0, f(No, false, "𢆃")},
- {0x2f88a, 0, 0, 0, f(No, false, "㡼")},
- {0x2f88b, 0, 0, 0, f(No, false, "庰")},
- {0x2f88c, 0, 0, 0, f(No, false, "庳")},
- {0x2f88d, 0, 0, 0, f(No, false, "庶")},
- {0x2f88e, 0, 0, 0, f(No, false, "廊")},
- {0x2f88f, 0, 0, 0, f(No, false, "𪎒")},
- {0x2f890, 0, 0, 0, f(No, false, "廾")},
- {0x2f891, 0, 0, 0, f(No, false, "𢌱")},
- {0x2f893, 0, 0, 0, f(No, false, "舁")},
- {0x2f894, 0, 0, 0, f(No, false, "弢")},
- {0x2f896, 0, 0, 0, f(No, false, "㣇")},
- {0x2f897, 0, 0, 0, f(No, false, "𣊸")},
- {0x2f898, 0, 0, 0, f(No, false, "𦇚")},
- {0x2f899, 0, 0, 0, f(No, false, "形")},
- {0x2f89a, 0, 0, 0, f(No, false, "彫")},
- {0x2f89b, 0, 0, 0, f(No, false, "㣣")},
- {0x2f89c, 0, 0, 0, f(No, false, "徚")},
- {0x2f89d, 0, 0, 0, f(No, false, "忍")},
- {0x2f89e, 0, 0, 0, f(No, false, "志")},
- {0x2f89f, 0, 0, 0, f(No, false, "忹")},
- {0x2f8a0, 0, 0, 0, f(No, false, "悁")},
- {0x2f8a1, 0, 0, 0, f(No, false, "㤺")},
- {0x2f8a2, 0, 0, 0, f(No, false, "㤜")},
- {0x2f8a3, 0, 0, 0, f(No, false, "悔")},
- {0x2f8a4, 0, 0, 0, f(No, false, "𢛔")},
- {0x2f8a5, 0, 0, 0, f(No, false, "惇")},
- {0x2f8a6, 0, 0, 0, f(No, false, "慈")},
- {0x2f8a7, 0, 0, 0, f(No, false, "慌")},
- {0x2f8a8, 0, 0, 0, f(No, false, "慎")},
- {0x2f8a9, 0, 0, 0, f(No, false, "慌")},
- {0x2f8aa, 0, 0, 0, f(No, false, "慺")},
- {0x2f8ab, 0, 0, 0, f(No, false, "憎")},
- {0x2f8ac, 0, 0, 0, f(No, false, "憲")},
- {0x2f8ad, 0, 0, 0, f(No, false, "憤")},
- {0x2f8ae, 0, 0, 0, f(No, false, "憯")},
- {0x2f8af, 0, 0, 0, f(No, false, "懞")},
- {0x2f8b0, 0, 0, 0, f(No, false, "懲")},
- {0x2f8b1, 0, 0, 0, f(No, false, "懶")},
- {0x2f8b2, 0, 0, 0, f(No, false, "成")},
- {0x2f8b3, 0, 0, 0, f(No, false, "戛")},
- {0x2f8b4, 0, 0, 0, f(No, false, "扝")},
- {0x2f8b5, 0, 0, 0, f(No, false, "抱")},
- {0x2f8b6, 0, 0, 0, f(No, false, "拔")},
- {0x2f8b7, 0, 0, 0, f(No, false, "捐")},
- {0x2f8b8, 0, 0, 0, f(No, false, "𢬌")},
- {0x2f8b9, 0, 0, 0, f(No, false, "挽")},
- {0x2f8ba, 0, 0, 0, f(No, false, "拼")},
- {0x2f8bb, 0, 0, 0, f(No, false, "捨")},
- {0x2f8bc, 0, 0, 0, f(No, false, "掃")},
- {0x2f8bd, 0, 0, 0, f(No, false, "揤")},
- {0x2f8be, 0, 0, 0, f(No, false, "𢯱")},
- {0x2f8bf, 0, 0, 0, f(No, false, "搢")},
- {0x2f8c0, 0, 0, 0, f(No, false, "揅")},
- {0x2f8c1, 0, 0, 0, f(No, false, "掩")},
- {0x2f8c2, 0, 0, 0, f(No, false, "㨮")},
- {0x2f8c3, 0, 0, 0, f(No, false, "摩")},
- {0x2f8c4, 0, 0, 0, f(No, false, "摾")},
- {0x2f8c5, 0, 0, 0, f(No, false, "撝")},
- {0x2f8c6, 0, 0, 0, f(No, false, "摷")},
- {0x2f8c7, 0, 0, 0, f(No, false, "㩬")},
- {0x2f8c8, 0, 0, 0, f(No, false, "敏")},
- {0x2f8c9, 0, 0, 0, f(No, false, "敬")},
- {0x2f8ca, 0, 0, 0, f(No, false, "𣀊")},
- {0x2f8cb, 0, 0, 0, f(No, false, "旣")},
- {0x2f8cc, 0, 0, 0, f(No, false, "書")},
- {0x2f8cd, 0, 0, 0, f(No, false, "晉")},
- {0x2f8ce, 0, 0, 0, f(No, false, "㬙")},
- {0x2f8cf, 0, 0, 0, f(No, false, "暑")},
- {0x2f8d0, 0, 0, 0, f(No, false, "㬈")},
- {0x2f8d1, 0, 0, 0, f(No, false, "㫤")},
- {0x2f8d2, 0, 0, 0, f(No, false, "冒")},
- {0x2f8d3, 0, 0, 0, f(No, false, "冕")},
- {0x2f8d4, 0, 0, 0, f(No, false, "最")},
- {0x2f8d5, 0, 0, 0, f(No, false, "暜")},
- {0x2f8d6, 0, 0, 0, f(No, false, "肭")},
- {0x2f8d7, 0, 0, 0, f(No, false, "䏙")},
- {0x2f8d8, 0, 0, 0, f(No, false, "朗")},
- {0x2f8d9, 0, 0, 0, f(No, false, "望")},
- {0x2f8da, 0, 0, 0, f(No, false, "朡")},
- {0x2f8db, 0, 0, 0, f(No, false, "杞")},
- {0x2f8dc, 0, 0, 0, f(No, false, "杓")},
- {0x2f8dd, 0, 0, 0, f(No, false, "𣏃")},
- {0x2f8de, 0, 0, 0, f(No, false, "㭉")},
- {0x2f8df, 0, 0, 0, f(No, false, "柺")},
- {0x2f8e0, 0, 0, 0, f(No, false, "枅")},
- {0x2f8e1, 0, 0, 0, f(No, false, "桒")},
- {0x2f8e2, 0, 0, 0, f(No, false, "梅")},
- {0x2f8e3, 0, 0, 0, f(No, false, "𣑭")},
- {0x2f8e4, 0, 0, 0, f(No, false, "梎")},
- {0x2f8e5, 0, 0, 0, f(No, false, "栟")},
- {0x2f8e6, 0, 0, 0, f(No, false, "椔")},
- {0x2f8e7, 0, 0, 0, f(No, false, "㮝")},
- {0x2f8e8, 0, 0, 0, f(No, false, "楂")},
- {0x2f8e9, 0, 0, 0, f(No, false, "榣")},
- {0x2f8ea, 0, 0, 0, f(No, false, "槪")},
- {0x2f8eb, 0, 0, 0, f(No, false, "檨")},
- {0x2f8ec, 0, 0, 0, f(No, false, "𣚣")},
- {0x2f8ed, 0, 0, 0, f(No, false, "櫛")},
- {0x2f8ee, 0, 0, 0, f(No, false, "㰘")},
- {0x2f8ef, 0, 0, 0, f(No, false, "次")},
- {0x2f8f0, 0, 0, 0, f(No, false, "𣢧")},
- {0x2f8f1, 0, 0, 0, f(No, false, "歔")},
- {0x2f8f2, 0, 0, 0, f(No, false, "㱎")},
- {0x2f8f3, 0, 0, 0, f(No, false, "歲")},
- {0x2f8f4, 0, 0, 0, f(No, false, "殟")},
- {0x2f8f5, 0, 0, 0, f(No, false, "殺")},
- {0x2f8f6, 0, 0, 0, f(No, false, "殻")},
- {0x2f8f7, 0, 0, 0, f(No, false, "𣪍")},
- {0x2f8f8, 0, 0, 0, f(No, false, "𡴋")},
- {0x2f8f9, 0, 0, 0, f(No, false, "𣫺")},
- {0x2f8fa, 0, 0, 0, f(No, false, "汎")},
- {0x2f8fb, 0, 0, 0, f(No, false, "𣲼")},
- {0x2f8fc, 0, 0, 0, f(No, false, "沿")},
- {0x2f8fd, 0, 0, 0, f(No, false, "泍")},
- {0x2f8fe, 0, 0, 0, f(No, false, "汧")},
- {0x2f8ff, 0, 0, 0, f(No, false, "洖")},
- {0x2f900, 0, 0, 0, f(No, false, "派")},
- {0x2f901, 0, 0, 0, f(No, false, "海")},
- {0x2f902, 0, 0, 0, f(No, false, "流")},
- {0x2f903, 0, 0, 0, f(No, false, "浩")},
- {0x2f904, 0, 0, 0, f(No, false, "浸")},
- {0x2f905, 0, 0, 0, f(No, false, "涅")},
- {0x2f906, 0, 0, 0, f(No, false, "𣴞")},
- {0x2f907, 0, 0, 0, f(No, false, "洴")},
- {0x2f908, 0, 0, 0, f(No, false, "港")},
- {0x2f909, 0, 0, 0, f(No, false, "湮")},
- {0x2f90a, 0, 0, 0, f(No, false, "㴳")},
- {0x2f90b, 0, 0, 0, f(No, false, "滋")},
- {0x2f90c, 0, 0, 0, f(No, false, "滇")},
- {0x2f90d, 0, 0, 0, f(No, false, "𣻑")},
- {0x2f90e, 0, 0, 0, f(No, false, "淹")},
- {0x2f90f, 0, 0, 0, f(No, false, "潮")},
- {0x2f910, 0, 0, 0, f(No, false, "𣽞")},
- {0x2f911, 0, 0, 0, f(No, false, "𣾎")},
- {0x2f912, 0, 0, 0, f(No, false, "濆")},
- {0x2f913, 0, 0, 0, f(No, false, "瀹")},
- {0x2f914, 0, 0, 0, f(No, false, "瀞")},
- {0x2f915, 0, 0, 0, f(No, false, "瀛")},
- {0x2f916, 0, 0, 0, f(No, false, "㶖")},
- {0x2f917, 0, 0, 0, f(No, false, "灊")},
- {0x2f918, 0, 0, 0, f(No, false, "災")},
- {0x2f919, 0, 0, 0, f(No, false, "灷")},
- {0x2f91a, 0, 0, 0, f(No, false, "炭")},
- {0x2f91b, 0, 0, 0, f(No, false, "𠔥")},
- {0x2f91c, 0, 0, 0, f(No, false, "煅")},
- {0x2f91d, 0, 0, 0, f(No, false, "𤉣")},
- {0x2f91e, 0, 0, 0, f(No, false, "熜")},
- {0x2f91f, 0, 0, 0, f(No, false, "𤎫")},
- {0x2f920, 0, 0, 0, f(No, false, "爨")},
- {0x2f921, 0, 0, 0, f(No, false, "爵")},
- {0x2f922, 0, 0, 0, f(No, false, "牐")},
- {0x2f923, 0, 0, 0, f(No, false, "𤘈")},
- {0x2f924, 0, 0, 0, f(No, false, "犀")},
- {0x2f925, 0, 0, 0, f(No, false, "犕")},
- {0x2f926, 0, 0, 0, f(No, false, "𤜵")},
- {0x2f927, 0, 0, 0, f(No, false, "𤠔")},
- {0x2f928, 0, 0, 0, f(No, false, "獺")},
- {0x2f929, 0, 0, 0, f(No, false, "王")},
- {0x2f92a, 0, 0, 0, f(No, false, "㺬")},
- {0x2f92b, 0, 0, 0, f(No, false, "玥")},
- {0x2f92c, 0, 0, 0, f(No, false, "㺸")},
- {0x2f92e, 0, 0, 0, f(No, false, "瑇")},
- {0x2f92f, 0, 0, 0, f(No, false, "瑜")},
- {0x2f930, 0, 0, 0, f(No, false, "瑱")},
- {0x2f931, 0, 0, 0, f(No, false, "璅")},
- {0x2f932, 0, 0, 0, f(No, false, "瓊")},
- {0x2f933, 0, 0, 0, f(No, false, "㼛")},
- {0x2f934, 0, 0, 0, f(No, false, "甤")},
- {0x2f935, 0, 0, 0, f(No, false, "𤰶")},
- {0x2f936, 0, 0, 0, f(No, false, "甾")},
- {0x2f937, 0, 0, 0, f(No, false, "𤲒")},
- {0x2f938, 0, 0, 0, f(No, false, "異")},
- {0x2f939, 0, 0, 0, f(No, false, "𢆟")},
- {0x2f93a, 0, 0, 0, f(No, false, "瘐")},
- {0x2f93b, 0, 0, 0, f(No, false, "𤾡")},
- {0x2f93c, 0, 0, 0, f(No, false, "𤾸")},
- {0x2f93d, 0, 0, 0, f(No, false, "𥁄")},
- {0x2f93e, 0, 0, 0, f(No, false, "㿼")},
- {0x2f93f, 0, 0, 0, f(No, false, "䀈")},
- {0x2f940, 0, 0, 0, f(No, false, "直")},
- {0x2f941, 0, 0, 0, f(No, false, "𥃳")},
- {0x2f942, 0, 0, 0, f(No, false, "𥃲")},
- {0x2f943, 0, 0, 0, f(No, false, "𥄙")},
- {0x2f944, 0, 0, 0, f(No, false, "𥄳")},
- {0x2f945, 0, 0, 0, f(No, false, "眞")},
- {0x2f946, 0, 0, 0, f(No, false, "真")},
- {0x2f948, 0, 0, 0, f(No, false, "睊")},
- {0x2f949, 0, 0, 0, f(No, false, "䀹")},
- {0x2f94a, 0, 0, 0, f(No, false, "瞋")},
- {0x2f94b, 0, 0, 0, f(No, false, "䁆")},
- {0x2f94c, 0, 0, 0, f(No, false, "䂖")},
- {0x2f94d, 0, 0, 0, f(No, false, "𥐝")},
- {0x2f94e, 0, 0, 0, f(No, false, "硎")},
- {0x2f94f, 0, 0, 0, f(No, false, "碌")},
- {0x2f950, 0, 0, 0, f(No, false, "磌")},
- {0x2f951, 0, 0, 0, f(No, false, "䃣")},
- {0x2f952, 0, 0, 0, f(No, false, "𥘦")},
- {0x2f953, 0, 0, 0, f(No, false, "祖")},
- {0x2f954, 0, 0, 0, f(No, false, "𥚚")},
- {0x2f955, 0, 0, 0, f(No, false, "𥛅")},
- {0x2f956, 0, 0, 0, f(No, false, "福")},
- {0x2f957, 0, 0, 0, f(No, false, "秫")},
- {0x2f958, 0, 0, 0, f(No, false, "䄯")},
- {0x2f959, 0, 0, 0, f(No, false, "穀")},
- {0x2f95a, 0, 0, 0, f(No, false, "穊")},
- {0x2f95b, 0, 0, 0, f(No, false, "穏")},
- {0x2f95c, 0, 0, 0, f(No, false, "𥥼")},
- {0x2f95d, 0, 0, 0, f(No, false, "𥪧")},
- {0x2f95f, 0, 0, 0, f(No, false, "竮")},
- {0x2f960, 0, 0, 0, f(No, false, "䈂")},
- {0x2f961, 0, 0, 0, f(No, false, "𥮫")},
- {0x2f962, 0, 0, 0, f(No, false, "篆")},
- {0x2f963, 0, 0, 0, f(No, false, "築")},
- {0x2f964, 0, 0, 0, f(No, false, "䈧")},
- {0x2f965, 0, 0, 0, f(No, false, "𥲀")},
- {0x2f966, 0, 0, 0, f(No, false, "糒")},
- {0x2f967, 0, 0, 0, f(No, false, "䊠")},
- {0x2f968, 0, 0, 0, f(No, false, "糨")},
- {0x2f969, 0, 0, 0, f(No, false, "糣")},
- {0x2f96a, 0, 0, 0, f(No, false, "紀")},
- {0x2f96b, 0, 0, 0, f(No, false, "𥾆")},
- {0x2f96c, 0, 0, 0, f(No, false, "絣")},
- {0x2f96d, 0, 0, 0, f(No, false, "䌁")},
- {0x2f96e, 0, 0, 0, f(No, false, "緇")},
- {0x2f96f, 0, 0, 0, f(No, false, "縂")},
- {0x2f970, 0, 0, 0, f(No, false, "繅")},
- {0x2f971, 0, 0, 0, f(No, false, "䌴")},
- {0x2f972, 0, 0, 0, f(No, false, "𦈨")},
- {0x2f973, 0, 0, 0, f(No, false, "𦉇")},
- {0x2f974, 0, 0, 0, f(No, false, "䍙")},
- {0x2f975, 0, 0, 0, f(No, false, "𦋙")},
- {0x2f976, 0, 0, 0, f(No, false, "罺")},
- {0x2f977, 0, 0, 0, f(No, false, "𦌾")},
- {0x2f978, 0, 0, 0, f(No, false, "羕")},
- {0x2f979, 0, 0, 0, f(No, false, "翺")},
- {0x2f97a, 0, 0, 0, f(No, false, "者")},
- {0x2f97b, 0, 0, 0, f(No, false, "𦓚")},
- {0x2f97c, 0, 0, 0, f(No, false, "𦔣")},
- {0x2f97d, 0, 0, 0, f(No, false, "聠")},
- {0x2f97e, 0, 0, 0, f(No, false, "𦖨")},
- {0x2f97f, 0, 0, 0, f(No, false, "聰")},
- {0x2f980, 0, 0, 0, f(No, false, "𣍟")},
- {0x2f981, 0, 0, 0, f(No, false, "䏕")},
- {0x2f982, 0, 0, 0, f(No, false, "育")},
- {0x2f983, 0, 0, 0, f(No, false, "脃")},
- {0x2f984, 0, 0, 0, f(No, false, "䐋")},
- {0x2f985, 0, 0, 0, f(No, false, "脾")},
- {0x2f986, 0, 0, 0, f(No, false, "媵")},
- {0x2f987, 0, 0, 0, f(No, false, "𦞧")},
- {0x2f988, 0, 0, 0, f(No, false, "𦞵")},
- {0x2f989, 0, 0, 0, f(No, false, "𣎓")},
- {0x2f98a, 0, 0, 0, f(No, false, "𣎜")},
- {0x2f98b, 0, 0, 0, f(No, false, "舁")},
- {0x2f98c, 0, 0, 0, f(No, false, "舄")},
- {0x2f98d, 0, 0, 0, f(No, false, "辞")},
- {0x2f98e, 0, 0, 0, f(No, false, "䑫")},
- {0x2f98f, 0, 0, 0, f(No, false, "芑")},
- {0x2f990, 0, 0, 0, f(No, false, "芋")},
- {0x2f991, 0, 0, 0, f(No, false, "芝")},
- {0x2f992, 0, 0, 0, f(No, false, "劳")},
- {0x2f993, 0, 0, 0, f(No, false, "花")},
- {0x2f994, 0, 0, 0, f(No, false, "芳")},
- {0x2f995, 0, 0, 0, f(No, false, "芽")},
- {0x2f996, 0, 0, 0, f(No, false, "苦")},
- {0x2f997, 0, 0, 0, f(No, false, "𦬼")},
- {0x2f998, 0, 0, 0, f(No, false, "若")},
- {0x2f999, 0, 0, 0, f(No, false, "茝")},
- {0x2f99a, 0, 0, 0, f(No, false, "荣")},
- {0x2f99b, 0, 0, 0, f(No, false, "莭")},
- {0x2f99c, 0, 0, 0, f(No, false, "茣")},
- {0x2f99d, 0, 0, 0, f(No, false, "莽")},
- {0x2f99e, 0, 0, 0, f(No, false, "菧")},
- {0x2f99f, 0, 0, 0, f(No, false, "著")},
- {0x2f9a0, 0, 0, 0, f(No, false, "荓")},
- {0x2f9a1, 0, 0, 0, f(No, false, "菊")},
- {0x2f9a2, 0, 0, 0, f(No, false, "菌")},
- {0x2f9a3, 0, 0, 0, f(No, false, "菜")},
- {0x2f9a4, 0, 0, 0, f(No, false, "𦰶")},
- {0x2f9a5, 0, 0, 0, f(No, false, "𦵫")},
- {0x2f9a6, 0, 0, 0, f(No, false, "𦳕")},
- {0x2f9a7, 0, 0, 0, f(No, false, "䔫")},
- {0x2f9a8, 0, 0, 0, f(No, false, "蓱")},
- {0x2f9a9, 0, 0, 0, f(No, false, "蓳")},
- {0x2f9aa, 0, 0, 0, f(No, false, "蔖")},
- {0x2f9ab, 0, 0, 0, f(No, false, "𧏊")},
- {0x2f9ac, 0, 0, 0, f(No, false, "蕤")},
- {0x2f9ad, 0, 0, 0, f(No, false, "𦼬")},
- {0x2f9ae, 0, 0, 0, f(No, false, "䕝")},
- {0x2f9af, 0, 0, 0, f(No, false, "䕡")},
- {0x2f9b0, 0, 0, 0, f(No, false, "𦾱")},
- {0x2f9b1, 0, 0, 0, f(No, false, "𧃒")},
- {0x2f9b2, 0, 0, 0, f(No, false, "䕫")},
- {0x2f9b3, 0, 0, 0, f(No, false, "虐")},
- {0x2f9b4, 0, 0, 0, f(No, false, "虜")},
- {0x2f9b5, 0, 0, 0, f(No, false, "虧")},
- {0x2f9b6, 0, 0, 0, f(No, false, "虩")},
- {0x2f9b7, 0, 0, 0, f(No, false, "蚩")},
- {0x2f9b8, 0, 0, 0, f(No, false, "蚈")},
- {0x2f9b9, 0, 0, 0, f(No, false, "蜎")},
- {0x2f9ba, 0, 0, 0, f(No, false, "蛢")},
- {0x2f9bb, 0, 0, 0, f(No, false, "蝹")},
- {0x2f9bc, 0, 0, 0, f(No, false, "蜨")},
- {0x2f9bd, 0, 0, 0, f(No, false, "蝫")},
- {0x2f9be, 0, 0, 0, f(No, false, "螆")},
- {0x2f9bf, 0, 0, 0, f(No, false, "䗗")},
- {0x2f9c0, 0, 0, 0, f(No, false, "蟡")},
- {0x2f9c1, 0, 0, 0, f(No, false, "蠁")},
- {0x2f9c2, 0, 0, 0, f(No, false, "䗹")},
- {0x2f9c3, 0, 0, 0, f(No, false, "衠")},
- {0x2f9c4, 0, 0, 0, f(No, false, "衣")},
- {0x2f9c5, 0, 0, 0, f(No, false, "𧙧")},
- {0x2f9c6, 0, 0, 0, f(No, false, "裗")},
- {0x2f9c7, 0, 0, 0, f(No, false, "裞")},
- {0x2f9c8, 0, 0, 0, f(No, false, "䘵")},
- {0x2f9c9, 0, 0, 0, f(No, false, "裺")},
- {0x2f9ca, 0, 0, 0, f(No, false, "㒻")},
- {0x2f9cb, 0, 0, 0, f(No, false, "𧢮")},
- {0x2f9cc, 0, 0, 0, f(No, false, "𧥦")},
- {0x2f9cd, 0, 0, 0, f(No, false, "䚾")},
- {0x2f9ce, 0, 0, 0, f(No, false, "䛇")},
- {0x2f9cf, 0, 0, 0, f(No, false, "誠")},
- {0x2f9d0, 0, 0, 0, f(No, false, "諭")},
- {0x2f9d1, 0, 0, 0, f(No, false, "變")},
- {0x2f9d2, 0, 0, 0, f(No, false, "豕")},
- {0x2f9d3, 0, 0, 0, f(No, false, "𧲨")},
- {0x2f9d4, 0, 0, 0, f(No, false, "貫")},
- {0x2f9d5, 0, 0, 0, f(No, false, "賁")},
- {0x2f9d6, 0, 0, 0, f(No, false, "贛")},
- {0x2f9d7, 0, 0, 0, f(No, false, "起")},
- {0x2f9d8, 0, 0, 0, f(No, false, "𧼯")},
- {0x2f9d9, 0, 0, 0, f(No, false, "𠠄")},
- {0x2f9da, 0, 0, 0, f(No, false, "跋")},
- {0x2f9db, 0, 0, 0, f(No, false, "趼")},
- {0x2f9dc, 0, 0, 0, f(No, false, "跰")},
- {0x2f9dd, 0, 0, 0, f(No, false, "𠣞")},
- {0x2f9de, 0, 0, 0, f(No, false, "軔")},
- {0x2f9df, 0, 0, 0, f(No, false, "輸")},
- {0x2f9e0, 0, 0, 0, f(No, false, "𨗒")},
- {0x2f9e1, 0, 0, 0, f(No, false, "𨗭")},
- {0x2f9e2, 0, 0, 0, f(No, false, "邔")},
- {0x2f9e3, 0, 0, 0, f(No, false, "郱")},
- {0x2f9e4, 0, 0, 0, f(No, false, "鄑")},
- {0x2f9e5, 0, 0, 0, f(No, false, "𨜮")},
- {0x2f9e6, 0, 0, 0, f(No, false, "鄛")},
- {0x2f9e7, 0, 0, 0, f(No, false, "鈸")},
- {0x2f9e8, 0, 0, 0, f(No, false, "鋗")},
- {0x2f9e9, 0, 0, 0, f(No, false, "鋘")},
- {0x2f9ea, 0, 0, 0, f(No, false, "鉼")},
- {0x2f9eb, 0, 0, 0, f(No, false, "鏹")},
- {0x2f9ec, 0, 0, 0, f(No, false, "鐕")},
- {0x2f9ed, 0, 0, 0, f(No, false, "𨯺")},
- {0x2f9ee, 0, 0, 0, f(No, false, "開")},
- {0x2f9ef, 0, 0, 0, f(No, false, "䦕")},
- {0x2f9f0, 0, 0, 0, f(No, false, "閷")},
- {0x2f9f1, 0, 0, 0, f(No, false, "𨵷")},
- {0x2f9f2, 0, 0, 0, f(No, false, "䧦")},
- {0x2f9f3, 0, 0, 0, f(No, false, "雃")},
- {0x2f9f4, 0, 0, 0, f(No, false, "嶲")},
- {0x2f9f5, 0, 0, 0, f(No, false, "霣")},
- {0x2f9f6, 0, 0, 0, f(No, false, "𩅅")},
- {0x2f9f7, 0, 0, 0, f(No, false, "𩈚")},
- {0x2f9f8, 0, 0, 0, f(No, false, "䩮")},
- {0x2f9f9, 0, 0, 0, f(No, false, "䩶")},
- {0x2f9fa, 0, 0, 0, f(No, false, "韠")},
- {0x2f9fb, 0, 0, 0, f(No, false, "𩐊")},
- {0x2f9fc, 0, 0, 0, f(No, false, "䪲")},
- {0x2f9fd, 0, 0, 0, f(No, false, "𩒖")},
- {0x2f9fe, 0, 0, 0, f(No, false, "頋")},
- {0x2fa00, 0, 0, 0, f(No, false, "頩")},
- {0x2fa01, 0, 0, 0, f(No, false, "𩖶")},
- {0x2fa02, 0, 0, 0, f(No, false, "飢")},
- {0x2fa03, 0, 0, 0, f(No, false, "䬳")},
- {0x2fa04, 0, 0, 0, f(No, false, "餩")},
- {0x2fa05, 0, 0, 0, f(No, false, "馧")},
- {0x2fa06, 0, 0, 0, f(No, false, "駂")},
- {0x2fa07, 0, 0, 0, f(No, false, "駾")},
- {0x2fa08, 0, 0, 0, f(No, false, "䯎")},
- {0x2fa09, 0, 0, 0, f(No, false, "𩬰")},
- {0x2fa0a, 0, 0, 0, f(No, false, "鬒")},
- {0x2fa0b, 0, 0, 0, f(No, false, "鱀")},
- {0x2fa0c, 0, 0, 0, f(No, false, "鳽")},
- {0x2fa0d, 0, 0, 0, f(No, false, "䳎")},
- {0x2fa0e, 0, 0, 0, f(No, false, "䳭")},
- {0x2fa0f, 0, 0, 0, f(No, false, "鵧")},
- {0x2fa10, 0, 0, 0, f(No, false, "𪃎")},
- {0x2fa11, 0, 0, 0, f(No, false, "䳸")},
- {0x2fa12, 0, 0, 0, f(No, false, "𪄅")},
- {0x2fa13, 0, 0, 0, f(No, false, "𪈎")},
- {0x2fa14, 0, 0, 0, f(No, false, "𪊑")},
- {0x2fa15, 0, 0, 0, f(No, false, "麻")},
- {0x2fa16, 0, 0, 0, f(No, false, "䵖")},
- {0x2fa17, 0, 0, 0, f(No, false, "黹")},
- {0x2fa18, 0, 0, 0, f(No, false, "黾")},
- {0x2fa19, 0, 0, 0, f(No, false, "鼅")},
- {0x2fa1a, 0, 0, 0, f(No, false, "鼏")},
- {0x2fa1b, 0, 0, 0, f(No, false, "鼖")},
- {0x2fa1c, 0, 0, 0, f(No, false, "鼻")},
- {0x2fa1d, 0, 0, 0, f(No, false, "𪘀")},
- {0x2fa1e, 0, 0, 0, f(Yes, false, "")},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go
deleted file mode 100644
index b1be64d55d8..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go
+++ /dev/null
@@ -1,7409 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-// +build !go1.10
-
-package norm
-
-const (
- Yes = iota
- No
- Maybe
-)
-
-type formData struct {
- qc uint8
- combinesForward bool
- decomposition string
-}
-
-type runeData struct {
- r rune
- ccc uint8
- nLead uint8
- nTrail uint8
- f [2]formData // 0: canonical; 1: compatibility
-}
-
-func f(qc uint8, cf bool, dec string) [2]formData {
- return [2]formData{{qc, cf, dec}, {qc, cf, dec}}
-}
-
-func g(qc, qck uint8, cf, cfk bool, d, dk string) [2]formData {
- return [2]formData{{qc, cf, d}, {qck, cfk, dk}}
-}
-
-var testData = []runeData{
- {0x0, 0, 0, 0, f(Yes, false, "")},
- {0x3c, 0, 0, 0, f(Yes, true, "")},
- {0x3f, 0, 0, 0, f(Yes, false, "")},
- {0x41, 0, 0, 0, f(Yes, true, "")},
- {0x51, 0, 0, 0, f(Yes, false, "")},
- {0x52, 0, 0, 0, f(Yes, true, "")},
- {0x5b, 0, 0, 0, f(Yes, false, "")},
- {0x61, 0, 0, 0, f(Yes, true, "")},
- {0x71, 0, 0, 0, f(Yes, false, "")},
- {0x72, 0, 0, 0, f(Yes, true, "")},
- {0x7b, 0, 0, 0, f(Yes, false, "")},
- {0xa0, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0xa1, 0, 0, 0, f(Yes, false, "")},
- {0xa8, 0, 0, 1, g(Yes, No, true, false, "", " ̈")},
- {0xa9, 0, 0, 0, f(Yes, false, "")},
- {0xaa, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xab, 0, 0, 0, f(Yes, false, "")},
- {0xaf, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xb0, 0, 0, 0, f(Yes, false, "")},
- {0xb2, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xb3, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xb4, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0xb5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0xb6, 0, 0, 0, f(Yes, false, "")},
- {0xb8, 0, 0, 1, g(Yes, No, false, false, "", " ̧")},
- {0xb9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xba, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xbb, 0, 0, 0, f(Yes, false, "")},
- {0xbc, 0, 0, 0, g(Yes, No, false, false, "", "1⁄4")},
- {0xbd, 0, 0, 0, g(Yes, No, false, false, "", "1⁄2")},
- {0xbe, 0, 0, 0, g(Yes, No, false, false, "", "3⁄4")},
- {0xbf, 0, 0, 0, f(Yes, false, "")},
- {0xc0, 0, 0, 1, f(Yes, false, "À")},
- {0xc1, 0, 0, 1, f(Yes, false, "Á")},
- {0xc2, 0, 0, 1, f(Yes, true, "Â")},
- {0xc3, 0, 0, 1, f(Yes, false, "Ã")},
- {0xc4, 0, 0, 1, f(Yes, true, "Ä")},
- {0xc5, 0, 0, 1, f(Yes, true, "Å")},
- {0xc6, 0, 0, 0, f(Yes, true, "")},
- {0xc7, 0, 0, 1, f(Yes, true, "Ç")},
- {0xc8, 0, 0, 1, f(Yes, false, "È")},
- {0xc9, 0, 0, 1, f(Yes, false, "É")},
- {0xca, 0, 0, 1, f(Yes, true, "Ê")},
- {0xcb, 0, 0, 1, f(Yes, false, "Ë")},
- {0xcc, 0, 0, 1, f(Yes, false, "Ì")},
- {0xcd, 0, 0, 1, f(Yes, false, "Í")},
- {0xce, 0, 0, 1, f(Yes, false, "Î")},
- {0xcf, 0, 0, 1, f(Yes, true, "Ï")},
- {0xd0, 0, 0, 0, f(Yes, false, "")},
- {0xd1, 0, 0, 1, f(Yes, false, "Ñ")},
- {0xd2, 0, 0, 1, f(Yes, false, "Ò")},
- {0xd3, 0, 0, 1, f(Yes, false, "Ó")},
- {0xd4, 0, 0, 1, f(Yes, true, "Ô")},
- {0xd5, 0, 0, 1, f(Yes, true, "Õ")},
- {0xd6, 0, 0, 1, f(Yes, true, "Ö")},
- {0xd7, 0, 0, 0, f(Yes, false, "")},
- {0xd8, 0, 0, 0, f(Yes, true, "")},
- {0xd9, 0, 0, 1, f(Yes, false, "Ù")},
- {0xda, 0, 0, 1, f(Yes, false, "Ú")},
- {0xdb, 0, 0, 1, f(Yes, false, "Û")},
- {0xdc, 0, 0, 1, f(Yes, true, "Ü")},
- {0xdd, 0, 0, 1, f(Yes, false, "Ý")},
- {0xde, 0, 0, 0, f(Yes, false, "")},
- {0xe0, 0, 0, 1, f(Yes, false, "à")},
- {0xe1, 0, 0, 1, f(Yes, false, "á")},
- {0xe2, 0, 0, 1, f(Yes, true, "â")},
- {0xe3, 0, 0, 1, f(Yes, false, "ã")},
- {0xe4, 0, 0, 1, f(Yes, true, "ä")},
- {0xe5, 0, 0, 1, f(Yes, true, "å")},
- {0xe6, 0, 0, 0, f(Yes, true, "")},
- {0xe7, 0, 0, 1, f(Yes, true, "ç")},
- {0xe8, 0, 0, 1, f(Yes, false, "è")},
- {0xe9, 0, 0, 1, f(Yes, false, "é")},
- {0xea, 0, 0, 1, f(Yes, true, "ê")},
- {0xeb, 0, 0, 1, f(Yes, false, "ë")},
- {0xec, 0, 0, 1, f(Yes, false, "ì")},
- {0xed, 0, 0, 1, f(Yes, false, "í")},
- {0xee, 0, 0, 1, f(Yes, false, "î")},
- {0xef, 0, 0, 1, f(Yes, true, "ï")},
- {0xf0, 0, 0, 0, f(Yes, false, "")},
- {0xf1, 0, 0, 1, f(Yes, false, "ñ")},
- {0xf2, 0, 0, 1, f(Yes, false, "ò")},
- {0xf3, 0, 0, 1, f(Yes, false, "ó")},
- {0xf4, 0, 0, 1, f(Yes, true, "ô")},
- {0xf5, 0, 0, 1, f(Yes, true, "õ")},
- {0xf6, 0, 0, 1, f(Yes, true, "ö")},
- {0xf7, 0, 0, 0, f(Yes, false, "")},
- {0xf8, 0, 0, 0, f(Yes, true, "")},
- {0xf9, 0, 0, 1, f(Yes, false, "ù")},
- {0xfa, 0, 0, 1, f(Yes, false, "ú")},
- {0xfb, 0, 0, 1, f(Yes, false, "û")},
- {0xfc, 0, 0, 1, f(Yes, true, "ü")},
- {0xfd, 0, 0, 1, f(Yes, false, "ý")},
- {0xfe, 0, 0, 0, f(Yes, false, "")},
- {0xff, 0, 0, 1, f(Yes, false, "ÿ")},
- {0x100, 0, 0, 1, f(Yes, false, "Ā")},
- {0x101, 0, 0, 1, f(Yes, false, "ā")},
- {0x102, 0, 0, 1, f(Yes, true, "Ă")},
- {0x103, 0, 0, 1, f(Yes, true, "ă")},
- {0x104, 0, 0, 1, f(Yes, false, "Ą")},
- {0x105, 0, 0, 1, f(Yes, false, "ą")},
- {0x106, 0, 0, 1, f(Yes, false, "Ć")},
- {0x107, 0, 0, 1, f(Yes, false, "ć")},
- {0x108, 0, 0, 1, f(Yes, false, "Ĉ")},
- {0x109, 0, 0, 1, f(Yes, false, "ĉ")},
- {0x10a, 0, 0, 1, f(Yes, false, "Ċ")},
- {0x10b, 0, 0, 1, f(Yes, false, "ċ")},
- {0x10c, 0, 0, 1, f(Yes, false, "Č")},
- {0x10d, 0, 0, 1, f(Yes, false, "č")},
- {0x10e, 0, 0, 1, f(Yes, false, "Ď")},
- {0x10f, 0, 0, 1, f(Yes, false, "ď")},
- {0x110, 0, 0, 0, f(Yes, false, "")},
- {0x112, 0, 0, 1, f(Yes, true, "Ē")},
- {0x113, 0, 0, 1, f(Yes, true, "ē")},
- {0x114, 0, 0, 1, f(Yes, false, "Ĕ")},
- {0x115, 0, 0, 1, f(Yes, false, "ĕ")},
- {0x116, 0, 0, 1, f(Yes, false, "Ė")},
- {0x117, 0, 0, 1, f(Yes, false, "ė")},
- {0x118, 0, 0, 1, f(Yes, false, "Ę")},
- {0x119, 0, 0, 1, f(Yes, false, "ę")},
- {0x11a, 0, 0, 1, f(Yes, false, "Ě")},
- {0x11b, 0, 0, 1, f(Yes, false, "ě")},
- {0x11c, 0, 0, 1, f(Yes, false, "Ĝ")},
- {0x11d, 0, 0, 1, f(Yes, false, "ĝ")},
- {0x11e, 0, 0, 1, f(Yes, false, "Ğ")},
- {0x11f, 0, 0, 1, f(Yes, false, "ğ")},
- {0x120, 0, 0, 1, f(Yes, false, "Ġ")},
- {0x121, 0, 0, 1, f(Yes, false, "ġ")},
- {0x122, 0, 0, 1, f(Yes, false, "Ģ")},
- {0x123, 0, 0, 1, f(Yes, false, "ģ")},
- {0x124, 0, 0, 1, f(Yes, false, "Ĥ")},
- {0x125, 0, 0, 1, f(Yes, false, "ĥ")},
- {0x126, 0, 0, 0, f(Yes, false, "")},
- {0x128, 0, 0, 1, f(Yes, false, "Ĩ")},
- {0x129, 0, 0, 1, f(Yes, false, "ĩ")},
- {0x12a, 0, 0, 1, f(Yes, false, "Ī")},
- {0x12b, 0, 0, 1, f(Yes, false, "ī")},
- {0x12c, 0, 0, 1, f(Yes, false, "Ĭ")},
- {0x12d, 0, 0, 1, f(Yes, false, "ĭ")},
- {0x12e, 0, 0, 1, f(Yes, false, "Į")},
- {0x12f, 0, 0, 1, f(Yes, false, "į")},
- {0x130, 0, 0, 1, f(Yes, false, "İ")},
- {0x131, 0, 0, 0, f(Yes, false, "")},
- {0x132, 0, 0, 0, g(Yes, No, false, false, "", "IJ")},
- {0x133, 0, 0, 0, g(Yes, No, false, false, "", "ij")},
- {0x134, 0, 0, 1, f(Yes, false, "Ĵ")},
- {0x135, 0, 0, 1, f(Yes, false, "ĵ")},
- {0x136, 0, 0, 1, f(Yes, false, "Ķ")},
- {0x137, 0, 0, 1, f(Yes, false, "ķ")},
- {0x138, 0, 0, 0, f(Yes, false, "")},
- {0x139, 0, 0, 1, f(Yes, false, "Ĺ")},
- {0x13a, 0, 0, 1, f(Yes, false, "ĺ")},
- {0x13b, 0, 0, 1, f(Yes, false, "Ļ")},
- {0x13c, 0, 0, 1, f(Yes, false, "ļ")},
- {0x13d, 0, 0, 1, f(Yes, false, "Ľ")},
- {0x13e, 0, 0, 1, f(Yes, false, "ľ")},
- {0x13f, 0, 0, 0, g(Yes, No, false, false, "", "L·")},
- {0x140, 0, 0, 0, g(Yes, No, false, false, "", "l·")},
- {0x141, 0, 0, 0, f(Yes, false, "")},
- {0x143, 0, 0, 1, f(Yes, false, "Ń")},
- {0x144, 0, 0, 1, f(Yes, false, "ń")},
- {0x145, 0, 0, 1, f(Yes, false, "Ņ")},
- {0x146, 0, 0, 1, f(Yes, false, "ņ")},
- {0x147, 0, 0, 1, f(Yes, false, "Ň")},
- {0x148, 0, 0, 1, f(Yes, false, "ň")},
- {0x149, 0, 0, 0, g(Yes, No, false, false, "", "ʼn")},
- {0x14a, 0, 0, 0, f(Yes, false, "")},
- {0x14c, 0, 0, 1, f(Yes, true, "Ō")},
- {0x14d, 0, 0, 1, f(Yes, true, "ō")},
- {0x14e, 0, 0, 1, f(Yes, false, "Ŏ")},
- {0x14f, 0, 0, 1, f(Yes, false, "ŏ")},
- {0x150, 0, 0, 1, f(Yes, false, "Ő")},
- {0x151, 0, 0, 1, f(Yes, false, "ő")},
- {0x152, 0, 0, 0, f(Yes, false, "")},
- {0x154, 0, 0, 1, f(Yes, false, "Ŕ")},
- {0x155, 0, 0, 1, f(Yes, false, "ŕ")},
- {0x156, 0, 0, 1, f(Yes, false, "Ŗ")},
- {0x157, 0, 0, 1, f(Yes, false, "ŗ")},
- {0x158, 0, 0, 1, f(Yes, false, "Ř")},
- {0x159, 0, 0, 1, f(Yes, false, "ř")},
- {0x15a, 0, 0, 1, f(Yes, true, "Ś")},
- {0x15b, 0, 0, 1, f(Yes, true, "ś")},
- {0x15c, 0, 0, 1, f(Yes, false, "Ŝ")},
- {0x15d, 0, 0, 1, f(Yes, false, "ŝ")},
- {0x15e, 0, 0, 1, f(Yes, false, "Ş")},
- {0x15f, 0, 0, 1, f(Yes, false, "ş")},
- {0x160, 0, 0, 1, f(Yes, true, "Š")},
- {0x161, 0, 0, 1, f(Yes, true, "š")},
- {0x162, 0, 0, 1, f(Yes, false, "Ţ")},
- {0x163, 0, 0, 1, f(Yes, false, "ţ")},
- {0x164, 0, 0, 1, f(Yes, false, "Ť")},
- {0x165, 0, 0, 1, f(Yes, false, "ť")},
- {0x166, 0, 0, 0, f(Yes, false, "")},
- {0x168, 0, 0, 1, f(Yes, true, "Ũ")},
- {0x169, 0, 0, 1, f(Yes, true, "ũ")},
- {0x16a, 0, 0, 1, f(Yes, true, "Ū")},
- {0x16b, 0, 0, 1, f(Yes, true, "ū")},
- {0x16c, 0, 0, 1, f(Yes, false, "Ŭ")},
- {0x16d, 0, 0, 1, f(Yes, false, "ŭ")},
- {0x16e, 0, 0, 1, f(Yes, false, "Ů")},
- {0x16f, 0, 0, 1, f(Yes, false, "ů")},
- {0x170, 0, 0, 1, f(Yes, false, "Ű")},
- {0x171, 0, 0, 1, f(Yes, false, "ű")},
- {0x172, 0, 0, 1, f(Yes, false, "Ų")},
- {0x173, 0, 0, 1, f(Yes, false, "ų")},
- {0x174, 0, 0, 1, f(Yes, false, "Ŵ")},
- {0x175, 0, 0, 1, f(Yes, false, "ŵ")},
- {0x176, 0, 0, 1, f(Yes, false, "Ŷ")},
- {0x177, 0, 0, 1, f(Yes, false, "ŷ")},
- {0x178, 0, 0, 1, f(Yes, false, "Ÿ")},
- {0x179, 0, 0, 1, f(Yes, false, "Ź")},
- {0x17a, 0, 0, 1, f(Yes, false, "ź")},
- {0x17b, 0, 0, 1, f(Yes, false, "Ż")},
- {0x17c, 0, 0, 1, f(Yes, false, "ż")},
- {0x17d, 0, 0, 1, f(Yes, false, "Ž")},
- {0x17e, 0, 0, 1, f(Yes, false, "ž")},
- {0x17f, 0, 0, 0, g(Yes, No, true, false, "", "s")},
- {0x180, 0, 0, 0, f(Yes, false, "")},
- {0x1a0, 0, 0, 1, f(Yes, true, "Ơ")},
- {0x1a1, 0, 0, 1, f(Yes, true, "ơ")},
- {0x1a2, 0, 0, 0, f(Yes, false, "")},
- {0x1af, 0, 0, 1, f(Yes, true, "Ư")},
- {0x1b0, 0, 0, 1, f(Yes, true, "ư")},
- {0x1b1, 0, 0, 0, f(Yes, false, "")},
- {0x1b7, 0, 0, 0, f(Yes, true, "")},
- {0x1b8, 0, 0, 0, f(Yes, false, "")},
- {0x1c4, 0, 0, 1, g(Yes, No, false, false, "", "DŽ")},
- {0x1c5, 0, 0, 1, g(Yes, No, false, false, "", "Dž")},
- {0x1c6, 0, 0, 1, g(Yes, No, false, false, "", "dž")},
- {0x1c7, 0, 0, 0, g(Yes, No, false, false, "", "LJ")},
- {0x1c8, 0, 0, 0, g(Yes, No, false, false, "", "Lj")},
- {0x1c9, 0, 0, 0, g(Yes, No, false, false, "", "lj")},
- {0x1ca, 0, 0, 0, g(Yes, No, false, false, "", "NJ")},
- {0x1cb, 0, 0, 0, g(Yes, No, false, false, "", "Nj")},
- {0x1cc, 0, 0, 0, g(Yes, No, false, false, "", "nj")},
- {0x1cd, 0, 0, 1, f(Yes, false, "Ǎ")},
- {0x1ce, 0, 0, 1, f(Yes, false, "ǎ")},
- {0x1cf, 0, 0, 1, f(Yes, false, "Ǐ")},
- {0x1d0, 0, 0, 1, f(Yes, false, "ǐ")},
- {0x1d1, 0, 0, 1, f(Yes, false, "Ǒ")},
- {0x1d2, 0, 0, 1, f(Yes, false, "ǒ")},
- {0x1d3, 0, 0, 1, f(Yes, false, "Ǔ")},
- {0x1d4, 0, 0, 1, f(Yes, false, "ǔ")},
- {0x1d5, 0, 0, 2, f(Yes, false, "Ǖ")},
- {0x1d6, 0, 0, 2, f(Yes, false, "ǖ")},
- {0x1d7, 0, 0, 2, f(Yes, false, "Ǘ")},
- {0x1d8, 0, 0, 2, f(Yes, false, "ǘ")},
- {0x1d9, 0, 0, 2, f(Yes, false, "Ǚ")},
- {0x1da, 0, 0, 2, f(Yes, false, "ǚ")},
- {0x1db, 0, 0, 2, f(Yes, false, "Ǜ")},
- {0x1dc, 0, 0, 2, f(Yes, false, "ǜ")},
- {0x1dd, 0, 0, 0, f(Yes, false, "")},
- {0x1de, 0, 0, 2, f(Yes, false, "Ǟ")},
- {0x1df, 0, 0, 2, f(Yes, false, "ǟ")},
- {0x1e0, 0, 0, 2, f(Yes, false, "Ǡ")},
- {0x1e1, 0, 0, 2, f(Yes, false, "ǡ")},
- {0x1e2, 0, 0, 1, f(Yes, false, "Ǣ")},
- {0x1e3, 0, 0, 1, f(Yes, false, "ǣ")},
- {0x1e4, 0, 0, 0, f(Yes, false, "")},
- {0x1e6, 0, 0, 1, f(Yes, false, "Ǧ")},
- {0x1e7, 0, 0, 1, f(Yes, false, "ǧ")},
- {0x1e8, 0, 0, 1, f(Yes, false, "Ǩ")},
- {0x1e9, 0, 0, 1, f(Yes, false, "ǩ")},
- {0x1ea, 0, 0, 1, f(Yes, true, "Ǫ")},
- {0x1eb, 0, 0, 1, f(Yes, true, "ǫ")},
- {0x1ec, 0, 0, 2, f(Yes, false, "Ǭ")},
- {0x1ed, 0, 0, 2, f(Yes, false, "ǭ")},
- {0x1ee, 0, 0, 1, f(Yes, false, "Ǯ")},
- {0x1ef, 0, 0, 1, f(Yes, false, "ǯ")},
- {0x1f0, 0, 0, 1, f(Yes, false, "ǰ")},
- {0x1f1, 0, 0, 0, g(Yes, No, false, false, "", "DZ")},
- {0x1f2, 0, 0, 0, g(Yes, No, false, false, "", "Dz")},
- {0x1f3, 0, 0, 0, g(Yes, No, false, false, "", "dz")},
- {0x1f4, 0, 0, 1, f(Yes, false, "Ǵ")},
- {0x1f5, 0, 0, 1, f(Yes, false, "ǵ")},
- {0x1f6, 0, 0, 0, f(Yes, false, "")},
- {0x1f8, 0, 0, 1, f(Yes, false, "Ǹ")},
- {0x1f9, 0, 0, 1, f(Yes, false, "ǹ")},
- {0x1fa, 0, 0, 2, f(Yes, false, "Ǻ")},
- {0x1fb, 0, 0, 2, f(Yes, false, "ǻ")},
- {0x1fc, 0, 0, 1, f(Yes, false, "Ǽ")},
- {0x1fd, 0, 0, 1, f(Yes, false, "ǽ")},
- {0x1fe, 0, 0, 1, f(Yes, false, "Ǿ")},
- {0x1ff, 0, 0, 1, f(Yes, false, "ǿ")},
- {0x200, 0, 0, 1, f(Yes, false, "Ȁ")},
- {0x201, 0, 0, 1, f(Yes, false, "ȁ")},
- {0x202, 0, 0, 1, f(Yes, false, "Ȃ")},
- {0x203, 0, 0, 1, f(Yes, false, "ȃ")},
- {0x204, 0, 0, 1, f(Yes, false, "Ȅ")},
- {0x205, 0, 0, 1, f(Yes, false, "ȅ")},
- {0x206, 0, 0, 1, f(Yes, false, "Ȇ")},
- {0x207, 0, 0, 1, f(Yes, false, "ȇ")},
- {0x208, 0, 0, 1, f(Yes, false, "Ȉ")},
- {0x209, 0, 0, 1, f(Yes, false, "ȉ")},
- {0x20a, 0, 0, 1, f(Yes, false, "Ȋ")},
- {0x20b, 0, 0, 1, f(Yes, false, "ȋ")},
- {0x20c, 0, 0, 1, f(Yes, false, "Ȍ")},
- {0x20d, 0, 0, 1, f(Yes, false, "ȍ")},
- {0x20e, 0, 0, 1, f(Yes, false, "Ȏ")},
- {0x20f, 0, 0, 1, f(Yes, false, "ȏ")},
- {0x210, 0, 0, 1, f(Yes, false, "Ȑ")},
- {0x211, 0, 0, 1, f(Yes, false, "ȑ")},
- {0x212, 0, 0, 1, f(Yes, false, "Ȓ")},
- {0x213, 0, 0, 1, f(Yes, false, "ȓ")},
- {0x214, 0, 0, 1, f(Yes, false, "Ȕ")},
- {0x215, 0, 0, 1, f(Yes, false, "ȕ")},
- {0x216, 0, 0, 1, f(Yes, false, "Ȗ")},
- {0x217, 0, 0, 1, f(Yes, false, "ȗ")},
- {0x218, 0, 0, 1, f(Yes, false, "Ș")},
- {0x219, 0, 0, 1, f(Yes, false, "ș")},
- {0x21a, 0, 0, 1, f(Yes, false, "Ț")},
- {0x21b, 0, 0, 1, f(Yes, false, "ț")},
- {0x21c, 0, 0, 0, f(Yes, false, "")},
- {0x21e, 0, 0, 1, f(Yes, false, "Ȟ")},
- {0x21f, 0, 0, 1, f(Yes, false, "ȟ")},
- {0x220, 0, 0, 0, f(Yes, false, "")},
- {0x226, 0, 0, 1, f(Yes, true, "Ȧ")},
- {0x227, 0, 0, 1, f(Yes, true, "ȧ")},
- {0x228, 0, 0, 1, f(Yes, true, "Ȩ")},
- {0x229, 0, 0, 1, f(Yes, true, "ȩ")},
- {0x22a, 0, 0, 2, f(Yes, false, "Ȫ")},
- {0x22b, 0, 0, 2, f(Yes, false, "ȫ")},
- {0x22c, 0, 0, 2, f(Yes, false, "Ȭ")},
- {0x22d, 0, 0, 2, f(Yes, false, "ȭ")},
- {0x22e, 0, 0, 1, f(Yes, true, "Ȯ")},
- {0x22f, 0, 0, 1, f(Yes, true, "ȯ")},
- {0x230, 0, 0, 2, f(Yes, false, "Ȱ")},
- {0x231, 0, 0, 2, f(Yes, false, "ȱ")},
- {0x232, 0, 0, 1, f(Yes, false, "Ȳ")},
- {0x233, 0, 0, 1, f(Yes, false, "ȳ")},
- {0x234, 0, 0, 0, f(Yes, false, "")},
- {0x292, 0, 0, 0, f(Yes, true, "")},
- {0x293, 0, 0, 0, f(Yes, false, "")},
- {0x2b0, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2b1, 0, 0, 0, g(Yes, No, false, false, "", "ɦ")},
- {0x2b2, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2b3, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x2b4, 0, 0, 0, g(Yes, No, false, false, "", "ɹ")},
- {0x2b5, 0, 0, 0, g(Yes, No, false, false, "", "ɻ")},
- {0x2b6, 0, 0, 0, g(Yes, No, false, false, "", "ʁ")},
- {0x2b7, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x2b8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x2b9, 0, 0, 0, f(Yes, false, "")},
- {0x2d8, 0, 0, 1, g(Yes, No, false, false, "", " ̆")},
- {0x2d9, 0, 0, 1, g(Yes, No, false, false, "", " ̇")},
- {0x2da, 0, 0, 1, g(Yes, No, false, false, "", " ̊")},
- {0x2db, 0, 0, 1, g(Yes, No, false, false, "", " ̨")},
- {0x2dc, 0, 0, 1, g(Yes, No, false, false, "", " ̃")},
- {0x2dd, 0, 0, 1, g(Yes, No, false, false, "", " ̋")},
- {0x2de, 0, 0, 0, f(Yes, false, "")},
- {0x2e0, 0, 0, 0, g(Yes, No, false, false, "", "ɣ")},
- {0x2e1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x2e3, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2e4, 0, 0, 0, g(Yes, No, false, false, "", "ʕ")},
- {0x2e5, 0, 0, 0, f(Yes, false, "")},
- {0x300, 230, 1, 1, f(Maybe, false, "")},
- {0x305, 230, 1, 1, f(Yes, false, "")},
- {0x306, 230, 1, 1, f(Maybe, false, "")},
- {0x30d, 230, 1, 1, f(Yes, false, "")},
- {0x30f, 230, 1, 1, f(Maybe, false, "")},
- {0x310, 230, 1, 1, f(Yes, false, "")},
- {0x311, 230, 1, 1, f(Maybe, false, "")},
- {0x312, 230, 1, 1, f(Yes, false, "")},
- {0x313, 230, 1, 1, f(Maybe, false, "")},
- {0x315, 232, 1, 1, f(Yes, false, "")},
- {0x316, 220, 1, 1, f(Yes, false, "")},
- {0x31a, 232, 1, 1, f(Yes, false, "")},
- {0x31b, 216, 1, 1, f(Maybe, false, "")},
- {0x31c, 220, 1, 1, f(Yes, false, "")},
- {0x321, 202, 1, 1, f(Yes, false, "")},
- {0x323, 220, 1, 1, f(Maybe, false, "")},
- {0x327, 202, 1, 1, f(Maybe, false, "")},
- {0x329, 220, 1, 1, f(Yes, false, "")},
- {0x32d, 220, 1, 1, f(Maybe, false, "")},
- {0x32f, 220, 1, 1, f(Yes, false, "")},
- {0x330, 220, 1, 1, f(Maybe, false, "")},
- {0x332, 220, 1, 1, f(Yes, false, "")},
- {0x334, 1, 1, 1, f(Yes, false, "")},
- {0x338, 1, 1, 1, f(Maybe, false, "")},
- {0x339, 220, 1, 1, f(Yes, false, "")},
- {0x33d, 230, 1, 1, f(Yes, false, "")},
- {0x340, 230, 1, 1, f(No, false, "̀")},
- {0x341, 230, 1, 1, f(No, false, "́")},
- {0x342, 230, 1, 1, f(Maybe, false, "")},
- {0x343, 230, 1, 1, f(No, false, "̓")},
- {0x344, 230, 2, 2, f(No, false, "̈́")},
- {0x345, 240, 1, 1, f(Maybe, false, "")},
- {0x346, 230, 1, 1, f(Yes, false, "")},
- {0x347, 220, 1, 1, f(Yes, false, "")},
- {0x34a, 230, 1, 1, f(Yes, false, "")},
- {0x34d, 220, 1, 1, f(Yes, false, "")},
- {0x34f, 0, 0, 0, f(Yes, false, "")},
- {0x350, 230, 1, 1, f(Yes, false, "")},
- {0x353, 220, 1, 1, f(Yes, false, "")},
- {0x357, 230, 1, 1, f(Yes, false, "")},
- {0x358, 232, 1, 1, f(Yes, false, "")},
- {0x359, 220, 1, 1, f(Yes, false, "")},
- {0x35b, 230, 1, 1, f(Yes, false, "")},
- {0x35c, 233, 1, 1, f(Yes, false, "")},
- {0x35d, 234, 1, 1, f(Yes, false, "")},
- {0x35f, 233, 1, 1, f(Yes, false, "")},
- {0x360, 234, 1, 1, f(Yes, false, "")},
- {0x362, 233, 1, 1, f(Yes, false, "")},
- {0x363, 230, 1, 1, f(Yes, false, "")},
- {0x370, 0, 0, 0, f(Yes, false, "")},
- {0x374, 0, 0, 0, f(No, false, "ʹ")},
- {0x375, 0, 0, 0, f(Yes, false, "")},
- {0x37a, 0, 0, 1, g(Yes, No, false, false, "", " ͅ")},
- {0x37b, 0, 0, 0, f(Yes, false, "")},
- {0x37e, 0, 0, 0, f(No, false, ";")},
- {0x37f, 0, 0, 0, f(Yes, false, "")},
- {0x384, 0, 0, 1, g(Yes, No, false, false, "", " ́")},
- {0x385, 0, 0, 2, g(Yes, No, false, false, "΅", " ̈́")},
- {0x386, 0, 0, 1, f(Yes, false, "Ά")},
- {0x387, 0, 0, 0, f(No, false, "·")},
- {0x388, 0, 0, 1, f(Yes, false, "Έ")},
- {0x389, 0, 0, 1, f(Yes, false, "Ή")},
- {0x38a, 0, 0, 1, f(Yes, false, "Ί")},
- {0x38b, 0, 0, 0, f(Yes, false, "")},
- {0x38c, 0, 0, 1, f(Yes, false, "Ό")},
- {0x38d, 0, 0, 0, f(Yes, false, "")},
- {0x38e, 0, 0, 1, f(Yes, false, "Ύ")},
- {0x38f, 0, 0, 1, f(Yes, false, "Ώ")},
- {0x390, 0, 0, 2, f(Yes, false, "ΐ")},
- {0x391, 0, 0, 0, f(Yes, true, "")},
- {0x392, 0, 0, 0, f(Yes, false, "")},
- {0x395, 0, 0, 0, f(Yes, true, "")},
- {0x396, 0, 0, 0, f(Yes, false, "")},
- {0x397, 0, 0, 0, f(Yes, true, "")},
- {0x398, 0, 0, 0, f(Yes, false, "")},
- {0x399, 0, 0, 0, f(Yes, true, "")},
- {0x39a, 0, 0, 0, f(Yes, false, "")},
- {0x39f, 0, 0, 0, f(Yes, true, "")},
- {0x3a0, 0, 0, 0, f(Yes, false, "")},
- {0x3a1, 0, 0, 0, f(Yes, true, "")},
- {0x3a2, 0, 0, 0, f(Yes, false, "")},
- {0x3a5, 0, 0, 0, f(Yes, true, "")},
- {0x3a6, 0, 0, 0, f(Yes, false, "")},
- {0x3a9, 0, 0, 0, f(Yes, true, "")},
- {0x3aa, 0, 0, 1, f(Yes, false, "Ϊ")},
- {0x3ab, 0, 0, 1, f(Yes, false, "Ϋ")},
- {0x3ac, 0, 0, 1, f(Yes, true, "ά")},
- {0x3ad, 0, 0, 1, f(Yes, false, "έ")},
- {0x3ae, 0, 0, 1, f(Yes, true, "ή")},
- {0x3af, 0, 0, 1, f(Yes, false, "ί")},
- {0x3b0, 0, 0, 2, f(Yes, false, "ΰ")},
- {0x3b1, 0, 0, 0, f(Yes, true, "")},
- {0x3b2, 0, 0, 0, f(Yes, false, "")},
- {0x3b5, 0, 0, 0, f(Yes, true, "")},
- {0x3b6, 0, 0, 0, f(Yes, false, "")},
- {0x3b7, 0, 0, 0, f(Yes, true, "")},
- {0x3b8, 0, 0, 0, f(Yes, false, "")},
- {0x3b9, 0, 0, 0, f(Yes, true, "")},
- {0x3ba, 0, 0, 0, f(Yes, false, "")},
- {0x3bf, 0, 0, 0, f(Yes, true, "")},
- {0x3c0, 0, 0, 0, f(Yes, false, "")},
- {0x3c1, 0, 0, 0, f(Yes, true, "")},
- {0x3c2, 0, 0, 0, f(Yes, false, "")},
- {0x3c5, 0, 0, 0, f(Yes, true, "")},
- {0x3c6, 0, 0, 0, f(Yes, false, "")},
- {0x3c9, 0, 0, 0, f(Yes, true, "")},
- {0x3ca, 0, 0, 1, f(Yes, true, "ϊ")},
- {0x3cb, 0, 0, 1, f(Yes, true, "ϋ")},
- {0x3cc, 0, 0, 1, f(Yes, false, "ό")},
- {0x3cd, 0, 0, 1, f(Yes, false, "ύ")},
- {0x3ce, 0, 0, 1, f(Yes, true, "ώ")},
- {0x3cf, 0, 0, 0, f(Yes, false, "")},
- {0x3d0, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x3d1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x3d2, 0, 0, 0, g(Yes, No, true, false, "", "Υ")},
- {0x3d3, 0, 0, 1, g(Yes, No, false, false, "ϓ", "Ύ")},
- {0x3d4, 0, 0, 1, g(Yes, No, false, false, "ϔ", "Ϋ")},
- {0x3d5, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x3d6, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x3d7, 0, 0, 0, f(Yes, false, "")},
- {0x3f0, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x3f1, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x3f2, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x3f3, 0, 0, 0, f(Yes, false, "")},
- {0x3f4, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x3f5, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x3f6, 0, 0, 0, f(Yes, false, "")},
- {0x3f9, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x3fa, 0, 0, 0, f(Yes, false, "")},
- {0x400, 0, 0, 1, f(Yes, false, "Ѐ")},
- {0x401, 0, 0, 1, f(Yes, false, "Ё")},
- {0x402, 0, 0, 0, f(Yes, false, "")},
- {0x403, 0, 0, 1, f(Yes, false, "Ѓ")},
- {0x404, 0, 0, 0, f(Yes, false, "")},
- {0x406, 0, 0, 0, f(Yes, true, "")},
- {0x407, 0, 0, 1, f(Yes, false, "Ї")},
- {0x408, 0, 0, 0, f(Yes, false, "")},
- {0x40c, 0, 0, 1, f(Yes, false, "Ќ")},
- {0x40d, 0, 0, 1, f(Yes, false, "Ѝ")},
- {0x40e, 0, 0, 1, f(Yes, false, "Ў")},
- {0x40f, 0, 0, 0, f(Yes, false, "")},
- {0x410, 0, 0, 0, f(Yes, true, "")},
- {0x411, 0, 0, 0, f(Yes, false, "")},
- {0x413, 0, 0, 0, f(Yes, true, "")},
- {0x414, 0, 0, 0, f(Yes, false, "")},
- {0x415, 0, 0, 0, f(Yes, true, "")},
- {0x419, 0, 0, 1, f(Yes, false, "Й")},
- {0x41a, 0, 0, 0, f(Yes, true, "")},
- {0x41b, 0, 0, 0, f(Yes, false, "")},
- {0x41e, 0, 0, 0, f(Yes, true, "")},
- {0x41f, 0, 0, 0, f(Yes, false, "")},
- {0x423, 0, 0, 0, f(Yes, true, "")},
- {0x424, 0, 0, 0, f(Yes, false, "")},
- {0x427, 0, 0, 0, f(Yes, true, "")},
- {0x428, 0, 0, 0, f(Yes, false, "")},
- {0x42b, 0, 0, 0, f(Yes, true, "")},
- {0x42c, 0, 0, 0, f(Yes, false, "")},
- {0x42d, 0, 0, 0, f(Yes, true, "")},
- {0x42e, 0, 0, 0, f(Yes, false, "")},
- {0x430, 0, 0, 0, f(Yes, true, "")},
- {0x431, 0, 0, 0, f(Yes, false, "")},
- {0x433, 0, 0, 0, f(Yes, true, "")},
- {0x434, 0, 0, 0, f(Yes, false, "")},
- {0x435, 0, 0, 0, f(Yes, true, "")},
- {0x439, 0, 0, 1, f(Yes, false, "й")},
- {0x43a, 0, 0, 0, f(Yes, true, "")},
- {0x43b, 0, 0, 0, f(Yes, false, "")},
- {0x43e, 0, 0, 0, f(Yes, true, "")},
- {0x43f, 0, 0, 0, f(Yes, false, "")},
- {0x443, 0, 0, 0, f(Yes, true, "")},
- {0x444, 0, 0, 0, f(Yes, false, "")},
- {0x447, 0, 0, 0, f(Yes, true, "")},
- {0x448, 0, 0, 0, f(Yes, false, "")},
- {0x44b, 0, 0, 0, f(Yes, true, "")},
- {0x44c, 0, 0, 0, f(Yes, false, "")},
- {0x44d, 0, 0, 0, f(Yes, true, "")},
- {0x44e, 0, 0, 0, f(Yes, false, "")},
- {0x450, 0, 0, 1, f(Yes, false, "ѐ")},
- {0x451, 0, 0, 1, f(Yes, false, "ё")},
- {0x452, 0, 0, 0, f(Yes, false, "")},
- {0x453, 0, 0, 1, f(Yes, false, "ѓ")},
- {0x454, 0, 0, 0, f(Yes, false, "")},
- {0x456, 0, 0, 0, f(Yes, true, "")},
- {0x457, 0, 0, 1, f(Yes, false, "ї")},
- {0x458, 0, 0, 0, f(Yes, false, "")},
- {0x45c, 0, 0, 1, f(Yes, false, "ќ")},
- {0x45d, 0, 0, 1, f(Yes, false, "ѝ")},
- {0x45e, 0, 0, 1, f(Yes, false, "ў")},
- {0x45f, 0, 0, 0, f(Yes, false, "")},
- {0x474, 0, 0, 0, f(Yes, true, "")},
- {0x476, 0, 0, 1, f(Yes, false, "Ѷ")},
- {0x477, 0, 0, 1, f(Yes, false, "ѷ")},
- {0x478, 0, 0, 0, f(Yes, false, "")},
- {0x483, 230, 1, 1, f(Yes, false, "")},
- {0x488, 0, 0, 0, f(Yes, false, "")},
- {0x4c1, 0, 0, 1, f(Yes, false, "Ӂ")},
- {0x4c2, 0, 0, 1, f(Yes, false, "ӂ")},
- {0x4c3, 0, 0, 0, f(Yes, false, "")},
- {0x4d0, 0, 0, 1, f(Yes, false, "Ӑ")},
- {0x4d1, 0, 0, 1, f(Yes, false, "ӑ")},
- {0x4d2, 0, 0, 1, f(Yes, false, "Ӓ")},
- {0x4d3, 0, 0, 1, f(Yes, false, "ӓ")},
- {0x4d4, 0, 0, 0, f(Yes, false, "")},
- {0x4d6, 0, 0, 1, f(Yes, false, "Ӗ")},
- {0x4d7, 0, 0, 1, f(Yes, false, "ӗ")},
- {0x4d8, 0, 0, 0, f(Yes, true, "")},
- {0x4da, 0, 0, 1, f(Yes, false, "Ӛ")},
- {0x4db, 0, 0, 1, f(Yes, false, "ӛ")},
- {0x4dc, 0, 0, 1, f(Yes, false, "Ӝ")},
- {0x4dd, 0, 0, 1, f(Yes, false, "ӝ")},
- {0x4de, 0, 0, 1, f(Yes, false, "Ӟ")},
- {0x4df, 0, 0, 1, f(Yes, false, "ӟ")},
- {0x4e0, 0, 0, 0, f(Yes, false, "")},
- {0x4e2, 0, 0, 1, f(Yes, false, "Ӣ")},
- {0x4e3, 0, 0, 1, f(Yes, false, "ӣ")},
- {0x4e4, 0, 0, 1, f(Yes, false, "Ӥ")},
- {0x4e5, 0, 0, 1, f(Yes, false, "ӥ")},
- {0x4e6, 0, 0, 1, f(Yes, false, "Ӧ")},
- {0x4e7, 0, 0, 1, f(Yes, false, "ӧ")},
- {0x4e8, 0, 0, 0, f(Yes, true, "")},
- {0x4ea, 0, 0, 1, f(Yes, false, "Ӫ")},
- {0x4eb, 0, 0, 1, f(Yes, false, "ӫ")},
- {0x4ec, 0, 0, 1, f(Yes, false, "Ӭ")},
- {0x4ed, 0, 0, 1, f(Yes, false, "ӭ")},
- {0x4ee, 0, 0, 1, f(Yes, false, "Ӯ")},
- {0x4ef, 0, 0, 1, f(Yes, false, "ӯ")},
- {0x4f0, 0, 0, 1, f(Yes, false, "Ӱ")},
- {0x4f1, 0, 0, 1, f(Yes, false, "ӱ")},
- {0x4f2, 0, 0, 1, f(Yes, false, "Ӳ")},
- {0x4f3, 0, 0, 1, f(Yes, false, "ӳ")},
- {0x4f4, 0, 0, 1, f(Yes, false, "Ӵ")},
- {0x4f5, 0, 0, 1, f(Yes, false, "ӵ")},
- {0x4f6, 0, 0, 0, f(Yes, false, "")},
- {0x4f8, 0, 0, 1, f(Yes, false, "Ӹ")},
- {0x4f9, 0, 0, 1, f(Yes, false, "ӹ")},
- {0x4fa, 0, 0, 0, f(Yes, false, "")},
- {0x587, 0, 0, 0, g(Yes, No, false, false, "", "եւ")},
- {0x588, 0, 0, 0, f(Yes, false, "")},
- {0x591, 220, 1, 1, f(Yes, false, "")},
- {0x592, 230, 1, 1, f(Yes, false, "")},
- {0x596, 220, 1, 1, f(Yes, false, "")},
- {0x597, 230, 1, 1, f(Yes, false, "")},
- {0x59a, 222, 1, 1, f(Yes, false, "")},
- {0x59b, 220, 1, 1, f(Yes, false, "")},
- {0x59c, 230, 1, 1, f(Yes, false, "")},
- {0x5a2, 220, 1, 1, f(Yes, false, "")},
- {0x5a8, 230, 1, 1, f(Yes, false, "")},
- {0x5aa, 220, 1, 1, f(Yes, false, "")},
- {0x5ab, 230, 1, 1, f(Yes, false, "")},
- {0x5ad, 222, 1, 1, f(Yes, false, "")},
- {0x5ae, 228, 1, 1, f(Yes, false, "")},
- {0x5af, 230, 1, 1, f(Yes, false, "")},
- {0x5b0, 10, 1, 1, f(Yes, false, "")},
- {0x5b1, 11, 1, 1, f(Yes, false, "")},
- {0x5b2, 12, 1, 1, f(Yes, false, "")},
- {0x5b3, 13, 1, 1, f(Yes, false, "")},
- {0x5b4, 14, 1, 1, f(Yes, false, "")},
- {0x5b5, 15, 1, 1, f(Yes, false, "")},
- {0x5b6, 16, 1, 1, f(Yes, false, "")},
- {0x5b7, 17, 1, 1, f(Yes, false, "")},
- {0x5b8, 18, 1, 1, f(Yes, false, "")},
- {0x5b9, 19, 1, 1, f(Yes, false, "")},
- {0x5bb, 20, 1, 1, f(Yes, false, "")},
- {0x5bc, 21, 1, 1, f(Yes, false, "")},
- {0x5bd, 22, 1, 1, f(Yes, false, "")},
- {0x5be, 0, 0, 0, f(Yes, false, "")},
- {0x5bf, 23, 1, 1, f(Yes, false, "")},
- {0x5c0, 0, 0, 0, f(Yes, false, "")},
- {0x5c1, 24, 1, 1, f(Yes, false, "")},
- {0x5c2, 25, 1, 1, f(Yes, false, "")},
- {0x5c3, 0, 0, 0, f(Yes, false, "")},
- {0x5c4, 230, 1, 1, f(Yes, false, "")},
- {0x5c5, 220, 1, 1, f(Yes, false, "")},
- {0x5c6, 0, 0, 0, f(Yes, false, "")},
- {0x5c7, 18, 1, 1, f(Yes, false, "")},
- {0x5c8, 0, 0, 0, f(Yes, false, "")},
- {0x610, 230, 1, 1, f(Yes, false, "")},
- {0x618, 30, 1, 1, f(Yes, false, "")},
- {0x619, 31, 1, 1, f(Yes, false, "")},
- {0x61a, 32, 1, 1, f(Yes, false, "")},
- {0x61b, 0, 0, 0, f(Yes, false, "")},
- {0x622, 0, 0, 1, f(Yes, false, "آ")},
- {0x623, 0, 0, 1, f(Yes, false, "أ")},
- {0x624, 0, 0, 1, f(Yes, false, "ؤ")},
- {0x625, 0, 0, 1, f(Yes, false, "إ")},
- {0x626, 0, 0, 1, f(Yes, false, "ئ")},
- {0x627, 0, 0, 0, f(Yes, true, "")},
- {0x628, 0, 0, 0, f(Yes, false, "")},
- {0x648, 0, 0, 0, f(Yes, true, "")},
- {0x649, 0, 0, 0, f(Yes, false, "")},
- {0x64a, 0, 0, 0, f(Yes, true, "")},
- {0x64b, 27, 1, 1, f(Yes, false, "")},
- {0x64c, 28, 1, 1, f(Yes, false, "")},
- {0x64d, 29, 1, 1, f(Yes, false, "")},
- {0x64e, 30, 1, 1, f(Yes, false, "")},
- {0x64f, 31, 1, 1, f(Yes, false, "")},
- {0x650, 32, 1, 1, f(Yes, false, "")},
- {0x651, 33, 1, 1, f(Yes, false, "")},
- {0x652, 34, 1, 1, f(Yes, false, "")},
- {0x653, 230, 1, 1, f(Maybe, false, "")},
- {0x655, 220, 1, 1, f(Maybe, false, "")},
- {0x656, 220, 1, 1, f(Yes, false, "")},
- {0x657, 230, 1, 1, f(Yes, false, "")},
- {0x65c, 220, 1, 1, f(Yes, false, "")},
- {0x65d, 230, 1, 1, f(Yes, false, "")},
- {0x65f, 220, 1, 1, f(Yes, false, "")},
- {0x660, 0, 0, 0, f(Yes, false, "")},
- {0x670, 35, 1, 1, f(Yes, false, "")},
- {0x671, 0, 0, 0, f(Yes, false, "")},
- {0x675, 0, 0, 0, g(Yes, No, false, false, "", "اٴ")},
- {0x676, 0, 0, 0, g(Yes, No, false, false, "", "وٴ")},
- {0x677, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0x678, 0, 0, 0, g(Yes, No, false, false, "", "يٴ")},
- {0x679, 0, 0, 0, f(Yes, false, "")},
- {0x6c0, 0, 0, 1, f(Yes, false, "ۀ")},
- {0x6c1, 0, 0, 0, f(Yes, true, "")},
- {0x6c2, 0, 0, 1, f(Yes, false, "ۂ")},
- {0x6c3, 0, 0, 0, f(Yes, false, "")},
- {0x6d2, 0, 0, 0, f(Yes, true, "")},
- {0x6d3, 0, 0, 1, f(Yes, false, "ۓ")},
- {0x6d4, 0, 0, 0, f(Yes, false, "")},
- {0x6d5, 0, 0, 0, f(Yes, true, "")},
- {0x6d6, 230, 1, 1, f(Yes, false, "")},
- {0x6dd, 0, 0, 0, f(Yes, false, "")},
- {0x6df, 230, 1, 1, f(Yes, false, "")},
- {0x6e3, 220, 1, 1, f(Yes, false, "")},
- {0x6e4, 230, 1, 1, f(Yes, false, "")},
- {0x6e5, 0, 0, 0, f(Yes, false, "")},
- {0x6e7, 230, 1, 1, f(Yes, false, "")},
- {0x6e9, 0, 0, 0, f(Yes, false, "")},
- {0x6ea, 220, 1, 1, f(Yes, false, "")},
- {0x6eb, 230, 1, 1, f(Yes, false, "")},
- {0x6ed, 220, 1, 1, f(Yes, false, "")},
- {0x6ee, 0, 0, 0, f(Yes, false, "")},
- {0x711, 36, 1, 1, f(Yes, false, "")},
- {0x712, 0, 0, 0, f(Yes, false, "")},
- {0x730, 230, 1, 1, f(Yes, false, "")},
- {0x731, 220, 1, 1, f(Yes, false, "")},
- {0x732, 230, 1, 1, f(Yes, false, "")},
- {0x734, 220, 1, 1, f(Yes, false, "")},
- {0x735, 230, 1, 1, f(Yes, false, "")},
- {0x737, 220, 1, 1, f(Yes, false, "")},
- {0x73a, 230, 1, 1, f(Yes, false, "")},
- {0x73b, 220, 1, 1, f(Yes, false, "")},
- {0x73d, 230, 1, 1, f(Yes, false, "")},
- {0x73e, 220, 1, 1, f(Yes, false, "")},
- {0x73f, 230, 1, 1, f(Yes, false, "")},
- {0x742, 220, 1, 1, f(Yes, false, "")},
- {0x743, 230, 1, 1, f(Yes, false, "")},
- {0x744, 220, 1, 1, f(Yes, false, "")},
- {0x745, 230, 1, 1, f(Yes, false, "")},
- {0x746, 220, 1, 1, f(Yes, false, "")},
- {0x747, 230, 1, 1, f(Yes, false, "")},
- {0x748, 220, 1, 1, f(Yes, false, "")},
- {0x749, 230, 1, 1, f(Yes, false, "")},
- {0x74b, 0, 0, 0, f(Yes, false, "")},
- {0x7eb, 230, 1, 1, f(Yes, false, "")},
- {0x7f2, 220, 1, 1, f(Yes, false, "")},
- {0x7f3, 230, 1, 1, f(Yes, false, "")},
- {0x7f4, 0, 0, 0, f(Yes, false, "")},
- {0x816, 230, 1, 1, f(Yes, false, "")},
- {0x81a, 0, 0, 0, f(Yes, false, "")},
- {0x81b, 230, 1, 1, f(Yes, false, "")},
- {0x824, 0, 0, 0, f(Yes, false, "")},
- {0x825, 230, 1, 1, f(Yes, false, "")},
- {0x828, 0, 0, 0, f(Yes, false, "")},
- {0x829, 230, 1, 1, f(Yes, false, "")},
- {0x82e, 0, 0, 0, f(Yes, false, "")},
- {0x859, 220, 1, 1, f(Yes, false, "")},
- {0x85c, 0, 0, 0, f(Yes, false, "")},
- {0x8d4, 230, 1, 1, f(Yes, false, "")},
- {0x8e2, 0, 0, 0, f(Yes, false, "")},
- {0x8e3, 220, 1, 1, f(Yes, false, "")},
- {0x8e4, 230, 1, 1, f(Yes, false, "")},
- {0x8e6, 220, 1, 1, f(Yes, false, "")},
- {0x8e7, 230, 1, 1, f(Yes, false, "")},
- {0x8e9, 220, 1, 1, f(Yes, false, "")},
- {0x8ea, 230, 1, 1, f(Yes, false, "")},
- {0x8ed, 220, 1, 1, f(Yes, false, "")},
- {0x8f0, 27, 1, 1, f(Yes, false, "")},
- {0x8f1, 28, 1, 1, f(Yes, false, "")},
- {0x8f2, 29, 1, 1, f(Yes, false, "")},
- {0x8f3, 230, 1, 1, f(Yes, false, "")},
- {0x8f6, 220, 1, 1, f(Yes, false, "")},
- {0x8f7, 230, 1, 1, f(Yes, false, "")},
- {0x8f9, 220, 1, 1, f(Yes, false, "")},
- {0x8fb, 230, 1, 1, f(Yes, false, "")},
- {0x900, 0, 0, 0, f(Yes, false, "")},
- {0x928, 0, 0, 0, f(Yes, true, "")},
- {0x929, 0, 0, 1, f(Yes, false, "ऩ")},
- {0x92a, 0, 0, 0, f(Yes, false, "")},
- {0x930, 0, 0, 0, f(Yes, true, "")},
- {0x931, 0, 0, 1, f(Yes, false, "ऱ")},
- {0x932, 0, 0, 0, f(Yes, false, "")},
- {0x933, 0, 0, 0, f(Yes, true, "")},
- {0x934, 0, 0, 1, f(Yes, false, "ऴ")},
- {0x935, 0, 0, 0, f(Yes, false, "")},
- {0x93c, 7, 1, 1, f(Maybe, false, "")},
- {0x93d, 0, 0, 0, f(Yes, false, "")},
- {0x94d, 9, 1, 1, f(Yes, false, "")},
- {0x94e, 0, 0, 0, f(Yes, false, "")},
- {0x951, 230, 1, 1, f(Yes, false, "")},
- {0x952, 220, 1, 1, f(Yes, false, "")},
- {0x953, 230, 1, 1, f(Yes, false, "")},
- {0x955, 0, 0, 0, f(Yes, false, "")},
- {0x958, 0, 0, 1, f(No, false, "क़")},
- {0x959, 0, 0, 1, f(No, false, "ख़")},
- {0x95a, 0, 0, 1, f(No, false, "ग़")},
- {0x95b, 0, 0, 1, f(No, false, "ज़")},
- {0x95c, 0, 0, 1, f(No, false, "ड़")},
- {0x95d, 0, 0, 1, f(No, false, "ढ़")},
- {0x95e, 0, 0, 1, f(No, false, "फ़")},
- {0x95f, 0, 0, 1, f(No, false, "य़")},
- {0x960, 0, 0, 0, f(Yes, false, "")},
- {0x9bc, 7, 1, 1, f(Yes, false, "")},
- {0x9bd, 0, 0, 0, f(Yes, false, "")},
- {0x9be, 0, 1, 1, f(Maybe, false, "")},
- {0x9bf, 0, 0, 0, f(Yes, false, "")},
- {0x9c7, 0, 0, 0, f(Yes, true, "")},
- {0x9c8, 0, 0, 0, f(Yes, false, "")},
- {0x9cb, 0, 0, 1, f(Yes, false, "ো")},
- {0x9cc, 0, 0, 1, f(Yes, false, "ৌ")},
- {0x9cd, 9, 1, 1, f(Yes, false, "")},
- {0x9ce, 0, 0, 0, f(Yes, false, "")},
- {0x9d7, 0, 1, 1, f(Maybe, false, "")},
- {0x9d8, 0, 0, 0, f(Yes, false, "")},
- {0x9dc, 0, 0, 1, f(No, false, "ড়")},
- {0x9dd, 0, 0, 1, f(No, false, "ঢ়")},
- {0x9de, 0, 0, 0, f(Yes, false, "")},
- {0x9df, 0, 0, 1, f(No, false, "য়")},
- {0x9e0, 0, 0, 0, f(Yes, false, "")},
- {0xa33, 0, 0, 1, f(No, false, "ਲ਼")},
- {0xa34, 0, 0, 0, f(Yes, false, "")},
- {0xa36, 0, 0, 1, f(No, false, "ਸ਼")},
- {0xa37, 0, 0, 0, f(Yes, false, "")},
- {0xa3c, 7, 1, 1, f(Yes, false, "")},
- {0xa3d, 0, 0, 0, f(Yes, false, "")},
- {0xa4d, 9, 1, 1, f(Yes, false, "")},
- {0xa4e, 0, 0, 0, f(Yes, false, "")},
- {0xa59, 0, 0, 1, f(No, false, "ਖ਼")},
- {0xa5a, 0, 0, 1, f(No, false, "ਗ਼")},
- {0xa5b, 0, 0, 1, f(No, false, "ਜ਼")},
- {0xa5c, 0, 0, 0, f(Yes, false, "")},
- {0xa5e, 0, 0, 1, f(No, false, "ਫ਼")},
- {0xa5f, 0, 0, 0, f(Yes, false, "")},
- {0xabc, 7, 1, 1, f(Yes, false, "")},
- {0xabd, 0, 0, 0, f(Yes, false, "")},
- {0xacd, 9, 1, 1, f(Yes, false, "")},
- {0xace, 0, 0, 0, f(Yes, false, "")},
- {0xb3c, 7, 1, 1, f(Yes, false, "")},
- {0xb3d, 0, 0, 0, f(Yes, false, "")},
- {0xb3e, 0, 1, 1, f(Maybe, false, "")},
- {0xb3f, 0, 0, 0, f(Yes, false, "")},
- {0xb47, 0, 0, 0, f(Yes, true, "")},
- {0xb48, 0, 0, 1, f(Yes, false, "ୈ")},
- {0xb49, 0, 0, 0, f(Yes, false, "")},
- {0xb4b, 0, 0, 1, f(Yes, false, "ୋ")},
- {0xb4c, 0, 0, 1, f(Yes, false, "ୌ")},
- {0xb4d, 9, 1, 1, f(Yes, false, "")},
- {0xb4e, 0, 0, 0, f(Yes, false, "")},
- {0xb56, 0, 1, 1, f(Maybe, false, "")},
- {0xb58, 0, 0, 0, f(Yes, false, "")},
- {0xb5c, 0, 0, 1, f(No, false, "ଡ଼")},
- {0xb5d, 0, 0, 1, f(No, false, "ଢ଼")},
- {0xb5e, 0, 0, 0, f(Yes, false, "")},
- {0xb92, 0, 0, 0, f(Yes, true, "")},
- {0xb93, 0, 0, 0, f(Yes, false, "")},
- {0xb94, 0, 0, 1, f(Yes, false, "ஔ")},
- {0xb95, 0, 0, 0, f(Yes, false, "")},
- {0xbbe, 0, 1, 1, f(Maybe, false, "")},
- {0xbbf, 0, 0, 0, f(Yes, false, "")},
- {0xbc6, 0, 0, 0, f(Yes, true, "")},
- {0xbc8, 0, 0, 0, f(Yes, false, "")},
- {0xbca, 0, 0, 1, f(Yes, false, "ொ")},
- {0xbcb, 0, 0, 1, f(Yes, false, "ோ")},
- {0xbcc, 0, 0, 1, f(Yes, false, "ௌ")},
- {0xbcd, 9, 1, 1, f(Yes, false, "")},
- {0xbce, 0, 0, 0, f(Yes, false, "")},
- {0xbd7, 0, 1, 1, f(Maybe, false, "")},
- {0xbd8, 0, 0, 0, f(Yes, false, "")},
- {0xc46, 0, 0, 0, f(Yes, true, "")},
- {0xc47, 0, 0, 0, f(Yes, false, "")},
- {0xc48, 0, 0, 1, f(Yes, false, "ై")},
- {0xc49, 0, 0, 0, f(Yes, false, "")},
- {0xc4d, 9, 1, 1, f(Yes, false, "")},
- {0xc4e, 0, 0, 0, f(Yes, false, "")},
- {0xc55, 84, 1, 1, f(Yes, false, "")},
- {0xc56, 91, 1, 1, f(Maybe, false, "")},
- {0xc57, 0, 0, 0, f(Yes, false, "")},
- {0xcbc, 7, 1, 1, f(Yes, false, "")},
- {0xcbd, 0, 0, 0, f(Yes, false, "")},
- {0xcbf, 0, 0, 0, f(Yes, true, "")},
- {0xcc0, 0, 0, 1, f(Yes, false, "ೀ")},
- {0xcc1, 0, 0, 0, f(Yes, false, "")},
- {0xcc2, 0, 1, 1, f(Maybe, false, "")},
- {0xcc3, 0, 0, 0, f(Yes, false, "")},
- {0xcc6, 0, 0, 0, f(Yes, true, "")},
- {0xcc7, 0, 0, 1, f(Yes, false, "ೇ")},
- {0xcc8, 0, 0, 1, f(Yes, false, "ೈ")},
- {0xcc9, 0, 0, 0, f(Yes, false, "")},
- {0xcca, 0, 0, 1, f(Yes, true, "ೊ")},
- {0xccb, 0, 0, 2, f(Yes, false, "ೋ")},
- {0xccc, 0, 0, 0, f(Yes, false, "")},
- {0xccd, 9, 1, 1, f(Yes, false, "")},
- {0xcce, 0, 0, 0, f(Yes, false, "")},
- {0xcd5, 0, 1, 1, f(Maybe, false, "")},
- {0xcd7, 0, 0, 0, f(Yes, false, "")},
- {0xd3e, 0, 1, 1, f(Maybe, false, "")},
- {0xd3f, 0, 0, 0, f(Yes, false, "")},
- {0xd46, 0, 0, 0, f(Yes, true, "")},
- {0xd48, 0, 0, 0, f(Yes, false, "")},
- {0xd4a, 0, 0, 1, f(Yes, false, "ൊ")},
- {0xd4b, 0, 0, 1, f(Yes, false, "ോ")},
- {0xd4c, 0, 0, 1, f(Yes, false, "ൌ")},
- {0xd4d, 9, 1, 1, f(Yes, false, "")},
- {0xd4e, 0, 0, 0, f(Yes, false, "")},
- {0xd57, 0, 1, 1, f(Maybe, false, "")},
- {0xd58, 0, 0, 0, f(Yes, false, "")},
- {0xdca, 9, 1, 1, f(Maybe, false, "")},
- {0xdcb, 0, 0, 0, f(Yes, false, "")},
- {0xdcf, 0, 1, 1, f(Maybe, false, "")},
- {0xdd0, 0, 0, 0, f(Yes, false, "")},
- {0xdd9, 0, 0, 0, f(Yes, true, "")},
- {0xdda, 0, 0, 1, f(Yes, false, "ේ")},
- {0xddb, 0, 0, 0, f(Yes, false, "")},
- {0xddc, 0, 0, 1, f(Yes, true, "ො")},
- {0xddd, 0, 0, 2, f(Yes, false, "ෝ")},
- {0xdde, 0, 0, 1, f(Yes, false, "ෞ")},
- {0xddf, 0, 1, 1, f(Maybe, false, "")},
- {0xde0, 0, 0, 0, f(Yes, false, "")},
- {0xe33, 0, 0, 0, g(Yes, No, false, false, "", "ํา")},
- {0xe34, 0, 0, 0, f(Yes, false, "")},
- {0xe38, 103, 1, 1, f(Yes, false, "")},
- {0xe3a, 9, 1, 1, f(Yes, false, "")},
- {0xe3b, 0, 0, 0, f(Yes, false, "")},
- {0xe48, 107, 1, 1, f(Yes, false, "")},
- {0xe4c, 0, 0, 0, f(Yes, false, "")},
- {0xeb3, 0, 0, 0, g(Yes, No, false, false, "", "ໍາ")},
- {0xeb4, 0, 0, 0, f(Yes, false, "")},
- {0xeb8, 118, 1, 1, f(Yes, false, "")},
- {0xeba, 0, 0, 0, f(Yes, false, "")},
- {0xec8, 122, 1, 1, f(Yes, false, "")},
- {0xecc, 0, 0, 0, f(Yes, false, "")},
- {0xedc, 0, 0, 0, g(Yes, No, false, false, "", "ຫນ")},
- {0xedd, 0, 0, 0, g(Yes, No, false, false, "", "ຫມ")},
- {0xede, 0, 0, 0, f(Yes, false, "")},
- {0xf0c, 0, 0, 0, g(Yes, No, false, false, "", "་")},
- {0xf0d, 0, 0, 0, f(Yes, false, "")},
- {0xf18, 220, 1, 1, f(Yes, false, "")},
- {0xf1a, 0, 0, 0, f(Yes, false, "")},
- {0xf35, 220, 1, 1, f(Yes, false, "")},
- {0xf36, 0, 0, 0, f(Yes, false, "")},
- {0xf37, 220, 1, 1, f(Yes, false, "")},
- {0xf38, 0, 0, 0, f(Yes, false, "")},
- {0xf39, 216, 1, 1, f(Yes, false, "")},
- {0xf3a, 0, 0, 0, f(Yes, false, "")},
- {0xf43, 0, 0, 0, f(No, false, "གྷ")},
- {0xf44, 0, 0, 0, f(Yes, false, "")},
- {0xf4d, 0, 0, 0, f(No, false, "ཌྷ")},
- {0xf4e, 0, 0, 0, f(Yes, false, "")},
- {0xf52, 0, 0, 0, f(No, false, "དྷ")},
- {0xf53, 0, 0, 0, f(Yes, false, "")},
- {0xf57, 0, 0, 0, f(No, false, "བྷ")},
- {0xf58, 0, 0, 0, f(Yes, false, "")},
- {0xf5c, 0, 0, 0, f(No, false, "ཛྷ")},
- {0xf5d, 0, 0, 0, f(Yes, false, "")},
- {0xf69, 0, 0, 0, f(No, false, "ཀྵ")},
- {0xf6a, 0, 0, 0, f(Yes, false, "")},
- {0xf71, 129, 1, 1, f(Yes, false, "")},
- {0xf72, 130, 1, 1, f(Yes, false, "")},
- {0xf73, 0, 2, 2, f(No, false, "ཱི")},
- {0xf74, 132, 1, 1, f(Yes, false, "")},
- {0xf75, 0, 2, 2, f(No, false, "ཱུ")},
- {0xf76, 0, 0, 1, f(No, false, "ྲྀ")},
- {0xf77, 0, 0, 2, g(Yes, No, false, false, "", "ྲཱྀ")},
- {0xf78, 0, 0, 1, f(No, false, "ླྀ")},
- {0xf79, 0, 0, 2, g(Yes, No, false, false, "", "ླཱྀ")},
- {0xf7a, 130, 1, 1, f(Yes, false, "")},
- {0xf7e, 0, 0, 0, f(Yes, false, "")},
- {0xf80, 130, 1, 1, f(Yes, false, "")},
- {0xf81, 0, 2, 2, f(No, false, "ཱྀ")},
- {0xf82, 230, 1, 1, f(Yes, false, "")},
- {0xf84, 9, 1, 1, f(Yes, false, "")},
- {0xf85, 0, 0, 0, f(Yes, false, "")},
- {0xf86, 230, 1, 1, f(Yes, false, "")},
- {0xf88, 0, 0, 0, f(Yes, false, "")},
- {0xf93, 0, 0, 0, f(No, false, "ྒྷ")},
- {0xf94, 0, 0, 0, f(Yes, false, "")},
- {0xf9d, 0, 0, 0, f(No, false, "ྜྷ")},
- {0xf9e, 0, 0, 0, f(Yes, false, "")},
- {0xfa2, 0, 0, 0, f(No, false, "ྡྷ")},
- {0xfa3, 0, 0, 0, f(Yes, false, "")},
- {0xfa7, 0, 0, 0, f(No, false, "ྦྷ")},
- {0xfa8, 0, 0, 0, f(Yes, false, "")},
- {0xfac, 0, 0, 0, f(No, false, "ྫྷ")},
- {0xfad, 0, 0, 0, f(Yes, false, "")},
- {0xfb9, 0, 0, 0, f(No, false, "ྐྵ")},
- {0xfba, 0, 0, 0, f(Yes, false, "")},
- {0xfc6, 220, 1, 1, f(Yes, false, "")},
- {0xfc7, 0, 0, 0, f(Yes, false, "")},
- {0x1025, 0, 0, 0, f(Yes, true, "")},
- {0x1026, 0, 0, 1, f(Yes, false, "ဦ")},
- {0x1027, 0, 0, 0, f(Yes, false, "")},
- {0x102e, 0, 1, 1, f(Maybe, false, "")},
- {0x102f, 0, 0, 0, f(Yes, false, "")},
- {0x1037, 7, 1, 1, f(Yes, false, "")},
- {0x1038, 0, 0, 0, f(Yes, false, "")},
- {0x1039, 9, 1, 1, f(Yes, false, "")},
- {0x103b, 0, 0, 0, f(Yes, false, "")},
- {0x108d, 220, 1, 1, f(Yes, false, "")},
- {0x108e, 0, 0, 0, f(Yes, false, "")},
- {0x10fc, 0, 0, 0, g(Yes, No, false, false, "", "ნ")},
- {0x10fd, 0, 0, 0, f(Yes, false, "")},
- {0x1100, 0, 0, 0, f(Yes, true, "")},
- {0x1113, 0, 0, 0, f(Yes, false, "")},
- {0x1161, 0, 1, 1, f(Maybe, true, "")},
- {0x1176, 0, 0, 0, f(Yes, false, "")},
- {0x11a8, 0, 1, 1, f(Maybe, false, "")},
- {0x11c3, 0, 0, 0, f(Yes, false, "")},
- {0x135d, 230, 1, 1, f(Yes, false, "")},
- {0x1360, 0, 0, 0, f(Yes, false, "")},
- {0x1714, 9, 1, 1, f(Yes, false, "")},
- {0x1715, 0, 0, 0, f(Yes, false, "")},
- {0x1734, 9, 1, 1, f(Yes, false, "")},
- {0x1735, 0, 0, 0, f(Yes, false, "")},
- {0x17d2, 9, 1, 1, f(Yes, false, "")},
- {0x17d3, 0, 0, 0, f(Yes, false, "")},
- {0x17dd, 230, 1, 1, f(Yes, false, "")},
- {0x17de, 0, 0, 0, f(Yes, false, "")},
- {0x18a9, 228, 1, 1, f(Yes, false, "")},
- {0x18aa, 0, 0, 0, f(Yes, false, "")},
- {0x1939, 222, 1, 1, f(Yes, false, "")},
- {0x193a, 230, 1, 1, f(Yes, false, "")},
- {0x193b, 220, 1, 1, f(Yes, false, "")},
- {0x193c, 0, 0, 0, f(Yes, false, "")},
- {0x1a17, 230, 1, 1, f(Yes, false, "")},
- {0x1a18, 220, 1, 1, f(Yes, false, "")},
- {0x1a19, 0, 0, 0, f(Yes, false, "")},
- {0x1a60, 9, 1, 1, f(Yes, false, "")},
- {0x1a61, 0, 0, 0, f(Yes, false, "")},
- {0x1a75, 230, 1, 1, f(Yes, false, "")},
- {0x1a7d, 0, 0, 0, f(Yes, false, "")},
- {0x1a7f, 220, 1, 1, f(Yes, false, "")},
- {0x1a80, 0, 0, 0, f(Yes, false, "")},
- {0x1ab0, 230, 1, 1, f(Yes, false, "")},
- {0x1ab5, 220, 1, 1, f(Yes, false, "")},
- {0x1abb, 230, 1, 1, f(Yes, false, "")},
- {0x1abd, 220, 1, 1, f(Yes, false, "")},
- {0x1abe, 0, 0, 0, f(Yes, false, "")},
- {0x1b05, 0, 0, 0, f(Yes, true, "")},
- {0x1b06, 0, 0, 1, f(Yes, false, "ᬆ")},
- {0x1b07, 0, 0, 0, f(Yes, true, "")},
- {0x1b08, 0, 0, 1, f(Yes, false, "ᬈ")},
- {0x1b09, 0, 0, 0, f(Yes, true, "")},
- {0x1b0a, 0, 0, 1, f(Yes, false, "ᬊ")},
- {0x1b0b, 0, 0, 0, f(Yes, true, "")},
- {0x1b0c, 0, 0, 1, f(Yes, false, "ᬌ")},
- {0x1b0d, 0, 0, 0, f(Yes, true, "")},
- {0x1b0e, 0, 0, 1, f(Yes, false, "ᬎ")},
- {0x1b0f, 0, 0, 0, f(Yes, false, "")},
- {0x1b11, 0, 0, 0, f(Yes, true, "")},
- {0x1b12, 0, 0, 1, f(Yes, false, "ᬒ")},
- {0x1b13, 0, 0, 0, f(Yes, false, "")},
- {0x1b34, 7, 1, 1, f(Yes, false, "")},
- {0x1b35, 0, 1, 1, f(Maybe, false, "")},
- {0x1b36, 0, 0, 0, f(Yes, false, "")},
- {0x1b3a, 0, 0, 0, f(Yes, true, "")},
- {0x1b3b, 0, 0, 1, f(Yes, false, "ᬻ")},
- {0x1b3c, 0, 0, 0, f(Yes, true, "")},
- {0x1b3d, 0, 0, 1, f(Yes, false, "ᬽ")},
- {0x1b3e, 0, 0, 0, f(Yes, true, "")},
- {0x1b40, 0, 0, 1, f(Yes, false, "ᭀ")},
- {0x1b41, 0, 0, 1, f(Yes, false, "ᭁ")},
- {0x1b42, 0, 0, 0, f(Yes, true, "")},
- {0x1b43, 0, 0, 1, f(Yes, false, "ᭃ")},
- {0x1b44, 9, 1, 1, f(Yes, false, "")},
- {0x1b45, 0, 0, 0, f(Yes, false, "")},
- {0x1b6b, 230, 1, 1, f(Yes, false, "")},
- {0x1b6c, 220, 1, 1, f(Yes, false, "")},
- {0x1b6d, 230, 1, 1, f(Yes, false, "")},
- {0x1b74, 0, 0, 0, f(Yes, false, "")},
- {0x1baa, 9, 1, 1, f(Yes, false, "")},
- {0x1bac, 0, 0, 0, f(Yes, false, "")},
- {0x1be6, 7, 1, 1, f(Yes, false, "")},
- {0x1be7, 0, 0, 0, f(Yes, false, "")},
- {0x1bf2, 9, 1, 1, f(Yes, false, "")},
- {0x1bf4, 0, 0, 0, f(Yes, false, "")},
- {0x1c37, 7, 1, 1, f(Yes, false, "")},
- {0x1c38, 0, 0, 0, f(Yes, false, "")},
- {0x1cd0, 230, 1, 1, f(Yes, false, "")},
- {0x1cd3, 0, 0, 0, f(Yes, false, "")},
- {0x1cd4, 1, 1, 1, f(Yes, false, "")},
- {0x1cd5, 220, 1, 1, f(Yes, false, "")},
- {0x1cda, 230, 1, 1, f(Yes, false, "")},
- {0x1cdc, 220, 1, 1, f(Yes, false, "")},
- {0x1ce0, 230, 1, 1, f(Yes, false, "")},
- {0x1ce1, 0, 0, 0, f(Yes, false, "")},
- {0x1ce2, 1, 1, 1, f(Yes, false, "")},
- {0x1ce9, 0, 0, 0, f(Yes, false, "")},
- {0x1ced, 220, 1, 1, f(Yes, false, "")},
- {0x1cee, 0, 0, 0, f(Yes, false, "")},
- {0x1cf4, 230, 1, 1, f(Yes, false, "")},
- {0x1cf5, 0, 0, 0, f(Yes, false, "")},
- {0x1cf8, 230, 1, 1, f(Yes, false, "")},
- {0x1cfa, 0, 0, 0, f(Yes, false, "")},
- {0x1d2c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d2d, 0, 0, 0, g(Yes, No, false, false, "", "Æ")},
- {0x1d2e, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d2f, 0, 0, 0, f(Yes, false, "")},
- {0x1d30, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d31, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d32, 0, 0, 0, g(Yes, No, false, false, "", "Ǝ")},
- {0x1d33, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d34, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d35, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d36, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d37, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d38, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d39, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d3a, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d3b, 0, 0, 0, f(Yes, false, "")},
- {0x1d3c, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d3d, 0, 0, 0, g(Yes, No, false, false, "", "Ȣ")},
- {0x1d3e, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d3f, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d40, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d41, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d42, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d43, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44, 0, 0, 0, g(Yes, No, false, false, "", "ɐ")},
- {0x1d45, 0, 0, 0, g(Yes, No, false, false, "", "ɑ")},
- {0x1d46, 0, 0, 0, g(Yes, No, false, false, "", "ᴂ")},
- {0x1d47, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d48, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d49, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4a, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x1d4b, 0, 0, 0, g(Yes, No, false, false, "", "ɛ")},
- {0x1d4c, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1d4d, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4e, 0, 0, 0, f(Yes, false, "")},
- {0x1d4f, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d50, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d51, 0, 0, 0, g(Yes, No, false, false, "", "ŋ")},
- {0x1d52, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d53, 0, 0, 0, g(Yes, No, false, false, "", "ɔ")},
- {0x1d54, 0, 0, 0, g(Yes, No, false, false, "", "ᴖ")},
- {0x1d55, 0, 0, 0, g(Yes, No, false, false, "", "ᴗ")},
- {0x1d56, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d57, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d58, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59, 0, 0, 0, g(Yes, No, false, false, "", "ᴝ")},
- {0x1d5a, 0, 0, 0, g(Yes, No, false, false, "", "ɯ")},
- {0x1d5b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5c, 0, 0, 0, g(Yes, No, false, false, "", "ᴥ")},
- {0x1d5d, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d5e, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d5f, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d60, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d61, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d62, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d63, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d64, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d65, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d67, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d68, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d69, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6a, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6b, 0, 0, 0, f(Yes, false, "")},
- {0x1d78, 0, 0, 0, g(Yes, No, false, false, "", "н")},
- {0x1d79, 0, 0, 0, f(Yes, false, "")},
- {0x1d9b, 0, 0, 0, g(Yes, No, false, false, "", "ɒ")},
- {0x1d9c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d9d, 0, 0, 0, g(Yes, No, false, false, "", "ɕ")},
- {0x1d9e, 0, 0, 0, g(Yes, No, false, false, "", "ð")},
- {0x1d9f, 0, 0, 0, g(Yes, No, false, false, "", "ɜ")},
- {0x1da0, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1da1, 0, 0, 0, g(Yes, No, false, false, "", "ɟ")},
- {0x1da2, 0, 0, 0, g(Yes, No, false, false, "", "ɡ")},
- {0x1da3, 0, 0, 0, g(Yes, No, false, false, "", "ɥ")},
- {0x1da4, 0, 0, 0, g(Yes, No, false, false, "", "ɨ")},
- {0x1da5, 0, 0, 0, g(Yes, No, false, false, "", "ɩ")},
- {0x1da6, 0, 0, 0, g(Yes, No, false, false, "", "ɪ")},
- {0x1da7, 0, 0, 0, g(Yes, No, false, false, "", "ᵻ")},
- {0x1da8, 0, 0, 0, g(Yes, No, false, false, "", "ʝ")},
- {0x1da9, 0, 0, 0, g(Yes, No, false, false, "", "ɭ")},
- {0x1daa, 0, 0, 0, g(Yes, No, false, false, "", "ᶅ")},
- {0x1dab, 0, 0, 0, g(Yes, No, false, false, "", "ʟ")},
- {0x1dac, 0, 0, 0, g(Yes, No, false, false, "", "ɱ")},
- {0x1dad, 0, 0, 0, g(Yes, No, false, false, "", "ɰ")},
- {0x1dae, 0, 0, 0, g(Yes, No, false, false, "", "ɲ")},
- {0x1daf, 0, 0, 0, g(Yes, No, false, false, "", "ɳ")},
- {0x1db0, 0, 0, 0, g(Yes, No, false, false, "", "ɴ")},
- {0x1db1, 0, 0, 0, g(Yes, No, false, false, "", "ɵ")},
- {0x1db2, 0, 0, 0, g(Yes, No, false, false, "", "ɸ")},
- {0x1db3, 0, 0, 0, g(Yes, No, false, false, "", "ʂ")},
- {0x1db4, 0, 0, 0, g(Yes, No, false, false, "", "ʃ")},
- {0x1db5, 0, 0, 0, g(Yes, No, false, false, "", "ƫ")},
- {0x1db6, 0, 0, 0, g(Yes, No, false, false, "", "ʉ")},
- {0x1db7, 0, 0, 0, g(Yes, No, false, false, "", "ʊ")},
- {0x1db8, 0, 0, 0, g(Yes, No, false, false, "", "ᴜ")},
- {0x1db9, 0, 0, 0, g(Yes, No, false, false, "", "ʋ")},
- {0x1dba, 0, 0, 0, g(Yes, No, false, false, "", "ʌ")},
- {0x1dbb, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1dbc, 0, 0, 0, g(Yes, No, false, false, "", "ʐ")},
- {0x1dbd, 0, 0, 0, g(Yes, No, false, false, "", "ʑ")},
- {0x1dbe, 0, 0, 0, g(Yes, No, false, false, "", "ʒ")},
- {0x1dbf, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1dc0, 230, 1, 1, f(Yes, false, "")},
- {0x1dc2, 220, 1, 1, f(Yes, false, "")},
- {0x1dc3, 230, 1, 1, f(Yes, false, "")},
- {0x1dca, 220, 1, 1, f(Yes, false, "")},
- {0x1dcb, 230, 1, 1, f(Yes, false, "")},
- {0x1dcd, 234, 1, 1, f(Yes, false, "")},
- {0x1dce, 214, 1, 1, f(Yes, false, "")},
- {0x1dcf, 220, 1, 1, f(Yes, false, "")},
- {0x1dd0, 202, 1, 1, f(Yes, false, "")},
- {0x1dd1, 230, 1, 1, f(Yes, false, "")},
- {0x1df6, 0, 0, 0, f(Yes, false, "")},
- {0x1dfb, 230, 1, 1, f(Yes, false, "")},
- {0x1dfc, 233, 1, 1, f(Yes, false, "")},
- {0x1dfd, 220, 1, 1, f(Yes, false, "")},
- {0x1dfe, 230, 1, 1, f(Yes, false, "")},
- {0x1dff, 220, 1, 1, f(Yes, false, "")},
- {0x1e00, 0, 0, 1, f(Yes, false, "Ḁ")},
- {0x1e01, 0, 0, 1, f(Yes, false, "ḁ")},
- {0x1e02, 0, 0, 1, f(Yes, false, "Ḃ")},
- {0x1e03, 0, 0, 1, f(Yes, false, "ḃ")},
- {0x1e04, 0, 0, 1, f(Yes, false, "Ḅ")},
- {0x1e05, 0, 0, 1, f(Yes, false, "ḅ")},
- {0x1e06, 0, 0, 1, f(Yes, false, "Ḇ")},
- {0x1e07, 0, 0, 1, f(Yes, false, "ḇ")},
- {0x1e08, 0, 0, 2, f(Yes, false, "Ḉ")},
- {0x1e09, 0, 0, 2, f(Yes, false, "ḉ")},
- {0x1e0a, 0, 0, 1, f(Yes, false, "Ḋ")},
- {0x1e0b, 0, 0, 1, f(Yes, false, "ḋ")},
- {0x1e0c, 0, 0, 1, f(Yes, false, "Ḍ")},
- {0x1e0d, 0, 0, 1, f(Yes, false, "ḍ")},
- {0x1e0e, 0, 0, 1, f(Yes, false, "Ḏ")},
- {0x1e0f, 0, 0, 1, f(Yes, false, "ḏ")},
- {0x1e10, 0, 0, 1, f(Yes, false, "Ḑ")},
- {0x1e11, 0, 0, 1, f(Yes, false, "ḑ")},
- {0x1e12, 0, 0, 1, f(Yes, false, "Ḓ")},
- {0x1e13, 0, 0, 1, f(Yes, false, "ḓ")},
- {0x1e14, 0, 0, 2, f(Yes, false, "Ḕ")},
- {0x1e15, 0, 0, 2, f(Yes, false, "ḕ")},
- {0x1e16, 0, 0, 2, f(Yes, false, "Ḗ")},
- {0x1e17, 0, 0, 2, f(Yes, false, "ḗ")},
- {0x1e18, 0, 0, 1, f(Yes, false, "Ḙ")},
- {0x1e19, 0, 0, 1, f(Yes, false, "ḙ")},
- {0x1e1a, 0, 0, 1, f(Yes, false, "Ḛ")},
- {0x1e1b, 0, 0, 1, f(Yes, false, "ḛ")},
- {0x1e1c, 0, 0, 2, f(Yes, false, "Ḝ")},
- {0x1e1d, 0, 0, 2, f(Yes, false, "ḝ")},
- {0x1e1e, 0, 0, 1, f(Yes, false, "Ḟ")},
- {0x1e1f, 0, 0, 1, f(Yes, false, "ḟ")},
- {0x1e20, 0, 0, 1, f(Yes, false, "Ḡ")},
- {0x1e21, 0, 0, 1, f(Yes, false, "ḡ")},
- {0x1e22, 0, 0, 1, f(Yes, false, "Ḣ")},
- {0x1e23, 0, 0, 1, f(Yes, false, "ḣ")},
- {0x1e24, 0, 0, 1, f(Yes, false, "Ḥ")},
- {0x1e25, 0, 0, 1, f(Yes, false, "ḥ")},
- {0x1e26, 0, 0, 1, f(Yes, false, "Ḧ")},
- {0x1e27, 0, 0, 1, f(Yes, false, "ḧ")},
- {0x1e28, 0, 0, 1, f(Yes, false, "Ḩ")},
- {0x1e29, 0, 0, 1, f(Yes, false, "ḩ")},
- {0x1e2a, 0, 0, 1, f(Yes, false, "Ḫ")},
- {0x1e2b, 0, 0, 1, f(Yes, false, "ḫ")},
- {0x1e2c, 0, 0, 1, f(Yes, false, "Ḭ")},
- {0x1e2d, 0, 0, 1, f(Yes, false, "ḭ")},
- {0x1e2e, 0, 0, 2, f(Yes, false, "Ḯ")},
- {0x1e2f, 0, 0, 2, f(Yes, false, "ḯ")},
- {0x1e30, 0, 0, 1, f(Yes, false, "Ḱ")},
- {0x1e31, 0, 0, 1, f(Yes, false, "ḱ")},
- {0x1e32, 0, 0, 1, f(Yes, false, "Ḳ")},
- {0x1e33, 0, 0, 1, f(Yes, false, "ḳ")},
- {0x1e34, 0, 0, 1, f(Yes, false, "Ḵ")},
- {0x1e35, 0, 0, 1, f(Yes, false, "ḵ")},
- {0x1e36, 0, 0, 1, f(Yes, true, "Ḷ")},
- {0x1e37, 0, 0, 1, f(Yes, true, "ḷ")},
- {0x1e38, 0, 0, 2, f(Yes, false, "Ḹ")},
- {0x1e39, 0, 0, 2, f(Yes, false, "ḹ")},
- {0x1e3a, 0, 0, 1, f(Yes, false, "Ḻ")},
- {0x1e3b, 0, 0, 1, f(Yes, false, "ḻ")},
- {0x1e3c, 0, 0, 1, f(Yes, false, "Ḽ")},
- {0x1e3d, 0, 0, 1, f(Yes, false, "ḽ")},
- {0x1e3e, 0, 0, 1, f(Yes, false, "Ḿ")},
- {0x1e3f, 0, 0, 1, f(Yes, false, "ḿ")},
- {0x1e40, 0, 0, 1, f(Yes, false, "Ṁ")},
- {0x1e41, 0, 0, 1, f(Yes, false, "ṁ")},
- {0x1e42, 0, 0, 1, f(Yes, false, "Ṃ")},
- {0x1e43, 0, 0, 1, f(Yes, false, "ṃ")},
- {0x1e44, 0, 0, 1, f(Yes, false, "Ṅ")},
- {0x1e45, 0, 0, 1, f(Yes, false, "ṅ")},
- {0x1e46, 0, 0, 1, f(Yes, false, "Ṇ")},
- {0x1e47, 0, 0, 1, f(Yes, false, "ṇ")},
- {0x1e48, 0, 0, 1, f(Yes, false, "Ṉ")},
- {0x1e49, 0, 0, 1, f(Yes, false, "ṉ")},
- {0x1e4a, 0, 0, 1, f(Yes, false, "Ṋ")},
- {0x1e4b, 0, 0, 1, f(Yes, false, "ṋ")},
- {0x1e4c, 0, 0, 2, f(Yes, false, "Ṍ")},
- {0x1e4d, 0, 0, 2, f(Yes, false, "ṍ")},
- {0x1e4e, 0, 0, 2, f(Yes, false, "Ṏ")},
- {0x1e4f, 0, 0, 2, f(Yes, false, "ṏ")},
- {0x1e50, 0, 0, 2, f(Yes, false, "Ṑ")},
- {0x1e51, 0, 0, 2, f(Yes, false, "ṑ")},
- {0x1e52, 0, 0, 2, f(Yes, false, "Ṓ")},
- {0x1e53, 0, 0, 2, f(Yes, false, "ṓ")},
- {0x1e54, 0, 0, 1, f(Yes, false, "Ṕ")},
- {0x1e55, 0, 0, 1, f(Yes, false, "ṕ")},
- {0x1e56, 0, 0, 1, f(Yes, false, "Ṗ")},
- {0x1e57, 0, 0, 1, f(Yes, false, "ṗ")},
- {0x1e58, 0, 0, 1, f(Yes, false, "Ṙ")},
- {0x1e59, 0, 0, 1, f(Yes, false, "ṙ")},
- {0x1e5a, 0, 0, 1, f(Yes, true, "Ṛ")},
- {0x1e5b, 0, 0, 1, f(Yes, true, "ṛ")},
- {0x1e5c, 0, 0, 2, f(Yes, false, "Ṝ")},
- {0x1e5d, 0, 0, 2, f(Yes, false, "ṝ")},
- {0x1e5e, 0, 0, 1, f(Yes, false, "Ṟ")},
- {0x1e5f, 0, 0, 1, f(Yes, false, "ṟ")},
- {0x1e60, 0, 0, 1, f(Yes, false, "Ṡ")},
- {0x1e61, 0, 0, 1, f(Yes, false, "ṡ")},
- {0x1e62, 0, 0, 1, f(Yes, true, "Ṣ")},
- {0x1e63, 0, 0, 1, f(Yes, true, "ṣ")},
- {0x1e64, 0, 0, 2, f(Yes, false, "Ṥ")},
- {0x1e65, 0, 0, 2, f(Yes, false, "ṥ")},
- {0x1e66, 0, 0, 2, f(Yes, false, "Ṧ")},
- {0x1e67, 0, 0, 2, f(Yes, false, "ṧ")},
- {0x1e68, 0, 0, 2, f(Yes, false, "Ṩ")},
- {0x1e69, 0, 0, 2, f(Yes, false, "ṩ")},
- {0x1e6a, 0, 0, 1, f(Yes, false, "Ṫ")},
- {0x1e6b, 0, 0, 1, f(Yes, false, "ṫ")},
- {0x1e6c, 0, 0, 1, f(Yes, false, "Ṭ")},
- {0x1e6d, 0, 0, 1, f(Yes, false, "ṭ")},
- {0x1e6e, 0, 0, 1, f(Yes, false, "Ṯ")},
- {0x1e6f, 0, 0, 1, f(Yes, false, "ṯ")},
- {0x1e70, 0, 0, 1, f(Yes, false, "Ṱ")},
- {0x1e71, 0, 0, 1, f(Yes, false, "ṱ")},
- {0x1e72, 0, 0, 1, f(Yes, false, "Ṳ")},
- {0x1e73, 0, 0, 1, f(Yes, false, "ṳ")},
- {0x1e74, 0, 0, 1, f(Yes, false, "Ṵ")},
- {0x1e75, 0, 0, 1, f(Yes, false, "ṵ")},
- {0x1e76, 0, 0, 1, f(Yes, false, "Ṷ")},
- {0x1e77, 0, 0, 1, f(Yes, false, "ṷ")},
- {0x1e78, 0, 0, 2, f(Yes, false, "Ṹ")},
- {0x1e79, 0, 0, 2, f(Yes, false, "ṹ")},
- {0x1e7a, 0, 0, 2, f(Yes, false, "Ṻ")},
- {0x1e7b, 0, 0, 2, f(Yes, false, "ṻ")},
- {0x1e7c, 0, 0, 1, f(Yes, false, "Ṽ")},
- {0x1e7d, 0, 0, 1, f(Yes, false, "ṽ")},
- {0x1e7e, 0, 0, 1, f(Yes, false, "Ṿ")},
- {0x1e7f, 0, 0, 1, f(Yes, false, "ṿ")},
- {0x1e80, 0, 0, 1, f(Yes, false, "Ẁ")},
- {0x1e81, 0, 0, 1, f(Yes, false, "ẁ")},
- {0x1e82, 0, 0, 1, f(Yes, false, "Ẃ")},
- {0x1e83, 0, 0, 1, f(Yes, false, "ẃ")},
- {0x1e84, 0, 0, 1, f(Yes, false, "Ẅ")},
- {0x1e85, 0, 0, 1, f(Yes, false, "ẅ")},
- {0x1e86, 0, 0, 1, f(Yes, false, "Ẇ")},
- {0x1e87, 0, 0, 1, f(Yes, false, "ẇ")},
- {0x1e88, 0, 0, 1, f(Yes, false, "Ẉ")},
- {0x1e89, 0, 0, 1, f(Yes, false, "ẉ")},
- {0x1e8a, 0, 0, 1, f(Yes, false, "Ẋ")},
- {0x1e8b, 0, 0, 1, f(Yes, false, "ẋ")},
- {0x1e8c, 0, 0, 1, f(Yes, false, "Ẍ")},
- {0x1e8d, 0, 0, 1, f(Yes, false, "ẍ")},
- {0x1e8e, 0, 0, 1, f(Yes, false, "Ẏ")},
- {0x1e8f, 0, 0, 1, f(Yes, false, "ẏ")},
- {0x1e90, 0, 0, 1, f(Yes, false, "Ẑ")},
- {0x1e91, 0, 0, 1, f(Yes, false, "ẑ")},
- {0x1e92, 0, 0, 1, f(Yes, false, "Ẓ")},
- {0x1e93, 0, 0, 1, f(Yes, false, "ẓ")},
- {0x1e94, 0, 0, 1, f(Yes, false, "Ẕ")},
- {0x1e95, 0, 0, 1, f(Yes, false, "ẕ")},
- {0x1e96, 0, 0, 1, f(Yes, false, "ẖ")},
- {0x1e97, 0, 0, 1, f(Yes, false, "ẗ")},
- {0x1e98, 0, 0, 1, f(Yes, false, "ẘ")},
- {0x1e99, 0, 0, 1, f(Yes, false, "ẙ")},
- {0x1e9a, 0, 0, 0, g(Yes, No, false, false, "", "aʾ")},
- {0x1e9b, 0, 0, 1, g(Yes, No, false, false, "ẛ", "ṡ")},
- {0x1e9c, 0, 0, 0, f(Yes, false, "")},
- {0x1ea0, 0, 0, 1, f(Yes, true, "Ạ")},
- {0x1ea1, 0, 0, 1, f(Yes, true, "ạ")},
- {0x1ea2, 0, 0, 1, f(Yes, false, "Ả")},
- {0x1ea3, 0, 0, 1, f(Yes, false, "ả")},
- {0x1ea4, 0, 0, 2, f(Yes, false, "Ấ")},
- {0x1ea5, 0, 0, 2, f(Yes, false, "ấ")},
- {0x1ea6, 0, 0, 2, f(Yes, false, "Ầ")},
- {0x1ea7, 0, 0, 2, f(Yes, false, "ầ")},
- {0x1ea8, 0, 0, 2, f(Yes, false, "Ẩ")},
- {0x1ea9, 0, 0, 2, f(Yes, false, "ẩ")},
- {0x1eaa, 0, 0, 2, f(Yes, false, "Ẫ")},
- {0x1eab, 0, 0, 2, f(Yes, false, "ẫ")},
- {0x1eac, 0, 0, 2, f(Yes, false, "Ậ")},
- {0x1ead, 0, 0, 2, f(Yes, false, "ậ")},
- {0x1eae, 0, 0, 2, f(Yes, false, "Ắ")},
- {0x1eaf, 0, 0, 2, f(Yes, false, "ắ")},
- {0x1eb0, 0, 0, 2, f(Yes, false, "Ằ")},
- {0x1eb1, 0, 0, 2, f(Yes, false, "ằ")},
- {0x1eb2, 0, 0, 2, f(Yes, false, "Ẳ")},
- {0x1eb3, 0, 0, 2, f(Yes, false, "ẳ")},
- {0x1eb4, 0, 0, 2, f(Yes, false, "Ẵ")},
- {0x1eb5, 0, 0, 2, f(Yes, false, "ẵ")},
- {0x1eb6, 0, 0, 2, f(Yes, false, "Ặ")},
- {0x1eb7, 0, 0, 2, f(Yes, false, "ặ")},
- {0x1eb8, 0, 0, 1, f(Yes, true, "Ẹ")},
- {0x1eb9, 0, 0, 1, f(Yes, true, "ẹ")},
- {0x1eba, 0, 0, 1, f(Yes, false, "Ẻ")},
- {0x1ebb, 0, 0, 1, f(Yes, false, "ẻ")},
- {0x1ebc, 0, 0, 1, f(Yes, false, "Ẽ")},
- {0x1ebd, 0, 0, 1, f(Yes, false, "ẽ")},
- {0x1ebe, 0, 0, 2, f(Yes, false, "Ế")},
- {0x1ebf, 0, 0, 2, f(Yes, false, "ế")},
- {0x1ec0, 0, 0, 2, f(Yes, false, "Ề")},
- {0x1ec1, 0, 0, 2, f(Yes, false, "ề")},
- {0x1ec2, 0, 0, 2, f(Yes, false, "Ể")},
- {0x1ec3, 0, 0, 2, f(Yes, false, "ể")},
- {0x1ec4, 0, 0, 2, f(Yes, false, "Ễ")},
- {0x1ec5, 0, 0, 2, f(Yes, false, "ễ")},
- {0x1ec6, 0, 0, 2, f(Yes, false, "Ệ")},
- {0x1ec7, 0, 0, 2, f(Yes, false, "ệ")},
- {0x1ec8, 0, 0, 1, f(Yes, false, "Ỉ")},
- {0x1ec9, 0, 0, 1, f(Yes, false, "ỉ")},
- {0x1eca, 0, 0, 1, f(Yes, false, "Ị")},
- {0x1ecb, 0, 0, 1, f(Yes, false, "ị")},
- {0x1ecc, 0, 0, 1, f(Yes, true, "Ọ")},
- {0x1ecd, 0, 0, 1, f(Yes, true, "ọ")},
- {0x1ece, 0, 0, 1, f(Yes, false, "Ỏ")},
- {0x1ecf, 0, 0, 1, f(Yes, false, "ỏ")},
- {0x1ed0, 0, 0, 2, f(Yes, false, "Ố")},
- {0x1ed1, 0, 0, 2, f(Yes, false, "ố")},
- {0x1ed2, 0, 0, 2, f(Yes, false, "Ồ")},
- {0x1ed3, 0, 0, 2, f(Yes, false, "ồ")},
- {0x1ed4, 0, 0, 2, f(Yes, false, "Ổ")},
- {0x1ed5, 0, 0, 2, f(Yes, false, "ổ")},
- {0x1ed6, 0, 0, 2, f(Yes, false, "Ỗ")},
- {0x1ed7, 0, 0, 2, f(Yes, false, "ỗ")},
- {0x1ed8, 0, 0, 2, f(Yes, false, "Ộ")},
- {0x1ed9, 0, 0, 2, f(Yes, false, "ộ")},
- {0x1eda, 0, 0, 2, f(Yes, false, "Ớ")},
- {0x1edb, 0, 0, 2, f(Yes, false, "ớ")},
- {0x1edc, 0, 0, 2, f(Yes, false, "Ờ")},
- {0x1edd, 0, 0, 2, f(Yes, false, "ờ")},
- {0x1ede, 0, 0, 2, f(Yes, false, "Ở")},
- {0x1edf, 0, 0, 2, f(Yes, false, "ở")},
- {0x1ee0, 0, 0, 2, f(Yes, false, "Ỡ")},
- {0x1ee1, 0, 0, 2, f(Yes, false, "ỡ")},
- {0x1ee2, 0, 0, 2, f(Yes, false, "Ợ")},
- {0x1ee3, 0, 0, 2, f(Yes, false, "ợ")},
- {0x1ee4, 0, 0, 1, f(Yes, false, "Ụ")},
- {0x1ee5, 0, 0, 1, f(Yes, false, "ụ")},
- {0x1ee6, 0, 0, 1, f(Yes, false, "Ủ")},
- {0x1ee7, 0, 0, 1, f(Yes, false, "ủ")},
- {0x1ee8, 0, 0, 2, f(Yes, false, "Ứ")},
- {0x1ee9, 0, 0, 2, f(Yes, false, "ứ")},
- {0x1eea, 0, 0, 2, f(Yes, false, "Ừ")},
- {0x1eeb, 0, 0, 2, f(Yes, false, "ừ")},
- {0x1eec, 0, 0, 2, f(Yes, false, "Ử")},
- {0x1eed, 0, 0, 2, f(Yes, false, "ử")},
- {0x1eee, 0, 0, 2, f(Yes, false, "Ữ")},
- {0x1eef, 0, 0, 2, f(Yes, false, "ữ")},
- {0x1ef0, 0, 0, 2, f(Yes, false, "Ự")},
- {0x1ef1, 0, 0, 2, f(Yes, false, "ự")},
- {0x1ef2, 0, 0, 1, f(Yes, false, "Ỳ")},
- {0x1ef3, 0, 0, 1, f(Yes, false, "ỳ")},
- {0x1ef4, 0, 0, 1, f(Yes, false, "Ỵ")},
- {0x1ef5, 0, 0, 1, f(Yes, false, "ỵ")},
- {0x1ef6, 0, 0, 1, f(Yes, false, "Ỷ")},
- {0x1ef7, 0, 0, 1, f(Yes, false, "ỷ")},
- {0x1ef8, 0, 0, 1, f(Yes, false, "Ỹ")},
- {0x1ef9, 0, 0, 1, f(Yes, false, "ỹ")},
- {0x1efa, 0, 0, 0, f(Yes, false, "")},
- {0x1f00, 0, 0, 1, f(Yes, true, "ἀ")},
- {0x1f01, 0, 0, 1, f(Yes, true, "ἁ")},
- {0x1f02, 0, 0, 2, f(Yes, true, "ἂ")},
- {0x1f03, 0, 0, 2, f(Yes, true, "ἃ")},
- {0x1f04, 0, 0, 2, f(Yes, true, "ἄ")},
- {0x1f05, 0, 0, 2, f(Yes, true, "ἅ")},
- {0x1f06, 0, 0, 2, f(Yes, true, "ἆ")},
- {0x1f07, 0, 0, 2, f(Yes, true, "ἇ")},
- {0x1f08, 0, 0, 1, f(Yes, true, "Ἀ")},
- {0x1f09, 0, 0, 1, f(Yes, true, "Ἁ")},
- {0x1f0a, 0, 0, 2, f(Yes, true, "Ἂ")},
- {0x1f0b, 0, 0, 2, f(Yes, true, "Ἃ")},
- {0x1f0c, 0, 0, 2, f(Yes, true, "Ἄ")},
- {0x1f0d, 0, 0, 2, f(Yes, true, "Ἅ")},
- {0x1f0e, 0, 0, 2, f(Yes, true, "Ἆ")},
- {0x1f0f, 0, 0, 2, f(Yes, true, "Ἇ")},
- {0x1f10, 0, 0, 1, f(Yes, true, "ἐ")},
- {0x1f11, 0, 0, 1, f(Yes, true, "ἑ")},
- {0x1f12, 0, 0, 2, f(Yes, false, "ἒ")},
- {0x1f13, 0, 0, 2, f(Yes, false, "ἓ")},
- {0x1f14, 0, 0, 2, f(Yes, false, "ἔ")},
- {0x1f15, 0, 0, 2, f(Yes, false, "ἕ")},
- {0x1f16, 0, 0, 0, f(Yes, false, "")},
- {0x1f18, 0, 0, 1, f(Yes, true, "Ἐ")},
- {0x1f19, 0, 0, 1, f(Yes, true, "Ἑ")},
- {0x1f1a, 0, 0, 2, f(Yes, false, "Ἒ")},
- {0x1f1b, 0, 0, 2, f(Yes, false, "Ἓ")},
- {0x1f1c, 0, 0, 2, f(Yes, false, "Ἔ")},
- {0x1f1d, 0, 0, 2, f(Yes, false, "Ἕ")},
- {0x1f1e, 0, 0, 0, f(Yes, false, "")},
- {0x1f20, 0, 0, 1, f(Yes, true, "ἠ")},
- {0x1f21, 0, 0, 1, f(Yes, true, "ἡ")},
- {0x1f22, 0, 0, 2, f(Yes, true, "ἢ")},
- {0x1f23, 0, 0, 2, f(Yes, true, "ἣ")},
- {0x1f24, 0, 0, 2, f(Yes, true, "ἤ")},
- {0x1f25, 0, 0, 2, f(Yes, true, "ἥ")},
- {0x1f26, 0, 0, 2, f(Yes, true, "ἦ")},
- {0x1f27, 0, 0, 2, f(Yes, true, "ἧ")},
- {0x1f28, 0, 0, 1, f(Yes, true, "Ἠ")},
- {0x1f29, 0, 0, 1, f(Yes, true, "Ἡ")},
- {0x1f2a, 0, 0, 2, f(Yes, true, "Ἢ")},
- {0x1f2b, 0, 0, 2, f(Yes, true, "Ἣ")},
- {0x1f2c, 0, 0, 2, f(Yes, true, "Ἤ")},
- {0x1f2d, 0, 0, 2, f(Yes, true, "Ἥ")},
- {0x1f2e, 0, 0, 2, f(Yes, true, "Ἦ")},
- {0x1f2f, 0, 0, 2, f(Yes, true, "Ἧ")},
- {0x1f30, 0, 0, 1, f(Yes, true, "ἰ")},
- {0x1f31, 0, 0, 1, f(Yes, true, "ἱ")},
- {0x1f32, 0, 0, 2, f(Yes, false, "ἲ")},
- {0x1f33, 0, 0, 2, f(Yes, false, "ἳ")},
- {0x1f34, 0, 0, 2, f(Yes, false, "ἴ")},
- {0x1f35, 0, 0, 2, f(Yes, false, "ἵ")},
- {0x1f36, 0, 0, 2, f(Yes, false, "ἶ")},
- {0x1f37, 0, 0, 2, f(Yes, false, "ἷ")},
- {0x1f38, 0, 0, 1, f(Yes, true, "Ἰ")},
- {0x1f39, 0, 0, 1, f(Yes, true, "Ἱ")},
- {0x1f3a, 0, 0, 2, f(Yes, false, "Ἲ")},
- {0x1f3b, 0, 0, 2, f(Yes, false, "Ἳ")},
- {0x1f3c, 0, 0, 2, f(Yes, false, "Ἴ")},
- {0x1f3d, 0, 0, 2, f(Yes, false, "Ἵ")},
- {0x1f3e, 0, 0, 2, f(Yes, false, "Ἶ")},
- {0x1f3f, 0, 0, 2, f(Yes, false, "Ἷ")},
- {0x1f40, 0, 0, 1, f(Yes, true, "ὀ")},
- {0x1f41, 0, 0, 1, f(Yes, true, "ὁ")},
- {0x1f42, 0, 0, 2, f(Yes, false, "ὂ")},
- {0x1f43, 0, 0, 2, f(Yes, false, "ὃ")},
- {0x1f44, 0, 0, 2, f(Yes, false, "ὄ")},
- {0x1f45, 0, 0, 2, f(Yes, false, "ὅ")},
- {0x1f46, 0, 0, 0, f(Yes, false, "")},
- {0x1f48, 0, 0, 1, f(Yes, true, "Ὀ")},
- {0x1f49, 0, 0, 1, f(Yes, true, "Ὁ")},
- {0x1f4a, 0, 0, 2, f(Yes, false, "Ὂ")},
- {0x1f4b, 0, 0, 2, f(Yes, false, "Ὃ")},
- {0x1f4c, 0, 0, 2, f(Yes, false, "Ὄ")},
- {0x1f4d, 0, 0, 2, f(Yes, false, "Ὅ")},
- {0x1f4e, 0, 0, 0, f(Yes, false, "")},
- {0x1f50, 0, 0, 1, f(Yes, true, "ὐ")},
- {0x1f51, 0, 0, 1, f(Yes, true, "ὑ")},
- {0x1f52, 0, 0, 2, f(Yes, false, "ὒ")},
- {0x1f53, 0, 0, 2, f(Yes, false, "ὓ")},
- {0x1f54, 0, 0, 2, f(Yes, false, "ὔ")},
- {0x1f55, 0, 0, 2, f(Yes, false, "ὕ")},
- {0x1f56, 0, 0, 2, f(Yes, false, "ὖ")},
- {0x1f57, 0, 0, 2, f(Yes, false, "ὗ")},
- {0x1f58, 0, 0, 0, f(Yes, false, "")},
- {0x1f59, 0, 0, 1, f(Yes, true, "Ὑ")},
- {0x1f5a, 0, 0, 0, f(Yes, false, "")},
- {0x1f5b, 0, 0, 2, f(Yes, false, "Ὓ")},
- {0x1f5c, 0, 0, 0, f(Yes, false, "")},
- {0x1f5d, 0, 0, 2, f(Yes, false, "Ὕ")},
- {0x1f5e, 0, 0, 0, f(Yes, false, "")},
- {0x1f5f, 0, 0, 2, f(Yes, false, "Ὗ")},
- {0x1f60, 0, 0, 1, f(Yes, true, "ὠ")},
- {0x1f61, 0, 0, 1, f(Yes, true, "ὡ")},
- {0x1f62, 0, 0, 2, f(Yes, true, "ὢ")},
- {0x1f63, 0, 0, 2, f(Yes, true, "ὣ")},
- {0x1f64, 0, 0, 2, f(Yes, true, "ὤ")},
- {0x1f65, 0, 0, 2, f(Yes, true, "ὥ")},
- {0x1f66, 0, 0, 2, f(Yes, true, "ὦ")},
- {0x1f67, 0, 0, 2, f(Yes, true, "ὧ")},
- {0x1f68, 0, 0, 1, f(Yes, true, "Ὠ")},
- {0x1f69, 0, 0, 1, f(Yes, true, "Ὡ")},
- {0x1f6a, 0, 0, 2, f(Yes, true, "Ὢ")},
- {0x1f6b, 0, 0, 2, f(Yes, true, "Ὣ")},
- {0x1f6c, 0, 0, 2, f(Yes, true, "Ὤ")},
- {0x1f6d, 0, 0, 2, f(Yes, true, "Ὥ")},
- {0x1f6e, 0, 0, 2, f(Yes, true, "Ὦ")},
- {0x1f6f, 0, 0, 2, f(Yes, true, "Ὧ")},
- {0x1f70, 0, 0, 1, f(Yes, true, "ὰ")},
- {0x1f71, 0, 0, 1, f(No, false, "ά")},
- {0x1f72, 0, 0, 1, f(Yes, false, "ὲ")},
- {0x1f73, 0, 0, 1, f(No, false, "έ")},
- {0x1f74, 0, 0, 1, f(Yes, true, "ὴ")},
- {0x1f75, 0, 0, 1, f(No, false, "ή")},
- {0x1f76, 0, 0, 1, f(Yes, false, "ὶ")},
- {0x1f77, 0, 0, 1, f(No, false, "ί")},
- {0x1f78, 0, 0, 1, f(Yes, false, "ὸ")},
- {0x1f79, 0, 0, 1, f(No, false, "ό")},
- {0x1f7a, 0, 0, 1, f(Yes, false, "ὺ")},
- {0x1f7b, 0, 0, 1, f(No, false, "ύ")},
- {0x1f7c, 0, 0, 1, f(Yes, true, "ὼ")},
- {0x1f7d, 0, 0, 1, f(No, false, "ώ")},
- {0x1f7e, 0, 0, 0, f(Yes, false, "")},
- {0x1f80, 0, 0, 2, f(Yes, false, "ᾀ")},
- {0x1f81, 0, 0, 2, f(Yes, false, "ᾁ")},
- {0x1f82, 0, 0, 3, f(Yes, false, "ᾂ")},
- {0x1f83, 0, 0, 3, f(Yes, false, "ᾃ")},
- {0x1f84, 0, 0, 3, f(Yes, false, "ᾄ")},
- {0x1f85, 0, 0, 3, f(Yes, false, "ᾅ")},
- {0x1f86, 0, 0, 3, f(Yes, false, "ᾆ")},
- {0x1f87, 0, 0, 3, f(Yes, false, "ᾇ")},
- {0x1f88, 0, 0, 2, f(Yes, false, "ᾈ")},
- {0x1f89, 0, 0, 2, f(Yes, false, "ᾉ")},
- {0x1f8a, 0, 0, 3, f(Yes, false, "ᾊ")},
- {0x1f8b, 0, 0, 3, f(Yes, false, "ᾋ")},
- {0x1f8c, 0, 0, 3, f(Yes, false, "ᾌ")},
- {0x1f8d, 0, 0, 3, f(Yes, false, "ᾍ")},
- {0x1f8e, 0, 0, 3, f(Yes, false, "ᾎ")},
- {0x1f8f, 0, 0, 3, f(Yes, false, "ᾏ")},
- {0x1f90, 0, 0, 2, f(Yes, false, "ᾐ")},
- {0x1f91, 0, 0, 2, f(Yes, false, "ᾑ")},
- {0x1f92, 0, 0, 3, f(Yes, false, "ᾒ")},
- {0x1f93, 0, 0, 3, f(Yes, false, "ᾓ")},
- {0x1f94, 0, 0, 3, f(Yes, false, "ᾔ")},
- {0x1f95, 0, 0, 3, f(Yes, false, "ᾕ")},
- {0x1f96, 0, 0, 3, f(Yes, false, "ᾖ")},
- {0x1f97, 0, 0, 3, f(Yes, false, "ᾗ")},
- {0x1f98, 0, 0, 2, f(Yes, false, "ᾘ")},
- {0x1f99, 0, 0, 2, f(Yes, false, "ᾙ")},
- {0x1f9a, 0, 0, 3, f(Yes, false, "ᾚ")},
- {0x1f9b, 0, 0, 3, f(Yes, false, "ᾛ")},
- {0x1f9c, 0, 0, 3, f(Yes, false, "ᾜ")},
- {0x1f9d, 0, 0, 3, f(Yes, false, "ᾝ")},
- {0x1f9e, 0, 0, 3, f(Yes, false, "ᾞ")},
- {0x1f9f, 0, 0, 3, f(Yes, false, "ᾟ")},
- {0x1fa0, 0, 0, 2, f(Yes, false, "ᾠ")},
- {0x1fa1, 0, 0, 2, f(Yes, false, "ᾡ")},
- {0x1fa2, 0, 0, 3, f(Yes, false, "ᾢ")},
- {0x1fa3, 0, 0, 3, f(Yes, false, "ᾣ")},
- {0x1fa4, 0, 0, 3, f(Yes, false, "ᾤ")},
- {0x1fa5, 0, 0, 3, f(Yes, false, "ᾥ")},
- {0x1fa6, 0, 0, 3, f(Yes, false, "ᾦ")},
- {0x1fa7, 0, 0, 3, f(Yes, false, "ᾧ")},
- {0x1fa8, 0, 0, 2, f(Yes, false, "ᾨ")},
- {0x1fa9, 0, 0, 2, f(Yes, false, "ᾩ")},
- {0x1faa, 0, 0, 3, f(Yes, false, "ᾪ")},
- {0x1fab, 0, 0, 3, f(Yes, false, "ᾫ")},
- {0x1fac, 0, 0, 3, f(Yes, false, "ᾬ")},
- {0x1fad, 0, 0, 3, f(Yes, false, "ᾭ")},
- {0x1fae, 0, 0, 3, f(Yes, false, "ᾮ")},
- {0x1faf, 0, 0, 3, f(Yes, false, "ᾯ")},
- {0x1fb0, 0, 0, 1, f(Yes, false, "ᾰ")},
- {0x1fb1, 0, 0, 1, f(Yes, false, "ᾱ")},
- {0x1fb2, 0, 0, 2, f(Yes, false, "ᾲ")},
- {0x1fb3, 0, 0, 1, f(Yes, false, "ᾳ")},
- {0x1fb4, 0, 0, 2, f(Yes, false, "ᾴ")},
- {0x1fb5, 0, 0, 0, f(Yes, false, "")},
- {0x1fb6, 0, 0, 1, f(Yes, true, "ᾶ")},
- {0x1fb7, 0, 0, 2, f(Yes, false, "ᾷ")},
- {0x1fb8, 0, 0, 1, f(Yes, false, "Ᾰ")},
- {0x1fb9, 0, 0, 1, f(Yes, false, "Ᾱ")},
- {0x1fba, 0, 0, 1, f(Yes, false, "Ὰ")},
- {0x1fbb, 0, 0, 1, f(No, false, "Ά")},
- {0x1fbc, 0, 0, 1, f(Yes, false, "ᾼ")},
- {0x1fbd, 0, 0, 1, g(Yes, No, false, false, "", " ̓")},
- {0x1fbe, 0, 0, 0, f(No, false, "ι")},
- {0x1fbf, 0, 0, 1, g(Yes, No, true, false, "", " ̓")},
- {0x1fc0, 0, 0, 1, g(Yes, No, false, false, "", " ͂")},
- {0x1fc1, 0, 0, 2, g(Yes, No, false, false, "῁", " ̈͂")},
- {0x1fc2, 0, 0, 2, f(Yes, false, "ῂ")},
- {0x1fc3, 0, 0, 1, f(Yes, false, "ῃ")},
- {0x1fc4, 0, 0, 2, f(Yes, false, "ῄ")},
- {0x1fc5, 0, 0, 0, f(Yes, false, "")},
- {0x1fc6, 0, 0, 1, f(Yes, true, "ῆ")},
- {0x1fc7, 0, 0, 2, f(Yes, false, "ῇ")},
- {0x1fc8, 0, 0, 1, f(Yes, false, "Ὲ")},
- {0x1fc9, 0, 0, 1, f(No, false, "Έ")},
- {0x1fca, 0, 0, 1, f(Yes, false, "Ὴ")},
- {0x1fcb, 0, 0, 1, f(No, false, "Ή")},
- {0x1fcc, 0, 0, 1, f(Yes, false, "ῌ")},
- {0x1fcd, 0, 0, 2, g(Yes, No, false, false, "῍", " ̓̀")},
- {0x1fce, 0, 0, 2, g(Yes, No, false, false, "῎", " ̓́")},
- {0x1fcf, 0, 0, 2, g(Yes, No, false, false, "῏", " ̓͂")},
- {0x1fd0, 0, 0, 1, f(Yes, false, "ῐ")},
- {0x1fd1, 0, 0, 1, f(Yes, false, "ῑ")},
- {0x1fd2, 0, 0, 2, f(Yes, false, "ῒ")},
- {0x1fd3, 0, 0, 2, f(No, false, "ΐ")},
- {0x1fd4, 0, 0, 0, f(Yes, false, "")},
- {0x1fd6, 0, 0, 1, f(Yes, false, "ῖ")},
- {0x1fd7, 0, 0, 2, f(Yes, false, "ῗ")},
- {0x1fd8, 0, 0, 1, f(Yes, false, "Ῐ")},
- {0x1fd9, 0, 0, 1, f(Yes, false, "Ῑ")},
- {0x1fda, 0, 0, 1, f(Yes, false, "Ὶ")},
- {0x1fdb, 0, 0, 1, f(No, false, "Ί")},
- {0x1fdc, 0, 0, 0, f(Yes, false, "")},
- {0x1fdd, 0, 0, 2, g(Yes, No, false, false, "῝", " ̔̀")},
- {0x1fde, 0, 0, 2, g(Yes, No, false, false, "῞", " ̔́")},
- {0x1fdf, 0, 0, 2, g(Yes, No, false, false, "῟", " ̔͂")},
- {0x1fe0, 0, 0, 1, f(Yes, false, "ῠ")},
- {0x1fe1, 0, 0, 1, f(Yes, false, "ῡ")},
- {0x1fe2, 0, 0, 2, f(Yes, false, "ῢ")},
- {0x1fe3, 0, 0, 2, f(No, false, "ΰ")},
- {0x1fe4, 0, 0, 1, f(Yes, false, "ῤ")},
- {0x1fe5, 0, 0, 1, f(Yes, false, "ῥ")},
- {0x1fe6, 0, 0, 1, f(Yes, false, "ῦ")},
- {0x1fe7, 0, 0, 2, f(Yes, false, "ῧ")},
- {0x1fe8, 0, 0, 1, f(Yes, false, "Ῠ")},
- {0x1fe9, 0, 0, 1, f(Yes, false, "Ῡ")},
- {0x1fea, 0, 0, 1, f(Yes, false, "Ὺ")},
- {0x1feb, 0, 0, 1, f(No, false, "Ύ")},
- {0x1fec, 0, 0, 1, f(Yes, false, "Ῥ")},
- {0x1fed, 0, 0, 2, g(Yes, No, false, false, "῭", " ̈̀")},
- {0x1fee, 0, 0, 2, g(No, No, false, false, "΅", " ̈́")},
- {0x1fef, 0, 0, 0, f(No, false, "`")},
- {0x1ff0, 0, 0, 0, f(Yes, false, "")},
- {0x1ff2, 0, 0, 2, f(Yes, false, "ῲ")},
- {0x1ff3, 0, 0, 1, f(Yes, false, "ῳ")},
- {0x1ff4, 0, 0, 2, f(Yes, false, "ῴ")},
- {0x1ff5, 0, 0, 0, f(Yes, false, "")},
- {0x1ff6, 0, 0, 1, f(Yes, true, "ῶ")},
- {0x1ff7, 0, 0, 2, f(Yes, false, "ῷ")},
- {0x1ff8, 0, 0, 1, f(Yes, false, "Ὸ")},
- {0x1ff9, 0, 0, 1, f(No, false, "Ό")},
- {0x1ffa, 0, 0, 1, f(Yes, false, "Ὼ")},
- {0x1ffb, 0, 0, 1, f(No, false, "Ώ")},
- {0x1ffc, 0, 0, 1, f(Yes, false, "ῼ")},
- {0x1ffd, 0, 0, 1, g(No, No, false, false, "´", " ́")},
- {0x1ffe, 0, 0, 1, g(Yes, No, true, false, "", " ̔")},
- {0x1fff, 0, 0, 0, f(Yes, false, "")},
- {0x2000, 0, 0, 0, g(No, No, false, false, "\u2002", " ")},
- {0x2001, 0, 0, 0, g(No, No, false, false, "\u2003", " ")},
- {0x2002, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x200b, 0, 0, 0, f(Yes, false, "")},
- {0x2011, 0, 0, 0, g(Yes, No, false, false, "", "‐")},
- {0x2012, 0, 0, 0, f(Yes, false, "")},
- {0x2017, 0, 0, 1, g(Yes, No, false, false, "", " ̳")},
- {0x2018, 0, 0, 0, f(Yes, false, "")},
- {0x2024, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0x2025, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0x2026, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0x2027, 0, 0, 0, f(Yes, false, "")},
- {0x202f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2030, 0, 0, 0, f(Yes, false, "")},
- {0x2033, 0, 0, 0, g(Yes, No, false, false, "", "′′")},
- {0x2034, 0, 0, 0, g(Yes, No, false, false, "", "′′′")},
- {0x2035, 0, 0, 0, f(Yes, false, "")},
- {0x2036, 0, 0, 0, g(Yes, No, false, false, "", "‵‵")},
- {0x2037, 0, 0, 0, g(Yes, No, false, false, "", "‵‵‵")},
- {0x2038, 0, 0, 0, f(Yes, false, "")},
- {0x203c, 0, 0, 0, g(Yes, No, false, false, "", "!!")},
- {0x203d, 0, 0, 0, f(Yes, false, "")},
- {0x203e, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0x203f, 0, 0, 0, f(Yes, false, "")},
- {0x2047, 0, 0, 0, g(Yes, No, false, false, "", "??")},
- {0x2048, 0, 0, 0, g(Yes, No, false, false, "", "?!")},
- {0x2049, 0, 0, 0, g(Yes, No, false, false, "", "!?")},
- {0x204a, 0, 0, 0, f(Yes, false, "")},
- {0x2057, 0, 0, 0, g(Yes, No, false, false, "", "′′′′")},
- {0x2058, 0, 0, 0, f(Yes, false, "")},
- {0x205f, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x2060, 0, 0, 0, f(Yes, false, "")},
- {0x2070, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2071, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2072, 0, 0, 0, f(Yes, false, "")},
- {0x2074, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2075, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2076, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2077, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2078, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2079, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x207a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x207b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x207c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x207d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x207e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x207f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x2080, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x2081, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2082, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2083, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2084, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2085, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2086, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2087, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2088, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2089, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x208a, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0x208b, 0, 0, 0, g(Yes, No, false, false, "", "−")},
- {0x208c, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0x208d, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0x208e, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0x208f, 0, 0, 0, f(Yes, false, "")},
- {0x2090, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x2091, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2092, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2093, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x2094, 0, 0, 0, g(Yes, No, false, false, "", "ə")},
- {0x2095, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x2096, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x2097, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2098, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2099, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x209a, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x209b, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x209c, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x209d, 0, 0, 0, f(Yes, false, "")},
- {0x20a8, 0, 0, 0, g(Yes, No, false, false, "", "Rs")},
- {0x20a9, 0, 0, 0, f(Yes, false, "")},
- {0x20d0, 230, 1, 1, f(Yes, false, "")},
- {0x20d2, 1, 1, 1, f(Yes, false, "")},
- {0x20d4, 230, 1, 1, f(Yes, false, "")},
- {0x20d8, 1, 1, 1, f(Yes, false, "")},
- {0x20db, 230, 1, 1, f(Yes, false, "")},
- {0x20dd, 0, 0, 0, f(Yes, false, "")},
- {0x20e1, 230, 1, 1, f(Yes, false, "")},
- {0x20e2, 0, 0, 0, f(Yes, false, "")},
- {0x20e5, 1, 1, 1, f(Yes, false, "")},
- {0x20e7, 230, 1, 1, f(Yes, false, "")},
- {0x20e8, 220, 1, 1, f(Yes, false, "")},
- {0x20e9, 230, 1, 1, f(Yes, false, "")},
- {0x20ea, 1, 1, 1, f(Yes, false, "")},
- {0x20ec, 220, 1, 1, f(Yes, false, "")},
- {0x20f0, 230, 1, 1, f(Yes, false, "")},
- {0x20f1, 0, 0, 0, f(Yes, false, "")},
- {0x2100, 0, 0, 0, g(Yes, No, false, false, "", "a/c")},
- {0x2101, 0, 0, 0, g(Yes, No, false, false, "", "a/s")},
- {0x2102, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x2103, 0, 0, 0, g(Yes, No, false, false, "", "°C")},
- {0x2104, 0, 0, 0, f(Yes, false, "")},
- {0x2105, 0, 0, 0, g(Yes, No, false, false, "", "c/o")},
- {0x2106, 0, 0, 0, g(Yes, No, false, false, "", "c/u")},
- {0x2107, 0, 0, 0, g(Yes, No, false, false, "", "Ɛ")},
- {0x2108, 0, 0, 0, f(Yes, false, "")},
- {0x2109, 0, 0, 0, g(Yes, No, false, false, "", "°F")},
- {0x210a, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x210b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x210e, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x210f, 0, 0, 0, g(Yes, No, false, false, "", "ħ")},
- {0x2110, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2112, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x2113, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x2114, 0, 0, 0, f(Yes, false, "")},
- {0x2115, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x2116, 0, 0, 0, g(Yes, No, false, false, "", "No")},
- {0x2117, 0, 0, 0, f(Yes, false, "")},
- {0x2119, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x211a, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x211b, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x211e, 0, 0, 0, f(Yes, false, "")},
- {0x2120, 0, 0, 0, g(Yes, No, false, false, "", "SM")},
- {0x2121, 0, 0, 0, g(Yes, No, false, false, "", "TEL")},
- {0x2122, 0, 0, 0, g(Yes, No, false, false, "", "TM")},
- {0x2123, 0, 0, 0, f(Yes, false, "")},
- {0x2124, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2125, 0, 0, 0, f(Yes, false, "")},
- {0x2126, 0, 0, 0, f(No, false, "Ω")},
- {0x2127, 0, 0, 0, f(Yes, false, "")},
- {0x2128, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x2129, 0, 0, 0, f(Yes, false, "")},
- {0x212a, 0, 0, 0, f(No, false, "K")},
- {0x212b, 0, 0, 1, f(No, false, "Å")},
- {0x212c, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x212d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x212e, 0, 0, 0, f(Yes, false, "")},
- {0x212f, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2130, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x2131, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x2132, 0, 0, 0, f(Yes, false, "")},
- {0x2133, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2134, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x2135, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0x2136, 0, 0, 0, g(Yes, No, false, false, "", "ב")},
- {0x2137, 0, 0, 0, g(Yes, No, false, false, "", "ג")},
- {0x2138, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0x2139, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x213a, 0, 0, 0, f(Yes, false, "")},
- {0x213b, 0, 0, 0, g(Yes, No, false, false, "", "FAX")},
- {0x213c, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x213d, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x213e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x213f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x2140, 0, 0, 0, g(Yes, No, false, false, "", "∑")},
- {0x2141, 0, 0, 0, f(Yes, false, "")},
- {0x2145, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x2146, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x2147, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x2148, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2149, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x214a, 0, 0, 0, f(Yes, false, "")},
- {0x2150, 0, 0, 0, g(Yes, No, false, false, "", "1⁄7")},
- {0x2151, 0, 0, 0, g(Yes, No, false, false, "", "1⁄9")},
- {0x2152, 0, 0, 0, g(Yes, No, false, false, "", "1⁄10")},
- {0x2153, 0, 0, 0, g(Yes, No, false, false, "", "1⁄3")},
- {0x2154, 0, 0, 0, g(Yes, No, false, false, "", "2⁄3")},
- {0x2155, 0, 0, 0, g(Yes, No, false, false, "", "1⁄5")},
- {0x2156, 0, 0, 0, g(Yes, No, false, false, "", "2⁄5")},
- {0x2157, 0, 0, 0, g(Yes, No, false, false, "", "3⁄5")},
- {0x2158, 0, 0, 0, g(Yes, No, false, false, "", "4⁄5")},
- {0x2159, 0, 0, 0, g(Yes, No, false, false, "", "1⁄6")},
- {0x215a, 0, 0, 0, g(Yes, No, false, false, "", "5⁄6")},
- {0x215b, 0, 0, 0, g(Yes, No, false, false, "", "1⁄8")},
- {0x215c, 0, 0, 0, g(Yes, No, false, false, "", "3⁄8")},
- {0x215d, 0, 0, 0, g(Yes, No, false, false, "", "5⁄8")},
- {0x215e, 0, 0, 0, g(Yes, No, false, false, "", "7⁄8")},
- {0x215f, 0, 0, 0, g(Yes, No, false, false, "", "1⁄")},
- {0x2160, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x2161, 0, 0, 0, g(Yes, No, false, false, "", "II")},
- {0x2162, 0, 0, 0, g(Yes, No, false, false, "", "III")},
- {0x2163, 0, 0, 0, g(Yes, No, false, false, "", "IV")},
- {0x2164, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2165, 0, 0, 0, g(Yes, No, false, false, "", "VI")},
- {0x2166, 0, 0, 0, g(Yes, No, false, false, "", "VII")},
- {0x2167, 0, 0, 0, g(Yes, No, false, false, "", "VIII")},
- {0x2168, 0, 0, 0, g(Yes, No, false, false, "", "IX")},
- {0x2169, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x216a, 0, 0, 0, g(Yes, No, false, false, "", "XI")},
- {0x216b, 0, 0, 0, g(Yes, No, false, false, "", "XII")},
- {0x216c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x216d, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x216e, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x216f, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x2170, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x2171, 0, 0, 0, g(Yes, No, false, false, "", "ii")},
- {0x2172, 0, 0, 0, g(Yes, No, false, false, "", "iii")},
- {0x2173, 0, 0, 0, g(Yes, No, false, false, "", "iv")},
- {0x2174, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x2175, 0, 0, 0, g(Yes, No, false, false, "", "vi")},
- {0x2176, 0, 0, 0, g(Yes, No, false, false, "", "vii")},
- {0x2177, 0, 0, 0, g(Yes, No, false, false, "", "viii")},
- {0x2178, 0, 0, 0, g(Yes, No, false, false, "", "ix")},
- {0x2179, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x217a, 0, 0, 0, g(Yes, No, false, false, "", "xi")},
- {0x217b, 0, 0, 0, g(Yes, No, false, false, "", "xii")},
- {0x217c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x217d, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x217e, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x217f, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x2180, 0, 0, 0, f(Yes, false, "")},
- {0x2189, 0, 0, 0, g(Yes, No, false, false, "", "0⁄3")},
- {0x218a, 0, 0, 0, f(Yes, false, "")},
- {0x2190, 0, 0, 0, f(Yes, true, "")},
- {0x2191, 0, 0, 0, f(Yes, false, "")},
- {0x2192, 0, 0, 0, f(Yes, true, "")},
- {0x2193, 0, 0, 0, f(Yes, false, "")},
- {0x2194, 0, 0, 0, f(Yes, true, "")},
- {0x2195, 0, 0, 0, f(Yes, false, "")},
- {0x219a, 0, 0, 1, f(Yes, false, "↚")},
- {0x219b, 0, 0, 1, f(Yes, false, "↛")},
- {0x219c, 0, 0, 0, f(Yes, false, "")},
- {0x21ae, 0, 0, 1, f(Yes, false, "↮")},
- {0x21af, 0, 0, 0, f(Yes, false, "")},
- {0x21cd, 0, 0, 1, f(Yes, false, "⇍")},
- {0x21ce, 0, 0, 1, f(Yes, false, "⇎")},
- {0x21cf, 0, 0, 1, f(Yes, false, "⇏")},
- {0x21d0, 0, 0, 0, f(Yes, true, "")},
- {0x21d1, 0, 0, 0, f(Yes, false, "")},
- {0x21d2, 0, 0, 0, f(Yes, true, "")},
- {0x21d3, 0, 0, 0, f(Yes, false, "")},
- {0x21d4, 0, 0, 0, f(Yes, true, "")},
- {0x21d5, 0, 0, 0, f(Yes, false, "")},
- {0x2203, 0, 0, 0, f(Yes, true, "")},
- {0x2204, 0, 0, 1, f(Yes, false, "∄")},
- {0x2205, 0, 0, 0, f(Yes, false, "")},
- {0x2208, 0, 0, 0, f(Yes, true, "")},
- {0x2209, 0, 0, 1, f(Yes, false, "∉")},
- {0x220a, 0, 0, 0, f(Yes, false, "")},
- {0x220b, 0, 0, 0, f(Yes, true, "")},
- {0x220c, 0, 0, 1, f(Yes, false, "∌")},
- {0x220d, 0, 0, 0, f(Yes, false, "")},
- {0x2223, 0, 0, 0, f(Yes, true, "")},
- {0x2224, 0, 0, 1, f(Yes, false, "∤")},
- {0x2225, 0, 0, 0, f(Yes, true, "")},
- {0x2226, 0, 0, 1, f(Yes, false, "∦")},
- {0x2227, 0, 0, 0, f(Yes, false, "")},
- {0x222c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫")},
- {0x222d, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫")},
- {0x222e, 0, 0, 0, f(Yes, false, "")},
- {0x222f, 0, 0, 0, g(Yes, No, false, false, "", "∮∮")},
- {0x2230, 0, 0, 0, g(Yes, No, false, false, "", "∮∮∮")},
- {0x2231, 0, 0, 0, f(Yes, false, "")},
- {0x223c, 0, 0, 0, f(Yes, true, "")},
- {0x223d, 0, 0, 0, f(Yes, false, "")},
- {0x2241, 0, 0, 1, f(Yes, false, "≁")},
- {0x2242, 0, 0, 0, f(Yes, false, "")},
- {0x2243, 0, 0, 0, f(Yes, true, "")},
- {0x2244, 0, 0, 1, f(Yes, false, "≄")},
- {0x2245, 0, 0, 0, f(Yes, true, "")},
- {0x2246, 0, 0, 0, f(Yes, false, "")},
- {0x2247, 0, 0, 1, f(Yes, false, "≇")},
- {0x2248, 0, 0, 0, f(Yes, true, "")},
- {0x2249, 0, 0, 1, f(Yes, false, "≉")},
- {0x224a, 0, 0, 0, f(Yes, false, "")},
- {0x224d, 0, 0, 0, f(Yes, true, "")},
- {0x224e, 0, 0, 0, f(Yes, false, "")},
- {0x2260, 0, 0, 1, f(Yes, false, "≠")},
- {0x2261, 0, 0, 0, f(Yes, true, "")},
- {0x2262, 0, 0, 1, f(Yes, false, "≢")},
- {0x2263, 0, 0, 0, f(Yes, false, "")},
- {0x2264, 0, 0, 0, f(Yes, true, "")},
- {0x2266, 0, 0, 0, f(Yes, false, "")},
- {0x226d, 0, 0, 1, f(Yes, false, "≭")},
- {0x226e, 0, 0, 1, f(Yes, false, "≮")},
- {0x226f, 0, 0, 1, f(Yes, false, "≯")},
- {0x2270, 0, 0, 1, f(Yes, false, "≰")},
- {0x2271, 0, 0, 1, f(Yes, false, "≱")},
- {0x2272, 0, 0, 0, f(Yes, true, "")},
- {0x2274, 0, 0, 1, f(Yes, false, "≴")},
- {0x2275, 0, 0, 1, f(Yes, false, "≵")},
- {0x2276, 0, 0, 0, f(Yes, true, "")},
- {0x2278, 0, 0, 1, f(Yes, false, "≸")},
- {0x2279, 0, 0, 1, f(Yes, false, "≹")},
- {0x227a, 0, 0, 0, f(Yes, true, "")},
- {0x227e, 0, 0, 0, f(Yes, false, "")},
- {0x2280, 0, 0, 1, f(Yes, false, "⊀")},
- {0x2281, 0, 0, 1, f(Yes, false, "⊁")},
- {0x2282, 0, 0, 0, f(Yes, true, "")},
- {0x2284, 0, 0, 1, f(Yes, false, "⊄")},
- {0x2285, 0, 0, 1, f(Yes, false, "⊅")},
- {0x2286, 0, 0, 0, f(Yes, true, "")},
- {0x2288, 0, 0, 1, f(Yes, false, "⊈")},
- {0x2289, 0, 0, 1, f(Yes, false, "⊉")},
- {0x228a, 0, 0, 0, f(Yes, false, "")},
- {0x2291, 0, 0, 0, f(Yes, true, "")},
- {0x2293, 0, 0, 0, f(Yes, false, "")},
- {0x22a2, 0, 0, 0, f(Yes, true, "")},
- {0x22a3, 0, 0, 0, f(Yes, false, "")},
- {0x22a8, 0, 0, 0, f(Yes, true, "")},
- {0x22aa, 0, 0, 0, f(Yes, false, "")},
- {0x22ab, 0, 0, 0, f(Yes, true, "")},
- {0x22ac, 0, 0, 1, f(Yes, false, "⊬")},
- {0x22ad, 0, 0, 1, f(Yes, false, "⊭")},
- {0x22ae, 0, 0, 1, f(Yes, false, "⊮")},
- {0x22af, 0, 0, 1, f(Yes, false, "⊯")},
- {0x22b0, 0, 0, 0, f(Yes, false, "")},
- {0x22b2, 0, 0, 0, f(Yes, true, "")},
- {0x22b6, 0, 0, 0, f(Yes, false, "")},
- {0x22e0, 0, 0, 1, f(Yes, false, "⋠")},
- {0x22e1, 0, 0, 1, f(Yes, false, "⋡")},
- {0x22e2, 0, 0, 1, f(Yes, false, "⋢")},
- {0x22e3, 0, 0, 1, f(Yes, false, "⋣")},
- {0x22e4, 0, 0, 0, f(Yes, false, "")},
- {0x22ea, 0, 0, 1, f(Yes, false, "⋪")},
- {0x22eb, 0, 0, 1, f(Yes, false, "⋫")},
- {0x22ec, 0, 0, 1, f(Yes, false, "⋬")},
- {0x22ed, 0, 0, 1, f(Yes, false, "⋭")},
- {0x22ee, 0, 0, 0, f(Yes, false, "")},
- {0x2329, 0, 0, 0, f(No, false, "〈")},
- {0x232a, 0, 0, 0, f(No, false, "〉")},
- {0x232b, 0, 0, 0, f(Yes, false, "")},
- {0x2460, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x2461, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x2462, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x2463, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x2464, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x2465, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x2466, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x2467, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x2468, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x2469, 0, 0, 0, g(Yes, No, false, false, "", "10")},
- {0x246a, 0, 0, 0, g(Yes, No, false, false, "", "11")},
- {0x246b, 0, 0, 0, g(Yes, No, false, false, "", "12")},
- {0x246c, 0, 0, 0, g(Yes, No, false, false, "", "13")},
- {0x246d, 0, 0, 0, g(Yes, No, false, false, "", "14")},
- {0x246e, 0, 0, 0, g(Yes, No, false, false, "", "15")},
- {0x246f, 0, 0, 0, g(Yes, No, false, false, "", "16")},
- {0x2470, 0, 0, 0, g(Yes, No, false, false, "", "17")},
- {0x2471, 0, 0, 0, g(Yes, No, false, false, "", "18")},
- {0x2472, 0, 0, 0, g(Yes, No, false, false, "", "19")},
- {0x2473, 0, 0, 0, g(Yes, No, false, false, "", "20")},
- {0x2474, 0, 0, 0, g(Yes, No, false, false, "", "(1)")},
- {0x2475, 0, 0, 0, g(Yes, No, false, false, "", "(2)")},
- {0x2476, 0, 0, 0, g(Yes, No, false, false, "", "(3)")},
- {0x2477, 0, 0, 0, g(Yes, No, false, false, "", "(4)")},
- {0x2478, 0, 0, 0, g(Yes, No, false, false, "", "(5)")},
- {0x2479, 0, 0, 0, g(Yes, No, false, false, "", "(6)")},
- {0x247a, 0, 0, 0, g(Yes, No, false, false, "", "(7)")},
- {0x247b, 0, 0, 0, g(Yes, No, false, false, "", "(8)")},
- {0x247c, 0, 0, 0, g(Yes, No, false, false, "", "(9)")},
- {0x247d, 0, 0, 0, g(Yes, No, false, false, "", "(10)")},
- {0x247e, 0, 0, 0, g(Yes, No, false, false, "", "(11)")},
- {0x247f, 0, 0, 0, g(Yes, No, false, false, "", "(12)")},
- {0x2480, 0, 0, 0, g(Yes, No, false, false, "", "(13)")},
- {0x2481, 0, 0, 0, g(Yes, No, false, false, "", "(14)")},
- {0x2482, 0, 0, 0, g(Yes, No, false, false, "", "(15)")},
- {0x2483, 0, 0, 0, g(Yes, No, false, false, "", "(16)")},
- {0x2484, 0, 0, 0, g(Yes, No, false, false, "", "(17)")},
- {0x2485, 0, 0, 0, g(Yes, No, false, false, "", "(18)")},
- {0x2486, 0, 0, 0, g(Yes, No, false, false, "", "(19)")},
- {0x2487, 0, 0, 0, g(Yes, No, false, false, "", "(20)")},
- {0x2488, 0, 0, 0, g(Yes, No, false, false, "", "1.")},
- {0x2489, 0, 0, 0, g(Yes, No, false, false, "", "2.")},
- {0x248a, 0, 0, 0, g(Yes, No, false, false, "", "3.")},
- {0x248b, 0, 0, 0, g(Yes, No, false, false, "", "4.")},
- {0x248c, 0, 0, 0, g(Yes, No, false, false, "", "5.")},
- {0x248d, 0, 0, 0, g(Yes, No, false, false, "", "6.")},
- {0x248e, 0, 0, 0, g(Yes, No, false, false, "", "7.")},
- {0x248f, 0, 0, 0, g(Yes, No, false, false, "", "8.")},
- {0x2490, 0, 0, 0, g(Yes, No, false, false, "", "9.")},
- {0x2491, 0, 0, 0, g(Yes, No, false, false, "", "10.")},
- {0x2492, 0, 0, 0, g(Yes, No, false, false, "", "11.")},
- {0x2493, 0, 0, 0, g(Yes, No, false, false, "", "12.")},
- {0x2494, 0, 0, 0, g(Yes, No, false, false, "", "13.")},
- {0x2495, 0, 0, 0, g(Yes, No, false, false, "", "14.")},
- {0x2496, 0, 0, 0, g(Yes, No, false, false, "", "15.")},
- {0x2497, 0, 0, 0, g(Yes, No, false, false, "", "16.")},
- {0x2498, 0, 0, 0, g(Yes, No, false, false, "", "17.")},
- {0x2499, 0, 0, 0, g(Yes, No, false, false, "", "18.")},
- {0x249a, 0, 0, 0, g(Yes, No, false, false, "", "19.")},
- {0x249b, 0, 0, 0, g(Yes, No, false, false, "", "20.")},
- {0x249c, 0, 0, 0, g(Yes, No, false, false, "", "(a)")},
- {0x249d, 0, 0, 0, g(Yes, No, false, false, "", "(b)")},
- {0x249e, 0, 0, 0, g(Yes, No, false, false, "", "(c)")},
- {0x249f, 0, 0, 0, g(Yes, No, false, false, "", "(d)")},
- {0x24a0, 0, 0, 0, g(Yes, No, false, false, "", "(e)")},
- {0x24a1, 0, 0, 0, g(Yes, No, false, false, "", "(f)")},
- {0x24a2, 0, 0, 0, g(Yes, No, false, false, "", "(g)")},
- {0x24a3, 0, 0, 0, g(Yes, No, false, false, "", "(h)")},
- {0x24a4, 0, 0, 0, g(Yes, No, false, false, "", "(i)")},
- {0x24a5, 0, 0, 0, g(Yes, No, false, false, "", "(j)")},
- {0x24a6, 0, 0, 0, g(Yes, No, false, false, "", "(k)")},
- {0x24a7, 0, 0, 0, g(Yes, No, false, false, "", "(l)")},
- {0x24a8, 0, 0, 0, g(Yes, No, false, false, "", "(m)")},
- {0x24a9, 0, 0, 0, g(Yes, No, false, false, "", "(n)")},
- {0x24aa, 0, 0, 0, g(Yes, No, false, false, "", "(o)")},
- {0x24ab, 0, 0, 0, g(Yes, No, false, false, "", "(p)")},
- {0x24ac, 0, 0, 0, g(Yes, No, false, false, "", "(q)")},
- {0x24ad, 0, 0, 0, g(Yes, No, false, false, "", "(r)")},
- {0x24ae, 0, 0, 0, g(Yes, No, false, false, "", "(s)")},
- {0x24af, 0, 0, 0, g(Yes, No, false, false, "", "(t)")},
- {0x24b0, 0, 0, 0, g(Yes, No, false, false, "", "(u)")},
- {0x24b1, 0, 0, 0, g(Yes, No, false, false, "", "(v)")},
- {0x24b2, 0, 0, 0, g(Yes, No, false, false, "", "(w)")},
- {0x24b3, 0, 0, 0, g(Yes, No, false, false, "", "(x)")},
- {0x24b4, 0, 0, 0, g(Yes, No, false, false, "", "(y)")},
- {0x24b5, 0, 0, 0, g(Yes, No, false, false, "", "(z)")},
- {0x24b6, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x24b7, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x24b8, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x24b9, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x24ba, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x24bb, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x24bc, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x24bd, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x24be, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x24bf, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x24c0, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x24c1, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x24c2, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x24c3, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x24c4, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x24c5, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x24c6, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x24c7, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x24c8, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x24c9, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x24ca, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x24cb, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x24cc, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x24cd, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x24ce, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x24cf, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x24d0, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x24d1, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x24d2, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x24d3, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x24d4, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x24d5, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x24d6, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x24d7, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x24d8, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x24d9, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x24da, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x24db, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x24dc, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x24dd, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x24de, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x24df, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x24e0, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x24e1, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x24e2, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x24e3, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x24e4, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x24e5, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x24e6, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x24e7, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x24e8, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x24e9, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x24ea, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x24eb, 0, 0, 0, f(Yes, false, "")},
- {0x2a0c, 0, 0, 0, g(Yes, No, false, false, "", "∫∫∫∫")},
- {0x2a0d, 0, 0, 0, f(Yes, false, "")},
- {0x2a74, 0, 0, 0, g(Yes, No, false, false, "", "::=")},
- {0x2a75, 0, 0, 0, g(Yes, No, false, false, "", "==")},
- {0x2a76, 0, 0, 0, g(Yes, No, false, false, "", "===")},
- {0x2a77, 0, 0, 0, f(Yes, false, "")},
- {0x2adc, 0, 0, 1, f(No, false, "⫝̸")},
- {0x2add, 0, 0, 0, f(Yes, false, "")},
- {0x2c7c, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x2c7d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x2c7e, 0, 0, 0, f(Yes, false, "")},
- {0x2cef, 230, 1, 1, f(Yes, false, "")},
- {0x2cf2, 0, 0, 0, f(Yes, false, "")},
- {0x2d6f, 0, 0, 0, g(Yes, No, false, false, "", "ⵡ")},
- {0x2d70, 0, 0, 0, f(Yes, false, "")},
- {0x2d7f, 9, 1, 1, f(Yes, false, "")},
- {0x2d80, 0, 0, 0, f(Yes, false, "")},
- {0x2de0, 230, 1, 1, f(Yes, false, "")},
- {0x2e00, 0, 0, 0, f(Yes, false, "")},
- {0x2e9f, 0, 0, 0, g(Yes, No, false, false, "", "母")},
- {0x2ea0, 0, 0, 0, f(Yes, false, "")},
- {0x2ef3, 0, 0, 0, g(Yes, No, false, false, "", "龟")},
- {0x2ef4, 0, 0, 0, f(Yes, false, "")},
- {0x2f00, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x2f01, 0, 0, 0, g(Yes, No, false, false, "", "丨")},
- {0x2f02, 0, 0, 0, g(Yes, No, false, false, "", "丶")},
- {0x2f03, 0, 0, 0, g(Yes, No, false, false, "", "丿")},
- {0x2f04, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x2f05, 0, 0, 0, g(Yes, No, false, false, "", "亅")},
- {0x2f06, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x2f07, 0, 0, 0, g(Yes, No, false, false, "", "亠")},
- {0x2f08, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x2f09, 0, 0, 0, g(Yes, No, false, false, "", "儿")},
- {0x2f0a, 0, 0, 0, g(Yes, No, false, false, "", "入")},
- {0x2f0b, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x2f0c, 0, 0, 0, g(Yes, No, false, false, "", "冂")},
- {0x2f0d, 0, 0, 0, g(Yes, No, false, false, "", "冖")},
- {0x2f0e, 0, 0, 0, g(Yes, No, false, false, "", "冫")},
- {0x2f0f, 0, 0, 0, g(Yes, No, false, false, "", "几")},
- {0x2f10, 0, 0, 0, g(Yes, No, false, false, "", "凵")},
- {0x2f11, 0, 0, 0, g(Yes, No, false, false, "", "刀")},
- {0x2f12, 0, 0, 0, g(Yes, No, false, false, "", "力")},
- {0x2f13, 0, 0, 0, g(Yes, No, false, false, "", "勹")},
- {0x2f14, 0, 0, 0, g(Yes, No, false, false, "", "匕")},
- {0x2f15, 0, 0, 0, g(Yes, No, false, false, "", "匚")},
- {0x2f16, 0, 0, 0, g(Yes, No, false, false, "", "匸")},
- {0x2f17, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x2f18, 0, 0, 0, g(Yes, No, false, false, "", "卜")},
- {0x2f19, 0, 0, 0, g(Yes, No, false, false, "", "卩")},
- {0x2f1a, 0, 0, 0, g(Yes, No, false, false, "", "厂")},
- {0x2f1b, 0, 0, 0, g(Yes, No, false, false, "", "厶")},
- {0x2f1c, 0, 0, 0, g(Yes, No, false, false, "", "又")},
- {0x2f1d, 0, 0, 0, g(Yes, No, false, false, "", "口")},
- {0x2f1e, 0, 0, 0, g(Yes, No, false, false, "", "囗")},
- {0x2f1f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x2f20, 0, 0, 0, g(Yes, No, false, false, "", "士")},
- {0x2f21, 0, 0, 0, g(Yes, No, false, false, "", "夂")},
- {0x2f22, 0, 0, 0, g(Yes, No, false, false, "", "夊")},
- {0x2f23, 0, 0, 0, g(Yes, No, false, false, "", "夕")},
- {0x2f24, 0, 0, 0, g(Yes, No, false, false, "", "大")},
- {0x2f25, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x2f26, 0, 0, 0, g(Yes, No, false, false, "", "子")},
- {0x2f27, 0, 0, 0, g(Yes, No, false, false, "", "宀")},
- {0x2f28, 0, 0, 0, g(Yes, No, false, false, "", "寸")},
- {0x2f29, 0, 0, 0, g(Yes, No, false, false, "", "小")},
- {0x2f2a, 0, 0, 0, g(Yes, No, false, false, "", "尢")},
- {0x2f2b, 0, 0, 0, g(Yes, No, false, false, "", "尸")},
- {0x2f2c, 0, 0, 0, g(Yes, No, false, false, "", "屮")},
- {0x2f2d, 0, 0, 0, g(Yes, No, false, false, "", "山")},
- {0x2f2e, 0, 0, 0, g(Yes, No, false, false, "", "巛")},
- {0x2f2f, 0, 0, 0, g(Yes, No, false, false, "", "工")},
- {0x2f30, 0, 0, 0, g(Yes, No, false, false, "", "己")},
- {0x2f31, 0, 0, 0, g(Yes, No, false, false, "", "巾")},
- {0x2f32, 0, 0, 0, g(Yes, No, false, false, "", "干")},
- {0x2f33, 0, 0, 0, g(Yes, No, false, false, "", "幺")},
- {0x2f34, 0, 0, 0, g(Yes, No, false, false, "", "广")},
- {0x2f35, 0, 0, 0, g(Yes, No, false, false, "", "廴")},
- {0x2f36, 0, 0, 0, g(Yes, No, false, false, "", "廾")},
- {0x2f37, 0, 0, 0, g(Yes, No, false, false, "", "弋")},
- {0x2f38, 0, 0, 0, g(Yes, No, false, false, "", "弓")},
- {0x2f39, 0, 0, 0, g(Yes, No, false, false, "", "彐")},
- {0x2f3a, 0, 0, 0, g(Yes, No, false, false, "", "彡")},
- {0x2f3b, 0, 0, 0, g(Yes, No, false, false, "", "彳")},
- {0x2f3c, 0, 0, 0, g(Yes, No, false, false, "", "心")},
- {0x2f3d, 0, 0, 0, g(Yes, No, false, false, "", "戈")},
- {0x2f3e, 0, 0, 0, g(Yes, No, false, false, "", "戶")},
- {0x2f3f, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x2f40, 0, 0, 0, g(Yes, No, false, false, "", "支")},
- {0x2f41, 0, 0, 0, g(Yes, No, false, false, "", "攴")},
- {0x2f42, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x2f43, 0, 0, 0, g(Yes, No, false, false, "", "斗")},
- {0x2f44, 0, 0, 0, g(Yes, No, false, false, "", "斤")},
- {0x2f45, 0, 0, 0, g(Yes, No, false, false, "", "方")},
- {0x2f46, 0, 0, 0, g(Yes, No, false, false, "", "无")},
- {0x2f47, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x2f48, 0, 0, 0, g(Yes, No, false, false, "", "曰")},
- {0x2f49, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x2f4a, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x2f4b, 0, 0, 0, g(Yes, No, false, false, "", "欠")},
- {0x2f4c, 0, 0, 0, g(Yes, No, false, false, "", "止")},
- {0x2f4d, 0, 0, 0, g(Yes, No, false, false, "", "歹")},
- {0x2f4e, 0, 0, 0, g(Yes, No, false, false, "", "殳")},
- {0x2f4f, 0, 0, 0, g(Yes, No, false, false, "", "毋")},
- {0x2f50, 0, 0, 0, g(Yes, No, false, false, "", "比")},
- {0x2f51, 0, 0, 0, g(Yes, No, false, false, "", "毛")},
- {0x2f52, 0, 0, 0, g(Yes, No, false, false, "", "氏")},
- {0x2f53, 0, 0, 0, g(Yes, No, false, false, "", "气")},
- {0x2f54, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x2f55, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x2f56, 0, 0, 0, g(Yes, No, false, false, "", "爪")},
- {0x2f57, 0, 0, 0, g(Yes, No, false, false, "", "父")},
- {0x2f58, 0, 0, 0, g(Yes, No, false, false, "", "爻")},
- {0x2f59, 0, 0, 0, g(Yes, No, false, false, "", "爿")},
- {0x2f5a, 0, 0, 0, g(Yes, No, false, false, "", "片")},
- {0x2f5b, 0, 0, 0, g(Yes, No, false, false, "", "牙")},
- {0x2f5c, 0, 0, 0, g(Yes, No, false, false, "", "牛")},
- {0x2f5d, 0, 0, 0, g(Yes, No, false, false, "", "犬")},
- {0x2f5e, 0, 0, 0, g(Yes, No, false, false, "", "玄")},
- {0x2f5f, 0, 0, 0, g(Yes, No, false, false, "", "玉")},
- {0x2f60, 0, 0, 0, g(Yes, No, false, false, "", "瓜")},
- {0x2f61, 0, 0, 0, g(Yes, No, false, false, "", "瓦")},
- {0x2f62, 0, 0, 0, g(Yes, No, false, false, "", "甘")},
- {0x2f63, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x2f64, 0, 0, 0, g(Yes, No, false, false, "", "用")},
- {0x2f65, 0, 0, 0, g(Yes, No, false, false, "", "田")},
- {0x2f66, 0, 0, 0, g(Yes, No, false, false, "", "疋")},
- {0x2f67, 0, 0, 0, g(Yes, No, false, false, "", "疒")},
- {0x2f68, 0, 0, 0, g(Yes, No, false, false, "", "癶")},
- {0x2f69, 0, 0, 0, g(Yes, No, false, false, "", "白")},
- {0x2f6a, 0, 0, 0, g(Yes, No, false, false, "", "皮")},
- {0x2f6b, 0, 0, 0, g(Yes, No, false, false, "", "皿")},
- {0x2f6c, 0, 0, 0, g(Yes, No, false, false, "", "目")},
- {0x2f6d, 0, 0, 0, g(Yes, No, false, false, "", "矛")},
- {0x2f6e, 0, 0, 0, g(Yes, No, false, false, "", "矢")},
- {0x2f6f, 0, 0, 0, g(Yes, No, false, false, "", "石")},
- {0x2f70, 0, 0, 0, g(Yes, No, false, false, "", "示")},
- {0x2f71, 0, 0, 0, g(Yes, No, false, false, "", "禸")},
- {0x2f72, 0, 0, 0, g(Yes, No, false, false, "", "禾")},
- {0x2f73, 0, 0, 0, g(Yes, No, false, false, "", "穴")},
- {0x2f74, 0, 0, 0, g(Yes, No, false, false, "", "立")},
- {0x2f75, 0, 0, 0, g(Yes, No, false, false, "", "竹")},
- {0x2f76, 0, 0, 0, g(Yes, No, false, false, "", "米")},
- {0x2f77, 0, 0, 0, g(Yes, No, false, false, "", "糸")},
- {0x2f78, 0, 0, 0, g(Yes, No, false, false, "", "缶")},
- {0x2f79, 0, 0, 0, g(Yes, No, false, false, "", "网")},
- {0x2f7a, 0, 0, 0, g(Yes, No, false, false, "", "羊")},
- {0x2f7b, 0, 0, 0, g(Yes, No, false, false, "", "羽")},
- {0x2f7c, 0, 0, 0, g(Yes, No, false, false, "", "老")},
- {0x2f7d, 0, 0, 0, g(Yes, No, false, false, "", "而")},
- {0x2f7e, 0, 0, 0, g(Yes, No, false, false, "", "耒")},
- {0x2f7f, 0, 0, 0, g(Yes, No, false, false, "", "耳")},
- {0x2f80, 0, 0, 0, g(Yes, No, false, false, "", "聿")},
- {0x2f81, 0, 0, 0, g(Yes, No, false, false, "", "肉")},
- {0x2f82, 0, 0, 0, g(Yes, No, false, false, "", "臣")},
- {0x2f83, 0, 0, 0, g(Yes, No, false, false, "", "自")},
- {0x2f84, 0, 0, 0, g(Yes, No, false, false, "", "至")},
- {0x2f85, 0, 0, 0, g(Yes, No, false, false, "", "臼")},
- {0x2f86, 0, 0, 0, g(Yes, No, false, false, "", "舌")},
- {0x2f87, 0, 0, 0, g(Yes, No, false, false, "", "舛")},
- {0x2f88, 0, 0, 0, g(Yes, No, false, false, "", "舟")},
- {0x2f89, 0, 0, 0, g(Yes, No, false, false, "", "艮")},
- {0x2f8a, 0, 0, 0, g(Yes, No, false, false, "", "色")},
- {0x2f8b, 0, 0, 0, g(Yes, No, false, false, "", "艸")},
- {0x2f8c, 0, 0, 0, g(Yes, No, false, false, "", "虍")},
- {0x2f8d, 0, 0, 0, g(Yes, No, false, false, "", "虫")},
- {0x2f8e, 0, 0, 0, g(Yes, No, false, false, "", "血")},
- {0x2f8f, 0, 0, 0, g(Yes, No, false, false, "", "行")},
- {0x2f90, 0, 0, 0, g(Yes, No, false, false, "", "衣")},
- {0x2f91, 0, 0, 0, g(Yes, No, false, false, "", "襾")},
- {0x2f92, 0, 0, 0, g(Yes, No, false, false, "", "見")},
- {0x2f93, 0, 0, 0, g(Yes, No, false, false, "", "角")},
- {0x2f94, 0, 0, 0, g(Yes, No, false, false, "", "言")},
- {0x2f95, 0, 0, 0, g(Yes, No, false, false, "", "谷")},
- {0x2f96, 0, 0, 0, g(Yes, No, false, false, "", "豆")},
- {0x2f97, 0, 0, 0, g(Yes, No, false, false, "", "豕")},
- {0x2f98, 0, 0, 0, g(Yes, No, false, false, "", "豸")},
- {0x2f99, 0, 0, 0, g(Yes, No, false, false, "", "貝")},
- {0x2f9a, 0, 0, 0, g(Yes, No, false, false, "", "赤")},
- {0x2f9b, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x2f9c, 0, 0, 0, g(Yes, No, false, false, "", "足")},
- {0x2f9d, 0, 0, 0, g(Yes, No, false, false, "", "身")},
- {0x2f9e, 0, 0, 0, g(Yes, No, false, false, "", "車")},
- {0x2f9f, 0, 0, 0, g(Yes, No, false, false, "", "辛")},
- {0x2fa0, 0, 0, 0, g(Yes, No, false, false, "", "辰")},
- {0x2fa1, 0, 0, 0, g(Yes, No, false, false, "", "辵")},
- {0x2fa2, 0, 0, 0, g(Yes, No, false, false, "", "邑")},
- {0x2fa3, 0, 0, 0, g(Yes, No, false, false, "", "酉")},
- {0x2fa4, 0, 0, 0, g(Yes, No, false, false, "", "釆")},
- {0x2fa5, 0, 0, 0, g(Yes, No, false, false, "", "里")},
- {0x2fa6, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x2fa7, 0, 0, 0, g(Yes, No, false, false, "", "長")},
- {0x2fa8, 0, 0, 0, g(Yes, No, false, false, "", "門")},
- {0x2fa9, 0, 0, 0, g(Yes, No, false, false, "", "阜")},
- {0x2faa, 0, 0, 0, g(Yes, No, false, false, "", "隶")},
- {0x2fab, 0, 0, 0, g(Yes, No, false, false, "", "隹")},
- {0x2fac, 0, 0, 0, g(Yes, No, false, false, "", "雨")},
- {0x2fad, 0, 0, 0, g(Yes, No, false, false, "", "靑")},
- {0x2fae, 0, 0, 0, g(Yes, No, false, false, "", "非")},
- {0x2faf, 0, 0, 0, g(Yes, No, false, false, "", "面")},
- {0x2fb0, 0, 0, 0, g(Yes, No, false, false, "", "革")},
- {0x2fb1, 0, 0, 0, g(Yes, No, false, false, "", "韋")},
- {0x2fb2, 0, 0, 0, g(Yes, No, false, false, "", "韭")},
- {0x2fb3, 0, 0, 0, g(Yes, No, false, false, "", "音")},
- {0x2fb4, 0, 0, 0, g(Yes, No, false, false, "", "頁")},
- {0x2fb5, 0, 0, 0, g(Yes, No, false, false, "", "風")},
- {0x2fb6, 0, 0, 0, g(Yes, No, false, false, "", "飛")},
- {0x2fb7, 0, 0, 0, g(Yes, No, false, false, "", "食")},
- {0x2fb8, 0, 0, 0, g(Yes, No, false, false, "", "首")},
- {0x2fb9, 0, 0, 0, g(Yes, No, false, false, "", "香")},
- {0x2fba, 0, 0, 0, g(Yes, No, false, false, "", "馬")},
- {0x2fbb, 0, 0, 0, g(Yes, No, false, false, "", "骨")},
- {0x2fbc, 0, 0, 0, g(Yes, No, false, false, "", "高")},
- {0x2fbd, 0, 0, 0, g(Yes, No, false, false, "", "髟")},
- {0x2fbe, 0, 0, 0, g(Yes, No, false, false, "", "鬥")},
- {0x2fbf, 0, 0, 0, g(Yes, No, false, false, "", "鬯")},
- {0x2fc0, 0, 0, 0, g(Yes, No, false, false, "", "鬲")},
- {0x2fc1, 0, 0, 0, g(Yes, No, false, false, "", "鬼")},
- {0x2fc2, 0, 0, 0, g(Yes, No, false, false, "", "魚")},
- {0x2fc3, 0, 0, 0, g(Yes, No, false, false, "", "鳥")},
- {0x2fc4, 0, 0, 0, g(Yes, No, false, false, "", "鹵")},
- {0x2fc5, 0, 0, 0, g(Yes, No, false, false, "", "鹿")},
- {0x2fc6, 0, 0, 0, g(Yes, No, false, false, "", "麥")},
- {0x2fc7, 0, 0, 0, g(Yes, No, false, false, "", "麻")},
- {0x2fc8, 0, 0, 0, g(Yes, No, false, false, "", "黃")},
- {0x2fc9, 0, 0, 0, g(Yes, No, false, false, "", "黍")},
- {0x2fca, 0, 0, 0, g(Yes, No, false, false, "", "黑")},
- {0x2fcb, 0, 0, 0, g(Yes, No, false, false, "", "黹")},
- {0x2fcc, 0, 0, 0, g(Yes, No, false, false, "", "黽")},
- {0x2fcd, 0, 0, 0, g(Yes, No, false, false, "", "鼎")},
- {0x2fce, 0, 0, 0, g(Yes, No, false, false, "", "鼓")},
- {0x2fcf, 0, 0, 0, g(Yes, No, false, false, "", "鼠")},
- {0x2fd0, 0, 0, 0, g(Yes, No, false, false, "", "鼻")},
- {0x2fd1, 0, 0, 0, g(Yes, No, false, false, "", "齊")},
- {0x2fd2, 0, 0, 0, g(Yes, No, false, false, "", "齒")},
- {0x2fd3, 0, 0, 0, g(Yes, No, false, false, "", "龍")},
- {0x2fd4, 0, 0, 0, g(Yes, No, false, false, "", "龜")},
- {0x2fd5, 0, 0, 0, g(Yes, No, false, false, "", "龠")},
- {0x2fd6, 0, 0, 0, f(Yes, false, "")},
- {0x3000, 0, 0, 0, g(Yes, No, false, false, "", " ")},
- {0x3001, 0, 0, 0, f(Yes, false, "")},
- {0x302a, 218, 1, 1, f(Yes, false, "")},
- {0x302b, 228, 1, 1, f(Yes, false, "")},
- {0x302c, 232, 1, 1, f(Yes, false, "")},
- {0x302d, 222, 1, 1, f(Yes, false, "")},
- {0x302e, 224, 1, 1, f(Yes, false, "")},
- {0x3030, 0, 0, 0, f(Yes, false, "")},
- {0x3036, 0, 0, 0, g(Yes, No, false, false, "", "〒")},
- {0x3037, 0, 0, 0, f(Yes, false, "")},
- {0x3038, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x3039, 0, 0, 0, g(Yes, No, false, false, "", "卄")},
- {0x303a, 0, 0, 0, g(Yes, No, false, false, "", "卅")},
- {0x303b, 0, 0, 0, f(Yes, false, "")},
- {0x3046, 0, 0, 0, f(Yes, true, "")},
- {0x3047, 0, 0, 0, f(Yes, false, "")},
- {0x304b, 0, 0, 0, f(Yes, true, "")},
- {0x304c, 0, 0, 1, f(Yes, false, "が")},
- {0x304d, 0, 0, 0, f(Yes, true, "")},
- {0x304e, 0, 0, 1, f(Yes, false, "ぎ")},
- {0x304f, 0, 0, 0, f(Yes, true, "")},
- {0x3050, 0, 0, 1, f(Yes, false, "ぐ")},
- {0x3051, 0, 0, 0, f(Yes, true, "")},
- {0x3052, 0, 0, 1, f(Yes, false, "げ")},
- {0x3053, 0, 0, 0, f(Yes, true, "")},
- {0x3054, 0, 0, 1, f(Yes, false, "ご")},
- {0x3055, 0, 0, 0, f(Yes, true, "")},
- {0x3056, 0, 0, 1, f(Yes, false, "ざ")},
- {0x3057, 0, 0, 0, f(Yes, true, "")},
- {0x3058, 0, 0, 1, f(Yes, false, "じ")},
- {0x3059, 0, 0, 0, f(Yes, true, "")},
- {0x305a, 0, 0, 1, f(Yes, false, "ず")},
- {0x305b, 0, 0, 0, f(Yes, true, "")},
- {0x305c, 0, 0, 1, f(Yes, false, "ぜ")},
- {0x305d, 0, 0, 0, f(Yes, true, "")},
- {0x305e, 0, 0, 1, f(Yes, false, "ぞ")},
- {0x305f, 0, 0, 0, f(Yes, true, "")},
- {0x3060, 0, 0, 1, f(Yes, false, "だ")},
- {0x3061, 0, 0, 0, f(Yes, true, "")},
- {0x3062, 0, 0, 1, f(Yes, false, "ぢ")},
- {0x3063, 0, 0, 0, f(Yes, false, "")},
- {0x3064, 0, 0, 0, f(Yes, true, "")},
- {0x3065, 0, 0, 1, f(Yes, false, "づ")},
- {0x3066, 0, 0, 0, f(Yes, true, "")},
- {0x3067, 0, 0, 1, f(Yes, false, "で")},
- {0x3068, 0, 0, 0, f(Yes, true, "")},
- {0x3069, 0, 0, 1, f(Yes, false, "ど")},
- {0x306a, 0, 0, 0, f(Yes, false, "")},
- {0x306f, 0, 0, 0, f(Yes, true, "")},
- {0x3070, 0, 0, 1, f(Yes, false, "ば")},
- {0x3071, 0, 0, 1, f(Yes, false, "ぱ")},
- {0x3072, 0, 0, 0, f(Yes, true, "")},
- {0x3073, 0, 0, 1, f(Yes, false, "び")},
- {0x3074, 0, 0, 1, f(Yes, false, "ぴ")},
- {0x3075, 0, 0, 0, f(Yes, true, "")},
- {0x3076, 0, 0, 1, f(Yes, false, "ぶ")},
- {0x3077, 0, 0, 1, f(Yes, false, "ぷ")},
- {0x3078, 0, 0, 0, f(Yes, true, "")},
- {0x3079, 0, 0, 1, f(Yes, false, "べ")},
- {0x307a, 0, 0, 1, f(Yes, false, "ぺ")},
- {0x307b, 0, 0, 0, f(Yes, true, "")},
- {0x307c, 0, 0, 1, f(Yes, false, "ぼ")},
- {0x307d, 0, 0, 1, f(Yes, false, "ぽ")},
- {0x307e, 0, 0, 0, f(Yes, false, "")},
- {0x3094, 0, 0, 1, f(Yes, false, "ゔ")},
- {0x3095, 0, 0, 0, f(Yes, false, "")},
- {0x3099, 8, 1, 1, f(Maybe, false, "")},
- {0x309b, 0, 0, 1, g(Yes, No, false, false, "", " ゙")},
- {0x309c, 0, 0, 1, g(Yes, No, false, false, "", " ゚")},
- {0x309d, 0, 0, 0, f(Yes, true, "")},
- {0x309e, 0, 0, 1, f(Yes, false, "ゞ")},
- {0x309f, 0, 0, 0, g(Yes, No, false, false, "", "より")},
- {0x30a0, 0, 0, 0, f(Yes, false, "")},
- {0x30a6, 0, 0, 0, f(Yes, true, "")},
- {0x30a7, 0, 0, 0, f(Yes, false, "")},
- {0x30ab, 0, 0, 0, f(Yes, true, "")},
- {0x30ac, 0, 0, 1, f(Yes, false, "ガ")},
- {0x30ad, 0, 0, 0, f(Yes, true, "")},
- {0x30ae, 0, 0, 1, f(Yes, false, "ギ")},
- {0x30af, 0, 0, 0, f(Yes, true, "")},
- {0x30b0, 0, 0, 1, f(Yes, false, "グ")},
- {0x30b1, 0, 0, 0, f(Yes, true, "")},
- {0x30b2, 0, 0, 1, f(Yes, false, "ゲ")},
- {0x30b3, 0, 0, 0, f(Yes, true, "")},
- {0x30b4, 0, 0, 1, f(Yes, false, "ゴ")},
- {0x30b5, 0, 0, 0, f(Yes, true, "")},
- {0x30b6, 0, 0, 1, f(Yes, false, "ザ")},
- {0x30b7, 0, 0, 0, f(Yes, true, "")},
- {0x30b8, 0, 0, 1, f(Yes, false, "ジ")},
- {0x30b9, 0, 0, 0, f(Yes, true, "")},
- {0x30ba, 0, 0, 1, f(Yes, false, "ズ")},
- {0x30bb, 0, 0, 0, f(Yes, true, "")},
- {0x30bc, 0, 0, 1, f(Yes, false, "ゼ")},
- {0x30bd, 0, 0, 0, f(Yes, true, "")},
- {0x30be, 0, 0, 1, f(Yes, false, "ゾ")},
- {0x30bf, 0, 0, 0, f(Yes, true, "")},
- {0x30c0, 0, 0, 1, f(Yes, false, "ダ")},
- {0x30c1, 0, 0, 0, f(Yes, true, "")},
- {0x30c2, 0, 0, 1, f(Yes, false, "ヂ")},
- {0x30c3, 0, 0, 0, f(Yes, false, "")},
- {0x30c4, 0, 0, 0, f(Yes, true, "")},
- {0x30c5, 0, 0, 1, f(Yes, false, "ヅ")},
- {0x30c6, 0, 0, 0, f(Yes, true, "")},
- {0x30c7, 0, 0, 1, f(Yes, false, "デ")},
- {0x30c8, 0, 0, 0, f(Yes, true, "")},
- {0x30c9, 0, 0, 1, f(Yes, false, "ド")},
- {0x30ca, 0, 0, 0, f(Yes, false, "")},
- {0x30cf, 0, 0, 0, f(Yes, true, "")},
- {0x30d0, 0, 0, 1, f(Yes, false, "バ")},
- {0x30d1, 0, 0, 1, f(Yes, false, "パ")},
- {0x30d2, 0, 0, 0, f(Yes, true, "")},
- {0x30d3, 0, 0, 1, f(Yes, false, "ビ")},
- {0x30d4, 0, 0, 1, f(Yes, false, "ピ")},
- {0x30d5, 0, 0, 0, f(Yes, true, "")},
- {0x30d6, 0, 0, 1, f(Yes, false, "ブ")},
- {0x30d7, 0, 0, 1, f(Yes, false, "プ")},
- {0x30d8, 0, 0, 0, f(Yes, true, "")},
- {0x30d9, 0, 0, 1, f(Yes, false, "ベ")},
- {0x30da, 0, 0, 1, f(Yes, false, "ペ")},
- {0x30db, 0, 0, 0, f(Yes, true, "")},
- {0x30dc, 0, 0, 1, f(Yes, false, "ボ")},
- {0x30dd, 0, 0, 1, f(Yes, false, "ポ")},
- {0x30de, 0, 0, 0, f(Yes, false, "")},
- {0x30ef, 0, 0, 0, f(Yes, true, "")},
- {0x30f3, 0, 0, 0, f(Yes, false, "")},
- {0x30f4, 0, 0, 1, f(Yes, false, "ヴ")},
- {0x30f5, 0, 0, 0, f(Yes, false, "")},
- {0x30f7, 0, 0, 1, f(Yes, false, "ヷ")},
- {0x30f8, 0, 0, 1, f(Yes, false, "ヸ")},
- {0x30f9, 0, 0, 1, f(Yes, false, "ヹ")},
- {0x30fa, 0, 0, 1, f(Yes, false, "ヺ")},
- {0x30fb, 0, 0, 0, f(Yes, false, "")},
- {0x30fd, 0, 0, 0, f(Yes, true, "")},
- {0x30fe, 0, 0, 1, f(Yes, false, "ヾ")},
- {0x30ff, 0, 0, 0, g(Yes, No, false, false, "", "コト")},
- {0x3100, 0, 0, 0, f(Yes, false, "")},
- {0x3131, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3132, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0x3133, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0x3134, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3135, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0x3136, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0x3137, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3138, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0x3139, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x313a, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0x313b, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0x313c, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0x313d, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0x313e, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0x313f, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0x3140, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0x3141, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3142, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3143, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0x3144, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0x3145, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3146, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0x3147, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3148, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3149, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0x314a, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x314b, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x314c, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x314d, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x314e, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x314f, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0x3150, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0x3151, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0x3152, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0x3153, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0x3154, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0x3155, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0x3156, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0x3157, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0x3158, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0x3159, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0x315a, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0x315b, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0x315c, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0x315d, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0x315e, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0x315f, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0x3160, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0x3161, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0x3162, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0x3163, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0x3164, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0x3165, 0, 0, 0, g(Yes, No, false, false, "", "ᄔ")},
- {0x3166, 0, 0, 0, g(Yes, No, false, false, "", "ᄕ")},
- {0x3167, 0, 0, 0, g(Yes, No, false, false, "", "ᇇ")},
- {0x3168, 0, 0, 0, g(Yes, No, false, false, "", "ᇈ")},
- {0x3169, 0, 0, 0, g(Yes, No, false, false, "", "ᇌ")},
- {0x316a, 0, 0, 0, g(Yes, No, false, false, "", "ᇎ")},
- {0x316b, 0, 0, 0, g(Yes, No, false, false, "", "ᇓ")},
- {0x316c, 0, 0, 0, g(Yes, No, false, false, "", "ᇗ")},
- {0x316d, 0, 0, 0, g(Yes, No, false, false, "", "ᇙ")},
- {0x316e, 0, 0, 0, g(Yes, No, false, false, "", "ᄜ")},
- {0x316f, 0, 0, 0, g(Yes, No, false, false, "", "ᇝ")},
- {0x3170, 0, 0, 0, g(Yes, No, false, false, "", "ᇟ")},
- {0x3171, 0, 0, 0, g(Yes, No, false, false, "", "ᄝ")},
- {0x3172, 0, 0, 0, g(Yes, No, false, false, "", "ᄞ")},
- {0x3173, 0, 0, 0, g(Yes, No, false, false, "", "ᄠ")},
- {0x3174, 0, 0, 0, g(Yes, No, false, false, "", "ᄢ")},
- {0x3175, 0, 0, 0, g(Yes, No, false, false, "", "ᄣ")},
- {0x3176, 0, 0, 0, g(Yes, No, false, false, "", "ᄧ")},
- {0x3177, 0, 0, 0, g(Yes, No, false, false, "", "ᄩ")},
- {0x3178, 0, 0, 0, g(Yes, No, false, false, "", "ᄫ")},
- {0x3179, 0, 0, 0, g(Yes, No, false, false, "", "ᄬ")},
- {0x317a, 0, 0, 0, g(Yes, No, false, false, "", "ᄭ")},
- {0x317b, 0, 0, 0, g(Yes, No, false, false, "", "ᄮ")},
- {0x317c, 0, 0, 0, g(Yes, No, false, false, "", "ᄯ")},
- {0x317d, 0, 0, 0, g(Yes, No, false, false, "", "ᄲ")},
- {0x317e, 0, 0, 0, g(Yes, No, false, false, "", "ᄶ")},
- {0x317f, 0, 0, 0, g(Yes, No, false, false, "", "ᅀ")},
- {0x3180, 0, 0, 0, g(Yes, No, false, false, "", "ᅇ")},
- {0x3181, 0, 0, 0, g(Yes, No, false, false, "", "ᅌ")},
- {0x3182, 0, 0, 0, g(Yes, No, false, false, "", "ᇱ")},
- {0x3183, 0, 0, 0, g(Yes, No, false, false, "", "ᇲ")},
- {0x3184, 0, 0, 0, g(Yes, No, false, false, "", "ᅗ")},
- {0x3185, 0, 0, 0, g(Yes, No, false, false, "", "ᅘ")},
- {0x3186, 0, 0, 0, g(Yes, No, false, false, "", "ᅙ")},
- {0x3187, 0, 0, 0, g(Yes, No, false, false, "", "ᆄ")},
- {0x3188, 0, 0, 0, g(Yes, No, false, false, "", "ᆅ")},
- {0x3189, 0, 0, 0, g(Yes, No, false, false, "", "ᆈ")},
- {0x318a, 0, 0, 0, g(Yes, No, false, false, "", "ᆑ")},
- {0x318b, 0, 0, 0, g(Yes, No, false, false, "", "ᆒ")},
- {0x318c, 0, 0, 0, g(Yes, No, false, false, "", "ᆔ")},
- {0x318d, 0, 0, 0, g(Yes, No, false, false, "", "ᆞ")},
- {0x318e, 0, 0, 0, g(Yes, No, false, false, "", "ᆡ")},
- {0x318f, 0, 0, 0, f(Yes, false, "")},
- {0x3192, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3193, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3194, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3195, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3196, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x3197, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x3198, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x3199, 0, 0, 0, g(Yes, No, false, false, "", "甲")},
- {0x319a, 0, 0, 0, g(Yes, No, false, false, "", "乙")},
- {0x319b, 0, 0, 0, g(Yes, No, false, false, "", "丙")},
- {0x319c, 0, 0, 0, g(Yes, No, false, false, "", "丁")},
- {0x319d, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x319e, 0, 0, 0, g(Yes, No, false, false, "", "地")},
- {0x319f, 0, 0, 0, g(Yes, No, false, false, "", "人")},
- {0x31a0, 0, 0, 0, f(Yes, false, "")},
- {0x3200, 0, 0, 0, g(Yes, No, false, false, "", "(ᄀ)")},
- {0x3201, 0, 0, 0, g(Yes, No, false, false, "", "(ᄂ)")},
- {0x3202, 0, 0, 0, g(Yes, No, false, false, "", "(ᄃ)")},
- {0x3203, 0, 0, 0, g(Yes, No, false, false, "", "(ᄅ)")},
- {0x3204, 0, 0, 0, g(Yes, No, false, false, "", "(ᄆ)")},
- {0x3205, 0, 0, 0, g(Yes, No, false, false, "", "(ᄇ)")},
- {0x3206, 0, 0, 0, g(Yes, No, false, false, "", "(ᄉ)")},
- {0x3207, 0, 0, 0, g(Yes, No, false, false, "", "(ᄋ)")},
- {0x3208, 0, 0, 0, g(Yes, No, false, false, "", "(ᄌ)")},
- {0x3209, 0, 0, 0, g(Yes, No, false, false, "", "(ᄎ)")},
- {0x320a, 0, 0, 0, g(Yes, No, false, false, "", "(ᄏ)")},
- {0x320b, 0, 0, 0, g(Yes, No, false, false, "", "(ᄐ)")},
- {0x320c, 0, 0, 0, g(Yes, No, false, false, "", "(ᄑ)")},
- {0x320d, 0, 0, 0, g(Yes, No, false, false, "", "(ᄒ)")},
- {0x320e, 0, 0, 0, g(Yes, No, false, false, "", "(가)")},
- {0x320f, 0, 0, 0, g(Yes, No, false, false, "", "(나)")},
- {0x3210, 0, 0, 0, g(Yes, No, false, false, "", "(다)")},
- {0x3211, 0, 0, 0, g(Yes, No, false, false, "", "(라)")},
- {0x3212, 0, 0, 0, g(Yes, No, false, false, "", "(마)")},
- {0x3213, 0, 0, 0, g(Yes, No, false, false, "", "(바)")},
- {0x3214, 0, 0, 0, g(Yes, No, false, false, "", "(사)")},
- {0x3215, 0, 0, 0, g(Yes, No, false, false, "", "(아)")},
- {0x3216, 0, 0, 0, g(Yes, No, false, false, "", "(자)")},
- {0x3217, 0, 0, 0, g(Yes, No, false, false, "", "(차)")},
- {0x3218, 0, 0, 0, g(Yes, No, false, false, "", "(카)")},
- {0x3219, 0, 0, 0, g(Yes, No, false, false, "", "(타)")},
- {0x321a, 0, 0, 0, g(Yes, No, false, false, "", "(파)")},
- {0x321b, 0, 0, 0, g(Yes, No, false, false, "", "(하)")},
- {0x321c, 0, 0, 0, g(Yes, No, false, false, "", "(주)")},
- {0x321d, 0, 0, 0, g(Yes, No, false, false, "", "(오전)")},
- {0x321e, 0, 0, 0, g(Yes, No, false, false, "", "(오후)")},
- {0x321f, 0, 0, 0, f(Yes, false, "")},
- {0x3220, 0, 0, 0, g(Yes, No, false, false, "", "(一)")},
- {0x3221, 0, 0, 0, g(Yes, No, false, false, "", "(二)")},
- {0x3222, 0, 0, 0, g(Yes, No, false, false, "", "(三)")},
- {0x3223, 0, 0, 0, g(Yes, No, false, false, "", "(四)")},
- {0x3224, 0, 0, 0, g(Yes, No, false, false, "", "(五)")},
- {0x3225, 0, 0, 0, g(Yes, No, false, false, "", "(六)")},
- {0x3226, 0, 0, 0, g(Yes, No, false, false, "", "(七)")},
- {0x3227, 0, 0, 0, g(Yes, No, false, false, "", "(八)")},
- {0x3228, 0, 0, 0, g(Yes, No, false, false, "", "(九)")},
- {0x3229, 0, 0, 0, g(Yes, No, false, false, "", "(十)")},
- {0x322a, 0, 0, 0, g(Yes, No, false, false, "", "(月)")},
- {0x322b, 0, 0, 0, g(Yes, No, false, false, "", "(火)")},
- {0x322c, 0, 0, 0, g(Yes, No, false, false, "", "(水)")},
- {0x322d, 0, 0, 0, g(Yes, No, false, false, "", "(木)")},
- {0x322e, 0, 0, 0, g(Yes, No, false, false, "", "(金)")},
- {0x322f, 0, 0, 0, g(Yes, No, false, false, "", "(土)")},
- {0x3230, 0, 0, 0, g(Yes, No, false, false, "", "(日)")},
- {0x3231, 0, 0, 0, g(Yes, No, false, false, "", "(株)")},
- {0x3232, 0, 0, 0, g(Yes, No, false, false, "", "(有)")},
- {0x3233, 0, 0, 0, g(Yes, No, false, false, "", "(社)")},
- {0x3234, 0, 0, 0, g(Yes, No, false, false, "", "(名)")},
- {0x3235, 0, 0, 0, g(Yes, No, false, false, "", "(特)")},
- {0x3236, 0, 0, 0, g(Yes, No, false, false, "", "(財)")},
- {0x3237, 0, 0, 0, g(Yes, No, false, false, "", "(祝)")},
- {0x3238, 0, 0, 0, g(Yes, No, false, false, "", "(労)")},
- {0x3239, 0, 0, 0, g(Yes, No, false, false, "", "(代)")},
- {0x323a, 0, 0, 0, g(Yes, No, false, false, "", "(呼)")},
- {0x323b, 0, 0, 0, g(Yes, No, false, false, "", "(学)")},
- {0x323c, 0, 0, 0, g(Yes, No, false, false, "", "(監)")},
- {0x323d, 0, 0, 0, g(Yes, No, false, false, "", "(企)")},
- {0x323e, 0, 0, 0, g(Yes, No, false, false, "", "(資)")},
- {0x323f, 0, 0, 0, g(Yes, No, false, false, "", "(協)")},
- {0x3240, 0, 0, 0, g(Yes, No, false, false, "", "(祭)")},
- {0x3241, 0, 0, 0, g(Yes, No, false, false, "", "(休)")},
- {0x3242, 0, 0, 0, g(Yes, No, false, false, "", "(自)")},
- {0x3243, 0, 0, 0, g(Yes, No, false, false, "", "(至)")},
- {0x3244, 0, 0, 0, g(Yes, No, false, false, "", "問")},
- {0x3245, 0, 0, 0, g(Yes, No, false, false, "", "幼")},
- {0x3246, 0, 0, 0, g(Yes, No, false, false, "", "文")},
- {0x3247, 0, 0, 0, g(Yes, No, false, false, "", "箏")},
- {0x3248, 0, 0, 0, f(Yes, false, "")},
- {0x3250, 0, 0, 0, g(Yes, No, false, false, "", "PTE")},
- {0x3251, 0, 0, 0, g(Yes, No, false, false, "", "21")},
- {0x3252, 0, 0, 0, g(Yes, No, false, false, "", "22")},
- {0x3253, 0, 0, 0, g(Yes, No, false, false, "", "23")},
- {0x3254, 0, 0, 0, g(Yes, No, false, false, "", "24")},
- {0x3255, 0, 0, 0, g(Yes, No, false, false, "", "25")},
- {0x3256, 0, 0, 0, g(Yes, No, false, false, "", "26")},
- {0x3257, 0, 0, 0, g(Yes, No, false, false, "", "27")},
- {0x3258, 0, 0, 0, g(Yes, No, false, false, "", "28")},
- {0x3259, 0, 0, 0, g(Yes, No, false, false, "", "29")},
- {0x325a, 0, 0, 0, g(Yes, No, false, false, "", "30")},
- {0x325b, 0, 0, 0, g(Yes, No, false, false, "", "31")},
- {0x325c, 0, 0, 0, g(Yes, No, false, false, "", "32")},
- {0x325d, 0, 0, 0, g(Yes, No, false, false, "", "33")},
- {0x325e, 0, 0, 0, g(Yes, No, false, false, "", "34")},
- {0x325f, 0, 0, 0, g(Yes, No, false, false, "", "35")},
- {0x3260, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0x3261, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0x3262, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0x3263, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0x3264, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0x3265, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0x3266, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0x3267, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0x3268, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0x3269, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0x326a, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0x326b, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0x326c, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0x326d, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0x326e, 0, 0, 1, g(Yes, No, false, false, "", "가")},
- {0x326f, 0, 0, 1, g(Yes, No, false, false, "", "나")},
- {0x3270, 0, 0, 1, g(Yes, No, false, false, "", "다")},
- {0x3271, 0, 0, 1, g(Yes, No, false, false, "", "라")},
- {0x3272, 0, 0, 1, g(Yes, No, false, false, "", "마")},
- {0x3273, 0, 0, 1, g(Yes, No, false, false, "", "바")},
- {0x3274, 0, 0, 1, g(Yes, No, false, false, "", "사")},
- {0x3275, 0, 0, 1, g(Yes, No, false, false, "", "아")},
- {0x3276, 0, 0, 1, g(Yes, No, false, false, "", "자")},
- {0x3277, 0, 0, 1, g(Yes, No, false, false, "", "차")},
- {0x3278, 0, 0, 1, g(Yes, No, false, false, "", "카")},
- {0x3279, 0, 0, 1, g(Yes, No, false, false, "", "타")},
- {0x327a, 0, 0, 1, g(Yes, No, false, false, "", "파")},
- {0x327b, 0, 0, 1, g(Yes, No, false, false, "", "하")},
- {0x327c, 0, 0, 1, g(Yes, No, false, false, "", "참고")},
- {0x327d, 0, 0, 1, g(Yes, No, false, false, "", "주의")},
- {0x327e, 0, 0, 1, g(Yes, No, false, false, "", "우")},
- {0x327f, 0, 0, 0, f(Yes, false, "")},
- {0x3280, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x3281, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x3282, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x3283, 0, 0, 0, g(Yes, No, false, false, "", "四")},
- {0x3284, 0, 0, 0, g(Yes, No, false, false, "", "五")},
- {0x3285, 0, 0, 0, g(Yes, No, false, false, "", "六")},
- {0x3286, 0, 0, 0, g(Yes, No, false, false, "", "七")},
- {0x3287, 0, 0, 0, g(Yes, No, false, false, "", "八")},
- {0x3288, 0, 0, 0, g(Yes, No, false, false, "", "九")},
- {0x3289, 0, 0, 0, g(Yes, No, false, false, "", "十")},
- {0x328a, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x328b, 0, 0, 0, g(Yes, No, false, false, "", "火")},
- {0x328c, 0, 0, 0, g(Yes, No, false, false, "", "水")},
- {0x328d, 0, 0, 0, g(Yes, No, false, false, "", "木")},
- {0x328e, 0, 0, 0, g(Yes, No, false, false, "", "金")},
- {0x328f, 0, 0, 0, g(Yes, No, false, false, "", "土")},
- {0x3290, 0, 0, 0, g(Yes, No, false, false, "", "日")},
- {0x3291, 0, 0, 0, g(Yes, No, false, false, "", "株")},
- {0x3292, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x3293, 0, 0, 0, g(Yes, No, false, false, "", "社")},
- {0x3294, 0, 0, 0, g(Yes, No, false, false, "", "名")},
- {0x3295, 0, 0, 0, g(Yes, No, false, false, "", "特")},
- {0x3296, 0, 0, 0, g(Yes, No, false, false, "", "財")},
- {0x3297, 0, 0, 0, g(Yes, No, false, false, "", "祝")},
- {0x3298, 0, 0, 0, g(Yes, No, false, false, "", "労")},
- {0x3299, 0, 0, 0, g(Yes, No, false, false, "", "秘")},
- {0x329a, 0, 0, 0, g(Yes, No, false, false, "", "男")},
- {0x329b, 0, 0, 0, g(Yes, No, false, false, "", "女")},
- {0x329c, 0, 0, 0, g(Yes, No, false, false, "", "適")},
- {0x329d, 0, 0, 0, g(Yes, No, false, false, "", "優")},
- {0x329e, 0, 0, 0, g(Yes, No, false, false, "", "印")},
- {0x329f, 0, 0, 0, g(Yes, No, false, false, "", "注")},
- {0x32a0, 0, 0, 0, g(Yes, No, false, false, "", "項")},
- {0x32a1, 0, 0, 0, g(Yes, No, false, false, "", "休")},
- {0x32a2, 0, 0, 0, g(Yes, No, false, false, "", "写")},
- {0x32a3, 0, 0, 0, g(Yes, No, false, false, "", "正")},
- {0x32a4, 0, 0, 0, g(Yes, No, false, false, "", "上")},
- {0x32a5, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x32a6, 0, 0, 0, g(Yes, No, false, false, "", "下")},
- {0x32a7, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x32a8, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x32a9, 0, 0, 0, g(Yes, No, false, false, "", "医")},
- {0x32aa, 0, 0, 0, g(Yes, No, false, false, "", "宗")},
- {0x32ab, 0, 0, 0, g(Yes, No, false, false, "", "学")},
- {0x32ac, 0, 0, 0, g(Yes, No, false, false, "", "監")},
- {0x32ad, 0, 0, 0, g(Yes, No, false, false, "", "企")},
- {0x32ae, 0, 0, 0, g(Yes, No, false, false, "", "資")},
- {0x32af, 0, 0, 0, g(Yes, No, false, false, "", "協")},
- {0x32b0, 0, 0, 0, g(Yes, No, false, false, "", "夜")},
- {0x32b1, 0, 0, 0, g(Yes, No, false, false, "", "36")},
- {0x32b2, 0, 0, 0, g(Yes, No, false, false, "", "37")},
- {0x32b3, 0, 0, 0, g(Yes, No, false, false, "", "38")},
- {0x32b4, 0, 0, 0, g(Yes, No, false, false, "", "39")},
- {0x32b5, 0, 0, 0, g(Yes, No, false, false, "", "40")},
- {0x32b6, 0, 0, 0, g(Yes, No, false, false, "", "41")},
- {0x32b7, 0, 0, 0, g(Yes, No, false, false, "", "42")},
- {0x32b8, 0, 0, 0, g(Yes, No, false, false, "", "43")},
- {0x32b9, 0, 0, 0, g(Yes, No, false, false, "", "44")},
- {0x32ba, 0, 0, 0, g(Yes, No, false, false, "", "45")},
- {0x32bb, 0, 0, 0, g(Yes, No, false, false, "", "46")},
- {0x32bc, 0, 0, 0, g(Yes, No, false, false, "", "47")},
- {0x32bd, 0, 0, 0, g(Yes, No, false, false, "", "48")},
- {0x32be, 0, 0, 0, g(Yes, No, false, false, "", "49")},
- {0x32bf, 0, 0, 0, g(Yes, No, false, false, "", "50")},
- {0x32c0, 0, 0, 0, g(Yes, No, false, false, "", "1月")},
- {0x32c1, 0, 0, 0, g(Yes, No, false, false, "", "2月")},
- {0x32c2, 0, 0, 0, g(Yes, No, false, false, "", "3月")},
- {0x32c3, 0, 0, 0, g(Yes, No, false, false, "", "4月")},
- {0x32c4, 0, 0, 0, g(Yes, No, false, false, "", "5月")},
- {0x32c5, 0, 0, 0, g(Yes, No, false, false, "", "6月")},
- {0x32c6, 0, 0, 0, g(Yes, No, false, false, "", "7月")},
- {0x32c7, 0, 0, 0, g(Yes, No, false, false, "", "8月")},
- {0x32c8, 0, 0, 0, g(Yes, No, false, false, "", "9月")},
- {0x32c9, 0, 0, 0, g(Yes, No, false, false, "", "10月")},
- {0x32ca, 0, 0, 0, g(Yes, No, false, false, "", "11月")},
- {0x32cb, 0, 0, 0, g(Yes, No, false, false, "", "12月")},
- {0x32cc, 0, 0, 0, g(Yes, No, false, false, "", "Hg")},
- {0x32cd, 0, 0, 0, g(Yes, No, false, false, "", "erg")},
- {0x32ce, 0, 0, 0, g(Yes, No, false, false, "", "eV")},
- {0x32cf, 0, 0, 0, g(Yes, No, false, false, "", "LTD")},
- {0x32d0, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0x32d1, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0x32d2, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0x32d3, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0x32d4, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0x32d5, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0x32d6, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0x32d7, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0x32d8, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0x32d9, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0x32da, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x32db, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0x32dc, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0x32dd, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0x32de, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0x32df, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0x32e0, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0x32e1, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0x32e2, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0x32e3, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0x32e4, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0x32e5, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0x32e6, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0x32e7, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0x32e8, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0x32e9, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0x32ea, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0x32eb, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0x32ec, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0x32ed, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0x32ee, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0x32ef, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0x32f0, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0x32f1, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0x32f2, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0x32f3, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0x32f4, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0x32f5, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0x32f6, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0x32f7, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0x32f8, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0x32f9, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0x32fa, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0x32fb, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0x32fc, 0, 0, 0, g(Yes, No, false, false, "", "ヰ")},
- {0x32fd, 0, 0, 0, g(Yes, No, false, false, "", "ヱ")},
- {0x32fe, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0x32ff, 0, 0, 0, f(Yes, false, "")},
- {0x3300, 0, 0, 0, g(Yes, No, false, false, "", "アパート")},
- {0x3301, 0, 0, 0, g(Yes, No, false, false, "", "アルファ")},
- {0x3302, 0, 0, 0, g(Yes, No, false, false, "", "アンペア")},
- {0x3303, 0, 0, 0, g(Yes, No, false, false, "", "アール")},
- {0x3304, 0, 0, 1, g(Yes, No, false, false, "", "イニング")},
- {0x3305, 0, 0, 0, g(Yes, No, false, false, "", "インチ")},
- {0x3306, 0, 0, 0, g(Yes, No, false, false, "", "ウォン")},
- {0x3307, 0, 0, 1, g(Yes, No, false, false, "", "エスクード")},
- {0x3308, 0, 0, 0, g(Yes, No, false, false, "", "エーカー")},
- {0x3309, 0, 0, 0, g(Yes, No, false, false, "", "オンス")},
- {0x330a, 0, 0, 0, g(Yes, No, false, false, "", "オーム")},
- {0x330b, 0, 0, 0, g(Yes, No, false, false, "", "カイリ")},
- {0x330c, 0, 0, 0, g(Yes, No, false, false, "", "カラット")},
- {0x330d, 0, 0, 0, g(Yes, No, false, false, "", "カロリー")},
- {0x330e, 0, 0, 0, g(Yes, No, false, false, "", "ガロン")},
- {0x330f, 0, 0, 0, g(Yes, No, false, false, "", "ガンマ")},
- {0x3310, 0, 0, 1, g(Yes, No, false, false, "", "ギガ")},
- {0x3311, 0, 0, 0, g(Yes, No, false, false, "", "ギニー")},
- {0x3312, 0, 0, 0, g(Yes, No, false, false, "", "キュリー")},
- {0x3313, 0, 0, 0, g(Yes, No, false, false, "", "ギルダー")},
- {0x3314, 0, 0, 0, g(Yes, No, false, false, "", "キロ")},
- {0x3315, 0, 0, 0, g(Yes, No, false, false, "", "キログラム")},
- {0x3316, 0, 0, 0, g(Yes, No, false, false, "", "キロメートル")},
- {0x3317, 0, 0, 0, g(Yes, No, false, false, "", "キロワット")},
- {0x3318, 0, 0, 0, g(Yes, No, false, false, "", "グラム")},
- {0x3319, 0, 0, 0, g(Yes, No, false, false, "", "グラムトン")},
- {0x331a, 0, 0, 0, g(Yes, No, false, false, "", "クルゼイロ")},
- {0x331b, 0, 0, 0, g(Yes, No, false, false, "", "クローネ")},
- {0x331c, 0, 0, 0, g(Yes, No, false, false, "", "ケース")},
- {0x331d, 0, 0, 0, g(Yes, No, false, false, "", "コルナ")},
- {0x331e, 0, 0, 1, g(Yes, No, false, false, "", "コーポ")},
- {0x331f, 0, 0, 0, g(Yes, No, false, false, "", "サイクル")},
- {0x3320, 0, 0, 0, g(Yes, No, false, false, "", "サンチーム")},
- {0x3321, 0, 0, 1, g(Yes, No, false, false, "", "シリング")},
- {0x3322, 0, 0, 0, g(Yes, No, false, false, "", "センチ")},
- {0x3323, 0, 0, 0, g(Yes, No, false, false, "", "セント")},
- {0x3324, 0, 0, 0, g(Yes, No, false, false, "", "ダース")},
- {0x3325, 0, 0, 0, g(Yes, No, false, false, "", "デシ")},
- {0x3326, 0, 0, 0, g(Yes, No, false, false, "", "ドル")},
- {0x3327, 0, 0, 0, g(Yes, No, false, false, "", "トン")},
- {0x3328, 0, 0, 0, g(Yes, No, false, false, "", "ナノ")},
- {0x3329, 0, 0, 0, g(Yes, No, false, false, "", "ノット")},
- {0x332a, 0, 0, 0, g(Yes, No, false, false, "", "ハイツ")},
- {0x332b, 0, 0, 0, g(Yes, No, false, false, "", "パーセント")},
- {0x332c, 0, 0, 0, g(Yes, No, false, false, "", "パーツ")},
- {0x332d, 0, 0, 0, g(Yes, No, false, false, "", "バーレル")},
- {0x332e, 0, 0, 0, g(Yes, No, false, false, "", "ピアストル")},
- {0x332f, 0, 0, 0, g(Yes, No, false, false, "", "ピクル")},
- {0x3330, 0, 0, 0, g(Yes, No, false, false, "", "ピコ")},
- {0x3331, 0, 0, 0, g(Yes, No, false, false, "", "ビル")},
- {0x3332, 0, 0, 1, g(Yes, No, false, false, "", "ファラッド")},
- {0x3333, 0, 0, 0, g(Yes, No, false, false, "", "フィート")},
- {0x3334, 0, 0, 0, g(Yes, No, false, false, "", "ブッシェル")},
- {0x3335, 0, 0, 0, g(Yes, No, false, false, "", "フラン")},
- {0x3336, 0, 0, 0, g(Yes, No, false, false, "", "ヘクタール")},
- {0x3337, 0, 0, 0, g(Yes, No, false, false, "", "ペソ")},
- {0x3338, 0, 0, 0, g(Yes, No, false, false, "", "ペニヒ")},
- {0x3339, 0, 0, 0, g(Yes, No, false, false, "", "ヘルツ")},
- {0x333a, 0, 0, 0, g(Yes, No, false, false, "", "ペンス")},
- {0x333b, 0, 0, 1, g(Yes, No, false, false, "", "ページ")},
- {0x333c, 0, 0, 0, g(Yes, No, false, false, "", "ベータ")},
- {0x333d, 0, 0, 0, g(Yes, No, false, false, "", "ポイント")},
- {0x333e, 0, 0, 0, g(Yes, No, false, false, "", "ボルト")},
- {0x333f, 0, 0, 0, g(Yes, No, false, false, "", "ホン")},
- {0x3340, 0, 0, 1, g(Yes, No, false, false, "", "ポンド")},
- {0x3341, 0, 0, 0, g(Yes, No, false, false, "", "ホール")},
- {0x3342, 0, 0, 0, g(Yes, No, false, false, "", "ホーン")},
- {0x3343, 0, 0, 0, g(Yes, No, false, false, "", "マイクロ")},
- {0x3344, 0, 0, 0, g(Yes, No, false, false, "", "マイル")},
- {0x3345, 0, 0, 0, g(Yes, No, false, false, "", "マッハ")},
- {0x3346, 0, 0, 0, g(Yes, No, false, false, "", "マルク")},
- {0x3347, 0, 0, 0, g(Yes, No, false, false, "", "マンション")},
- {0x3348, 0, 0, 0, g(Yes, No, false, false, "", "ミクロン")},
- {0x3349, 0, 0, 0, g(Yes, No, false, false, "", "ミリ")},
- {0x334a, 0, 0, 0, g(Yes, No, false, false, "", "ミリバール")},
- {0x334b, 0, 0, 1, g(Yes, No, false, false, "", "メガ")},
- {0x334c, 0, 0, 0, g(Yes, No, false, false, "", "メガトン")},
- {0x334d, 0, 0, 0, g(Yes, No, false, false, "", "メートル")},
- {0x334e, 0, 0, 1, g(Yes, No, false, false, "", "ヤード")},
- {0x334f, 0, 0, 0, g(Yes, No, false, false, "", "ヤール")},
- {0x3350, 0, 0, 0, g(Yes, No, false, false, "", "ユアン")},
- {0x3351, 0, 0, 0, g(Yes, No, false, false, "", "リットル")},
- {0x3352, 0, 0, 0, g(Yes, No, false, false, "", "リラ")},
- {0x3353, 0, 0, 0, g(Yes, No, false, false, "", "ルピー")},
- {0x3354, 0, 0, 0, g(Yes, No, false, false, "", "ルーブル")},
- {0x3355, 0, 0, 0, g(Yes, No, false, false, "", "レム")},
- {0x3356, 0, 0, 0, g(Yes, No, false, false, "", "レントゲン")},
- {0x3357, 0, 0, 0, g(Yes, No, false, false, "", "ワット")},
- {0x3358, 0, 0, 0, g(Yes, No, false, false, "", "0点")},
- {0x3359, 0, 0, 0, g(Yes, No, false, false, "", "1点")},
- {0x335a, 0, 0, 0, g(Yes, No, false, false, "", "2点")},
- {0x335b, 0, 0, 0, g(Yes, No, false, false, "", "3点")},
- {0x335c, 0, 0, 0, g(Yes, No, false, false, "", "4点")},
- {0x335d, 0, 0, 0, g(Yes, No, false, false, "", "5点")},
- {0x335e, 0, 0, 0, g(Yes, No, false, false, "", "6点")},
- {0x335f, 0, 0, 0, g(Yes, No, false, false, "", "7点")},
- {0x3360, 0, 0, 0, g(Yes, No, false, false, "", "8点")},
- {0x3361, 0, 0, 0, g(Yes, No, false, false, "", "9点")},
- {0x3362, 0, 0, 0, g(Yes, No, false, false, "", "10点")},
- {0x3363, 0, 0, 0, g(Yes, No, false, false, "", "11点")},
- {0x3364, 0, 0, 0, g(Yes, No, false, false, "", "12点")},
- {0x3365, 0, 0, 0, g(Yes, No, false, false, "", "13点")},
- {0x3366, 0, 0, 0, g(Yes, No, false, false, "", "14点")},
- {0x3367, 0, 0, 0, g(Yes, No, false, false, "", "15点")},
- {0x3368, 0, 0, 0, g(Yes, No, false, false, "", "16点")},
- {0x3369, 0, 0, 0, g(Yes, No, false, false, "", "17点")},
- {0x336a, 0, 0, 0, g(Yes, No, false, false, "", "18点")},
- {0x336b, 0, 0, 0, g(Yes, No, false, false, "", "19点")},
- {0x336c, 0, 0, 0, g(Yes, No, false, false, "", "20点")},
- {0x336d, 0, 0, 0, g(Yes, No, false, false, "", "21点")},
- {0x336e, 0, 0, 0, g(Yes, No, false, false, "", "22点")},
- {0x336f, 0, 0, 0, g(Yes, No, false, false, "", "23点")},
- {0x3370, 0, 0, 0, g(Yes, No, false, false, "", "24点")},
- {0x3371, 0, 0, 0, g(Yes, No, false, false, "", "hPa")},
- {0x3372, 0, 0, 0, g(Yes, No, false, false, "", "da")},
- {0x3373, 0, 0, 0, g(Yes, No, false, false, "", "AU")},
- {0x3374, 0, 0, 0, g(Yes, No, false, false, "", "bar")},
- {0x3375, 0, 0, 0, g(Yes, No, false, false, "", "oV")},
- {0x3376, 0, 0, 0, g(Yes, No, false, false, "", "pc")},
- {0x3377, 0, 0, 0, g(Yes, No, false, false, "", "dm")},
- {0x3378, 0, 0, 0, g(Yes, No, false, false, "", "dm2")},
- {0x3379, 0, 0, 0, g(Yes, No, false, false, "", "dm3")},
- {0x337a, 0, 0, 0, g(Yes, No, false, false, "", "IU")},
- {0x337b, 0, 0, 0, g(Yes, No, false, false, "", "平成")},
- {0x337c, 0, 0, 0, g(Yes, No, false, false, "", "昭和")},
- {0x337d, 0, 0, 0, g(Yes, No, false, false, "", "大正")},
- {0x337e, 0, 0, 0, g(Yes, No, false, false, "", "明治")},
- {0x337f, 0, 0, 0, g(Yes, No, false, false, "", "株式会社")},
- {0x3380, 0, 0, 0, g(Yes, No, false, false, "", "pA")},
- {0x3381, 0, 0, 0, g(Yes, No, false, false, "", "nA")},
- {0x3382, 0, 0, 0, g(Yes, No, false, false, "", "μA")},
- {0x3383, 0, 0, 0, g(Yes, No, false, false, "", "mA")},
- {0x3384, 0, 0, 0, g(Yes, No, false, false, "", "kA")},
- {0x3385, 0, 0, 0, g(Yes, No, false, false, "", "KB")},
- {0x3386, 0, 0, 0, g(Yes, No, false, false, "", "MB")},
- {0x3387, 0, 0, 0, g(Yes, No, false, false, "", "GB")},
- {0x3388, 0, 0, 0, g(Yes, No, false, false, "", "cal")},
- {0x3389, 0, 0, 0, g(Yes, No, false, false, "", "kcal")},
- {0x338a, 0, 0, 0, g(Yes, No, false, false, "", "pF")},
- {0x338b, 0, 0, 0, g(Yes, No, false, false, "", "nF")},
- {0x338c, 0, 0, 0, g(Yes, No, false, false, "", "μF")},
- {0x338d, 0, 0, 0, g(Yes, No, false, false, "", "μg")},
- {0x338e, 0, 0, 0, g(Yes, No, false, false, "", "mg")},
- {0x338f, 0, 0, 0, g(Yes, No, false, false, "", "kg")},
- {0x3390, 0, 0, 0, g(Yes, No, false, false, "", "Hz")},
- {0x3391, 0, 0, 0, g(Yes, No, false, false, "", "kHz")},
- {0x3392, 0, 0, 0, g(Yes, No, false, false, "", "MHz")},
- {0x3393, 0, 0, 0, g(Yes, No, false, false, "", "GHz")},
- {0x3394, 0, 0, 0, g(Yes, No, false, false, "", "THz")},
- {0x3395, 0, 0, 0, g(Yes, No, false, false, "", "μl")},
- {0x3396, 0, 0, 0, g(Yes, No, false, false, "", "ml")},
- {0x3397, 0, 0, 0, g(Yes, No, false, false, "", "dl")},
- {0x3398, 0, 0, 0, g(Yes, No, false, false, "", "kl")},
- {0x3399, 0, 0, 0, g(Yes, No, false, false, "", "fm")},
- {0x339a, 0, 0, 0, g(Yes, No, false, false, "", "nm")},
- {0x339b, 0, 0, 0, g(Yes, No, false, false, "", "μm")},
- {0x339c, 0, 0, 0, g(Yes, No, false, false, "", "mm")},
- {0x339d, 0, 0, 0, g(Yes, No, false, false, "", "cm")},
- {0x339e, 0, 0, 0, g(Yes, No, false, false, "", "km")},
- {0x339f, 0, 0, 0, g(Yes, No, false, false, "", "mm2")},
- {0x33a0, 0, 0, 0, g(Yes, No, false, false, "", "cm2")},
- {0x33a1, 0, 0, 0, g(Yes, No, false, false, "", "m2")},
- {0x33a2, 0, 0, 0, g(Yes, No, false, false, "", "km2")},
- {0x33a3, 0, 0, 0, g(Yes, No, false, false, "", "mm3")},
- {0x33a4, 0, 0, 0, g(Yes, No, false, false, "", "cm3")},
- {0x33a5, 0, 0, 0, g(Yes, No, false, false, "", "m3")},
- {0x33a6, 0, 0, 0, g(Yes, No, false, false, "", "km3")},
- {0x33a7, 0, 0, 0, g(Yes, No, false, false, "", "m∕s")},
- {0x33a8, 0, 0, 0, g(Yes, No, false, false, "", "m∕s2")},
- {0x33a9, 0, 0, 0, g(Yes, No, false, false, "", "Pa")},
- {0x33aa, 0, 0, 0, g(Yes, No, false, false, "", "kPa")},
- {0x33ab, 0, 0, 0, g(Yes, No, false, false, "", "MPa")},
- {0x33ac, 0, 0, 0, g(Yes, No, false, false, "", "GPa")},
- {0x33ad, 0, 0, 0, g(Yes, No, false, false, "", "rad")},
- {0x33ae, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s")},
- {0x33af, 0, 0, 0, g(Yes, No, false, false, "", "rad∕s2")},
- {0x33b0, 0, 0, 0, g(Yes, No, false, false, "", "ps")},
- {0x33b1, 0, 0, 0, g(Yes, No, false, false, "", "ns")},
- {0x33b2, 0, 0, 0, g(Yes, No, false, false, "", "μs")},
- {0x33b3, 0, 0, 0, g(Yes, No, false, false, "", "ms")},
- {0x33b4, 0, 0, 0, g(Yes, No, false, false, "", "pV")},
- {0x33b5, 0, 0, 0, g(Yes, No, false, false, "", "nV")},
- {0x33b6, 0, 0, 0, g(Yes, No, false, false, "", "μV")},
- {0x33b7, 0, 0, 0, g(Yes, No, false, false, "", "mV")},
- {0x33b8, 0, 0, 0, g(Yes, No, false, false, "", "kV")},
- {0x33b9, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x33ba, 0, 0, 0, g(Yes, No, false, false, "", "pW")},
- {0x33bb, 0, 0, 0, g(Yes, No, false, false, "", "nW")},
- {0x33bc, 0, 0, 0, g(Yes, No, false, false, "", "μW")},
- {0x33bd, 0, 0, 0, g(Yes, No, false, false, "", "mW")},
- {0x33be, 0, 0, 0, g(Yes, No, false, false, "", "kW")},
- {0x33bf, 0, 0, 0, g(Yes, No, false, false, "", "MW")},
- {0x33c0, 0, 0, 0, g(Yes, No, false, false, "", "kΩ")},
- {0x33c1, 0, 0, 0, g(Yes, No, false, false, "", "MΩ")},
- {0x33c2, 0, 0, 0, g(Yes, No, false, false, "", "a.m.")},
- {0x33c3, 0, 0, 0, g(Yes, No, false, false, "", "Bq")},
- {0x33c4, 0, 0, 0, g(Yes, No, false, false, "", "cc")},
- {0x33c5, 0, 0, 0, g(Yes, No, false, false, "", "cd")},
- {0x33c6, 0, 0, 0, g(Yes, No, false, false, "", "C∕kg")},
- {0x33c7, 0, 0, 0, g(Yes, No, false, false, "", "Co.")},
- {0x33c8, 0, 0, 0, g(Yes, No, false, false, "", "dB")},
- {0x33c9, 0, 0, 0, g(Yes, No, false, false, "", "Gy")},
- {0x33ca, 0, 0, 0, g(Yes, No, false, false, "", "ha")},
- {0x33cb, 0, 0, 0, g(Yes, No, false, false, "", "HP")},
- {0x33cc, 0, 0, 0, g(Yes, No, false, false, "", "in")},
- {0x33cd, 0, 0, 0, g(Yes, No, false, false, "", "KK")},
- {0x33ce, 0, 0, 0, g(Yes, No, false, false, "", "KM")},
- {0x33cf, 0, 0, 0, g(Yes, No, false, false, "", "kt")},
- {0x33d0, 0, 0, 0, g(Yes, No, false, false, "", "lm")},
- {0x33d1, 0, 0, 0, g(Yes, No, false, false, "", "ln")},
- {0x33d2, 0, 0, 0, g(Yes, No, false, false, "", "log")},
- {0x33d3, 0, 0, 0, g(Yes, No, false, false, "", "lx")},
- {0x33d4, 0, 0, 0, g(Yes, No, false, false, "", "mb")},
- {0x33d5, 0, 0, 0, g(Yes, No, false, false, "", "mil")},
- {0x33d6, 0, 0, 0, g(Yes, No, false, false, "", "mol")},
- {0x33d7, 0, 0, 0, g(Yes, No, false, false, "", "PH")},
- {0x33d8, 0, 0, 0, g(Yes, No, false, false, "", "p.m.")},
- {0x33d9, 0, 0, 0, g(Yes, No, false, false, "", "PPM")},
- {0x33da, 0, 0, 0, g(Yes, No, false, false, "", "PR")},
- {0x33db, 0, 0, 0, g(Yes, No, false, false, "", "sr")},
- {0x33dc, 0, 0, 0, g(Yes, No, false, false, "", "Sv")},
- {0x33dd, 0, 0, 0, g(Yes, No, false, false, "", "Wb")},
- {0x33de, 0, 0, 0, g(Yes, No, false, false, "", "V∕m")},
- {0x33df, 0, 0, 0, g(Yes, No, false, false, "", "A∕m")},
- {0x33e0, 0, 0, 0, g(Yes, No, false, false, "", "1日")},
- {0x33e1, 0, 0, 0, g(Yes, No, false, false, "", "2日")},
- {0x33e2, 0, 0, 0, g(Yes, No, false, false, "", "3日")},
- {0x33e3, 0, 0, 0, g(Yes, No, false, false, "", "4日")},
- {0x33e4, 0, 0, 0, g(Yes, No, false, false, "", "5日")},
- {0x33e5, 0, 0, 0, g(Yes, No, false, false, "", "6日")},
- {0x33e6, 0, 0, 0, g(Yes, No, false, false, "", "7日")},
- {0x33e7, 0, 0, 0, g(Yes, No, false, false, "", "8日")},
- {0x33e8, 0, 0, 0, g(Yes, No, false, false, "", "9日")},
- {0x33e9, 0, 0, 0, g(Yes, No, false, false, "", "10日")},
- {0x33ea, 0, 0, 0, g(Yes, No, false, false, "", "11日")},
- {0x33eb, 0, 0, 0, g(Yes, No, false, false, "", "12日")},
- {0x33ec, 0, 0, 0, g(Yes, No, false, false, "", "13日")},
- {0x33ed, 0, 0, 0, g(Yes, No, false, false, "", "14日")},
- {0x33ee, 0, 0, 0, g(Yes, No, false, false, "", "15日")},
- {0x33ef, 0, 0, 0, g(Yes, No, false, false, "", "16日")},
- {0x33f0, 0, 0, 0, g(Yes, No, false, false, "", "17日")},
- {0x33f1, 0, 0, 0, g(Yes, No, false, false, "", "18日")},
- {0x33f2, 0, 0, 0, g(Yes, No, false, false, "", "19日")},
- {0x33f3, 0, 0, 0, g(Yes, No, false, false, "", "20日")},
- {0x33f4, 0, 0, 0, g(Yes, No, false, false, "", "21日")},
- {0x33f5, 0, 0, 0, g(Yes, No, false, false, "", "22日")},
- {0x33f6, 0, 0, 0, g(Yes, No, false, false, "", "23日")},
- {0x33f7, 0, 0, 0, g(Yes, No, false, false, "", "24日")},
- {0x33f8, 0, 0, 0, g(Yes, No, false, false, "", "25日")},
- {0x33f9, 0, 0, 0, g(Yes, No, false, false, "", "26日")},
- {0x33fa, 0, 0, 0, g(Yes, No, false, false, "", "27日")},
- {0x33fb, 0, 0, 0, g(Yes, No, false, false, "", "28日")},
- {0x33fc, 0, 0, 0, g(Yes, No, false, false, "", "29日")},
- {0x33fd, 0, 0, 0, g(Yes, No, false, false, "", "30日")},
- {0x33fe, 0, 0, 0, g(Yes, No, false, false, "", "31日")},
- {0x33ff, 0, 0, 0, g(Yes, No, false, false, "", "gal")},
- {0x3400, 0, 0, 0, f(Yes, false, "")},
- {0xa66f, 230, 1, 1, f(Yes, false, "")},
- {0xa670, 0, 0, 0, f(Yes, false, "")},
- {0xa674, 230, 1, 1, f(Yes, false, "")},
- {0xa67e, 0, 0, 0, f(Yes, false, "")},
- {0xa69c, 0, 0, 0, g(Yes, No, false, false, "", "ъ")},
- {0xa69d, 0, 0, 0, g(Yes, No, false, false, "", "ь")},
- {0xa69e, 230, 1, 1, f(Yes, false, "")},
- {0xa6a0, 0, 0, 0, f(Yes, false, "")},
- {0xa6f0, 230, 1, 1, f(Yes, false, "")},
- {0xa6f2, 0, 0, 0, f(Yes, false, "")},
- {0xa770, 0, 0, 0, g(Yes, No, false, false, "", "ꝯ")},
- {0xa771, 0, 0, 0, f(Yes, false, "")},
- {0xa7f8, 0, 0, 0, g(Yes, No, false, false, "", "Ħ")},
- {0xa7f9, 0, 0, 0, g(Yes, No, false, false, "", "œ")},
- {0xa7fa, 0, 0, 0, f(Yes, false, "")},
- {0xa806, 9, 1, 1, f(Yes, false, "")},
- {0xa807, 0, 0, 0, f(Yes, false, "")},
- {0xa8c4, 9, 1, 1, f(Yes, false, "")},
- {0xa8c5, 0, 0, 0, f(Yes, false, "")},
- {0xa8e0, 230, 1, 1, f(Yes, false, "")},
- {0xa8f2, 0, 0, 0, f(Yes, false, "")},
- {0xa92b, 220, 1, 1, f(Yes, false, "")},
- {0xa92e, 0, 0, 0, f(Yes, false, "")},
- {0xa953, 9, 1, 1, f(Yes, false, "")},
- {0xa954, 0, 0, 0, f(Yes, false, "")},
- {0xa9b3, 7, 1, 1, f(Yes, false, "")},
- {0xa9b4, 0, 0, 0, f(Yes, false, "")},
- {0xa9c0, 9, 1, 1, f(Yes, false, "")},
- {0xa9c1, 0, 0, 0, f(Yes, false, "")},
- {0xaab0, 230, 1, 1, f(Yes, false, "")},
- {0xaab1, 0, 0, 0, f(Yes, false, "")},
- {0xaab2, 230, 1, 1, f(Yes, false, "")},
- {0xaab4, 220, 1, 1, f(Yes, false, "")},
- {0xaab5, 0, 0, 0, f(Yes, false, "")},
- {0xaab7, 230, 1, 1, f(Yes, false, "")},
- {0xaab9, 0, 0, 0, f(Yes, false, "")},
- {0xaabe, 230, 1, 1, f(Yes, false, "")},
- {0xaac0, 0, 0, 0, f(Yes, false, "")},
- {0xaac1, 230, 1, 1, f(Yes, false, "")},
- {0xaac2, 0, 0, 0, f(Yes, false, "")},
- {0xaaf6, 9, 1, 1, f(Yes, false, "")},
- {0xaaf7, 0, 0, 0, f(Yes, false, "")},
- {0xab5c, 0, 0, 0, g(Yes, No, false, false, "", "ꜧ")},
- {0xab5d, 0, 0, 0, g(Yes, No, false, false, "", "ꬷ")},
- {0xab5e, 0, 0, 0, g(Yes, No, false, false, "", "ɫ")},
- {0xab5f, 0, 0, 0, g(Yes, No, false, false, "", "ꭒ")},
- {0xab60, 0, 0, 0, f(Yes, false, "")},
- {0xabed, 9, 1, 1, f(Yes, false, "")},
- {0xabee, 0, 0, 0, f(Yes, false, "")},
- {0xac00, 0, 0, 1, f(Yes, true, "")},
- {0xac01, 0, 0, 2, f(Yes, false, "")},
- {0xac1c, 0, 0, 1, f(Yes, true, "")},
- {0xac1d, 0, 0, 2, f(Yes, false, "")},
- {0xac38, 0, 0, 1, f(Yes, true, "")},
- {0xac39, 0, 0, 2, f(Yes, false, "")},
- {0xac54, 0, 0, 1, f(Yes, true, "")},
- {0xac55, 0, 0, 2, f(Yes, false, "")},
- {0xac70, 0, 0, 1, f(Yes, true, "")},
- {0xac71, 0, 0, 2, f(Yes, false, "")},
- {0xac8c, 0, 0, 1, f(Yes, true, "")},
- {0xac8d, 0, 0, 2, f(Yes, false, "")},
- {0xaca8, 0, 0, 1, f(Yes, true, "")},
- {0xaca9, 0, 0, 2, f(Yes, false, "")},
- {0xacc4, 0, 0, 1, f(Yes, true, "")},
- {0xacc5, 0, 0, 2, f(Yes, false, "")},
- {0xace0, 0, 0, 1, f(Yes, true, "")},
- {0xace1, 0, 0, 2, f(Yes, false, "")},
- {0xacfc, 0, 0, 1, f(Yes, true, "")},
- {0xacfd, 0, 0, 2, f(Yes, false, "")},
- {0xad18, 0, 0, 1, f(Yes, true, "")},
- {0xad19, 0, 0, 2, f(Yes, false, "")},
- {0xad34, 0, 0, 1, f(Yes, true, "")},
- {0xad35, 0, 0, 2, f(Yes, false, "")},
- {0xad50, 0, 0, 1, f(Yes, true, "")},
- {0xad51, 0, 0, 2, f(Yes, false, "")},
- {0xad6c, 0, 0, 1, f(Yes, true, "")},
- {0xad6d, 0, 0, 2, f(Yes, false, "")},
- {0xad88, 0, 0, 1, f(Yes, true, "")},
- {0xad89, 0, 0, 2, f(Yes, false, "")},
- {0xada4, 0, 0, 1, f(Yes, true, "")},
- {0xada5, 0, 0, 2, f(Yes, false, "")},
- {0xadc0, 0, 0, 1, f(Yes, true, "")},
- {0xadc1, 0, 0, 2, f(Yes, false, "")},
- {0xaddc, 0, 0, 1, f(Yes, true, "")},
- {0xaddd, 0, 0, 2, f(Yes, false, "")},
- {0xadf8, 0, 0, 1, f(Yes, true, "")},
- {0xadf9, 0, 0, 2, f(Yes, false, "")},
- {0xae14, 0, 0, 1, f(Yes, true, "")},
- {0xae15, 0, 0, 2, f(Yes, false, "")},
- {0xae30, 0, 0, 1, f(Yes, true, "")},
- {0xae31, 0, 0, 2, f(Yes, false, "")},
- {0xae4c, 0, 0, 1, f(Yes, true, "")},
- {0xae4d, 0, 0, 2, f(Yes, false, "")},
- {0xae68, 0, 0, 1, f(Yes, true, "")},
- {0xae69, 0, 0, 2, f(Yes, false, "")},
- {0xae84, 0, 0, 1, f(Yes, true, "")},
- {0xae85, 0, 0, 2, f(Yes, false, "")},
- {0xaea0, 0, 0, 1, f(Yes, true, "")},
- {0xaea1, 0, 0, 2, f(Yes, false, "")},
- {0xaebc, 0, 0, 1, f(Yes, true, "")},
- {0xaebd, 0, 0, 2, f(Yes, false, "")},
- {0xaed8, 0, 0, 1, f(Yes, true, "")},
- {0xaed9, 0, 0, 2, f(Yes, false, "")},
- {0xaef4, 0, 0, 1, f(Yes, true, "")},
- {0xaef5, 0, 0, 2, f(Yes, false, "")},
- {0xaf10, 0, 0, 1, f(Yes, true, "")},
- {0xaf11, 0, 0, 2, f(Yes, false, "")},
- {0xaf2c, 0, 0, 1, f(Yes, true, "")},
- {0xaf2d, 0, 0, 2, f(Yes, false, "")},
- {0xaf48, 0, 0, 1, f(Yes, true, "")},
- {0xaf49, 0, 0, 2, f(Yes, false, "")},
- {0xaf64, 0, 0, 1, f(Yes, true, "")},
- {0xaf65, 0, 0, 2, f(Yes, false, "")},
- {0xaf80, 0, 0, 1, f(Yes, true, "")},
- {0xaf81, 0, 0, 2, f(Yes, false, "")},
- {0xaf9c, 0, 0, 1, f(Yes, true, "")},
- {0xaf9d, 0, 0, 2, f(Yes, false, "")},
- {0xafb8, 0, 0, 1, f(Yes, true, "")},
- {0xafb9, 0, 0, 2, f(Yes, false, "")},
- {0xafd4, 0, 0, 1, f(Yes, true, "")},
- {0xafd5, 0, 0, 2, f(Yes, false, "")},
- {0xaff0, 0, 0, 1, f(Yes, true, "")},
- {0xaff1, 0, 0, 2, f(Yes, false, "")},
- {0xb00c, 0, 0, 1, f(Yes, true, "")},
- {0xb00d, 0, 0, 2, f(Yes, false, "")},
- {0xb028, 0, 0, 1, f(Yes, true, "")},
- {0xb029, 0, 0, 2, f(Yes, false, "")},
- {0xb044, 0, 0, 1, f(Yes, true, "")},
- {0xb045, 0, 0, 2, f(Yes, false, "")},
- {0xb060, 0, 0, 1, f(Yes, true, "")},
- {0xb061, 0, 0, 2, f(Yes, false, "")},
- {0xb07c, 0, 0, 1, f(Yes, true, "")},
- {0xb07d, 0, 0, 2, f(Yes, false, "")},
- {0xb098, 0, 0, 1, f(Yes, true, "")},
- {0xb099, 0, 0, 2, f(Yes, false, "")},
- {0xb0b4, 0, 0, 1, f(Yes, true, "")},
- {0xb0b5, 0, 0, 2, f(Yes, false, "")},
- {0xb0d0, 0, 0, 1, f(Yes, true, "")},
- {0xb0d1, 0, 0, 2, f(Yes, false, "")},
- {0xb0ec, 0, 0, 1, f(Yes, true, "")},
- {0xb0ed, 0, 0, 2, f(Yes, false, "")},
- {0xb108, 0, 0, 1, f(Yes, true, "")},
- {0xb109, 0, 0, 2, f(Yes, false, "")},
- {0xb124, 0, 0, 1, f(Yes, true, "")},
- {0xb125, 0, 0, 2, f(Yes, false, "")},
- {0xb140, 0, 0, 1, f(Yes, true, "")},
- {0xb141, 0, 0, 2, f(Yes, false, "")},
- {0xb15c, 0, 0, 1, f(Yes, true, "")},
- {0xb15d, 0, 0, 2, f(Yes, false, "")},
- {0xb178, 0, 0, 1, f(Yes, true, "")},
- {0xb179, 0, 0, 2, f(Yes, false, "")},
- {0xb194, 0, 0, 1, f(Yes, true, "")},
- {0xb195, 0, 0, 2, f(Yes, false, "")},
- {0xb1b0, 0, 0, 1, f(Yes, true, "")},
- {0xb1b1, 0, 0, 2, f(Yes, false, "")},
- {0xb1cc, 0, 0, 1, f(Yes, true, "")},
- {0xb1cd, 0, 0, 2, f(Yes, false, "")},
- {0xb1e8, 0, 0, 1, f(Yes, true, "")},
- {0xb1e9, 0, 0, 2, f(Yes, false, "")},
- {0xb204, 0, 0, 1, f(Yes, true, "")},
- {0xb205, 0, 0, 2, f(Yes, false, "")},
- {0xb220, 0, 0, 1, f(Yes, true, "")},
- {0xb221, 0, 0, 2, f(Yes, false, "")},
- {0xb23c, 0, 0, 1, f(Yes, true, "")},
- {0xb23d, 0, 0, 2, f(Yes, false, "")},
- {0xb258, 0, 0, 1, f(Yes, true, "")},
- {0xb259, 0, 0, 2, f(Yes, false, "")},
- {0xb274, 0, 0, 1, f(Yes, true, "")},
- {0xb275, 0, 0, 2, f(Yes, false, "")},
- {0xb290, 0, 0, 1, f(Yes, true, "")},
- {0xb291, 0, 0, 2, f(Yes, false, "")},
- {0xb2ac, 0, 0, 1, f(Yes, true, "")},
- {0xb2ad, 0, 0, 2, f(Yes, false, "")},
- {0xb2c8, 0, 0, 1, f(Yes, true, "")},
- {0xb2c9, 0, 0, 2, f(Yes, false, "")},
- {0xb2e4, 0, 0, 1, f(Yes, true, "")},
- {0xb2e5, 0, 0, 2, f(Yes, false, "")},
- {0xb300, 0, 0, 1, f(Yes, true, "")},
- {0xb301, 0, 0, 2, f(Yes, false, "")},
- {0xb31c, 0, 0, 1, f(Yes, true, "")},
- {0xb31d, 0, 0, 2, f(Yes, false, "")},
- {0xb338, 0, 0, 1, f(Yes, true, "")},
- {0xb339, 0, 0, 2, f(Yes, false, "")},
- {0xb354, 0, 0, 1, f(Yes, true, "")},
- {0xb355, 0, 0, 2, f(Yes, false, "")},
- {0xb370, 0, 0, 1, f(Yes, true, "")},
- {0xb371, 0, 0, 2, f(Yes, false, "")},
- {0xb38c, 0, 0, 1, f(Yes, true, "")},
- {0xb38d, 0, 0, 2, f(Yes, false, "")},
- {0xb3a8, 0, 0, 1, f(Yes, true, "")},
- {0xb3a9, 0, 0, 2, f(Yes, false, "")},
- {0xb3c4, 0, 0, 1, f(Yes, true, "")},
- {0xb3c5, 0, 0, 2, f(Yes, false, "")},
- {0xb3e0, 0, 0, 1, f(Yes, true, "")},
- {0xb3e1, 0, 0, 2, f(Yes, false, "")},
- {0xb3fc, 0, 0, 1, f(Yes, true, "")},
- {0xb3fd, 0, 0, 2, f(Yes, false, "")},
- {0xb418, 0, 0, 1, f(Yes, true, "")},
- {0xb419, 0, 0, 2, f(Yes, false, "")},
- {0xb434, 0, 0, 1, f(Yes, true, "")},
- {0xb435, 0, 0, 2, f(Yes, false, "")},
- {0xb450, 0, 0, 1, f(Yes, true, "")},
- {0xb451, 0, 0, 2, f(Yes, false, "")},
- {0xb46c, 0, 0, 1, f(Yes, true, "")},
- {0xb46d, 0, 0, 2, f(Yes, false, "")},
- {0xb488, 0, 0, 1, f(Yes, true, "")},
- {0xb489, 0, 0, 2, f(Yes, false, "")},
- {0xb4a4, 0, 0, 1, f(Yes, true, "")},
- {0xb4a5, 0, 0, 2, f(Yes, false, "")},
- {0xb4c0, 0, 0, 1, f(Yes, true, "")},
- {0xb4c1, 0, 0, 2, f(Yes, false, "")},
- {0xb4dc, 0, 0, 1, f(Yes, true, "")},
- {0xb4dd, 0, 0, 2, f(Yes, false, "")},
- {0xb4f8, 0, 0, 1, f(Yes, true, "")},
- {0xb4f9, 0, 0, 2, f(Yes, false, "")},
- {0xb514, 0, 0, 1, f(Yes, true, "")},
- {0xb515, 0, 0, 2, f(Yes, false, "")},
- {0xb530, 0, 0, 1, f(Yes, true, "")},
- {0xb531, 0, 0, 2, f(Yes, false, "")},
- {0xb54c, 0, 0, 1, f(Yes, true, "")},
- {0xb54d, 0, 0, 2, f(Yes, false, "")},
- {0xb568, 0, 0, 1, f(Yes, true, "")},
- {0xb569, 0, 0, 2, f(Yes, false, "")},
- {0xb584, 0, 0, 1, f(Yes, true, "")},
- {0xb585, 0, 0, 2, f(Yes, false, "")},
- {0xb5a0, 0, 0, 1, f(Yes, true, "")},
- {0xb5a1, 0, 0, 2, f(Yes, false, "")},
- {0xb5bc, 0, 0, 1, f(Yes, true, "")},
- {0xb5bd, 0, 0, 2, f(Yes, false, "")},
- {0xb5d8, 0, 0, 1, f(Yes, true, "")},
- {0xb5d9, 0, 0, 2, f(Yes, false, "")},
- {0xb5f4, 0, 0, 1, f(Yes, true, "")},
- {0xb5f5, 0, 0, 2, f(Yes, false, "")},
- {0xb610, 0, 0, 1, f(Yes, true, "")},
- {0xb611, 0, 0, 2, f(Yes, false, "")},
- {0xb62c, 0, 0, 1, f(Yes, true, "")},
- {0xb62d, 0, 0, 2, f(Yes, false, "")},
- {0xb648, 0, 0, 1, f(Yes, true, "")},
- {0xb649, 0, 0, 2, f(Yes, false, "")},
- {0xb664, 0, 0, 1, f(Yes, true, "")},
- {0xb665, 0, 0, 2, f(Yes, false, "")},
- {0xb680, 0, 0, 1, f(Yes, true, "")},
- {0xb681, 0, 0, 2, f(Yes, false, "")},
- {0xb69c, 0, 0, 1, f(Yes, true, "")},
- {0xb69d, 0, 0, 2, f(Yes, false, "")},
- {0xb6b8, 0, 0, 1, f(Yes, true, "")},
- {0xb6b9, 0, 0, 2, f(Yes, false, "")},
- {0xb6d4, 0, 0, 1, f(Yes, true, "")},
- {0xb6d5, 0, 0, 2, f(Yes, false, "")},
- {0xb6f0, 0, 0, 1, f(Yes, true, "")},
- {0xb6f1, 0, 0, 2, f(Yes, false, "")},
- {0xb70c, 0, 0, 1, f(Yes, true, "")},
- {0xb70d, 0, 0, 2, f(Yes, false, "")},
- {0xb728, 0, 0, 1, f(Yes, true, "")},
- {0xb729, 0, 0, 2, f(Yes, false, "")},
- {0xb744, 0, 0, 1, f(Yes, true, "")},
- {0xb745, 0, 0, 2, f(Yes, false, "")},
- {0xb760, 0, 0, 1, f(Yes, true, "")},
- {0xb761, 0, 0, 2, f(Yes, false, "")},
- {0xb77c, 0, 0, 1, f(Yes, true, "")},
- {0xb77d, 0, 0, 2, f(Yes, false, "")},
- {0xb798, 0, 0, 1, f(Yes, true, "")},
- {0xb799, 0, 0, 2, f(Yes, false, "")},
- {0xb7b4, 0, 0, 1, f(Yes, true, "")},
- {0xb7b5, 0, 0, 2, f(Yes, false, "")},
- {0xb7d0, 0, 0, 1, f(Yes, true, "")},
- {0xb7d1, 0, 0, 2, f(Yes, false, "")},
- {0xb7ec, 0, 0, 1, f(Yes, true, "")},
- {0xb7ed, 0, 0, 2, f(Yes, false, "")},
- {0xb808, 0, 0, 1, f(Yes, true, "")},
- {0xb809, 0, 0, 2, f(Yes, false, "")},
- {0xb824, 0, 0, 1, f(Yes, true, "")},
- {0xb825, 0, 0, 2, f(Yes, false, "")},
- {0xb840, 0, 0, 1, f(Yes, true, "")},
- {0xb841, 0, 0, 2, f(Yes, false, "")},
- {0xb85c, 0, 0, 1, f(Yes, true, "")},
- {0xb85d, 0, 0, 2, f(Yes, false, "")},
- {0xb878, 0, 0, 1, f(Yes, true, "")},
- {0xb879, 0, 0, 2, f(Yes, false, "")},
- {0xb894, 0, 0, 1, f(Yes, true, "")},
- {0xb895, 0, 0, 2, f(Yes, false, "")},
- {0xb8b0, 0, 0, 1, f(Yes, true, "")},
- {0xb8b1, 0, 0, 2, f(Yes, false, "")},
- {0xb8cc, 0, 0, 1, f(Yes, true, "")},
- {0xb8cd, 0, 0, 2, f(Yes, false, "")},
- {0xb8e8, 0, 0, 1, f(Yes, true, "")},
- {0xb8e9, 0, 0, 2, f(Yes, false, "")},
- {0xb904, 0, 0, 1, f(Yes, true, "")},
- {0xb905, 0, 0, 2, f(Yes, false, "")},
- {0xb920, 0, 0, 1, f(Yes, true, "")},
- {0xb921, 0, 0, 2, f(Yes, false, "")},
- {0xb93c, 0, 0, 1, f(Yes, true, "")},
- {0xb93d, 0, 0, 2, f(Yes, false, "")},
- {0xb958, 0, 0, 1, f(Yes, true, "")},
- {0xb959, 0, 0, 2, f(Yes, false, "")},
- {0xb974, 0, 0, 1, f(Yes, true, "")},
- {0xb975, 0, 0, 2, f(Yes, false, "")},
- {0xb990, 0, 0, 1, f(Yes, true, "")},
- {0xb991, 0, 0, 2, f(Yes, false, "")},
- {0xb9ac, 0, 0, 1, f(Yes, true, "")},
- {0xb9ad, 0, 0, 2, f(Yes, false, "")},
- {0xb9c8, 0, 0, 1, f(Yes, true, "")},
- {0xb9c9, 0, 0, 2, f(Yes, false, "")},
- {0xb9e4, 0, 0, 1, f(Yes, true, "")},
- {0xb9e5, 0, 0, 2, f(Yes, false, "")},
- {0xba00, 0, 0, 1, f(Yes, true, "")},
- {0xba01, 0, 0, 2, f(Yes, false, "")},
- {0xba1c, 0, 0, 1, f(Yes, true, "")},
- {0xba1d, 0, 0, 2, f(Yes, false, "")},
- {0xba38, 0, 0, 1, f(Yes, true, "")},
- {0xba39, 0, 0, 2, f(Yes, false, "")},
- {0xba54, 0, 0, 1, f(Yes, true, "")},
- {0xba55, 0, 0, 2, f(Yes, false, "")},
- {0xba70, 0, 0, 1, f(Yes, true, "")},
- {0xba71, 0, 0, 2, f(Yes, false, "")},
- {0xba8c, 0, 0, 1, f(Yes, true, "")},
- {0xba8d, 0, 0, 2, f(Yes, false, "")},
- {0xbaa8, 0, 0, 1, f(Yes, true, "")},
- {0xbaa9, 0, 0, 2, f(Yes, false, "")},
- {0xbac4, 0, 0, 1, f(Yes, true, "")},
- {0xbac5, 0, 0, 2, f(Yes, false, "")},
- {0xbae0, 0, 0, 1, f(Yes, true, "")},
- {0xbae1, 0, 0, 2, f(Yes, false, "")},
- {0xbafc, 0, 0, 1, f(Yes, true, "")},
- {0xbafd, 0, 0, 2, f(Yes, false, "")},
- {0xbb18, 0, 0, 1, f(Yes, true, "")},
- {0xbb19, 0, 0, 2, f(Yes, false, "")},
- {0xbb34, 0, 0, 1, f(Yes, true, "")},
- {0xbb35, 0, 0, 2, f(Yes, false, "")},
- {0xbb50, 0, 0, 1, f(Yes, true, "")},
- {0xbb51, 0, 0, 2, f(Yes, false, "")},
- {0xbb6c, 0, 0, 1, f(Yes, true, "")},
- {0xbb6d, 0, 0, 2, f(Yes, false, "")},
- {0xbb88, 0, 0, 1, f(Yes, true, "")},
- {0xbb89, 0, 0, 2, f(Yes, false, "")},
- {0xbba4, 0, 0, 1, f(Yes, true, "")},
- {0xbba5, 0, 0, 2, f(Yes, false, "")},
- {0xbbc0, 0, 0, 1, f(Yes, true, "")},
- {0xbbc1, 0, 0, 2, f(Yes, false, "")},
- {0xbbdc, 0, 0, 1, f(Yes, true, "")},
- {0xbbdd, 0, 0, 2, f(Yes, false, "")},
- {0xbbf8, 0, 0, 1, f(Yes, true, "")},
- {0xbbf9, 0, 0, 2, f(Yes, false, "")},
- {0xbc14, 0, 0, 1, f(Yes, true, "")},
- {0xbc15, 0, 0, 2, f(Yes, false, "")},
- {0xbc30, 0, 0, 1, f(Yes, true, "")},
- {0xbc31, 0, 0, 2, f(Yes, false, "")},
- {0xbc4c, 0, 0, 1, f(Yes, true, "")},
- {0xbc4d, 0, 0, 2, f(Yes, false, "")},
- {0xbc68, 0, 0, 1, f(Yes, true, "")},
- {0xbc69, 0, 0, 2, f(Yes, false, "")},
- {0xbc84, 0, 0, 1, f(Yes, true, "")},
- {0xbc85, 0, 0, 2, f(Yes, false, "")},
- {0xbca0, 0, 0, 1, f(Yes, true, "")},
- {0xbca1, 0, 0, 2, f(Yes, false, "")},
- {0xbcbc, 0, 0, 1, f(Yes, true, "")},
- {0xbcbd, 0, 0, 2, f(Yes, false, "")},
- {0xbcd8, 0, 0, 1, f(Yes, true, "")},
- {0xbcd9, 0, 0, 2, f(Yes, false, "")},
- {0xbcf4, 0, 0, 1, f(Yes, true, "")},
- {0xbcf5, 0, 0, 2, f(Yes, false, "")},
- {0xbd10, 0, 0, 1, f(Yes, true, "")},
- {0xbd11, 0, 0, 2, f(Yes, false, "")},
- {0xbd2c, 0, 0, 1, f(Yes, true, "")},
- {0xbd2d, 0, 0, 2, f(Yes, false, "")},
- {0xbd48, 0, 0, 1, f(Yes, true, "")},
- {0xbd49, 0, 0, 2, f(Yes, false, "")},
- {0xbd64, 0, 0, 1, f(Yes, true, "")},
- {0xbd65, 0, 0, 2, f(Yes, false, "")},
- {0xbd80, 0, 0, 1, f(Yes, true, "")},
- {0xbd81, 0, 0, 2, f(Yes, false, "")},
- {0xbd9c, 0, 0, 1, f(Yes, true, "")},
- {0xbd9d, 0, 0, 2, f(Yes, false, "")},
- {0xbdb8, 0, 0, 1, f(Yes, true, "")},
- {0xbdb9, 0, 0, 2, f(Yes, false, "")},
- {0xbdd4, 0, 0, 1, f(Yes, true, "")},
- {0xbdd5, 0, 0, 2, f(Yes, false, "")},
- {0xbdf0, 0, 0, 1, f(Yes, true, "")},
- {0xbdf1, 0, 0, 2, f(Yes, false, "")},
- {0xbe0c, 0, 0, 1, f(Yes, true, "")},
- {0xbe0d, 0, 0, 2, f(Yes, false, "")},
- {0xbe28, 0, 0, 1, f(Yes, true, "")},
- {0xbe29, 0, 0, 2, f(Yes, false, "")},
- {0xbe44, 0, 0, 1, f(Yes, true, "")},
- {0xbe45, 0, 0, 2, f(Yes, false, "")},
- {0xbe60, 0, 0, 1, f(Yes, true, "")},
- {0xbe61, 0, 0, 2, f(Yes, false, "")},
- {0xbe7c, 0, 0, 1, f(Yes, true, "")},
- {0xbe7d, 0, 0, 2, f(Yes, false, "")},
- {0xbe98, 0, 0, 1, f(Yes, true, "")},
- {0xbe99, 0, 0, 2, f(Yes, false, "")},
- {0xbeb4, 0, 0, 1, f(Yes, true, "")},
- {0xbeb5, 0, 0, 2, f(Yes, false, "")},
- {0xbed0, 0, 0, 1, f(Yes, true, "")},
- {0xbed1, 0, 0, 2, f(Yes, false, "")},
- {0xbeec, 0, 0, 1, f(Yes, true, "")},
- {0xbeed, 0, 0, 2, f(Yes, false, "")},
- {0xbf08, 0, 0, 1, f(Yes, true, "")},
- {0xbf09, 0, 0, 2, f(Yes, false, "")},
- {0xbf24, 0, 0, 1, f(Yes, true, "")},
- {0xbf25, 0, 0, 2, f(Yes, false, "")},
- {0xbf40, 0, 0, 1, f(Yes, true, "")},
- {0xbf41, 0, 0, 2, f(Yes, false, "")},
- {0xbf5c, 0, 0, 1, f(Yes, true, "")},
- {0xbf5d, 0, 0, 2, f(Yes, false, "")},
- {0xbf78, 0, 0, 1, f(Yes, true, "")},
- {0xbf79, 0, 0, 2, f(Yes, false, "")},
- {0xbf94, 0, 0, 1, f(Yes, true, "")},
- {0xbf95, 0, 0, 2, f(Yes, false, "")},
- {0xbfb0, 0, 0, 1, f(Yes, true, "")},
- {0xbfb1, 0, 0, 2, f(Yes, false, "")},
- {0xbfcc, 0, 0, 1, f(Yes, true, "")},
- {0xbfcd, 0, 0, 2, f(Yes, false, "")},
- {0xbfe8, 0, 0, 1, f(Yes, true, "")},
- {0xbfe9, 0, 0, 2, f(Yes, false, "")},
- {0xc004, 0, 0, 1, f(Yes, true, "")},
- {0xc005, 0, 0, 2, f(Yes, false, "")},
- {0xc020, 0, 0, 1, f(Yes, true, "")},
- {0xc021, 0, 0, 2, f(Yes, false, "")},
- {0xc03c, 0, 0, 1, f(Yes, true, "")},
- {0xc03d, 0, 0, 2, f(Yes, false, "")},
- {0xc058, 0, 0, 1, f(Yes, true, "")},
- {0xc059, 0, 0, 2, f(Yes, false, "")},
- {0xc074, 0, 0, 1, f(Yes, true, "")},
- {0xc075, 0, 0, 2, f(Yes, false, "")},
- {0xc090, 0, 0, 1, f(Yes, true, "")},
- {0xc091, 0, 0, 2, f(Yes, false, "")},
- {0xc0ac, 0, 0, 1, f(Yes, true, "")},
- {0xc0ad, 0, 0, 2, f(Yes, false, "")},
- {0xc0c8, 0, 0, 1, f(Yes, true, "")},
- {0xc0c9, 0, 0, 2, f(Yes, false, "")},
- {0xc0e4, 0, 0, 1, f(Yes, true, "")},
- {0xc0e5, 0, 0, 2, f(Yes, false, "")},
- {0xc100, 0, 0, 1, f(Yes, true, "")},
- {0xc101, 0, 0, 2, f(Yes, false, "")},
- {0xc11c, 0, 0, 1, f(Yes, true, "")},
- {0xc11d, 0, 0, 2, f(Yes, false, "")},
- {0xc138, 0, 0, 1, f(Yes, true, "")},
- {0xc139, 0, 0, 2, f(Yes, false, "")},
- {0xc154, 0, 0, 1, f(Yes, true, "")},
- {0xc155, 0, 0, 2, f(Yes, false, "")},
- {0xc170, 0, 0, 1, f(Yes, true, "")},
- {0xc171, 0, 0, 2, f(Yes, false, "")},
- {0xc18c, 0, 0, 1, f(Yes, true, "")},
- {0xc18d, 0, 0, 2, f(Yes, false, "")},
- {0xc1a8, 0, 0, 1, f(Yes, true, "")},
- {0xc1a9, 0, 0, 2, f(Yes, false, "")},
- {0xc1c4, 0, 0, 1, f(Yes, true, "")},
- {0xc1c5, 0, 0, 2, f(Yes, false, "")},
- {0xc1e0, 0, 0, 1, f(Yes, true, "")},
- {0xc1e1, 0, 0, 2, f(Yes, false, "")},
- {0xc1fc, 0, 0, 1, f(Yes, true, "")},
- {0xc1fd, 0, 0, 2, f(Yes, false, "")},
- {0xc218, 0, 0, 1, f(Yes, true, "")},
- {0xc219, 0, 0, 2, f(Yes, false, "")},
- {0xc234, 0, 0, 1, f(Yes, true, "")},
- {0xc235, 0, 0, 2, f(Yes, false, "")},
- {0xc250, 0, 0, 1, f(Yes, true, "")},
- {0xc251, 0, 0, 2, f(Yes, false, "")},
- {0xc26c, 0, 0, 1, f(Yes, true, "")},
- {0xc26d, 0, 0, 2, f(Yes, false, "")},
- {0xc288, 0, 0, 1, f(Yes, true, "")},
- {0xc289, 0, 0, 2, f(Yes, false, "")},
- {0xc2a4, 0, 0, 1, f(Yes, true, "")},
- {0xc2a5, 0, 0, 2, f(Yes, false, "")},
- {0xc2c0, 0, 0, 1, f(Yes, true, "")},
- {0xc2c1, 0, 0, 2, f(Yes, false, "")},
- {0xc2dc, 0, 0, 1, f(Yes, true, "")},
- {0xc2dd, 0, 0, 2, f(Yes, false, "")},
- {0xc2f8, 0, 0, 1, f(Yes, true, "")},
- {0xc2f9, 0, 0, 2, f(Yes, false, "")},
- {0xc314, 0, 0, 1, f(Yes, true, "")},
- {0xc315, 0, 0, 2, f(Yes, false, "")},
- {0xc330, 0, 0, 1, f(Yes, true, "")},
- {0xc331, 0, 0, 2, f(Yes, false, "")},
- {0xc34c, 0, 0, 1, f(Yes, true, "")},
- {0xc34d, 0, 0, 2, f(Yes, false, "")},
- {0xc368, 0, 0, 1, f(Yes, true, "")},
- {0xc369, 0, 0, 2, f(Yes, false, "")},
- {0xc384, 0, 0, 1, f(Yes, true, "")},
- {0xc385, 0, 0, 2, f(Yes, false, "")},
- {0xc3a0, 0, 0, 1, f(Yes, true, "")},
- {0xc3a1, 0, 0, 2, f(Yes, false, "")},
- {0xc3bc, 0, 0, 1, f(Yes, true, "")},
- {0xc3bd, 0, 0, 2, f(Yes, false, "")},
- {0xc3d8, 0, 0, 1, f(Yes, true, "")},
- {0xc3d9, 0, 0, 2, f(Yes, false, "")},
- {0xc3f4, 0, 0, 1, f(Yes, true, "")},
- {0xc3f5, 0, 0, 2, f(Yes, false, "")},
- {0xc410, 0, 0, 1, f(Yes, true, "")},
- {0xc411, 0, 0, 2, f(Yes, false, "")},
- {0xc42c, 0, 0, 1, f(Yes, true, "")},
- {0xc42d, 0, 0, 2, f(Yes, false, "")},
- {0xc448, 0, 0, 1, f(Yes, true, "")},
- {0xc449, 0, 0, 2, f(Yes, false, "")},
- {0xc464, 0, 0, 1, f(Yes, true, "")},
- {0xc465, 0, 0, 2, f(Yes, false, "")},
- {0xc480, 0, 0, 1, f(Yes, true, "")},
- {0xc481, 0, 0, 2, f(Yes, false, "")},
- {0xc49c, 0, 0, 1, f(Yes, true, "")},
- {0xc49d, 0, 0, 2, f(Yes, false, "")},
- {0xc4b8, 0, 0, 1, f(Yes, true, "")},
- {0xc4b9, 0, 0, 2, f(Yes, false, "")},
- {0xc4d4, 0, 0, 1, f(Yes, true, "")},
- {0xc4d5, 0, 0, 2, f(Yes, false, "")},
- {0xc4f0, 0, 0, 1, f(Yes, true, "")},
- {0xc4f1, 0, 0, 2, f(Yes, false, "")},
- {0xc50c, 0, 0, 1, f(Yes, true, "")},
- {0xc50d, 0, 0, 2, f(Yes, false, "")},
- {0xc528, 0, 0, 1, f(Yes, true, "")},
- {0xc529, 0, 0, 2, f(Yes, false, "")},
- {0xc544, 0, 0, 1, f(Yes, true, "")},
- {0xc545, 0, 0, 2, f(Yes, false, "")},
- {0xc560, 0, 0, 1, f(Yes, true, "")},
- {0xc561, 0, 0, 2, f(Yes, false, "")},
- {0xc57c, 0, 0, 1, f(Yes, true, "")},
- {0xc57d, 0, 0, 2, f(Yes, false, "")},
- {0xc598, 0, 0, 1, f(Yes, true, "")},
- {0xc599, 0, 0, 2, f(Yes, false, "")},
- {0xc5b4, 0, 0, 1, f(Yes, true, "")},
- {0xc5b5, 0, 0, 2, f(Yes, false, "")},
- {0xc5d0, 0, 0, 1, f(Yes, true, "")},
- {0xc5d1, 0, 0, 2, f(Yes, false, "")},
- {0xc5ec, 0, 0, 1, f(Yes, true, "")},
- {0xc5ed, 0, 0, 2, f(Yes, false, "")},
- {0xc608, 0, 0, 1, f(Yes, true, "")},
- {0xc609, 0, 0, 2, f(Yes, false, "")},
- {0xc624, 0, 0, 1, f(Yes, true, "")},
- {0xc625, 0, 0, 2, f(Yes, false, "")},
- {0xc640, 0, 0, 1, f(Yes, true, "")},
- {0xc641, 0, 0, 2, f(Yes, false, "")},
- {0xc65c, 0, 0, 1, f(Yes, true, "")},
- {0xc65d, 0, 0, 2, f(Yes, false, "")},
- {0xc678, 0, 0, 1, f(Yes, true, "")},
- {0xc679, 0, 0, 2, f(Yes, false, "")},
- {0xc694, 0, 0, 1, f(Yes, true, "")},
- {0xc695, 0, 0, 2, f(Yes, false, "")},
- {0xc6b0, 0, 0, 1, f(Yes, true, "")},
- {0xc6b1, 0, 0, 2, f(Yes, false, "")},
- {0xc6cc, 0, 0, 1, f(Yes, true, "")},
- {0xc6cd, 0, 0, 2, f(Yes, false, "")},
- {0xc6e8, 0, 0, 1, f(Yes, true, "")},
- {0xc6e9, 0, 0, 2, f(Yes, false, "")},
- {0xc704, 0, 0, 1, f(Yes, true, "")},
- {0xc705, 0, 0, 2, f(Yes, false, "")},
- {0xc720, 0, 0, 1, f(Yes, true, "")},
- {0xc721, 0, 0, 2, f(Yes, false, "")},
- {0xc73c, 0, 0, 1, f(Yes, true, "")},
- {0xc73d, 0, 0, 2, f(Yes, false, "")},
- {0xc758, 0, 0, 1, f(Yes, true, "")},
- {0xc759, 0, 0, 2, f(Yes, false, "")},
- {0xc774, 0, 0, 1, f(Yes, true, "")},
- {0xc775, 0, 0, 2, f(Yes, false, "")},
- {0xc790, 0, 0, 1, f(Yes, true, "")},
- {0xc791, 0, 0, 2, f(Yes, false, "")},
- {0xc7ac, 0, 0, 1, f(Yes, true, "")},
- {0xc7ad, 0, 0, 2, f(Yes, false, "")},
- {0xc7c8, 0, 0, 1, f(Yes, true, "")},
- {0xc7c9, 0, 0, 2, f(Yes, false, "")},
- {0xc7e4, 0, 0, 1, f(Yes, true, "")},
- {0xc7e5, 0, 0, 2, f(Yes, false, "")},
- {0xc800, 0, 0, 1, f(Yes, true, "")},
- {0xc801, 0, 0, 2, f(Yes, false, "")},
- {0xc81c, 0, 0, 1, f(Yes, true, "")},
- {0xc81d, 0, 0, 2, f(Yes, false, "")},
- {0xc838, 0, 0, 1, f(Yes, true, "")},
- {0xc839, 0, 0, 2, f(Yes, false, "")},
- {0xc854, 0, 0, 1, f(Yes, true, "")},
- {0xc855, 0, 0, 2, f(Yes, false, "")},
- {0xc870, 0, 0, 1, f(Yes, true, "")},
- {0xc871, 0, 0, 2, f(Yes, false, "")},
- {0xc88c, 0, 0, 1, f(Yes, true, "")},
- {0xc88d, 0, 0, 2, f(Yes, false, "")},
- {0xc8a8, 0, 0, 1, f(Yes, true, "")},
- {0xc8a9, 0, 0, 2, f(Yes, false, "")},
- {0xc8c4, 0, 0, 1, f(Yes, true, "")},
- {0xc8c5, 0, 0, 2, f(Yes, false, "")},
- {0xc8e0, 0, 0, 1, f(Yes, true, "")},
- {0xc8e1, 0, 0, 2, f(Yes, false, "")},
- {0xc8fc, 0, 0, 1, f(Yes, true, "")},
- {0xc8fd, 0, 0, 2, f(Yes, false, "")},
- {0xc918, 0, 0, 1, f(Yes, true, "")},
- {0xc919, 0, 0, 2, f(Yes, false, "")},
- {0xc934, 0, 0, 1, f(Yes, true, "")},
- {0xc935, 0, 0, 2, f(Yes, false, "")},
- {0xc950, 0, 0, 1, f(Yes, true, "")},
- {0xc951, 0, 0, 2, f(Yes, false, "")},
- {0xc96c, 0, 0, 1, f(Yes, true, "")},
- {0xc96d, 0, 0, 2, f(Yes, false, "")},
- {0xc988, 0, 0, 1, f(Yes, true, "")},
- {0xc989, 0, 0, 2, f(Yes, false, "")},
- {0xc9a4, 0, 0, 1, f(Yes, true, "")},
- {0xc9a5, 0, 0, 2, f(Yes, false, "")},
- {0xc9c0, 0, 0, 1, f(Yes, true, "")},
- {0xc9c1, 0, 0, 2, f(Yes, false, "")},
- {0xc9dc, 0, 0, 1, f(Yes, true, "")},
- {0xc9dd, 0, 0, 2, f(Yes, false, "")},
- {0xc9f8, 0, 0, 1, f(Yes, true, "")},
- {0xc9f9, 0, 0, 2, f(Yes, false, "")},
- {0xca14, 0, 0, 1, f(Yes, true, "")},
- {0xca15, 0, 0, 2, f(Yes, false, "")},
- {0xca30, 0, 0, 1, f(Yes, true, "")},
- {0xca31, 0, 0, 2, f(Yes, false, "")},
- {0xca4c, 0, 0, 1, f(Yes, true, "")},
- {0xca4d, 0, 0, 2, f(Yes, false, "")},
- {0xca68, 0, 0, 1, f(Yes, true, "")},
- {0xca69, 0, 0, 2, f(Yes, false, "")},
- {0xca84, 0, 0, 1, f(Yes, true, "")},
- {0xca85, 0, 0, 2, f(Yes, false, "")},
- {0xcaa0, 0, 0, 1, f(Yes, true, "")},
- {0xcaa1, 0, 0, 2, f(Yes, false, "")},
- {0xcabc, 0, 0, 1, f(Yes, true, "")},
- {0xcabd, 0, 0, 2, f(Yes, false, "")},
- {0xcad8, 0, 0, 1, f(Yes, true, "")},
- {0xcad9, 0, 0, 2, f(Yes, false, "")},
- {0xcaf4, 0, 0, 1, f(Yes, true, "")},
- {0xcaf5, 0, 0, 2, f(Yes, false, "")},
- {0xcb10, 0, 0, 1, f(Yes, true, "")},
- {0xcb11, 0, 0, 2, f(Yes, false, "")},
- {0xcb2c, 0, 0, 1, f(Yes, true, "")},
- {0xcb2d, 0, 0, 2, f(Yes, false, "")},
- {0xcb48, 0, 0, 1, f(Yes, true, "")},
- {0xcb49, 0, 0, 2, f(Yes, false, "")},
- {0xcb64, 0, 0, 1, f(Yes, true, "")},
- {0xcb65, 0, 0, 2, f(Yes, false, "")},
- {0xcb80, 0, 0, 1, f(Yes, true, "")},
- {0xcb81, 0, 0, 2, f(Yes, false, "")},
- {0xcb9c, 0, 0, 1, f(Yes, true, "")},
- {0xcb9d, 0, 0, 2, f(Yes, false, "")},
- {0xcbb8, 0, 0, 1, f(Yes, true, "")},
- {0xcbb9, 0, 0, 2, f(Yes, false, "")},
- {0xcbd4, 0, 0, 1, f(Yes, true, "")},
- {0xcbd5, 0, 0, 2, f(Yes, false, "")},
- {0xcbf0, 0, 0, 1, f(Yes, true, "")},
- {0xcbf1, 0, 0, 2, f(Yes, false, "")},
- {0xcc0c, 0, 0, 1, f(Yes, true, "")},
- {0xcc0d, 0, 0, 2, f(Yes, false, "")},
- {0xcc28, 0, 0, 1, f(Yes, true, "")},
- {0xcc29, 0, 0, 2, f(Yes, false, "")},
- {0xcc44, 0, 0, 1, f(Yes, true, "")},
- {0xcc45, 0, 0, 2, f(Yes, false, "")},
- {0xcc60, 0, 0, 1, f(Yes, true, "")},
- {0xcc61, 0, 0, 2, f(Yes, false, "")},
- {0xcc7c, 0, 0, 1, f(Yes, true, "")},
- {0xcc7d, 0, 0, 2, f(Yes, false, "")},
- {0xcc98, 0, 0, 1, f(Yes, true, "")},
- {0xcc99, 0, 0, 2, f(Yes, false, "")},
- {0xccb4, 0, 0, 1, f(Yes, true, "")},
- {0xccb5, 0, 0, 2, f(Yes, false, "")},
- {0xccd0, 0, 0, 1, f(Yes, true, "")},
- {0xccd1, 0, 0, 2, f(Yes, false, "")},
- {0xccec, 0, 0, 1, f(Yes, true, "")},
- {0xcced, 0, 0, 2, f(Yes, false, "")},
- {0xcd08, 0, 0, 1, f(Yes, true, "")},
- {0xcd09, 0, 0, 2, f(Yes, false, "")},
- {0xcd24, 0, 0, 1, f(Yes, true, "")},
- {0xcd25, 0, 0, 2, f(Yes, false, "")},
- {0xcd40, 0, 0, 1, f(Yes, true, "")},
- {0xcd41, 0, 0, 2, f(Yes, false, "")},
- {0xcd5c, 0, 0, 1, f(Yes, true, "")},
- {0xcd5d, 0, 0, 2, f(Yes, false, "")},
- {0xcd78, 0, 0, 1, f(Yes, true, "")},
- {0xcd79, 0, 0, 2, f(Yes, false, "")},
- {0xcd94, 0, 0, 1, f(Yes, true, "")},
- {0xcd95, 0, 0, 2, f(Yes, false, "")},
- {0xcdb0, 0, 0, 1, f(Yes, true, "")},
- {0xcdb1, 0, 0, 2, f(Yes, false, "")},
- {0xcdcc, 0, 0, 1, f(Yes, true, "")},
- {0xcdcd, 0, 0, 2, f(Yes, false, "")},
- {0xcde8, 0, 0, 1, f(Yes, true, "")},
- {0xcde9, 0, 0, 2, f(Yes, false, "")},
- {0xce04, 0, 0, 1, f(Yes, true, "")},
- {0xce05, 0, 0, 2, f(Yes, false, "")},
- {0xce20, 0, 0, 1, f(Yes, true, "")},
- {0xce21, 0, 0, 2, f(Yes, false, "")},
- {0xce3c, 0, 0, 1, f(Yes, true, "")},
- {0xce3d, 0, 0, 2, f(Yes, false, "")},
- {0xce58, 0, 0, 1, f(Yes, true, "")},
- {0xce59, 0, 0, 2, f(Yes, false, "")},
- {0xce74, 0, 0, 1, f(Yes, true, "")},
- {0xce75, 0, 0, 2, f(Yes, false, "")},
- {0xce90, 0, 0, 1, f(Yes, true, "")},
- {0xce91, 0, 0, 2, f(Yes, false, "")},
- {0xceac, 0, 0, 1, f(Yes, true, "")},
- {0xcead, 0, 0, 2, f(Yes, false, "")},
- {0xcec8, 0, 0, 1, f(Yes, true, "")},
- {0xcec9, 0, 0, 2, f(Yes, false, "")},
- {0xcee4, 0, 0, 1, f(Yes, true, "")},
- {0xcee5, 0, 0, 2, f(Yes, false, "")},
- {0xcf00, 0, 0, 1, f(Yes, true, "")},
- {0xcf01, 0, 0, 2, f(Yes, false, "")},
- {0xcf1c, 0, 0, 1, f(Yes, true, "")},
- {0xcf1d, 0, 0, 2, f(Yes, false, "")},
- {0xcf38, 0, 0, 1, f(Yes, true, "")},
- {0xcf39, 0, 0, 2, f(Yes, false, "")},
- {0xcf54, 0, 0, 1, f(Yes, true, "")},
- {0xcf55, 0, 0, 2, f(Yes, false, "")},
- {0xcf70, 0, 0, 1, f(Yes, true, "")},
- {0xcf71, 0, 0, 2, f(Yes, false, "")},
- {0xcf8c, 0, 0, 1, f(Yes, true, "")},
- {0xcf8d, 0, 0, 2, f(Yes, false, "")},
- {0xcfa8, 0, 0, 1, f(Yes, true, "")},
- {0xcfa9, 0, 0, 2, f(Yes, false, "")},
- {0xcfc4, 0, 0, 1, f(Yes, true, "")},
- {0xcfc5, 0, 0, 2, f(Yes, false, "")},
- {0xcfe0, 0, 0, 1, f(Yes, true, "")},
- {0xcfe1, 0, 0, 2, f(Yes, false, "")},
- {0xcffc, 0, 0, 1, f(Yes, true, "")},
- {0xcffd, 0, 0, 2, f(Yes, false, "")},
- {0xd018, 0, 0, 1, f(Yes, true, "")},
- {0xd019, 0, 0, 2, f(Yes, false, "")},
- {0xd034, 0, 0, 1, f(Yes, true, "")},
- {0xd035, 0, 0, 2, f(Yes, false, "")},
- {0xd050, 0, 0, 1, f(Yes, true, "")},
- {0xd051, 0, 0, 2, f(Yes, false, "")},
- {0xd06c, 0, 0, 1, f(Yes, true, "")},
- {0xd06d, 0, 0, 2, f(Yes, false, "")},
- {0xd088, 0, 0, 1, f(Yes, true, "")},
- {0xd089, 0, 0, 2, f(Yes, false, "")},
- {0xd0a4, 0, 0, 1, f(Yes, true, "")},
- {0xd0a5, 0, 0, 2, f(Yes, false, "")},
- {0xd0c0, 0, 0, 1, f(Yes, true, "")},
- {0xd0c1, 0, 0, 2, f(Yes, false, "")},
- {0xd0dc, 0, 0, 1, f(Yes, true, "")},
- {0xd0dd, 0, 0, 2, f(Yes, false, "")},
- {0xd0f8, 0, 0, 1, f(Yes, true, "")},
- {0xd0f9, 0, 0, 2, f(Yes, false, "")},
- {0xd114, 0, 0, 1, f(Yes, true, "")},
- {0xd115, 0, 0, 2, f(Yes, false, "")},
- {0xd130, 0, 0, 1, f(Yes, true, "")},
- {0xd131, 0, 0, 2, f(Yes, false, "")},
- {0xd14c, 0, 0, 1, f(Yes, true, "")},
- {0xd14d, 0, 0, 2, f(Yes, false, "")},
- {0xd168, 0, 0, 1, f(Yes, true, "")},
- {0xd169, 0, 0, 2, f(Yes, false, "")},
- {0xd184, 0, 0, 1, f(Yes, true, "")},
- {0xd185, 0, 0, 2, f(Yes, false, "")},
- {0xd1a0, 0, 0, 1, f(Yes, true, "")},
- {0xd1a1, 0, 0, 2, f(Yes, false, "")},
- {0xd1bc, 0, 0, 1, f(Yes, true, "")},
- {0xd1bd, 0, 0, 2, f(Yes, false, "")},
- {0xd1d8, 0, 0, 1, f(Yes, true, "")},
- {0xd1d9, 0, 0, 2, f(Yes, false, "")},
- {0xd1f4, 0, 0, 1, f(Yes, true, "")},
- {0xd1f5, 0, 0, 2, f(Yes, false, "")},
- {0xd210, 0, 0, 1, f(Yes, true, "")},
- {0xd211, 0, 0, 2, f(Yes, false, "")},
- {0xd22c, 0, 0, 1, f(Yes, true, "")},
- {0xd22d, 0, 0, 2, f(Yes, false, "")},
- {0xd248, 0, 0, 1, f(Yes, true, "")},
- {0xd249, 0, 0, 2, f(Yes, false, "")},
- {0xd264, 0, 0, 1, f(Yes, true, "")},
- {0xd265, 0, 0, 2, f(Yes, false, "")},
- {0xd280, 0, 0, 1, f(Yes, true, "")},
- {0xd281, 0, 0, 2, f(Yes, false, "")},
- {0xd29c, 0, 0, 1, f(Yes, true, "")},
- {0xd29d, 0, 0, 2, f(Yes, false, "")},
- {0xd2b8, 0, 0, 1, f(Yes, true, "")},
- {0xd2b9, 0, 0, 2, f(Yes, false, "")},
- {0xd2d4, 0, 0, 1, f(Yes, true, "")},
- {0xd2d5, 0, 0, 2, f(Yes, false, "")},
- {0xd2f0, 0, 0, 1, f(Yes, true, "")},
- {0xd2f1, 0, 0, 2, f(Yes, false, "")},
- {0xd30c, 0, 0, 1, f(Yes, true, "")},
- {0xd30d, 0, 0, 2, f(Yes, false, "")},
- {0xd328, 0, 0, 1, f(Yes, true, "")},
- {0xd329, 0, 0, 2, f(Yes, false, "")},
- {0xd344, 0, 0, 1, f(Yes, true, "")},
- {0xd345, 0, 0, 2, f(Yes, false, "")},
- {0xd360, 0, 0, 1, f(Yes, true, "")},
- {0xd361, 0, 0, 2, f(Yes, false, "")},
- {0xd37c, 0, 0, 1, f(Yes, true, "")},
- {0xd37d, 0, 0, 2, f(Yes, false, "")},
- {0xd398, 0, 0, 1, f(Yes, true, "")},
- {0xd399, 0, 0, 2, f(Yes, false, "")},
- {0xd3b4, 0, 0, 1, f(Yes, true, "")},
- {0xd3b5, 0, 0, 2, f(Yes, false, "")},
- {0xd3d0, 0, 0, 1, f(Yes, true, "")},
- {0xd3d1, 0, 0, 2, f(Yes, false, "")},
- {0xd3ec, 0, 0, 1, f(Yes, true, "")},
- {0xd3ed, 0, 0, 2, f(Yes, false, "")},
- {0xd408, 0, 0, 1, f(Yes, true, "")},
- {0xd409, 0, 0, 2, f(Yes, false, "")},
- {0xd424, 0, 0, 1, f(Yes, true, "")},
- {0xd425, 0, 0, 2, f(Yes, false, "")},
- {0xd440, 0, 0, 1, f(Yes, true, "")},
- {0xd441, 0, 0, 2, f(Yes, false, "")},
- {0xd45c, 0, 0, 1, f(Yes, true, "")},
- {0xd45d, 0, 0, 2, f(Yes, false, "")},
- {0xd478, 0, 0, 1, f(Yes, true, "")},
- {0xd479, 0, 0, 2, f(Yes, false, "")},
- {0xd494, 0, 0, 1, f(Yes, true, "")},
- {0xd495, 0, 0, 2, f(Yes, false, "")},
- {0xd4b0, 0, 0, 1, f(Yes, true, "")},
- {0xd4b1, 0, 0, 2, f(Yes, false, "")},
- {0xd4cc, 0, 0, 1, f(Yes, true, "")},
- {0xd4cd, 0, 0, 2, f(Yes, false, "")},
- {0xd4e8, 0, 0, 1, f(Yes, true, "")},
- {0xd4e9, 0, 0, 2, f(Yes, false, "")},
- {0xd504, 0, 0, 1, f(Yes, true, "")},
- {0xd505, 0, 0, 2, f(Yes, false, "")},
- {0xd520, 0, 0, 1, f(Yes, true, "")},
- {0xd521, 0, 0, 2, f(Yes, false, "")},
- {0xd53c, 0, 0, 1, f(Yes, true, "")},
- {0xd53d, 0, 0, 2, f(Yes, false, "")},
- {0xd558, 0, 0, 1, f(Yes, true, "")},
- {0xd559, 0, 0, 2, f(Yes, false, "")},
- {0xd574, 0, 0, 1, f(Yes, true, "")},
- {0xd575, 0, 0, 2, f(Yes, false, "")},
- {0xd590, 0, 0, 1, f(Yes, true, "")},
- {0xd591, 0, 0, 2, f(Yes, false, "")},
- {0xd5ac, 0, 0, 1, f(Yes, true, "")},
- {0xd5ad, 0, 0, 2, f(Yes, false, "")},
- {0xd5c8, 0, 0, 1, f(Yes, true, "")},
- {0xd5c9, 0, 0, 2, f(Yes, false, "")},
- {0xd5e4, 0, 0, 1, f(Yes, true, "")},
- {0xd5e5, 0, 0, 2, f(Yes, false, "")},
- {0xd600, 0, 0, 1, f(Yes, true, "")},
- {0xd601, 0, 0, 2, f(Yes, false, "")},
- {0xd61c, 0, 0, 1, f(Yes, true, "")},
- {0xd61d, 0, 0, 2, f(Yes, false, "")},
- {0xd638, 0, 0, 1, f(Yes, true, "")},
- {0xd639, 0, 0, 2, f(Yes, false, "")},
- {0xd654, 0, 0, 1, f(Yes, true, "")},
- {0xd655, 0, 0, 2, f(Yes, false, "")},
- {0xd670, 0, 0, 1, f(Yes, true, "")},
- {0xd671, 0, 0, 2, f(Yes, false, "")},
- {0xd68c, 0, 0, 1, f(Yes, true, "")},
- {0xd68d, 0, 0, 2, f(Yes, false, "")},
- {0xd6a8, 0, 0, 1, f(Yes, true, "")},
- {0xd6a9, 0, 0, 2, f(Yes, false, "")},
- {0xd6c4, 0, 0, 1, f(Yes, true, "")},
- {0xd6c5, 0, 0, 2, f(Yes, false, "")},
- {0xd6e0, 0, 0, 1, f(Yes, true, "")},
- {0xd6e1, 0, 0, 2, f(Yes, false, "")},
- {0xd6fc, 0, 0, 1, f(Yes, true, "")},
- {0xd6fd, 0, 0, 2, f(Yes, false, "")},
- {0xd718, 0, 0, 1, f(Yes, true, "")},
- {0xd719, 0, 0, 2, f(Yes, false, "")},
- {0xd734, 0, 0, 1, f(Yes, true, "")},
- {0xd735, 0, 0, 2, f(Yes, false, "")},
- {0xd750, 0, 0, 1, f(Yes, true, "")},
- {0xd751, 0, 0, 2, f(Yes, false, "")},
- {0xd76c, 0, 0, 1, f(Yes, true, "")},
- {0xd76d, 0, 0, 2, f(Yes, false, "")},
- {0xd788, 0, 0, 1, f(Yes, true, "")},
- {0xd789, 0, 0, 2, f(Yes, false, "")},
- {0xd7a4, 0, 0, 0, f(Yes, false, "")},
- {0xf900, 0, 0, 0, f(No, false, "豈")},
- {0xf901, 0, 0, 0, f(No, false, "更")},
- {0xf902, 0, 0, 0, f(No, false, "車")},
- {0xf903, 0, 0, 0, f(No, false, "賈")},
- {0xf904, 0, 0, 0, f(No, false, "滑")},
- {0xf905, 0, 0, 0, f(No, false, "串")},
- {0xf906, 0, 0, 0, f(No, false, "句")},
- {0xf907, 0, 0, 0, f(No, false, "龜")},
- {0xf909, 0, 0, 0, f(No, false, "契")},
- {0xf90a, 0, 0, 0, f(No, false, "金")},
- {0xf90b, 0, 0, 0, f(No, false, "喇")},
- {0xf90c, 0, 0, 0, f(No, false, "奈")},
- {0xf90d, 0, 0, 0, f(No, false, "懶")},
- {0xf90e, 0, 0, 0, f(No, false, "癩")},
- {0xf90f, 0, 0, 0, f(No, false, "羅")},
- {0xf910, 0, 0, 0, f(No, false, "蘿")},
- {0xf911, 0, 0, 0, f(No, false, "螺")},
- {0xf912, 0, 0, 0, f(No, false, "裸")},
- {0xf913, 0, 0, 0, f(No, false, "邏")},
- {0xf914, 0, 0, 0, f(No, false, "樂")},
- {0xf915, 0, 0, 0, f(No, false, "洛")},
- {0xf916, 0, 0, 0, f(No, false, "烙")},
- {0xf917, 0, 0, 0, f(No, false, "珞")},
- {0xf918, 0, 0, 0, f(No, false, "落")},
- {0xf919, 0, 0, 0, f(No, false, "酪")},
- {0xf91a, 0, 0, 0, f(No, false, "駱")},
- {0xf91b, 0, 0, 0, f(No, false, "亂")},
- {0xf91c, 0, 0, 0, f(No, false, "卵")},
- {0xf91d, 0, 0, 0, f(No, false, "欄")},
- {0xf91e, 0, 0, 0, f(No, false, "爛")},
- {0xf91f, 0, 0, 0, f(No, false, "蘭")},
- {0xf920, 0, 0, 0, f(No, false, "鸞")},
- {0xf921, 0, 0, 0, f(No, false, "嵐")},
- {0xf922, 0, 0, 0, f(No, false, "濫")},
- {0xf923, 0, 0, 0, f(No, false, "藍")},
- {0xf924, 0, 0, 0, f(No, false, "襤")},
- {0xf925, 0, 0, 0, f(No, false, "拉")},
- {0xf926, 0, 0, 0, f(No, false, "臘")},
- {0xf927, 0, 0, 0, f(No, false, "蠟")},
- {0xf928, 0, 0, 0, f(No, false, "廊")},
- {0xf929, 0, 0, 0, f(No, false, "朗")},
- {0xf92a, 0, 0, 0, f(No, false, "浪")},
- {0xf92b, 0, 0, 0, f(No, false, "狼")},
- {0xf92c, 0, 0, 0, f(No, false, "郎")},
- {0xf92d, 0, 0, 0, f(No, false, "來")},
- {0xf92e, 0, 0, 0, f(No, false, "冷")},
- {0xf92f, 0, 0, 0, f(No, false, "勞")},
- {0xf930, 0, 0, 0, f(No, false, "擄")},
- {0xf931, 0, 0, 0, f(No, false, "櫓")},
- {0xf932, 0, 0, 0, f(No, false, "爐")},
- {0xf933, 0, 0, 0, f(No, false, "盧")},
- {0xf934, 0, 0, 0, f(No, false, "老")},
- {0xf935, 0, 0, 0, f(No, false, "蘆")},
- {0xf936, 0, 0, 0, f(No, false, "虜")},
- {0xf937, 0, 0, 0, f(No, false, "路")},
- {0xf938, 0, 0, 0, f(No, false, "露")},
- {0xf939, 0, 0, 0, f(No, false, "魯")},
- {0xf93a, 0, 0, 0, f(No, false, "鷺")},
- {0xf93b, 0, 0, 0, f(No, false, "碌")},
- {0xf93c, 0, 0, 0, f(No, false, "祿")},
- {0xf93d, 0, 0, 0, f(No, false, "綠")},
- {0xf93e, 0, 0, 0, f(No, false, "菉")},
- {0xf93f, 0, 0, 0, f(No, false, "錄")},
- {0xf940, 0, 0, 0, f(No, false, "鹿")},
- {0xf941, 0, 0, 0, f(No, false, "論")},
- {0xf942, 0, 0, 0, f(No, false, "壟")},
- {0xf943, 0, 0, 0, f(No, false, "弄")},
- {0xf944, 0, 0, 0, f(No, false, "籠")},
- {0xf945, 0, 0, 0, f(No, false, "聾")},
- {0xf946, 0, 0, 0, f(No, false, "牢")},
- {0xf947, 0, 0, 0, f(No, false, "磊")},
- {0xf948, 0, 0, 0, f(No, false, "賂")},
- {0xf949, 0, 0, 0, f(No, false, "雷")},
- {0xf94a, 0, 0, 0, f(No, false, "壘")},
- {0xf94b, 0, 0, 0, f(No, false, "屢")},
- {0xf94c, 0, 0, 0, f(No, false, "樓")},
- {0xf94d, 0, 0, 0, f(No, false, "淚")},
- {0xf94e, 0, 0, 0, f(No, false, "漏")},
- {0xf94f, 0, 0, 0, f(No, false, "累")},
- {0xf950, 0, 0, 0, f(No, false, "縷")},
- {0xf951, 0, 0, 0, f(No, false, "陋")},
- {0xf952, 0, 0, 0, f(No, false, "勒")},
- {0xf953, 0, 0, 0, f(No, false, "肋")},
- {0xf954, 0, 0, 0, f(No, false, "凜")},
- {0xf955, 0, 0, 0, f(No, false, "凌")},
- {0xf956, 0, 0, 0, f(No, false, "稜")},
- {0xf957, 0, 0, 0, f(No, false, "綾")},
- {0xf958, 0, 0, 0, f(No, false, "菱")},
- {0xf959, 0, 0, 0, f(No, false, "陵")},
- {0xf95a, 0, 0, 0, f(No, false, "讀")},
- {0xf95b, 0, 0, 0, f(No, false, "拏")},
- {0xf95c, 0, 0, 0, f(No, false, "樂")},
- {0xf95d, 0, 0, 0, f(No, false, "諾")},
- {0xf95e, 0, 0, 0, f(No, false, "丹")},
- {0xf95f, 0, 0, 0, f(No, false, "寧")},
- {0xf960, 0, 0, 0, f(No, false, "怒")},
- {0xf961, 0, 0, 0, f(No, false, "率")},
- {0xf962, 0, 0, 0, f(No, false, "異")},
- {0xf963, 0, 0, 0, f(No, false, "北")},
- {0xf964, 0, 0, 0, f(No, false, "磻")},
- {0xf965, 0, 0, 0, f(No, false, "便")},
- {0xf966, 0, 0, 0, f(No, false, "復")},
- {0xf967, 0, 0, 0, f(No, false, "不")},
- {0xf968, 0, 0, 0, f(No, false, "泌")},
- {0xf969, 0, 0, 0, f(No, false, "數")},
- {0xf96a, 0, 0, 0, f(No, false, "索")},
- {0xf96b, 0, 0, 0, f(No, false, "參")},
- {0xf96c, 0, 0, 0, f(No, false, "塞")},
- {0xf96d, 0, 0, 0, f(No, false, "省")},
- {0xf96e, 0, 0, 0, f(No, false, "葉")},
- {0xf96f, 0, 0, 0, f(No, false, "說")},
- {0xf970, 0, 0, 0, f(No, false, "殺")},
- {0xf971, 0, 0, 0, f(No, false, "辰")},
- {0xf972, 0, 0, 0, f(No, false, "沈")},
- {0xf973, 0, 0, 0, f(No, false, "拾")},
- {0xf974, 0, 0, 0, f(No, false, "若")},
- {0xf975, 0, 0, 0, f(No, false, "掠")},
- {0xf976, 0, 0, 0, f(No, false, "略")},
- {0xf977, 0, 0, 0, f(No, false, "亮")},
- {0xf978, 0, 0, 0, f(No, false, "兩")},
- {0xf979, 0, 0, 0, f(No, false, "凉")},
- {0xf97a, 0, 0, 0, f(No, false, "梁")},
- {0xf97b, 0, 0, 0, f(No, false, "糧")},
- {0xf97c, 0, 0, 0, f(No, false, "良")},
- {0xf97d, 0, 0, 0, f(No, false, "諒")},
- {0xf97e, 0, 0, 0, f(No, false, "量")},
- {0xf97f, 0, 0, 0, f(No, false, "勵")},
- {0xf980, 0, 0, 0, f(No, false, "呂")},
- {0xf981, 0, 0, 0, f(No, false, "女")},
- {0xf982, 0, 0, 0, f(No, false, "廬")},
- {0xf983, 0, 0, 0, f(No, false, "旅")},
- {0xf984, 0, 0, 0, f(No, false, "濾")},
- {0xf985, 0, 0, 0, f(No, false, "礪")},
- {0xf986, 0, 0, 0, f(No, false, "閭")},
- {0xf987, 0, 0, 0, f(No, false, "驪")},
- {0xf988, 0, 0, 0, f(No, false, "麗")},
- {0xf989, 0, 0, 0, f(No, false, "黎")},
- {0xf98a, 0, 0, 0, f(No, false, "力")},
- {0xf98b, 0, 0, 0, f(No, false, "曆")},
- {0xf98c, 0, 0, 0, f(No, false, "歷")},
- {0xf98d, 0, 0, 0, f(No, false, "轢")},
- {0xf98e, 0, 0, 0, f(No, false, "年")},
- {0xf98f, 0, 0, 0, f(No, false, "憐")},
- {0xf990, 0, 0, 0, f(No, false, "戀")},
- {0xf991, 0, 0, 0, f(No, false, "撚")},
- {0xf992, 0, 0, 0, f(No, false, "漣")},
- {0xf993, 0, 0, 0, f(No, false, "煉")},
- {0xf994, 0, 0, 0, f(No, false, "璉")},
- {0xf995, 0, 0, 0, f(No, false, "秊")},
- {0xf996, 0, 0, 0, f(No, false, "練")},
- {0xf997, 0, 0, 0, f(No, false, "聯")},
- {0xf998, 0, 0, 0, f(No, false, "輦")},
- {0xf999, 0, 0, 0, f(No, false, "蓮")},
- {0xf99a, 0, 0, 0, f(No, false, "連")},
- {0xf99b, 0, 0, 0, f(No, false, "鍊")},
- {0xf99c, 0, 0, 0, f(No, false, "列")},
- {0xf99d, 0, 0, 0, f(No, false, "劣")},
- {0xf99e, 0, 0, 0, f(No, false, "咽")},
- {0xf99f, 0, 0, 0, f(No, false, "烈")},
- {0xf9a0, 0, 0, 0, f(No, false, "裂")},
- {0xf9a1, 0, 0, 0, f(No, false, "說")},
- {0xf9a2, 0, 0, 0, f(No, false, "廉")},
- {0xf9a3, 0, 0, 0, f(No, false, "念")},
- {0xf9a4, 0, 0, 0, f(No, false, "捻")},
- {0xf9a5, 0, 0, 0, f(No, false, "殮")},
- {0xf9a6, 0, 0, 0, f(No, false, "簾")},
- {0xf9a7, 0, 0, 0, f(No, false, "獵")},
- {0xf9a8, 0, 0, 0, f(No, false, "令")},
- {0xf9a9, 0, 0, 0, f(No, false, "囹")},
- {0xf9aa, 0, 0, 0, f(No, false, "寧")},
- {0xf9ab, 0, 0, 0, f(No, false, "嶺")},
- {0xf9ac, 0, 0, 0, f(No, false, "怜")},
- {0xf9ad, 0, 0, 0, f(No, false, "玲")},
- {0xf9ae, 0, 0, 0, f(No, false, "瑩")},
- {0xf9af, 0, 0, 0, f(No, false, "羚")},
- {0xf9b0, 0, 0, 0, f(No, false, "聆")},
- {0xf9b1, 0, 0, 0, f(No, false, "鈴")},
- {0xf9b2, 0, 0, 0, f(No, false, "零")},
- {0xf9b3, 0, 0, 0, f(No, false, "靈")},
- {0xf9b4, 0, 0, 0, f(No, false, "領")},
- {0xf9b5, 0, 0, 0, f(No, false, "例")},
- {0xf9b6, 0, 0, 0, f(No, false, "禮")},
- {0xf9b7, 0, 0, 0, f(No, false, "醴")},
- {0xf9b8, 0, 0, 0, f(No, false, "隸")},
- {0xf9b9, 0, 0, 0, f(No, false, "惡")},
- {0xf9ba, 0, 0, 0, f(No, false, "了")},
- {0xf9bb, 0, 0, 0, f(No, false, "僚")},
- {0xf9bc, 0, 0, 0, f(No, false, "寮")},
- {0xf9bd, 0, 0, 0, f(No, false, "尿")},
- {0xf9be, 0, 0, 0, f(No, false, "料")},
- {0xf9bf, 0, 0, 0, f(No, false, "樂")},
- {0xf9c0, 0, 0, 0, f(No, false, "燎")},
- {0xf9c1, 0, 0, 0, f(No, false, "療")},
- {0xf9c2, 0, 0, 0, f(No, false, "蓼")},
- {0xf9c3, 0, 0, 0, f(No, false, "遼")},
- {0xf9c4, 0, 0, 0, f(No, false, "龍")},
- {0xf9c5, 0, 0, 0, f(No, false, "暈")},
- {0xf9c6, 0, 0, 0, f(No, false, "阮")},
- {0xf9c7, 0, 0, 0, f(No, false, "劉")},
- {0xf9c8, 0, 0, 0, f(No, false, "杻")},
- {0xf9c9, 0, 0, 0, f(No, false, "柳")},
- {0xf9ca, 0, 0, 0, f(No, false, "流")},
- {0xf9cb, 0, 0, 0, f(No, false, "溜")},
- {0xf9cc, 0, 0, 0, f(No, false, "琉")},
- {0xf9cd, 0, 0, 0, f(No, false, "留")},
- {0xf9ce, 0, 0, 0, f(No, false, "硫")},
- {0xf9cf, 0, 0, 0, f(No, false, "紐")},
- {0xf9d0, 0, 0, 0, f(No, false, "類")},
- {0xf9d1, 0, 0, 0, f(No, false, "六")},
- {0xf9d2, 0, 0, 0, f(No, false, "戮")},
- {0xf9d3, 0, 0, 0, f(No, false, "陸")},
- {0xf9d4, 0, 0, 0, f(No, false, "倫")},
- {0xf9d5, 0, 0, 0, f(No, false, "崙")},
- {0xf9d6, 0, 0, 0, f(No, false, "淪")},
- {0xf9d7, 0, 0, 0, f(No, false, "輪")},
- {0xf9d8, 0, 0, 0, f(No, false, "律")},
- {0xf9d9, 0, 0, 0, f(No, false, "慄")},
- {0xf9da, 0, 0, 0, f(No, false, "栗")},
- {0xf9db, 0, 0, 0, f(No, false, "率")},
- {0xf9dc, 0, 0, 0, f(No, false, "隆")},
- {0xf9dd, 0, 0, 0, f(No, false, "利")},
- {0xf9de, 0, 0, 0, f(No, false, "吏")},
- {0xf9df, 0, 0, 0, f(No, false, "履")},
- {0xf9e0, 0, 0, 0, f(No, false, "易")},
- {0xf9e1, 0, 0, 0, f(No, false, "李")},
- {0xf9e2, 0, 0, 0, f(No, false, "梨")},
- {0xf9e3, 0, 0, 0, f(No, false, "泥")},
- {0xf9e4, 0, 0, 0, f(No, false, "理")},
- {0xf9e5, 0, 0, 0, f(No, false, "痢")},
- {0xf9e6, 0, 0, 0, f(No, false, "罹")},
- {0xf9e7, 0, 0, 0, f(No, false, "裏")},
- {0xf9e8, 0, 0, 0, f(No, false, "裡")},
- {0xf9e9, 0, 0, 0, f(No, false, "里")},
- {0xf9ea, 0, 0, 0, f(No, false, "離")},
- {0xf9eb, 0, 0, 0, f(No, false, "匿")},
- {0xf9ec, 0, 0, 0, f(No, false, "溺")},
- {0xf9ed, 0, 0, 0, f(No, false, "吝")},
- {0xf9ee, 0, 0, 0, f(No, false, "燐")},
- {0xf9ef, 0, 0, 0, f(No, false, "璘")},
- {0xf9f0, 0, 0, 0, f(No, false, "藺")},
- {0xf9f1, 0, 0, 0, f(No, false, "隣")},
- {0xf9f2, 0, 0, 0, f(No, false, "鱗")},
- {0xf9f3, 0, 0, 0, f(No, false, "麟")},
- {0xf9f4, 0, 0, 0, f(No, false, "林")},
- {0xf9f5, 0, 0, 0, f(No, false, "淋")},
- {0xf9f6, 0, 0, 0, f(No, false, "臨")},
- {0xf9f7, 0, 0, 0, f(No, false, "立")},
- {0xf9f8, 0, 0, 0, f(No, false, "笠")},
- {0xf9f9, 0, 0, 0, f(No, false, "粒")},
- {0xf9fa, 0, 0, 0, f(No, false, "狀")},
- {0xf9fb, 0, 0, 0, f(No, false, "炙")},
- {0xf9fc, 0, 0, 0, f(No, false, "識")},
- {0xf9fd, 0, 0, 0, f(No, false, "什")},
- {0xf9fe, 0, 0, 0, f(No, false, "茶")},
- {0xf9ff, 0, 0, 0, f(No, false, "刺")},
- {0xfa00, 0, 0, 0, f(No, false, "切")},
- {0xfa01, 0, 0, 0, f(No, false, "度")},
- {0xfa02, 0, 0, 0, f(No, false, "拓")},
- {0xfa03, 0, 0, 0, f(No, false, "糖")},
- {0xfa04, 0, 0, 0, f(No, false, "宅")},
- {0xfa05, 0, 0, 0, f(No, false, "洞")},
- {0xfa06, 0, 0, 0, f(No, false, "暴")},
- {0xfa07, 0, 0, 0, f(No, false, "輻")},
- {0xfa08, 0, 0, 0, f(No, false, "行")},
- {0xfa09, 0, 0, 0, f(No, false, "降")},
- {0xfa0a, 0, 0, 0, f(No, false, "見")},
- {0xfa0b, 0, 0, 0, f(No, false, "廓")},
- {0xfa0c, 0, 0, 0, f(No, false, "兀")},
- {0xfa0d, 0, 0, 0, f(No, false, "嗀")},
- {0xfa0e, 0, 0, 0, f(Yes, false, "")},
- {0xfa10, 0, 0, 0, f(No, false, "塚")},
- {0xfa11, 0, 0, 0, f(Yes, false, "")},
- {0xfa12, 0, 0, 0, f(No, false, "晴")},
- {0xfa13, 0, 0, 0, f(Yes, false, "")},
- {0xfa15, 0, 0, 0, f(No, false, "凞")},
- {0xfa16, 0, 0, 0, f(No, false, "猪")},
- {0xfa17, 0, 0, 0, f(No, false, "益")},
- {0xfa18, 0, 0, 0, f(No, false, "礼")},
- {0xfa19, 0, 0, 0, f(No, false, "神")},
- {0xfa1a, 0, 0, 0, f(No, false, "祥")},
- {0xfa1b, 0, 0, 0, f(No, false, "福")},
- {0xfa1c, 0, 0, 0, f(No, false, "靖")},
- {0xfa1d, 0, 0, 0, f(No, false, "精")},
- {0xfa1e, 0, 0, 0, f(No, false, "羽")},
- {0xfa1f, 0, 0, 0, f(Yes, false, "")},
- {0xfa20, 0, 0, 0, f(No, false, "蘒")},
- {0xfa21, 0, 0, 0, f(Yes, false, "")},
- {0xfa22, 0, 0, 0, f(No, false, "諸")},
- {0xfa23, 0, 0, 0, f(Yes, false, "")},
- {0xfa25, 0, 0, 0, f(No, false, "逸")},
- {0xfa26, 0, 0, 0, f(No, false, "都")},
- {0xfa27, 0, 0, 0, f(Yes, false, "")},
- {0xfa2a, 0, 0, 0, f(No, false, "飯")},
- {0xfa2b, 0, 0, 0, f(No, false, "飼")},
- {0xfa2c, 0, 0, 0, f(No, false, "館")},
- {0xfa2d, 0, 0, 0, f(No, false, "鶴")},
- {0xfa2e, 0, 0, 0, f(No, false, "郞")},
- {0xfa2f, 0, 0, 0, f(No, false, "隷")},
- {0xfa30, 0, 0, 0, f(No, false, "侮")},
- {0xfa31, 0, 0, 0, f(No, false, "僧")},
- {0xfa32, 0, 0, 0, f(No, false, "免")},
- {0xfa33, 0, 0, 0, f(No, false, "勉")},
- {0xfa34, 0, 0, 0, f(No, false, "勤")},
- {0xfa35, 0, 0, 0, f(No, false, "卑")},
- {0xfa36, 0, 0, 0, f(No, false, "喝")},
- {0xfa37, 0, 0, 0, f(No, false, "嘆")},
- {0xfa38, 0, 0, 0, f(No, false, "器")},
- {0xfa39, 0, 0, 0, f(No, false, "塀")},
- {0xfa3a, 0, 0, 0, f(No, false, "墨")},
- {0xfa3b, 0, 0, 0, f(No, false, "層")},
- {0xfa3c, 0, 0, 0, f(No, false, "屮")},
- {0xfa3d, 0, 0, 0, f(No, false, "悔")},
- {0xfa3e, 0, 0, 0, f(No, false, "慨")},
- {0xfa3f, 0, 0, 0, f(No, false, "憎")},
- {0xfa40, 0, 0, 0, f(No, false, "懲")},
- {0xfa41, 0, 0, 0, f(No, false, "敏")},
- {0xfa42, 0, 0, 0, f(No, false, "既")},
- {0xfa43, 0, 0, 0, f(No, false, "暑")},
- {0xfa44, 0, 0, 0, f(No, false, "梅")},
- {0xfa45, 0, 0, 0, f(No, false, "海")},
- {0xfa46, 0, 0, 0, f(No, false, "渚")},
- {0xfa47, 0, 0, 0, f(No, false, "漢")},
- {0xfa48, 0, 0, 0, f(No, false, "煮")},
- {0xfa49, 0, 0, 0, f(No, false, "爫")},
- {0xfa4a, 0, 0, 0, f(No, false, "琢")},
- {0xfa4b, 0, 0, 0, f(No, false, "碑")},
- {0xfa4c, 0, 0, 0, f(No, false, "社")},
- {0xfa4d, 0, 0, 0, f(No, false, "祉")},
- {0xfa4e, 0, 0, 0, f(No, false, "祈")},
- {0xfa4f, 0, 0, 0, f(No, false, "祐")},
- {0xfa50, 0, 0, 0, f(No, false, "祖")},
- {0xfa51, 0, 0, 0, f(No, false, "祝")},
- {0xfa52, 0, 0, 0, f(No, false, "禍")},
- {0xfa53, 0, 0, 0, f(No, false, "禎")},
- {0xfa54, 0, 0, 0, f(No, false, "穀")},
- {0xfa55, 0, 0, 0, f(No, false, "突")},
- {0xfa56, 0, 0, 0, f(No, false, "節")},
- {0xfa57, 0, 0, 0, f(No, false, "練")},
- {0xfa58, 0, 0, 0, f(No, false, "縉")},
- {0xfa59, 0, 0, 0, f(No, false, "繁")},
- {0xfa5a, 0, 0, 0, f(No, false, "署")},
- {0xfa5b, 0, 0, 0, f(No, false, "者")},
- {0xfa5c, 0, 0, 0, f(No, false, "臭")},
- {0xfa5d, 0, 0, 0, f(No, false, "艹")},
- {0xfa5f, 0, 0, 0, f(No, false, "著")},
- {0xfa60, 0, 0, 0, f(No, false, "褐")},
- {0xfa61, 0, 0, 0, f(No, false, "視")},
- {0xfa62, 0, 0, 0, f(No, false, "謁")},
- {0xfa63, 0, 0, 0, f(No, false, "謹")},
- {0xfa64, 0, 0, 0, f(No, false, "賓")},
- {0xfa65, 0, 0, 0, f(No, false, "贈")},
- {0xfa66, 0, 0, 0, f(No, false, "辶")},
- {0xfa67, 0, 0, 0, f(No, false, "逸")},
- {0xfa68, 0, 0, 0, f(No, false, "難")},
- {0xfa69, 0, 0, 0, f(No, false, "響")},
- {0xfa6a, 0, 0, 0, f(No, false, "頻")},
- {0xfa6b, 0, 0, 0, f(No, false, "恵")},
- {0xfa6c, 0, 0, 0, f(No, false, "𤋮")},
- {0xfa6d, 0, 0, 0, f(No, false, "舘")},
- {0xfa6e, 0, 0, 0, f(Yes, false, "")},
- {0xfa70, 0, 0, 0, f(No, false, "並")},
- {0xfa71, 0, 0, 0, f(No, false, "况")},
- {0xfa72, 0, 0, 0, f(No, false, "全")},
- {0xfa73, 0, 0, 0, f(No, false, "侀")},
- {0xfa74, 0, 0, 0, f(No, false, "充")},
- {0xfa75, 0, 0, 0, f(No, false, "冀")},
- {0xfa76, 0, 0, 0, f(No, false, "勇")},
- {0xfa77, 0, 0, 0, f(No, false, "勺")},
- {0xfa78, 0, 0, 0, f(No, false, "喝")},
- {0xfa79, 0, 0, 0, f(No, false, "啕")},
- {0xfa7a, 0, 0, 0, f(No, false, "喙")},
- {0xfa7b, 0, 0, 0, f(No, false, "嗢")},
- {0xfa7c, 0, 0, 0, f(No, false, "塚")},
- {0xfa7d, 0, 0, 0, f(No, false, "墳")},
- {0xfa7e, 0, 0, 0, f(No, false, "奄")},
- {0xfa7f, 0, 0, 0, f(No, false, "奔")},
- {0xfa80, 0, 0, 0, f(No, false, "婢")},
- {0xfa81, 0, 0, 0, f(No, false, "嬨")},
- {0xfa82, 0, 0, 0, f(No, false, "廒")},
- {0xfa83, 0, 0, 0, f(No, false, "廙")},
- {0xfa84, 0, 0, 0, f(No, false, "彩")},
- {0xfa85, 0, 0, 0, f(No, false, "徭")},
- {0xfa86, 0, 0, 0, f(No, false, "惘")},
- {0xfa87, 0, 0, 0, f(No, false, "慎")},
- {0xfa88, 0, 0, 0, f(No, false, "愈")},
- {0xfa89, 0, 0, 0, f(No, false, "憎")},
- {0xfa8a, 0, 0, 0, f(No, false, "慠")},
- {0xfa8b, 0, 0, 0, f(No, false, "懲")},
- {0xfa8c, 0, 0, 0, f(No, false, "戴")},
- {0xfa8d, 0, 0, 0, f(No, false, "揄")},
- {0xfa8e, 0, 0, 0, f(No, false, "搜")},
- {0xfa8f, 0, 0, 0, f(No, false, "摒")},
- {0xfa90, 0, 0, 0, f(No, false, "敖")},
- {0xfa91, 0, 0, 0, f(No, false, "晴")},
- {0xfa92, 0, 0, 0, f(No, false, "朗")},
- {0xfa93, 0, 0, 0, f(No, false, "望")},
- {0xfa94, 0, 0, 0, f(No, false, "杖")},
- {0xfa95, 0, 0, 0, f(No, false, "歹")},
- {0xfa96, 0, 0, 0, f(No, false, "殺")},
- {0xfa97, 0, 0, 0, f(No, false, "流")},
- {0xfa98, 0, 0, 0, f(No, false, "滛")},
- {0xfa99, 0, 0, 0, f(No, false, "滋")},
- {0xfa9a, 0, 0, 0, f(No, false, "漢")},
- {0xfa9b, 0, 0, 0, f(No, false, "瀞")},
- {0xfa9c, 0, 0, 0, f(No, false, "煮")},
- {0xfa9d, 0, 0, 0, f(No, false, "瞧")},
- {0xfa9e, 0, 0, 0, f(No, false, "爵")},
- {0xfa9f, 0, 0, 0, f(No, false, "犯")},
- {0xfaa0, 0, 0, 0, f(No, false, "猪")},
- {0xfaa1, 0, 0, 0, f(No, false, "瑱")},
- {0xfaa2, 0, 0, 0, f(No, false, "甆")},
- {0xfaa3, 0, 0, 0, f(No, false, "画")},
- {0xfaa4, 0, 0, 0, f(No, false, "瘝")},
- {0xfaa5, 0, 0, 0, f(No, false, "瘟")},
- {0xfaa6, 0, 0, 0, f(No, false, "益")},
- {0xfaa7, 0, 0, 0, f(No, false, "盛")},
- {0xfaa8, 0, 0, 0, f(No, false, "直")},
- {0xfaa9, 0, 0, 0, f(No, false, "睊")},
- {0xfaaa, 0, 0, 0, f(No, false, "着")},
- {0xfaab, 0, 0, 0, f(No, false, "磌")},
- {0xfaac, 0, 0, 0, f(No, false, "窱")},
- {0xfaad, 0, 0, 0, f(No, false, "節")},
- {0xfaae, 0, 0, 0, f(No, false, "类")},
- {0xfaaf, 0, 0, 0, f(No, false, "絛")},
- {0xfab0, 0, 0, 0, f(No, false, "練")},
- {0xfab1, 0, 0, 0, f(No, false, "缾")},
- {0xfab2, 0, 0, 0, f(No, false, "者")},
- {0xfab3, 0, 0, 0, f(No, false, "荒")},
- {0xfab4, 0, 0, 0, f(No, false, "華")},
- {0xfab5, 0, 0, 0, f(No, false, "蝹")},
- {0xfab6, 0, 0, 0, f(No, false, "襁")},
- {0xfab7, 0, 0, 0, f(No, false, "覆")},
- {0xfab8, 0, 0, 0, f(No, false, "視")},
- {0xfab9, 0, 0, 0, f(No, false, "調")},
- {0xfaba, 0, 0, 0, f(No, false, "諸")},
- {0xfabb, 0, 0, 0, f(No, false, "請")},
- {0xfabc, 0, 0, 0, f(No, false, "謁")},
- {0xfabd, 0, 0, 0, f(No, false, "諾")},
- {0xfabe, 0, 0, 0, f(No, false, "諭")},
- {0xfabf, 0, 0, 0, f(No, false, "謹")},
- {0xfac0, 0, 0, 0, f(No, false, "變")},
- {0xfac1, 0, 0, 0, f(No, false, "贈")},
- {0xfac2, 0, 0, 0, f(No, false, "輸")},
- {0xfac3, 0, 0, 0, f(No, false, "遲")},
- {0xfac4, 0, 0, 0, f(No, false, "醙")},
- {0xfac5, 0, 0, 0, f(No, false, "鉶")},
- {0xfac6, 0, 0, 0, f(No, false, "陼")},
- {0xfac7, 0, 0, 0, f(No, false, "難")},
- {0xfac8, 0, 0, 0, f(No, false, "靖")},
- {0xfac9, 0, 0, 0, f(No, false, "韛")},
- {0xfaca, 0, 0, 0, f(No, false, "響")},
- {0xfacb, 0, 0, 0, f(No, false, "頋")},
- {0xfacc, 0, 0, 0, f(No, false, "頻")},
- {0xfacd, 0, 0, 0, f(No, false, "鬒")},
- {0xface, 0, 0, 0, f(No, false, "龜")},
- {0xfacf, 0, 0, 0, f(No, false, "𢡊")},
- {0xfad0, 0, 0, 0, f(No, false, "𢡄")},
- {0xfad1, 0, 0, 0, f(No, false, "𣏕")},
- {0xfad2, 0, 0, 0, f(No, false, "㮝")},
- {0xfad3, 0, 0, 0, f(No, false, "䀘")},
- {0xfad4, 0, 0, 0, f(No, false, "䀹")},
- {0xfad5, 0, 0, 0, f(No, false, "𥉉")},
- {0xfad6, 0, 0, 0, f(No, false, "𥳐")},
- {0xfad7, 0, 0, 0, f(No, false, "𧻓")},
- {0xfad8, 0, 0, 0, f(No, false, "齃")},
- {0xfad9, 0, 0, 0, f(No, false, "龎")},
- {0xfada, 0, 0, 0, f(Yes, false, "")},
- {0xfb00, 0, 0, 0, g(Yes, No, false, false, "", "ff")},
- {0xfb01, 0, 0, 0, g(Yes, No, false, false, "", "fi")},
- {0xfb02, 0, 0, 0, g(Yes, No, false, false, "", "fl")},
- {0xfb03, 0, 0, 0, g(Yes, No, false, false, "", "ffi")},
- {0xfb04, 0, 0, 0, g(Yes, No, false, false, "", "ffl")},
- {0xfb05, 0, 0, 0, g(Yes, No, false, false, "", "st")},
- {0xfb07, 0, 0, 0, f(Yes, false, "")},
- {0xfb13, 0, 0, 0, g(Yes, No, false, false, "", "մն")},
- {0xfb14, 0, 0, 0, g(Yes, No, false, false, "", "մե")},
- {0xfb15, 0, 0, 0, g(Yes, No, false, false, "", "մի")},
- {0xfb16, 0, 0, 0, g(Yes, No, false, false, "", "վն")},
- {0xfb17, 0, 0, 0, g(Yes, No, false, false, "", "մխ")},
- {0xfb18, 0, 0, 0, f(Yes, false, "")},
- {0xfb1d, 0, 0, 1, f(No, false, "יִ")},
- {0xfb1e, 26, 1, 1, f(Yes, false, "")},
- {0xfb1f, 0, 0, 1, f(No, false, "ײַ")},
- {0xfb20, 0, 0, 0, g(Yes, No, false, false, "", "ע")},
- {0xfb21, 0, 0, 0, g(Yes, No, false, false, "", "א")},
- {0xfb22, 0, 0, 0, g(Yes, No, false, false, "", "ד")},
- {0xfb23, 0, 0, 0, g(Yes, No, false, false, "", "ה")},
- {0xfb24, 0, 0, 0, g(Yes, No, false, false, "", "כ")},
- {0xfb25, 0, 0, 0, g(Yes, No, false, false, "", "ל")},
- {0xfb26, 0, 0, 0, g(Yes, No, false, false, "", "ם")},
- {0xfb27, 0, 0, 0, g(Yes, No, false, false, "", "ר")},
- {0xfb28, 0, 0, 0, g(Yes, No, false, false, "", "ת")},
- {0xfb29, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfb2a, 0, 0, 1, f(No, false, "שׁ")},
- {0xfb2b, 0, 0, 1, f(No, false, "שׂ")},
- {0xfb2c, 0, 0, 2, f(No, false, "שּׁ")},
- {0xfb2d, 0, 0, 2, f(No, false, "שּׂ")},
- {0xfb2e, 0, 0, 1, f(No, false, "אַ")},
- {0xfb2f, 0, 0, 1, f(No, false, "אָ")},
- {0xfb30, 0, 0, 1, f(No, false, "אּ")},
- {0xfb31, 0, 0, 1, f(No, false, "בּ")},
- {0xfb32, 0, 0, 1, f(No, false, "גּ")},
- {0xfb33, 0, 0, 1, f(No, false, "דּ")},
- {0xfb34, 0, 0, 1, f(No, false, "הּ")},
- {0xfb35, 0, 0, 1, f(No, false, "וּ")},
- {0xfb36, 0, 0, 1, f(No, false, "זּ")},
- {0xfb37, 0, 0, 0, f(Yes, false, "")},
- {0xfb38, 0, 0, 1, f(No, false, "טּ")},
- {0xfb39, 0, 0, 1, f(No, false, "יּ")},
- {0xfb3a, 0, 0, 1, f(No, false, "ךּ")},
- {0xfb3b, 0, 0, 1, f(No, false, "כּ")},
- {0xfb3c, 0, 0, 1, f(No, false, "לּ")},
- {0xfb3d, 0, 0, 0, f(Yes, false, "")},
- {0xfb3e, 0, 0, 1, f(No, false, "מּ")},
- {0xfb3f, 0, 0, 0, f(Yes, false, "")},
- {0xfb40, 0, 0, 1, f(No, false, "נּ")},
- {0xfb41, 0, 0, 1, f(No, false, "סּ")},
- {0xfb42, 0, 0, 0, f(Yes, false, "")},
- {0xfb43, 0, 0, 1, f(No, false, "ףּ")},
- {0xfb44, 0, 0, 1, f(No, false, "פּ")},
- {0xfb45, 0, 0, 0, f(Yes, false, "")},
- {0xfb46, 0, 0, 1, f(No, false, "צּ")},
- {0xfb47, 0, 0, 1, f(No, false, "קּ")},
- {0xfb48, 0, 0, 1, f(No, false, "רּ")},
- {0xfb49, 0, 0, 1, f(No, false, "שּ")},
- {0xfb4a, 0, 0, 1, f(No, false, "תּ")},
- {0xfb4b, 0, 0, 1, f(No, false, "וֹ")},
- {0xfb4c, 0, 0, 1, f(No, false, "בֿ")},
- {0xfb4d, 0, 0, 1, f(No, false, "כֿ")},
- {0xfb4e, 0, 0, 1, f(No, false, "פֿ")},
- {0xfb4f, 0, 0, 0, g(Yes, No, false, false, "", "אל")},
- {0xfb50, 0, 0, 0, g(Yes, No, false, false, "", "ٱ")},
- {0xfb52, 0, 0, 0, g(Yes, No, false, false, "", "ٻ")},
- {0xfb56, 0, 0, 0, g(Yes, No, false, false, "", "پ")},
- {0xfb5a, 0, 0, 0, g(Yes, No, false, false, "", "ڀ")},
- {0xfb5e, 0, 0, 0, g(Yes, No, false, false, "", "ٺ")},
- {0xfb62, 0, 0, 0, g(Yes, No, false, false, "", "ٿ")},
- {0xfb66, 0, 0, 0, g(Yes, No, false, false, "", "ٹ")},
- {0xfb6a, 0, 0, 0, g(Yes, No, false, false, "", "ڤ")},
- {0xfb6e, 0, 0, 0, g(Yes, No, false, false, "", "ڦ")},
- {0xfb72, 0, 0, 0, g(Yes, No, false, false, "", "ڄ")},
- {0xfb76, 0, 0, 0, g(Yes, No, false, false, "", "ڃ")},
- {0xfb7a, 0, 0, 0, g(Yes, No, false, false, "", "چ")},
- {0xfb7e, 0, 0, 0, g(Yes, No, false, false, "", "ڇ")},
- {0xfb82, 0, 0, 0, g(Yes, No, false, false, "", "ڍ")},
- {0xfb84, 0, 0, 0, g(Yes, No, false, false, "", "ڌ")},
- {0xfb86, 0, 0, 0, g(Yes, No, false, false, "", "ڎ")},
- {0xfb88, 0, 0, 0, g(Yes, No, false, false, "", "ڈ")},
- {0xfb8a, 0, 0, 0, g(Yes, No, false, false, "", "ژ")},
- {0xfb8c, 0, 0, 0, g(Yes, No, false, false, "", "ڑ")},
- {0xfb8e, 0, 0, 0, g(Yes, No, false, false, "", "ک")},
- {0xfb92, 0, 0, 0, g(Yes, No, false, false, "", "گ")},
- {0xfb96, 0, 0, 0, g(Yes, No, false, false, "", "ڳ")},
- {0xfb9a, 0, 0, 0, g(Yes, No, false, false, "", "ڱ")},
- {0xfb9e, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0xfba0, 0, 0, 0, g(Yes, No, false, false, "", "ڻ")},
- {0xfba4, 0, 0, 1, g(Yes, No, false, false, "", "ۀ")},
- {0xfba6, 0, 0, 0, g(Yes, No, false, false, "", "ہ")},
- {0xfbaa, 0, 0, 0, g(Yes, No, false, false, "", "ھ")},
- {0xfbae, 0, 0, 0, g(Yes, No, false, false, "", "ے")},
- {0xfbb0, 0, 0, 1, g(Yes, No, false, false, "", "ۓ")},
- {0xfbb2, 0, 0, 0, f(Yes, false, "")},
- {0xfbd3, 0, 0, 0, g(Yes, No, false, false, "", "ڭ")},
- {0xfbd7, 0, 0, 0, g(Yes, No, false, false, "", "ۇ")},
- {0xfbd9, 0, 0, 0, g(Yes, No, false, false, "", "ۆ")},
- {0xfbdb, 0, 0, 0, g(Yes, No, false, false, "", "ۈ")},
- {0xfbdd, 0, 0, 0, g(Yes, No, false, false, "", "ۇٴ")},
- {0xfbde, 0, 0, 0, g(Yes, No, false, false, "", "ۋ")},
- {0xfbe0, 0, 0, 0, g(Yes, No, false, false, "", "ۅ")},
- {0xfbe2, 0, 0, 0, g(Yes, No, false, false, "", "ۉ")},
- {0xfbe4, 0, 0, 0, g(Yes, No, false, false, "", "ې")},
- {0xfbe8, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfbea, 0, 0, 0, g(Yes, No, false, false, "", "ئا")},
- {0xfbec, 0, 0, 0, g(Yes, No, false, false, "", "ئە")},
- {0xfbee, 0, 0, 0, g(Yes, No, false, false, "", "ئو")},
- {0xfbf0, 0, 0, 0, g(Yes, No, false, false, "", "ئۇ")},
- {0xfbf2, 0, 0, 0, g(Yes, No, false, false, "", "ئۆ")},
- {0xfbf4, 0, 0, 0, g(Yes, No, false, false, "", "ئۈ")},
- {0xfbf6, 0, 0, 0, g(Yes, No, false, false, "", "ئې")},
- {0xfbf9, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfbfc, 0, 0, 0, g(Yes, No, false, false, "", "ی")},
- {0xfc00, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc01, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc02, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc03, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc04, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc05, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc06, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc07, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc08, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc09, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc0a, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc0b, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfc0c, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfc0d, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfc0e, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc0f, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc10, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc11, 0, 0, 0, g(Yes, No, false, false, "", "ثج")},
- {0xfc12, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc13, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc14, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc15, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfc16, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfc17, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfc18, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfc19, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfc1a, 0, 0, 0, g(Yes, No, false, false, "", "خح")},
- {0xfc1b, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfc1c, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfc1d, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfc1e, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfc1f, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfc20, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfc21, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfc22, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfc23, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfc24, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfc25, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfc26, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfc27, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfc28, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfc29, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfc2a, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfc2b, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfc2c, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfc2d, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfc2e, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfc2f, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfc30, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfc31, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc32, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc33, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfc34, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfc35, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc36, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc37, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc38, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfc39, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfc3a, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfc3b, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc3c, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc3d, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc3e, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc3f, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfc40, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfc41, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfc42, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc43, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc44, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc45, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfc46, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfc47, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfc48, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc49, 0, 0, 0, g(Yes, No, false, false, "", "مى")},
- {0xfc4a, 0, 0, 0, g(Yes, No, false, false, "", "مي")},
- {0xfc4b, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfc4c, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfc4d, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfc4e, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc4f, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc50, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc51, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfc52, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfc53, 0, 0, 0, g(Yes, No, false, false, "", "هى")},
- {0xfc54, 0, 0, 0, g(Yes, No, false, false, "", "هي")},
- {0xfc55, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfc56, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfc57, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfc58, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc59, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc5a, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc5b, 0, 0, 1, g(Yes, No, false, false, "", "ذٰ")},
- {0xfc5c, 0, 0, 1, g(Yes, No, false, false, "", "رٰ")},
- {0xfc5d, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc5e, 0, 0, 2, g(Yes, No, false, false, "", " ٌّ")},
- {0xfc5f, 0, 0, 2, g(Yes, No, false, false, "", " ٍّ")},
- {0xfc60, 0, 0, 2, g(Yes, No, false, false, "", " َّ")},
- {0xfc61, 0, 0, 2, g(Yes, No, false, false, "", " ُّ")},
- {0xfc62, 0, 0, 2, g(Yes, No, false, false, "", " ِّ")},
- {0xfc63, 0, 0, 2, g(Yes, No, false, false, "", " ّٰ")},
- {0xfc64, 0, 0, 0, g(Yes, No, false, false, "", "ئر")},
- {0xfc65, 0, 0, 0, g(Yes, No, false, false, "", "ئز")},
- {0xfc66, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc67, 0, 0, 0, g(Yes, No, false, false, "", "ئن")},
- {0xfc68, 0, 0, 0, g(Yes, No, false, false, "", "ئى")},
- {0xfc69, 0, 0, 0, g(Yes, No, false, false, "", "ئي")},
- {0xfc6a, 0, 0, 0, g(Yes, No, false, false, "", "بر")},
- {0xfc6b, 0, 0, 0, g(Yes, No, false, false, "", "بز")},
- {0xfc6c, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfc6d, 0, 0, 0, g(Yes, No, false, false, "", "بن")},
- {0xfc6e, 0, 0, 0, g(Yes, No, false, false, "", "بى")},
- {0xfc6f, 0, 0, 0, g(Yes, No, false, false, "", "بي")},
- {0xfc70, 0, 0, 0, g(Yes, No, false, false, "", "تر")},
- {0xfc71, 0, 0, 0, g(Yes, No, false, false, "", "تز")},
- {0xfc72, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfc73, 0, 0, 0, g(Yes, No, false, false, "", "تن")},
- {0xfc74, 0, 0, 0, g(Yes, No, false, false, "", "تى")},
- {0xfc75, 0, 0, 0, g(Yes, No, false, false, "", "تي")},
- {0xfc76, 0, 0, 0, g(Yes, No, false, false, "", "ثر")},
- {0xfc77, 0, 0, 0, g(Yes, No, false, false, "", "ثز")},
- {0xfc78, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfc79, 0, 0, 0, g(Yes, No, false, false, "", "ثن")},
- {0xfc7a, 0, 0, 0, g(Yes, No, false, false, "", "ثى")},
- {0xfc7b, 0, 0, 0, g(Yes, No, false, false, "", "ثي")},
- {0xfc7c, 0, 0, 0, g(Yes, No, false, false, "", "فى")},
- {0xfc7d, 0, 0, 0, g(Yes, No, false, false, "", "في")},
- {0xfc7e, 0, 0, 0, g(Yes, No, false, false, "", "قى")},
- {0xfc7f, 0, 0, 0, g(Yes, No, false, false, "", "قي")},
- {0xfc80, 0, 0, 0, g(Yes, No, false, false, "", "كا")},
- {0xfc81, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfc82, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfc83, 0, 0, 0, g(Yes, No, false, false, "", "كى")},
- {0xfc84, 0, 0, 0, g(Yes, No, false, false, "", "كي")},
- {0xfc85, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfc86, 0, 0, 0, g(Yes, No, false, false, "", "لى")},
- {0xfc87, 0, 0, 0, g(Yes, No, false, false, "", "لي")},
- {0xfc88, 0, 0, 0, g(Yes, No, false, false, "", "ما")},
- {0xfc89, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfc8a, 0, 0, 0, g(Yes, No, false, false, "", "نر")},
- {0xfc8b, 0, 0, 0, g(Yes, No, false, false, "", "نز")},
- {0xfc8c, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfc8d, 0, 0, 0, g(Yes, No, false, false, "", "نن")},
- {0xfc8e, 0, 0, 0, g(Yes, No, false, false, "", "نى")},
- {0xfc8f, 0, 0, 0, g(Yes, No, false, false, "", "ني")},
- {0xfc90, 0, 0, 1, g(Yes, No, false, false, "", "ىٰ")},
- {0xfc91, 0, 0, 0, g(Yes, No, false, false, "", "ير")},
- {0xfc92, 0, 0, 0, g(Yes, No, false, false, "", "يز")},
- {0xfc93, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfc94, 0, 0, 0, g(Yes, No, false, false, "", "ين")},
- {0xfc95, 0, 0, 0, g(Yes, No, false, false, "", "يى")},
- {0xfc96, 0, 0, 0, g(Yes, No, false, false, "", "يي")},
- {0xfc97, 0, 0, 0, g(Yes, No, false, false, "", "ئج")},
- {0xfc98, 0, 0, 0, g(Yes, No, false, false, "", "ئح")},
- {0xfc99, 0, 0, 0, g(Yes, No, false, false, "", "ئخ")},
- {0xfc9a, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfc9b, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfc9c, 0, 0, 0, g(Yes, No, false, false, "", "بج")},
- {0xfc9d, 0, 0, 0, g(Yes, No, false, false, "", "بح")},
- {0xfc9e, 0, 0, 0, g(Yes, No, false, false, "", "بخ")},
- {0xfc9f, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfca0, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfca1, 0, 0, 0, g(Yes, No, false, false, "", "تج")},
- {0xfca2, 0, 0, 0, g(Yes, No, false, false, "", "تح")},
- {0xfca3, 0, 0, 0, g(Yes, No, false, false, "", "تخ")},
- {0xfca4, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfca5, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfca6, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfca7, 0, 0, 0, g(Yes, No, false, false, "", "جح")},
- {0xfca8, 0, 0, 0, g(Yes, No, false, false, "", "جم")},
- {0xfca9, 0, 0, 0, g(Yes, No, false, false, "", "حج")},
- {0xfcaa, 0, 0, 0, g(Yes, No, false, false, "", "حم")},
- {0xfcab, 0, 0, 0, g(Yes, No, false, false, "", "خج")},
- {0xfcac, 0, 0, 0, g(Yes, No, false, false, "", "خم")},
- {0xfcad, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfcae, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfcaf, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfcb0, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfcb1, 0, 0, 0, g(Yes, No, false, false, "", "صح")},
- {0xfcb2, 0, 0, 0, g(Yes, No, false, false, "", "صخ")},
- {0xfcb3, 0, 0, 0, g(Yes, No, false, false, "", "صم")},
- {0xfcb4, 0, 0, 0, g(Yes, No, false, false, "", "ضج")},
- {0xfcb5, 0, 0, 0, g(Yes, No, false, false, "", "ضح")},
- {0xfcb6, 0, 0, 0, g(Yes, No, false, false, "", "ضخ")},
- {0xfcb7, 0, 0, 0, g(Yes, No, false, false, "", "ضم")},
- {0xfcb8, 0, 0, 0, g(Yes, No, false, false, "", "طح")},
- {0xfcb9, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfcba, 0, 0, 0, g(Yes, No, false, false, "", "عج")},
- {0xfcbb, 0, 0, 0, g(Yes, No, false, false, "", "عم")},
- {0xfcbc, 0, 0, 0, g(Yes, No, false, false, "", "غج")},
- {0xfcbd, 0, 0, 0, g(Yes, No, false, false, "", "غم")},
- {0xfcbe, 0, 0, 0, g(Yes, No, false, false, "", "فج")},
- {0xfcbf, 0, 0, 0, g(Yes, No, false, false, "", "فح")},
- {0xfcc0, 0, 0, 0, g(Yes, No, false, false, "", "فخ")},
- {0xfcc1, 0, 0, 0, g(Yes, No, false, false, "", "فم")},
- {0xfcc2, 0, 0, 0, g(Yes, No, false, false, "", "قح")},
- {0xfcc3, 0, 0, 0, g(Yes, No, false, false, "", "قم")},
- {0xfcc4, 0, 0, 0, g(Yes, No, false, false, "", "كج")},
- {0xfcc5, 0, 0, 0, g(Yes, No, false, false, "", "كح")},
- {0xfcc6, 0, 0, 0, g(Yes, No, false, false, "", "كخ")},
- {0xfcc7, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcc8, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfcc9, 0, 0, 0, g(Yes, No, false, false, "", "لج")},
- {0xfcca, 0, 0, 0, g(Yes, No, false, false, "", "لح")},
- {0xfccb, 0, 0, 0, g(Yes, No, false, false, "", "لخ")},
- {0xfccc, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfccd, 0, 0, 0, g(Yes, No, false, false, "", "له")},
- {0xfcce, 0, 0, 0, g(Yes, No, false, false, "", "مج")},
- {0xfccf, 0, 0, 0, g(Yes, No, false, false, "", "مح")},
- {0xfcd0, 0, 0, 0, g(Yes, No, false, false, "", "مخ")},
- {0xfcd1, 0, 0, 0, g(Yes, No, false, false, "", "مم")},
- {0xfcd2, 0, 0, 0, g(Yes, No, false, false, "", "نج")},
- {0xfcd3, 0, 0, 0, g(Yes, No, false, false, "", "نح")},
- {0xfcd4, 0, 0, 0, g(Yes, No, false, false, "", "نخ")},
- {0xfcd5, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcd6, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcd7, 0, 0, 0, g(Yes, No, false, false, "", "هج")},
- {0xfcd8, 0, 0, 0, g(Yes, No, false, false, "", "هم")},
- {0xfcd9, 0, 0, 1, g(Yes, No, false, false, "", "هٰ")},
- {0xfcda, 0, 0, 0, g(Yes, No, false, false, "", "يج")},
- {0xfcdb, 0, 0, 0, g(Yes, No, false, false, "", "يح")},
- {0xfcdc, 0, 0, 0, g(Yes, No, false, false, "", "يخ")},
- {0xfcdd, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcde, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcdf, 0, 0, 0, g(Yes, No, false, false, "", "ئم")},
- {0xfce0, 0, 0, 0, g(Yes, No, false, false, "", "ئه")},
- {0xfce1, 0, 0, 0, g(Yes, No, false, false, "", "بم")},
- {0xfce2, 0, 0, 0, g(Yes, No, false, false, "", "به")},
- {0xfce3, 0, 0, 0, g(Yes, No, false, false, "", "تم")},
- {0xfce4, 0, 0, 0, g(Yes, No, false, false, "", "ته")},
- {0xfce5, 0, 0, 0, g(Yes, No, false, false, "", "ثم")},
- {0xfce6, 0, 0, 0, g(Yes, No, false, false, "", "ثه")},
- {0xfce7, 0, 0, 0, g(Yes, No, false, false, "", "سم")},
- {0xfce8, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfce9, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfcea, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfceb, 0, 0, 0, g(Yes, No, false, false, "", "كل")},
- {0xfcec, 0, 0, 0, g(Yes, No, false, false, "", "كم")},
- {0xfced, 0, 0, 0, g(Yes, No, false, false, "", "لم")},
- {0xfcee, 0, 0, 0, g(Yes, No, false, false, "", "نم")},
- {0xfcef, 0, 0, 0, g(Yes, No, false, false, "", "نه")},
- {0xfcf0, 0, 0, 0, g(Yes, No, false, false, "", "يم")},
- {0xfcf1, 0, 0, 0, g(Yes, No, false, false, "", "يه")},
- {0xfcf2, 0, 0, 2, g(Yes, No, false, false, "", "ـَّ")},
- {0xfcf3, 0, 0, 2, g(Yes, No, false, false, "", "ـُّ")},
- {0xfcf4, 0, 0, 2, g(Yes, No, false, false, "", "ـِّ")},
- {0xfcf5, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfcf6, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfcf7, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfcf8, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfcf9, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfcfa, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfcfb, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfcfc, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfcfd, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfcfe, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfcff, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd00, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd01, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd02, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd03, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd04, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd05, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd06, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd07, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd08, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd09, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd0a, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd0b, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd0c, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd0d, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd0e, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd0f, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd10, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd11, 0, 0, 0, g(Yes, No, false, false, "", "طى")},
- {0xfd12, 0, 0, 0, g(Yes, No, false, false, "", "طي")},
- {0xfd13, 0, 0, 0, g(Yes, No, false, false, "", "عى")},
- {0xfd14, 0, 0, 0, g(Yes, No, false, false, "", "عي")},
- {0xfd15, 0, 0, 0, g(Yes, No, false, false, "", "غى")},
- {0xfd16, 0, 0, 0, g(Yes, No, false, false, "", "غي")},
- {0xfd17, 0, 0, 0, g(Yes, No, false, false, "", "سى")},
- {0xfd18, 0, 0, 0, g(Yes, No, false, false, "", "سي")},
- {0xfd19, 0, 0, 0, g(Yes, No, false, false, "", "شى")},
- {0xfd1a, 0, 0, 0, g(Yes, No, false, false, "", "شي")},
- {0xfd1b, 0, 0, 0, g(Yes, No, false, false, "", "حى")},
- {0xfd1c, 0, 0, 0, g(Yes, No, false, false, "", "حي")},
- {0xfd1d, 0, 0, 0, g(Yes, No, false, false, "", "جى")},
- {0xfd1e, 0, 0, 0, g(Yes, No, false, false, "", "جي")},
- {0xfd1f, 0, 0, 0, g(Yes, No, false, false, "", "خى")},
- {0xfd20, 0, 0, 0, g(Yes, No, false, false, "", "خي")},
- {0xfd21, 0, 0, 0, g(Yes, No, false, false, "", "صى")},
- {0xfd22, 0, 0, 0, g(Yes, No, false, false, "", "صي")},
- {0xfd23, 0, 0, 0, g(Yes, No, false, false, "", "ضى")},
- {0xfd24, 0, 0, 0, g(Yes, No, false, false, "", "ضي")},
- {0xfd25, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd26, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd27, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd28, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd29, 0, 0, 0, g(Yes, No, false, false, "", "شر")},
- {0xfd2a, 0, 0, 0, g(Yes, No, false, false, "", "سر")},
- {0xfd2b, 0, 0, 0, g(Yes, No, false, false, "", "صر")},
- {0xfd2c, 0, 0, 0, g(Yes, No, false, false, "", "ضر")},
- {0xfd2d, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd2e, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd2f, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd30, 0, 0, 0, g(Yes, No, false, false, "", "شم")},
- {0xfd31, 0, 0, 0, g(Yes, No, false, false, "", "سه")},
- {0xfd32, 0, 0, 0, g(Yes, No, false, false, "", "شه")},
- {0xfd33, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd34, 0, 0, 0, g(Yes, No, false, false, "", "سج")},
- {0xfd35, 0, 0, 0, g(Yes, No, false, false, "", "سح")},
- {0xfd36, 0, 0, 0, g(Yes, No, false, false, "", "سخ")},
- {0xfd37, 0, 0, 0, g(Yes, No, false, false, "", "شج")},
- {0xfd38, 0, 0, 0, g(Yes, No, false, false, "", "شح")},
- {0xfd39, 0, 0, 0, g(Yes, No, false, false, "", "شخ")},
- {0xfd3a, 0, 0, 0, g(Yes, No, false, false, "", "طم")},
- {0xfd3b, 0, 0, 0, g(Yes, No, false, false, "", "ظم")},
- {0xfd3c, 0, 0, 1, g(Yes, No, false, false, "", "اً")},
- {0xfd3e, 0, 0, 0, f(Yes, false, "")},
- {0xfd50, 0, 0, 0, g(Yes, No, false, false, "", "تجم")},
- {0xfd51, 0, 0, 0, g(Yes, No, false, false, "", "تحج")},
- {0xfd53, 0, 0, 0, g(Yes, No, false, false, "", "تحم")},
- {0xfd54, 0, 0, 0, g(Yes, No, false, false, "", "تخم")},
- {0xfd55, 0, 0, 0, g(Yes, No, false, false, "", "تمج")},
- {0xfd56, 0, 0, 0, g(Yes, No, false, false, "", "تمح")},
- {0xfd57, 0, 0, 0, g(Yes, No, false, false, "", "تمخ")},
- {0xfd58, 0, 0, 0, g(Yes, No, false, false, "", "جمح")},
- {0xfd5a, 0, 0, 0, g(Yes, No, false, false, "", "حمي")},
- {0xfd5b, 0, 0, 0, g(Yes, No, false, false, "", "حمى")},
- {0xfd5c, 0, 0, 0, g(Yes, No, false, false, "", "سحج")},
- {0xfd5d, 0, 0, 0, g(Yes, No, false, false, "", "سجح")},
- {0xfd5e, 0, 0, 0, g(Yes, No, false, false, "", "سجى")},
- {0xfd5f, 0, 0, 0, g(Yes, No, false, false, "", "سمح")},
- {0xfd61, 0, 0, 0, g(Yes, No, false, false, "", "سمج")},
- {0xfd62, 0, 0, 0, g(Yes, No, false, false, "", "سمم")},
- {0xfd64, 0, 0, 0, g(Yes, No, false, false, "", "صحح")},
- {0xfd66, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfd67, 0, 0, 0, g(Yes, No, false, false, "", "شحم")},
- {0xfd69, 0, 0, 0, g(Yes, No, false, false, "", "شجي")},
- {0xfd6a, 0, 0, 0, g(Yes, No, false, false, "", "شمخ")},
- {0xfd6c, 0, 0, 0, g(Yes, No, false, false, "", "شمم")},
- {0xfd6e, 0, 0, 0, g(Yes, No, false, false, "", "ضحى")},
- {0xfd6f, 0, 0, 0, g(Yes, No, false, false, "", "ضخم")},
- {0xfd71, 0, 0, 0, g(Yes, No, false, false, "", "طمح")},
- {0xfd73, 0, 0, 0, g(Yes, No, false, false, "", "طمم")},
- {0xfd74, 0, 0, 0, g(Yes, No, false, false, "", "طمي")},
- {0xfd75, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfd76, 0, 0, 0, g(Yes, No, false, false, "", "عمم")},
- {0xfd78, 0, 0, 0, g(Yes, No, false, false, "", "عمى")},
- {0xfd79, 0, 0, 0, g(Yes, No, false, false, "", "غمم")},
- {0xfd7a, 0, 0, 0, g(Yes, No, false, false, "", "غمي")},
- {0xfd7b, 0, 0, 0, g(Yes, No, false, false, "", "غمى")},
- {0xfd7c, 0, 0, 0, g(Yes, No, false, false, "", "فخم")},
- {0xfd7e, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfd7f, 0, 0, 0, g(Yes, No, false, false, "", "قمم")},
- {0xfd80, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfd81, 0, 0, 0, g(Yes, No, false, false, "", "لحي")},
- {0xfd82, 0, 0, 0, g(Yes, No, false, false, "", "لحى")},
- {0xfd83, 0, 0, 0, g(Yes, No, false, false, "", "لجج")},
- {0xfd85, 0, 0, 0, g(Yes, No, false, false, "", "لخم")},
- {0xfd87, 0, 0, 0, g(Yes, No, false, false, "", "لمح")},
- {0xfd89, 0, 0, 0, g(Yes, No, false, false, "", "محج")},
- {0xfd8a, 0, 0, 0, g(Yes, No, false, false, "", "محم")},
- {0xfd8b, 0, 0, 0, g(Yes, No, false, false, "", "محي")},
- {0xfd8c, 0, 0, 0, g(Yes, No, false, false, "", "مجح")},
- {0xfd8d, 0, 0, 0, g(Yes, No, false, false, "", "مجم")},
- {0xfd8e, 0, 0, 0, g(Yes, No, false, false, "", "مخج")},
- {0xfd8f, 0, 0, 0, g(Yes, No, false, false, "", "مخم")},
- {0xfd90, 0, 0, 0, f(Yes, false, "")},
- {0xfd92, 0, 0, 0, g(Yes, No, false, false, "", "مجخ")},
- {0xfd93, 0, 0, 0, g(Yes, No, false, false, "", "همج")},
- {0xfd94, 0, 0, 0, g(Yes, No, false, false, "", "همم")},
- {0xfd95, 0, 0, 0, g(Yes, No, false, false, "", "نحم")},
- {0xfd96, 0, 0, 0, g(Yes, No, false, false, "", "نحى")},
- {0xfd97, 0, 0, 0, g(Yes, No, false, false, "", "نجم")},
- {0xfd99, 0, 0, 0, g(Yes, No, false, false, "", "نجى")},
- {0xfd9a, 0, 0, 0, g(Yes, No, false, false, "", "نمي")},
- {0xfd9b, 0, 0, 0, g(Yes, No, false, false, "", "نمى")},
- {0xfd9c, 0, 0, 0, g(Yes, No, false, false, "", "يمم")},
- {0xfd9e, 0, 0, 0, g(Yes, No, false, false, "", "بخي")},
- {0xfd9f, 0, 0, 0, g(Yes, No, false, false, "", "تجي")},
- {0xfda0, 0, 0, 0, g(Yes, No, false, false, "", "تجى")},
- {0xfda1, 0, 0, 0, g(Yes, No, false, false, "", "تخي")},
- {0xfda2, 0, 0, 0, g(Yes, No, false, false, "", "تخى")},
- {0xfda3, 0, 0, 0, g(Yes, No, false, false, "", "تمي")},
- {0xfda4, 0, 0, 0, g(Yes, No, false, false, "", "تمى")},
- {0xfda5, 0, 0, 0, g(Yes, No, false, false, "", "جمي")},
- {0xfda6, 0, 0, 0, g(Yes, No, false, false, "", "جحى")},
- {0xfda7, 0, 0, 0, g(Yes, No, false, false, "", "جمى")},
- {0xfda8, 0, 0, 0, g(Yes, No, false, false, "", "سخى")},
- {0xfda9, 0, 0, 0, g(Yes, No, false, false, "", "صحي")},
- {0xfdaa, 0, 0, 0, g(Yes, No, false, false, "", "شحي")},
- {0xfdab, 0, 0, 0, g(Yes, No, false, false, "", "ضحي")},
- {0xfdac, 0, 0, 0, g(Yes, No, false, false, "", "لجي")},
- {0xfdad, 0, 0, 0, g(Yes, No, false, false, "", "لمي")},
- {0xfdae, 0, 0, 0, g(Yes, No, false, false, "", "يحي")},
- {0xfdaf, 0, 0, 0, g(Yes, No, false, false, "", "يجي")},
- {0xfdb0, 0, 0, 0, g(Yes, No, false, false, "", "يمي")},
- {0xfdb1, 0, 0, 0, g(Yes, No, false, false, "", "ممي")},
- {0xfdb2, 0, 0, 0, g(Yes, No, false, false, "", "قمي")},
- {0xfdb3, 0, 0, 0, g(Yes, No, false, false, "", "نحي")},
- {0xfdb4, 0, 0, 0, g(Yes, No, false, false, "", "قمح")},
- {0xfdb5, 0, 0, 0, g(Yes, No, false, false, "", "لحم")},
- {0xfdb6, 0, 0, 0, g(Yes, No, false, false, "", "عمي")},
- {0xfdb7, 0, 0, 0, g(Yes, No, false, false, "", "كمي")},
- {0xfdb8, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdb9, 0, 0, 0, g(Yes, No, false, false, "", "مخي")},
- {0xfdba, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbb, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdbc, 0, 0, 0, g(Yes, No, false, false, "", "لجم")},
- {0xfdbd, 0, 0, 0, g(Yes, No, false, false, "", "نجح")},
- {0xfdbe, 0, 0, 0, g(Yes, No, false, false, "", "جحي")},
- {0xfdbf, 0, 0, 0, g(Yes, No, false, false, "", "حجي")},
- {0xfdc0, 0, 0, 0, g(Yes, No, false, false, "", "مجي")},
- {0xfdc1, 0, 0, 0, g(Yes, No, false, false, "", "فمي")},
- {0xfdc2, 0, 0, 0, g(Yes, No, false, false, "", "بحي")},
- {0xfdc3, 0, 0, 0, g(Yes, No, false, false, "", "كمم")},
- {0xfdc4, 0, 0, 0, g(Yes, No, false, false, "", "عجم")},
- {0xfdc5, 0, 0, 0, g(Yes, No, false, false, "", "صمم")},
- {0xfdc6, 0, 0, 0, g(Yes, No, false, false, "", "سخي")},
- {0xfdc7, 0, 0, 0, g(Yes, No, false, false, "", "نجي")},
- {0xfdc8, 0, 0, 0, f(Yes, false, "")},
- {0xfdf0, 0, 0, 0, g(Yes, No, false, false, "", "صلے")},
- {0xfdf1, 0, 0, 0, g(Yes, No, false, false, "", "قلے")},
- {0xfdf2, 0, 0, 0, g(Yes, No, false, false, "", "الله")},
- {0xfdf3, 0, 0, 0, g(Yes, No, false, false, "", "اكبر")},
- {0xfdf4, 0, 0, 0, g(Yes, No, false, false, "", "محمد")},
- {0xfdf5, 0, 0, 0, g(Yes, No, false, false, "", "صلعم")},
- {0xfdf6, 0, 0, 0, g(Yes, No, false, false, "", "رسول")},
- {0xfdf7, 0, 0, 0, g(Yes, No, false, false, "", "عليه")},
- {0xfdf8, 0, 0, 0, g(Yes, No, false, false, "", "وسلم")},
- {0xfdf9, 0, 0, 0, g(Yes, No, false, false, "", "صلى")},
- {0xfdfa, 0, 0, 0, g(Yes, No, false, false, "", "صلى الله عليه وسلم")},
- {0xfdfb, 0, 0, 0, g(Yes, No, false, false, "", "جل جلاله")},
- {0xfdfc, 0, 0, 0, g(Yes, No, false, false, "", "ریال")},
- {0xfdfd, 0, 0, 0, f(Yes, false, "")},
- {0xfe10, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe11, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe12, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xfe13, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe14, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe15, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe16, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe17, 0, 0, 0, g(Yes, No, false, false, "", "〖")},
- {0xfe18, 0, 0, 0, g(Yes, No, false, false, "", "〗")},
- {0xfe19, 0, 0, 0, g(Yes, No, false, false, "", "...")},
- {0xfe1a, 0, 0, 0, f(Yes, false, "")},
- {0xfe20, 230, 1, 1, f(Yes, false, "")},
- {0xfe27, 220, 1, 1, f(Yes, false, "")},
- {0xfe2e, 230, 1, 1, f(Yes, false, "")},
- {0xfe30, 0, 0, 0, g(Yes, No, false, false, "", "..")},
- {0xfe31, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe32, 0, 0, 0, g(Yes, No, false, false, "", "–")},
- {0xfe33, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe35, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe36, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe37, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe38, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe39, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe3a, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe3b, 0, 0, 0, g(Yes, No, false, false, "", "【")},
- {0xfe3c, 0, 0, 0, g(Yes, No, false, false, "", "】")},
- {0xfe3d, 0, 0, 0, g(Yes, No, false, false, "", "《")},
- {0xfe3e, 0, 0, 0, g(Yes, No, false, false, "", "》")},
- {0xfe3f, 0, 0, 0, g(Yes, No, false, false, "", "〈")},
- {0xfe40, 0, 0, 0, g(Yes, No, false, false, "", "〉")},
- {0xfe41, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xfe42, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xfe43, 0, 0, 0, g(Yes, No, false, false, "", "『")},
- {0xfe44, 0, 0, 0, g(Yes, No, false, false, "", "』")},
- {0xfe45, 0, 0, 0, f(Yes, false, "")},
- {0xfe47, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xfe48, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xfe49, 0, 0, 1, g(Yes, No, false, false, "", " ̅")},
- {0xfe4d, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xfe50, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xfe51, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xfe52, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xfe53, 0, 0, 0, f(Yes, false, "")},
- {0xfe54, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xfe55, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xfe56, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xfe57, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xfe58, 0, 0, 0, g(Yes, No, false, false, "", "—")},
- {0xfe59, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xfe5a, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xfe5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xfe5c, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xfe5d, 0, 0, 0, g(Yes, No, false, false, "", "〔")},
- {0xfe5e, 0, 0, 0, g(Yes, No, false, false, "", "〕")},
- {0xfe5f, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xfe60, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xfe61, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xfe62, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xfe63, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xfe64, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xfe65, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xfe66, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xfe67, 0, 0, 0, f(Yes, false, "")},
- {0xfe68, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xfe69, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xfe6a, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xfe6b, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xfe6c, 0, 0, 0, f(Yes, false, "")},
- {0xfe70, 0, 0, 1, g(Yes, No, false, false, "", " ً")},
- {0xfe71, 0, 0, 1, g(Yes, No, false, false, "", "ـً")},
- {0xfe72, 0, 0, 1, g(Yes, No, false, false, "", " ٌ")},
- {0xfe73, 0, 0, 0, f(Yes, false, "")},
- {0xfe74, 0, 0, 1, g(Yes, No, false, false, "", " ٍ")},
- {0xfe75, 0, 0, 0, f(Yes, false, "")},
- {0xfe76, 0, 0, 1, g(Yes, No, false, false, "", " َ")},
- {0xfe77, 0, 0, 1, g(Yes, No, false, false, "", "ـَ")},
- {0xfe78, 0, 0, 1, g(Yes, No, false, false, "", " ُ")},
- {0xfe79, 0, 0, 1, g(Yes, No, false, false, "", "ـُ")},
- {0xfe7a, 0, 0, 1, g(Yes, No, false, false, "", " ِ")},
- {0xfe7b, 0, 0, 1, g(Yes, No, false, false, "", "ـِ")},
- {0xfe7c, 0, 0, 1, g(Yes, No, false, false, "", " ّ")},
- {0xfe7d, 0, 0, 1, g(Yes, No, false, false, "", "ـّ")},
- {0xfe7e, 0, 0, 1, g(Yes, No, false, false, "", " ْ")},
- {0xfe7f, 0, 0, 1, g(Yes, No, false, false, "", "ـْ")},
- {0xfe80, 0, 0, 0, g(Yes, No, false, false, "", "ء")},
- {0xfe81, 0, 0, 1, g(Yes, No, false, false, "", "آ")},
- {0xfe83, 0, 0, 1, g(Yes, No, false, false, "", "أ")},
- {0xfe85, 0, 0, 1, g(Yes, No, false, false, "", "ؤ")},
- {0xfe87, 0, 0, 1, g(Yes, No, false, false, "", "إ")},
- {0xfe89, 0, 0, 1, g(Yes, No, false, false, "", "ئ")},
- {0xfe8d, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0xfe8f, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0xfe93, 0, 0, 0, g(Yes, No, false, false, "", "ة")},
- {0xfe95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0xfe99, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0xfe9d, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0xfea1, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0xfea5, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0xfea9, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0xfeab, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0xfead, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0xfeaf, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0xfeb1, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0xfeb5, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0xfeb9, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0xfebd, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0xfec1, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0xfec5, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0xfec9, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0xfecd, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0xfed1, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0xfed5, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0xfed9, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0xfedd, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0xfee1, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0xfee5, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0xfee9, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0xfeed, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0xfeef, 0, 0, 0, g(Yes, No, false, false, "", "ى")},
- {0xfef1, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0xfef5, 0, 0, 1, g(Yes, No, false, false, "", "لآ")},
- {0xfef7, 0, 0, 1, g(Yes, No, false, false, "", "لأ")},
- {0xfef9, 0, 0, 1, g(Yes, No, false, false, "", "لإ")},
- {0xfefb, 0, 0, 0, g(Yes, No, false, false, "", "لا")},
- {0xfefd, 0, 0, 0, f(Yes, false, "")},
- {0xff01, 0, 0, 0, g(Yes, No, false, false, "", "!")},
- {0xff02, 0, 0, 0, g(Yes, No, false, false, "", "\"")},
- {0xff03, 0, 0, 0, g(Yes, No, false, false, "", "#")},
- {0xff04, 0, 0, 0, g(Yes, No, false, false, "", "$")},
- {0xff05, 0, 0, 0, g(Yes, No, false, false, "", "%")},
- {0xff06, 0, 0, 0, g(Yes, No, false, false, "", "&")},
- {0xff07, 0, 0, 0, g(Yes, No, false, false, "", "'")},
- {0xff08, 0, 0, 0, g(Yes, No, false, false, "", "(")},
- {0xff09, 0, 0, 0, g(Yes, No, false, false, "", ")")},
- {0xff0a, 0, 0, 0, g(Yes, No, false, false, "", "*")},
- {0xff0b, 0, 0, 0, g(Yes, No, false, false, "", "+")},
- {0xff0c, 0, 0, 0, g(Yes, No, false, false, "", ",")},
- {0xff0d, 0, 0, 0, g(Yes, No, false, false, "", "-")},
- {0xff0e, 0, 0, 0, g(Yes, No, false, false, "", ".")},
- {0xff0f, 0, 0, 0, g(Yes, No, false, false, "", "/")},
- {0xff10, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0xff11, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0xff12, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0xff13, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0xff14, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0xff15, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0xff16, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0xff17, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0xff18, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0xff19, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0xff1a, 0, 0, 0, g(Yes, No, false, false, "", ":")},
- {0xff1b, 0, 0, 0, g(Yes, No, false, false, "", ";")},
- {0xff1c, 0, 0, 0, g(Yes, No, false, false, "", "<")},
- {0xff1d, 0, 0, 0, g(Yes, No, false, false, "", "=")},
- {0xff1e, 0, 0, 0, g(Yes, No, false, false, "", ">")},
- {0xff1f, 0, 0, 0, g(Yes, No, false, false, "", "?")},
- {0xff20, 0, 0, 0, g(Yes, No, false, false, "", "@")},
- {0xff21, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0xff22, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0xff23, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0xff24, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0xff25, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0xff26, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0xff27, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0xff28, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0xff29, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0xff2a, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0xff2b, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0xff2c, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0xff2d, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0xff2e, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0xff2f, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0xff30, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0xff31, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0xff32, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0xff33, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0xff34, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0xff35, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0xff36, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0xff37, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0xff38, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0xff39, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0xff3a, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0xff3b, 0, 0, 0, g(Yes, No, false, false, "", "[")},
- {0xff3c, 0, 0, 0, g(Yes, No, false, false, "", "\\")},
- {0xff3d, 0, 0, 0, g(Yes, No, false, false, "", "]")},
- {0xff3e, 0, 0, 0, g(Yes, No, false, false, "", "^")},
- {0xff3f, 0, 0, 0, g(Yes, No, false, false, "", "_")},
- {0xff40, 0, 0, 0, g(Yes, No, false, false, "", "`")},
- {0xff41, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0xff42, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0xff43, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0xff44, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0xff45, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0xff46, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0xff47, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0xff48, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0xff49, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0xff4a, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0xff4b, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0xff4c, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0xff4d, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0xff4e, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0xff4f, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0xff50, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0xff51, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0xff52, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0xff53, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0xff54, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0xff55, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0xff56, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0xff57, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0xff58, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0xff59, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0xff5a, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0xff5b, 0, 0, 0, g(Yes, No, false, false, "", "{")},
- {0xff5c, 0, 0, 0, g(Yes, No, false, false, "", "|")},
- {0xff5d, 0, 0, 0, g(Yes, No, false, false, "", "}")},
- {0xff5e, 0, 0, 0, g(Yes, No, false, false, "", "~")},
- {0xff5f, 0, 0, 0, g(Yes, No, false, false, "", "⦅")},
- {0xff60, 0, 0, 0, g(Yes, No, false, false, "", "⦆")},
- {0xff61, 0, 0, 0, g(Yes, No, false, false, "", "。")},
- {0xff62, 0, 0, 0, g(Yes, No, false, false, "", "「")},
- {0xff63, 0, 0, 0, g(Yes, No, false, false, "", "」")},
- {0xff64, 0, 0, 0, g(Yes, No, false, false, "", "、")},
- {0xff65, 0, 0, 0, g(Yes, No, false, false, "", "・")},
- {0xff66, 0, 0, 0, g(Yes, No, false, false, "", "ヲ")},
- {0xff67, 0, 0, 0, g(Yes, No, false, false, "", "ァ")},
- {0xff68, 0, 0, 0, g(Yes, No, false, false, "", "ィ")},
- {0xff69, 0, 0, 0, g(Yes, No, false, false, "", "ゥ")},
- {0xff6a, 0, 0, 0, g(Yes, No, false, false, "", "ェ")},
- {0xff6b, 0, 0, 0, g(Yes, No, false, false, "", "ォ")},
- {0xff6c, 0, 0, 0, g(Yes, No, false, false, "", "ャ")},
- {0xff6d, 0, 0, 0, g(Yes, No, false, false, "", "ュ")},
- {0xff6e, 0, 0, 0, g(Yes, No, false, false, "", "ョ")},
- {0xff6f, 0, 0, 0, g(Yes, No, false, false, "", "ッ")},
- {0xff70, 0, 0, 0, g(Yes, No, false, false, "", "ー")},
- {0xff71, 0, 0, 0, g(Yes, No, false, false, "", "ア")},
- {0xff72, 0, 0, 0, g(Yes, No, false, false, "", "イ")},
- {0xff73, 0, 0, 0, g(Yes, No, false, false, "", "ウ")},
- {0xff74, 0, 0, 0, g(Yes, No, false, false, "", "エ")},
- {0xff75, 0, 0, 0, g(Yes, No, false, false, "", "オ")},
- {0xff76, 0, 0, 0, g(Yes, No, false, false, "", "カ")},
- {0xff77, 0, 0, 0, g(Yes, No, false, false, "", "キ")},
- {0xff78, 0, 0, 0, g(Yes, No, false, false, "", "ク")},
- {0xff79, 0, 0, 0, g(Yes, No, false, false, "", "ケ")},
- {0xff7a, 0, 0, 0, g(Yes, No, false, false, "", "コ")},
- {0xff7b, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0xff7c, 0, 0, 0, g(Yes, No, false, false, "", "シ")},
- {0xff7d, 0, 0, 0, g(Yes, No, false, false, "", "ス")},
- {0xff7e, 0, 0, 0, g(Yes, No, false, false, "", "セ")},
- {0xff7f, 0, 0, 0, g(Yes, No, false, false, "", "ソ")},
- {0xff80, 0, 0, 0, g(Yes, No, false, false, "", "タ")},
- {0xff81, 0, 0, 0, g(Yes, No, false, false, "", "チ")},
- {0xff82, 0, 0, 0, g(Yes, No, false, false, "", "ツ")},
- {0xff83, 0, 0, 0, g(Yes, No, false, false, "", "テ")},
- {0xff84, 0, 0, 0, g(Yes, No, false, false, "", "ト")},
- {0xff85, 0, 0, 0, g(Yes, No, false, false, "", "ナ")},
- {0xff86, 0, 0, 0, g(Yes, No, false, false, "", "ニ")},
- {0xff87, 0, 0, 0, g(Yes, No, false, false, "", "ヌ")},
- {0xff88, 0, 0, 0, g(Yes, No, false, false, "", "ネ")},
- {0xff89, 0, 0, 0, g(Yes, No, false, false, "", "ノ")},
- {0xff8a, 0, 0, 0, g(Yes, No, false, false, "", "ハ")},
- {0xff8b, 0, 0, 0, g(Yes, No, false, false, "", "ヒ")},
- {0xff8c, 0, 0, 0, g(Yes, No, false, false, "", "フ")},
- {0xff8d, 0, 0, 0, g(Yes, No, false, false, "", "ヘ")},
- {0xff8e, 0, 0, 0, g(Yes, No, false, false, "", "ホ")},
- {0xff8f, 0, 0, 0, g(Yes, No, false, false, "", "マ")},
- {0xff90, 0, 0, 0, g(Yes, No, false, false, "", "ミ")},
- {0xff91, 0, 0, 0, g(Yes, No, false, false, "", "ム")},
- {0xff92, 0, 0, 0, g(Yes, No, false, false, "", "メ")},
- {0xff93, 0, 0, 0, g(Yes, No, false, false, "", "モ")},
- {0xff94, 0, 0, 0, g(Yes, No, false, false, "", "ヤ")},
- {0xff95, 0, 0, 0, g(Yes, No, false, false, "", "ユ")},
- {0xff96, 0, 0, 0, g(Yes, No, false, false, "", "ヨ")},
- {0xff97, 0, 0, 0, g(Yes, No, false, false, "", "ラ")},
- {0xff98, 0, 0, 0, g(Yes, No, false, false, "", "リ")},
- {0xff99, 0, 0, 0, g(Yes, No, false, false, "", "ル")},
- {0xff9a, 0, 0, 0, g(Yes, No, false, false, "", "レ")},
- {0xff9b, 0, 0, 0, g(Yes, No, false, false, "", "ロ")},
- {0xff9c, 0, 0, 0, g(Yes, No, false, false, "", "ワ")},
- {0xff9d, 0, 0, 0, g(Yes, No, false, false, "", "ン")},
- {0xff9e, 0, 1, 1, g(Yes, No, false, false, "", "゙")},
- {0xff9f, 0, 1, 1, g(Yes, No, false, false, "", "゚")},
- {0xffa0, 0, 0, 0, g(Yes, No, false, false, "", "ᅠ")},
- {0xffa1, 0, 0, 0, g(Yes, No, false, false, "", "ᄀ")},
- {0xffa2, 0, 0, 0, g(Yes, No, false, false, "", "ᄁ")},
- {0xffa3, 0, 1, 1, g(Yes, No, false, false, "", "ᆪ")},
- {0xffa4, 0, 0, 0, g(Yes, No, false, false, "", "ᄂ")},
- {0xffa5, 0, 1, 1, g(Yes, No, false, false, "", "ᆬ")},
- {0xffa6, 0, 1, 1, g(Yes, No, false, false, "", "ᆭ")},
- {0xffa7, 0, 0, 0, g(Yes, No, false, false, "", "ᄃ")},
- {0xffa8, 0, 0, 0, g(Yes, No, false, false, "", "ᄄ")},
- {0xffa9, 0, 0, 0, g(Yes, No, false, false, "", "ᄅ")},
- {0xffaa, 0, 1, 1, g(Yes, No, false, false, "", "ᆰ")},
- {0xffab, 0, 1, 1, g(Yes, No, false, false, "", "ᆱ")},
- {0xffac, 0, 1, 1, g(Yes, No, false, false, "", "ᆲ")},
- {0xffad, 0, 1, 1, g(Yes, No, false, false, "", "ᆳ")},
- {0xffae, 0, 1, 1, g(Yes, No, false, false, "", "ᆴ")},
- {0xffaf, 0, 1, 1, g(Yes, No, false, false, "", "ᆵ")},
- {0xffb0, 0, 0, 0, g(Yes, No, false, false, "", "ᄚ")},
- {0xffb1, 0, 0, 0, g(Yes, No, false, false, "", "ᄆ")},
- {0xffb2, 0, 0, 0, g(Yes, No, false, false, "", "ᄇ")},
- {0xffb3, 0, 0, 0, g(Yes, No, false, false, "", "ᄈ")},
- {0xffb4, 0, 0, 0, g(Yes, No, false, false, "", "ᄡ")},
- {0xffb5, 0, 0, 0, g(Yes, No, false, false, "", "ᄉ")},
- {0xffb6, 0, 0, 0, g(Yes, No, false, false, "", "ᄊ")},
- {0xffb7, 0, 0, 0, g(Yes, No, false, false, "", "ᄋ")},
- {0xffb8, 0, 0, 0, g(Yes, No, false, false, "", "ᄌ")},
- {0xffb9, 0, 0, 0, g(Yes, No, false, false, "", "ᄍ")},
- {0xffba, 0, 0, 0, g(Yes, No, false, false, "", "ᄎ")},
- {0xffbb, 0, 0, 0, g(Yes, No, false, false, "", "ᄏ")},
- {0xffbc, 0, 0, 0, g(Yes, No, false, false, "", "ᄐ")},
- {0xffbd, 0, 0, 0, g(Yes, No, false, false, "", "ᄑ")},
- {0xffbe, 0, 0, 0, g(Yes, No, false, false, "", "ᄒ")},
- {0xffbf, 0, 0, 0, f(Yes, false, "")},
- {0xffc2, 0, 1, 1, g(Yes, No, false, false, "", "ᅡ")},
- {0xffc3, 0, 1, 1, g(Yes, No, false, false, "", "ᅢ")},
- {0xffc4, 0, 1, 1, g(Yes, No, false, false, "", "ᅣ")},
- {0xffc5, 0, 1, 1, g(Yes, No, false, false, "", "ᅤ")},
- {0xffc6, 0, 1, 1, g(Yes, No, false, false, "", "ᅥ")},
- {0xffc7, 0, 1, 1, g(Yes, No, false, false, "", "ᅦ")},
- {0xffc8, 0, 0, 0, f(Yes, false, "")},
- {0xffca, 0, 1, 1, g(Yes, No, false, false, "", "ᅧ")},
- {0xffcb, 0, 1, 1, g(Yes, No, false, false, "", "ᅨ")},
- {0xffcc, 0, 1, 1, g(Yes, No, false, false, "", "ᅩ")},
- {0xffcd, 0, 1, 1, g(Yes, No, false, false, "", "ᅪ")},
- {0xffce, 0, 1, 1, g(Yes, No, false, false, "", "ᅫ")},
- {0xffcf, 0, 1, 1, g(Yes, No, false, false, "", "ᅬ")},
- {0xffd0, 0, 0, 0, f(Yes, false, "")},
- {0xffd2, 0, 1, 1, g(Yes, No, false, false, "", "ᅭ")},
- {0xffd3, 0, 1, 1, g(Yes, No, false, false, "", "ᅮ")},
- {0xffd4, 0, 1, 1, g(Yes, No, false, false, "", "ᅯ")},
- {0xffd5, 0, 1, 1, g(Yes, No, false, false, "", "ᅰ")},
- {0xffd6, 0, 1, 1, g(Yes, No, false, false, "", "ᅱ")},
- {0xffd7, 0, 1, 1, g(Yes, No, false, false, "", "ᅲ")},
- {0xffd8, 0, 0, 0, f(Yes, false, "")},
- {0xffda, 0, 1, 1, g(Yes, No, false, false, "", "ᅳ")},
- {0xffdb, 0, 1, 1, g(Yes, No, false, false, "", "ᅴ")},
- {0xffdc, 0, 1, 1, g(Yes, No, false, false, "", "ᅵ")},
- {0xffdd, 0, 0, 0, f(Yes, false, "")},
- {0xffe0, 0, 0, 0, g(Yes, No, false, false, "", "¢")},
- {0xffe1, 0, 0, 0, g(Yes, No, false, false, "", "£")},
- {0xffe2, 0, 0, 0, g(Yes, No, false, false, "", "¬")},
- {0xffe3, 0, 0, 1, g(Yes, No, false, false, "", " ̄")},
- {0xffe4, 0, 0, 0, g(Yes, No, false, false, "", "¦")},
- {0xffe5, 0, 0, 0, g(Yes, No, false, false, "", "¥")},
- {0xffe6, 0, 0, 0, g(Yes, No, false, false, "", "₩")},
- {0xffe7, 0, 0, 0, f(Yes, false, "")},
- {0xffe8, 0, 0, 0, g(Yes, No, false, false, "", "│")},
- {0xffe9, 0, 0, 0, g(Yes, No, false, false, "", "←")},
- {0xffea, 0, 0, 0, g(Yes, No, false, false, "", "↑")},
- {0xffeb, 0, 0, 0, g(Yes, No, false, false, "", "→")},
- {0xffec, 0, 0, 0, g(Yes, No, false, false, "", "↓")},
- {0xffed, 0, 0, 0, g(Yes, No, false, false, "", "■")},
- {0xffee, 0, 0, 0, g(Yes, No, false, false, "", "○")},
- {0xffef, 0, 0, 0, f(Yes, false, "")},
- {0x101fd, 220, 1, 1, f(Yes, false, "")},
- {0x101fe, 0, 0, 0, f(Yes, false, "")},
- {0x102e0, 220, 1, 1, f(Yes, false, "")},
- {0x102e1, 0, 0, 0, f(Yes, false, "")},
- {0x10376, 230, 1, 1, f(Yes, false, "")},
- {0x1037b, 0, 0, 0, f(Yes, false, "")},
- {0x10a0d, 220, 1, 1, f(Yes, false, "")},
- {0x10a0e, 0, 0, 0, f(Yes, false, "")},
- {0x10a0f, 230, 1, 1, f(Yes, false, "")},
- {0x10a10, 0, 0, 0, f(Yes, false, "")},
- {0x10a38, 230, 1, 1, f(Yes, false, "")},
- {0x10a39, 1, 1, 1, f(Yes, false, "")},
- {0x10a3a, 220, 1, 1, f(Yes, false, "")},
- {0x10a3b, 0, 0, 0, f(Yes, false, "")},
- {0x10a3f, 9, 1, 1, f(Yes, false, "")},
- {0x10a40, 0, 0, 0, f(Yes, false, "")},
- {0x10ae5, 230, 1, 1, f(Yes, false, "")},
- {0x10ae6, 220, 1, 1, f(Yes, false, "")},
- {0x10ae7, 0, 0, 0, f(Yes, false, "")},
- {0x11046, 9, 1, 1, f(Yes, false, "")},
- {0x11047, 0, 0, 0, f(Yes, false, "")},
- {0x1107f, 9, 1, 1, f(Yes, false, "")},
- {0x11080, 0, 0, 0, f(Yes, false, "")},
- {0x11099, 0, 0, 0, f(Yes, true, "")},
- {0x1109a, 0, 0, 1, f(Yes, false, "𑂚")},
- {0x1109b, 0, 0, 0, f(Yes, true, "")},
- {0x1109c, 0, 0, 1, f(Yes, false, "𑂜")},
- {0x1109d, 0, 0, 0, f(Yes, false, "")},
- {0x110a5, 0, 0, 0, f(Yes, true, "")},
- {0x110a6, 0, 0, 0, f(Yes, false, "")},
- {0x110ab, 0, 0, 1, f(Yes, false, "𑂫")},
- {0x110ac, 0, 0, 0, f(Yes, false, "")},
- {0x110b9, 9, 1, 1, f(Yes, false, "")},
- {0x110ba, 7, 1, 1, f(Maybe, false, "")},
- {0x110bb, 0, 0, 0, f(Yes, false, "")},
- {0x11100, 230, 1, 1, f(Yes, false, "")},
- {0x11103, 0, 0, 0, f(Yes, false, "")},
- {0x11127, 0, 1, 1, f(Maybe, false, "")},
- {0x11128, 0, 0, 0, f(Yes, false, "")},
- {0x1112e, 0, 0, 1, f(Yes, false, "𑄮")},
- {0x1112f, 0, 0, 1, f(Yes, false, "𑄯")},
- {0x11130, 0, 0, 0, f(Yes, false, "")},
- {0x11131, 0, 0, 0, f(Yes, true, "")},
- {0x11133, 9, 1, 1, f(Yes, false, "")},
- {0x11135, 0, 0, 0, f(Yes, false, "")},
- {0x11173, 7, 1, 1, f(Yes, false, "")},
- {0x11174, 0, 0, 0, f(Yes, false, "")},
- {0x111c0, 9, 1, 1, f(Yes, false, "")},
- {0x111c1, 0, 0, 0, f(Yes, false, "")},
- {0x111ca, 7, 1, 1, f(Yes, false, "")},
- {0x111cb, 0, 0, 0, f(Yes, false, "")},
- {0x11235, 9, 1, 1, f(Yes, false, "")},
- {0x11236, 7, 1, 1, f(Yes, false, "")},
- {0x11237, 0, 0, 0, f(Yes, false, "")},
- {0x112e9, 7, 1, 1, f(Yes, false, "")},
- {0x112ea, 9, 1, 1, f(Yes, false, "")},
- {0x112eb, 0, 0, 0, f(Yes, false, "")},
- {0x1133c, 7, 1, 1, f(Yes, false, "")},
- {0x1133d, 0, 0, 0, f(Yes, false, "")},
- {0x1133e, 0, 1, 1, f(Maybe, false, "")},
- {0x1133f, 0, 0, 0, f(Yes, false, "")},
- {0x11347, 0, 0, 0, f(Yes, true, "")},
- {0x11348, 0, 0, 0, f(Yes, false, "")},
- {0x1134b, 0, 0, 1, f(Yes, false, "𑍋")},
- {0x1134c, 0, 0, 1, f(Yes, false, "𑍌")},
- {0x1134d, 9, 1, 1, f(Yes, false, "")},
- {0x1134e, 0, 0, 0, f(Yes, false, "")},
- {0x11357, 0, 1, 1, f(Maybe, false, "")},
- {0x11358, 0, 0, 0, f(Yes, false, "")},
- {0x11366, 230, 1, 1, f(Yes, false, "")},
- {0x1136d, 0, 0, 0, f(Yes, false, "")},
- {0x11370, 230, 1, 1, f(Yes, false, "")},
- {0x11375, 0, 0, 0, f(Yes, false, "")},
- {0x11442, 9, 1, 1, f(Yes, false, "")},
- {0x11443, 0, 0, 0, f(Yes, false, "")},
- {0x11446, 7, 1, 1, f(Yes, false, "")},
- {0x11447, 0, 0, 0, f(Yes, false, "")},
- {0x114b0, 0, 1, 1, f(Maybe, false, "")},
- {0x114b1, 0, 0, 0, f(Yes, false, "")},
- {0x114b9, 0, 0, 0, f(Yes, true, "")},
- {0x114ba, 0, 1, 1, f(Maybe, false, "")},
- {0x114bb, 0, 0, 1, f(Yes, false, "𑒻")},
- {0x114bc, 0, 0, 1, f(Yes, false, "𑒼")},
- {0x114bd, 0, 1, 1, f(Maybe, false, "")},
- {0x114be, 0, 0, 1, f(Yes, false, "𑒾")},
- {0x114bf, 0, 0, 0, f(Yes, false, "")},
- {0x114c2, 9, 1, 1, f(Yes, false, "")},
- {0x114c3, 7, 1, 1, f(Yes, false, "")},
- {0x114c4, 0, 0, 0, f(Yes, false, "")},
- {0x115af, 0, 1, 1, f(Maybe, false, "")},
- {0x115b0, 0, 0, 0, f(Yes, false, "")},
- {0x115b8, 0, 0, 0, f(Yes, true, "")},
- {0x115ba, 0, 0, 1, f(Yes, false, "𑖺")},
- {0x115bb, 0, 0, 1, f(Yes, false, "𑖻")},
- {0x115bc, 0, 0, 0, f(Yes, false, "")},
- {0x115bf, 9, 1, 1, f(Yes, false, "")},
- {0x115c0, 7, 1, 1, f(Yes, false, "")},
- {0x115c1, 0, 0, 0, f(Yes, false, "")},
- {0x1163f, 9, 1, 1, f(Yes, false, "")},
- {0x11640, 0, 0, 0, f(Yes, false, "")},
- {0x116b6, 9, 1, 1, f(Yes, false, "")},
- {0x116b7, 7, 1, 1, f(Yes, false, "")},
- {0x116b8, 0, 0, 0, f(Yes, false, "")},
- {0x1172b, 9, 1, 1, f(Yes, false, "")},
- {0x1172c, 0, 0, 0, f(Yes, false, "")},
- {0x11c3f, 9, 1, 1, f(Yes, false, "")},
- {0x11c40, 0, 0, 0, f(Yes, false, "")},
- {0x16af0, 1, 1, 1, f(Yes, false, "")},
- {0x16af5, 0, 0, 0, f(Yes, false, "")},
- {0x16b30, 230, 1, 1, f(Yes, false, "")},
- {0x16b37, 0, 0, 0, f(Yes, false, "")},
- {0x1bc9e, 1, 1, 1, f(Yes, false, "")},
- {0x1bc9f, 0, 0, 0, f(Yes, false, "")},
- {0x1d15e, 0, 0, 1, f(No, false, "𝅗𝅥")},
- {0x1d15f, 0, 0, 1, f(No, false, "𝅘𝅥")},
- {0x1d160, 0, 0, 2, f(No, false, "𝅘𝅥𝅮")},
- {0x1d161, 0, 0, 2, f(No, false, "𝅘𝅥𝅯")},
- {0x1d162, 0, 0, 2, f(No, false, "𝅘𝅥𝅰")},
- {0x1d163, 0, 0, 2, f(No, false, "𝅘𝅥𝅱")},
- {0x1d164, 0, 0, 2, f(No, false, "𝅘𝅥𝅲")},
- {0x1d165, 216, 1, 1, f(Yes, false, "")},
- {0x1d167, 1, 1, 1, f(Yes, false, "")},
- {0x1d16a, 0, 0, 0, f(Yes, false, "")},
- {0x1d16d, 226, 1, 1, f(Yes, false, "")},
- {0x1d16e, 216, 1, 1, f(Yes, false, "")},
- {0x1d173, 0, 0, 0, f(Yes, false, "")},
- {0x1d17b, 220, 1, 1, f(Yes, false, "")},
- {0x1d183, 0, 0, 0, f(Yes, false, "")},
- {0x1d185, 230, 1, 1, f(Yes, false, "")},
- {0x1d18a, 220, 1, 1, f(Yes, false, "")},
- {0x1d18c, 0, 0, 0, f(Yes, false, "")},
- {0x1d1aa, 230, 1, 1, f(Yes, false, "")},
- {0x1d1ae, 0, 0, 0, f(Yes, false, "")},
- {0x1d1bb, 0, 0, 1, f(No, false, "𝆹𝅥")},
- {0x1d1bc, 0, 0, 1, f(No, false, "𝆺𝅥")},
- {0x1d1bd, 0, 0, 2, f(No, false, "𝆹𝅥𝅮")},
- {0x1d1be, 0, 0, 2, f(No, false, "𝆺𝅥𝅮")},
- {0x1d1bf, 0, 0, 2, f(No, false, "𝆹𝅥𝅯")},
- {0x1d1c0, 0, 0, 2, f(No, false, "𝆺𝅥𝅯")},
- {0x1d1c1, 0, 0, 0, f(Yes, false, "")},
- {0x1d242, 230, 1, 1, f(Yes, false, "")},
- {0x1d245, 0, 0, 0, f(Yes, false, "")},
- {0x1d400, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d401, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d402, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d403, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d404, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d405, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d406, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d407, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d408, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d409, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d40a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d40b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d40c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d40d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d40e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d40f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d410, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d411, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d412, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d413, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d414, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d415, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d416, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d417, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d418, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d419, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d41a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d41b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d41c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d41d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d41e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d41f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d420, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d421, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d422, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d423, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d424, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d425, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d426, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d427, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d428, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d429, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d42a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d42b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d42c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d42d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d42e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d42f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d430, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d431, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d432, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d433, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d434, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d435, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d436, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d437, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d438, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d439, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d43a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d43b, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d43c, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d43d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d43e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d43f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d440, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d441, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d442, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d443, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d444, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d445, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d446, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d447, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d448, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d449, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d44a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d44b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d44c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d44d, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d44e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d44f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d450, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d451, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d452, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d453, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d454, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d455, 0, 0, 0, f(Yes, false, "")},
- {0x1d456, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d457, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d458, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d459, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d45a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d45b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d45c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d45d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d45e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d45f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d460, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d461, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d462, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d463, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d464, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d465, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d466, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d467, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d468, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d469, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d46a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d46b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d46c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d46d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d46e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d46f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d470, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d471, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d472, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d473, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d474, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d475, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d476, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d477, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d478, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d479, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d47a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d47b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d47c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d47d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d47e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d47f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d480, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d481, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d482, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d483, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d484, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d485, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d486, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d487, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d488, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d489, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d48a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d48b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d48c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d48d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d48e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d48f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d490, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d491, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d492, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d493, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d494, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d495, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d496, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d497, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d498, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d499, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d49a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d49b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d49c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d49d, 0, 0, 0, f(Yes, false, "")},
- {0x1d49e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d49f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4a0, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a2, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4a3, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a5, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4a6, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4a7, 0, 0, 0, f(Yes, false, "")},
- {0x1d4a9, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4aa, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4ab, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4ac, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4ad, 0, 0, 0, f(Yes, false, "")},
- {0x1d4ae, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4af, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4b0, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4b1, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4b2, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4b3, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4b4, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4b5, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4b6, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4b7, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4b8, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4b9, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ba, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bb, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4bc, 0, 0, 0, f(Yes, false, "")},
- {0x1d4bd, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4be, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4bf, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4c0, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4c1, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4c2, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4c3, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4c4, 0, 0, 0, f(Yes, false, "")},
- {0x1d4c5, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4c6, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4c7, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4c8, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4c9, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4ca, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4cb, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d4cc, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d4cd, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d4ce, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d4cf, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d4d0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d4d1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d4d2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d4d3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d4d4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d4d5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d4d6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d4d7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d4d8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d4d9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d4da, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d4db, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d4dc, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d4dd, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d4de, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d4df, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d4e0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d4e1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d4e2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d4e3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d4e4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d4e5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d4e6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d4e7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d4e8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d4e9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d4ea, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d4eb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d4ec, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d4ed, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d4ee, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d4ef, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d4f0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d4f1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d4f2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d4f3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d4f4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d4f5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d4f6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d4f7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d4f8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d4f9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d4fa, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d4fb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d4fc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d4fd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d4fe, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d4ff, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d500, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d501, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d502, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d503, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d504, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d505, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d506, 0, 0, 0, f(Yes, false, "")},
- {0x1d507, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d508, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d509, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d50a, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d50b, 0, 0, 0, f(Yes, false, "")},
- {0x1d50d, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d50e, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d50f, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d510, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d511, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d512, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d513, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d514, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d515, 0, 0, 0, f(Yes, false, "")},
- {0x1d516, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d517, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d518, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d519, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d51a, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d51b, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d51c, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d51d, 0, 0, 0, f(Yes, false, "")},
- {0x1d51e, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d51f, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d520, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d521, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d522, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d523, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d524, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d525, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d526, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d527, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d528, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d529, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d52a, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d52b, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d52c, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d52d, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d52e, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d52f, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d530, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d531, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d532, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d533, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d534, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d535, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d536, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d537, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d538, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d539, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d53a, 0, 0, 0, f(Yes, false, "")},
- {0x1d53b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d53c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d53d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d53e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d53f, 0, 0, 0, f(Yes, false, "")},
- {0x1d540, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d541, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d542, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d543, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d544, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d545, 0, 0, 0, f(Yes, false, "")},
- {0x1d546, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d547, 0, 0, 0, f(Yes, false, "")},
- {0x1d54a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d54b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d54c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d54d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d54e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d54f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d550, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d551, 0, 0, 0, f(Yes, false, "")},
- {0x1d552, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d553, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d554, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d555, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d556, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d557, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d558, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d559, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d55a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d55b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d55c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d55d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d55e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d55f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d560, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d561, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d562, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d563, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d564, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d565, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d566, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d567, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d568, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d569, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d56a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d56b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d56c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d56d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d56e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d56f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d570, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d571, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d572, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d573, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d574, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d575, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d576, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d577, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d578, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d579, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d57a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d57b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d57c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d57d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d57e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d57f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d580, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d581, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d582, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d583, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d584, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d585, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d586, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d587, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d588, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d589, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d58a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d58b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d58c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d58d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d58e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d58f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d590, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d591, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d592, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d593, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d594, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d595, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d596, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d597, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d598, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d599, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d59a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d59b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d59c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d59d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d59e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d59f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5a0, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5a1, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5a2, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5a3, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5a4, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5a5, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5a6, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5a7, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5a8, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5a9, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5aa, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5ab, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5ac, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5ad, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5ae, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5af, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5b0, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5b1, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5b2, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5b3, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5b4, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5b5, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5b6, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5b7, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5b8, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5b9, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ba, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5bb, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5bc, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5bd, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5be, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5bf, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5c0, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5c1, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5c2, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5c3, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5c4, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5c5, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5c6, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5c7, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5c8, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5c9, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5ca, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5cb, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d5cc, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d5cd, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d5ce, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d5cf, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d5d0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d5d1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d5d2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d5d3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d5d4, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d5d5, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d5d6, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d5d7, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d5d8, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d5d9, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d5da, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d5db, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d5dc, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d5dd, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d5de, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d5df, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d5e0, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d5e1, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d5e2, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d5e3, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d5e4, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d5e5, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d5e6, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d5e7, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d5e8, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d5e9, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d5ea, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d5eb, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d5ec, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d5ed, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d5ee, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d5ef, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d5f0, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d5f1, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d5f2, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d5f3, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d5f4, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d5f5, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d5f6, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d5f7, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d5f8, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d5f9, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d5fa, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d5fb, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d5fc, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d5fd, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d5fe, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d5ff, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d600, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d601, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d602, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d603, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d604, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d605, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d606, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d607, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d608, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d609, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d60a, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d60b, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d60c, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d60d, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d60e, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d60f, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d610, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d611, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d612, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d613, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d614, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d615, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d616, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d617, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d618, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d619, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d61a, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d61b, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d61c, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d61d, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d61e, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d61f, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d620, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d621, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d622, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d623, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d624, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d625, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d626, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d627, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d628, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d629, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d62a, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d62b, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d62c, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d62d, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d62e, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d62f, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d630, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d631, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d632, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d633, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d634, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d635, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d636, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d637, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d638, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d639, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d63a, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d63b, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d63c, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d63d, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d63e, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d63f, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d640, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d641, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d642, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d643, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d644, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d645, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d646, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d647, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d648, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d649, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d64a, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d64b, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d64c, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d64d, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d64e, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d64f, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d650, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d651, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d652, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d653, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d654, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d655, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d656, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d657, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d658, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d659, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d65a, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d65b, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d65c, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d65d, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d65e, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d65f, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d660, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d661, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d662, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d663, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d664, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d665, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d666, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d667, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d668, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d669, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d66a, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d66b, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d66c, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d66d, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d66e, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d66f, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d670, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1d671, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1d672, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1d673, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1d674, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1d675, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1d676, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1d677, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1d678, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1d679, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1d67a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1d67b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1d67c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1d67d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1d67e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1d67f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1d680, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1d681, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1d682, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1d683, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1d684, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1d685, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1d686, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1d687, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1d688, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1d689, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1d68a, 0, 0, 0, g(Yes, No, false, false, "", "a")},
- {0x1d68b, 0, 0, 0, g(Yes, No, false, false, "", "b")},
- {0x1d68c, 0, 0, 0, g(Yes, No, false, false, "", "c")},
- {0x1d68d, 0, 0, 0, g(Yes, No, false, false, "", "d")},
- {0x1d68e, 0, 0, 0, g(Yes, No, false, false, "", "e")},
- {0x1d68f, 0, 0, 0, g(Yes, No, false, false, "", "f")},
- {0x1d690, 0, 0, 0, g(Yes, No, false, false, "", "g")},
- {0x1d691, 0, 0, 0, g(Yes, No, false, false, "", "h")},
- {0x1d692, 0, 0, 0, g(Yes, No, false, false, "", "i")},
- {0x1d693, 0, 0, 0, g(Yes, No, false, false, "", "j")},
- {0x1d694, 0, 0, 0, g(Yes, No, false, false, "", "k")},
- {0x1d695, 0, 0, 0, g(Yes, No, false, false, "", "l")},
- {0x1d696, 0, 0, 0, g(Yes, No, false, false, "", "m")},
- {0x1d697, 0, 0, 0, g(Yes, No, false, false, "", "n")},
- {0x1d698, 0, 0, 0, g(Yes, No, false, false, "", "o")},
- {0x1d699, 0, 0, 0, g(Yes, No, false, false, "", "p")},
- {0x1d69a, 0, 0, 0, g(Yes, No, false, false, "", "q")},
- {0x1d69b, 0, 0, 0, g(Yes, No, false, false, "", "r")},
- {0x1d69c, 0, 0, 0, g(Yes, No, false, false, "", "s")},
- {0x1d69d, 0, 0, 0, g(Yes, No, false, false, "", "t")},
- {0x1d69e, 0, 0, 0, g(Yes, No, false, false, "", "u")},
- {0x1d69f, 0, 0, 0, g(Yes, No, false, false, "", "v")},
- {0x1d6a0, 0, 0, 0, g(Yes, No, false, false, "", "w")},
- {0x1d6a1, 0, 0, 0, g(Yes, No, false, false, "", "x")},
- {0x1d6a2, 0, 0, 0, g(Yes, No, false, false, "", "y")},
- {0x1d6a3, 0, 0, 0, g(Yes, No, false, false, "", "z")},
- {0x1d6a4, 0, 0, 0, g(Yes, No, false, false, "", "ı")},
- {0x1d6a5, 0, 0, 0, g(Yes, No, false, false, "", "ȷ")},
- {0x1d6a6, 0, 0, 0, f(Yes, false, "")},
- {0x1d6a8, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6a9, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6aa, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6ab, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6ac, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6ad, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6ae, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6af, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6b0, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6b1, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6b2, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6b3, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6b4, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6b5, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6b6, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6b7, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6b8, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6b9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ba, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6bb, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6bc, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6bd, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6be, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6bf, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6c0, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6c1, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6c2, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6c3, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6c4, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6c5, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d6c6, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6c7, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d6c8, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d6c9, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6ca, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d6cb, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6cc, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d6cd, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d6ce, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d6cf, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d6d0, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d6d1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6d2, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6d3, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d6d4, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d6d5, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d6d6, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d6d7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6d8, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d6d9, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d6da, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d6db, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d6dc, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d6dd, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d6de, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d6df, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d6e0, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d6e1, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d6e2, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d6e3, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d6e4, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d6e5, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d6e6, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d6e7, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d6e8, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d6e9, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6ea, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d6eb, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d6ec, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d6ed, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d6ee, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d6ef, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d6f0, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d6f1, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d6f2, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d6f3, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d6f4, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d6f5, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d6f6, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d6f7, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d6f8, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d6f9, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d6fa, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d6fb, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d6fc, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d6fd, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d6fe, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d6ff, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d700, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d701, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d702, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d703, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d704, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d705, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d706, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d707, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d708, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d709, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d70a, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d70b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d70c, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d70d, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d70e, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d70f, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d710, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d711, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d712, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d713, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d714, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d715, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d716, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d717, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d718, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d719, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d71a, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d71b, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d71c, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d71d, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d71e, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d71f, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d720, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d721, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d722, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d723, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d724, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d725, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d726, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d727, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d728, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d729, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d72a, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d72b, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d72c, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d72d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d72e, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d72f, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d730, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d731, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d732, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d733, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d734, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d735, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d736, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d737, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d738, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d739, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d73a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d73b, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d73c, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d73d, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d73e, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d73f, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d740, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d741, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d742, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d743, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d744, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d745, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d746, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d747, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d748, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d749, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d74a, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d74b, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d74c, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d74d, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d74e, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d74f, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d750, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d751, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d752, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d753, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d754, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d755, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d756, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d757, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d758, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d759, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d75a, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d75b, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d75c, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d75d, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d75e, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d75f, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d760, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d761, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d762, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d763, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d764, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d765, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d766, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d767, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d768, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d769, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d76a, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d76b, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d76c, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d76d, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d76e, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d76f, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d770, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d771, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d772, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d773, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d774, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d775, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d776, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d777, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d778, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d779, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d77a, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d77b, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d77c, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d77d, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d77e, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d77f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d780, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d781, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d782, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d783, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d784, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d785, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d786, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d787, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d788, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d789, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d78a, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d78b, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d78c, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d78d, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d78e, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d78f, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d790, 0, 0, 0, g(Yes, No, false, false, "", "Α")},
- {0x1d791, 0, 0, 0, g(Yes, No, false, false, "", "Β")},
- {0x1d792, 0, 0, 0, g(Yes, No, false, false, "", "Γ")},
- {0x1d793, 0, 0, 0, g(Yes, No, false, false, "", "Δ")},
- {0x1d794, 0, 0, 0, g(Yes, No, false, false, "", "Ε")},
- {0x1d795, 0, 0, 0, g(Yes, No, false, false, "", "Ζ")},
- {0x1d796, 0, 0, 0, g(Yes, No, false, false, "", "Η")},
- {0x1d797, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d798, 0, 0, 0, g(Yes, No, false, false, "", "Ι")},
- {0x1d799, 0, 0, 0, g(Yes, No, false, false, "", "Κ")},
- {0x1d79a, 0, 0, 0, g(Yes, No, false, false, "", "Λ")},
- {0x1d79b, 0, 0, 0, g(Yes, No, false, false, "", "Μ")},
- {0x1d79c, 0, 0, 0, g(Yes, No, false, false, "", "Ν")},
- {0x1d79d, 0, 0, 0, g(Yes, No, false, false, "", "Ξ")},
- {0x1d79e, 0, 0, 0, g(Yes, No, false, false, "", "Ο")},
- {0x1d79f, 0, 0, 0, g(Yes, No, false, false, "", "Π")},
- {0x1d7a0, 0, 0, 0, g(Yes, No, false, false, "", "Ρ")},
- {0x1d7a1, 0, 0, 0, g(Yes, No, false, false, "", "Θ")},
- {0x1d7a2, 0, 0, 0, g(Yes, No, false, false, "", "Σ")},
- {0x1d7a3, 0, 0, 0, g(Yes, No, false, false, "", "Τ")},
- {0x1d7a4, 0, 0, 0, g(Yes, No, false, false, "", "Υ")},
- {0x1d7a5, 0, 0, 0, g(Yes, No, false, false, "", "Φ")},
- {0x1d7a6, 0, 0, 0, g(Yes, No, false, false, "", "Χ")},
- {0x1d7a7, 0, 0, 0, g(Yes, No, false, false, "", "Ψ")},
- {0x1d7a8, 0, 0, 0, g(Yes, No, false, false, "", "Ω")},
- {0x1d7a9, 0, 0, 0, g(Yes, No, false, false, "", "∇")},
- {0x1d7aa, 0, 0, 0, g(Yes, No, false, false, "", "α")},
- {0x1d7ab, 0, 0, 0, g(Yes, No, false, false, "", "β")},
- {0x1d7ac, 0, 0, 0, g(Yes, No, false, false, "", "γ")},
- {0x1d7ad, 0, 0, 0, g(Yes, No, false, false, "", "δ")},
- {0x1d7ae, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7af, 0, 0, 0, g(Yes, No, false, false, "", "ζ")},
- {0x1d7b0, 0, 0, 0, g(Yes, No, false, false, "", "η")},
- {0x1d7b1, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7b2, 0, 0, 0, g(Yes, No, false, false, "", "ι")},
- {0x1d7b3, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7b4, 0, 0, 0, g(Yes, No, false, false, "", "λ")},
- {0x1d7b5, 0, 0, 0, g(Yes, No, false, false, "", "μ")},
- {0x1d7b6, 0, 0, 0, g(Yes, No, false, false, "", "ν")},
- {0x1d7b7, 0, 0, 0, g(Yes, No, false, false, "", "ξ")},
- {0x1d7b8, 0, 0, 0, g(Yes, No, false, false, "", "ο")},
- {0x1d7b9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ba, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7bb, 0, 0, 0, g(Yes, No, false, false, "", "ς")},
- {0x1d7bc, 0, 0, 0, g(Yes, No, false, false, "", "σ")},
- {0x1d7bd, 0, 0, 0, g(Yes, No, false, false, "", "τ")},
- {0x1d7be, 0, 0, 0, g(Yes, No, false, false, "", "υ")},
- {0x1d7bf, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c0, 0, 0, 0, g(Yes, No, false, false, "", "χ")},
- {0x1d7c1, 0, 0, 0, g(Yes, No, false, false, "", "ψ")},
- {0x1d7c2, 0, 0, 0, g(Yes, No, false, false, "", "ω")},
- {0x1d7c3, 0, 0, 0, g(Yes, No, false, false, "", "∂")},
- {0x1d7c4, 0, 0, 0, g(Yes, No, false, false, "", "ε")},
- {0x1d7c5, 0, 0, 0, g(Yes, No, false, false, "", "θ")},
- {0x1d7c6, 0, 0, 0, g(Yes, No, false, false, "", "κ")},
- {0x1d7c7, 0, 0, 0, g(Yes, No, false, false, "", "φ")},
- {0x1d7c8, 0, 0, 0, g(Yes, No, false, false, "", "ρ")},
- {0x1d7c9, 0, 0, 0, g(Yes, No, false, false, "", "π")},
- {0x1d7ca, 0, 0, 0, g(Yes, No, false, false, "", "Ϝ")},
- {0x1d7cb, 0, 0, 0, g(Yes, No, false, false, "", "ϝ")},
- {0x1d7cc, 0, 0, 0, f(Yes, false, "")},
- {0x1d7ce, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7cf, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7d0, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7d1, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7d2, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7d3, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7d4, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7d5, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7d6, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7d7, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7d8, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7d9, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7da, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7db, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7dc, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7dd, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7de, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7df, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7e0, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7e1, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7e2, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7e3, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7e4, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7e5, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7e6, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7e7, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7e8, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7e9, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7ea, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7eb, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7ec, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7ed, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7ee, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7ef, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7f0, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7f1, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7f2, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7f3, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7f4, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7f5, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d7f6, 0, 0, 0, g(Yes, No, false, false, "", "0")},
- {0x1d7f7, 0, 0, 0, g(Yes, No, false, false, "", "1")},
- {0x1d7f8, 0, 0, 0, g(Yes, No, false, false, "", "2")},
- {0x1d7f9, 0, 0, 0, g(Yes, No, false, false, "", "3")},
- {0x1d7fa, 0, 0, 0, g(Yes, No, false, false, "", "4")},
- {0x1d7fb, 0, 0, 0, g(Yes, No, false, false, "", "5")},
- {0x1d7fc, 0, 0, 0, g(Yes, No, false, false, "", "6")},
- {0x1d7fd, 0, 0, 0, g(Yes, No, false, false, "", "7")},
- {0x1d7fe, 0, 0, 0, g(Yes, No, false, false, "", "8")},
- {0x1d7ff, 0, 0, 0, g(Yes, No, false, false, "", "9")},
- {0x1d800, 0, 0, 0, f(Yes, false, "")},
- {0x1e000, 230, 1, 1, f(Yes, false, "")},
- {0x1e007, 0, 0, 0, f(Yes, false, "")},
- {0x1e008, 230, 1, 1, f(Yes, false, "")},
- {0x1e019, 0, 0, 0, f(Yes, false, "")},
- {0x1e01b, 230, 1, 1, f(Yes, false, "")},
- {0x1e022, 0, 0, 0, f(Yes, false, "")},
- {0x1e023, 230, 1, 1, f(Yes, false, "")},
- {0x1e025, 0, 0, 0, f(Yes, false, "")},
- {0x1e026, 230, 1, 1, f(Yes, false, "")},
- {0x1e02b, 0, 0, 0, f(Yes, false, "")},
- {0x1e8d0, 220, 1, 1, f(Yes, false, "")},
- {0x1e8d7, 0, 0, 0, f(Yes, false, "")},
- {0x1e944, 230, 1, 1, f(Yes, false, "")},
- {0x1e94a, 7, 1, 1, f(Yes, false, "")},
- {0x1e94b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee00, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee01, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee02, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee03, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee04, 0, 0, 0, f(Yes, false, "")},
- {0x1ee05, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee06, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee07, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee08, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee09, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee0a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee0b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee0c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee0d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee0e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee0f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee10, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee11, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee12, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee13, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee14, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee15, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee16, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee17, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee18, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee19, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee1a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee1b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee1c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee1d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee1e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee1f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee20, 0, 0, 0, f(Yes, false, "")},
- {0x1ee21, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee22, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee23, 0, 0, 0, f(Yes, false, "")},
- {0x1ee24, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee25, 0, 0, 0, f(Yes, false, "")},
- {0x1ee27, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee28, 0, 0, 0, f(Yes, false, "")},
- {0x1ee29, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee2a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee2b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee2c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee2d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee2e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee2f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee30, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee31, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee32, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee33, 0, 0, 0, f(Yes, false, "")},
- {0x1ee34, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee35, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee36, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee37, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee38, 0, 0, 0, f(Yes, false, "")},
- {0x1ee39, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee3a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee3b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee3c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee42, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee43, 0, 0, 0, f(Yes, false, "")},
- {0x1ee47, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee48, 0, 0, 0, f(Yes, false, "")},
- {0x1ee49, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee4a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee4c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee4d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee4e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee4f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee50, 0, 0, 0, f(Yes, false, "")},
- {0x1ee51, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee52, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee53, 0, 0, 0, f(Yes, false, "")},
- {0x1ee54, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee55, 0, 0, 0, f(Yes, false, "")},
- {0x1ee57, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee58, 0, 0, 0, f(Yes, false, "")},
- {0x1ee59, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee5a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee5c, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5d, 0, 0, 0, g(Yes, No, false, false, "", "ں")},
- {0x1ee5e, 0, 0, 0, f(Yes, false, "")},
- {0x1ee5f, 0, 0, 0, g(Yes, No, false, false, "", "ٯ")},
- {0x1ee60, 0, 0, 0, f(Yes, false, "")},
- {0x1ee61, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee62, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee63, 0, 0, 0, f(Yes, false, "")},
- {0x1ee64, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee65, 0, 0, 0, f(Yes, false, "")},
- {0x1ee67, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee68, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee69, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee6a, 0, 0, 0, g(Yes, No, false, false, "", "ك")},
- {0x1ee6b, 0, 0, 0, f(Yes, false, "")},
- {0x1ee6c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee6d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee6e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee6f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee70, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee71, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee72, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee73, 0, 0, 0, f(Yes, false, "")},
- {0x1ee74, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee75, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee76, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee77, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee78, 0, 0, 0, f(Yes, false, "")},
- {0x1ee79, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee7a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee7b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee7c, 0, 0, 0, g(Yes, No, false, false, "", "ٮ")},
- {0x1ee7d, 0, 0, 0, f(Yes, false, "")},
- {0x1ee7e, 0, 0, 0, g(Yes, No, false, false, "", "ڡ")},
- {0x1ee7f, 0, 0, 0, f(Yes, false, "")},
- {0x1ee80, 0, 0, 0, g(Yes, No, false, false, "", "ا")},
- {0x1ee81, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1ee82, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1ee83, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1ee84, 0, 0, 0, g(Yes, No, false, false, "", "ه")},
- {0x1ee85, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1ee86, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1ee87, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1ee88, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1ee89, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1ee8a, 0, 0, 0, f(Yes, false, "")},
- {0x1ee8b, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1ee8c, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1ee8d, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1ee8e, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1ee8f, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1ee90, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1ee91, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1ee92, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1ee93, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1ee94, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1ee95, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1ee96, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1ee97, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1ee98, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1ee99, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1ee9a, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1ee9b, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1ee9c, 0, 0, 0, f(Yes, false, "")},
- {0x1eea1, 0, 0, 0, g(Yes, No, false, false, "", "ب")},
- {0x1eea2, 0, 0, 0, g(Yes, No, false, false, "", "ج")},
- {0x1eea3, 0, 0, 0, g(Yes, No, false, false, "", "د")},
- {0x1eea4, 0, 0, 0, f(Yes, false, "")},
- {0x1eea5, 0, 0, 0, g(Yes, No, false, false, "", "و")},
- {0x1eea6, 0, 0, 0, g(Yes, No, false, false, "", "ز")},
- {0x1eea7, 0, 0, 0, g(Yes, No, false, false, "", "ح")},
- {0x1eea8, 0, 0, 0, g(Yes, No, false, false, "", "ط")},
- {0x1eea9, 0, 0, 0, g(Yes, No, false, false, "", "ي")},
- {0x1eeaa, 0, 0, 0, f(Yes, false, "")},
- {0x1eeab, 0, 0, 0, g(Yes, No, false, false, "", "ل")},
- {0x1eeac, 0, 0, 0, g(Yes, No, false, false, "", "م")},
- {0x1eead, 0, 0, 0, g(Yes, No, false, false, "", "ن")},
- {0x1eeae, 0, 0, 0, g(Yes, No, false, false, "", "س")},
- {0x1eeaf, 0, 0, 0, g(Yes, No, false, false, "", "ع")},
- {0x1eeb0, 0, 0, 0, g(Yes, No, false, false, "", "ف")},
- {0x1eeb1, 0, 0, 0, g(Yes, No, false, false, "", "ص")},
- {0x1eeb2, 0, 0, 0, g(Yes, No, false, false, "", "ق")},
- {0x1eeb3, 0, 0, 0, g(Yes, No, false, false, "", "ر")},
- {0x1eeb4, 0, 0, 0, g(Yes, No, false, false, "", "ش")},
- {0x1eeb5, 0, 0, 0, g(Yes, No, false, false, "", "ت")},
- {0x1eeb6, 0, 0, 0, g(Yes, No, false, false, "", "ث")},
- {0x1eeb7, 0, 0, 0, g(Yes, No, false, false, "", "خ")},
- {0x1eeb8, 0, 0, 0, g(Yes, No, false, false, "", "ذ")},
- {0x1eeb9, 0, 0, 0, g(Yes, No, false, false, "", "ض")},
- {0x1eeba, 0, 0, 0, g(Yes, No, false, false, "", "ظ")},
- {0x1eebb, 0, 0, 0, g(Yes, No, false, false, "", "غ")},
- {0x1eebc, 0, 0, 0, f(Yes, false, "")},
- {0x1f100, 0, 0, 0, g(Yes, No, false, false, "", "0.")},
- {0x1f101, 0, 0, 0, g(Yes, No, false, false, "", "0,")},
- {0x1f102, 0, 0, 0, g(Yes, No, false, false, "", "1,")},
- {0x1f103, 0, 0, 0, g(Yes, No, false, false, "", "2,")},
- {0x1f104, 0, 0, 0, g(Yes, No, false, false, "", "3,")},
- {0x1f105, 0, 0, 0, g(Yes, No, false, false, "", "4,")},
- {0x1f106, 0, 0, 0, g(Yes, No, false, false, "", "5,")},
- {0x1f107, 0, 0, 0, g(Yes, No, false, false, "", "6,")},
- {0x1f108, 0, 0, 0, g(Yes, No, false, false, "", "7,")},
- {0x1f109, 0, 0, 0, g(Yes, No, false, false, "", "8,")},
- {0x1f10a, 0, 0, 0, g(Yes, No, false, false, "", "9,")},
- {0x1f10b, 0, 0, 0, f(Yes, false, "")},
- {0x1f110, 0, 0, 0, g(Yes, No, false, false, "", "(A)")},
- {0x1f111, 0, 0, 0, g(Yes, No, false, false, "", "(B)")},
- {0x1f112, 0, 0, 0, g(Yes, No, false, false, "", "(C)")},
- {0x1f113, 0, 0, 0, g(Yes, No, false, false, "", "(D)")},
- {0x1f114, 0, 0, 0, g(Yes, No, false, false, "", "(E)")},
- {0x1f115, 0, 0, 0, g(Yes, No, false, false, "", "(F)")},
- {0x1f116, 0, 0, 0, g(Yes, No, false, false, "", "(G)")},
- {0x1f117, 0, 0, 0, g(Yes, No, false, false, "", "(H)")},
- {0x1f118, 0, 0, 0, g(Yes, No, false, false, "", "(I)")},
- {0x1f119, 0, 0, 0, g(Yes, No, false, false, "", "(J)")},
- {0x1f11a, 0, 0, 0, g(Yes, No, false, false, "", "(K)")},
- {0x1f11b, 0, 0, 0, g(Yes, No, false, false, "", "(L)")},
- {0x1f11c, 0, 0, 0, g(Yes, No, false, false, "", "(M)")},
- {0x1f11d, 0, 0, 0, g(Yes, No, false, false, "", "(N)")},
- {0x1f11e, 0, 0, 0, g(Yes, No, false, false, "", "(O)")},
- {0x1f11f, 0, 0, 0, g(Yes, No, false, false, "", "(P)")},
- {0x1f120, 0, 0, 0, g(Yes, No, false, false, "", "(Q)")},
- {0x1f121, 0, 0, 0, g(Yes, No, false, false, "", "(R)")},
- {0x1f122, 0, 0, 0, g(Yes, No, false, false, "", "(S)")},
- {0x1f123, 0, 0, 0, g(Yes, No, false, false, "", "(T)")},
- {0x1f124, 0, 0, 0, g(Yes, No, false, false, "", "(U)")},
- {0x1f125, 0, 0, 0, g(Yes, No, false, false, "", "(V)")},
- {0x1f126, 0, 0, 0, g(Yes, No, false, false, "", "(W)")},
- {0x1f127, 0, 0, 0, g(Yes, No, false, false, "", "(X)")},
- {0x1f128, 0, 0, 0, g(Yes, No, false, false, "", "(Y)")},
- {0x1f129, 0, 0, 0, g(Yes, No, false, false, "", "(Z)")},
- {0x1f12a, 0, 0, 0, g(Yes, No, false, false, "", "〔S〕")},
- {0x1f12b, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f12c, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f12d, 0, 0, 0, g(Yes, No, false, false, "", "CD")},
- {0x1f12e, 0, 0, 0, g(Yes, No, false, false, "", "WZ")},
- {0x1f12f, 0, 0, 0, f(Yes, false, "")},
- {0x1f130, 0, 0, 0, g(Yes, No, false, false, "", "A")},
- {0x1f131, 0, 0, 0, g(Yes, No, false, false, "", "B")},
- {0x1f132, 0, 0, 0, g(Yes, No, false, false, "", "C")},
- {0x1f133, 0, 0, 0, g(Yes, No, false, false, "", "D")},
- {0x1f134, 0, 0, 0, g(Yes, No, false, false, "", "E")},
- {0x1f135, 0, 0, 0, g(Yes, No, false, false, "", "F")},
- {0x1f136, 0, 0, 0, g(Yes, No, false, false, "", "G")},
- {0x1f137, 0, 0, 0, g(Yes, No, false, false, "", "H")},
- {0x1f138, 0, 0, 0, g(Yes, No, false, false, "", "I")},
- {0x1f139, 0, 0, 0, g(Yes, No, false, false, "", "J")},
- {0x1f13a, 0, 0, 0, g(Yes, No, false, false, "", "K")},
- {0x1f13b, 0, 0, 0, g(Yes, No, false, false, "", "L")},
- {0x1f13c, 0, 0, 0, g(Yes, No, false, false, "", "M")},
- {0x1f13d, 0, 0, 0, g(Yes, No, false, false, "", "N")},
- {0x1f13e, 0, 0, 0, g(Yes, No, false, false, "", "O")},
- {0x1f13f, 0, 0, 0, g(Yes, No, false, false, "", "P")},
- {0x1f140, 0, 0, 0, g(Yes, No, false, false, "", "Q")},
- {0x1f141, 0, 0, 0, g(Yes, No, false, false, "", "R")},
- {0x1f142, 0, 0, 0, g(Yes, No, false, false, "", "S")},
- {0x1f143, 0, 0, 0, g(Yes, No, false, false, "", "T")},
- {0x1f144, 0, 0, 0, g(Yes, No, false, false, "", "U")},
- {0x1f145, 0, 0, 0, g(Yes, No, false, false, "", "V")},
- {0x1f146, 0, 0, 0, g(Yes, No, false, false, "", "W")},
- {0x1f147, 0, 0, 0, g(Yes, No, false, false, "", "X")},
- {0x1f148, 0, 0, 0, g(Yes, No, false, false, "", "Y")},
- {0x1f149, 0, 0, 0, g(Yes, No, false, false, "", "Z")},
- {0x1f14a, 0, 0, 0, g(Yes, No, false, false, "", "HV")},
- {0x1f14b, 0, 0, 0, g(Yes, No, false, false, "", "MV")},
- {0x1f14c, 0, 0, 0, g(Yes, No, false, false, "", "SD")},
- {0x1f14d, 0, 0, 0, g(Yes, No, false, false, "", "SS")},
- {0x1f14e, 0, 0, 0, g(Yes, No, false, false, "", "PPV")},
- {0x1f14f, 0, 0, 0, g(Yes, No, false, false, "", "WC")},
- {0x1f150, 0, 0, 0, f(Yes, false, "")},
- {0x1f16a, 0, 0, 0, g(Yes, No, false, false, "", "MC")},
- {0x1f16b, 0, 0, 0, g(Yes, No, false, false, "", "MD")},
- {0x1f16c, 0, 0, 0, f(Yes, false, "")},
- {0x1f190, 0, 0, 0, g(Yes, No, false, false, "", "DJ")},
- {0x1f191, 0, 0, 0, f(Yes, false, "")},
- {0x1f200, 0, 0, 0, g(Yes, No, false, false, "", "ほか")},
- {0x1f201, 0, 0, 0, g(Yes, No, false, false, "", "ココ")},
- {0x1f202, 0, 0, 0, g(Yes, No, false, false, "", "サ")},
- {0x1f203, 0, 0, 0, f(Yes, false, "")},
- {0x1f210, 0, 0, 0, g(Yes, No, false, false, "", "手")},
- {0x1f211, 0, 0, 0, g(Yes, No, false, false, "", "字")},
- {0x1f212, 0, 0, 0, g(Yes, No, false, false, "", "双")},
- {0x1f213, 0, 0, 1, g(Yes, No, false, false, "", "デ")},
- {0x1f214, 0, 0, 0, g(Yes, No, false, false, "", "二")},
- {0x1f215, 0, 0, 0, g(Yes, No, false, false, "", "多")},
- {0x1f216, 0, 0, 0, g(Yes, No, false, false, "", "解")},
- {0x1f217, 0, 0, 0, g(Yes, No, false, false, "", "天")},
- {0x1f218, 0, 0, 0, g(Yes, No, false, false, "", "交")},
- {0x1f219, 0, 0, 0, g(Yes, No, false, false, "", "映")},
- {0x1f21a, 0, 0, 0, g(Yes, No, false, false, "", "無")},
- {0x1f21b, 0, 0, 0, g(Yes, No, false, false, "", "料")},
- {0x1f21c, 0, 0, 0, g(Yes, No, false, false, "", "前")},
- {0x1f21d, 0, 0, 0, g(Yes, No, false, false, "", "後")},
- {0x1f21e, 0, 0, 0, g(Yes, No, false, false, "", "再")},
- {0x1f21f, 0, 0, 0, g(Yes, No, false, false, "", "新")},
- {0x1f220, 0, 0, 0, g(Yes, No, false, false, "", "初")},
- {0x1f221, 0, 0, 0, g(Yes, No, false, false, "", "終")},
- {0x1f222, 0, 0, 0, g(Yes, No, false, false, "", "生")},
- {0x1f223, 0, 0, 0, g(Yes, No, false, false, "", "販")},
- {0x1f224, 0, 0, 0, g(Yes, No, false, false, "", "声")},
- {0x1f225, 0, 0, 0, g(Yes, No, false, false, "", "吹")},
- {0x1f226, 0, 0, 0, g(Yes, No, false, false, "", "演")},
- {0x1f227, 0, 0, 0, g(Yes, No, false, false, "", "投")},
- {0x1f228, 0, 0, 0, g(Yes, No, false, false, "", "捕")},
- {0x1f229, 0, 0, 0, g(Yes, No, false, false, "", "一")},
- {0x1f22a, 0, 0, 0, g(Yes, No, false, false, "", "三")},
- {0x1f22b, 0, 0, 0, g(Yes, No, false, false, "", "遊")},
- {0x1f22c, 0, 0, 0, g(Yes, No, false, false, "", "左")},
- {0x1f22d, 0, 0, 0, g(Yes, No, false, false, "", "中")},
- {0x1f22e, 0, 0, 0, g(Yes, No, false, false, "", "右")},
- {0x1f22f, 0, 0, 0, g(Yes, No, false, false, "", "指")},
- {0x1f230, 0, 0, 0, g(Yes, No, false, false, "", "走")},
- {0x1f231, 0, 0, 0, g(Yes, No, false, false, "", "打")},
- {0x1f232, 0, 0, 0, g(Yes, No, false, false, "", "禁")},
- {0x1f233, 0, 0, 0, g(Yes, No, false, false, "", "空")},
- {0x1f234, 0, 0, 0, g(Yes, No, false, false, "", "合")},
- {0x1f235, 0, 0, 0, g(Yes, No, false, false, "", "満")},
- {0x1f236, 0, 0, 0, g(Yes, No, false, false, "", "有")},
- {0x1f237, 0, 0, 0, g(Yes, No, false, false, "", "月")},
- {0x1f238, 0, 0, 0, g(Yes, No, false, false, "", "申")},
- {0x1f239, 0, 0, 0, g(Yes, No, false, false, "", "割")},
- {0x1f23a, 0, 0, 0, g(Yes, No, false, false, "", "営")},
- {0x1f23b, 0, 0, 0, g(Yes, No, false, false, "", "配")},
- {0x1f23c, 0, 0, 0, f(Yes, false, "")},
- {0x1f240, 0, 0, 0, g(Yes, No, false, false, "", "〔本〕")},
- {0x1f241, 0, 0, 0, g(Yes, No, false, false, "", "〔三〕")},
- {0x1f242, 0, 0, 0, g(Yes, No, false, false, "", "〔二〕")},
- {0x1f243, 0, 0, 0, g(Yes, No, false, false, "", "〔安〕")},
- {0x1f244, 0, 0, 0, g(Yes, No, false, false, "", "〔点〕")},
- {0x1f245, 0, 0, 0, g(Yes, No, false, false, "", "〔打〕")},
- {0x1f246, 0, 0, 0, g(Yes, No, false, false, "", "〔盗〕")},
- {0x1f247, 0, 0, 0, g(Yes, No, false, false, "", "〔勝〕")},
- {0x1f248, 0, 0, 0, g(Yes, No, false, false, "", "〔敗〕")},
- {0x1f249, 0, 0, 0, f(Yes, false, "")},
- {0x1f250, 0, 0, 0, g(Yes, No, false, false, "", "得")},
- {0x1f251, 0, 0, 0, g(Yes, No, false, false, "", "可")},
- {0x1f252, 0, 0, 0, f(Yes, false, "")},
- {0x2f800, 0, 0, 0, f(No, false, "丽")},
- {0x2f801, 0, 0, 0, f(No, false, "丸")},
- {0x2f802, 0, 0, 0, f(No, false, "乁")},
- {0x2f803, 0, 0, 0, f(No, false, "𠄢")},
- {0x2f804, 0, 0, 0, f(No, false, "你")},
- {0x2f805, 0, 0, 0, f(No, false, "侮")},
- {0x2f806, 0, 0, 0, f(No, false, "侻")},
- {0x2f807, 0, 0, 0, f(No, false, "倂")},
- {0x2f808, 0, 0, 0, f(No, false, "偺")},
- {0x2f809, 0, 0, 0, f(No, false, "備")},
- {0x2f80a, 0, 0, 0, f(No, false, "僧")},
- {0x2f80b, 0, 0, 0, f(No, false, "像")},
- {0x2f80c, 0, 0, 0, f(No, false, "㒞")},
- {0x2f80d, 0, 0, 0, f(No, false, "𠘺")},
- {0x2f80e, 0, 0, 0, f(No, false, "免")},
- {0x2f80f, 0, 0, 0, f(No, false, "兔")},
- {0x2f810, 0, 0, 0, f(No, false, "兤")},
- {0x2f811, 0, 0, 0, f(No, false, "具")},
- {0x2f812, 0, 0, 0, f(No, false, "𠔜")},
- {0x2f813, 0, 0, 0, f(No, false, "㒹")},
- {0x2f814, 0, 0, 0, f(No, false, "內")},
- {0x2f815, 0, 0, 0, f(No, false, "再")},
- {0x2f816, 0, 0, 0, f(No, false, "𠕋")},
- {0x2f817, 0, 0, 0, f(No, false, "冗")},
- {0x2f818, 0, 0, 0, f(No, false, "冤")},
- {0x2f819, 0, 0, 0, f(No, false, "仌")},
- {0x2f81a, 0, 0, 0, f(No, false, "冬")},
- {0x2f81b, 0, 0, 0, f(No, false, "况")},
- {0x2f81c, 0, 0, 0, f(No, false, "𩇟")},
- {0x2f81d, 0, 0, 0, f(No, false, "凵")},
- {0x2f81e, 0, 0, 0, f(No, false, "刃")},
- {0x2f81f, 0, 0, 0, f(No, false, "㓟")},
- {0x2f820, 0, 0, 0, f(No, false, "刻")},
- {0x2f821, 0, 0, 0, f(No, false, "剆")},
- {0x2f822, 0, 0, 0, f(No, false, "割")},
- {0x2f823, 0, 0, 0, f(No, false, "剷")},
- {0x2f824, 0, 0, 0, f(No, false, "㔕")},
- {0x2f825, 0, 0, 0, f(No, false, "勇")},
- {0x2f826, 0, 0, 0, f(No, false, "勉")},
- {0x2f827, 0, 0, 0, f(No, false, "勤")},
- {0x2f828, 0, 0, 0, f(No, false, "勺")},
- {0x2f829, 0, 0, 0, f(No, false, "包")},
- {0x2f82a, 0, 0, 0, f(No, false, "匆")},
- {0x2f82b, 0, 0, 0, f(No, false, "北")},
- {0x2f82c, 0, 0, 0, f(No, false, "卉")},
- {0x2f82d, 0, 0, 0, f(No, false, "卑")},
- {0x2f82e, 0, 0, 0, f(No, false, "博")},
- {0x2f82f, 0, 0, 0, f(No, false, "即")},
- {0x2f830, 0, 0, 0, f(No, false, "卽")},
- {0x2f831, 0, 0, 0, f(No, false, "卿")},
- {0x2f834, 0, 0, 0, f(No, false, "𠨬")},
- {0x2f835, 0, 0, 0, f(No, false, "灰")},
- {0x2f836, 0, 0, 0, f(No, false, "及")},
- {0x2f837, 0, 0, 0, f(No, false, "叟")},
- {0x2f838, 0, 0, 0, f(No, false, "𠭣")},
- {0x2f839, 0, 0, 0, f(No, false, "叫")},
- {0x2f83a, 0, 0, 0, f(No, false, "叱")},
- {0x2f83b, 0, 0, 0, f(No, false, "吆")},
- {0x2f83c, 0, 0, 0, f(No, false, "咞")},
- {0x2f83d, 0, 0, 0, f(No, false, "吸")},
- {0x2f83e, 0, 0, 0, f(No, false, "呈")},
- {0x2f83f, 0, 0, 0, f(No, false, "周")},
- {0x2f840, 0, 0, 0, f(No, false, "咢")},
- {0x2f841, 0, 0, 0, f(No, false, "哶")},
- {0x2f842, 0, 0, 0, f(No, false, "唐")},
- {0x2f843, 0, 0, 0, f(No, false, "啓")},
- {0x2f844, 0, 0, 0, f(No, false, "啣")},
- {0x2f845, 0, 0, 0, f(No, false, "善")},
- {0x2f847, 0, 0, 0, f(No, false, "喙")},
- {0x2f848, 0, 0, 0, f(No, false, "喫")},
- {0x2f849, 0, 0, 0, f(No, false, "喳")},
- {0x2f84a, 0, 0, 0, f(No, false, "嗂")},
- {0x2f84b, 0, 0, 0, f(No, false, "圖")},
- {0x2f84c, 0, 0, 0, f(No, false, "嘆")},
- {0x2f84d, 0, 0, 0, f(No, false, "圗")},
- {0x2f84e, 0, 0, 0, f(No, false, "噑")},
- {0x2f84f, 0, 0, 0, f(No, false, "噴")},
- {0x2f850, 0, 0, 0, f(No, false, "切")},
- {0x2f851, 0, 0, 0, f(No, false, "壮")},
- {0x2f852, 0, 0, 0, f(No, false, "城")},
- {0x2f853, 0, 0, 0, f(No, false, "埴")},
- {0x2f854, 0, 0, 0, f(No, false, "堍")},
- {0x2f855, 0, 0, 0, f(No, false, "型")},
- {0x2f856, 0, 0, 0, f(No, false, "堲")},
- {0x2f857, 0, 0, 0, f(No, false, "報")},
- {0x2f858, 0, 0, 0, f(No, false, "墬")},
- {0x2f859, 0, 0, 0, f(No, false, "𡓤")},
- {0x2f85a, 0, 0, 0, f(No, false, "売")},
- {0x2f85b, 0, 0, 0, f(No, false, "壷")},
- {0x2f85c, 0, 0, 0, f(No, false, "夆")},
- {0x2f85d, 0, 0, 0, f(No, false, "多")},
- {0x2f85e, 0, 0, 0, f(No, false, "夢")},
- {0x2f85f, 0, 0, 0, f(No, false, "奢")},
- {0x2f860, 0, 0, 0, f(No, false, "𡚨")},
- {0x2f861, 0, 0, 0, f(No, false, "𡛪")},
- {0x2f862, 0, 0, 0, f(No, false, "姬")},
- {0x2f863, 0, 0, 0, f(No, false, "娛")},
- {0x2f864, 0, 0, 0, f(No, false, "娧")},
- {0x2f865, 0, 0, 0, f(No, false, "姘")},
- {0x2f866, 0, 0, 0, f(No, false, "婦")},
- {0x2f867, 0, 0, 0, f(No, false, "㛮")},
- {0x2f868, 0, 0, 0, f(No, false, "㛼")},
- {0x2f869, 0, 0, 0, f(No, false, "嬈")},
- {0x2f86a, 0, 0, 0, f(No, false, "嬾")},
- {0x2f86c, 0, 0, 0, f(No, false, "𡧈")},
- {0x2f86d, 0, 0, 0, f(No, false, "寃")},
- {0x2f86e, 0, 0, 0, f(No, false, "寘")},
- {0x2f86f, 0, 0, 0, f(No, false, "寧")},
- {0x2f870, 0, 0, 0, f(No, false, "寳")},
- {0x2f871, 0, 0, 0, f(No, false, "𡬘")},
- {0x2f872, 0, 0, 0, f(No, false, "寿")},
- {0x2f873, 0, 0, 0, f(No, false, "将")},
- {0x2f874, 0, 0, 0, f(No, false, "当")},
- {0x2f875, 0, 0, 0, f(No, false, "尢")},
- {0x2f876, 0, 0, 0, f(No, false, "㞁")},
- {0x2f877, 0, 0, 0, f(No, false, "屠")},
- {0x2f878, 0, 0, 0, f(No, false, "屮")},
- {0x2f879, 0, 0, 0, f(No, false, "峀")},
- {0x2f87a, 0, 0, 0, f(No, false, "岍")},
- {0x2f87b, 0, 0, 0, f(No, false, "𡷤")},
- {0x2f87c, 0, 0, 0, f(No, false, "嵃")},
- {0x2f87d, 0, 0, 0, f(No, false, "𡷦")},
- {0x2f87e, 0, 0, 0, f(No, false, "嵮")},
- {0x2f87f, 0, 0, 0, f(No, false, "嵫")},
- {0x2f880, 0, 0, 0, f(No, false, "嵼")},
- {0x2f881, 0, 0, 0, f(No, false, "巡")},
- {0x2f882, 0, 0, 0, f(No, false, "巢")},
- {0x2f883, 0, 0, 0, f(No, false, "㠯")},
- {0x2f884, 0, 0, 0, f(No, false, "巽")},
- {0x2f885, 0, 0, 0, f(No, false, "帨")},
- {0x2f886, 0, 0, 0, f(No, false, "帽")},
- {0x2f887, 0, 0, 0, f(No, false, "幩")},
- {0x2f888, 0, 0, 0, f(No, false, "㡢")},
- {0x2f889, 0, 0, 0, f(No, false, "𢆃")},
- {0x2f88a, 0, 0, 0, f(No, false, "㡼")},
- {0x2f88b, 0, 0, 0, f(No, false, "庰")},
- {0x2f88c, 0, 0, 0, f(No, false, "庳")},
- {0x2f88d, 0, 0, 0, f(No, false, "庶")},
- {0x2f88e, 0, 0, 0, f(No, false, "廊")},
- {0x2f88f, 0, 0, 0, f(No, false, "𪎒")},
- {0x2f890, 0, 0, 0, f(No, false, "廾")},
- {0x2f891, 0, 0, 0, f(No, false, "𢌱")},
- {0x2f893, 0, 0, 0, f(No, false, "舁")},
- {0x2f894, 0, 0, 0, f(No, false, "弢")},
- {0x2f896, 0, 0, 0, f(No, false, "㣇")},
- {0x2f897, 0, 0, 0, f(No, false, "𣊸")},
- {0x2f898, 0, 0, 0, f(No, false, "𦇚")},
- {0x2f899, 0, 0, 0, f(No, false, "形")},
- {0x2f89a, 0, 0, 0, f(No, false, "彫")},
- {0x2f89b, 0, 0, 0, f(No, false, "㣣")},
- {0x2f89c, 0, 0, 0, f(No, false, "徚")},
- {0x2f89d, 0, 0, 0, f(No, false, "忍")},
- {0x2f89e, 0, 0, 0, f(No, false, "志")},
- {0x2f89f, 0, 0, 0, f(No, false, "忹")},
- {0x2f8a0, 0, 0, 0, f(No, false, "悁")},
- {0x2f8a1, 0, 0, 0, f(No, false, "㤺")},
- {0x2f8a2, 0, 0, 0, f(No, false, "㤜")},
- {0x2f8a3, 0, 0, 0, f(No, false, "悔")},
- {0x2f8a4, 0, 0, 0, f(No, false, "𢛔")},
- {0x2f8a5, 0, 0, 0, f(No, false, "惇")},
- {0x2f8a6, 0, 0, 0, f(No, false, "慈")},
- {0x2f8a7, 0, 0, 0, f(No, false, "慌")},
- {0x2f8a8, 0, 0, 0, f(No, false, "慎")},
- {0x2f8a9, 0, 0, 0, f(No, false, "慌")},
- {0x2f8aa, 0, 0, 0, f(No, false, "慺")},
- {0x2f8ab, 0, 0, 0, f(No, false, "憎")},
- {0x2f8ac, 0, 0, 0, f(No, false, "憲")},
- {0x2f8ad, 0, 0, 0, f(No, false, "憤")},
- {0x2f8ae, 0, 0, 0, f(No, false, "憯")},
- {0x2f8af, 0, 0, 0, f(No, false, "懞")},
- {0x2f8b0, 0, 0, 0, f(No, false, "懲")},
- {0x2f8b1, 0, 0, 0, f(No, false, "懶")},
- {0x2f8b2, 0, 0, 0, f(No, false, "成")},
- {0x2f8b3, 0, 0, 0, f(No, false, "戛")},
- {0x2f8b4, 0, 0, 0, f(No, false, "扝")},
- {0x2f8b5, 0, 0, 0, f(No, false, "抱")},
- {0x2f8b6, 0, 0, 0, f(No, false, "拔")},
- {0x2f8b7, 0, 0, 0, f(No, false, "捐")},
- {0x2f8b8, 0, 0, 0, f(No, false, "𢬌")},
- {0x2f8b9, 0, 0, 0, f(No, false, "挽")},
- {0x2f8ba, 0, 0, 0, f(No, false, "拼")},
- {0x2f8bb, 0, 0, 0, f(No, false, "捨")},
- {0x2f8bc, 0, 0, 0, f(No, false, "掃")},
- {0x2f8bd, 0, 0, 0, f(No, false, "揤")},
- {0x2f8be, 0, 0, 0, f(No, false, "𢯱")},
- {0x2f8bf, 0, 0, 0, f(No, false, "搢")},
- {0x2f8c0, 0, 0, 0, f(No, false, "揅")},
- {0x2f8c1, 0, 0, 0, f(No, false, "掩")},
- {0x2f8c2, 0, 0, 0, f(No, false, "㨮")},
- {0x2f8c3, 0, 0, 0, f(No, false, "摩")},
- {0x2f8c4, 0, 0, 0, f(No, false, "摾")},
- {0x2f8c5, 0, 0, 0, f(No, false, "撝")},
- {0x2f8c6, 0, 0, 0, f(No, false, "摷")},
- {0x2f8c7, 0, 0, 0, f(No, false, "㩬")},
- {0x2f8c8, 0, 0, 0, f(No, false, "敏")},
- {0x2f8c9, 0, 0, 0, f(No, false, "敬")},
- {0x2f8ca, 0, 0, 0, f(No, false, "𣀊")},
- {0x2f8cb, 0, 0, 0, f(No, false, "旣")},
- {0x2f8cc, 0, 0, 0, f(No, false, "書")},
- {0x2f8cd, 0, 0, 0, f(No, false, "晉")},
- {0x2f8ce, 0, 0, 0, f(No, false, "㬙")},
- {0x2f8cf, 0, 0, 0, f(No, false, "暑")},
- {0x2f8d0, 0, 0, 0, f(No, false, "㬈")},
- {0x2f8d1, 0, 0, 0, f(No, false, "㫤")},
- {0x2f8d2, 0, 0, 0, f(No, false, "冒")},
- {0x2f8d3, 0, 0, 0, f(No, false, "冕")},
- {0x2f8d4, 0, 0, 0, f(No, false, "最")},
- {0x2f8d5, 0, 0, 0, f(No, false, "暜")},
- {0x2f8d6, 0, 0, 0, f(No, false, "肭")},
- {0x2f8d7, 0, 0, 0, f(No, false, "䏙")},
- {0x2f8d8, 0, 0, 0, f(No, false, "朗")},
- {0x2f8d9, 0, 0, 0, f(No, false, "望")},
- {0x2f8da, 0, 0, 0, f(No, false, "朡")},
- {0x2f8db, 0, 0, 0, f(No, false, "杞")},
- {0x2f8dc, 0, 0, 0, f(No, false, "杓")},
- {0x2f8dd, 0, 0, 0, f(No, false, "𣏃")},
- {0x2f8de, 0, 0, 0, f(No, false, "㭉")},
- {0x2f8df, 0, 0, 0, f(No, false, "柺")},
- {0x2f8e0, 0, 0, 0, f(No, false, "枅")},
- {0x2f8e1, 0, 0, 0, f(No, false, "桒")},
- {0x2f8e2, 0, 0, 0, f(No, false, "梅")},
- {0x2f8e3, 0, 0, 0, f(No, false, "𣑭")},
- {0x2f8e4, 0, 0, 0, f(No, false, "梎")},
- {0x2f8e5, 0, 0, 0, f(No, false, "栟")},
- {0x2f8e6, 0, 0, 0, f(No, false, "椔")},
- {0x2f8e7, 0, 0, 0, f(No, false, "㮝")},
- {0x2f8e8, 0, 0, 0, f(No, false, "楂")},
- {0x2f8e9, 0, 0, 0, f(No, false, "榣")},
- {0x2f8ea, 0, 0, 0, f(No, false, "槪")},
- {0x2f8eb, 0, 0, 0, f(No, false, "檨")},
- {0x2f8ec, 0, 0, 0, f(No, false, "𣚣")},
- {0x2f8ed, 0, 0, 0, f(No, false, "櫛")},
- {0x2f8ee, 0, 0, 0, f(No, false, "㰘")},
- {0x2f8ef, 0, 0, 0, f(No, false, "次")},
- {0x2f8f0, 0, 0, 0, f(No, false, "𣢧")},
- {0x2f8f1, 0, 0, 0, f(No, false, "歔")},
- {0x2f8f2, 0, 0, 0, f(No, false, "㱎")},
- {0x2f8f3, 0, 0, 0, f(No, false, "歲")},
- {0x2f8f4, 0, 0, 0, f(No, false, "殟")},
- {0x2f8f5, 0, 0, 0, f(No, false, "殺")},
- {0x2f8f6, 0, 0, 0, f(No, false, "殻")},
- {0x2f8f7, 0, 0, 0, f(No, false, "𣪍")},
- {0x2f8f8, 0, 0, 0, f(No, false, "𡴋")},
- {0x2f8f9, 0, 0, 0, f(No, false, "𣫺")},
- {0x2f8fa, 0, 0, 0, f(No, false, "汎")},
- {0x2f8fb, 0, 0, 0, f(No, false, "𣲼")},
- {0x2f8fc, 0, 0, 0, f(No, false, "沿")},
- {0x2f8fd, 0, 0, 0, f(No, false, "泍")},
- {0x2f8fe, 0, 0, 0, f(No, false, "汧")},
- {0x2f8ff, 0, 0, 0, f(No, false, "洖")},
- {0x2f900, 0, 0, 0, f(No, false, "派")},
- {0x2f901, 0, 0, 0, f(No, false, "海")},
- {0x2f902, 0, 0, 0, f(No, false, "流")},
- {0x2f903, 0, 0, 0, f(No, false, "浩")},
- {0x2f904, 0, 0, 0, f(No, false, "浸")},
- {0x2f905, 0, 0, 0, f(No, false, "涅")},
- {0x2f906, 0, 0, 0, f(No, false, "𣴞")},
- {0x2f907, 0, 0, 0, f(No, false, "洴")},
- {0x2f908, 0, 0, 0, f(No, false, "港")},
- {0x2f909, 0, 0, 0, f(No, false, "湮")},
- {0x2f90a, 0, 0, 0, f(No, false, "㴳")},
- {0x2f90b, 0, 0, 0, f(No, false, "滋")},
- {0x2f90c, 0, 0, 0, f(No, false, "滇")},
- {0x2f90d, 0, 0, 0, f(No, false, "𣻑")},
- {0x2f90e, 0, 0, 0, f(No, false, "淹")},
- {0x2f90f, 0, 0, 0, f(No, false, "潮")},
- {0x2f910, 0, 0, 0, f(No, false, "𣽞")},
- {0x2f911, 0, 0, 0, f(No, false, "𣾎")},
- {0x2f912, 0, 0, 0, f(No, false, "濆")},
- {0x2f913, 0, 0, 0, f(No, false, "瀹")},
- {0x2f914, 0, 0, 0, f(No, false, "瀞")},
- {0x2f915, 0, 0, 0, f(No, false, "瀛")},
- {0x2f916, 0, 0, 0, f(No, false, "㶖")},
- {0x2f917, 0, 0, 0, f(No, false, "灊")},
- {0x2f918, 0, 0, 0, f(No, false, "災")},
- {0x2f919, 0, 0, 0, f(No, false, "灷")},
- {0x2f91a, 0, 0, 0, f(No, false, "炭")},
- {0x2f91b, 0, 0, 0, f(No, false, "𠔥")},
- {0x2f91c, 0, 0, 0, f(No, false, "煅")},
- {0x2f91d, 0, 0, 0, f(No, false, "𤉣")},
- {0x2f91e, 0, 0, 0, f(No, false, "熜")},
- {0x2f91f, 0, 0, 0, f(No, false, "𤎫")},
- {0x2f920, 0, 0, 0, f(No, false, "爨")},
- {0x2f921, 0, 0, 0, f(No, false, "爵")},
- {0x2f922, 0, 0, 0, f(No, false, "牐")},
- {0x2f923, 0, 0, 0, f(No, false, "𤘈")},
- {0x2f924, 0, 0, 0, f(No, false, "犀")},
- {0x2f925, 0, 0, 0, f(No, false, "犕")},
- {0x2f926, 0, 0, 0, f(No, false, "𤜵")},
- {0x2f927, 0, 0, 0, f(No, false, "𤠔")},
- {0x2f928, 0, 0, 0, f(No, false, "獺")},
- {0x2f929, 0, 0, 0, f(No, false, "王")},
- {0x2f92a, 0, 0, 0, f(No, false, "㺬")},
- {0x2f92b, 0, 0, 0, f(No, false, "玥")},
- {0x2f92c, 0, 0, 0, f(No, false, "㺸")},
- {0x2f92e, 0, 0, 0, f(No, false, "瑇")},
- {0x2f92f, 0, 0, 0, f(No, false, "瑜")},
- {0x2f930, 0, 0, 0, f(No, false, "瑱")},
- {0x2f931, 0, 0, 0, f(No, false, "璅")},
- {0x2f932, 0, 0, 0, f(No, false, "瓊")},
- {0x2f933, 0, 0, 0, f(No, false, "㼛")},
- {0x2f934, 0, 0, 0, f(No, false, "甤")},
- {0x2f935, 0, 0, 0, f(No, false, "𤰶")},
- {0x2f936, 0, 0, 0, f(No, false, "甾")},
- {0x2f937, 0, 0, 0, f(No, false, "𤲒")},
- {0x2f938, 0, 0, 0, f(No, false, "異")},
- {0x2f939, 0, 0, 0, f(No, false, "𢆟")},
- {0x2f93a, 0, 0, 0, f(No, false, "瘐")},
- {0x2f93b, 0, 0, 0, f(No, false, "𤾡")},
- {0x2f93c, 0, 0, 0, f(No, false, "𤾸")},
- {0x2f93d, 0, 0, 0, f(No, false, "𥁄")},
- {0x2f93e, 0, 0, 0, f(No, false, "㿼")},
- {0x2f93f, 0, 0, 0, f(No, false, "䀈")},
- {0x2f940, 0, 0, 0, f(No, false, "直")},
- {0x2f941, 0, 0, 0, f(No, false, "𥃳")},
- {0x2f942, 0, 0, 0, f(No, false, "𥃲")},
- {0x2f943, 0, 0, 0, f(No, false, "𥄙")},
- {0x2f944, 0, 0, 0, f(No, false, "𥄳")},
- {0x2f945, 0, 0, 0, f(No, false, "眞")},
- {0x2f946, 0, 0, 0, f(No, false, "真")},
- {0x2f948, 0, 0, 0, f(No, false, "睊")},
- {0x2f949, 0, 0, 0, f(No, false, "䀹")},
- {0x2f94a, 0, 0, 0, f(No, false, "瞋")},
- {0x2f94b, 0, 0, 0, f(No, false, "䁆")},
- {0x2f94c, 0, 0, 0, f(No, false, "䂖")},
- {0x2f94d, 0, 0, 0, f(No, false, "𥐝")},
- {0x2f94e, 0, 0, 0, f(No, false, "硎")},
- {0x2f94f, 0, 0, 0, f(No, false, "碌")},
- {0x2f950, 0, 0, 0, f(No, false, "磌")},
- {0x2f951, 0, 0, 0, f(No, false, "䃣")},
- {0x2f952, 0, 0, 0, f(No, false, "𥘦")},
- {0x2f953, 0, 0, 0, f(No, false, "祖")},
- {0x2f954, 0, 0, 0, f(No, false, "𥚚")},
- {0x2f955, 0, 0, 0, f(No, false, "𥛅")},
- {0x2f956, 0, 0, 0, f(No, false, "福")},
- {0x2f957, 0, 0, 0, f(No, false, "秫")},
- {0x2f958, 0, 0, 0, f(No, false, "䄯")},
- {0x2f959, 0, 0, 0, f(No, false, "穀")},
- {0x2f95a, 0, 0, 0, f(No, false, "穊")},
- {0x2f95b, 0, 0, 0, f(No, false, "穏")},
- {0x2f95c, 0, 0, 0, f(No, false, "𥥼")},
- {0x2f95d, 0, 0, 0, f(No, false, "𥪧")},
- {0x2f95f, 0, 0, 0, f(No, false, "竮")},
- {0x2f960, 0, 0, 0, f(No, false, "䈂")},
- {0x2f961, 0, 0, 0, f(No, false, "𥮫")},
- {0x2f962, 0, 0, 0, f(No, false, "篆")},
- {0x2f963, 0, 0, 0, f(No, false, "築")},
- {0x2f964, 0, 0, 0, f(No, false, "䈧")},
- {0x2f965, 0, 0, 0, f(No, false, "𥲀")},
- {0x2f966, 0, 0, 0, f(No, false, "糒")},
- {0x2f967, 0, 0, 0, f(No, false, "䊠")},
- {0x2f968, 0, 0, 0, f(No, false, "糨")},
- {0x2f969, 0, 0, 0, f(No, false, "糣")},
- {0x2f96a, 0, 0, 0, f(No, false, "紀")},
- {0x2f96b, 0, 0, 0, f(No, false, "𥾆")},
- {0x2f96c, 0, 0, 0, f(No, false, "絣")},
- {0x2f96d, 0, 0, 0, f(No, false, "䌁")},
- {0x2f96e, 0, 0, 0, f(No, false, "緇")},
- {0x2f96f, 0, 0, 0, f(No, false, "縂")},
- {0x2f970, 0, 0, 0, f(No, false, "繅")},
- {0x2f971, 0, 0, 0, f(No, false, "䌴")},
- {0x2f972, 0, 0, 0, f(No, false, "𦈨")},
- {0x2f973, 0, 0, 0, f(No, false, "𦉇")},
- {0x2f974, 0, 0, 0, f(No, false, "䍙")},
- {0x2f975, 0, 0, 0, f(No, false, "𦋙")},
- {0x2f976, 0, 0, 0, f(No, false, "罺")},
- {0x2f977, 0, 0, 0, f(No, false, "𦌾")},
- {0x2f978, 0, 0, 0, f(No, false, "羕")},
- {0x2f979, 0, 0, 0, f(No, false, "翺")},
- {0x2f97a, 0, 0, 0, f(No, false, "者")},
- {0x2f97b, 0, 0, 0, f(No, false, "𦓚")},
- {0x2f97c, 0, 0, 0, f(No, false, "𦔣")},
- {0x2f97d, 0, 0, 0, f(No, false, "聠")},
- {0x2f97e, 0, 0, 0, f(No, false, "𦖨")},
- {0x2f97f, 0, 0, 0, f(No, false, "聰")},
- {0x2f980, 0, 0, 0, f(No, false, "𣍟")},
- {0x2f981, 0, 0, 0, f(No, false, "䏕")},
- {0x2f982, 0, 0, 0, f(No, false, "育")},
- {0x2f983, 0, 0, 0, f(No, false, "脃")},
- {0x2f984, 0, 0, 0, f(No, false, "䐋")},
- {0x2f985, 0, 0, 0, f(No, false, "脾")},
- {0x2f986, 0, 0, 0, f(No, false, "媵")},
- {0x2f987, 0, 0, 0, f(No, false, "𦞧")},
- {0x2f988, 0, 0, 0, f(No, false, "𦞵")},
- {0x2f989, 0, 0, 0, f(No, false, "𣎓")},
- {0x2f98a, 0, 0, 0, f(No, false, "𣎜")},
- {0x2f98b, 0, 0, 0, f(No, false, "舁")},
- {0x2f98c, 0, 0, 0, f(No, false, "舄")},
- {0x2f98d, 0, 0, 0, f(No, false, "辞")},
- {0x2f98e, 0, 0, 0, f(No, false, "䑫")},
- {0x2f98f, 0, 0, 0, f(No, false, "芑")},
- {0x2f990, 0, 0, 0, f(No, false, "芋")},
- {0x2f991, 0, 0, 0, f(No, false, "芝")},
- {0x2f992, 0, 0, 0, f(No, false, "劳")},
- {0x2f993, 0, 0, 0, f(No, false, "花")},
- {0x2f994, 0, 0, 0, f(No, false, "芳")},
- {0x2f995, 0, 0, 0, f(No, false, "芽")},
- {0x2f996, 0, 0, 0, f(No, false, "苦")},
- {0x2f997, 0, 0, 0, f(No, false, "𦬼")},
- {0x2f998, 0, 0, 0, f(No, false, "若")},
- {0x2f999, 0, 0, 0, f(No, false, "茝")},
- {0x2f99a, 0, 0, 0, f(No, false, "荣")},
- {0x2f99b, 0, 0, 0, f(No, false, "莭")},
- {0x2f99c, 0, 0, 0, f(No, false, "茣")},
- {0x2f99d, 0, 0, 0, f(No, false, "莽")},
- {0x2f99e, 0, 0, 0, f(No, false, "菧")},
- {0x2f99f, 0, 0, 0, f(No, false, "著")},
- {0x2f9a0, 0, 0, 0, f(No, false, "荓")},
- {0x2f9a1, 0, 0, 0, f(No, false, "菊")},
- {0x2f9a2, 0, 0, 0, f(No, false, "菌")},
- {0x2f9a3, 0, 0, 0, f(No, false, "菜")},
- {0x2f9a4, 0, 0, 0, f(No, false, "𦰶")},
- {0x2f9a5, 0, 0, 0, f(No, false, "𦵫")},
- {0x2f9a6, 0, 0, 0, f(No, false, "𦳕")},
- {0x2f9a7, 0, 0, 0, f(No, false, "䔫")},
- {0x2f9a8, 0, 0, 0, f(No, false, "蓱")},
- {0x2f9a9, 0, 0, 0, f(No, false, "蓳")},
- {0x2f9aa, 0, 0, 0, f(No, false, "蔖")},
- {0x2f9ab, 0, 0, 0, f(No, false, "𧏊")},
- {0x2f9ac, 0, 0, 0, f(No, false, "蕤")},
- {0x2f9ad, 0, 0, 0, f(No, false, "𦼬")},
- {0x2f9ae, 0, 0, 0, f(No, false, "䕝")},
- {0x2f9af, 0, 0, 0, f(No, false, "䕡")},
- {0x2f9b0, 0, 0, 0, f(No, false, "𦾱")},
- {0x2f9b1, 0, 0, 0, f(No, false, "𧃒")},
- {0x2f9b2, 0, 0, 0, f(No, false, "䕫")},
- {0x2f9b3, 0, 0, 0, f(No, false, "虐")},
- {0x2f9b4, 0, 0, 0, f(No, false, "虜")},
- {0x2f9b5, 0, 0, 0, f(No, false, "虧")},
- {0x2f9b6, 0, 0, 0, f(No, false, "虩")},
- {0x2f9b7, 0, 0, 0, f(No, false, "蚩")},
- {0x2f9b8, 0, 0, 0, f(No, false, "蚈")},
- {0x2f9b9, 0, 0, 0, f(No, false, "蜎")},
- {0x2f9ba, 0, 0, 0, f(No, false, "蛢")},
- {0x2f9bb, 0, 0, 0, f(No, false, "蝹")},
- {0x2f9bc, 0, 0, 0, f(No, false, "蜨")},
- {0x2f9bd, 0, 0, 0, f(No, false, "蝫")},
- {0x2f9be, 0, 0, 0, f(No, false, "螆")},
- {0x2f9bf, 0, 0, 0, f(No, false, "䗗")},
- {0x2f9c0, 0, 0, 0, f(No, false, "蟡")},
- {0x2f9c1, 0, 0, 0, f(No, false, "蠁")},
- {0x2f9c2, 0, 0, 0, f(No, false, "䗹")},
- {0x2f9c3, 0, 0, 0, f(No, false, "衠")},
- {0x2f9c4, 0, 0, 0, f(No, false, "衣")},
- {0x2f9c5, 0, 0, 0, f(No, false, "𧙧")},
- {0x2f9c6, 0, 0, 0, f(No, false, "裗")},
- {0x2f9c7, 0, 0, 0, f(No, false, "裞")},
- {0x2f9c8, 0, 0, 0, f(No, false, "䘵")},
- {0x2f9c9, 0, 0, 0, f(No, false, "裺")},
- {0x2f9ca, 0, 0, 0, f(No, false, "㒻")},
- {0x2f9cb, 0, 0, 0, f(No, false, "𧢮")},
- {0x2f9cc, 0, 0, 0, f(No, false, "𧥦")},
- {0x2f9cd, 0, 0, 0, f(No, false, "䚾")},
- {0x2f9ce, 0, 0, 0, f(No, false, "䛇")},
- {0x2f9cf, 0, 0, 0, f(No, false, "誠")},
- {0x2f9d0, 0, 0, 0, f(No, false, "諭")},
- {0x2f9d1, 0, 0, 0, f(No, false, "變")},
- {0x2f9d2, 0, 0, 0, f(No, false, "豕")},
- {0x2f9d3, 0, 0, 0, f(No, false, "𧲨")},
- {0x2f9d4, 0, 0, 0, f(No, false, "貫")},
- {0x2f9d5, 0, 0, 0, f(No, false, "賁")},
- {0x2f9d6, 0, 0, 0, f(No, false, "贛")},
- {0x2f9d7, 0, 0, 0, f(No, false, "起")},
- {0x2f9d8, 0, 0, 0, f(No, false, "𧼯")},
- {0x2f9d9, 0, 0, 0, f(No, false, "𠠄")},
- {0x2f9da, 0, 0, 0, f(No, false, "跋")},
- {0x2f9db, 0, 0, 0, f(No, false, "趼")},
- {0x2f9dc, 0, 0, 0, f(No, false, "跰")},
- {0x2f9dd, 0, 0, 0, f(No, false, "𠣞")},
- {0x2f9de, 0, 0, 0, f(No, false, "軔")},
- {0x2f9df, 0, 0, 0, f(No, false, "輸")},
- {0x2f9e0, 0, 0, 0, f(No, false, "𨗒")},
- {0x2f9e1, 0, 0, 0, f(No, false, "𨗭")},
- {0x2f9e2, 0, 0, 0, f(No, false, "邔")},
- {0x2f9e3, 0, 0, 0, f(No, false, "郱")},
- {0x2f9e4, 0, 0, 0, f(No, false, "鄑")},
- {0x2f9e5, 0, 0, 0, f(No, false, "𨜮")},
- {0x2f9e6, 0, 0, 0, f(No, false, "鄛")},
- {0x2f9e7, 0, 0, 0, f(No, false, "鈸")},
- {0x2f9e8, 0, 0, 0, f(No, false, "鋗")},
- {0x2f9e9, 0, 0, 0, f(No, false, "鋘")},
- {0x2f9ea, 0, 0, 0, f(No, false, "鉼")},
- {0x2f9eb, 0, 0, 0, f(No, false, "鏹")},
- {0x2f9ec, 0, 0, 0, f(No, false, "鐕")},
- {0x2f9ed, 0, 0, 0, f(No, false, "𨯺")},
- {0x2f9ee, 0, 0, 0, f(No, false, "開")},
- {0x2f9ef, 0, 0, 0, f(No, false, "䦕")},
- {0x2f9f0, 0, 0, 0, f(No, false, "閷")},
- {0x2f9f1, 0, 0, 0, f(No, false, "𨵷")},
- {0x2f9f2, 0, 0, 0, f(No, false, "䧦")},
- {0x2f9f3, 0, 0, 0, f(No, false, "雃")},
- {0x2f9f4, 0, 0, 0, f(No, false, "嶲")},
- {0x2f9f5, 0, 0, 0, f(No, false, "霣")},
- {0x2f9f6, 0, 0, 0, f(No, false, "𩅅")},
- {0x2f9f7, 0, 0, 0, f(No, false, "𩈚")},
- {0x2f9f8, 0, 0, 0, f(No, false, "䩮")},
- {0x2f9f9, 0, 0, 0, f(No, false, "䩶")},
- {0x2f9fa, 0, 0, 0, f(No, false, "韠")},
- {0x2f9fb, 0, 0, 0, f(No, false, "𩐊")},
- {0x2f9fc, 0, 0, 0, f(No, false, "䪲")},
- {0x2f9fd, 0, 0, 0, f(No, false, "𩒖")},
- {0x2f9fe, 0, 0, 0, f(No, false, "頋")},
- {0x2fa00, 0, 0, 0, f(No, false, "頩")},
- {0x2fa01, 0, 0, 0, f(No, false, "𩖶")},
- {0x2fa02, 0, 0, 0, f(No, false, "飢")},
- {0x2fa03, 0, 0, 0, f(No, false, "䬳")},
- {0x2fa04, 0, 0, 0, f(No, false, "餩")},
- {0x2fa05, 0, 0, 0, f(No, false, "馧")},
- {0x2fa06, 0, 0, 0, f(No, false, "駂")},
- {0x2fa07, 0, 0, 0, f(No, false, "駾")},
- {0x2fa08, 0, 0, 0, f(No, false, "䯎")},
- {0x2fa09, 0, 0, 0, f(No, false, "𩬰")},
- {0x2fa0a, 0, 0, 0, f(No, false, "鬒")},
- {0x2fa0b, 0, 0, 0, f(No, false, "鱀")},
- {0x2fa0c, 0, 0, 0, f(No, false, "鳽")},
- {0x2fa0d, 0, 0, 0, f(No, false, "䳎")},
- {0x2fa0e, 0, 0, 0, f(No, false, "䳭")},
- {0x2fa0f, 0, 0, 0, f(No, false, "鵧")},
- {0x2fa10, 0, 0, 0, f(No, false, "𪃎")},
- {0x2fa11, 0, 0, 0, f(No, false, "䳸")},
- {0x2fa12, 0, 0, 0, f(No, false, "𪄅")},
- {0x2fa13, 0, 0, 0, f(No, false, "𪈎")},
- {0x2fa14, 0, 0, 0, f(No, false, "𪊑")},
- {0x2fa15, 0, 0, 0, f(No, false, "麻")},
- {0x2fa16, 0, 0, 0, f(No, false, "䵖")},
- {0x2fa17, 0, 0, 0, f(No, false, "黹")},
- {0x2fa18, 0, 0, 0, f(No, false, "黾")},
- {0x2fa19, 0, 0, 0, f(No, false, "鼅")},
- {0x2fa1a, 0, 0, 0, f(No, false, "鼏")},
- {0x2fa1b, 0, 0, 0, f(No, false, "鼖")},
- {0x2fa1c, 0, 0, 0, f(No, false, "鼻")},
- {0x2fa1d, 0, 0, 0, f(No, false, "𪘀")},
- {0x2fa1e, 0, 0, 0, f(Yes, false, "")},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_iter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_iter_test.go
deleted file mode 100644
index 82df89c7bf7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_iter_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm_test
-
-import (
- "bytes"
- "fmt"
- "unicode/utf8"
-
- "golang.org/x/text/unicode/norm"
-)
-
-// EqualSimple uses a norm.Iter to compare two non-normalized
-// strings for equivalence.
-func EqualSimple(a, b string) bool {
- var ia, ib norm.Iter
- ia.InitString(norm.NFKD, a)
- ib.InitString(norm.NFKD, b)
- for !ia.Done() && !ib.Done() {
- if !bytes.Equal(ia.Next(), ib.Next()) {
- return false
- }
- }
- return ia.Done() && ib.Done()
-}
-
-// FindPrefix finds the longest common prefix of ASCII characters
-// of a and b.
-func FindPrefix(a, b string) int {
- i := 0
- for ; i < len(a) && i < len(b) && a[i] < utf8.RuneSelf && a[i] == b[i]; i++ {
- }
- return i
-}
-
-// EqualOpt is like EqualSimple, but optimizes the special
-// case for ASCII characters.
-func EqualOpt(a, b string) bool {
- n := FindPrefix(a, b)
- a, b = a[n:], b[n:]
- var ia, ib norm.Iter
- ia.InitString(norm.NFKD, a)
- ib.InitString(norm.NFKD, b)
- for !ia.Done() && !ib.Done() {
- if !bytes.Equal(ia.Next(), ib.Next()) {
- return false
- }
- if n := int64(FindPrefix(a[ia.Pos():], b[ib.Pos():])); n != 0 {
- ia.Seek(n, 1)
- ib.Seek(n, 1)
- }
- }
- return ia.Done() && ib.Done()
-}
-
-var compareTests = []struct{ a, b string }{
- {"aaa", "aaa"},
- {"aaa", "aab"},
- {"a\u0300a", "\u00E0a"},
- {"a\u0300\u0320b", "a\u0320\u0300b"},
- {"\u1E0A\u0323", "\x44\u0323\u0307"},
- // A character that decomposes into multiple segments
- // spans several iterations.
- {"\u3304", "\u30A4\u30CB\u30F3\u30AF\u3099"},
-}
-
-func ExampleIter() {
- for i, t := range compareTests {
- r0 := EqualSimple(t.a, t.b)
- r1 := EqualOpt(t.a, t.b)
- fmt.Printf("%d: %v %v\n", i, r0, r1)
- }
- // Output:
- // 0: true true
- // 1: false false
- // 2: true true
- // 3: true true
- // 4: true true
- // 5: true true
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_test.go
deleted file mode 100644
index 8f3b15653c0..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/example_test.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm_test
-
-import (
- "fmt"
-
- "golang.org/x/text/unicode/norm"
-)
-
-func ExampleForm_NextBoundary() {
- s := norm.NFD.String("Mêlée")
-
- for i := 0; i < len(s); {
- d := norm.NFC.NextBoundaryInString(s[i:], true)
- fmt.Printf("%[1]s: %+[1]q\n", s[i:i+d])
- i += d
- }
- // Output:
- // M: "M"
- // ê: "e\u0302"
- // l: "l"
- // é: "e\u0301"
- // e: "e"
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/forminfo_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/forminfo_test.go
deleted file mode 100644
index e15ba9bee67..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/forminfo_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build test
-
-package norm
-
-import "testing"
-
-func TestProperties(t *testing.T) {
- var d runeData
- CK := [2]string{"C", "K"}
- for k, r := 1, rune(0); r < 0x2ffff; r++ {
- if k < len(testData) && r == testData[k].r {
- d = testData[k]
- k++
- }
- s := string(r)
- for j, p := range []Properties{NFC.PropertiesString(s), NFKC.PropertiesString(s)} {
- f := d.f[j]
- if p.CCC() != d.ccc {
- t.Errorf("%U: ccc(%s): was %d; want %d %X", r, CK[j], p.CCC(), d.ccc, p.index)
- }
- if p.isYesC() != (f.qc == Yes) {
- t.Errorf("%U: YesC(%s): was %v; want %v", r, CK[j], p.isYesC(), f.qc == Yes)
- }
- if p.combinesBackward() != (f.qc == Maybe) {
- t.Errorf("%U: combines backwards(%s): was %v; want %v", r, CK[j], p.combinesBackward(), f.qc == Maybe)
- }
- if p.nLeadingNonStarters() != d.nLead {
- t.Errorf("%U: nLead(%s): was %d; want %d %#v %#v", r, CK[j], p.nLeadingNonStarters(), d.nLead, p, d)
- }
- if p.nTrailingNonStarters() != d.nTrail {
- t.Errorf("%U: nTrail(%s): was %d; want %d %#v %#v", r, CK[j], p.nTrailingNonStarters(), d.nTrail, p, d)
- }
- if p.combinesForward() != f.combinesForward {
- t.Errorf("%U: combines forward(%s): was %v; want %v %#v", r, CK[j], p.combinesForward(), f.combinesForward, p)
- }
- // Skip Hangul as it is algorithmically computed.
- if r >= hangulBase && r < hangulEnd {
- continue
- }
- if p.hasDecomposition() {
- if has := f.decomposition != ""; !has {
- t.Errorf("%U: hasDecomposition(%s): was %v; want %v", r, CK[j], p.hasDecomposition(), has)
- }
- if string(p.Decomposition()) != f.decomposition {
- t.Errorf("%U: decomp(%s): was %+q; want %+q", r, CK[j], p.Decomposition(), f.decomposition)
- }
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/iter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/iter_test.go
deleted file mode 100644
index d95aa304d47..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/iter_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "strings"
- "testing"
-)
-
-func doIterNorm(f Form, s string) []byte {
- acc := []byte{}
- i := Iter{}
- i.InitString(f, s)
- for !i.Done() {
- acc = append(acc, i.Next()...)
- }
- return acc
-}
-
-func TestIterNext(t *testing.T) {
- runNormTests(t, "IterNext", func(f Form, out []byte, s string) []byte {
- return doIterNorm(f, string(append(out, s...)))
- })
-}
-
-type SegmentTest struct {
- in string
- out []string
-}
-
-var segmentTests = []SegmentTest{
- {"\u1E0A\u0323a", []string{"\x44\u0323\u0307", "a", ""}},
- {rep('a', segSize), append(strings.Split(rep('a', segSize), ""), "")},
- {rep('a', segSize+2), append(strings.Split(rep('a', segSize+2), ""), "")},
- {rep('a', segSize) + "\u0300aa",
- append(strings.Split(rep('a', segSize-1), ""), "a\u0300", "a", "a", "")},
-
- // U+0f73 is NOT treated as a starter as it is a modifier
- {"a" + grave(29) + "\u0f73", []string{"a" + grave(29), cgj + "\u0f73"}},
- {"a\u0f73", []string{"a\u0f73"}},
-
- // U+ff9e is treated as a non-starter.
- // TODO: should we? Note that this will only affect iteration, as whether
- // or not we do so does not affect the normalization output and will either
- // way result in consistent iteration output.
- {"a" + grave(30) + "\uff9e", []string{"a" + grave(30), cgj + "\uff9e"}},
- {"a\uff9e", []string{"a\uff9e"}},
-}
-
-var segmentTestsK = []SegmentTest{
- {"\u3332", []string{"\u30D5", "\u30A1", "\u30E9", "\u30C3", "\u30C8\u3099", ""}},
- // last segment of multi-segment decomposition needs normalization
- {"\u3332\u093C", []string{"\u30D5", "\u30A1", "\u30E9", "\u30C3", "\u30C8\u093C\u3099", ""}},
- {"\u320E", []string{"\x28", "\uAC00", "\x29"}},
-
- // last segment should be copied to start of buffer.
- {"\ufdfa", []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645", ""}},
- {"\ufdfa" + grave(30), []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645" + grave(30), ""}},
- {"\uFDFA" + grave(64), []string{"\u0635", "\u0644", "\u0649", " ", "\u0627", "\u0644", "\u0644", "\u0647", " ", "\u0639", "\u0644", "\u064a", "\u0647", " ", "\u0648", "\u0633", "\u0644", "\u0645" + grave(30), cgj + grave(30), cgj + grave(4), ""}},
-
- // Hangul and Jamo are grouped together.
- {"\uAC00", []string{"\u1100\u1161", ""}},
- {"\uAC01", []string{"\u1100\u1161\u11A8", ""}},
- {"\u1100\u1161", []string{"\u1100\u1161", ""}},
-}
-
-// Note that, by design, segmentation is equal for composing and decomposing forms.
-func TestIterSegmentation(t *testing.T) {
- segmentTest(t, "SegmentTestD", NFD, segmentTests)
- segmentTest(t, "SegmentTestC", NFC, segmentTests)
- segmentTest(t, "SegmentTestKD", NFKD, segmentTestsK)
- segmentTest(t, "SegmentTestKC", NFKC, segmentTestsK)
-}
-
-func segmentTest(t *testing.T, name string, f Form, tests []SegmentTest) {
- iter := Iter{}
- for i, tt := range tests {
- iter.InitString(f, tt.in)
- for j, seg := range tt.out {
- if seg == "" {
- if !iter.Done() {
- res := string(iter.Next())
- t.Errorf(`%s:%d:%d: expected Done()==true, found segment %+q`, name, i, j, res)
- }
- continue
- }
- if iter.Done() {
- t.Errorf("%s:%d:%d: Done()==true, want false", name, i, j)
- }
- seg = f.String(seg)
- if res := string(iter.Next()); res != seg {
- t.Errorf(`%s:%d:%d" segment was %+q (%d); want %+q (%d)`, name, i, j, pc(res), len(res), pc(seg), len(seg))
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/normalize_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/normalize_test.go
deleted file mode 100644
index e3c0ac73a71..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/normalize_test.go
+++ /dev/null
@@ -1,1287 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "bytes"
- "flag"
- "fmt"
- "io"
- "log"
- "strings"
- "testing"
- "unicode/utf8"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/transform"
-)
-
-var (
- testn = flag.Int("testn", -1, "specific test number to run or -1 for all")
-)
-
-// pc replaces any rune r that is repeated n times, for n > 1, with r{n}.
-func pc(s string) []byte {
- b := bytes.NewBuffer(make([]byte, 0, len(s)))
- for i := 0; i < len(s); {
- r, sz := utf8.DecodeRuneInString(s[i:])
- n := 0
- if sz == 1 {
- // Special-case one-byte case to handle repetition for invalid UTF-8.
- for c := s[i]; i+n < len(s) && s[i+n] == c; n++ {
- }
- } else {
- for _, r2 := range s[i:] {
- if r2 != r {
- break
- }
- n++
- }
- }
- b.WriteString(s[i : i+sz])
- if n > 1 {
- fmt.Fprintf(b, "{%d}", n)
- }
- i += sz * n
- }
- return b.Bytes()
-}
-
-// pidx finds the index from which two strings start to differ, plus context.
-// It returns the index and ellipsis if the index is greater than 0.
-func pidx(a, b string) (i int, prefix string) {
- for ; i < len(a) && i < len(b) && a[i] == b[i]; i++ {
- }
- if i < 8 {
- return 0, ""
- }
- i -= 3 // ensure taking at least one full rune before the difference.
- for k := i - 7; i > k && !utf8.RuneStart(a[i]); i-- {
- }
- return i, "..."
-}
-
-type PositionTest struct {
- input string
- pos int
- buffer string // expected contents of reorderBuffer, if applicable
-}
-
-type positionFunc func(rb *reorderBuffer, s string) (int, []byte)
-
-func runPosTests(t *testing.T, name string, f Form, fn positionFunc, tests []PositionTest) {
- rb := reorderBuffer{}
- rb.init(f, nil)
- for i, test := range tests {
- rb.reset()
- rb.src = inputString(test.input)
- rb.nsrc = len(test.input)
- pos, out := fn(&rb, test.input)
- if pos != test.pos {
- t.Errorf("%s:%d: position is %d; want %d", name, i, pos, test.pos)
- }
- if outs := string(out); outs != test.buffer {
- k, pfx := pidx(outs, test.buffer)
- t.Errorf("%s:%d: buffer \nwas %s%+q; \nwant %s%+q", name, i, pfx, pc(outs[k:]), pfx, pc(test.buffer[k:]))
- }
- }
-}
-
-func grave(n int) string {
- return rep(0x0300, n)
-}
-
-func rep(r rune, n int) string {
- return strings.Repeat(string(r), n)
-}
-
-const segSize = maxByteBufferSize
-
-var cgj = GraphemeJoiner
-
-var decomposeSegmentTests = []PositionTest{
- // illegal runes
- {"\xC2", 0, ""},
- {"\xC0", 1, "\xC0"},
- {"\u00E0\x80", 2, "\u0061\u0300"},
- // starter
- {"a", 1, "a"},
- {"ab", 1, "a"},
- // starter + composing
- {"a\u0300", 3, "a\u0300"},
- {"a\u0300b", 3, "a\u0300"},
- // with decomposition
- {"\u00C0", 2, "A\u0300"},
- {"\u00C0b", 2, "A\u0300"},
- // long
- {grave(31), 60, grave(30) + cgj},
- {"a" + grave(31), 61, "a" + grave(30) + cgj},
-
- // Stability tests: see http://www.unicode.org/review/pr-29.html.
- // U+0300 COMBINING GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING GRAVE;;;;
- // U+0B47 ORIYA VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
- // U+0B3E ORIYA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
- // U+1100 HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;;;;
- // U+1161 HANGUL JUNGSEONG A;Lo;0;L;;;;;N;;;;;
- {"\u0B47\u0300\u0B3E", 8, "\u0B47\u0300\u0B3E"},
- {"\u1100\u0300\u1161", 8, "\u1100\u0300\u1161"},
- {"\u0B47\u0B3E", 6, "\u0B47\u0B3E"},
- {"\u1100\u1161", 6, "\u1100\u1161"},
-
- // U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
- // Sequence of decomposing characters that are starters and modifiers.
- {"\u0d4a" + strings.Repeat("\u0d3e", 31), 90, "\u0d46" + strings.Repeat("\u0d3e", 30) + cgj},
-
- {grave(30), 60, grave(30)},
- // U+FF9E is a starter, but decomposes to U+3099, which is not.
- {grave(30) + "\uff9e", 60, grave(30) + cgj},
- // ends with incomplete UTF-8 encoding
- {"\xCC", 0, ""},
- {"\u0300\xCC", 2, "\u0300"},
-}
-
-func decomposeSegmentF(rb *reorderBuffer, s string) (int, []byte) {
- rb.initString(NFD, s)
- rb.setFlusher(nil, appendFlush)
- p := decomposeSegment(rb, 0, true)
- return p, rb.out
-}
-
-func TestDecomposeSegment(t *testing.T) {
- runPosTests(t, "TestDecomposeSegment", NFC, decomposeSegmentF, decomposeSegmentTests)
-}
-
-var firstBoundaryTests = []PositionTest{
- // no boundary
- {"", -1, ""},
- {"\u0300", -1, ""},
- {"\x80\x80", -1, ""},
- // illegal runes
- {"\xff", 0, ""},
- {"\u0300\xff", 2, ""},
- {"\u0300\xc0\x80\x80", 2, ""},
- // boundaries
- {"a", 0, ""},
- {"\u0300a", 2, ""},
- // Hangul
- {"\u1103\u1161", 0, ""},
- {"\u110B\u1173\u11B7", 0, ""},
- {"\u1161\u110B\u1173\u11B7", 3, ""},
- {"\u1173\u11B7\u1103\u1161", 6, ""},
- // too many combining characters.
- {grave(maxNonStarters - 1), -1, ""},
- {grave(maxNonStarters), 60, ""},
- {grave(maxNonStarters + 1), 60, ""},
-}
-
-func firstBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
- return rb.f.form.FirstBoundary([]byte(s)), nil
-}
-
-func firstBoundaryStringF(rb *reorderBuffer, s string) (int, []byte) {
- return rb.f.form.FirstBoundaryInString(s), nil
-}
-
-func TestFirstBoundary(t *testing.T) {
- runPosTests(t, "TestFirstBoundary", NFC, firstBoundaryF, firstBoundaryTests)
- runPosTests(t, "TestFirstBoundaryInString", NFC, firstBoundaryStringF, firstBoundaryTests)
-}
-
-func TestNextBoundary(t *testing.T) {
- testCases := []struct {
- input string
- atEOF bool
- want int
- }{
- // no boundary
- {"", true, 0},
- {"", false, -1},
- {"\u0300", true, 2},
- {"\u0300", false, -1},
- {"\x80\x80", true, 1},
- {"\x80\x80", false, 1},
- // illegal runes
- {"\xff", false, 1},
- {"\u0300\xff", false, 2},
- {"\u0300\xc0\x80\x80", false, 2},
- {"\xc2\x80\x80", false, 2},
- {"\xc2", false, -1},
- {"\xc2", true, 1},
- {"a\u0300\xc2", false, -1},
- {"a\u0300\xc2", true, 3},
- // boundaries
- {"a", true, 1},
- {"a", false, -1},
- {"aa", false, 1},
- {"\u0300", true, 2},
- {"\u0300", false, -1},
- {"\u0300a", false, 2},
- // Hangul
- {"\u1103\u1161", true, 6},
- {"\u1103\u1161", false, -1},
- {"\u110B\u1173\u11B7", false, -1},
- {"\u110B\u1173\u11B7\u110B\u1173\u11B7", false, 9},
- {"\u1161\u110B\u1173\u11B7", false, 3},
- {"\u1173\u11B7\u1103\u1161", false, 6},
- // too many combining characters.
- {grave(maxNonStarters - 1), false, -1},
- {grave(maxNonStarters), false, 60},
- {grave(maxNonStarters + 1), false, 60},
- }
-
- for _, tc := range testCases {
- if got := NFC.NextBoundary([]byte(tc.input), tc.atEOF); got != tc.want {
- t.Errorf("NextBoundary(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
- }
- if got := NFC.NextBoundaryInString(tc.input, tc.atEOF); got != tc.want {
- t.Errorf("NextBoundaryInString(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
- }
- }
-}
-
-var decomposeToLastTests = []PositionTest{
- // ends with inert character
- {"Hello!", 6, ""},
- {"\u0632", 2, ""},
- {"a\u0301\u0635", 5, ""},
- // ends with non-inert starter
- {"a", 0, "a"},
- {"a\u0301a", 3, "a"},
- {"a\u0301\u03B9", 3, "\u03B9"},
- {"a\u0327", 0, "a\u0327"},
- // illegal runes
- {"\xFF", 1, ""},
- {"aa\xFF", 3, ""},
- {"\xC0\x80\x80", 3, ""},
- {"\xCC\x80\x80", 3, ""},
- // ends with incomplete UTF-8 encoding
- {"a\xCC", 2, ""},
- // ends with combining characters
- {"\u0300\u0301", 0, "\u0300\u0301"},
- {"a\u0300\u0301", 0, "a\u0300\u0301"},
- {"a\u0301\u0308", 0, "a\u0301\u0308"},
- {"a\u0308\u0301", 0, "a\u0308\u0301"},
- {"aaaa\u0300\u0301", 3, "a\u0300\u0301"},
- {"\u0300a\u0300\u0301", 2, "a\u0300\u0301"},
- {"\u00C0", 0, "A\u0300"},
- {"a\u00C0", 1, "A\u0300"},
- // decomposing
- {"a\u0300\u00E0", 3, "a\u0300"},
- // multisegment decompositions (flushes leading segments)
- {"a\u0300\uFDC0", 7, "\u064A"},
- {"\uFDC0" + grave(29), 4, "\u064A" + grave(29)},
- {"\uFDC0" + grave(30), 4, "\u064A" + grave(30)},
- {"\uFDC0" + grave(31), 5, grave(30)},
- {"\uFDFA" + grave(14), 31, "\u0645" + grave(14)},
- // Overflow
- {"\u00E0" + grave(29), 0, "a" + grave(30)},
- {"\u00E0" + grave(30), 2, grave(30)},
- // Hangul
- {"a\u1103", 1, "\u1103"},
- {"a\u110B", 1, "\u110B"},
- {"a\u110B\u1173", 1, "\u110B\u1173"},
- // See comment in composition.go:compBoundaryAfter.
- {"a\u110B\u1173\u11B7", 1, "\u110B\u1173\u11B7"},
- {"a\uC73C", 1, "\u110B\u1173"},
- {"다음", 3, "\u110B\u1173\u11B7"},
- {"다", 0, "\u1103\u1161"},
- {"\u1103\u1161\u110B\u1173\u11B7", 6, "\u110B\u1173\u11B7"},
- {"\u110B\u1173\u11B7\u1103\u1161", 9, "\u1103\u1161"},
- {"다음음", 6, "\u110B\u1173\u11B7"},
- {"음다다", 6, "\u1103\u1161"},
- // maximized buffer
- {"a" + grave(30), 0, "a" + grave(30)},
- // Buffer overflow
- {"a" + grave(31), 3, grave(30)},
- // weird UTF-8
- {"a\u0300\u11B7", 0, "a\u0300\u11B7"},
-}
-
-func decomposeToLast(rb *reorderBuffer, s string) (int, []byte) {
- rb.setFlusher([]byte(s), appendFlush)
- decomposeToLastBoundary(rb)
- buf := rb.flush(nil)
- return len(rb.out), buf
-}
-
-func TestDecomposeToLastBoundary(t *testing.T) {
- runPosTests(t, "TestDecomposeToLastBoundary", NFKC, decomposeToLast, decomposeToLastTests)
-}
-
-var lastBoundaryTests = []PositionTest{
- // ends with inert character
- {"Hello!", 6, ""},
- {"\u0632", 2, ""},
- // ends with non-inert starter
- {"a", 0, ""},
- // illegal runes
- {"\xff", 1, ""},
- {"aa\xff", 3, ""},
- {"a\xff\u0300", 1, ""}, // TODO: should probably be 2.
- {"\xc0\x80\x80", 3, ""},
- {"\xc0\x80\x80\u0300", 3, ""},
- // ends with incomplete UTF-8 encoding
- {"\xCC", -1, ""},
- {"\xE0\x80", -1, ""},
- {"\xF0\x80\x80", -1, ""},
- {"a\xCC", 0, ""},
- {"\x80\xCC", 1, ""},
- {"\xCC\xCC", 1, ""},
- // ends with combining characters
- {"a\u0300\u0301", 0, ""},
- {"aaaa\u0300\u0301", 3, ""},
- {"\u0300a\u0300\u0301", 2, ""},
- {"\u00C2", 0, ""},
- {"a\u00C2", 1, ""},
- // decomposition may recombine
- {"\u0226", 0, ""},
- // no boundary
- {"", -1, ""},
- {"\u0300\u0301", -1, ""},
- {"\u0300", -1, ""},
- {"\x80\x80", -1, ""},
- {"\x80\x80\u0301", -1, ""},
- // Hangul
- {"다음", 3, ""},
- {"다", 0, ""},
- {"\u1103\u1161\u110B\u1173\u11B7", 6, ""},
- {"\u110B\u1173\u11B7\u1103\u1161", 9, ""},
- // too many combining characters.
- {grave(maxNonStarters - 1), -1, ""},
- // May still be preceded with a non-starter.
- {grave(maxNonStarters), -1, ""},
- // May still need to insert a cgj after the last combiner.
- {grave(maxNonStarters + 1), 2, ""},
- {grave(maxNonStarters + 2), 4, ""},
-
- {"a" + grave(maxNonStarters-1), 0, ""},
- {"a" + grave(maxNonStarters), 0, ""},
- // May still need to insert a cgj after the last combiner.
- {"a" + grave(maxNonStarters+1), 3, ""},
- {"a" + grave(maxNonStarters+2), 5, ""},
-}
-
-func lastBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
- return rb.f.form.LastBoundary([]byte(s)), nil
-}
-
-func TestLastBoundary(t *testing.T) {
- runPosTests(t, "TestLastBoundary", NFC, lastBoundaryF, lastBoundaryTests)
-}
-
-type spanTest struct {
- input string
- atEOF bool
- n int
- err error
-}
-
-var quickSpanTests = []spanTest{
- {"", true, 0, nil},
- // starters
- {"a", true, 1, nil},
- {"abc", true, 3, nil},
- {"\u043Eb", true, 3, nil},
- // incomplete last rune.
- {"\xCC", true, 1, nil},
- {"\xCC", false, 0, transform.ErrShortSrc},
- {"a\xCC", true, 2, nil},
- {"a\xCC", false, 0, transform.ErrShortSrc}, // TODO: could be 1 for NFD
- // incorrectly ordered combining characters
- {"\u0300\u0316", true, 0, transform.ErrEndOfSpan},
- {"\u0300\u0316", false, 0, transform.ErrEndOfSpan},
- {"\u0300\u0316cd", true, 0, transform.ErrEndOfSpan},
- {"\u0300\u0316cd", false, 0, transform.ErrEndOfSpan},
- // have a maximum number of combining characters.
- {rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
- {"a" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
- {"Ɵ" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
- {"aa" + rep(0x035D, 30) + "\u035B", true, 1, transform.ErrEndOfSpan},
- {rep(0x035D, 30) + cgj + "\u035B", true, 64, nil},
- {"a" + rep(0x035D, 30) + cgj + "\u035B", true, 65, nil},
- {"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
- {"aa" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
-
- {"a" + rep(0x035D, 30) + cgj + "\u035B", false, 61, transform.ErrShortSrc},
- {"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
- {"aa" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
-}
-
-var quickSpanNFDTests = []spanTest{
- // needs decomposing
- {"\u00C0", true, 0, transform.ErrEndOfSpan},
- {"abc\u00C0", true, 3, transform.ErrEndOfSpan},
- // correctly ordered combining characters
- {"\u0300", true, 2, nil},
- {"ab\u0300", true, 4, nil},
- {"ab\u0300cd", true, 6, nil},
- {"\u0300cd", true, 4, nil},
- {"\u0316\u0300", true, 4, nil},
- {"ab\u0316\u0300", true, 6, nil},
- {"ab\u0316\u0300cd", true, 8, nil},
- {"ab\u0316\u0300\u00C0", true, 6, transform.ErrEndOfSpan},
- {"\u0316\u0300cd", true, 6, nil},
- {"\u043E\u0308b", true, 5, nil},
- // incorrectly ordered combining characters
- {"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan}, // TODO: we could skip 'b' as well.
- {"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
- // Hangul
- {"같은", true, 0, transform.ErrEndOfSpan},
-}
-
-var quickSpanNFCTests = []spanTest{
- // okay composed
- {"\u00C0", true, 2, nil},
- {"abc\u00C0", true, 5, nil},
- // correctly ordered combining characters
- // TODO: b may combine with modifiers, which is why this fails. We could
- // make a more precise test that that actually checks whether last
- // characters combines. Probably not worth it.
- {"ab\u0300", true, 1, transform.ErrEndOfSpan},
- {"ab\u0300cd", true, 1, transform.ErrEndOfSpan},
- {"ab\u0316\u0300", true, 1, transform.ErrEndOfSpan},
- {"ab\u0316\u0300cd", true, 1, transform.ErrEndOfSpan},
- {"\u00C0\u035D", true, 4, nil},
- // we do not special case leading combining characters
- {"\u0300cd", true, 0, transform.ErrEndOfSpan},
- {"\u0300", true, 0, transform.ErrEndOfSpan},
- {"\u0316\u0300", true, 0, transform.ErrEndOfSpan},
- {"\u0316\u0300cd", true, 0, transform.ErrEndOfSpan},
- // incorrectly ordered combining characters
- {"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan},
- {"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
- // Hangul
- {"같은", true, 6, nil},
- {"같은", false, 3, transform.ErrShortSrc},
- // We return the start of the violating segment in case of overflow.
- {grave(30) + "\uff9e", true, 0, transform.ErrEndOfSpan},
- {grave(30), true, 0, transform.ErrEndOfSpan},
-}
-
-func runSpanTests(t *testing.T, name string, f Form, testCases []spanTest) {
- for i, tc := range testCases {
- s := fmt.Sprintf("Bytes/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
- ok := testtext.Run(t, s, func(t *testing.T) {
- n, err := f.Span([]byte(tc.input), tc.atEOF)
- if n != tc.n || err != tc.err {
- t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
- }
- })
- if !ok {
- continue // Don't do the String variant if the Bytes variant failed.
- }
- s = fmt.Sprintf("String/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
- testtext.Run(t, s, func(t *testing.T) {
- n, err := f.SpanString(tc.input, tc.atEOF)
- if n != tc.n || err != tc.err {
- t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
- }
- })
- }
-}
-
-func TestSpan(t *testing.T) {
- runSpanTests(t, "NFD", NFD, quickSpanTests)
- runSpanTests(t, "NFD", NFD, quickSpanNFDTests)
- runSpanTests(t, "NFC", NFC, quickSpanTests)
- runSpanTests(t, "NFC", NFC, quickSpanNFCTests)
-}
-
-var isNormalTests = []PositionTest{
- {"", 1, ""},
- // illegal runes
- {"\xff", 1, ""},
- // starters
- {"a", 1, ""},
- {"abc", 1, ""},
- {"\u043Eb", 1, ""},
- // incorrectly ordered combining characters
- {"\u0300\u0316", 0, ""},
- {"ab\u0300\u0316", 0, ""},
- {"ab\u0300\u0316cd", 0, ""},
- {"\u0300\u0316cd", 0, ""},
-}
-var isNormalNFDTests = []PositionTest{
- // needs decomposing
- {"\u00C0", 0, ""},
- {"abc\u00C0", 0, ""},
- // correctly ordered combining characters
- {"\u0300", 1, ""},
- {"ab\u0300", 1, ""},
- {"ab\u0300cd", 1, ""},
- {"\u0300cd", 1, ""},
- {"\u0316\u0300", 1, ""},
- {"ab\u0316\u0300", 1, ""},
- {"ab\u0316\u0300cd", 1, ""},
- {"\u0316\u0300cd", 1, ""},
- {"\u043E\u0308b", 1, ""},
- // Hangul
- {"같은", 0, ""},
-}
-var isNormalNFCTests = []PositionTest{
- // okay composed
- {"\u00C0", 1, ""},
- {"abc\u00C0", 1, ""},
- // need reordering
- {"a\u0300", 0, ""},
- {"a\u0300cd", 0, ""},
- {"a\u0316\u0300", 0, ""},
- {"a\u0316\u0300cd", 0, ""},
- // correctly ordered combining characters
- {"ab\u0300", 1, ""},
- {"ab\u0300cd", 1, ""},
- {"ab\u0316\u0300", 1, ""},
- {"ab\u0316\u0300cd", 1, ""},
- {"\u00C0\u035D", 1, ""},
- {"\u0300", 1, ""},
- {"\u0316\u0300cd", 1, ""},
- // Hangul
- {"같은", 1, ""},
-}
-
-var isNormalNFKXTests = []PositionTest{
- // Special case.
- {"\u00BC", 0, ""},
-}
-
-func isNormalF(rb *reorderBuffer, s string) (int, []byte) {
- if rb.f.form.IsNormal([]byte(s)) {
- return 1, nil
- }
- return 0, nil
-}
-
-func isNormalStringF(rb *reorderBuffer, s string) (int, []byte) {
- if rb.f.form.IsNormalString(s) {
- return 1, nil
- }
- return 0, nil
-}
-
-func TestIsNormal(t *testing.T) {
- runPosTests(t, "TestIsNormalNFD1", NFD, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFD2", NFD, isNormalF, isNormalNFDTests)
- runPosTests(t, "TestIsNormalNFC1", NFC, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFC2", NFC, isNormalF, isNormalNFCTests)
- runPosTests(t, "TestIsNormalNFKD1", NFKD, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFKD2", NFKD, isNormalF, isNormalNFDTests)
- runPosTests(t, "TestIsNormalNFKD3", NFKD, isNormalF, isNormalNFKXTests)
- runPosTests(t, "TestIsNormalNFKC1", NFKC, isNormalF, isNormalTests)
- runPosTests(t, "TestIsNormalNFKC2", NFKC, isNormalF, isNormalNFCTests)
- runPosTests(t, "TestIsNormalNFKC3", NFKC, isNormalF, isNormalNFKXTests)
-}
-
-func TestIsNormalString(t *testing.T) {
- runPosTests(t, "TestIsNormalNFD1", NFD, isNormalStringF, isNormalTests)
- runPosTests(t, "TestIsNormalNFD2", NFD, isNormalStringF, isNormalNFDTests)
- runPosTests(t, "TestIsNormalNFC1", NFC, isNormalStringF, isNormalTests)
- runPosTests(t, "TestIsNormalNFC2", NFC, isNormalStringF, isNormalNFCTests)
-}
-
-type AppendTest struct {
- left string
- right string
- out string
-}
-
-type appendFunc func(f Form, out []byte, s string) []byte
-
-var fstr = []string{"NFC", "NFD", "NFKC", "NFKD"}
-
-func runNormTests(t *testing.T, name string, fn appendFunc) {
- for f := NFC; f <= NFKD; f++ {
- runAppendTests(t, name, f, fn, normTests[f])
- }
-}
-
-func runAppendTests(t *testing.T, name string, f Form, fn appendFunc, tests []AppendTest) {
- for i, test := range tests {
- t.Run(fmt.Sprintf("%s/%d", fstr[f], i), func(t *testing.T) {
- id := pc(test.left + test.right)
- if *testn >= 0 && i != *testn {
- return
- }
- t.Run("fn", func(t *testing.T) {
- out := []byte(test.left)
- have := string(fn(f, out, test.right))
- if len(have) != len(test.out) {
- t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(test.out), pc(have), pc(test.out))
- }
- if have != test.out {
- k, pf := pidx(have, test.out)
- t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(test.out[k:]))
- }
- })
-
- // Bootstrap by normalizing input. Ensures that the various variants
- // behave the same.
- for g := NFC; g <= NFKD; g++ {
- if f == g {
- continue
- }
- t.Run(fstr[g], func(t *testing.T) {
- want := g.String(test.left + test.right)
- have := string(fn(g, g.AppendString(nil, test.left), test.right))
- if len(have) != len(want) {
- t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(want), pc(have), pc(want))
- }
- if have != want {
- k, pf := pidx(have, want)
- t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(want[k:]))
- }
- })
- }
- })
- }
-}
-
-var normTests = [][]AppendTest{
- appendTestsNFC,
- appendTestsNFD,
- appendTestsNFKC,
- appendTestsNFKD,
-}
-
-var appendTestsNFC = []AppendTest{
- {"", ascii, ascii},
- {"", txt_all, txt_all},
- {"\uff9e", grave(30), "\uff9e" + grave(29) + cgj + grave(1)},
- {grave(30), "\uff9e", grave(30) + cgj + "\uff9e"},
-
- // Tests designed for Iter.
- { // ordering of non-composing combining characters
- "",
- "\u0305\u0316",
- "\u0316\u0305",
- },
- { // segment overflow
- "",
- "a" + rep(0x0305, maxNonStarters+4) + "\u0316",
- "a" + rep(0x0305, maxNonStarters) + cgj + "\u0316" + rep(0x305, 4),
- },
-
- { // Combine across non-blocking non-starters.
- // U+0327 COMBINING CEDILLA;Mn;202;NSM;;;;;N;NON-SPACING CEDILLA;;;;
- // U+0325 COMBINING RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RING BELOW;;;;
- "", "a\u0327\u0325", "\u1e01\u0327",
- },
-
- { // Jamo V+T does not combine.
- "",
- "\u1161\u11a8",
- "\u1161\u11a8",
- },
-
- // Stability tests: see http://www.unicode.org/review/pr-29.html.
- {"", "\u0b47\u0300\u0b3e", "\u0b47\u0300\u0b3e"},
- {"", "\u1100\u0300\u1161", "\u1100\u0300\u1161"},
- {"", "\u0b47\u0b3e", "\u0b4b"},
- {"", "\u1100\u1161", "\uac00"},
-
- // U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
- { // 0d4a starts a new segment.
- "",
- "\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
- "\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
- },
-
- { // Split combining characters.
- // TODO: don't insert CGJ before starters.
- "",
- "\u0d46" + strings.Repeat("\u0d3e", 31),
- "\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
- },
-
- { // Split combining characters.
- "",
- "\u0d4a" + strings.Repeat("\u0d3e", 30),
- "\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
- },
-
- { // https://golang.org/issues/20079
- "",
- "\xeb\u0344",
- "\xeb\u0308\u0301",
- },
-
- { // https://golang.org/issues/20079
- "",
- "\uac00" + strings.Repeat("\u0300", 30),
- "\uac00" + strings.Repeat("\u0300", 29) + "\u034f\u0300",
- },
-
- { // https://golang.org/issues/20079
- "",
- "\xeb" + strings.Repeat("\u0300", 31),
- "\xeb" + strings.Repeat("\u0300", 30) + "\u034f\u0300",
- },
-}
-
-var appendTestsNFD = []AppendTest{
- // TODO: Move some of the tests here.
-}
-
-var appendTestsNFKC = []AppendTest{
- // empty buffers
- {"", "", ""},
- {"a", "", "a"},
- {"", "a", "a"},
- {"", "\u0041\u0307\u0304", "\u01E0"},
- // segment split across buffers
- {"", "a\u0300b", "\u00E0b"},
- {"a", "\u0300b", "\u00E0b"},
- {"a", "\u0300\u0316", "\u00E0\u0316"},
- {"a", "\u0316\u0300", "\u00E0\u0316"},
- {"a", "\u0300a\u0300", "\u00E0\u00E0"},
- {"a", "\u0300a\u0300a\u0300", "\u00E0\u00E0\u00E0"},
- {"a", "\u0300aaa\u0300aaa\u0300", "\u00E0aa\u00E0aa\u00E0"},
- {"a\u0300", "\u0327", "\u00E0\u0327"},
- {"a\u0327", "\u0300", "\u00E0\u0327"},
- {"a\u0316", "\u0300", "\u00E0\u0316"},
- {"\u0041\u0307", "\u0304", "\u01E0"},
- // Hangul
- {"", "\u110B\u1173", "\uC73C"},
- {"", "\u1103\u1161", "\uB2E4"},
- {"", "\u110B\u1173\u11B7", "\uC74C"},
- {"", "\u320E", "\x28\uAC00\x29"},
- {"", "\x28\u1100\u1161\x29", "\x28\uAC00\x29"},
- {"\u1103", "\u1161", "\uB2E4"},
- {"\u110B", "\u1173\u11B7", "\uC74C"},
- {"\u110B\u1173", "\u11B7", "\uC74C"},
- {"\uC73C", "\u11B7", "\uC74C"},
- // UTF-8 encoding split across buffers
- {"a\xCC", "\x80", "\u00E0"},
- {"a\xCC", "\x80b", "\u00E0b"},
- {"a\xCC", "\x80a\u0300", "\u00E0\u00E0"},
- {"a\xCC", "\x80\x80", "\u00E0\x80"},
- {"a\xCC", "\x80\xCC", "\u00E0\xCC"},
- {"a\u0316\xCC", "\x80a\u0316\u0300", "\u00E0\u0316\u00E0\u0316"},
- // ending in incomplete UTF-8 encoding
- {"", "\xCC", "\xCC"},
- {"a", "\xCC", "a\xCC"},
- {"a", "b\xCC", "ab\xCC"},
- {"\u0226", "\xCC", "\u0226\xCC"},
- // illegal runes
- {"", "\x80", "\x80"},
- {"", "\x80\x80\x80", "\x80\x80\x80"},
- {"", "\xCC\x80\x80\x80", "\xCC\x80\x80\x80"},
- {"", "a\x80", "a\x80"},
- {"", "a\x80\x80\x80", "a\x80\x80\x80"},
- {"", "a\x80\x80\x80\x80\x80\x80", "a\x80\x80\x80\x80\x80\x80"},
- {"a", "\x80\x80\x80", "a\x80\x80\x80"},
- // overflow
- {"", strings.Repeat("\x80", 33), strings.Repeat("\x80", 33)},
- {strings.Repeat("\x80", 33), "", strings.Repeat("\x80", 33)},
- {strings.Repeat("\x80", 33), strings.Repeat("\x80", 33), strings.Repeat("\x80", 66)},
- // overflow of combining characters
- {"", grave(34), grave(30) + cgj + grave(4)},
- {"", grave(36), grave(30) + cgj + grave(6)},
- {grave(29), grave(5), grave(30) + cgj + grave(4)},
- {grave(30), grave(4), grave(30) + cgj + grave(4)},
- {grave(30), grave(3), grave(30) + cgj + grave(3)},
- {grave(30) + "\xCC", "\x80", grave(30) + cgj + grave(1)},
- {"", "\uFDFA" + grave(14), "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645" + grave(14)},
- {"", "\uFDFA" + grave(28) + "\u0316", "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645\u0316" + grave(28)},
- // - First rune has a trailing non-starter.
- {"\u00d5", grave(30), "\u00d5" + grave(29) + cgj + grave(1)},
- // - U+FF9E decomposes into a non-starter in compatibility mode. A CGJ must be
- // inserted even when FF9E starts a new segment.
- {"\uff9e", grave(30), "\u3099" + grave(29) + cgj + grave(1)},
- {grave(30), "\uff9e", grave(30) + cgj + "\u3099"},
- // - Many non-starter decompositions in a row causing overflow.
- {"", rep(0x340, 31), rep(0x300, 30) + cgj + "\u0300"},
- {"", rep(0xFF9E, 31), rep(0x3099, 30) + cgj + "\u3099"},
-
- {"", "\u0644\u0625" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + "\u0300\u0300"},
- {"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
- {"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
-
- // U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
- {"", "\u0f7f" + rep(0xf71, 29) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80"},
- {"", "\u0f7f" + rep(0xf71, 28) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + "\u0f80"},
- {"", "\u0f7f" + rep(0xf81, 16), "\u0f7f" + rep(0xf71, 15) + rep(0xf80, 15) + cgj + "\u0f71\u0f80"},
-
- // weird UTF-8
- {"\u00E0\xE1", "\x86", "\u00E0\xE1\x86"},
- {"a\u0300\u11B7", "\u0300", "\u00E0\u11B7\u0300"},
- {"a\u0300\u11B7\u0300", "\u0300", "\u00E0\u11B7\u0300\u0300"},
- {"\u0300", "\xF8\x80\x80\x80\x80\u0300", "\u0300\xF8\x80\x80\x80\x80\u0300"},
- {"\u0300", "\xFC\x80\x80\x80\x80\x80\u0300", "\u0300\xFC\x80\x80\x80\x80\x80\u0300"},
- {"\xF8\x80\x80\x80\x80\u0300", "\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
- {"\xFC\x80\x80\x80\x80\x80\u0300", "\u0300", "\xFC\x80\x80\x80\x80\x80\u0300\u0300"},
- {"\xF8\x80\x80\x80", "\x80\u0300\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
-
- {"", strings.Repeat("a\u0316\u0300", 6), strings.Repeat("\u00E0\u0316", 6)},
- // large input.
- {"", strings.Repeat("a\u0300\u0316", 31), strings.Repeat("\u00E0\u0316", 31)},
- {"", strings.Repeat("a\u0300\u0316", 4000), strings.Repeat("\u00E0\u0316", 4000)},
- {"", strings.Repeat("\x80\x80", 4000), strings.Repeat("\x80\x80", 4000)},
- {"", "\u0041\u0307\u0304", "\u01E0"},
-}
-
-var appendTestsNFKD = []AppendTest{
- {"", "a" + grave(64), "a" + grave(30) + cgj + grave(30) + cgj + grave(4)},
-
- { // segment overflow on unchanged character
- "",
- "a" + grave(64) + "\u0316",
- "a" + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(4),
- },
- { // segment overflow on unchanged character + start value
- "",
- "a" + grave(98) + "\u0316",
- "a" + grave(30) + cgj + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(8),
- },
- { // segment overflow on decomposition. (U+0340 decomposes to U+0300.)
- "",
- "a" + grave(59) + "\u0340",
- "a" + grave(30) + cgj + grave(30),
- },
- { // segment overflow on non-starter decomposition
- "",
- "a" + grave(33) + "\u0340" + grave(30) + "\u0320",
- "a" + grave(30) + cgj + grave(30) + cgj + "\u0320" + grave(4),
- },
- { // start value after ASCII overflow
- "",
- rep('a', segSize) + grave(32) + "\u0320",
- rep('a', segSize) + grave(30) + cgj + "\u0320" + grave(2),
- },
- { // Jamo overflow
- "",
- "\u1100\u1161" + grave(30) + "\u0320" + grave(2),
- "\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // Hangul
- "",
- "\uac00",
- "\u1100\u1161",
- },
- { // Hangul overflow
- "",
- "\uac00" + grave(32) + "\u0320",
- "\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // Hangul overflow in Hangul mode.
- "",
- "\uac00\uac00" + grave(32) + "\u0320",
- "\u1100\u1161\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // Hangul overflow in Hangul mode.
- "",
- strings.Repeat("\uac00", 3) + grave(32) + "\u0320",
- strings.Repeat("\u1100\u1161", 3) + grave(29) + cgj + "\u0320" + grave(3),
- },
- { // start value after cc=0
- "",
- "您您" + grave(34) + "\u0320",
- "您您" + grave(30) + cgj + "\u0320" + grave(4),
- },
- { // start value after normalization
- "",
- "\u0300\u0320a" + grave(34) + "\u0320",
- "\u0320\u0300a" + grave(30) + cgj + "\u0320" + grave(4),
- },
- {
- // U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
- "",
- "a\u0f7f" + rep(0xf71, 29) + "\u0f81",
- "a\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80",
- },
-}
-
-func TestAppend(t *testing.T) {
- runNormTests(t, "Append", func(f Form, out []byte, s string) []byte {
- return f.Append(out, []byte(s)...)
- })
-}
-
-func TestAppendString(t *testing.T) {
- runNormTests(t, "AppendString", func(f Form, out []byte, s string) []byte {
- return f.AppendString(out, s)
- })
-}
-
-func TestBytes(t *testing.T) {
- runNormTests(t, "Bytes", func(f Form, out []byte, s string) []byte {
- buf := []byte{}
- buf = append(buf, out...)
- buf = append(buf, s...)
- return f.Bytes(buf)
- })
-}
-
-func TestString(t *testing.T) {
- runNormTests(t, "String", func(f Form, out []byte, s string) []byte {
- outs := string(out) + s
- return []byte(f.String(outs))
- })
-}
-
-func TestLinking(t *testing.T) {
- const prog = `
- package main
- import "fmt"
- import "golang.org/x/text/unicode/norm"
- func main() { fmt.Println(norm.%s) }
- `
- baseline, errB := testtext.CodeSize(fmt.Sprintf(prog, "MaxSegmentSize"))
- withTables, errT := testtext.CodeSize(fmt.Sprintf(prog, `NFC.String("")`))
- if errB != nil || errT != nil {
- t.Skipf("code size failed: %v and %v", errB, errT)
- }
- // Tables are at least 50K
- if d := withTables - baseline; d < 50*1024 {
- t.Errorf("tables appear not to be dropped: %d - %d = %d",
- withTables, baseline, d)
- }
-}
-
-func appendBench(f Form, in []byte) func() {
- buf := make([]byte, 0, 4*len(in))
- return func() {
- f.Append(buf, in...)
- }
-}
-
-func bytesBench(f Form, in []byte) func() {
- return func() {
- f.Bytes(in)
- }
-}
-
-func iterBench(f Form, in []byte) func() {
- iter := Iter{}
- return func() {
- iter.Init(f, in)
- for !iter.Done() {
- iter.Next()
- }
- }
-}
-
-func transformBench(f Form, in []byte) func() {
- buf := make([]byte, 4*len(in))
- return func() {
- if _, n, err := f.Transform(buf, in, true); err != nil || len(in) != n {
- log.Panic(n, len(in), err)
- }
- }
-}
-
-func readerBench(f Form, in []byte) func() {
- buf := make([]byte, 4*len(in))
- return func() {
- r := f.Reader(bytes.NewReader(in))
- var err error
- for err == nil {
- _, err = r.Read(buf)
- }
- if err != io.EOF {
- panic("")
- }
- }
-}
-
-func writerBench(f Form, in []byte) func() {
- buf := make([]byte, 0, 4*len(in))
- return func() {
- r := f.Writer(bytes.NewBuffer(buf))
- if _, err := r.Write(in); err != nil {
- panic("")
- }
- }
-}
-
-func appendBenchmarks(bm []func(), f Form, in []byte) []func() {
- bm = append(bm, appendBench(f, in))
- bm = append(bm, iterBench(f, in))
- bm = append(bm, transformBench(f, in))
- bm = append(bm, readerBench(f, in))
- bm = append(bm, writerBench(f, in))
- return bm
-}
-
-func doFormBenchmark(b *testing.B, inf, f Form, s string) {
- b.StopTimer()
- in := inf.Bytes([]byte(s))
- bm := appendBenchmarks(nil, f, in)
- b.SetBytes(int64(len(in) * len(bm)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- for _, fn := range bm {
- fn()
- }
- }
-}
-
-func doSingle(b *testing.B, f func(Form, []byte) func(), s []byte) {
- b.StopTimer()
- fn := f(NFC, s)
- b.SetBytes(int64(len(s)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- fn()
- }
-}
-
-var (
- smallNoChange = []byte("nörmalization")
- smallChange = []byte("No\u0308rmalization")
- ascii = strings.Repeat("There is nothing to change here! ", 500)
-)
-
-func lowerBench(f Form, in []byte) func() {
- // Use package strings instead of bytes as it doesn't allocate memory
- // if there aren't any changes.
- s := string(in)
- return func() {
- strings.ToLower(s)
- }
-}
-
-func BenchmarkLowerCaseNoChange(b *testing.B) {
- doSingle(b, lowerBench, smallNoChange)
-}
-func BenchmarkLowerCaseChange(b *testing.B) {
- doSingle(b, lowerBench, smallChange)
-}
-
-func quickSpanBench(f Form, in []byte) func() {
- return func() {
- f.QuickSpan(in)
- }
-}
-
-func BenchmarkQuickSpanChangeNFC(b *testing.B) {
- doSingle(b, quickSpanBench, smallNoChange)
-}
-
-func BenchmarkBytesNoChangeNFC(b *testing.B) {
- doSingle(b, bytesBench, smallNoChange)
-}
-func BenchmarkBytesChangeNFC(b *testing.B) {
- doSingle(b, bytesBench, smallChange)
-}
-
-func BenchmarkAppendNoChangeNFC(b *testing.B) {
- doSingle(b, appendBench, smallNoChange)
-}
-func BenchmarkAppendChangeNFC(b *testing.B) {
- doSingle(b, appendBench, smallChange)
-}
-func BenchmarkAppendLargeNFC(b *testing.B) {
- doSingle(b, appendBench, txt_all_bytes)
-}
-
-func BenchmarkIterNoChangeNFC(b *testing.B) {
- doSingle(b, iterBench, smallNoChange)
-}
-func BenchmarkIterChangeNFC(b *testing.B) {
- doSingle(b, iterBench, smallChange)
-}
-func BenchmarkIterLargeNFC(b *testing.B) {
- doSingle(b, iterBench, txt_all_bytes)
-}
-
-func BenchmarkTransformNoChangeNFC(b *testing.B) {
- doSingle(b, transformBench, smallNoChange)
-}
-func BenchmarkTransformChangeNFC(b *testing.B) {
- doSingle(b, transformBench, smallChange)
-}
-func BenchmarkTransformLargeNFC(b *testing.B) {
- doSingle(b, transformBench, txt_all_bytes)
-}
-
-func BenchmarkNormalizeAsciiNFC(b *testing.B) {
- doFormBenchmark(b, NFC, NFC, ascii)
-}
-func BenchmarkNormalizeAsciiNFD(b *testing.B) {
- doFormBenchmark(b, NFC, NFD, ascii)
-}
-func BenchmarkNormalizeAsciiNFKC(b *testing.B) {
- doFormBenchmark(b, NFC, NFKC, ascii)
-}
-func BenchmarkNormalizeAsciiNFKD(b *testing.B) {
- doFormBenchmark(b, NFC, NFKD, ascii)
-}
-
-func BenchmarkNormalizeNFC2NFC(b *testing.B) {
- doFormBenchmark(b, NFC, NFC, txt_all)
-}
-func BenchmarkNormalizeNFC2NFD(b *testing.B) {
- doFormBenchmark(b, NFC, NFD, txt_all)
-}
-func BenchmarkNormalizeNFD2NFC(b *testing.B) {
- doFormBenchmark(b, NFD, NFC, txt_all)
-}
-func BenchmarkNormalizeNFD2NFD(b *testing.B) {
- doFormBenchmark(b, NFD, NFD, txt_all)
-}
-
-// Hangul is often special-cased, so we test it separately.
-func BenchmarkNormalizeHangulNFC2NFC(b *testing.B) {
- doFormBenchmark(b, NFC, NFC, txt_kr)
-}
-func BenchmarkNormalizeHangulNFC2NFD(b *testing.B) {
- doFormBenchmark(b, NFC, NFD, txt_kr)
-}
-func BenchmarkNormalizeHangulNFD2NFC(b *testing.B) {
- doFormBenchmark(b, NFD, NFC, txt_kr)
-}
-func BenchmarkNormalizeHangulNFD2NFD(b *testing.B) {
- doFormBenchmark(b, NFD, NFD, txt_kr)
-}
-
-var forms = []Form{NFC, NFD, NFKC, NFKD}
-
-func doTextBenchmark(b *testing.B, s string) {
- b.StopTimer()
- in := []byte(s)
- bm := []func(){}
- for _, f := range forms {
- bm = appendBenchmarks(bm, f, in)
- }
- b.SetBytes(int64(len(s) * len(bm)))
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- for _, f := range bm {
- f()
- }
- }
-}
-
-func BenchmarkCanonicalOrdering(b *testing.B) {
- doTextBenchmark(b, txt_canon)
-}
-func BenchmarkExtendedLatin(b *testing.B) {
- doTextBenchmark(b, txt_vn)
-}
-func BenchmarkMiscTwoByteUtf8(b *testing.B) {
- doTextBenchmark(b, twoByteUtf8)
-}
-func BenchmarkMiscThreeByteUtf8(b *testing.B) {
- doTextBenchmark(b, threeByteUtf8)
-}
-func BenchmarkHangul(b *testing.B) {
- doTextBenchmark(b, txt_kr)
-}
-func BenchmarkJapanese(b *testing.B) {
- doTextBenchmark(b, txt_jp)
-}
-func BenchmarkChinese(b *testing.B) {
- doTextBenchmark(b, txt_cn)
-}
-func BenchmarkOverflow(b *testing.B) {
- doTextBenchmark(b, overflow)
-}
-
-var overflow = string(bytes.Repeat([]byte("\u035D"), 4096)) + "\u035B"
-
-// Tests sampled from the Canonical ordering tests (Part 2) of
-// http://unicode.org/Public/UNIDATA/NormalizationTest.txt
-const txt_canon = `\u0061\u0315\u0300\u05AE\u0300\u0062 \u0061\u0300\u0315\u0300\u05AE\u0062
-\u0061\u0302\u0315\u0300\u05AE\u0062 \u0061\u0307\u0315\u0300\u05AE\u0062
-\u0061\u0315\u0300\u05AE\u030A\u0062 \u0061\u059A\u0316\u302A\u031C\u0062
-\u0061\u032E\u059A\u0316\u302A\u0062 \u0061\u0338\u093C\u0334\u0062
-\u0061\u059A\u0316\u302A\u0339 \u0061\u0341\u0315\u0300\u05AE\u0062
-\u0061\u0348\u059A\u0316\u302A\u0062 \u0061\u0361\u0345\u035D\u035C\u0062
-\u0061\u0366\u0315\u0300\u05AE\u0062 \u0061\u0315\u0300\u05AE\u0486\u0062
-\u0061\u05A4\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0613\u0062
-\u0061\u0315\u0300\u05AE\u0615\u0062 \u0061\u0617\u0315\u0300\u05AE\u0062
-\u0061\u0619\u0618\u064D\u064E\u0062 \u0061\u0315\u0300\u05AE\u0654\u0062
-\u0061\u0315\u0300\u05AE\u06DC\u0062 \u0061\u0733\u0315\u0300\u05AE\u0062
-\u0061\u0744\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0745\u0062
-\u0061\u09CD\u05B0\u094D\u3099\u0062 \u0061\u0E38\u0E48\u0E38\u0C56\u0062
-\u0061\u0EB8\u0E48\u0E38\u0E49\u0062 \u0061\u0F72\u0F71\u0EC8\u0F71\u0062
-\u0061\u1039\u05B0\u094D\u3099\u0062 \u0061\u05B0\u094D\u3099\u1A60\u0062
-\u0061\u3099\u093C\u0334\u1BE6\u0062 \u0061\u3099\u093C\u0334\u1C37\u0062
-\u0061\u1CD9\u059A\u0316\u302A\u0062 \u0061\u2DED\u0315\u0300\u05AE\u0062
-\u0061\u2DEF\u0315\u0300\u05AE\u0062 \u0061\u302D\u302E\u059A\u0316\u0062`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/vn/
-const txt_vn = `Với các điều kiện sau: Ghi nhận công của tác giả.
-Nếu bạn sử dụng, chuyển đổi, hoặc xây dựng dự án từ
-nội dung được chia sẻ này, bạn phải áp dụng giấy phép này hoặc
-một giấy phép khác có các điều khoản tương tự như giấy phép này
-cho dự án của bạn. Hiểu rằng: Miễn — Bất kỳ các điều kiện nào
-trên đây cũng có thể được miễn bỏ nếu bạn được sự cho phép của
-người sở hữu bản quyền. Phạm vi công chúng — Khi tác phẩm hoặc
-bất kỳ chương nào của tác phẩm đã trong vùng dành cho công
-chúng theo quy định của pháp luật thì tình trạng của nó không
-bị ảnh hưởng bởi giấy phép trong bất kỳ trường hợp nào.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/1.0/deed.ru
-const txt_ru = `При обязательном соблюдении следующих условий:
-Attribution — Вы должны атрибутировать произведение (указывать
-автора и источник) в порядке, предусмотренном автором или
-лицензиаром (но только так, чтобы никоим образом не подразумевалось,
-что они поддерживают вас или использование вами данного произведения).
-Υπό τις ακόλουθες προϋποθέσεις:`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/gr/
-const txt_gr = `Αναφορά Δημιουργού — Θα πρέπει να κάνετε την αναφορά στο έργο με τον
-τρόπο που έχει οριστεί από το δημιουργό ή το χορηγούντο την άδεια
-(χωρίς όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή
-τη χρήση του έργου από εσάς). Παρόμοια Διανομή — Εάν αλλοιώσετε,
-τροποποιήσετε ή δημιουργήσετε περαιτέρω βασισμένοι στο έργο θα
-μπορείτε να διανέμετε το έργο που θα προκύψει μόνο με την ίδια ή
-παρόμοια άδεια.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/deed.ar
-const txt_ar = `بموجب الشروط التالية نسب المصنف — يجب عليك أن
-تنسب العمل بالطريقة التي تحددها المؤلف أو المرخص (ولكن ليس بأي حال من
-الأحوال أن توحي وتقترح بتحول أو استخدامك للعمل).
-المشاركة على قدم المساواة — إذا كنت يعدل ، والتغيير ، أو الاستفادة
-من هذا العمل ، قد ينتج عن توزيع العمل إلا في ظل تشابه او تطابق فى واحد
-لهذا الترخيص.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/1.0/il/
-const txt_il = `בכפוף לתנאים הבאים: ייחוס — עליך לייחס את היצירה (לתת קרדיט) באופן
-המצויין על-ידי היוצר או מעניק הרישיון (אך לא בשום אופן המרמז על כך
-שהם תומכים בך או בשימוש שלך ביצירה). שיתוף זהה — אם תחליט/י לשנות,
-לעבד או ליצור יצירה נגזרת בהסתמך על יצירה זו, תוכל/י להפיץ את יצירתך
-החדשה רק תחת אותו הרישיון או רישיון דומה לרישיון זה.`
-
-const twoByteUtf8 = txt_ru + txt_gr + txt_ar + txt_il
-
-// Taken from http://creativecommons.org/licenses/by-sa/2.0/kr/
-const txt_kr = `다음과 같은 조건을 따라야 합니다: 저작자표시
-(Attribution) — 저작자나 이용허락자가 정한 방법으로 저작물의
-원저작자를 표시하여야 합니다(그러나 원저작자가 이용자나 이용자의
-이용을 보증하거나 추천한다는 의미로 표시해서는 안됩니다).
-동일조건변경허락 — 이 저작물을 이용하여 만든 이차적 저작물에는 본
-라이선스와 동일한 라이선스를 적용해야 합니다.`
-
-// Taken from http://creativecommons.org/licenses/by-sa/3.0/th/
-const txt_th = `ภายใต้เงื่อนไข ดังต่อไปนี้ : แสดงที่มา — คุณต้องแสดงที่
-มาของงานดังกล่าว ตามรูปแบบที่ผู้สร้างสรรค์หรือผู้อนุญาตกำหนด (แต่
-ไม่ใช่ในลักษณะที่ว่า พวกเขาสนับสนุนคุณหรือสนับสนุนการที่
-คุณนำงานไปใช้) อนุญาตแบบเดียวกัน — หากคุณดัดแปลง เปลี่ยนรูป หรื
-อต่อเติมงานนี้ คุณต้องใช้สัญญาอนุญาตแบบเดียวกันหรือแบบที่เหมื
-อนกับสัญญาอนุญาตที่ใช้กับงานนี้เท่านั้น`
-
-const threeByteUtf8 = txt_th
-
-// Taken from http://creativecommons.org/licenses/by-sa/2.0/jp/
-const txt_jp = `あなたの従うべき条件は以下の通りです。
-表示 — あなたは原著作者のクレジットを表示しなければなりません。
-継承 — もしあなたがこの作品を改変、変形または加工した場合、
-あなたはその結果生じた作品をこの作品と同一の許諾条件の下でのみ
-頒布することができます。`
-
-// http://creativecommons.org/licenses/by-sa/2.5/cn/
-const txt_cn = `您可以自由: 复制、发行、展览、表演、放映、
-广播或通过信息网络传播本作品 创作演绎作品
-对本作品进行商业性使用 惟须遵守下列条件:
-署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。
-相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,
-您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。`
-
-const txt_cjk = txt_cn + txt_jp + txt_kr
-const txt_all = txt_vn + twoByteUtf8 + threeByteUtf8 + txt_cjk
-
-var txt_all_bytes = []byte(txt_all)
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/readwriter_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/readwriter_test.go
deleted file mode 100644
index b7756ba24e2..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/readwriter_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "bytes"
- "fmt"
- "testing"
-)
-
-var bufSizes = []int{1, 2, 3, 4, 5, 6, 7, 8, 100, 101, 102, 103, 4000, 4001, 4002, 4003}
-
-func readFunc(size int) appendFunc {
- return func(f Form, out []byte, s string) []byte {
- out = append(out, s...)
- r := f.Reader(bytes.NewBuffer(out))
- buf := make([]byte, size)
- result := []byte{}
- for n, err := 0, error(nil); err == nil; {
- n, err = r.Read(buf)
- result = append(result, buf[:n]...)
- }
- return result
- }
-}
-
-func TestReader(t *testing.T) {
- for _, s := range bufSizes {
- name := fmt.Sprintf("TestReader%d", s)
- runNormTests(t, name, readFunc(s))
- }
-}
-
-func writeFunc(size int) appendFunc {
- return func(f Form, out []byte, s string) []byte {
- in := append(out, s...)
- result := new(bytes.Buffer)
- w := f.Writer(result)
- buf := make([]byte, size)
- for n := 0; len(in) > 0; in = in[n:] {
- n = copy(buf, in)
- _, _ = w.Write(buf[:n])
- }
- w.Close()
- return result.Bytes()
- }
-}
-
-func TestWriter(t *testing.T) {
- for _, s := range bufSizes {
- name := fmt.Sprintf("TestWriter%d", s)
- runNormTests(t, name, writeFunc(s))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/transform_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/transform_test.go
deleted file mode 100644
index d596ff3d893..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/transform_test.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/text/transform"
-)
-
-func TestTransform(t *testing.T) {
- tests := []struct {
- f Form
- in, out string
- eof bool
- dstSize int
- err error
- }{
- {NFC, "ab", "ab", true, 2, nil},
- {NFC, "qx", "qx", true, 2, nil},
- {NFD, "qx", "qx", true, 2, nil},
- {NFC, "", "", true, 1, nil},
- {NFD, "", "", true, 1, nil},
- {NFC, "", "", false, 1, nil},
- {NFD, "", "", false, 1, nil},
-
- // Normalized segment does not fit in destination.
- {NFD, "ö", "", true, 1, transform.ErrShortDst},
- {NFD, "ö", "", true, 2, transform.ErrShortDst},
-
- // As an artifact of the algorithm, only full segments are written.
- // This is not strictly required, and some bytes could be written.
- // In practice, for Transform to not block, the destination buffer
- // should be at least MaxSegmentSize to work anyway and these edge
- // conditions will be relatively rare.
- {NFC, "ab", "", true, 1, transform.ErrShortDst},
- // This is even true for inert runes.
- {NFC, "qx", "", true, 1, transform.ErrShortDst},
- {NFC, "a\u0300abc", "\u00e0a", true, 4, transform.ErrShortDst},
-
- // We cannot write a segment if successive runes could still change the result.
- {NFD, "ö", "", false, 3, transform.ErrShortSrc},
- {NFC, "a\u0300", "", false, 4, transform.ErrShortSrc},
- {NFD, "a\u0300", "", false, 4, transform.ErrShortSrc},
- {NFC, "ö", "", false, 3, transform.ErrShortSrc},
-
- {NFC, "a\u0300", "", true, 1, transform.ErrShortDst},
- // Theoretically could fit, but won't due to simplified checks.
- {NFC, "a\u0300", "", true, 2, transform.ErrShortDst},
- {NFC, "a\u0300", "", true, 3, transform.ErrShortDst},
- {NFC, "a\u0300", "\u00e0", true, 4, nil},
-
- {NFD, "öa\u0300", "o\u0308", false, 8, transform.ErrShortSrc},
- {NFD, "öa\u0300ö", "o\u0308a\u0300", true, 8, transform.ErrShortDst},
- {NFD, "öa\u0300ö", "o\u0308a\u0300", false, 12, transform.ErrShortSrc},
-
- // Illegal input is copied verbatim.
- {NFD, "\xbd\xb2=\xbc ", "\xbd\xb2=\xbc ", true, 8, nil},
- }
- b := make([]byte, 100)
- for i, tt := range tests {
- nDst, _, err := tt.f.Transform(b[:tt.dstSize], []byte(tt.in), tt.eof)
- out := string(b[:nDst])
- if out != tt.out || err != tt.err {
- t.Errorf("%d: was %+q (%v); want %+q (%v)", i, out, err, tt.out, tt.err)
- }
- if want := tt.f.String(tt.in)[:nDst]; want != out {
- t.Errorf("%d: incorrect normalization: was %+q; want %+q", i, out, want)
- }
- }
-}
-
-var transBufSizes = []int{
- MaxTransformChunkSize,
- 3 * MaxTransformChunkSize / 2,
- 2 * MaxTransformChunkSize,
- 3 * MaxTransformChunkSize,
- 100 * MaxTransformChunkSize,
-}
-
-func doTransNorm(f Form, buf []byte, b []byte) []byte {
- acc := []byte{}
- for p := 0; p < len(b); {
- nd, ns, _ := f.Transform(buf[:], b[p:], true)
- p += ns
- acc = append(acc, buf[:nd]...)
- }
- return acc
-}
-
-func TestTransformNorm(t *testing.T) {
- for _, sz := range transBufSizes {
- buf := make([]byte, sz)
- runNormTests(t, fmt.Sprintf("Transform:%d", sz), func(f Form, out []byte, s string) []byte {
- return doTransNorm(f, buf, append(out, s...))
- })
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/ucd_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/ucd_test.go
deleted file mode 100644
index 29205a6aa89..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/norm/ucd_test.go
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package norm
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "regexp"
- "runtime"
- "strconv"
- "strings"
- "sync"
- "testing"
- "time"
- "unicode/utf8"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
-)
-
-var once sync.Once
-
-func skipShort(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- once.Do(func() { loadTestData(t) })
-}
-
-// This regression test runs the test set in NormalizationTest.txt
-// (taken from http://www.unicode.org/Public/<unicode.Version>/ucd/).
-//
-// NormalizationTest.txt has form:
-// @Part0 # Specific cases
-// #
-// 1E0A;1E0A;0044 0307;1E0A;0044 0307; # (Ḋ; Ḋ; D◌̇; Ḋ; D◌̇; ) LATIN CAPITAL LETTER D WITH DOT ABOVE
-// 1E0C;1E0C;0044 0323;1E0C;0044 0323; # (Ḍ; Ḍ; D◌̣; Ḍ; D◌̣; ) LATIN CAPITAL LETTER D WITH DOT BELOW
-//
-// Each test has 5 columns (c1, c2, c3, c4, c5), where
-// (c1, c2, c3, c4, c5) == (c1, NFC(c1), NFD(c1), NFKC(c1), NFKD(c1))
-//
-// CONFORMANCE:
-// 1. The following invariants must be true for all conformant implementations
-//
-// NFC
-// c2 == NFC(c1) == NFC(c2) == NFC(c3)
-// c4 == NFC(c4) == NFC(c5)
-//
-// NFD
-// c3 == NFD(c1) == NFD(c2) == NFD(c3)
-// c5 == NFD(c4) == NFD(c5)
-//
-// NFKC
-// c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
-//
-// NFKD
-// c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
-//
-// 2. For every code point X assigned in this version of Unicode that is not
-// specifically listed in Part 1, the following invariants must be true
-// for all conformant implementations:
-//
-// X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X)
-//
-
-// Column types.
-const (
- cRaw = iota
- cNFC
- cNFD
- cNFKC
- cNFKD
- cMaxColumns
-)
-
-// Holds data from NormalizationTest.txt
-var part []Part
-
-type Part struct {
- name string
- number int
- tests []Test
-}
-
-type Test struct {
- name string
- partnr int
- number int
- r rune // used for character by character test
- cols [cMaxColumns]string // Each has 5 entries, see below.
-}
-
-func (t Test) Name() string {
- if t.number < 0 {
- return part[t.partnr].name
- }
- return fmt.Sprintf("%s:%d", part[t.partnr].name, t.number)
-}
-
-var partRe = regexp.MustCompile(`@Part(\d) # (.*)$`)
-var testRe = regexp.MustCompile(`^` + strings.Repeat(`([\dA-F ]+);`, 5) + ` # (.*)$`)
-
-var counter int
-
-// Load the data form NormalizationTest.txt
-func loadTestData(t *testing.T) {
- f := gen.OpenUCDFile("NormalizationTest.txt")
- defer f.Close()
- scanner := bufio.NewScanner(f)
- for scanner.Scan() {
- line := scanner.Text()
- if len(line) == 0 || line[0] == '#' {
- continue
- }
- m := partRe.FindStringSubmatch(line)
- if m != nil {
- if len(m) < 3 {
- t.Fatal("Failed to parse Part: ", line)
- }
- i, err := strconv.Atoi(m[1])
- if err != nil {
- t.Fatal(err)
- }
- name := m[2]
- part = append(part, Part{name: name[:len(name)-1], number: i})
- continue
- }
- m = testRe.FindStringSubmatch(line)
- if m == nil || len(m) < 7 {
- t.Fatalf(`Failed to parse: "%s" result: %#v`, line, m)
- }
- test := Test{name: m[6], partnr: len(part) - 1, number: counter}
- counter++
- for j := 1; j < len(m)-1; j++ {
- for _, split := range strings.Split(m[j], " ") {
- r, err := strconv.ParseUint(split, 16, 64)
- if err != nil {
- t.Fatal(err)
- }
- if test.r == 0 {
- // save for CharacterByCharacterTests
- test.r = rune(r)
- }
- var buf [utf8.UTFMax]byte
- sz := utf8.EncodeRune(buf[:], rune(r))
- test.cols[j-1] += string(buf[:sz])
- }
- }
- part := &part[len(part)-1]
- part.tests = append(part.tests, test)
- }
- if scanner.Err() != nil {
- t.Fatal(scanner.Err())
- }
-}
-
-func cmpResult(t *testing.T, tc *Test, name string, f Form, gold, test, result string) {
- if gold != result {
- t.Errorf("%s:%s: %s(%+q)=%+q; want %+q: %s",
- tc.Name(), name, fstr[f], test, result, gold, tc.name)
- }
-}
-
-func cmpIsNormal(t *testing.T, tc *Test, name string, f Form, test string, result, want bool) {
- if result != want {
- t.Errorf("%s:%s: %s(%+q)=%v; want %v", tc.Name(), name, fstr[f], test, result, want)
- }
-}
-
-func doTest(t *testing.T, tc *Test, f Form, gold, test string) {
- testb := []byte(test)
- result := f.Bytes(testb)
- cmpResult(t, tc, "Bytes", f, gold, test, string(result))
-
- sresult := f.String(test)
- cmpResult(t, tc, "String", f, gold, test, sresult)
-
- acc := []byte{}
- i := Iter{}
- i.InitString(f, test)
- for !i.Done() {
- acc = append(acc, i.Next()...)
- }
- cmpResult(t, tc, "Iter.Next", f, gold, test, string(acc))
-
- buf := make([]byte, 128)
- acc = nil
- for p := 0; p < len(testb); {
- nDst, nSrc, _ := f.Transform(buf, testb[p:], true)
- acc = append(acc, buf[:nDst]...)
- p += nSrc
- }
- cmpResult(t, tc, "Transform", f, gold, test, string(acc))
-
- for i := range test {
- out := f.Append(f.Bytes([]byte(test[:i])), []byte(test[i:])...)
- cmpResult(t, tc, fmt.Sprintf(":Append:%d", i), f, gold, test, string(out))
- }
- cmpIsNormal(t, tc, "IsNormal", f, test, f.IsNormal([]byte(test)), test == gold)
- cmpIsNormal(t, tc, "IsNormalString", f, test, f.IsNormalString(test), test == gold)
-}
-
-func doConformanceTests(t *testing.T, tc *Test, partn int) {
- for i := 0; i <= 2; i++ {
- doTest(t, tc, NFC, tc.cols[1], tc.cols[i])
- doTest(t, tc, NFD, tc.cols[2], tc.cols[i])
- doTest(t, tc, NFKC, tc.cols[3], tc.cols[i])
- doTest(t, tc, NFKD, tc.cols[4], tc.cols[i])
- }
- for i := 3; i <= 4; i++ {
- doTest(t, tc, NFC, tc.cols[3], tc.cols[i])
- doTest(t, tc, NFD, tc.cols[4], tc.cols[i])
- doTest(t, tc, NFKC, tc.cols[3], tc.cols[i])
- doTest(t, tc, NFKD, tc.cols[4], tc.cols[i])
- }
-}
-
-func TestCharacterByCharacter(t *testing.T) {
- skipShort(t)
- tests := part[1].tests
- var last rune = 0
- for i := 0; i <= len(tests); i++ { // last one is special case
- var r rune
- if i == len(tests) {
- r = 0x2FA1E // Don't have to go to 0x10FFFF
- } else {
- r = tests[i].r
- }
- for last++; last < r; last++ {
- // Check all characters that were not explicitly listed in the test.
- tc := &Test{partnr: 1, number: -1}
- char := string(last)
- doTest(t, tc, NFC, char, char)
- doTest(t, tc, NFD, char, char)
- doTest(t, tc, NFKC, char, char)
- doTest(t, tc, NFKD, char, char)
- }
- if i < len(tests) {
- doConformanceTests(t, &tests[i], 1)
- }
- }
-}
-
-func TestStandardTests(t *testing.T) {
- skipShort(t)
- for _, j := range []int{0, 2, 3} {
- for _, test := range part[j].tests {
- doConformanceTests(t, &test, j)
- }
- }
-}
-
-// TestPerformance verifies that normalization is O(n). If any of the
-// code does not properly check for maxCombiningChars, normalization
-// may exhibit O(n**2) behavior.
-func TestPerformance(t *testing.T) {
- skipShort(t)
- runtime.GOMAXPROCS(2)
- success := make(chan bool, 1)
- go func() {
- buf := bytes.Repeat([]byte("\u035D"), 1024*1024)
- buf = append(buf, "\u035B"...)
- NFC.Append(nil, buf...)
- success <- true
- }()
- timeout := time.After(1 * time.Second)
- select {
- case <-success:
- // test completed before the timeout
- case <-timeout:
- t.Errorf(`unexpectedly long time to complete PerformanceTest`)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/merge_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/merge_test.go
deleted file mode 100644
index 93ed0fcadcf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/merge_test.go
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package rangetable
-
-import (
- "testing"
- "unicode"
-)
-
-var (
- maxRuneTable = &unicode.RangeTable{
- R32: []unicode.Range32{
- {unicode.MaxRune, unicode.MaxRune, 1},
- },
- }
-
- overlap1 = &unicode.RangeTable{
- R16: []unicode.Range16{
- {0x100, 0xfffc, 4},
- },
- R32: []unicode.Range32{
- {0x100000, 0x10fffc, 4},
- },
- }
-
- overlap2 = &unicode.RangeTable{
- R16: []unicode.Range16{
- {0x101, 0xfffd, 4},
- },
- R32: []unicode.Range32{
- {0x100001, 0x10fffd, 3},
- },
- }
-
- // The following table should be compacted into two entries for R16 and R32.
- optimize = &unicode.RangeTable{
- R16: []unicode.Range16{
- {0x1, 0x1, 1},
- {0x2, 0x2, 1},
- {0x3, 0x3, 1},
- {0x5, 0x5, 1},
- {0x7, 0x7, 1},
- {0x9, 0x9, 1},
- {0xb, 0xf, 2},
- },
- R32: []unicode.Range32{
- {0x10001, 0x10001, 1},
- {0x10002, 0x10002, 1},
- {0x10003, 0x10003, 1},
- {0x10005, 0x10005, 1},
- {0x10007, 0x10007, 1},
- {0x10009, 0x10009, 1},
- {0x1000b, 0x1000f, 2},
- },
- }
-)
-
-func TestMerge(t *testing.T) {
- for i, tt := range [][]*unicode.RangeTable{
- {unicode.Cc, unicode.Cf},
- {unicode.L, unicode.Ll},
- {unicode.L, unicode.Ll, unicode.Lu},
- {unicode.Ll, unicode.Lu},
- {unicode.M},
- unicode.GraphicRanges,
- cased,
-
- // Merge R16 only and R32 only and vice versa.
- {unicode.Khmer, unicode.Khudawadi},
- {unicode.Imperial_Aramaic, unicode.Radical},
-
- // Merge with empty.
- {&unicode.RangeTable{}},
- {&unicode.RangeTable{}, &unicode.RangeTable{}},
- {&unicode.RangeTable{}, &unicode.RangeTable{}, &unicode.RangeTable{}},
- {&unicode.RangeTable{}, unicode.Hiragana},
- {unicode.Inherited, &unicode.RangeTable{}},
- {&unicode.RangeTable{}, unicode.Hanunoo, &unicode.RangeTable{}},
-
- // Hypothetical tables.
- {maxRuneTable},
- {overlap1, overlap2},
-
- // Optimization
- {optimize},
- } {
- rt := Merge(tt...)
- for r := rune(0); r <= unicode.MaxRune; r++ {
- if got, want := unicode.Is(rt, r), unicode.In(r, tt...); got != want {
- t.Fatalf("%d:%U: got %v; want %v", i, r, got, want)
- }
- }
- // Test optimization and correctness for R16.
- for k := 0; k < len(rt.R16)-1; k++ {
- if lo, hi := rt.R16[k].Lo, rt.R16[k].Hi; lo > hi {
- t.Errorf("%d: Lo (%x) > Hi (%x)", i, lo, hi)
- }
- if hi, lo := rt.R16[k].Hi, rt.R16[k+1].Lo; hi >= lo {
- t.Errorf("%d: Hi (%x) >= next Lo (%x)", i, hi, lo)
- }
- if rt.R16[k].Hi+rt.R16[k].Stride == rt.R16[k+1].Lo {
- t.Errorf("%d: missed optimization for R16 at %d between %X and %x",
- i, k, rt.R16[k], rt.R16[k+1])
- }
- }
- // Test optimization and correctness for R32.
- for k := 0; k < len(rt.R32)-1; k++ {
- if lo, hi := rt.R32[k].Lo, rt.R32[k].Hi; lo > hi {
- t.Errorf("%d: Lo (%x) > Hi (%x)", i, lo, hi)
- }
- if hi, lo := rt.R32[k].Hi, rt.R32[k+1].Lo; hi >= lo {
- t.Errorf("%d: Hi (%x) >= next Lo (%x)", i, hi, lo)
- }
- if rt.R32[k].Hi+rt.R32[k].Stride == rt.R32[k+1].Lo {
- t.Errorf("%d: missed optimization for R32 at %d between %X and %X",
- i, k, rt.R32[k], rt.R32[k+1])
- }
- }
- }
-}
-
-const runes = "Hello World in 2015!,\U0010fffd"
-
-func BenchmarkNotMerged(t *testing.B) {
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.In(r, unicode.GraphicRanges...)
- }
- }
-}
-
-func BenchmarkMerged(t *testing.B) {
- rt := Merge(unicode.GraphicRanges...)
-
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.Is(rt, r)
- }
- }
-}
-
-var cased = []*unicode.RangeTable{
- unicode.Lower,
- unicode.Upper,
- unicode.Title,
- unicode.Other_Lowercase,
- unicode.Other_Uppercase,
-}
-
-func BenchmarkNotMergedCased(t *testing.B) {
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.In(r, cased...)
- }
- }
-}
-
-func BenchmarkMergedCased(t *testing.B) {
- // This reduces len(R16) from 243 to 82 and len(R32) from 65 to 35 for
- // Unicode 7.0.0.
- rt := Merge(cased...)
-
- for i := 0; i < t.N; i++ {
- for _, r := range runes {
- unicode.Is(rt, r)
- }
- }
-}
-
-func BenchmarkInit(t *testing.B) {
- for i := 0; i < t.N; i++ {
- Merge(cased...)
- Merge(unicode.GraphicRanges...)
- }
-}
-
-func BenchmarkInit2(t *testing.B) {
- // Hypothetical near-worst-case performance.
- for i := 0; i < t.N; i++ {
- Merge(overlap1, overlap2)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go
deleted file mode 100644
index 5a355aa3535..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package rangetable
-
-import (
- "reflect"
- "testing"
- "unicode"
-)
-
-var (
- empty = &unicode.RangeTable{}
- many = &unicode.RangeTable{
- R16: []unicode.Range16{{0, 0xffff, 5}},
- R32: []unicode.Range32{{0x10004, 0x10009, 5}},
- LatinOffset: 0,
- }
-)
-
-func TestVisit(t *testing.T) {
- Visit(empty, func(got rune) {
- t.Error("call from empty RangeTable")
- })
-
- var want rune
- Visit(many, func(got rune) {
- if got != want {
- t.Errorf("got %U; want %U", got, want)
- }
- want += 5
- })
- if want -= 5; want != 0x10009 {
- t.Errorf("last run was %U; want U+10009", want)
- }
-}
-
-func TestNew(t *testing.T) {
- for i, rt := range []*unicode.RangeTable{
- empty,
- unicode.Co,
- unicode.Letter,
- unicode.ASCII_Hex_Digit,
- many,
- maxRuneTable,
- } {
- var got, want []rune
- Visit(rt, func(r rune) {
- want = append(want, r)
- })
- Visit(New(want...), func(r rune) {
- got = append(got, r)
- })
- if !reflect.DeepEqual(got, want) {
- t.Errorf("%d:\ngot %v;\nwant %v", i, got, want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/example_test.go
deleted file mode 100644
index 3bb44fd3152..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/example_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package runenames_test
-
-import (
- "fmt"
-
- "golang.org/x/text/unicode/runenames"
-)
-
-func Example() {
- runes := []rune{
- -1,
- '\U00000000',
- '\U0000001f',
- '\U00000020',
- '\U00000021',
- '\U00000041',
- '\U0000007e',
- '\U0000007f',
- '\U00000080',
- '\U000000e0',
-
- '\U0000037f',
- '\U00000380',
- '\U00000381',
- '\U00000382',
- '\U00000383',
- '\U00000384',
- '\U00000385',
- '\U00000386',
- '\U000007c0',
-
- '\U00002603',
- '\U000033ff',
- '\U00003400',
- '\U00003401',
- '\U00003402',
- '\U00004dc0',
-
- '\U00009fd5',
- '\U00009fd6',
- '\U00009fff',
- '\U0000a000',
- 0xdc00, // '\U0000dc00' (Low Surrogate) is an invalid Go literal.
- '\U0000f800',
- '\U0000fffc',
- '\U0000fffd',
- '\U0000fffe',
- '\U0000ffff',
-
- '\U00010000',
- '\U0001f574',
- '\U0002fa1d',
- '\U0002fa1e',
- '\U000e0100',
- '\U000e01ef',
- '\U000e01f0',
- '\U00100000',
- '\U0010fffd',
- '\U0010fffe',
- '\U0010ffff',
- }
-
- for _, r := range runes {
- fmt.Printf("%08x %q\n", r, runenames.Name(r))
- }
-
- // Output:
- // -0000001 ""
- // 00000000 "<control>"
- // 0000001f "<control>"
- // 00000020 "SPACE"
- // 00000021 "EXCLAMATION MARK"
- // 00000041 "LATIN CAPITAL LETTER A"
- // 0000007e "TILDE"
- // 0000007f "<control>"
- // 00000080 "<control>"
- // 000000e0 "LATIN SMALL LETTER A WITH GRAVE"
- // 0000037f "GREEK CAPITAL LETTER YOT"
- // 00000380 ""
- // 00000381 ""
- // 00000382 ""
- // 00000383 ""
- // 00000384 "GREEK TONOS"
- // 00000385 "GREEK DIALYTIKA TONOS"
- // 00000386 "GREEK CAPITAL LETTER ALPHA WITH TONOS"
- // 000007c0 "NKO DIGIT ZERO"
- // 00002603 "SNOWMAN"
- // 000033ff "SQUARE GAL"
- // 00003400 "<CJK Ideograph Extension A>"
- // 00003401 "<CJK Ideograph Extension A>"
- // 00003402 "<CJK Ideograph Extension A>"
- // 00004dc0 "HEXAGRAM FOR THE CREATIVE HEAVEN"
- // 00009fd5 "<CJK Ideograph>"
- // 00009fd6 ""
- // 00009fff ""
- // 0000a000 "YI SYLLABLE IT"
- // 0000dc00 "<Low Surrogate>"
- // 0000f800 "<Private Use>"
- // 0000fffc "OBJECT REPLACEMENT CHARACTER"
- // 0000fffd "REPLACEMENT CHARACTER"
- // 0000fffe ""
- // 0000ffff ""
- // 00010000 "LINEAR B SYLLABLE B008 A"
- // 0001f574 "MAN IN BUSINESS SUIT LEVITATING"
- // 0002fa1d "CJK COMPATIBILITY IDEOGRAPH-2FA1D"
- // 0002fa1e ""
- // 000e0100 "VARIATION SELECTOR-17"
- // 000e01ef "VARIATION SELECTOR-256"
- // 000e01f0 ""
- // 00100000 "<Plane 16 Private Use>"
- // 0010fffd "<Plane 16 Private Use>"
- // 0010fffe ""
- // 0010ffff ""
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/runenames_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/runenames_test.go
deleted file mode 100644
index 6a2d2b6074f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/unicode/runenames/runenames_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package runenames
-
-import (
- "strings"
- "testing"
- "unicode"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/internal/ucd"
-)
-
-func TestName(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- wants := make([]string, 1+unicode.MaxRune)
- ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) {
- r, s := p.Rune(0), p.String(ucd.Name)
- if s == "" {
- return
- }
- if s[0] == '<' {
- const first = ", First>"
- if i := strings.Index(s, first); i >= 0 {
- s = s[:i] + ">"
- }
- }
- wants[r] = s
- })
-
- nErrors := 0
- for r, want := range wants {
- got := Name(rune(r))
- if got != want {
- t.Errorf("r=%#08x: got %q, want %q", r, got, want)
- nErrors++
- if nErrors == 100 {
- t.Fatal("too many errors")
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/common_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/common_test.go
deleted file mode 100644
index 9ebb782c025..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/common_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package width
-
-// This code is shared between the main code generator and the test code.
-
-import (
- "flag"
- "log"
- "strconv"
- "strings"
-
- "golang.org/x/text/internal/gen"
- "golang.org/x/text/internal/ucd"
-)
-
-var (
- outputFile = flag.String("out", "tables.go", "output file")
-)
-
-var typeMap = map[string]elem{
- "A": tagAmbiguous,
- "N": tagNeutral,
- "Na": tagNarrow,
- "W": tagWide,
- "F": tagFullwidth,
- "H": tagHalfwidth,
-}
-
-// getWidthData calls f for every entry for which it is defined.
-//
-// f may be called multiple times for the same rune. The last call to f is the
-// correct value. f is not called for all runes. The default tag type is
-// Neutral.
-func getWidthData(f func(r rune, tag elem, alt rune)) {
- // Set the default values for Unified Ideographs. In line with Annex 11,
- // we encode full ranges instead of the defined runes in Unified_Ideograph.
- for _, b := range []struct{ lo, hi rune }{
- {0x4E00, 0x9FFF}, // the CJK Unified Ideographs block,
- {0x3400, 0x4DBF}, // the CJK Unified Ideographs Externsion A block,
- {0xF900, 0xFAFF}, // the CJK Compatibility Ideographs block,
- {0x20000, 0x2FFFF}, // the Supplementary Ideographic Plane,
- {0x30000, 0x3FFFF}, // the Tertiary Ideographic Plane,
- } {
- for r := b.lo; r <= b.hi; r++ {
- f(r, tagWide, 0)
- }
- }
-
- inverse := map[rune]rune{}
- maps := map[string]bool{
- "<wide>": true,
- "<narrow>": true,
- }
-
- // We cannot reuse package norm's decomposition, as we need an unexpanded
- // decomposition. We make use of the opportunity to verify that the
- // decomposition type is as expected.
- ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) {
- r := p.Rune(0)
- s := strings.SplitN(p.String(ucd.DecompMapping), " ", 2)
- if !maps[s[0]] {
- return
- }
- x, err := strconv.ParseUint(s[1], 16, 32)
- if err != nil {
- log.Fatalf("Error parsing rune %q", s[1])
- }
- if inverse[r] != 0 || inverse[rune(x)] != 0 {
- log.Fatalf("Circular dependency in mapping between %U and %U", r, x)
- }
- inverse[r] = rune(x)
- inverse[rune(x)] = r
- })
-
- // <rune range>;<type>
- ucd.Parse(gen.OpenUCDFile("EastAsianWidth.txt"), func(p *ucd.Parser) {
- tag, ok := typeMap[p.String(1)]
- if !ok {
- log.Fatalf("Unknown width type %q", p.String(1))
- }
- r := p.Rune(0)
- alt, ok := inverse[r]
- if tag == tagFullwidth || tag == tagHalfwidth && r != wonSign {
- tag |= tagNeedsFold
- if !ok {
- log.Fatalf("Narrow or wide rune %U has no decomposition", r)
- }
- }
- f(r, tag, alt)
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/example_test.go
deleted file mode 100644
index 62adba6600d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/example_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package width_test
-
-import (
- "fmt"
-
- "golang.org/x/text/width"
-)
-
-func ExampleTransformer_fold() {
- s := "abヲ₩○¥A"
- f := width.Fold.String(s)
- fmt.Printf("%U: %s\n", []rune(s), s)
- fmt.Printf("%U: %s\n", []rune(f), f)
-
- // Output:
- // [U+0061 U+0062 U+FF66 U+FFE6 U+FFEE U+FFE5 U+FF21]: abヲ₩○¥A
- // [U+0061 U+0062 U+30F2 U+20A9 U+25CB U+00A5 U+0041]: abヲ₩○¥A
-}
-
-func ExampleTransformer_widen() {
- s := "ab¥ヲ₩○"
- w := width.Widen.String(s)
- fmt.Printf("%U: %s\n", []rune(s), s)
- fmt.Printf("%U: %s\n", []rune(w), w)
-
- // Output:
- // [U+0061 U+0062 U+00A5 U+FF66 U+20A9 U+FFEE]: ab¥ヲ₩○
- // [U+FF41 U+FF42 U+FFE5 U+30F2 U+FFE6 U+25CB]: ab¥ヲ₩○
-}
-
-func ExampleTransformer_narrow() {
- s := "abヲ₩○¥A"
- n := width.Narrow.String(s)
- fmt.Printf("%U: %s\n", []rune(s), s)
- fmt.Printf("%U: %s\n", []rune(n), n)
-
- // Ambiguous characters with a halfwidth equivalent get mapped as well.
- s = "←"
- n = width.Narrow.String(s)
- fmt.Printf("%U: %s\n", []rune(s), s)
- fmt.Printf("%U: %s\n", []rune(n), n)
-
- // Output:
- // [U+0061 U+0062 U+30F2 U+FFE6 U+25CB U+FFE5 U+FF21]: abヲ₩○¥A
- // [U+0061 U+0062 U+FF66 U+20A9 U+FFEE U+00A5 U+0041]: abヲ₩○¥A
- // [U+2190]: ←
- // [U+FFE9]: ←
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/runes_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/runes_test.go
deleted file mode 100644
index 587dab4ed44..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/runes_test.go
+++ /dev/null
@@ -1,461 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package width
-
-var mapRunes = map[rune]struct {
- r rune
- e elem
-}{
- 0x20: {0x3000, 0x6000},
- 0x21: {0xFF01, 0x6000},
- 0x22: {0xFF02, 0x6000},
- 0x23: {0xFF03, 0x6000},
- 0x24: {0xFF04, 0x6000},
- 0x25: {0xFF05, 0x6000},
- 0x26: {0xFF06, 0x6000},
- 0x27: {0xFF07, 0x6000},
- 0x28: {0xFF08, 0x6000},
- 0x29: {0xFF09, 0x6000},
- 0x2A: {0xFF0A, 0x6000},
- 0x2B: {0xFF0B, 0x6000},
- 0x2C: {0xFF0C, 0x6000},
- 0x2D: {0xFF0D, 0x6000},
- 0x2E: {0xFF0E, 0x6000},
- 0x2F: {0xFF0F, 0x6000},
- 0x30: {0xFF10, 0x6000},
- 0x31: {0xFF11, 0x6000},
- 0x32: {0xFF12, 0x6000},
- 0x33: {0xFF13, 0x6000},
- 0x34: {0xFF14, 0x6000},
- 0x35: {0xFF15, 0x6000},
- 0x36: {0xFF16, 0x6000},
- 0x37: {0xFF17, 0x6000},
- 0x38: {0xFF18, 0x6000},
- 0x39: {0xFF19, 0x6000},
- 0x3A: {0xFF1A, 0x6000},
- 0x3B: {0xFF1B, 0x6000},
- 0x3C: {0xFF1C, 0x6000},
- 0x3D: {0xFF1D, 0x6000},
- 0x3E: {0xFF1E, 0x6000},
- 0x3F: {0xFF1F, 0x6000},
- 0x40: {0xFF20, 0x6000},
- 0x41: {0xFF21, 0x6000},
- 0x42: {0xFF22, 0x6000},
- 0x43: {0xFF23, 0x6000},
- 0x44: {0xFF24, 0x6000},
- 0x45: {0xFF25, 0x6000},
- 0x46: {0xFF26, 0x6000},
- 0x47: {0xFF27, 0x6000},
- 0x48: {0xFF28, 0x6000},
- 0x49: {0xFF29, 0x6000},
- 0x4A: {0xFF2A, 0x6000},
- 0x4B: {0xFF2B, 0x6000},
- 0x4C: {0xFF2C, 0x6000},
- 0x4D: {0xFF2D, 0x6000},
- 0x4E: {0xFF2E, 0x6000},
- 0x4F: {0xFF2F, 0x6000},
- 0x50: {0xFF30, 0x6000},
- 0x51: {0xFF31, 0x6000},
- 0x52: {0xFF32, 0x6000},
- 0x53: {0xFF33, 0x6000},
- 0x54: {0xFF34, 0x6000},
- 0x55: {0xFF35, 0x6000},
- 0x56: {0xFF36, 0x6000},
- 0x57: {0xFF37, 0x6000},
- 0x58: {0xFF38, 0x6000},
- 0x59: {0xFF39, 0x6000},
- 0x5A: {0xFF3A, 0x6000},
- 0x5B: {0xFF3B, 0x6000},
- 0x5C: {0xFF3C, 0x6000},
- 0x5D: {0xFF3D, 0x6000},
- 0x5E: {0xFF3E, 0x6000},
- 0x5F: {0xFF3F, 0x6000},
- 0x60: {0xFF40, 0x6000},
- 0x61: {0xFF41, 0x6000},
- 0x62: {0xFF42, 0x6000},
- 0x63: {0xFF43, 0x6000},
- 0x64: {0xFF44, 0x6000},
- 0x65: {0xFF45, 0x6000},
- 0x66: {0xFF46, 0x6000},
- 0x67: {0xFF47, 0x6000},
- 0x68: {0xFF48, 0x6000},
- 0x69: {0xFF49, 0x6000},
- 0x6A: {0xFF4A, 0x6000},
- 0x6B: {0xFF4B, 0x6000},
- 0x6C: {0xFF4C, 0x6000},
- 0x6D: {0xFF4D, 0x6000},
- 0x6E: {0xFF4E, 0x6000},
- 0x6F: {0xFF4F, 0x6000},
- 0x70: {0xFF50, 0x6000},
- 0x71: {0xFF51, 0x6000},
- 0x72: {0xFF52, 0x6000},
- 0x73: {0xFF53, 0x6000},
- 0x74: {0xFF54, 0x6000},
- 0x75: {0xFF55, 0x6000},
- 0x76: {0xFF56, 0x6000},
- 0x77: {0xFF57, 0x6000},
- 0x78: {0xFF58, 0x6000},
- 0x79: {0xFF59, 0x6000},
- 0x7A: {0xFF5A, 0x6000},
- 0x7B: {0xFF5B, 0x6000},
- 0x7C: {0xFF5C, 0x6000},
- 0x7D: {0xFF5D, 0x6000},
- 0x7E: {0xFF5E, 0x6000},
- 0xA2: {0xFFE0, 0x6000},
- 0xA3: {0xFFE1, 0x6000},
- 0xA5: {0xFFE5, 0x6000},
- 0xA6: {0xFFE4, 0x6000},
- 0xAC: {0xFFE2, 0x6000},
- 0xAF: {0xFFE3, 0x6000},
- 0x20A9: {0xFFE6, 0xA000},
- 0x2190: {0xFFE9, 0x2000},
- 0x2191: {0xFFEA, 0x2000},
- 0x2192: {0xFFEB, 0x2000},
- 0x2193: {0xFFEC, 0x2000},
- 0x2502: {0xFFE8, 0x2000},
- 0x25A0: {0xFFED, 0x2000},
- 0x25CB: {0xFFEE, 0x2000},
- 0x2985: {0xFF5F, 0x6000},
- 0x2986: {0xFF60, 0x6000},
- 0x3000: {0x20, 0x9000},
- 0x3001: {0xFF64, 0x4000},
- 0x3002: {0xFF61, 0x4000},
- 0x300C: {0xFF62, 0x4000},
- 0x300D: {0xFF63, 0x4000},
- 0x3099: {0xFF9E, 0x4000},
- 0x309A: {0xFF9F, 0x4000},
- 0x30A1: {0xFF67, 0x4000},
- 0x30A2: {0xFF71, 0x4000},
- 0x30A3: {0xFF68, 0x4000},
- 0x30A4: {0xFF72, 0x4000},
- 0x30A5: {0xFF69, 0x4000},
- 0x30A6: {0xFF73, 0x4000},
- 0x30A7: {0xFF6A, 0x4000},
- 0x30A8: {0xFF74, 0x4000},
- 0x30A9: {0xFF6B, 0x4000},
- 0x30AA: {0xFF75, 0x4000},
- 0x30AB: {0xFF76, 0x4000},
- 0x30AD: {0xFF77, 0x4000},
- 0x30AF: {0xFF78, 0x4000},
- 0x30B1: {0xFF79, 0x4000},
- 0x30B3: {0xFF7A, 0x4000},
- 0x30B5: {0xFF7B, 0x4000},
- 0x30B7: {0xFF7C, 0x4000},
- 0x30B9: {0xFF7D, 0x4000},
- 0x30BB: {0xFF7E, 0x4000},
- 0x30BD: {0xFF7F, 0x4000},
- 0x30BF: {0xFF80, 0x4000},
- 0x30C1: {0xFF81, 0x4000},
- 0x30C3: {0xFF6F, 0x4000},
- 0x30C4: {0xFF82, 0x4000},
- 0x30C6: {0xFF83, 0x4000},
- 0x30C8: {0xFF84, 0x4000},
- 0x30CA: {0xFF85, 0x4000},
- 0x30CB: {0xFF86, 0x4000},
- 0x30CC: {0xFF87, 0x4000},
- 0x30CD: {0xFF88, 0x4000},
- 0x30CE: {0xFF89, 0x4000},
- 0x30CF: {0xFF8A, 0x4000},
- 0x30D2: {0xFF8B, 0x4000},
- 0x30D5: {0xFF8C, 0x4000},
- 0x30D8: {0xFF8D, 0x4000},
- 0x30DB: {0xFF8E, 0x4000},
- 0x30DE: {0xFF8F, 0x4000},
- 0x30DF: {0xFF90, 0x4000},
- 0x30E0: {0xFF91, 0x4000},
- 0x30E1: {0xFF92, 0x4000},
- 0x30E2: {0xFF93, 0x4000},
- 0x30E3: {0xFF6C, 0x4000},
- 0x30E4: {0xFF94, 0x4000},
- 0x30E5: {0xFF6D, 0x4000},
- 0x30E6: {0xFF95, 0x4000},
- 0x30E7: {0xFF6E, 0x4000},
- 0x30E8: {0xFF96, 0x4000},
- 0x30E9: {0xFF97, 0x4000},
- 0x30EA: {0xFF98, 0x4000},
- 0x30EB: {0xFF99, 0x4000},
- 0x30EC: {0xFF9A, 0x4000},
- 0x30ED: {0xFF9B, 0x4000},
- 0x30EF: {0xFF9C, 0x4000},
- 0x30F2: {0xFF66, 0x4000},
- 0x30F3: {0xFF9D, 0x4000},
- 0x30FB: {0xFF65, 0x4000},
- 0x30FC: {0xFF70, 0x4000},
- 0x3131: {0xFFA1, 0x4000},
- 0x3132: {0xFFA2, 0x4000},
- 0x3133: {0xFFA3, 0x4000},
- 0x3134: {0xFFA4, 0x4000},
- 0x3135: {0xFFA5, 0x4000},
- 0x3136: {0xFFA6, 0x4000},
- 0x3137: {0xFFA7, 0x4000},
- 0x3138: {0xFFA8, 0x4000},
- 0x3139: {0xFFA9, 0x4000},
- 0x313A: {0xFFAA, 0x4000},
- 0x313B: {0xFFAB, 0x4000},
- 0x313C: {0xFFAC, 0x4000},
- 0x313D: {0xFFAD, 0x4000},
- 0x313E: {0xFFAE, 0x4000},
- 0x313F: {0xFFAF, 0x4000},
- 0x3140: {0xFFB0, 0x4000},
- 0x3141: {0xFFB1, 0x4000},
- 0x3142: {0xFFB2, 0x4000},
- 0x3143: {0xFFB3, 0x4000},
- 0x3144: {0xFFB4, 0x4000},
- 0x3145: {0xFFB5, 0x4000},
- 0x3146: {0xFFB6, 0x4000},
- 0x3147: {0xFFB7, 0x4000},
- 0x3148: {0xFFB8, 0x4000},
- 0x3149: {0xFFB9, 0x4000},
- 0x314A: {0xFFBA, 0x4000},
- 0x314B: {0xFFBB, 0x4000},
- 0x314C: {0xFFBC, 0x4000},
- 0x314D: {0xFFBD, 0x4000},
- 0x314E: {0xFFBE, 0x4000},
- 0x314F: {0xFFC2, 0x4000},
- 0x3150: {0xFFC3, 0x4000},
- 0x3151: {0xFFC4, 0x4000},
- 0x3152: {0xFFC5, 0x4000},
- 0x3153: {0xFFC6, 0x4000},
- 0x3154: {0xFFC7, 0x4000},
- 0x3155: {0xFFCA, 0x4000},
- 0x3156: {0xFFCB, 0x4000},
- 0x3157: {0xFFCC, 0x4000},
- 0x3158: {0xFFCD, 0x4000},
- 0x3159: {0xFFCE, 0x4000},
- 0x315A: {0xFFCF, 0x4000},
- 0x315B: {0xFFD2, 0x4000},
- 0x315C: {0xFFD3, 0x4000},
- 0x315D: {0xFFD4, 0x4000},
- 0x315E: {0xFFD5, 0x4000},
- 0x315F: {0xFFD6, 0x4000},
- 0x3160: {0xFFD7, 0x4000},
- 0x3161: {0xFFDA, 0x4000},
- 0x3162: {0xFFDB, 0x4000},
- 0x3163: {0xFFDC, 0x4000},
- 0x3164: {0xFFA0, 0x4000},
- 0xFF01: {0x21, 0x9000},
- 0xFF02: {0x22, 0x9000},
- 0xFF03: {0x23, 0x9000},
- 0xFF04: {0x24, 0x9000},
- 0xFF05: {0x25, 0x9000},
- 0xFF06: {0x26, 0x9000},
- 0xFF07: {0x27, 0x9000},
- 0xFF08: {0x28, 0x9000},
- 0xFF09: {0x29, 0x9000},
- 0xFF0A: {0x2A, 0x9000},
- 0xFF0B: {0x2B, 0x9000},
- 0xFF0C: {0x2C, 0x9000},
- 0xFF0D: {0x2D, 0x9000},
- 0xFF0E: {0x2E, 0x9000},
- 0xFF0F: {0x2F, 0x9000},
- 0xFF10: {0x30, 0x9000},
- 0xFF11: {0x31, 0x9000},
- 0xFF12: {0x32, 0x9000},
- 0xFF13: {0x33, 0x9000},
- 0xFF14: {0x34, 0x9000},
- 0xFF15: {0x35, 0x9000},
- 0xFF16: {0x36, 0x9000},
- 0xFF17: {0x37, 0x9000},
- 0xFF18: {0x38, 0x9000},
- 0xFF19: {0x39, 0x9000},
- 0xFF1A: {0x3A, 0x9000},
- 0xFF1B: {0x3B, 0x9000},
- 0xFF1C: {0x3C, 0x9000},
- 0xFF1D: {0x3D, 0x9000},
- 0xFF1E: {0x3E, 0x9000},
- 0xFF1F: {0x3F, 0x9000},
- 0xFF20: {0x40, 0x9000},
- 0xFF21: {0x41, 0x9000},
- 0xFF22: {0x42, 0x9000},
- 0xFF23: {0x43, 0x9000},
- 0xFF24: {0x44, 0x9000},
- 0xFF25: {0x45, 0x9000},
- 0xFF26: {0x46, 0x9000},
- 0xFF27: {0x47, 0x9000},
- 0xFF28: {0x48, 0x9000},
- 0xFF29: {0x49, 0x9000},
- 0xFF2A: {0x4A, 0x9000},
- 0xFF2B: {0x4B, 0x9000},
- 0xFF2C: {0x4C, 0x9000},
- 0xFF2D: {0x4D, 0x9000},
- 0xFF2E: {0x4E, 0x9000},
- 0xFF2F: {0x4F, 0x9000},
- 0xFF30: {0x50, 0x9000},
- 0xFF31: {0x51, 0x9000},
- 0xFF32: {0x52, 0x9000},
- 0xFF33: {0x53, 0x9000},
- 0xFF34: {0x54, 0x9000},
- 0xFF35: {0x55, 0x9000},
- 0xFF36: {0x56, 0x9000},
- 0xFF37: {0x57, 0x9000},
- 0xFF38: {0x58, 0x9000},
- 0xFF39: {0x59, 0x9000},
- 0xFF3A: {0x5A, 0x9000},
- 0xFF3B: {0x5B, 0x9000},
- 0xFF3C: {0x5C, 0x9000},
- 0xFF3D: {0x5D, 0x9000},
- 0xFF3E: {0x5E, 0x9000},
- 0xFF3F: {0x5F, 0x9000},
- 0xFF40: {0x60, 0x9000},
- 0xFF41: {0x61, 0x9000},
- 0xFF42: {0x62, 0x9000},
- 0xFF43: {0x63, 0x9000},
- 0xFF44: {0x64, 0x9000},
- 0xFF45: {0x65, 0x9000},
- 0xFF46: {0x66, 0x9000},
- 0xFF47: {0x67, 0x9000},
- 0xFF48: {0x68, 0x9000},
- 0xFF49: {0x69, 0x9000},
- 0xFF4A: {0x6A, 0x9000},
- 0xFF4B: {0x6B, 0x9000},
- 0xFF4C: {0x6C, 0x9000},
- 0xFF4D: {0x6D, 0x9000},
- 0xFF4E: {0x6E, 0x9000},
- 0xFF4F: {0x6F, 0x9000},
- 0xFF50: {0x70, 0x9000},
- 0xFF51: {0x71, 0x9000},
- 0xFF52: {0x72, 0x9000},
- 0xFF53: {0x73, 0x9000},
- 0xFF54: {0x74, 0x9000},
- 0xFF55: {0x75, 0x9000},
- 0xFF56: {0x76, 0x9000},
- 0xFF57: {0x77, 0x9000},
- 0xFF58: {0x78, 0x9000},
- 0xFF59: {0x79, 0x9000},
- 0xFF5A: {0x7A, 0x9000},
- 0xFF5B: {0x7B, 0x9000},
- 0xFF5C: {0x7C, 0x9000},
- 0xFF5D: {0x7D, 0x9000},
- 0xFF5E: {0x7E, 0x9000},
- 0xFF5F: {0x2985, 0x9000},
- 0xFF60: {0x2986, 0x9000},
- 0xFF61: {0x3002, 0xB000},
- 0xFF62: {0x300C, 0xB000},
- 0xFF63: {0x300D, 0xB000},
- 0xFF64: {0x3001, 0xB000},
- 0xFF65: {0x30FB, 0xB000},
- 0xFF66: {0x30F2, 0xB000},
- 0xFF67: {0x30A1, 0xB000},
- 0xFF68: {0x30A3, 0xB000},
- 0xFF69: {0x30A5, 0xB000},
- 0xFF6A: {0x30A7, 0xB000},
- 0xFF6B: {0x30A9, 0xB000},
- 0xFF6C: {0x30E3, 0xB000},
- 0xFF6D: {0x30E5, 0xB000},
- 0xFF6E: {0x30E7, 0xB000},
- 0xFF6F: {0x30C3, 0xB000},
- 0xFF70: {0x30FC, 0xB000},
- 0xFF71: {0x30A2, 0xB000},
- 0xFF72: {0x30A4, 0xB000},
- 0xFF73: {0x30A6, 0xB000},
- 0xFF74: {0x30A8, 0xB000},
- 0xFF75: {0x30AA, 0xB000},
- 0xFF76: {0x30AB, 0xB000},
- 0xFF77: {0x30AD, 0xB000},
- 0xFF78: {0x30AF, 0xB000},
- 0xFF79: {0x30B1, 0xB000},
- 0xFF7A: {0x30B3, 0xB000},
- 0xFF7B: {0x30B5, 0xB000},
- 0xFF7C: {0x30B7, 0xB000},
- 0xFF7D: {0x30B9, 0xB000},
- 0xFF7E: {0x30BB, 0xB000},
- 0xFF7F: {0x30BD, 0xB000},
- 0xFF80: {0x30BF, 0xB000},
- 0xFF81: {0x30C1, 0xB000},
- 0xFF82: {0x30C4, 0xB000},
- 0xFF83: {0x30C6, 0xB000},
- 0xFF84: {0x30C8, 0xB000},
- 0xFF85: {0x30CA, 0xB000},
- 0xFF86: {0x30CB, 0xB000},
- 0xFF87: {0x30CC, 0xB000},
- 0xFF88: {0x30CD, 0xB000},
- 0xFF89: {0x30CE, 0xB000},
- 0xFF8A: {0x30CF, 0xB000},
- 0xFF8B: {0x30D2, 0xB000},
- 0xFF8C: {0x30D5, 0xB000},
- 0xFF8D: {0x30D8, 0xB000},
- 0xFF8E: {0x30DB, 0xB000},
- 0xFF8F: {0x30DE, 0xB000},
- 0xFF90: {0x30DF, 0xB000},
- 0xFF91: {0x30E0, 0xB000},
- 0xFF92: {0x30E1, 0xB000},
- 0xFF93: {0x30E2, 0xB000},
- 0xFF94: {0x30E4, 0xB000},
- 0xFF95: {0x30E6, 0xB000},
- 0xFF96: {0x30E8, 0xB000},
- 0xFF97: {0x30E9, 0xB000},
- 0xFF98: {0x30EA, 0xB000},
- 0xFF99: {0x30EB, 0xB000},
- 0xFF9A: {0x30EC, 0xB000},
- 0xFF9B: {0x30ED, 0xB000},
- 0xFF9C: {0x30EF, 0xB000},
- 0xFF9D: {0x30F3, 0xB000},
- 0xFF9E: {0x3099, 0xB000},
- 0xFF9F: {0x309A, 0xB000},
- 0xFFA0: {0x3164, 0xB000},
- 0xFFA1: {0x3131, 0xB000},
- 0xFFA2: {0x3132, 0xB000},
- 0xFFA3: {0x3133, 0xB000},
- 0xFFA4: {0x3134, 0xB000},
- 0xFFA5: {0x3135, 0xB000},
- 0xFFA6: {0x3136, 0xB000},
- 0xFFA7: {0x3137, 0xB000},
- 0xFFA8: {0x3138, 0xB000},
- 0xFFA9: {0x3139, 0xB000},
- 0xFFAA: {0x313A, 0xB000},
- 0xFFAB: {0x313B, 0xB000},
- 0xFFAC: {0x313C, 0xB000},
- 0xFFAD: {0x313D, 0xB000},
- 0xFFAE: {0x313E, 0xB000},
- 0xFFAF: {0x313F, 0xB000},
- 0xFFB0: {0x3140, 0xB000},
- 0xFFB1: {0x3141, 0xB000},
- 0xFFB2: {0x3142, 0xB000},
- 0xFFB3: {0x3143, 0xB000},
- 0xFFB4: {0x3144, 0xB000},
- 0xFFB5: {0x3145, 0xB000},
- 0xFFB6: {0x3146, 0xB000},
- 0xFFB7: {0x3147, 0xB000},
- 0xFFB8: {0x3148, 0xB000},
- 0xFFB9: {0x3149, 0xB000},
- 0xFFBA: {0x314A, 0xB000},
- 0xFFBB: {0x314B, 0xB000},
- 0xFFBC: {0x314C, 0xB000},
- 0xFFBD: {0x314D, 0xB000},
- 0xFFBE: {0x314E, 0xB000},
- 0xFFC2: {0x314F, 0xB000},
- 0xFFC3: {0x3150, 0xB000},
- 0xFFC4: {0x3151, 0xB000},
- 0xFFC5: {0x3152, 0xB000},
- 0xFFC6: {0x3153, 0xB000},
- 0xFFC7: {0x3154, 0xB000},
- 0xFFCA: {0x3155, 0xB000},
- 0xFFCB: {0x3156, 0xB000},
- 0xFFCC: {0x3157, 0xB000},
- 0xFFCD: {0x3158, 0xB000},
- 0xFFCE: {0x3159, 0xB000},
- 0xFFCF: {0x315A, 0xB000},
- 0xFFD2: {0x315B, 0xB000},
- 0xFFD3: {0x315C, 0xB000},
- 0xFFD4: {0x315D, 0xB000},
- 0xFFD5: {0x315E, 0xB000},
- 0xFFD6: {0x315F, 0xB000},
- 0xFFD7: {0x3160, 0xB000},
- 0xFFDA: {0x3161, 0xB000},
- 0xFFDB: {0x3162, 0xB000},
- 0xFFDC: {0x3163, 0xB000},
- 0xFFE0: {0xA2, 0x9000},
- 0xFFE1: {0xA3, 0x9000},
- 0xFFE2: {0xAC, 0x9000},
- 0xFFE3: {0xAF, 0x9000},
- 0xFFE4: {0xA6, 0x9000},
- 0xFFE5: {0xA5, 0x9000},
- 0xFFE6: {0x20A9, 0x9000},
- 0xFFE8: {0x2502, 0xB000},
- 0xFFE9: {0x2190, 0xB000},
- 0xFFEA: {0x2191, 0xB000},
- 0xFFEB: {0x2192, 0xB000},
- 0xFFEC: {0x2193, 0xB000},
- 0xFFED: {0x25A0, 0xB000},
- 0xFFEE: {0x25CB, 0xB000},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/tables_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/tables_test.go
deleted file mode 100644
index 189febd3cb6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/tables_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package width
-
-import (
- "testing"
-
- "golang.org/x/text/internal/testtext"
-)
-
-const (
- loSurrogate = 0xD800
- hiSurrogate = 0xDFFF
-)
-
-func TestTables(t *testing.T) {
- testtext.SkipIfNotLong(t)
-
- runes := map[rune]Kind{}
- getWidthData(func(r rune, tag elem, _ rune) {
- runes[r] = tag.kind()
- })
- for r := rune(0); r < 0x10FFFF; r++ {
- if loSurrogate <= r && r <= hiSurrogate {
- continue
- }
- p := LookupRune(r)
- if got, want := p.Kind(), runes[r]; got != want {
- t.Errorf("Kind of %U was %s; want %s.", r, got, want)
- }
- want, mapped := foldRune(r)
- if got := p.Folded(); (got == 0) == mapped || got != 0 && got != want {
- t.Errorf("Folded(%U) = %U; want %U", r, got, want)
- }
- want, mapped = widenRune(r)
- if got := p.Wide(); (got == 0) == mapped || got != 0 && got != want {
- t.Errorf("Wide(%U) = %U; want %U", r, got, want)
- }
- want, mapped = narrowRune(r)
- if got := p.Narrow(); (got == 0) == mapped || got != 0 && got != want {
- t.Errorf("Narrow(%U) = %U; want %U", r, got, want)
- }
- }
-}
-
-// TestAmbiguous verifies that that ambiguous runes with a mapping always map to
-// a halfwidth rune.
-func TestAmbiguous(t *testing.T) {
- for r, m := range mapRunes {
- if m.e != tagAmbiguous {
- continue
- }
- if k := mapRunes[m.r].e.kind(); k != EastAsianHalfwidth {
- t.Errorf("Rune %U is ambiguous and maps to a rune of type %v", r, k)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/transform_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/transform_test.go
deleted file mode 100644
index f9122d6db01..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/golang.org/x/text/width/transform_test.go
+++ /dev/null
@@ -1,701 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package width
-
-import (
- "bytes"
- "strings"
- "testing"
-
- "golang.org/x/text/internal/testtext"
- "golang.org/x/text/transform"
-)
-
-func foldRune(r rune) (folded rune, ok bool) {
- alt, ok := mapRunes[r]
- if ok && alt.e&tagNeedsFold != 0 {
- return alt.r, true
- }
- return r, false
-}
-
-func widenRune(r rune) (wide rune, ok bool) {
- alt, ok := mapRunes[r]
- if k := alt.e.kind(); k == EastAsianHalfwidth || k == EastAsianNarrow {
- return alt.r, true
- }
- return r, false
-}
-
-func narrowRune(r rune) (narrow rune, ok bool) {
- alt, ok := mapRunes[r]
- if k := alt.e.kind(); k == EastAsianFullwidth || k == EastAsianWide || k == EastAsianAmbiguous {
- return alt.r, true
- }
- return r, false
-}
-
-func TestFoldSingleRunes(t *testing.T) {
- for r := rune(0); r < 0x1FFFF; r++ {
- if loSurrogate <= r && r <= hiSurrogate {
- continue
- }
- x, _ := foldRune(r)
- want := string(x)
- got := Fold.String(string(r))
- if got != want {
- t.Errorf("Fold().String(%U) = %+q; want %+q", r, got, want)
- }
- }
-}
-
-type transformTest struct {
- desc string
- src string
- nBuf int
- nDst int
- atEOF bool
- dst string
- nSrc int
- err error
- nSpan int
- errSpan error
-}
-
-func (tc *transformTest) doTest(t *testing.T, tr Transformer) {
- testtext.Run(t, tc.desc, func(t *testing.T) {
- b := make([]byte, tc.nBuf)
- nDst, nSrc, err := tr.Transform(b, []byte(tc.src), tc.atEOF)
- if got := string(b[:nDst]); got != tc.dst[:nDst] {
- t.Errorf("dst was %+q; want %+q", got, tc.dst)
- }
- if nDst != tc.nDst {
- t.Errorf("nDst was %d; want %d", nDst, tc.nDst)
- }
- if nSrc != tc.nSrc {
- t.Errorf("nSrc was %d; want %d", nSrc, tc.nSrc)
- }
- if err != tc.err {
- t.Errorf("error was %v; want %v", err, tc.err)
- }
- if got := tr.String(tc.src); got != tc.dst {
- t.Errorf("String(%q) = %q; want %q", tc.src, got, tc.dst)
- }
- n, err := tr.Span([]byte(tc.src), tc.atEOF)
- if n != tc.nSpan || err != tc.errSpan {
- t.Errorf("Span: got %d, %v; want %d, %v", n, err, tc.nSpan, tc.errSpan)
- }
- })
-}
-
-func TestFold(t *testing.T) {
- for _, tc := range []transformTest{{
- desc: "empty",
- src: "",
- nBuf: 10,
- dst: "",
- nDst: 0,
- nSrc: 0,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: nil,
- }, {
- desc: "short source 1",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 1,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 1,
- errSpan: transform.ErrShortSrc,
- }, {
- desc: "short source 2",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 1,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 1,
- errSpan: transform.ErrShortSrc,
- }, {
- desc: "incomplete but terminated source 1",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 2,
- nSrc: 2,
- atEOF: true,
- err: nil,
- nSpan: 2,
- errSpan: nil,
- }, {
- desc: "incomplete but terminated source 2",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 3,
- nSrc: 3,
- atEOF: true,
- err: nil,
- nSpan: 3,
- errSpan: nil,
- }, {
- desc: "exact fit dst",
- src: "a\uff01",
- nBuf: 2,
- dst: "a!",
- nDst: 2,
- nSrc: 4,
- atEOF: false,
- err: nil,
- nSpan: 1,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "exact fit dst and src ascii",
- src: "ab",
- nBuf: 2,
- dst: "ab",
- nDst: 2,
- nSrc: 2,
- atEOF: true,
- err: nil,
- nSpan: 2,
- errSpan: nil,
- }, {
- desc: "empty dst",
- src: "\u0300",
- nBuf: 0,
- dst: "\u0300",
- nDst: 0,
- nSrc: 0,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 2,
- errSpan: nil,
- }, {
- desc: "empty dst ascii",
- src: "a",
- nBuf: 0,
- dst: "a",
- nDst: 0,
- nSrc: 0,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 1,
- errSpan: nil,
- }, {
- desc: "short dst 1",
- src: "a\uffe0", // ¢
- nBuf: 2,
- dst: "a\u00a2", // ¢
- nDst: 1,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortDst,
- nSpan: 1,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short dst 2",
- src: "不夠",
- nBuf: 3,
- dst: "不夠",
- nDst: 3,
- nSrc: 3,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 6,
- errSpan: nil,
- }, {
- desc: "short dst fast path",
- src: "fast",
- nDst: 3,
- dst: "fast",
- nBuf: 3,
- nSrc: 3,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 4,
- errSpan: nil,
- }, {
- desc: "short dst larger buffer",
- src: "\uff21" + strings.Repeat("0", 127) + "B",
- nBuf: 128,
- dst: "A" + strings.Repeat("0", 127) + "B",
- nDst: 128,
- nSrc: 130,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "fast path alternation",
- src: "fast路徑fast路徑",
- nBuf: 20,
- dst: "fast路徑fast路徑",
- nDst: 20,
- nSrc: 20,
- atEOF: true,
- err: nil,
- nSpan: 20,
- errSpan: nil,
- }} {
- tc.doTest(t, Fold)
- }
-}
-
-func TestWidenSingleRunes(t *testing.T) {
- for r := rune(0); r < 0x1FFFF; r++ {
- if loSurrogate <= r && r <= hiSurrogate {
- continue
- }
- alt, _ := widenRune(r)
- want := string(alt)
- got := Widen.String(string(r))
- if got != want {
- t.Errorf("Widen().String(%U) = %+q; want %+q", r, got, want)
- }
- }
-}
-
-func TestWiden(t *testing.T) {
- for _, tc := range []transformTest{{
- desc: "empty",
- src: "",
- nBuf: 10,
- dst: "",
- nDst: 0,
- nSrc: 0,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: nil,
- }, {
- desc: "short source 1",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 3,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short source 2",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 3,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "incomplete but terminated source 1",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 4,
- nSrc: 2,
- atEOF: true,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "incomplete but terminated source 2",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 5,
- nSrc: 3,
- atEOF: true,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short source 1 some span",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 3,
- nSrc: 3,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 3,
- errSpan: transform.ErrShortSrc,
- }, {
- desc: "short source 2 some span",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 3,
- nSrc: 3,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 3,
- errSpan: transform.ErrShortSrc,
- }, {
- desc: "incomplete but terminated source 1 some span",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 4,
- nSrc: 4,
- atEOF: true,
- err: nil,
- nSpan: 4,
- errSpan: nil,
- }, {
- desc: "incomplete but terminated source 2 some span",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 5,
- nSrc: 5,
- atEOF: true,
- err: nil,
- nSpan: 5,
- errSpan: nil,
- }, {
- desc: "exact fit dst",
- src: "a!",
- nBuf: 6,
- dst: "a\uff01",
- nDst: 6,
- nSrc: 2,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "empty dst",
- src: "\u0300",
- nBuf: 0,
- dst: "\u0300",
- nDst: 0,
- nSrc: 0,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 2,
- errSpan: nil,
- }, {
- desc: "empty dst ascii",
- src: "a",
- nBuf: 0,
- dst: "a",
- nDst: 0,
- nSrc: 0,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short dst 1",
- src: "a\uffe0",
- nBuf: 4,
- dst: "a\uffe0",
- nDst: 3,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortDst,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short dst 2",
- src: "不夠",
- nBuf: 3,
- dst: "不夠",
- nDst: 3,
- nSrc: 3,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 6,
- errSpan: nil,
- }, {
- desc: "short dst ascii",
- src: "ascii",
- nBuf: 3,
- dst: "ascii", // U+ff41, ...
- nDst: 3,
- nSrc: 1,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "ambiguous",
- src: "\uffe9",
- nBuf: 4,
- dst: "\u2190",
- nDst: 3,
- nSrc: 3,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }} {
- tc.doTest(t, Widen)
- }
-}
-
-func TestNarrowSingleRunes(t *testing.T) {
- for r := rune(0); r < 0x1FFFF; r++ {
- if loSurrogate <= r && r <= hiSurrogate {
- continue
- }
- alt, _ := narrowRune(r)
- want := string(alt)
- got := Narrow.String(string(r))
- if got != want {
- t.Errorf("Narrow().String(%U) = %+q; want %+q", r, got, want)
- }
- }
-}
-
-func TestNarrow(t *testing.T) {
- for _, tc := range []transformTest{{
- desc: "empty",
- src: "",
- nBuf: 10,
- dst: "",
- nDst: 0,
- nSrc: 0,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: nil,
- }, {
- desc: "short source 1",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 1,
- nSrc: 1,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 1,
- errSpan: transform.ErrShortSrc,
- }, {
- desc: "short source 2",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 1,
- nSrc: 3,
- atEOF: false,
- err: transform.ErrShortSrc,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "incomplete but terminated source 1",
- src: "a\xc2",
- nBuf: 10,
- dst: "a\xc2",
- nDst: 2,
- nSrc: 4,
- atEOF: true,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "incomplete but terminated source 2",
- src: "a\xe0\x80",
- nBuf: 10,
- dst: "a\xe0\x80",
- nDst: 3,
- nSrc: 5,
- atEOF: true,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "exact fit dst",
- src: "a\uff01",
- nBuf: 2,
- dst: "a!",
- nDst: 2,
- nSrc: 6,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "exact fit dst some span",
- src: "a\uff01",
- nBuf: 2,
- dst: "a!",
- nDst: 2,
- nSrc: 4,
- atEOF: false,
- err: nil,
- nSpan: 1,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "empty dst",
- src: "\u0300",
- nBuf: 0,
- dst: "\u0300",
- nDst: 0,
- nSrc: 0,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 2,
- errSpan: nil,
- }, {
- desc: "empty dst ascii",
- src: "a",
- nBuf: 0,
- dst: "a",
- nDst: 0,
- nSrc: 0,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 1,
- errSpan: nil,
- }, {
- desc: "short dst 1",
- src: "a\uffe0", // ¢
- nBuf: 2,
- dst: "a\u00a2", // ¢
- nDst: 1,
- nSrc: 3,
- atEOF: false,
- err: transform.ErrShortDst,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short dst 2",
- src: "不夠",
- nBuf: 3,
- dst: "不夠",
- nDst: 3,
- nSrc: 3,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 6,
- errSpan: nil,
- }, {
- // Create a narrow variant of ambiguous runes, if they exist.
- desc: "ambiguous",
- src: "\u2190",
- nBuf: 4,
- dst: "\uffe9",
- nDst: 3,
- nSrc: 3,
- atEOF: false,
- err: nil,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "short dst fast path",
- src: "fast",
- nBuf: 3,
- dst: "fast",
- nDst: 3,
- nSrc: 3,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 4,
- errSpan: nil,
- }, {
- desc: "short dst larger buffer",
- src: "\uff21" + strings.Repeat("0", 127) + "B",
- nBuf: 128,
- dst: "A" + strings.Repeat("0", 127) + "B",
- nDst: 128,
- nSrc: 130,
- atEOF: true,
- err: transform.ErrShortDst,
- nSpan: 0,
- errSpan: transform.ErrEndOfSpan,
- }, {
- desc: "fast path alternation",
- src: "fast路徑fast路徑",
- nBuf: 20,
- dst: "fast路徑fast路徑",
- nDst: 20,
- nSrc: 20,
- atEOF: true,
- err: nil,
- nSpan: 20,
- errSpan: nil,
- }} {
- tc.doTest(t, Narrow)
- }
-}
-
-func bench(b *testing.B, t Transformer, s string) {
- dst := make([]byte, 1024)
- src := []byte(s)
- b.SetBytes(int64(len(src)))
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- t.Transform(dst, src, true)
- }
-}
-
-func changingRunes(f func(r rune) (rune, bool)) string {
- buf := &bytes.Buffer{}
- for r := rune(0); r <= 0xFFFF; r++ {
- if _, ok := foldRune(r); ok {
- buf.WriteRune(r)
- }
- }
- return buf.String()
-}
-
-func BenchmarkFoldASCII(b *testing.B) {
- bench(b, Fold, testtext.ASCII)
-}
-
-func BenchmarkFoldCJK(b *testing.B) {
- bench(b, Fold, testtext.CJK)
-}
-
-func BenchmarkFoldNonCanonical(b *testing.B) {
- bench(b, Fold, changingRunes(foldRune))
-}
-
-func BenchmarkFoldOther(b *testing.B) {
- bench(b, Fold, testtext.TwoByteUTF8+testtext.ThreeByteUTF8)
-}
-
-func BenchmarkWideASCII(b *testing.B) {
- bench(b, Widen, testtext.ASCII)
-}
-
-func BenchmarkWideCJK(b *testing.B) {
- bench(b, Widen, testtext.CJK)
-}
-
-func BenchmarkWideNonCanonical(b *testing.B) {
- bench(b, Widen, changingRunes(widenRune))
-}
-
-func BenchmarkWideOther(b *testing.B) {
- bench(b, Widen, testtext.TwoByteUTF8+testtext.ThreeByteUTF8)
-}
-
-func BenchmarkNarrowASCII(b *testing.B) {
- bench(b, Narrow, testtext.ASCII)
-}
-
-func BenchmarkNarrowCJK(b *testing.B) {
- bench(b, Narrow, testtext.CJK)
-}
-
-func BenchmarkNarrowNonCanonical(b *testing.B) {
- bench(b, Narrow, changingRunes(narrowRune))
-}
-
-func BenchmarkNarrowOther(b *testing.B) {
- bench(b, Narrow, testtext.TwoByteUTF8+testtext.ThreeByteUTF8)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/.travis.yml b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/.travis.yml
index ec2b9fc837e..89060992b2b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/.travis.yml
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/.travis.yml
@@ -40,7 +40,7 @@ before_script:
script:
- (cd bson && go test -check.v)
- - go test -check.v -fast
+ - go test -check.v -fast -cursor-timeout
- (cd txn && go test -check.v)
# vim:sw=4:ts=4:et
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/auth_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/auth_test.go
deleted file mode 100644
index 60908a8a58d..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/auth_test.go
+++ /dev/null
@@ -1,1294 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo_test
-
-import (
- "crypto/tls"
- "flag"
- "fmt"
- "io/ioutil"
- "net"
- "net/url"
- "os"
- "runtime"
- "sync"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
-)
-
-func (s *S) TestAuthLoginDatabase(c *C) {
- // Test both with a normal database and with an authenticated shard.
- for _, addr := range []string{"localhost:40002", "localhost:40203"} {
- session, err := mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- admindb := session.DB("admin")
-
- err = admindb.Login("root", "wrong")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
- }
-}
-
-func (s *S) TestAuthLoginSession(c *C) {
- // Test both with a normal database and with an authenticated shard.
- for _, addr := range []string{"localhost:40002", "localhost:40203"} {
- session, err := mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- cred := mgo.Credential{
- Username: "root",
- Password: "wrong",
- }
- err = session.Login(&cred)
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-
- cred.Password = "rapadura"
-
- err = session.Login(&cred)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
- }
-}
-
-func (s *S) TestAuthLoginLogout(c *C) {
- // Test both with a normal database and with an authenticated shard.
- for _, addr := range []string{"localhost:40002", "localhost:40203"} {
- session, err := mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- // Must have dropped auth from the session too.
- session = session.Copy()
- defer session.Close()
-
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
- }
-}
-
-func (s *S) TestAuthLoginLogoutAll(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session.LogoutAll()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-
- // Must have dropped auth from the session too.
- session = session.Copy()
- defer session.Close()
-
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-}
-
-func (s *S) TestAuthUpsertUserErrors(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
-
- err = mydb.UpsertUser(&mgo.User{})
- c.Assert(err, ErrorMatches, "user has no Username")
-
- err = mydb.UpsertUser(&mgo.User{Username: "user", Password: "pass", UserSource: "source"})
- c.Assert(err, ErrorMatches, "user has both Password/PasswordHash and UserSource set")
-
- err = mydb.UpsertUser(&mgo.User{Username: "user", Password: "pass", OtherDBRoles: map[string][]mgo.Role{"db": nil}})
- c.Assert(err, ErrorMatches, "user with OtherDBRoles is only supported in the admin or \\$external databases")
-}
-
-func (s *S) TestAuthUpsertUser(c *C) {
- if !s.versionAtLeast(2, 4) {
- c.Skip("UpsertUser only works on 2.4+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
-
- ruser := &mgo.User{
- Username: "myruser",
- Password: "mypass",
- Roles: []mgo.Role{mgo.RoleRead},
- }
- rwuser := &mgo.User{
- Username: "myrwuser",
- Password: "mypass",
- Roles: []mgo.Role{mgo.RoleReadWrite},
- }
-
- err = mydb.UpsertUser(ruser)
- c.Assert(err, IsNil)
- err = mydb.UpsertUser(rwuser)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myruser", "mypass")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- err = mydb.Login("myrwuser", "mypass")
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- myotherdb := session.DB("myotherdb")
-
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- // Test UserSource.
- rwuserother := &mgo.User{
- Username: "myrwuser",
- UserSource: "mydb",
- Roles: []mgo.Role{mgo.RoleRead},
- }
-
- err = myotherdb.UpsertUser(rwuserother)
- if s.versionAtLeast(2, 6) {
- c.Assert(err, ErrorMatches, `MongoDB 2.6\+ does not support the UserSource setting`)
- return
- }
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- // Test indirection via UserSource: we can't write to it, because
- // the roles for myrwuser are different there.
- othercoll := myotherdb.C("myothercoll")
- err = othercoll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // Reading works, though.
- err = othercoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- // Can't login directly into the database using UserSource, though.
- err = myotherdb.Login("myrwuser", "mypass")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
-}
-
-func (s *S) TestAuthUpsertUserOtherDBRoles(c *C) {
- if !s.versionAtLeast(2, 4) {
- c.Skip("UpsertUser only works on 2.4+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- ruser := &mgo.User{
- Username: "myruser",
- Password: "mypass",
- OtherDBRoles: map[string][]mgo.Role{"mydb": []mgo.Role{mgo.RoleRead}},
- }
-
- err = admindb.UpsertUser(ruser)
- c.Assert(err, IsNil)
- defer admindb.RemoveUser("myruser")
-
- admindb.Logout()
- err = admindb.Login("myruser", "mypass")
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- err = coll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthUpsertUserUpdates(c *C) {
- if !s.versionAtLeast(2, 4) {
- c.Skip("UpsertUser only works on 2.4+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
-
- // Insert a user that can read.
- user := &mgo.User{
- Username: "myruser",
- Password: "mypass",
- Roles: []mgo.Role{mgo.RoleRead},
- }
- err = mydb.UpsertUser(user)
- c.Assert(err, IsNil)
-
- // Now update the user password.
- user = &mgo.User{
- Username: "myruser",
- Password: "mynewpass",
- }
- err = mydb.UpsertUser(user)
- c.Assert(err, IsNil)
-
- // Login with the new user.
- usession, err := mgo.Dial("myruser:mynewpass@localhost:40002/mydb")
- c.Assert(err, IsNil)
- defer usession.Close()
-
- // Can read, but not write.
- err = usession.DB("mydb").C("mycoll").Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
- err = usession.DB("mydb").C("mycoll").Insert(M{"ok": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // Update the user role.
- user = &mgo.User{
- Username: "myruser",
- Roles: []mgo.Role{mgo.RoleReadWrite},
- }
- err = mydb.UpsertUser(user)
- c.Assert(err, IsNil)
-
- // Dial again to ensure the password hasn't changed.
- usession, err = mgo.Dial("myruser:mynewpass@localhost:40002/mydb")
- c.Assert(err, IsNil)
- defer usession.Close()
-
- // Now it can write.
- err = usession.DB("mydb").C("mycoll").Insert(M{"ok": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthAddUser(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myruser", "mypass", true)
- c.Assert(err, IsNil)
- err = mydb.AddUser("mywuser", "mypass", false)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myruser", "mypass")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- err = mydb.Login("mywuser", "mypass")
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthAddUserReplaces(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "myoldpass", false)
- c.Assert(err, IsNil)
- err = mydb.AddUser("myuser", "mynewpass", true)
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- err = mydb.Login("myuser", "myoldpass")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
- err = mydb.Login("myuser", "mynewpass")
- c.Assert(err, IsNil)
-
- // ReadOnly flag was changed too.
- err = mydb.C("mycoll").Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-}
-
-func (s *S) TestAuthRemoveUser(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "mypass", true)
- c.Assert(err, IsNil)
- err = mydb.RemoveUser("myuser")
- c.Assert(err, IsNil)
- err = mydb.RemoveUser("myuser")
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = mydb.Login("myuser", "mypass")
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.|Could not find user.*")
-}
-
-func (s *S) TestAuthLoginTwiceDoesNothing(c *C) {
- if s.versionAtLeast(3, 7, 3) {
- c.Skip("Login caching invalidated by mechanism negotation in 3.7.3+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- oldStats := mgo.GetStats()
-
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-}
-
-func (s *S) TestAuthLoginLogoutLoginDoesNothing(c *C) {
- if s.versionAtLeast(3, 7, 3) {
- c.Skip("Login caching invalidated by mechanism negotation in 3.7.3+")
- }
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- oldStats := mgo.GetStats()
-
- admindb.Logout()
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-}
-
-func (s *S) TestAuthLoginSwitchUser(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- err = admindb.Login("reader", "rapadura")
- c.Assert(err, IsNil)
-
- // Can't write.
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // But can read.
- result := struct{ N int }{}
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-}
-
-func (s *S) TestAuthLoginChangePassword(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "myoldpass", false)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "myoldpass")
- c.Assert(err, IsNil)
-
- err = mydb.AddUser("myuser", "mynewpass", true)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "mynewpass")
- c.Assert(err, IsNil)
-
- admindb.Logout()
-
- // The second login must be in effect, which means read-only.
- err = mydb.C("mycoll").Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-}
-
-func (s *S) TestAuthLoginCachingWithSessionRefresh(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session.Refresh()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingWithSessionCopy(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session = session.Copy()
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingWithSessionClone(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session = session.Clone()
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingWithNewSession(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- session = session.New()
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|need to login|not authorized .*")
-}
-
-func (s *S) TestAuthLoginCachingAcrossPool(c *C) {
- if s.versionAtLeast(3, 7, 3) {
- c.Skip("Login caching invalidated by mechanism negotation in 3.7.3+")
- }
- // Logins are cached even when the conenction goes back
- // into the pool.
-
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- // Add another user to test the logout case at the same time.
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "mypass", false)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Logout root explicitly, to test both cases.
- admindb.Logout()
-
- // Give socket back to pool.
- session.Refresh()
-
- // Brand new session, should use socket from the pool.
- other := session.New()
- defer other.Close()
-
- oldStats := mgo.GetStats()
-
- err = other.DB("admin").Login("root", "rapadura")
- c.Assert(err, IsNil)
- err = other.DB("mydb").Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Both logins were cached, so no ops.
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-
- // And they actually worked.
- err = other.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- other.DB("admin").Logout()
-
- err = other.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthLoginCachingAcrossPoolWithLogout(c *C) {
- if s.versionAtLeast(3, 7, 3) {
- c.Skip("Login caching invalidated by mechanism negotation in 3.7.3+")
- }
- // Now verify that logouts are properly flushed if they
- // are not revalidated after leaving the pool.
-
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- // Add another user to test the logout case at the same time.
- mydb := session.DB("mydb")
- err = mydb.AddUser("myuser", "mypass", true)
- c.Assert(err, IsNil)
-
- err = mydb.Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Just some data to query later.
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- // Give socket back to pool.
- session.Refresh()
-
- // Brand new session, should use socket from the pool.
- other := session.New()
- defer other.Close()
-
- oldStats := mgo.GetStats()
-
- err = other.DB("mydb").Login("myuser", "mypass")
- c.Assert(err, IsNil)
-
- // Login was cached, so no ops.
- newStats := mgo.GetStats()
- c.Assert(newStats.SentOps, Equals, oldStats.SentOps)
-
- // Can't write, since root has been implicitly logged out
- // when the collection went into the pool, and not revalidated.
- err = other.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- // But can read due to the revalidated myuser login.
- result := struct{ N int }{}
- err = other.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-}
-
-func (s *S) TestAuthEventual(c *C) {
- // Eventual sessions don't keep sockets around, so they are
- // an interesting test case.
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- admindb := session.DB("admin")
- err = admindb.Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- var wg sync.WaitGroup
- wg.Add(20)
-
- for i := 0; i != 10; i++ {
- go func() {
- defer wg.Done()
- var result struct{ N int }
- err := session.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
- }()
- }
-
- for i := 0; i != 10; i++ {
- go func() {
- defer wg.Done()
- err := session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
- }()
- }
-
- wg.Wait()
-}
-
-func (s *S) TestAuthURL(c *C) {
- session, err := mgo.Dial("mongodb://root:rapadura@localhost:40002/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthURLWrongCredentials(c *C) {
- session, err := mgo.Dial("mongodb://root:wrong@localhost:40002/")
- if session != nil {
- session.Close()
- }
- c.Assert(err, ErrorMatches, "auth fail(s|ed)|.*Authentication failed.")
- c.Assert(session, IsNil)
-}
-
-func (s *S) TestAuthURLWithNewSession(c *C) {
- // When authentication is in the URL, the new session will
- // actually carry it on as well, even if logged out explicitly.
- session, err := mgo.Dial("mongodb://root:rapadura@localhost:40002/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.DB("admin").Logout()
-
- // Do it twice to ensure it passes the needed data on.
- session = session.New()
- defer session.Close()
- session = session.New()
- defer session.Close()
-
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestAuthURLWithDatabase(c *C) {
- session, err := mgo.Dial("mongodb://root:rapadura@localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- mydb := session.DB("mydb")
- err = mydb.AddUser("myruser", "mypass", true)
- c.Assert(err, IsNil)
-
- // Test once with database, and once with source.
- for i := 0; i < 2; i++ {
- var url string
- if i == 0 {
- url = "mongodb://myruser:mypass@localhost:40002/mydb"
- } else {
- url = "mongodb://myruser:mypass@localhost:40002/admin?authSource=mydb"
- }
- usession, err := mgo.Dial(url)
- c.Assert(err, IsNil)
- defer usession.Close()
-
- ucoll := usession.DB("mydb").C("mycoll")
- err = ucoll.FindId(0).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
- err = ucoll.Insert(M{"n": 1})
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
- }
-}
-
-func (s *S) TestDefaultDatabase(c *C) {
- tests := []struct{ url, db string }{
- {"mongodb://root:rapadura@localhost:40002", "test"},
- {"mongodb://root:rapadura@localhost:40002/admin", "admin"},
- {"mongodb://localhost:40001", "test"},
- {"mongodb://localhost:40001/", "test"},
- {"mongodb://localhost:40001/mydb", "mydb"},
- }
-
- for _, test := range tests {
- session, err := mgo.Dial(test.url)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("test: %#v", test)
- c.Assert(session.DB("").Name, Equals, test.db)
-
- scopy := session.Copy()
- c.Check(scopy.DB("").Name, Equals, test.db)
- scopy.Close()
- }
-}
-
-func (s *S) TestAuthDirect(c *C) {
- // Direct connections must work to the master and slaves.
- for _, port := range []string{"40031", "40032", "40033"} {
- url := fmt.Sprintf("mongodb://root:rapadura@localhost:%s/?connect=direct", port)
- session, err := mgo.Dial(url)
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- var result struct{}
- err = session.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-}
-
-func (s *S) TestAuthDirectWithLogin(c *C) {
- // Direct connections must work to the master and slaves.
- for _, port := range []string{"40031", "40032", "40033"} {
- url := fmt.Sprintf("mongodb://localhost:%s/?connect=direct", port)
- session, err := mgo.Dial(url)
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
- session.SetSyncTimeout(3 * time.Second)
-
- err = session.DB("admin").Login("root", "rapadura")
- c.Assert(err, IsNil)
-
- var result struct{}
- err = session.DB("mydb").C("mycoll").Find(nil).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-}
-
-func (s *S) TestAuthScramSha1Cred(c *C) {
- if !s.versionAtLeast(2, 7, 7) {
- c.Skip("SCRAM-SHA-1 tests depend on 2.7.7")
- }
- cred := &mgo.Credential{
- Username: "root",
- Password: "rapadura",
- Mechanism: "SCRAM-SHA-1",
- Source: "admin",
- }
- host := "localhost:40002"
- c.Logf("Connecting to %s...", host)
- session, err := mgo.Dial(host)
- c.Assert(err, IsNil)
- defer session.Close()
-
- mycoll := session.DB("admin").C("mycoll")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthScramSha1URL(c *C) {
- if !s.versionAtLeast(2, 7, 7) {
- c.Skip("SCRAM-SHA-1 tests depend on 2.7.7")
- }
- host := "localhost:40002"
- c.Logf("Connecting to %s...", host)
- session, err := mgo.Dial(fmt.Sprintf("root:rapadura@%s?authMechanism=SCRAM-SHA-1", host))
- c.Assert(err, IsNil)
- defer session.Close()
-
- mycoll := session.DB("admin").C("mycoll")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthScramSha256Cred(c *C) {
- if !s.versionAtLeast(3, 7, 3) {
- c.Skip("SCRAM-SHA-256 tests depend on 3.7.3")
- }
- cred := &mgo.Credential{
- Username: "IX",
- Password: "IX",
- Mechanism: "SCRAM-SHA-256",
- Source: "admin",
- }
- host := "localhost:40002"
- c.Logf("Connecting to %s...", host)
- session, err := mgo.Dial(host)
- c.Assert(err, IsNil)
- defer session.Close()
-
- mycoll := session.DB("admin").C("mycoll")
-
- c.Logf("Connected! Testing the need for authentication (before login)...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- c.Logf("Connected! Testing the need for authentication (after login)...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthScramSha256URL(c *C) {
- if !s.versionAtLeast(3, 7, 3) {
- c.Skip("SCRAM-SHA-256 tests depend on 3.7.3")
- }
- host := "localhost:40002"
- c.Logf("Connecting to %s...", host)
- session, err := mgo.Dial(fmt.Sprintf("IX:IX@%s?authMechanism=SCRAM-SHA-256", host))
- c.Assert(err, IsNil)
- defer session.Close()
-
- mycoll := session.DB("admin").C("mycoll")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthScramSha256URLSaslprep(c *C) {
- if !s.versionAtLeast(3, 7, 3) {
- c.Skip("SCRAM-SHA-256 tests depend on 3.7.3")
- }
- host := "localhost:40002"
-
- cases := []string{
- "IX:IX",
- "IX:I%C2%ADX",
- "%E2%85%A8:IV",
- "%E2%85%A8:I%C2%ADV",
- "\u2168:\u2163",
- }
-
- for i, v := range cases {
- uri := fmt.Sprintf("%s@%s?authMechanism=SCRAM-SHA-256", v, host)
- c.Logf("Case %d: %s", i, uri)
- session, err := mgo.Dial(uri)
- c.Assert(err, IsNil)
- defer session.Close()
- mycoll := session.DB("admin").C("mycoll")
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-
-}
-
-func (s *S) TestAuthScramNegotiation(c *C) {
- if !s.versionAtLeast(3, 7, 3) {
- c.Skip("SCRAM-SHA-256 tests depend on 3.7.3")
- }
- host := "localhost:40002"
-
- cases := []string{
- "IX:IX",
- "sha1:sha1",
- "both:both",
- }
-
- for i, v := range cases {
- dialStr := fmt.Sprintf("%s@%s", v, host)
- c.Logf("Case %d: %s", i, dialStr)
- session, err := mgo.Dial(dialStr)
- c.Assert(err, IsNil)
- defer session.Close()
- mycoll := session.DB("admin").C("mycoll")
- c.Logf("Connected! Testing the need for authentication...")
- err = mycoll.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-}
-
-func (s *S) TestAuthX509Cred(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- binfo, err := session.BuildInfo()
- c.Assert(err, IsNil)
- if binfo.OpenSSLVersion == "" {
- c.Skip("server does not support SSL")
- }
-
- clientCertPEM, err := ioutil.ReadFile("harness/certs/client.pem")
- c.Assert(err, IsNil)
-
- clientCert, err := tls.X509KeyPair(clientCertPEM, clientCertPEM)
- c.Assert(err, IsNil)
-
- tlsConfig := &tls.Config{
- // Isolating tests to client certs, don't care about server validation.
- InsecureSkipVerify: true,
- Certificates: []tls.Certificate{clientCert},
- }
-
- var host = "localhost:40003"
- c.Logf("Connecting to %s...", host)
- session, err = mgo.DialWithInfo(&mgo.DialInfo{
- Addrs: []string{host},
- DialServer: func(addr *mgo.ServerAddr) (net.Conn, error) {
- return tls.Dial("tcp", addr.String(), tlsConfig)
- },
- })
- c.Assert(err, IsNil)
- defer session.Close()
-
- err = session.Login(&mgo.Credential{Username: "root", Password: "rapadura"})
- c.Assert(err, IsNil)
-
- // This needs to be kept in sync with client.pem
- x509Subject := "CN=localhost,OU=Client,O=MGO,L=MGO,ST=MGO,C=GO"
-
- externalDB := session.DB("$external")
- var x509User mgo.User = mgo.User{
- Username: x509Subject,
- OtherDBRoles: map[string][]mgo.Role{"admin": []mgo.Role{mgo.RoleRoot}},
- }
- err = externalDB.UpsertUser(&x509User)
- c.Assert(err, IsNil)
-
- session.LogoutAll()
-
- c.Logf("Connected! Ensuring authentication is required...")
- names, err := session.DatabaseNames()
- c.Assert(err, ErrorMatches, "not authorized .*")
-
- cred := &mgo.Credential{
- Username: x509Subject,
- Mechanism: "MONGODB-X509",
- Source: "$external",
- }
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- names, err = session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(len(names) > 0, Equals, true)
-}
-
-var (
- plainFlag = flag.String("plain", "", "Host to test PLAIN authentication against (depends on custom environment)")
- plainUser = "einstein"
- plainPass = "password"
-)
-
-func (s *S) TestAuthPlainCred(c *C) {
- if *plainFlag == "" {
- c.Skip("no -plain")
- }
- cred := &mgo.Credential{
- Username: plainUser,
- Password: plainPass,
- Source: "$external",
- Mechanism: "PLAIN",
- }
- c.Logf("Connecting to %s...", *plainFlag)
- session, err := mgo.Dial(*plainFlag)
- c.Assert(err, IsNil)
- defer session.Close()
-
- records := session.DB("records").C("records")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = records.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized|not authorized .*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- c.Logf("Connected! Testing the need for authentication...")
- err = records.Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestAuthPlainURL(c *C) {
- if *plainFlag == "" {
- c.Skip("no -plain")
- }
- c.Logf("Connecting to %s...", *plainFlag)
- session, err := mgo.Dial(fmt.Sprintf("%s:%s@%s?authMechanism=PLAIN", url.QueryEscape(plainUser), url.QueryEscape(plainPass), *plainFlag))
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Connected! Testing the need for authentication...")
- err = session.DB("records").C("records").Find(nil).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-var (
- kerberosFlag = flag.Bool("kerberos", false, "Test Kerberos authentication (depends on custom environment)")
- kerberosHost = "ldaptest.10gen.cc"
- kerberosUser = "drivers@LDAPTEST.10GEN.CC"
-
- winKerberosPasswordEnv = "MGO_KERBEROS_PASSWORD"
-)
-
-// Kerberos has its own suite because it talks to a remote server
-// that is prepared to authenticate against a kerberos deployment.
-type KerberosSuite struct{}
-
-var _ = Suite(&KerberosSuite{})
-
-func (kerberosSuite *KerberosSuite) SetUpSuite(c *C) {
- mgo.SetDebug(true)
- mgo.SetStats(true)
-}
-
-func (kerberosSuite *KerberosSuite) TearDownSuite(c *C) {
- mgo.SetDebug(false)
- mgo.SetStats(false)
-}
-
-func (kerberosSuite *KerberosSuite) SetUpTest(c *C) {
- mgo.SetLogger((*cLogger)(c))
- mgo.ResetStats()
-}
-
-func (kerberosSuite *KerberosSuite) TearDownTest(c *C) {
- mgo.SetLogger(nil)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosCred(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
- cred := &mgo.Credential{
- Username: kerberosUser,
- Mechanism: "GSSAPI",
- }
- windowsAppendPasswordToCredential(cred)
- c.Logf("Connecting to %s...", kerberosHost)
- session, err := mgo.Dial(kerberosHost)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Connected! Testing the need for authentication...")
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, ErrorMatches, ".*authorized.*")
-
- c.Logf("Authenticating...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- n, err = session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosURL(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
- c.Logf("Connecting to %s...", kerberosHost)
- connectUri := url.QueryEscape(kerberosUser) + "@" + kerberosHost + "?authMechanism=GSSAPI"
- if runtime.GOOS == "windows" {
- connectUri = url.QueryEscape(kerberosUser) + ":" + url.QueryEscape(getWindowsKerberosPassword()) + "@" + kerberosHost + "?authMechanism=GSSAPI"
- }
- session, err := mgo.Dial(connectUri)
- c.Assert(err, IsNil)
- defer session.Close()
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosServiceName(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
-
- wrongServiceName := "wrong"
- rightServiceName := "mongodb"
-
- cred := &mgo.Credential{
- Username: kerberosUser,
- Mechanism: "GSSAPI",
- Service: wrongServiceName,
- }
- windowsAppendPasswordToCredential(cred)
-
- c.Logf("Connecting to %s...", kerberosHost)
- session, err := mgo.Dial(kerberosHost)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Authenticating with incorrect service name...")
- err = session.Login(cred)
- c.Assert(err, ErrorMatches, ".*@LDAPTEST.10GEN.CC not found.*")
-
- cred.Service = rightServiceName
- c.Logf("Authenticating with correct service name...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (kerberosSuite *KerberosSuite) TestAuthKerberosServiceHost(c *C) {
- if !*kerberosFlag {
- c.Skip("no -kerberos")
- }
-
- wrongServiceHost := "eggs.bacon.tk"
- rightServiceHost := kerberosHost
-
- cred := &mgo.Credential{
- Username: kerberosUser,
- Mechanism: "GSSAPI",
- ServiceHost: wrongServiceHost,
- }
- windowsAppendPasswordToCredential(cred)
-
- c.Logf("Connecting to %s...", kerberosHost)
- session, err := mgo.Dial(kerberosHost)
- c.Assert(err, IsNil)
- defer session.Close()
-
- c.Logf("Authenticating with incorrect service host...")
- err = session.Login(cred)
- c.Assert(err, ErrorMatches, ".*@LDAPTEST.10GEN.CC not found.*")
-
- cred.ServiceHost = rightServiceHost
- c.Logf("Authenticating with correct service host...")
- err = session.Login(cred)
- c.Assert(err, IsNil)
- c.Logf("Authenticated!")
-
- n, err := session.DB("kerberos").C("test").Find(M{}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-// No kinit on SSPI-style Kerberos, so we need to provide a password. In order
-// to avoid inlining password, require it to be set as an environment variable,
-// for instance: `SET MGO_KERBEROS_PASSWORD=this_isnt_the_password`
-func getWindowsKerberosPassword() string {
- pw := os.Getenv(winKerberosPasswordEnv)
- if pw == "" {
- panic(fmt.Sprintf("Need to set %v environment variable to run Kerberos tests on Windows", winKerberosPasswordEnv))
- }
- return pw
-}
-
-func windowsAppendPasswordToCredential(cred *mgo.Credential) {
- if runtime.GOOS == "windows" {
- cred.Password = getWindowsKerberosPassword()
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson.go
index c023b0638bb..22e95b84bc1 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson.go
@@ -112,6 +112,16 @@ var SetZero = errors.New("set to zero")
// undefined ordered. See also the bson.D type for an ordered alternative.
type M map[string]interface{}
+// MarshalBSON marshals the document to BSON.
+func (m M) MarshalBSON() ([]byte, error) {
+ return Marshal(m)
+}
+
+// UnmarshalBSON unmarshals BSON into the document.
+func (m *M) UnmarshalBSON(data []byte) error {
+ return Unmarshal(data, m)
+}
+
// D represents a BSON document containing ordered elements. For example:
//
// bson.D{{"a", 1}, {"b", true}}
@@ -121,6 +131,16 @@ type M map[string]interface{}
// using a map is generally more comfortable. See bson.M and bson.RawD.
type D []DocElem
+// MarshalBSON marshals the document to BSON.
+func (d D) MarshalBSON() ([]byte, error) {
+ return Marshal(d)
+}
+
+// UnmarshalBSON unmarshals BSON into the document.
+func (d *D) UnmarshalBSON(data []byte) error {
+ return Unmarshal(data, d)
+}
+
// DocElem is an element of the bson.D document representation.
type DocElem struct {
Name string
@@ -156,6 +176,16 @@ type Raw struct {
// documents in general.
type RawD []RawDocElem
+// MarshalBSON marshals the document to BSON.
+func (d RawD) MarshalBSON() ([]byte, error) {
+ return Marshal(d)
+}
+
+// UnmarshalBSON unmarshals BSON into the document.
+func (d *RawD) UnmarshalBSON(data []byte) error {
+ return Unmarshal(data, d)
+}
+
// See the RawD type.
type RawDocElem struct {
Name string
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_corpus_spec_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_corpus_spec_test.go
deleted file mode 100644
index b6737a69f79..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_corpus_spec_test.go
+++ /dev/null
@@ -1,1926 +0,0 @@
-// Code generated by "bson_corpus_spec_test_generator.go"; DO NOT EDIT
-
-package bson_test
-
-import (
- "encoding/hex"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2/bson"
-)
-
-func testValid(c *C, in []byte, expected []byte, result interface{}) {
- err := bson.Unmarshal(in, result)
- c.Assert(err, IsNil)
-
- out, err := bson.Marshal(result)
- c.Assert(err, IsNil)
-
- c.Assert(string(expected), Equals, string(out), Commentf("roundtrip failed for %T, expected '%x' but got '%x'", result, expected, out))
-}
-
-func testDecodeSkip(c *C, in []byte) {
- err := bson.Unmarshal(in, &struct{}{})
- c.Assert(err, IsNil)
-}
-
-func testDecodeError(c *C, in []byte, result interface{}) {
- err := bson.Unmarshal(in, result)
- c.Assert(err, Not(IsNil))
-}
-
-func (s *S) TestArray_Empty(c *C) {
- b, err := hex.DecodeString("0D000000046100050000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element []interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestArray_Single_Element_Array(c *C) {
- b, err := hex.DecodeString("140000000461000C0000001030000A0000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element []interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestArray_Single_Element_Array_with_index_set_incorrectly_1(c *C) {
- b, err := hex.DecodeString("130000000461000B00000010000A0000000000")
- c.Assert(err, IsNil)
-
- cb, err := hex.DecodeString("140000000461000C0000001030000A0000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element []interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestArray_Single_Element_Array_with_index_set_incorrectly(c *C) {
- b, err := hex.DecodeString("150000000461000D000000106162000A0000000000")
- c.Assert(err, IsNil)
-
- cb, err := hex.DecodeString("140000000461000C0000001030000A0000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element []interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestArray_Array_length_too_long__eats_outer_terminator(c *C) {
- b, err := hex.DecodeString("140000000461000D0000001030000A0000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestArray_Array_length_too_short__leaks_terminator(c *C) {
- b, err := hex.DecodeString("140000000461000B0000001030000A0000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestArray_Invalid_Array__bad_string_length_in_field(c *C) {
- b, err := hex.DecodeString("1A00000004666F6F00100000000230000500000062617A000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBinary_type_subtype_0x00__Zero_length_(c *C) {
- b, err := hex.DecodeString("0D000000057800000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element []byte `bson:"x"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_subtype_0x00(c *C) {
- b, err := hex.DecodeString("0F0000000578000200000000FFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element []byte `bson:"x"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_subtype_0x01(c *C) {
- b, err := hex.DecodeString("0F0000000578000200000001FFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_subtype_0x03(c *C) {
- b, err := hex.DecodeString("1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_subtype_0x04(c *C) {
- b, err := hex.DecodeString("1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_subtype_0x05(c *C) {
- b, err := hex.DecodeString("1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_subtype_0x80(c *C) {
- b, err := hex.DecodeString("0F0000000578000200000080FFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBinary_type_Length_longer_than_document(c *C) {
- b, err := hex.DecodeString("1D000000057800FF0000000573FFD26444B34C6990E8E7D1DFC035D400")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBinary_type_Negative_length(c *C) {
- b, err := hex.DecodeString("0D000000057800FFFFFFFF0000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBinary_type_subtype_0x02_length_too_long_(c *C) {
- b, err := hex.DecodeString("13000000057800060000000203000000FFFF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBinary_type_subtype_0x02_length_too_short(c *C) {
- b, err := hex.DecodeString("13000000057800060000000201000000FFFF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBinary_type_subtype_0x02_length_negative_one(c *C) {
- b, err := hex.DecodeString("130000000578000600000002FFFFFFFFFFFF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBoolean_True(c *C) {
- b, err := hex.DecodeString("090000000862000100")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bool `bson:"b"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBoolean_False(c *C) {
- b, err := hex.DecodeString("090000000862000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bool `bson:"b"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestBoolean_Invalid_boolean_value_of_2(c *C) {
- b, err := hex.DecodeString("090000000862000200")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestBoolean_Invalid_boolean_value_of__1(c *C) {
- b, err := hex.DecodeString("09000000086200FF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_Empty_string(c *C) {
- b, err := hex.DecodeString("0D0000000D6100010000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_Single_character(c *C) {
- b, err := hex.DecodeString("0E0000000D610002000000620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_Multi_character(c *C) {
- b, err := hex.DecodeString("190000000D61000D0000006162616261626162616261620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_two_byte_UTF_8____(c *C) {
- b, err := hex.DecodeString("190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_three_byte_UTF_8____(c *C) {
- b, err := hex.DecodeString("190000000261000D000000E29886E29886E29886E298860000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_Embedded_nulls(c *C) {
- b, err := hex.DecodeString("190000000261000D0000006162006261620062616261620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_bad_code_string_length__0__but_no_0x00_either_(c *C) {
- b, err := hex.DecodeString("0C0000000261000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_bad_code_string_length___1(c *C) {
- b, err := hex.DecodeString("0C000000026100FFFFFFFF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_bad_code_string_length__eats_terminator(c *C) {
- b, err := hex.DecodeString("10000000026100050000006200620000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_bad_code_string_length__longer_than_rest_of_document(c *C) {
- b, err := hex.DecodeString("120000000200FFFFFF00666F6F6261720000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_code_string_is_not_null_terminated(c *C) {
- b, err := hex.DecodeString("1000000002610004000000616263FF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_empty_code_string__but_extra_null(c *C) {
- b, err := hex.DecodeString("0E00000002610001000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_Empty_code_string__empty_scope(c *C) {
- b, err := hex.DecodeString("160000000F61000E0000000100000000050000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_Non_empty_code_string__empty_scope(c *C) {
- b, err := hex.DecodeString("1A0000000F610012000000050000006162636400050000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_Empty_code_string__non_empty_scope(c *C) {
- b, err := hex.DecodeString("1D0000000F61001500000001000000000C000000107800010000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_Non_empty_code_string_and_non_empty_scope(c *C) {
- b, err := hex.DecodeString("210000000F6100190000000500000061626364000C000000107800010000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_Unicode_and_embedded_null_in_code_string__empty_scope(c *C) {
- b, err := hex.DecodeString("1A0000000F61001200000005000000C3A9006400050000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_field_length_zero(c *C) {
- b, err := hex.DecodeString("280000000F6100000000000500000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_field_length_negative(c *C) {
- b, err := hex.DecodeString("280000000F6100FFFFFFFF0500000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_field_length_too_short__less_than_minimum_size_(c *C) {
- b, err := hex.DecodeString("160000000F61000D0000000100000000050000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_field_length_too_short__truncates_scope_(c *C) {
- b, err := hex.DecodeString("280000000F61001F0000000500000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_field_length_too_long__clips_outer_doc_(c *C) {
- b, err := hex.DecodeString("280000000F6100210000000500000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_field_length_too_long__longer_than_outer_doc_(c *C) {
- b, err := hex.DecodeString("280000000F6100FF0000000500000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_bad_code_string__length_too_short(c *C) {
- b, err := hex.DecodeString("280000000F6100200000000400000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_bad_code_string__length_too_long__clips_scope_(c *C) {
- b, err := hex.DecodeString("280000000F6100200000000600000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_bad_code_string__negative_length(c *C) {
- b, err := hex.DecodeString("280000000F610020000000FFFFFFFF61626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_bad_code_string__length_longer_than_field(c *C) {
- b, err := hex.DecodeString("280000000F610020000000FF00000061626364001300000010780001000000107900010000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestJavascript_Code_with_Scope_bad_scope_doc__field_has_bad_string_length_(c *C) {
- b, err := hex.DecodeString("1C0000000F001500000001000000000C000000020000000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDateTime_epoch(c *C) {
- b, err := hex.DecodeString("10000000096100000000000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element time.Time `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDateTime_positive_ms(c *C) {
- b, err := hex.DecodeString("10000000096100C4D8D6CC3B01000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element time.Time `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDateTime_negative(c *C) {
- b, err := hex.DecodeString("10000000096100C43CE7B9BDFFFFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element time.Time `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDateTime_datetime_field_truncated(c *C) {
- b, err := hex.DecodeString("0C0000000961001234567800")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDBPointer_type__deprecated__DBpointer(c *C) {
- b, err := hex.DecodeString("1A0000000C610002000000620056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBPointer_type__deprecated__DBpointer_with_opposite_key_order(c *C) {
- b, err := hex.DecodeString("1A0000000C610002000000620056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBPointer_type__deprecated__DBpointer_with_extra_keys(c *C) {
- b, err := hex.DecodeString("1A0000000C610002000000620056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBPointer_type__deprecated__With_two_byte_UTF_8(c *C) {
- b, err := hex.DecodeString("1B0000000C610003000000C3A90056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBPointer_type__deprecated__String_with_negative_length(c *C) {
- b, err := hex.DecodeString("1A0000000C6100FFFFFFFF620056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDBPointer_type__deprecated__String_with_zero_length(c *C) {
- b, err := hex.DecodeString("1A0000000C610000000000620056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDBPointer_type__deprecated__String_not_null_terminated(c *C) {
- b, err := hex.DecodeString("1A0000000C610002000000626256E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDBPointer_type__deprecated__short_OID__less_than_minimum_length_for_field_(c *C) {
- b, err := hex.DecodeString("160000000C61000300000061620056E1FC72E0C91700")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDBPointer_type__deprecated__short_OID__greater_than_minimum__but_truncated_(c *C) {
- b, err := hex.DecodeString("1A0000000C61000300000061620056E1FC72E0C917E9C4716100")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDBRef_DBRef(c *C) {
- b, err := hex.DecodeString("37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBRef_DBRef_with_database(c *C) {
- b, err := hex.DecodeString("4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBRef_DBRef_with_database_and_additional_fields(c *C) {
- b, err := hex.DecodeString("48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBRef_DBRef_with_additional_fields(c *C) {
- b, err := hex.DecodeString("4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDBRef_Document_with_key_names_similar_to_those_of_a_DBRef(c *C) {
- b, err := hex.DecodeString("3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDocument_type__sub_documents__Empty_subdoc(c *C) {
- b, err := hex.DecodeString("0D000000037800050000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bson.D `bson:"x"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDocument_type__sub_documents__Empty_string_key_subdoc(c *C) {
- b, err := hex.DecodeString("150000000378000D00000002000200000062000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bson.D `bson:"x"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDocument_type__sub_documents__Single_character_key_subdoc(c *C) {
- b, err := hex.DecodeString("160000000378000E0000000261000200000062000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bson.D `bson:"x"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDocument_type__sub_documents__Subdocument_length_too_long__eats_outer_terminator(c *C) {
- b, err := hex.DecodeString("1800000003666F6F000F0000001062617200FFFFFF7F0000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDocument_type__sub_documents__Subdocument_length_too_short__leaks_terminator(c *C) {
- b, err := hex.DecodeString("1500000003666F6F000A0000000862617200010000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDocument_type__sub_documents__Invalid_subdocument__bad_string_length_in_field(c *C) {
- b, err := hex.DecodeString("1C00000003666F6F001200000002626172000500000062617A000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestDouble_type__1_0_1(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000F03F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__1_0(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000F0BF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__1_0001220703125_1(c *C) {
- b, err := hex.DecodeString("10000000016400000000008000F03F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__1_0001220703125(c *C) {
- b, err := hex.DecodeString("10000000016400000000008000F0BF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__2_0001220703125e10_1(c *C) {
- b, err := hex.DecodeString("1000000001640000807ca1a9a0124200")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__2_0001220703125e10(c *C) {
- b, err := hex.DecodeString("1000000001640000807ca1a9a012c200")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type_0_0(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__0_0(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000008000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type_NaN(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000F87F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type_NaN_with_payload(c *C) {
- b, err := hex.DecodeString("10000000016400120000000000F87F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type_Inf(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000F07F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type__Inf(c *C) {
- b, err := hex.DecodeString("10000000016400000000000000F0FF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element float64 `bson:"d"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestDouble_type_double_truncated(c *C) {
- b, err := hex.DecodeString("0B0000000164000000F03F00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestInt32_type_MinValue(c *C) {
- b, err := hex.DecodeString("0C0000001069000000008000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int32 `bson:"i"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt32_type_MaxValue(c *C) {
- b, err := hex.DecodeString("0C000000106900FFFFFF7F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int32 `bson:"i"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt32_type__1(c *C) {
- b, err := hex.DecodeString("0C000000106900FFFFFFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int32 `bson:"i"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt32_type_0(c *C) {
- b, err := hex.DecodeString("0C0000001069000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int32 `bson:"i"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt32_type_1(c *C) {
- b, err := hex.DecodeString("0C0000001069000100000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int32 `bson:"i"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt32_type_Bad_int32_field_length(c *C) {
- b, err := hex.DecodeString("090000001061000500")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestInt64_type_MinValue(c *C) {
- b, err := hex.DecodeString("10000000126100000000000000008000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int64 `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt64_type_MaxValue(c *C) {
- b, err := hex.DecodeString("10000000126100FFFFFFFFFFFFFF7F00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int64 `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt64_type__1(c *C) {
- b, err := hex.DecodeString("10000000126100FFFFFFFFFFFFFFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int64 `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt64_type_0(c *C) {
- b, err := hex.DecodeString("10000000126100000000000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int64 `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt64_type_1(c *C) {
- b, err := hex.DecodeString("10000000126100010000000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element int64 `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestInt64_type_int64_field_truncated(c *C) {
- b, err := hex.DecodeString("0C0000001261001234567800")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestMaxkey_type_Maxkey(c *C) {
- b, err := hex.DecodeString("080000007F610000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestMinkey_type_Minkey(c *C) {
- b, err := hex.DecodeString("08000000FF610000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestMultiple_types_within_the_same_document_All_BSON_types(c *C) {
- b, err := hex.DecodeString("3b020000075f69640057e193d7a9cc81b4027498b50e53796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500f6285c8fc23545400542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c736500000c4442506f696e746572000e00000064622e636f6c6c656374696f6e0057e193d7a9cc81b4027498b1034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0006556e646566696e65640000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestNull_type_Null(c *C) {
- b, err := hex.DecodeString("080000000A610000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestObjectId_All_zeroes(c *C) {
- b, err := hex.DecodeString("1400000007610000000000000000000000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bson.ObjectId `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestObjectId_All_ones(c *C) {
- b, err := hex.DecodeString("14000000076100FFFFFFFFFFFFFFFFFFFFFFFF00")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bson.ObjectId `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestObjectId_Random(c *C) {
- b, err := hex.DecodeString("1400000007610056E1FC72E0C917E9C471416100")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element bson.ObjectId `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestObjectId_OID_truncated(c *C) {
- b, err := hex.DecodeString("1200000007610056E1FC72E0C917E9C471")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestRegular_Expression_type_empty_regex_with_no_options(c *C) {
- b, err := hex.DecodeString("0A0000000B6100000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestRegular_Expression_type_regex_without_options(c *C) {
- b, err := hex.DecodeString("0D0000000B6100616263000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestRegular_Expression_type_regex_with_options(c *C) {
- b, err := hex.DecodeString("0F0000000B610061626300696D0000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestRegular_Expression_type_regex_with_slash(c *C) {
- b, err := hex.DecodeString("110000000B610061622F636400696D0000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestRegular_Expression_type_flags_not_alphabetized(c *C) {
- b, err := hex.DecodeString("100000000B6100616263006D69780000")
- c.Assert(err, IsNil)
-
- cb, err := hex.DecodeString("100000000B610061626300696D780000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestRegular_Expression_type_embedded_null_in_pattern(c *C) {
- b, err := hex.DecodeString("0F0000000B610061006300696D0000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestRegular_Expression_type_embedded_null_in_flags(c *C) {
- b, err := hex.DecodeString("100000000B61006162630069006D0000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestString_Empty_string(c *C) {
- b, err := hex.DecodeString("0D000000026100010000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element string `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestString_Single_character(c *C) {
- b, err := hex.DecodeString("0E00000002610002000000620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element string `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestString_Multi_character(c *C) {
- b, err := hex.DecodeString("190000000261000D0000006162616261626162616261620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element string `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestString_two_byte_UTF_8____(c *C) {
- b, err := hex.DecodeString("190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element string `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestString_three_byte_UTF_8____(c *C) {
- b, err := hex.DecodeString("190000000261000D000000E29886E29886E29886E298860000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element string `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestString_Embedded_nulls(c *C) {
- b, err := hex.DecodeString("190000000261000D0000006162006261620062616261620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element string `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestString_bad_string_length__0__but_no_0x00_either_(c *C) {
- b, err := hex.DecodeString("0C0000000261000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestString_bad_string_length___1(c *C) {
- b, err := hex.DecodeString("0C000000026100FFFFFFFF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestString_bad_string_length__eats_terminator(c *C) {
- b, err := hex.DecodeString("10000000026100050000006200620000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestString_bad_string_length__longer_than_rest_of_document(c *C) {
- b, err := hex.DecodeString("120000000200FFFFFF00666F6F6261720000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestString_string_is_not_null_terminated(c *C) {
- b, err := hex.DecodeString("1000000002610004000000616263FF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestString_empty_string__but_extra_null(c *C) {
- b, err := hex.DecodeString("0E00000002610001000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestSymbol_Empty_string(c *C) {
- b, err := hex.DecodeString("0D0000000E6100010000000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestSymbol_Single_character(c *C) {
- b, err := hex.DecodeString("0E0000000E610002000000620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestSymbol_Multi_character(c *C) {
- b, err := hex.DecodeString("190000000E61000D0000006162616261626162616261620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestSymbol_two_byte_UTF_8____(c *C) {
- b, err := hex.DecodeString("190000000E61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestSymbol_three_byte_UTF_8____(c *C) {
- b, err := hex.DecodeString("190000000E61000D000000E29886E29886E29886E298860000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestSymbol_Embedded_nulls(c *C) {
- b, err := hex.DecodeString("190000000E61000D0000006162006261620062616261620000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestSymbol_bad_symbol_length__0__but_no_0x00_either_(c *C) {
- b, err := hex.DecodeString("0C0000000261000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestSymbol_bad_symbol_length___1(c *C) {
- b, err := hex.DecodeString("0C000000026100FFFFFFFF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestSymbol_bad_symbol_length__eats_terminator(c *C) {
- b, err := hex.DecodeString("10000000026100050000006200620000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestSymbol_bad_symbol_length__longer_than_rest_of_document(c *C) {
- b, err := hex.DecodeString("120000000200FFFFFF00666F6F6261720000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestSymbol_symbol_is_not_null_terminated(c *C) {
- b, err := hex.DecodeString("1000000002610004000000616263FF00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestSymbol_empty_symbol__but_extra_null(c *C) {
- b, err := hex.DecodeString("0E00000002610001000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTimestamp_type_Timestamp___123456789__42_(c *C) {
- b, err := hex.DecodeString("100000001161002A00000015CD5B0700")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
- var resultS struct {
- Element interface{} `bson:"a"`
- }
- testValid(c, b, cb, &resultS)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestTimestamp_type_Truncated_timestamp_field(c *C) {
- b, err := hex.DecodeString("0f0000001161002A00000015CD5B00")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Document_with_keys_that_start_with__(c *C) {
- b, err := hex.DecodeString("0f00000010246b6579002a00000000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestTop_level_document_validity_Document_that_resembles_extended_JSON__but_with_extra_keys(c *C) {
- b, err := hex.DecodeString("3f00000002247265676578000c0000006e6f742d612d72656765780002246f7074696f6e7300020000006900022462616e616e6100050000007065656c0000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestTop_level_document_validity_Document_that_resembles_extended_JSON__but_with_missing_keys(c *C) {
- b, err := hex.DecodeString("1a000000022462696e6172790008000000616263646566670000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
-
-func (s *S) TestTop_level_document_validity_An_object_size_that_s_too_small_to_even_include_the_object_size__but_is_a_well_formed__empty_object(c *C) {
- b, err := hex.DecodeString("0100000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_An_object_size_that_s_only_enough_for_the_object_size__but_is_a_well_formed__empty_object(c *C) {
- b, err := hex.DecodeString("0400000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_One_object__with_length_shorter_than_size__missing_EOO_(c *C) {
- b, err := hex.DecodeString("05000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_One_object__sized_correctly__with_a_spot_for_an_EOO__but_the_EOO_is_0x01(c *C) {
- b, err := hex.DecodeString("0500000001")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_One_object__sized_correctly__with_a_spot_for_an_EOO__but_the_EOO_is_0xff(c *C) {
- b, err := hex.DecodeString("05000000FF")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_One_object__sized_correctly__with_a_spot_for_an_EOO__but_the_EOO_is_0x70(c *C) {
- b, err := hex.DecodeString("0500000070")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Byte_count_is_zero__with_non_zero_input_length_(c *C) {
- b, err := hex.DecodeString("00000000000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Stated_length_exceeds_byte_count__with_truncated_document(c *C) {
- b, err := hex.DecodeString("1200000002666F6F0004000000626172")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Stated_length_less_than_byte_count__with_garbage_after_envelope(c *C) {
- b, err := hex.DecodeString("1200000002666F6F00040000006261720000DEADBEEF")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Stated_length_exceeds_byte_count__with_valid_envelope(c *C) {
- b, err := hex.DecodeString("1300000002666F6F00040000006261720000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Stated_length_less_than_byte_count__with_valid_envelope(c *C) {
- b, err := hex.DecodeString("1100000002666F6F00040000006261720000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Invalid_BSON_type_low_range(c *C) {
- b, err := hex.DecodeString("07000000000000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Invalid_BSON_type_high_range(c *C) {
- b, err := hex.DecodeString("07000000800000")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestTop_level_document_validity_Document_truncated_mid_key(c *C) {
- b, err := hex.DecodeString("1200000002666F")
- c.Assert(err, IsNil)
-
- var resultD bson.D
- testDecodeError(c, b, &resultD)
-}
-
-func (s *S) TestUndefined_type__deprecated__Undefined(c *C) {
- b, err := hex.DecodeString("0800000006610000")
- c.Assert(err, IsNil)
-
- cb := b
-
- var resultD bson.D
- testValid(c, b, cb, &resultD)
-
- testDecodeSkip(c, b)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_test.go
deleted file mode 100644
index 11fdfae4185..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/bson_test.go
+++ /dev/null
@@ -1,1770 +0,0 @@
-// BSON library for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// gobson - BSON library for Go.
-
-package bson_test
-
-import (
- "encoding/binary"
- "encoding/json"
- "encoding/xml"
- "errors"
- "net/url"
- "reflect"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2/bson"
-)
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct{}
-
-var _ = Suite(&S{})
-
-// Wrap up the document elements contained in data, prepending the int32
-// length of the data, and appending the '\x00' value closing the document.
-func wrapInDoc(data string) string {
- result := make([]byte, len(data)+5)
- binary.LittleEndian.PutUint32(result, uint32(len(result)))
- copy(result[4:], []byte(data))
- return string(result)
-}
-
-func makeZeroDoc(value interface{}) (zero interface{}) {
- v := reflect.ValueOf(value)
- t := v.Type()
- switch t.Kind() {
- case reflect.Map:
- mv := reflect.MakeMap(t)
- zero = mv.Interface()
- case reflect.Ptr:
- pv := reflect.New(v.Type().Elem())
- zero = pv.Interface()
- case reflect.Slice, reflect.Int, reflect.Int64, reflect.Struct:
- zero = reflect.New(t).Interface()
- default:
- panic("unsupported doc type: " + t.Name())
- }
- return zero
-}
-
-func testUnmarshal(c *C, data string, obj interface{}) {
- zero := makeZeroDoc(obj)
- err := bson.Unmarshal([]byte(data), zero)
- c.Assert(err, IsNil)
- c.Assert(zero, DeepEquals, obj)
-}
-
-type testItemType struct {
- obj interface{}
- data string
-}
-
-// --------------------------------------------------------------------------
-// Samples from bsonspec.org:
-
-var sampleItems = []testItemType{
- {bson.M{"hello": "world"},
- "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"},
- {bson.M{"BSON": []interface{}{"awesome", float64(5.05), 1986}},
- "1\x00\x00\x00\x04BSON\x00&\x00\x00\x00\x020\x00\x08\x00\x00\x00" +
- "awesome\x00\x011\x00333333\x14@\x102\x00\xc2\x07\x00\x00\x00\x00"},
-}
-
-func (s *S) TestMarshalSampleItems(c *C) {
- for i, item := range sampleItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, item.data, Commentf("Failed on item %d", i))
- }
-}
-
-func (s *S) TestUnmarshalSampleItems(c *C) {
- for i, item := range sampleItems {
- value := bson.M{}
- err := bson.Unmarshal([]byte(item.data), value)
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, item.obj, Commentf("Failed on item %d", i))
- }
-}
-
-// --------------------------------------------------------------------------
-// Every type, ordered by the type flag. These are not wrapped with the
-// length and last \x00 from the document. wrapInDoc() computes them.
-// Note that all of them should be supported as two-way conversions.
-
-var allItems = []testItemType{
- {bson.M{},
- ""},
- {bson.M{"_": float64(5.05)},
- "\x01_\x00333333\x14@"},
- {bson.M{"_": "yo"},
- "\x02_\x00\x03\x00\x00\x00yo\x00"},
- {bson.M{"_": bson.M{"a": true}},
- "\x03_\x00\x09\x00\x00\x00\x08a\x00\x01\x00"},
- {bson.M{"_": []interface{}{true, false}},
- "\x04_\x00\r\x00\x00\x00\x080\x00\x01\x081\x00\x00\x00"},
- {bson.M{"_": []byte("yo")},
- "\x05_\x00\x02\x00\x00\x00\x00yo"},
- {bson.M{"_": bson.Binary{0x80, []byte("udef")}},
- "\x05_\x00\x04\x00\x00\x00\x80udef"},
- {bson.M{"_": bson.Undefined}, // Obsolete, but still seen in the wild.
- "\x06_\x00"},
- {bson.M{"_": bson.ObjectId("0123456789ab")},
- "\x07_\x000123456789ab"},
- {bson.M{"_": bson.DBPointer{"testnamespace", bson.ObjectId("0123456789ab")}},
- "\x0C_\x00\x0e\x00\x00\x00testnamespace\x000123456789ab"},
- {bson.M{"_": false},
- "\x08_\x00\x00"},
- {bson.M{"_": true},
- "\x08_\x00\x01"},
- {bson.M{"_": time.Unix(0, 258e6)}, // Note the NS <=> MS conversion.
- "\x09_\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"_": nil},
- "\x0A_\x00"},
- {bson.M{"_": bson.RegEx{"ab", "cd"}},
- "\x0B_\x00ab\x00cd\x00"},
- {bson.M{"_": bson.JavaScript{"code", nil}},
- "\x0D_\x00\x05\x00\x00\x00code\x00"},
- {bson.M{"_": bson.Symbol("sym")},
- "\x0E_\x00\x04\x00\x00\x00sym\x00"},
- {bson.M{"_": bson.JavaScript{"code", bson.M{"": nil}}},
- "\x0F_\x00\x14\x00\x00\x00\x05\x00\x00\x00code\x00" +
- "\x07\x00\x00\x00\x0A\x00\x00"},
- {bson.M{"_": 258},
- "\x10_\x00\x02\x01\x00\x00"},
- {bson.M{"_": bson.MongoTimestamp(258)},
- "\x11_\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"_": int64(258)},
- "\x12_\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"_": int64(258 << 32)},
- "\x12_\x00\x00\x00\x00\x00\x02\x01\x00\x00"},
- {bson.M{"_": bson.MaxKey},
- "\x7F_\x00"},
- {bson.M{"_": bson.MinKey},
- "\xFF_\x00"},
-}
-
-func (s *S) TestMarshalAllItems(c *C) {
- for i, item := range allItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data), Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalAllItems(c *C) {
- for i, item := range allItems {
- value := bson.M{}
- err := bson.Unmarshal([]byte(wrapInDoc(item.data)), value)
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, item.obj, Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalRawAllItems(c *C) {
- for i, item := range allItems {
- if len(item.data) == 0 {
- continue
- }
- value := item.obj.(bson.M)["_"]
- if value == nil {
- continue
- }
- pv := reflect.New(reflect.ValueOf(value).Type())
- raw := bson.Raw{item.data[0], []byte(item.data[3:])}
- c.Logf("Unmarshal raw: %#v, %#v", raw, pv.Interface())
- err := raw.Unmarshal(pv.Interface())
- c.Assert(err, IsNil)
- c.Assert(pv.Elem().Interface(), DeepEquals, value, Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalRawIncompatible(c *C) {
- raw := bson.Raw{0x08, []byte{0x01}} // true
- err := raw.Unmarshal(&struct{}{})
- c.Assert(err, ErrorMatches, "BSON kind 0x08 isn't compatible with type struct \\{\\}")
-}
-
-func (s *S) TestUnmarshalZeroesStruct(c *C) {
- data, err := bson.Marshal(bson.M{"b": 2})
- c.Assert(err, IsNil)
- type T struct{ A, B int }
- v := T{A: 1}
- err = bson.Unmarshal(data, &v)
- c.Assert(err, IsNil)
- c.Assert(v.A, Equals, 0)
- c.Assert(v.B, Equals, 2)
-}
-
-func (s *S) TestUnmarshalZeroesMap(c *C) {
- data, err := bson.Marshal(bson.M{"b": 2})
- c.Assert(err, IsNil)
- m := bson.M{"a": 1}
- err = bson.Unmarshal(data, &m)
- c.Assert(err, IsNil)
- c.Assert(m, DeepEquals, bson.M{"b": 2})
-}
-
-func (s *S) TestUnmarshalNonNilInterface(c *C) {
- data, err := bson.Marshal(bson.M{"b": 2})
- c.Assert(err, IsNil)
- m := bson.M{"a": 1}
- var i interface{}
- i = m
- err = bson.Unmarshal(data, &i)
- c.Assert(err, IsNil)
- c.Assert(i, DeepEquals, bson.M{"b": 2})
- c.Assert(m, DeepEquals, bson.M{"a": 1})
-}
-
-// --------------------------------------------------------------------------
-// Some one way marshaling operations which would unmarshal differently.
-
-var oneWayMarshalItems = []testItemType{
- // These are being passed as pointers, and will unmarshal as values.
- {bson.M{"": &bson.Binary{0x02, []byte("old")}},
- "\x05\x00\x07\x00\x00\x00\x02\x03\x00\x00\x00old"},
- {bson.M{"": &bson.Binary{0x80, []byte("udef")}},
- "\x05\x00\x04\x00\x00\x00\x80udef"},
- {bson.M{"": &bson.RegEx{"ab", "cd"}},
- "\x0B\x00ab\x00cd\x00"},
- {bson.M{"": &bson.JavaScript{"code", nil}},
- "\x0D\x00\x05\x00\x00\x00code\x00"},
- {bson.M{"": &bson.JavaScript{"code", bson.M{"": nil}}},
- "\x0F\x00\x14\x00\x00\x00\x05\x00\x00\x00code\x00" +
- "\x07\x00\x00\x00\x0A\x00\x00"},
-
- // There's no float32 type in BSON. Will encode as a float64.
- {bson.M{"": float32(5.05)},
- "\x01\x00\x00\x00\x00@33\x14@"},
-
- // The array will be unmarshaled as a slice instead.
- {bson.M{"": [2]bool{true, false}},
- "\x04\x00\r\x00\x00\x00\x080\x00\x01\x081\x00\x00\x00"},
-
- // The typed slice will be unmarshaled as []interface{}.
- {bson.M{"": []bool{true, false}},
- "\x04\x00\r\x00\x00\x00\x080\x00\x01\x081\x00\x00\x00"},
-
- // Will unmarshal as a []byte.
- {bson.M{"": bson.Binary{0x00, []byte("yo")}},
- "\x05\x00\x02\x00\x00\x00\x00yo"},
- {bson.M{"": bson.Binary{0x02, []byte("old")}},
- "\x05\x00\x07\x00\x00\x00\x02\x03\x00\x00\x00old"},
-
- // No way to preserve the type information here. We might encode as a zero
- // value, but this would mean that pointer values in structs wouldn't be
- // able to correctly distinguish between unset and set to the zero value.
- {bson.M{"": (*byte)(nil)},
- "\x0A\x00"},
-
- // No int types smaller than int32 in BSON. Could encode this as a char,
- // but it would still be ambiguous, take more, and be awkward in Go when
- // loaded without typing information.
- {bson.M{"": byte(8)},
- "\x10\x00\x08\x00\x00\x00"},
-
- // There are no unsigned types in BSON. Will unmarshal as int32 or int64.
- {bson.M{"": uint32(258)},
- "\x10\x00\x02\x01\x00\x00"},
- {bson.M{"": uint64(258)},
- "\x12\x00\x02\x01\x00\x00\x00\x00\x00\x00"},
- {bson.M{"": uint64(258 << 32)},
- "\x12\x00\x00\x00\x00\x00\x02\x01\x00\x00"},
-
- // This will unmarshal as int.
- {bson.M{"": int32(258)},
- "\x10\x00\x02\x01\x00\x00"},
-
- // That's a special case. The unsigned value is too large for an int32,
- // so an int64 is used instead.
- {bson.M{"": uint32(1<<32 - 1)},
- "\x12\x00\xFF\xFF\xFF\xFF\x00\x00\x00\x00"},
- {bson.M{"": uint(1<<32 - 1)},
- "\x12\x00\xFF\xFF\xFF\xFF\x00\x00\x00\x00"},
-}
-
-func (s *S) TestOneWayMarshalItems(c *C) {
- for i, item := range oneWayMarshalItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data),
- Commentf("Failed on item %d", i))
- }
-}
-
-// --------------------------------------------------------------------------
-// Two-way tests for user-defined structures using the samples
-// from bsonspec.org.
-
-type specSample1 struct {
- Hello string
-}
-
-type specSample2 struct {
- BSON []interface{} "BSON"
-}
-
-var structSampleItems = []testItemType{
- {&specSample1{"world"},
- "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"},
- {&specSample2{[]interface{}{"awesome", float64(5.05), 1986}},
- "1\x00\x00\x00\x04BSON\x00&\x00\x00\x00\x020\x00\x08\x00\x00\x00" +
- "awesome\x00\x011\x00333333\x14@\x102\x00\xc2\x07\x00\x00\x00\x00"},
-}
-
-func (s *S) TestMarshalStructSampleItems(c *C) {
- for i, item := range structSampleItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, item.data,
- Commentf("Failed on item %d", i))
- }
-}
-
-func (s *S) TestUnmarshalStructSampleItems(c *C) {
- for _, item := range structSampleItems {
- testUnmarshal(c, item.data, item.obj)
- }
-}
-
-func (s *S) Test64bitInt(c *C) {
- var i int64 = (1 << 31)
- if int(i) > 0 {
- data, err := bson.Marshal(bson.M{"i": int(i)})
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc("\x12i\x00\x00\x00\x00\x80\x00\x00\x00\x00"))
-
- var result struct{ I int }
- err = bson.Unmarshal(data, &result)
- c.Assert(err, IsNil)
- c.Assert(int64(result.I), Equals, i)
- }
-}
-
-// --------------------------------------------------------------------------
-// Generic two-way struct marshaling tests.
-
-var bytevar = byte(8)
-var byteptr = &bytevar
-
-var structItems = []testItemType{
- {&struct{ Ptr *byte }{nil},
- "\x0Aptr\x00"},
- {&struct{ Ptr *byte }{&bytevar},
- "\x10ptr\x00\x08\x00\x00\x00"},
- {&struct{ Ptr **byte }{&byteptr},
- "\x10ptr\x00\x08\x00\x00\x00"},
- {&struct{ Byte byte }{8},
- "\x10byte\x00\x08\x00\x00\x00"},
- {&struct{ Byte byte }{0},
- "\x10byte\x00\x00\x00\x00\x00"},
- {&struct {
- V byte "Tag"
- }{8},
- "\x10Tag\x00\x08\x00\x00\x00"},
- {&struct {
- V *struct {
- Byte byte
- }
- }{&struct{ Byte byte }{8}},
- "\x03v\x00" + "\x0f\x00\x00\x00\x10byte\x00\b\x00\x00\x00\x00"},
- {&struct{ priv byte }{}, ""},
-
- // The order of the dumped fields should be the same in the struct.
- {&struct{ A, C, B, D, F, E *byte }{},
- "\x0Aa\x00\x0Ac\x00\x0Ab\x00\x0Ad\x00\x0Af\x00\x0Ae\x00"},
-
- {&struct{ V bson.Raw }{bson.Raw{0x03, []byte("\x0f\x00\x00\x00\x10byte\x00\b\x00\x00\x00\x00")}},
- "\x03v\x00" + "\x0f\x00\x00\x00\x10byte\x00\b\x00\x00\x00\x00"},
- {&struct{ V bson.Raw }{bson.Raw{0x10, []byte("\x00\x00\x00\x00")}},
- "\x10v\x00" + "\x00\x00\x00\x00"},
-
- // Byte arrays.
- {&struct{ V [2]byte }{[2]byte{'y', 'o'}},
- "\x05v\x00\x02\x00\x00\x00\x00yo"},
-}
-
-func (s *S) TestMarshalStructItems(c *C) {
- for i, item := range structItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data),
- Commentf("Failed on item %d", i))
- }
-}
-
-func (s *S) TestUnmarshalStructItems(c *C) {
- for _, item := range structItems {
- testUnmarshal(c, wrapInDoc(item.data), item.obj)
- }
-}
-
-func (s *S) TestUnmarshalRawStructItems(c *C) {
- for i, item := range structItems {
- raw := bson.Raw{0x03, []byte(wrapInDoc(item.data))}
- zero := makeZeroDoc(item.obj)
- err := raw.Unmarshal(zero)
- c.Assert(err, IsNil)
- c.Assert(zero, DeepEquals, item.obj, Commentf("Failed on item %d: %#v", i, item))
- }
-}
-
-func (s *S) TestUnmarshalRawNil(c *C) {
- // Regression test: shouldn't try to nil out the pointer itself,
- // as it's not settable.
- raw := bson.Raw{0x0A, []byte{}}
- err := raw.Unmarshal(&struct{}{})
- c.Assert(err, IsNil)
-}
-
-// --------------------------------------------------------------------------
-// One-way marshaling tests.
-
-type dOnIface struct {
- D interface{}
-}
-
-type ignoreField struct {
- Before string
- Ignore string `bson:"-"`
- After string
-}
-
-var marshalItems = []testItemType{
- // Ordered document dump. Will unmarshal as a dictionary by default.
- {bson.D{{"a", nil}, {"c", nil}, {"b", nil}, {"d", nil}, {"f", nil}, {"e", true}},
- "\x0Aa\x00\x0Ac\x00\x0Ab\x00\x0Ad\x00\x0Af\x00\x08e\x00\x01"},
- {MyD{{"a", nil}, {"c", nil}, {"b", nil}, {"d", nil}, {"f", nil}, {"e", true}},
- "\x0Aa\x00\x0Ac\x00\x0Ab\x00\x0Ad\x00\x0Af\x00\x08e\x00\x01"},
- {&dOnIface{bson.D{{"a", nil}, {"c", nil}, {"b", nil}, {"d", true}}},
- "\x03d\x00" + wrapInDoc("\x0Aa\x00\x0Ac\x00\x0Ab\x00\x08d\x00\x01")},
-
- {bson.RawD{{"a", bson.Raw{0x0A, nil}}, {"c", bson.Raw{0x0A, nil}}, {"b", bson.Raw{0x08, []byte{0x01}}}},
- "\x0Aa\x00" + "\x0Ac\x00" + "\x08b\x00\x01"},
- {MyRawD{{"a", bson.Raw{0x0A, nil}}, {"c", bson.Raw{0x0A, nil}}, {"b", bson.Raw{0x08, []byte{0x01}}}},
- "\x0Aa\x00" + "\x0Ac\x00" + "\x08b\x00\x01"},
- {&dOnIface{bson.RawD{{"a", bson.Raw{0x0A, nil}}, {"c", bson.Raw{0x0A, nil}}, {"b", bson.Raw{0x08, []byte{0x01}}}}},
- "\x03d\x00" + wrapInDoc("\x0Aa\x00"+"\x0Ac\x00"+"\x08b\x00\x01")},
-
- {&ignoreField{"before", "ignore", "after"},
- "\x02before\x00\a\x00\x00\x00before\x00\x02after\x00\x06\x00\x00\x00after\x00"},
-
- // Marshalling a Raw document does nothing.
- {bson.Raw{0x03, []byte(wrapInDoc("anything"))},
- "anything"},
- {bson.Raw{Data: []byte(wrapInDoc("anything"))},
- "anything"},
-}
-
-func (s *S) TestMarshalOneWayItems(c *C) {
- for _, item := range marshalItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data))
- }
-}
-
-// --------------------------------------------------------------------------
-// One-way unmarshaling tests.
-
-var unmarshalItems = []testItemType{
- // Field is private. Should not attempt to unmarshal it.
- {&struct{ priv byte }{},
- "\x10priv\x00\x08\x00\x00\x00"},
-
- // Wrong casing. Field names are lowercased.
- {&struct{ Byte byte }{},
- "\x10Byte\x00\x08\x00\x00\x00"},
-
- // Ignore non-existing field.
- {&struct{ Byte byte }{9},
- "\x10boot\x00\x08\x00\x00\x00" + "\x10byte\x00\x09\x00\x00\x00"},
-
- // Do not unmarshal on ignored field.
- {&ignoreField{"before", "", "after"},
- "\x02before\x00\a\x00\x00\x00before\x00" +
- "\x02-\x00\a\x00\x00\x00ignore\x00" +
- "\x02after\x00\x06\x00\x00\x00after\x00"},
-
- // Ignore unsuitable types silently.
- {map[string]string{"str": "s"},
- "\x02str\x00\x02\x00\x00\x00s\x00" + "\x10int\x00\x01\x00\x00\x00"},
- {map[string][]int{"array": []int{5, 9}},
- "\x04array\x00" + wrapInDoc("\x100\x00\x05\x00\x00\x00"+"\x021\x00\x02\x00\x00\x00s\x00"+"\x102\x00\x09\x00\x00\x00")},
-
- // Wrong type. Shouldn't init pointer.
- {&struct{ Str *byte }{},
- "\x02str\x00\x02\x00\x00\x00s\x00"},
- {&struct{ Str *struct{ Str string } }{},
- "\x02str\x00\x02\x00\x00\x00s\x00"},
-
- // Ordered document.
- {&struct{ bson.D }{bson.D{{"a", nil}, {"c", nil}, {"b", nil}, {"d", true}}},
- "\x03d\x00" + wrapInDoc("\x0Aa\x00\x0Ac\x00\x0Ab\x00\x08d\x00\x01")},
-
- // Raw document.
- {&bson.Raw{0x03, []byte(wrapInDoc("\x10byte\x00\x08\x00\x00\x00"))},
- "\x10byte\x00\x08\x00\x00\x00"},
-
- // RawD document.
- {&struct{ bson.RawD }{bson.RawD{{"a", bson.Raw{0x0A, []byte{}}}, {"c", bson.Raw{0x0A, []byte{}}}, {"b", bson.Raw{0x08, []byte{0x01}}}}},
- "\x03rawd\x00" + wrapInDoc("\x0Aa\x00\x0Ac\x00\x08b\x00\x01")},
-
- // Decode old binary.
- {bson.M{"_": []byte("old")},
- "\x05_\x00\x07\x00\x00\x00\x02\x03\x00\x00\x00old"},
-
- // Decode old binary without length. According to the spec, this shouldn't happen.
- {bson.M{"_": []byte("old")},
- "\x05_\x00\x03\x00\x00\x00\x02old"},
-
- // Decode a doc within a doc in to a slice within a doc; shouldn't error
- {&struct{ Foo []string }{},
- "\x03\x66\x6f\x6f\x00\x05\x00\x00\x00\x00"},
-}
-
-func (s *S) TestUnmarshalOneWayItems(c *C) {
- for _, item := range unmarshalItems {
- testUnmarshal(c, wrapInDoc(item.data), item.obj)
- }
-}
-
-func (s *S) TestUnmarshalNilInStruct(c *C) {
- // Nil is the default value, so we need to ensure it's indeed being set.
- b := byte(1)
- v := &struct{ Ptr *byte }{&b}
- err := bson.Unmarshal([]byte(wrapInDoc("\x0Aptr\x00")), v)
- c.Assert(err, IsNil)
- c.Assert(v, DeepEquals, &struct{ Ptr *byte }{nil})
-}
-
-// --------------------------------------------------------------------------
-// Marshalling error cases.
-
-type structWithDupKeys struct {
- Name byte
- Other byte "name" // Tag should precede.
-}
-
-var marshalErrorItems = []testItemType{
- {bson.M{"": uint64(1 << 63)},
- "BSON has no uint64 type, and value is too large to fit correctly in an int64"},
- {bson.M{"": bson.ObjectId("tooshort")},
- "ObjectIDs must be exactly 12 bytes long \\(got 8\\)"},
- {int64(123),
- "Can't marshal int64 as a BSON document"},
- {bson.M{"": 1i},
- "Can't marshal complex128 in a BSON document"},
- {&structWithDupKeys{},
- "Duplicated key 'name' in struct bson_test.structWithDupKeys"},
- {bson.Raw{0xA, []byte{}},
- "Attempted to marshal Raw kind 10 as a document"},
- {bson.Raw{0x3, []byte{}},
- "Attempted to marshal empty Raw document"},
- {bson.M{"w": bson.Raw{0x3, []byte{}}},
- "Attempted to marshal empty Raw document"},
- {&inlineCantPtr{&struct{ A, B int }{1, 2}},
- "Option ,inline needs a struct value or map field"},
- {&inlineDupName{1, struct{ A, B int }{2, 3}},
- "Duplicated key 'a' in struct bson_test.inlineDupName"},
- {&inlineDupMap{},
- "Multiple ,inline maps in struct bson_test.inlineDupMap"},
- {&inlineBadKeyMap{},
- "Option ,inline needs a map with string keys in struct bson_test.inlineBadKeyMap"},
- {&inlineMap{A: 1, M: map[string]interface{}{"a": 1}},
- `Can't have key "a" in inlined map; conflicts with struct field`},
-}
-
-func (s *S) TestMarshalErrorItems(c *C) {
- for _, item := range marshalErrorItems {
- data, err := bson.Marshal(item.obj)
- c.Assert(err, ErrorMatches, item.data)
- c.Assert(data, IsNil)
- }
-}
-
-// --------------------------------------------------------------------------
-// Unmarshalling error cases.
-
-type unmarshalErrorType struct {
- obj interface{}
- data string
- error string
-}
-
-var unmarshalErrorItems = []unmarshalErrorType{
- // Tag name conflicts with existing parameter.
- {&structWithDupKeys{},
- "\x10name\x00\x08\x00\x00\x00",
- "Duplicated key 'name' in struct bson_test.structWithDupKeys"},
-
- // Non-string map key.
- {map[int]interface{}{},
- "\x10name\x00\x08\x00\x00\x00",
- "BSON map must have string keys. Got: map\\[int\\]interface \\{\\}"},
-
- {nil,
- "\xEEname\x00",
- "Unknown element kind \\(0xEE\\)"},
-
- {struct{ Name bool }{},
- "\x10name\x00\x08\x00\x00\x00",
- "Unmarshal can't deal with struct values. Use a pointer."},
-
- {123,
- "\x10name\x00\x08\x00\x00\x00",
- "Unmarshal needs a map or a pointer to a struct."},
-
- {nil,
- "\x08\x62\x00\x02",
- "encoded boolean must be 1 or 0, found 2"},
-}
-
-func (s *S) TestUnmarshalErrorItems(c *C) {
- for _, item := range unmarshalErrorItems {
- data := []byte(wrapInDoc(item.data))
- var value interface{}
- switch reflect.ValueOf(item.obj).Kind() {
- case reflect.Map, reflect.Ptr:
- value = makeZeroDoc(item.obj)
- case reflect.Invalid:
- value = bson.M{}
- default:
- value = item.obj
- }
- err := bson.Unmarshal(data, value)
- c.Assert(err, ErrorMatches, item.error)
- }
-}
-
-type unmarshalRawErrorType struct {
- obj interface{}
- raw bson.Raw
- error string
-}
-
-var unmarshalRawErrorItems = []unmarshalRawErrorType{
- // Tag name conflicts with existing parameter.
- {&structWithDupKeys{},
- bson.Raw{0x03, []byte("\x10byte\x00\x08\x00\x00\x00")},
- "Duplicated key 'name' in struct bson_test.structWithDupKeys"},
-
- {&struct{}{},
- bson.Raw{0xEE, []byte{}},
- "Unknown element kind \\(0xEE\\)"},
-
- {struct{ Name bool }{},
- bson.Raw{0x10, []byte("\x08\x00\x00\x00")},
- "Raw Unmarshal can't deal with struct values. Use a pointer."},
-
- {123,
- bson.Raw{0x10, []byte("\x08\x00\x00\x00")},
- "Raw Unmarshal needs a map or a valid pointer."},
-}
-
-func (s *S) TestUnmarshalRawErrorItems(c *C) {
- for i, item := range unmarshalRawErrorItems {
- err := item.raw.Unmarshal(item.obj)
- c.Assert(err, ErrorMatches, item.error, Commentf("Failed on item %d: %#v\n", i, item))
- }
-}
-
-var corruptedData = []string{
- "\x04\x00\x00\x00\x00", // Document shorter than minimum
- "\x06\x00\x00\x00\x00", // Not enough data
- "\x05\x00\x00", // Broken length
- "\x05\x00\x00\x00\xff", // Corrupted termination
- "\x0A\x00\x00\x00\x0Aooop\x00", // Unfinished C string
-
- // Array end past end of string (s[2]=0x07 is correct)
- wrapInDoc("\x04\x00\x09\x00\x00\x00\x0A\x00\x00"),
-
- // Array end within string, but past acceptable.
- wrapInDoc("\x04\x00\x08\x00\x00\x00\x0A\x00\x00"),
-
- // Document end within string, but past acceptable.
- wrapInDoc("\x03\x00\x08\x00\x00\x00\x0A\x00\x00"),
-
- // String with corrupted end.
- wrapInDoc("\x02\x00\x03\x00\x00\x00yo\xFF"),
-
- // String with negative length (issue #116).
- "\x0c\x00\x00\x00\x02x\x00\xff\xff\xff\xff\x00",
-
- // String with zero length (must include trailing '\x00')
- "\x0c\x00\x00\x00\x02x\x00\x00\x00\x00\x00\x00",
-
- // Binary with negative length.
- "\r\x00\x00\x00\x05x\x00\xff\xff\xff\xff\x00\x00",
-}
-
-func (s *S) TestUnmarshalMapDocumentTooShort(c *C) {
- for _, data := range corruptedData {
- err := bson.Unmarshal([]byte(data), bson.M{})
- c.Assert(err, ErrorMatches, "Document is corrupted")
-
- err = bson.Unmarshal([]byte(data), &struct{}{})
- c.Assert(err, ErrorMatches, "Document is corrupted")
- }
-}
-
-// --------------------------------------------------------------------------
-// Setter test cases.
-
-var setterResult = map[string]error{}
-
-type setterType struct {
- received interface{}
-}
-
-func (o *setterType) SetBSON(raw bson.Raw) error {
- err := raw.Unmarshal(&o.received)
- if err != nil {
- panic("The panic:" + err.Error())
- }
- if s, ok := o.received.(string); ok {
- if result, ok := setterResult[s]; ok {
- return result
- }
- }
- return nil
-}
-
-type ptrSetterDoc struct {
- Field *setterType "_"
-}
-
-type valSetterDoc struct {
- Field setterType "_"
-}
-
-func (s *S) TestUnmarshalAllItemsWithPtrSetter(c *C) {
- for _, item := range allItems {
- for i := 0; i != 2; i++ {
- var field *setterType
- if i == 0 {
- obj := &ptrSetterDoc{}
- err := bson.Unmarshal([]byte(wrapInDoc(item.data)), obj)
- c.Assert(err, IsNil)
- field = obj.Field
- } else {
- obj := &valSetterDoc{}
- err := bson.Unmarshal([]byte(wrapInDoc(item.data)), obj)
- c.Assert(err, IsNil)
- field = &obj.Field
- }
- if item.data == "" {
- // Nothing to unmarshal. Should be untouched.
- if i == 0 {
- c.Assert(field, IsNil)
- } else {
- c.Assert(field.received, IsNil)
- }
- } else {
- expected := item.obj.(bson.M)["_"]
- c.Assert(field, NotNil, Commentf("Pointer not initialized (%#v)", expected))
- c.Assert(field.received, DeepEquals, expected)
- }
- }
- }
-}
-
-func (s *S) TestUnmarshalWholeDocumentWithSetter(c *C) {
- obj := &setterType{}
- err := bson.Unmarshal([]byte(sampleItems[0].data), obj)
- c.Assert(err, IsNil)
- c.Assert(obj.received, DeepEquals, bson.M{"hello": "world"})
-}
-
-func (s *S) TestUnmarshalSetterOmits(c *C) {
- setterResult["2"] = &bson.TypeError{}
- setterResult["4"] = &bson.TypeError{}
- defer func() {
- delete(setterResult, "2")
- delete(setterResult, "4")
- }()
-
- m := map[string]*setterType{}
- data := wrapInDoc("\x02abc\x00\x02\x00\x00\x001\x00" +
- "\x02def\x00\x02\x00\x00\x002\x00" +
- "\x02ghi\x00\x02\x00\x00\x003\x00" +
- "\x02jkl\x00\x02\x00\x00\x004\x00")
- err := bson.Unmarshal([]byte(data), m)
- c.Assert(err, IsNil)
- c.Assert(m["abc"], NotNil)
- c.Assert(m["def"], IsNil)
- c.Assert(m["ghi"], NotNil)
- c.Assert(m["jkl"], IsNil)
-
- c.Assert(m["abc"].received, Equals, "1")
- c.Assert(m["ghi"].received, Equals, "3")
-}
-
-func (s *S) TestUnmarshalSetterErrors(c *C) {
- boom := errors.New("BOOM")
- setterResult["2"] = boom
- defer delete(setterResult, "2")
-
- m := map[string]*setterType{}
- data := wrapInDoc("\x02abc\x00\x02\x00\x00\x001\x00" +
- "\x02def\x00\x02\x00\x00\x002\x00" +
- "\x02ghi\x00\x02\x00\x00\x003\x00")
- err := bson.Unmarshal([]byte(data), m)
- c.Assert(err, Equals, boom)
- c.Assert(m["abc"], NotNil)
- c.Assert(m["def"], IsNil)
- c.Assert(m["ghi"], IsNil)
-
- c.Assert(m["abc"].received, Equals, "1")
-}
-
-func (s *S) TestDMap(c *C) {
- d := bson.D{{"a", 1}, {"b", 2}}
- c.Assert(d.Map(), DeepEquals, bson.M{"a": 1, "b": 2})
-}
-
-func (s *S) TestUnmarshalSetterSetZero(c *C) {
- setterResult["foo"] = bson.SetZero
- defer delete(setterResult, "field")
-
- data, err := bson.Marshal(bson.M{"field": "foo"})
- c.Assert(err, IsNil)
-
- m := map[string]*setterType{}
- err = bson.Unmarshal([]byte(data), m)
- c.Assert(err, IsNil)
-
- value, ok := m["field"]
- c.Assert(ok, Equals, true)
- c.Assert(value, IsNil)
-}
-
-// --------------------------------------------------------------------------
-// Getter test cases.
-
-type typeWithGetter struct {
- result interface{}
- err error
-}
-
-func (t *typeWithGetter) GetBSON() (interface{}, error) {
- if t == nil {
- return "<value is nil>", nil
- }
- return t.result, t.err
-}
-
-type docWithGetterField struct {
- Field *typeWithGetter "_"
-}
-
-func (s *S) TestMarshalAllItemsWithGetter(c *C) {
- for i, item := range allItems {
- if item.data == "" {
- continue
- }
- obj := &docWithGetterField{}
- obj.Field = &typeWithGetter{result: item.obj.(bson.M)["_"]}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, wrapInDoc(item.data),
- Commentf("Failed on item #%d", i))
- }
-}
-
-func (s *S) TestMarshalWholeDocumentWithGetter(c *C) {
- obj := &typeWithGetter{result: sampleItems[0].obj}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, sampleItems[0].data)
-}
-
-func (s *S) TestGetterErrors(c *C) {
- e := errors.New("oops")
-
- obj1 := &docWithGetterField{}
- obj1.Field = &typeWithGetter{sampleItems[0].obj, e}
- data, err := bson.Marshal(obj1)
- c.Assert(err, ErrorMatches, "oops")
- c.Assert(data, IsNil)
-
- obj2 := &typeWithGetter{sampleItems[0].obj, e}
- data, err = bson.Marshal(obj2)
- c.Assert(err, ErrorMatches, "oops")
- c.Assert(data, IsNil)
-}
-
-type intGetter int64
-
-func (t intGetter) GetBSON() (interface{}, error) {
- return int64(t), nil
-}
-
-type typeWithIntGetter struct {
- V intGetter ",minsize"
-}
-
-func (s *S) TestMarshalShortWithGetter(c *C) {
- obj := typeWithIntGetter{42}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- m := bson.M{}
- err = bson.Unmarshal(data, m)
- c.Assert(err, IsNil)
- c.Assert(m["v"], Equals, 42)
-}
-
-func (s *S) TestMarshalWithGetterNil(c *C) {
- obj := docWithGetterField{}
- data, err := bson.Marshal(obj)
- c.Assert(err, IsNil)
- m := bson.M{}
- err = bson.Unmarshal(data, m)
- c.Assert(err, IsNil)
- c.Assert(m, DeepEquals, bson.M{"_": "<value is nil>"})
-}
-
-// --------------------------------------------------------------------------
-// Cross-type conversion tests.
-
-type crossTypeItem struct {
- obj1 interface{}
- obj2 interface{}
-}
-
-type condStr struct {
- V string ",omitempty"
-}
-type condStrNS struct {
- V string `a:"A" bson:",omitempty" b:"B"`
-}
-type condBool struct {
- V bool ",omitempty"
-}
-type condInt struct {
- V int ",omitempty"
-}
-type condUInt struct {
- V uint ",omitempty"
-}
-type condFloat struct {
- V float64 ",omitempty"
-}
-type condIface struct {
- V interface{} ",omitempty"
-}
-type condPtr struct {
- V *bool ",omitempty"
-}
-type condSlice struct {
- V []string ",omitempty"
-}
-type condMap struct {
- V map[string]int ",omitempty"
-}
-type namedCondStr struct {
- V string "myv,omitempty"
-}
-type condTime struct {
- V time.Time ",omitempty"
-}
-type condStruct struct {
- V struct{ A []int } ",omitempty"
-}
-type condRaw struct {
- V bson.Raw ",omitempty"
-}
-
-type shortInt struct {
- V int64 ",minsize"
-}
-type shortUint struct {
- V uint64 ",minsize"
-}
-type shortIface struct {
- V interface{} ",minsize"
-}
-type shortPtr struct {
- V *int64 ",minsize"
-}
-type shortNonEmptyInt struct {
- V int64 ",minsize,omitempty"
-}
-
-type inlineInt struct {
- V struct{ A, B int } ",inline"
-}
-type inlineCantPtr struct {
- V *struct{ A, B int } ",inline"
-}
-type inlineDupName struct {
- A int
- V struct{ A, B int } ",inline"
-}
-type inlineMap struct {
- A int
- M map[string]interface{} ",inline"
-}
-type inlineMapInt struct {
- A int
- M map[string]int ",inline"
-}
-type inlineMapMyM struct {
- A int
- M MyM ",inline"
-}
-type inlineDupMap struct {
- M1 map[string]interface{} ",inline"
- M2 map[string]interface{} ",inline"
-}
-type inlineBadKeyMap struct {
- M map[int]int ",inline"
-}
-type inlineUnexported struct {
- M map[string]interface{} ",inline"
- unexported ",inline"
-}
-type unexported struct {
- A int
-}
-
-type getterSetterD bson.D
-
-func (s getterSetterD) GetBSON() (interface{}, error) {
- if len(s) == 0 {
- return bson.D{}, nil
- }
- return bson.D(s[:len(s)-1]), nil
-}
-
-func (s *getterSetterD) SetBSON(raw bson.Raw) error {
- var doc bson.D
- err := raw.Unmarshal(&doc)
- doc = append(doc, bson.DocElem{"suffix", true})
- *s = getterSetterD(doc)
- return err
-}
-
-type getterSetterInt int
-
-func (i getterSetterInt) GetBSON() (interface{}, error) {
- return bson.D{{"a", int(i)}}, nil
-}
-
-func (i *getterSetterInt) SetBSON(raw bson.Raw) error {
- var doc struct{ A int }
- err := raw.Unmarshal(&doc)
- *i = getterSetterInt(doc.A)
- return err
-}
-
-type ifaceType interface {
- Hello()
-}
-
-type ifaceSlice []ifaceType
-
-func (s *ifaceSlice) SetBSON(raw bson.Raw) error {
- var ns []int
- if err := raw.Unmarshal(&ns); err != nil {
- return err
- }
- *s = make(ifaceSlice, ns[0])
- return nil
-}
-
-func (s ifaceSlice) GetBSON() (interface{}, error) {
- return []int{len(s)}, nil
-}
-
-type (
- MyString string
- MyBytes []byte
- MyBool bool
- MyD []bson.DocElem
- MyRawD []bson.RawDocElem
- MyM map[string]interface{}
-)
-
-var (
- truevar = true
- falsevar = false
-
- int64var = int64(42)
- int64ptr = &int64var
- intvar = int(42)
- intptr = &intvar
-
- gsintvar = getterSetterInt(42)
-)
-
-func parseURL(s string) *url.URL {
- u, err := url.Parse(s)
- if err != nil {
- panic(err)
- }
- return u
-}
-
-// That's a pretty fun test. It will dump the first item, generate a zero
-// value equivalent to the second one, load the dumped data onto it, and then
-// verify that the resulting value is deep-equal to the untouched second value.
-// Then, it will do the same in the *opposite* direction!
-var twoWayCrossItems = []crossTypeItem{
- // int<=>int
- {&struct{ I int }{42}, &struct{ I int8 }{42}},
- {&struct{ I int }{42}, &struct{ I int32 }{42}},
- {&struct{ I int }{42}, &struct{ I int64 }{42}},
- {&struct{ I int8 }{42}, &struct{ I int32 }{42}},
- {&struct{ I int8 }{42}, &struct{ I int64 }{42}},
- {&struct{ I int32 }{42}, &struct{ I int64 }{42}},
-
- // uint<=>uint
- {&struct{ I uint }{42}, &struct{ I uint8 }{42}},
- {&struct{ I uint }{42}, &struct{ I uint32 }{42}},
- {&struct{ I uint }{42}, &struct{ I uint64 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I uint32 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I uint64 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I uint64 }{42}},
-
- // float32<=>float64
- {&struct{ I float32 }{42}, &struct{ I float64 }{42}},
-
- // int<=>uint
- {&struct{ I uint }{42}, &struct{ I int }{42}},
- {&struct{ I uint }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint }{42}, &struct{ I int64 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint8 }{42}, &struct{ I int64 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint32 }{42}, &struct{ I int64 }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int8 }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int32 }{42}},
- {&struct{ I uint64 }{42}, &struct{ I int64 }{42}},
-
- // int <=> float
- {&struct{ I int }{42}, &struct{ I float64 }{42}},
-
- // int <=> bool
- {&struct{ I int }{1}, &struct{ I bool }{true}},
- {&struct{ I int }{0}, &struct{ I bool }{false}},
-
- // uint <=> float64
- {&struct{ I uint }{42}, &struct{ I float64 }{42}},
-
- // uint <=> bool
- {&struct{ I uint }{1}, &struct{ I bool }{true}},
- {&struct{ I uint }{0}, &struct{ I bool }{false}},
-
- // float64 <=> bool
- {&struct{ I float64 }{1}, &struct{ I bool }{true}},
- {&struct{ I float64 }{0}, &struct{ I bool }{false}},
-
- // string <=> string and string <=> []byte
- {&struct{ S []byte }{[]byte("abc")}, &struct{ S string }{"abc"}},
- {&struct{ S []byte }{[]byte("def")}, &struct{ S bson.Symbol }{"def"}},
- {&struct{ S string }{"ghi"}, &struct{ S bson.Symbol }{"ghi"}},
-
- // map <=> struct
- {&struct {
- A struct {
- B, C int
- }
- }{struct{ B, C int }{1, 2}},
- map[string]map[string]int{"a": map[string]int{"b": 1, "c": 2}}},
-
- {&struct{ A bson.Symbol }{"abc"}, map[string]string{"a": "abc"}},
- {&struct{ A bson.Symbol }{"abc"}, map[string][]byte{"a": []byte("abc")}},
- {&struct{ A []byte }{[]byte("abc")}, map[string]string{"a": "abc"}},
- {&struct{ A uint }{42}, map[string]int{"a": 42}},
- {&struct{ A uint }{42}, map[string]float64{"a": 42}},
- {&struct{ A uint }{1}, map[string]bool{"a": true}},
- {&struct{ A int }{42}, map[string]uint{"a": 42}},
- {&struct{ A int }{42}, map[string]float64{"a": 42}},
- {&struct{ A int }{1}, map[string]bool{"a": true}},
- {&struct{ A float64 }{42}, map[string]float32{"a": 42}},
- {&struct{ A float64 }{42}, map[string]int{"a": 42}},
- {&struct{ A float64 }{42}, map[string]uint{"a": 42}},
- {&struct{ A float64 }{1}, map[string]bool{"a": true}},
- {&struct{ A bool }{true}, map[string]int{"a": 1}},
- {&struct{ A bool }{true}, map[string]uint{"a": 1}},
- {&struct{ A bool }{true}, map[string]float64{"a": 1}},
- {&struct{ A **byte }{&byteptr}, map[string]byte{"a": 8}},
-
- // url.URL <=> string
- {&struct{ URL *url.URL }{parseURL("h://e.c/p")}, map[string]string{"url": "h://e.c/p"}},
- {&struct{ URL url.URL }{*parseURL("h://e.c/p")}, map[string]string{"url": "h://e.c/p"}},
-
- // Slices
- {&struct{ S []int }{[]int{1, 2, 3}}, map[string][]int{"s": []int{1, 2, 3}}},
- {&struct{ S *[]int }{&[]int{1, 2, 3}}, map[string][]int{"s": []int{1, 2, 3}}},
-
- // Conditionals
- {&condBool{true}, map[string]bool{"v": true}},
- {&condBool{}, map[string]bool{}},
- {&condInt{1}, map[string]int{"v": 1}},
- {&condInt{}, map[string]int{}},
- {&condUInt{1}, map[string]uint{"v": 1}},
- {&condUInt{}, map[string]uint{}},
- {&condFloat{}, map[string]int{}},
- {&condStr{"yo"}, map[string]string{"v": "yo"}},
- {&condStr{}, map[string]string{}},
- {&condStrNS{"yo"}, map[string]string{"v": "yo"}},
- {&condStrNS{}, map[string]string{}},
- {&condSlice{[]string{"yo"}}, map[string][]string{"v": []string{"yo"}}},
- {&condSlice{}, map[string][]string{}},
- {&condMap{map[string]int{"k": 1}}, bson.M{"v": bson.M{"k": 1}}},
- {&condMap{}, map[string][]string{}},
- {&condIface{"yo"}, map[string]string{"v": "yo"}},
- {&condIface{""}, map[string]string{"v": ""}},
- {&condIface{}, map[string]string{}},
- {&condPtr{&truevar}, map[string]bool{"v": true}},
- {&condPtr{&falsevar}, map[string]bool{"v": false}},
- {&condPtr{}, map[string]string{}},
-
- {&condTime{time.Unix(123456789, 123e6)}, map[string]time.Time{"v": time.Unix(123456789, 123e6)}},
- {&condTime{}, map[string]string{}},
-
- {&condStruct{struct{ A []int }{[]int{1}}}, bson.M{"v": bson.M{"a": []interface{}{1}}}},
- {&condStruct{struct{ A []int }{}}, bson.M{}},
-
- {&condRaw{bson.Raw{Kind: 0x0A, Data: []byte{}}}, bson.M{"v": nil}},
- {&condRaw{bson.Raw{Kind: 0x00}}, bson.M{}},
-
- {&namedCondStr{"yo"}, map[string]string{"myv": "yo"}},
- {&namedCondStr{}, map[string]string{}},
-
- {&shortInt{1}, map[string]interface{}{"v": 1}},
- {&shortInt{1 << 30}, map[string]interface{}{"v": 1 << 30}},
- {&shortInt{1 << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortUint{1 << 30}, map[string]interface{}{"v": 1 << 30}},
- {&shortUint{1 << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortIface{int64(1) << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortPtr{int64ptr}, map[string]interface{}{"v": intvar}},
-
- {&shortNonEmptyInt{1}, map[string]interface{}{"v": 1}},
- {&shortNonEmptyInt{1 << 31}, map[string]interface{}{"v": int64(1 << 31)}},
- {&shortNonEmptyInt{}, map[string]interface{}{}},
-
- {&inlineInt{struct{ A, B int }{1, 2}}, map[string]interface{}{"a": 1, "b": 2}},
- {&inlineMap{A: 1, M: map[string]interface{}{"b": 2}}, map[string]interface{}{"a": 1, "b": 2}},
- {&inlineMap{A: 1, M: nil}, map[string]interface{}{"a": 1}},
- {&inlineMapInt{A: 1, M: map[string]int{"b": 2}}, map[string]int{"a": 1, "b": 2}},
- {&inlineMapInt{A: 1, M: nil}, map[string]int{"a": 1}},
- {&inlineMapMyM{A: 1, M: MyM{"b": MyM{"c": 3}}}, map[string]interface{}{"a": 1, "b": map[string]interface{}{"c": 3}}},
- {&inlineUnexported{M: map[string]interface{}{"b": 1}, unexported: unexported{A: 2}}, map[string]interface{}{"b": 1, "a": 2}},
-
- // []byte <=> Binary
- {&struct{ B []byte }{[]byte("abc")}, map[string]bson.Binary{"b": bson.Binary{Data: []byte("abc")}}},
-
- // []byte <=> MyBytes
- {&struct{ B MyBytes }{[]byte("abc")}, map[string]string{"b": "abc"}},
- {&struct{ B MyBytes }{[]byte{}}, map[string]string{"b": ""}},
- {&struct{ B MyBytes }{}, map[string]bool{}},
- {&struct{ B []byte }{[]byte("abc")}, map[string]MyBytes{"b": []byte("abc")}},
-
- // bool <=> MyBool
- {&struct{ B MyBool }{true}, map[string]bool{"b": true}},
- {&struct{ B MyBool }{}, map[string]bool{"b": false}},
- {&struct{ B MyBool }{}, map[string]string{}},
- {&struct{ B bool }{}, map[string]MyBool{"b": false}},
-
- // arrays
- {&struct{ V [2]int }{[...]int{1, 2}}, map[string][2]int{"v": [2]int{1, 2}}},
- {&struct{ V [2]byte }{[...]byte{1, 2}}, map[string][2]byte{"v": [2]byte{1, 2}}},
-
- // zero time
- {&struct{ V time.Time }{}, map[string]interface{}{"v": time.Time{}}},
-
- // zero time + 1 second + 1 millisecond; overflows int64 as nanoseconds
- {&struct{ V time.Time }{time.Unix(-62135596799, 1e6).Local()},
- map[string]interface{}{"v": time.Unix(-62135596799, 1e6).Local()}},
-
- // bson.D <=> []DocElem
- {&bson.D{{"a", bson.D{{"b", 1}, {"c", 2}}}}, &bson.D{{"a", bson.D{{"b", 1}, {"c", 2}}}}},
- {&bson.D{{"a", bson.D{{"b", 1}, {"c", 2}}}}, &MyD{{"a", MyD{{"b", 1}, {"c", 2}}}}},
- {&struct{ V MyD }{MyD{{"a", 1}}}, &bson.D{{"v", bson.D{{"a", 1}}}}},
-
- // bson.RawD <=> []RawDocElem
- {&bson.RawD{{"a", bson.Raw{0x08, []byte{0x01}}}}, &bson.RawD{{"a", bson.Raw{0x08, []byte{0x01}}}}},
- {&bson.RawD{{"a", bson.Raw{0x08, []byte{0x01}}}}, &MyRawD{{"a", bson.Raw{0x08, []byte{0x01}}}}},
-
- // bson.M <=> map
- {bson.M{"a": bson.M{"b": 1, "c": 2}}, MyM{"a": MyM{"b": 1, "c": 2}}},
- {bson.M{"a": bson.M{"b": 1, "c": 2}}, map[string]interface{}{"a": map[string]interface{}{"b": 1, "c": 2}}},
-
- // bson.M <=> map[MyString]
- {bson.M{"a": bson.M{"b": 1, "c": 2}}, map[MyString]interface{}{"a": map[MyString]interface{}{"b": 1, "c": 2}}},
-
- // json.Number <=> int64, float64
- {&struct{ N json.Number }{"5"}, map[string]interface{}{"n": int64(5)}},
- {&struct{ N json.Number }{"5.05"}, map[string]interface{}{"n": 5.05}},
- {&struct{ N json.Number }{"9223372036854776000"}, map[string]interface{}{"n": float64(1 << 63)}},
-
- // bson.D <=> non-struct getter/setter
- {&bson.D{{"a", 1}}, &getterSetterD{{"a", 1}, {"suffix", true}}},
- {&bson.D{{"a", 42}}, &gsintvar},
-
- // Interface slice setter.
- {&struct{ V ifaceSlice }{ifaceSlice{nil, nil, nil}}, bson.M{"v": []interface{}{3}}},
-}
-
-// Same thing, but only one way (obj1 => obj2).
-var oneWayCrossItems = []crossTypeItem{
- // map <=> struct
- {map[string]interface{}{"a": 1, "b": "2", "c": 3}, map[string]int{"a": 1, "c": 3}},
-
- // inline map elides badly typed values
- {map[string]interface{}{"a": 1, "b": "2", "c": 3}, &inlineMapInt{A: 1, M: map[string]int{"c": 3}}},
-
- // Can't decode int into struct.
- {bson.M{"a": bson.M{"b": 2}}, &struct{ A bool }{}},
-
- // Would get decoded into a int32 too in the opposite direction.
- {&shortIface{int64(1) << 30}, map[string]interface{}{"v": 1 << 30}},
-
- // Ensure omitempty on struct with private fields works properly.
- {&struct {
- V struct{ v time.Time } ",omitempty"
- }{}, map[string]interface{}{}},
-
- // Attempt to marshal slice into RawD (issue #120).
- {bson.M{"x": []int{1, 2, 3}}, &struct{ X bson.RawD }{}},
-}
-
-func testCrossPair(c *C, dump interface{}, load interface{}) {
- c.Logf("Dump: %#v", dump)
- c.Logf("Load: %#v", load)
- zero := makeZeroDoc(load)
- data, err := bson.Marshal(dump)
- c.Assert(err, IsNil)
- c.Logf("Dumped: %#v", string(data))
- err = bson.Unmarshal(data, zero)
- c.Assert(err, IsNil)
- c.Logf("Loaded: %#v", zero)
- c.Assert(zero, DeepEquals, load)
-}
-
-func (s *S) TestTwoWayCrossPairs(c *C) {
- for _, item := range twoWayCrossItems {
- testCrossPair(c, item.obj1, item.obj2)
- testCrossPair(c, item.obj2, item.obj1)
- }
-}
-
-func (s *S) TestOneWayCrossPairs(c *C) {
- for _, item := range oneWayCrossItems {
- testCrossPair(c, item.obj1, item.obj2)
- }
-}
-
-// --------------------------------------------------------------------------
-// ObjectId hex representation test.
-
-func (s *S) TestObjectIdHex(c *C) {
- id := bson.ObjectIdHex("4d88e15b60f486e428412dc9")
- c.Assert(id.String(), Equals, `ObjectIdHex("4d88e15b60f486e428412dc9")`)
- c.Assert(id.Hex(), Equals, "4d88e15b60f486e428412dc9")
-}
-
-func (s *S) TestIsObjectIdHex(c *C) {
- test := []struct {
- id string
- valid bool
- }{
- {"4d88e15b60f486e428412dc9", true},
- {"4d88e15b60f486e428412dc", false},
- {"4d88e15b60f486e428412dc9e", false},
- {"4d88e15b60f486e428412dcx", false},
- }
- for _, t := range test {
- c.Assert(bson.IsObjectIdHex(t.id), Equals, t.valid)
- }
-}
-
-// --------------------------------------------------------------------------
-// ObjectId parts extraction tests.
-
-type objectIdParts struct {
- id bson.ObjectId
- timestamp int64
- machine []byte
- pid uint16
- counter int32
-}
-
-var objectIds = []objectIdParts{
- objectIdParts{
- bson.ObjectIdHex("4d88e15b60f486e428412dc9"),
- 1300816219,
- []byte{0x60, 0xf4, 0x86},
- 0xe428,
- 4271561,
- },
- objectIdParts{
- bson.ObjectIdHex("000000000000000000000000"),
- 0,
- []byte{0x00, 0x00, 0x00},
- 0x0000,
- 0,
- },
- objectIdParts{
- bson.ObjectIdHex("00000000aabbccddee000001"),
- 0,
- []byte{0xaa, 0xbb, 0xcc},
- 0xddee,
- 1,
- },
-}
-
-func (s *S) TestObjectIdPartsExtraction(c *C) {
- for i, v := range objectIds {
- t := time.Unix(v.timestamp, 0)
- c.Assert(v.id.Time(), Equals, t, Commentf("#%d Wrong timestamp value", i))
- c.Assert(v.id.Machine(), DeepEquals, v.machine, Commentf("#%d Wrong machine id value", i))
- c.Assert(v.id.Pid(), Equals, v.pid, Commentf("#%d Wrong pid value", i))
- c.Assert(v.id.Counter(), Equals, v.counter, Commentf("#%d Wrong counter value", i))
- }
-}
-
-func (s *S) TestNow(c *C) {
- before := time.Now()
- time.Sleep(1e6)
- now := bson.Now()
- time.Sleep(1e6)
- after := time.Now()
- c.Assert(now.After(before) && now.Before(after), Equals, true, Commentf("now=%s, before=%s, after=%s", now, before, after))
-}
-
-// --------------------------------------------------------------------------
-// ObjectId generation tests.
-
-func (s *S) TestNewObjectId(c *C) {
- // Generate 10 ids
- ids := make([]bson.ObjectId, 10)
- for i := 0; i < 10; i++ {
- ids[i] = bson.NewObjectId()
- }
- for i := 1; i < 10; i++ {
- prevId := ids[i-1]
- id := ids[i]
- // Test for uniqueness among all other 9 generated ids
- for j, tid := range ids {
- if j != i {
- c.Assert(id, Not(Equals), tid, Commentf("Generated ObjectId is not unique"))
- }
- }
- // Check that timestamp was incremented and is within 30 seconds of the previous one
- secs := id.Time().Sub(prevId.Time()).Seconds()
- c.Assert((secs >= 0 && secs <= 30), Equals, true, Commentf("Wrong timestamp in generated ObjectId"))
- // Check that machine ids are the same
- c.Assert(id.Machine(), DeepEquals, prevId.Machine())
- // Check that pids are the same
- c.Assert(id.Pid(), Equals, prevId.Pid())
- // Test for proper increment
- delta := int(id.Counter() - prevId.Counter())
- c.Assert(delta, Equals, 1, Commentf("Wrong increment in generated ObjectId"))
- }
-}
-
-func (s *S) TestNewObjectIdWithTime(c *C) {
- t := time.Unix(12345678, 0)
- id := bson.NewObjectIdWithTime(t)
- c.Assert(id.Time(), Equals, t)
- c.Assert(id.Machine(), DeepEquals, []byte{0x00, 0x00, 0x00})
- c.Assert(int(id.Pid()), Equals, 0)
- c.Assert(int(id.Counter()), Equals, 0)
-}
-
-// --------------------------------------------------------------------------
-// ObjectId JSON marshalling.
-
-type jsonType struct {
- Id bson.ObjectId
-}
-
-var jsonIdTests = []struct {
- value jsonType
- json string
- marshal bool
- unmarshal bool
- error string
-}{{
- value: jsonType{Id: bson.ObjectIdHex("4d88e15b60f486e428412dc9")},
- json: `{"Id":"4d88e15b60f486e428412dc9"}`,
- marshal: true,
- unmarshal: true,
-}, {
- value: jsonType{},
- json: `{"Id":""}`,
- marshal: true,
- unmarshal: true,
-}, {
- value: jsonType{},
- json: `{"Id":null}`,
- marshal: false,
- unmarshal: true,
-}, {
- json: `{"Id":"4d88e15b60f486e428412dc9A"}`,
- error: `invalid ObjectId in JSON: "4d88e15b60f486e428412dc9A"`,
- marshal: false,
- unmarshal: true,
-}, {
- json: `{"Id":"4d88e15b60f486e428412dcZ"}`,
- error: `invalid ObjectId in JSON: "4d88e15b60f486e428412dcZ" .*`,
- marshal: false,
- unmarshal: true,
-}}
-
-func (s *S) TestObjectIdJSONMarshaling(c *C) {
- for _, test := range jsonIdTests {
- if test.marshal {
- data, err := json.Marshal(&test.value)
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, test.json)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
-
- if test.unmarshal {
- var value jsonType
- err := json.Unmarshal([]byte(test.json), &value)
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, test.value)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
- }
-}
-
-// --------------------------------------------------------------------------
-// ObjectId Text encoding.TextUnmarshaler.
-
-var textIdTests = []struct {
- value bson.ObjectId
- text string
- marshal bool
- unmarshal bool
- error string
-}{{
- value: bson.ObjectIdHex("4d88e15b60f486e428412dc9"),
- text: "4d88e15b60f486e428412dc9",
- marshal: true,
- unmarshal: true,
-}, {
- text: "",
- marshal: true,
- unmarshal: true,
-}, {
- text: "4d88e15b60f486e428412dc9A",
- marshal: false,
- unmarshal: true,
- error: `invalid ObjectId: 4d88e15b60f486e428412dc9A`,
-}, {
- text: "4d88e15b60f486e428412dcZ",
- marshal: false,
- unmarshal: true,
- error: `invalid ObjectId: 4d88e15b60f486e428412dcZ .*`,
-}}
-
-func (s *S) TestObjectIdTextMarshaling(c *C) {
- for _, test := range textIdTests {
- if test.marshal {
- data, err := test.value.MarshalText()
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, test.text)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
-
- if test.unmarshal {
- err := test.value.UnmarshalText([]byte(test.text))
- if test.error == "" {
- c.Assert(err, IsNil)
- if test.value != "" {
- value := bson.ObjectIdHex(test.text)
- c.Assert(value, DeepEquals, test.value)
- }
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
- }
-}
-
-// --------------------------------------------------------------------------
-// ObjectId XML marshalling.
-
-type xmlType struct {
- Id bson.ObjectId
-}
-
-var xmlIdTests = []struct {
- value xmlType
- xml string
- marshal bool
- unmarshal bool
- error string
-}{{
- value: xmlType{Id: bson.ObjectIdHex("4d88e15b60f486e428412dc9")},
- xml: "<xmlType><Id>4d88e15b60f486e428412dc9</Id></xmlType>",
- marshal: true,
- unmarshal: true,
-}, {
- value: xmlType{},
- xml: "<xmlType><Id></Id></xmlType>",
- marshal: true,
- unmarshal: true,
-}, {
- xml: "<xmlType><Id>4d88e15b60f486e428412dc9A</Id></xmlType>",
- marshal: false,
- unmarshal: true,
- error: `invalid ObjectId: 4d88e15b60f486e428412dc9A`,
-}, {
- xml: "<xmlType><Id>4d88e15b60f486e428412dcZ</Id></xmlType>",
- marshal: false,
- unmarshal: true,
- error: `invalid ObjectId: 4d88e15b60f486e428412dcZ .*`,
-}}
-
-func (s *S) TestObjectIdXMLMarshaling(c *C) {
- for _, test := range xmlIdTests {
- if test.marshal {
- data, err := xml.Marshal(&test.value)
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(string(data), Equals, test.xml)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
-
- if test.unmarshal {
- var value xmlType
- err := xml.Unmarshal([]byte(test.xml), &value)
- if test.error == "" {
- c.Assert(err, IsNil)
- c.Assert(value, DeepEquals, test.value)
- } else {
- c.Assert(err, ErrorMatches, test.error)
- }
- }
- }
-}
-
-// --------------------------------------------------------------------------
-// Some simple benchmarks.
-
-type BenchT struct {
- A, B, C, D, E, F string
-}
-
-type BenchRawT struct {
- A string
- B int
- C bson.M
- D []float64
-}
-
-func (s *S) BenchmarkUnmarhsalStruct(c *C) {
- v := BenchT{A: "A", D: "D", E: "E"}
- data, err := bson.Marshal(&v)
- if err != nil {
- panic(err)
- }
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- err = bson.Unmarshal(data, &v)
- }
- if err != nil {
- panic(err)
- }
-}
-
-func (s *S) BenchmarkUnmarhsalMap(c *C) {
- m := bson.M{"a": "a", "d": "d", "e": "e"}
- data, err := bson.Marshal(&m)
- if err != nil {
- panic(err)
- }
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- err = bson.Unmarshal(data, &m)
- }
- if err != nil {
- panic(err)
- }
-}
-
-func (s *S) BenchmarkUnmarshalRaw(c *C) {
- var err error
- m := BenchRawT{
- A: "test_string",
- B: 123,
- C: bson.M{
- "subdoc_int": 12312,
- "subdoc_doc": bson.M{"1": 1},
- },
- D: []float64{0.0, 1.3333, -99.9997, 3.1415},
- }
- data, err := bson.Marshal(&m)
- if err != nil {
- panic(err)
- }
- raw := bson.Raw{}
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- err = bson.Unmarshal(data, &raw)
- }
- if err != nil {
- panic(err)
- }
-}
-
-func (s *S) BenchmarkNewObjectId(c *C) {
- for i := 0; i < c.N; i++ {
- bson.NewObjectId()
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/decimal_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/decimal_test.go
deleted file mode 100644
index a29728094ec..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/decimal_test.go
+++ /dev/null
@@ -1,4109 +0,0 @@
-// BSON library for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package bson_test
-
-import (
- "encoding/hex"
- "encoding/json"
- "fmt"
- "regexp"
- "strings"
-
- "gopkg.in/mgo.v2/bson"
-
- . "gopkg.in/check.v1"
-)
-
-// --------------------------------------------------------------------------
-// Decimal tests
-
-type decimalTests struct {
- Valid []struct {
- Description string `json:"description"`
- BSON string `json:"bson"`
- CanonicalBSON string `json:"canonical_bson"`
- ExtJSON string `json:"extjson"`
- CanonicalExtJSON string `json:"canonical_extjson"`
- Lossy bool `json:"lossy"`
- } `json:"valid"`
-
- ParseErrors []struct {
- Description string `json:"description"`
- String string `json:"string"`
- } `json:"parseErrors"`
-}
-
-func extJSONRepr(s string) string {
- var value struct {
- D struct {
- Repr string `json:"$numberDecimal"`
- } `json:"d"`
- }
- err := json.Unmarshal([]byte(s), &value)
- if err != nil {
- panic(err)
- }
- return value.D.Repr
-}
-
-func (s *S) TestDecimalTests(c *C) {
- // These also conform to the spec and are used by Go elsewhere.
- // (e.g. math/big won't parse "Infinity").
- goStr := func(s string) string {
- switch s {
- case "Infinity":
- return "Inf"
- case "-Infinity":
- return "-Inf"
- }
- return s
- }
-
- for _, testEntry := range decimalTestsJSON {
- testFile := testEntry.file
-
- var tests decimalTests
- err := json.Unmarshal([]byte(testEntry.json), &tests)
- c.Assert(err, IsNil)
-
- for _, test := range tests.Valid {
- c.Logf("Running %s test: %s", testFile, test.Description)
-
- test.BSON = strings.ToLower(test.BSON)
-
- // Unmarshal value from BSON data.
- bsonData, err := hex.DecodeString(test.BSON)
- var bsonValue struct{ D interface{} }
- err = bson.Unmarshal(bsonData, &bsonValue)
- c.Assert(err, IsNil)
- dec128, ok := bsonValue.D.(bson.Decimal128)
- c.Assert(ok, Equals, true)
-
- // Extract ExtJSON representations (canonical and not).
- extjRepr := extJSONRepr(test.ExtJSON)
- cextjRepr := extjRepr
- if test.CanonicalExtJSON != "" {
- cextjRepr = extJSONRepr(test.CanonicalExtJSON)
- }
-
- wantRepr := goStr(cextjRepr)
-
- // Generate canonical representation.
- c.Assert(dec128.String(), Equals, wantRepr)
-
- // Parse original canonical representation.
- parsed, err := bson.ParseDecimal128(cextjRepr)
- c.Assert(err, IsNil)
- c.Assert(parsed.String(), Equals, wantRepr)
-
- // Parse non-canonical representation.
- parsed, err = bson.ParseDecimal128(extjRepr)
- c.Assert(err, IsNil)
- c.Assert(parsed.String(), Equals, wantRepr)
-
- // Parse Go canonical representation (Inf vs. Infinity).
- parsed, err = bson.ParseDecimal128(wantRepr)
- c.Assert(err, IsNil)
- c.Assert(parsed.String(), Equals, wantRepr)
-
- // Marshal original value back into BSON data.
- data, err := bson.Marshal(bsonValue)
- c.Assert(err, IsNil)
- c.Assert(hex.EncodeToString(data), Equals, test.BSON)
-
- if test.Lossy {
- continue
- }
-
- // Marshal the parsed canonical representation.
- var parsedValue struct{ D interface{} }
- parsedValue.D = parsed
- data, err = bson.Marshal(parsedValue)
- c.Assert(err, IsNil)
- c.Assert(hex.EncodeToString(data), Equals, test.BSON)
- }
-
- for _, test := range tests.ParseErrors {
- c.Logf("Running %s parse error test: %s (string %q)", testFile, test.Description, test.String)
-
- _, err := bson.ParseDecimal128(test.String)
- quoted := regexp.QuoteMeta(fmt.Sprintf("%q", test.String))
- c.Assert(err, ErrorMatches, `cannot parse `+quoted+` as a decimal128`)
- }
- }
-}
-
-const decBenchNum = "9.999999999999999999999999999999999E+6144"
-
-func (s *S) BenchmarkDecimal128String(c *C) {
- d, err := bson.ParseDecimal128(decBenchNum)
- c.Assert(err, IsNil)
- c.Assert(d.String(), Equals, decBenchNum)
-
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- d.String()
- }
-}
-
-func (s *S) BenchmarkDecimal128Parse(c *C) {
- var err error
- c.ResetTimer()
- for i := 0; i < c.N; i++ {
- _, err = bson.ParseDecimal128(decBenchNum)
- }
- if err != nil {
- panic(err)
- }
-}
-
-var decimalTestsJSON = []struct{ file, json string }{
- {"decimal128-1.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "valid": [
- {
- "description": "Special - Canonical NaN",
- "bson": "180000001364000000000000000000000000000000007C00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}"
- },
- {
- "description": "Special - Negative NaN",
- "bson": "18000000136400000000000000000000000000000000FC00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}",
- "lossy": true
- },
- {
- "description": "Special - Negative NaN",
- "bson": "18000000136400000000000000000000000000000000FC00",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-NaN\"}}",
- "lossy": true
- },
- {
- "description": "Special - Canonical SNaN",
- "bson": "180000001364000000000000000000000000000000007E00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}",
- "lossy": true
- },
- {
- "description": "Special - Negative SNaN",
- "bson": "18000000136400000000000000000000000000000000FE00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}",
- "lossy": true
- },
- {
- "description": "Special - NaN with a payload",
- "bson": "180000001364001200000000000000000000000000007E00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}",
- "lossy": true
- },
- {
- "description": "Special - Canonical Positive Infinity",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "Special - Canonical Negative Infinity",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "Special - Invalid representation treated as 0",
- "bson": "180000001364000000000000000000000000000000106C00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}",
- "lossy": true
- },
- {
- "description": "Special - Invalid representation treated as -0",
- "bson": "18000000136400DCBA9876543210DEADBEEF00000010EC00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}",
- "lossy": true
- },
- {
- "description": "Special - Invalid representation treated as 0E3",
- "bson": "18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF116C00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}",
- "lossy": true
- },
- {
- "description": "Regular - Adjusted Exponent Limit",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CF22F00",
- "extjson": "{\"d\": { \"$numberDecimal\": \"0.000001234567890123456789012345678901234\" }}"
- },
- {
- "description": "Regular - Smallest",
- "bson": "18000000136400D204000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001234\"}}"
- },
- {
- "description": "Regular - Smallest with Trailing Zeros",
- "bson": "1800000013640040EF5A07000000000000000000002A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00123400000\"}}"
- },
- {
- "description": "Regular - 0.1",
- "bson": "1800000013640001000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1\"}}"
- },
- {
- "description": "Regular - 0.1234567890123456789012345678901234",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CFC2F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1234567890123456789012345678901234\"}}"
- },
- {
- "description": "Regular - 0",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "Regular - -0",
- "bson": "18000000136400000000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}"
- },
- {
- "description": "Regular - -0.0",
- "bson": "1800000013640000000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}"
- },
- {
- "description": "Regular - 2",
- "bson": "180000001364000200000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2\"}}"
- },
- {
- "description": "Regular - 2.000",
- "bson": "18000000136400D0070000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2.000\"}}"
- },
- {
- "description": "Regular - Largest",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1234567890123456789012345678901234\"}}"
- },
- {
- "description": "Scientific - Tiniest",
- "bson": "18000000136400FFFFFFFF638E8D37C087ADBE09ED010000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"9.999999999999999999999999999999999E-6143\"}}"
- },
- {
- "description": "Scientific - Tiny",
- "bson": "180000001364000100000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}"
- },
- {
- "description": "Scientific - Negative Tiny",
- "bson": "180000001364000100000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}"
- },
- {
- "description": "Scientific - Adjusted Exponent Limit",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CF02F00",
- "extjson": "{\"d\": { \"$numberDecimal\": \"1.234567890123456789012345678901234E-7\" }}"
- },
- {
- "description": "Scientific - Fractional",
- "bson": "1800000013640064000000000000000000000000002CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00E-8\"}}"
- },
- {
- "description": "Scientific - 0 with Exponent",
- "bson": "180000001364000000000000000000000000000000205F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6000\"}}"
- },
- {
- "description": "Scientific - 0 with Negative Exponent",
- "bson": "1800000013640000000000000000000000000000007A2B00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-611\"}}"
- },
- {
- "description": "Scientific - No Decimal with Signed Exponent",
- "bson": "180000001364000100000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+3\"}}"
- },
- {
- "description": "Scientific - Trailing Zero",
- "bson": "180000001364001A04000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.050E+4\"}}"
- },
- {
- "description": "Scientific - With Decimal",
- "bson": "180000001364006900000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.05E+3\"}}"
- },
- {
- "description": "Scientific - Full",
- "bson": "18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"5192296858534827628530496329220095\"}}"
- },
- {
- "description": "Scientific - Large",
- "bson": "18000000136400000000000A5BC138938D44C64D31FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "Scientific - Largest",
- "bson": "18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"9.999999999999999999999999999999999E+6144\"}}"
- },
- {
- "description": "Non-Canonical Parsing - Exponent Normalization",
- "bson": "1800000013640064000000000000000000000000002CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-100E-10\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00E-8\"}}"
- },
- {
- "description": "Non-Canonical Parsing - Unsigned Positive Exponent",
- "bson": "180000001364000100000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+3\"}}"
- },
- {
- "description": "Non-Canonical Parsing - Lowercase Exponent Identifier",
- "bson": "180000001364000100000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1e+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+3\"}}"
- },
- {
- "description": "Non-Canonical Parsing - Long Significand with Exponent",
- "bson": "1800000013640079D9E0F9763ADA429D0200000000583000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12345689012345789012345E+12\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.2345689012345789012345E+34\"}}"
- },
- {
- "description": "Non-Canonical Parsing - Positive Sign",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+1234567890123456789012345678901234\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1234567890123456789012345678901234\"}}"
- },
- {
- "description": "Non-Canonical Parsing - Long Decimal String",
- "bson": "180000001364000100000000000000000000000000722800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \".000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-999\"}}"
- },
- {
- "description": "Non-Canonical Parsing - nan",
- "bson": "180000001364000000000000000000000000000000007C00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"nan\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}"
- },
- {
- "description": "Non-Canonical Parsing - nAn",
- "bson": "180000001364000000000000000000000000000000007C00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"nAn\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}"
- },
- {
- "description": "Non-Canonical Parsing - +infinity",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+infinity\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - infinity",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"infinity\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - infiniTY",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"infiniTY\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - inf",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"inf\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - inF",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"inF\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - -infinity",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-infinity\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - -infiniTy",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-infiniTy\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - -Inf",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - -inf",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-inf\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "Non-Canonical Parsing - -inF",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-inF\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "Rounded Subnormal number",
- "bson": "180000001364000100000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10E-6177\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}"
- },
- {
- "description": "Clamped",
- "bson": "180000001364000a00000000000000000000000000fe5f00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E6112\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6112\"}}"
- },
- {
- "description": "Exact rounding",
- "bson": "18000000136400000000000a5bc138938d44c64d31cc3700",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+999\"}}"
- }
- ]
-}
-`},
-
- {"decimal128-2.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "valid": [
- {
- "description": "[decq021] Normality",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C40B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1234567890123456789012345678901234\"}}"
- },
- {
- "description": "[decq823] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400010000800000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483649\"}}"
- },
- {
- "description": "[decq822] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400000000800000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483648\"}}"
- },
- {
- "description": "[decq821] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400FFFFFF7F0000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483647\"}}"
- },
- {
- "description": "[decq820] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400FEFFFF7F0000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-2147483646\"}}"
- },
- {
- "description": "[decq152] fold-downs (more below)",
- "bson": "18000000136400393000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-12345\"}}"
- },
- {
- "description": "[decq154] fold-downs (more below)",
- "bson": "18000000136400D20400000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1234\"}}"
- },
- {
- "description": "[decq006] derivative canonical plain strings",
- "bson": "18000000136400EE0200000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-750\"}}"
- },
- {
- "description": "[decq164] fold-downs (more below)",
- "bson": "1800000013640039300000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-123.45\"}}"
- },
- {
- "description": "[decq156] fold-downs (more below)",
- "bson": "180000001364007B0000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-123\"}}"
- },
- {
- "description": "[decq008] derivative canonical plain strings",
- "bson": "18000000136400EE020000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-75.0\"}}"
- },
- {
- "description": "[decq158] fold-downs (more below)",
- "bson": "180000001364000C0000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-12\"}}"
- },
- {
- "description": "[decq122] Nmax and similar",
- "bson": "18000000136400FFFFFFFF638E8D37C087ADBE09EDFFDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.999999999999999999999999999999999E+6144\"}}"
- },
- {
- "description": "[decq002] (mostly derived from the Strawman 4 document and examples)",
- "bson": "18000000136400EE020000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-7.50\"}}"
- },
- {
- "description": "[decq004] derivative canonical plain strings",
- "bson": "18000000136400EE0200000000000000000000000042B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-7.50E+3\"}}"
- },
- {
- "description": "[decq018] derivative canonical plain strings",
- "bson": "18000000136400EE020000000000000000000000002EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-7.50E-7\"}}"
- },
- {
- "description": "[decq125] Nmax and similar",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CFEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.234567890123456789012345678901234E+6144\"}}"
- },
- {
- "description": "[decq131] fold-downs (more below)",
- "bson": "18000000136400000000807F1BCF85B27059C8A43CFEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.230000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq162] fold-downs (more below)",
- "bson": "180000001364007B000000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.23\"}}"
- },
- {
- "description": "[decq176] Nmin and below",
- "bson": "18000000136400010000000A5BC138938D44C64D31008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000001E-6143\"}}"
- },
- {
- "description": "[decq174] Nmin and below",
- "bson": "18000000136400000000000A5BC138938D44C64D31008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000000E-6143\"}}"
- },
- {
- "description": "[decq133] fold-downs (more below)",
- "bson": "18000000136400000000000A5BC138938D44C64D31FEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq160] fold-downs (more below)",
- "bson": "18000000136400010000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1\"}}"
- },
- {
- "description": "[decq172] Nmin and below",
- "bson": "180000001364000100000000000000000000000000428000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6143\"}}"
- },
- {
- "description": "[decq010] derivative canonical plain strings",
- "bson": "18000000136400EE020000000000000000000000003AB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.750\"}}"
- },
- {
- "description": "[decq012] derivative canonical plain strings",
- "bson": "18000000136400EE0200000000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0750\"}}"
- },
- {
- "description": "[decq014] derivative canonical plain strings",
- "bson": "18000000136400EE0200000000000000000000000034B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000750\"}}"
- },
- {
- "description": "[decq016] derivative canonical plain strings",
- "bson": "18000000136400EE0200000000000000000000000030B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000750\"}}"
- },
- {
- "description": "[decq404] zeros",
- "bson": "180000001364000000000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}"
- },
- {
- "description": "[decq424] negative zeros",
- "bson": "180000001364000000000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}"
- },
- {
- "description": "[decq407] zeros",
- "bson": "1800000013640000000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}"
- },
- {
- "description": "[decq427] negative zeros",
- "bson": "1800000013640000000000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}"
- },
- {
- "description": "[decq409] zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[decq428] negative zeros",
- "bson": "18000000136400000000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}"
- },
- {
- "description": "[decq700] Selected DPD codes",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[decq406] zeros",
- "bson": "1800000013640000000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}"
- },
- {
- "description": "[decq426] negative zeros",
- "bson": "1800000013640000000000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}"
- },
- {
- "description": "[decq410] zeros",
- "bson": "180000001364000000000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}"
- },
- {
- "description": "[decq431] negative zeros",
- "bson": "18000000136400000000000000000000000000000046B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+3\"}}"
- },
- {
- "description": "[decq419] clamped zeros...",
- "bson": "180000001364000000000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}"
- },
- {
- "description": "[decq432] negative zeros",
- "bson": "180000001364000000000000000000000000000000FEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}"
- },
- {
- "description": "[decq405] zeros",
- "bson": "180000001364000000000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}"
- },
- {
- "description": "[decq425] negative zeros",
- "bson": "180000001364000000000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}"
- },
- {
- "description": "[decq508] Specials",
- "bson": "180000001364000000000000000000000000000000007800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"Infinity\"}}"
- },
- {
- "description": "[decq528] Specials",
- "bson": "18000000136400000000000000000000000000000000F800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-Infinity\"}}"
- },
- {
- "description": "[decq541] Specials",
- "bson": "180000001364000000000000000000000000000000007C00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"NaN\"}}"
- },
- {
- "description": "[decq074] Nmin and below",
- "bson": "18000000136400000000000A5BC138938D44C64D31000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E-6143\"}}"
- },
- {
- "description": "[decq602] fold-down full sequence",
- "bson": "18000000136400000000000A5BC138938D44C64D31FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq604] fold-down full sequence",
- "bson": "180000001364000000000081EFAC855B416D2DEE04FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E+6143\"}}"
- },
- {
- "description": "[decq606] fold-down full sequence",
- "bson": "1800000013640000000080264B91C02220BE377E00FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000000E+6142\"}}"
- },
- {
- "description": "[decq608] fold-down full sequence",
- "bson": "1800000013640000000040EAED7446D09C2C9F0C00FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000E+6141\"}}"
- },
- {
- "description": "[decq610] fold-down full sequence",
- "bson": "18000000136400000000A0CA17726DAE0F1E430100FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000E+6140\"}}"
- },
- {
- "description": "[decq612] fold-down full sequence",
- "bson": "18000000136400000000106102253E5ECE4F200000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000E+6139\"}}"
- },
- {
- "description": "[decq614] fold-down full sequence",
- "bson": "18000000136400000000E83C80D09F3C2E3B030000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000E+6138\"}}"
- },
- {
- "description": "[decq616] fold-down full sequence",
- "bson": "18000000136400000000E4D20CC8DCD2B752000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000E+6137\"}}"
- },
- {
- "description": "[decq618] fold-down full sequence",
- "bson": "180000001364000000004A48011416954508000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000E+6136\"}}"
- },
- {
- "description": "[decq620] fold-down full sequence",
- "bson": "18000000136400000000A1EDCCCE1BC2D300000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000E+6135\"}}"
- },
- {
- "description": "[decq622] fold-down full sequence",
- "bson": "18000000136400000080F64AE1C7022D1500000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000E+6134\"}}"
- },
- {
- "description": "[decq624] fold-down full sequence",
- "bson": "18000000136400000040B2BAC9E0191E0200000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000E+6133\"}}"
- },
- {
- "description": "[decq626] fold-down full sequence",
- "bson": "180000001364000000A0DEC5ADC935360000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000E+6132\"}}"
- },
- {
- "description": "[decq628] fold-down full sequence",
- "bson": "18000000136400000010632D5EC76B050000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000E+6131\"}}"
- },
- {
- "description": "[decq630] fold-down full sequence",
- "bson": "180000001364000000E8890423C78A000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000E+6130\"}}"
- },
- {
- "description": "[decq632] fold-down full sequence",
- "bson": "18000000136400000064A7B3B6E00D000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000E+6129\"}}"
- },
- {
- "description": "[decq634] fold-down full sequence",
- "bson": "1800000013640000008A5D78456301000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000E+6128\"}}"
- },
- {
- "description": "[decq636] fold-down full sequence",
- "bson": "180000001364000000C16FF2862300000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000E+6127\"}}"
- },
- {
- "description": "[decq638] fold-down full sequence",
- "bson": "180000001364000080C6A47E8D0300000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000E+6126\"}}"
- },
- {
- "description": "[decq640] fold-down full sequence",
- "bson": "1800000013640000407A10F35A0000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000E+6125\"}}"
- },
- {
- "description": "[decq642] fold-down full sequence",
- "bson": "1800000013640000A0724E18090000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000E+6124\"}}"
- },
- {
- "description": "[decq644] fold-down full sequence",
- "bson": "180000001364000010A5D4E8000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000E+6123\"}}"
- },
- {
- "description": "[decq646] fold-down full sequence",
- "bson": "1800000013640000E8764817000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000E+6122\"}}"
- },
- {
- "description": "[decq648] fold-down full sequence",
- "bson": "1800000013640000E40B5402000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000E+6121\"}}"
- },
- {
- "description": "[decq650] fold-down full sequence",
- "bson": "1800000013640000CA9A3B00000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000E+6120\"}}"
- },
- {
- "description": "[decq652] fold-down full sequence",
- "bson": "1800000013640000E1F50500000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000E+6119\"}}"
- },
- {
- "description": "[decq654] fold-down full sequence",
- "bson": "180000001364008096980000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000E+6118\"}}"
- },
- {
- "description": "[decq656] fold-down full sequence",
- "bson": "1800000013640040420F0000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000E+6117\"}}"
- },
- {
- "description": "[decq658] fold-down full sequence",
- "bson": "18000000136400A086010000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000E+6116\"}}"
- },
- {
- "description": "[decq660] fold-down full sequence",
- "bson": "180000001364001027000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000E+6115\"}}"
- },
- {
- "description": "[decq662] fold-down full sequence",
- "bson": "18000000136400E803000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000E+6114\"}}"
- },
- {
- "description": "[decq664] fold-down full sequence",
- "bson": "180000001364006400000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+6113\"}}"
- },
- {
- "description": "[decq666] fold-down full sequence",
- "bson": "180000001364000A00000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6112\"}}"
- },
- {
- "description": "[decq060] fold-downs (more below)",
- "bson": "180000001364000100000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1\"}}"
- },
- {
- "description": "[decq670] fold-down full sequence",
- "bson": "180000001364000100000000000000000000000000FC5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6110\"}}"
- },
- {
- "description": "[decq668] fold-down full sequence",
- "bson": "180000001364000100000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6111\"}}"
- },
- {
- "description": "[decq072] Nmin and below",
- "bson": "180000001364000100000000000000000000000000420000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6143\"}}"
- },
- {
- "description": "[decq076] Nmin and below",
- "bson": "18000000136400010000000A5BC138938D44C64D31000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000001E-6143\"}}"
- },
- {
- "description": "[decq036] fold-downs (more below)",
- "bson": "18000000136400000000807F1BCF85B27059C8A43CFE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.230000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq062] fold-downs (more below)",
- "bson": "180000001364007B000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23\"}}"
- },
- {
- "description": "[decq034] Nmax and similar",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3CFE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.234567890123456789012345678901234E+6144\"}}"
- },
- {
- "description": "[decq441] exponent lengths",
- "bson": "180000001364000700000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7\"}}"
- },
- {
- "description": "[decq449] exponent lengths",
- "bson": "1800000013640007000000000000000000000000001E5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+5999\"}}"
- },
- {
- "description": "[decq447] exponent lengths",
- "bson": "1800000013640007000000000000000000000000000E3800",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+999\"}}"
- },
- {
- "description": "[decq445] exponent lengths",
- "bson": "180000001364000700000000000000000000000000063100",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+99\"}}"
- },
- {
- "description": "[decq443] exponent lengths",
- "bson": "180000001364000700000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+9\"}}"
- },
- {
- "description": "[decq842] VG testcase",
- "bson": "180000001364000000FED83F4E7C9FE4E269E38A5BCD1700",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7.049000000000010795488000000000000E-3097\"}}"
- },
- {
- "description": "[decq841] VG testcase",
- "bson": "180000001364000000203B9DB5056F000000000000002400",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"8.000000000000000000E-1550\"}}"
- },
- {
- "description": "[decq840] VG testcase",
- "bson": "180000001364003C17258419D710C42F0000000000002400",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"8.81125000000001349436E-1548\"}}"
- },
- {
- "description": "[decq701] Selected DPD codes",
- "bson": "180000001364000900000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"9\"}}"
- },
- {
- "description": "[decq032] Nmax and similar",
- "bson": "18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"9.999999999999999999999999999999999E+6144\"}}"
- },
- {
- "description": "[decq702] Selected DPD codes",
- "bson": "180000001364000A00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10\"}}"
- },
- {
- "description": "[decq057] fold-downs (more below)",
- "bson": "180000001364000C00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12\"}}"
- },
- {
- "description": "[decq703] Selected DPD codes",
- "bson": "180000001364001300000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"19\"}}"
- },
- {
- "description": "[decq704] Selected DPD codes",
- "bson": "180000001364001400000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"20\"}}"
- },
- {
- "description": "[decq705] Selected DPD codes",
- "bson": "180000001364001D00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"29\"}}"
- },
- {
- "description": "[decq706] Selected DPD codes",
- "bson": "180000001364001E00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"30\"}}"
- },
- {
- "description": "[decq707] Selected DPD codes",
- "bson": "180000001364002700000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"39\"}}"
- },
- {
- "description": "[decq708] Selected DPD codes",
- "bson": "180000001364002800000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"40\"}}"
- },
- {
- "description": "[decq709] Selected DPD codes",
- "bson": "180000001364003100000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"49\"}}"
- },
- {
- "description": "[decq710] Selected DPD codes",
- "bson": "180000001364003200000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"50\"}}"
- },
- {
- "description": "[decq711] Selected DPD codes",
- "bson": "180000001364003B00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"59\"}}"
- },
- {
- "description": "[decq712] Selected DPD codes",
- "bson": "180000001364003C00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"60\"}}"
- },
- {
- "description": "[decq713] Selected DPD codes",
- "bson": "180000001364004500000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"69\"}}"
- },
- {
- "description": "[decq714] Selected DPD codes",
- "bson": "180000001364004600000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"70\"}}"
- },
- {
- "description": "[decq715] Selected DPD codes",
- "bson": "180000001364004700000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"71\"}}"
- },
- {
- "description": "[decq716] Selected DPD codes",
- "bson": "180000001364004800000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"72\"}}"
- },
- {
- "description": "[decq717] Selected DPD codes",
- "bson": "180000001364004900000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"73\"}}"
- },
- {
- "description": "[decq718] Selected DPD codes",
- "bson": "180000001364004A00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"74\"}}"
- },
- {
- "description": "[decq719] Selected DPD codes",
- "bson": "180000001364004B00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"75\"}}"
- },
- {
- "description": "[decq720] Selected DPD codes",
- "bson": "180000001364004C00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"76\"}}"
- },
- {
- "description": "[decq721] Selected DPD codes",
- "bson": "180000001364004D00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"77\"}}"
- },
- {
- "description": "[decq722] Selected DPD codes",
- "bson": "180000001364004E00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"78\"}}"
- },
- {
- "description": "[decq723] Selected DPD codes",
- "bson": "180000001364004F00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"79\"}}"
- },
- {
- "description": "[decq056] fold-downs (more below)",
- "bson": "180000001364007B00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"123\"}}"
- },
- {
- "description": "[decq064] fold-downs (more below)",
- "bson": "1800000013640039300000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"123.45\"}}"
- },
- {
- "description": "[decq732] Selected DPD codes",
- "bson": "180000001364000802000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"520\"}}"
- },
- {
- "description": "[decq733] Selected DPD codes",
- "bson": "180000001364000902000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"521\"}}"
- },
- {
- "description": "[decq740] DPD: one of each of the huffman groups",
- "bson": "180000001364000903000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"777\"}}"
- },
- {
- "description": "[decq741] DPD: one of each of the huffman groups",
- "bson": "180000001364000A03000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"778\"}}"
- },
- {
- "description": "[decq742] DPD: one of each of the huffman groups",
- "bson": "180000001364001303000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"787\"}}"
- },
- {
- "description": "[decq746] DPD: one of each of the huffman groups",
- "bson": "180000001364001F03000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"799\"}}"
- },
- {
- "description": "[decq743] DPD: one of each of the huffman groups",
- "bson": "180000001364006D03000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"877\"}}"
- },
- {
- "description": "[decq753] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "180000001364007803000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"888\"}}"
- },
- {
- "description": "[decq754] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "180000001364007903000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"889\"}}"
- },
- {
- "description": "[decq760] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "180000001364008203000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"898\"}}"
- },
- {
- "description": "[decq764] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "180000001364008303000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"899\"}}"
- },
- {
- "description": "[decq745] DPD: one of each of the huffman groups",
- "bson": "18000000136400D303000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"979\"}}"
- },
- {
- "description": "[decq770] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "18000000136400DC03000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"988\"}}"
- },
- {
- "description": "[decq774] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "18000000136400DD03000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"989\"}}"
- },
- {
- "description": "[decq730] Selected DPD codes",
- "bson": "18000000136400E203000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"994\"}}"
- },
- {
- "description": "[decq731] Selected DPD codes",
- "bson": "18000000136400E303000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"995\"}}"
- },
- {
- "description": "[decq744] DPD: one of each of the huffman groups",
- "bson": "18000000136400E503000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"997\"}}"
- },
- {
- "description": "[decq780] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "18000000136400E603000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"998\"}}"
- },
- {
- "description": "[decq787] DPD all-highs cases (includes the 24 redundant codes)",
- "bson": "18000000136400E703000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"999\"}}"
- },
- {
- "description": "[decq053] fold-downs (more below)",
- "bson": "18000000136400D204000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1234\"}}"
- },
- {
- "description": "[decq052] fold-downs (more below)",
- "bson": "180000001364003930000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12345\"}}"
- },
- {
- "description": "[decq792] Miscellaneous (testers' queries, etc.)",
- "bson": "180000001364003075000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"30000\"}}"
- },
- {
- "description": "[decq793] Miscellaneous (testers' queries, etc.)",
- "bson": "1800000013640090940D0000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"890000\"}}"
- },
- {
- "description": "[decq824] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400FEFFFF7F00000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483646\"}}"
- },
- {
- "description": "[decq825] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400FFFFFF7F00000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483647\"}}"
- },
- {
- "description": "[decq826] values around [u]int32 edges (zeros done earlier)",
- "bson": "180000001364000000008000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483648\"}}"
- },
- {
- "description": "[decq827] values around [u]int32 edges (zeros done earlier)",
- "bson": "180000001364000100008000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2147483649\"}}"
- },
- {
- "description": "[decq828] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400FEFFFFFF00000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967294\"}}"
- },
- {
- "description": "[decq829] values around [u]int32 edges (zeros done earlier)",
- "bson": "18000000136400FFFFFFFF00000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967295\"}}"
- },
- {
- "description": "[decq830] values around [u]int32 edges (zeros done earlier)",
- "bson": "180000001364000000000001000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967296\"}}"
- },
- {
- "description": "[decq831] values around [u]int32 edges (zeros done earlier)",
- "bson": "180000001364000100000001000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"4294967297\"}}"
- },
- {
- "description": "[decq022] Normality",
- "bson": "18000000136400C7711CC7B548F377DC80A131C836403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1111111111111111111111111111111111\"}}"
- },
- {
- "description": "[decq020] Normality",
- "bson": "18000000136400F2AF967ED05C82DE3297FF6FDE3C403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1234567890123456789012345678901234\"}}"
- },
- {
- "description": "[decq550] Specials",
- "bson": "18000000136400FFFFFFFF638E8D37C087ADBE09ED413000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"9999999999999999999999999999999999\"}}"
- }
- ]
-}
-`},
-
- {"decimal128-3.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "valid": [
- {
- "description": "[basx066] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE0000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-00345678.5432\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-345678.5432\"}}"
- },
- {
- "description": "[basx065] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE0000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0345678.5432\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-345678.5432\"}}"
- },
- {
- "description": "[basx064] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE0000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-345678.5432\"}}"
- },
- {
- "description": "[basx041] strings without E cannot generate E in result",
- "bson": "180000001364004C0000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-76\"}}"
- },
- {
- "description": "[basx027] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000F270000000000000000000000003AB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.999\"}}"
- },
- {
- "description": "[basx026] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364009F230000000000000000000000003AB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.119\"}}"
- },
- {
- "description": "[basx025] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364008F030000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.11\"}}"
- },
- {
- "description": "[basx024] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364005B000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.1\"}}"
- },
- {
- "description": "[dqbsr531] negatives (Rounded)",
- "bson": "1800000013640099761CC7B548F377DC80A131C836FEAF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.1111111111111111111111111111123450\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.111111111111111111111111111112345\"}}"
- },
- {
- "description": "[basx022] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000A000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.0\"}}"
- },
- {
- "description": "[basx021] conform to rules and exponent will be in permitted range).",
- "bson": "18000000136400010000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1\"}}"
- },
- {
- "description": "[basx601] Zeros",
- "bson": "1800000013640000000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}"
- },
- {
- "description": "[basx622] Zeros",
- "bson": "1800000013640000000000000000000000000000002EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-9\"}}"
- },
- {
- "description": "[basx602] Zeros",
- "bson": "180000001364000000000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8\"}}"
- },
- {
- "description": "[basx621] Zeros",
- "bson": "18000000136400000000000000000000000000000030B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-8\"}}"
- },
- {
- "description": "[basx603] Zeros",
- "bson": "180000001364000000000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}"
- },
- {
- "description": "[basx620] Zeros",
- "bson": "18000000136400000000000000000000000000000032B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-7\"}}"
- },
- {
- "description": "[basx604] Zeros",
- "bson": "180000001364000000000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}"
- },
- {
- "description": "[basx619] Zeros",
- "bson": "18000000136400000000000000000000000000000034B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000\"}}"
- },
- {
- "description": "[basx605] Zeros",
- "bson": "180000001364000000000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}"
- },
- {
- "description": "[basx618] Zeros",
- "bson": "18000000136400000000000000000000000000000036B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000\"}}"
- },
- {
- "description": "[basx680] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"000000.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx606] Zeros",
- "bson": "180000001364000000000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}"
- },
- {
- "description": "[basx617] Zeros",
- "bson": "18000000136400000000000000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}"
- },
- {
- "description": "[basx681] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"00000.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx686] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+00000.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx687] Zeros",
- "bson": "18000000136400000000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-00000.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}"
- },
- {
- "description": "[basx019] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640000000000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-00.00\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}"
- },
- {
- "description": "[basx607] Zeros",
- "bson": "1800000013640000000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}"
- },
- {
- "description": "[basx616] Zeros",
- "bson": "1800000013640000000000000000000000000000003AB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000\"}}"
- },
- {
- "description": "[basx682] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0000.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx155] Numbers with E",
- "bson": "1800000013640000000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000e+0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}"
- },
- {
- "description": "[basx130] Numbers with E",
- "bson": "180000001364000000000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}"
- },
- {
- "description": "[basx290] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}"
- },
- {
- "description": "[basx131] Numbers with E",
- "bson": "180000001364000000000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}"
- },
- {
- "description": "[basx291] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000036B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000\"}}"
- },
- {
- "description": "[basx132] Numbers with E",
- "bson": "180000001364000000000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}"
- },
- {
- "description": "[basx292] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000034B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000\"}}"
- },
- {
- "description": "[basx133] Numbers with E",
- "bson": "180000001364000000000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}"
- },
- {
- "description": "[basx293] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000032B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-7\"}}"
- },
- {
- "description": "[basx608] Zeros",
- "bson": "1800000013640000000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}"
- },
- {
- "description": "[basx615] Zeros",
- "bson": "1800000013640000000000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}"
- },
- {
- "description": "[basx683] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"000.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx630] Zeros",
- "bson": "1800000013640000000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}"
- },
- {
- "description": "[basx670] Zeros",
- "bson": "1800000013640000000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}"
- },
- {
- "description": "[basx631] Zeros",
- "bson": "1800000013640000000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}"
- },
- {
- "description": "[basx671] Zeros",
- "bson": "1800000013640000000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}"
- },
- {
- "description": "[basx134] Numbers with E",
- "bson": "180000001364000000000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}"
- },
- {
- "description": "[basx294] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}"
- },
- {
- "description": "[basx632] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx672] Zeros",
- "bson": "180000001364000000000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}"
- },
- {
- "description": "[basx135] Numbers with E",
- "bson": "180000001364000000000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}"
- },
- {
- "description": "[basx295] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000036B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000\"}}"
- },
- {
- "description": "[basx633] Zeros",
- "bson": "180000001364000000000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+1\"}}"
- },
- {
- "description": "[basx673] Zeros",
- "bson": "180000001364000000000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}"
- },
- {
- "description": "[basx136] Numbers with E",
- "bson": "180000001364000000000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}"
- },
- {
- "description": "[basx674] Zeros",
- "bson": "180000001364000000000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}"
- },
- {
- "description": "[basx634] Zeros",
- "bson": "180000001364000000000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+2\"}}"
- },
- {
- "description": "[basx137] Numbers with E",
- "bson": "180000001364000000000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}"
- },
- {
- "description": "[basx635] Zeros",
- "bson": "180000001364000000000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}"
- },
- {
- "description": "[basx675] Zeros",
- "bson": "180000001364000000000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}"
- },
- {
- "description": "[basx636] Zeros",
- "bson": "180000001364000000000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+4\"}}"
- },
- {
- "description": "[basx676] Zeros",
- "bson": "180000001364000000000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8\"}}"
- },
- {
- "description": "[basx637] Zeros",
- "bson": "1800000013640000000000000000000000000000004A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+5\"}}"
- },
- {
- "description": "[basx677] Zeros",
- "bson": "1800000013640000000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}"
- },
- {
- "description": "[basx638] Zeros",
- "bson": "1800000013640000000000000000000000000000004C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6\"}}"
- },
- {
- "description": "[basx678] Zeros",
- "bson": "1800000013640000000000000000000000000000002C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-10\"}}"
- },
- {
- "description": "[basx149] Numbers with E",
- "bson": "180000001364000000000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"000E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}"
- },
- {
- "description": "[basx639] Zeros",
- "bson": "1800000013640000000000000000000000000000004E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+7\"}}"
- },
- {
- "description": "[basx679] Zeros",
- "bson": "1800000013640000000000000000000000000000002A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00E-9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-11\"}}"
- },
- {
- "description": "[basx063] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE00000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+00345678.5432\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}"
- },
- {
- "description": "[basx018] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640000000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}"
- },
- {
- "description": "[basx609] Zeros",
- "bson": "1800000013640000000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}"
- },
- {
- "description": "[basx614] Zeros",
- "bson": "1800000013640000000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}"
- },
- {
- "description": "[basx684] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"00.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx640] Zeros",
- "bson": "1800000013640000000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}"
- },
- {
- "description": "[basx660] Zeros",
- "bson": "1800000013640000000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}"
- },
- {
- "description": "[basx641] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx661] Zeros",
- "bson": "1800000013640000000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00\"}}"
- },
- {
- "description": "[basx296] some more negative zeros [systematic tests below]",
- "bson": "1800000013640000000000000000000000000000003AB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000\"}}"
- },
- {
- "description": "[basx642] Zeros",
- "bson": "180000001364000000000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+1\"}}"
- },
- {
- "description": "[basx662] Zeros",
- "bson": "1800000013640000000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000\"}}"
- },
- {
- "description": "[basx297] some more negative zeros [systematic tests below]",
- "bson": "18000000136400000000000000000000000000000038B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0000\"}}"
- },
- {
- "description": "[basx643] Zeros",
- "bson": "180000001364000000000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+2\"}}"
- },
- {
- "description": "[basx663] Zeros",
- "bson": "180000001364000000000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000\"}}"
- },
- {
- "description": "[basx644] Zeros",
- "bson": "180000001364000000000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}"
- },
- {
- "description": "[basx664] Zeros",
- "bson": "180000001364000000000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000\"}}"
- },
- {
- "description": "[basx645] Zeros",
- "bson": "180000001364000000000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+4\"}}"
- },
- {
- "description": "[basx665] Zeros",
- "bson": "180000001364000000000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000\"}}"
- },
- {
- "description": "[basx646] Zeros",
- "bson": "1800000013640000000000000000000000000000004A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+5\"}}"
- },
- {
- "description": "[basx666] Zeros",
- "bson": "180000001364000000000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-7\"}}"
- },
- {
- "description": "[basx647] Zeros",
- "bson": "1800000013640000000000000000000000000000004C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6\"}}"
- },
- {
- "description": "[basx667] Zeros",
- "bson": "180000001364000000000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8\"}}"
- },
- {
- "description": "[basx648] Zeros",
- "bson": "1800000013640000000000000000000000000000004E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+7\"}}"
- },
- {
- "description": "[basx668] Zeros",
- "bson": "1800000013640000000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}"
- },
- {
- "description": "[basx160] Numbers with E",
- "bson": "180000001364000000000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"00E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}"
- },
- {
- "description": "[basx161] Numbers with E",
- "bson": "1800000013640000000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"00E-9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-9\"}}"
- },
- {
- "description": "[basx649] Zeros",
- "bson": "180000001364000000000000000000000000000000503000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+8\"}}"
- },
- {
- "description": "[basx669] Zeros",
- "bson": "1800000013640000000000000000000000000000002C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0E-9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-10\"}}"
- },
- {
- "description": "[basx062] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE00000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+0345678.5432\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}"
- },
- {
- "description": "[basx001] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx017] conform to rules and exponent will be in permitted range).",
- "bson": "18000000136400000000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}"
- },
- {
- "description": "[basx611] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx613] Zeros",
- "bson": "18000000136400000000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}"
- },
- {
- "description": "[basx685] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx688] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+0.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx689] Zeros",
- "bson": "18000000136400000000000000000000000000000040B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0\"}}"
- },
- {
- "description": "[basx650] Zeros",
- "bson": "180000001364000000000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0\"}}"
- },
- {
- "description": "[basx651] Zeros",
- "bson": "180000001364000000000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+1\"}}"
- },
- {
- "description": "[basx298] some more negative zeros [systematic tests below]",
- "bson": "1800000013640000000000000000000000000000003CB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00\"}}"
- },
- {
- "description": "[basx652] Zeros",
- "bson": "180000001364000000000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+2\"}}"
- },
- {
- "description": "[basx299] some more negative zeros [systematic tests below]",
- "bson": "1800000013640000000000000000000000000000003AB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000\"}}"
- },
- {
- "description": "[basx653] Zeros",
- "bson": "180000001364000000000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+3\"}}"
- },
- {
- "description": "[basx654] Zeros",
- "bson": "180000001364000000000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+4\"}}"
- },
- {
- "description": "[basx655] Zeros",
- "bson": "1800000013640000000000000000000000000000004A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+5\"}}"
- },
- {
- "description": "[basx656] Zeros",
- "bson": "1800000013640000000000000000000000000000004C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6\"}}"
- },
- {
- "description": "[basx657] Zeros",
- "bson": "1800000013640000000000000000000000000000004E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+7\"}}"
- },
- {
- "description": "[basx658] Zeros",
- "bson": "180000001364000000000000000000000000000000503000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+8\"}}"
- },
- {
- "description": "[basx138] Numbers with E",
- "bson": "180000001364000000000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+0E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}"
- },
- {
- "description": "[basx139] Numbers with E",
- "bson": "18000000136400000000000000000000000000000052B000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+9\"}}"
- },
- {
- "description": "[basx144] Numbers with E",
- "bson": "180000001364000000000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}"
- },
- {
- "description": "[basx154] Numbers with E",
- "bson": "180000001364000000000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}"
- },
- {
- "description": "[basx659] Zeros",
- "bson": "180000001364000000000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+9\"}}"
- },
- {
- "description": "[basx042] strings without E cannot generate E in result",
- "bson": "18000000136400FC040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+12.76\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}"
- },
- {
- "description": "[basx143] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+1E+009\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx061] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE00000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+345678.5432\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}"
- },
- {
- "description": "[basx036] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640015CD5B0700000000000000000000203000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000000123456789\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23456789E-8\"}}"
- },
- {
- "description": "[basx035] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640015CD5B0700000000000000000000223000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000123456789\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23456789E-7\"}}"
- },
- {
- "description": "[basx034] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640015CD5B0700000000000000000000243000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000123456789\"}}"
- },
- {
- "description": "[basx053] strings without E cannot generate E in result",
- "bson": "180000001364003200000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000050\"}}"
- },
- {
- "description": "[basx033] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640015CD5B0700000000000000000000263000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000123456789\"}}"
- },
- {
- "description": "[basx016] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000C000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.012\"}}"
- },
- {
- "description": "[basx015] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364007B000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.123\"}}"
- },
- {
- "description": "[basx037] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640078DF0D8648700000000000000000223000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.123456789012344\"}}"
- },
- {
- "description": "[basx038] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640079DF0D8648700000000000000000223000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.123456789012345\"}}"
- },
- {
- "description": "[basx250] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}"
- },
- {
- "description": "[basx257] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}"
- },
- {
- "description": "[basx256] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}"
- },
- {
- "description": "[basx258] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}"
- },
- {
- "description": "[basx251] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000103000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-21\"}}"
- },
- {
- "description": "[basx263] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000603000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+19\"}}"
- },
- {
- "description": "[basx255] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001265\"}}"
- },
- {
- "description": "[basx259] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}"
- },
- {
- "description": "[basx254] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0001265\"}}"
- },
- {
- "description": "[basx260] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}"
- },
- {
- "description": "[basx253] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00001265\"}}"
- },
- {
- "description": "[basx261] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}"
- },
- {
- "description": "[basx252] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000283000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-9\"}}"
- },
- {
- "description": "[basx262] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265E+8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+7\"}}"
- },
- {
- "description": "[basx159] Numbers with E",
- "bson": "1800000013640049000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.73e-7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7.3E-8\"}}"
- },
- {
- "description": "[basx004] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640064000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00\"}}"
- },
- {
- "description": "[basx003] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000A000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0\"}}"
- },
- {
- "description": "[basx002] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000100000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1\"}}"
- },
- {
- "description": "[basx148] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+009\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx153] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E009\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx141] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1e+09\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx146] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+09\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx151] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1e09\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx142] Numbers with E",
- "bson": "180000001364000100000000000000000000000000F43000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+90\"}}"
- },
- {
- "description": "[basx147] Numbers with E",
- "bson": "180000001364000100000000000000000000000000F43000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1e+90\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+90\"}}"
- },
- {
- "description": "[basx152] Numbers with E",
- "bson": "180000001364000100000000000000000000000000F43000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E90\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+90\"}}"
- },
- {
- "description": "[basx140] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx150] Numbers with E",
- "bson": "180000001364000100000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+9\"}}"
- },
- {
- "description": "[basx014] conform to rules and exponent will be in permitted range).",
- "bson": "18000000136400D2040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.234\"}}"
- },
- {
- "description": "[basx170] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}"
- },
- {
- "description": "[basx177] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}"
- },
- {
- "description": "[basx176] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}"
- },
- {
- "description": "[basx178] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}"
- },
- {
- "description": "[basx171] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000123000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-20\"}}"
- },
- {
- "description": "[basx183] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000623000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+20\"}}"
- },
- {
- "description": "[basx175] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}"
- },
- {
- "description": "[basx179] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}"
- },
- {
- "description": "[basx174] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001265\"}}"
- },
- {
- "description": "[basx180] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}"
- },
- {
- "description": "[basx173] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0001265\"}}"
- },
- {
- "description": "[basx181] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}"
- },
- {
- "description": "[basx172] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000002A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-8\"}}"
- },
- {
- "description": "[basx182] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000004A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+8\"}}"
- },
- {
- "description": "[basx157] Numbers with E",
- "bson": "180000001364000400000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"4E+9\"}}"
- },
- {
- "description": "[basx067] examples",
- "bson": "180000001364000500000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000005\"}}"
- },
- {
- "description": "[basx069] examples",
- "bson": "180000001364000500000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-7\"}}"
- },
- {
- "description": "[basx385] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7\"}}"
- },
- {
- "description": "[basx365] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000543000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E10\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+10\"}}"
- },
- {
- "description": "[basx405] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000002C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-10\"}}"
- },
- {
- "description": "[basx363] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000563000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E11\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+11\"}}"
- },
- {
- "description": "[basx407] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000002A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-11\"}}"
- },
- {
- "description": "[basx361] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000583000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E12\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+12\"}}"
- },
- {
- "description": "[basx409] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000283000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-12\"}}"
- },
- {
- "description": "[basx411] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000263000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-13\"}}"
- },
- {
- "description": "[basx383] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+1\"}}"
- },
- {
- "description": "[basx387] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.7\"}}"
- },
- {
- "description": "[basx381] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+2\"}}"
- },
- {
- "description": "[basx389] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.07\"}}"
- },
- {
- "description": "[basx379] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+3\"}}"
- },
- {
- "description": "[basx391] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.007\"}}"
- },
- {
- "description": "[basx377] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+4\"}}"
- },
- {
- "description": "[basx393] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0007\"}}"
- },
- {
- "description": "[basx375] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000004A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+5\"}}"
- },
- {
- "description": "[basx395] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00007\"}}"
- },
- {
- "description": "[basx373] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000004C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+6\"}}"
- },
- {
- "description": "[basx397] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000007\"}}"
- },
- {
- "description": "[basx371] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000004E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+7\"}}"
- },
- {
- "description": "[basx399] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-7\"}}"
- },
- {
- "description": "[basx369] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000503000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+8\"}}"
- },
- {
- "description": "[basx401] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-8\"}}"
- },
- {
- "description": "[basx367] Engineering notation tests",
- "bson": "180000001364000700000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"7E+9\"}}"
- },
- {
- "description": "[basx403] Engineering notation tests",
- "bson": "1800000013640007000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"7E-9\"}}"
- },
- {
- "description": "[basx007] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640064000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10.0\"}}"
- },
- {
- "description": "[basx005] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364000A00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10\"}}"
- },
- {
- "description": "[basx165] Numbers with E",
- "bson": "180000001364000A00000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10E+009\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}"
- },
- {
- "description": "[basx163] Numbers with E",
- "bson": "180000001364000A00000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10E+09\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}"
- },
- {
- "description": "[basx325] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"10\"}}"
- },
- {
- "description": "[basx305] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000543000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e10\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+11\"}}"
- },
- {
- "description": "[basx345] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000002C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-10\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-9\"}}"
- },
- {
- "description": "[basx303] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000563000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e11\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+12\"}}"
- },
- {
- "description": "[basx347] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000002A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-11\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-10\"}}"
- },
- {
- "description": "[basx301] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000583000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e12\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+13\"}}"
- },
- {
- "description": "[basx349] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000283000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-12\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-11\"}}"
- },
- {
- "description": "[basx351] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000263000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-13\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-12\"}}"
- },
- {
- "description": "[basx323] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+2\"}}"
- },
- {
- "description": "[basx327] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0\"}}"
- },
- {
- "description": "[basx321] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+3\"}}"
- },
- {
- "description": "[basx329] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.10\"}}"
- },
- {
- "description": "[basx319] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+4\"}}"
- },
- {
- "description": "[basx331] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.010\"}}"
- },
- {
- "description": "[basx317] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+5\"}}"
- },
- {
- "description": "[basx333] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0010\"}}"
- },
- {
- "description": "[basx315] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000004A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6\"}}"
- },
- {
- "description": "[basx335] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00010\"}}"
- },
- {
- "description": "[basx313] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000004C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+7\"}}"
- },
- {
- "description": "[basx337] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-6\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000010\"}}"
- },
- {
- "description": "[basx311] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000004E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+8\"}}"
- },
- {
- "description": "[basx339] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000010\"}}"
- },
- {
- "description": "[basx309] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000503000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+9\"}}"
- },
- {
- "description": "[basx341] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-7\"}}"
- },
- {
- "description": "[basx164] Numbers with E",
- "bson": "180000001364000A00000000000000000000000000F43000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e+90\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+91\"}}"
- },
- {
- "description": "[basx162] Numbers with E",
- "bson": "180000001364000A00000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}"
- },
- {
- "description": "[basx307] Engineering notation tests",
- "bson": "180000001364000A00000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+10\"}}"
- },
- {
- "description": "[basx343] Engineering notation tests",
- "bson": "180000001364000A000000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10e-9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-8\"}}"
- },
- {
- "description": "[basx008] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640065000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10.1\"}}"
- },
- {
- "description": "[basx009] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640068000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10.4\"}}"
- },
- {
- "description": "[basx010] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640069000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10.5\"}}"
- },
- {
- "description": "[basx011] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364006A000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10.6\"}}"
- },
- {
- "description": "[basx012] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364006D000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"10.9\"}}"
- },
- {
- "description": "[basx013] conform to rules and exponent will be in permitted range).",
- "bson": "180000001364006E000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"11.0\"}}"
- },
- {
- "description": "[basx040] strings without E cannot generate E in result",
- "bson": "180000001364000C00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12\"}}"
- },
- {
- "description": "[basx190] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}"
- },
- {
- "description": "[basx197] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}"
- },
- {
- "description": "[basx196] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}"
- },
- {
- "description": "[basx198] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}"
- },
- {
- "description": "[basx191] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000143000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-19\"}}"
- },
- {
- "description": "[basx203] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000643000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+21\"}}"
- },
- {
- "description": "[basx195] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}"
- },
- {
- "description": "[basx199] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}"
- },
- {
- "description": "[basx194] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}"
- },
- {
- "description": "[basx200] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}"
- },
- {
- "description": "[basx193] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.001265\"}}"
- },
- {
- "description": "[basx201] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+5\"}}"
- },
- {
- "description": "[basx192] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000002C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-7\"}}"
- },
- {
- "description": "[basx202] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000004C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65E+8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+9\"}}"
- },
- {
- "description": "[basx044] strings without E cannot generate E in result",
- "bson": "18000000136400FC040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"012.76\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}"
- },
- {
- "description": "[basx042] strings without E cannot generate E in result",
- "bson": "18000000136400FC040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}"
- },
- {
- "description": "[basx046] strings without E cannot generate E in result",
- "bson": "180000001364001100000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"17.\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"17\"}}"
- },
- {
- "description": "[basx049] strings without E cannot generate E in result",
- "bson": "180000001364002C00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0044\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"44\"}}"
- },
- {
- "description": "[basx048] strings without E cannot generate E in result",
- "bson": "180000001364002C00000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"044\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"44\"}}"
- },
- {
- "description": "[basx158] Numbers with E",
- "bson": "180000001364002C00000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"44E+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"4.4E+10\"}}"
- },
- {
- "description": "[basx068] examples",
- "bson": "180000001364003200000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"50E-7\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000050\"}}"
- },
- {
- "description": "[basx169] Numbers with E",
- "bson": "180000001364006400000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"100e+009\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+11\"}}"
- },
- {
- "description": "[basx167] Numbers with E",
- "bson": "180000001364006400000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"100e+09\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+11\"}}"
- },
- {
- "description": "[basx168] Numbers with E",
- "bson": "180000001364006400000000000000000000000000F43000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"100E+90\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+92\"}}"
- },
- {
- "description": "[basx166] Numbers with E",
- "bson": "180000001364006400000000000000000000000000523000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"100e+9\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+11\"}}"
- },
- {
- "description": "[basx210] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}"
- },
- {
- "description": "[basx217] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}"
- },
- {
- "description": "[basx216] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}"
- },
- {
- "description": "[basx218] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}"
- },
- {
- "description": "[basx211] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000163000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-18\"}}"
- },
- {
- "description": "[basx223] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000663000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+22\"}}"
- },
- {
- "description": "[basx215] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}"
- },
- {
- "description": "[basx219] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}"
- },
- {
- "description": "[basx214] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}"
- },
- {
- "description": "[basx220] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+5\"}}"
- },
- {
- "description": "[basx213] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.01265\"}}"
- },
- {
- "description": "[basx221] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+6\"}}"
- },
- {
- "description": "[basx212] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000002E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000001265\"}}"
- },
- {
- "description": "[basx222] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000004E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5E+8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+10\"}}"
- },
- {
- "description": "[basx006] conform to rules and exponent will be in permitted range).",
- "bson": "18000000136400E803000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1000\"}}"
- },
- {
- "description": "[basx230] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}"
- },
- {
- "description": "[basx237] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1265\"}}"
- },
- {
- "description": "[basx236] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"126.5\"}}"
- },
- {
- "description": "[basx238] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000423000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+1\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+4\"}}"
- },
- {
- "description": "[basx231] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000183000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E-17\"}}"
- },
- {
- "description": "[basx243] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000683000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+20\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+23\"}}"
- },
- {
- "description": "[basx235] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.65\"}}"
- },
- {
- "description": "[basx239] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000443000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+2\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+5\"}}"
- },
- {
- "description": "[basx234] Numbers with E",
- "bson": "18000000136400F1040000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265\"}}"
- },
- {
- "description": "[basx240] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000463000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+3\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+6\"}}"
- },
- {
- "description": "[basx233] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1265\"}}"
- },
- {
- "description": "[basx241] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000483000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+4\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+7\"}}"
- },
- {
- "description": "[basx232] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E-8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00001265\"}}"
- },
- {
- "description": "[basx242] Numbers with E",
- "bson": "18000000136400F104000000000000000000000000503000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1265E+8\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.265E+11\"}}"
- },
- {
- "description": "[basx060] strings without E cannot generate E in result",
- "bson": "18000000136400185C0ACE00000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.5432\"}}"
- },
- {
- "description": "[basx059] strings without E cannot generate E in result",
- "bson": "18000000136400F198670C08000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0345678.54321\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.54321\"}}"
- },
- {
- "description": "[basx058] strings without E cannot generate E in result",
- "bson": "180000001364006AF90B7C50000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"345678.543210\"}}"
- },
- {
- "description": "[basx057] strings without E cannot generate E in result",
- "bson": "180000001364006A19562522020000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"2345678.543210\"}}"
- },
- {
- "description": "[basx056] strings without E cannot generate E in result",
- "bson": "180000001364006AB9C8733A0B0000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"12345678.543210\"}}"
- },
- {
- "description": "[basx031] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640040AF0D8648700000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"123456789.000000\"}}"
- },
- {
- "description": "[basx030] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640080910F8648700000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"123456789.123456\"}}"
- },
- {
- "description": "[basx032] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640080910F8648700000000000000000403000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"123456789123456\"}}"
- }
- ]
-}
-`},
-
- {"decimal128-4.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "valid": [
- {
- "description": "[basx023] conform to rules and exponent will be in permitted range).",
- "bson": "1800000013640001000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.1\"}}"
- },
-
- {
- "description": "[basx045] strings without E cannot generate E in result",
- "bson": "1800000013640003000000000000000000000000003A3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+0.003\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.003\"}}"
- },
- {
- "description": "[basx610] Zeros",
- "bson": "1800000013640000000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \".0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0\"}}"
- },
- {
- "description": "[basx612] Zeros",
- "bson": "1800000013640000000000000000000000000000003EB000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-.0\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.0\"}}"
- },
- {
- "description": "[basx043] strings without E cannot generate E in result",
- "bson": "18000000136400FC040000000000000000000000003C3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"+12.76\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"12.76\"}}"
- },
- {
- "description": "[basx055] strings without E cannot generate E in result",
- "bson": "180000001364000500000000000000000000000000303000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000005\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-8\"}}"
- },
- {
- "description": "[basx054] strings without E cannot generate E in result",
- "bson": "180000001364000500000000000000000000000000323000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0000005\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"5E-7\"}}"
- },
- {
- "description": "[basx052] strings without E cannot generate E in result",
- "bson": "180000001364000500000000000000000000000000343000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000005\"}}"
- },
- {
- "description": "[basx051] strings without E cannot generate E in result",
- "bson": "180000001364000500000000000000000000000000363000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"00.00005\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00005\"}}"
- },
- {
- "description": "[basx050] strings without E cannot generate E in result",
- "bson": "180000001364000500000000000000000000000000383000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.0005\"}}"
- },
- {
- "description": "[basx047] strings without E cannot generate E in result",
- "bson": "1800000013640005000000000000000000000000003E3000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \".5\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.5\"}}"
- },
- {
- "description": "[dqbsr431] check rounding modes heeded (Rounded)",
- "bson": "1800000013640099761CC7B548F377DC80A131C836FE2F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.1111111111111111111111111111123450\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.111111111111111111111111111112345\"}}"
- },
- {
- "description": "OK2",
- "bson": "18000000136400000000000A5BC138938D44C64D31FC2F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \".100000000000000000000000000000000000000000000000000000000000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0.1000000000000000000000000000000000\"}}"
- }
- ],
- "parseErrors": [
- {
- "description": "[basx564] Near-specials (Conversion_syntax)",
- "string": "Infi"
- },
- {
- "description": "[basx565] Near-specials (Conversion_syntax)",
- "string": "Infin"
- },
- {
- "description": "[basx566] Near-specials (Conversion_syntax)",
- "string": "Infini"
- },
- {
- "description": "[basx567] Near-specials (Conversion_syntax)",
- "string": "Infinit"
- },
- {
- "description": "[basx568] Near-specials (Conversion_syntax)",
- "string": "-Infinit"
- },
- {
- "description": "[basx590] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": ".Infinity"
- },
- {
- "description": "[basx562] Near-specials (Conversion_syntax)",
- "string": "NaNq"
- },
- {
- "description": "[basx563] Near-specials (Conversion_syntax)",
- "string": "NaNs"
- },
- {
- "description": "[dqbas939] overflow results at different rounding modes (Overflow & Inexact & Rounded)",
- "string": "-7e10000"
- },
- {
- "description": "[dqbsr534] negatives (Rounded & Inexact)",
- "string": "-1.11111111111111111111111111111234650"
- },
- {
- "description": "[dqbsr535] negatives (Rounded & Inexact)",
- "string": "-1.11111111111111111111111111111234551"
- },
- {
- "description": "[dqbsr533] negatives (Rounded & Inexact)",
- "string": "-1.11111111111111111111111111111234550"
- },
- {
- "description": "[dqbsr532] negatives (Rounded & Inexact)",
- "string": "-1.11111111111111111111111111111234549"
- },
- {
- "description": "[dqbsr432] check rounding modes heeded (Rounded & Inexact)",
- "string": "1.11111111111111111111111111111234549"
- },
- {
- "description": "[dqbsr433] check rounding modes heeded (Rounded & Inexact)",
- "string": "1.11111111111111111111111111111234550"
- },
- {
- "description": "[dqbsr435] check rounding modes heeded (Rounded & Inexact)",
- "string": "1.11111111111111111111111111111234551"
- },
- {
- "description": "[dqbsr434] check rounding modes heeded (Rounded & Inexact)",
- "string": "1.11111111111111111111111111111234650"
- },
- {
- "description": "[dqbas938] overflow results at different rounding modes (Overflow & Inexact & Rounded)",
- "string": "7e10000"
- },
- {
- "description": "Inexact rounding#1",
- "string": "100000000000000000000000000000000000000000000000000000000001"
- },
- {
- "description": "Inexact rounding#2",
- "string": "1E-6177"
- }
- ]
-}
-`},
-
- {"decimal128-5.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "valid": [
- {
- "description": "[decq035] fold-downs (more below) (Clamped)",
- "bson": "18000000136400000000807F1BCF85B27059C8A43CFE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.23E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.230000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq037] fold-downs (more below) (Clamped)",
- "bson": "18000000136400000000000A5BC138938D44C64D31FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq077] Nmin and below (Subnormal)",
- "bson": "180000001364000000000081EFAC855B416D2DEE04000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.100000000000000000000000000000000E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E-6144\"}}"
- },
- {
- "description": "[decq078] Nmin and below (Subnormal)",
- "bson": "180000001364000000000081EFAC855B416D2DEE04000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E-6144\"}}"
- },
- {
- "description": "[decq079] Nmin and below (Subnormal)",
- "bson": "180000001364000A00000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000000000000000000000000000010E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-6175\"}}"
- },
- {
- "description": "[decq080] Nmin and below (Subnormal)",
- "bson": "180000001364000A00000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E-6175\"}}"
- },
- {
- "description": "[decq081] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000020000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.00000000000000000000000000000001E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6175\"}}"
- },
- {
- "description": "[decq082] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000020000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6175\"}}"
- },
- {
- "description": "[decq083] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0.000000000000000000000000000000001E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}"
- },
- {
- "description": "[decq084] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}"
- },
- {
- "description": "[decq090] underflows cannot be tested for simple copies, check edge cases (Subnormal)",
- "bson": "180000001364000100000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1e-6176\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1E-6176\"}}"
- },
- {
- "description": "[decq100] underflows cannot be tested for simple copies, check edge cases (Subnormal)",
- "bson": "18000000136400FFFFFFFF095BC138938D44C64D31000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"999999999999999999999999999999999e-6176\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"9.99999999999999999999999999999999E-6144\"}}"
- },
- {
- "description": "[decq130] fold-downs (more below) (Clamped)",
- "bson": "18000000136400000000807F1BCF85B27059C8A43CFEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.23E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.230000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq132] fold-downs (more below) (Clamped)",
- "bson": "18000000136400000000000A5BC138938D44C64D31FEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.000000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq177] Nmin and below (Subnormal)",
- "bson": "180000001364000000000081EFAC855B416D2DEE04008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.100000000000000000000000000000000E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00000000000000000000000000000000E-6144\"}}"
- },
- {
- "description": "[decq178] Nmin and below (Subnormal)",
- "bson": "180000001364000000000081EFAC855B416D2DEE04008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.00000000000000000000000000000000E-6144\"}}"
- },
- {
- "description": "[decq179] Nmin and below (Subnormal)",
- "bson": "180000001364000A00000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000000000000000000000000000010E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.0E-6175\"}}"
- },
- {
- "description": "[decq180] Nmin and below (Subnormal)",
- "bson": "180000001364000A00000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1.0E-6175\"}}"
- },
- {
- "description": "[decq181] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000028000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.00000000000000000000000000000001E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6175\"}}"
- },
- {
- "description": "[decq182] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000028000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6175\"}}"
- },
- {
- "description": "[decq183] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0.000000000000000000000000000000001E-6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}"
- },
- {
- "description": "[decq184] Nmin and below (Subnormal)",
- "bson": "180000001364000100000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}"
- },
- {
- "description": "[decq190] underflow edge cases (Subnormal)",
- "bson": "180000001364000100000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-1e-6176\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-1E-6176\"}}"
- },
- {
- "description": "[decq200] underflow edge cases (Subnormal)",
- "bson": "18000000136400FFFFFFFF095BC138938D44C64D31008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-999999999999999999999999999999999e-6176\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-9.99999999999999999999999999999999E-6144\"}}"
- },
- {
- "description": "[decq400] zeros (Clamped)",
- "bson": "180000001364000000000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-8000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}"
- },
- {
- "description": "[decq401] zeros (Clamped)",
- "bson": "180000001364000000000000000000000000000000000000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6177\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E-6176\"}}"
- },
- {
- "description": "[decq414] clamped zeros... (Clamped)",
- "bson": "180000001364000000000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6112\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}"
- },
- {
- "description": "[decq416] clamped zeros... (Clamped)",
- "bson": "180000001364000000000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}"
- },
- {
- "description": "[decq418] clamped zeros... (Clamped)",
- "bson": "180000001364000000000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+8000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"0E+6111\"}}"
- },
- {
- "description": "[decq420] negative zeros (Clamped)",
- "bson": "180000001364000000000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-8000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}"
- },
- {
- "description": "[decq421] negative zeros (Clamped)",
- "bson": "180000001364000000000000000000000000000000008000",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6177\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E-6176\"}}"
- },
- {
- "description": "[decq434] clamped zeros... (Clamped)",
- "bson": "180000001364000000000000000000000000000000FEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6112\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}"
- },
- {
- "description": "[decq436] clamped zeros... (Clamped)",
- "bson": "180000001364000000000000000000000000000000FEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}"
- },
- {
- "description": "[decq438] clamped zeros... (Clamped)",
- "bson": "180000001364000000000000000000000000000000FEDF00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+8000\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"-0E+6111\"}}"
- },
- {
- "description": "[decq601] fold-down full sequence (Clamped)",
- "bson": "18000000136400000000000A5BC138938D44C64D31FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6144\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000000E+6144\"}}"
- },
- {
- "description": "[decq603] fold-down full sequence (Clamped)",
- "bson": "180000001364000000000081EFAC855B416D2DEE04FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6143\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000000E+6143\"}}"
- },
- {
- "description": "[decq605] fold-down full sequence (Clamped)",
- "bson": "1800000013640000000080264B91C02220BE377E00FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6142\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000000E+6142\"}}"
- },
- {
- "description": "[decq607] fold-down full sequence (Clamped)",
- "bson": "1800000013640000000040EAED7446D09C2C9F0C00FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6141\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000000E+6141\"}}"
- },
- {
- "description": "[decq609] fold-down full sequence (Clamped)",
- "bson": "18000000136400000000A0CA17726DAE0F1E430100FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6140\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000000E+6140\"}}"
- },
- {
- "description": "[decq611] fold-down full sequence (Clamped)",
- "bson": "18000000136400000000106102253E5ECE4F200000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6139\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000000E+6139\"}}"
- },
- {
- "description": "[decq613] fold-down full sequence (Clamped)",
- "bson": "18000000136400000000E83C80D09F3C2E3B030000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6138\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000000E+6138\"}}"
- },
- {
- "description": "[decq615] fold-down full sequence (Clamped)",
- "bson": "18000000136400000000E4D20CC8DCD2B752000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6137\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000000E+6137\"}}"
- },
- {
- "description": "[decq617] fold-down full sequence (Clamped)",
- "bson": "180000001364000000004A48011416954508000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6136\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000000E+6136\"}}"
- },
- {
- "description": "[decq619] fold-down full sequence (Clamped)",
- "bson": "18000000136400000000A1EDCCCE1BC2D300000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6135\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000000E+6135\"}}"
- },
- {
- "description": "[decq621] fold-down full sequence (Clamped)",
- "bson": "18000000136400000080F64AE1C7022D1500000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6134\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000000E+6134\"}}"
- },
- {
- "description": "[decq623] fold-down full sequence (Clamped)",
- "bson": "18000000136400000040B2BAC9E0191E0200000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6133\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000000E+6133\"}}"
- },
- {
- "description": "[decq625] fold-down full sequence (Clamped)",
- "bson": "180000001364000000A0DEC5ADC935360000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6132\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000000E+6132\"}}"
- },
- {
- "description": "[decq627] fold-down full sequence (Clamped)",
- "bson": "18000000136400000010632D5EC76B050000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6131\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000000E+6131\"}}"
- },
- {
- "description": "[decq629] fold-down full sequence (Clamped)",
- "bson": "180000001364000000E8890423C78A000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6130\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000000E+6130\"}}"
- },
- {
- "description": "[decq631] fold-down full sequence (Clamped)",
- "bson": "18000000136400000064A7B3B6E00D000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6129\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000000E+6129\"}}"
- },
- {
- "description": "[decq633] fold-down full sequence (Clamped)",
- "bson": "1800000013640000008A5D78456301000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6128\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000000E+6128\"}}"
- },
- {
- "description": "[decq635] fold-down full sequence (Clamped)",
- "bson": "180000001364000000C16FF2862300000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6127\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000000E+6127\"}}"
- },
- {
- "description": "[decq637] fold-down full sequence (Clamped)",
- "bson": "180000001364000080C6A47E8D0300000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6126\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000000E+6126\"}}"
- },
- {
- "description": "[decq639] fold-down full sequence (Clamped)",
- "bson": "1800000013640000407A10F35A0000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6125\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000000E+6125\"}}"
- },
- {
- "description": "[decq641] fold-down full sequence (Clamped)",
- "bson": "1800000013640000A0724E18090000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6124\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000000E+6124\"}}"
- },
- {
- "description": "[decq643] fold-down full sequence (Clamped)",
- "bson": "180000001364000010A5D4E8000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6123\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000000E+6123\"}}"
- },
- {
- "description": "[decq645] fold-down full sequence (Clamped)",
- "bson": "1800000013640000E8764817000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6122\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000000E+6122\"}}"
- },
- {
- "description": "[decq647] fold-down full sequence (Clamped)",
- "bson": "1800000013640000E40B5402000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6121\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000000E+6121\"}}"
- },
- {
- "description": "[decq649] fold-down full sequence (Clamped)",
- "bson": "1800000013640000CA9A3B00000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6120\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000000E+6120\"}}"
- },
- {
- "description": "[decq651] fold-down full sequence (Clamped)",
- "bson": "1800000013640000E1F50500000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6119\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000000E+6119\"}}"
- },
- {
- "description": "[decq653] fold-down full sequence (Clamped)",
- "bson": "180000001364008096980000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6118\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000000E+6118\"}}"
- },
- {
- "description": "[decq655] fold-down full sequence (Clamped)",
- "bson": "1800000013640040420F0000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6117\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000000E+6117\"}}"
- },
- {
- "description": "[decq657] fold-down full sequence (Clamped)",
- "bson": "18000000136400A086010000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6116\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00000E+6116\"}}"
- },
- {
- "description": "[decq659] fold-down full sequence (Clamped)",
- "bson": "180000001364001027000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6115\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0000E+6115\"}}"
- },
- {
- "description": "[decq661] fold-down full sequence (Clamped)",
- "bson": "18000000136400E803000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6114\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.000E+6114\"}}"
- },
- {
- "description": "[decq663] fold-down full sequence (Clamped)",
- "bson": "180000001364006400000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6113\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.00E+6113\"}}"
- },
- {
- "description": "[decq665] fold-down full sequence (Clamped)",
- "bson": "180000001364000A00000000000000000000000000FE5F00",
- "extjson": "{\"d\" : {\"$numberDecimal\" : \"1E+6112\"}}",
- "canonical_extjson": "{\"d\" : {\"$numberDecimal\" : \"1.0E+6112\"}}"
- }
- ]
-}
-`},
-
- {"decimal128-6.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "parseErrors": [
- {
- "description": "Incomplete Exponent",
- "string": "1e"
- },
- {
- "description": "Exponent at the beginning",
- "string": "E01"
- },
- {
- "description": "Just a decimal place",
- "string": "."
- },
- {
- "description": "2 decimal places",
- "string": "..3"
- },
- {
- "description": "2 decimal places",
- "string": ".13.3"
- },
- {
- "description": "2 decimal places",
- "string": "1..3"
- },
- {
- "description": "2 decimal places",
- "string": "1.3.4"
- },
- {
- "description": "2 decimal places",
- "string": "1.34."
- },
- {
- "description": "Decimal with no digits",
- "string": ".e"
- },
- {
- "description": "2 signs",
- "string": "+-32.4"
- },
- {
- "description": "2 signs",
- "string": "-+32.4"
- },
- {
- "description": "2 negative signs",
- "string": "--32.4"
- },
- {
- "description": "2 negative signs",
- "string": "-32.-4"
- },
- {
- "description": "End in negative sign",
- "string": "32.0-"
- },
- {
- "description": "2 negative signs",
- "string": "32.4E--21"
- },
- {
- "description": "2 negative signs",
- "string": "32.4E-2-1"
- },
- {
- "description": "2 signs",
- "string": "32.4E+-21"
- },
- {
- "description": "Empty string",
- "string": ""
- },
- {
- "description": "leading white space positive number",
- "string": " 1"
- },
- {
- "description": "leading white space negative number",
- "string": " -1"
- },
- {
- "description": "trailing white space",
- "string": "1 "
- },
- {
- "description": "Invalid",
- "string": "E"
- },
- {
- "description": "Invalid",
- "string": "invalid"
- },
- {
- "description": "Invalid",
- "string": "i"
- },
- {
- "description": "Invalid",
- "string": "in"
- },
- {
- "description": "Invalid",
- "string": "-in"
- },
- {
- "description": "Invalid",
- "string": "Na"
- },
- {
- "description": "Invalid",
- "string": "-Na"
- },
- {
- "description": "Invalid",
- "string": "1.23abc"
- },
- {
- "description": "Invalid",
- "string": "1.23abcE+02"
- },
- {
- "description": "Invalid",
- "string": "1.23E+0aabs2"
- }
- ]
-}
-`},
-
- {"decimal128-7.json", `
-{
- "description": "Decimal128",
- "bson_type": "0x13",
- "test_key": "d",
- "parseErrors": [
- {
- "description": "[basx572] Near-specials (Conversion_syntax)",
- "string": "-9Inf"
- },
- {
- "description": "[basx516] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "-1-"
- },
- {
- "description": "[basx533] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "0000.."
- },
- {
- "description": "[basx534] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": ".0000."
- },
- {
- "description": "[basx535] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "00..00"
- },
- {
- "description": "[basx569] Near-specials (Conversion_syntax)",
- "string": "0Inf"
- },
- {
- "description": "[basx571] Near-specials (Conversion_syntax)",
- "string": "-0Inf"
- },
- {
- "description": "[basx575] Near-specials (Conversion_syntax)",
- "string": "0sNaN"
- },
- {
- "description": "[basx503] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "++1"
- },
- {
- "description": "[basx504] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "--1"
- },
- {
- "description": "[basx505] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "-+1"
- },
- {
- "description": "[basx506] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "+-1"
- },
- {
- "description": "[basx510] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": " +1"
- },
- {
- "description": "[basx513] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": " + 1"
- },
- {
- "description": "[basx514] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": " - 1"
- },
- {
- "description": "[basx501] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "."
- },
- {
- "description": "[basx502] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": ".."
- },
- {
- "description": "[basx519] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": ""
- },
- {
- "description": "[basx525] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "e100"
- },
- {
- "description": "[basx549] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "e+1"
- },
- {
- "description": "[basx577] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": ".e+1"
- },
- {
- "description": "[basx578] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "+.e+1"
- },
- {
- "description": "[basx581] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "E+1"
- },
- {
- "description": "[basx582] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": ".E+1"
- },
- {
- "description": "[basx583] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "+.E+1"
- },
- {
- "description": "[basx579] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "-.e+"
- },
- {
- "description": "[basx580] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "-.e"
- },
- {
- "description": "[basx584] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "-.E+"
- },
- {
- "description": "[basx585] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "-.E"
- },
- {
- "description": "[basx589] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "+.Inf"
- },
- {
- "description": "[basx586] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": ".NaN"
- },
- {
- "description": "[basx587] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "-.NaN"
- },
- {
- "description": "[basx545] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "ONE"
- },
- {
- "description": "[basx561] Near-specials (Conversion_syntax)",
- "string": "qNaN"
- },
- {
- "description": "[basx573] Near-specials (Conversion_syntax)",
- "string": "-sNa"
- },
- {
- "description": "[basx588] some baddies with dots and Es and dots and specials (Conversion_syntax)",
- "string": "+.sNaN"
- },
- {
- "description": "[basx544] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "ten"
- },
- {
- "description": "[basx527] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "u0b65"
- },
- {
- "description": "[basx526] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "u0e5a"
- },
- {
- "description": "[basx515] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "x"
- },
- {
- "description": "[basx574] Near-specials (Conversion_syntax)",
- "string": "xNaN"
- },
- {
- "description": "[basx530] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": ".123.5"
- },
- {
- "description": "[basx500] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1..2"
- },
- {
- "description": "[basx542] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1e1.0"
- },
- {
- "description": "[basx553] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E+1.2.3"
- },
- {
- "description": "[basx543] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1e123e"
- },
- {
- "description": "[basx552] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E+1.2"
- },
- {
- "description": "[basx546] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1e.1"
- },
- {
- "description": "[basx547] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1e1."
- },
- {
- "description": "[basx554] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E++1"
- },
- {
- "description": "[basx555] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E--1"
- },
- {
- "description": "[basx556] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E+-1"
- },
- {
- "description": "[basx557] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E-+1"
- },
- {
- "description": "[basx558] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E'1"
- },
- {
- "description": "[basx559] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E\"1"
- },
- {
- "description": "[basx520] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1e-"
- },
- {
- "description": "[basx560] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1E"
- },
- {
- "description": "[basx548] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1ee"
- },
- {
- "description": "[basx551] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1.2.1"
- },
- {
- "description": "[basx550] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1.23.4"
- },
- {
- "description": "[basx529] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "1.34.5"
- },
- {
- "description": "[basx531] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "01.35."
- },
- {
- "description": "[basx532] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "01.35-"
- },
- {
- "description": "[basx518] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "3+"
- },
- {
- "description": "[basx521] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "7e99999a"
- },
- {
- "description": "[basx570] Near-specials (Conversion_syntax)",
- "string": "9Inf"
- },
- {
- "description": "[basx512] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "12 "
- },
- {
- "description": "[basx517] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "12-"
- },
- {
- "description": "[basx507] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "12e"
- },
- {
- "description": "[basx508] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "12e++"
- },
- {
- "description": "[basx509] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "12f4"
- },
- {
- "description": "[basx536] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "111e*123"
- },
- {
- "description": "[basx537] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "111e123-"
- },
- {
- "description": "[basx540] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "111e1*23"
- },
- {
- "description": "[basx538] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "111e+12+"
- },
- {
- "description": "[basx539] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "111e1-3-"
- },
- {
- "description": "[basx541] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "111E1e+3"
- },
- {
- "description": "[basx528] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "123,65"
- },
- {
- "description": "[basx523] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "7e12356789012x"
- },
- {
- "description": "[basx522] The 'baddies' tests from DiagBigDecimal, plus some new ones (Conversion_syntax)",
- "string": "7e123567890x"
- }
- ]
-}
-`},
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/json_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/json_test.go
deleted file mode 100644
index 866f51c34e3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bson/json_test.go
+++ /dev/null
@@ -1,184 +0,0 @@
-package bson_test
-
-import (
- "gopkg.in/mgo.v2/bson"
-
- . "gopkg.in/check.v1"
- "reflect"
- "strings"
- "time"
-)
-
-type jsonTest struct {
- a interface{} // value encoded into JSON (optional)
- b string // JSON expected as output of <a>, and used as input to <c>
- c interface{} // Value expected from decoding <b>, defaults to <a>
- e string // error string, if decoding (b) should fail
-}
-
-var jsonTests = []jsonTest{
- // $binary
- {
- a: []byte("foo"),
- b: `{"$binary":"Zm9v","$type":"0x0"}`,
- }, {
- a: bson.Binary{Kind: 2, Data: []byte("foo")},
- b: `{"$binary":"Zm9v","$type":"0x2"}`,
- }, {
- b: `BinData(2,"Zm9v")`,
- c: bson.Binary{Kind: 2, Data: []byte("foo")},
- },
-
- // $date
- {
- a: time.Date(2016, 5, 15, 1, 2, 3, 4000000, time.UTC),
- b: `{"$date":"2016-05-15T01:02:03.004Z"}`,
- }, {
- b: `{"$date": {"$numberLong": "1002"}}`,
- c: time.Date(1970, 1, 1, 0, 0, 1, 2e6, time.UTC),
- }, {
- b: `ISODate("2016-05-15T01:02:03.004Z")`,
- c: time.Date(2016, 5, 15, 1, 2, 3, 4000000, time.UTC),
- }, {
- b: `new Date(1000)`,
- c: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
- }, {
- b: `new Date("2016-05-15")`,
- c: time.Date(2016, 5, 15, 0, 0, 0, 0, time.UTC),
- },
-
- // $timestamp
- {
- a: bson.MongoTimestamp(4294967298),
- b: `{"$timestamp":{"t":1,"i":2}}`,
- }, {
- b: `Timestamp(1, 2)`,
- c: bson.MongoTimestamp(4294967298),
- },
-
- // $regex
- {
- a: bson.RegEx{"pattern", "options"},
- b: `{"$regex":"pattern","$options":"options"}`,
- },
-
- // $oid
- {
- a: bson.ObjectIdHex("0123456789abcdef01234567"),
- b: `{"$oid":"0123456789abcdef01234567"}`,
- }, {
- b: `ObjectId("0123456789abcdef01234567")`,
- c: bson.ObjectIdHex("0123456789abcdef01234567"),
- },
-
- // $ref (no special type)
- {
- b: `DBRef("name", "id")`,
- c: map[string]interface{}{"$ref": "name", "$id": "id"},
- },
-
- // $numberLong
- {
- a: 123,
- b: `123`,
- }, {
- a: int64(9007199254740992),
- b: `{"$numberLong":9007199254740992}`,
- }, {
- a: int64(1<<53 + 1),
- b: `{"$numberLong":"9007199254740993"}`,
- }, {
- a: 1<<53 + 1,
- b: `{"$numberLong":"9007199254740993"}`,
- c: int64(9007199254740993),
- }, {
- b: `NumberLong(9007199254740992)`,
- c: int64(1 << 53),
- }, {
- b: `NumberLong("9007199254740993")`,
- c: int64(1<<53 + 1),
- },
-
- // $minKey, $maxKey
- {
- a: bson.MinKey,
- b: `{"$minKey":1}`,
- }, {
- a: bson.MaxKey,
- b: `{"$maxKey":1}`,
- }, {
- b: `MinKey`,
- c: bson.MinKey,
- }, {
- b: `MaxKey`,
- c: bson.MaxKey,
- }, {
- b: `{"$minKey":0}`,
- e: `invalid $minKey object: {"$minKey":0}`,
- }, {
- b: `{"$maxKey":0}`,
- e: `invalid $maxKey object: {"$maxKey":0}`,
- },
-
- {
- a: bson.Undefined,
- b: `{"$undefined":true}`,
- }, {
- b: `undefined`,
- c: bson.Undefined,
- }, {
- b: `{"v": undefined}`,
- c: struct{ V interface{} }{bson.Undefined},
- },
-
- // Unquoted keys and trailing commas
- {
- b: `{$foo: ["bar",],}`,
- c: map[string]interface{}{"$foo": []interface{}{"bar"}},
- },
-}
-
-func (s *S) TestJSON(c *C) {
- for i, item := range jsonTests {
- c.Logf("------------ (#%d)", i)
- c.Logf("A: %#v", item.a)
- c.Logf("B: %#v", item.b)
-
- if item.c == nil {
- item.c = item.a
- } else {
- c.Logf("C: %#v", item.c)
- }
- if item.e != "" {
- c.Logf("E: %s", item.e)
- }
-
- if item.a != nil {
- data, err := bson.MarshalJSON(item.a)
- c.Assert(err, IsNil)
- c.Logf("Dumped: %#v", string(data))
- c.Assert(strings.TrimSuffix(string(data), "\n"), Equals, item.b)
- }
-
- var zero interface{}
- if item.c == nil {
- zero = &struct{}{}
- } else {
- zero = reflect.New(reflect.TypeOf(item.c)).Interface()
- }
- err := bson.UnmarshalJSON([]byte(item.b), zero)
- if item.e != "" {
- c.Assert(err, NotNil)
- c.Assert(err.Error(), Equals, item.e)
- continue
- }
- c.Assert(err, IsNil)
- zerov := reflect.ValueOf(zero)
- value := zerov.Interface()
- if zerov.Kind() == reflect.Ptr {
- value = zerov.Elem().Interface()
- }
- c.Logf("Loaded: %#v", value)
- c.Assert(value, DeepEquals, item.c)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bulk_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bulk_test.go
deleted file mode 100644
index cb280bbfa40..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/bulk_test.go
+++ /dev/null
@@ -1,504 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2015 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo_test
-
-import (
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
-)
-
-func (s *S) TestBulkInsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Insert(M{"n": 1})
- bulk.Insert(M{"n": 2}, M{"n": 3})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {2}, {3}})
-}
-
-func (s *S) TestBulkInsertError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Insert(M{"_id": 1}, M{"_id": 2}, M{"_id": 2}, M{"_id": 3})
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-
- type doc struct {
- N int `_id`
- }
- var res []doc
- err = coll.Find(nil).Sort("_id").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {2}})
-}
-
-func (s *S) TestBulkInsertErrorUnordered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": 1}, M{"_id": 2}, M{"_id": 2}, M{"_id": 3})
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
-
- type doc struct {
- N int `_id`
- }
- var res []doc
- err = coll.Find(nil).Sort("_id").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {2}, {3}})
-}
-
-func (s *S) TestBulkInsertErrorUnorderedSplitBatch(c *C) {
- // The server has a batch limit of 1000 documents when using write commands.
- // This artificial limit did not exist with the old wire protocol, so to
- // avoid compatibility issues the implementation internally split batches
- // into the proper size and delivers them one by one. This test ensures that
- // the behavior of unordered (that is, continue on error) remains correct
- // when errors happen and there are batches left.
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- bulk := coll.Bulk()
- bulk.Unordered()
-
- const total = 4096
- type doc struct {
- Id int `_id`
- }
- docs := make([]interface{}, total)
- for i := 0; i < total; i++ {
- docs[i] = doc{i}
- }
- docs[1] = doc{0}
- bulk.Insert(docs...)
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
-
- n, err := coll.Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, total-1)
-
- var res doc
- err = coll.FindId(1500).One(&res)
- c.Assert(err, IsNil)
- c.Assert(res.Id, Equals, 1500)
-}
-
-func (s *S) TestBulkErrorString(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // If it's just the same string multiple times, join it into a single message.
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": 1}, M{"_id": 2}, M{"_id": 2})
- _, err = bulk.Run()
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
- c.Assert(err, Not(ErrorMatches), ".*duplicate key.*duplicate key")
- c.Assert(mgo.IsDup(err), Equals, true)
-
- // With matching errors but different messages, present them all.
- bulk = coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": "dupone"}, M{"_id": "dupone"}, M{"_id": "duptwo"}, M{"_id": "duptwo"})
- _, err = bulk.Run()
- if s.versionAtLeast(2, 6) {
- c.Assert(err, ErrorMatches, "multiple errors in bulk operation:\n( - .*duplicate.*\n){2}$")
- c.Assert(err, ErrorMatches, "(?s).*dupone.*")
- c.Assert(err, ErrorMatches, "(?s).*duptwo.*")
- } else {
- // Wire protocol query doesn't return all errors.
- c.Assert(err, ErrorMatches, ".*duplicate.*")
- }
- c.Assert(mgo.IsDup(err), Equals, true)
-
- // With mixed errors, present them all.
- bulk = coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"_id": 1}, M{"_id": []int{2}})
- _, err = bulk.Run()
- if s.versionAtLeast(2, 6) {
- c.Assert(err, ErrorMatches, "multiple errors in bulk operation:\n - .*duplicate.*\n - .*array.*\n$")
- } else {
- // Wire protocol query doesn't return all errors.
- c.Assert(err, ErrorMatches, ".*array.*")
- }
- c.Assert(mgo.IsDup(err), Equals, false)
-}
-
-func (s *S) TestBulkErrorCases_2_6(c *C) {
- if !s.versionAtLeast(2, 6) {
- c.Skip("2.4- has poor bulk reporting")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- bulk := coll.Bulk()
- bulk.Unordered()
-
- // There's a limit of 1000 operations per command, so
- // this forces the more complex indexing logic to act.
- for i := 0; i < 1010; i++ {
- switch i {
- case 3, 14:
- bulk.Insert(M{"_id": "dupone"})
- case 5, 106:
- bulk.Update(M{"_id": i - 1}, M{"$set": M{"_id": 4}})
- case 7, 1008:
- bulk.Insert(M{"_id": "duptwo"})
- default:
- bulk.Insert(M{"_id": i})
- }
- }
-
- _, err = bulk.Run()
- ecases := err.(*mgo.BulkError).Cases()
-
- c.Check(ecases[0].Err, ErrorMatches, ".*duplicate.*dupone.*")
- c.Check(ecases[0].Index, Equals, 14)
- c.Check(ecases[1].Err, ErrorMatches, ".*update.*_id.*")
- c.Check(ecases[1].Index, Equals, 106)
- c.Check(ecases[2].Err, ErrorMatches, ".*duplicate.*duptwo.*")
- c.Check(ecases[2].Index, Equals, 1008)
-}
-
-func (s *S) TestBulkErrorCases_2_4(c *C) {
- if s.versionAtLeast(2, 6) {
- c.Skip("2.6+ has better reporting")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- bulk := coll.Bulk()
- bulk.Unordered()
-
- // There's a limit of 1000 operations per command, so
- // this forces the more complex indexing logic to act.
- for i := 0; i < 1010; i++ {
- switch i {
- case 3, 14:
- bulk.Insert(M{"_id": "dupone"})
- case 5:
- bulk.Update(M{"_id": i - 1}, M{"$set": M{"n": 4}})
- case 106:
- bulk.Update(M{"_id": i - 1}, M{"$bogus": M{"n": 4}})
- case 7, 1008:
- bulk.Insert(M{"_id": "duptwo"})
- default:
- bulk.Insert(M{"_id": i})
- }
- }
-
- _, err = bulk.Run()
- ecases := err.(*mgo.BulkError).Cases()
-
- c.Check(ecases[0].Err, ErrorMatches, ".*duplicate.*duptwo.*")
- c.Check(ecases[0].Index, Equals, -1)
- c.Check(ecases[1].Err, ErrorMatches, `.*\$bogus.*`)
- c.Check(ecases[1].Index, Equals, 106)
-}
-
-func (s *S) TestBulkErrorCasesOrdered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- bulk := coll.Bulk()
-
- // There's a limit of 1000 operations per command, so
- // this forces the more complex indexing logic to act.
- for i := 0; i < 20; i++ {
- switch i {
- case 3, 14:
- bulk.Insert(M{"_id": "dupone"})
- case 7, 17:
- bulk.Insert(M{"_id": "duptwo"})
- default:
- bulk.Insert(M{"_id": i})
- }
- }
-
- _, err = bulk.Run()
- ecases := err.(*mgo.BulkError).Cases()
-
- c.Check(ecases[0].Err, ErrorMatches, ".*duplicate.*dupone.*")
- if s.versionAtLeast(2, 6) {
- c.Check(ecases[0].Index, Equals, 14)
- } else {
- c.Check(ecases[0].Index, Equals, -1)
- }
- c.Check(ecases, HasLen, 1)
-}
-
-func (s *S) TestBulkUpdate(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Update(M{"n": 1}, M{"$set": M{"n": 1}})
- bulk.Update(M{"n": 2}, M{"$set": M{"n": 20}})
- bulk.Update(M{"n": 5}, M{"$set": M{"n": 50}}) // Won't match.
- bulk.Update(M{"n": 1}, M{"$set": M{"n": 10}}, M{"n": 3}, M{"$set": M{"n": 30}})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 4)
- if s.versionAtLeast(2, 6) {
- c.Assert(r.Modified, Equals, 3)
- }
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{10}, {20}, {30}})
-}
-
-func (s *S) TestBulkUpdateError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Update(
- M{"n": 1}, M{"$set": M{"n": 10}},
- M{"n": 2}, M{"$set": M{"n": 20, "_id": 20}},
- M{"n": 3}, M{"$set": M{"n": 30}},
- )
- r, err := bulk.Run()
- c.Assert(err, ErrorMatches, ".*_id.*")
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{2}, {3}, {10}})
-}
-
-func (s *S) TestBulkUpdateErrorUnordered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Update(
- M{"n": 1}, M{"$set": M{"n": 10}},
- M{"n": 2}, M{"$set": M{"n": 20, "_id": 20}},
- M{"n": 3}, M{"$set": M{"n": 30}},
- )
- r, err := bulk.Run()
- c.Assert(err, ErrorMatches, ".*_id.*")
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{2}, {10}, {30}})
-}
-
-func (s *S) TestBulkUpdateAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.UpdateAll(M{"n": 1}, M{"$set": M{"n": 10}})
- bulk.UpdateAll(M{"n": 2}, M{"$set": M{"n": 2}}) // Won't change.
- bulk.UpdateAll(M{"n": 5}, M{"$set": M{"n": 50}}) // Won't match.
- bulk.UpdateAll(M{}, M{"$inc": M{"n": 1}}, M{"n": 11}, M{"$set": M{"n": 5}})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 6)
- if s.versionAtLeast(2, 6) {
- c.Assert(r.Modified, Equals, 5)
- }
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{3}, {4}, {5}})
-}
-
-func (s *S) TestBulkMixedUnordered(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Abuse undefined behavior to ensure the desired implementation is in place.
- bulk := coll.Bulk()
- bulk.Unordered()
- bulk.Insert(M{"n": 1})
- bulk.Update(M{"n": 2}, M{"$inc": M{"n": 1}})
- bulk.Insert(M{"n": 2})
- bulk.Update(M{"n": 3}, M{"$inc": M{"n": 1}})
- bulk.Update(M{"n": 1}, M{"$inc": M{"n": 1}})
- bulk.Insert(M{"n": 3})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 3)
- if s.versionAtLeast(2, 6) {
- c.Assert(r.Modified, Equals, 3)
- }
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{2}, {3}, {4}})
-}
-
-func (s *S) TestBulkUpsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Upsert(M{"n": 2}, M{"$set": M{"n": 20}})
- bulk.Upsert(M{"n": 4}, M{"$set": M{"n": 40}}, M{"n": 3}, M{"$set": M{"n": 30}})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r, FitsTypeOf, &mgo.BulkResult{})
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{1}, {20}, {30}, {40}})
-}
-
-func (s *S) TestBulkRemove(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3}, M{"n": 4}, M{"n": 4})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.Remove(M{"n": 1})
- bulk.Remove(M{"n": 2}, M{"n": 4})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 3)
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{3}, {4}})
-}
-
-func (s *S) TestBulkRemoveAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1}, M{"n": 2}, M{"n": 3}, M{"n": 4}, M{"n": 4})
- c.Assert(err, IsNil)
-
- bulk := coll.Bulk()
- bulk.RemoveAll(M{"n": 1})
- bulk.RemoveAll(M{"n": 2}, M{"n": 4})
- r, err := bulk.Run()
- c.Assert(err, IsNil)
- c.Assert(r.Matched, Equals, 4)
-
- type doc struct{ N int }
- var res []doc
- err = coll.Find(nil).Sort("n").All(&res)
- c.Assert(err, IsNil)
- c.Assert(res, DeepEquals, []doc{{3}})
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/cluster_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/cluster_test.go
deleted file mode 100644
index a19a2320aaf..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/cluster_test.go
+++ /dev/null
@@ -1,2101 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo_test
-
-import (
- "fmt"
- "io"
- "net"
- "strings"
- "sync"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/bson"
-)
-
-func (s *S) TestNewSession(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Do a dummy operation to wait for connection.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Tweak safety and query settings to ensure other has copied those.
- session.SetSafe(nil)
- session.SetBatch(-1)
- other := session.New()
- defer other.Close()
- session.SetSafe(&mgo.Safe{})
-
- // Clone was copied while session was unsafe, so no errors.
- otherColl := other.DB("mydb").C("mycoll")
- err = otherColl.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Original session was made safe again.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, NotNil)
-
- // With New(), each session has its own socket now.
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 2)
-
- // Ensure query parameters were cloned.
- err = otherColl.Insert(M{"_id": 2})
- c.Assert(err, IsNil)
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(other.Ping(), IsNil)
-
- mgo.ResetStats()
-
- iter := otherColl.Find(M{}).Iter()
- c.Assert(err, IsNil)
-
- m := M{}
- ok := iter.Next(m)
- c.Assert(ok, Equals, true)
- err = iter.Close()
- c.Assert(err, IsNil)
-
- // If Batch(-1) is in effect, a single document must have been received.
- stats = mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 1)
-}
-
-func (s *S) TestCloneSession(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Do a dummy operation to wait for connection.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Tweak safety and query settings to ensure clone is copying those.
- session.SetSafe(nil)
- session.SetBatch(-1)
- clone := session.Clone()
- defer clone.Close()
- session.SetSafe(&mgo.Safe{})
-
- // Clone was copied while session was unsafe, so no errors.
- cloneColl := clone.DB("mydb").C("mycoll")
- err = cloneColl.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Original session was made safe again.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, NotNil)
-
- // With Clone(), same socket is shared between sessions now.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
- c.Assert(stats.SocketRefs, Equals, 2)
-
- // Refreshing one of them should let the original socket go,
- // while preserving the safety settings.
- clone.Refresh()
- err = cloneColl.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Must have used another connection now.
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 2)
- c.Assert(stats.SocketRefs, Equals, 2)
-
- // Ensure query parameters were cloned.
- err = cloneColl.Insert(M{"_id": 2})
- c.Assert(err, IsNil)
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(clone.Ping(), IsNil)
-
- mgo.ResetStats()
-
- iter := cloneColl.Find(M{}).Iter()
- c.Assert(err, IsNil)
-
- m := M{}
- ok := iter.Next(m)
- c.Assert(ok, Equals, true)
- err = iter.Close()
- c.Assert(err, IsNil)
-
- // If Batch(-1) is in effect, a single document must have been received.
- stats = mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 1)
-}
-
-func (s *S) TestModeStrong(c *C) {
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
- session.SetMode(mgo.Strong, false)
-
- c.Assert(session.Mode(), Equals, mgo.Strong)
-
- result := M{}
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- session.SetMode(mgo.Strong, true)
-
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeMonotonic(c *C) {
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
-
- c.Assert(session.Mode(), Equals, mgo.Monotonic)
-
- var result struct{ IsMaster bool }
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.IsMaster, Equals, false)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.IsMaster, Equals, true)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 2)
-
- session.SetMode(mgo.Monotonic, true)
-
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeMonotonicAfterStrong(c *C) {
- // Test that a strong session shifting to a monotonic
- // one preserves the socket untouched.
-
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Insert something to force a connection to the master.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- session.SetMode(mgo.Monotonic, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // Master socket should still be reserved.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Confirm it's the master even though it's Monotonic by now.
- result := M{}
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-}
-
-func (s *S) TestModeStrongAfterMonotonic(c *C) {
- // Test that shifting from Monotonic to Strong while
- // using a slave socket will keep the socket reserved
- // until the master socket is necessary, so that no
- // switch over occurs unless it's actually necessary.
-
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
-
- // Ensure we're talking to a slave, and reserve the socket.
- result := M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, false)
-
- // Switch to a Strong session.
- session.SetMode(mgo.Strong, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // Slave socket should still be reserved.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // But any operation will switch it to the master.
- result = M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-}
-
-func (s *S) TestModeMonotonicWriteOnIteration(c *C) {
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, false)
-
- c.Assert(session.Mode(), Equals, mgo.Monotonic)
-
- coll1 := session.DB("mydb").C("mycoll1")
- coll2 := session.DB("mydb").C("mycoll2")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll1.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- // Release master so we can grab a slave again.
- session.Refresh()
-
- // Wait until synchronization is done.
- for {
- n, err := coll1.Count()
- c.Assert(err, IsNil)
- if n == len(ns) {
- break
- }
- }
-
- iter := coll1.Find(nil).Batch(2).Iter()
- i := 0
- m := M{}
- for iter.Next(&m) {
- i++
- if i > 3 {
- err := coll2.Insert(M{"n": 47 + i})
- c.Assert(err, IsNil)
- }
- }
- c.Assert(i, Equals, len(ns))
-}
-
-func (s *S) TestModeEventual(c *C) {
- // Must necessarily connect to a slave, otherwise the
- // master connection will be available first.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Eventual, false)
-
- c.Assert(session.Mode(), Equals, mgo.Eventual)
-
- result := M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, false)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- result = M{}
- err = session.Run("ismaster", &result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeEventualAfterStrong(c *C) {
- // Test that a strong session shifting to an eventual
- // one preserves the socket untouched.
-
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Insert something to force a connection to the master.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- session.SetMode(mgo.Eventual, false)
-
- // Wait since the sync also uses sockets.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // Master socket should still be reserved.
- stats := mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Confirm it's the master even though it's Eventual by now.
- result := M{}
- cmd := session.DB("admin").C("$cmd")
- err = cmd.Find(M{"ismaster": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result["ismaster"], Equals, true)
-
- session.SetMode(mgo.Eventual, true)
-
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestModeStrongFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // With strong consistency, this will open a socket to the master.
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Kill the master.
- host := result.Host
- s.Stop(host)
-
- // This must fail, since the connection was broken.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // With strong consistency, it fails again until reset.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Now we should be able to talk to the new master.
- // Increase the timeout since this may take quite a while.
- session.SetSyncTimeout(3 * time.Minute)
-
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Not(Equals), host)
-
- // Insert some data to confirm it's indeed a master.
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 42})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModePrimaryHiccup(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // With strong consistency, this will open a socket to the master.
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Establish a few extra sessions to create spare sockets to
- // the master. This increases a bit the chances of getting an
- // incorrect cached socket.
- var sessions []*mgo.Session
- for i := 0; i < 20; i++ {
- sessions = append(sessions, session.Copy())
- err = sessions[len(sessions)-1].Run("serverStatus", result)
- c.Assert(err, IsNil)
- }
- for i := range sessions {
- sessions[i].Close()
- }
-
- // Kill the master, but bring it back immediatelly.
- host := result.Host
- s.Stop(host)
- s.StartAll()
-
- // This must fail, since the connection was broken.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // With strong consistency, it fails again until reset.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Now we should be able to talk to the new master.
- // Increase the timeout since this may take quite a while.
- session.SetSyncTimeout(3 * time.Minute)
-
- // Insert some data to confirm it's indeed a master.
- err = session.DB("mydb").C("mycoll").Insert(M{"n": 42})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModeMonotonicFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- // Insert something to force a switch to the master.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait a bit for this to be synchronized to slaves.
- time.Sleep(3 * time.Second)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Kill the master.
- host := result.Host
- s.Stop(host)
- // Wait a bit for this to be take effect as recent servers do some cleanup
- // before shutdown
- time.Sleep(2 * time.Second)
-
- // This must fail, since the connection was broken.
- err = session.Run("serverStatus", result)
- c.Assert(err, NotNil)
-
- // With monotonic consistency, it fails again until reset.
- err = session.Run("serverStatus", result)
- c.Assert(err, NotNil)
-
- session.Refresh()
-
- // Now we should be able to talk to the new master.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Not(Equals), host)
-}
-
-func (s *S) TestModeMonotonicWithSlaveFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // Create new monotonic session with an explicit address to ensure
- // a slave is synchronized before the master, otherwise a connection
- // with the master may be used below for lack of other options.
- var addr string
- switch {
- case strings.HasSuffix(ssresult.Host, ":40021"):
- addr = "localhost:40022"
- case strings.HasSuffix(ssresult.Host, ":40022"):
- addr = "localhost:40021"
- case strings.HasSuffix(ssresult.Host, ":40023"):
- addr = "localhost:40021"
- default:
- c.Fatal("Unknown host: ", ssresult.Host)
- }
-
- session, err = mgo.Dial(addr)
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- // Check the address of the socket associated with the monotonic session.
- c.Log("Running serverStatus and isMaster with monotonic session")
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- slave := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, false, Commentf("%s is not a slave", slave))
-
- c.Assert(master, Not(Equals), slave)
-
- // Kill the master.
- s.Stop(master)
-
- // Session must still be good, since we were talking to a slave.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
-
- c.Assert(ssresult.Host, Equals, slave,
- Commentf("Monotonic session moved from %s to %s", slave, ssresult.Host))
-
- // If we try to insert something, it'll have to hold until the new
- // master is available to move the connection, and work correctly.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Must now be talking to the new master.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // ... which is not the old one, since it's still dead.
- c.Assert(ssresult.Host, Not(Equals), master)
-}
-
-func (s *S) TestModeEventualFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- master := result.Host
-
- session.SetMode(mgo.Eventual, true)
-
- // Should connect to the master when needed.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait a bit for this to be synchronized to slaves.
- time.Sleep(3 * time.Second)
-
- // Kill the master.
- s.Stop(master)
-
- // Should still work, with the new master now.
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Not(Equals), master)
-}
-
-func (s *S) TestModeSecondaryJustPrimary(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Secondary, true)
-
- err = session.Ping()
- c.Assert(err, ErrorMatches, "no reachable servers")
-}
-
-func (s *S) TestModeSecondaryPreferredJustPrimary(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.SecondaryPreferred, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModeSecondaryPreferredFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Ensure secondaries are available for being picked up.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- session.SetMode(mgo.SecondaryPreferred, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Not(Equals), "rs1a")
- secondary := result.Host
-
- // Should connect to the primary when needed.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Wait a bit for this to be synchronized to slaves.
- time.Sleep(3 * time.Second)
-
- // Kill the primary.
- s.Stop("localhost:40011")
-
- // It can still talk to the selected secondary.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Equals, secondary)
-
- // But cannot speak to the primary until reset.
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, Equals, io.EOF)
-
- session.Refresh()
-
- // Can still talk to a secondary.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Not(Equals), "rs1a")
-
- s.StartAll()
-
- // Should now be able to talk to the primary again.
- coll = session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestModePrimaryPreferredFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.PrimaryPreferred, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Equals, "rs1a")
-
- // Kill the primary.
- s.Stop("localhost:40011")
-
- // Should now fail as there was a primary socket in use already.
- err = session.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // Refresh so the reserved primary socket goes away.
- session.Refresh()
-
- // Should be able to talk to the secondary.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- s.StartAll()
-
- // Should wait for the new primary to become available.
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // And should use the new primary in general, as it is preferred.
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Equals, "rs1a")
-}
-
-func (s *S) TestModePrimaryFallover(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSyncTimeout(3 * time.Second)
-
- session.SetMode(mgo.Primary, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Equals, "rs1a")
-
- // Kill the primary.
- s.Stop("localhost:40011")
-
- session.Refresh()
-
- err = session.Ping()
- c.Assert(err, ErrorMatches, "no reachable servers")
-}
-
-func (s *S) TestModeSecondary(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Secondary, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(supvName(result.Host), Not(Equals), "rs1a")
- secondary := result.Host
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(result.Host, Equals, secondary)
-}
-
-func (s *S) TestPreserveSocketCountOnSync(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- stats := mgo.GetStats()
- for stats.SocketsAlive != 3 {
- c.Logf("Waiting for all connections to be established (sockets alive currently %d)...", stats.SocketsAlive)
- stats = mgo.GetStats()
- time.Sleep(5e8)
- }
-
- c.Assert(stats.SocketsAlive, Equals, 3)
-
- // Kill the master (with rs1, 'a' is always the master).
- s.Stop("localhost:40011")
-
- // Wait for the logic to run for a bit and bring it back.
- startedAll := make(chan bool)
- go func() {
- time.Sleep(5e9)
- s.StartAll()
- startedAll <- true
- }()
-
- // Do not allow the test to return before the goroutine above is done.
- defer func() {
- <-startedAll
- }()
-
- // Do an action to kick the resync logic in, and also to
- // wait until the cluster recognizes the server is back.
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, true)
-
- for i := 0; i != 20; i++ {
- stats = mgo.GetStats()
- if stats.SocketsAlive == 3 {
- break
- }
- c.Logf("Waiting for 3 sockets alive, have %d", stats.SocketsAlive)
- time.Sleep(5e8)
- }
-
- // Ensure the number of sockets is preserved after syncing.
- stats = mgo.GetStats()
- c.Assert(stats.SocketsAlive, Equals, 3)
- c.Assert(stats.SocketsInUse, Equals, 1)
- c.Assert(stats.SocketRefs, Equals, 1)
-}
-
-// Connect to the master of a deployment with a single server,
-// run an insert, and then ensure the insert worked and that a
-// single connection was established.
-func (s *S) TestTopologySyncWithSingleMaster(c *C) {
- // Use hostname here rather than IP, to make things trickier.
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
-
- // One connection used for discovery. Master socket recycled for
- // insert. Socket is reserved after insert.
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 0)
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Refresh session and socket must be released.
- session.Refresh()
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestTopologySyncWithSlaveSeed(c *C) {
- // That's supposed to be a slave. Must run discovery
- // and find out master to insert successfully.
- session, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, true)
-
- // One connection to each during discovery. Master
- // socket recycled for insert.
- stats := mgo.GetStats()
- c.Assert(stats.MasterConns, Equals, 1)
- c.Assert(stats.SlaveConns, Equals, 2)
-
- // Only one socket reference alive, in the master socket owned
- // by the above session.
- c.Assert(stats.SocketsInUse, Equals, 1)
-
- // Refresh it, and it must be gone.
- session.Refresh()
- stats = mgo.GetStats()
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestSyncTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- s.Stop("localhost:40001")
-
- timeout := 3 * time.Second
- session.SetSyncTimeout(timeout)
- started := time.Now()
-
- // Do something.
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, ErrorMatches, "no reachable servers")
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-timeout*2)), Equals, true)
-}
-
-func (s *S) TestDialWithTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- timeout := 2 * time.Second
- started := time.Now()
-
- // 40009 isn't used by the test servers.
- session, err := mgo.DialWithTimeout("localhost:40009", timeout)
- if session != nil {
- session.Close()
- }
- c.Assert(err, ErrorMatches, "no reachable servers")
- c.Assert(session, IsNil)
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-timeout*2)), Equals, true)
-}
-
-func (s *S) TestSocketTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- s.Freeze("localhost:40001")
-
- timeout := 3 * time.Second
- session.SetSocketTimeout(timeout)
- started := time.Now()
-
- // Do something.
- result := struct{ Ok bool }{}
- err = session.Run("getLastError", &result)
- c.Assert(err, ErrorMatches, ".*: i/o timeout")
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-timeout*2)), Equals, true)
-}
-
-func (s *S) TestSocketTimeoutOnDial(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- timeout := 1 * time.Second
-
- defer mgo.HackSyncSocketTimeout(timeout)()
-
- s.Freeze("localhost:40001")
-
- started := time.Now()
-
- session, err := mgo.DialWithTimeout("localhost:40001", timeout)
- c.Assert(err, ErrorMatches, "no reachable servers")
- c.Assert(session, IsNil)
-
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
- c.Assert(started.After(time.Now().Add(-20*time.Second)), Equals, true)
-}
-
-func (s *S) TestSocketTimeoutOnInactiveSocket(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- timeout := 2 * time.Second
- session.SetSocketTimeout(timeout)
-
- // Do something that relies on the timeout and works.
- c.Assert(session.Ping(), IsNil)
-
- // Freeze and wait for the timeout to go by.
- s.Freeze("localhost:40001")
- time.Sleep(timeout + 500*time.Millisecond)
- s.Thaw("localhost:40001")
-
- // Do something again. The timeout above should not have killed
- // the socket as there was nothing to be done.
- c.Assert(session.Ping(), IsNil)
-}
-
-func (s *S) TestDialWithReplicaSetName(c *C) {
- seedLists := [][]string{
- // rs1 primary and rs2 primary
- []string{"localhost:40011", "localhost:40021"},
- // rs1 primary and rs2 secondary
- []string{"localhost:40011", "localhost:40022"},
- // rs1 secondary and rs2 primary
- []string{"localhost:40012", "localhost:40021"},
- // rs1 secondary and rs2 secondary
- []string{"localhost:40012", "localhost:40022"},
- }
-
- rs2Members := []string{":40021", ":40022", ":40023"}
-
- verifySyncedServers := func(session *mgo.Session, numServers int) {
- // wait for the server(s) to be synced
- for len(session.LiveServers()) != numServers {
- c.Log("Waiting for cluster sync to finish...")
- time.Sleep(5e8)
- }
-
- // ensure none of the rs2 set members are communicated with
- for _, addr := range session.LiveServers() {
- for _, rs2Member := range rs2Members {
- c.Assert(strings.HasSuffix(addr, rs2Member), Equals, false)
- }
- }
- }
-
- // only communication with rs1 members is expected
- for _, seedList := range seedLists {
- info := mgo.DialInfo{
- Addrs: seedList,
- Timeout: 5 * time.Second,
- ReplicaSetName: "rs1",
- }
-
- session, err := mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 3)
- session.Close()
-
- info.Direct = true
- session, err = mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 1)
- session.Close()
-
- connectionUrl := fmt.Sprintf("mongodb://%v/?replicaSet=rs1", strings.Join(seedList, ","))
- session, err = mgo.Dial(connectionUrl)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 3)
- session.Close()
-
- connectionUrl += "&connect=direct"
- session, err = mgo.Dial(connectionUrl)
- c.Assert(err, IsNil)
- verifySyncedServers(session, 1)
- session.Close()
- }
-
-}
-
-func (s *S) TestDirect(c *C) {
- session, err := mgo.Dial("localhost:40012?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // We know that server is a slave.
- session.SetMode(mgo.Monotonic, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40012"), Equals, true)
-
- stats := mgo.GetStats()
- c.Assert(stats.SocketsAlive, Equals, 1)
- c.Assert(stats.SocketsInUse, Equals, 1)
- c.Assert(stats.SocketRefs, Equals, 1)
-
- // We've got no master, so it'll timeout.
- session.SetSyncTimeout(5e8 * time.Nanosecond)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"test": 1})
- c.Assert(err, ErrorMatches, "no reachable servers")
-
- // Writing to the local database is okay.
- coll = session.DB("local").C("mycoll")
- defer coll.RemoveAll(nil)
- id := bson.NewObjectId()
- err = coll.Insert(M{"_id": id})
- c.Assert(err, IsNil)
-
- // Data was stored in the right server.
- n, err := coll.Find(M{"_id": id}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-
- // Server hasn't changed.
- result.Host = ""
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40012"), Equals, true)
-}
-
-func (s *S) TestDirectToUnknownStateMember(c *C) {
- session, err := mgo.Dial("localhost:40041?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Monotonic, true)
-
- result := &struct{ Host string }{}
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40041"), Equals, true)
-
- // We've got no master, so it'll timeout.
- session.SetSyncTimeout(5e8 * time.Nanosecond)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"test": 1})
- c.Assert(err, ErrorMatches, "no reachable servers")
-
- // Slave is still reachable.
- result.Host = ""
- err = session.Run("serverStatus", result)
- c.Assert(err, IsNil)
- c.Assert(strings.HasSuffix(result.Host, ":40041"), Equals, true)
-}
-
-func (s *S) TestFailFast(c *C) {
- info := mgo.DialInfo{
- Addrs: []string{"localhost:99999"},
- Timeout: 5 * time.Second,
- FailFast: true,
- }
-
- started := time.Now()
-
- _, err := mgo.DialWithInfo(&info)
- c.Assert(err, ErrorMatches, "no reachable servers")
-
- c.Assert(started.After(time.Now().Add(-time.Second)), Equals, true)
-}
-
-func (s *S) countQueries(c *C, server string) (n int) {
- defer func() { c.Logf("Queries for %q: %d", server, n) }()
- session, err := mgo.Dial(server + "?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetMode(mgo.Monotonic, true)
- var result struct {
- OpCounters struct {
- Query int
- }
- Metrics struct {
- Commands struct{ Find struct{ Total int } }
- }
- }
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- if s.versionAtLeast(3, 2) {
- return result.Metrics.Commands.Find.Total
- }
- return result.OpCounters.Query
-}
-
-func (s *S) countCommands(c *C, server, commandName string) (n int) {
- defer func() { c.Logf("Queries for %q: %d", server, n) }()
- session, err := mgo.Dial(server + "?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetMode(mgo.Monotonic, true)
- var result struct {
- Metrics struct {
- Commands map[string]struct{ Total int }
- }
- }
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- return result.Metrics.Commands[commandName].Total
-}
-
-func (s *S) TestMonotonicSlaveOkFlagWithMongos(c *C) {
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // Ensure mongos is aware about the current topology.
- s.Stop(":40201")
- s.StartAll()
-
- mongos, err := mgo.Dial("localhost:40202")
- c.Assert(err, IsNil)
- defer mongos.Close()
-
- // Insert some data as otherwise 3.2+ doesn't seem to run the query at all.
- err = mongos.DB("mydb").C("mycoll").Insert(bson.M{"n": 1})
- c.Assert(err, IsNil)
-
- // Wait until all servers see the data.
- for _, addr := range []string{"localhost:40021", "localhost:40022", "localhost:40023"} {
- session, err := mgo.Dial(addr + "?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetMode(mgo.Monotonic, true)
- for i := 300; i >= 0; i-- {
- n, err := session.DB("mydb").C("mycoll").Find(nil).Count()
- c.Assert(err, IsNil)
- if n == 1 {
- break
- }
- if i == 0 {
- c.Fatalf("Inserted data never reached " + addr)
- }
- time.Sleep(100 * time.Millisecond)
- }
- }
-
- // Collect op counters for everyone.
- q21a := s.countQueries(c, "localhost:40021")
- q22a := s.countQueries(c, "localhost:40022")
- q23a := s.countQueries(c, "localhost:40023")
-
- // Do a SlaveOk query through MongoS
-
- mongos.SetMode(mgo.Monotonic, true)
-
- coll := mongos.DB("mydb").C("mycoll")
- var result struct{ N int }
- for i := 0; i != 5; i++ {
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
- }
-
- // Collect op counters for everyone again.
- q21b := s.countQueries(c, "localhost:40021")
- q22b := s.countQueries(c, "localhost:40022")
- q23b := s.countQueries(c, "localhost:40023")
-
- var masterDelta, slaveDelta int
- switch hostPort(master) {
- case "40021":
- masterDelta = q21b - q21a
- slaveDelta = (q22b - q22a) + (q23b - q23a)
- case "40022":
- masterDelta = q22b - q22a
- slaveDelta = (q21b - q21a) + (q23b - q23a)
- case "40023":
- masterDelta = q23b - q23a
- slaveDelta = (q21b - q21a) + (q22b - q22a)
- default:
- c.Fatal("Uh?")
- }
-
- c.Check(masterDelta, Equals, 0) // Just the counting itself.
- c.Check(slaveDelta, Equals, 5) // The counting for both, plus 5 queries above.
-}
-
-func (s *S) TestSecondaryModeWithMongos(c *C) {
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- // Ensure mongos is aware about the current topology.
- s.Stop(":40201")
- s.StartAll()
-
- mongos, err := mgo.Dial("localhost:40202")
- c.Assert(err, IsNil)
- defer mongos.Close()
-
- mongos.SetSyncTimeout(5 * time.Second)
-
- // Insert some data as otherwise 3.2+ doesn't seem to run the query at all.
- err = mongos.DB("mydb").C("mycoll").Insert(bson.M{"n": 1})
- c.Assert(err, IsNil)
-
- // Wait until all servers see the data.
- for _, addr := range []string{"localhost:40021", "localhost:40022", "localhost:40023"} {
- session, err := mgo.Dial(addr + "?connect=direct")
- c.Assert(err, IsNil)
- defer session.Close()
- session.SetMode(mgo.Monotonic, true)
- for i := 300; i >= 0; i-- {
- n, err := session.DB("mydb").C("mycoll").Find(nil).Count()
- c.Assert(err, IsNil)
- if n == 1 {
- break
- }
- if i == 0 {
- c.Fatalf("Inserted data never reached " + addr)
- }
- time.Sleep(100 * time.Millisecond)
- }
- }
-
- // Collect op counters for everyone.
- q21a := s.countQueries(c, "localhost:40021")
- q22a := s.countQueries(c, "localhost:40022")
- q23a := s.countQueries(c, "localhost:40023")
-
- // Do a Secondary query through MongoS
-
- mongos.SetMode(mgo.Secondary, true)
-
- coll := mongos.DB("mydb").C("mycoll")
- var result struct{ N int }
- for i := 0; i != 5; i++ {
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
- }
-
- // Collect op counters for everyone again.
- q21b := s.countQueries(c, "localhost:40021")
- q22b := s.countQueries(c, "localhost:40022")
- q23b := s.countQueries(c, "localhost:40023")
-
- var masterDelta, slaveDelta int
- switch hostPort(master) {
- case "40021":
- masterDelta = q21b - q21a
- slaveDelta = (q22b - q22a) + (q23b - q23a)
- case "40022":
- masterDelta = q22b - q22a
- slaveDelta = (q21b - q21a) + (q23b - q23a)
- case "40023":
- masterDelta = q23b - q23a
- slaveDelta = (q21b - q21a) + (q22b - q22a)
- default:
- c.Fatal("Uh?")
- }
-
- c.Check(masterDelta, Equals, 0) // Just the counting itself.
- c.Check(slaveDelta, Equals, 5) // The counting for both, plus 5 queries above.
-}
-
-func (s *S) TestSecondaryModeWithMongosInsert(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40202")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Secondary, true)
- session.SetSafe(&mgo.Safe{WMode:"majority"})
- session.SetSyncTimeout(4 * time.Second)
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // give time for replication
- time.Sleep(1 * time.Second)
-
- var result struct{ A int }
- coll.Find(nil).One(&result)
- c.Assert(result.A, Equals, 1)
-}
-
-
-func (s *S) TestRemovalOfClusterMember(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- master, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer master.Close()
-
- // Wait for cluster to fully sync up.
- for i := 0; i < 10; i++ {
- if len(master.LiveServers()) == 3 {
- break
- }
- time.Sleep(5e8)
- }
- if len(master.LiveServers()) != 3 {
- c.Fatalf("Test started with bad cluster state: %v", master.LiveServers())
- }
-
- result := &struct {
- IsMaster bool
- Me string
- }{}
- slave := master.Copy()
- slave.SetMode(mgo.Monotonic, true) // Monotonic can hold a non-master socket persistently.
- err = slave.Run("isMaster", result)
- c.Assert(err, IsNil)
- c.Assert(result.IsMaster, Equals, false)
- slaveAddr := result.Me
-
- defer func() {
- config := map[string]string{
- "40021": `{_id: 1, host: "127.0.0.1:40021", priority: 1, tags: {rs2: "a"}}`,
- "40022": `{_id: 2, host: "127.0.0.1:40022", priority: 0, tags: {rs2: "b"}}`,
- "40023": `{_id: 3, host: "127.0.0.1:40023", priority: 0, tags: {rs2: "c"}}`,
- }
- master.Refresh()
- master.Run(bson.D{{"$eval", `rs.add(` + config[hostPort(slaveAddr)] + `)`}}, nil)
- master.Close()
- slave.Close()
-
- // Ensure suite syncs up with the changes before next test.
- s.Stop(":40201")
- s.StartAll()
- time.Sleep(8 * time.Second)
- // TODO Find a better way to find out when mongos is fully aware that all
- // servers are up. Without that follow up tests that depend on mongos will
- // break due to their expectation of things being in a working state.
- }()
-
- c.Logf("========== Removing slave: %s ==========", slaveAddr)
-
- master.Run(bson.D{{"$eval", `rs.remove("` + slaveAddr + `")`}}, nil)
-
- master.Refresh()
-
- // Give the cluster a moment to catch up by doing a roundtrip to the master.
- err = master.Ping()
- c.Assert(err, IsNil)
-
- time.Sleep(3e9)
-
- // This must fail since the slave has been taken off the cluster.
- err = slave.Ping()
- c.Assert(err, NotNil)
-
- for i := 0; i < 15; i++ {
- if len(master.LiveServers()) == 2 {
- break
- }
- time.Sleep(time.Second)
- }
- live := master.LiveServers()
- if len(live) != 2 {
- c.Errorf("Removed server still considered live: %#s", live)
- }
-
- c.Log("========== Test succeeded. ==========")
-}
-
-func (s *S) TestPoolLimitSimple(c *C) {
- for test := 0; test < 2; test++ {
- var session *mgo.Session
- var err error
- if test == 0 {
- session, err = mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- session.SetPoolLimit(1)
- } else {
- session, err = mgo.Dial("localhost:40001?maxPoolSize=1")
- c.Assert(err, IsNil)
- }
- defer session.Close()
-
- // Put one socket in use.
- c.Assert(session.Ping(), IsNil)
-
- done := make(chan time.Duration)
-
- // Now block trying to get another one due to the pool limit.
- go func() {
- copy := session.Copy()
- defer copy.Close()
- started := time.Now()
- c.Check(copy.Ping(), IsNil)
- done <- time.Now().Sub(started)
- }()
-
- time.Sleep(300 * time.Millisecond)
-
- // Put the one socket back in the pool, freeing it for the copy.
- session.Refresh()
- delay := <-done
- c.Assert(delay > 300*time.Millisecond, Equals, true, Commentf("Delay: %s", delay))
- }
-}
-
-func (s *S) TestPoolLimitMany(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- stats := mgo.GetStats()
- for stats.SocketsAlive != 3 {
- c.Logf("Waiting for all connections to be established (sockets alive currently %d)...", stats.SocketsAlive)
- stats = mgo.GetStats()
- time.Sleep(5e8)
- }
-
- const poolLimit = 64
- session.SetPoolLimit(poolLimit)
-
- // Consume the whole limit for the master.
- var master []*mgo.Session
- for i := 0; i < poolLimit; i++ {
- s := session.Copy()
- defer s.Close()
- c.Assert(s.Ping(), IsNil)
- master = append(master, s)
- }
-
- before := time.Now()
- go func() {
- time.Sleep(3e9)
- master[0].Refresh()
- }()
-
- // Then, a single ping must block, since it would need another
- // connection to the master, over the limit. Once the goroutine
- // above releases its socket, it should move on.
- session.Ping()
- delay := time.Now().Sub(before)
- c.Assert(delay > 3e9, Equals, true)
- c.Assert(delay < 6e9, Equals, true)
-}
-
-func (s *S) TestSetModeEventualIterBug(c *C) {
- session1, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session1.Close()
-
- session1.SetMode(mgo.Eventual, false)
-
- coll1 := session1.DB("mydb").C("mycoll")
-
- const N = 100
- for i := 0; i < N; i++ {
- err = coll1.Insert(M{"_id": i})
- c.Assert(err, IsNil)
- }
-
- c.Logf("Waiting until secondary syncs")
- for {
- n, err := coll1.Count()
- c.Assert(err, IsNil)
- if n == N {
- c.Logf("Found all")
- break
- }
- }
-
- session2, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session2.Close()
-
- session2.SetMode(mgo.Eventual, false)
-
- coll2 := session2.DB("mydb").C("mycoll")
-
- i := 0
- iter := coll2.Find(nil).Batch(10).Iter()
- var result struct{}
- for iter.Next(&result) {
- i++
- }
- c.Assert(iter.Close(), Equals, nil)
- c.Assert(i, Equals, N)
-}
-
-func (s *S) TestCustomDialOld(c *C) {
- dials := make(chan bool, 16)
- dial := func(addr net.Addr) (net.Conn, error) {
- tcpaddr, ok := addr.(*net.TCPAddr)
- if !ok {
- return nil, fmt.Errorf("unexpected address type: %T", addr)
- }
- dials <- true
- return net.DialTCP("tcp", nil, tcpaddr)
- }
- info := mgo.DialInfo{
- Addrs: []string{"localhost:40012"},
- Dial: dial,
- }
-
- // Use hostname here rather than IP, to make things trickier.
- session, err := mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- defer session.Close()
-
- const N = 3
- for i := 0; i < N; i++ {
- select {
- case <-dials:
- case <-time.After(5 * time.Second):
- c.Fatalf("expected %d dials, got %d", N, i)
- }
- }
- select {
- case <-dials:
- c.Fatalf("got more dials than expected")
- case <-time.After(100 * time.Millisecond):
- }
-}
-
-func (s *S) TestCustomDialNew(c *C) {
- dials := make(chan bool, 16)
- dial := func(addr *mgo.ServerAddr) (net.Conn, error) {
- dials <- true
- if addr.TCPAddr().Port == 40012 {
- c.Check(addr.String(), Equals, "localhost:40012")
- }
- return net.DialTCP("tcp", nil, addr.TCPAddr())
- }
- info := mgo.DialInfo{
- Addrs: []string{"localhost:40012"},
- DialServer: dial,
- }
-
- // Use hostname here rather than IP, to make things trickier.
- session, err := mgo.DialWithInfo(&info)
- c.Assert(err, IsNil)
- defer session.Close()
-
- const N = 3
- for i := 0; i < N; i++ {
- select {
- case <-dials:
- case <-time.After(5 * time.Second):
- c.Fatalf("expected %d dials, got %d", N, i)
- }
- }
- select {
- case <-dials:
- c.Fatalf("got more dials than expected")
- case <-time.After(100 * time.Millisecond):
- }
-}
-
-func (s *S) TestPrimaryShutdownOnAuthShard(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- // Dial the shard.
- session, err := mgo.Dial("localhost:40203")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Login and insert something to make it more realistic.
- session.DB("admin").Login("root", "rapadura")
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(bson.M{"n": 1})
- c.Assert(err, IsNil)
-
- // Dial the replica set to figure the master out.
- rs, err := mgo.Dial("root:rapadura@localhost:40031")
- c.Assert(err, IsNil)
- defer rs.Close()
-
- // With strong consistency, this will open a socket to the master.
- result := &struct{ Host string }{}
- err = rs.Run("serverStatus", result)
- c.Assert(err, IsNil)
-
- // Kill the master.
- host := result.Host
- s.Stop(host)
-
- // This must fail, since the connection was broken.
- err = rs.Run("serverStatus", result)
- c.Assert(err, Equals, io.EOF)
-
- // Refresh session and wait for re-election.
- session.Refresh()
- for i := 0; i < 60; i++ {
- err = coll.Insert(bson.M{"n": 3})
- if err == nil {
- break
- }
- c.Logf("Waiting for replica set to elect a new master. Last error: %v", err)
- time.Sleep(500 * time.Millisecond)
- }
- c.Assert(err, IsNil)
-
- count, err := coll.Count()
- c.Assert(count > 1, Equals, true)
-}
-
-func (s *S) TestNearestSecondary(c *C) {
- defer mgo.HackPingDelay(300 * time.Millisecond)()
-
- rs1a := "127.0.0.1:40011"
- rs1b := "127.0.0.1:40012"
- rs1c := "127.0.0.1:40013"
- s.Freeze(rs1b)
-
- session, err := mgo.Dial(rs1a)
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Wait for the sync up to run through the first couple of servers.
- for len(session.LiveServers()) != 2 {
- c.Log("Waiting for two servers to be alive...")
- time.Sleep(100 * time.Millisecond)
- }
-
- // Extra delay to ensure the third server gets penalized.
- time.Sleep(500 * time.Millisecond)
-
- // Release third server.
- s.Thaw(rs1b)
-
- // Wait for it to come up.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for all servers to be alive...")
- time.Sleep(100 * time.Millisecond)
- }
-
- session.SetMode(mgo.Monotonic, true)
- var result struct{ Host string }
-
- // See which slave picks the line, several times to avoid chance.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1c))
- }
-
- if *fast {
- // Don't hold back for several seconds.
- return
- }
-
- // Now hold the other server for long enough to penalize it.
- s.Freeze(rs1c)
- time.Sleep(5 * time.Second)
- s.Thaw(rs1c)
-
- // Wait for the ping to be processed.
- time.Sleep(500 * time.Millisecond)
-
- // Repeating the test should now pick the former server consistently.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1b))
- }
-}
-
-func (s *S) TestNearestServer(c *C) {
- defer mgo.HackPingDelay(300 * time.Millisecond)()
-
- rs1a := "127.0.0.1:40011"
- rs1b := "127.0.0.1:40012"
- rs1c := "127.0.0.1:40013"
-
- session, err := mgo.Dial(rs1a)
- c.Assert(err, IsNil)
- defer session.Close()
-
- s.Freeze(rs1a)
- s.Freeze(rs1b)
-
- // Extra delay to ensure the first two servers get penalized.
- time.Sleep(500 * time.Millisecond)
-
- // Release them.
- s.Thaw(rs1a)
- s.Thaw(rs1b)
-
- // Wait for everyone to come up.
- for len(session.LiveServers()) != 3 {
- c.Log("Waiting for all servers to be alive...")
- time.Sleep(100 * time.Millisecond)
- }
-
- session.SetMode(mgo.Nearest, true)
- var result struct{ Host string }
-
- // See which server picks the line, several times to avoid chance.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1c))
- }
-
- if *fast {
- // Don't hold back for several seconds.
- return
- }
-
- // Now hold the two secondaries for long enough to penalize them.
- s.Freeze(rs1b)
- s.Freeze(rs1c)
- time.Sleep(5 * time.Second)
- s.Thaw(rs1b)
- s.Thaw(rs1c)
-
- // Wait for the ping to be processed.
- time.Sleep(500 * time.Millisecond)
-
- // Repeating the test should now pick the primary server consistently.
- for i := 0; i < 10; i++ {
- session.Refresh()
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, hostPort(rs1a))
- }
-}
-
-func (s *S) TestConnectCloseConcurrency(c *C) {
- restore := mgo.HackPingDelay(500 * time.Millisecond)
- defer restore()
- var wg sync.WaitGroup
- const n = 500
- wg.Add(n)
- for i := 0; i < n; i++ {
- go func() {
- defer wg.Done()
- session, err := mgo.Dial("localhost:40001")
- if err != nil {
- c.Fatal(err)
- }
- time.Sleep(1)
- session.Close()
- }()
- }
- wg.Wait()
-}
-
-func (s *S) TestSelectServers(c *C) {
- if !s.versionAtLeast(2, 2) {
- c.Skip("read preferences introduced in 2.2")
- }
-
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Eventual, true)
-
- var result struct{ Host string }
-
- session.Refresh()
- session.SelectServers(bson.D{{"rs1", "b"}})
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, "40012")
-
- session.Refresh()
- session.SelectServers(bson.D{{"rs1", "c"}})
- err = session.Run("serverStatus", &result)
- c.Assert(err, IsNil)
- c.Assert(hostPort(result.Host), Equals, "40013")
-}
-
-func (s *S) TestSelectServersWithMongos(c *C) {
- if !s.versionAtLeast(2, 2) {
- c.Skip("read preferences introduced in 2.2")
- }
-
- session, err := mgo.Dial("localhost:40021")
- c.Assert(err, IsNil)
- defer session.Close()
-
- ssresult := &struct{ Host string }{}
- imresult := &struct{ IsMaster bool }{}
-
- // Figure the master while still using the strong session.
- err = session.Run("serverStatus", ssresult)
- c.Assert(err, IsNil)
- err = session.Run("isMaster", imresult)
- c.Assert(err, IsNil)
- master := ssresult.Host
- c.Assert(imresult.IsMaster, Equals, true, Commentf("%s is not the master", master))
-
- var slave1, slave2 string
- switch hostPort(master) {
- case "40021":
- slave1, slave2 = "b", "c"
- case "40022":
- slave1, slave2 = "a", "c"
- case "40023":
- slave1, slave2 = "a", "b"
- }
-
- // Collect op counters for everyone.
- q21a := s.countQueries(c, "localhost:40021")
- q22a := s.countQueries(c, "localhost:40022")
- q23a := s.countQueries(c, "localhost:40023")
-
- // Do a SlaveOk query through MongoS
- mongos, err := mgo.Dial("localhost:40202")
- c.Assert(err, IsNil)
- defer mongos.Close()
-
- mongos.SetMode(mgo.Monotonic, true)
-
- mongos.Refresh()
- mongos.SelectServers(bson.D{{"rs2", slave1}})
- coll := mongos.DB("mydb").C("mycoll")
- result := &struct{}{}
- for i := 0; i != 5; i++ {
- err := coll.Find(nil).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-
- mongos.Refresh()
- mongos.SelectServers(bson.D{{"rs2", slave2}})
- coll = mongos.DB("mydb").C("mycoll")
- for i := 0; i != 7; i++ {
- err := coll.Find(nil).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- }
-
- // Collect op counters for everyone again.
- q21b := s.countQueries(c, "localhost:40021")
- q22b := s.countQueries(c, "localhost:40022")
- q23b := s.countQueries(c, "localhost:40023")
-
- switch hostPort(master) {
- case "40021":
- c.Check(q21b-q21a, Equals, 0)
- c.Check(q22b-q22a, Equals, 5)
- c.Check(q23b-q23a, Equals, 7)
- case "40022":
- c.Check(q21b-q21a, Equals, 5)
- c.Check(q22b-q22a, Equals, 0)
- c.Check(q23b-q23a, Equals, 7)
- case "40023":
- c.Check(q21b-q21a, Equals, 5)
- c.Check(q22b-q22a, Equals, 7)
- c.Check(q23b-q23a, Equals, 0)
- default:
- c.Fatal("Uh?")
- }
-}
-
-func (s *S) TestDoNotFallbackToMonotonic(c *C) {
- // There was a bug at some point that some functions were
- // falling back to Monotonic mode. This test ensures all listIndexes
- // commands go to the primary, as should happen since the session is
- // in Strong mode.
- if !s.versionAtLeast(3, 0) {
- c.Skip("command-counting logic depends on 3.0+")
- }
-
- session1, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session1.Close()
- err = session1.DB("mydb").C("mycoll").EnsureIndex(
- mgo.Index{Key: []string{"x", "y"}},
- )
- c.Assert(err, IsNil)
-
- session2, err := mgo.Dial("localhost:40012")
- c.Assert(err, IsNil)
- defer session2.Close()
-
- for i := 0; i < 15; i++ {
- q11a := s.countCommands(c, "localhost:40011", "listIndexes")
- q12a := s.countCommands(c, "localhost:40012", "listIndexes")
- q13a := s.countCommands(c, "localhost:40013", "listIndexes")
-
- _, err := session2.DB("mydb").C("mycoll").Indexes()
- c.Assert(err, IsNil)
-
- q11b := s.countCommands(c, "localhost:40011", "listIndexes")
- q12b := s.countCommands(c, "localhost:40012", "listIndexes")
- q13b := s.countCommands(c, "localhost:40013", "listIndexes")
-
- c.Assert(q11b, Equals, q11a+1)
- c.Assert(q12b, Equals, q12a)
- c.Assert(q13b, Equals, q13a)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/dbserver_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/dbserver_test.go
deleted file mode 100644
index 79812fde34f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/dbserver_test.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package dbtest_test
-
-import (
- "os"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
-
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/dbtest"
-)
-
-type M map[string]interface{}
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- oldCheckSessions string
-}
-
-var _ = Suite(&S{})
-
-func (s *S) SetUpTest(c *C) {
- s.oldCheckSessions = os.Getenv("CHECK_SESSIONS")
- os.Setenv("CHECK_SESSIONS", "")
-}
-
-func (s *S) TearDownTest(c *C) {
- os.Setenv("CHECK_SESSIONS", s.oldCheckSessions)
-}
-
-func (s *S) TestWipeData(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- session := server.Session()
- err := session.DB("mydb").C("mycoll").Insert(M{"a": 1})
- session.Close()
- c.Assert(err, IsNil)
-
- server.Wipe()
-
- session = server.Session()
- names, err := session.DatabaseNames()
- session.Close()
- c.Assert(err, IsNil)
- for _, name := range names {
- if name != "local" && name != "admin" {
- c.Fatalf("Wipe should have removed this database: %s", name)
- }
- }
-}
-
-func (s *S) TestStop(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- // Server should not be running.
- process := server.ProcessTest()
- c.Assert(process, IsNil)
-
- session := server.Session()
- addr := session.LiveServers()[0]
- session.Close()
-
- // Server should be running now.
- process = server.ProcessTest()
- p, err := os.FindProcess(process.Pid)
- c.Assert(err, IsNil)
- p.Release()
-
- server.Stop()
-
- // Server should not be running anymore.
- session, err = mgo.DialWithTimeout(addr, 500*time.Millisecond)
- if session != nil {
- session.Close()
- c.Fatalf("Stop did not stop the server")
- }
-}
-
-func (s *S) TestCheckSessions(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- session := server.Session()
- defer session.Close()
- c.Assert(server.Wipe, PanicMatches, "There are mgo sessions still alive.")
-}
-
-func (s *S) TestCheckSessionsDisabled(c *C) {
- var server dbtest.DBServer
- server.SetPath(c.MkDir())
- defer server.Stop()
-
- os.Setenv("CHECK_SESSIONS", "0")
-
- // Should not panic, although it looks to Wipe like this session will leak.
- session := server.Session()
- defer session.Close()
- server.Wipe()
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/export_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/export_test.go
deleted file mode 100644
index 65f1cb02388..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/dbtest/export_test.go
+++ /dev/null
@@ -1,12 +0,0 @@
-package dbtest
-
-import (
- "os"
-)
-
-func (dbs *DBServer) ProcessTest() *os.Process {
- if dbs.server == nil {
- return nil
- }
- return dbs.server.Process
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/export_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/export_test.go
deleted file mode 100644
index 690f84d3835..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/export_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package mgo
-
-import (
- "time"
-)
-
-func HackPingDelay(newDelay time.Duration) (restore func()) {
- globalMutex.Lock()
- defer globalMutex.Unlock()
-
- oldDelay := pingDelay
- restore = func() {
- globalMutex.Lock()
- pingDelay = oldDelay
- globalMutex.Unlock()
- }
- pingDelay = newDelay
- return
-}
-
-func HackSyncSocketTimeout(newTimeout time.Duration) (restore func()) {
- globalMutex.Lock()
- defer globalMutex.Unlock()
-
- oldTimeout := syncSocketTimeout
- restore = func() {
- globalMutex.Lock()
- syncSocketTimeout = oldTimeout
- globalMutex.Unlock()
- }
- syncSocketTimeout = newTimeout
- return
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/gridfs_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/gridfs_test.go
deleted file mode 100644
index 5a6ed555950..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/gridfs_test.go
+++ /dev/null
@@ -1,708 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo_test
-
-import (
- "io"
- "os"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/bson"
-)
-
-func (s *S) TestGridFSCreate(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- before := bson.Now()
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- n, err := file.Write([]byte("some data"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 9)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- after := bson.Now()
-
- // Check the file information.
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- fileId, ok := result["_id"].(bson.ObjectId)
- c.Assert(ok, Equals, true)
- c.Assert(fileId.Valid(), Equals, true)
- result["_id"] = "<id>"
-
- ud, ok := result["uploadDate"].(time.Time)
- c.Assert(ok, Equals, true)
- c.Assert(ud.After(before) && ud.Before(after), Equals, true)
- result["uploadDate"] = "<timestamp>"
-
- expected := M{
- "_id": "<id>",
- "length": 9,
- "chunkSize": 255 * 1024,
- "uploadDate": "<timestamp>",
- "md5": "1e50210a0202497fb79bc38b6ade6c34",
- }
- c.Assert(result, DeepEquals, expected)
-
- // Check the chunk.
- result = M{}
- err = db.C("fs.chunks").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- chunkId, ok := result["_id"].(bson.ObjectId)
- c.Assert(ok, Equals, true)
- c.Assert(chunkId.Valid(), Equals, true)
- result["_id"] = "<id>"
-
- expected = M{
- "_id": "<id>",
- "files_id": fileId,
- "n": 0,
- "data": []byte("some data"),
- }
- c.Assert(result, DeepEquals, expected)
-
- // Check that an index was created.
- indexes, err := db.C("fs.chunks").Indexes()
- c.Assert(err, IsNil)
- c.Assert(len(indexes), Equals, 2)
- c.Assert(indexes[1].Key, DeepEquals, []string{"files_id", "n"})
-}
-
-func (s *S) TestGridFSFileDetails(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile1.txt")
- c.Assert(err, IsNil)
-
- n, err := file.Write([]byte("some"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
-
- c.Assert(file.Size(), Equals, int64(4))
-
- n, err = file.Write([]byte(" data"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 5)
-
- c.Assert(file.Size(), Equals, int64(9))
-
- id, _ := file.Id().(bson.ObjectId)
- c.Assert(id.Valid(), Equals, true)
- c.Assert(file.Name(), Equals, "myfile1.txt")
- c.Assert(file.ContentType(), Equals, "")
-
- var info interface{}
- err = file.GetMeta(&info)
- c.Assert(err, IsNil)
- c.Assert(info, IsNil)
-
- file.SetId("myid")
- file.SetName("myfile2.txt")
- file.SetContentType("text/plain")
- file.SetMeta(M{"any": "thing"})
-
- c.Assert(file.Id(), Equals, "myid")
- c.Assert(file.Name(), Equals, "myfile2.txt")
- c.Assert(file.ContentType(), Equals, "text/plain")
-
- err = file.GetMeta(&info)
- c.Assert(err, IsNil)
- c.Assert(info, DeepEquals, bson.M{"any": "thing"})
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- c.Assert(file.MD5(), Equals, "1e50210a0202497fb79bc38b6ade6c34")
-
- ud := file.UploadDate()
- now := time.Now()
- c.Assert(ud.Before(now), Equals, true)
- c.Assert(ud.After(now.Add(-3*time.Second)), Equals, true)
-
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- result["uploadDate"] = "<timestamp>"
-
- expected := M{
- "_id": "myid",
- "length": 9,
- "chunkSize": 255 * 1024,
- "uploadDate": "<timestamp>",
- "md5": "1e50210a0202497fb79bc38b6ade6c34",
- "filename": "myfile2.txt",
- "contentType": "text/plain",
- "metadata": M{"any": "thing"},
- }
- c.Assert(result, DeepEquals, expected)
-}
-
-func (s *S) TestGridFSSetUploadDate(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- t := time.Date(2014, 1, 1, 1, 1, 1, 0, time.Local)
- file.SetUploadDate(t)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- // Check the file information.
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- ud := result["uploadDate"].(time.Time)
- if !ud.Equal(t) {
- c.Fatalf("want upload date %s, got %s", t, ud)
- }
-}
-
-func (s *S) TestGridFSCreateWithChunking(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- file.SetChunkSize(5)
-
- // Smaller than the chunk size.
- n, err := file.Write([]byte("abc"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-
- // Boundary in the middle.
- n, err = file.Write([]byte("defg"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
-
- // Boundary at the end.
- n, err = file.Write([]byte("hij"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-
- // Larger than the chunk size, with 3 chunks.
- n, err = file.Write([]byte("klmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 12)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- // Check the file information.
- result := M{}
- err = db.C("fs.files").Find(nil).One(result)
- c.Assert(err, IsNil)
-
- fileId, _ := result["_id"].(bson.ObjectId)
- c.Assert(fileId.Valid(), Equals, true)
- result["_id"] = "<id>"
- result["uploadDate"] = "<timestamp>"
-
- expected := M{
- "_id": "<id>",
- "length": 22,
- "chunkSize": 5,
- "uploadDate": "<timestamp>",
- "md5": "44a66044834cbe55040089cabfc102d5",
- }
- c.Assert(result, DeepEquals, expected)
-
- // Check the chunks.
- iter := db.C("fs.chunks").Find(nil).Sort("n").Iter()
- dataChunks := []string{"abcde", "fghij", "klmno", "pqrst", "uv"}
- for i := 0; ; i++ {
- result = M{}
- if !iter.Next(result) {
- if i != 5 {
- c.Fatalf("Expected 5 chunks, got %d", i)
- }
- break
- }
- c.Assert(iter.Close(), IsNil)
-
- result["_id"] = "<id>"
-
- expected = M{
- "_id": "<id>",
- "files_id": fileId,
- "n": i,
- "data": []byte(dataChunks[i]),
- }
- c.Assert(result, DeepEquals, expected)
- }
-}
-
-func (s *S) TestGridFSAbort(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("some data"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 9)
-
- var count int
- for i := 0; i < 10; i++ {
- count, err = db.C("fs.chunks").Count()
- if count > 0 || err != nil {
- break
- }
- }
- c.Assert(err, IsNil)
- c.Assert(count, Equals, 1)
-
- file.Abort()
-
- err = file.Close()
- c.Assert(err, ErrorMatches, "write aborted")
-
- count, err = db.C("fs.chunks").Count()
- c.Assert(err, IsNil)
- c.Assert(count, Equals, 0)
-}
-
-func (s *S) TestGridFSCloseConflict(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- db.C("fs.files").EnsureIndex(mgo.Index{Key: []string{"filename"}, Unique: true})
-
- // For a closing-time conflict
- err = db.C("fs.files").Insert(M{"filename": "foo.txt"})
- c.Assert(err, IsNil)
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("foo.txt")
- c.Assert(err, IsNil)
-
- _, err = file.Write([]byte("some data"))
- c.Assert(err, IsNil)
-
- err = file.Close()
- c.Assert(mgo.IsDup(err), Equals, true)
-
- count, err := db.C("fs.chunks").Count()
- c.Assert(err, IsNil)
- c.Assert(count, Equals, 0)
-}
-
-func (s *S) TestGridFSOpenNotFound(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.OpenId("non-existent")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
- c.Assert(file, IsNil)
-
- file, err = gfs.Open("non-existent")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
- c.Assert(file, IsNil)
-}
-
-func (s *S) TestGridFSReadAll(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
- id := file.Id()
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("abcdefghijklmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 22)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- file, err = gfs.OpenId(id)
- c.Assert(err, IsNil)
-
- b := make([]byte, 30)
- n, err = file.Read(b)
- c.Assert(n, Equals, 22)
- c.Assert(err, IsNil)
-
- n, err = file.Read(b)
- c.Assert(n, Equals, 0)
- c.Assert(err == io.EOF, Equals, true)
-
- err = file.Close()
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGridFSReadChunking(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
-
- id := file.Id()
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("abcdefghijklmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 22)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- file, err = gfs.OpenId(id)
- c.Assert(err, IsNil)
-
- b := make([]byte, 30)
-
- // Smaller than the chunk size.
- n, err = file.Read(b[:3])
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
- c.Assert(b[:3], DeepEquals, []byte("abc"))
-
- // Boundary in the middle.
- n, err = file.Read(b[:4])
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
- c.Assert(b[:4], DeepEquals, []byte("defg"))
-
- // Boundary at the end.
- n, err = file.Read(b[:3])
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
- c.Assert(b[:3], DeepEquals, []byte("hij"))
-
- // Larger than the chunk size, with 3 chunks.
- n, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 12)
- c.Assert(b[:12], DeepEquals, []byte("klmnopqrstuv"))
-
- n, err = file.Read(b)
- c.Assert(n, Equals, 0)
- c.Assert(err == io.EOF, Equals, true)
-
- err = file.Close()
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestGridFSOpen(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- file.Close()
-
- file, err = gfs.Open("myfile.txt")
- c.Assert(err, IsNil)
- defer file.Close()
-
- var b [1]byte
-
- _, err = file.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "2")
-}
-
-func (s *S) TestGridFSSeek(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
- file, err := gfs.Create("")
- c.Assert(err, IsNil)
- id := file.Id()
-
- file.SetChunkSize(5)
-
- n, err := file.Write([]byte("abcdefghijklmnopqrstuv"))
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 22)
-
- err = file.Close()
- c.Assert(err, IsNil)
-
- b := make([]byte, 5)
-
- file, err = gfs.OpenId(id)
- c.Assert(err, IsNil)
-
- o, err := file.Seek(3, os.SEEK_SET)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(3))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("defgh"))
-
- o, err = file.Seek(5, os.SEEK_CUR)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(13))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("nopqr"))
-
- o, err = file.Seek(0, os.SEEK_END)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(22))
- n, err = file.Read(b)
- c.Assert(err, Equals, io.EOF)
- c.Assert(n, Equals, 0)
-
- o, err = file.Seek(-10, os.SEEK_END)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(12))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("mnopq"))
-
- o, err = file.Seek(8, os.SEEK_SET)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(8))
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("ijklm"))
-
- // Trivial seek forward within same chunk. Already
- // got the data, shouldn't touch the database.
- sent := mgo.GetStats().SentOps
- o, err = file.Seek(1, os.SEEK_CUR)
- c.Assert(err, IsNil)
- c.Assert(o, Equals, int64(14))
- c.Assert(mgo.GetStats().SentOps, Equals, sent)
- _, err = file.Read(b)
- c.Assert(err, IsNil)
- c.Assert(b, DeepEquals, []byte("opqrs"))
-
- // Try seeking past end of file.
- file.Seek(3, os.SEEK_SET)
- o, err = file.Seek(23, os.SEEK_SET)
- c.Assert(err, ErrorMatches, "seek past end of file")
- c.Assert(o, Equals, int64(3))
-}
-
-func (s *S) TestGridFSRemoveId(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- id := file.Id()
- file.Close()
-
- err = gfs.RemoveId(id)
- c.Assert(err, IsNil)
-
- file, err = gfs.Open("myfile.txt")
- c.Assert(err, IsNil)
- defer file.Close()
-
- var b [1]byte
-
- _, err = file.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "1")
-
- n, err := db.C("fs.chunks").Find(M{"files_id": id}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 0)
-}
-
-func (s *S) TestGridFSRemove(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- file.Close()
-
- err = gfs.Remove("myfile.txt")
- c.Assert(err, IsNil)
-
- _, err = gfs.Open("myfile.txt")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
-
- n, err := db.C("fs.chunks").Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 0)
-}
-
-func (s *S) TestGridFSOpenNext(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
-
- gfs := db.GridFS("fs")
-
- file, err := gfs.Create("myfile1.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'1'})
- file.Close()
-
- file, err = gfs.Create("myfile2.txt")
- c.Assert(err, IsNil)
- file.Write([]byte{'2'})
- file.Close()
-
- var f *mgo.GridFile
- var b [1]byte
-
- iter := gfs.Find(nil).Sort("-filename").Iter()
-
- ok := gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, true)
- c.Check(f.Name(), Equals, "myfile2.txt")
-
- _, err = f.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "2")
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, true)
- c.Check(f.Name(), Equals, "myfile1.txt")
-
- _, err = f.Read(b[:])
- c.Assert(err, IsNil)
- c.Assert(string(b[:]), Equals, "1")
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
- c.Assert(f, IsNil)
-
- // Do it again with a more restrictive query to make sure
- // it's actually taken into account.
- iter = gfs.Find(bson.M{"filename": "myfile1.txt"}).Iter()
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, true)
- c.Check(f.Name(), Equals, "myfile1.txt")
-
- ok = gfs.OpenNext(iter, &f)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
- c.Assert(f, IsNil)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/bench_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/bench_test.go
deleted file mode 100644
index cd7380b1efb..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/bench_test.go
+++ /dev/null
@@ -1,223 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Large data benchmark.
-// The JSON data is a summary of agl's changes in the
-// go, webkit, and chromium open source projects.
-// We benchmark converting between the JSON form
-// and in-memory data structures.
-
-package json
-
-import (
- "bytes"
- "compress/gzip"
- "io/ioutil"
- "os"
- "strings"
- "testing"
-)
-
-type codeResponse struct {
- Tree *codeNode `json:"tree"`
- Username string `json:"username"`
-}
-
-type codeNode struct {
- Name string `json:"name"`
- Kids []*codeNode `json:"kids"`
- CLWeight float64 `json:"cl_weight"`
- Touches int `json:"touches"`
- MinT int64 `json:"min_t"`
- MaxT int64 `json:"max_t"`
- MeanT int64 `json:"mean_t"`
-}
-
-var codeJSON []byte
-var codeStruct codeResponse
-
-func codeInit() {
- f, err := os.Open("testdata/code.json.gz")
- if err != nil {
- panic(err)
- }
- defer f.Close()
- gz, err := gzip.NewReader(f)
- if err != nil {
- panic(err)
- }
- data, err := ioutil.ReadAll(gz)
- if err != nil {
- panic(err)
- }
-
- codeJSON = data
-
- if err := Unmarshal(codeJSON, &codeStruct); err != nil {
- panic("unmarshal code.json: " + err.Error())
- }
-
- if data, err = Marshal(&codeStruct); err != nil {
- panic("marshal code.json: " + err.Error())
- }
-
- if !bytes.Equal(data, codeJSON) {
- println("different lengths", len(data), len(codeJSON))
- for i := 0; i < len(data) && i < len(codeJSON); i++ {
- if data[i] != codeJSON[i] {
- println("re-marshal: changed at byte", i)
- println("orig: ", string(codeJSON[i-10:i+10]))
- println("new: ", string(data[i-10:i+10]))
- break
- }
- }
- panic("re-marshal code.json: different result")
- }
-}
-
-func BenchmarkCodeEncoder(b *testing.B) {
- if codeJSON == nil {
- b.StopTimer()
- codeInit()
- b.StartTimer()
- }
- enc := NewEncoder(ioutil.Discard)
- for i := 0; i < b.N; i++ {
- if err := enc.Encode(&codeStruct); err != nil {
- b.Fatal("Encode:", err)
- }
- }
- b.SetBytes(int64(len(codeJSON)))
-}
-
-func BenchmarkCodeMarshal(b *testing.B) {
- if codeJSON == nil {
- b.StopTimer()
- codeInit()
- b.StartTimer()
- }
- for i := 0; i < b.N; i++ {
- if _, err := Marshal(&codeStruct); err != nil {
- b.Fatal("Marshal:", err)
- }
- }
- b.SetBytes(int64(len(codeJSON)))
-}
-
-func BenchmarkCodeDecoder(b *testing.B) {
- if codeJSON == nil {
- b.StopTimer()
- codeInit()
- b.StartTimer()
- }
- var buf bytes.Buffer
- dec := NewDecoder(&buf)
- var r codeResponse
- for i := 0; i < b.N; i++ {
- buf.Write(codeJSON)
- // hide EOF
- buf.WriteByte('\n')
- buf.WriteByte('\n')
- buf.WriteByte('\n')
- if err := dec.Decode(&r); err != nil {
- b.Fatal("Decode:", err)
- }
- }
- b.SetBytes(int64(len(codeJSON)))
-}
-
-func BenchmarkDecoderStream(b *testing.B) {
- b.StopTimer()
- var buf bytes.Buffer
- dec := NewDecoder(&buf)
- buf.WriteString(`"` + strings.Repeat("x", 1000000) + `"` + "\n\n\n")
- var x interface{}
- if err := dec.Decode(&x); err != nil {
- b.Fatal("Decode:", err)
- }
- ones := strings.Repeat(" 1\n", 300000) + "\n\n\n"
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- if i%300000 == 0 {
- buf.WriteString(ones)
- }
- x = nil
- if err := dec.Decode(&x); err != nil || x != 1.0 {
- b.Fatalf("Decode: %v after %d", err, i)
- }
- }
-}
-
-func BenchmarkCodeUnmarshal(b *testing.B) {
- if codeJSON == nil {
- b.StopTimer()
- codeInit()
- b.StartTimer()
- }
- for i := 0; i < b.N; i++ {
- var r codeResponse
- if err := Unmarshal(codeJSON, &r); err != nil {
- b.Fatal("Unmarshal:", err)
- }
- }
- b.SetBytes(int64(len(codeJSON)))
-}
-
-func BenchmarkCodeUnmarshalReuse(b *testing.B) {
- if codeJSON == nil {
- b.StopTimer()
- codeInit()
- b.StartTimer()
- }
- var r codeResponse
- for i := 0; i < b.N; i++ {
- if err := Unmarshal(codeJSON, &r); err != nil {
- b.Fatal("Unmarshal:", err)
- }
- }
-}
-
-func BenchmarkUnmarshalString(b *testing.B) {
- data := []byte(`"hello, world"`)
- var s string
-
- for i := 0; i < b.N; i++ {
- if err := Unmarshal(data, &s); err != nil {
- b.Fatal("Unmarshal:", err)
- }
- }
-}
-
-func BenchmarkUnmarshalFloat64(b *testing.B) {
- var f float64
- data := []byte(`3.14`)
-
- for i := 0; i < b.N; i++ {
- if err := Unmarshal(data, &f); err != nil {
- b.Fatal("Unmarshal:", err)
- }
- }
-}
-
-func BenchmarkUnmarshalInt64(b *testing.B) {
- var x int64
- data := []byte(`3`)
-
- for i := 0; i < b.N; i++ {
- if err := Unmarshal(data, &x); err != nil {
- b.Fatal("Unmarshal:", err)
- }
- }
-}
-
-func BenchmarkIssue10335(b *testing.B) {
- b.ReportAllocs()
- var s struct{}
- j := []byte(`{"a":{ }}`)
- for n := 0; n < b.N; n++ {
- if err := Unmarshal(j, &s); err != nil {
- b.Fatal(err)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/decode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/decode_test.go
deleted file mode 100644
index 30e46ca44f0..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/decode_test.go
+++ /dev/null
@@ -1,1512 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "bytes"
- "encoding"
- "errors"
- "fmt"
- "image"
- "net"
- "reflect"
- "strings"
- "testing"
- "time"
-)
-
-type T struct {
- X string
- Y int
- Z int `json:"-"`
-}
-
-type U struct {
- Alphabet string `json:"alpha"`
-}
-
-type V struct {
- F1 interface{}
- F2 int32
- F3 Number
-}
-
-// ifaceNumAsFloat64/ifaceNumAsNumber are used to test unmarshaling with and
-// without UseNumber
-var ifaceNumAsFloat64 = map[string]interface{}{
- "k1": float64(1),
- "k2": "s",
- "k3": []interface{}{float64(1), float64(2.0), float64(3e-3)},
- "k4": map[string]interface{}{"kk1": "s", "kk2": float64(2)},
-}
-
-var ifaceNumAsNumber = map[string]interface{}{
- "k1": Number("1"),
- "k2": "s",
- "k3": []interface{}{Number("1"), Number("2.0"), Number("3e-3")},
- "k4": map[string]interface{}{"kk1": "s", "kk2": Number("2")},
-}
-
-type tx struct {
- x int
-}
-
-// A type that can unmarshal itself.
-
-type unmarshaler struct {
- T bool
-}
-
-func (u *unmarshaler) UnmarshalJSON(b []byte) error {
- *u = unmarshaler{true} // All we need to see that UnmarshalJSON is called.
- return nil
-}
-
-type ustruct struct {
- M unmarshaler
-}
-
-type unmarshalerText struct {
- A, B string
-}
-
-// needed for re-marshaling tests
-func (u unmarshalerText) MarshalText() ([]byte, error) {
- return []byte(u.A + ":" + u.B), nil
-}
-
-func (u *unmarshalerText) UnmarshalText(b []byte) error {
- pos := bytes.Index(b, []byte(":"))
- if pos == -1 {
- return errors.New("missing separator")
- }
- u.A, u.B = string(b[:pos]), string(b[pos+1:])
- return nil
-}
-
-var _ encoding.TextUnmarshaler = (*unmarshalerText)(nil)
-
-type ustructText struct {
- M unmarshalerText
-}
-
-var (
- um0, um1 unmarshaler // target2 of unmarshaling
- ump = &um1
- umtrue = unmarshaler{true}
- umslice = []unmarshaler{{true}}
- umslicep = new([]unmarshaler)
- umstruct = ustruct{unmarshaler{true}}
-
- um0T, um1T unmarshalerText // target2 of unmarshaling
- umpType = &um1T
- umtrueXY = unmarshalerText{"x", "y"}
- umsliceXY = []unmarshalerText{{"x", "y"}}
- umslicepType = new([]unmarshalerText)
- umstructType = new(ustructText)
- umstructXY = ustructText{unmarshalerText{"x", "y"}}
-
- ummapType = map[unmarshalerText]bool{}
- ummapXY = map[unmarshalerText]bool{unmarshalerText{"x", "y"}: true}
-)
-
-// Test data structures for anonymous fields.
-
-type Point struct {
- Z int
-}
-
-type Top struct {
- Level0 int
- Embed0
- *Embed0a
- *Embed0b `json:"e,omitempty"` // treated as named
- Embed0c `json:"-"` // ignored
- Loop
- Embed0p // has Point with X, Y, used
- Embed0q // has Point with Z, used
- embed // contains exported field
-}
-
-type Embed0 struct {
- Level1a int // overridden by Embed0a's Level1a with json tag
- Level1b int // used because Embed0a's Level1b is renamed
- Level1c int // used because Embed0a's Level1c is ignored
- Level1d int // annihilated by Embed0a's Level1d
- Level1e int `json:"x"` // annihilated by Embed0a.Level1e
-}
-
-type Embed0a struct {
- Level1a int `json:"Level1a,omitempty"`
- Level1b int `json:"LEVEL1B,omitempty"`
- Level1c int `json:"-"`
- Level1d int // annihilated by Embed0's Level1d
- Level1f int `json:"x"` // annihilated by Embed0's Level1e
-}
-
-type Embed0b Embed0
-
-type Embed0c Embed0
-
-type Embed0p struct {
- image.Point
-}
-
-type Embed0q struct {
- Point
-}
-
-type embed struct {
- Q int
-}
-
-type Loop struct {
- Loop1 int `json:",omitempty"`
- Loop2 int `json:",omitempty"`
- *Loop
-}
-
-// From reflect test:
-// The X in S6 and S7 annihilate, but they also block the X in S8.S9.
-type S5 struct {
- S6
- S7
- S8
-}
-
-type S6 struct {
- X int
-}
-
-type S7 S6
-
-type S8 struct {
- S9
-}
-
-type S9 struct {
- X int
- Y int
-}
-
-// From reflect test:
-// The X in S11.S6 and S12.S6 annihilate, but they also block the X in S13.S8.S9.
-type S10 struct {
- S11
- S12
- S13
-}
-
-type S11 struct {
- S6
-}
-
-type S12 struct {
- S6
-}
-
-type S13 struct {
- S8
-}
-
-type unmarshalTest struct {
- in string
- ptr interface{}
- out interface{}
- err error
- useNumber bool
-}
-
-type Ambig struct {
- // Given "hello", the first match should win.
- First int `json:"HELLO"`
- Second int `json:"Hello"`
-}
-
-type XYZ struct {
- X interface{}
- Y interface{}
- Z interface{}
-}
-
-func sliceAddr(x []int) *[]int { return &x }
-func mapAddr(x map[string]int) *map[string]int { return &x }
-
-var unmarshalTests = []unmarshalTest{
- // basic types
- {in: `true`, ptr: new(bool), out: true},
- {in: `1`, ptr: new(int), out: 1},
- {in: `1.2`, ptr: new(float64), out: 1.2},
- {in: `-5`, ptr: new(int16), out: int16(-5)},
- {in: `2`, ptr: new(Number), out: Number("2"), useNumber: true},
- {in: `2`, ptr: new(Number), out: Number("2")},
- {in: `2`, ptr: new(interface{}), out: float64(2.0)},
- {in: `2`, ptr: new(interface{}), out: Number("2"), useNumber: true},
- {in: `"a\u1234"`, ptr: new(string), out: "a\u1234"},
- {in: `"http:\/\/"`, ptr: new(string), out: "http://"},
- {in: `"g-clef: \uD834\uDD1E"`, ptr: new(string), out: "g-clef: \U0001D11E"},
- {in: `"invalid: \uD834x\uDD1E"`, ptr: new(string), out: "invalid: \uFFFDx\uFFFD"},
- {in: "null", ptr: new(interface{}), out: nil},
- {in: `{"X": [1,2,3], "Y": 4}`, ptr: new(T), out: T{Y: 4}, err: &UnmarshalTypeError{"array", reflect.TypeOf(""), 7}},
- {in: `{"x": 1}`, ptr: new(tx), out: tx{}},
- {in: `{"F1":1,"F2":2,"F3":3}`, ptr: new(V), out: V{F1: float64(1), F2: int32(2), F3: Number("3")}},
- {in: `{"F1":1,"F2":2,"F3":3}`, ptr: new(V), out: V{F1: Number("1"), F2: int32(2), F3: Number("3")}, useNumber: true},
- {in: `{"k1":1,"k2":"s","k3":[1,2.0,3e-3],"k4":{"kk1":"s","kk2":2}}`, ptr: new(interface{}), out: ifaceNumAsFloat64},
- {in: `{"k1":1,"k2":"s","k3":[1,2.0,3e-3],"k4":{"kk1":"s","kk2":2}}`, ptr: new(interface{}), out: ifaceNumAsNumber, useNumber: true},
-
- // raw values with whitespace
- {in: "\n true ", ptr: new(bool), out: true},
- {in: "\t 1 ", ptr: new(int), out: 1},
- {in: "\r 1.2 ", ptr: new(float64), out: 1.2},
- {in: "\t -5 \n", ptr: new(int16), out: int16(-5)},
- {in: "\t \"a\\u1234\" \n", ptr: new(string), out: "a\u1234"},
-
- // Z has a "-" tag.
- {in: `{"Y": 1, "Z": 2}`, ptr: new(T), out: T{Y: 1}},
-
- {in: `{"alpha": "abc", "alphabet": "xyz"}`, ptr: new(U), out: U{Alphabet: "abc"}},
- {in: `{"alpha": "abc"}`, ptr: new(U), out: U{Alphabet: "abc"}},
- {in: `{"alphabet": "xyz"}`, ptr: new(U), out: U{}},
-
- // syntax errors
- {in: `{"X": "foo", "Y"}`, err: &SyntaxError{"invalid character '}' after object key", 17}},
- {in: `[1, 2, 3+]`, err: &SyntaxError{"invalid character '+' after array element", 9}},
- {in: `{"X":12x}`, err: &SyntaxError{"invalid character 'x' after object key:value pair", 8}, useNumber: true},
-
- // raw value errors
- {in: "\x01 42", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}},
- {in: " 42 \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 5}},
- {in: "\x01 true", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}},
- {in: " false \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 8}},
- {in: "\x01 1.2", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}},
- {in: " 3.4 \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 6}},
- {in: "\x01 \"string\"", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}},
- {in: " \"string\" \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 11}},
-
- // array tests
- {in: `[1, 2, 3]`, ptr: new([3]int), out: [3]int{1, 2, 3}},
- {in: `[1, 2, 3]`, ptr: new([1]int), out: [1]int{1}},
- {in: `[1, 2, 3]`, ptr: new([5]int), out: [5]int{1, 2, 3, 0, 0}},
-
- // empty array to interface test
- {in: `[]`, ptr: new([]interface{}), out: []interface{}{}},
- {in: `null`, ptr: new([]interface{}), out: []interface{}(nil)},
- {in: `{"T":[]}`, ptr: new(map[string]interface{}), out: map[string]interface{}{"T": []interface{}{}}},
- {in: `{"T":null}`, ptr: new(map[string]interface{}), out: map[string]interface{}{"T": interface{}(nil)}},
-
- // composite tests
- {in: allValueIndent, ptr: new(All), out: allValue},
- {in: allValueCompact, ptr: new(All), out: allValue},
- {in: allValueIndent, ptr: new(*All), out: &allValue},
- {in: allValueCompact, ptr: new(*All), out: &allValue},
- {in: pallValueIndent, ptr: new(All), out: pallValue},
- {in: pallValueCompact, ptr: new(All), out: pallValue},
- {in: pallValueIndent, ptr: new(*All), out: &pallValue},
- {in: pallValueCompact, ptr: new(*All), out: &pallValue},
-
- // unmarshal interface test
- {in: `{"T":false}`, ptr: &um0, out: umtrue}, // use "false" so test will fail if custom unmarshaler is not called
- {in: `{"T":false}`, ptr: &ump, out: &umtrue},
- {in: `[{"T":false}]`, ptr: &umslice, out: umslice},
- {in: `[{"T":false}]`, ptr: &umslicep, out: &umslice},
- {in: `{"M":{"T":"x:y"}}`, ptr: &umstruct, out: umstruct},
-
- // UnmarshalText interface test
- {in: `"x:y"`, ptr: &um0T, out: umtrueXY},
- {in: `"x:y"`, ptr: &umpType, out: &umtrueXY},
- {in: `["x:y"]`, ptr: &umsliceXY, out: umsliceXY},
- {in: `["x:y"]`, ptr: &umslicepType, out: &umsliceXY},
- {in: `{"M":"x:y"}`, ptr: umstructType, out: umstructXY},
-
- // Map keys can be encoding.TextUnmarshalers
- {in: `{"x:y":true}`, ptr: &ummapType, out: ummapXY},
- // If multiple values for the same key exists, only the most recent value is used.
- {in: `{"x:y":false,"x:y":true}`, ptr: &ummapType, out: ummapXY},
-
- // Overwriting of data.
- // This is different from package xml, but it's what we've always done.
- // Now documented and tested.
- {in: `[2]`, ptr: sliceAddr([]int{1}), out: []int{2}},
- {in: `{"key": 2}`, ptr: mapAddr(map[string]int{"old": 0, "key": 1}), out: map[string]int{"key": 2}},
-
- {
- in: `{
- "Level0": 1,
- "Level1b": 2,
- "Level1c": 3,
- "x": 4,
- "Level1a": 5,
- "LEVEL1B": 6,
- "e": {
- "Level1a": 8,
- "Level1b": 9,
- "Level1c": 10,
- "Level1d": 11,
- "x": 12
- },
- "Loop1": 13,
- "Loop2": 14,
- "X": 15,
- "Y": 16,
- "Z": 17,
- "Q": 18
- }`,
- ptr: new(Top),
- out: Top{
- Level0: 1,
- Embed0: Embed0{
- Level1b: 2,
- Level1c: 3,
- },
- Embed0a: &Embed0a{
- Level1a: 5,
- Level1b: 6,
- },
- Embed0b: &Embed0b{
- Level1a: 8,
- Level1b: 9,
- Level1c: 10,
- Level1d: 11,
- Level1e: 12,
- },
- Loop: Loop{
- Loop1: 13,
- Loop2: 14,
- },
- Embed0p: Embed0p{
- Point: image.Point{X: 15, Y: 16},
- },
- Embed0q: Embed0q{
- Point: Point{Z: 17},
- },
- embed: embed{
- Q: 18,
- },
- },
- },
- {
- in: `{"hello": 1}`,
- ptr: new(Ambig),
- out: Ambig{First: 1},
- },
-
- {
- in: `{"X": 1,"Y":2}`,
- ptr: new(S5),
- out: S5{S8: S8{S9: S9{Y: 2}}},
- },
- {
- in: `{"X": 1,"Y":2}`,
- ptr: new(S10),
- out: S10{S13: S13{S8: S8{S9: S9{Y: 2}}}},
- },
-
- // invalid UTF-8 is coerced to valid UTF-8.
- {
- in: "\"hello\xffworld\"",
- ptr: new(string),
- out: "hello\ufffdworld",
- },
- {
- in: "\"hello\xc2\xc2world\"",
- ptr: new(string),
- out: "hello\ufffd\ufffdworld",
- },
- {
- in: "\"hello\xc2\xffworld\"",
- ptr: new(string),
- out: "hello\ufffd\ufffdworld",
- },
- {
- in: "\"hello\\ud800world\"",
- ptr: new(string),
- out: "hello\ufffdworld",
- },
- {
- in: "\"hello\\ud800\\ud800world\"",
- ptr: new(string),
- out: "hello\ufffd\ufffdworld",
- },
- {
- in: "\"hello\\ud800\\ud800world\"",
- ptr: new(string),
- out: "hello\ufffd\ufffdworld",
- },
- {
- in: "\"hello\xed\xa0\x80\xed\xb0\x80world\"",
- ptr: new(string),
- out: "hello\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdworld",
- },
-
- // Used to be issue 8305, but time.Time implements encoding.TextUnmarshaler so this works now.
- {
- in: `{"2009-11-10T23:00:00Z": "hello world"}`,
- ptr: &map[time.Time]string{},
- out: map[time.Time]string{time.Date(2009, 11, 10, 23, 0, 0, 0, time.UTC): "hello world"},
- },
-
- // issue 8305
- {
- in: `{"2009-11-10T23:00:00Z": "hello world"}`,
- ptr: &map[Point]string{},
- err: &UnmarshalTypeError{"object", reflect.TypeOf(map[Point]string{}), 1},
- },
- {
- in: `{"asdf": "hello world"}`,
- ptr: &map[unmarshaler]string{},
- err: &UnmarshalTypeError{"object", reflect.TypeOf(map[unmarshaler]string{}), 1},
- },
-}
-
-func TestMarshal(t *testing.T) {
- b, err := Marshal(allValue)
- if err != nil {
- t.Fatalf("Marshal allValue: %v", err)
- }
- if string(b) != allValueCompact {
- t.Errorf("Marshal allValueCompact")
- diff(t, b, []byte(allValueCompact))
- return
- }
-
- b, err = Marshal(pallValue)
- if err != nil {
- t.Fatalf("Marshal pallValue: %v", err)
- }
- if string(b) != pallValueCompact {
- t.Errorf("Marshal pallValueCompact")
- diff(t, b, []byte(pallValueCompact))
- return
- }
-}
-
-var badUTF8 = []struct {
- in, out string
-}{
- {"hello\xffworld", `"hello\ufffdworld"`},
- {"", `""`},
- {"\xff", `"\ufffd"`},
- {"\xff\xff", `"\ufffd\ufffd"`},
- {"a\xffb", `"a\ufffdb"`},
- {"\xe6\x97\xa5\xe6\x9c\xac\xff\xaa\x9e", `"日本\ufffd\ufffd\ufffd"`},
-}
-
-func TestMarshalBadUTF8(t *testing.T) {
- for _, tt := range badUTF8 {
- b, err := Marshal(tt.in)
- if string(b) != tt.out || err != nil {
- t.Errorf("Marshal(%q) = %#q, %v, want %#q, nil", tt.in, b, err, tt.out)
- }
- }
-}
-
-func TestMarshalNumberZeroVal(t *testing.T) {
- var n Number
- out, err := Marshal(n)
- if err != nil {
- t.Fatal(err)
- }
- outStr := string(out)
- if outStr != "0" {
- t.Fatalf("Invalid zero val for Number: %q", outStr)
- }
-}
-
-func TestMarshalEmbeds(t *testing.T) {
- top := &Top{
- Level0: 1,
- Embed0: Embed0{
- Level1b: 2,
- Level1c: 3,
- },
- Embed0a: &Embed0a{
- Level1a: 5,
- Level1b: 6,
- },
- Embed0b: &Embed0b{
- Level1a: 8,
- Level1b: 9,
- Level1c: 10,
- Level1d: 11,
- Level1e: 12,
- },
- Loop: Loop{
- Loop1: 13,
- Loop2: 14,
- },
- Embed0p: Embed0p{
- Point: image.Point{X: 15, Y: 16},
- },
- Embed0q: Embed0q{
- Point: Point{Z: 17},
- },
- embed: embed{
- Q: 18,
- },
- }
- b, err := Marshal(top)
- if err != nil {
- t.Fatal(err)
- }
- want := "{\"Level0\":1,\"Level1b\":2,\"Level1c\":3,\"Level1a\":5,\"LEVEL1B\":6,\"e\":{\"Level1a\":8,\"Level1b\":9,\"Level1c\":10,\"Level1d\":11,\"x\":12},\"Loop1\":13,\"Loop2\":14,\"X\":15,\"Y\":16,\"Z\":17,\"Q\":18}"
- if string(b) != want {
- t.Errorf("Wrong marshal result.\n got: %q\nwant: %q", b, want)
- }
-}
-
-func TestUnmarshal(t *testing.T) {
- for i, tt := range unmarshalTests {
- var scan scanner
- in := []byte(tt.in)
- if err := checkValid(in, &scan); err != nil {
- if !reflect.DeepEqual(err, tt.err) {
- t.Errorf("#%d: checkValid: %#v", i, err)
- continue
- }
- }
- if tt.ptr == nil {
- continue
- }
-
- // v = new(right-type)
- v := reflect.New(reflect.TypeOf(tt.ptr).Elem())
- dec := NewDecoder(bytes.NewReader(in))
- if tt.useNumber {
- dec.UseNumber()
- }
- if err := dec.Decode(v.Interface()); !reflect.DeepEqual(err, tt.err) {
- t.Errorf("#%d: %v, want %v", i, err, tt.err)
- continue
- } else if err != nil {
- continue
- }
- if !reflect.DeepEqual(v.Elem().Interface(), tt.out) {
- t.Errorf("#%d: mismatch\nhave: %#+v\nwant: %#+v", i, v.Elem().Interface(), tt.out)
- data, _ := Marshal(v.Elem().Interface())
- println(string(data))
- data, _ = Marshal(tt.out)
- println(string(data))
- continue
- }
-
- // Check round trip.
- if tt.err == nil {
- enc, err := Marshal(v.Interface())
- if err != nil {
- t.Errorf("#%d: error re-marshaling: %v", i, err)
- continue
- }
- vv := reflect.New(reflect.TypeOf(tt.ptr).Elem())
- dec = NewDecoder(bytes.NewReader(enc))
- if tt.useNumber {
- dec.UseNumber()
- }
- if err := dec.Decode(vv.Interface()); err != nil {
- t.Errorf("#%d: error re-unmarshaling %#q: %v", i, enc, err)
- continue
- }
- if !reflect.DeepEqual(v.Elem().Interface(), vv.Elem().Interface()) {
- t.Errorf("#%d: mismatch\nhave: %#+v\nwant: %#+v", i, v.Elem().Interface(), vv.Elem().Interface())
- t.Errorf(" In: %q", strings.Map(noSpace, string(in)))
- t.Errorf("Marshal: %q", strings.Map(noSpace, string(enc)))
- continue
- }
- }
- }
-}
-
-func TestUnmarshalMarshal(t *testing.T) {
- initBig()
- var v interface{}
- if err := Unmarshal(jsonBig, &v); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- b, err := Marshal(v)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if !bytes.Equal(jsonBig, b) {
- t.Errorf("Marshal jsonBig")
- diff(t, b, jsonBig)
- return
- }
-}
-
-var numberTests = []struct {
- in string
- i int64
- intErr string
- f float64
- floatErr string
-}{
- {in: "-1.23e1", intErr: "strconv.ParseInt: parsing \"-1.23e1\": invalid syntax", f: -1.23e1},
- {in: "-12", i: -12, f: -12.0},
- {in: "1e1000", intErr: "strconv.ParseInt: parsing \"1e1000\": invalid syntax", floatErr: "strconv.ParseFloat: parsing \"1e1000\": value out of range"},
-}
-
-// Independent of Decode, basic coverage of the accessors in Number
-func TestNumberAccessors(t *testing.T) {
- for _, tt := range numberTests {
- n := Number(tt.in)
- if s := n.String(); s != tt.in {
- t.Errorf("Number(%q).String() is %q", tt.in, s)
- }
- if i, err := n.Int64(); err == nil && tt.intErr == "" && i != tt.i {
- t.Errorf("Number(%q).Int64() is %d", tt.in, i)
- } else if (err == nil && tt.intErr != "") || (err != nil && err.Error() != tt.intErr) {
- t.Errorf("Number(%q).Int64() wanted error %q but got: %v", tt.in, tt.intErr, err)
- }
- if f, err := n.Float64(); err == nil && tt.floatErr == "" && f != tt.f {
- t.Errorf("Number(%q).Float64() is %g", tt.in, f)
- } else if (err == nil && tt.floatErr != "") || (err != nil && err.Error() != tt.floatErr) {
- t.Errorf("Number(%q).Float64() wanted error %q but got: %v", tt.in, tt.floatErr, err)
- }
- }
-}
-
-func TestLargeByteSlice(t *testing.T) {
- s0 := make([]byte, 2000)
- for i := range s0 {
- s0[i] = byte(i)
- }
- b, err := Marshal(s0)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- var s1 []byte
- if err := Unmarshal(b, &s1); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if !bytes.Equal(s0, s1) {
- t.Errorf("Marshal large byte slice")
- diff(t, s0, s1)
- }
-}
-
-type Xint struct {
- X int
-}
-
-func TestUnmarshalInterface(t *testing.T) {
- var xint Xint
- var i interface{} = &xint
- if err := Unmarshal([]byte(`{"X":1}`), &i); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if xint.X != 1 {
- t.Fatalf("Did not write to xint")
- }
-}
-
-func TestUnmarshalPtrPtr(t *testing.T) {
- var xint Xint
- pxint := &xint
- if err := Unmarshal([]byte(`{"X":1}`), &pxint); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if xint.X != 1 {
- t.Fatalf("Did not write to xint")
- }
-}
-
-func TestEscape(t *testing.T) {
- const input = `"foobar"<html>` + " [\u2028 \u2029]"
- const expected = `"\"foobar\"\u003chtml\u003e [\u2028 \u2029]"`
- b, err := Marshal(input)
- if err != nil {
- t.Fatalf("Marshal error: %v", err)
- }
- if s := string(b); s != expected {
- t.Errorf("Encoding of [%s]:\n got [%s]\nwant [%s]", input, s, expected)
- }
-}
-
-// WrongString is a struct that's misusing the ,string modifier.
-type WrongString struct {
- Message string `json:"result,string"`
-}
-
-type wrongStringTest struct {
- in, err string
-}
-
-var wrongStringTests = []wrongStringTest{
- {`{"result":"x"}`, `json: invalid use of ,string struct tag, trying to unmarshal "x" into string`},
- {`{"result":"foo"}`, `json: invalid use of ,string struct tag, trying to unmarshal "foo" into string`},
- {`{"result":"123"}`, `json: invalid use of ,string struct tag, trying to unmarshal "123" into string`},
- {`{"result":123}`, `json: invalid use of ,string struct tag, trying to unmarshal unquoted value into string`},
-}
-
-// If people misuse the ,string modifier, the error message should be
-// helpful, telling the user that they're doing it wrong.
-func TestErrorMessageFromMisusedString(t *testing.T) {
- for n, tt := range wrongStringTests {
- r := strings.NewReader(tt.in)
- var s WrongString
- err := NewDecoder(r).Decode(&s)
- got := fmt.Sprintf("%v", err)
- if got != tt.err {
- t.Errorf("%d. got err = %q, want %q", n, got, tt.err)
- }
- }
-}
-
-func noSpace(c rune) rune {
- if isSpace(byte(c)) { //only used for ascii
- return -1
- }
- return c
-}
-
-type All struct {
- Bool bool
- Int int
- Int8 int8
- Int16 int16
- Int32 int32
- Int64 int64
- Uint uint
- Uint8 uint8
- Uint16 uint16
- Uint32 uint32
- Uint64 uint64
- Uintptr uintptr
- Float32 float32
- Float64 float64
-
- Foo string `json:"bar"`
- Foo2 string `json:"bar2,dummyopt"`
-
- IntStr int64 `json:",string"`
-
- PBool *bool
- PInt *int
- PInt8 *int8
- PInt16 *int16
- PInt32 *int32
- PInt64 *int64
- PUint *uint
- PUint8 *uint8
- PUint16 *uint16
- PUint32 *uint32
- PUint64 *uint64
- PUintptr *uintptr
- PFloat32 *float32
- PFloat64 *float64
-
- String string
- PString *string
-
- Map map[string]Small
- MapP map[string]*Small
- PMap *map[string]Small
- PMapP *map[string]*Small
-
- EmptyMap map[string]Small
- NilMap map[string]Small
-
- Slice []Small
- SliceP []*Small
- PSlice *[]Small
- PSliceP *[]*Small
-
- EmptySlice []Small
- NilSlice []Small
-
- StringSlice []string
- ByteSlice []byte
-
- Small Small
- PSmall *Small
- PPSmall **Small
-
- Interface interface{}
- PInterface *interface{}
-
- unexported int
-}
-
-type Small struct {
- Tag string
-}
-
-var allValue = All{
- Bool: true,
- Int: 2,
- Int8: 3,
- Int16: 4,
- Int32: 5,
- Int64: 6,
- Uint: 7,
- Uint8: 8,
- Uint16: 9,
- Uint32: 10,
- Uint64: 11,
- Uintptr: 12,
- Float32: 14.1,
- Float64: 15.1,
- Foo: "foo",
- Foo2: "foo2",
- IntStr: 42,
- String: "16",
- Map: map[string]Small{
- "17": {Tag: "tag17"},
- "18": {Tag: "tag18"},
- },
- MapP: map[string]*Small{
- "19": {Tag: "tag19"},
- "20": nil,
- },
- EmptyMap: map[string]Small{},
- Slice: []Small{{Tag: "tag20"}, {Tag: "tag21"}},
- SliceP: []*Small{{Tag: "tag22"}, nil, {Tag: "tag23"}},
- EmptySlice: []Small{},
- StringSlice: []string{"str24", "str25", "str26"},
- ByteSlice: []byte{27, 28, 29},
- Small: Small{Tag: "tag30"},
- PSmall: &Small{Tag: "tag31"},
- Interface: 5.2,
-}
-
-var pallValue = All{
- PBool: &allValue.Bool,
- PInt: &allValue.Int,
- PInt8: &allValue.Int8,
- PInt16: &allValue.Int16,
- PInt32: &allValue.Int32,
- PInt64: &allValue.Int64,
- PUint: &allValue.Uint,
- PUint8: &allValue.Uint8,
- PUint16: &allValue.Uint16,
- PUint32: &allValue.Uint32,
- PUint64: &allValue.Uint64,
- PUintptr: &allValue.Uintptr,
- PFloat32: &allValue.Float32,
- PFloat64: &allValue.Float64,
- PString: &allValue.String,
- PMap: &allValue.Map,
- PMapP: &allValue.MapP,
- PSlice: &allValue.Slice,
- PSliceP: &allValue.SliceP,
- PPSmall: &allValue.PSmall,
- PInterface: &allValue.Interface,
-}
-
-var allValueIndent = `{
- "Bool": true,
- "Int": 2,
- "Int8": 3,
- "Int16": 4,
- "Int32": 5,
- "Int64": 6,
- "Uint": 7,
- "Uint8": 8,
- "Uint16": 9,
- "Uint32": 10,
- "Uint64": 11,
- "Uintptr": 12,
- "Float32": 14.1,
- "Float64": 15.1,
- "bar": "foo",
- "bar2": "foo2",
- "IntStr": "42",
- "PBool": null,
- "PInt": null,
- "PInt8": null,
- "PInt16": null,
- "PInt32": null,
- "PInt64": null,
- "PUint": null,
- "PUint8": null,
- "PUint16": null,
- "PUint32": null,
- "PUint64": null,
- "PUintptr": null,
- "PFloat32": null,
- "PFloat64": null,
- "String": "16",
- "PString": null,
- "Map": {
- "17": {
- "Tag": "tag17"
- },
- "18": {
- "Tag": "tag18"
- }
- },
- "MapP": {
- "19": {
- "Tag": "tag19"
- },
- "20": null
- },
- "PMap": null,
- "PMapP": null,
- "EmptyMap": {},
- "NilMap": null,
- "Slice": [
- {
- "Tag": "tag20"
- },
- {
- "Tag": "tag21"
- }
- ],
- "SliceP": [
- {
- "Tag": "tag22"
- },
- null,
- {
- "Tag": "tag23"
- }
- ],
- "PSlice": null,
- "PSliceP": null,
- "EmptySlice": [],
- "NilSlice": null,
- "StringSlice": [
- "str24",
- "str25",
- "str26"
- ],
- "ByteSlice": "Gxwd",
- "Small": {
- "Tag": "tag30"
- },
- "PSmall": {
- "Tag": "tag31"
- },
- "PPSmall": null,
- "Interface": 5.2,
- "PInterface": null
-}`
-
-var allValueCompact = strings.Map(noSpace, allValueIndent)
-
-var pallValueIndent = `{
- "Bool": false,
- "Int": 0,
- "Int8": 0,
- "Int16": 0,
- "Int32": 0,
- "Int64": 0,
- "Uint": 0,
- "Uint8": 0,
- "Uint16": 0,
- "Uint32": 0,
- "Uint64": 0,
- "Uintptr": 0,
- "Float32": 0,
- "Float64": 0,
- "bar": "",
- "bar2": "",
- "IntStr": "0",
- "PBool": true,
- "PInt": 2,
- "PInt8": 3,
- "PInt16": 4,
- "PInt32": 5,
- "PInt64": 6,
- "PUint": 7,
- "PUint8": 8,
- "PUint16": 9,
- "PUint32": 10,
- "PUint64": 11,
- "PUintptr": 12,
- "PFloat32": 14.1,
- "PFloat64": 15.1,
- "String": "",
- "PString": "16",
- "Map": null,
- "MapP": null,
- "PMap": {
- "17": {
- "Tag": "tag17"
- },
- "18": {
- "Tag": "tag18"
- }
- },
- "PMapP": {
- "19": {
- "Tag": "tag19"
- },
- "20": null
- },
- "EmptyMap": null,
- "NilMap": null,
- "Slice": null,
- "SliceP": null,
- "PSlice": [
- {
- "Tag": "tag20"
- },
- {
- "Tag": "tag21"
- }
- ],
- "PSliceP": [
- {
- "Tag": "tag22"
- },
- null,
- {
- "Tag": "tag23"
- }
- ],
- "EmptySlice": null,
- "NilSlice": null,
- "StringSlice": null,
- "ByteSlice": null,
- "Small": {
- "Tag": ""
- },
- "PSmall": null,
- "PPSmall": {
- "Tag": "tag31"
- },
- "Interface": null,
- "PInterface": 5.2
-}`
-
-var pallValueCompact = strings.Map(noSpace, pallValueIndent)
-
-func TestRefUnmarshal(t *testing.T) {
- type S struct {
- // Ref is defined in encode_test.go.
- R0 Ref
- R1 *Ref
- R2 RefText
- R3 *RefText
- }
- want := S{
- R0: 12,
- R1: new(Ref),
- R2: 13,
- R3: new(RefText),
- }
- *want.R1 = 12
- *want.R3 = 13
-
- var got S
- if err := Unmarshal([]byte(`{"R0":"ref","R1":"ref","R2":"ref","R3":"ref"}`), &got); err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("got %+v, want %+v", got, want)
- }
-}
-
-// Test that the empty string doesn't panic decoding when ,string is specified
-// Issue 3450
-func TestEmptyString(t *testing.T) {
- type T2 struct {
- Number1 int `json:",string"`
- Number2 int `json:",string"`
- }
- data := `{"Number1":"1", "Number2":""}`
- dec := NewDecoder(strings.NewReader(data))
- var t2 T2
- err := dec.Decode(&t2)
- if err == nil {
- t.Fatal("Decode: did not return error")
- }
- if t2.Number1 != 1 {
- t.Fatal("Decode: did not set Number1")
- }
-}
-
-// Test that a null for ,string is not replaced with the previous quoted string (issue 7046).
-// It should also not be an error (issue 2540, issue 8587).
-func TestNullString(t *testing.T) {
- type T struct {
- A int `json:",string"`
- B int `json:",string"`
- C *int `json:",string"`
- }
- data := []byte(`{"A": "1", "B": null, "C": null}`)
- var s T
- s.B = 1
- s.C = new(int)
- *s.C = 2
- err := Unmarshal(data, &s)
- if err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if s.B != 1 || s.C != nil {
- t.Fatalf("after Unmarshal, s.B=%d, s.C=%p, want 1, nil", s.B, s.C)
- }
-}
-
-func intp(x int) *int {
- p := new(int)
- *p = x
- return p
-}
-
-func intpp(x *int) **int {
- pp := new(*int)
- *pp = x
- return pp
-}
-
-var interfaceSetTests = []struct {
- pre interface{}
- json string
- post interface{}
-}{
- {"foo", `"bar"`, "bar"},
- {"foo", `2`, 2.0},
- {"foo", `true`, true},
- {"foo", `null`, nil},
-
- {nil, `null`, nil},
- {new(int), `null`, nil},
- {(*int)(nil), `null`, nil},
- {new(*int), `null`, new(*int)},
- {(**int)(nil), `null`, nil},
- {intp(1), `null`, nil},
- {intpp(nil), `null`, intpp(nil)},
- {intpp(intp(1)), `null`, intpp(nil)},
-}
-
-func TestInterfaceSet(t *testing.T) {
- for _, tt := range interfaceSetTests {
- b := struct{ X interface{} }{tt.pre}
- blob := `{"X":` + tt.json + `}`
- if err := Unmarshal([]byte(blob), &b); err != nil {
- t.Errorf("Unmarshal %#q: %v", blob, err)
- continue
- }
- if !reflect.DeepEqual(b.X, tt.post) {
- t.Errorf("Unmarshal %#q into %#v: X=%#v, want %#v", blob, tt.pre, b.X, tt.post)
- }
- }
-}
-
-// JSON null values should be ignored for primitives and string values instead of resulting in an error.
-// Issue 2540
-func TestUnmarshalNulls(t *testing.T) {
- jsonData := []byte(`{
- "Bool" : null,
- "Int" : null,
- "Int8" : null,
- "Int16" : null,
- "Int32" : null,
- "Int64" : null,
- "Uint" : null,
- "Uint8" : null,
- "Uint16" : null,
- "Uint32" : null,
- "Uint64" : null,
- "Float32" : null,
- "Float64" : null,
- "String" : null}`)
-
- nulls := All{
- Bool: true,
- Int: 2,
- Int8: 3,
- Int16: 4,
- Int32: 5,
- Int64: 6,
- Uint: 7,
- Uint8: 8,
- Uint16: 9,
- Uint32: 10,
- Uint64: 11,
- Float32: 12.1,
- Float64: 13.1,
- String: "14"}
-
- err := Unmarshal(jsonData, &nulls)
- if err != nil {
- t.Errorf("Unmarshal of null values failed: %v", err)
- }
- if !nulls.Bool || nulls.Int != 2 || nulls.Int8 != 3 || nulls.Int16 != 4 || nulls.Int32 != 5 || nulls.Int64 != 6 ||
- nulls.Uint != 7 || nulls.Uint8 != 8 || nulls.Uint16 != 9 || nulls.Uint32 != 10 || nulls.Uint64 != 11 ||
- nulls.Float32 != 12.1 || nulls.Float64 != 13.1 || nulls.String != "14" {
-
- t.Errorf("Unmarshal of null values affected primitives")
- }
-}
-
-func TestStringKind(t *testing.T) {
- type stringKind string
-
- var m1, m2 map[stringKind]int
- m1 = map[stringKind]int{
- "foo": 42,
- }
-
- data, err := Marshal(m1)
- if err != nil {
- t.Errorf("Unexpected error marshaling: %v", err)
- }
-
- err = Unmarshal(data, &m2)
- if err != nil {
- t.Errorf("Unexpected error unmarshaling: %v", err)
- }
-
- if !reflect.DeepEqual(m1, m2) {
- t.Error("Items should be equal after encoding and then decoding")
- }
-}
-
-// Custom types with []byte as underlying type could not be marshalled
-// and then unmarshalled.
-// Issue 8962.
-func TestByteKind(t *testing.T) {
- type byteKind []byte
-
- a := byteKind("hello")
-
- data, err := Marshal(a)
- if err != nil {
- t.Error(err)
- }
- var b byteKind
- err = Unmarshal(data, &b)
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(a, b) {
- t.Errorf("expected %v == %v", a, b)
- }
-}
-
-// The fix for issue 8962 introduced a regression.
-// Issue 12921.
-func TestSliceOfCustomByte(t *testing.T) {
- type Uint8 uint8
-
- a := []Uint8("hello")
-
- data, err := Marshal(a)
- if err != nil {
- t.Fatal(err)
- }
- var b []Uint8
- err = Unmarshal(data, &b)
- if err != nil {
- t.Fatal(err)
- }
- if !reflect.DeepEqual(a, b) {
- t.Fatalf("expected %v == %v", a, b)
- }
-}
-
-var decodeTypeErrorTests = []struct {
- dest interface{}
- src string
-}{
- {new(string), `{"user": "name"}`}, // issue 4628.
- {new(error), `{}`}, // issue 4222
- {new(error), `[]`},
- {new(error), `""`},
- {new(error), `123`},
- {new(error), `true`},
-}
-
-func TestUnmarshalTypeError(t *testing.T) {
- for _, item := range decodeTypeErrorTests {
- err := Unmarshal([]byte(item.src), item.dest)
- if _, ok := err.(*UnmarshalTypeError); !ok {
- t.Errorf("expected type error for Unmarshal(%q, type %T): got %T",
- item.src, item.dest, err)
- }
- }
-}
-
-var unmarshalSyntaxTests = []string{
- "tru",
- "fals",
- "nul",
- "123e",
- `"hello`,
- `[1,2,3`,
- `{"key":1`,
- `{"key":1,`,
-}
-
-func TestUnmarshalSyntax(t *testing.T) {
- var x interface{}
- for _, src := range unmarshalSyntaxTests {
- err := Unmarshal([]byte(src), &x)
- if _, ok := err.(*SyntaxError); !ok {
- t.Errorf("expected syntax error for Unmarshal(%q): got %T", src, err)
- }
- }
-}
-
-// Test handling of unexported fields that should be ignored.
-// Issue 4660
-type unexportedFields struct {
- Name string
- m map[string]interface{} `json:"-"`
- m2 map[string]interface{} `json:"abcd"`
-}
-
-func TestUnmarshalUnexported(t *testing.T) {
- input := `{"Name": "Bob", "m": {"x": 123}, "m2": {"y": 456}, "abcd": {"z": 789}}`
- want := &unexportedFields{Name: "Bob"}
-
- out := &unexportedFields{}
- err := Unmarshal([]byte(input), out)
- if err != nil {
- t.Errorf("got error %v, expected nil", err)
- }
- if !reflect.DeepEqual(out, want) {
- t.Errorf("got %q, want %q", out, want)
- }
-}
-
-// Time3339 is a time.Time which encodes to and from JSON
-// as an RFC 3339 time in UTC.
-type Time3339 time.Time
-
-func (t *Time3339) UnmarshalJSON(b []byte) error {
- if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' {
- return fmt.Errorf("types: failed to unmarshal non-string value %q as an RFC 3339 time", b)
- }
- tm, err := time.Parse(time.RFC3339, string(b[1:len(b)-1]))
- if err != nil {
- return err
- }
- *t = Time3339(tm)
- return nil
-}
-
-func TestUnmarshalJSONLiteralError(t *testing.T) {
- var t3 Time3339
- err := Unmarshal([]byte(`"0000-00-00T00:00:00Z"`), &t3)
- if err == nil {
- t.Fatalf("expected error; got time %v", time.Time(t3))
- }
- if !strings.Contains(err.Error(), "range") {
- t.Errorf("got err = %v; want out of range error", err)
- }
-}
-
-// Test that extra object elements in an array do not result in a
-// "data changing underfoot" error.
-// Issue 3717
-func TestSkipArrayObjects(t *testing.T) {
- json := `[{}]`
- var dest [0]interface{}
-
- err := Unmarshal([]byte(json), &dest)
- if err != nil {
- t.Errorf("got error %q, want nil", err)
- }
-}
-
-// Test semantics of pre-filled struct fields and pre-filled map fields.
-// Issue 4900.
-func TestPrefilled(t *testing.T) {
- ptrToMap := func(m map[string]interface{}) *map[string]interface{} { return &m }
-
- // Values here change, cannot reuse table across runs.
- var prefillTests = []struct {
- in string
- ptr interface{}
- out interface{}
- }{
- {
- in: `{"X": 1, "Y": 2}`,
- ptr: &XYZ{X: float32(3), Y: int16(4), Z: 1.5},
- out: &XYZ{X: float64(1), Y: float64(2), Z: 1.5},
- },
- {
- in: `{"X": 1, "Y": 2}`,
- ptr: ptrToMap(map[string]interface{}{"X": float32(3), "Y": int16(4), "Z": 1.5}),
- out: ptrToMap(map[string]interface{}{"X": float64(1), "Y": float64(2), "Z": 1.5}),
- },
- }
-
- for _, tt := range prefillTests {
- ptrstr := fmt.Sprintf("%v", tt.ptr)
- err := Unmarshal([]byte(tt.in), tt.ptr) // tt.ptr edited here
- if err != nil {
- t.Errorf("Unmarshal: %v", err)
- }
- if !reflect.DeepEqual(tt.ptr, tt.out) {
- t.Errorf("Unmarshal(%#q, %s): have %v, want %v", tt.in, ptrstr, tt.ptr, tt.out)
- }
- }
-}
-
-var invalidUnmarshalTests = []struct {
- v interface{}
- want string
-}{
- {nil, "json: Unmarshal(nil)"},
- {struct{}{}, "json: Unmarshal(non-pointer struct {})"},
- {(*int)(nil), "json: Unmarshal(nil *int)"},
-}
-
-func TestInvalidUnmarshal(t *testing.T) {
- buf := []byte(`{"a":"1"}`)
- for _, tt := range invalidUnmarshalTests {
- err := Unmarshal(buf, tt.v)
- if err == nil {
- t.Errorf("Unmarshal expecting error, got nil")
- continue
- }
- if got := err.Error(); got != tt.want {
- t.Errorf("Unmarshal = %q; want %q", got, tt.want)
- }
- }
-}
-
-var invalidUnmarshalTextTests = []struct {
- v interface{}
- want string
-}{
- {nil, "json: Unmarshal(nil)"},
- {struct{}{}, "json: Unmarshal(non-pointer struct {})"},
- {(*int)(nil), "json: Unmarshal(nil *int)"},
- {new(net.IP), "json: cannot unmarshal string into Go value of type *net.IP"},
-}
-
-func TestInvalidUnmarshalText(t *testing.T) {
- buf := []byte(`123`)
- for _, tt := range invalidUnmarshalTextTests {
- err := Unmarshal(buf, tt.v)
- if err == nil {
- t.Errorf("Unmarshal expecting error, got nil")
- continue
- }
- if got := err.Error(); got != tt.want {
- t.Errorf("Unmarshal = %q; want %q", got, tt.want)
- }
- }
-}
-
-// Test that string option is ignored for invalid types.
-// Issue 9812.
-func TestInvalidStringOption(t *testing.T) {
- num := 0
- item := struct {
- T time.Time `json:",string"`
- M map[string]string `json:",string"`
- S []string `json:",string"`
- A [1]string `json:",string"`
- I interface{} `json:",string"`
- P *int `json:",string"`
- }{M: make(map[string]string), S: make([]string, 0), I: num, P: &num}
-
- data, err := Marshal(item)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
-
- err = Unmarshal(data, &item)
- if err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/encode_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/encode_test.go
deleted file mode 100644
index b484022a70e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/encode_test.go
+++ /dev/null
@@ -1,613 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "bytes"
- "fmt"
- "math"
- "reflect"
- "testing"
- "unicode"
-)
-
-type Optionals struct {
- Sr string `json:"sr"`
- So string `json:"so,omitempty"`
- Sw string `json:"-"`
-
- Ir int `json:"omitempty"` // actually named omitempty, not an option
- Io int `json:"io,omitempty"`
-
- Slr []string `json:"slr,random"`
- Slo []string `json:"slo,omitempty"`
-
- Mr map[string]interface{} `json:"mr"`
- Mo map[string]interface{} `json:",omitempty"`
-
- Fr float64 `json:"fr"`
- Fo float64 `json:"fo,omitempty"`
-
- Br bool `json:"br"`
- Bo bool `json:"bo,omitempty"`
-
- Ur uint `json:"ur"`
- Uo uint `json:"uo,omitempty"`
-
- Str struct{} `json:"str"`
- Sto struct{} `json:"sto,omitempty"`
-}
-
-var optionalsExpected = `{
- "sr": "",
- "omitempty": 0,
- "slr": null,
- "mr": {},
- "fr": 0,
- "br": false,
- "ur": 0,
- "str": {},
- "sto": {}
-}`
-
-func TestOmitEmpty(t *testing.T) {
- var o Optionals
- o.Sw = "something"
- o.Mr = map[string]interface{}{}
- o.Mo = map[string]interface{}{}
-
- got, err := MarshalIndent(&o, "", " ")
- if err != nil {
- t.Fatal(err)
- }
- if got := string(got); got != optionalsExpected {
- t.Errorf(" got: %s\nwant: %s\n", got, optionalsExpected)
- }
-}
-
-type StringTag struct {
- BoolStr bool `json:",string"`
- IntStr int64 `json:",string"`
- StrStr string `json:",string"`
-}
-
-var stringTagExpected = `{
- "BoolStr": "true",
- "IntStr": "42",
- "StrStr": "\"xzbit\""
-}`
-
-func TestStringTag(t *testing.T) {
- var s StringTag
- s.BoolStr = true
- s.IntStr = 42
- s.StrStr = "xzbit"
- got, err := MarshalIndent(&s, "", " ")
- if err != nil {
- t.Fatal(err)
- }
- if got := string(got); got != stringTagExpected {
- t.Fatalf(" got: %s\nwant: %s\n", got, stringTagExpected)
- }
-
- // Verify that it round-trips.
- var s2 StringTag
- err = NewDecoder(bytes.NewReader(got)).Decode(&s2)
- if err != nil {
- t.Fatalf("Decode: %v", err)
- }
- if !reflect.DeepEqual(s, s2) {
- t.Fatalf("decode didn't match.\nsource: %#v\nEncoded as:\n%s\ndecode: %#v", s, string(got), s2)
- }
-}
-
-// byte slices are special even if they're renamed types.
-type renamedByte byte
-type renamedByteSlice []byte
-type renamedRenamedByteSlice []renamedByte
-
-func TestEncodeRenamedByteSlice(t *testing.T) {
- s := renamedByteSlice("abc")
- result, err := Marshal(s)
- if err != nil {
- t.Fatal(err)
- }
- expect := `"YWJj"`
- if string(result) != expect {
- t.Errorf(" got %s want %s", result, expect)
- }
- r := renamedRenamedByteSlice("abc")
- result, err = Marshal(r)
- if err != nil {
- t.Fatal(err)
- }
- if string(result) != expect {
- t.Errorf(" got %s want %s", result, expect)
- }
-}
-
-var unsupportedValues = []interface{}{
- math.NaN(),
- math.Inf(-1),
- math.Inf(1),
-}
-
-func TestUnsupportedValues(t *testing.T) {
- for _, v := range unsupportedValues {
- if _, err := Marshal(v); err != nil {
- if _, ok := err.(*UnsupportedValueError); !ok {
- t.Errorf("for %v, got %T want UnsupportedValueError", v, err)
- }
- } else {
- t.Errorf("for %v, expected error", v)
- }
- }
-}
-
-// Ref has Marshaler and Unmarshaler methods with pointer receiver.
-type Ref int
-
-func (*Ref) MarshalJSON() ([]byte, error) {
- return []byte(`"ref"`), nil
-}
-
-func (r *Ref) UnmarshalJSON([]byte) error {
- *r = 12
- return nil
-}
-
-// Val has Marshaler methods with value receiver.
-type Val int
-
-func (Val) MarshalJSON() ([]byte, error) {
- return []byte(`"val"`), nil
-}
-
-// RefText has Marshaler and Unmarshaler methods with pointer receiver.
-type RefText int
-
-func (*RefText) MarshalText() ([]byte, error) {
- return []byte(`"ref"`), nil
-}
-
-func (r *RefText) UnmarshalText([]byte) error {
- *r = 13
- return nil
-}
-
-// ValText has Marshaler methods with value receiver.
-type ValText int
-
-func (ValText) MarshalText() ([]byte, error) {
- return []byte(`"val"`), nil
-}
-
-func TestRefValMarshal(t *testing.T) {
- var s = struct {
- R0 Ref
- R1 *Ref
- R2 RefText
- R3 *RefText
- V0 Val
- V1 *Val
- V2 ValText
- V3 *ValText
- }{
- R0: 12,
- R1: new(Ref),
- R2: 14,
- R3: new(RefText),
- V0: 13,
- V1: new(Val),
- V2: 15,
- V3: new(ValText),
- }
- const want = `{"R0":"ref","R1":"ref","R2":"\"ref\"","R3":"\"ref\"","V0":"val","V1":"val","V2":"\"val\"","V3":"\"val\""}`
- b, err := Marshal(&s)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if got := string(b); got != want {
- t.Errorf("got %q, want %q", got, want)
- }
-}
-
-// C implements Marshaler and returns unescaped JSON.
-type C int
-
-func (C) MarshalJSON() ([]byte, error) {
- return []byte(`"<&>"`), nil
-}
-
-// CText implements Marshaler and returns unescaped text.
-type CText int
-
-func (CText) MarshalText() ([]byte, error) {
- return []byte(`"<&>"`), nil
-}
-
-func TestMarshalerEscaping(t *testing.T) {
- var c C
- want := `"\u003c\u0026\u003e"`
- b, err := Marshal(c)
- if err != nil {
- t.Fatalf("Marshal(c): %v", err)
- }
- if got := string(b); got != want {
- t.Errorf("Marshal(c) = %#q, want %#q", got, want)
- }
-
- var ct CText
- want = `"\"\u003c\u0026\u003e\""`
- b, err = Marshal(ct)
- if err != nil {
- t.Fatalf("Marshal(ct): %v", err)
- }
- if got := string(b); got != want {
- t.Errorf("Marshal(ct) = %#q, want %#q", got, want)
- }
-}
-
-type IntType int
-
-type MyStruct struct {
- IntType
-}
-
-func TestAnonymousNonstruct(t *testing.T) {
- var i IntType = 11
- a := MyStruct{i}
- const want = `{"IntType":11}`
-
- b, err := Marshal(a)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if got := string(b); got != want {
- t.Errorf("got %q, want %q", got, want)
- }
-}
-
-type BugA struct {
- S string
-}
-
-type BugB struct {
- BugA
- S string
-}
-
-type BugC struct {
- S string
-}
-
-// Legal Go: We never use the repeated embedded field (S).
-type BugX struct {
- A int
- BugA
- BugB
-}
-
-// Issue 5245.
-func TestEmbeddedBug(t *testing.T) {
- v := BugB{
- BugA{"A"},
- "B",
- }
- b, err := Marshal(v)
- if err != nil {
- t.Fatal("Marshal:", err)
- }
- want := `{"S":"B"}`
- got := string(b)
- if got != want {
- t.Fatalf("Marshal: got %s want %s", got, want)
- }
- // Now check that the duplicate field, S, does not appear.
- x := BugX{
- A: 23,
- }
- b, err = Marshal(x)
- if err != nil {
- t.Fatal("Marshal:", err)
- }
- want = `{"A":23}`
- got = string(b)
- if got != want {
- t.Fatalf("Marshal: got %s want %s", got, want)
- }
-}
-
-type BugD struct { // Same as BugA after tagging.
- XXX string `json:"S"`
-}
-
-// BugD's tagged S field should dominate BugA's.
-type BugY struct {
- BugA
- BugD
-}
-
-// Test that a field with a tag dominates untagged fields.
-func TestTaggedFieldDominates(t *testing.T) {
- v := BugY{
- BugA{"BugA"},
- BugD{"BugD"},
- }
- b, err := Marshal(v)
- if err != nil {
- t.Fatal("Marshal:", err)
- }
- want := `{"S":"BugD"}`
- got := string(b)
- if got != want {
- t.Fatalf("Marshal: got %s want %s", got, want)
- }
-}
-
-// There are no tags here, so S should not appear.
-type BugZ struct {
- BugA
- BugC
- BugY // Contains a tagged S field through BugD; should not dominate.
-}
-
-func TestDuplicatedFieldDisappears(t *testing.T) {
- v := BugZ{
- BugA{"BugA"},
- BugC{"BugC"},
- BugY{
- BugA{"nested BugA"},
- BugD{"nested BugD"},
- },
- }
- b, err := Marshal(v)
- if err != nil {
- t.Fatal("Marshal:", err)
- }
- want := `{}`
- got := string(b)
- if got != want {
- t.Fatalf("Marshal: got %s want %s", got, want)
- }
-}
-
-func TestStringBytes(t *testing.T) {
- // Test that encodeState.stringBytes and encodeState.string use the same encoding.
- var r []rune
- for i := '\u0000'; i <= unicode.MaxRune; i++ {
- r = append(r, i)
- }
- s := string(r) + "\xff\xff\xffhello" // some invalid UTF-8 too
-
- for _, escapeHTML := range []bool{true, false} {
- es := &encodeState{}
- es.string(s, escapeHTML)
-
- esBytes := &encodeState{}
- esBytes.stringBytes([]byte(s), escapeHTML)
-
- enc := es.Buffer.String()
- encBytes := esBytes.Buffer.String()
- if enc != encBytes {
- i := 0
- for i < len(enc) && i < len(encBytes) && enc[i] == encBytes[i] {
- i++
- }
- enc = enc[i:]
- encBytes = encBytes[i:]
- i = 0
- for i < len(enc) && i < len(encBytes) && enc[len(enc)-i-1] == encBytes[len(encBytes)-i-1] {
- i++
- }
- enc = enc[:len(enc)-i]
- encBytes = encBytes[:len(encBytes)-i]
-
- if len(enc) > 20 {
- enc = enc[:20] + "..."
- }
- if len(encBytes) > 20 {
- encBytes = encBytes[:20] + "..."
- }
-
- t.Errorf("with escapeHTML=%t, encodings differ at %#q vs %#q",
- escapeHTML, enc, encBytes)
- }
- }
-}
-
-func TestIssue6458(t *testing.T) {
- type Foo struct {
- M RawMessage
- }
- x := Foo{RawMessage(`"foo"`)}
-
- b, err := Marshal(&x)
- if err != nil {
- t.Fatal(err)
- }
- if want := `{"M":"foo"}`; string(b) != want {
- t.Errorf("Marshal(&x) = %#q; want %#q", b, want)
- }
-
- b, err = Marshal(x)
- if err != nil {
- t.Fatal(err)
- }
-
- if want := `{"M":"ImZvbyI="}`; string(b) != want {
- t.Errorf("Marshal(x) = %#q; want %#q", b, want)
- }
-}
-
-func TestIssue10281(t *testing.T) {
- type Foo struct {
- N Number
- }
- x := Foo{Number(`invalid`)}
-
- b, err := Marshal(&x)
- if err == nil {
- t.Errorf("Marshal(&x) = %#q; want error", b)
- }
-}
-
-func TestHTMLEscape(t *testing.T) {
- var b, want bytes.Buffer
- m := `{"M":"<html>foo &` + "\xe2\x80\xa8 \xe2\x80\xa9" + `</html>"}`
- want.Write([]byte(`{"M":"\u003chtml\u003efoo \u0026\u2028 \u2029\u003c/html\u003e"}`))
- HTMLEscape(&b, []byte(m))
- if !bytes.Equal(b.Bytes(), want.Bytes()) {
- t.Errorf("HTMLEscape(&b, []byte(m)) = %s; want %s", b.Bytes(), want.Bytes())
- }
-}
-
-// golang.org/issue/8582
-func TestEncodePointerString(t *testing.T) {
- type stringPointer struct {
- N *int64 `json:"n,string"`
- }
- var n int64 = 42
- b, err := Marshal(stringPointer{N: &n})
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if got, want := string(b), `{"n":"42"}`; got != want {
- t.Errorf("Marshal = %s, want %s", got, want)
- }
- var back stringPointer
- err = Unmarshal(b, &back)
- if err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if back.N == nil {
- t.Fatalf("Unmarshalled nil N field")
- }
- if *back.N != 42 {
- t.Fatalf("*N = %d; want 42", *back.N)
- }
-}
-
-var encodeStringTests = []struct {
- in string
- out string
-}{
- {"\x00", `"\u0000"`},
- {"\x01", `"\u0001"`},
- {"\x02", `"\u0002"`},
- {"\x03", `"\u0003"`},
- {"\x04", `"\u0004"`},
- {"\x05", `"\u0005"`},
- {"\x06", `"\u0006"`},
- {"\x07", `"\u0007"`},
- {"\x08", `"\u0008"`},
- {"\x09", `"\t"`},
- {"\x0a", `"\n"`},
- {"\x0b", `"\u000b"`},
- {"\x0c", `"\u000c"`},
- {"\x0d", `"\r"`},
- {"\x0e", `"\u000e"`},
- {"\x0f", `"\u000f"`},
- {"\x10", `"\u0010"`},
- {"\x11", `"\u0011"`},
- {"\x12", `"\u0012"`},
- {"\x13", `"\u0013"`},
- {"\x14", `"\u0014"`},
- {"\x15", `"\u0015"`},
- {"\x16", `"\u0016"`},
- {"\x17", `"\u0017"`},
- {"\x18", `"\u0018"`},
- {"\x19", `"\u0019"`},
- {"\x1a", `"\u001a"`},
- {"\x1b", `"\u001b"`},
- {"\x1c", `"\u001c"`},
- {"\x1d", `"\u001d"`},
- {"\x1e", `"\u001e"`},
- {"\x1f", `"\u001f"`},
-}
-
-func TestEncodeString(t *testing.T) {
- for _, tt := range encodeStringTests {
- b, err := Marshal(tt.in)
- if err != nil {
- t.Errorf("Marshal(%q): %v", tt.in, err)
- continue
- }
- out := string(b)
- if out != tt.out {
- t.Errorf("Marshal(%q) = %#q, want %#q", tt.in, out, tt.out)
- }
- }
-}
-
-type jsonbyte byte
-
-func (b jsonbyte) MarshalJSON() ([]byte, error) { return tenc(`{"JB":%d}`, b) }
-
-type textbyte byte
-
-func (b textbyte) MarshalText() ([]byte, error) { return tenc(`TB:%d`, b) }
-
-type jsonint int
-
-func (i jsonint) MarshalJSON() ([]byte, error) { return tenc(`{"JI":%d}`, i) }
-
-type textint int
-
-func (i textint) MarshalText() ([]byte, error) { return tenc(`TI:%d`, i) }
-
-func tenc(format string, a ...interface{}) ([]byte, error) {
- var buf bytes.Buffer
- fmt.Fprintf(&buf, format, a...)
- return buf.Bytes(), nil
-}
-
-// Issue 13783
-func TestEncodeBytekind(t *testing.T) {
- testdata := []struct {
- data interface{}
- want string
- }{
- {byte(7), "7"},
- {jsonbyte(7), `{"JB":7}`},
- {textbyte(4), `"TB:4"`},
- {jsonint(5), `{"JI":5}`},
- {textint(1), `"TI:1"`},
- {[]byte{0, 1}, `"AAE="`},
- {[]jsonbyte{0, 1}, `[{"JB":0},{"JB":1}]`},
- {[][]jsonbyte{{0, 1}, {3}}, `[[{"JB":0},{"JB":1}],[{"JB":3}]]`},
- {[]textbyte{2, 3}, `["TB:2","TB:3"]`},
- {[]jsonint{5, 4}, `[{"JI":5},{"JI":4}]`},
- {[]textint{9, 3}, `["TI:9","TI:3"]`},
- {[]int{9, 3}, `[9,3]`},
- }
- for _, d := range testdata {
- js, err := Marshal(d.data)
- if err != nil {
- t.Error(err)
- continue
- }
- got, want := string(js), d.want
- if got != want {
- t.Errorf("got %s, want %s", got, want)
- }
- }
-}
-
-func TestTextMarshalerMapKeysAreSorted(t *testing.T) {
- b, err := Marshal(map[unmarshalerText]int{
- {"x", "y"}: 1,
- {"y", "x"}: 2,
- {"a", "z"}: 3,
- {"z", "a"}: 4,
- })
- if err != nil {
- t.Fatalf("Failed to Marshal text.Marshaler: %v", err)
- }
- const want = `{"a:z":3,"x:y":1,"y:x":2,"z:a":4}`
- if string(b) != want {
- t.Errorf("Marshal map with text.Marshaler keys: got %#q, want %#q", b, want)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/example_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/example_test.go
deleted file mode 100644
index 326bdc9540e..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/example_test.go
+++ /dev/null
@@ -1,252 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json_test
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "log"
- "os"
- "strings"
-)
-
-func ExampleMarshal() {
- type ColorGroup struct {
- ID int
- Name string
- Colors []string
- }
- group := ColorGroup{
- ID: 1,
- Name: "Reds",
- Colors: []string{"Crimson", "Red", "Ruby", "Maroon"},
- }
- b, err := json.Marshal(group)
- if err != nil {
- fmt.Println("error:", err)
- }
- os.Stdout.Write(b)
- // Output:
- // {"ID":1,"Name":"Reds","Colors":["Crimson","Red","Ruby","Maroon"]}
-}
-
-func ExampleUnmarshal() {
- var jsonBlob = []byte(`[
- {"Name": "Platypus", "Order": "Monotremata"},
- {"Name": "Quoll", "Order": "Dasyuromorphia"}
- ]`)
- type Animal struct {
- Name string
- Order string
- }
- var animals []Animal
- err := json.Unmarshal(jsonBlob, &animals)
- if err != nil {
- fmt.Println("error:", err)
- }
- fmt.Printf("%+v", animals)
- // Output:
- // [{Name:Platypus Order:Monotremata} {Name:Quoll Order:Dasyuromorphia}]
-}
-
-// This example uses a Decoder to decode a stream of distinct JSON values.
-func ExampleDecoder() {
- const jsonStream = `
- {"Name": "Ed", "Text": "Knock knock."}
- {"Name": "Sam", "Text": "Who's there?"}
- {"Name": "Ed", "Text": "Go fmt."}
- {"Name": "Sam", "Text": "Go fmt who?"}
- {"Name": "Ed", "Text": "Go fmt yourself!"}
- `
- type Message struct {
- Name, Text string
- }
- dec := json.NewDecoder(strings.NewReader(jsonStream))
- for {
- var m Message
- if err := dec.Decode(&m); err == io.EOF {
- break
- } else if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%s: %s\n", m.Name, m.Text)
- }
- // Output:
- // Ed: Knock knock.
- // Sam: Who's there?
- // Ed: Go fmt.
- // Sam: Go fmt who?
- // Ed: Go fmt yourself!
-}
-
-// This example uses a Decoder to decode a stream of distinct JSON values.
-func ExampleDecoder_Token() {
- const jsonStream = `
- {"Message": "Hello", "Array": [1, 2, 3], "Null": null, "Number": 1.234}
- `
- dec := json.NewDecoder(strings.NewReader(jsonStream))
- for {
- t, err := dec.Token()
- if err == io.EOF {
- break
- }
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%T: %v", t, t)
- if dec.More() {
- fmt.Printf(" (more)")
- }
- fmt.Printf("\n")
- }
- // Output:
- // json.Delim: { (more)
- // string: Message (more)
- // string: Hello (more)
- // string: Array (more)
- // json.Delim: [ (more)
- // float64: 1 (more)
- // float64: 2 (more)
- // float64: 3
- // json.Delim: ] (more)
- // string: Null (more)
- // <nil>: <nil> (more)
- // string: Number (more)
- // float64: 1.234
- // json.Delim: }
-}
-
-// This example uses a Decoder to decode a streaming array of JSON objects.
-func ExampleDecoder_Decode_stream() {
- const jsonStream = `
- [
- {"Name": "Ed", "Text": "Knock knock."},
- {"Name": "Sam", "Text": "Who's there?"},
- {"Name": "Ed", "Text": "Go fmt."},
- {"Name": "Sam", "Text": "Go fmt who?"},
- {"Name": "Ed", "Text": "Go fmt yourself!"}
- ]
- `
- type Message struct {
- Name, Text string
- }
- dec := json.NewDecoder(strings.NewReader(jsonStream))
-
- // read open bracket
- t, err := dec.Token()
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%T: %v\n", t, t)
-
- var m Message
- // while the array contains values
- for dec.More() {
-
- // decode an array value (Message)
- err := dec.Decode(&m)
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Printf("%v: %v\n", m.Name, m.Text)
- }
-
- // read closing bracket
- t, err = dec.Token()
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%T: %v\n", t, t)
-
- // Output:
- // json.Delim: [
- // Ed: Knock knock.
- // Sam: Who's there?
- // Ed: Go fmt.
- // Sam: Go fmt who?
- // Ed: Go fmt yourself!
- // json.Delim: ]
-
-}
-
-// This example uses RawMessage to delay parsing part of a JSON message.
-func ExampleRawMessage() {
- type Color struct {
- Space string
- Point json.RawMessage // delay parsing until we know the color space
- }
- type RGB struct {
- R uint8
- G uint8
- B uint8
- }
- type YCbCr struct {
- Y uint8
- Cb int8
- Cr int8
- }
-
- var j = []byte(`[
- {"Space": "YCbCr", "Point": {"Y": 255, "Cb": 0, "Cr": -10}},
- {"Space": "RGB", "Point": {"R": 98, "G": 218, "B": 255}}
- ]`)
- var colors []Color
- err := json.Unmarshal(j, &colors)
- if err != nil {
- log.Fatalln("error:", err)
- }
-
- for _, c := range colors {
- var dst interface{}
- switch c.Space {
- case "RGB":
- dst = new(RGB)
- case "YCbCr":
- dst = new(YCbCr)
- }
- err := json.Unmarshal(c.Point, dst)
- if err != nil {
- log.Fatalln("error:", err)
- }
- fmt.Println(c.Space, dst)
- }
- // Output:
- // YCbCr &{255 0 -10}
- // RGB &{98 218 255}
-}
-
-func ExampleIndent() {
- type Road struct {
- Name string
- Number int
- }
- roads := []Road{
- {"Diamond Fork", 29},
- {"Sheep Creek", 51},
- }
-
- b, err := json.Marshal(roads)
- if err != nil {
- log.Fatal(err)
- }
-
- var out bytes.Buffer
- json.Indent(&out, b, "=", "\t")
- out.WriteTo(os.Stdout)
- // Output:
- // [
- // = {
- // = "Name": "Diamond Fork",
- // = "Number": 29
- // = },
- // = {
- // = "Name": "Sheep Creek",
- // = "Number": 51
- // = }
- // =]
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/extension_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/extension_test.go
deleted file mode 100644
index c5db5cf559f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/extension_test.go
+++ /dev/null
@@ -1,221 +0,0 @@
-package json
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strconv"
- "testing"
-)
-
-type funcN struct {
- Arg1 int `json:"arg1"`
- Arg2 int `json:"arg2"`
-}
-
-type funcs struct {
- Func2 *funcN `json:"$func2"`
- Func1 *funcN `json:"$func1"`
-}
-
-type funcsText struct {
- Func1 jsonText `json:"$func1"`
- Func2 jsonText `json:"$func2"`
-}
-
-type jsonText struct {
- json string
-}
-
-func (jt *jsonText) UnmarshalJSON(data []byte) error {
- jt.json = string(data)
- return nil
-}
-
-type nestedText struct {
- F jsonText
- B bool
-}
-
-type unquotedKey struct {
- S string `json:"$k_1"`
-}
-
-var ext Extension
-
-type keyed string
-
-func decodeKeyed(data []byte) (interface{}, error) {
- return keyed(data), nil
-}
-
-type keyedType struct {
- K keyed
- I int
-}
-
-type docint int
-
-type const1Type struct{}
-
-var const1 = new(const1Type)
-
-func init() {
- ext.DecodeFunc("Func1", "$func1")
- ext.DecodeFunc("Func2", "$func2", "arg1", "arg2")
- ext.DecodeFunc("Func3", "$func3", "arg1")
- ext.DecodeFunc("new Func4", "$func4", "arg1")
-
- ext.DecodeConst("Const1", const1)
-
- ext.DecodeKeyed("$key1", decodeKeyed)
- ext.DecodeKeyed("$func3", decodeKeyed)
-
- ext.EncodeType(docint(0), func(v interface{}) ([]byte, error) {
- s := `{"$docint": ` + strconv.Itoa(int(v.(docint))) + `}`
- return []byte(s), nil
- })
-
- ext.DecodeUnquotedKeys(true)
- ext.DecodeTrailingCommas(true)
-}
-
-type extDecodeTest struct {
- in string
- ptr interface{}
- out interface{}
- err error
-
- noext bool
-}
-
-var extDecodeTests = []extDecodeTest{
- // Functions
- {in: `Func1()`, ptr: new(interface{}), out: map[string]interface{}{
- "$func1": map[string]interface{}{},
- }},
- {in: `{"v": Func1()}`, ptr: new(interface{}), out: map[string]interface{}{
- "v": map[string]interface{}{"$func1": map[string]interface{}{}},
- }},
- {in: `Func2(1)`, ptr: new(interface{}), out: map[string]interface{}{
- "$func2": map[string]interface{}{"arg1": float64(1)},
- }},
- {in: `Func2(1, 2)`, ptr: new(interface{}), out: map[string]interface{}{
- "$func2": map[string]interface{}{"arg1": float64(1), "arg2": float64(2)},
- }},
- {in: `Func2(Func1())`, ptr: new(interface{}), out: map[string]interface{}{
- "$func2": map[string]interface{}{"arg1": map[string]interface{}{"$func1": map[string]interface{}{}}},
- }},
- {in: `Func2(1, 2, 3)`, ptr: new(interface{}), err: fmt.Errorf("json: too many arguments for function Func2")},
- {in: `BadFunc()`, ptr: new(interface{}), err: fmt.Errorf(`json: unknown function "BadFunc"`)},
-
- {in: `Func1()`, ptr: new(funcs), out: funcs{Func1: &funcN{}}},
- {in: `Func2(1)`, ptr: new(funcs), out: funcs{Func2: &funcN{Arg1: 1}}},
- {in: `Func2(1, 2)`, ptr: new(funcs), out: funcs{Func2: &funcN{Arg1: 1, Arg2: 2}}},
-
- {in: `Func2(1, 2, 3)`, ptr: new(funcs), err: fmt.Errorf("json: too many arguments for function Func2")},
- {in: `BadFunc()`, ptr: new(funcs), err: fmt.Errorf(`json: unknown function "BadFunc"`)},
-
- {in: `Func2(1)`, ptr: new(jsonText), out: jsonText{"Func2(1)"}},
- {in: `Func2(1, 2)`, ptr: new(funcsText), out: funcsText{Func2: jsonText{"Func2(1, 2)"}}},
- {in: `{"f": Func2(1, 2), "b": true}`, ptr: new(nestedText), out: nestedText{jsonText{"Func2(1, 2)"}, true}},
-
- {in: `Func1()`, ptr: new(struct{}), out: struct{}{}},
-
- // Functions with "new" prefix
- {in: `new Func4(1)`, ptr: new(interface{}), out: map[string]interface{}{
- "$func4": map[string]interface{}{"arg1": float64(1)},
- }},
-
- // Constants
- {in: `Const1`, ptr: new(interface{}), out: const1},
- {in: `{"c": Const1}`, ptr: new(struct{ C *const1Type }), out: struct{ C *const1Type }{const1}},
-
- // Space after quoted key
- {in: `{"c" : Const1}`, ptr: new(struct{ C *const1Type }), out: struct{ C *const1Type }{const1}},
-
- // Keyed documents
- {in: `{"v": {"$key1": 1}}`, ptr: new(interface{}), out: map[string]interface{}{"v": keyed(`{"$key1": 1}`)}},
- {in: `{"k": {"$key1": 1}}`, ptr: new(keyedType), out: keyedType{K: keyed(`{"$key1": 1}`)}},
- {in: `{"i": {"$key1": 1}}`, ptr: new(keyedType), err: &UnmarshalTypeError{"object", reflect.TypeOf(0), 18}},
-
- // Keyed function documents
- {in: `{"v": Func3()}`, ptr: new(interface{}), out: map[string]interface{}{"v": keyed(`Func3()`)}},
- {in: `{"k": Func3()}`, ptr: new(keyedType), out: keyedType{K: keyed(`Func3()`)}},
- {in: `{"i": Func3()}`, ptr: new(keyedType), err: &UnmarshalTypeError{"object", reflect.TypeOf(0), 13}},
-
- // Unquoted keys
- {in: `{$k_1: "bar"}`, ptr: new(interface{}), out: map[string]interface{}{"$k_1": "bar"}},
- {in: `{$k_1: "bar"}`, ptr: new(unquotedKey), out: unquotedKey{"bar"}},
-
- {in: `{$k_1: "bar"}`, noext: true, ptr: new(interface{}),
- err: &SyntaxError{"invalid character '$' looking for beginning of object key string", 2}},
- {in: `{$k_1: "bar"}`, noext: true, ptr: new(unquotedKey),
- err: &SyntaxError{"invalid character '$' looking for beginning of object key string", 2}},
-
- // Trailing commas
- {in: `{"k": "v",}`, ptr: new(interface{}), out: map[string]interface{}{"k": "v"}},
- {in: `{"k": "v",}`, ptr: new(struct{}), out: struct{}{}},
- {in: `["v",]`, ptr: new(interface{}), out: []interface{}{"v"}},
-
- {in: `{"k": "v",}`, noext: true, ptr: new(interface{}),
- err: &SyntaxError{"invalid character '}' looking for beginning of object key string", 11}},
- {in: `{"k": "v",}`, noext: true, ptr: new(struct{}),
- err: &SyntaxError{"invalid character '}' looking for beginning of object key string", 11}},
- {in: `["a",]`, noext: true, ptr: new(interface{}),
- err: &SyntaxError{"invalid character ']' looking for beginning of value", 6}},
-}
-
-type extEncodeTest struct {
- in interface{}
- out string
- err error
-}
-
-var extEncodeTests = []extEncodeTest{
- {in: docint(13), out: "{\"$docint\":13}\n"},
-}
-
-func TestExtensionDecode(t *testing.T) {
- for i, tt := range extDecodeTests {
- in := []byte(tt.in)
-
- // v = new(right-type)
- v := reflect.New(reflect.TypeOf(tt.ptr).Elem())
- dec := NewDecoder(bytes.NewReader(in))
- if !tt.noext {
- dec.Extend(&ext)
- }
- if err := dec.Decode(v.Interface()); !reflect.DeepEqual(err, tt.err) {
- t.Errorf("#%d: %v, want %v", i, err, tt.err)
- continue
- } else if err != nil {
- continue
- }
- if !reflect.DeepEqual(v.Elem().Interface(), tt.out) {
- t.Errorf("#%d: mismatch\nhave: %#+v\nwant: %#+v", i, v.Elem().Interface(), tt.out)
- data, _ := Marshal(v.Elem().Interface())
- t.Logf("%s", string(data))
- data, _ = Marshal(tt.out)
- t.Logf("%s", string(data))
- continue
- }
- }
-}
-
-func TestExtensionEncode(t *testing.T) {
- var buf bytes.Buffer
- for i, tt := range extEncodeTests {
- buf.Truncate(0)
- enc := NewEncoder(&buf)
- enc.Extend(&ext)
- err := enc.Encode(tt.in)
- if !reflect.DeepEqual(err, tt.err) {
- t.Errorf("#%d: %v, want %v", i, err, tt.err)
- continue
- }
- if buf.String() != tt.out {
- t.Errorf("#%d: mismatch\nhave: %q\nwant: %q", i, buf.String(), tt.out)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/fold_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/fold_test.go
deleted file mode 100644
index 9fb94646a85..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/fold_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "bytes"
- "strings"
- "testing"
- "unicode/utf8"
-)
-
-var foldTests = []struct {
- fn func(s, t []byte) bool
- s, t string
- want bool
-}{
- {equalFoldRight, "", "", true},
- {equalFoldRight, "a", "a", true},
- {equalFoldRight, "", "a", false},
- {equalFoldRight, "a", "", false},
- {equalFoldRight, "a", "A", true},
- {equalFoldRight, "AB", "ab", true},
- {equalFoldRight, "AB", "ac", false},
- {equalFoldRight, "sbkKc", "ſbKKc", true},
- {equalFoldRight, "SbKkc", "ſbKKc", true},
- {equalFoldRight, "SbKkc", "ſbKK", false},
- {equalFoldRight, "e", "é", false},
- {equalFoldRight, "s", "S", true},
-
- {simpleLetterEqualFold, "", "", true},
- {simpleLetterEqualFold, "abc", "abc", true},
- {simpleLetterEqualFold, "abc", "ABC", true},
- {simpleLetterEqualFold, "abc", "ABCD", false},
- {simpleLetterEqualFold, "abc", "xxx", false},
-
- {asciiEqualFold, "a_B", "A_b", true},
- {asciiEqualFold, "aa@", "aa`", false}, // verify 0x40 and 0x60 aren't case-equivalent
-}
-
-func TestFold(t *testing.T) {
- for i, tt := range foldTests {
- if got := tt.fn([]byte(tt.s), []byte(tt.t)); got != tt.want {
- t.Errorf("%d. %q, %q = %v; want %v", i, tt.s, tt.t, got, tt.want)
- }
- truth := strings.EqualFold(tt.s, tt.t)
- if truth != tt.want {
- t.Errorf("strings.EqualFold doesn't agree with case %d", i)
- }
- }
-}
-
-func TestFoldAgainstUnicode(t *testing.T) {
- const bufSize = 5
- buf1 := make([]byte, 0, bufSize)
- buf2 := make([]byte, 0, bufSize)
- var runes []rune
- for i := 0x20; i <= 0x7f; i++ {
- runes = append(runes, rune(i))
- }
- runes = append(runes, kelvin, smallLongEss)
-
- funcs := []struct {
- name string
- fold func(s, t []byte) bool
- letter bool // must be ASCII letter
- simple bool // must be simple ASCII letter (not 'S' or 'K')
- }{
- {
- name: "equalFoldRight",
- fold: equalFoldRight,
- },
- {
- name: "asciiEqualFold",
- fold: asciiEqualFold,
- simple: true,
- },
- {
- name: "simpleLetterEqualFold",
- fold: simpleLetterEqualFold,
- simple: true,
- letter: true,
- },
- }
-
- for _, ff := range funcs {
- for _, r := range runes {
- if r >= utf8.RuneSelf {
- continue
- }
- if ff.letter && !isASCIILetter(byte(r)) {
- continue
- }
- if ff.simple && (r == 's' || r == 'S' || r == 'k' || r == 'K') {
- continue
- }
- for _, r2 := range runes {
- buf1 := append(buf1[:0], 'x')
- buf2 := append(buf2[:0], 'x')
- buf1 = buf1[:1+utf8.EncodeRune(buf1[1:bufSize], r)]
- buf2 = buf2[:1+utf8.EncodeRune(buf2[1:bufSize], r2)]
- buf1 = append(buf1, 'x')
- buf2 = append(buf2, 'x')
- want := bytes.EqualFold(buf1, buf2)
- if got := ff.fold(buf1, buf2); got != want {
- t.Errorf("%s(%q, %q) = %v; want %v", ff.name, buf1, buf2, got, want)
- }
- }
- }
- }
-}
-
-func isASCIILetter(b byte) bool {
- return ('A' <= b && b <= 'Z') || ('a' <= b && b <= 'z')
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/number_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/number_test.go
deleted file mode 100644
index 4b869996388..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/number_test.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "regexp"
- "testing"
-)
-
-func TestNumberIsValid(t *testing.T) {
- // From: http://stackoverflow.com/a/13340826
- var jsonNumberRegexp = regexp.MustCompile(`^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$`)
-
- validTests := []string{
- "0",
- "-0",
- "1",
- "-1",
- "0.1",
- "-0.1",
- "1234",
- "-1234",
- "12.34",
- "-12.34",
- "12E0",
- "12E1",
- "12e34",
- "12E-0",
- "12e+1",
- "12e-34",
- "-12E0",
- "-12E1",
- "-12e34",
- "-12E-0",
- "-12e+1",
- "-12e-34",
- "1.2E0",
- "1.2E1",
- "1.2e34",
- "1.2E-0",
- "1.2e+1",
- "1.2e-34",
- "-1.2E0",
- "-1.2E1",
- "-1.2e34",
- "-1.2E-0",
- "-1.2e+1",
- "-1.2e-34",
- "0E0",
- "0E1",
- "0e34",
- "0E-0",
- "0e+1",
- "0e-34",
- "-0E0",
- "-0E1",
- "-0e34",
- "-0E-0",
- "-0e+1",
- "-0e-34",
- }
-
- for _, test := range validTests {
- if !isValidNumber(test) {
- t.Errorf("%s should be valid", test)
- }
-
- var f float64
- if err := Unmarshal([]byte(test), &f); err != nil {
- t.Errorf("%s should be valid but Unmarshal failed: %v", test, err)
- }
-
- if !jsonNumberRegexp.MatchString(test) {
- t.Errorf("%s should be valid but regexp does not match", test)
- }
- }
-
- invalidTests := []string{
- "",
- "invalid",
- "1.0.1",
- "1..1",
- "-1-2",
- "012a42",
- "01.2",
- "012",
- "12E12.12",
- "1e2e3",
- "1e+-2",
- "1e--23",
- "1e",
- "e1",
- "1e+",
- "1ea",
- "1a",
- "1.a",
- "1.",
- "01",
- "1.e1",
- }
-
- for _, test := range invalidTests {
- if isValidNumber(test) {
- t.Errorf("%s should be invalid", test)
- }
-
- var f float64
- if err := Unmarshal([]byte(test), &f); err == nil {
- t.Errorf("%s should be invalid but unmarshal wrote %v", test, f)
- }
-
- if jsonNumberRegexp.MatchString(test) {
- t.Errorf("%s should be invalid but matches regexp", test)
- }
- }
-}
-
-func BenchmarkNumberIsValid(b *testing.B) {
- s := "-61657.61667E+61673"
- for i := 0; i < b.N; i++ {
- isValidNumber(s)
- }
-}
-
-func BenchmarkNumberIsValidRegexp(b *testing.B) {
- var jsonNumberRegexp = regexp.MustCompile(`^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$`)
- s := "-61657.61667E+61673"
- for i := 0; i < b.N; i++ {
- jsonNumberRegexp.MatchString(s)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/scanner_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/scanner_test.go
deleted file mode 100644
index 70a28974f78..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/scanner_test.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "bytes"
- "math"
- "math/rand"
- "reflect"
- "testing"
-)
-
-// Tests of simple examples.
-
-type example struct {
- compact string
- indent string
-}
-
-var examples = []example{
- {`1`, `1`},
- {`{}`, `{}`},
- {`[]`, `[]`},
- {`{"":2}`, "{\n\t\"\": 2\n}"},
- {`[3]`, "[\n\t3\n]"},
- {`[1,2,3]`, "[\n\t1,\n\t2,\n\t3\n]"},
- {`{"x":1}`, "{\n\t\"x\": 1\n}"},
- {ex1, ex1i},
-}
-
-var ex1 = `[true,false,null,"x",1,1.5,0,-5e+2]`
-
-var ex1i = `[
- true,
- false,
- null,
- "x",
- 1,
- 1.5,
- 0,
- -5e+2
-]`
-
-func TestCompact(t *testing.T) {
- var buf bytes.Buffer
- for _, tt := range examples {
- buf.Reset()
- if err := Compact(&buf, []byte(tt.compact)); err != nil {
- t.Errorf("Compact(%#q): %v", tt.compact, err)
- } else if s := buf.String(); s != tt.compact {
- t.Errorf("Compact(%#q) = %#q, want original", tt.compact, s)
- }
-
- buf.Reset()
- if err := Compact(&buf, []byte(tt.indent)); err != nil {
- t.Errorf("Compact(%#q): %v", tt.indent, err)
- continue
- } else if s := buf.String(); s != tt.compact {
- t.Errorf("Compact(%#q) = %#q, want %#q", tt.indent, s, tt.compact)
- }
- }
-}
-
-func TestCompactSeparators(t *testing.T) {
- // U+2028 and U+2029 should be escaped inside strings.
- // They should not appear outside strings.
- tests := []struct {
- in, compact string
- }{
- {"{\"\u2028\": 1}", `{"\u2028":1}`},
- {"{\"\u2029\" :2}", `{"\u2029":2}`},
- }
- for _, tt := range tests {
- var buf bytes.Buffer
- if err := Compact(&buf, []byte(tt.in)); err != nil {
- t.Errorf("Compact(%q): %v", tt.in, err)
- } else if s := buf.String(); s != tt.compact {
- t.Errorf("Compact(%q) = %q, want %q", tt.in, s, tt.compact)
- }
- }
-}
-
-func TestIndent(t *testing.T) {
- var buf bytes.Buffer
- for _, tt := range examples {
- buf.Reset()
- if err := Indent(&buf, []byte(tt.indent), "", "\t"); err != nil {
- t.Errorf("Indent(%#q): %v", tt.indent, err)
- } else if s := buf.String(); s != tt.indent {
- t.Errorf("Indent(%#q) = %#q, want original", tt.indent, s)
- }
-
- buf.Reset()
- if err := Indent(&buf, []byte(tt.compact), "", "\t"); err != nil {
- t.Errorf("Indent(%#q): %v", tt.compact, err)
- continue
- } else if s := buf.String(); s != tt.indent {
- t.Errorf("Indent(%#q) = %#q, want %#q", tt.compact, s, tt.indent)
- }
- }
-}
-
-// Tests of a large random structure.
-
-func TestCompactBig(t *testing.T) {
- initBig()
- var buf bytes.Buffer
- if err := Compact(&buf, jsonBig); err != nil {
- t.Fatalf("Compact: %v", err)
- }
- b := buf.Bytes()
- if !bytes.Equal(b, jsonBig) {
- t.Error("Compact(jsonBig) != jsonBig")
- diff(t, b, jsonBig)
- return
- }
-}
-
-func TestIndentBig(t *testing.T) {
- initBig()
- var buf bytes.Buffer
- if err := Indent(&buf, jsonBig, "", "\t"); err != nil {
- t.Fatalf("Indent1: %v", err)
- }
- b := buf.Bytes()
- if len(b) == len(jsonBig) {
- // jsonBig is compact (no unnecessary spaces);
- // indenting should make it bigger
- t.Fatalf("Indent(jsonBig) did not get bigger")
- }
-
- // should be idempotent
- var buf1 bytes.Buffer
- if err := Indent(&buf1, b, "", "\t"); err != nil {
- t.Fatalf("Indent2: %v", err)
- }
- b1 := buf1.Bytes()
- if !bytes.Equal(b1, b) {
- t.Error("Indent(Indent(jsonBig)) != Indent(jsonBig)")
- diff(t, b1, b)
- return
- }
-
- // should get back to original
- buf1.Reset()
- if err := Compact(&buf1, b); err != nil {
- t.Fatalf("Compact: %v", err)
- }
- b1 = buf1.Bytes()
- if !bytes.Equal(b1, jsonBig) {
- t.Error("Compact(Indent(jsonBig)) != jsonBig")
- diff(t, b1, jsonBig)
- return
- }
-}
-
-type indentErrorTest struct {
- in string
- err error
-}
-
-var indentErrorTests = []indentErrorTest{
- {`{"X": "foo", "Y"}`, &SyntaxError{"invalid character '}' after object key", 17}},
- {`{"X": "foo" "Y": "bar"}`, &SyntaxError{"invalid character '\"' after object key:value pair", 13}},
-}
-
-func TestIndentErrors(t *testing.T) {
- for i, tt := range indentErrorTests {
- slice := make([]uint8, 0)
- buf := bytes.NewBuffer(slice)
- if err := Indent(buf, []uint8(tt.in), "", ""); err != nil {
- if !reflect.DeepEqual(err, tt.err) {
- t.Errorf("#%d: Indent: %#v", i, err)
- continue
- }
- }
- }
-}
-
-func TestNextValueBig(t *testing.T) {
- initBig()
- var scan scanner
- item, rest, err := nextValue(jsonBig, &scan)
- if err != nil {
- t.Fatalf("nextValue: %s", err)
- }
- if len(item) != len(jsonBig) || &item[0] != &jsonBig[0] {
- t.Errorf("invalid item: %d %d", len(item), len(jsonBig))
- }
- if len(rest) != 0 {
- t.Errorf("invalid rest: %d", len(rest))
- }
-
- item, rest, err = nextValue(append(jsonBig, "HELLO WORLD"...), &scan)
- if err != nil {
- t.Fatalf("nextValue extra: %s", err)
- }
- if len(item) != len(jsonBig) {
- t.Errorf("invalid item: %d %d", len(item), len(jsonBig))
- }
- if string(rest) != "HELLO WORLD" {
- t.Errorf("invalid rest: %d", len(rest))
- }
-}
-
-var benchScan scanner
-
-func BenchmarkSkipValue(b *testing.B) {
- initBig()
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- nextValue(jsonBig, &benchScan)
- }
- b.SetBytes(int64(len(jsonBig)))
-}
-
-func diff(t *testing.T, a, b []byte) {
- for i := 0; ; i++ {
- if i >= len(a) || i >= len(b) || a[i] != b[i] {
- j := i - 10
- if j < 0 {
- j = 0
- }
- t.Errorf("diverge at %d: «%s» vs «%s»", i, trim(a[j:]), trim(b[j:]))
- return
- }
- }
-}
-
-func trim(b []byte) []byte {
- if len(b) > 20 {
- return b[0:20]
- }
- return b
-}
-
-// Generate a random JSON object.
-
-var jsonBig []byte
-
-func initBig() {
- n := 10000
- if testing.Short() {
- n = 100
- }
- b, err := Marshal(genValue(n))
- if err != nil {
- panic(err)
- }
- jsonBig = b
-}
-
-func genValue(n int) interface{} {
- if n > 1 {
- switch rand.Intn(2) {
- case 0:
- return genArray(n)
- case 1:
- return genMap(n)
- }
- }
- switch rand.Intn(3) {
- case 0:
- return rand.Intn(2) == 0
- case 1:
- return rand.NormFloat64()
- case 2:
- return genString(30)
- }
- panic("unreachable")
-}
-
-func genString(stddev float64) string {
- n := int(math.Abs(rand.NormFloat64()*stddev + stddev/2))
- c := make([]rune, n)
- for i := range c {
- f := math.Abs(rand.NormFloat64()*64 + 32)
- if f > 0x10ffff {
- f = 0x10ffff
- }
- c[i] = rune(f)
- }
- return string(c)
-}
-
-func genArray(n int) []interface{} {
- f := int(math.Abs(rand.NormFloat64()) * math.Min(10, float64(n/2)))
- if f > n {
- f = n
- }
- if f < 1 {
- f = 1
- }
- x := make([]interface{}, f)
- for i := range x {
- x[i] = genValue(((i+1)*n)/f - (i*n)/f)
- }
- return x
-}
-
-func genMap(n int) map[string]interface{} {
- f := int(math.Abs(rand.NormFloat64()) * math.Min(10, float64(n/2)))
- if f > n {
- f = n
- }
- if n > 0 && f == 0 {
- f = 1
- }
- x := make(map[string]interface{})
- for i := 0; i < f; i++ {
- x[genString(10)] = genValue(((i+1)*n)/f - (i*n)/f)
- }
- return x
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/stream_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/stream_test.go
deleted file mode 100644
index 4ebeaba961c..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/stream_test.go
+++ /dev/null
@@ -1,418 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "net/http/httptest"
- "reflect"
- "strings"
- "testing"
-)
-
-// Test values for the stream test.
-// One of each JSON kind.
-var streamTest = []interface{}{
- 0.1,
- "hello",
- nil,
- true,
- false,
- []interface{}{"a", "b", "c"},
- map[string]interface{}{"K": "Kelvin", "ß": "long s"},
- 3.14, // another value to make sure something can follow map
-}
-
-var streamEncoded = `0.1
-"hello"
-null
-true
-false
-["a","b","c"]
-{"ß":"long s","K":"Kelvin"}
-3.14
-`
-
-func TestEncoder(t *testing.T) {
- for i := 0; i <= len(streamTest); i++ {
- var buf bytes.Buffer
- enc := NewEncoder(&buf)
- for j, v := range streamTest[0:i] {
- if err := enc.Encode(v); err != nil {
- t.Fatalf("encode #%d: %v", j, err)
- }
- }
- if have, want := buf.String(), nlines(streamEncoded, i); have != want {
- t.Errorf("encoding %d items: mismatch", i)
- diff(t, []byte(have), []byte(want))
- break
- }
- }
-}
-
-var streamEncodedIndent = `0.1
-"hello"
-null
-true
-false
-[
->."a",
->."b",
->."c"
->]
-{
->."ß": "long s",
->."K": "Kelvin"
->}
-3.14
-`
-
-func TestEncoderIndent(t *testing.T) {
- var buf bytes.Buffer
- enc := NewEncoder(&buf)
- enc.Indent(">", ".")
- for _, v := range streamTest {
- enc.Encode(v)
- }
- if have, want := buf.String(), streamEncodedIndent; have != want {
- t.Error("indented encoding mismatch")
- diff(t, []byte(have), []byte(want))
- }
-}
-
-func TestEncoderDisableHTMLEscaping(t *testing.T) {
- var c C
- var ct CText
- for _, tt := range []struct {
- name string
- v interface{}
- wantEscape string
- want string
- }{
- {"c", c, `"\u003c\u0026\u003e"`, `"<&>"`},
- {"ct", ct, `"\"\u003c\u0026\u003e\""`, `"\"<&>\""`},
- {`"<&>"`, "<&>", `"\u003c\u0026\u003e"`, `"<&>"`},
- } {
- var buf bytes.Buffer
- enc := NewEncoder(&buf)
- if err := enc.Encode(tt.v); err != nil {
- t.Fatalf("Encode(%s): %s", tt.name, err)
- }
- if got := strings.TrimSpace(buf.String()); got != tt.wantEscape {
- t.Errorf("Encode(%s) = %#q, want %#q", tt.name, got, tt.wantEscape)
- }
- buf.Reset()
- enc.DisableHTMLEscaping()
- if err := enc.Encode(tt.v); err != nil {
- t.Fatalf("DisableHTMLEscaping Encode(%s): %s", tt.name, err)
- }
- if got := strings.TrimSpace(buf.String()); got != tt.want {
- t.Errorf("DisableHTMLEscaping Encode(%s) = %#q, want %#q",
- tt.name, got, tt.want)
- }
- }
-}
-
-func TestDecoder(t *testing.T) {
- for i := 0; i <= len(streamTest); i++ {
- // Use stream without newlines as input,
- // just to stress the decoder even more.
- // Our test input does not include back-to-back numbers.
- // Otherwise stripping the newlines would
- // merge two adjacent JSON values.
- var buf bytes.Buffer
- for _, c := range nlines(streamEncoded, i) {
- // That's stupid isn't it!? nulltrue!?!? :/
- //if c != '\n' {
- buf.WriteRune(c)
- //}
- }
- out := make([]interface{}, i)
- dec := NewDecoder(&buf)
- for j := range out {
- if err := dec.Decode(&out[j]); err != nil {
- t.Fatalf("decode #%d/%d: %v", j, i, err)
- }
- }
- if !reflect.DeepEqual(out, streamTest[0:i]) {
- t.Errorf("decoding %d items: mismatch", i)
- for j := range out {
- if !reflect.DeepEqual(out[j], streamTest[j]) {
- t.Errorf("#%d: have %v want %v", j, out[j], streamTest[j])
- }
- }
- break
- }
- }
-}
-
-func TestDecoderBuffered(t *testing.T) {
- r := strings.NewReader(`{"Name": "Gopher"} extra `)
- var m struct {
- Name string
- }
- d := NewDecoder(r)
- err := d.Decode(&m)
- if err != nil {
- t.Fatal(err)
- }
- if m.Name != "Gopher" {
- t.Errorf("Name = %q; want Gopher", m.Name)
- }
- rest, err := ioutil.ReadAll(d.Buffered())
- if err != nil {
- t.Fatal(err)
- }
- if g, w := string(rest), " extra "; g != w {
- t.Errorf("Remaining = %q; want %q", g, w)
- }
-}
-
-func nlines(s string, n int) string {
- if n <= 0 {
- return ""
- }
- for i, c := range s {
- if c == '\n' {
- if n--; n == 0 {
- return s[0 : i+1]
- }
- }
- }
- return s
-}
-
-func TestRawMessage(t *testing.T) {
- // TODO(rsc): Should not need the * in *RawMessage
- var data struct {
- X float64
- Id *RawMessage
- Y float32
- }
- const raw = `["\u0056",null]`
- const msg = `{"X":0.1,"Id":["\u0056",null],"Y":0.2}`
- err := Unmarshal([]byte(msg), &data)
- if err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if string([]byte(*data.Id)) != raw {
- t.Fatalf("Raw mismatch: have %#q want %#q", []byte(*data.Id), raw)
- }
- b, err := Marshal(&data)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if string(b) != msg {
- t.Fatalf("Marshal: have %#q want %#q", b, msg)
- }
-}
-
-func TestNullRawMessage(t *testing.T) {
- // TODO(rsc): Should not need the * in *RawMessage
- var data struct {
- X float64
- Id *RawMessage
- Y float32
- }
- data.Id = new(RawMessage)
- const msg = `{"X":0.1,"Id":null,"Y":0.2}`
- err := Unmarshal([]byte(msg), &data)
- if err != nil {
- t.Fatalf("Unmarshal: %v", err)
- }
- if data.Id != nil {
- t.Fatalf("Raw mismatch: have non-nil, want nil")
- }
- b, err := Marshal(&data)
- if err != nil {
- t.Fatalf("Marshal: %v", err)
- }
- if string(b) != msg {
- t.Fatalf("Marshal: have %#q want %#q", b, msg)
- }
-}
-
-var blockingTests = []string{
- `{"x": 1}`,
- `[1, 2, 3]`,
-}
-
-func TestBlocking(t *testing.T) {
- for _, enc := range blockingTests {
- r, w := net.Pipe()
- go w.Write([]byte(enc))
- var val interface{}
-
- // If Decode reads beyond what w.Write writes above,
- // it will block, and the test will deadlock.
- if err := NewDecoder(r).Decode(&val); err != nil {
- t.Errorf("decoding %s: %v", enc, err)
- }
- r.Close()
- w.Close()
- }
-}
-
-func BenchmarkEncoderEncode(b *testing.B) {
- b.ReportAllocs()
- type T struct {
- X, Y string
- }
- v := &T{"foo", "bar"}
- for i := 0; i < b.N; i++ {
- if err := NewEncoder(ioutil.Discard).Encode(v); err != nil {
- b.Fatal(err)
- }
- }
-}
-
-type tokenStreamCase struct {
- json string
- expTokens []interface{}
-}
-
-type decodeThis struct {
- v interface{}
-}
-
-var tokenStreamCases []tokenStreamCase = []tokenStreamCase{
- // streaming token cases
- {json: `10`, expTokens: []interface{}{float64(10)}},
- {json: ` [10] `, expTokens: []interface{}{
- Delim('['), float64(10), Delim(']')}},
- {json: ` [false,10,"b"] `, expTokens: []interface{}{
- Delim('['), false, float64(10), "b", Delim(']')}},
- {json: `{ "a": 1 }`, expTokens: []interface{}{
- Delim('{'), "a", float64(1), Delim('}')}},
- {json: `{"a": 1, "b":"3"}`, expTokens: []interface{}{
- Delim('{'), "a", float64(1), "b", "3", Delim('}')}},
- {json: ` [{"a": 1},{"a": 2}] `, expTokens: []interface{}{
- Delim('['),
- Delim('{'), "a", float64(1), Delim('}'),
- Delim('{'), "a", float64(2), Delim('}'),
- Delim(']')}},
- {json: `{"obj": {"a": 1}}`, expTokens: []interface{}{
- Delim('{'), "obj", Delim('{'), "a", float64(1), Delim('}'),
- Delim('}')}},
- {json: `{"obj": [{"a": 1}]}`, expTokens: []interface{}{
- Delim('{'), "obj", Delim('['),
- Delim('{'), "a", float64(1), Delim('}'),
- Delim(']'), Delim('}')}},
-
- // streaming tokens with intermittent Decode()
- {json: `{ "a": 1 }`, expTokens: []interface{}{
- Delim('{'), "a",
- decodeThis{float64(1)},
- Delim('}')}},
- {json: ` [ { "a" : 1 } ] `, expTokens: []interface{}{
- Delim('['),
- decodeThis{map[string]interface{}{"a": float64(1)}},
- Delim(']')}},
- {json: ` [{"a": 1},{"a": 2}] `, expTokens: []interface{}{
- Delim('['),
- decodeThis{map[string]interface{}{"a": float64(1)}},
- decodeThis{map[string]interface{}{"a": float64(2)}},
- Delim(']')}},
- {json: `{ "obj" : [ { "a" : 1 } ] }`, expTokens: []interface{}{
- Delim('{'), "obj", Delim('['),
- decodeThis{map[string]interface{}{"a": float64(1)}},
- Delim(']'), Delim('}')}},
-
- {json: `{"obj": {"a": 1}}`, expTokens: []interface{}{
- Delim('{'), "obj",
- decodeThis{map[string]interface{}{"a": float64(1)}},
- Delim('}')}},
- {json: `{"obj": [{"a": 1}]}`, expTokens: []interface{}{
- Delim('{'), "obj",
- decodeThis{[]interface{}{
- map[string]interface{}{"a": float64(1)},
- }},
- Delim('}')}},
- {json: ` [{"a": 1} {"a": 2}] `, expTokens: []interface{}{
- Delim('['),
- decodeThis{map[string]interface{}{"a": float64(1)}},
- decodeThis{&SyntaxError{"expected comma after array element", 0}},
- }},
- {json: `{ "a" 1 }`, expTokens: []interface{}{
- Delim('{'), "a",
- decodeThis{&SyntaxError{"expected colon after object key", 0}},
- }},
-}
-
-func TestDecodeInStream(t *testing.T) {
-
- for ci, tcase := range tokenStreamCases {
-
- dec := NewDecoder(strings.NewReader(tcase.json))
- for i, etk := range tcase.expTokens {
-
- var tk interface{}
- var err error
-
- if dt, ok := etk.(decodeThis); ok {
- etk = dt.v
- err = dec.Decode(&tk)
- } else {
- tk, err = dec.Token()
- }
- if experr, ok := etk.(error); ok {
- if err == nil || err.Error() != experr.Error() {
- t.Errorf("case %v: Expected error %v in %q, but was %v", ci, experr, tcase.json, err)
- }
- break
- } else if err == io.EOF {
- t.Errorf("case %v: Unexpected EOF in %q", ci, tcase.json)
- break
- } else if err != nil {
- t.Errorf("case %v: Unexpected error '%v' in %q", ci, err, tcase.json)
- break
- }
- if !reflect.DeepEqual(tk, etk) {
- t.Errorf(`case %v: %q @ %v expected %T(%v) was %T(%v)`, ci, tcase.json, i, etk, etk, tk, tk)
- break
- }
- }
- }
-
-}
-
-// Test from golang.org/issue/11893
-func TestHTTPDecoding(t *testing.T) {
- const raw = `{ "foo": "bar" }`
-
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte(raw))
- }))
- defer ts.Close()
- res, err := http.Get(ts.URL)
- if err != nil {
- log.Fatalf("GET failed: %v", err)
- }
- defer res.Body.Close()
-
- foo := struct {
- Foo string
- }{}
-
- d := NewDecoder(res.Body)
- err = d.Decode(&foo)
- if err != nil {
- t.Fatalf("Decode: %v", err)
- }
- if foo.Foo != "bar" {
- t.Errorf("decoded %q; want \"bar\"", foo.Foo)
- }
-
- // make sure we get the EOF the second time
- err = d.Decode(&foo)
- if err != io.EOF {
- t.Errorf("err = %v; want io.EOF", err)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tagkey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tagkey_test.go
deleted file mode 100644
index c1739ea97f7..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tagkey_test.go
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "testing"
-)
-
-type basicLatin2xTag struct {
- V string `json:"$%-/"`
-}
-
-type basicLatin3xTag struct {
- V string `json:"0123456789"`
-}
-
-type basicLatin4xTag struct {
- V string `json:"ABCDEFGHIJKLMO"`
-}
-
-type basicLatin5xTag struct {
- V string `json:"PQRSTUVWXYZ_"`
-}
-
-type basicLatin6xTag struct {
- V string `json:"abcdefghijklmno"`
-}
-
-type basicLatin7xTag struct {
- V string `json:"pqrstuvwxyz"`
-}
-
-type miscPlaneTag struct {
- V string `json:"色は匂へど"`
-}
-
-type percentSlashTag struct {
- V string `json:"text/html%"` // https://golang.org/issue/2718
-}
-
-type punctuationTag struct {
- V string `json:"!#$%&()*+-./:<=>?@[]^_{|}~"` // https://golang.org/issue/3546
-}
-
-type emptyTag struct {
- W string
-}
-
-type misnamedTag struct {
- X string `jsom:"Misnamed"`
-}
-
-type badFormatTag struct {
- Y string `:"BadFormat"`
-}
-
-type badCodeTag struct {
- Z string `json:" !\"#&'()*+,."`
-}
-
-type spaceTag struct {
- Q string `json:"With space"`
-}
-
-type unicodeTag struct {
- W string `json:"Ελλάδα"`
-}
-
-var structTagObjectKeyTests = []struct {
- raw interface{}
- value string
- key string
-}{
- {basicLatin2xTag{"2x"}, "2x", "$%-/"},
- {basicLatin3xTag{"3x"}, "3x", "0123456789"},
- {basicLatin4xTag{"4x"}, "4x", "ABCDEFGHIJKLMO"},
- {basicLatin5xTag{"5x"}, "5x", "PQRSTUVWXYZ_"},
- {basicLatin6xTag{"6x"}, "6x", "abcdefghijklmno"},
- {basicLatin7xTag{"7x"}, "7x", "pqrstuvwxyz"},
- {miscPlaneTag{"いろはにほへと"}, "いろはにほへと", "色は匂へど"},
- {emptyTag{"Pour Moi"}, "Pour Moi", "W"},
- {misnamedTag{"Animal Kingdom"}, "Animal Kingdom", "X"},
- {badFormatTag{"Orfevre"}, "Orfevre", "Y"},
- {badCodeTag{"Reliable Man"}, "Reliable Man", "Z"},
- {percentSlashTag{"brut"}, "brut", "text/html%"},
- {punctuationTag{"Union Rags"}, "Union Rags", "!#$%&()*+-./:<=>?@[]^_{|}~"},
- {spaceTag{"Perreddu"}, "Perreddu", "With space"},
- {unicodeTag{"Loukanikos"}, "Loukanikos", "Ελλάδα"},
-}
-
-func TestStructTagObjectKey(t *testing.T) {
- for _, tt := range structTagObjectKeyTests {
- b, err := Marshal(tt.raw)
- if err != nil {
- t.Fatalf("Marshal(%#q) failed: %v", tt.raw, err)
- }
- var f interface{}
- err = Unmarshal(b, &f)
- if err != nil {
- t.Fatalf("Unmarshal(%#q) failed: %v", b, err)
- }
- for i, v := range f.(map[string]interface{}) {
- switch i {
- case tt.key:
- if s, ok := v.(string); !ok || s != tt.value {
- t.Fatalf("Unexpected value: %#q, want %v", s, tt.value)
- }
- default:
- t.Fatalf("Unexpected key: %#q, from %#q", i, b)
- }
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tags_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tags_test.go
deleted file mode 100644
index 8ba8ddd5f80..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/json/tags_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package json
-
-import (
- "testing"
-)
-
-func TestTagParsing(t *testing.T) {
- name, opts := parseTag("field,foobar,foo")
- if name != "field" {
- t.Fatalf("name = %q, want field", name)
- }
- for _, tt := range []struct {
- opt string
- want bool
- }{
- {"foobar", true},
- {"foo", true},
- {"bar", false},
- } {
- if opts.Contains(tt.opt) != tt.want {
- t.Errorf("Contains(%q) = %v", tt.opt, !tt.want)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/scram/scram_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/scram/scram_test.go
deleted file mode 100644
index 9c20fdfc488..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/internal/scram/scram_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package scram_test
-
-import (
- "crypto/sha1"
- "testing"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2/internal/scram"
- "strings"
-)
-
-var _ = Suite(&S{})
-
-func Test(t *testing.T) { TestingT(t) }
-
-type S struct{}
-
-var tests = [][]string{{
- "U: user pencil",
- "N: fyko+d2lbbFgONRv9qkxdawL",
- "C: n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL",
- "S: r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,s=QSXCR+Q6sek8bf92,i=4096",
- "C: c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts=",
- "S: v=rmF9pqV8S7suAoZWja4dJRkFsKQ=",
-}, {
- "U: root fe8c89e308ec08763df36333cbf5d3a2",
- "N: OTcxNDk5NjM2MzE5",
- "C: n,,n=root,r=OTcxNDk5NjM2MzE5",
- "S: r=OTcxNDk5NjM2MzE581Ra3provgG0iDsMkDiIAlrh4532dDLp,s=XRDkVrFC9JuL7/F4tG0acQ==,i=10000",
- "C: c=biws,r=OTcxNDk5NjM2MzE581Ra3provgG0iDsMkDiIAlrh4532dDLp,p=6y1jp9R7ETyouTXS9fW9k5UHdBc=",
- "S: v=LBnd9dUJRxdqZiEq91NKP3z/bHA=",
-}}
-
-func (s *S) TestExamples(c *C) {
- for _, steps := range tests {
- if len(steps) < 2 || len(steps[0]) < 3 || !strings.HasPrefix(steps[0], "U: ") {
- c.Fatalf("Invalid test: %#v", steps)
- }
- auth := strings.Fields(steps[0][3:])
- client := scram.NewClient(sha1.New, auth[0], auth[1])
- first, done := true, false
- c.Logf("-----")
- c.Logf("%s", steps[0])
- for _, step := range steps[1:] {
- c.Logf("%s", step)
- switch step[:3] {
- case "N: ":
- client.SetNonce([]byte(step[3:]))
- case "C: ":
- if first {
- first = false
- done = client.Step(nil)
- }
- c.Assert(done, Equals, false)
- c.Assert(client.Err(), IsNil)
- c.Assert(string(client.Out()), Equals, step[3:])
- case "S: ":
- first = false
- done = client.Step([]byte(step[3:]))
- default:
- panic("invalid test line: " + step)
- }
- }
- c.Assert(done, Equals, true)
- c.Assert(client.Err(), IsNil)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/queue_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/queue_test.go
deleted file mode 100644
index bd0ab550f97..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/queue_test.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo
-
-import (
- . "gopkg.in/check.v1"
-)
-
-type QS struct{}
-
-var _ = Suite(&QS{})
-
-func (s *QS) TestSequentialGrowth(c *C) {
- q := queue{}
- n := 2048
- for i := 0; i != n; i++ {
- q.Push(i)
- }
- for i := 0; i != n; i++ {
- c.Assert(q.Pop(), Equals, i)
- }
-}
-
-var queueTestLists = [][]int{
- // {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
-
- // {8, 9, 10, 11, ... 2, 3, 4, 5, 6, 7}
- {0, 1, 2, 3, 4, 5, 6, 7, -1, -1, 8, 9, 10, 11},
-
- // {8, 9, 10, 11, ... 2, 3, 4, 5, 6, 7}
- {0, 1, 2, 3, -1, -1, 4, 5, 6, 7, 8, 9, 10, 11},
-
- // {0, 1, 2, 3, 4, 5, 6, 7, 8}
- {0, 1, 2, 3, 4, 5, 6, 7, 8,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 0, 1, 2, 3, 4, 5, 6, 7, 8},
-}
-
-func (s *QS) TestQueueTestLists(c *C) {
- test := []int{}
- testi := 0
- reset := func() {
- test = test[0:0]
- testi = 0
- }
- push := func(i int) {
- test = append(test, i)
- }
- pop := func() (i int) {
- if testi == len(test) {
- return -1
- }
- i = test[testi]
- testi++
- return
- }
-
- for _, list := range queueTestLists {
- reset()
- q := queue{}
- for _, n := range list {
- if n == -1 {
- c.Assert(q.Pop(), Equals, pop(), Commentf("With list %#v", list))
- } else {
- q.Push(n)
- push(n)
- }
- }
-
- for n := pop(); n != -1; n = pop() {
- c.Assert(q.Pop(), Equals, n, Commentf("With list %#v", list))
- }
-
- c.Assert(q.Pop(), Equals, nil, Commentf("With list %#v", list))
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session.go
index 3e234f8318c..88e38bdd65b 100644
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session.go
+++ b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session.go
@@ -3291,19 +3291,22 @@ func prepareFindOp(socket *mongoSocket, op *queryOp, limit int32) bool {
}
find := findCmd{
- Collection: op.collection[nameDot+1:],
- Filter: op.query,
- Projection: op.selector,
- Sort: op.options.OrderBy,
- Skip: op.skip,
- Limit: limit,
- MaxTimeMS: op.options.MaxTimeMS,
- MaxScan: op.options.MaxScan,
- Hint: op.options.Hint,
- Comment: op.options.Comment,
- Snapshot: op.options.Snapshot,
- OplogReplay: op.flags&flagLogReplay != 0,
- Collation: op.options.Collation,
+ Collection: op.collection[nameDot+1:],
+ Filter: op.query,
+ Projection: op.selector,
+ Sort: op.options.OrderBy,
+ Skip: op.skip,
+ Limit: limit,
+ MaxTimeMS: op.options.MaxTimeMS,
+ MaxScan: op.options.MaxScan,
+ Hint: op.options.Hint,
+ Comment: op.options.Comment,
+ Snapshot: op.options.Snapshot,
+ Tailable: op.flags&flagTailable != 0,
+ AwaitData: op.flags&flagAwaitData != 0,
+ OplogReplay: op.flags&flagLogReplay != 0,
+ NoCursorTimeout: op.flags&flagNoCursorTimeout != 0,
+ Collation: op.options.Collation,
}
if op.limit < 0 {
find.BatchSize = -op.limit
@@ -3827,19 +3830,20 @@ func (iter *Iter) Timeout() bool {
func (iter *Iter) Next(result interface{}) bool {
iter.m.Lock()
iter.timedout = false
- timeout := time.Time{}
+ deadline := time.Time{}
// check should we expect more data.
for iter.err == nil && iter.docData.Len() == 0 && (iter.docsToReceive > 0 || iter.op.cursorId != 0) {
- // we should expect more data.
+ // either there is a getMore running or we will schedule one, set
+ // the deadline regardless.
+ if iter.timeout >= 0 && deadline.IsZero() {
+ deadline = time.Now().Add(iter.timeout)
+ }
// If we have yet to receive data, increment the timer until we timeout.
if iter.docsToReceive == 0 {
- if iter.timeout >= 0 {
- if timeout.IsZero() {
- timeout = time.Now().Add(iter.timeout)
- }
- if time.Now().After(timeout) {
+ if !deadline.IsZero() {
+ if time.Now().After(deadline) {
iter.timedout = true
iter.m.Unlock()
return false
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session_test.go
deleted file mode 100644
index b95d00eb360..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/session_test.go
+++ /dev/null
@@ -1,4373 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo_test
-
-import (
- "flag"
- "fmt"
- "math"
- "os"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/bson"
-)
-
-func (s *S) TestRunString(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run("ping", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestRunValue(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run(M{"ping": 1}, &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestPing(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Just ensure the nonce has been received.
- result := struct{}{}
- err = session.Run("ping", &result)
-
- mgo.ResetStats()
-
- err = session.Ping()
- c.Assert(err, IsNil)
-
- // Pretty boring.
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 1)
- c.Assert(stats.ReceivedOps, Equals, 1)
-}
-
-func (s *S) TestDialIPAddress(c *C) {
- session, err := mgo.Dial("127.0.0.1:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- if os.Getenv("NOIPV6") != "1" {
- session, err = mgo.Dial("[::1%]:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- }
-}
-
-func (s *S) TestURLSingle(c *C) {
- session, err := mgo.Dial("mongodb://localhost:40001/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run("ping", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestURLMany(c *C) {
- session, err := mgo.Dial("mongodb://localhost:40011,localhost:40012/")
- c.Assert(err, IsNil)
- defer session.Close()
-
- result := struct{ Ok int }{}
- err = session.Run("ping", &result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestURLParsing(c *C) {
- urls := []string{
- "localhost:40001?foo=1&bar=2",
- "localhost:40001?foo=1;bar=2",
- }
- for _, url := range urls {
- session, err := mgo.Dial(url)
- if session != nil {
- session.Close()
- }
- c.Assert(err, ErrorMatches, "unsupported connection URL option: (foo=1|bar=2)")
- }
-}
-
-func (s *S) TestURLReadPreference(c *C) {
- type test struct {
- url string
- mode mgo.Mode
- }
-
- tests := []test{
- {"localhost:40001?readPreference=primary", mgo.Primary},
- {"localhost:40001?readPreference=primaryPreferred", mgo.PrimaryPreferred},
- {"localhost:40001?readPreference=secondary", mgo.Secondary},
- {"localhost:40001?readPreference=secondaryPreferred", mgo.SecondaryPreferred},
- {"localhost:40001?readPreference=nearest", mgo.Nearest},
- }
-
- for _, test := range tests {
- info, err := mgo.ParseURL(test.url)
- c.Assert(err, IsNil)
- c.Assert(info.ReadPreference, NotNil)
- c.Assert(info.ReadPreference.Mode, Equals, test.mode)
- }
-}
-
-func (s *S) TestURLWriteConcern(c *C) {
- type test struct {
- url string
- safe *mgo.Safe
- }
-
- tests := []test{
- {"localhost:31012?w=1", &mgo.Safe{W: 1}},
- {"localhost:31012?w=0", &mgo.Safe{W: 0}},
- {"localhost:31012?w=2", &mgo.Safe{W: 2}},
- {"localhost:31012?w=3", &mgo.Safe{W: 3}},
- {"localhost:31012?w=42", &mgo.Safe{W: 42}},
- {"localhost:31012?w=majority", &mgo.Safe{WMode: "majority"}},
- {"localhost:31012?w=foo", &mgo.Safe{WMode: "foo"}},
- {"localhost:31012?w=one", &mgo.Safe{WMode: "one"}},
- {"localhost:31012?wtimeoutMS=100", &mgo.Safe{WTimeout: 100}},
- {"localhost:31012?wtimeoutMS=0", &mgo.Safe{WTimeout: 0}},
- {"localhost:31012?wtimeoutMS=1", &mgo.Safe{WTimeout: 1}},
- {"localhost:31012?journal=true", &mgo.Safe{J: true}},
- {"localhost:31012?journal=false", &mgo.Safe{J: false}},
- {"localhost:31012", &mgo.Safe{}},
- }
-
- for _, test := range tests {
- info, err := mgo.ParseURL(test.url)
- c.Assert(err, IsNil)
- c.Assert(info.WriteConcern, NotNil)
- c.Assert(info.WriteConcern, DeepEquals, test.safe)
- }
-
- errorCases := []string{
- "localhost:31012?w=-1",
- "localhost:31012?w=-34",
- "localhost:31012?wtimeoutMS=-34",
- "localhost:31012?wtimeoutMS=-1",
- }
-
- for _, url := range errorCases {
- info, err := mgo.ParseURL(url)
- c.Assert(err, NotNil)
- c.Assert(info, IsNil)
- }
-}
-
-func (s *S) TestURLInvalidReadPreference(c *C) {
- urls := []string{
- "localhost:40001?readPreference=foo",
- "localhost:40001?readPreference=primarypreferred",
- }
- for _, url := range urls {
- _, err := mgo.ParseURL(url)
- c.Assert(err, NotNil)
- }
-}
-
-func (s *S) TestURLReadPreferenceTags(c *C) {
- type test struct {
- url string
- tagSets []bson.D
- }
-
- tests := []test{
- {"localhost:40001?readPreference=secondary&readPreferenceTags=dc:ny,rack:1", []bson.D{{{"dc", "ny"}, {"rack", "1"}}}},
- {"localhost:40001?readPreference=secondary&readPreferenceTags= dc : ny , rack : 1 ", []bson.D{{{"dc", "ny"}, {"rack", "1"}}}},
- {"localhost:40001?readPreference=secondary&readPreferenceTags=dc:ny", []bson.D{{{"dc", "ny"}}}},
- {"localhost:40001?readPreference=secondary&readPreferenceTags=rack:1&readPreferenceTags=dc:ny", []bson.D{{{"rack", "1"}}, {{"dc", "ny"}}}},
- }
-
- for _, test := range tests {
- info, err := mgo.ParseURL(test.url)
- c.Assert(err, IsNil)
- c.Assert(info.ReadPreference, NotNil)
- c.Assert(info.ReadPreference.TagSets, DeepEquals, test.tagSets)
- }
-}
-
-func (s *S) TestURLInvalidReadPreferenceTags(c *C) {
- urls := []string{
- "localhost:40001?readPreference=secondary&readPreferenceTags=dc",
- "localhost:40001?readPreference=secondary&readPreferenceTags=dc:ny,rack",
- "localhost:40001?readPreference=secondary&readPreferenceTags=dc,rack",
- "localhost:40001?readPreference=primary&readPreferenceTags=dc:ny",
- }
- for _, url := range urls {
- _, err := mgo.ParseURL(url)
- c.Assert(err, NotNil)
- }
-}
-
-func (s *S) TestReadableServer(c *C) {
- session, err := mgo.Dial("localhost:40011,localhost:40012,localhost:40013")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetMode(mgo.Primary, true)
- primary_address, err := session.ReadableServer()
- c.Assert(err, IsNil)
- c.Assert(primary_address, Equals, "localhost:40011")
-
- session.SetMode(mgo.Secondary, true)
- secondary_address, err := session.ReadableServer()
- c.Assert(err, IsNil)
-
- valid_addresses := []string{"localhost:40012", "localhost:40013"}
- if secondary_address != valid_addresses[0] && secondary_address != valid_addresses[1] {
- c.Fatalf("secondary_address should be in %v, not: %v", valid_addresses, secondary_address)
- }
-}
-
-func (s *S) TestInsertFindOne(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 1, "b": 3})
- c.Assert(err, IsNil)
-
- result := struct{ A, B int }{}
-
- err = coll.Find(M{"a": 1}).Sort("b").One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 1)
- c.Assert(result.B, Equals, 2)
-
- err = coll.Find(M{"a": 1}).Sort("-b").One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 1)
- c.Assert(result.B, Equals, 3)
-}
-
-func (s *S) TestInsertFindOneNil(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Find(nil).One(nil)
- c.Assert(err, ErrorMatches, "unauthorized.*|not authorized.*")
-}
-
-func (s *S) TestInsertFindOneMap(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
- result := make(M)
- err = coll.Find(M{"a": 1}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["a"], Equals, 1)
- c.Assert(result["b"], Equals, 2)
-}
-
-func (s *S) TestInsertFindAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"a": 1, "b": 2})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 3, "b": 4})
- c.Assert(err, IsNil)
-
- type R struct{ A, B int }
- var result []R
-
- assertResult := func() {
- c.Assert(len(result), Equals, 2)
- c.Assert(result[0].A, Equals, 1)
- c.Assert(result[0].B, Equals, 2)
- c.Assert(result[1].A, Equals, 3)
- c.Assert(result[1].B, Equals, 4)
- }
-
- // nil slice
- err = coll.Find(nil).Sort("a").All(&result)
- c.Assert(err, IsNil)
- assertResult()
-
- // Previously allocated slice
- allocd := make([]R, 5)
- result = allocd
- err = coll.Find(nil).Sort("a").All(&result)
- c.Assert(err, IsNil)
- assertResult()
-
- // Ensure result is backed by the originally allocated array
- c.Assert(&result[0], Equals, &allocd[0])
-
- // Non-pointer slice error
- f := func() { coll.Find(nil).All(result) }
- c.Assert(f, Panics, "result argument must be a slice address")
-
- // Non-slice error
- f = func() { coll.Find(nil).All(new(int)) }
- c.Assert(f, Panics, "result argument must be a slice address")
-}
-
-func (s *S) TestFindRef(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db1 := session.DB("db1")
- db1col1 := db1.C("col1")
-
- db2 := session.DB("db2")
- db2col1 := db2.C("col1")
-
- err = db1col1.Insert(M{"_id": 1, "n": 1})
- c.Assert(err, IsNil)
- err = db1col1.Insert(M{"_id": 2, "n": 2})
- c.Assert(err, IsNil)
- err = db2col1.Insert(M{"_id": 2, "n": 3})
- c.Assert(err, IsNil)
-
- result := struct{ N int }{}
-
- ref1 := &mgo.DBRef{Collection: "col1", Id: 1}
- ref2 := &mgo.DBRef{Collection: "col1", Id: 2, Database: "db2"}
-
- err = db1.FindRef(ref1).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-
- err = db1.FindRef(ref2).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 3)
-
- err = db2.FindRef(ref1).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = db2.FindRef(ref2).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 3)
-
- err = session.FindRef(ref2).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 3)
-
- f := func() { session.FindRef(ref1).One(&result) }
- c.Assert(f, PanicMatches, "Can't resolve database for &mgo.DBRef{Collection:\"col1\", Id:1, Database:\"\"}")
-}
-
-func (s *S) TestDatabaseAndCollectionNames(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db1 := session.DB("db1")
- db1col1 := db1.C("col1")
- db1col2 := db1.C("col2")
-
- db2 := session.DB("db2")
- db2col1 := db2.C("col3")
-
- err = db1col1.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = db1col2.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = db2col1.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- names, err := session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(filterDBs(names), DeepEquals, []string{"db1", "db2"})
-
- // Try to exercise cursor logic. 2.8.0-rc3 still ignores this.
- session.SetBatch(2)
-
- names, err = db1.CollectionNames()
- c.Assert(err, IsNil)
- if s.versionAtLeast(3, 2) {
- c.Assert(names, DeepEquals, []string{"col1", "col2"})
- } else {
- c.Assert(names, DeepEquals, []string{"col1", "col2", "system.indexes"})
- }
-
- names, err = db2.CollectionNames()
- c.Assert(err, IsNil)
- if s.versionAtLeast(3, 2) {
- c.Assert(names, DeepEquals, []string{"col3"})
- } else {
- c.Assert(names, DeepEquals, []string{"col3", "system.indexes"})
- }
-}
-
-func (s *S) TestSelect(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- result := struct{ A, B int }{}
-
- err = coll.Find(M{"a": 1}).Select(M{"b": 1}).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 0)
- c.Assert(result.B, Equals, 2)
-}
-
-func (s *S) TestInlineMap(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- var v, result1 struct {
- A int
- M map[string]int ",inline"
- }
-
- v.A = 1
- v.M = map[string]int{"b": 2}
- err = coll.Insert(v)
- c.Assert(err, IsNil)
-
- noId := M{"_id": 0}
-
- err = coll.Find(nil).Select(noId).One(&result1)
- c.Assert(err, IsNil)
- c.Assert(result1.A, Equals, 1)
- c.Assert(result1.M, DeepEquals, map[string]int{"b": 2})
-
- var result2 M
- err = coll.Find(nil).Select(noId).One(&result2)
- c.Assert(err, IsNil)
- c.Assert(result2, DeepEquals, M{"a": 1, "b": 2})
-
-}
-
-func (s *S) TestUpdate(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"k": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- // No changes is a no-op and shouldn't return an error.
- err = coll.Update(M{"k": 42}, M{"$set": M{"n": 42}})
- c.Assert(err, IsNil)
-
- err = coll.Update(M{"k": 42}, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- result := make(M)
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 43)
-
- err = coll.Update(M{"k": 47}, M{"k": 47, "n": 47})
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.Find(M{"k": 47}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestUpdateId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"_id": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- err = coll.UpdateId(42, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- result := make(M)
- err = coll.FindId(42).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 43)
-
- err = coll.UpdateId(47, M{"k": 47, "n": 47})
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.FindId(47).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestUpdateNil(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"k": 42, "n": 42})
- c.Assert(err, IsNil)
- err = coll.Update(nil, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- result := make(M)
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 43)
-
- err = coll.Insert(M{"k": 45, "n": 45})
- c.Assert(err, IsNil)
- _, err = coll.UpdateAll(nil, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
-
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 44)
- err = coll.Find(M{"k": 45}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 46)
-}
-
-func (s *S) TestUpsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(bson.D{{"k", n}, {"n", n}})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.Upsert(M{"k": 42}, bson.D{{"k", 42}, {"n", 24}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Matched, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- result := M{}
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 24)
-
- // Match but do not change.
- info, err = coll.Upsert(M{"k": 42}, bson.D{{"k", 42}, {"n", 24}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1) // On 2.6+ this feels like a server mistake.
- c.Assert(info.Matched, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- // Insert with internally created id.
- info, err = coll.Upsert(M{"k": 47}, M{"k": 47, "n": 47})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Matched, Equals, 0)
- c.Assert(info.UpsertedId, NotNil)
-
- err = coll.Find(M{"k": 47}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 47)
-
- result = M{}
- err = coll.Find(M{"_id": info.UpsertedId}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 47)
-
- // Insert with provided id.
- info, err = coll.Upsert(M{"k": 48}, M{"k": 48, "n": 48, "_id": 48})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Matched, Equals, 0)
- if s.versionAtLeast(2, 6) {
- c.Assert(info.UpsertedId, Equals, 48)
- } else {
- c.Assert(info.UpsertedId, IsNil) // Unfortunate, but that's what Mongo gave us.
- }
-
- err = coll.Find(M{"k": 48}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 48)
-}
-
-func (s *S) TestUpsertId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"_id": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.UpsertId(42, M{"n": 24})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- result := M{}
- err = coll.FindId(42).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 24)
-
- info, err = coll.UpsertId(47, M{"_id": 47, "n": 47})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- if s.versionAtLeast(2, 6) {
- c.Assert(info.UpsertedId, Equals, 47)
- } else {
- c.Assert(info.UpsertedId, IsNil)
- }
-
- err = coll.FindId(47).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 47)
-}
-
-func (s *S) TestUpdateAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"k": n, "n": n})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.UpdateAll(M{"k": M{"$gt": 42}}, M{"$unset": M{"missing": 1}})
- c.Assert(err, IsNil)
- if s.versionAtLeast(2, 6) {
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Matched, Equals, 4)
- } else {
- c.Assert(info.Updated, Equals, 4)
- c.Assert(info.Matched, Equals, 4)
- }
-
- info, err = coll.UpdateAll(M{"k": M{"$gt": 42}}, M{"$inc": M{"n": 1}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 4)
- c.Assert(info.Matched, Equals, 4)
-
- result := make(M)
- err = coll.Find(M{"k": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 42)
-
- err = coll.Find(M{"k": 43}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 44)
-
- err = coll.Find(M{"k": 44}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 45)
-
- if !s.versionAtLeast(2, 6) {
- // 2.6 made this invalid.
- info, err = coll.UpdateAll(M{"k": 47}, M{"k": 47, "n": 47})
- c.Assert(err, Equals, nil)
- c.Assert(info.Updated, Equals, 0)
- }
-}
-
-func (s *S) TestRemove(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- err = coll.Remove(M{"n": M{"$gt": 42}})
- c.Assert(err, IsNil)
-
- result := &struct{ N int }{}
- err = coll.Find(M{"n": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 42)
-
- err = coll.Find(M{"n": 43}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.Find(M{"n": 44}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 44)
-}
-
-func (s *S) TestRemoveId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"_id": 40}, M{"_id": 41}, M{"_id": 42})
- c.Assert(err, IsNil)
-
- err = coll.RemoveId(41)
- c.Assert(err, IsNil)
-
- c.Assert(coll.FindId(40).One(nil), IsNil)
- c.Assert(coll.FindId(41).One(nil), Equals, mgo.ErrNotFound)
- c.Assert(coll.FindId(42).One(nil), IsNil)
-}
-
-func (s *S) TestRemoveUnsafe(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSafe(nil)
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"_id": 40}, M{"_id": 41}, M{"_id": 42})
- c.Assert(err, IsNil)
-
- err = coll.RemoveId(41)
- c.Assert(err, IsNil)
-
- c.Assert(coll.FindId(40).One(nil), IsNil)
- c.Assert(coll.FindId(41).One(nil), Equals, mgo.ErrNotFound)
- c.Assert(coll.FindId(42).One(nil), IsNil)
-}
-
-func (s *S) TestRemoveAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- info, err := coll.RemoveAll(M{"n": M{"$gt": 42}})
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 4)
- c.Assert(info.Matched, Equals, 4)
- c.Assert(info.UpsertedId, IsNil)
-
- result := &struct{ N int }{}
- err = coll.Find(M{"n": 42}).One(result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 42)
-
- err = coll.Find(M{"n": 43}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.Find(M{"n": 44}).One(result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- info, err = coll.RemoveAll(nil)
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 3)
- c.Assert(info.Matched, Equals, 3)
- c.Assert(info.UpsertedId, IsNil)
-
- n, err := coll.Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 0)
-}
-
-func (s *S) TestDropDatabase(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db1 := session.DB("db1")
- db1.C("col").Insert(M{"_id": 1})
-
- db2 := session.DB("db2")
- db2.C("col").Insert(M{"_id": 1})
-
- err = db1.DropDatabase()
- c.Assert(err, IsNil)
-
- names, err := session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(filterDBs(names), DeepEquals, []string{"db2"})
-
- err = db2.DropDatabase()
- c.Assert(err, IsNil)
-
- names, err = session.DatabaseNames()
- c.Assert(err, IsNil)
- c.Assert(filterDBs(names), DeepEquals, []string{})
-}
-
-func findIndexByName(c *mgo.Collection, name string) (mgo.Index, error) {
- indexes, err := c.Indexes()
- if err != nil {
- return mgo.Index{}, err
- }
- for _, v := range indexes {
- if v.Name == name {
- return v, nil
- }
- }
- return mgo.Index{}, mgo.ErrNotFound
-}
-
-func filterDBs(dbs []string) []string {
- var i int
- for _, name := range dbs {
- switch name {
- case "admin", "local", "config":
- default:
- dbs[i] = name
- i++
- }
- }
- if len(dbs) == 0 {
- return []string{}
- }
- return dbs[:i]
-}
-
-func (s *S) TestDropCollection(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("db1")
- db.C("col1").Insert(M{"_id": 1})
- db.C("col2").Insert(M{"_id": 1})
-
- err = db.C("col1").DropCollection()
- c.Assert(err, IsNil)
-
- names, err := db.CollectionNames()
- c.Assert(err, IsNil)
- if s.versionAtLeast(3, 2) {
- c.Assert(names, DeepEquals, []string{"col2"})
- } else {
- c.Assert(names, DeepEquals, []string{"col2", "system.indexes"})
- }
-
- err = db.C("col2").DropCollection()
- c.Assert(err, IsNil)
-
- names, err = db.CollectionNames()
- c.Assert(err, IsNil)
- if s.versionAtLeast(3, 2) {
- c.Assert(names, DeepEquals, []string(nil))
- } else {
- c.Assert(names, DeepEquals, []string{"system.indexes"})
- }
-}
-
-func (s *S) TestCreateCollectionCapped(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- Capped: true,
- MaxBytes: 1024,
- MaxDocs: 3,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- ns := []int{1, 2, 3, 4, 5}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-}
-
-func (s *S) TestCreateCollectionNoIndex(c *C) {
- if s.versionAtLeast(3, 7) {
- c.Skip("autoIndexId removed in MongoDB 3.7+")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- DisableIdIndex: true,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(indexes, HasLen, 0)
-}
-
-func (s *S) TestCreateCollectionForceIndex(c *C) {
- if s.versionAtLeast(3, 7) {
- c.Skip("autoIndexId removed in MongoDB 3.7+")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- ForceIdIndex: true,
- Capped: true,
- MaxBytes: 1024,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(indexes, HasLen, 1)
-}
-
-func (s *S) TestCreateCollectionValidator(c *C) {
- if !s.versionAtLeast(3, 2) {
- c.Skip("validation depends on MongoDB 3.2+")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
- coll := db.C("mycoll")
-
- // Test Validator.
- info := &mgo.CollectionInfo{
- Validator: M{"b": M{"$exists": true}},
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 1})
- c.Assert(err, ErrorMatches, "Document failed validation")
- err = coll.DropCollection()
- c.Assert(err, IsNil)
-
- // Test ValidatorAction.
- info = &mgo.CollectionInfo{
- Validator: M{"b": M{"$exists": true}},
- ValidationAction: "warn",
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
- err = coll.DropCollection()
- c.Assert(err, IsNil)
-
- // Test ValidationLevel.
- info = &mgo.CollectionInfo{
- Validator: M{"a": M{"$exists": true}},
- ValidationLevel: "moderate",
- }
- err = coll.Create(info)
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
- err = db.Run(bson.D{{"collMod", "mycoll"}, {"validator", M{"b": M{"$exists": true}}}}, nil)
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 2})
- c.Assert(err, ErrorMatches, "Document failed validation")
- err = coll.Update(M{"a": 1}, M{"c": 1})
- c.Assert(err, IsNil)
- err = coll.DropCollection()
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestCreateCollectionStorageEngine(c *C) {
- if !s.versionAtLeast(3, 0) {
- c.Skip("storageEngine option depends on MongoDB 3.0+")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
- coll := db.C("mycoll")
-
- info := &mgo.CollectionInfo{
- StorageEngine: M{"test": M{}},
- }
- err = coll.Create(info)
- c.Assert(err, ErrorMatches, "test is not a registered storage engine for this server")
-}
-
-func (s *S) TestIsDupValues(c *C) {
- c.Assert(mgo.IsDup(nil), Equals, false)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 1}), Equals, false)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 1}), Equals, false)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 11000}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 11000}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 11001}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 11001}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.LastError{Code: 12582}), Equals, true)
- c.Assert(mgo.IsDup(&mgo.QueryError{Code: 12582}), Equals, true)
- lerr := &mgo.LastError{Code: 16460, Err: "error inserting 1 documents to shard ... caused by :: E11000 duplicate key error index: ..."}
- c.Assert(mgo.IsDup(lerr), Equals, true)
-}
-
-func (s *S) TestIsDupPrimary(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestIsDupUnique(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- index := mgo.Index{
- Key: []string{"a", "b"},
- Unique: true,
- }
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(index)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"a": 1, "b": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"a": 1, "b": 1})
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestIsDupCapped(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- info := &mgo.CollectionInfo{
- ForceIdIndex: true,
- Capped: true,
- MaxBytes: 1024,
- }
- err = coll.Create(info)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"_id": 1})
- // The error was different for capped collections before 2.6.
- c.Assert(err, ErrorMatches, ".*duplicate key.*")
- // The issue is reduced by using IsDup.
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestIsDupFindAndModify(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"n"}, Unique: true})
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"n": 2})
- c.Assert(err, IsNil)
- _, err = coll.Find(M{"n": 1}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}}, bson.M{})
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
- c.Assert(mgo.IsDup(err), Equals, true)
-}
-
-func (s *S) TestFindAndModify(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 42})
-
- session.SetMode(mgo.Monotonic, true)
-
- result := M{}
- info, err := coll.Find(M{"n": 42}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 42)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Matched, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- // A nil result parameter should be acceptable.
- info, err = coll.Find(M{"n": 43}).Apply(mgo.Change{Update: M{"$unset": M{"missing": 1}}}, nil)
- c.Assert(err, IsNil)
- c.Assert(info.Updated, Equals, 1) // On 2.6+ this feels like a server mistake.
- c.Assert(info.Matched, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 43}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}, ReturnNew: true}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 44)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 50}).Apply(mgo.Change{Upsert: true, Update: M{"n": 51, "o": 52}}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], IsNil)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, NotNil)
-
- result = M{}
- info, err = coll.Find(nil).Sort("-n").Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}, ReturnNew: true}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], Equals, 52)
- c.Assert(info.Updated, Equals, 1)
- c.Assert(info.Removed, Equals, 0)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 52}).Select(M{"o": 1}).Apply(mgo.Change{Remove: true}, result)
- c.Assert(err, IsNil)
- c.Assert(result["n"], IsNil)
- c.Assert(result["o"], Equals, 52)
- c.Assert(info.Updated, Equals, 0)
- c.Assert(info.Removed, Equals, 1)
- c.Assert(info.UpsertedId, IsNil)
-
- result = M{}
- info, err = coll.Find(M{"n": 60}).Apply(mgo.Change{Remove: true}, result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- c.Assert(len(result), Equals, 0)
- c.Assert(info, IsNil)
-}
-
-func (s *S) TestFindAndModifyBug997828(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": "not-a-number"})
-
- result := make(M)
- _, err = coll.Find(M{"n": "not-a-number"}).Apply(mgo.Change{Update: M{"$inc": M{"n": 1}}}, result)
- c.Assert(err, ErrorMatches, `(exception: )?Cannot apply \$inc .*`)
- if s.versionAtLeast(2, 1) {
- qerr, _ := err.(*mgo.QueryError)
- c.Assert(qerr, NotNil, Commentf("err: %#v", err))
- // Oh, the dance of error codes. :-(
- if s.versionAtLeast(3, 7) {
- c.Assert(qerr.Code, Equals, 14)
- } else if s.versionAtLeast(2, 6) {
- c.Assert(qerr.Code, Equals, 16837)
- } else {
- c.Assert(qerr.Code, Equals, 10140)
- }
- } else {
- lerr, _ := err.(*mgo.LastError)
- c.Assert(lerr, NotNil, Commentf("err: %#v", err))
- c.Assert(lerr.Code, Equals, 10140)
- }
-}
-
-func (s *S) TestFindAndModifyErrmsgDoc(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"errmsg": "an error"})
-
- var result M
- _, err = coll.Find(M{}).Apply(mgo.Change{Update: M{"$set": M{"n": 1}}}, &result)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestCountCollection(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-}
-
-func (s *S) TestCountQuery(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(M{"n": M{"$gt": 40}}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestCountQuerySorted(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(M{"n": M{"$gt": 40}}).Sort("n").Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestCountSkipLimit(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- n, err := coll.Find(nil).Skip(1).Limit(3).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 3)
-
- n, err = coll.Find(nil).Skip(1).Limit(5).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 4)
-}
-
-func (s *S) TestQueryExplain(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- m := M{}
- query := coll.Find(nil).Limit(2)
- err = query.Explain(m)
- c.Assert(err, IsNil)
- if m["queryPlanner"] != nil {
- c.Assert(m["executionStats"].(M)["totalDocsExamined"], Equals, 2)
- } else {
- c.Assert(m["cursor"], Equals, "BasicCursor")
- c.Assert(m["nscanned"], Equals, 2)
- c.Assert(m["n"], Equals, 2)
- }
-
- n := 0
- var result M
- iter := query.Iter()
- for iter.Next(&result) {
- n++
- }
- c.Assert(iter.Close(), IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestQuerySetMaxScan(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(nil).SetMaxScan(2)
- var result []M
- err = query.All(&result)
- c.Assert(err, IsNil)
- c.Assert(result, HasLen, 2)
-}
-
-func (s *S) TestQuerySetMaxTime(c *C) {
- if !s.versionAtLeast(2, 6) {
- c.Skip("SetMaxTime only supported in 2.6+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 1000; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(nil)
- query.SetMaxTime(1 * time.Millisecond)
- query.Batch(2)
- var result []M
- err = query.All(&result)
- c.Assert(err, ErrorMatches, "operation exceeded time limit")
-}
-
-func (s *S) TestQueryHint(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.EnsureIndexKey("a")
-
- m := M{}
- err = coll.Find(nil).Hint("a").Explain(m)
- c.Assert(err, IsNil)
-
- if m["queryPlanner"] != nil {
- m = m["queryPlanner"].(M)
- m = m["winningPlan"].(M)
- m = m["inputStage"].(M)
- c.Assert(m["indexName"], Equals, "a_1")
- } else {
- c.Assert(m["indexBounds"], NotNil)
- c.Assert(m["indexBounds"].(M)["a"], NotNil)
- }
-}
-
-func (s *S) TestQueryComment(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- db := session.DB("mydb")
- coll := db.C("mycoll")
-
- err = db.Run(bson.M{"profile": 2}, nil)
- c.Assert(err, IsNil)
-
- ns := []int{40, 41, 42}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(bson.M{"n": 41})
- query.Comment("some comment")
- err = query.One(nil)
- c.Assert(err, IsNil)
-
- query = coll.Find(bson.M{"n": 41})
- query.Comment("another comment")
- err = query.One(nil)
- c.Assert(err, IsNil)
-
- commentField := "query.$comment"
- nField := "query.$query.n"
- if s.versionAtLeast(3, 6) {
- commentField = "command.comment"
- nField = "command.filter.n"
- } else if s.versionAtLeast(3, 2) {
- commentField = "query.comment"
- nField = "query.filter.n"
- }
- n, err := session.DB("mydb").C("system.profile").Find(bson.M{nField: 41, commentField: "some comment"}).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 1)
-}
-
-func (s *S) TestFindOneNotFound(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- result := struct{ A, B int }{}
- err = coll.Find(M{"a": 1}).One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
- c.Assert(err, ErrorMatches, "not found")
- c.Assert(err == mgo.ErrNotFound, Equals, true)
-}
-
-func (s *S) TestFindIterNotFound(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- result := struct{ A, B int }{}
- iter := coll.Find(M{"a": 1}).Iter()
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), IsNil)
-}
-
-func (s *S) TestFindNil(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- result := struct{ N int }{}
-
- err = coll.Find(nil).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 1)
-}
-
-func (s *S) TestFindId(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"_id": 41, "n": 41})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"_id": 42, "n": 42})
- c.Assert(err, IsNil)
-
- result := struct{ N int }{}
-
- err = coll.FindId(42).One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.N, Equals, 42)
-}
-
-func (s *S) TestFindIterAll(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- iter := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2).Iter()
- result := struct{ N int }{}
- for i := 2; i < 7; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true, Commentf("err=%v", err))
- c.Assert(result.N, Equals, ns[i])
- if i == 1 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and their REPLY_OPs.
- if s.versionAtLeast(3, 2) {
- // In 3.2+ responses come in batches inside the op reply docs.
- c.Assert(stats.ReceivedDocs, Equals, 3)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 5)
- }
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindIterTwiceWithSameQuery(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 40; i != 47; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(M{}).Sort("n")
-
- iter1 := query.Skip(1).Iter()
- iter2 := query.Skip(2).Iter()
-
- var result struct{ N int }
- ok := iter2.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, 42)
- ok = iter1.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, 41)
-}
-
-func (s *S) TestFindIterWithoutResults(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"n": 42})
-
- iter := coll.Find(M{"n": 0}).Iter()
-
- result := struct{ N int }{}
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
- c.Assert(result.N, Equals, 0)
-}
-
-func (s *S) TestFindIterLimit(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Limit(3)
- iter := query.Iter()
-
- result := struct{ N int }{}
- for i := 2; i < 5; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // Limit works properly in 3.2+, and results are batched in single doc.
- c.Assert(stats.SentOps, Equals, 1) // 1*QUERY_OP
- c.Assert(stats.ReceivedOps, Equals, 1) // and its REPLY_OP
- c.Assert(stats.ReceivedDocs, Equals, 1)
- } else {
- c.Assert(stats.SentOps, Equals, 2) // 1*QUERY_OP + 1*KILL_CURSORS_OP
- c.Assert(stats.ReceivedOps, Equals, 1) // and its REPLY_OP
- c.Assert(stats.ReceivedDocs, Equals, 3)
- }
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-var cursorTimeout = flag.Bool("cursor-timeout", false, "Enable cursor timeout test")
-
-func (s *S) TestFindIterCursorTimeout(c *C) {
- if !*cursorTimeout {
- c.Skip("-cursor-timeout")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- type Doc struct {
- Id int "_id"
- }
-
- coll := session.DB("test").C("test")
- coll.Remove(nil)
- for i := 0; i < 100; i++ {
- err = coll.Insert(Doc{i})
- c.Assert(err, IsNil)
- }
-
- session.SetBatch(1)
- iter := coll.Find(nil).Iter()
- var doc Doc
- if !iter.Next(&doc) {
- c.Fatalf("iterator failed to return any documents")
- }
-
- for i := 10; i > 0; i-- {
- c.Logf("Sleeping... %d minutes to go...", i)
- time.Sleep(1*time.Minute + 2*time.Second)
- }
-
- // Drain any existing documents that were fetched.
- if !iter.Next(&doc) {
- c.Fatalf("iterator with timed out cursor failed to return previously cached document")
- }
- if iter.Next(&doc) {
- c.Fatalf("timed out cursor returned document")
- }
-
- c.Assert(iter.Err(), Equals, mgo.ErrCursor)
-}
-
-func (s *S) TestTooManyItemsLimitBug(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(runtime.NumCPU()))
-
- mgo.SetDebug(false)
- coll := session.DB("mydb").C("mycoll")
- words := strings.Split("foo bar baz", " ")
- for i := 0; i < 5; i++ {
- words = append(words, words...)
- }
- doc := bson.D{{"words", words}}
- inserts := 10000
- limit := 5000
- iters := 0
- c.Assert(inserts > limit, Equals, true)
- for i := 0; i < inserts; i++ {
- err := coll.Insert(&doc)
- c.Assert(err, IsNil)
- }
- iter := coll.Find(nil).Limit(limit).Iter()
- for iter.Next(&doc) {
- if iters%100 == 0 {
- c.Logf("Seen %d docments", iters)
- }
- iters++
- }
- c.Assert(iter.Close(), IsNil)
- c.Assert(iters, Equals, limit)
-}
-
-func (s *S) TestBatchSizeZeroGetMore(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(runtime.NumCPU()))
-
- mgo.SetDebug(false)
- coll := session.DB("mydb").C("mycoll")
- words := strings.Split("foo bar baz", " ")
- for i := 0; i < 5; i++ {
- words = append(words, words...)
- }
- doc := bson.D{{"words", words}}
- inserts := 10000
- iters := 0
- for i := 0; i < inserts; i++ {
- err := coll.Insert(&doc)
- c.Assert(err, IsNil)
- }
- iter := coll.Find(nil).Iter()
- for iter.Next(&doc) {
- if iters%100 == 0 {
- c.Logf("Seen %d docments", iters)
- }
- iters++
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func serverCursorsOpen(session *mgo.Session) int {
- var result struct {
- Cursors struct {
- TotalOpen int `bson:"totalOpen"`
- TimedOut int `bson:"timedOut"`
- }
- }
- err := session.Run("serverStatus", &result)
- if err != nil {
- panic(err)
- }
- return result.Cursors.TotalOpen
-}
-
-func (s *S) TestFindIterLimitWithMore(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Insane amounts of logging otherwise due to the
- // amount of data being shuffled.
- mgo.SetDebug(false)
- defer mgo.SetDebug(true)
-
- // Should amount to more than 4MB bson payload,
- // the default limit per result chunk.
- const total = 4096
- var d struct{ A [1024]byte }
- docs := make([]interface{}, total)
- for i := 0; i < total; i++ {
- docs[i] = &d
- }
- err = coll.Insert(docs...)
- c.Assert(err, IsNil)
-
- n, err := coll.Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, total)
-
- // First, try restricting to a single chunk with a negative limit.
- nresults := 0
- iter := coll.Find(nil).Limit(-total).Iter()
- var discard struct{}
- for iter.Next(&discard) {
- nresults++
- }
- if nresults < total/2 {
- c.Fatalf("Too few results with negative limit: %d < %d/2", nresults, total)
- } else if nresults > total {
- c.Fatalf("Too many results with negative limit: %d > %d", nresults, total)
- }
-
- cursorsOpen := serverCursorsOpen(session)
-
- // Try again, with a positive limit. Should reach the end now,
- // using multiple chunks.
- nresults = 0
- iter = coll.Find(nil).Limit(total).Iter()
- for iter.Next(&discard) {
- nresults++
- }
- c.Assert(nresults, Equals, total)
-
- // Ensure the cursor used is properly killed.
- c.Assert(serverCursorsOpen(session), Equals, cursorsOpen)
-
- // Edge case, -MinInt == -MinInt.
- nresults = 0
- iter = coll.Find(nil).Limit(math.MinInt32).Iter()
- for iter.Next(&discard) {
- nresults++
- }
- if nresults < total/2 || nresults > total {
- c.Fatalf("Bad result size with MinInt32 limit: %d", nresults)
- }
-}
-
-func (s *S) TestFindIterLimitWithBatch(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(session.Ping(), IsNil)
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Limit(3).Batch(2)
- iter := query.Iter()
- result := struct{ N int }{}
- for i := 2; i < 5; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 {
- stats := mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // In 3.2+ responses come in batches inside the op reply docs.
- c.Assert(stats.ReceivedDocs, Equals, 1)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // In 3.2+ limit works properly even with multiple batches..
- c.Assert(stats.SentOps, Equals, 2) // 1*QUERY_OP + 1*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 2) // and its REPLY_OPs
-
- // In 3.2+ responses come in batches inside the op reply docs.
- c.Assert(stats.ReceivedDocs, Equals, 2)
- } else {
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 1*GET_MORE_OP + 1*KILL_CURSORS_OP
- c.Assert(stats.ReceivedOps, Equals, 2) // and its REPLY_OPs
- c.Assert(stats.ReceivedDocs, Equals, 3)
- }
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindIterSortWithBatch(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- // Without this, the logic above breaks because Mongo refuses to
- // return a cursor with an in-memory sort.
- coll.EnsureIndexKey("n")
-
- // Ping the database to ensure the nonce has been received already.
- c.Assert(session.Ping(), IsNil)
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$lte": 44}}).Sort("-n").Batch(2)
- iter := query.Iter()
- ns = []int{46, 45, 44, 43, 42, 41, 40}
- result := struct{ N int }{}
- for i := 2; i < len(ns); i++ {
- c.Logf("i=%d", i)
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 {
- stats := mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, 1)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
- }
-
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and its REPLY_OPs
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, 3)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 5)
- }
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-// Test tailable cursors in a situation where Next has to sleep to
-// respect the timeout requested on Tail.
-func (s *S) TestFindTailTimeoutWithSleep(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cresult := struct{ ErrMsg string }{}
-
- db := session.DB("mydb")
- err = db.Run(bson.D{{"create", "mycoll"}, {"capped", true}, {"size", 1024}}, &cresult)
- c.Assert(err, IsNil)
- c.Assert(cresult.ErrMsg, Equals, "")
- coll := db.C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- timeout := 5 * time.Second
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Tail(timeout)
-
- n := len(ns)
- result := struct{ N int }{}
- for i := 2; i != n; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 { // The batch boundary.
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- mgo.ResetStats()
-
- // The following call to Next will block.
- done := make(chan bool)
- defer func() { <-done }()
- go func() {
- // The internal AwaitData timing of MongoDB is around 2 seconds,
- // so this should force mgo to sleep at least once by itself to
- // respect the requested timeout.
- c.Logf("[GOROUTINE] Starting and sleeping...")
- time.Sleep(timeout - 2*time.Second)
- c.Logf("[GOROUTINE] Woke up...")
- session := session.New()
- c.Logf("[GOROUTINE] Session created and will insert...")
- err := coll.Insert(M{"n": 47})
- c.Logf("[GOROUTINE] Insert attempted, err=%v...", err)
- session.Close()
- c.Logf("[GOROUTINE] Session closed.")
- c.Check(err, IsNil)
- done <- true
- }()
-
- c.Log("Will wait for Next with N=47...")
- ok := iter.Next(&result)
- c.Log("Next unblocked...")
- c.Assert(ok, Equals, true)
-
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 47)
- c.Log("Got Next with N=47!")
-
- c.Log("Will wait for a result which will never come...")
-
- started := time.Now()
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, true)
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
-
- c.Log("Will now reuse the timed out tail cursor...")
-
- coll.Insert(M{"n": 48})
- ok = iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Close(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 48)
-}
-
-// Test tailable cursors in a situation where Next never gets to sleep once
-// to respect the timeout requested on Tail.
-func (s *S) TestFindTailTimeoutNoSleep(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cresult := struct{ ErrMsg string }{}
-
- db := session.DB("mydb")
- err = db.Run(bson.D{{"create", "mycoll"}, {"capped", true}, {"size", 1024}}, &cresult)
- c.Assert(err, IsNil)
- c.Assert(cresult.ErrMsg, Equals, "")
- coll := db.C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- timeout := 1 * time.Second
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Tail(timeout)
-
- n := len(ns)
- result := struct{ N int }{}
- for i := 2; i != n; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 { // The batch boundary.
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- // The following call to Next will block.
- go func() {
- // The internal AwaitData timing of MongoDB is around 2 seconds,
- // so this item should arrive within the AwaitData threshold.
- time.Sleep(500 * time.Millisecond)
- session := session.New()
- defer session.Close()
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"n": 47})
- }()
-
- c.Log("Will wait for Next with N=47...")
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 47)
- c.Log("Got Next with N=47!")
-
- c.Log("Will wait for a result which will never come...")
-
- started := time.Now()
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, true)
- c.Assert(started.Before(time.Now().Add(-timeout)), Equals, true)
-
- c.Log("Will now reuse the timed out tail cursor...")
-
- coll.Insert(M{"n": 48})
- ok = iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Close(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 48)
-}
-
-// Test tailable cursors in a situation where Next never gets to sleep once
-// to respect the timeout requested on Tail.
-func (s *S) TestFindTailNoTimeout(c *C) {
- if *fast {
- c.Skip("-fast")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
-
- cresult := struct{ ErrMsg string }{}
-
- db := session.DB("mydb")
- err = db.Run(bson.D{{"create", "mycoll"}, {"capped", true}, {"size", 1024}}, &cresult)
- c.Assert(err, IsNil)
- c.Assert(cresult.ErrMsg, Equals, "")
- coll := db.C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Tail(-1)
- c.Assert(err, IsNil)
-
- n := len(ns)
- result := struct{ N int }{}
- for i := 2; i != n; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 { // The batch boundary.
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
-
- mgo.ResetStats()
-
- // The following call to Next will block.
- go func() {
- time.Sleep(5e8)
- s := session.New()
- defer s.Close()
- coll := s.DB("mydb").C("mycoll")
- coll.Insert(M{"n": 47})
- }()
-
- c.Log("Will wait for Next with N=47...")
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(iter.Err(), IsNil)
- c.Assert(iter.Timeout(), Equals, false)
- c.Assert(result.N, Equals, 47)
- c.Log("Got Next with N=47!")
-
- c.Log("Will wait for a result which will never come...")
-
- gotNext := make(chan bool)
- go func() {
- ok := iter.Next(&result)
- gotNext <- ok
- }()
-
- select {
- case ok := <-gotNext:
- c.Fatalf("Next returned: %v", ok)
- case <-time.After(3e9):
- // Good. Should still be sleeping at that point.
- }
-
- // Closing the session should cause Next to return.
- session.Close()
-
- select {
- case ok := <-gotNext:
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), ErrorMatches, "Closed explicitly")
- c.Assert(iter.Timeout(), Equals, false)
- case <-time.After(1e9):
- c.Fatal("Closing the session did not unblock Next")
- }
-}
-
-func (s *S) TestIterNextResetsResult(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{1, 2, 3}
- for _, n := range ns {
- coll.Insert(M{"n" + strconv.Itoa(n): n})
- }
-
- query := coll.Find(nil).Sort("$natural")
-
- i := 0
- var sresult *struct{ N1, N2, N3 int }
- iter := query.Iter()
- for iter.Next(&sresult) {
- switch i {
- case 0:
- c.Assert(sresult.N1, Equals, 1)
- c.Assert(sresult.N2+sresult.N3, Equals, 0)
- case 1:
- c.Assert(sresult.N2, Equals, 2)
- c.Assert(sresult.N1+sresult.N3, Equals, 0)
- case 2:
- c.Assert(sresult.N3, Equals, 3)
- c.Assert(sresult.N1+sresult.N2, Equals, 0)
- }
- i++
- }
- c.Assert(iter.Close(), IsNil)
-
- i = 0
- var mresult M
- iter = query.Iter()
- for iter.Next(&mresult) {
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, M{"n3": 3})
- }
- i++
- }
- c.Assert(iter.Close(), IsNil)
-
- i = 0
- var iresult interface{}
- iter = query.Iter()
- for iter.Next(&iresult) {
- mresult, ok := iresult.(bson.M)
- c.Assert(ok, Equals, true, Commentf("%#v", iresult))
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, bson.M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, bson.M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, bson.M{"n3": 3})
- }
- i++
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestFindForOnIter(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
- iter := query.Iter()
-
- i := 2
- var result *struct{ N int }
- err = iter.For(&result, func() error {
- c.Assert(i < 7, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 1 {
- stats := mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, 1)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and their REPLY_OPs.
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, 3)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 5)
- }
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindFor(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- session.Refresh() // Release socket.
-
- mgo.ResetStats()
-
- query := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2)
-
- i := 2
- var result *struct{ N int }
- err = query.For(&result, func() error {
- c.Assert(i < 7, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 1 {
- stats := mgo.GetStats()
- c.Assert(stats.ReceivedDocs, Equals, 2)
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, 1)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 2)
- }
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- session.Refresh() // Release socket.
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 3) // 1*QUERY_OP + 2*GET_MORE_OP
- c.Assert(stats.ReceivedOps, Equals, 3) // and their REPLY_OPs.
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, 3)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, 5)
- }
- c.Assert(stats.SocketsInUse, Equals, 0)
-}
-
-func (s *S) TestFindForStopOnError(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- query := coll.Find(M{"n": M{"$gte": 42}})
- i := 2
- var result *struct{ N int }
- err = query.For(&result, func() error {
- c.Assert(i < 4, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- if i == 3 {
- return fmt.Errorf("stop!")
- }
- i++
- return nil
- })
- c.Assert(err, ErrorMatches, "stop!")
-}
-
-func (s *S) TestFindForResetsResult(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{1, 2, 3}
- for _, n := range ns {
- coll.Insert(M{"n" + strconv.Itoa(n): n})
- }
-
- query := coll.Find(nil).Sort("$natural")
-
- i := 0
- var sresult *struct{ N1, N2, N3 int }
- err = query.For(&sresult, func() error {
- switch i {
- case 0:
- c.Assert(sresult.N1, Equals, 1)
- c.Assert(sresult.N2+sresult.N3, Equals, 0)
- case 1:
- c.Assert(sresult.N2, Equals, 2)
- c.Assert(sresult.N1+sresult.N3, Equals, 0)
- case 2:
- c.Assert(sresult.N3, Equals, 3)
- c.Assert(sresult.N1+sresult.N2, Equals, 0)
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- i = 0
- var mresult M
- err = query.For(&mresult, func() error {
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, M{"n3": 3})
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-
- i = 0
- var iresult interface{}
- err = query.For(&iresult, func() error {
- mresult, ok := iresult.(bson.M)
- c.Assert(ok, Equals, true, Commentf("%#v", iresult))
- delete(mresult, "_id")
- switch i {
- case 0:
- c.Assert(mresult, DeepEquals, bson.M{"n1": 1})
- case 1:
- c.Assert(mresult, DeepEquals, bson.M{"n2": 2})
- case 2:
- c.Assert(mresult, DeepEquals, bson.M{"n3": 3})
- }
- i++
- return nil
- })
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestFindIterSnapshot(c *C) {
- if s.versionAtLeast(3, 2) {
- c.Skip("Broken in 3.2: https://jira.mongodb.org/browse/SERVER-21403")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Insane amounts of logging otherwise due to the
- // amount of data being shuffled.
- mgo.SetDebug(false)
- defer mgo.SetDebug(true)
-
- coll := session.DB("mydb").C("mycoll")
-
- var a [1024000]byte
-
- for n := 0; n < 10; n++ {
- err := coll.Insert(M{"_id": n, "n": n, "a1": &a})
- c.Assert(err, IsNil)
- }
-
- query := coll.Find(M{"n": M{"$gt": -1}}).Batch(2).Prefetch(0)
- query.Snapshot()
- iter := query.Iter()
-
- seen := map[int]bool{}
- result := struct {
- Id int "_id"
- }{}
- for iter.Next(&result) {
- if len(seen) == 2 {
- // Grow all entries so that they have to move.
- // Backwards so that the order is inverted.
- for n := 10; n >= 0; n-- {
- _, err := coll.Upsert(M{"_id": n}, M{"$set": M{"a2": &a}})
- c.Assert(err, IsNil)
- }
- }
- if seen[result.Id] {
- c.Fatalf("seen duplicated key: %d", result.Id)
- }
- seen[result.Id] = true
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestSort(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- coll.Insert(M{"a": 1, "b": 1})
- coll.Insert(M{"a": 2, "b": 2})
- coll.Insert(M{"a": 2, "b": 1})
- coll.Insert(M{"a": 0, "b": 1})
- coll.Insert(M{"a": 2, "b": 0})
- coll.Insert(M{"a": 0, "b": 2})
- coll.Insert(M{"a": 1, "b": 2})
- coll.Insert(M{"a": 0, "b": 0})
- coll.Insert(M{"a": 1, "b": 0})
-
- query := coll.Find(M{})
- query.Sort("-a") // Should be ignored.
- query.Sort("-b", "a")
- iter := query.Iter()
-
- l := make([]int, 18)
- r := struct{ A, B int }{}
- for i := 0; i != len(l); i += 2 {
- ok := iter.Next(&r)
- c.Assert(ok, Equals, true)
- c.Assert(err, IsNil)
- l[i] = r.A
- l[i+1] = r.B
- }
-
- c.Assert(l, DeepEquals, []int{0, 2, 1, 2, 2, 2, 0, 1, 1, 1, 2, 1, 0, 0, 1, 0, 2, 0})
-}
-
-func (s *S) TestSortWithBadArgs(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- f1 := func() { coll.Find(nil).Sort("") }
- f2 := func() { coll.Find(nil).Sort("+") }
- f3 := func() { coll.Find(nil).Sort("foo", "-") }
-
- for _, f := range []func(){f1, f2, f3} {
- c.Assert(f, PanicMatches, "Sort: empty field name")
- }
-}
-
-func (s *S) TestSortScoreText(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- if !s.versionAtLeast(2, 4) {
- c.Skip("Text search depends on 2.4+")
- }
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{
- Key: []string{"$text:a", "$text:b"},
- })
- msg := "text search not enabled"
- if err != nil && strings.Contains(err.Error(), msg) {
- c.Skip(msg)
- }
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{
- "a": "none",
- "b": "twice: foo foo",
- })
- c.Assert(err, IsNil)
- err = coll.Insert(M{
- "a": "just once: foo",
- "b": "none",
- })
- c.Assert(err, IsNil)
- err = coll.Insert(M{
- "a": "many: foo foo foo",
- "b": "none",
- })
- c.Assert(err, IsNil)
- err = coll.Insert(M{
- "a": "none",
- "b": "none",
- "c": "ignore: foo",
- })
- c.Assert(err, IsNil)
-
- query := coll.Find(M{"$text": M{"$search": "foo"}})
- query.Select(M{"score": M{"$meta": "textScore"}})
- query.Sort("$textScore:score")
- iter := query.Iter()
-
- var r struct{ A, B string }
- var results []string
- for iter.Next(&r) {
- results = append(results, r.A, r.B)
- }
-
- c.Assert(results, DeepEquals, []string{
- "many: foo foo foo", "none",
- "none", "twice: foo foo",
- "just once: foo", "none",
- })
-}
-
-func (s *S) TestPrefetching(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- const total = 600
- const batch = 100
- mgo.SetDebug(false)
- docs := make([]interface{}, total)
- for i := 0; i != total; i++ {
- docs[i] = bson.D{{"n", i}}
- }
- err = coll.Insert(docs...)
- c.Assert(err, IsNil)
-
- for testi := 0; testi < 5; testi++ {
- mgo.ResetStats()
-
- var iter *mgo.Iter
- var beforeMore int
-
- switch testi {
- case 0: // The default session value.
- session.SetBatch(batch)
- iter = coll.Find(M{}).Iter()
- beforeMore = 75
-
- case 2: // Changing the session value.
- session.SetBatch(batch)
- session.SetPrefetch(0.27)
- iter = coll.Find(M{}).Iter()
- beforeMore = 73
-
- case 1: // Changing via query methods.
- iter = coll.Find(M{}).Prefetch(0.27).Batch(batch).Iter()
- beforeMore = 73
-
- case 3: // With prefetch on first document.
- iter = coll.Find(M{}).Prefetch(1.0).Batch(batch).Iter()
- beforeMore = 0
-
- case 4: // Without prefetch.
- iter = coll.Find(M{}).Prefetch(0).Batch(batch).Iter()
- beforeMore = 100
- }
-
- pings := 0
- for batchi := 0; batchi < len(docs)/batch-1; batchi++ {
- c.Logf("Iterating over %d documents on batch %d", beforeMore, batchi)
- var result struct{ N int }
- for i := 0; i < beforeMore; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true, Commentf("iter.Err: %v", iter.Err()))
- }
- beforeMore = 99
- c.Logf("Done iterating.")
-
- session.Run("ping", nil) // Roundtrip to settle down.
- pings++
-
- stats := mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, (batchi+1)+pings)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, (batchi+1)*batch+pings)
- }
-
- c.Logf("Iterating over one more document on batch %d", batchi)
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true, Commentf("iter.Err: %v", iter.Err()))
- c.Logf("Done iterating.")
-
- session.Run("ping", nil) // Roundtrip to settle down.
- pings++
-
- stats = mgo.GetStats()
- if s.versionAtLeast(3, 2) {
- // Find command in 3.2+ bundles batches in a single document.
- c.Assert(stats.ReceivedDocs, Equals, (batchi+2)+pings)
- } else {
- c.Assert(stats.ReceivedDocs, Equals, (batchi+2)*batch+pings)
- }
- }
- }
-}
-
-func (s *S) TestSafeSetting(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Check the default
- safe := session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 0)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, false)
-
- // Tweak it
- session.SetSafe(&mgo.Safe{W: 1, WTimeout: 2, FSync: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 1)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // Reset it again.
- session.SetSafe(&mgo.Safe{})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 0)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, false)
-
- // Ensure safety to something more conservative.
- session.SetSafe(&mgo.Safe{W: 5, WTimeout: 6, J: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 5)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 6)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, true)
-
- // Ensure safety to something less conservative won't change it.
- session.EnsureSafe(&mgo.Safe{W: 4, WTimeout: 7})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 5)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 6)
- c.Assert(safe.FSync, Equals, false)
- c.Assert(safe.J, Equals, true)
-
- // But to something more conservative will.
- session.EnsureSafe(&mgo.Safe{W: 6, WTimeout: 4, FSync: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 6)
- c.Assert(safe.WMode, Equals, "")
- c.Assert(safe.WTimeout, Equals, 4)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // Even more conservative.
- session.EnsureSafe(&mgo.Safe{WMode: "majority", WTimeout: 2})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "majority")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // WMode always overrides, whatever it is, but J doesn't.
- session.EnsureSafe(&mgo.Safe{WMode: "something", J: true})
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "something")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // EnsureSafe with nil does nothing.
- session.EnsureSafe(nil)
- safe = session.Safe()
- c.Assert(safe.W, Equals, 0)
- c.Assert(safe.WMode, Equals, "something")
- c.Assert(safe.WTimeout, Equals, 2)
- c.Assert(safe.FSync, Equals, true)
- c.Assert(safe.J, Equals, false)
-
- // Changing the safety of a cloned session doesn't touch the original.
- clone := session.Clone()
- defer clone.Close()
- clone.EnsureSafe(&mgo.Safe{WMode: "foo"})
- safe = session.Safe()
- c.Assert(safe.WMode, Equals, "something")
-}
-
-func (s *S) TestSafeInsert(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Insert an element with a predefined key.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- // Session should be safe by default, so inserting it again must fail.
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, ErrorMatches, ".*E11000 duplicate.*")
- c.Assert(err.(*mgo.LastError).Code, Equals, 11000)
-
- // It must have sent two operations (INSERT_OP + getLastError QUERY_OP)
- stats := mgo.GetStats()
-
- if s.versionAtLeast(2, 6) {
- c.Assert(stats.SentOps, Equals, 1)
- } else {
- c.Assert(stats.SentOps, Equals, 2)
- }
-
- mgo.ResetStats()
-
- // If we disable safety, though, it won't complain.
- session.SetSafe(nil)
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, IsNil)
-
- // Must have sent a single operation this time (just the INSERT_OP)
- stats = mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 1)
-}
-
-func (s *S) TestSafeParameters(c *C) {
- session, err := mgo.Dial("localhost:40011")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- // Tweak the safety parameters to something unachievable.
- session.SetSafe(&mgo.Safe{W: 4, WTimeout: 100})
- err = coll.Insert(M{"_id": 1})
- c.Assert(err, ErrorMatches, "timeout|timed out waiting for slaves|Not enough data-bearing nodes|waiting for replication timed out") // :-(
- if !s.versionAtLeast(2, 6) {
- // 2.6 turned it into a query error.
- c.Assert(err.(*mgo.LastError).WTimeout, Equals, true)
- }
-}
-
-func (s *S) TestQueryErrorOne(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Find(M{"a": 1}).Select(M{"a": M{"b": 1}}).One(nil)
- c.Assert(err, ErrorMatches, ".*Unsupported projection option:.*")
- c.Assert(err.(*mgo.QueryError).Message, Matches, ".*Unsupported projection option:.*")
- // Oh, the dance of error codes. :-(
- if s.versionAtLeast(3, 2) {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 2)
- } else if s.versionAtLeast(2, 6) {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 17287)
- } else {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 13097)
- }
-}
-
-func (s *S) TestQueryErrorNext(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- iter := coll.Find(M{"a": 1}).Select(M{"a": M{"b": 1}}).Iter()
-
- var result struct{}
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
-
- err = iter.Close()
- c.Assert(err, ErrorMatches, ".*Unsupported projection option:.*")
- c.Assert(err.(*mgo.QueryError).Message, Matches, ".*Unsupported projection option:.*")
- // Oh, the dance of error codes. :-(
- if s.versionAtLeast(3, 2) {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 2)
- } else if s.versionAtLeast(2, 6) {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 17287)
- } else {
- c.Assert(err.(*mgo.QueryError).Code, Equals, 13097)
- }
- c.Assert(iter.Err(), Equals, err)
-}
-
-var indexTests = []struct {
- index mgo.Index
- expected M
-}{{
- mgo.Index{
- Key: []string{"a"},
- Background: true,
- },
- M{
- "name": "a_1",
- "key": M{"a": 1},
- "ns": "mydb.mycoll",
- "background": true,
- },
-}, {
- mgo.Index{
- Key: []string{"a", "-b"},
- Unique: true,
- DropDups: true,
- },
- M{
- "name": "a_1_b_-1",
- "key": M{"a": 1, "b": -1},
- "ns": "mydb.mycoll",
- "unique": true,
- "dropDups": true,
- },
-}, {
- mgo.Index{
- Key: []string{"@loc_old"}, // Obsolete
- Min: -500,
- Max: 500,
- Bits: 32,
- },
- M{
- "name": "loc_old_2d",
- "key": M{"loc_old": "2d"},
- "ns": "mydb.mycoll",
- "min": -500.0,
- "max": 500.0,
- "bits": 32,
- },
-}, {
- mgo.Index{
- Key: []string{"$2d:loc"},
- Min: -500,
- Max: 500,
- Bits: 32,
- },
- M{
- "name": "loc_2d",
- "key": M{"loc": "2d"},
- "ns": "mydb.mycoll",
- "min": -500.0,
- "max": 500.0,
- "bits": 32,
- },
-}, {
- mgo.Index{
- Key: []string{"$2d:loc"},
- Minf: -500.1,
- Maxf: 500.1,
- Min: 1, // Should be ignored
- Max: 2,
- Bits: 32,
- },
- M{
- "name": "loc_2d",
- "key": M{"loc": "2d"},
- "ns": "mydb.mycoll",
- "min": -500.1,
- "max": 500.1,
- "bits": 32,
- },
-}, {
- mgo.Index{
- Key: []string{"$geoHaystack:loc", "type"},
- BucketSize: 1,
- },
- M{
- "name": "loc_geoHaystack_type_1",
- "key": M{"loc": "geoHaystack", "type": 1},
- "ns": "mydb.mycoll",
- "bucketSize": 1.0,
- },
-}, {
- mgo.Index{
- Key: []string{"$text:a", "$text:b"},
- Weights: map[string]int{"b": 42},
- },
- M{
- "name": "a_text_b_text",
- "key": M{"_fts": "text", "_ftsx": 1},
- "ns": "mydb.mycoll",
- "weights": M{"a": 1, "b": 42},
- "default_language": "english",
- "language_override": "language",
- "textIndexVersion": 2,
- },
-}, {
- mgo.Index{
- Key: []string{"$text:a"},
- DefaultLanguage: "portuguese",
- LanguageOverride: "idioma",
- },
- M{
- "name": "a_text",
- "key": M{"_fts": "text", "_ftsx": 1},
- "ns": "mydb.mycoll",
- "weights": M{"a": 1},
- "default_language": "portuguese",
- "language_override": "idioma",
- "textIndexVersion": 2,
- },
-}, {
- mgo.Index{
- Key: []string{"$text:$**"},
- },
- M{
- "name": "$**_text",
- "key": M{"_fts": "text", "_ftsx": 1},
- "ns": "mydb.mycoll",
- "weights": M{"$**": 1},
- "default_language": "english",
- "language_override": "language",
- "textIndexVersion": 2,
- },
-}, {
- mgo.Index{
- Key: []string{"cn"},
- Name: "CustomName",
- },
- M{
- "name": "CustomName",
- "key": M{"cn": 1},
- "ns": "mydb.mycoll",
- },
-}}
-
-func (s *S) TestEnsureIndex(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- // idxs := session.DB("mydb").C("system.indexes")
-
- for _, test := range indexTests {
- if !s.versionAtLeast(2, 4) && test.expected["textIndexVersion"] != nil {
- continue
- }
-
- err = coll.EnsureIndex(test.index)
- msg := "text search not enabled"
- if err != nil && strings.Contains(err.Error(), msg) {
- continue
- }
- c.Assert(err, IsNil)
-
- expectedName := test.index.Name
- if expectedName == "" {
- expectedName, _ = test.expected["name"].(string)
- }
-
- // obtained := M{}
- // err = idxs.Find(M{"name": expectedName}).One(obtained)
- // c.Assert(err, IsNil) // XXX ERR HERE
- //
- // delete(obtained, "v")
- //
- // if s.versionAtLeast(2, 7) {
- // // Was deprecated in 2.6, and not being reported by 2.7+.
- // delete(test.expected, "dropDups")
- // test.index.DropDups = false
- // }
- // if s.versionAtLeast(3, 2) && test.expected["textIndexVersion"] != nil {
- // test.expected["textIndexVersion"] = 3
- // }
- //
- // c.Assert(obtained, DeepEquals, test.expected)
-
- // The result of Indexes must match closely what was used to create the index.
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
- c.Assert(indexes, HasLen, 2)
- gotIndex := indexes[0]
- if gotIndex.Name == "_id_" {
- gotIndex = indexes[1]
- }
- wantIndex := test.index
- if wantIndex.Name == "" {
- wantIndex.Name = gotIndex.Name
- }
- if strings.HasPrefix(wantIndex.Key[0], "@") {
- wantIndex.Key[0] = "$2d:" + wantIndex.Key[0][1:]
- }
- if wantIndex.Minf == 0 && wantIndex.Maxf == 0 {
- wantIndex.Minf = float64(wantIndex.Min)
- wantIndex.Maxf = float64(wantIndex.Max)
- } else {
- wantIndex.Min = gotIndex.Min
- wantIndex.Max = gotIndex.Max
- }
- if wantIndex.DefaultLanguage == "" {
- wantIndex.DefaultLanguage = gotIndex.DefaultLanguage
- }
- if wantIndex.LanguageOverride == "" {
- wantIndex.LanguageOverride = gotIndex.LanguageOverride
- }
- for name, _ := range gotIndex.Weights {
- if _, ok := wantIndex.Weights[name]; !ok {
- if wantIndex.Weights == nil {
- wantIndex.Weights = make(map[string]int)
- }
- wantIndex.Weights[name] = 1
- }
- }
- if s.versionAtLeast(3, 0) {
- // 3.0 no longer takes dropDups
- wantIndex.DropDups = false
- }
- c.Assert(gotIndex, DeepEquals, wantIndex)
-
- // Drop created index by key or by name if a custom name was used.
- if test.index.Name == "" {
- err = coll.DropIndex(test.index.Key...)
- c.Assert(err, IsNil)
- } else {
- err = coll.DropIndexName(test.index.Name)
- c.Assert(err, IsNil)
- }
- }
-}
-
-func (s *S) TestEnsureIndexWithBadInfo(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{})
- c.Assert(err, ErrorMatches, "invalid index key:.*")
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{""}})
- c.Assert(err, ErrorMatches, "invalid index key:.*")
-}
-
-func (s *S) TestEnsureIndexWithUnsafeSession(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSafe(nil)
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"a": 1})
- c.Assert(err, IsNil)
-
- // Should fail since there are duplicated entries.
- index := mgo.Index{
- Key: []string{"a"},
- Unique: true,
- }
-
- err = coll.EnsureIndex(index)
- c.Assert(err, ErrorMatches, ".*duplicate key error.*")
-}
-
-func (s *S) TestEnsureIndexKey(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("a", "-b")
- c.Assert(err, IsNil)
-
- result1, err := findIndexByName(coll, "a_1")
- c.Assert(err, IsNil)
- c.Assert(result1.Key, DeepEquals, []string{"a"})
-
- result2, err := findIndexByName(coll, "a_1_b_-1")
- c.Assert(err, IsNil)
- c.Assert(result2.Key, DeepEquals, []string{"a", "-b"})
-}
-
-func (s *S) TestEnsureIndexDropIndex(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("-b")
- c.Assert(err, IsNil)
-
- err = coll.DropIndex("-b")
- c.Assert(err, IsNil)
-
- _, err = findIndexByName(coll, "a_1")
- c.Assert(err, IsNil)
-
- _, err = findIndexByName(coll, "b_1")
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndex("a")
- c.Assert(err, IsNil)
-
- _, err = findIndexByName(coll, "a_1")
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndex("a")
- c.Assert(err, ErrorMatches, "index not found.*")
-}
-
-func (s *S) TestEnsureIndexDropIndexName(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"b"}, Name: "a"})
- c.Assert(err, IsNil)
-
- err = coll.DropIndexName("a")
- c.Assert(err, IsNil)
-
- _, err = findIndexByName(coll, "a_1")
- c.Assert(err, IsNil)
-
- _, err = findIndexByName(coll, "a")
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndexName("a_1")
- c.Assert(err, IsNil)
-
- _, err = findIndexByName(coll, "a_1")
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = coll.DropIndexName("a_1")
- c.Assert(err, ErrorMatches, "index not found.*")
-}
-
-func (s *S) TestEnsureIndexCaching(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- // Second EnsureIndex should be cached and do nothing.
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 0)
-
- // Resetting the cache should make it contact the server again.
- session.ResetIndexCache()
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-
- // Dropping the index should also drop the cached index key.
- err = coll.DropIndex("a")
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-}
-
-func (s *S) TestEnsureIndexGetIndexes(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndexKey("-b")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- // Obsolete.
- err = coll.EnsureIndexKey("@c")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndexKey("$2d:d")
- c.Assert(err, IsNil)
-
- // Try to exercise cursor logic. 2.8.0-rc3 still ignores this.
- session.SetBatch(2)
-
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
-
- c.Assert(indexes[0].Name, Equals, "_id_")
- c.Assert(indexes[1].Name, Equals, "a_1")
- c.Assert(indexes[1].Key, DeepEquals, []string{"a"})
- c.Assert(indexes[2].Name, Equals, "b_-1")
- c.Assert(indexes[2].Key, DeepEquals, []string{"-b"})
- c.Assert(indexes[3].Name, Equals, "c_2d")
- c.Assert(indexes[3].Key, DeepEquals, []string{"$2d:c"})
- c.Assert(indexes[4].Name, Equals, "d_2d")
- c.Assert(indexes[4].Key, DeepEquals, []string{"$2d:d"})
-}
-
-func (s *S) TestEnsureIndexNameCaching(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- // Second EnsureIndex should be cached and do nothing.
- err = coll.EnsureIndexKey("a")
- c.Assert(err, IsNil)
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- stats := mgo.GetStats()
- c.Assert(stats.SentOps, Equals, 0)
-
- // Resetting the cache should make it contact the server again.
- session.ResetIndexCache()
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-
- // Dropping the index should also drop the cached index key.
- err = coll.DropIndexName("custom")
- c.Assert(err, IsNil)
-
- mgo.ResetStats()
-
- err = coll.EnsureIndex(mgo.Index{Key: []string{"a"}, Name: "custom"})
- c.Assert(err, IsNil)
-
- stats = mgo.GetStats()
- c.Assert(stats.SentOps > 0, Equals, true)
-}
-
-func (s *S) TestEnsureIndexEvalGetIndexes(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({b: -1})"}}, nil)
- c.Assert(err, IsNil)
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({a: 1})"}}, nil)
- c.Assert(err, IsNil)
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({c: -1, e: 1})"}}, nil)
- c.Assert(err, IsNil)
- err = session.Run(bson.D{{"eval", "db.getSiblingDB('mydb').mycoll.ensureIndex({d: '2d'})"}}, nil)
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
-
- c.Assert(indexes[0].Name, Equals, "_id_")
- c.Assert(indexes[1].Name, Equals, "a_1")
- c.Assert(indexes[1].Key, DeepEquals, []string{"a"})
- c.Assert(indexes[2].Name, Equals, "b_-1")
- c.Assert(indexes[2].Key, DeepEquals, []string{"-b"})
- c.Assert(indexes[3].Name, Equals, "c_-1_e_1")
- c.Assert(indexes[3].Key, DeepEquals, []string{"-c", "e"})
- if s.versionAtLeast(2, 2) {
- c.Assert(indexes[4].Name, Equals, "d_2d")
- c.Assert(indexes[4].Key, DeepEquals, []string{"$2d:d"})
- } else {
- c.Assert(indexes[4].Name, Equals, "d_")
- c.Assert(indexes[4].Key, DeepEquals, []string{"$2d:d"})
- }
-}
-
-var testTTL = flag.Bool("test-ttl", false, "test TTL collections (may take 1 minute)")
-
-func (s *S) TestEnsureIndexExpireAfter(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- session.SetSafe(nil)
-
- coll := session.DB("mydb").C("mycoll")
-
- err = coll.Insert(M{"n": 1, "t": time.Now().Add(-120 * time.Second)})
- c.Assert(err, IsNil)
- err = coll.Insert(M{"n": 2, "t": time.Now()})
- c.Assert(err, IsNil)
-
- // Should fail since there are duplicated entries.
- index := mgo.Index{
- Key: []string{"t"},
- ExpireAfter: 1 * time.Minute,
- }
-
- err = coll.EnsureIndex(index)
- c.Assert(err, IsNil)
-
- indexes, err := coll.Indexes()
- c.Assert(err, IsNil)
- c.Assert(indexes[1].Name, Equals, "t_1")
- c.Assert(indexes[1].ExpireAfter, Equals, 1*time.Minute)
-
- if *testTTL {
- worked := false
- stop := time.Now().Add(70 * time.Second)
- for time.Now().Before(stop) {
- n, err := coll.Count()
- c.Assert(err, IsNil)
- if n == 1 {
- worked = true
- break
- }
- c.Assert(n, Equals, 2)
- c.Logf("Still has 2 entries...")
- time.Sleep(1 * time.Second)
- }
- if !worked {
- c.Fatalf("TTL index didn't work")
- }
- }
-}
-
-func (s *S) TestDistinct(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- var result []int
- err = coll.Find(M{"n": M{"$gt": 2}}).Sort("n").Distinct("n", &result)
-
- sort.IntSlice(result).Sort()
- c.Assert(result, DeepEquals, []int{3, 4, 6})
-}
-
-func (s *S) TestMapReduce(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- }
- var result []struct {
- Id int "_id"
- Value int
- }
-
- info, err := coll.Find(M{"n": M{"$gt": 2}}).MapReduce(job, &result)
- c.Assert(err, IsNil)
- c.Assert(info.InputCount, Equals, 4)
- c.Assert(info.EmitCount, Equals, 4)
- c.Assert(info.OutputCount, Equals, 3)
- c.Assert(info.VerboseTime, IsNil)
-
- expected := map[int]int{3: 1, 4: 2, 6: 1}
- for _, item := range result {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
-}
-
-func (s *S) TestMapReduceFinalize(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1) }",
- Reduce: "function(key, values) { return Array.sum(values) }",
- Finalize: "function(key, count) { return {count: count} }",
- }
- var result []struct {
- Id int "_id"
- Value struct{ Count int }
- }
- _, err = coll.Find(nil).MapReduce(job, &result)
- c.Assert(err, IsNil)
-
- expected := map[int]int{1: 1, 2: 2, 3: 1, 4: 2, 6: 1}
- for _, item := range result {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value.Count, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
-}
-
-func (s *S) TestMapReduceToCollection(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Out: "mr",
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.InputCount, Equals, 7)
- c.Assert(info.EmitCount, Equals, 7)
- c.Assert(info.OutputCount, Equals, 5)
- c.Assert(info.Collection, Equals, "mr")
- c.Assert(info.Database, Equals, "mydb")
-
- expected := map[int]int{1: 1, 2: 2, 3: 1, 4: 2, 6: 1}
- var item *struct {
- Id int "_id"
- Value int
- }
- mr := session.DB("mydb").C("mr")
- iter := mr.Find(nil).Iter()
- for iter.Next(&item) {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestMapReduceToOtherDb(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Out: bson.D{{"replace", "mr"}, {"db", "otherdb"}},
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.InputCount, Equals, 7)
- c.Assert(info.EmitCount, Equals, 7)
- c.Assert(info.OutputCount, Equals, 5)
- c.Assert(info.Collection, Equals, "mr")
- c.Assert(info.Database, Equals, "otherdb")
-
- expected := map[int]int{1: 1, 2: 2, 3: 1, 4: 2, 6: 1}
- var item *struct {
- Id int "_id"
- Value int
- }
- mr := session.DB("otherdb").C("mr")
- iter := mr.Find(nil).Iter()
- for iter.Next(&item) {
- c.Logf("Item: %#v", &item)
- c.Assert(item.Value, Equals, expected[item.Id])
- expected[item.Id] = -1
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestMapReduceOutOfOrder(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Out: bson.M{"a": "a", "z": "z", "replace": "mr", "db": "otherdb", "b": "b", "y": "y"},
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.Collection, Equals, "mr")
- c.Assert(info.Database, Equals, "otherdb")
-}
-
-func (s *S) TestMapReduceScope(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- coll.Insert(M{"n": 1})
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, x); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Scope: M{"x": 42},
- }
-
- var result []bson.M
- _, err = coll.Find(nil).MapReduce(job, &result)
- c.Assert(len(result), Equals, 1)
- c.Assert(result[0]["value"], Equals, 42.0)
-}
-
-func (s *S) TestMapReduceVerbose(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 100; i++ {
- err = coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- Verbose: true,
- }
-
- info, err := coll.Find(nil).MapReduce(job, nil)
- c.Assert(err, IsNil)
- c.Assert(info.VerboseTime, NotNil)
-}
-
-func (s *S) TestMapReduceLimit(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for _, i := range []int{1, 4, 6, 2, 2, 3, 4} {
- coll.Insert(M{"n": i})
- }
-
- job := &mgo.MapReduce{
- Map: "function() { emit(this.n, 1); }",
- Reduce: "function(key, values) { return Array.sum(values); }",
- }
-
- var result []bson.M
- _, err = coll.Find(nil).Limit(3).MapReduce(job, &result)
- c.Assert(err, IsNil)
- c.Assert(len(result), Equals, 3)
-}
-
-func (s *S) TestBuildInfo(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- info, err := session.BuildInfo()
- c.Assert(err, IsNil)
-
- var v []int
- var nightly bool
- for i, a := range strings.Split(info.Version, ".") {
- if i == 2 && strings.Index(a, "-") != -1 {
- nightly = true
- a = a[:strings.Index(a, "-")]
- info.VersionArray[len(info.VersionArray)-1] = 0
- }
- n, err := strconv.Atoi(a)
- c.Assert(err, IsNil)
- if nightly {
- n += 1
- }
- v = append(v, n)
- }
- for len(v) < 4 {
- v = append(v, 0)
- }
-
- c.Assert(info.VersionArray, DeepEquals, v)
- c.Assert(info.GitVersion, Matches, "[a-z0-9]+")
-
- if s.versionAtLeast(3, 2) {
- // It was deprecated in 3.2.
- c.Assert(info.SysInfo, Equals, "")
- } else {
- c.Assert(info.SysInfo, Matches, ".*[0-9:]+.*")
- }
- if info.Bits != 32 && info.Bits != 64 {
- c.Fatalf("info.Bits is %d", info.Bits)
- }
- if info.MaxObjectSize < 8192 {
- c.Fatalf("info.MaxObjectSize seems too small: %d", info.MaxObjectSize)
- }
-}
-
-func (s *S) TestZeroTimeRoundtrip(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- var d struct{ T time.Time }
- conn := session.DB("mydb").C("mycoll")
- err = conn.Insert(d)
- c.Assert(err, IsNil)
-
- var result bson.M
- err = conn.Find(nil).One(&result)
- c.Assert(err, IsNil)
- t, isTime := result["t"].(time.Time)
- c.Assert(isTime, Equals, true)
- c.Assert(t, Equals, time.Time{})
-}
-
-func (s *S) TestFsyncLock(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- clone := session.Clone()
- defer clone.Close()
-
- err = session.FsyncLock()
- c.Assert(err, IsNil)
-
- done := make(chan time.Time)
- go func() {
- time.Sleep(3 * time.Second)
- now := time.Now()
- err := session.FsyncUnlock()
- c.Check(err, IsNil)
- done <- now
- }()
-
- err = clone.DB("mydb").C("mycoll").Insert(bson.M{"n": 1})
- unlocked := time.Now()
- unlocking := <-done
- c.Assert(err, IsNil)
-
- c.Assert(unlocked.After(unlocking), Equals, true)
-}
-
-func (s *S) TestFsync(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- // Not much to do here. Just a smoke check.
- err = session.Fsync(false)
- c.Assert(err, IsNil)
- err = session.Fsync(true)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestPipeIter(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- pipe := coll.Pipe([]M{{"$match": M{"n": M{"$gte": 42}}}})
-
- // Ensure cursor logic is working by forcing a small batch.
- pipe.Batch(2)
-
- // Smoke test for AllowDiskUse.
- pipe.AllowDiskUse()
-
- iter := pipe.Iter()
- result := struct{ N int }{}
- for i := 2; i < 7; i++ {
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.N, Equals, ns[i])
- }
-
- c.Assert(iter.Next(&result), Equals, false)
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestPipeAll(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err := coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- var result []struct{ N int }
- err = coll.Pipe([]M{{"$match": M{"n": M{"$gte": 42}}}}).All(&result)
- c.Assert(err, IsNil)
- for i := 2; i < 7; i++ {
- c.Assert(result[i-2].N, Equals, ns[i])
- }
-}
-
-func (s *S) TestPipeOne(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- result := struct{ A, B int }{}
-
- pipe := coll.Pipe([]M{{"$project": M{"a": 1, "b": M{"$add": []interface{}{"$b", 1}}}}})
- err = pipe.One(&result)
- c.Assert(err, IsNil)
- c.Assert(result.A, Equals, 1)
- c.Assert(result.B, Equals, 3)
-
- pipe = coll.Pipe([]M{{"$match": M{"a": 2}}})
- err = pipe.One(&result)
- c.Assert(err, Equals, mgo.ErrNotFound)
-}
-
-func (s *S) TestPipeExplain(c *C) {
- if !s.versionAtLeast(2, 1) {
- c.Skip("Pipe only works on 2.1+")
- }
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- coll.Insert(M{"a": 1, "b": 2})
-
- pipe := coll.Pipe([]M{{"$project": M{"a": 1, "b": M{"$add": []interface{}{"$b", 1}}}}})
-
- // The explain command result changes across versions.
- var result struct{ Ok int }
- err = pipe.Explain(&result)
- c.Assert(err, IsNil)
- c.Assert(result.Ok, Equals, 1)
-}
-
-func (s *S) TestBatch1Bug(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 3; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- var ns []struct{ N int }
- err = coll.Find(nil).Batch(1).All(&ns)
- c.Assert(err, IsNil)
- c.Assert(len(ns), Equals, 3)
-
- session.SetBatch(1)
- err = coll.Find(nil).All(&ns)
- c.Assert(err, IsNil)
- c.Assert(len(ns), Equals, 3)
-}
-
-func (s *S) TestInterfaceIterBug(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- for i := 0; i < 3; i++ {
- err := coll.Insert(M{"n": i})
- c.Assert(err, IsNil)
- }
-
- var result interface{}
-
- i := 0
- iter := coll.Find(nil).Sort("n").Iter()
- for iter.Next(&result) {
- c.Assert(result.(bson.M)["n"], Equals, i)
- i++
- }
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestFindIterCloseKillsCursor(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- cursors := serverCursorsOpen(session)
-
- coll := session.DB("mydb").C("mycoll")
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- err = coll.Insert(M{"n": n})
- c.Assert(err, IsNil)
- }
-
- iter := coll.Find(nil).Batch(2).Iter()
- c.Assert(iter.Next(bson.M{}), Equals, true)
-
- c.Assert(iter.Close(), IsNil)
- c.Assert(serverCursorsOpen(session), Equals, cursors)
-}
-
-func (s *S) TestFindIterDoneWithBatches(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- ns := []int{40, 41, 42, 43, 44, 45, 46}
- for _, n := range ns {
- coll.Insert(M{"n": n})
- }
-
- iter := coll.Find(M{"n": M{"$gte": 42}}).Sort("$natural").Prefetch(0).Batch(2).Iter()
- result := struct{ N int }{}
- for i := 2; i < 7; i++ {
- // first check will be with pending local record;
- // second will be with open cursor ID but no local
- // records
- c.Assert(iter.Done(), Equals, false)
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true, Commentf("err=%v", err))
- }
-
- c.Assert(iter.Done(), Equals, true)
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Close(), IsNil)
-}
-
-func (s *S) TestFindIterDoneErr(c *C) {
- session, err := mgo.Dial("localhost:40002")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- iter := coll.Find(nil).Iter()
-
- result := struct{}{}
- ok := iter.Next(&result)
- c.Assert(iter.Done(), Equals, true)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Err(), ErrorMatches, "unauthorized.*|not authorized.*")
-}
-
-func (s *S) TestFindIterDoneNotFound(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
-
- result := struct{ A, B int }{}
- iter := coll.Find(M{"a": 1}).Iter()
- ok := iter.Next(&result)
- c.Assert(ok, Equals, false)
- c.Assert(iter.Done(), Equals, true)
-}
-
-func (s *S) TestLogReplay(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- for i := 0; i < 5; i++ {
- err = coll.Insert(M{"ts": time.Now()})
- c.Assert(err, IsNil)
- }
-
- iter := coll.Find(nil).LogReplay().Iter()
- if s.versionAtLeast(2, 6) {
- // This used to fail in 2.4. Now it's just a smoke test.
- c.Assert(iter.Err(), IsNil)
- } else {
- c.Assert(iter.Next(bson.M{}), Equals, false)
- c.Assert(iter.Err(), ErrorMatches, "no ts field in query")
- }
-}
-
-func (s *S) TestSetCursorTimeout(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 42})
-
- // This is just a smoke test. Won't wait 10 minutes for an actual timeout.
-
- session.SetCursorTimeout(0)
-
- var result struct{ N int }
- iter := coll.Find(nil).Iter()
- c.Assert(iter.Next(&result), Equals, true)
- c.Assert(result.N, Equals, 42)
- c.Assert(iter.Next(&result), Equals, false)
-}
-
-func (s *S) TestNewIterNoServer(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- data, err := bson.Marshal(bson.M{"a": 1})
-
- coll := session.DB("mydb").C("mycoll")
- iter := coll.NewIter(nil, []bson.Raw{{3, data}}, 42, nil)
-
- var result struct{ A int }
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.A, Equals, 1)
-
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
-
- c.Assert(iter.Err(), ErrorMatches, "server not available")
-}
-
-func (s *S) TestNewIterNoServerPresetErr(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- data, err := bson.Marshal(bson.M{"a": 1})
-
- coll := session.DB("mydb").C("mycoll")
- iter := coll.NewIter(nil, []bson.Raw{{3, data}}, 42, fmt.Errorf("my error"))
-
- var result struct{ A int }
- ok := iter.Next(&result)
- c.Assert(ok, Equals, true)
- c.Assert(result.A, Equals, 1)
-
- ok = iter.Next(&result)
- c.Assert(ok, Equals, false)
-
- c.Assert(iter.Err(), ErrorMatches, "my error")
-}
-
-func (s *S) TestBypassValidation(c *C) {
- if !s.versionAtLeast(3, 2) {
- c.Skip("validation supported on 3.2+")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- err = coll.Insert(M{"n": 1})
- c.Assert(err, IsNil)
-
- err = coll.Database.Run(bson.D{
- {"collMod", "mycoll"},
- {"validator", M{"s": M{"$type": "string"}}},
- }, nil)
- c.Assert(err, IsNil)
-
- err = coll.Insert(M{"n": 2})
- c.Assert(err, ErrorMatches, "Document failed validation")
-
- err = coll.Update(M{"n": 1}, M{"n": 10})
- c.Assert(err, ErrorMatches, "Document failed validation")
-
- session.SetBypassValidation(true)
-
- err = coll.Insert(M{"n": 3})
- c.Assert(err, IsNil)
-
- err = coll.Update(M{"n": 3}, M{"n": 4})
- c.Assert(err, IsNil)
-
- // Ensure this still works. Shouldn't be affected.
- err = coll.Remove(M{"n": 1})
- c.Assert(err, IsNil)
-
- var result struct{ N int }
- var ns []int
- iter := coll.Find(nil).Iter()
- for iter.Next(&result) {
- ns = append(ns, result.N)
- }
- c.Assert(iter.Err(), IsNil)
- sort.Ints(ns)
- c.Assert(ns, DeepEquals, []int{4})
-}
-
-func (s *S) TestVersionAtLeast(c *C) {
- tests := [][][]int{
- {{3, 2, 1}, {3, 2, 0}},
- {{3, 2, 1}, {3, 2}},
- {{3, 2, 1}, {2, 5, 5, 5}},
- {{3, 2, 1}, {2, 5, 5}},
- {{3, 2, 1}, {2, 5}},
- }
- for _, pair := range tests {
- bi := mgo.BuildInfo{VersionArray: pair[0]}
- c.Assert(bi.VersionAtLeast(pair[1]...), Equals, true)
-
- bi = mgo.BuildInfo{VersionArray: pair[0]}
- c.Assert(bi.VersionAtLeast(pair[0]...), Equals, true)
-
- bi = mgo.BuildInfo{VersionArray: pair[1]}
- c.Assert(bi.VersionAtLeast(pair[1]...), Equals, true)
-
- bi = mgo.BuildInfo{VersionArray: pair[1]}
- c.Assert(bi.VersionAtLeast(pair[0]...), Equals, false)
- }
-}
-
-func (s *S) TestCollationQueries(c *C) {
- if !s.versionAtLeast(3, 3, 12) {
- c.Skip("collations being released with 3.4")
- }
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- docsToInsert := []bson.M{
- {"text_number": "010"},
- {"text_number": "2"},
- {"text_number": "10"},
- }
-
- coll := session.DB("mydb").C("mycoll")
- for _, doc := range docsToInsert {
- err = coll.Insert(doc)
- c.Assert(err, IsNil)
- }
-
- collation := &mgo.Collation{
- Locale: "en",
- NumericOrdering: true,
- }
-
- err = coll.EnsureIndex(mgo.Index{
- Key: []string{"text_number"},
- Collation: collation,
- })
- c.Assert(err, IsNil)
-
- iter := coll.Find(nil).Sort("text_number").Collation(collation).Iter()
- defer iter.Close()
- for _, expectedRes := range []string{"2", "010", "10"} {
- res := make(bson.M)
- found := iter.Next(&res)
- c.Assert(iter.Err(), IsNil)
- c.Assert(found, Equals, true)
- c.Assert(res["text_number"], Equals, expectedRes)
- }
-}
-
-// --------------------------------------------------------------------------
-// Some benchmarks that require a running database.
-
-func (s *S) BenchmarkFindIterRaw(c *C) {
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- defer session.Close()
-
- coll := session.DB("mydb").C("mycoll")
- doc := bson.D{
- {"f2", "a short string"},
- {"f3", bson.D{{"1", "one"}, {"2", 2.0}}},
- {"f4", []string{"a", "b", "c", "d", "e", "f", "g"}},
- }
-
- for i := 0; i < c.N+1; i++ {
- err := coll.Insert(doc)
- c.Assert(err, IsNil)
- }
-
- session.SetBatch(c.N)
-
- var raw bson.Raw
- iter := coll.Find(nil).Iter()
- iter.Next(&raw)
- c.ResetTimer()
- i := 0
- for iter.Next(&raw) {
- i++
- }
- c.StopTimer()
- c.Assert(iter.Err(), IsNil)
- c.Assert(i, Equals, c.N)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/suite_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/suite_test.go
deleted file mode 100644
index ad1576936c3..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/suite_test.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// mgo - MongoDB driver for Go
-//
-// Copyright (c) 2010-2012 - Gustavo Niemeyer <gustavo@niemeyer.net>
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package mgo_test
-
-import (
- "bytes"
- "errors"
- "flag"
- "fmt"
- "net"
- "os/exec"
- "runtime"
- "strconv"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/bson"
-)
-
-var fast = flag.Bool("fast", false, "Skip slow tests")
-
-type M bson.M
-
-type cLogger C
-
-func (c *cLogger) Output(calldepth int, s string) error {
- ns := time.Now().UnixNano()
- t := float64(ns%100e9) / 1e9
- ((*C)(c)).Logf("[LOG] %.05f %s", t, s)
- return nil
-}
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- session *mgo.Session
- stopped bool
- build mgo.BuildInfo
- frozen []string
-}
-
-func (s *S) versionAtLeast(v ...int) (result bool) {
- for i := range v {
- if i == len(s.build.VersionArray) {
- return false
- }
- if s.build.VersionArray[i] != v[i] {
- return s.build.VersionArray[i] >= v[i]
- }
- }
- return true
-}
-
-var _ = Suite(&S{})
-
-func (s *S) SetUpSuite(c *C) {
- mgo.SetDebug(true)
- mgo.SetStats(true)
- s.StartAll()
-
- session, err := mgo.Dial("localhost:40001")
- c.Assert(err, IsNil)
- s.build, err = session.BuildInfo()
- c.Check(err, IsNil)
- session.Close()
-}
-
-func (s *S) SetUpTest(c *C) {
- s.StartAll()
- err := run("mongo --nodb harness/mongojs/dropall.js")
- if err != nil {
- panic(err.Error())
- }
- mgo.SetLogger((*cLogger)(c))
- mgo.ResetStats()
-}
-
-func (s *S) TearDownTest(c *C) {
- if s.stopped {
- s.Stop(":40201")
- s.Stop(":40202")
- s.Stop(":40203")
- s.StartAll()
- }
- for _, host := range s.frozen {
- if host != "" {
- s.Thaw(host)
- }
- }
- var stats mgo.Stats
- for i := 0; ; i++ {
- stats = mgo.GetStats()
- if stats.SocketsInUse == 0 && stats.SocketsAlive == 0 {
- break
- }
- if i == 20 {
- c.Fatal("Test left sockets in a dirty state")
- }
- c.Logf("Waiting for sockets to die: %d in use, %d alive", stats.SocketsInUse, stats.SocketsAlive)
- time.Sleep(500 * time.Millisecond)
- }
- for i := 0; ; i++ {
- stats = mgo.GetStats()
- if stats.Clusters == 0 {
- break
- }
- if i == 60 {
- c.Fatal("Test left clusters alive")
- }
- c.Logf("Waiting for clusters to die: %d alive", stats.Clusters)
- time.Sleep(1 * time.Second)
- }
-}
-
-func (s *S) Stop(host string) {
- // Give a moment for slaves to sync and avoid getting rollback issues.
- panicOnWindows()
- time.Sleep(2 * time.Second)
- err := run("svc -d _harness/daemons/" + supvName(host))
- if err != nil {
- panic(err)
- }
- // Give a second for shutdown to finish
- time.Sleep(2 * time.Second)
- s.stopped = true
-}
-
-func (s *S) pid(host string) int {
- // Note recent releases of lsof force 'f' to be present in the output (WTF?).
- cmd := exec.Command("lsof", "-iTCP:"+hostPort(host), "-sTCP:LISTEN", "-Fpf")
- output, err := cmd.CombinedOutput()
- if err != nil {
- panic(err)
- }
- pidstr := string(bytes.Fields(output[1:])[0])
- pid, err := strconv.Atoi(pidstr)
- if err != nil {
- panic(fmt.Errorf("cannot convert pid to int: %q, command line: %q", pidstr, cmd.Args))
- }
- return pid
-}
-
-func (s *S) Freeze(host string) {
- err := stop(s.pid(host))
- if err != nil {
- panic(err)
- }
- s.frozen = append(s.frozen, host)
-}
-
-func (s *S) Thaw(host string) {
- err := cont(s.pid(host))
- if err != nil {
- panic(err)
- }
- for i, frozen := range s.frozen {
- if frozen == host {
- s.frozen[i] = ""
- }
- }
-}
-
-func (s *S) StartAll() {
- if s.stopped {
- // Restart any stopped nodes.
- run("svc -u _harness/daemons/*")
- err := run("mongo --nodb harness/mongojs/wait.js")
- if err != nil {
- panic(err)
- }
- s.stopped = false
- }
-}
-
-func run(command string) error {
- var output []byte
- var err error
- if runtime.GOOS == "windows" {
- output, err = exec.Command("cmd", "/C", command).CombinedOutput()
- } else {
- output, err = exec.Command("/bin/sh", "-c", command).CombinedOutput()
- }
-
- if err != nil {
- msg := fmt.Sprintf("Failed to execute: %s: %s\n%s", command, err.Error(), string(output))
- return errors.New(msg)
- }
- return nil
-}
-
-var supvNames = map[string]string{
- "40001": "db1",
- "40002": "db2",
- "40011": "rs1a",
- "40012": "rs1b",
- "40013": "rs1c",
- "40021": "rs2a",
- "40022": "rs2b",
- "40023": "rs2c",
- "40031": "rs3a",
- "40032": "rs3b",
- "40033": "rs3c",
- "40041": "rs4a",
- "40051": "rs5a",
- "40101": "cfg1",
- "40102": "cfg2",
- "40103": "cfg3",
- "40201": "s1",
- "40202": "s2",
- "40203": "s3",
-}
-
-// supvName returns the daemon name for the given host address.
-func supvName(host string) string {
- host, port, err := net.SplitHostPort(host)
- if err != nil {
- panic(err)
- }
- name, ok := supvNames[port]
- if !ok {
- panic("Unknown host: " + host)
- }
- return name
-}
-
-func hostPort(host string) string {
- _, port, err := net.SplitHostPort(host)
- if err != nil {
- panic(err)
- }
- return port
-}
-
-func panicOnWindows() {
- if runtime.GOOS == "windows" {
- panic("the test suite is not yet fully supported on Windows")
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_test.go
deleted file mode 100644
index b8bbd7b340f..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_test.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !windows
-
-package mgo_test
-
-import (
- "syscall"
-)
-
-func stop(pid int) (err error) {
- return syscall.Kill(pid, syscall.SIGSTOP)
-}
-
-func cont(pid int) (err error) {
- return syscall.Kill(pid, syscall.SIGCONT)
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_windows_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_windows_test.go
deleted file mode 100644
index f2deaca86ec..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/syscall_windows_test.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package mgo_test
-
-func stop(pid int) (err error) {
- panicOnWindows() // Always does.
- return nil
-}
-
-func cont(pid int) (err error) {
- panicOnWindows() // Always does.
- return nil
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/dockey_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/dockey_test.go
deleted file mode 100644
index e8dee952cf4..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/dockey_test.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package txn
-
-import (
- "sort"
-
- . "gopkg.in/check.v1"
-)
-
-type DocKeySuite struct{}
-
-var _ = Suite(&DocKeySuite{})
-
-type T struct {
- A int
- B string
-}
-
-type T2 struct {
- A int
- B string
-}
-
-type T3 struct {
- A int
- B string
-}
-
-type T4 struct {
- A int
- B string
-}
-
-type T5 struct {
- F int
- Q string
-}
-
-type T6 struct {
- A int
- B string
-}
-
-type T7 struct {
- A bool
- B float64
-}
-
-type T8 struct {
- A int
- B string
-}
-
-type T9 struct {
- A int
- B string
- C bool
-}
-
-type T10 struct {
- C int `bson:"a"`
- D string `bson:"b,omitempty"`
-}
-
-type T11 struct {
- C int
- D string
-}
-
-type T12 struct {
- S string
-}
-
-type T13 struct {
- p, q, r bool
- S string
-}
-
-var docKeysTests = [][]docKeys{
- {{
- {"c", 1},
- {"c", 5},
- {"c", 2},
- }, {
- {"c", 1},
- {"c", 2},
- {"c", 5},
- }}, {{
- {"c", "foo"},
- {"c", "bar"},
- {"c", "bob"},
- }, {
- {"c", "bar"},
- {"c", "bob"},
- {"c", "foo"},
- }}, {{
- {"c", 0.2},
- {"c", 0.07},
- {"c", 0.9},
- }, {
- {"c", 0.07},
- {"c", 0.2},
- {"c", 0.9},
- }}, {{
- {"c", true},
- {"c", false},
- {"c", true},
- }, {
- {"c", false},
- {"c", true},
- {"c", true},
- }}, {{
- {"c", T{1, "b"}},
- {"c", T{1, "a"}},
- {"c", T{0, "b"}},
- {"c", T{0, "a"}},
- }, {
- {"c", T{0, "a"}},
- {"c", T{0, "b"}},
- {"c", T{1, "a"}},
- {"c", T{1, "b"}},
- }}, {{
- {"c", T{1, "a"}},
- {"c", T{0, "a"}},
- }, {
- {"c", T{0, "a"}},
- {"c", T{1, "a"}},
- }}, {{
- {"c", T3{0, "b"}},
- {"c", T2{1, "b"}},
- {"c", T3{1, "a"}},
- {"c", T2{0, "a"}},
- }, {
- {"c", T2{0, "a"}},
- {"c", T3{0, "b"}},
- {"c", T3{1, "a"}},
- {"c", T2{1, "b"}},
- }}, {{
- {"c", T5{1, "b"}},
- {"c", T4{1, "b"}},
- {"c", T5{0, "a"}},
- {"c", T4{0, "a"}},
- }, {
- {"c", T4{0, "a"}},
- {"c", T5{0, "a"}},
- {"c", T4{1, "b"}},
- {"c", T5{1, "b"}},
- }}, {{
- {"c", T6{1, "b"}},
- {"c", T7{true, 0.2}},
- {"c", T6{0, "a"}},
- {"c", T7{false, 0.04}},
- }, {
- {"c", T6{0, "a"}},
- {"c", T6{1, "b"}},
- {"c", T7{false, 0.04}},
- {"c", T7{true, 0.2}},
- }}, {{
- {"c", T9{1, "b", true}},
- {"c", T8{1, "b"}},
- {"c", T9{0, "a", false}},
- {"c", T8{0, "a"}},
- }, {
- {"c", T9{0, "a", false}},
- {"c", T8{0, "a"}},
- {"c", T9{1, "b", true}},
- {"c", T8{1, "b"}},
- }}, {{
- {"b", 2},
- {"a", 5},
- {"c", 2},
- {"b", 1},
- }, {
- {"a", 5},
- {"b", 1},
- {"b", 2},
- {"c", 2},
- }}, {{
- {"c", T11{1, "a"}},
- {"c", T11{1, "a"}},
- {"c", T10{1, "a"}},
- }, {
- {"c", T10{1, "a"}},
- {"c", T11{1, "a"}},
- {"c", T11{1, "a"}},
- }}, {{
- {"c", T12{"a"}},
- {"c", T13{false, true, false, "a"}},
- {"c", T12{"b"}},
- {"c", T13{false, true, false, "b"}},
- }, {
- {"c", T12{"a"}},
- {"c", T13{false, true, false, "a"}},
- {"c", T12{"b"}},
- {"c", T13{false, true, false, "b"}},
- }},
-}
-
-func (s *DocKeySuite) TestSort(c *C) {
- for _, test := range docKeysTests {
- keys := test[0]
- expected := test[1]
- sort.Sort(keys)
- c.Check(keys, DeepEquals, expected)
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/sim_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/sim_test.go
deleted file mode 100644
index a369ded7c31..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/sim_test.go
+++ /dev/null
@@ -1,388 +0,0 @@
-package txn_test
-
-import (
- "flag"
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/bson"
- "gopkg.in/mgo.v2/dbtest"
- "gopkg.in/mgo.v2/txn"
- . "gopkg.in/check.v1"
- "math/rand"
- "time"
-)
-
-var (
- duration = flag.Duration("duration", 200*time.Millisecond, "duration for each simulation")
- seed = flag.Int64("seed", 0, "seed for rand")
-)
-
-type params struct {
- killChance float64
- slowdownChance float64
- slowdown time.Duration
-
- unsafe bool
- workers int
- accounts int
- changeHalf bool
- reinsertCopy bool
- reinsertZeroed bool
- changelog bool
-
- changes int
-}
-
-func (s *S) TestSim1Worker(c *C) {
- simulate(c, &s.server, params{
- workers: 1,
- accounts: 4,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSim4WorkersDense(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 2,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSim4WorkersSparse(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 10,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimHalf1Worker(c *C) {
- simulate(c, &s.server, params{
- workers: 1,
- accounts: 4,
- changeHalf: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimHalf4WorkersDense(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 2,
- changeHalf: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimHalf4WorkersSparse(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 10,
- changeHalf: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertCopy1Worker(c *C) {
- simulate(c, &s.server, params{
- workers: 1,
- accounts: 10,
- reinsertCopy: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertCopy4Workers(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 10,
- reinsertCopy: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertZeroed1Worker(c *C) {
- simulate(c, &s.server, params{
- workers: 1,
- accounts: 10,
- reinsertZeroed: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimReinsertZeroed4Workers(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 10,
- reinsertZeroed: true,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- })
-}
-
-func (s *S) TestSimChangeLog(c *C) {
- simulate(c, &s.server, params{
- workers: 4,
- accounts: 10,
- killChance: 0.01,
- slowdownChance: 0.3,
- slowdown: 100 * time.Millisecond,
- changelog: true,
- })
-}
-
-type balanceChange struct {
- id bson.ObjectId
- origin int
- target int
- amount int
-}
-
-func simulate(c *C, server *dbtest.DBServer, params params) {
- seed := *seed
- if seed == 0 {
- seed = time.Now().UnixNano()
- }
- rand.Seed(seed)
- c.Logf("Seed: %v", seed)
-
- txn.SetChaos(txn.Chaos{
- KillChance: params.killChance,
- SlowdownChance: params.slowdownChance,
- Slowdown: params.slowdown,
- })
- defer txn.SetChaos(txn.Chaos{})
-
- session := server.Session()
- defer session.Close()
-
- db := session.DB("test")
- tc := db.C("tc")
-
- runner := txn.NewRunner(tc)
-
- tclog := db.C("tc.log")
- if params.changelog {
- info := mgo.CollectionInfo{
- Capped: true,
- MaxBytes: 1000000,
- }
- err := tclog.Create(&info)
- c.Assert(err, IsNil)
- runner.ChangeLog(tclog)
- }
-
- accounts := db.C("accounts")
- for i := 0; i < params.accounts; i++ {
- err := accounts.Insert(M{"_id": i, "balance": 300})
- c.Assert(err, IsNil)
- }
- var stop time.Time
- if params.changes <= 0 {
- stop = time.Now().Add(*duration)
- }
-
- max := params.accounts
- if params.reinsertCopy || params.reinsertZeroed {
- max = int(float64(params.accounts) * 1.5)
- }
-
- changes := make(chan balanceChange, 1024)
-
- //session.SetMode(mgo.Eventual, true)
- for i := 0; i < params.workers; i++ {
- go func() {
- n := 0
- for {
- if n > 0 && n == params.changes {
- break
- }
- if !stop.IsZero() && time.Now().After(stop) {
- break
- }
-
- change := balanceChange{
- id: bson.NewObjectId(),
- origin: rand.Intn(max),
- target: rand.Intn(max),
- amount: 100,
- }
-
- var old Account
- var oldExists bool
- if params.reinsertCopy || params.reinsertZeroed {
- if err := accounts.FindId(change.origin).One(&old); err != mgo.ErrNotFound {
- c.Check(err, IsNil)
- change.amount = old.Balance
- oldExists = true
- }
- }
-
- var ops []txn.Op
- switch {
- case params.reinsertCopy && oldExists:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": change.amount},
- Remove: true,
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocMissing,
- Insert: M{"balance": change.amount},
- }}
- case params.reinsertZeroed && oldExists:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.target,
- Assert: txn.DocMissing,
- Insert: M{"balance": 0},
- }, {
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": change.amount},
- Remove: true,
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocExists,
- Update: M{"$inc": M{"balance": change.amount}},
- }}
- case params.changeHalf:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": M{"$gte": change.amount}},
- Update: M{"$inc": M{"balance": -change.amount / 2}},
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocExists,
- Update: M{"$inc": M{"balance": change.amount / 2}},
- }, {
- C: "accounts",
- Id: change.origin,
- Update: M{"$inc": M{"balance": -change.amount / 2}},
- }, {
- C: "accounts",
- Id: change.target,
- Update: M{"$inc": M{"balance": change.amount / 2}},
- }}
- default:
- ops = []txn.Op{{
- C: "accounts",
- Id: change.origin,
- Assert: M{"balance": M{"$gte": change.amount}},
- Update: M{"$inc": M{"balance": -change.amount}},
- }, {
- C: "accounts",
- Id: change.target,
- Assert: txn.DocExists,
- Update: M{"$inc": M{"balance": change.amount}},
- }}
- }
-
- err := runner.Run(ops, change.id, nil)
- if err != nil && err != txn.ErrAborted && err != txn.ErrChaos {
- c.Check(err, IsNil)
- }
- n++
- changes <- change
- }
- changes <- balanceChange{}
- }()
- }
-
- alive := params.workers
- changeLog := make([]balanceChange, 0, 1024)
- for alive > 0 {
- change := <-changes
- if change.id == "" {
- alive--
- } else {
- changeLog = append(changeLog, change)
- }
- }
- c.Check(len(changeLog), Not(Equals), 0, Commentf("No operations were even attempted."))
-
- txn.SetChaos(txn.Chaos{})
- err := runner.ResumeAll()
- c.Assert(err, IsNil)
-
- n, err := accounts.Count()
- c.Check(err, IsNil)
- c.Check(n, Equals, params.accounts, Commentf("Number of accounts has changed."))
-
- n, err = accounts.Find(M{"balance": M{"$lt": 0}}).Count()
- c.Check(err, IsNil)
- c.Check(n, Equals, 0, Commentf("There are %d accounts with negative balance.", n))
-
- globalBalance := 0
- iter := accounts.Find(nil).Iter()
- account := Account{}
- for iter.Next(&account) {
- globalBalance += account.Balance
- }
- c.Check(iter.Close(), IsNil)
- c.Check(globalBalance, Equals, params.accounts*300, Commentf("Total amount of money should be constant."))
-
- // Compute and verify the exact final state of all accounts.
- balance := make(map[int]int)
- for i := 0; i < params.accounts; i++ {
- balance[i] += 300
- }
- var applied, aborted int
- for _, change := range changeLog {
- err := runner.Resume(change.id)
- if err == txn.ErrAborted {
- aborted++
- continue
- } else if err != nil {
- c.Fatalf("resuming %s failed: %v", change.id, err)
- }
- balance[change.origin] -= change.amount
- balance[change.target] += change.amount
- applied++
- }
- iter = accounts.Find(nil).Iter()
- for iter.Next(&account) {
- c.Assert(account.Balance, Equals, balance[account.Id])
- }
- c.Check(iter.Close(), IsNil)
- c.Logf("Total transactions: %d (%d applied, %d aborted)", len(changeLog), applied, aborted)
-
- if params.changelog {
- n, err := tclog.Count()
- c.Assert(err, IsNil)
- // Check if the capped collection is full.
- dummy := make([]byte, 1024)
- tclog.Insert(M{"_id": bson.NewObjectId(), "dummy": dummy})
- m, err := tclog.Count()
- c.Assert(err, IsNil)
- if m == n+1 {
- // Wasn't full, so it must have seen it all.
- c.Assert(err, IsNil)
- c.Assert(n, Equals, applied)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/tarjan_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/tarjan_test.go
deleted file mode 100644
index 79745c39be6..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/tarjan_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package txn
-
-import (
- "fmt"
- "gopkg.in/mgo.v2/bson"
- . "gopkg.in/check.v1"
-)
-
-type TarjanSuite struct{}
-
-var _ = Suite(TarjanSuite{})
-
-func bid(n int) bson.ObjectId {
- return bson.ObjectId(fmt.Sprintf("%024d", n))
-}
-
-func bids(ns ...int) (ids []bson.ObjectId) {
- for _, n := range ns {
- ids = append(ids, bid(n))
- }
- return
-}
-
-func (TarjanSuite) TestExample(c *C) {
- successors := map[bson.ObjectId][]bson.ObjectId{
- bid(1): bids(2, 3),
- bid(2): bids(1, 5),
- bid(3): bids(4),
- bid(4): bids(3, 5),
- bid(5): bids(6),
- bid(6): bids(7),
- bid(7): bids(8),
- bid(8): bids(6, 9),
- bid(9): bids(),
- }
-
- c.Assert(tarjanSort(successors), DeepEquals, [][]bson.ObjectId{
- bids(9),
- bids(6, 7, 8),
- bids(5),
- bids(3, 4),
- bids(1, 2),
- })
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/txn_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/txn_test.go
deleted file mode 100644
index 12923ca1209..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/mgo.v2/txn/txn_test.go
+++ /dev/null
@@ -1,778 +0,0 @@
-package txn_test
-
-import (
- "flag"
- "fmt"
- "sync"
- "testing"
- "time"
-
- . "gopkg.in/check.v1"
- "gopkg.in/mgo.v2"
- "gopkg.in/mgo.v2/bson"
- "gopkg.in/mgo.v2/dbtest"
- "gopkg.in/mgo.v2/txn"
-)
-
-func TestAll(t *testing.T) {
- TestingT(t)
-}
-
-type S struct {
- server dbtest.DBServer
- session *mgo.Session
- db *mgo.Database
- tc, sc *mgo.Collection
- accounts *mgo.Collection
- runner *txn.Runner
-}
-
-var _ = Suite(&S{})
-
-type M map[string]interface{}
-
-func (s *S) SetUpSuite(c *C) {
- s.server.SetPath(c.MkDir())
-}
-
-func (s *S) TearDownSuite(c *C) {
- s.server.Stop()
-}
-
-func (s *S) SetUpTest(c *C) {
- s.server.Wipe()
-
- txn.SetChaos(txn.Chaos{})
- txn.SetLogger(c)
- txn.SetDebug(true)
-
- s.session = s.server.Session()
- s.db = s.session.DB("test")
- s.tc = s.db.C("tc")
- s.sc = s.db.C("tc.stash")
- s.accounts = s.db.C("accounts")
- s.runner = txn.NewRunner(s.tc)
-}
-
-func (s *S) TearDownTest(c *C) {
- txn.SetLogger(nil)
- txn.SetDebug(false)
- s.session.Close()
-}
-
-type Account struct {
- Id int `bson:"_id"`
- Balance int
-}
-
-func (s *S) TestDocExists(c *C) {
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- exists := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: txn.DocExists,
- }}
- missing := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: txn.DocMissing,
- }}
-
- err = s.runner.Run(exists, "", nil)
- c.Assert(err, IsNil)
- err = s.runner.Run(missing, "", nil)
- c.Assert(err, Equals, txn.ErrAborted)
-
- err = s.accounts.RemoveId(0)
- c.Assert(err, IsNil)
-
- err = s.runner.Run(exists, "", nil)
- c.Assert(err, Equals, txn.ErrAborted)
- err = s.runner.Run(missing, "", nil)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestInsert(c *C) {
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 200},
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-
- ops[0].Id = 1
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(1).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 200)
-}
-
-func (s *S) TestInsertStructID(c *C) {
- type id struct {
- FirstName string
- LastName string
- }
- ops := []txn.Op{{
- C: "accounts",
- Id: id{FirstName: "John", LastName: "Jones"},
- Assert: txn.DocMissing,
- Insert: M{"balance": 200},
- }, {
- C: "accounts",
- Id: id{FirstName: "Sally", LastName: "Smith"},
- Assert: txn.DocMissing,
- Insert: M{"balance": 800},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- n, err := s.accounts.Find(nil).Count()
- c.Assert(err, IsNil)
- c.Assert(n, Equals, 2)
-}
-
-func (s *S) TestRemove(c *C) {
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Remove: true,
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(0).One(nil)
- c.Assert(err, Equals, mgo.ErrNotFound)
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-}
-
-func (s *S) TestUpdate(c *C) {
- var err error
- err = s.accounts.Insert(M{"_id": 0, "balance": 200})
- c.Assert(err, IsNil)
- err = s.accounts.Insert(M{"_id": 1, "balance": 200})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-
- ops[0].Id = 1
-
- err = s.accounts.FindId(1).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 200)
-}
-
-func (s *S) TestInsertUpdate(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 200},
- }, {
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 400)
-}
-
-func (s *S) TestUpdateInsert(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }, {
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 200},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 200)
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-}
-
-func (s *S) TestInsertRemoveInsert(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 200},
- }, {
- C: "accounts",
- Id: 0,
- Remove: true,
- }, {
- C: "accounts",
- Id: 0,
- Insert: M{"_id": 0, "balance": 300},
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-}
-
-func (s *S) TestQueueStashing(c *C) {
- txn.SetChaos(txn.Chaos{
- KillChance: 1,
- Breakpoint: "set-applying",
- })
-
- opses := [][]txn.Op{{{
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 100},
- }}, {{
- C: "accounts",
- Id: 0,
- Remove: true,
- }}, {{
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 200},
- }}, {{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}}
-
- var last bson.ObjectId
- for _, ops := range opses {
- last = bson.NewObjectId()
- err := s.runner.Run(ops, last, nil)
- c.Assert(err, Equals, txn.ErrChaos)
- }
-
- txn.SetChaos(txn.Chaos{})
- err := s.runner.Resume(last)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 300)
-}
-
-func (s *S) TestInfo(c *C) {
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: txn.DocMissing,
- }}
-
- id := bson.NewObjectId()
- err := s.runner.Run(ops, id, M{"n": 42})
- c.Assert(err, IsNil)
-
- var t struct{ I struct{ N int } }
- err = s.tc.FindId(id).One(&t)
- c.Assert(err, IsNil)
- c.Assert(t.I.N, Equals, 42)
-}
-
-func (s *S) TestErrors(c *C) {
- doc := bson.M{"foo": 1}
- tests := []txn.Op{{
- C: "c",
- Id: 0,
- }, {
- C: "c",
- Id: 0,
- Insert: doc,
- Remove: true,
- }, {
- C: "c",
- Id: 0,
- Insert: doc,
- Update: doc,
- }, {
- C: "c",
- Id: 0,
- Update: doc,
- Remove: true,
- }, {
- C: "c",
- Assert: doc,
- }, {
- Id: 0,
- Assert: doc,
- }}
-
- txn.SetChaos(txn.Chaos{KillChance: 1.0})
- for _, op := range tests {
- c.Logf("op: %v", op)
- err := s.runner.Run([]txn.Op{op}, "", nil)
- c.Assert(err, ErrorMatches, "error in transaction op 0: .*")
- }
-}
-
-func (s *S) TestAssertNestedOr(c *C) {
- // Assert uses $or internally. Ensure nesting works.
- err := s.accounts.Insert(M{"_id": 0, "balance": 300})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Assert: bson.D{{"$or", []bson.D{{{"balance", 100}}, {{"balance", 300}}}}},
- Update: bson.D{{"$inc", bson.D{{"balance", 100}}}},
- }}
-
- err = s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var account Account
- err = s.accounts.FindId(0).One(&account)
- c.Assert(err, IsNil)
- c.Assert(account.Balance, Equals, 400)
-}
-
-func (s *S) TestVerifyFieldOrdering(c *C) {
- // Used to have a map in certain operations, which means
- // the ordering of fields would be messed up.
- fields := bson.D{{"a", 1}, {"b", 2}, {"c", 3}}
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Insert: fields,
- }}
-
- err := s.runner.Run(ops, "", nil)
- c.Assert(err, IsNil)
-
- var d bson.D
- err = s.accounts.FindId(0).One(&d)
- c.Assert(err, IsNil)
-
- var filtered bson.D
- for _, e := range d {
- switch e.Name {
- case "a", "b", "c":
- filtered = append(filtered, e)
- }
- }
- c.Assert(filtered, DeepEquals, fields)
-}
-
-func (s *S) TestChangeLog(c *C) {
- chglog := s.db.C("chglog")
- s.runner.ChangeLog(chglog)
-
- ops := []txn.Op{{
- C: "debts",
- Id: 0,
- Assert: txn.DocMissing,
- }, {
- C: "accounts",
- Id: 0,
- Insert: M{"balance": 300},
- }, {
- C: "accounts",
- Id: 1,
- Insert: M{"balance": 300},
- }, {
- C: "people",
- Id: "joe",
- Insert: M{"accounts": []int64{0, 1}},
- }}
- id := bson.NewObjectId()
- err := s.runner.Run(ops, id, nil)
- c.Assert(err, IsNil)
-
- type IdList []interface{}
- type Log struct {
- Docs IdList "d"
- Revnos []int64 "r"
- }
- var m map[string]*Log
- err = chglog.FindId(id).One(&m)
- c.Assert(err, IsNil)
-
- c.Assert(m["accounts"], DeepEquals, &Log{IdList{0, 1}, []int64{2, 2}})
- c.Assert(m["people"], DeepEquals, &Log{IdList{"joe"}, []int64{2}})
- c.Assert(m["debts"], IsNil)
-
- ops = []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }, {
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 100}},
- }}
- id = bson.NewObjectId()
- err = s.runner.Run(ops, id, nil)
- c.Assert(err, IsNil)
-
- m = nil
- err = chglog.FindId(id).One(&m)
- c.Assert(err, IsNil)
-
- c.Assert(m["accounts"], DeepEquals, &Log{IdList{0, 1}, []int64{3, 3}})
- c.Assert(m["people"], IsNil)
-
- ops = []txn.Op{{
- C: "accounts",
- Id: 0,
- Remove: true,
- }, {
- C: "people",
- Id: "joe",
- Remove: true,
- }}
- id = bson.NewObjectId()
- err = s.runner.Run(ops, id, nil)
- c.Assert(err, IsNil)
-
- m = nil
- err = chglog.FindId(id).One(&m)
- c.Assert(err, IsNil)
-
- c.Assert(m["accounts"], DeepEquals, &Log{IdList{0}, []int64{-4}})
- c.Assert(m["people"], DeepEquals, &Log{IdList{"joe"}, []int64{-3}})
-}
-
-func (s *S) TestPurgeMissing(c *C) {
- txn.SetChaos(txn.Chaos{
- KillChance: 1,
- Breakpoint: "set-applying",
- })
-
- err := s.accounts.Insert(M{"_id": 0, "balance": 100})
- c.Assert(err, IsNil)
- err = s.accounts.Insert(M{"_id": 1, "balance": 100})
- c.Assert(err, IsNil)
-
- ops1 := []txn.Op{{
- C: "accounts",
- Id: 3,
- Insert: M{"balance": 100},
- }}
-
- ops2 := []txn.Op{{
- C: "accounts",
- Id: 0,
- Remove: true,
- }, {
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 100}},
- }, {
- C: "accounts",
- Id: 2,
- Insert: M{"balance": 100},
- }}
-
- first := bson.NewObjectId()
- c.Logf("---- Running ops1 under transaction %q, to be canceled by chaos", first.Hex())
- err = s.runner.Run(ops1, first, nil)
- c.Assert(err, Equals, txn.ErrChaos)
-
- last := bson.NewObjectId()
- c.Logf("---- Running ops2 under transaction %q, to be canceled by chaos", last.Hex())
- err = s.runner.Run(ops2, last, nil)
- c.Assert(err, Equals, txn.ErrChaos)
-
- c.Logf("---- Removing transaction %q", last.Hex())
- err = s.tc.RemoveId(last)
- c.Assert(err, IsNil)
-
- c.Logf("---- Disabling chaos and attempting to resume all")
- txn.SetChaos(txn.Chaos{})
- err = s.runner.ResumeAll()
- c.Assert(err, IsNil)
-
- again := bson.NewObjectId()
- c.Logf("---- Running ops2 again under transaction %q, to fail for missing transaction", again.Hex())
- err = s.runner.Run(ops2, again, nil)
- c.Assert(err, ErrorMatches, "cannot find transaction .*")
-
- c.Logf("---- Purging missing transactions")
- err = s.runner.PurgeMissing("accounts")
- c.Assert(err, IsNil)
-
- c.Logf("---- Resuming pending transactions")
- err = s.runner.ResumeAll()
- c.Assert(err, IsNil)
-
- expect := []struct{ Id, Balance int }{
- {0, -1},
- {1, 200},
- {2, 100},
- {3, 100},
- }
- var got Account
- for _, want := range expect {
- err = s.accounts.FindId(want.Id).One(&got)
- if want.Balance == -1 {
- if err != mgo.ErrNotFound {
- c.Errorf("Account %d should not exist, find got err=%#v", err)
- }
- } else if err != nil {
- c.Errorf("Account %d should have balance of %d, but wasn't found", want.Id, want.Balance)
- } else if got.Balance != want.Balance {
- c.Errorf("Account %d should have balance of %d, got %d", want.Id, want.Balance, got.Balance)
- }
- }
-}
-
-func (s *S) TestTxnQueueStashStressTest(c *C) {
- txn.SetChaos(txn.Chaos{
- SlowdownChance: 0.3,
- Slowdown: 50 * time.Millisecond,
- })
- defer txn.SetChaos(txn.Chaos{})
-
- // So we can run more iterations of the test in less time.
- txn.SetDebug(false)
-
- const runners = 10
- const inserts = 10
- const repeat = 100
-
- for r := 0; r < repeat; r++ {
- var wg sync.WaitGroup
- wg.Add(runners)
- for i := 0; i < runners; i++ {
- go func(i, r int) {
- defer wg.Done()
-
- session := s.session.New()
- defer session.Close()
- runner := txn.NewRunner(s.tc.With(session))
-
- for j := 0; j < inserts; j++ {
- ops := []txn.Op{{
- C: "accounts",
- Id: fmt.Sprintf("insert-%d-%d", r, j),
- Insert: bson.M{
- "added-by": i,
- },
- }}
- err := runner.Run(ops, "", nil)
- if err != txn.ErrAborted {
- c.Check(err, IsNil)
- }
- }
- }(i, r)
- }
- wg.Wait()
- }
-}
-
-func (s *S) TestPurgeMissingPipelineSizeLimit(c *C) {
- // This test ensures that PurgeMissing can handle very large
- // txn-queue fields. Previous iterations of PurgeMissing would
- // trigger a 16MB aggregation pipeline result size limit when run
- // against a documents or stashes with large numbers of txn-queue
- // entries. PurgeMissing now no longer uses aggregation pipelines
- // to work around this limit.
-
- // The pipeline result size limitation was removed from MongoDB in 2.6 so
- // this test is only run for older MongoDB version.
- build, err := s.session.BuildInfo()
- c.Assert(err, IsNil)
- if build.VersionAtLeast(2, 6) {
- c.Skip("This tests a problem that can only happen with MongoDB < 2.6 ")
- }
-
- // Insert a single document to work with.
- err = s.accounts.Insert(M{"_id": 0, "balance": 100})
- c.Assert(err, IsNil)
-
- ops := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 100}},
- }}
-
- // Generate one successful transaction.
- good := bson.NewObjectId()
- c.Logf("---- Running ops under transaction %q", good.Hex())
- err = s.runner.Run(ops, good, nil)
- c.Assert(err, IsNil)
-
- // Generate another transaction which which will go missing.
- missing := bson.NewObjectId()
- c.Logf("---- Running ops under transaction %q (which will go missing)", missing.Hex())
- err = s.runner.Run(ops, missing, nil)
- c.Assert(err, IsNil)
-
- err = s.tc.RemoveId(missing)
- c.Assert(err, IsNil)
-
- // Generate a txn-queue on the test document that's large enough
- // that it used to cause PurgeMissing to exceed MongoDB's pipeline
- // result 16MB size limit (MongoDB 2.4 and older only).
- //
- // The contents of the txn-queue field doesn't matter, only that
- // it's big enough to trigger the size limit. The required size
- // can also be achieved by using multiple documents as long as the
- // cumulative size of all the txn-queue fields exceeds the
- // pipeline limit. A single document is easier to work with for
- // this test however.
- //
- // The txn id of the successful transaction is used fill the
- // txn-queue because this takes advantage of a short circuit in
- // PurgeMissing, dramatically speeding up the test run time.
- const fakeQueueLen = 250000
- fakeTxnQueue := make([]string, fakeQueueLen)
- token := good.Hex() + "_12345678" // txn id + nonce
- for i := 0; i < fakeQueueLen; i++ {
- fakeTxnQueue[i] = token
- }
-
- err = s.accounts.UpdateId(0, bson.M{
- "$set": bson.M{"txn-queue": fakeTxnQueue},
- })
- c.Assert(err, IsNil)
-
- // PurgeMissing could hit the same pipeline result size limit when
- // processing the txn-queue fields of stash documents so insert
- // the large txn-queue there too to ensure that no longer happens.
- err = s.sc.Insert(
- bson.D{{"c", "accounts"}, {"id", 0}},
- bson.M{"txn-queue": fakeTxnQueue},
- )
- c.Assert(err, IsNil)
-
- c.Logf("---- Purging missing transactions")
- err = s.runner.PurgeMissing("accounts")
- c.Assert(err, IsNil)
-}
-
-var flaky = flag.Bool("flaky", false, "Include flaky tests")
-
-func (s *S) TestTxnQueueStressTest(c *C) {
- // This fails about 20% of the time on Mongo 3.2 (I haven't tried
- // other versions) with account balance being 3999 instead of
- // 4000. That implies that some updates are being lost. This is
- // bad and we'll need to chase it down in the near future - the
- // only reason it's being skipped now is that it's already failing
- // and it's better to have the txn tests running without this one
- // than to have them not running at all.
- if !*flaky {
- c.Skip("Fails intermittently - disabling until fixed")
- }
- txn.SetChaos(txn.Chaos{
- SlowdownChance: 0.3,
- Slowdown: 50 * time.Millisecond,
- })
- defer txn.SetChaos(txn.Chaos{})
-
- // So we can run more iterations of the test in less time.
- txn.SetDebug(false)
-
- err := s.accounts.Insert(M{"_id": 0, "balance": 0}, M{"_id": 1, "balance": 0})
- c.Assert(err, IsNil)
-
- // Run half of the operations changing account 0 and then 1,
- // and the other half in the opposite order.
- ops01 := []txn.Op{{
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 1}},
- }, {
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 1}},
- }}
-
- ops10 := []txn.Op{{
- C: "accounts",
- Id: 1,
- Update: M{"$inc": M{"balance": 1}},
- }, {
- C: "accounts",
- Id: 0,
- Update: M{"$inc": M{"balance": 1}},
- }}
-
- ops := [][]txn.Op{ops01, ops10}
-
- const runners = 4
- const changes = 1000
-
- var wg sync.WaitGroup
- wg.Add(runners)
- for n := 0; n < runners; n++ {
- n := n
- go func() {
- defer wg.Done()
- for i := 0; i < changes; i++ {
- err = s.runner.Run(ops[n%2], "", nil)
- c.Assert(err, IsNil)
- }
- }()
- }
- wg.Wait()
-
- for id := 0; id < 2; id++ {
- var account Account
- err = s.accounts.FindId(id).One(&account)
- if account.Balance != runners*changes {
- c.Errorf("Account should have balance of %d, got %d", runners*changes, account.Balance)
- }
- }
-}
diff --git a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/tomb.v2/tomb_test.go b/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/tomb.v2/tomb_test.go
deleted file mode 100644
index a1064dffe65..00000000000
--- a/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/gopkg.in/tomb.v2/tomb_test.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package tomb_test
-
-import (
- "errors"
- "gopkg.in/tomb.v2"
- "reflect"
- "testing"
-)
-
-func nothing() error { return nil }
-
-func TestNewTomb(t *testing.T) {
- tb := &tomb.Tomb{}
- checkState(t, tb, false, false, tomb.ErrStillAlive)
-}
-
-func TestGo(t *testing.T) {
- tb := &tomb.Tomb{}
- alive := make(chan bool)
- tb.Go(func() error {
- alive <- true
- tb.Go(func() error {
- alive <- true
- <-tb.Dying()
- return nil
- })
- <-tb.Dying()
- return nil
- })
- <-alive
- <-alive
- checkState(t, tb, false, false, tomb.ErrStillAlive)
- tb.Kill(nil)
- tb.Wait()
- checkState(t, tb, true, true, nil)
-}
-
-func TestGoErr(t *testing.T) {
- first := errors.New("first error")
- second := errors.New("first error")
- tb := &tomb.Tomb{}
- alive := make(chan bool)
- tb.Go(func() error {
- alive <- true
- tb.Go(func() error {
- alive <- true
- return first
- })
- <-tb.Dying()
- return second
- })
- <-alive
- <-alive
- tb.Wait()
- checkState(t, tb, true, true, first)
-}
-
-func TestGoPanic(t *testing.T) {
- // ErrDying being used properly, after a clean death.
- tb := &tomb.Tomb{}
- tb.Go(nothing)
- tb.Wait()
- defer func() {
- err := recover()
- if err != "tomb.Go called after all goroutines terminated" {
- t.Fatalf("Wrong panic on post-death tomb.Go call: %v", err)
- }
- checkState(t, tb, true, true, nil)
- }()
- tb.Go(nothing)
-}
-
-func TestKill(t *testing.T) {
- // a nil reason flags the goroutine as dying
- tb := &tomb.Tomb{}
- tb.Kill(nil)
- checkState(t, tb, true, false, nil)
-
- // a non-nil reason now will override Kill
- err := errors.New("some error")
- tb.Kill(err)
- checkState(t, tb, true, false, err)
-
- // another non-nil reason won't replace the first one
- tb.Kill(errors.New("ignore me"))
- checkState(t, tb, true, false, err)
-
- tb.Go(nothing)
- tb.Wait()
- checkState(t, tb, true, true, err)
-}
-
-func TestKillf(t *testing.T) {
- tb := &tomb.Tomb{}
-
- err := tb.Killf("BO%s", "OM")
- if s := err.Error(); s != "BOOM" {
- t.Fatalf(`Killf("BO%s", "OM"): want "BOOM", got %q`, s)
- }
- checkState(t, tb, true, false, err)
-
- // another non-nil reason won't replace the first one
- tb.Killf("ignore me")
- checkState(t, tb, true, false, err)
-
- tb.Go(nothing)
- tb.Wait()
- checkState(t, tb, true, true, err)
-}
-
-func TestErrDying(t *testing.T) {
- // ErrDying being used properly, after a clean death.
- tb := &tomb.Tomb{}
- tb.Kill(nil)
- tb.Kill(tomb.ErrDying)
- checkState(t, tb, true, false, nil)
-
- // ErrDying being used properly, after an errorful death.
- err := errors.New("some error")
- tb.Kill(err)
- tb.Kill(tomb.ErrDying)
- checkState(t, tb, true, false, err)
-
- // ErrDying being used badly, with an alive tomb.
- tb = &tomb.Tomb{}
- defer func() {
- err := recover()
- if err != "tomb: Kill with ErrDying while still alive" {
- t.Fatalf("Wrong panic on Kill(ErrDying): %v", err)
- }
- checkState(t, tb, false, false, tomb.ErrStillAlive)
- }()
- tb.Kill(tomb.ErrDying)
-}
-
-func TestKillErrStillAlivePanic(t *testing.T) {
- tb := &tomb.Tomb{}
- defer func() {
- err := recover()
- if err != "tomb: Kill with ErrStillAlive" {
- t.Fatalf("Wrong panic on Kill(ErrStillAlive): %v", err)
- }
- checkState(t, tb, false, false, tomb.ErrStillAlive)
- }()
- tb.Kill(tomb.ErrStillAlive)
-}
-
-func checkState(t *testing.T, tb *tomb.Tomb, wantDying, wantDead bool, wantErr error) {
- select {
- case <-tb.Dying():
- if !wantDying {
- t.Error("<-Dying: should block")
- }
- default:
- if wantDying {
- t.Error("<-Dying: should not block")
- }
- }
- seemsDead := false
- select {
- case <-tb.Dead():
- if !wantDead {
- t.Error("<-Dead: should block")
- }
- seemsDead = true
- default:
- if wantDead {
- t.Error("<-Dead: should not block")
- }
- }
- if err := tb.Err(); err != wantErr {
- t.Errorf("Err: want %#v, got %#v", wantErr, err)
- }
- if wantDead && seemsDead {
- waitErr := tb.Wait()
- switch {
- case waitErr == tomb.ErrStillAlive:
- t.Errorf("Wait should not return ErrStillAlive")
- case !reflect.DeepEqual(waitErr, wantErr):
- t.Errorf("Wait: want %#v, got %#v", wantErr, waitErr)
- }
- }
-}