Git Product home page Git Product logo

ccffer's Introduction

ccffer

Go Reference

Overview

ccffer (Corner Case Faker Fuzzer) is

Installation

Supported Go Versions

Only supports Go v1.18 and higher.

License and Terms

ccffer is licensed under the MIT

ccffer's People

Contributors

khei4 avatar

Watchers

 avatar

ccffer's Issues

Review

気づいたことを書いていきます
文脈をわからずに書いているので、気に入ったら修正してもらえるといいと思います。

型のテーブルの形式

これで実際のGoの型が取れるか?
いちいちMatchをかくしかないのか

var TypeVals map[string][]string = map[string][]string{
	"bool":   {"true", "false"},
	"string": {"\"\""},
	"int":    {"0", "-(1 << 31) - 1", "1 << 31"},
	"int64":  {"0", "-(1 << 63) - 1", "1 << 63"},
	"uint":   {"0", "^uint(0)"},
	// TODO: import math library by formatting test
	// "float32": []string{"0", "math.NaN()", "math.Inf(0)", "math.Inf(-1)"},
}

関数定義, 構造体定義のリストを作る

とりあえず単一のソースの中にある関数の定義のリストと構造体定義のリストを作る

  • 普通の関数
package main

import (
	"fmt"
)

func SignleArg(a int) {
	fmt.Print(a)
}
func SignleRes() int {
	return 42
}
func NamedRes() (g int) {
	g = 42
	return
}

func main() {
	SignleArg(13)
	_ = SignleRes()
	_ = NamedRes()
}
  • 構造体と関数
package main

type (
	A struct {
		X int
	}
	B struct {
		Y int
	}
	C interface {
		C()
	}
)

func StructF(a A) B {
	return B{a.X}
}

func main() {
	_ = StructF(A{})
}
  • Genericな関数
package main

func SignleTypeParam[T any](a T) T {
	return a
}

func TypeConstraint1[T comparable](a, b T) bool {
	return a == b
}

func main() {
	SignleTypeParam("hoge")
	SignleTypeParam(13)
	TypeConstraint1(1, 2)
	TypeConstraint1("1,2", "2,3")
}

割り算関数を実行する

部分的なコードを実行したい時, ASTを取ってくるのが良いのか, それとも文字列を実行するのがいいのか

types.Eval()を使う

func main2() {
		fmt.Print("hello")
	}

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.