| 
158
 | 
     1  | 
  | 
| 
 | 
     2  | 
import io.Source
  | 
| 
 | 
     3  | 
import scala.util._
  | 
| 
 | 
     4  | 
  | 
| 
 | 
     5  | 
val file_population_test = "population.csv"
  | 
| 
 | 
     6  | 
val file_alcohol_test = "alcohol.csv"
  | 
| 
 | 
     7  | 
  | 
| 
 | 
     8  | 
  | 
| 
 | 
     9  | 
def get_csv_file_test(file: String) : List[String] = 
  | 
| 
 | 
    10  | 
  Source.fromFile(file)("ISO-8859-1").getLines.toList
 | 
| 
 | 
    11  | 
  | 
| 
 | 
    12  | 
val alcs_test = get_csv_file_test(file_alcohol_test)
  | 
| 
 | 
    13  | 
val pops_test = get_csv_file_test(file_population_test)
  | 
| 
 | 
    14  | 
  | 
| 
 | 
    15  | 
assert(CW6b.process_alcs(alcs_test.drop(1))(0) == ("Afghanistan", 0.0))
 | 
| 
 | 
    16  | 
assert(CW6b.process_alcs(alcs_test.drop(1))(1) == ("Albania", 4.9))
 | 
| 
 | 
    17  | 
  | 
| 
 | 
    18  | 
assert(CW6b.process_pops(pops_test.drop(1))("Micronesia") == 104015)
 | 
| 
 | 
    19  | 
assert(CW6b.process_pops(pops_test.drop(1))("Albania") == 2889104)
 |