diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-06-11 02:37:11 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-06-11 02:37:11 +0200 |
commit | 7c1a38999c2eebfbd0939c9f8f8f864f10d9bc9a (patch) | |
tree | 258af2b9ab6c31640f4454dd22867ac688e8345b /src/test.cpp | |
parent | 6210a9d50b216f22a8b755c2c9daea66659514f0 (diff) | |
download | biboumi-7c1a38999c2eebfbd0939c9f8f8f864f10d9bc9a.tar.gz biboumi-7c1a38999c2eebfbd0939c9f8f8f864f10d9bc9a.tar.bz2 biboumi-7c1a38999c2eebfbd0939c9f8f8f864f10d9bc9a.tar.xz biboumi-7c1a38999c2eebfbd0939c9f8f8f864f10d9bc9a.zip |
Rewrite the whole IID usage
IRC users and channels are now distinguished by the separator used in the
IID (% or !).
ref #2468
Diffstat (limited to 'src/test.cpp')
-rw-r--r-- | src/test.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test.cpp b/src/test.cpp index 216608a..87ab49c 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -290,5 +290,41 @@ int main() std::cout << correctjid2 << std::endl; assert(correctjid2 == "zigougou@poez.io"); + /** + * IID parsing + */ + std::cout << color << "Testing IID parsing…" << reset << std::endl; + Iid iid1("foo!irc.example.org"); + std::cout << std::to_string(iid1) << std::endl; + assert(std::to_string(iid1) == "foo!irc.example.org"); + assert(iid1.get_local() == "foo"); + assert(iid1.get_server() == "irc.example.org"); + assert(!iid1.is_channel); + assert(iid1.is_user); + + Iid iid2("#test%irc.example.org"); + std::cout << std::to_string(iid2) << std::endl; + assert(std::to_string(iid2) == "#test%irc.example.org"); + assert(iid2.get_local() == "#test"); + assert(iid2.get_server() == "irc.example.org"); + assert(iid2.is_channel); + assert(!iid2.is_user); + + Iid iid3("%irc.example.org"); + std::cout << std::to_string(iid3) << std::endl; + assert(std::to_string(iid3) == "%irc.example.org"); + assert(iid3.get_local() == ""); + assert(iid3.get_server() == "irc.example.org"); + assert(iid3.is_channel); + assert(!iid3.is_user); + + Iid iid4("irc.example.org"); + std::cout << std::to_string(iid4) << std::endl; + assert(std::to_string(iid4) == "irc.example.org"); + assert(iid4.get_local() == ""); + assert(iid4.get_server() == "irc.example.org"); + assert(!iid4.is_channel); + assert(!iid4.is_user); + return 0; } |