<commit_before>package mctest

import (
  "fmt"
  "net/http"
  "testing"
)

func TestInit(t *testing.T) {
  req, _ := http.NewRequest("GET", "/path/to/handler", nil)
  resp := NewMockTestResponse(t)
  go func(w http.ResponseWriter, r *http.Request) {

  }(resp, req)
  if !resp.AssertCode(-1) {
    t.Fatalf("Response StatusCode is %d asserted that it is %d", resp.StatusCode, -1)
  }
  if len(resp.Bytes()) != 0 {
    t.Fatalf("Expected response bytes to be 0 but they are %d", len(resp.Bytes()))
  }

}

func HomeHandler(w http.ResponseWriter, r *http.Request) {
  w.WriteHeader(200)
  fmt.Fprintf(w, "HomeHandler")
}

func TestHome(t *testing.T) {
  req, _ := http.NewRequest("GET", "/path/to/handler", nil)
  resp := NewMockTestResponse(t)
  HomeHandler(resp, req)
  b := "HomeHandler"
  if !resp.AssertCode(200) {
    t.Fatalf("Response StatusCode is %d asserted that it is %d", resp.StatusCode, 200)
  }
  if !resp.AssertBody(b) {
    t.Fatalf("Response body is %s asserted that it is %s", resp.String(), b)
  }
}

// TODO: Write some more complex bytes
func ByteHomeHandler(w http.ResponseWriter, r *http.Request) {
  w.WriteHeader(200)
  w.Write([]byte("HomeHandler"))
}
func TestByteHome(t *testing.T) {
  req, _ := http.NewRequest("GET", "/path/to/handler", nil)
  resp := NewMockTestResponse(t)
  ByteHomeHandler(resp, req)<commit_msg>Use constants<commit_after>package mctest

import (
  "fmt"
  "net/http"
  "testing"
)

func TestInit(t *testing.T) {
  req, _ := http.NewRequest("GET", "/path/to/handler", nil)
  resp := NewMockTestResponse(t)
  go func(w http.ResponseWriter, r *http.Request) {

  }(resp, req)
  if !resp.AssertCode(-1) {
    t.Fatalf("Response StatusCode is %d asserted that it is %d", resp.StatusCode, -1)
  }
  if len(resp.Bytes()) != 0 {
    t.Fatalf("Expected response bytes to be 0 but they are %d", len(resp.Bytes()))
  }

}

func HomeHandler(w http.ResponseWriter, r *http.Request) {
  w.WriteHeader(http.StatusOK)
  fmt.Fprintf(w, "HomeHandler")
}

func TestHome(t *testing.T) {
  req, _ := http.NewRequest("GET", "/path/to/handler", nil)
  resp := NewMockTestResponse(t)
  HomeHandler(resp, req)
  b := "HomeHandler"
  if !resp.AssertCode(http.StatusOK) {
    t.Fatalf("Response StatusCode is %d asserted that it is %d", resp.StatusCode, http.StatusOK)
  }
  if !resp.AssertBody(b) {
    t.Fatalf("Response body is %s asserted that it is %s", resp.String(), b)
  }
}

// TODO: Write some more complex bytes
func ByteHomeHandler(w http.ResponseWriter, r *http.Request) {
  w.WriteHeader(200)
  w.Write([]byte("HomeHandler"))
}
func TestByteHome(t *testing.T) {
  req, _ := http.NewRequest("GET", "/path/to/handler", nil)
  resp := NewMockTestResponse(t)
  ByteHomeHandler(resp, req)
{'fraction_non_alphanumeric': 0.16274797942689198, 'fraction_numerical': 0.008449669360764144, 'mean_word_length': 4.033271719038817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '561174', 'n_tokens_mistral': 1002, 'n_tokens_neox': 987, 'n_words': 240}