<commit_before>import { HexUtils } from "../../src/HexUtils"

const hex1 = { q: 0, r: 0, s: 0 }
const hex2 = { q: 0, r: -2, s: 2 }

const layout = {
  spacing: 6.0,
  orientation: {
    f0: 3.0 / 2.0,
    f1: 0.0,
    f2: Math.sqrt(3.0) / 2.0,
    f3: Math.sqrt(3.0),
    b0: 2.0 / 3.0,
    b1: 0.0,
    b2: -1.0 / 3.0,
    b3: Math.sqrt(3.0) / 3.0,
    startAngle: 0.0,
  },
  size: {
    x: 10,
    y: 10,
  },
  origin: {
    x: 0,
    y: 0,
  },
}

test("HexUtils.equals should work", () => {
  expect(HexUtils.equals(hex1, hex1)).toBe(true)
  expect(HexUtils.equals(hex1, hex2)).toBe(false)
})

test("HexUtils.add should work", () => {
  expect(HexUtils.add(hex1, hex2)).toEqual({ q: 0, r: -2, s: 2 })
})

test("HexUtils.subtract should work", () => {
  expect(HexUtils.subtract(hex1, hex2)).toEqual({ q: 0, r: 2, s: -2 })
})

test("HexUtils.multiply should work", () => {
  expect(HexUtils.multiply(hex1, 3)).toEqual({ q: 0, r: 0, s: 0 })
})

test("HexUtils.lengths should work", () => {
  expect(HexUtils.lengths(hex2)).toBe(2)
})

test("HexUtils.distance should work", () => {
  expect(HexUtils.distance(hex1, hex2)).toBe(2)
})

test("HexUtils.direction should work", () => {
  expect(HexUtils.direction(0)).toEqual({ q: 1, r: 0, s: -1 })
})

test("HexUtils.neighbour should work", () => {
  expect(HexUtils.neighbour(hex1, 1)).toEqual({ q: 1, r: -1, s: 0 })
})

test("HexUtils.neighbours should work", () => {
  expect(HexUtils.neighbours(hex1)).toEqual([
    { q: 1, r: 0, s: -1 },
    { q: 1, r: -1, s: 0 },
    { q: 0, r: -1, s: 1 },
    { q: -1, r: 0, s: 1 },
    { q: -1, r: 1, s: 0 },
    { q: 0, r: 1, s: -1 },
  ])
})

test("HexUtils.round should work when qDiff > rDiff && qDiff > sDiff", () => {
  expect(HexUtils.round({ q: 1.5, r: 0.3, s: 0.1 })).toEqual({
    q: -0,
    r: 0,
    s: 0,
  })
})

test("when qDiff !> rDiff || qDiff !> sDiff && rDiff > sDiff", () => {
  expect(HexUtils.round({ q: 0.123, r: -2.456, s: 2.789 })).toEqual({
    q: 0,
    r: -3,
    s: 3,<commit_msg>neighbour was changed to neighbor across all files. The new HexCoordinates type was applied to hex1 and hex2 test objects.<commit_after>import { HexUtils } from "../../src/HexUtils"
import { HexCoordinates } from "../../src/models/Hex"

const hex1: HexCoordinates = { q: 0, r: 0, s: 0 }
const hex2: HexCoordinates = { q: 0, r: -2, s: 2 }

const layout = {
  spacing: 6.0,
  orientation: {
    f0: 3.0 / 2.0,
    f1: 0.0,
    f2: Math.sqrt(3.0) / 2.0,
    f3: Math.sqrt(3.0),
    b0: 2.0 / 3.0,
    b1: 0.0,
    b2: -1.0 / 3.0,
    b3: Math.sqrt(3.0) / 3.0,
    startAngle: 0.0,
  },
  size: {
    x: 10,
    y: 10,
  },
  origin: {
    x: 0,
    y: 0,
  },
}

test("HexUtils.equals should work", () => {
  expect(HexUtils.equals(hex1, hex1)).toBe(true)
  expect(HexUtils.equals(hex1, hex2)).toBe(false)
})

test("HexUtils.add should work", () => {
  expect(HexUtils.add(hex1, hex2)).toEqual({ q: 0, r: -2, s: 2 })
})

test("HexUtils.subtract should work", () => {
  expect(HexUtils.subtract(hex1, hex2)).toEqual({ q: 0, r: 2, s: -2 })
})

test("HexUtils.multiply should work", () => {
  expect(HexUtils.multiply(hex1, 3)).toEqual({ q: 0, r: 0, s: 0 })
})

test("HexUtils.lengths should work", () => {
  expect(HexUtils.lengths(hex2)).toBe(2)
})

test("HexUtils.distance should work", () => {
  expect(HexUtils.distance(hex1, hex2)).toBe(2)
})

test("HexUtils.direction should work", () => {
  expect(HexUtils.direction(0)).toEqual({ q: 1, r: 0, s: -1 })
})

test("HexUtils.neighbor should work", () => {
  expect(HexUtils.neighbor(hex1, 1)).toEqual({ q: 1, r: -1, s: 0 })
})

test("HexUtils.neighbors should work", () => {
  expect(HexUtils.neighbors(hex1)).toEqual([
    { q: 1, r: 0, s: -1 },
    { q: 1, r: -1, s: 0 },
    { q: 0, r: -1, s: 1 },
    { q: -1, r: 0, s: 1 },
    { q: -1, r: 1, s: 0 },
    { q: 0, r: 1, s: -1 },
  ])
})

test("HexUtils.round should work when qDiff > rDiff && qDiff > sDiff", () => {
  expect(HexUtils.round({ q: 1.5, r: 0.3, s: 0.1 })).toEqual({
    q: -0,
    r: 0,
    s: 0,
  })
})

test("when qDiff !> rDiff || qDiff !> sDiff && rDiff > sDiff", () => {
  expect(HexUtils.round({ q: 0.123, r: -2.456, s: 2.789 })).toEqual({
    q: 0,
    r: -3,
    s: 3,
{'fraction_non_alphanumeric': 0.233245886000477, 'fraction_numerical': 0.06153112330073933, 'mean_word_length': 2.7379679144385025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7218691', 'n_tokens_mistral': 1950, 'n_tokens_neox': 1834, 'n_words': 446}