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
record.test.ts172 linesDownload Raw Back to tests
1// @ts-ignore TS61332import { expect, test } from "vitest";3 4import * as z from "zod/v3";5import { util } from "../helpers/util.js";6 7const booleanRecord = z.record(z.boolean());8type booleanRecord = z.infer<typeof booleanRecord>;9 10const recordWithEnumKeys = z.record(z.enum(["Tuna", "Salmon"]), z.string());11type recordWithEnumKeys = z.infer<typeof recordWithEnumKeys>;12 13const recordWithLiteralKeys = z.record(z.union([z.literal("Tuna"), z.literal("Salmon")]), z.string());14type recordWithLiteralKeys = z.infer<typeof recordWithLiteralKeys>;15 16test("type inference", () => {17  util.assertEqual<booleanRecord, Record<string, boolean>>(true);18 19  util.assertEqual<recordWithEnumKeys, Partial<Record<"Tuna" | "Salmon", string>>>(true);20 21  util.assertEqual<recordWithLiteralKeys, Partial<Record<"Tuna" | "Salmon", string>>>(true);22});23 24test("methods", () => {25  booleanRecord.optional();26  booleanRecord.nullable();27});28 29test("string record parse - pass", () => {30  booleanRecord.parse({31    k1: true,32    k2: false,33    1234: false,34  });35});36 37test("string record parse - fail", () => {38  const badCheck = () =>39    booleanRecord.parse({40      asdf: 1234,41    } as any);42  expect(badCheck).toThrow();43 44  expect(() => booleanRecord.parse("asdf")).toThrow();45});46 47test("string record parse - fail", () => {48  const badCheck = () =>49    booleanRecord.parse({50      asdf: {},51    } as any);52  expect(badCheck).toThrow();53});54 55test("string record parse - fail", () => {56  const badCheck = () =>57    booleanRecord.parse({58      asdf: [],59    } as any);60  expect(badCheck).toThrow();61});62 63test("key schema", () => {64  const result1 = recordWithEnumKeys.parse({65    Tuna: "asdf",66    Salmon: "asdf",67  });68  expect(result1).toEqual({69    Tuna: "asdf",70    Salmon: "asdf",71  });72 73  const result2 = recordWithLiteralKeys.parse({74    Tuna: "asdf",75    Salmon: "asdf",76  });77  expect(result2).toEqual({78    Tuna: "asdf",79    Salmon: "asdf",80  });81 82  // shouldn't require us to specify all props in record83  const result3 = recordWithEnumKeys.parse({84    Tuna: "abcd",85  });86  expect(result3).toEqual({87    Tuna: "abcd",88  });89 90  // shouldn't require us to specify all props in record91  const result4 = recordWithLiteralKeys.parse({92    Salmon: "abcd",93  });94  expect(result4).toEqual({95    Salmon: "abcd",96  });97 98  expect(() =>99    recordWithEnumKeys.parse({100      Tuna: "asdf",101      Salmon: "asdf",102      Trout: "asdf",103    })104  ).toThrow();105 106  expect(() =>107    recordWithLiteralKeys.parse({108      Tuna: "asdf",109      Salmon: "asdf",110 111      Trout: "asdf",112    })113  ).toThrow();114});115 116// test("record element", () => {117//   expect(booleanRecord.element).toBeInstanceOf(z.ZodBoolean);118// });119 120test("key and value getters", () => {121  const rec = z.record(z.string(), z.number());122 123  rec.keySchema.parse("asdf");124  rec.valueSchema.parse(1234);125  rec.element.parse(1234);126});127 128test("is not vulnerable to prototype pollution", async () => {129  const rec = z.record(130    z.object({131      a: z.string(),132    })133  );134 135  const data = JSON.parse(`136    {137      "__proto__": {138        "a": "evil"139      },140      "b": {141        "a": "good"142      }143    }144  `);145 146  const obj1 = rec.parse(data);147  expect(obj1.a).toBeUndefined();148 149  const obj2 = rec.safeParse(data);150  expect(obj2.success).toBe(true);151  if (obj2.success) {152    expect(obj2.data.a).toBeUndefined();153  }154 155  const obj3 = await rec.parseAsync(data);156  expect(obj3.a).toBeUndefined();157 158  const obj4 = await rec.safeParseAsync(data);159  expect(obj4.success).toBe(true);160  if (obj4.success) {161    expect(obj4.data.a).toBeUndefined();162  }163});164 165test("dont parse undefined values", () => {166  const result1 = z.record(z.any()).parse({ foo: undefined });167 168  expect(result1).toEqual({169    foo: undefined,170  });171});172 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai