import os
import sys

root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
sys.path.append(root)

# ----------------------------------------------------------------------------

# 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

# ----------------------------------------------------------------------------
# -*- coding: utf-8 -*-

from ccxt.base.decimal_to_precision import number_to_string  # noqa E402
import ccxt  # noqa: F402

def test_number_to_string():
    exchange = ccxt.Exchange({
        'id': 'regirock',
    })
    # ----------------------------------------------------------------------------
    # numberToString
    assert exchange.number_to_string(-7.8e-7) == '-0.00000078'
    assert exchange.number_to_string(7.8e-7) == '0.00000078'
    assert exchange.number_to_string(-0.0000017805) == '-0.0000017805'
    assert exchange.number_to_string(0.0000017805) == '0.0000017805'
    assert exchange.number_to_string(-7.0005e+27) == '-7000500000000000000000000000'
    assert exchange.number_to_string(7.0005e+27) == '7000500000000000000000000000'
    assert exchange.number_to_string(-7.9e+27) == '-7900000000000000000000000000'
    assert exchange.number_to_string(7e+27) == '7000000000000000000000000000'
    assert exchange.number_to_string(7.9e+27) == '7900000000000000000000000000'
    assert exchange.number_to_string(-12.345) == '-12.345'
    assert exchange.number_to_string(12.345) == '12.345'
    assert exchange.number_to_string(0) == '0'
    assert exchange.number_to_string(7.35946e+21) == '7359460000000000000000'
    assert exchange.number_to_string(1e-8) == '0.00000001'
    assert exchange.number_to_string(1e-7) == '0.0000001'
    assert exchange.number_to_string(-1e-7) == '-0.0000001'
