Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
map.test.ts111 linesDownload Raw Back to tests
1// @ts-ignore TS61332import { expect, test } from "vitest";3 4import * as z from "zod/v3";5import { ZodIssueCode } from "zod/v3";6import { util } from "../helpers/util.js";7 8const stringMap = z.map(z.string(), z.string());9type stringMap = z.infer<typeof stringMap>;10 11test("type inference", () => {12  util.assertEqual<stringMap, Map<string, string>>(true);13});14 15test("valid parse", () => {16  const result = stringMap.safeParse(17    new Map([18      ["first", "foo"],19      ["second", "bar"],20    ])21  );22  expect(result.success).toEqual(true);23  if (result.success) {24    expect(result.data.has("first")).toEqual(true);25    expect(result.data.has("second")).toEqual(true);26    expect(result.data.get("first")).toEqual("foo");27    expect(result.data.get("second")).toEqual("bar");28  }29});30 31test("valid parse async", async () => {32  const result = await stringMap.spa(33    new Map([34      ["first", "foo"],35      ["second", "bar"],36    ])37  );38  expect(result.success).toEqual(true);39  if (result.success) {40    expect(result.data.has("first")).toEqual(true);41    expect(result.data.has("second")).toEqual(true);42    expect(result.data.get("first")).toEqual("foo");43    expect(result.data.get("second")).toEqual("bar");44  }45});46 47test("throws when a Set is given", () => {48  const result = stringMap.safeParse(new Set([]));49  expect(result.success).toEqual(false);50  if (result.success === false) {51    expect(result.error.issues.length).toEqual(1);52    expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);53  }54});55 56test("throws when the given map has invalid key and invalid input", () => {57  const result = stringMap.safeParse(new Map([[42, Symbol()]]));58  expect(result.success).toEqual(false);59  if (result.success === false) {60    expect(result.error.issues.length).toEqual(2);61    expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);62    expect(result.error.issues[0].path).toEqual([0, "key"]);63    expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type);64    expect(result.error.issues[1].path).toEqual([0, "value"]);65  }66});67 68test("throws when the given map has multiple invalid entries", () => {69  // const result = stringMap.safeParse(new Map([[42, Symbol()]]));70 71  const result = stringMap.safeParse(72    new Map([73      [1, "foo"],74      ["bar", 2],75    ] as [any, any][]) as Map<any, any>76  );77 78  // const result = stringMap.safeParse(new Map([[42, Symbol()]]));79  expect(result.success).toEqual(false);80  if (result.success === false) {81    expect(result.error.issues.length).toEqual(2);82    expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);83    expect(result.error.issues[0].path).toEqual([0, "key"]);84    expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type);85    expect(result.error.issues[1].path).toEqual([1, "value"]);86  }87});88 89test("dirty", async () => {90  const map = z.map(91    z.string().refine((val) => val === val.toUpperCase(), {92      message: "Keys must be uppercase",93    }),94    z.string()95  );96  const result = await map.spa(97    new Map([98      ["first", "foo"],99      ["second", "bar"],100    ])101  );102  expect(result.success).toEqual(false);103  if (!result.success) {104    expect(result.error.issues.length).toEqual(2);105    expect(result.error.issues[0].code).toEqual(z.ZodIssueCode.custom);106    expect(result.error.issues[0].message).toEqual("Keys must be uppercase");107    expect(result.error.issues[1].code).toEqual(z.ZodIssueCode.custom);108    expect(result.error.issues[1].message).toEqual("Keys must be uppercase");109  }110});111 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai