<commit_before>//
//  Value+Comparing.swift
//  BSON
//
//  Created by <NAME> on 18-04-16.
//
//

import Foundation

extension Value : Equatable {}

public func ==(lhs: Value, rhs: Value) -> Bool {
    switch (lhs, rhs) {
    case (.double(_), _):
        return lhs.double == rhs.double
    case (.string(_), _):
        return lhs.string == rhs.string
    case (.document(_), _), (.array(_), _):
        return lhs.document == rhs.document
    case (.binary(let subtype1, let data1), .binary(let subtype2, let data2)):
        return subtype1.rawValue == subtype2.rawValue && data1 == data2
    case (.objectId(_), .objectId(_)):
        return lhs.bytes == rhs.bytes
    case (.boolean(let val1), .boolean(let val2)):
        return val1 == val2
    case (.dateTime(let val1), .dateTime(let val2)):
        return val1 == val2
    case (.regularExpression(let exp1, let opt1), .regularExpression(let exp2, let opt2)):
        return exp1 == exp2 && opt1 == opt2
    case (.javascriptCode(let code1), .javascriptCode(let code2)):
        return code1 == code2
    case (.javascriptCodeWithScope(let code1, let scope1), .javascriptCodeWithScope(let code2, let scope2)):
        return code1 == code2 && scope1 == scope2
    case (.int32(_), _):
        return lhs.int32 == rhs.int32
    case (.timestamp(let val1), .timestamp(let val2)):
        return val1 == val2
    case (.int64(_), _):
        return lhs.int64 == rhs.int64
    case (.minKey, .minKey), (.maxKey, .maxKey), (.null, .null), (.nothing, .nothing):
        return true
    default:
        return false
    }
}

public func ==(lhs: Value, rhs: String) -> Bool {
    return lhs.string == rhs
}

public func ==(lhs: Value, rhs: Int) -> Bool {
    return lhs.int == rhs
}

public func ==(lhs: Value, rhs: Int32) -> Bool {
    return lhs.int32 == rhs
}

public func ==(lhs: Value, rhs: Int64) -> Bool {
    return lhs.int64 == rhs
}
<commit_msg>Fixed comparison not to use default values<commit_after>//
//  Value+Comparing.swift
//  BSON
//
//  Created by <NAME> on 18-04-16.
//
//

import Foundation

extension Value : Equatable {}

public func ==(lhs: Value, rhs: Value) -> Bool {
    switch (lhs, rhs) {
    case (.double(_), _):
        return lhs.double == rhs.doubleValue
    case (.string(_), _):
        return lhs.string == rhs.stringValue
    case (.document(_), _), (.array(_), _):
        return lhs.document == rhs.documentValue
    case (.binary(let subtype1, let data1), .binary(let subtype2, let data2)):
        return subtype1.rawValue == subtype2.rawValue && data1 == data2
    case (.objectId(_), .objectId(_)):
        return lhs.bytes == rhs.bytes
    case (.boolean(let val1), .boolean(let val2)):
        return val1 == val2
    case (.dateTime(let val1), .dateTime(let val2)):
        return val1 == val2
    case (.regularExpression(let exp1, let opt1), .regularExpression(let exp2, let opt2)):
        return exp1 == exp2 && opt1 == opt2
    case (.javascriptCode(let code1), .javascriptCode(let code2)):
        return code1 == code2
    case (.javascriptCodeWithScope(let code1, let scope1), .javascriptCodeWithScope(let code2, let scope2)):
        return code1 == code2 && scope1 == scope2
    case (.int32(_), _):
        return lhs.int32 == rhs.int32Value
    case (.timestamp(let val1), .timestamp(let val2)):
        return val1 == val2
    case (.int64(_), _):
        return lhs.int64 == rhs.int64Value
    case (.minKey, .minKey), (.maxKey, .maxKey), (.null, .null), (.nothing, .nothing):
        return true
    default:
        return false
    }
}

public func ==(lhs: Value, rhs: String) -> Bool {
    return lhs.string == rhs
}

public func ==(lhs: Value, rhs: Int) -> Bool {
    return lhs.int == rhs
}

public func ==(lhs: Value, rhs: Int32) -> Bool {
    return lhs.int32 == rhs
}

public func ==(lhs: Value, rhs: Int64) -> Bool {
    return lhs.int64 == rhs
}

{'fraction_non_alphanumeric': 0.15702479338842976, 'fraction_numerical': 0.03409090909090909, 'mean_word_length': 2.685061845861085, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3490160', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1259, 'n_words': 372}