<?php
namespace ccxt;

// ----------------------------------------------------------------------------

// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

// -----------------------------------------------------------------------------
include_once PATH_TO_CCXT . '/test/exchange/base/test_shared_methods.php';

function test_sort_by() {
    // todo: other argument checks
    $exchange = new \ccxt\Exchange(array(
        'id' => 'sampleexchange',
    ));
    $arr = [array(
    'x' => 5,
), array(
    'x' => 2,
), array(
    'x' => 4,
), array(
    'x' => 0,
), array(
    'x' => 1,
), array(
    'x' => 3,
)];
    $new_array = $exchange->sort_by($arr, 'x');
    assert_deep_equal($exchange, null, 'sortBy', $new_array, [array(
    'x' => 0,
), array(
    'x' => 1,
), array(
    'x' => 2,
), array(
    'x' => 3,
), array(
    'x' => 4,
), array(
    'x' => 5,
)]);
    $new_array_descending = $exchange->sort_by($arr, 'x', true);
    assert_deep_equal($exchange, null, 'sortBy', $new_array_descending, [array(
    'x' => 5,
), array(
    'x' => 4,
), array(
    'x' => 3,
), array(
    'x' => 2,
), array(
    'x' => 1,
), array(
    'x' => 0,
)]);
    $empty_array = $exchange->sort_by([], 'x');
    assert_deep_equal($exchange, null, 'sortBy', $empty_array, []);
}
