<commit_before>import XCTest
@testable import Star

class StarRatingTests: XCTestCase {
  
  // MARK: - Star fill level
  
  func testStarFillLevel_moreThanOneRemain() {
    let result = StarRating.starFillLevel(ratingRemainder: 1.1, starFillMode: .Precise,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(1, result)
  }
  
  func testStarFillLevel_negativeRemainder() {
    let result = StarRating.starFillLevel(ratingRemainder: -0.1, starFillMode: .Precise,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(0, result)
  }
  
  func testStarFillLevel_partiallyFileldPrecise() {
    let result = StarRating.starFillLevel(ratingRemainder: 0.67, starFillMode: .Precise,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(0.67, result)
  }
  
  func testStarFillLevel_partiallyFileldPreciseWithCorrection() {
    var result = StarRating.starFillLevel(ratingRemainder: 0.67, starFillMode: .Precise,
      correctFillLevelForPrecise: true)
    
    result = Helpers.roundToPlaces(result, places: 3)
    XCTAssertEqual(0.602, result)
  }
  
  func testStarFillLevel_partiallyFileldHalf() {
    let result = StarRating.starFillLevel(ratingRemainder: 0.67, starFillMode: .Half,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(0.5, result)
  }
  
  func testStarFillLevel_partiallyFileldFull() {
    let result = StarRating.starFillLevel(ratingRemainder: 0.67, starFillMode: .Full,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(1, result)
  }
  
  // MARK: - Correct precise fill level
  
  func testCorrectPreciseFillLevel() {
    let result = StarRating.correctPreciseFillLevel(0.5)
    
    XCTAssertEqual(0.5, result)
  }
  
  func testCorrectPreciseFillLevel_moreThanHalf() {
    let result = StarRating.correctPreciseFillLevel(0.7)
    
    XCTAssertEqual(0.62, result)
  }
  <commit_msg>Show star design in storyboard<commit_after>import XCTest
@testable import Star

class StarRatingTests: XCTestCase {
  
  // MARK: - Star fill level
  
  func testStarFillLevel_moreThanOneRemain() {
    let result = StarRating.starFillLevel(ratingRemainder: 1.1,
      fillMode: .Precise,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(1, result)
  }
  
  func testStarFillLevel_negativeRemainder() {
    let result = StarRating.starFillLevel(ratingRemainder: -0.1,
      fillMode: .Precise,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(0, result)
  }
  
  func testStarFillLevel_partiallyFileldPrecise() {
    let result = StarRating.starFillLevel(ratingRemainder: 0.67,
      fillMode: .Precise,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(0.67, result)
  }
  
  func testStarFillLevel_partiallyFileldPreciseWithCorrection() {
    var result = StarRating.starFillLevel(ratingRemainder: 0.67, fillMode: .Precise,
      correctFillLevelForPrecise: true)
    
    result = Helpers.roundToPlaces(result, places: 3)
    XCTAssertEqual(0.602, result)
  }
  
  func testStarFillLevel_partiallyFileldHalf() {
    let result = StarRating.starFillLevel(ratingRemainder: 0.67, fillMode: .Half,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(0.5, result)
  }
  
  func testStarFillLevel_partiallyFileldFull() {
    let result = StarRating.starFillLevel(ratingRemainder: 0.67, fillMode: .Full,
      correctFillLevelForPrecise: false)
    
    XCTAssertEqual(1, result)
  }
  
  // MARK: - Correct precise fill level
  
  func testCorrectPreciseFillLevel() {
    let result = StarRating.correctPreciseFillLevel(0.5)
    
    XCTAssertEqual(0.5, result)
  }
  
  func testCorrectPreciseFillLevel_moreThanHalf() {
    let result = StarRating.correctPreciseFillLevel(0.7)
    
    XCTAssertEqual(0.62, result)
  }
  
{'fraction_non_alphanumeric': 0.08433413397384575, 'fraction_numerical': 0.020282892981051508, 'mean_word_length': 3.7263556116015133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4914862', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1249, 'n_words': 218}