File: util.vala

package info (click to toggle)
dino-im 0.5.1%2Bgit20251115.1deacee-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 7,188 kB
  • sloc: ansic: 394; cpp: 231; xml: 92; python: 55; makefile: 13
file content (24 lines) | stat: -rw-r--r-- 590 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Xmpp.Util;

namespace Xmpp.Test {

class UtilTest : Gee.TestCase {
    public UtilTest() {
        base("util");

        add_hex_test(0x0, "");
        add_hex_test(0x123abc, "123abc");
        add_hex_test(0x0, "0x123abc");
        add_hex_test(0xa, "A quick brown fox jumps over the lazy dog.");
        add_hex_test(0xfeed, "   FEED ME   ");
    }

    private void add_hex_test(int expected, string str) {
        string test_name = @"from_hex(\"$(str)\")";
        add_test(test_name, () => {
            fail_if_not_eq_int(expected, (int)from_hex(str));
        });
    }
}

}