GithubHelp home page GithubHelp logo

davidastevenson / extendible-hashing Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 305 KB

An old project from my university days refreshed to modern C++, with automated testing added

C++ 99.66% C 0.20% Makefile 0.14%

extendible-hashing's Introduction

extendible-hashing

An old project from my university days refreshed to modern C++, with automated testing added

  • Catch2 is used for testing. (Not included in this repo.)
  • GoogleTest is also used for testing.

The compilation prerequisites are included in this Vagrantfile repo, so get that first if necessary.

Basic compiliation and running notes:

make [catch2test] [gtest]

Running catch2 tests:

./catch2test

Running googletest tests:

./gtest

Cleaning up

make clean

Status

  • various lib/ sources now compiled and have tests (combination of googletest and catch2)
  • indexholder discovered to not even be calling any bit_op_lib functions, however! I probably had intended to refactor common operations into it, but never completed the job.
    • later look to change indexholder implementation to use bit_op_lib?
    • indexholder interface is unclear
      • initial tests were failing, but after understanding the expected usage, resolved it
      • rejuvenating this old code is an exercise, but typically something should be done about the interface
        • documentation at minimum, alternatively a better interface / implementation would be best
  • look to "modernize" the source
    • e.g.
      • rather than char strings?
      • enums
  • other refactoring
    • some of the API is not so caller / test friendly

TODO

  • Complete tests around main extendiblehashfile
  • Tidy up TODO items throughout source

NOTES

LESSONS LEARNED

  • surprisingly, I was using plain "delete" against arrays in the original code
    • when deleting arrays created on the heap with new, delete[] must be used, not delete
    • this tidbit got a brief mention in my old C++ text, but perhaps I never knew this? A NetBSD compiler quirk?
  • don't waste time going down the rabbit hole of memory issues
    • just install valgrind, and learn the basics
    • upon using valgrind, I was quickly able to identify an issue that resulted in program crashes
      • probably, back in 2000/2001, I had got stuck with this issue and that was where I left the code
    • gdb also essential

extendible-hashing's People

Contributors

davidastevenson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.