about summary refs log tree commit diff stats
path: root/tests/unittests
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2018-09-06 20:32:08 +0200
committerMichael Vetter <jubalh@iodoru.org>2018-09-06 20:40:09 +0200
commit82f8083b857358c5dd54700fd51254ca745c30a1 (patch)
treedca5b3c68e9b5987ba2e0e40222cfb443dd9bd70 /tests/unittests
parent9e021d5c8f1fbbac05ff989eca1d2bf766d8c935 (diff)
downloadprofani-tty-82f8083b857358c5dd54700fd51254ca745c30a1.tar.gz
Move p_sha1_hash() to stanza.c
Move `p_sha1_hash()` from `common.c` to	`xmpp/stanza.c` as it is only
used in this file and now depends on libstrophe so xmpp is a better
namespace folder.
Renaming it as `_stanza_create_sha1_hash()`. And making static since
only used here.

The function cannot be tested in the unit tests anymore.
Once functional tests are working again we should write a test for the
sha1 functionality.
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_common.c56
-rw-r--r--tests/unittests/test_common.h8
-rw-r--r--tests/unittests/unittests.c7
3 files changed, 0 insertions, 71 deletions
diff --git a/tests/unittests/test_common.c b/tests/unittests/test_common.c
index 75eed6e2..4849a4a7 100644
--- a/tests/unittests/test_common.c
+++ b/tests/unittests/test_common.c
@@ -212,62 +212,6 @@ void test_blah_is_not_valid_resource_presence_string(void **state)
     assert_false(valid_resource_presence_string("blah"));
 }
 
-void test_p_sha1_hash1(void **state)
-{
-    char *inp = "<message>some message</message>\n<element>another element</element>\n";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "ZJLLzkYc51Lug3fZ7MJJzK95Ikg=");
-}
-
-void test_p_sha1_hash2(void **state)
-{
-    char *inp = "";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "2jmj7l5rSw0yVb/vlWAYkK/YBwk=");
-}
-
-void test_p_sha1_hash3(void **state)
-{
-    char *inp = "m";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "aw0xwNVjIjAk2kVpFYRkOseMlug=");
-}
-
-void test_p_sha1_hash4(void **state)
-{
-    char *inp = "<element/>\n";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "xcgld4ZfXvU0P7+cW3WFLUuE3C8=");
-}
-
-void test_p_sha1_hash5(void **state)
-{
-    char *inp = "  ";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "CZYAoQqUQRSqxAbRNrYl+0Ft13k=");
-}
-
-void test_p_sha1_hash6(void **state)
-{
-    char *inp = " sdf  \n ";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "zjtm8dKlTj1KhYDlM2z8FsmAhSQ=");
-}
-
-void test_p_sha1_hash7(void **state)
-{
-    char *inp = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci. Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum si.";
-    char *result = p_sha1_hash(inp);
-
-    assert_string_equal(result, "bNfKVfqEOGmzlH8M+e8FYTB46SU=");
-}
-
 void utf8_display_len_null_str(void **state)
 {
     int result = utf8_display_len(NULL);
diff --git a/tests/unittests/test_common.h b/tests/unittests/test_common.h
index 6da87a68..bcef3367 100644
--- a/tests/unittests/test_common.h
+++ b/tests/unittests/test_common.h
@@ -19,14 +19,6 @@ void test_dnd_is_valid_resource_presence_string(void **state);
 void test_available_is_not_valid_resource_presence_string(void **state);
 void test_unavailable_is_not_valid_resource_presence_string(void **state);
 void test_blah_is_not_valid_resource_presence_string(void **state);
-void test_p_sha1_hash1(void **state);
-void test_p_sha1_hash2(void **state);
-void test_p_sha1_hash3(void **state);
-void test_p_sha1_hash4(void **state);
-void test_p_sha1_hash5(void **state);
-void test_p_sha1_hash6(void **state);
-void test_p_sha1_hash6(void **state);
-void test_p_sha1_hash7(void **state);
 void utf8_display_len_null_str(void **state);
 void utf8_display_len_1_non_wide(void **state);
 void utf8_display_len_1_wide(void **state);
diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c
index 4e3e149e..8fad2e51 100644
--- a/tests/unittests/unittests.c
+++ b/tests/unittests/unittests.c
@@ -78,13 +78,6 @@ int main(int argc, char* argv[]) {
         unit_test(test_available_is_not_valid_resource_presence_string),
         unit_test(test_unavailable_is_not_valid_resource_presence_string),
         unit_test(test_blah_is_not_valid_resource_presence_string),
-        unit_test(test_p_sha1_hash1),
-        unit_test(test_p_sha1_hash2),
-        unit_test(test_p_sha1_hash3),
-        unit_test(test_p_sha1_hash4),
-        unit_test(test_p_sha1_hash5),
-        unit_test(test_p_sha1_hash6),
-        unit_test(test_p_sha1_hash7),
         unit_test(utf8_display_len_null_str),
         unit_test(utf8_display_len_1_non_wide),
         unit_test(utf8_display_len_1_wide),
='n552' href='#n552'>552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867