Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.
You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.
A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.
#
#include <criterion/criterion.h>
#include <stdio.h>
Test(the_multiply_function, should_pass_all_the_tests_provided) {
for (int i = 0; i < 50; i++) {
puts("blah blah blah");
cr_expect_eq(1, 0);
}
}
Some user interactions, such as resizing and scrolling, can create a huge number of browser events in a short period of time. If listeners attached to these events take a long time to execute, the user's browser can start to slow down significantly. To mitigate this issue, we want to to implement a throttle function that will detect clusters of events and reduce the number of times we call an expensive function.
Your function will accept an array representing a stream of event timestamps and return an array representing the times that a callback should have been called. If an event happens within wait time of the previous event, it is part of the same cluster. Your function should satisfy the following use cases:
- Firing once on the first event in a cluster, e.g. as soon as the window starts resizing.
- Firing once after the last event in a cluster, e.g. after the user window stops resizing.
- Firing every interval milliseconds during a cluster, e.g. every 100ms while the window is resizing.
function throttle(wait, onLast, onFirst, interval, timestamps) {
let ret = [];
let cluster = [timestamps[0]];
for(let i=1; i<timestamps.length; i++) {
if(timestamps[i] - timestamps[i-1] <= wait) {
cluster.push(timestamps[i]);
} else {
let clusterEventTimes = evaluateCluster(wait, onLast, onFirst, interval, cluster);
clusterEventTimes.forEach( function(el){ ret.push(el); });
cluster = [timestamps[i]];
}
if(i == timestamps.length-1) {
let clusterEventTimes = evaluateCluster(wait, onLast, onFirst, interval, cluster);
clusterEventTimes.forEach( function(el){ ret.push(el); });
}
}
return ret;
}
// Determines all times when an event needs to be fired
function evaluateCluster(wait, onLast, onFirst, interval, cluster){
let ret = [];
if(onFirst) {
ret.push(cluster[0]); // push cluster start
}
if(interval != 0) {
let maxInterval = cluster[cluster.length-1];
if(onLast) {
maxInterval += wait;
}
for(let intEv = cluster[0]+interval; intEv < maxInterval; intEv+=interval) {
ret.push(intEv);
}
}
if(onLast) {
ret.push(cluster[cluster.length-1]+wait); // push cluster end
}
return ret;
}
// TODO: Replace examples and use TDD development by writing your own tests
describe('default tests', function() {
it('test1', function(){
Test.assertSimilar(throttle(20, false, true, 0, [0,10,20,30]), [0]);
});
it('test2', function(){
Test.assertSimilar(throttle(20, true, false, 0, [0,10,20,30]), [50]);
});
it('test3', function(){
Test.assertSimilar(throttle(20, false, true, 20, [0,10,20,30]), [0,20]);
});
it('test4', function(){
Test.assertSimilar(throttle(20, false, true, 0, [0,10,40]), [0,40]);
});
it('test5', function(){
Test.assertSimilar(throttle(20, true, false, 0, [0,10,40]), [30,60]);
});
it('test6', function(){
Test.assertSimilar(throttle(20, true, true, 0, [0,10,50]), [0,30,50,70]);
});
it('test7', function(){
Test.assertSimilar(throttle(20, true, true, 10, [0,10,50]), [0,10,20,30,50,60,70]);
});
});
Set 1 Challenge 1 for the cryptopal crypto challenges (https://cryptopals.com/sets/1/challenges/1).
Convert hex to base64
function hexToBase64(hex) {
return hex;
}
// TODO: Replace examples and use TDD development by writing your own tests
// These are some CW specific test methods available:
// Test.expect(boolean, [optional] message)
// Test.assertEquals(actual, expected, [optional] message)
// Test.assertSimilar(actual, expected, [optional] message)
// Test.assertNotEquals(actual, expected, [optional] message)
// NodeJS assert is also automatically required for you.
// assert(true)
// assert.strictEqual({a: 1}, {a: 1})
// assert.deepEqual({a: [{b: 1}]}, {a: [{b: 1}]})
// You can also use Chai (http://chaijs.com/) by requiring it yourself
// var expect = require("chai").expect;
// var assert = require("chai").assert;
// require("chai").should();
describe("Solution", function(){
it("should test for something", function(){
Test.assertEquals(hexToBase64(
'49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d'),
'SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t', 'Sample test provied');
});
});
You will be given an array of integers and a target value. Determine the number of pairs of array elements that have a difference equal to the target value.
For example, given an array of [1,2,3,4] and a target value of 1, we have three pairs meeting the condition. 2 - 1 = 1, 3 - 2 = 1, and 4 - 3 = 1.
Input Format:
The first line contains n and k, the number of array elements and the target value.
The second line contains n space-separated integers of the array.
Constraints:
2 ≤ n ≤ 105
0 < k < 109
each integer element arr[i], will conform to 0 < arr[i] < 2^31 - 1
each integer arr[i] will be unique
Output Format
An integer representing the number of pairs of integers whose difference is k.
Sample Input:
5, 2, [1, 5, 3, 4, 2]
Sample Output:
3
Explanation:
There are 3 pairs of integers in the set with a difference of 2: [5,3], [4,2], and [3,1].
function pairs(num_elements, target_value, array) {
return 0;
}
// TODO: Replace examples and use TDD development by writing your own tests
// These are some CW specific test methods available:
// Test.expect(boolean, [optional] message)
// Test.assertEquals(actual, expected, [optional] message)
// Test.assertSimilar(actual, expected, [optional] message)
// Test.assertNotEquals(actual, expected, [optional] message)
// NodeJS assert is also automatically required for you.
// assert(true)
// assert.strictEqual({a: 1}, {a: 1})
// assert.deepEqual({a: [{b: 1}]}, {a: [{b: 1}]})
// You can also use Chai (http://chaijs.com/) by requiring it yourself
// var expect = require("chai").expect;
// var assert = require("chai").assert;
// require("chai").should();
describe('default tests', function() {
it('t01', function(){
Test.assertSimilar(pairs(226, 687, [967551, 42711, 652888, 556131, 432461, 689084, 878716, 707516, 462627, 719131, 921983, 626364, 4162, 381455, 628368, 434733, 845482, 789342, 129922, 384203, 516975, 872544, 958157, 257969, 383516, 972027, 753530, 579132, 732314, 692990, 938898, 673695, 304274, 911598, 386363, 643777, 897942, 705604, 307205, 691832, 525153, 13560, 131633, 967903, 704917, 719007, 275998, 823133, 381356, 694812, 130946, 14247, 881464, 212321, 535615, 388113, 263786, 993408, 303132, 347246, 957012, 356253, 80278, 682192, 79591, 22168, 399471, 130259, 302213, 146877, 143512, 464001, 323710, 716383, 252562, 704230, 528752, 385676, 433835, 84087, 324397, 19622, 726853, 400158, 765711, 879403, 717070, 796189, 630429, 735240, 899316, 897255, 682879, 943532, 548896, 650909, 128885, 156561, 260454, 861309, 463314, 396080, 486644, 483429, 306518, 579819, 726166, 319856, 689771, 346559, 466803, 340669, 602785, 686432, 259959, 146736, 878107, 718444, 272951, 371357, 690458, 625990, 672321, 968982, 211634, 966184, 806955, 421135, 486063, 350431, 856525, 674382, 968295, 709010, 81652, 874036, 487437, 966921, 318376, 402219, 956325, 319682, 346722, 112336, 643090, 670617, 700593, 580506, 695051, 996996, 486750, 989387, 738565, 873231, 311817, 351118, 77220, 129572, 900003, 880777, 109146, 675069, 829732, 420069, 519779, 692670, 391266, 683566, 349744, 629055, 305831, 14934, 216260, 302900, 347933, 85417, 307892, 367031, 433148, 431774, 871170, 955638, 629386, 252687, 151756, 290426, 642403, 213008, 693677, 349307, 80965, 376767, 879481, 177826, 382142, 591034, 733001, 967608, 381793, 957699, 382829, 251634, 641716, 226476, 530957, 871857, 658236, 615467, 401532, 681505, 485376, 694364, 144675, 23169, 673008, 146049, 581193, 461940, 22324, 641029, 878794, 620846, 558429, 6994, 41576, 717757]), 80);
});
it('t02', function(){
Test.assertSimilar(pairs(520, 1341, [480247, 690951, 368650, 575544, 932592, 321567, 652970, 963956, 746702, 824511, 980999, 242171, 75168, 144120, 203281, 992812, 430432, 46770, 566884, 92507, 792622, 718045, 789412, 790753, 802355, 881533, 612820, 506671, 502468, 665638, 66191, 951403, 922175, 881334, 291814, 742679, 370213, 713716, 14949, 629095, 91166, 894145, 178277, 835114, 896011, 824973, 920015, 269023, 234465, 402146, 357349, 395469, 910656, 176710, 711413, 726112, 433114, 96368, 686702, 297662, 135664, 95027, 998231, 820113, 699691, 528591, 250234, 797555, 199258, 688762, 783282, 281335, 190961, 349489, 587162, 850086, 639235, 74994, 718529, 123181, 552080, 250564, 403128, 431140, 442349, 16543, 502801, 701950, 456529, 772458, 91184, 654812, 193933, 347157, 933933, 870810, 400418, 127204, 318247, 348498, 406169, 15202, 918819, 102695, 150771, 918674, 90677, 710072, 823632, 856234, 906310, 160235, 506824, 510573, 836828, 901556, 699472, 500897, 403487, 510915, 141438, 148591, 312882, 801014, 954648, 281117, 1106, 262483, 252916, 841213, 623621, 794873, 957677, 657494, 394128, 810582, 914651, 798332, 391446, 755404, 505150, 679777, 822795, 314223, 389594, 606607, 125863, 17631, 344343, 458427, 259089, 989403, 181599, 593315, 988512, 580598, 936534, 367309, 799673, 271705, 320929, 360031, 503809, 846577, 22595, 641086, 535783, 494704, 68552, 338979, 807411, 64529, 368075, 428458, 717392, 466549, 476353, 686973, 923116, 821454, 429091, 934899, 794776, 97519, 632949, 41245, 995494, 172116, 959858, 681118, 118915, 293202, 248893, 344475, 156419, 212590, 492022, 124522, 826314, 682459, 692292, 561421, 238980, 498215, 205666, 403923, 94837, 552521, 792094, 716398, 188802, 619598, 632016, 543965, 329954, 207226, 569425, 157760, 392787, 2447, 14066, 715057, 385708, 84803, 233616, 242362, 970989, 17784, 406600, 190058, 631608, 516318, 580430, 53746, 3374, 279019, 855452, 996890, 748043, 813264, 313625, 97709, 772158, 369416, 485470, 678410, 900215, 195274, 634290, 491797, 949301, 496874, 833604, 821829, 431773, 717739, 807900, 43509, 173457, 3788, 201940, 465658, 120256, 311541, 413762, 75343, 642456, 700813, 317648, 159101, 559156, 88502, 781591, 740587, 315015, 521764, 832196, 635631, 708731, 741928, 356008, 346807, 316356, 716867, 894513, 496804, 797970, 130748, 586503, 642427, 646069, 957903, 444465, 707390, 633357, 656993, 237639, 11826, 316906, 103685, 356856, 494122, 838169, 486757, 843895, 270364, 750395, 793435, 463867, 242694, 365968, 87148, 689298, 491556, 878640, 416615, 200599, 854111, 356584, 328613, 490899, 315564, 88484, 490456, 991956, 658127, 736560, 197956, 349839, 404828, 523105, 483347, 584480, 995549, 312333, 585821, 16934, 975304, 896546, 874617, 693633, 365715, 244874, 492781, 318962, 234957, 13861, 645179, 315565, 568084, 492240, 893522, 881838, 552193, 658334, 129149, 314966, 654311, 13769, 576885, 40072, 115125, 879156, 403659, 228762, 453847, 324249, 744020, 238238, 407941, 306587, 771117, 148637, 598738, 17884, 48869, 560284, 794644, 356657, 594656, 251575, 596308, 869469, 895486, 812515, 260602, 877299, 222492, 525909, 662368, 965297, 706240, 88489, 358526, 187258, 502238, 875958, 490681, 915992, 588503, 12520, 643941, 762594, 98860, 504941, 319588, 126516, 897533, 334149, 996835, 130213, 316905, 145461, 180976, 170775, 570766, 537124, 998176, 506491, 729202, 493581, 103764, 655652, 359018, 411918, 77428, 974422, 313674, 125341, 744610, 578226, 236298, 935274, 494479, 482006, 883179, 484688, 465208, 121597, 459553, 310411, 208567, 811923, 93848, 493138, 505483, 357998, 174798, 226999, 222733, 892181, 962615, 94822, 451165, 683431, 591974, 15593, 473717, 845236, 775340, 348699, 524446, 18972, 842554, 148147, 527250, 65870, 656153, 353975, 692, 354667, 318989, 331295, 340320, 287289, 366734, 175369, 350830, 142779, 894555, 471557, 643768, 674387, 478608, 856793, 390002, 355316, 809241, 877815, 196615, 994153, 471101, 677069, 574203, 938399, 796214, 316307, 534142, 322908, 211249, 459768, 101003, 577077, 358690, 673046, 990184, 309958, 451388, 712375, 455188, 206055, 527236, 92525, 54848, 879981, 935193, 620939, 4902, 921883, 461109]), 205);
});
it('t03', function(){
Test.assertSimilar(pairs(517, 812, [954818, 241033, 33130, 770982, 268961, 612387, 4694, 920450, 204026, 578561, 905400, 335039, 911529, 343403, 531471, 818030, 429413, 666038, 584156, 471248, 607892, 942323, 539016, 279499, 703163, 376851, 501882, 281461, 929502, 480261, 241212, 571608, 775056, 168082, 338290, 54785, 939503, 147529, 569984, 837271, 763542, 64258, 377663, 716858, 877549, 776680, 875582, 438741, 967488, 44397, 572144, 797670, 530875, 493357, 53749, 936749, 899221, 212351, 350831, 316195, 876737, 251042, 135260, 818842, 537452, 311339, 257475, 768872, 628049, 25361, 580997, 355301, 256008, 595301, 904209, 426401, 924680, 896443, 950331, 716247, 512825, 552587, 152729, 949519, 796858, 492545, 225791, 317819, 532066, 680205, 926567, 679393, 379225, 580185, 25503, 552021, 819654, 141913, 6318, 43585, 629808, 535828, 177213, 659635, 326464, 958066, 669159, 181416, 161859, 531255, 228882, 930201, 422310, 678223, 621490, 494981, 852726, 168606, 539394, 420019, 530659, 241170, 310527, 161047, 778304, 165334, 532067, 250230, 308290, 100913, 367412, 375587, 102882, 194122, 709517, 935125, 507056, 5380, 121400, 658913, 136884, 359888, 57729, 516523, 596113, 787816, 125984, 676599, 310726, 259099, 111154, 482930, 228070, 654604, 723593, 768253, 514449, 515261, 665640, 162285, 619866, 573768, 27797, 984557, 582682, 7130, 821278, 466538, 133780, 539076, 366600, 179603, 420505, 797134, 996709, 928191, 171122, 826430, 643488, 924943, 278687, 918727, 921163, 267743, 770987, 970121, 309914, 248606, 869640, 799294, 681017, 229694, 441177, 521646, 584968, 661882, 828081, 794851, 733189, 810624, 619054, 169418, 349266, 919638, 11862, 947183, 637643, 162671, 956442, 137, 687541, 831830, 658823, 846874, 939067, 870452, 531254, 788628, 312151, 925755, 594489, 804310, 353298, 663602, 931373, 153704, 770689, 120433, 822976, 419961, 136072, 898409, 383863, 385168, 619671, 868828, 934205, 241758, 207414, 690642, 334985, 620678, 530443, 24691, 418881, 101048, 900414, 487782, 778734, 867204, 440365, 178837, 941353, 333180, 518147, 663064, 203276, 176401, 441989, 317007, 529847, 641419, 41593, 390615, 868016, 664414, 43217, 733386, 26985, 23067, 713811, 168894, 909976, 470423, 988165, 587318, 439553, 334173, 566198, 241073, 368224, 932637, 549585, 61730, 621295, 596925, 313384, 249418, 588185, 969112, 803436, 431037, 714623, 46021, 538264, 793837, 377211, 369036, 487426, 590675, 665226, 545079, 355599, 807544, 174867, 909409, 577749, 443148, 52125, 475864, 634439, 604989, 137354, 10467, 74439, 988392, 256663, 649813, 969924, 775868, 761389, 897597, 875925, 719927, 332549, 585409, 935017, 167270, 984261, 764237, 762559, 337478, 895631, 933501, 376399, 443960, 113017, 766100, 613220, 310631, 342518, 315132, 931013, 444566, 793679, 230506, 927379, 787004, 512013, 917915, 835208, 632284, 925574, 884006, 662694, 494169, 357721, 478300, 794892, 30754, 154979, 924904, 408428, 195091, 820466, 829705, 242344, 622203, 55597, 430225, 920351, 918014, 388179, 587174, 763371, 643855, 329021, 788941, 903756, 570796, 321960, 500240, 32318, 556670, 536640, 369848, 160235, 504277, 948707, 476676, 455603, 531907, 825618, 513637, 207980, 707135, 863491, 674064, 31506, 193467, 717502, 278804, 2224, 343330, 975012, 828893, 938691, 517335, 903746, 131159, 952104, 642231, 418069, 53973, 678581, 551795, 934313, 764183, 245063, 572956, 378023, 417257, 894495, 601777, 289281, 933393, 661070, 860326, 242267, 583344, 99424, 159423, 730079, 714228, 333361, 765978, 519341, 433382, 26173, 277526, 559659, 678299, 677411, 705419, 477488, 534738, 515711, 444772, 378475, 824806, 6545, 530442, 777110, 772611, 488868, 769065, 443706, 864337, 49922, 955630, 765166, 581720, 763013, 581058, 901332, 397636, 208226, 877924, 532878, 658011, 777492, 339102, 45209, 717420, 389803, 42405, 401865, 830517, 364816, 5506, 492644, 969871, 234527, 937067, 495793, 762201, 663647, 767441, 740649, 957254, 108566, 64095, 391627, 871162, 932581, 798453, 265449, 517287, 764354, 336666, 894007, 258287, 25757, 344142, 137696, 582532, 138508, 918826, 935937, 58478, 74468, 581870, 245226, 14684, 937879, 550320, 968300]), 192);
});
it('t16', function(){
Test.assertSimilar(pairs(5, 2, [1, 5, 3, 4, 2]), 3);
});
it('t17', function(){
Test.assertSimilar(pairs(10, 1, [363374326 364147530, 61825163, 1073065718, 1281246024, 1399469912, 428047635, 491595254, 879792181, 1069262793]), 0);
});
});
TIL that
instance Foldable ((,) a) where
foldMap f (_, y) = f y
foldr f z (_, y) = f y z
module FoldableTuple2 where
-- see the tests
module FoldableTuple2Spec where
import Test.Hspec
import Test.QuickCheck
spec :: Spec
spec = do
describe "(,) a" $ do
it "can be used with `length`" $
property $ \x -> length (x :: (Int, String)) `shouldBe` 1
it "can be used with `concat`" $
property $ \x -> concat (x :: (Int, String)) `shouldBe` snd x
Why when i try to run it i get the EOFError? I don't get it when i test in Python 3.6.5 Shell
from datetime import datetime
a = datetime.now()
c = str(a.hour) + str(a.minute)
b = input("Please, print the password here (without letters!): ")
if b.isdigit():
if(b == c):
print("ACCESS CONFIRMED")
else:
print("ACCESS DENIED")
else:
print("Please, don't print letters.")
print("Reset the program.")
# TODO: Replace examples and use TDD development by writing your own tests
# These are some of the methods available:
# test.expect(boolean, [optional] message)
# test.assert_equals(actual, expected, [optional] message)
# test.assert_not_equals(actual, expected, [optional] message)
# You can use Test.describe and Test.it to write BDD style test groupings
#include <stdlib.h>
typedef struct IntVector {
int *data;
} IntVector;
IntVector *IntVector_new(size_t size) {
IntVector *this = malloc(sizeof(IntVector));
this->data = calloc(sizeof(*this->data), size);
return this;
}
void IntVector_free(IntVector *this) {
free(this->data);
free(this);
}
int IntVector_get(const IntVector *this, size_t index) {
return this->data[index];
}
void IntVector_set(IntVector *this, size_t index, int value) {
return this->data[index] = value;
}
#include <criterion/criterion.h>
typedef struct IntVector IntVector;
Test(type_IntVector, should_be_implemented) {
IntVector *v = IntVector_new(2);
cr_assert_eq(IntVector_get(v, 0), 0);
cr_assert_eq(IntVector_get(v, 1), 0);
IntVector_set(v, 0, 1);
IntVector_set(v, 1, 2);
cr_assert_eq(IntVector_get(v, 0), 1);
cr_assert_eq(IntVector_get(v, 1), 2);
IntVector_free(v);
}
Yes and no. A queue can be implemented using one explicit stack by leveraging the technique of recursion in the "dequeue" operation but note that recursion is handled internally by a function call stack; hence, technically, there are still two stacks at work ;)
class Queue {
constructor() {
this._stack = []; // We will be using this array as a stack - only
// its push and pop operations will ever be called
}
enqueue(data) {
this._stack.push(data);
}
dequeue() {
if (this._stack.length === 1)
return this._stack.pop();
else {
var tmp = this._stack.pop(), result = this.dequeue();
this.enqueue(tmp);
return result;
}
}
}
Test.describe("Queue", function () {
Test.it("should have working enqueue and dequeue operations", function () {
var queue = new Queue();
queue.enqueue(1);
queue.enqueue(2);
queue.enqueue(3);
Test.assertEquals(queue.dequeue(), 1);
queue.enqueue(4);
queue.enqueue(5);
queue.enqueue(6);
Test.assertEquals(queue.dequeue(), 2);
Test.assertEquals(queue.dequeue(), 3);
queue.enqueue(7);
queue.enqueue(8);
queue.enqueue(9);
queue.enqueue(10);
Test.assertEquals(queue.dequeue(), 4);
Test.assertEquals(queue.dequeue(), 5);
Test.assertEquals(queue.dequeue(), 6);
Test.assertEquals(queue.dequeue(), 7);
Test.assertEquals(queue.dequeue(), 8);
Test.assertEquals(queue.dequeue(), 9);
Test.assertEquals(queue.dequeue(), 10);
});
});
def array_of_two(n)
raise 'n is not a number' unless n.is_a?(Numeric) # comment to fail test case
[n, n]
end
describe "Test#expect_error" do
Test.expect_error("array_of_two should raise an exception if N is not a number") { array_of_two('hello world') }
end
Just testing whether it is possible to "cheat" using the stack internally maintained by the computer to "implement" stack operations (between calls) in NASM.
Conclusion: It doesn't seem to be possible - at least with the way I did it, I got a segfault during the first call to stack_push()
which just attempts to push its second argument to the internal stack and returns to the caller, let alone the pop and peek operations. There also doesn't seem to be a reliable way to check whether the internal stack is empty. Thus, it should be safe to translate my recent Stacks kata into NASM.
global stack_push, stack_pop, stack_peek ; , stack_is_empty
section .text
stack_push:
push rsi
ret
stack_pop:
pop rsi
ret
stack_peek:
pop rsi
push rsi
ret
#include <criterion/criterion.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdio.h>
typedef struct node {
int data;
struct node *next;
} Node;
typedef struct {
Node *root;
} Stack;
void stack_push(Stack *stack, int data);
int stack_pop(Stack *stack);
int stack_peek(const Stack *stack);
// bool stack_is_empty(const Stack *stack);
Stack *new_stack() {
Stack *stack = malloc(sizeof(Stack));
stack->root = NULL;
return stack;
}
void delete_stack(Stack *stack) {
Node *nd = stack->root;
while (nd) {
Node *tmp = nd->next;
free(nd);
nd = tmp;
}
free(stack);
}
Test(Stack, should_work_for_some_examples) {
Stack *stack = new_stack();
printf("Stack initialized\n");
stack_push(stack, 1);
printf("First push operation successful!\n"); // This is never printed, suggesting that
// segfault occurs during first call to stack_push() attempting to cheat
stack_push(stack, 2);
stack_push(stack, 3);
cr_assert_eq(stack_peek(stack), 3);
cr_assert_eq(stack_pop(stack), 3);
cr_assert_eq(stack_peek(stack), 2);
cr_assert_eq(stack_pop(stack), 2);
cr_assert_eq(stack_peek(stack), 1);
cr_assert_eq(stack_pop(stack), 1);
delete_stack(stack);
}