Coder Social home page Coder Social logo

asstdlib's Introduction

👋 Hi there! I'm Alihan SARAÇ

👇For more information, contact to me. 👇

🤠About Me🤠 🔗Contact🔗
Computer Science Student saracalihan.com
Web, IOT, Robotic Twitter
Istanbul-TURKEY Mail
Swimming, Kickbox, RC Toys LinkedIn
Pronouns: He/Him Kommunity

asstdlib's People

Contributors

saracalihan avatar

Watchers

 avatar

asstdlib's Issues

stuck

stuck data structure implementation

Most useful String functions

  • StringView.starts_with(char* )
  • StringView.ends_with(char* )
  • StringView.replace(char*, char* )
  • StringView.replace_all(char*, char* )

Native Vector type

Currently, we use std::vector for the dynamic array type. We should implement a native list type without using any other library.

The most important feature is the CPU caching mechanism. We have to use an array to store data because the CPU can cache the completed array but if we use iterator-style data store it point following data and the CPU can not cache it.

Pages can be stored in the linked list. We don't need to cache all pages. Maybe the default page size can be 100.

vector

simple unsigned array implementation

Test library

Description

We should add test functions. We have two main jestish function to test code

  • Describe: This function contains a test group. It has a label and body.
  • Test: This function is the primary test function. It waits for the return value then the value is false which means to test is failed.

Example usage:

#include <ASstdlib/Test>

Describe("User Table", {
    Test('client get empty array when user not found', {
        // code
        return false;
    })

    Test('client get true from 'isAdmin()' function when role is admin', {
        // code
        return true;
    })
})

Describe("Utilities", {
    Test('isFalsy() ...', {
        // code
        return true;
    })
})

// User Table:
//     ❌ - client gets an empty array when the user not found
//     ✔️ - client get true from 'isAdmin()' function when role is admin
// Utilities:
//     ✔️ - isFalsy() ...
//
// Failed test: 1
// Failed group: 1
// Total test: 3
// Total group: 2
// Time: 1.35s

Run test

We need to a flow for testing this library's codes. A simple make action is enough for this job.

  1. Add tests folder to the root level
  2. Write test files for all c++ files with its names. e.g. tests/Date.cpp
  3. compile only tests folder then run it
make test

ErrorOr<T> implementation

currently, we throw exceptions on unexpected errors or something went wrong. But, it crashes the whole workflow. So we need to wrapper for the functions.

ErrorOr<T> {
  value: T = NULL,
  error: Exception = NULL,
  has_error: boolean = false,
  error_message: string = NULL,
}
int getUserCount(bool countAdmin);

ErrorOr<int> value = ErrorOr<int>([](){
  return getUserCount(false);
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.