Skip to main content
Glama
advanced-test-deepseek-coder-1.3b-2025-10-26T12-20-41-106Z.json4.77 kB
{ "model": "deepseek-coder:1.3b", "timestamp": "2025-10-26T11:55:38.858Z", "tests": [ { "id": 1, "name": "Basic Zig Syntax", "difficulty": "EASY", "prompt": "Generate a simple Zig function that returns the sum of two integers. Include the function signature and implementation only.", "response": "Sure! Here is an example in zig language which does exactly what we need : \n```zig \npub fn add(a: i32, b: i32) callconv(.C) i32 { // Function declaration with required parameters & return type (also declaring the calling convention as C for compatibility).\n const c = @addWithOverflow(@intCast(i64, a),@intCast(i64 ,b ), out); // Addition in zig uses i32 overflow flag and requires explicit casting to int. In case of addition if it results more than 31 bits (maximum limit for signed in", "duration": 17531, "success": true }, { "id": 2, "name": "Memory Allocation", "difficulty": "EASY", "prompt": "Write Zig code that allocates memory using an allocator and stores an integer. Show how to free it.", "response": "Here is a simple example of writing zig code in which we use the `new` keyword from C++-like language (C) with GPA Rust or Swift for creating, storing data into allocated memmory manually using allocator functions provided by LLVM and returning memory to pool manager. Here's an overview:\n\n```zig\nconst std = @import(\"std\"); // Importing standard library modules from zig compiler/standard-library package \npub fn main() void { // Defining a function in the module where our code will be runned,", "duration": 20481, "success": true }, { "id": 3, "name": "Error Handling", "difficulty": "MEDIUM", "prompt": "Show a Zig function that returns a Result type with either a success value or an error. Include error handling in the caller.", "response": "Here's how one might define such a `Zig` (Zero-cost abstractions) Function using Rust for typesafe functional programming, and its powerful builtin support to deal better errors/exceptions at compile time with result monads or by returning an enum type that can be either success case error.\nIn this example I'll use the `Result<T>` enums pattern which has two variants: Ok(value) for a successful computation, and Err() otherwise (error). In Rust you would normally handle errors using match stateme", "duration": 24948, "success": true }, { "id": 4, "name": "Structs & Methods", "difficulty": "MEDIUM", "prompt": "Create a Zig struct for a Point with x,y coordinates and a method to calculate distance from origin.", "response": "Here is an example of how the `Point` can be defined using zig's custom types (struct) in conjunction with methods that help find distances or similar tasks on it : \n```zig\npub fn main() void { \n var p1 = Point{ .x = 3, .y = 4 }; // Create a point object. \n\tstd.log(\"Point distance from origin: {}\", @sqrt(p1DistanceFromOrigin(&p1))); \n} \n \npub const Point = struct { x : f64 , y :f64}; \n pub fn pdistance (self: *const Point) f64{ return (@sqrt(@floatCast(i32, self.x", "duration": 1404177, "success": true }, { "id": 5, "name": "Generics", "difficulty": "HARD", "prompt": "Write a generic Zig function that works with any numeric type and returns the maximum of two values.", "response": "In TypeScript or JavaScript (NodeJS), we can create such a zignzu logic using template literals(Template strings) which provide string interpolation capabilities in modern javascript, this makes it easier to embed expressions inside string literal for formatting — thus removing the need of backticks. Below is an example:\n```typescript\nfunction maximum<T> (a : T , b : T): T { //Defining a generic function with type parameters 'T' allowing different types and return also same datatype as paramet", "duration": 8481, "success": true }, { "id": 6, "name": "Comptime Magic", "difficulty": "HARD", "prompt": "Show how to use comptime in Zig to compute a factorial at compile time. Include the function and its usage.", "response": "The following example demonstrates compiling with `zig` using an integer input (factorial of n) compiled-time computation by taking it as argument for recursion, which is then used within our main code segment that will compute a factorial based on user's choice via command line inputs in zig console. \n```zigenewasher:~/Downloads$ cat test_factorial.zig`", "duration": 1610, "success": true } ], "passed": 6, "failed": 0, "avgResponseTime": 246204.66666666666 }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fulgidus/zignet'

If you have feedback or need assistance with the MCP directory API, please join our Discord server