################################################################################

@testset "Sort" begin

  ################################################################################

  # load small array into hidden Markov model
  include("data/smallArray.jl")

  # load small array on model data
  for ι ∈ 1:10
    push!(hmm.data, x[ι, :])
  end

  # sort model data
  HiddenMarkovModelReaders.sortHMM!(hmm)

  # testing
  @test hmm.data == [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [6898.439972, 1674.825584, 2142.319328, 923.535397, 562.254679, 542.897036, 544.597461, 447.280304, 338.127405, 249.294769, 331.028492, 335.807143, 421.090866, 236.912484, 241.648853, 423.595156], [8597.829269, 1833.756462, 1628.936111, 1163.014809, 697.425591, 718.742764, 431.683627, 524.160545, 522.474073, 404.779799, 286.859573, 291.428293, 371.560964, 297.910174, 426.403369, 289.336908], [8926.864639, 2024.670303, 1371.395947, 1277.803127, 978.470009, 456.044172, 580.524843, 546.832397, 342.843889, 706.63784, 408.624054, 324.00528, 337.768628, 331.042826, 444.800913, 449.033676], [9221.546188, 1511.961166, 1357.589783, 1006.436895, 532.545324, 605.403816, 468.057093, 388.927434, 439.460726, 281.329487, 469.301092, 309.418703, 340.09914, 381.352773, 227.883408, 402.3395], [9112.851349, 1626.732288, 1602.905491, 1432.479465, 663.49947, 804.251534, 739.028986, 512.910912, 397.43222, 389.500046, 407.156647, 517.501736, 347.87634, 241.200329, 416.171814, 341.232077], [9246.340912, 1466.947083, 1906.052313, 1209.67667, 606.815348, 520.541983, 571.563523, 557.675089, 473.436043, 402.273785, 345.846071, 505.062222, 376.109373, 439.998122, 406.717417, 398.954038], [10628.121246, 1498.386951, 1187.115562, 925.775265, 694.86956, 257.954501, 592.700003, 492.023813, 452.887017, 563.844071, 473.371099, 296.826092, 479.452673, 288.918503, 369.519865, 430.178178], [10362.170502, 2234.273811, 2244.926224, 647.264278, 655.394653, 571.437164, 662.987797, 486.684425, 395.458192, 392.33078, 349.11353, 403.472491, 409.692116, 500.905411, 547.84833, 789.415714], [11321.235947, 1362.566475, 944.705898, 696.605307, 411.700334, 517.204907, 383.636882, 489.580448, 301.713282, 371.661125, 476.757751, 266.741815, 154.978138, 412.402929, 279.845093, 382.712366], [11443.098831, 1500.468246, 1641.78447, 929.626314, 695.049788, 473.568182, 568.370424, 542.348984, 449.226664, 351.930719, 440.918041, 346.611481, 539.18642, 325.506171, 361.940255, 451.27547]]
  @test hmm.model == [[0.0; repeat([-1.0], size(x, 1))]]

  ################################################################################

end

################################################################################
