(t *testing.T)
| 38 | ) |
| 39 | |
| 40 | func TestRandomCodeCrash(t *testing.T) { |
| 41 | log.InitLog(4) |
| 42 | defer func() { |
| 43 | os.RemoveAll("Log") |
| 44 | }() |
| 45 | |
| 46 | config := &Config{ |
| 47 | Time: 10, |
| 48 | Height: 10, |
| 49 | Tx: &types.Transaction{}, |
| 50 | } |
| 51 | |
| 52 | var code []byte |
| 53 | defer func() { |
| 54 | if err := recover(); err != nil { |
| 55 | fmt.Printf("code %x \n", code) |
| 56 | } |
| 57 | }() |
| 58 | |
| 59 | for i := 1; i < 10; i++ { |
| 60 | fmt.Printf("test round:%d \n", i) |
| 61 | code := make([]byte, i) |
| 62 | for j := 0; j < 10; j++ { |
| 63 | rand.Read(code) |
| 64 | |
| 65 | sc := SmartContract{ |
| 66 | Config: config, |
| 67 | Gas: 10000, |
| 68 | CacheDB: nil, |
| 69 | } |
| 70 | engine, _ := sc.NewExecuteEngine(code, types.InvokeNeo) |
| 71 | engine.Invoke() |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestOpCodeDUP(t *testing.T) { |
| 77 | log.InitLog(4) |
nothing calls this directly
no test coverage detected