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.
03.1k
1// @ts-ignore TS61332import { expect, test } from "vitest";3 4import * as z from "zod/v3";5import { util } from "../helpers/util.js";6import { Mocker } from "./Mocker.js";7 8const literalStringSchema = z.literal("asdf");9const literalNumberSchema = z.literal(12);10const literalBooleanSchema = z.literal(true);11const literalBigIntSchema = z.literal(BigInt(42));12const MySymbol = Symbol("stuff");13const literalSymbolSchema = z.literal(MySymbol);14const stringSchema = z.string();15const numberSchema = z.number();16const bigintSchema = z.bigint();17const booleanSchema = z.boolean();18const dateSchema = z.date();19const symbolSchema = z.symbol();20 21const nullSchema = z.null();22const undefinedSchema = z.undefined();23const stringSchemaOptional = z.string().optional();24const stringSchemaNullable = z.string().nullable();25const numberSchemaOptional = z.number().optional();26const numberSchemaNullable = z.number().nullable();27const bigintSchemaOptional = z.bigint().optional();28const bigintSchemaNullable = z.bigint().nullable();29const booleanSchemaOptional = z.boolean().optional();30const booleanSchemaNullable = z.boolean().nullable();31const dateSchemaOptional = z.date().optional();32const dateSchemaNullable = z.date().nullable();33const symbolSchemaOptional = z.symbol().optional();34const symbolSchemaNullable = z.symbol().nullable();35 36const val = new Mocker();37 38test("literal string correct", () => {39 expect(literalStringSchema.parse("asdf")).toBe("asdf");40});41 42test("literal string incorrect", () => {43 const f = () => literalStringSchema.parse("not_asdf");44 expect(f).toThrow();45});46 47test("literal string number", () => {48 const f = () => literalStringSchema.parse(123);49 expect(f).toThrow();50});51 52test("literal string boolean", () => {53 const f = () => literalStringSchema.parse(true);54 expect(f).toThrow();55});56 57test("literal string boolean", () => {58 const f = () => literalStringSchema.parse(true);59 expect(f).toThrow();60});61 62test("literal string object", () => {63 const f = () => literalStringSchema.parse({});64 expect(f).toThrow();65});66 67test("literal number correct", () => {68 expect(literalNumberSchema.parse(12)).toBe(12);69});70 71test("literal number incorrect", () => {72 const f = () => literalNumberSchema.parse(13);73 expect(f).toThrow();74});75 76test("literal number number", () => {77 const f = () => literalNumberSchema.parse(val.string);78 expect(f).toThrow();79});80 81test("literal number boolean", () => {82 const f = () => literalNumberSchema.parse(val.boolean);83 expect(f).toThrow();84});85 86test("literal number object", () => {87 const f = () => literalStringSchema.parse({});88 expect(f).toThrow();89});90 91test("literal boolean correct", () => {92 expect(literalBooleanSchema.parse(true)).toBe(true);93});94 95test("literal boolean incorrect", () => {96 const f = () => literalBooleanSchema.parse(false);97 expect(f).toThrow();98});99 100test("literal boolean number", () => {101 const f = () => literalBooleanSchema.parse("asdf");102 expect(f).toThrow();103});104 105test("literal boolean boolean", () => {106 const f = () => literalBooleanSchema.parse(123);107 expect(f).toThrow();108});109 110test("literal boolean object", () => {111 const f = () => literalBooleanSchema.parse({});112 expect(f).toThrow();113});114 115test("literal bigint correct", () => {116 expect(literalBigIntSchema.parse(BigInt(42))).toBe(BigInt(42));117});118 119test("literal bigint incorrect", () => {120 const f = () => literalBigIntSchema.parse(BigInt(43));121 expect(f).toThrow();122});123 124test("literal bigint number", () => {125 const f = () => literalBigIntSchema.parse("asdf");126 expect(f).toThrow();127});128 129test("literal bigint boolean", () => {130 const f = () => literalBigIntSchema.parse(123);131 expect(f).toThrow();132});133 134test("literal bigint object", () => {135 const f = () => literalBigIntSchema.parse({});136 expect(f).toThrow();137});138 139test("literal symbol", () => {140 util.assertEqual<z.infer<typeof literalSymbolSchema>, typeof MySymbol>(true);141 literalSymbolSchema.parse(MySymbol);142 expect(() => literalSymbolSchema.parse(Symbol("asdf"))).toThrow();143});144 145test("parse stringSchema string", () => {146 stringSchema.parse(val.string);147});148 149test("parse stringSchema number", () => {150 const f = () => stringSchema.parse(val.number);151 expect(f).toThrow();152});153 154test("parse stringSchema boolean", () => {155 const f = () => stringSchema.parse(val.boolean);156 expect(f).toThrow();157});158 159test("parse stringSchema undefined", () => {160 const f = () => stringSchema.parse(val.undefined);161 expect(f).toThrow();162});163 164test("parse stringSchema null", () => {165 const f = () => stringSchema.parse(val.null);166 expect(f).toThrow();167});168 169test("parse numberSchema string", () => {170 const f = () => numberSchema.parse(val.string);171 expect(f).toThrow();172});173 174test("parse numberSchema number", () => {175 numberSchema.parse(val.number);176});177 178test("parse numberSchema bigint", () => {179 const f = () => numberSchema.parse(val.bigint);180 expect(f).toThrow();181});182 183test("parse numberSchema boolean", () => {184 const f = () => numberSchema.parse(val.boolean);185 expect(f).toThrow();186});187 188test("parse numberSchema undefined", () => {189 const f = () => numberSchema.parse(val.undefined);190 expect(f).toThrow();191});192 193test("parse numberSchema null", () => {194 const f = () => numberSchema.parse(val.null);195 expect(f).toThrow();196});197 198test("parse bigintSchema string", () => {199 const f = () => bigintSchema.parse(val.string);200 expect(f).toThrow();201});202 203test("parse bigintSchema number", () => {204 const f = () => bigintSchema.parse(val.number);205 expect(f).toThrow();206});207 208test("parse bigintSchema bigint", () => {209 bigintSchema.parse(val.bigint);210});211 212test("parse bigintSchema boolean", () => {213 const f = () => bigintSchema.parse(val.boolean);214 expect(f).toThrow();215});216 217test("parse bigintSchema undefined", () => {218 const f = () => bigintSchema.parse(val.undefined);219 expect(f).toThrow();220});221 222test("parse bigintSchema null", () => {223 const f = () => bigintSchema.parse(val.null);224 expect(f).toThrow();225});226 227test("parse booleanSchema string", () => {228 const f = () => booleanSchema.parse(val.string);229 expect(f).toThrow();230});231 232test("parse booleanSchema number", () => {233 const f = () => booleanSchema.parse(val.number);234 expect(f).toThrow();235});236 237test("parse booleanSchema boolean", () => {238 booleanSchema.parse(val.boolean);239});240 241test("parse booleanSchema undefined", () => {242 const f = () => booleanSchema.parse(val.undefined);243 expect(f).toThrow();244});245 246test("parse booleanSchema null", () => {247 const f = () => booleanSchema.parse(val.null);248 expect(f).toThrow();249});250 251// ==============252 253test("parse dateSchema string", () => {254 const f = () => dateSchema.parse(val.string);255 expect(f).toThrow();256});257 258test("parse dateSchema number", () => {259 const f = () => dateSchema.parse(val.number);260 expect(f).toThrow();261});262 263test("parse dateSchema boolean", () => {264 const f = () => dateSchema.parse(val.boolean);265 expect(f).toThrow();266});267 268test("parse dateSchema date", () => {269 dateSchema.parse(val.date);270});271 272test("parse dateSchema undefined", () => {273 const f = () => dateSchema.parse(val.undefined);274 expect(f).toThrow();275});276 277test("parse dateSchema null", () => {278 const f = () => dateSchema.parse(val.null);279 expect(f).toThrow();280});281 282test("parse dateSchema invalid date", async () => {283 try {284 await dateSchema.parseAsync(new Date("invalid"));285 } catch (err) {286 expect((err as z.ZodError).issues[0].code).toEqual(z.ZodIssueCode.invalid_date);287 }288});289// ==============290 291test("parse symbolSchema string", () => {292 const f = () => symbolSchema.parse(val.string);293 expect(f).toThrow();294});295 296test("parse symbolSchema number", () => {297 const f = () => symbolSchema.parse(val.number);298 expect(f).toThrow();299});300 301test("parse symbolSchema boolean", () => {302 const f = () => symbolSchema.parse(val.boolean);303 expect(f).toThrow();304});305 306test("parse symbolSchema date", () => {307 const f = () => symbolSchema.parse(val.date);308 expect(f).toThrow();309});310 311test("parse symbolSchema symbol", () => {312 symbolSchema.parse(val.symbol);313});314 315test("parse symbolSchema undefined", () => {316 const f = () => symbolSchema.parse(val.undefined);317 expect(f).toThrow();318});319 320test("parse symbolSchema null", () => {321 const f = () => symbolSchema.parse(val.null);322 expect(f).toThrow();323});324 325// ==============326 327test("parse undefinedSchema string", () => {328 const f = () => undefinedSchema.parse(val.string);329 expect(f).toThrow();330});331 332test("parse undefinedSchema number", () => {333 const f = () => undefinedSchema.parse(val.number);334 expect(f).toThrow();335});336 337test("parse undefinedSchema boolean", () => {338 const f = () => undefinedSchema.parse(val.boolean);339 expect(f).toThrow();340});341 342test("parse undefinedSchema undefined", () => {343 undefinedSchema.parse(val.undefined);344});345 346test("parse undefinedSchema null", () => {347 const f = () => undefinedSchema.parse(val.null);348 expect(f).toThrow();349});350 351test("parse nullSchema string", () => {352 const f = () => nullSchema.parse(val.string);353 expect(f).toThrow();354});355 356test("parse nullSchema number", () => {357 const f = () => nullSchema.parse(val.number);358 expect(f).toThrow();359});360 361test("parse nullSchema boolean", () => {362 const f = () => nullSchema.parse(val.boolean);363 expect(f).toThrow();364});365 366test("parse nullSchema undefined", () => {367 const f = () => nullSchema.parse(val.undefined);368 expect(f).toThrow();369});370 371test("parse nullSchema null", () => {372 nullSchema.parse(val.null);373});374 375test("primitive inference", () => {376 util.assertEqual<z.TypeOf<typeof literalStringSchema>, "asdf">(true);377 util.assertEqual<z.TypeOf<typeof literalNumberSchema>, 12>(true);378 util.assertEqual<z.TypeOf<typeof literalBooleanSchema>, true>(true);379 util.assertEqual<z.TypeOf<typeof literalBigIntSchema>, bigint>(true);380 util.assertEqual<z.TypeOf<typeof stringSchema>, string>(true);381 util.assertEqual<z.TypeOf<typeof numberSchema>, number>(true);382 util.assertEqual<z.TypeOf<typeof bigintSchema>, bigint>(true);383 util.assertEqual<z.TypeOf<typeof booleanSchema>, boolean>(true);384 util.assertEqual<z.TypeOf<typeof dateSchema>, Date>(true);385 util.assertEqual<z.TypeOf<typeof symbolSchema>, symbol>(true);386 387 util.assertEqual<z.TypeOf<typeof nullSchema>, null>(true);388 util.assertEqual<z.TypeOf<typeof undefinedSchema>, undefined>(true);389 util.assertEqual<z.TypeOf<typeof stringSchemaOptional>, string | undefined>(true);390 util.assertEqual<z.TypeOf<typeof stringSchemaNullable>, string | null>(true);391 util.assertEqual<z.TypeOf<typeof numberSchemaOptional>, number | undefined>(true);392 util.assertEqual<z.TypeOf<typeof numberSchemaNullable>, number | null>(true);393 util.assertEqual<z.TypeOf<typeof bigintSchemaOptional>, bigint | undefined>(true);394 util.assertEqual<z.TypeOf<typeof bigintSchemaNullable>, bigint | null>(true);395 util.assertEqual<z.TypeOf<typeof booleanSchemaOptional>, boolean | undefined>(true);396 util.assertEqual<z.TypeOf<typeof booleanSchemaNullable>, boolean | null>(true);397 util.assertEqual<z.TypeOf<typeof dateSchemaOptional>, Date | undefined>(true);398 util.assertEqual<z.TypeOf<typeof dateSchemaNullable>, Date | null>(true);399 util.assertEqual<z.TypeOf<typeof symbolSchemaOptional>, symbol | undefined>(true);400 util.assertEqual<z.TypeOf<typeof symbolSchemaNullable>, symbol | null>(true);401 402 // [403 // literalStringSchemaTest,404 // literalNumberSchemaTest,405 // literalBooleanSchemaTest,406 // literalBigIntSchemaTest,407 // stringSchemaTest,408 // numberSchemaTest,409 // bigintSchemaTest,410 // booleanSchemaTest,411 // dateSchemaTest,412 // symbolSchemaTest,413 414 // nullSchemaTest,415 // undefinedSchemaTest,416 // stringSchemaOptionalTest,417 // stringSchemaNullableTest,418 // numberSchemaOptionalTest,419 // numberSchemaNullableTest,420 // bigintSchemaOptionalTest,421 // bigintSchemaNullableTest,422 // booleanSchemaOptionalTest,423 // booleanSchemaNullableTest,424 // dateSchemaOptionalTest,425 // dateSchemaNullableTest,426 // symbolSchemaOptionalTest,427 // symbolSchemaNullableTest,428 429 // ];430});431 432test("get literal value", () => {433 expect(literalStringSchema.value).toEqual("asdf");434});435 436test("optional convenience method", () => {437 z.ostring().parse(undefined);438 z.onumber().parse(undefined);439 z.oboolean().parse(undefined);440});441 