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";5 6test("string coercion", () => {7 const schema = z.coerce.string();8 expect(schema.parse("sup")).toEqual("sup");9 expect(schema.parse("")).toEqual("");10 expect(schema.parse(12)).toEqual("12");11 expect(schema.parse(0)).toEqual("0");12 expect(schema.parse(-12)).toEqual("-12");13 expect(schema.parse(3.14)).toEqual("3.14");14 expect(schema.parse(BigInt(15))).toEqual("15");15 expect(schema.parse(Number.NaN)).toEqual("NaN");16 expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual("Infinity");17 expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual("-Infinity");18 expect(schema.parse(true)).toEqual("true");19 expect(schema.parse(false)).toEqual("false");20 expect(schema.parse(null)).toEqual("null");21 expect(schema.parse(undefined)).toEqual("undefined");22 expect(schema.parse({ hello: "world!" })).toEqual("[object Object]");23 expect(schema.parse(["item", "another_item"])).toEqual("item,another_item");24 expect(schema.parse([])).toEqual("");25 expect(schema.parse(new Date("2022-01-01T00:00:00.000Z"))).toEqual(new Date("2022-01-01T00:00:00.000Z").toString());26});27 28test("number coercion", () => {29 const schema = z.coerce.number();30 expect(schema.parse("12")).toEqual(12);31 expect(schema.parse("0")).toEqual(0);32 expect(schema.parse("-12")).toEqual(-12);33 expect(schema.parse("3.14")).toEqual(3.14);34 expect(schema.parse("")).toEqual(0);35 expect(() => schema.parse("NOT_A_NUMBER")).toThrow(); // z.ZodError36 expect(schema.parse(12)).toEqual(12);37 expect(schema.parse(0)).toEqual(0);38 expect(schema.parse(-12)).toEqual(-12);39 expect(schema.parse(3.14)).toEqual(3.14);40 expect(schema.parse(BigInt(15))).toEqual(15);41 expect(() => schema.parse(Number.NaN)).toThrow(); // z.ZodError42 expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual(Number.POSITIVE_INFINITY);43 expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual(Number.NEGATIVE_INFINITY);44 expect(schema.parse(true)).toEqual(1);45 expect(schema.parse(false)).toEqual(0);46 expect(schema.parse(null)).toEqual(0);47 expect(() => schema.parse(undefined)).toThrow(); // z.ZodError48 expect(() => schema.parse({ hello: "world!" })).toThrow(); // z.ZodError49 expect(() => schema.parse(["item", "another_item"])).toThrow(); // z.ZodError50 expect(schema.parse([])).toEqual(0);51 expect(schema.parse(new Date(1670139203496))).toEqual(1670139203496);52});53 54test("boolean coercion", () => {55 const schema = z.coerce.boolean();56 expect(schema.parse("true")).toEqual(true);57 expect(schema.parse("false")).toEqual(true);58 expect(schema.parse("0")).toEqual(true);59 expect(schema.parse("1")).toEqual(true);60 expect(schema.parse("")).toEqual(false);61 expect(schema.parse(1)).toEqual(true);62 expect(schema.parse(0)).toEqual(false);63 expect(schema.parse(-1)).toEqual(true);64 expect(schema.parse(3.14)).toEqual(true);65 expect(schema.parse(BigInt(15))).toEqual(true);66 expect(schema.parse(Number.NaN)).toEqual(false);67 expect(schema.parse(Number.POSITIVE_INFINITY)).toEqual(true);68 expect(schema.parse(Number.NEGATIVE_INFINITY)).toEqual(true);69 expect(schema.parse(true)).toEqual(true);70 expect(schema.parse(false)).toEqual(false);71 expect(schema.parse(null)).toEqual(false);72 expect(schema.parse(undefined)).toEqual(false);73 expect(schema.parse({ hello: "world!" })).toEqual(true);74 expect(schema.parse(["item", "another_item"])).toEqual(true);75 expect(schema.parse([])).toEqual(true);76 expect(schema.parse(new Date(1670139203496))).toEqual(true);77});78 79test("bigint coercion", () => {80 const schema = z.coerce.bigint();81 expect(schema.parse("5")).toEqual(BigInt(5));82 expect(schema.parse("0")).toEqual(BigInt(0));83 expect(schema.parse("-5")).toEqual(BigInt(-5));84 expect(() => schema.parse("3.14")).toThrow(); // not a z.ZodError!85 expect(schema.parse("")).toEqual(BigInt(0));86 expect(() => schema.parse("NOT_A_NUMBER")).toThrow(); // not a z.ZodError!87 expect(schema.parse(5)).toEqual(BigInt(5));88 expect(schema.parse(0)).toEqual(BigInt(0));89 expect(schema.parse(-5)).toEqual(BigInt(-5));90 expect(() => schema.parse(3.14)).toThrow(); // not a z.ZodError!91 expect(schema.parse(BigInt(5))).toEqual(BigInt(5));92 expect(() => schema.parse(Number.NaN)).toThrow(); // not a z.ZodError!93 expect(() => schema.parse(Number.POSITIVE_INFINITY)).toThrow(); // not a z.ZodError!94 expect(() => schema.parse(Number.NEGATIVE_INFINITY)).toThrow(); // not a z.ZodError!95 expect(schema.parse(true)).toEqual(BigInt(1));96 expect(schema.parse(false)).toEqual(BigInt(0));97 expect(() => schema.parse(null)).toThrow(); // not a z.ZodError!98 expect(() => schema.parse(undefined)).toThrow(); // not a z.ZodError!99 expect(() => schema.parse({ hello: "world!" })).toThrow(); // not a z.ZodError!100 expect(() => schema.parse(["item", "another_item"])).toThrow(); // not a z.ZodError!101 expect(schema.parse([])).toEqual(BigInt(0));102 expect(schema.parse(new Date(1670139203496))).toEqual(BigInt(1670139203496));103});104 105test("date coercion", () => {106 const schema = z.coerce.date();107 expect(schema.parse(new Date().toDateString())).toBeInstanceOf(Date);108 expect(schema.parse(new Date().toISOString())).toBeInstanceOf(Date);109 expect(schema.parse(new Date().toUTCString())).toBeInstanceOf(Date);110 expect(schema.parse("5")).toBeInstanceOf(Date);111 expect(schema.parse("2000-01-01")).toBeInstanceOf(Date);112 // expect(schema.parse("0")).toBeInstanceOf(Date);113 // expect(schema.parse("-5")).toBeInstanceOf(Date);114 // expect(schema.parse("3.14")).toBeInstanceOf(Date);115 expect(() => schema.parse("")).toThrow(); // z.ZodError116 expect(() => schema.parse("NOT_A_DATE")).toThrow(); // z.ZodError117 expect(schema.parse(5)).toBeInstanceOf(Date);118 expect(schema.parse(0)).toBeInstanceOf(Date);119 expect(schema.parse(-5)).toBeInstanceOf(Date);120 expect(schema.parse(3.14)).toBeInstanceOf(Date);121 expect(() => schema.parse(BigInt(5))).toThrow(); // not a z.ZodError!122 expect(() => schema.parse(Number.NaN)).toThrow(); // z.ZodError123 expect(() => schema.parse(Number.POSITIVE_INFINITY)).toThrow(); // z.ZodError124 expect(() => schema.parse(Number.NEGATIVE_INFINITY)).toThrow(); // z.ZodError125 expect(schema.parse(true)).toBeInstanceOf(Date);126 expect(schema.parse(false)).toBeInstanceOf(Date);127 expect(schema.parse(null)).toBeInstanceOf(Date);128 expect(() => schema.parse(undefined)).toThrow(); // z.ZodError129 expect(() => schema.parse({ hello: "world!" })).toThrow(); // z.ZodError130 expect(() => schema.parse(["item", "another_item"])).toThrow(); // z.ZodError131 expect(() => schema.parse([])).toThrow(); // z.ZodError132 expect(schema.parse(new Date())).toBeInstanceOf(Date);133});134 