about summary refs log blame commit diff stats
path: root/tests/unittests/test_contact.h
blob: 605573ea1bb27f086d938e44cb90e1f29331d3a5 (plain) (tree)























                                                                     
void contact_in_group(void** state);
void contact_not_in_group(void** state);
void contact_name_when_name_exists(void** state);
void contact_jid_when_name_not_exists(void** state);
void contact_string_when_name_exists(void** state);
void contact_string_when_name_not_exists(void** state);
void contact_string_when_default_resource(void** state);
void contact_presence_offline(void** state);
void contact_presence_uses_highest_priority(void** state);
void contact_presence_chat_when_same_prioroty(void** state);
void contact_presence_online_when_same_prioroty(void** state);
void contact_presence_away_when_same_prioroty(void** state);
void contact_presence_xa_when_same_prioroty(void** state);
void contact_presence_dnd(void** state);
void contact_subscribed_when_to(void** state);
void contact_subscribed_when_both(void** state);
void contact_not_subscribed_when_from(void** state);
void contact_not_subscribed_when_no_subscription_value(void** state);
void contact_not_available(void** state);
void contact_not_available_when_highest_priority_away(void** state);
void contact_not_available_when_highest_priority_xa(void** state);
void contact_not_available_when_highest_priority_dnd(void** state);
void contact_available_when_highest_priority_online(void** state);
void contact_available_when_highest_priority_chat(void** state);
local primes = task.Channel:new() > task.spawn(sieve, primes) > while true do > Window:addstr(primes:recv()) > Window:addstr(' ') > Window:refresh() > end >end - __teliva_timestamp: >Sat Feb 26 22:09:47 2022 __teliva_note: >clear screen when it fills up; pause on keypress > >In Teliva getch() implicitly refreshes the screen. main: >function main() > Window:nodelay(true) > Window:clear() > local primes = task.Channel:new() > task.spawn(sieve, primes) > local h, w = Window:getmaxyx() > while true do > Window:addstr(primes:recv()) > Window:addstr(' ') > local c = Window:getch() > if c then break end -- key pressed > local y, x = Window:getyx() > if y > h-1 then > Window:clear() > end > end > print('key pressed; done') > Window:nodelay(false) > Window:getch() >end - __teliva_timestamp: >Sat Feb 26 22:27:25 2022 doc:blurb: >Sieve of Eratosthenes >https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes > >A demonstration of tasks and channels, the primitives for (cooperative) concurrency in Teliva. > >We string together a cascade of tasks connected by channels. Every prime number gets a new task that prints the first incoming number, and then filters out multiples of it from the incoming channel. > >This approach has the advantage that we don't need to create an array of n numbers to compute primes less than n. > >However, we still need to create p tasks and p channels if there are p primes less than n. Probably not worth it, given tasks and channels are much larger than numbers. This is just a demo. > >The noticeable periodic pauses are perhaps due to garbage collection.