Commit Graph

36 Commits

Author SHA1 Message Date
Adam Rocska 6d98c2d5ff Added docs' to the control byte.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 13:12:01 +02:00
Adam Rocska cc4305f2d2 Can't get tests any better than they are for now.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 13:05:09 +02:00
Adam Rocska 3901f2dc1a Tests refactored.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 12:56:15 +02:00
Adam Rocska 5f7d42e458 Moved the typealiases outside of the class context. I have an idea to make compilation faster.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 12:12:06 +02:00
Adam Rocska bda2c458b2 Payload size definition tests given. Ugly as hell. Must refactor.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-05-01 12:09:10 +02:00
Adam Rocska 7fff4d7a13 Removed unnecessary comment.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 23:38:35 +02:00
Adam Rocska 7bde17165c Source is good. Now let's make the tests faster and better.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 22:33:32 +02:00
Adam Rocska 927efa97f7 Half way done with the generalized solution. Tests are green. And I am proud.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 19:45:21 +02:00
Adam Rocska c349a08525 Simplified sliceFrom value definition
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 18:47:00 +02:00
Adam Rocska 8c21e60f20 Added the test case for the range between 30 and 65.821 but now it's time to refactor.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 18:44:28 +02:00
Adam Rocska cbe43c1bc6 ControlByte payloadSize determined for values between 29 and 284. On to the next challenge.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 18:11:56 +02:00
Adam Rocska 934dadc269 ControlByte payloadSize determined for values smaller than 29. On to the next challenge.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 16:59:44 +02:00
Adam Rocska 7bc612efee ControlByte constructor got changed, because the byte sequence is at least 1 byte, at most 5 bytes long.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 14:43:44 +02:00
Adam Rocska b020fb2944 Finally got a concept on how to program this in a non-convoluted way.
- Extended UInt8 with a nice and juicy bitmask helper function
- Foundation for a ControlByte type

Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-30 13:27:23 +02:00
Adam Rocska 5ee582ca93 Had the usual unnecessary header comment from CLion.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 19:37:33 +02:00
Adam Rocska 90a7e857ec We for sure will need an enum for MaxMind DB data types.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 19:36:10 +02:00
Adam Rocska 311cdc3342 Figured out a rather unorthodox, and unsafe way of transforming `Data` to certain Swift types. Will come in handy to represent the MaxMindDB somehow.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 18:01:16 +02:00
Adam Rocska 067ee0be4c Bada test class naming fixed.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 17:07:57 +02:00
Adam Rocska bbda680aff Fixed the bad test naming.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:53:03 +02:00
Adam Rocska c1c9c55d4f New test data just found a bug. Fixed it.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:51:36 +02:00
Adam Rocska 4a854026ec Removed useless dead code remaining from previous states.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:44:57 +02:00
Adam Rocska fe668afb9e Better assertions.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:44:20 +02:00
Adam Rocska e06afd3d7a Making the tests & the API nicer.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:41:19 +02:00
Adam Rocska 028b7ae23d Removed stray dead code.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
2020-04-29 16:13:48 +02:00
Adam Rocska 58cf90498d uncommented rest of the tests. 2020-04-29 16:04:30 +02:00
Adam Rocska a98db16edb Bugfixing in the search algorithm. 2020-04-29 15:53:22 +02:00
Adam Rocska 661125fc80 I was an inattentive prick, and misimplemented the algorithm. It works now. 2020-04-29 13:29:16 +02:00
Adam Rocska c0dba1887b Committing half made not working code to ask for some help. The search algorithm gets stuck at index 20990 as if it was an overflow, while it can't be an overflow, since it's a typealias for Int, and also, it's not a square number. Weird. Bughunting. 2020-04-29 13:03:10 +02:00
Adam Rocska 3173807987 Removed submodules, and doing stuff. 2020-04-28 11:08:31 +02:00
Adam Rocska f90617555a Added a license. Yea, GNU GPL seems to be a good enough idea here. 2020-04-27 21:46:34 +02:00
Adam Rocska 3c798fe572 I managed to make the "libmaxminddb" dir disappear. 2020-04-27 21:39:40 +02:00
Adam Rocska 4fc53d970c I figured out what the problem was. I was an idiot in many ways :
- the submodule had an invalid detatched head commit hash. Dunno why.
- the package swift file defined a wrong version number for libmaxminddb. Moral of the story : don't be an ass.
- some leftover garbage from automake made me believe I was done
- potato
2020-04-27 21:27:28 +02:00
Adam Rocska 731ac6da87 Trying to resolve this header file issue. 2020-04-27 17:30:45 +02:00
Adam Rocska b948d24911 Added "maxminddb_config.h" in the helper package, because "libmaxmind" has it built via automake autoreconf. 2020-04-27 16:45:40 +02:00
Adam Rocska 6d4ad564f4 Git clone note added. 2020-04-27 15:26:48 +02:00
Adam Rocska 3b32769926 Initial Commit. 2020-04-27 15:25:09 +02:00