Coder Social home page Coder Social logo

time.localtime about c4go HOT 5 CLOSED

konstantin8105 avatar konstantin8105 commented on May 20, 2024
time.localtime

from c4go.

Comments (5)

Konstantin8105 avatar Konstantin8105 commented on May 20, 2024

How to run test for that issue:

go test -v -tags=integration -run=TestIntegrationScripts/tests/time.c
go test -v -run=TestCSTD

from c4go.

IngCr3at1on avatar IngCr3at1on commented on May 20, 2024

I was going to take a crack at this but it looks like the existing time tests fail which makes me skittish about adding anything.

=== RUN   TestIntegrationScripts
=== RUN   TestIntegrationScripts/tests/time.c
TAP: # Total tests: 0
--- FAIL: TestIntegrationScripts (0.64s)
    --- FAIL: TestIntegrationScripts/tests/time.c (0.64s)
        main_test.go:280: 
              Expect:
            `1..19
            # asctime
            1 ok - asctime(timeinfo) == "Thu Jan  1 22:13:20 1970\n"
            # ctime
            2 ok - s != NULL
            3 ok - s == "Fri Dec 31 HH:mm:58 1999\n"
            # gmtime
            4 ok - timeinfo->tm_sec == 20
            5 ok - timeinfo->tm_min == 13
            6 ok - timeinfo->tm_hour == 22
            7 ok - timeinfo->tm_mday == 1
            8 ok - timeinfo->tm_mon == 0
            9 ok - timeinfo->tm_year == 70
            10 ok - timeinfo->tm_wday == 4
            11 ok - timeinfo->tm_yday == 0
            12 ok - timeinfo->tm_isdst == 0
            # mktime
            13 ok - timeinfo.tm_wday == 6
            14 ok - timeinfo.tm_year == 100
            15 ok - timeinfo.tm_mon == 4
            16 ok - timeinfo.tm_mday == 20
            # time
            17 ok - now != 0
            18 ok - now != 0
            19 ok - now == tloc
            `
              Actial:
            `# command-line-arguments [command-line-arguments.test]
            build/tests/time/main_test.go:211:21: undefined: __int8_t
            `
            Parts of code:
            +========================+
            File : ./build/tests/time/main_test.go
            
            Line : 192  : // Warning (*ast.CStyleCastExpr):  $GOPATH/src/github.com/Konstantin8105/c4go/tests/time.c:72 :argument position is 3. Cannot transpileToExpr. err = Cannot transpileImplicitCastExpr. err = Cannot transpileToExpr. err = Not acceptable nil node
            Line : 193  : // Warning (*ast.CallExpr):  $GOPATH/src/github.com/Konstantin8105/c4go/tests/time.c:72 :Cannot transpileToStmt : Cannot transpileToExpr. err = Error in transpileCallExpr : name of call function is noarch.Printf. argument position is 3. Cannot transpileToExpr. err = Cannot transpileImplicitCastExpr. err = Cannot transpileToExpr. err = Not acceptable nil node
            Line : 194  : // Warning (*ast.ImplicitCastExpr):  $GOPATH/src/github.com/Konstantin8105/c4go/tests/time.c:79 :argument position is 0. Cannot transpileToExpr. err = Cannot transpileImplicitCastExpr. err = Cannot transpileToExpr. err = Not acceptable nil node
            Line : 195  : // Warning (*ast.BinaryOperator):  $GOPATH/src/github.com/Konstantin8105/c4go/tests/time.c:79 :Cannot transpile BinaryOperator with type 'struct tm *' : result type = {unknown53}. Error: operator is `=`. cannot atomic for right part. Cannot transpileToExpr. err = Error in transpileCallExpr : name of call function is noarch.Gmtime. argument position is 0. Cannot transpileToExpr. err = Cannot transpileImplicitCastExpr. err = Cannot transpileToExpr. err = Not acceptable nil node
            Line : 196  : // Warning (*ast.BinaryOperator):  $GOPATH/src/github.com/Konstantin8105/c4go/tests/time.c:79 :Cannot transpileToStmt : Cannot transpileToExpr. err = Cannot transpile BinaryOperator with type 'struct tm *' : result type = {unknown53}. Error: operator is `=`. cannot atomic for right part. Cannot transpileToExpr. err = Error in transpileCallExpr : name of call function is noarch.Gmtime. argument position is 0. Cannot transpileToExpr. err = Cannot transpileImplicitCastExpr. err = Cannot transpileToExpr. err = Not acceptable nil node
            Line : 197  : 
            Line : 198  : package main
            Line : 199  : 
            Line : 200  : import "io/ioutil"
            Line : 201  : import "testing"
            Line : 202  : import "os"
            Line : 203  : import "fmt"
            Line : 204  : import "math"
            Line : 205  : import "github.com/Konstantin8105/c4go/linux"
            Line : 206  : import "github.com/Konstantin8105/c4go/noarch"
            Line : 207  : 
            Line : 208  : type size_t uint32
            Line : 209  : type va_list int64
            Line : 210  : type __gnuc_va_list int64
            Line : 211 *: type __int_least8_t __int8_t
            Line : 212  : type __uint_least8_t __uint8_t
            Line : 213  : type __int_least16_t __int16_t
            Line : 214  : type __uint_least16_t uint16
            Line : 215  : type __int_least32_t __int32_t
            Line : 216  : type __uint_least32_t uint32
            
            
            *   1 "1..19"                                 "# command-line-arguments [command-line-arguments.test]"
            *   2 "# asctime"                             "build/tests/time/main_test.go:211:21: undefined: __int8_t"
            *   3 "1 ok - asctime(timeinfo) == \"Thu Jan  1 22:13:20 1970\\n\""""
            *   4 "# ctime"                               
            *   5 "2 ok - s != NULL"                      
            *   6 "3 ok - s == \"Fri Dec 31 HH:mm:58 1999\\n\""
            *   7 "# gmtime"                              
            *   8 "4 ok - timeinfo->tm_sec == 20"         
            *   9 "5 ok - timeinfo->tm_min == 13"         
            *  10 "6 ok - timeinfo->tm_hour == 22"        
            *  11 "7 ok - timeinfo->tm_mday == 1"         
            *  12 "8 ok - timeinfo->tm_mon == 0"          
            *  13 "9 ok - timeinfo->tm_year == 70"        
            *  14 "10 ok - timeinfo->tm_wday == 4"        
            *  15 "11 ok - timeinfo->tm_yday == 0"        
            *  16 "12 ok - timeinfo->tm_isdst == 0"       
            *  17 "# mktime"                              
            *  18 "13 ok - timeinfo.tm_wday == 6"         
            *  19 "14 ok - timeinfo.tm_year == 100"       
            *  20 "15 ok - timeinfo.tm_mon == 4"          
            *  21 "16 ok - timeinfo.tm_mday == 20"        
            *  22 "# time"                                
            *  23 "17 ok - now != 0"                      
            *  24 "18 ok - now != 0"                      
            *  25 "19 ok - now == tloc"                   
            *  26 ""                                      
FAIL
exit status 1
FAIL	github.com/Konstantin8105/c4go	0.644s

@Konstantin8105 do you know why the above errors might be occuring?

from c4go.

Konstantin8105 avatar Konstantin8105 commented on May 20, 2024

@IngCr3at1on , tests is ok by travis and my local laptop. Now, darwin(MacOS) is not supported. Could you clarify:

  • OS
  • golang version
  • clang version

from c4go.

IngCr3at1on avatar IngCr3at1on commented on May 20, 2024

Sure; Arch Linux, go version go1.11 linux/amd64, clang version 7.0.0

from c4go.

Konstantin8105 avatar Konstantin8105 commented on May 20, 2024

It is look very nice.
Now, we use clang 6.0 for testing. May be is the problem.

- env: SCRIPT=test CLANG=6.0

May be you have some specific implementation of glibc.

from c4go.

Related Issues (20)

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.