示例#1
0
        public void smallSimpleTest()
        {
            int[] array    = { 1, 2, 3, 4, 10, 11 };
            int   expected = 31;
            int   result   = SimpleArraySum.simpleArraySum(array);

            Assert.AreEqual(expected, result);
        }
示例#2
0
        public void largeTest()
        {
            int arraySize = 1000;

            int[] array    = { 456, 124, 752, 746, 782, 492, 741, 171, 752, 295, 2, 56, 725, 961, 135, 654, 697, 328, 112, 992, 922, 816, 519, 997, 751, 268, 378, 276, 209, 842, 805, 348, 587, 105, 61, 449, 590, 616, 442, 347, 665, 231, 429, 721, 145, 213, 645, 8, 846, 211, 586, 738, 967, 903, 392, 847, 240, 916, 594, 478, 195, 443, 914, 921, 285, 272, 449, 32, 217, 95, 765, 830, 340, 279, 949, 32, 591, 563, 458, 19, 963, 105, 784, 548, 229, 62, 474, 331, 639, 545, 923, 513, 116, 573, 375, 43, 345, 314, 426, 915, 589, 928, 72, 886, 625, 737, 552, 790, 527, 11, 223, 312, 831, 879, 809, 616, 712, 486, 546, 788, 572, 717, 806, 497, 746, 382, 55, 871, 733, 956, 817, 598, 716, 435, 958, 767, 945, 786, 49, 276, 175, 190, 743, 111, 503, 470, 893, 163, 113, 702, 637, 939, 207, 892, 441, 450, 89, 4, 494, 410, 150, 881, 808, 274, 361, 924, 597, 321, 957, 639, 779, 352, 770, 770, 542, 380, 279, 633, 438, 580, 218, 1, 710, 245, 92, 710, 363, 350, 586, 77, 412, 350, 242, 930, 547, 567, 102, 310, 583, 744, 540, 881, 450, 494, 526, 290, 456, 152, 445, 401, 457, 453, 963, 443, 279, 132, 565, 915, 833, 392, 766, 146, 193, 458, 262, 121, 833, 630, 440, 935, 502, 287, 712, 710, 39, 720, 349, 444, 711, 143, 151, 459, 333, 796, 485, 326, 503, 196, 747, 510, 147, 898, 135, 383, 643, 633, 458, 102, 602, 915, 943, 652, 525, 479, 118, 983, 498, 399, 477, 889, 835, 46, 376, 716, 357, 874, 252, 162, 7, 658, 612, 385, 40, 458, 493, 551, 920, 203, 832, 507, 221, 44, 660, 157, 880, 709, 612, 931, 115, 538, 556, 181, 883, 936, 943, 190, 411, 887, 726, 557, 407, 424, 980, 235, 359, 912, 527, 423, 569, 584, 96, 708, 518, 754, 204, 26, 425, 667, 178, 188, 922, 188, 506, 95, 781, 244, 355, 363, 685, 48, 795, 132, 377, 22, 232, 505, 5, 89, 696, 713, 589, 752, 614, 267, 915, 241, 170, 290, 224, 214, 833, 979, 293, 11, 343, 345, 64, 102, 603, 462, 351, 791, 12, 484, 307, 511, 601, 39, 749, 252, 179, 33, 377, 224, 848, 243, 1, 797, 189, 828, 369, 851, 152, 333, 182, 424, 579, 817, 876, 960, 196, 336, 725, 404, 763, 610, 54, 938, 563, 954, 755, 941, 603, 489, 570, 412, 213, 149, 535, 36, 50, 842, 538, 946, 101, 33, 272, 318, 524, 957, 496, 213, 312, 388, 633, 997, 477, 753, 482, 21, 866, 827, 995, 575, 961, 626, 134, 394, 239, 236, 597, 851, 787, 108, 973, 687, 3, 497, 408, 86, 769, 674, 804, 47, 593, 444, 369, 292, 76, 794, 481, 226, 907, 659, 716, 726, 290, 326, 219, 989, 711, 175, 112, 265, 870, 391, 34, 946, 687, 549, 318, 735, 32, 388, 792, 100, 916, 24, 423, 868, 604, 826, 532, 952, 889, 243, 161, 759, 549, 915, 752, 800, 849, 301, 785, 318, 121, 469, 999, 334, 767, 790, 906, 917, 844, 814, 169, 467, 820, 166, 797, 160, 547, 155, 464, 10, 262, 556, 567, 383, 424, 166, 109, 972, 429, 948, 921, 36, 801, 303, 44, 680, 643, 309, 426, 193, 919, 847, 699, 362, 865, 989, 152, 362, 86, 420, 41, 82, 832, 506, 70, 873, 366, 597, 170, 108, 813, 875, 709, 795, 560, 459, 700, 591, 778, 973, 568, 235, 974, 553, 284, 423, 763, 275, 944, 536, 886, 875, 240, 510, 188, 194, 534, 696, 357, 218, 173, 866, 99, 696, 387, 651, 442, 294, 366, 735, 492, 724, 277, 808, 109, 285, 946, 716, 789, 887, 969, 223, 406, 742, 378, 850, 199, 83, 755, 966, 9, 515, 942, 892, 307, 381, 583, 263, 58, 396, 304, 342, 974, 959, 194, 135, 115, 678, 910, 778, 681, 873, 95, 559, 91, 532, 175, 22, 957, 753, 231, 459, 819, 998, 716, 27, 231, 167, 550, 687, 256, 222, 528, 684, 309, 195, 661, 28, 656, 458, 241, 826, 284, 864, 186, 14, 877, 523, 998, 775, 95, 744, 786, 198, 543, 751, 317, 40, 34, 900, 855, 399, 902, 853, 417, 886, 102, 454, 991, 79, 967, 90, 814, 374, 806, 37, 749, 666, 336, 935, 19, 883, 457, 174, 355, 888, 740, 4, 240, 53, 932, 409, 660, 763, 990, 365, 938, 582, 186, 967, 417, 102, 273, 277, 196, 394, 690, 832, 350, 65, 181, 612, 914, 663, 252, 950, 892, 449, 239, 889, 388, 246, 490, 226, 554, 237, 513, 888, 22, 215, 729, 379, 48, 235, 191, 123, 554, 794, 789, 745, 941, 392, 387, 109, 908, 275, 365, 198, 823, 270, 119, 885, 777, 727, 51, 389, 707, 465, 739, 196, 285, 842, 66, 525, 37, 927, 251, 238, 230, 543, 162, 84, 635, 166, 933, 692, 104, 348, 600, 23, 525, 246, 160, 250, 845, 996, 250, 429, 744, 743, 160, 71, 175, 125, 535, 322, 205, 955, 393, 153, 764, 784, 352, 902, 987, 254, 948, 428, 216, 927, 744, 968, 697, 622, 168, 262, 109, 544, 299, 283, 998, 323, 450, 594, 235, 924, 984, 183, 365, 344, 164, 917, 400, 273, 64, 285, 402, 815, 175, 47, 665, 600, 211, 609, 395, 540, 901, 752, 667, 236, 581, 943, 122, 666, 752, 79, 782, 838, 423, 545, 409, 821, 164, 133, 471, 333, 76, 474, 747, 264, 30, 940, 29, 670, 814, 362, 179, 200, 746, 840, 995, 75, 147, 534, 223, 818, 711, 641, 486, 892, 94, 429, 784, 775, 839, 165, 745, 90, 473, 219, 172, 809, 672, 667, 827, 620, 586, 392, 121, 186, 260, 881, 293, 579, 492, 211, 880, 991, 771, 853, 122, 111, 509, 536, 555, 69, 296, 579, 498, 545, 81, 350, 25, 675, 894, 322, 183, 333, 984, 214, 902, 829, 744, 36, 707, 624, 236, 850, 380, 519, 915, 218, 15, 685 };
            int   expected = 495619;
            int   result   = SimpleArraySum.simpleArraySum(array);

            Assert.AreEqual(expected, result);
        }