Browse Source

Merge branch 'master' of github.com:theonesean/aight

master
James Fenn 1 year ago
parent
commit
442ed3316b
2 changed files with 24 additions and 0 deletions
  1. +10
    -0
      CONTRIBUTING.md
  2. +14
    -0
      source/util/hasher.d

+ 10
- 0
CONTRIBUTING.md View File

@@ -0,0 +1,10 @@
# Contribution Guidelines

Howdy! Thanks for being interested enough in improving this dumb tool that you’re reading instructions for how to do so. Here are some general guidelines to make sure your code is up to our (very lax) standards.

1. All PRs should be made to the `stagin` branch. Yes, that spelling is correct. Sean typed it in wrong when we first started the project, but we decided to just keep it this way, because we're assholes.
2. Make sure your PRs pass Codacy’s tests. (This will be very easy because Codacy can’t parse D.)
3. Don’t worry too much about coding or documentation style. Most functions should have Javadoc-style descriptions, but if it’s obvious, don’t worry about it. This will become more specific if it needs to.
4. Reference issues in PRs. If there isn’t a relevant issue, it would be super cool if you opened one!
5. If there’s a task manager that you (and preferably several other people) use, and you’d like to use it in `aight`, submit an issue with the `new-provider` tag. For bonus points, describe its API/format/general technical details.
6. Horse. ​(:horse:.)

+ 14
- 0
source/util/hasher.d View File

@@ -1,5 +1,7 @@
module util.hasher;

import std.stdio: writeln;

class Hasher {

private string[ulong] hashCodes;
@@ -25,3 +27,15 @@ class Hasher {
}

}

///
unittest {
Hasher hasher = new Hasher();
hasher.restrict(1);
ulong a = hasher.hash("apple");
ulong b = hasher.hash("banana");
assert(a != b, "Hash nums shouldn't be duplicated.");
assert(a != 1 && b != 1, "Restricted values should be respected.");

writeln("util/hasher.d ----- CHECK");
}

Loading…
Cancel
Save