/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to tests/libvee/stack.vala

  • Committer: Gustav Hartvigsson
  • Date: 2024-12-21 23:51:45 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20241221235145-4metak6z6u6vf6b0
[General] Major refactoring. Utils -> Vee nenaming.
Todo: Split libvee into a different library??

Also: Fixed spelling mistakes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using Utils;
 
1
using Vee;
2
2
using GLib;
3
3
 
4
4
void stack_test () {
5
 
  Test.add_func (UTIL_TEST_STACK_PREFIX + "new", () => {
 
5
  Test.add_func (VEE_TEST_STACK_PREFIX + "new", () => {
6
6
    var stk = new Stack<int> ();
7
7
    if (stk == null) {
8
8
      Test.fail ();
17
17
    
18
18
  });
19
19
 
20
 
  Test.add_func (UTIL_TEST_STACK_PREFIX + "push_pop", () => {
 
20
  Test.add_func (VEE_TEST_STACK_PREFIX + "push_pop", () => {
21
21
    var stk = new Stack<int> ();
22
22
    stk.push (1337);
23
23
    if (stk.is_empty ()) {
31
31
    if (stk.is_empty () == false) {
32
32
      Test.fail ();
33
33
      Test.message ("Stack reports that it's not empty," +
34
 
                    " when it's only value has been poped.");
 
34
                    " when it's only value has been popped.");
35
35
    }
36
36
    
37
37
  });
38
38
 
39
39
 
40
 
  Test.add_func (UTIL_TEST_STACK_PREFIX + "value", () => {
 
40
  Test.add_func (VEE_TEST_STACK_PREFIX + "value", () => {
41
41
    var stk = new Stack<int> ();
42
42
    
43
43
    stk.push (1337);
44
44
 
45
45
    if (stk.peek () != 1337) {
46
46
      Test.fail ();
47
 
      Test.message ("Peeked value did not match exepcted value.");
 
47
      Test.message ("Peeked value did not match expected value.");
48
48
    }
49
49
 
50
50
    if (stk.pop () != 1337) {
51
51
      Test.fail ();
52
 
      Test.message ("Poped value does not match expected value.");
 
52
      Test.message ("Popped value does not match expected value.");
53
53
    }
54
54
    
55
55
    foreach (var i in new Range (0, 10000) ) {
60
60
      int got_val = stk.pop ();
61
61
      if (i != got_val) {
62
62
         Test.fail ();
63
 
         Test.message ("Wrong value: Expeted %i, get %i.",
 
63
         Test.message ("Wrong value: Experted %i, get %i.",
64
64
                       i, got_val);
65
65
      }
66
66
    }