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
recursive.test.ts198 linesDownload Raw Back to tests
1// @ts-ignore TS61332import { test } from "vitest";3 4import { z } from "zod/v3";5 6interface Category {7  name: string;8  subcategories: Category[];9}10 11const testCategory: Category = {12  name: "I",13  subcategories: [14    {15      name: "A",16      subcategories: [17        {18          name: "1",19          subcategories: [20            {21              name: "a",22              subcategories: [],23            },24          ],25        },26      ],27    },28  ],29};30 31test("recursion with z.late.object", () => {32  const Category: z.ZodType<Category> = z.late.object(() => ({33    name: z.string(),34    subcategories: z.array(Category),35  }));36  Category.parse(testCategory);37});38 39test("recursion with z.lazy", () => {40  const Category: z.ZodType<Category> = z.lazy(() =>41    z.object({42      name: z.string(),43      subcategories: z.array(Category),44    })45  );46  Category.parse(testCategory);47});48 49test("schema getter", () => {50  z.lazy(() => z.string()).schema.parse("asdf");51});52 53type LinkedList = null | { value: number; next: LinkedList };54 55const linkedListExample = {56  value: 1,57  next: {58    value: 2,59    next: {60      value: 3,61      next: {62        value: 4,63        next: null,64      },65    },66  },67};68 69test("recursion involving union type", () => {70  const LinkedListSchema: z.ZodType<LinkedList> = z.lazy(() =>71    z.union([72      z.null(),73      z.object({74        value: z.number(),75        next: LinkedListSchema,76      }),77    ])78  );79  LinkedListSchema.parse(linkedListExample);80});81 82// interface A {83//   val: number;84//   b: B;85// }86 87// interface B {88//   val: number;89//   a: A;90// }91 92// const A: z.ZodType<A> = z.late.object(() => ({93//   val: z.number(),94//   b: B,95// }));96 97// const B: z.ZodType<B> = z.late.object(() => ({98//   val: z.number(),99//   a: A,100// }));101 102// const Alazy: z.ZodType<A> = z.lazy(() => z.object({103//   val: z.number(),104//   b: B,105// }));106 107// const Blazy: z.ZodType<B> = z.lazy(() => z.object({108//   val: z.number(),109//   a: A,110// }));111 112// const a: any = { val: 1 };113// const b: any = { val: 2 };114// a.b = b;115// b.a = a;116 117// test('valid check', () => {118//   A.parse(a);119//   B.parse(b);120// });121 122// test("valid check lazy", () => {123//   A.parse({val:1, b:});124//   B.parse(b);125// });126 127// test('masking check', () => {128//   const FragmentOnA = z129//     .object({130//       val: z.number(),131//       b: z132//         .object({133//           val: z.number(),134//           a: z135//             .object({136//               val: z.number(),137//             })138//             .nonstrict(),139//         })140//         .nonstrict(),141//     })142//     .nonstrict();143 144//   const fragment = FragmentOnA.parse(a);145//   fragment;146// });147 148// test('invalid check', () => {149//   expect(() => A.parse({} as any)).toThrow();150// });151 152// test('schema getter', () => {153//   (A as z.ZodLazy<any>).schema;154// });155 156// test("self recursion with cyclical data", () => {157//   interface Category {158//     name: string;159//     subcategories: Category[];160//   }161 162//   const Category: z.ZodType<Category> = z.late.object(() => ({163//     name: z.string(),164//     subcategories: z.array(Category),165//   }));166 167//   const untypedCategory: any = {168//     name: "Category A",169//   };170//   // creating a cycle171//   untypedCategory.subcategories = [untypedCategory];172//   Category.parse(untypedCategory);173// });174 175// test("self recursion with base type", () => {176//   const BaseCategory = z.object({177//     name: z.string(),178//   });179//   type BaseCategory = z.infer<typeof BaseCategory>;180 181//   type Category = BaseCategory & { subcategories: Category[] };182 183//   const Category: z.ZodType<Category> = z.late184//     .object(() => ({185//       subcategories: z.array(Category),186//     }))187//     .extend({188//       name: z.string(),189//     });190 191//   const untypedCategory: any = {192//     name: "Category A",193//   };194//   // creating a cycle195//   untypedCategory.subcategories = [untypedCategory];196//   Category.parse(untypedCategory); // parses successfully197// });198 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai