@skybaer0804/tdd
v1.1.5
Published
TDD 방식으로 개발된 유틸리티 라이브러리
Downloads
569
Maintainers
Readme
��#� �T�D�D� �U�t�i�l�i�t�y� �L�i�b�r�a�r�y�
�
�A� �u�t�i�l�i�t�y� �f�u�n�c�t�i�o�n� �l�i�b�r�a�r�y� �d�e�v�e�l�o�p�e�d� �u�s�i�n�g� �T�D�D� �(�T�e�s�t�-�D�r�i�v�e�n� �D�e�v�e�l�o�p�m�e�n�t�)�.� �P�r�o�v�i�d�e�s� �v�a�r�i�o�u�s� �f�e�a�t�u�r�e�s� �i�n�c�l�u�d�i�n�g� �m�a�t�h�e�m�a�t�i�c�a�l� �o�p�e�r�a�t�i�o�n�s�,� �d�a�t�a� �v�a�l�i�d�a�t�i�o�n�,� �a�n�d� �f�o�r�m�a�t�t�i�n�g�.�
�
�#�#� �I�n�s�t�a�l�l�a�t�i�o�n�
�
����b�a�s�h�
�n�p�m� �i�n�s�t�a�l�l� �@�s�k�y�b�a�e�r�0�8�0�4�/�t�d�d�
����
�
�o�r�
�
����b�a�s�h�
�y�a�r�n� �a�d�d� �@�s�k�y�b�a�e�r�0�8�0�4�/�t�d�d�
����
�
�#�#� �U�s�a�g�e�
�
����j�a�v�a�s�c�r�i�p�t�
�/�/� �M�e�t�h�o�d� �1�:� �I�m�p�o�r�t� �a�l�l� �f�u�n�c�t�i�o�n�s� �a�t� �o�n�c�e�
�i�m�p�o�r�t� �{� �a�d�d�,� �s�u�b�t�r�a�c�t�,� �p�o�w�,� �d�i�v�i�d�e�,� �p�e�r�c�e�n�t�,� �i�s�N�u�m�,� �i�s�P�o�s�i�t�i�v�e�N�u�m�,� �i�s�U�r�l�,� �i�s�I�n�p�u�t�X�s�s�S�a�f�e�,� �t�o�N�u�m�,� �t�o�S�t�r�i�n�g�C�o�m�m�a�,� �t�o�R�e�n�d�e�r�X�s�s�S�a�f�e� �}� �f�r�o�m� �'�@�s�k�y�b�a�e�r�0�8�0�4�/�t�d�d�'�;�
�
�/�/� �M�e�t�h�o�d� �2�:� �I�m�p�o�r�t� �b�y� �c�a�t�e�g�o�r�y�
�i�m�p�o�r�t� �{� �a�d�d�,� �s�u�b�t�r�a�c�t�,� �p�o�w�,� �d�i�v�i�d�e�,� �p�e�r�c�e�n�t� �}� �f�r�o�m� �'�@�s�k�y�b�a�e�r�0�8�0�4�/�t�d�d�/�m�a�t�h�'�;�
�i�m�p�o�r�t� �{� �i�s�N�u�m�,� �i�s�P�o�s�i�t�i�v�e�N�u�m�,� �i�s�U�r�l�,� �i�s�I�n�p�u�t�X�s�s�S�a�f�e� �}� �f�r�o�m� �'�@�s�k�y�b�a�e�r�0�8�0�4�/�t�d�d�/�v�a�l�i�d�a�t�e�'�;�
�i�m�p�o�r�t� �{� �t�o�N�u�m�,� �t�o�S�t�r�i�n�g�C�o�m�m�a�,� �t�o�R�e�n�d�e�r�X�s�s�S�a�f�e� �}� �f�r�o�m� �'�@�s�k�y�b�a�e�r�0�8�0�4�/�t�d�d�/�f�o�r�m�a�t�'�;�
�
�/�/� �M�a�t�h� �f�u�n�c�t�i�o�n�s�
�c�o�n�s�o�l�e�.�l�o�g�(�a�d�d�(�2�,� �3�)�)�;� �/�/� �5�
�c�o�n�s�o�l�e�.�l�o�g�(�a�d�d�(�'�1�'�,� �'�2�'�)�)�;� �/�/� �3�
�c�o�n�s�o�l�e�.�l�o�g�(�s�u�b�t�r�a�c�t�(�5�,� �3�)�)�;� �/�/� �2�
�c�o�n�s�o�l�e�.�l�o�g�(�p�o�w�(�2�,� �3�)�)�;� �/�/� �8�
�c�o�n�s�o�l�e�.�l�o�g�(�d�i�v�i�d�e�(�1�0�,� �2�)�)�;� �/�/� �5�
�c�o�n�s�o�l�e�.�l�o�g�(�p�e�r�c�e�n�t�(�5�0�,� �1�0�0�)�)�;� �/�/� �5�0�
�
�/�/� �V�a�l�i�d�a�t�i�o�n� �f�u�n�c�t�i�o�n�s�
�c�o�n�s�o�l�e�.�l�o�g�(�i�s�N�u�m�(�1�2�3�)�)�;� �/�/� �t�r�u�e�
�c�o�n�s�o�l�e�.�l�o�g�(�i�s�U�r�l�(�'�h�t�t�p�s�:�/�/�e�x�a�m�p�l�e�.�c�o�m�'�)�)�;� �/�/� �t�r�u�e�
�c�o�n�s�o�l�e�.�l�o�g�(�i�s�I�n�p�u�t�X�s�s�S�a�f�e�(�'�<�s�c�r�i�p�t�>�a�l�e�r�t�(�1�)�<�/�s�c�r�i�p�t�>�'�)�)�;� �/�/� �f�a�l�s�e�
�
�/�/� �F�o�r�m�a�t� �f�u�n�c�t�i�o�n�s�
�c�o�n�s�o�l�e�.�l�o�g�(�t�o�N�u�m�(�'�1�2�3�'�)�)�;� �/�/� �1�2�3�
�c�o�n�s�o�l�e�.�l�o�g�(�t�o�S�t�r�i�n�g�C�o�m�m�a�(�1�2�3�4�)�)�;� �/�/� �'�1�,�2�3�4�'�
�c�o�n�s�o�l�e�.�l�o�g�(�t�o�R�e�n�d�e�r�X�s�s�S�a�f�e�(�'�<�s�c�r�i�p�t�>�a�l�e�r�t�(�1�)�<�/�s�c�r�i�p�t�>�'�)�)�;� �/�/� �'�&�l�t�;�s�c�r�i�p�t�&�g�t�;�a�l�e�r�t�(�1�)�&�l�t�;�/�s�c�r�i�p�t�&�g�t�;�'�
����
�
�#�#� �A�P�I� �D�o�c�u�m�e�n�t�a�t�i�o�n�
�
�#�#�#� �M�a�t�h� �F�u�n�c�t�i�o�n�s�
�
�#�#�#�#� �a�d�d�(�a�,� �b�)�
�
�A�d�d�s� �t�w�o� �n�u�m�b�e�r�s�.� �A�u�t�o�m�a�t�i�c�a�l�l�y� �c�o�n�v�e�r�t�s� �s�t�r�i�n�g� �n�u�m�b�e�r�s�.�
�
�-� � � ��a�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �F�i�r�s�t� �n�u�m�b�e�r�
�-� � � ��b�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �S�e�c�o�n�d� �n�u�m�b�e�r�
�-� � � �R�e�t�u�r�n�s�:� �(�n�u�m�b�e�r�)� �S�u�m� �o�f� �t�w�o� �n�u�m�b�e�r�s�
�
����j�a�v�a�s�c�r�i�p�t�
�a�d�d�(�2�,� �3�)�;� �/�/� �5�
�a�d�d�(�'�1�'�,� �'�2�'�)�;� �/�/� �3�
�a�d�d�(�'�1�,�0�0�0�'�,� �'�2�,�0�0�0�'�)�;� �/�/� �3�0�0�0�
����
�
�#�#�#�#� �s�u�b�t�r�a�c�t�(�a�,� �b�)�
�
�S�u�b�t�r�a�c�t�s� �t�w�o� �n�u�m�b�e�r�s�.� �A�u�t�o�m�a�t�i�c�a�l�l�y� �c�o�n�v�e�r�t�s� �s�t�r�i�n�g� �n�u�m�b�e�r�s�.�
�
�-� � � ��a�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �F�i�r�s�t� �n�u�m�b�e�r�
�-� � � ��b�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �S�e�c�o�n�d� �n�u�m�b�e�r�
�-� � � �R�e�t�u�r�n�s�:� �(�n�u�m�b�e�r�)� �D�i�f�f�e�r�e�n�c�e� �o�f� �t�w�o� �n�u�m�b�e�r�s�
�
����j�a�v�a�s�c�r�i�p�t�
�s�u�b�t�r�a�c�t�(�5�,� �3�)�;� �/�/� �2�
�s�u�b�t�r�a�c�t�(�'�5�'�,� �'�3�'�)�;� �/�/� �2�
����
�
�#�#�#�#� �p�o�w�(�b�a�s�e�,� �e�x�p�o�n�e�n�t�)�
�
�P�o�w�e�r� �f�u�n�c�t�i�o�n�.� �A�u�t�o�m�a�t�i�c�a�l�l�y� �c�o�n�v�e�r�t�s� �s�t�r�i�n�g� �n�u�m�b�e�r�s�.�
�
�-� � � ��b�a�s�e�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �B�a�s�e�
�-� � � ��e�x�p�o�n�e�n�t�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �E�x�p�o�n�e�n�t�
�-� � � �R�e�t�u�r�n�s�:� �(�n�u�m�b�e�r�)� �B�a�s�e� �r�a�i�s�e�d� �t�o� �t�h�e� �p�o�w�e�r� �o�f� �e�x�p�o�n�e�n�t�
�
����j�a�v�a�s�c�r�i�p�t�
�p�o�w�(�2�,� �3�)�;� �/�/� �8�
�p�o�w�(�'�2�'�,� �'�3�'�)�;� �/�/� �8�
����
�
�#�#�#�#� �d�i�v�i�d�e�(�d�i�v�i�d�e�n�d�,� �d�i�v�i�s�o�r�)�
�
�D�i�v�i�s�i�o�n� �f�u�n�c�t�i�o�n�.� �A�u�t�o�m�a�t�i�c�a�l�l�y� �c�o�n�v�e�r�t�s� �s�t�r�i�n�g� �n�u�m�b�e�r�s�.�
�
�-� � � ��d�i�v�i�d�e�n�d�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �N�u�m�b�e�r� �t�o� �b�e� �d�i�v�i�d�e�d�
�-� � � ��d�i�v�i�s�o�r�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �N�u�m�b�e�r� �t�o� �d�i�v�i�d�e� �b�y�
�-� � � �R�e�t�u�r�n�s�:� �(�n�u�m�b�e�r�)� �R�e�s�u�l�t� �o�f� �d�i�v�i�s�i�o�n�
�
����j�a�v�a�s�c�r�i�p�t�
�d�i�v�i�d�e�(�1�0�,� �2�)�;� �/�/� �5�
�d�i�v�i�d�e�(�'�1�0�'�,� �'�2�'�)�;� �/�/� �5�
����
�
�#�#�#�#� �p�e�r�c�e�n�t�(�v�a�l�u�e�,� �t�o�t�a�l�)�
�
�C�a�l�c�u�l�a�t�e�s� �p�e�r�c�e�n�t�a�g�e�.�
�
�-� � � ��v�a�l�u�e�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �V�a�l�u�e� �t�o� �c�a�l�c�u�l�a�t�e�
�-� � � ��t�o�t�a�l�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �T�o�t�a�l� �v�a�l�u�e�
�-� � � �R�e�t�u�r�n�s�:� �(�n�u�m�b�e�r�)� �P�e�r�c�e�n�t�a�g�e�
�
����j�a�v�a�s�c�r�i�p�t�
�p�e�r�c�e�n�t�(�5�0�,� �1�0�0�)�;� �/�/� �5�0�
�p�e�r�c�e�n�t�(�2�5�,� �1�0�0�)�;� �/�/� �2�5�
�p�e�r�c�e�n�t�(�1�,� �3�)�;� �/�/� �3�3�.�3�3�3�.�.�.�
����
�
�#�#�#� �V�a�l�i�d�a�t�e� �F�u�n�c�t�i�o�n�s�
�
�#�#�#�#� �i�s�N�u�m�(�v�a�l�u�e�)�
�
�C�h�e�c�k�s� �i�f� �a� �v�a�l�u�e� �i�s� �a� �n�u�m�b�e�r�.�
�
�-� � � ��v�a�l�u�e�� �(�\��)�:� �V�a�l�u�e� �t�o� �c�h�e�c�k�
�-� � � �R�e�t�u�r�n�s�:� �(�b�o�o�l�e�a�n�)� �t�r�u�e� �i�f� �n�u�m�b�e�r�,� �f�a�l�s�e� �o�t�h�e�r�w�i�s�e�
�
����j�a�v�a�s�c�r�i�p�t�
�i�s�N�u�m�(�1�2�3�)�;� �/�/� �t�r�u�e�
�i�s�N�u�m�(�'�1�2�3�'�)�;� �/�/� �f�a�l�s�e�
�i�s�N�u�m�(�n�u�l�l�)�;� �/�/� �f�a�l�s�e�
����
�
�#�#�#�#� �i�s�P�o�s�i�t�i�v�e�N�u�m�(�v�a�l�u�e�)�
�
�C�h�e�c�k�s� �i�f� �a� �v�a�l�u�e� �i�s� �a� �n�o�n�-�n�e�g�a�t�i�v�e� �i�n�t�e�g�e�r�.�
�
�-� � � ��v�a�l�u�e�� �(�\��)�:� �V�a�l�u�e� �t�o� �c�h�e�c�k�
�-� � � �R�e�t�u�r�n�s�:� �(�b�o�o�l�e�a�n�)� �t�r�u�e� �i�f� �n�o�n�-�n�e�g�a�t�i�v�e� �i�n�t�e�g�e�r�,� �f�a�l�s�e� �o�t�h�e�r�w�i�s�e�
�
����j�a�v�a�s�c�r�i�p�t�
�i�s�P�o�s�i�t�i�v�e�N�u�m�(�0�)�;� �/�/� �t�r�u�e�
�i�s�P�o�s�i�t�i�v�e�N�u�m�(�1�)�;� �/�/� �t�r�u�e�
�i�s�P�o�s�i�t�i�v�e�N�u�m�(�-�1�)�;� �/�/� �f�a�l�s�e�
����
�
�#�#�#�#� �i�s�U�r�l�(�v�a�l�u�e�)�
�
�C�h�e�c�k�s� �i�f� �a� �v�a�l�u�e� �i�s� �a� �v�a�l�i�d� �U�R�L� �f�o�r�m�a�t�.�
�
�-� � � ��v�a�l�u�e�� �(�\��)�:� �V�a�l�u�e� �t�o� �c�h�e�c�k�
�-� � � �R�e�t�u�r�n�s�:� �(�b�o�o�l�e�a�n�)� �t�r�u�e� �i�f� �v�a�l�i�d� �U�R�L�,� �f�a�l�s�e� �o�t�h�e�r�w�i�s�e�
�
����j�a�v�a�s�c�r�i�p�t�
�i�s�U�r�l�(�'�h�t�t�p�s�:�/�/�e�x�a�m�p�l�e�.�c�o�m�'�)�;� �/�/� �t�r�u�e�
�i�s�U�r�l�(�'�n�o�t�-�a�-�u�r�l�'�)�;� �/�/� �f�a�l�s�e�
����
�
�#�#�#�#� �i�s�I�n�p�u�t�X�s�s�S�a�f�e�(�v�a�l�u�e�)�
�
�C�h�e�c�k�s� �i�f� �i�n�p�u�t� �v�a�l�u�e� �i�s� �s�a�f�e� �f�r�o�m� �X�S�S� �a�t�t�a�c�k�s�.�
�
�-� � � ��v�a�l�u�e�� �(�\��)�:� �V�a�l�u�e� �t�o� �c�h�e�c�k�
�-� � � �R�e�t�u�r�n�s�:� �(�b�o�o�l�e�a�n�)� �t�r�u�e� �i�f� �s�a�f�e�,� �f�a�l�s�e� �i�f� �d�a�n�g�e�r�o�u�s�
�
����j�a�v�a�s�c�r�i�p�t�
�i�s�I�n�p�u�t�X�s�s�S�a�f�e�(�'�S�a�f�e� �t�e�x�t�'�)�;� �/�/� �t�r�u�e�
�i�s�I�n�p�u�t�X�s�s�S�a�f�e�(�'�<�s�c�r�i�p�t�>�a�l�e�r�t�(�"�X�S�S�"�)�<�/�s�c�r�i�p�t�>�'�)�;� �/�/� �f�a�l�s�e�
����
�
�#�#�#� �F�o�r�m�a�t� �F�u�n�c�t�i�o�n�s�
�
�#�#�#�#� �t�o�N�u�m�(�v�a�l�u�e�)�
�
�C�o�n�v�e�r�t�s� �a� �v�a�l�u�e� �t�o� �a� �n�u�m�b�e�r�.�
�
�-� � � ��v�a�l�u�e�� �(�\��)�:� �V�a�l�u�e� �t�o� �c�o�n�v�e�r�t�
�-� � � �R�e�t�u�r�n�s�:� �(�n�u�m�b�e�r�)� �C�o�n�v�e�r�t�e�d� �n�u�m�b�e�r�
�
����j�a�v�a�s�c�r�i�p�t�
�t�o�N�u�m�(�'�1�2�3�'�)�;� �/�/� �1�2�3�
�t�o�N�u�m�(�'� �1�2�,�3�4�0� �'�)�;� �/�/� �1�2�3�4�0�
�t�o�N�u�m�(�'�a�b�c�'�)�;� �/�/� �N�a�N�
����
�
�#�#�#�#� �t�o�S�t�r�i�n�g�C�o�m�m�a�(�v�a�l�u�e�)�
�
�C�o�n�v�e�r�t�s� �a� �n�u�m�b�e�r� �t�o� �a� �s�t�r�i�n�g� �w�i�t�h� �t�h�o�u�s�a�n�d� �s�e�p�a�r�a�t�o�r�s�.�
�
�-� � � ��v�a�l�u�e�� �(�n�u�m�b�e�r�|�s�t�r�i�n�g�)�:� �N�u�m�b�e�r� �o�r� �s�t�r�i�n�g� �t�o� �c�o�n�v�e�r�t�
�-� � � �R�e�t�u�r�n�s�:� �(�s�t�r�i�n�g�)� �S�t�r�i�n�g� �w�i�t�h� �c�o�m�m�a�s�
�
����j�a�v�a�s�c�r�i�p�t�
�t�o�S�t�r�i�n�g�C�o�m�m�a�(�1�2�3�4�)�;� �/�/� �'�1�,�2�3�4�'�
�t�o�S�t�r�i�n�g�C�o�m�m�a�(�1�2�3�4�5�6�7�)�;� �/�/� �'�1�,�2�3�4�,�5�6�7�'�
����
�
�#�#�#�#� �t�o�R�e�n�d�e�r�X�s�s�S�a�f�e�(�v�a�l�u�e�)�
�
�E�s�c�a�p�e�s� �H�T�M�L� �s�p�e�c�i�a�l� �c�h�a�r�a�c�t�e�r�s� �t�o� �p�r�e�v�e�n�t� �X�S�S� �a�t�t�a�c�k�s�.�
�
�-� � � ��v�a�l�u�e�� �(�\��)�:� �V�a�l�u�e� �t�o� �e�s�c�a�p�e�
�-� � � �R�e�t�u�r�n�s�:� �(�s�t�r�i�n�g�)� �E�s�c�a�p�e�d� �s�a�f�e� �s�t�r�i�n�g�
�
����j�a�v�a�s�c�r�i�p�t�
�t�o�R�e�n�d�e�r�X�s�s�S�a�f�e�(�'�S�a�f�e� �t�e�x�t�'�)�;� �/�/� �'�S�a�f�e� �t�e�x�t�'�
�t�o�R�e�n�d�e�r�X�s�s�S�a�f�e�(�'�<�s�c�r�i�p�t�>�a�l�e�r�t�(�"�X�S�S�"�)�<�/�s�c�r�i�p�t�>�'�)�;� �/�/� �'�&�l�t�;�s�c�r�i�p�t�&�g�t�;�a�l�e�r�t�(�&�q�u�o�t�;�X�S�S�&�q�u�o�t�;�)�&�l�t�;�/�s�c�r�i�p�t�&�g�t�;�'�
����
�
�#�#� �R�u�n�n�i�n�g� �T�e�s�t�s�
�
����b�a�s�h�
�n�p�m� �t�e�s�t�
����
�
�#�#� �D�e�v�e�l�o�p�m�e�n�t�
�
�T�h�i�s� �p�r�o�j�e�c�t� �f�o�l�l�o�w�s� �t�h�e� �T�D�D� �R�e�d�-�G�r�e�e�n�-�B�l�u�e� �c�y�c�l�e�:�
�
�1�.� �R�e�d� �P�h�a�s�e�:� �W�r�i�t�e� �f�a�i�l�i�n�g� �t�e�s�t� �c�o�d�e�
�2�.� �G�r�e�e�n� �P�h�a�s�e�:� �W�r�i�t�e� �m�i�n�i�m�a�l� �c�o�d�e� �t�o� �p�a�s�s� �t�e�s�t�s�
�3�.� �B�l�u�e� �P�h�a�s�e�:� �R�e�f�a�c�t�o�r� �a�n�d� �c�l�e�a�n� �u�p� �c�o�d�e�
�
�#�#� �C�h�a�n�g�e�l�o�g�
�
�#�#�#� �1�.�1�.�0� �(�2�0�2�4�-�1�1�-�1�0�)�
�
�#�#�#�#� �N�e�w� �F�e�a�t�u�r�e�s�
�
�-� � � �A�d�d�e�d� �f�o�r�m�a�t� �c�a�t�e�g�o�r�y� �(�t�o�N�u�m�,� �t�o�S�t�r�i�n�g�C�o�m�m�a�,� �t�o�R�e�n�d�e�r�X�s�s�S�a�f�e�)�
�-� � � �E�x�t�e�n�d�e�d� �v�a�l�i�d�a�t�e� �c�a�t�e�g�o�r�y� �(�i�s�U�r�l�,� �i�s�I�n�p�u�t�X�s�s�S�a�f�e�)�
�-� � � �E�x�t�e�n�d�e�d� �m�a�t�h� �c�a�t�e�g�o�r�y� �(�p�e�r�c�e�n�t�)�
�
�#�#�#�#� �I�m�p�r�o�v�e�m�e�n�t�s�
�
�-� � � �I�m�p�r�o�v�e�d� �n�o�n�-�n�u�m�b�e�r� �i�n�p�u�t� �h�a�n�d�l�i�n�g� �i�n� �m�a�t�h� �f�u�n�c�t�i�o�n�s�
�-� � � �S�u�p�p�o�r�t� �f�o�r� �a�u�t�o�m�a�t�i�c� �s�t�r�i�n�g� �n�u�m�b�e�r� �c�o�n�v�e�r�s�i�o�n�
�-� � � �S�u�p�p�o�r�t� �f�o�r� �s�t�r�i�n�g� �n�u�m�b�e�r�s� �w�i�t�h� �s�p�a�c�e�s� �a�n�d� �c�o�m�m�a�s�
�
�#�#�#� �1�.�0�.�2�
�
�-� � � �I�n�i�t�i�a�l� �v�e�r�s�i�o�n�
�-� � � �B�a�s�i�c� �m�a�t�h� �f�u�n�c�t�i�o�n�s� �(�a�d�d�,� �s�u�b�t�r�a�c�t�,� �p�o�w�,� �d�i�v�i�d�e�)�
�-� � � �B�a�s�i�c� �v�a�l�i�d�a�t�i�o�n� �f�u�n�c�t�i�o�n�s� �(�i�s�N�u�m�,� �i�s�P�o�s�i�t�i�v�e�N�u�m�)�
�
�#�#� �L�i�c�e�n�s�e�
�
�M�I�T�
�
