about summary refs log tree commit diff stats
path: root/tests
Commit message (Expand)AuthorAgeFilesLines
...
* Fix two memleaks in test_parserMichael Vetter2019-10-061-0/+4
* Fix memleak in cmd_bookmark_list_shows_bookmarks unittestMichael Vetter2019-10-061-0/+16
* Fix memleak in test_parser unittestMichael Vetter2019-10-061-0/+2
* Fix memleak in test_callbacks unittestMichael Vetter2019-10-061-0/+2
* Fix memleak in test_parser unittestMichael Vetter2019-10-061-1/+7
* Fix test_callbacks memleakMichael Vetter2019-10-061-0/+5
* Fix test_jid unittest memleakMichael Vetter2019-10-061-0/+29
* Fix unittest memleak in test_cmd_joinMichael Vetter2019-10-051-0/+8
* Possibility to specify alternative config fileMichael Vetter2019-08-021-1/+1
* Add omemo_close stub for testsMichael Vetter2019-07-181-0/+1
* Add missing stub filePaul Fariello2019-07-171-0/+7
* Fix handling of encrypted carbonsPaul Fariello2019-06-211-1/+1
* Rename prof_message_t into ProfMessagePaul Fariello2019-06-202-7/+7
* Add prof_message_t to wrap all message attributesPaul Fariello2019-06-202-7/+7
* Fix prefs_get_str related leaks in unit testsMichael Vetter2019-06-193-0/+15
* Remove cons_mouse_setting() stubMichael Vetter2019-06-171-1/+0
* Cancel autoping timer on disconnect or connection lossDmitry Podgorny2019-06-031-0/+1
* Use mock_type() for casting mock()Frank Zschockelt2019-05-084-13/+13
* Use mock_ptr_type() to silence compiler warningsFrank Zschockelt2019-05-084-12/+12
* Update tests with new URLMichael Vetter2019-05-036-39/+39
* Add occupantswin_occupants_all() stub to unittestMichael Vetter2019-04-231-0/+1
* Fix server_event unit testsPaul Fariello2019-04-171-0/+5
* Fix OTR unit test after account_new API changePaul Fariello2019-04-171-1/+1
* Fix unit test after account_new API changePaul Fariello2019-04-176-18/+19
* Add omemo_start_sessions to unittest stubMichael Vetter2019-04-141-0/+1
* Automatically starts OMEMO if one identity is trustedPaul Fariello2019-04-101-0/+6
* Wait for discovery end to publish omemo devicelist and bundlePaul Fariello2019-04-101-0/+1
* Rework MUC reflected message filteringPaul Fariello2019-04-102-3/+6
* Add OMEMO in prefs commandPaul Fariello2019-04-101-0/+1
* Add required OMEMO stub for unit-testPaul Fariello2019-04-103-3/+69
* Fix broken support for case-sensitive account namesPhilip Flohr2019-02-223-8/+32
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
* tests: remove cflag -w and fix warningsDmitry Podgorny2018-10-318-101/+106
* Merge pull request #991 from paulfariello/feature/xep-0050Michael Vetter2018-09-276-15/+17
|\
| * Remove unused stup session_get_domainPaul Fariello2018-09-051-5/+0
| * Add connection_get_domain stub for testsPaul Fariello2018-09-051-0/+5
| * Add support for command config executionPaul Fariello2018-09-051-1/+1
| * Add conf win callbackPaul Fariello2018-09-051-2/+2
| * Rename mucconf wins into conf winsPaul Fariello2018-09-055-12/+12
| * Add command subcommands: list and execPaul Fariello2018-09-051-0/+2
* | Move p_sha1_hash() to stanza.cMichael Vetter2018-09-063-71/+0
|/
* fix: Missing pthread includeRafael Sadowski2018-08-131-0/+1
* Add room /me functional testsJames Booth2018-04-213-0/+58
* Add preferences for tab displayJames Booth2018-03-091-2/+7
* Add prefs for empty tabs and tab namesJames Booth2018-03-081-0/+1
* Show name in statusbar tabs WIPJames Booth2018-03-081-2/+2
* Use jid argument for /bookmark when in roomJames Booth2018-03-043-1/+139
* Add /rooms cacheJames Booth2018-02-052-0/+2
* Filter rooms by simple case insensitive textJames Booth2018-02-041-0/+9
* Fix tests, move glob creationJames Booth2018-01-275-11/+35
t;vc@akkartik.com> 2016-02-24 17:28:17 -0800 committer Kartik K. Agaram <vc@akkartik.com> 2016-02-24 17:28:17 -0800 2696 - start work on hash 'table' data structure' href='/akkartik/mu/commit/078table.mu?h=main&id=b17de7ba5219efe67ecd80b71c20769fbbf423a9'>b17de7ba ^
991d76f3 ^

b17de7ba ^

7a84094a ^
4f3d9065 ^

51b0936f ^
1ead3562 ^
4f3d9065 ^


760f683f ^
b17de7ba ^

7a84094a ^
4f3d9065 ^
7a84094a ^
b17de7ba ^
4f3d9065 ^
a0331a9b ^
aed29290 ^
51b0936f ^
b17de7ba ^
aed29290 ^
b17de7ba ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87



                                                                     

                                     
       
                         
                              

                         
           


   
                                       


                                                    
       
                          
                               

                         
           


   
                             

              
                                


                                 
                



              
                                                          


                                           
                                                                                 
                                           

 
                                                                                              

                  
                      
                  
                                             
                                                 
                                                                    
                                                                 
                                                    

                                           
                                                     

                                                           

 
                             

                  
                                         
                        


                          
                                                                

                  
                      
                  
                                             
                                                 
                                                                    
                                                                 
                                                    
                                           
                                                       
                               
 
# A table is like an array, except that its keys are not integers but
# arbitrary types.

scenario table-read-write [
  local-scope
  tab:&:table:num:num <- new-table 30
  run [
    put-index tab, 12, 34
    1:num/raw <- index tab, 12
  ]
  memory-should-contain [
    1 <- 34
  ]
]

scenario table-read-write-non-integer [
  local-scope
  key:text <- new [abc def]
  {tab: (address table text number)} <- new-table 30
  run [
    put-index tab, key, 34
    1:num/raw <- index tab, key
  ]
  memory-should-contain [
    1 <- 34
  ]
]

container table:_key:_value [
  length:num
  capacity:num
  data:&:@:table_row:_key:_value
]

container table_row:_key:_value [
  occupied?:bool
  key:_key
  value:_value
]

def new-table capacity:num -> result:&:table:_key:_value [
  local-scope
  load-ingredients
  result <- new {(table _key _value): type}
  data:&:@:table_row:_key:_value <- new {(table_row _key _value): type}, capacity
  *result <- merge 0/length, capacity, data
]

def put-index table:&:table:_key:_value, key:_key, value:_value -> table:&:table:_key:_value [
  local-scope
  load-ingredients
  hash:num <- hash key
  hash <- abs hash
  capacity:num <- get *table, capacity:offset
  _, hash <- divide-with-remainder hash, capacity
  hash <- abs hash  # in case hash overflows into a negative integer
  table-data:&:@:table_row:_key:_value <- get *table, data:offset
  x:table_row:_key:_value <- index *table-data, hash
  occupied?:bool <- get x, occupied?:offset
  not-occupied?:bool <- not occupied?:bool
  assert not-occupied?, [can't handle collisions yet]
  new-row:table_row:_key:_value <- merge 1/true, key, value
  *table-data <- put-index *table-data, hash, new-row
]

def abs n:num -> result:num [
  local-scope
  load-ingredients
  positive?:bool <- greater-or-equal n, 0
  return-if positive?, n
  result <- multiply n, -1
]

def index table:&:table:_key:_value, key:_key -> result:_value [
  local-scope
  load-ingredients
  hash:num <- hash key
  hash <- abs hash
  capacity:num <- get *table, capacity:offset
  _, hash <- divide-with-remainder hash, capacity
  hash <- abs hash  # in case hash overflows into a negative integer
  table-data:&:@:table_row:_key:_value <- get *table, data:offset
  x:table_row:_key:_value <- index *table-data, hash
  occupied?:bool <- get x, occupied?:offset
  assert occupied?, [can't handle missing elements yet]
  result <- get x, value:offset
]