<commit_before>//
//  FileComparison.swift
//  agrader
//
//  Created by Ant on 26/08/2017.
//
//

import Foundation

func trim(_ input: String) -> String {
    return input.trimmingCharacters(in: .whitespacesAndNewlines)
}

func standardiseNewlines(_ input: String) -> String {
    let possibleNewlines = ["\n\r", "\r\n","\r"]
    var result = input
    possibleNewlines.forEach { newline in
        result = result.replacingOccurrences(of: newline, with: "\n")
    }
    return result
}

func prepareOutput(_ string: String, ignoreWhitespace: Bool = false, ignoreNewlines: Bool = false) -> String {
    return trim(standardiseNewlines(string))
}

func isExactMatch(expected: String, actual: String) -> Bool {
    return expected == actual
}

func isEndsWithMatch(expected: String, actual: String) -> Bool {
    return actual.hasSuffix(expected)
}<commit_msg>Fixed bug on double lines of input/output<commit_after>//
//  FileComparison.swift
//  agrader
//
//  Created by Ant on 26/08/2017.
//
//

import Foundation

func trim(_ input: String) -> String {
    return input.trimmingCharacters(in: .whitespacesAndNewlines)
}

func standardiseNewlines(_ input: String) -> String {
    return input.replacingOccurrences(of: "\r\n", with: "\n")
}

func prepareOutput(_ string: String, ignoreWhitespace: Bool = false, ignoreNewlines: Bool = false) -> String {
    return trim(standardiseNewlines(string))
}

func isExactMatch(expected: String, actual: String) -> Bool {
    return expected == actual
}

func isEndsWithMatch(expected: String, actual: String) -> Bool {
    return actual.hasSuffix(expected)
}
{'fraction_non_alphanumeric': 0.12734082397003746, 'fraction_numerical': 0.009987515605493134, 'mean_word_length': 3.813813813813814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5928479', 'n_tokens_mistral': 523, 'n_tokens_neox': 497, 'n_words': 134}