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
tuple.test.ts91 linesDownload Raw Back to tests
1// @ts-ignore TS61332import { expect, test } from "vitest";3 4import * as z from "zod/v3";5import { ZodError } from "../ZodError.js";6import { util } from "../helpers/util.js";7 8const testTuple = z.tuple([z.string(), z.object({ name: z.literal("Rudy") }), z.array(z.literal("blue"))]);9const testData = ["asdf", { name: "Rudy" }, ["blue"]];10const badData = [123, { name: "Rudy2" }, ["blue", "red"]];11 12test("tuple inference", () => {13  const args1 = z.tuple([z.string()]);14  const returns1 = z.number();15  const func1 = z.function(args1, returns1);16  type func1 = z.TypeOf<typeof func1>;17  util.assertEqual<func1, (k: string) => number>(true);18});19 20test("successful validation", () => {21  const val = testTuple.parse(testData);22  expect(val).toEqual(["asdf", { name: "Rudy" }, ["blue"]]);23});24 25test("successful async validation", async () => {26  const val = await testTuple.parseAsync(testData);27  return expect(val).toEqual(testData);28});29 30test("failed validation", () => {31  const checker = () => {32    testTuple.parse([123, { name: "Rudy2" }, ["blue", "red"]] as any);33  };34  try {35    checker();36  } catch (err) {37    if (err instanceof ZodError) {38      expect(err.issues.length).toEqual(3);39    }40  }41});42 43test("failed async validation", async () => {44  const res = await testTuple.safeParse(badData);45  expect(res.success).toEqual(false);46  if (!res.success) {47    expect(res.error.issues.length).toEqual(3);48  }49  // try {50  //   checker();51  // } catch (err) {52  //   if (err instanceof ZodError) {53  //     expect(err.issues.length).toEqual(3);54  //   }55  // }56});57 58test("tuple with transformers", () => {59  const stringToNumber = z.string().transform((val) => val.length);60  const val = z.tuple([stringToNumber]);61 62  type t1 = z.input<typeof val>;63  util.assertEqual<t1, [string]>(true);64  type t2 = z.output<typeof val>;65  util.assertEqual<t2, [number]>(true);66  expect(val.parse(["1234"])).toEqual([4]);67});68 69test("tuple with rest schema", () => {70  const myTuple = z.tuple([z.string(), z.number()]).rest(z.boolean());71  expect(myTuple.parse(["asdf", 1234, true, false, true])).toEqual(["asdf", 1234, true, false, true]);72 73  expect(myTuple.parse(["asdf", 1234])).toEqual(["asdf", 1234]);74 75  expect(() => myTuple.parse(["asdf", 1234, "asdf"])).toThrow();76  type t1 = z.output<typeof myTuple>;77 78  util.assertEqual<t1, [string, number, ...boolean[]]>(true);79});80 81test("parse should fail given sparse array as tuple", () => {82  expect(() => testTuple.parse(new Array(3))).toThrow();83});84 85// test('tuple with optional elements', () => {86//   const result = z87//     .tuple([z.string(), z.number().optional()])88//     .safeParse(['asdf']);89//   expect(result).toEqual(['asdf']);90// });91 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai